This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
See @README.md for usage documentation. Run tk help for command reference. Always update the README.md usage content when adding/changing commands and flags.
Core script: Single-file bash implementation (ticket, ~1000 lines). Uses awk for performant bulk operations on large ticket sets.
Key functions:
generate_id()- Creates IDs from directory name prefix + random suffixticket_path()- Resolves partial IDs to full file pathsyaml_field()/update_yaml_field()- YAML frontmatter manipulation via sedcmd_*()- Command handlerscmd_ready(),cmd_blocked(),cmd_ls()- awk-based bulk listing with sorting
Dependencies: bash, sed, awk, find. Optional: ripgrep (faster grep).
Plugin system: Commands can be extended via external executables in PATH.
tk foochecks fortk-foothenticket-fooin PATHtk super foobypasses plugins, runs built-in directly- Plugins receive
TICKETS_DIRandTK_SCRIPTenvironment variables - See
plugins/README.mdfor full conventions
plugins/
├── README.md # Plugin conventions documentation
├── ticket-query # Extracted from core (requires jq)
├── ticket-migrate-beads # Extracted from core (requires jq)
└── ...
pkg/
├── extras.txt # Curated list for ticket-extras meta-package
└── aur/ # PKGBUILD templates
Plugins in this repo use ticket- prefix (matching the script name). Both tk-* and ticket-* work at runtime.
Required metadata in first 10 lines:
#!/usr/bin/env bash
# tk-plugin: Short description for tk help
# tk-plugin-version: 1.0.0When moving a command from core to a plugin:
- Create
plugins/ticket-<name>with the extracted logic - Add metadata comments (
tk-plugin:,tk-plugin-version:) - Remove
cmd_<name>()from core script - Remove from dispatch case statement
- Add
<name>topkg/extras.txt - Update CHANGELOG.md (see below)
- Update README.md usage section
For new functionality (not extracted from core):
- Create
plugins/ticket-<name> - Add metadata comments
- Do NOT add to
pkg/extras.txt(only core extractions go there) - Document in plugins/README.md if it's an official plugin
BDD tests using Behave. Run with make test (requires uv).
- Feature files:
features/*.feature- Gherkin scenarios covering all commands - Step definitions:
features/steps/ticket_steps.py - CI runs tests on push to master and all PRs
When adding new commands or flags, add corresponding scenarios to the appropriate feature file.
Update CHANGELOG.md when committing notable changes:
- New commands, flags, bug fixes, behavior changes
- Add under appropriate heading (Added, Fixed, Changed, Removed)
- Add a
### Pluginssubsection when plugins are added/modified - Format:
- ticket-<name> <version>: <change description>
Example:
## [Unreleased]
### Added
- New `foo` command
### Plugins
- ticket-query 1.1.0: Added --format flag
- ticket-migrate-beads 1.0.1: Fixed date parsing- Documentation-only changes
- CI/workflow changes (unless they affect user-facing behavior)
Three meta-packages plus individual plugin packages:
ticket- Full installation (depends on ticket-core + ticket-extras)ticket-core- Core script only, no pluginsticket-extras- Curated plugins extracted from core (listed inpkg/extras.txt)ticket-<name>- Individual plugin packages
Users can mix and match:
brew install ticket # Everything
brew install ticket-core # Minimal
brew install ticket-core ticket-query # Core + specific plugin- Update CHANGELOG.md: change
## [Unreleased]to version + date - Commit and tag:
git commit -am "release: v0.4.0" git tag v0.4.0 git push && git push origin v0.4.0
The release workflow (.github/workflows/release.yml) automatically:
- Creates GitHub release with changelog body
- Runs
scripts/publish-homebrew.sh- updates all formulas in tap - Runs
scripts/publish-aur.sh- updates all AUR packages
Plugins are only published if their tk-plugin-version changed (identical PKGBUILDs result in no-op pushes).
- Homebrew:
wedow/homebrew-toolstap - AUR: Individual repos at
aur.archlinux.org/<pkgname>.git
Both are updated automatically by CI. AUR repos are created on first push if they don't exist.