Automatic human-readable ID assignment for Asana tasks
Project description
Asana Auto-ID
Automatic human-readable ID assignment for Asana tasks and subtasks.
Overview
aa is a command-line tool that automatically assigns short, human-readable IDs to your Asana tasks. It adds prefixes like PRJ-5 or PRJ-5-1 to task names, making them easier to reference in discussions, documentation, and team communication.
Key Features:
- ๐ข Automatic ID assignment with hierarchical numbering
- ๐ Preserves existing IDs and detects conflicts
- ๐ณ Supports nested subtask hierarchies (e.g.,
PRJ-5-2-3) - ๐ Async processing for fast performance
- ๐ Dry-run mode to preview changes
- ๐ฆ Multiple project support from a single config
Installation
Prerequisites
- Python 3.12 or higher
- UV package manager
Install UV
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
Install aa
# Clone the repository
git clone <repository-url>
cd asana-tools
# Sync dependencies and install the command
uv sync
# Verify installation
uv run aa --help
Quick Start
1. Initialize Configuration
Run the interactive setup to create your configuration file:
uv run aa init
This will:
- Prompt for your Asana Personal Access Token (hidden input)
- Fetch all your active projects from Asana
- Create
.aa.ymlwith all projects and helpful comments
Alternative: Create a template manually:
uv run aa init --force
2. Scan Your Projects
Scan your projects to build the ID cache:
uv run aa scan
This creates .aa.cache.yaml with the current state of IDs in your projects.
3. Assign IDs
Preview what changes will be made:
uv run aa update --dry-run
Apply the changes:
uv run aa update
Usage
Commands
aa init
Initialize configuration file.
# Interactive mode (default) - fetches your projects
uv run aa init
# Create template file
uv run aa init --force
# Specify custom config path
uv run aa init --config my-config.yml
aa scan
Scan projects and update cache with existing IDs.
# Scan all projects
uv run aa scan
# Scan specific project
uv run aa scan --project PRJ
# Ignore conflicts and update cache anyway
uv run aa scan --ignore-conflicts
# Verbose output
uv run aa scan -v
# Very verbose (includes HTTP logs)
uv run aa scan -vv
aa update
Assign IDs to tasks without them.
# Preview changes (dry-run)
uv run aa update --dry-run
# Update all projects
uv run aa update
# Update specific project
uv run aa update --project PRJ
# Ignore conflicts during scan
uv run aa update --ignore-conflicts
# Verbose output
uv run aa update -v
Global Options
All commands support these global options:
--config TEXT- Path to config file (default:.aa.yml)-v, --verbose- Increase verbosity (use-vvfor debug level)--help- Show help message
Configuration Format
.aa.yml
The configuration file defines your Asana token and projects:
asana_token: 'your-personal-access-token'
interactive: false
projects:
# Project Name
# https://app.asana.com/0/1234567890
- code: PRJ # 2-5 uppercase letters
asana_id: '1234567890'
# Another Project
# https://app.asana.com/0/9876543210
- code: TSK
asana_id: '9876543210'
Fields:
asana_token(required) - Your Asana Personal Access Tokeninteractive(optional) - Set tofalseto disable interactive promptsprojects(required) - List of projects to managecode(required) - 2-5 uppercase letters, used as ID prefixasana_id(required) - Asana project ID (numeric string)
Getting Your Personal Access Token:
- Go to Asana Developer Console
- Click "Create new token"
- Copy the token and paste it in your config
Cache Format
.aa.cache.yaml
The cache file tracks the last assigned IDs for each project:
projects:
PRJ:
last_root: 42 # Last root task ID (PRJ-42)
subtasks:
'5': 3 # PRJ-5-3 is the last subtask of PRJ-5
'12': 7 # PRJ-12-7 is the last subtask of PRJ-12
'12-2': 4 # PRJ-12-2-4 is the last subtask of PRJ-12-2
TSK:
last_root: 15
subtasks: {}
Structure:
projects- Dictionary keyed by project codelast_root- Highest root task number assignedsubtasks- Dictionary mapping parent IDs to their last subtask number- Key format:
"5"for root task PRJ-5,"12-2"for subtask PRJ-12-2 - Value: Last subtask number assigned to that parent
- Key format:
Note: This file is automatically managed by aa scan and aa update. You typically don't need to edit it manually.
ID Format and Hierarchy
ID Structure
IDs follow a hierarchical pattern:
- Root tasks:
CODE-N(e.g.,PRJ-5) - Subtasks:
CODE-N-M(e.g.,PRJ-5-1) - Nested subtasks:
CODE-N-M-K(e.g.,PRJ-5-1-2) - Deeper nesting:
CODE-N-M-K-...(unlimited depth)
Where:
CODE= Project code (2-5 uppercase letters)N, M, K= Sequential numbers starting from 1
Example Hierarchy
PRJ-1: Implement authentication
โโโ PRJ-1-1: Design login flow
โโโ PRJ-1-2: Create user model
โ โโโ PRJ-1-2-1: Add validation
โ โโโ PRJ-1-2-2: Write tests
โโโ PRJ-1-3: Build API endpoints
PRJ-2: Setup CI/CD
โโโ PRJ-2-1: Configure GitHub Actions
โโโ PRJ-2-2: Add deployment scripts
PRJ-3: Documentation
How IDs Are Assigned
- Root tasks get sequential numbers:
PRJ-1,PRJ-2,PRJ-3, ... - Subtasks inherit parent ID and add their own number:
PRJ-1-1,PRJ-1-2, ... - Nested subtasks continue the pattern:
PRJ-1-2-1,PRJ-1-2-2, ... - Existing IDs are preserved - tasks with IDs are skipped
- Counters are tracked in the cache to ensure no duplicates
Task Name Format
IDs are prepended to task names:
Before: "Implement user authentication"
After: "PRJ-5 Implement user authentication"
Before: "Add validation"
After: "PRJ-5-2 Add validation"
Workflow
Typical Workflow
-
Initial Setup
uv run aa init # Create config with your projects uv run aa scan # Build initial cache uv run aa update --dry-run # Preview changes uv run aa update # Apply IDs
-
Regular Usage
# When you add new tasks in Asana: uv run aa update # Assign IDs to new tasks
-
Adding New Projects
- Edit
.aa.ymlto add the new project - Run
uv run aa scan --project NEWto initialize cache - Run
uv run aa update --project NEWto assign IDs
- Edit
Conflict Handling
What is a conflict?
- An ID exists in Asana that's higher than the cached value
- Duplicate IDs found in different tasks
When conflicts occur:
# Default: scan/update stops with an error
uv run aa scan
# Error: Conflict detected! Task "PRJ-50" found but cache shows last_root: 42
# Option 1: Fix manually (update cache or rename tasks)
# Option 2: Ignore and update cache to match Asana
uv run aa scan --ignore-conflicts
Best practice: Investigate conflicts before using --ignore-conflicts to ensure no IDs were assigned outside of aa.
Advanced Usage
Multiple Projects
Process all projects at once:
uv run aa update
Process specific project:
uv run aa update --project PRJ
Custom Config Location
uv run aa --config ~/my-configs/asana.yml scan
uv run aa --config ~/my-configs/asana.yml update
Debugging
Enable verbose logging:
# INFO level
uv run aa scan -v
# DEBUG level (includes HTTP requests)
uv run aa scan -vv
Dry-Run Mode
Always preview changes before applying:
uv run aa update --dry-run
This shows:
- Which tasks will get IDs
- What the new names will be
- No changes are made to Asana or cache
Troubleshooting
"Config file not found"
Make sure you've run uv run aa init or created .aa.yml manually.
"Invalid token" or 401 errors
Your Asana token may be expired or invalid. Generate a new token and update .aa.yml.
"Conflict detected"
Someone may have manually added IDs or the cache is out of sync. Options:
- Review the conflicting tasks in Asana
- Update the cache manually if needed
- Use
--ignore-conflictsto auto-update cache
Tasks not getting IDs
Check that:
- Tasks don't already have IDs (they're skipped)
- You're running
update, not justscan - You're not in
--dry-runmode
Rate limiting
Asana API has rate limits (1500 requests/minute). The tool includes automatic retry logic with exponential backoff.
Development
Project Structure
asana-tools/
โโโ aa/
โ โโโ __init__.py
โ โโโ __main__.py
โ โโโ cli.py # Main CLI entry point
โ โโโ commands/ # CLI commands
โ โ โโโ init.py
โ โ โโโ scan.py
โ โ โโโ update.py
โ โโโ core/ # Business logic
โ โ โโโ asana_client.py
โ โ โโโ id_manager.py
โ โ โโโ task_processor.py
โ โโโ models/ # Data models
โ โ โโโ config.py
โ โ โโโ cache.py
โ โ โโโ task.py
โ โโโ utils/ # Utilities
โ โโโ config_loader.py
โ โโโ cache_manager.py
โโโ .aa.yml # Config file (gitignored)
โโโ .aa.cache.yaml # Cache file (gitignored)
โโโ pyproject.toml # Project metadata
โโโ README.md
Running Tests
# Install dev dependencies
uv sync
# Run tests
uv run pytest
# Run with coverage
uv run pytest --cov=aa
Adding Dependencies
uv add <package-name>
License
[Your License Here]
Contributing
[Your Contributing Guidelines Here]
Support
For issues and questions:
- Open an issue on GitHub
- Check existing issues for solutions
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aa_cli-0.2.0.tar.gz.
File metadata
- Download URL: aa_cli-0.2.0.tar.gz
- Upload date:
- Size: 59.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
381060c3f1734f41d3ae98a16beb9dbc8cf7e07c67271b513db0f589a0c579db
|
|
| MD5 |
8de8d32f18e3f8f8d6a0cbca652e778f
|
|
| BLAKE2b-256 |
680a0e9f35afb048c301119bb6a7a7cd42f2a0417a59865cd26d027183d7c939
|
File details
Details for the file aa_cli-0.2.0-py3-none-any.whl.
File metadata
- Download URL: aa_cli-0.2.0-py3-none-any.whl
- Upload date:
- Size: 30.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6268c7c377552d3015dcaf9f2cfe4605ab0960e99accbd2420e92de8e273f47
|
|
| MD5 |
3737fbeaaa199863f05b7146df78d19a
|
|
| BLAKE2b-256 |
1b4a2d9fd528b2628b842ab06e4efaea8764c87dfa92d8c13ced140234e15e14
|