A small Zsh productivity tool for repetitive Anaconda package-maintenance work. It keeps ticket workspaces and metadata together, remembers the active ticket, navigates to related feedstocks, and invokes the configured refinement and feedstock tools with their expected arguments.
The production workflow is entirely Zsh. Python is used only to test the real Zsh implementation in isolated temporary directories.
- Create, register, edit, switch, list, and purge ticket workspaces.
- Restore the active ticket when a new shell sources the script.
- Navigate independently between ticket workspaces, the aggregate repository, and package feedstock repositories.
- Run the refinement and feedstock tools through stable wrapper commands.
- Store state in a small human-readable TSV registry.
- Zsh.
- Conda initialized in the interactive shell when running internal tools.
- Access to the refinement and feedstock executables and the refinement support/configuration paths used by your team.
- Python 3.10 or newer and pytest for development and validation.
Clone or copy the repository to a stable location, then source the production
script from .zshrc after the Conda initialization block:
source "$HOME/.config/anaconda-ticket-workflow/ticket-workflow.zsh"Configuration exports must appear before that line. Restart Zsh or source the file directly after making changes:
zsh -n "$HOME/.config/anaconda-ticket-workflow/ticket-workflow.zsh"
source "$HOME/.config/anaconda-ticket-workflow/ticket-workflow.zsh"Sourcing creates the configured ticket and state directories when necessary, then silently restores the last valid active ticket. It does not change the current directory, activate Conda, or invoke either internal tool.
Environment variables are the public configuration interface. Set them before
sourcing the script. Standard Zsh expressions such as $HOME expand when the
export statement is evaluated; the workflow consumes the resulting value
verbatim and never uses eval to reinterpret path text.
| Variable | Required when | Default |
|---|---|---|
TICKET_WORKFLOW_AGGREGATE_DIR |
ticket init, cd_feedstock, or cd_aggregate |
None |
TICKET_WORKFLOW_TICKETS_DIR |
Always available | $HOME/Workspace/tickets |
TICKET_WORKFLOW_STATE_DIR |
Always available | ${XDG_STATE_HOME:-$HOME/.local/state}/anaconda-ticket-workflow |
TICKET_WORKFLOW_REFINEMENT_TOOL |
Refinement runs | None |
TICKET_WORKFLOW_FEEDSTOCK_TOOL |
Feedstock tooling runs | None |
TICKET_WORKFLOW_REFINEMENT_SUPPORT_DIR |
Refinement runs | None |
TICKET_WORKFLOW_REFINEMENT_CONFIG |
Refinement runs | None |
TICKET_WORKFLOW_CONDA_ENV |
Internal tools run | dev |
For example:
export TICKET_WORKFLOW_AGGREGATE_DIR="$HOME/Workspace/aggregate"
export TICKET_WORKFLOW_TICKETS_DIR="$HOME/Workspace/tickets"
export TICKET_WORKFLOW_STATE_DIR="$HOME/.local/state/anaconda-ticket-workflow"
export TICKET_WORKFLOW_REFINEMENT_TOOL="/path/to/refinement-tool"
export TICKET_WORKFLOW_FEEDSTOCK_TOOL="/path/to/feedstock-tool"
export TICKET_WORKFLOW_REFINEMENT_SUPPORT_DIR="/path/to/refinement-support"
export TICKET_WORKFLOW_REFINEMENT_CONFIG="/path/to/refinement.ini"
export TICKET_WORKFLOW_CONDA_ENV="dev"A copyable placeholder template is available at
examples/ticket-workflow.env.example.
The legacy runtime globals such as AGGREGATE_ROOT, TICKET_WORKSPACE_ROOT,
and TICKET_STATE_DIR remain available for shell compatibility, but should not
be used as the configuration interface.
For an existing installation, set the new variables to the locations already
in use before sourcing this version. Registry records and state files are read
without migration, and existing ticket directories are not moved. In
particular, keep TICKET_WORKFLOW_TICKETS_DIR aligned with the parent directory
recorded for existing ticket workspaces.
| Command | Purpose |
|---|---|
ticket init <ticket-id> <package-name> <package-version> |
Create and activate a ticket workspace, then run both tools. Must start in the aggregate directory. |
ticket edit [<current-ticket-id>] [--ticket-id <new-id>] [--package-name <new-name>] [--version <new-version>] |
Update a registry record and rename its ticket workspace. Without an ID, edit the active ticket. |
ticket switch <ticket-id> |
Make a registered ticket active without changing directory. |
ticket list |
List registered tickets and mark the active one. |
ticket current |
Show the active ticket and exported variables. |
ticket run |
Run both configured tools for the active ticket. |
ticket purge |
Permanently reset managed workspaces and state after typing PURGE. |
ticket help, ticket -h, ticket --help |
Show compact terminal help. |
The current ticket ID for ticket edit, when supplied, must be the first
argument after edit. Options cannot precede it.
cd_ticket [ticket-id]changes to a registered ticket workspace. An explicit ID does not change the active ticket.cd_feedstock [package-name]changes to<package-name>-feedstockunder the aggregate. Without a name, it uses the active ticket's package.cd_aggregatechanges to the configured aggregate repository.refinement_tool <ticket-id> <package-name>runs the configured refinement executable.feedstock_tool <ticket-id>runs the configured feedstock executable.
Ticket workspaces and feedstock repositories are separate. In particular,
ticket edit only renames the managed ticket workspace. It never discovers,
validates, renames, moves, or modifies a feedstock repository, and it does not
activate Conda or run internal tools.
The identifiers below are fictional placeholders:
cd_aggregate
ticket init EXAMPLE-100 configspace 1.2.2
ticket current
cd_ticket
cd_feedstock
ticket edit --version 1.2.3
ticket run
ticket switch EXAMPLE-101
ticket purgeThe state directory contains:
tickets.tsv # ticket ID, package, version, and workspace path
active-ticket # active ticket ID
registry.lock # temporary mutation lock; normally absent
The active record is exported as TI (ticket ID), PN (package name), PV
(package version), and TD (ticket directory). State-only commands and
cd_ticket do not require aggregate or internal-tool configuration.
Install the test dependency into the active development environment and run pytest:
python -m pip install -e '.[test]'
python -m pytest
zsh -n ticket-workflow.zshTests launch real zsh -f subprocesses, source ticket-workflow.zsh, and use
only temporary homes, state directories, workspaces, and mock executables. See
CONTRIBUTING.md before changing public behavior.
ticket purgepermanently removes the configured ticket workspace and state roots. It rejects broad, overlapping, aggregate, symlinked, or inconsistent targets and requires exact interactive confirmation.- Internal tool access and the expected Conda environment are organization- specific and are not included in this repository.
ticket initregisters and activates the workspace before running tools. A later tool failure does not remove the created ticket.- Real interactive Ctrl+C behavior and integration with production internal tools may require manual verification.
While the script is still loaded, run ticket purge if you intentionally want
to delete all managed ticket workspaces and persistent state. Then remove the
source line and configuration exports from .zshrc, start a new shell, and
delete the copied repository. Skip ticket purge if the workspace data should
be retained.