A command-line tool that automatically detects and tags Astro projects in your development directories using macOS Finder tags. This makes it easy to visually identify and filter your Astro projects in Finder.
- Automatically detects Astro projects by checking:
- presence of
astro.config.mjs
orastro.config.ts
- Astro dependencies in
package.json
- presence of
- Creates and applies macOS Finder tags
- Scans immediate subdirectories only (no deep recursion)
- Skips hidden directories
- Prevents duplicate tags
- Customizable tag name and color
- macOS (tested on Monterey and newer)
- Python 3.6+
- tag command line tool
- Clone this repository:
git clone https://github.com/dilantha/macos-astro-tagger.git
cd macos-astro-tagger
- Install the required
tag
command line tool:
brew install tag
- Make the script executable (optional):
chmod +x astro_tagger.py
Basic usage to tag all Astro projects in a directory:
python3 astro_tagger.py /path/to/your/projects
By default, this will:
- Create a purple "Astro" tag if it doesn't exist
- Scan all immediate subdirectories in the specified path
- Tag any Astro projects found with the "Astro" tag
You can specify a custom tag name and color:
python3 astro_tagger.py /path/to/projects "My Astro" Blue
Available colors:
- Red
- Orange
- Yellow
- Green
- Blue
- Purple
- Gray
Tag all projects in your web development directory:
python3 astro_tagger.py ~/www
Use a custom tag for client projects:
python3 astro_tagger.py ~/clients "Client Astro" Orange
The script:
- Creates the specified tag in Finder if it doesn't exist
- Scans the immediate subdirectories of the specified path
- Identifies Astro projects by checking for:
astro.config.mjs
orastro.config.ts
- Astro dependencies in
package.json
- Checks for existing tags to prevent duplicates
- Applies the tag to detected Astro projects
- Only works on macOS due to reliance on Finder tags
- Requires the
tag
command line tool - Only scans immediate subdirectories (not recursive)
- May require Finder permissions to manage tags
If you see "Warning: Failed to create tag", try:
- Open Finder
- Create the tag manually (Finder > Settings > Tags)
- Run the script again
If you encounter permission errors:
- Make sure the script has access to the directories you're scanning
- Check System Settings > Privacy & Security > Files and Folders
- Ensure Terminal/your IDE has proper permissions
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.
Created by Dilantha Nanayakkara