Phase 6: CLI (Typer)
Phase 6: The CLI
Objective
Two CLI tools that make the association graph usable from the terminal:
-
assoc— query, reverse, list, path, export, create (Typer-based Python CLI) -
assoc-link— create content AND associate it in one step (bash script)
What Was Built
assoc CLI (Python + Typer)
Registered as [project.scripts] in pyproject.toml. Reads YAML files directly — no server needed.
uv run assoc stats --data data/
{"keys": 385, "relations": 11, "edges": 610}
uv run assoc query CISSP --data data/
uv run assoc reverse remote-work --data data/
uv run assoc path CISSP consulting-practice --data data/
uv run assoc list --data data/
uv run assoc list --relations --data data/
uv run assoc new RHCSA enables linux-admin-career --data data/
uv run assoc export --data data/ | jq length
uv run assoc export --data data/ | jq '[.[] | select(.relation == "enables")]'
assoc-link Script (Bash)
Location: scripts/assoc-link.sh — bridges content creation and the knowledge graph.
assoc-link incident "DNS resolution failure" --relates-to bind-01 vyos-01 dns
Creating incident: INC-2026-04-07-dns-resolution-failure → Use /incident skill or domus-api POST to create the document → Creating associations... ✓ INC-2026-04-07-dns-resolution-failure --links-to--> bind-01 ✓ INC-2026-04-07-dns-resolution-failure --links-to--> vyos-01 ✓ INC-2026-04-07-dns-resolution-failure --links-to--> dns 3 associations created.
assoc-link project "Ollama RAG" --uses python ollama --depends-on domus-api --enables natural-language-queries
assoc-link codex bash traps --teaches error-handling bash-scripting
assoc-link note "yq !!null gotcha" --teaches yq yaml-gotchas
assoc-link link CISSP --blocks remote-work --enables security-career
Shell Alias Setup
Add to ~/.zshrc or a dots-quantum aliases file:
alias assoc-link='bash ~/atelier/_projects/personal/association-engine/scripts/assoc-link.sh'
Available Relations
| Relation | Inverse | Example |
|---|---|---|
|
|
domus-api --uses-→ fastapi |
|
|
python --enables-→ domus-api |
|
|
CISSP --requires-→ security-patterns |
|
|
CISSP --blocks-→ remote-work |
|
|
association-engine --depends-on-→ domus-api |
|
|
codex-bash --teaches-→ parameter-expansion |
|
|
INC-2026-04-06 --links-to-→ CR-2026-04-07 |
|
|
kvm-01 --contains-→ vault-01 |
|
|
domus-captures --produces-→ worklogs |
|
|
edu-cissp --tracks-→ CISSP |
|
|
DEPLOY-2026-03-07 --completes-→ ha-phase-3 |
The Daily Workflow
1. Start work on something
→ assoc query <thing> --data data/
→ See what it connects to, what depends on it
2. Create content (document, incident, project)
→ /incident "description" OR domus-api POST
→ assoc-link incident "description" --relates-to system1 system2
3. Complete something
→ assoc-link link DEPLOY-2026-04-08 --completes ha-phase-2 --enables dns-ha
4. Review / plan
→ assoc reverse python --data data/ (what depends on Python?)
→ assoc path CISSP consulting --data data/ (how does CISSP lead to consulting?)
→ assoc list --data data/ | grep STD (all standards in the graph)
Checklist
-
uv add typercompleted -
cli.pycreated with query, reverse, list, stats, path, new, export commands -
[project.scripts]entry in pyproject.toml -
Output is JSON — pipeable to jq
-
assoc-link.shscript — bridges content creation and associations -
5 modes: incident, project, codex, note, link
-
39 tests passing
-
610 edges across 9 YAML files
Verification
# CLI works
uv run assoc stats --data data/
# assoc-link works
bash scripts/assoc-link.sh link test-entity --enables test-target
# Tests pass
uv run --extra dev pytest tests/ -v
# Lint clean
uv run --extra dev ruff check src/