|
| 1 | +# Justfile Restructure Plan |
| 2 | + |
| 3 | +## Goal |
| 4 | + |
| 5 | +Reduce the justfile from ~93 recipes / 1212 lines to ~25 recipes / ~300 lines. Delete everything replaced by the agents CLI, delete TODO stubs, keep only what the CLI doesn't cover. |
| 6 | + |
| 7 | +## Recipe Inventory |
| 8 | + |
| 9 | +### KEEP — Root recipes (no group change) |
| 10 | + |
| 11 | +| Recipe | Lines | Why Keep | |
| 12 | +|--------|-------|----------| |
| 13 | +| `default` | 4-5 | Just `--list` | |
| 14 | +| `agents *args` | 16-17 | CLI entry point | |
| 15 | +| `matrixng *args` | 20-22 | Viewer CLI entry point | |
| 16 | + |
| 17 | +### KEEP — Install group |
| 18 | + |
| 19 | +| Recipe | Lines | Why Keep | |
| 20 | +|--------|-------|----------| |
| 21 | +| `init` | 31 | Orchestrates all `_init-*` private recipes — no CLI equivalent | |
| 22 | +| `_init-brew` | 35-37 | Homebrew deps | |
| 23 | +| `_init-pre-commit` | 40-42 | Pre-commit hooks | |
| 24 | +| `_init-bun` | 45-47 | Bun workspace install | |
| 25 | +| `_init-python` | 50-52 | uv sync | |
| 26 | +| `_init-docker` | 55 | Calls `mcp-up` | |
| 27 | +| `_init-ollama` | 58-66 | Ollama model pull | |
| 28 | +| `_init-db` | 69-71 | Calls `kg-init` | |
| 29 | +| `install target='all'` | 93-95 | Symlink management to `~/.claude/` — unique, not in CLI | |
| 30 | +| `_install-*` | 97-152 | Private helpers for install | |
| 31 | +| `uninstall target='all'` | 155-157 | Reverse of install | |
| 32 | +| `_uninstall-*` | 159-177 | Private helpers for uninstall | |
| 33 | +| `list-claude` | 180-189 | List installed components in `~/.claude/` | |
| 34 | + |
| 35 | +### KEEP — Docker group |
| 36 | + |
| 37 | +| Recipe | Lines | Why Keep | |
| 38 | +|--------|-------|----------| |
| 39 | +| `mcp-up` | 75-78 | Docker compose up | |
| 40 | +| `mcp-down` | 81-82 | Docker compose down | |
| 41 | +| `mcp-logs` | 85-86 | Docker compose logs | |
| 42 | +| `mcp-status` | 89-90 | Docker compose ps | |
| 43 | + |
| 44 | +### KEEP — KG group (Python-based, not in agents CLI) |
| 45 | + |
| 46 | +| Recipe | Lines | Why Keep | |
| 47 | +|--------|-------|----------| |
| 48 | +| `kg-init` | 1094-1095 | Python init-db.py | |
| 49 | +| `kg-ingest` | 1099-1100 | Python embed.py ingest | |
| 50 | +| `kg-search query` | 1109-1110 | Python embed.py search | |
| 51 | +| `kg-watch` | 1124-1125 | Python watch-embed.py | |
| 52 | +| `kg-dump` | 1129-1130 | Python init-db.py --dump | |
| 53 | +| `kg-load` | 1133-1135 | Python init-db.py --load | |
| 54 | +| `kg-rebuild` | 1150-1157 | Orchestrator: rm db + init + ingest + similarity + dump | |
| 55 | + |
| 56 | +Note: `kg-check`, `kg-similar`, `kg-rebuild-embeddings`, `kg-stats` are available via `just agents kg <subcommand>`. Keep `kg-similarity` because `kg-rebuild` calls it. Keep only the ones CLAUDE.md references or that `_init-db` / `kg-rebuild` depends on. |
| 57 | + |
| 58 | +### DELETE — Replaced by agents CLI |
| 59 | + |
| 60 | +| Recipe | Lines | CLI Replacement | |
| 61 | +|--------|-------|-----------------| |
| 62 | +| `ls-tags` | 100-101 | `agents list --type skill --tags` | |
| 63 | +| `create-skill` | 466-511 | `agents init --type skill <name>` | |
| 64 | +| `validate-skill` | 514-571 | `agents lint --type skill <path>` | |
| 65 | +| `list-skills` | 575-593 | `agents list --type skill` | |
| 66 | +| `validate-all-skills` | 597-620 | `agents lint --type skill --all` | |
| 67 | +| `validate-pillars` | 624-715 | `agents lint --type skill <name> --pillars` | |
| 68 | +| `validate-all-lang-skills` | 719-763 | `agents lint --type skill --all --pillars` | |
| 69 | +| `import-and-normalize` | 767-778 | `agents add --type skill <repo>` | |
| 70 | +| `install-plugin` | 783-802 | `agents add --type plugin <name>` | |
| 71 | +| `build-plugin` | 806-843 | `agents plugin build <name>` | |
| 72 | +| `uninstall-plugin` | 847-859 | `agents remove --type plugin <name>` | |
| 73 | +| `check-plugin-sources` | 863-875 | `agents plugin check <name>` | |
| 74 | +| `list-plugins` | 879-888 | `agents list --type plugin` | |
| 75 | +| `add-feedback-infra` | 892-984 | Not in CLI yet, but rarely used — delete | |
| 76 | +| `add-feedback-infra-all` | 988-1002 | Delete | |
| 77 | +| `plugin-hash` | 1006-1007 | `agents plugin hash <path>` | |
| 78 | +| `plugin-hash-verify` | 1011-1012 | `agents plugin hash <path> --verify <expected>` | |
| 79 | +| `plugin-verify-sources` | 1016-1024 | `agents plugin check <name>` | |
| 80 | +| `plugin-check` | 1028-1037 | `agents lint --type plugin <name>` | |
| 81 | +| `plugin-update` | 1041-1058 | `agents plugin update <name>` | |
| 82 | +| `plugin-check-all` | 1062-1063 | `agents lint --type plugin --all` | |
| 83 | +| `plugin-build-all` | 1067-1068 | `agents plugin build --all` | |
| 84 | +| `plugin-update-all` | 1072-1073 | `agents plugin update --all` | |
| 85 | +| `migrate-check` | 1077-1078 | One-time migration, already done | |
| 86 | +| `migrate-plugin` | 1082-1083 | One-time migration, already done | |
| 87 | +| `migrate-all-plugins` | 1087-1088 | One-time migration, already done | |
| 88 | +| `mcp-stats` | 1161-1162 | `agents mcp stats` | |
| 89 | +| `mcp-search` | 1165-1166 | `agents mcp search <query>` | |
| 90 | +| `mcp-list` | 1169-1170 | `agents mcp list` | |
| 91 | +| `mcp-show` | 1173-1174 | `agents mcp show <slug>` | |
| 92 | +| `mcp-tools` | 1177-1178 | `agents mcp tools <slug>` | |
| 93 | +| `list-external-skills` | 281-294 | `agents list --type skill --external` | |
| 94 | +| `search-skills` | 298-314 | `agents search --type skill <query>` | |
| 95 | +| `import-skill` | 318-375 | `agents add --type skill <repo>` | |
| 96 | +| `import-skill-by-name` | 379-408 | `agents add --type skill <name>` | |
| 97 | +| `list-registries` | 412-417 | `agents registry list` | |
| 98 | +| `external-version` | 421-422 | `agents info --type skill <name>` | |
| 99 | +| `check-external-updates` | 426-458 | `agents update --type skill --check` | |
| 100 | +| `sync-anthropic-skills` | 202-249 | `agents update --type skill --upstream` | |
| 101 | +| `check-anthropic-updates` | 253-267 | `agents update --type skill --upstream --check` | |
| 102 | +| `anthropic-version` | 271-272 | `agents info --type skill --upstream` | |
| 103 | + |
| 104 | +### DELETE — Unused KG recipes (available via agents kg subcommand) |
| 105 | + |
| 106 | +| Recipe | Lines | CLI Replacement | |
| 107 | +|--------|-------|-----------------| |
| 108 | +| `kg-check` | 1104-1105 | `agents kg check` | |
| 109 | +| `kg-similar` | 1114-1115 | `agents kg similar <entity>` | |
| 110 | +| `kg-similarity` | 1119-1120 | `agents kg similarity` — BUT `kg-rebuild` calls it. Inline the call in `kg-rebuild` instead. | |
| 111 | +| `kg-rebuild-embeddings` | 1139-1141 | `agents kg rebuild-embeddings` | |
| 112 | +| `kg-stats` | 1145-1146 | `agents kg stats` | |
| 113 | + |
| 114 | +### DELETE — TODO stubs |
| 115 | + |
| 116 | +| Recipe | Lines | Why Delete | |
| 117 | +|--------|-------|------------| |
| 118 | +| `opencode` | 1180-1181 | Empty stub | |
| 119 | +| `zed` | 1183-1184 | Empty stub | |
| 120 | +| `vscode` | 1186-1187 | Empty stub | |
| 121 | +| `windsurf` | 1189-1190 | Empty stub | |
| 122 | +| `cursor` | 1192-1193 | Empty stub | |
| 123 | +| `mcp-setup` | 1195-1196 | Empty stub | |
| 124 | +| `sitemap` | 1198-1212 | Broken/incomplete | |
| 125 | + |
| 126 | +### DELETE — Module declarations (content justfiles are dead code) |
| 127 | + |
| 128 | +| Recipe | Lines | Why Delete | |
| 129 | +|--------|-------|------------| |
| 130 | +| `mod plugin` | 8 | content/plugins/justfile — not used, CLI handles everything | |
| 131 | +| `mod skill` | 9 | content/skills/justfile — not used | |
| 132 | +| `mod command` | 10 | content/commands/justfile — not used | |
| 133 | +| `mod agent` | 11 | content/agents/justfile — not used | |
| 134 | +| `mod rule` | 12 | content/rules/justfile — not used | |
| 135 | + |
| 136 | +Verify these modules are unused: `grep -r 'just plugin\|just skill\|just command\|just agent\|just rule' .pre-commit-config.yaml CLAUDE.md docs/` |
| 137 | + |
| 138 | +### DELETE — Variables (orphaned after recipe deletion) |
| 139 | + |
| 140 | +| Variable | Line | Why Delete | |
| 141 | +|----------|------|------------| |
| 142 | +| `ANTHROPIC_SKILLS_REPO` | 193 | Used by deleted sync-anthropic-skills | |
| 143 | +| `ANTHROPIC_VERSION_FILE` | 194 | Used by deleted sync-anthropic-skills | |
| 144 | +| `ANTHROPIC_SKILL_MAP` | 198 | Used by deleted sync-anthropic-skills | |
| 145 | +| `EXTERNAL_MANIFEST` | 276 | Used by deleted external recipes | |
| 146 | +| `EXTERNAL_VERSION_DIR` | 277 | Used by deleted external recipes | |
| 147 | +| `SKILL_TEMPLATE_DIR` | 462 | Used by deleted create-skill | |
| 148 | + |
| 149 | +## References to Update |
| 150 | + |
| 151 | +| File | Recipe Referenced | Action | |
| 152 | +|------|------------------|--------| |
| 153 | +| `CLAUDE.md:71` | `just kg-init` | Keep (recipe stays) | |
| 154 | +| `CLAUDE.md:74` | `just kg-ingest` | Keep (recipe stays) | |
| 155 | +| `CLAUDE.md:77` | `just kg-search "..."` | Keep (recipe stays) | |
| 156 | +| `CLAUDE.md:80` | `just kg-watch` | Keep (recipe stays) | |
| 157 | +| `CLAUDE.md:134` | `just skill external:check` | Change to `just agents update --type skill --check` | |
| 158 | +| `CLAUDE.md:135` | `just kg-search "query"` | Keep | |
| 159 | +| `.pre-commit-config.yaml:275` | `just --fmt --check` | Keep (justfile self-format, not a recipe) | |
| 160 | + |
| 161 | +## Target justfile structure (~25 recipes, ~300 lines) |
| 162 | + |
| 163 | +``` |
| 164 | +set unstable := true |
| 165 | +
|
| 166 | +default: # just --list |
| 167 | +
|
| 168 | +# Tools |
| 169 | +[group('tools')] |
| 170 | +agents *args # CLI entry point |
| 171 | +matrixng *args # Viewer CLI entry point |
| 172 | +
|
| 173 | +# Variables |
| 174 | +CLAUDE_DIR, EMBEDDING_MODEL |
| 175 | +
|
| 176 | +# Install |
| 177 | +[group('install')] |
| 178 | +init # Orchestrates _init-* |
| 179 | +install target='all' # Symlinks to ~/.claude/ |
| 180 | +uninstall target='all' |
| 181 | +list-claude |
| 182 | +
|
| 183 | +# Private init helpers |
| 184 | +_init-brew, _init-pre-commit, _init-bun, _init-python, _init-docker, _init-ollama, _init-db |
| 185 | +# Private install/uninstall helpers |
| 186 | +_install-all, _install-claude, _install-claude-{settings,commands,rules,skills,hooks} |
| 187 | +_uninstall-all, _uninstall-claude |
| 188 | +
|
| 189 | +# Docker |
| 190 | +[group('docker')] |
| 191 | +mcp-up, mcp-down, mcp-logs, mcp-status |
| 192 | +
|
| 193 | +# KG (Python-based) |
| 194 | +[group('kg')] |
| 195 | +kg-init, kg-ingest, kg-search, kg-watch, kg-dump, kg-load, kg-rebuild (inline kg-similarity call) |
| 196 | +``` |
| 197 | + |
| 198 | +## Acceptance Criteria |
| 199 | + |
| 200 | +- [ ] `just --list` shows only ~25 recipes in clean groups: tools, install, docker, kg |
| 201 | +- [ ] `just init` still works (all _init-* helpers present) |
| 202 | +- [ ] `just install` / `just uninstall` / `just list-claude` work |
| 203 | +- [ ] `just agents <verb> <type>` works |
| 204 | +- [ ] `just matrixng build <workspace>` works |
| 205 | +- [ ] `just kg-search "test"` works |
| 206 | +- [ ] No broken references in `.pre-commit-config.yaml`, `CLAUDE.md`, or docs |
| 207 | +- [ ] Content module justfiles (`content/*/justfile`) deleted or emptied |
| 208 | +- [ ] All tests pass: `bun test packages/matrixng/ && bun test packages/cli/` |
0 commit comments