{"id":21890065,"url":"https://github.com/ejfox/cli-markdown-tagger","last_synced_at":"2026-04-20T05:04:18.559Z","repository":{"id":264513377,"uuid":"860117081","full_name":"ejfox/cli-markdown-tagger","owner":"ejfox","description":"Use an LLM to add tags to your markdown's frontmatter","archived":false,"fork":false,"pushed_at":"2024-11-24T19:04:31.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-19T20:05:32.617Z","etag":null,"topics":["cli","llm","markdown"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ejfox.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-19T21:13:31.000Z","updated_at":"2024-11-24T19:04:34.000Z","dependencies_parsed_at":"2024-11-24T20:19:08.524Z","dependency_job_id":"61fde372-1816-48d3-b60a-e1a719496dac","html_url":"https://github.com/ejfox/cli-markdown-tagger","commit_stats":null,"previous_names":["ejfox/cli-markdown-tagger"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ejfox%2Fcli-markdown-tagger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ejfox%2Fcli-markdown-tagger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ejfox%2Fcli-markdown-tagger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ejfox%2Fcli-markdown-tagger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ejfox","download_url":"https://codeload.github.com/ejfox/cli-markdown-tagger/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244898409,"owners_count":20528335,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","llm","markdown"],"created_at":"2024-11-28T11:28:33.534Z","updated_at":"2026-04-20T05:04:18.527Z","avatar_url":"https://github.com/ejfox.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Markdown Tag Updater CLI Tool\n\nThis CLI tool automatically updates tags in the frontmatter of markdown files using AI-powered suggestions. It fetches a list of allowed tags from a specified URL and uses the OpenRouter API to suggest relevant tags based on the content of the markdown file.\n\n\u003cimg width=\"842\" alt=\"Screenshot 2024-09-19 at 5 17 38 PM\" src=\"https://github.com/user-attachments/assets/e9651286-e7bd-4edc-9245-900bb176283d\"\u003e\n\n\n## Features\n\n- Fetches allowed tags from a specified URL\n- Uses AI (via OpenRouter API) to suggest relevant tags based on file content\n- Updates markdown frontmatter with suggested tags\n- Supports custom OpenRouter models\n- Preserves existing tags\n\n## Prerequisites\n\n- Node.js (v12 or higher recommended)\n- npm (comes with Node.js)\n- OpenRouter API key\n\n## API Key Setup\n\nTo use this tool, you need an API key from OpenRouter. Follow these steps to obtain and set up your API key:\n\n1. Go to [https://openrouter.ai/settings/keys](https://openrouter.ai/settings/keys)\n2. If you don't have an account, create one and log in\n3. Generate a new API key\n\nOnce you have your API key, you need to set it as an environment variable. Here's how to do it on macOS/Linux:\n\n1. Open your `.zshrc` file in your preferred text editor. We recommend using nvim or VSCode:\n   ```\n   nvim ~/.zshrc\n   ```\n   or\n   ```\n   code ~/.zshrc\n   ```\n\n2. Add the following lines at the end of the file:\n   ```zsh\n   export OPENROUTER_API_KEY=\"your_api_key_here\"\n   export OPENROUTER_BASE_URL=\"https://openrouter.ai/api/v1\"\n   ```\n   Replace \"your_api_key_here\" with your actual API key.\n\n3. Save the file and exit the editor.\n\n4. Apply the changes by running:\n   ```\n   source ~/.zshrc\n   ```\n\n5. Verify that the variables are set correctly:\n   ```\n   echo $OPENROUTER_API_KEY\n   echo $OPENROUTER_BASE_URL\n   ```\n   These commands should print your API key and the base URL respectively.\n\nAfter setting up your API key, restart your terminal for the changes to take full effect. If you're using the tool in an already open terminal, remember to run `source ~/.zshrc` or start a new terminal session.\n\n## Installation\n\n1. Clone this repository or download the script:\n\n   ```\n   git clone https://github.com/yourusername/markdown-tag-updater.git\n   cd markdown-tag-updater\n   ```\n\n2. Install the required dependencies:\n\n   ```\n   npm install yargs gray-matter axios openai dotenv\n   ```\n\n3. Create a `.env` file in the project root and add your OpenRouter API key:\n\n   ```\n   OPENROUTER_API_KEY=your_api_key_here\n   ```\n\n## Usage\n\nBasic usage:\n\n```\nnode markdown-tag-updater.js -f path/to/your/markdown/file.md\n```\n\nSpecify a custom tags URL:\n\n```\nnode markdown-tag-updater.js -f path/to/your/markdown/file.md -u https://example.com/custom-tags.json\n```\n\nUse a different OpenRouter model:\n\n```\nnode markdown-tag-updater.js -f path/to/your/markdown/file.md -m anthropic/claude-2\n```\n\n### Options\n\n- `-f, --file`: Path to the markdown file (required)\n- `-u, --tags-url`: URL of the JSON file containing tags (default: https://ejfox.com/tags.json)\n- `-m, --model`: OpenRouter model to use (default: openai/gpt-3.5-turbo)\n- `-h, --help`: Show help information\n\n## How it Works\n\n1. The tool reads the specified markdown file.\n2. It fetches the list of allowed tags from the specified URL.\n3. The content of the markdown file is sent to the OpenRouter API along with the list of allowed tags.\n4. The API suggests relevant tags based on the content.\n5. The tool updates the frontmatter of the markdown file with the suggested tags, preserving any existing tags.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fejfox%2Fcli-markdown-tagger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fejfox%2Fcli-markdown-tagger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fejfox%2Fcli-markdown-tagger/lists"}