Tools
Supercharge Your Workflow
At Collected Notes, we believe in giving users control and flexibility to manage their content. The Collected Notes CLI Tools allow you to interact with the Collected Notes API directly from your command line. Whether you're a developer looking to automate workflows or a power user wanting to streamline note management, these tools in Go, JavaScript (TypeScript), and Rust will get the job done.
In this post, we'll give you a quick overview of these tools, examples of how they can be used, and a simple guide to getting started.
Why Use CLI Tools?
Using the Collected Notes CLI tools allows you to:
- Retrieve and manage site information
- Create, update, and delete notes
- Perform advanced operations like searching notes and exporting content
These tools are designed to make note management faster and more efficient, especially for developers or those who prefer working from the command line.
Available CLI Tools
Collected Notes offers CLI tools in Go, JavaScript (TypeScript), and Rust, giving you the flexibility to choose the language that best fits your needs. For this post, we'll focus on a few examples using the JavaScript (TypeScript) CLI Tool, which is easy to integrate into existing Node.js projects.
What Can You Build with the Collected Notes CLI?
The possibilities are endless! Here are some real-world use cases:
-
Automated Content Publishing: Use the CLI to publish notes or blog posts on a schedule using a cron job.
-
Content Backup: Create a script to periodically export all your notes as Markdown or HTML and back them up.
-
Custom Frontend: Fetch and display your notes dynamically on a custom website using the CLI.
-
Advanced Note Search: Build a tool for searching notes across multiple sites and organizing them based on relevance.
Quick Start Guide for the JavaScript CLI Tool
Let’s walk through setting up the JavaScript CLI Tool to fetch and create notes.
Step 1: Install and Set Up the Tool
Start by cloning the repository and installing the dependencies:
git clone https://github.com/Collected-Notes/tools
cd tools/javascript/cli
npm install
npx tsc
Step 2: Set Up Your API Token
To use the CLI tools, you need an API token from Collected Notes. You can generate one by visiting the API page.
After generating your API token, store it in a .collected-notes
file in your home directory:
echo "your-api-token" > ~/.collected-notes
Replace your-api-token
with the actual token you generated from the API page.
Step 3: Fetch All Sites
Once you have the CLI set up, you can start interacting with your Collected Notes account. For example, to fetch all the sites associated with your account, use this command:
node dist/index.js get-sites
Step 4: Create a New Note
You can also create a new public note on one of your sites:
node dist/index.js create-note <site_path> "This is a new note!" public
Replace <site_path>
with the actual path of your site. This command creates a new note with the body "This is a new note!" and sets it to public visibility.
Conclusion
The Collected Notes CLI tools provide a powerful and efficient way to manage your sites and notes programmatically. Whether you want to automate publishing, back up content, or integrate notes into a custom project, the CLI tools have you covered.
Start using the tools today and explore the full potential of Collected Notes for your workflow. For more information, check out the GitHub repository.