@erclx/aitk 0.39.0 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,115 @@
1
+ ---
2
+ title: Scripting
3
+ description: The runtime catalogs that replace hardcoded names, what each carries, and a headless invocation per domain
4
+ ---
5
+
6
+ # Scripting
7
+
8
+ What a skill or script reads to discover names at runtime, and how each domain is invoked with no TTY.
9
+
10
+ ## Runtime catalogs
11
+
12
+ Use these to discover what's available instead of hardcoding names.
13
+
14
+ | Command | Returns |
15
+ | -------------------------------- | --------------------------------------------- |
16
+ | `aitk tooling list --json` | Stacks, extends chain, dep and script counts |
17
+ | `aitk snippets list --json` | Presets and categories with their slugs |
18
+ | `aitk standards list --json` | Standards docs and the paths each governs |
19
+ | `aitk gov list --json` | Governance stacks and rule sets |
20
+ | `aitk claude seeds list --json` | Seed doc sources with content |
21
+ | `aitk claude skills list --json` | Plugin skills, descriptions, requirement flag |
22
+ | `aitk docs list --json` | Consumer docs plus per-domain context |
23
+
24
+ ### Catalog fields
25
+
26
+ Every catalog serializes through `JSON.stringify`, so a name carrying a quote
27
+ emits valid JSON. `aitk tooling list` and `aitk snippets list` previously built
28
+ their output with `printf` and no escaping.
29
+
30
+ `aitk standards list` carries `appliesTo` per standard, the paths that standard's
31
+ `## Scope` statement declares. It holds the backticked paths from the first
32
+ sentence of the statement, the single entry `*` for a standard governing an
33
+ attribute rather than a document type, and an empty array when the statement
34
+ declares nothing a parser can read. A consumer mapping a file to its governing
35
+ standards reads this rather than holding a table of its own, and reports an empty
36
+ array rather than skipping the standard behind it.
37
+
38
+ `aitk claude seeds list` reads the same plan `aitk claude init` applies, so the
39
+ listing and the install cannot disagree. It now reports
40
+ `.claude/context/index.md`, which `init` has always installed and the listing
41
+ never named, and it emits the project-level `CLAUDE.md` last rather than first.
42
+
43
+ ### The skills catalog
44
+
45
+ `aitk claude skills list` reads `claude/skills/*/SKILL.md` and reports the folder
46
+ name with the frontmatter description, sorted by name. Internal skills under
47
+ `.claude/skills/` are excluded, since they never install into a target and a
48
+ count spanning both overstates what ships. A skill whose frontmatter is missing
49
+ or unparseable returns an empty description rather than failing the listing, so
50
+ one malformed file cannot hide the rest of the catalog. `--names` emits skill
51
+ names one per line.
52
+
53
+ Each entry also carries `requirement`, whether the folder holds a sibling
54
+ `REQUIREMENT.md`. Every skill is meant to carry one, so a `false` is a gap to
55
+ close rather than a recorded exemption, and the flag answers which skills are
56
+ missing theirs without a caller listing the directory itself. Nothing gates the
57
+ rule yet, which is why the flag is worth reading against the shipped corpus after
58
+ a merge.
59
+
60
+ ## Non-interactive examples
61
+
62
+ ```bash
63
+ # Create a new tooling stack
64
+ AITK_NON_INTERACTIVE=1 aitk tooling create astro
65
+
66
+ # Sync a stack into a target project
67
+ AITK_NON_INTERACTIVE=1 aitk tooling sync astro /path/to/project
68
+
69
+ # Install a governance stack (the stack argument is required headlessly)
70
+ AITK_NON_INTERACTIVE=1 aitk gov install astro --add 260-shadcn /path/to/project
71
+
72
+ # Update installed governance rules, dropping a retired .claude/GOV.md
73
+ AITK_NON_INTERACTIVE=1 aitk gov sync /path/to/project
74
+
75
+ # Concatenate installed rules into a paste payload
76
+ AITK_NON_INTERACTIVE=1 aitk gov build /path/to/project
77
+
78
+ # Sync a monorepo subtree, skipping the base layer the repo root already owns
79
+ AITK_NON_INTERACTIVE=1 aitk tooling sync vite-react /path/to/repo/frontend --skip base
80
+
81
+ # Verify a stack end-to-end in a throwaway scaffold
82
+ aitk tooling verify vite-react
83
+
84
+ # Apply one stack without scanning or prompting, for scripted provisioning
85
+ aitk tooling inject base /path/to/project
86
+ aitk tooling inject base /path/to/project --configs --seeds
87
+
88
+ # Drop managed gitignore entries a manifest no longer declares
89
+ # Prints the number removed on stdout, diagnostics on stderr
90
+ aitk tooling prune-gitignore base /path/to/project
91
+
92
+ # Install a snippet preset
93
+ AITK_NON_INTERACTIVE=1 aitk snippets install essentials /path/to/project
94
+
95
+ # Update snippets already installed, leaving project-authored ones alone
96
+ AITK_NON_INTERACTIVE=1 aitk snippets sync /path/to/project
97
+
98
+ # Report standards drift without applying it, which is what headless does here
99
+ AITK_NON_INTERACTIVE=1 aitk standards sync /path/to/project
100
+
101
+ # Copy every standard into a target, overwriting what is there
102
+ AITK_NON_INTERACTIVE=1 aitk standards install /path/to/project
103
+
104
+ # Bootstrap a project. Any flag suppresses the confirmation prompt
105
+ AITK_NON_INTERACTIVE=1 aitk init --stack astro --skip wiki /path/to/project
106
+
107
+ # Run every domain sync. The git workflow is refused headlessly, so nothing is pushed
108
+ AITK_NON_INTERACTIVE=1 aitk sync /path/to/project
109
+
110
+ # Scaffold .claude/wiki/ with a stub index. The target must already exist
111
+ AITK_NON_INTERACTIVE=1 aitk wiki init /path/to/project
112
+
113
+ # Run a sandbox scenario non-interactively
114
+ SANDBOX_SCENARIO=sync aitk sandbox infra:tooling
115
+ ```
@@ -0,0 +1,33 @@
1
+ ---
2
+ title: Tasks
3
+ description: Selecting a shipped task by stem or pull request, the refusal reasons, and why the board root defaults to the main worktree
4
+ ---
5
+
6
+ # Tasks
7
+
8
+ `aitk tasks archive` moves a shipped task from `.claude/tasks/` into `.claude/.tmp/task-archive/`, drops its row from `priority.md`, and regenerates the board index. The three run as one unit, so the attended and unattended callers cannot archive differently.
9
+
10
+ Name the task by its filename stem, or by the pull request it carries:
11
+
12
+ ```bash
13
+ aitk tasks archive v28.1-trigger-escalation
14
+ aitk tasks archive --pull-request 673 --json
15
+ ```
16
+
17
+ | Option | Behavior |
18
+ | -------------------- | ------------------------------------------------------------ |
19
+ | `--pull-request <n>` | Select the task whose `Pull request:` line names this number |
20
+ | `--json` | Emit a machine-readable record on stdout |
21
+ | `--root <path>` | Board root, defaulting to the main worktree |
22
+
23
+ Exit codes: `0` archived, `1` refused. Every gate is a refusal rather than a warning, because `.husky/post-merge` calls this with nobody watching. The `reason` field carries which gate fired: `no-board`, `no-match`, `ambiguous`, `no-outcomes`, `open-outcomes`, or `plan-unswept`.
24
+
25
+ The board is shared scratch at the main worktree root, so `--root` defaults to the first entry of `git worktree list` rather than the working directory. A linked worktree archives against the same board every other session reads.
26
+
27
+ Skills branch on the reason rather than on the exit code:
28
+
29
+ ```bash
30
+ aitk tasks archive --pull-request 673 --json | jq -r 'if .ok then .task else .reason end'
31
+ ```
32
+
33
+ For the board format, the `Pull request:` line, and the archive rules, see `.claude/standards/tasks.md`.
package/docs/index.md CHANGED
@@ -9,7 +9,6 @@ One-line reference for each doc in this folder.
9
9
 
10
10
  ## Agent surface
11
11
 
12
- - [Agents](agents.md): CLI catalog and invocation rules for agents
13
12
  - [AI workflow](ai-workflow.md): Overarching AI workflow across domains
14
13
  - [Target projects](target-projects.md): Scaffold, add domains later, and sync upstream drift in a toolkit-managed project
15
14
 
@@ -18,3 +17,7 @@ One-line reference for each doc in this folder.
18
17
  - [Operating model](operating-model.md): Orchestrator and worker roles for building across parallel sessions
19
18
  - [Visual design workflow](visual-design-workflow.md): Tiered guide for design and wireframe authoring with Claude Code
20
19
  - [Zshrc aliases for Claude Code](zshrc-aliases.md): Shell aliases that shorten common Claude Code invocations
20
+
21
+ ## Sub-catalogs
22
+
23
+ - [Agents](agents/index.md): CLI catalog and invocation rules for agents, split by command domain. Start with overview.
@@ -8,7 +8,7 @@ category: Agent surface
8
8
 
9
9
  How a project outside this repo consumes the toolkit across its lifecycle. Three phases: scaffold once, add a domain later when a new need appears, and sync when the upstream toolkit moves.
10
10
 
11
- This doc stays at the narrative layer. For command flags and JSON shapes, see [agents](agents.md). For per-domain mechanics, see each `.claude/context/<domain>.md`.
11
+ This doc stays at the narrative layer. For command flags and JSON shapes, see [agents](agents/index.md). For per-domain mechanics, see each `.claude/context/<domain>.md`.
12
12
 
13
13
  ## Getting the skills
14
14
 
@@ -179,7 +179,7 @@ Sync also refuses a target whose working tree is dirty, so commit or stash befor
179
179
 
180
180
  ## Related
181
181
 
182
- - [agents](agents.md): CLI flags, exit codes, and JSON output shapes
182
+ - [agents](agents/index.md): CLI flags, exit codes, and JSON output shapes
183
183
  - [AI workflow](ai-workflow.md): feature-development loop inside a toolkit-managed project
184
184
  - [tooling](../.claude/context/tooling.md), [governance](../.claude/context/governance.md), [claude plugin](../.claude/context/claude-plugin/index.md), [indexes](../.claude/context/indexes.md), [snippets](../.claude/context/snippets.md), [standards](../.claude/context/standards.md): per-domain mechanics
185
185
  - [sandbox](../.claude/context/sandbox/index.md): scenario catalog for verifying domain flows
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@erclx/aitk",
3
3
  "type": "module",
4
- "version": "0.39.0",
4
+ "version": "0.40.0",
5
5
  "description": "Infrastructure and quality tooling for developer workflows",
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -38,6 +38,35 @@ is_internal_topic() {
38
38
  esac
39
39
  }
40
40
 
41
+ # Emits `name<TAB>description<TAB>category<TAB>target` per target-facing doc,
42
+ # sorted so a domain split into a folder lands in its alphabetical place rather
43
+ # than after every file. A folder declares its category on its own index, since
44
+ # the allowlist is what separates a target-facing doc from a workflow one and a
45
+ # split domain is not exempt from it.
46
+ collect_docs() {
47
+ local file name description category
48
+ {
49
+ while IFS= read -r file; do
50
+ name=$(basename "$file" .md)
51
+ [ "$name" = "index" ] && continue
52
+ category=$(read_frontmatter_field "$file" "category")
53
+ is_target_facing "$category" || continue
54
+ description=$(read_frontmatter_field "$file" "description")
55
+ printf '%s\t%s\t%s\t%s\n' "$name" "$description" "$category" "docs/$name.md"
56
+ done < <(find "$DOCS_DIR" -maxdepth 1 -type f -name "*.md")
57
+
58
+ # A split domain is named by its folder and described by its generated
59
+ # index, which carries subtitle where a sibling file carries description
60
+ while IFS= read -r file; do
61
+ name=$(basename "$(dirname "$file")")
62
+ category=$(read_frontmatter_field "$file" "category")
63
+ is_target_facing "$category" || continue
64
+ description=$(read_frontmatter_field "$file" "subtitle")
65
+ printf '%s\t%s\t%s\t%s\n' "$name" "$description" "$category" "docs/$name/index.md"
66
+ done < <(find "$DOCS_DIR" -mindepth 2 -maxdepth 2 -type f -name "index.md")
67
+ } | sort
68
+ }
69
+
41
70
  # Emits `name<TAB>description<TAB>target` per context entry, sorted so a domain
42
71
  # split into a folder lands in its alphabetical place rather than after every
43
72
  # file. Matches listTopics in src/docs/read.ts, which sorts both together.
@@ -64,16 +93,11 @@ collect_context() {
64
93
  }
65
94
 
66
95
  list_text() {
67
- local file name description category target
96
+ local name description category target
68
97
  log_step "Docs"
69
- while IFS= read -r file; do
70
- name=$(basename "$file" .md)
71
- [ "$name" = "index" ] && continue
72
- category=$(read_frontmatter_field "$file" "category")
73
- is_target_facing "$category" || continue
74
- description=$(read_frontmatter_field "$file" "description")
98
+ while IFS=$'\t' read -r name description category target; do
75
99
  log_info "$name : $description"
76
- done < <(find "$DOCS_DIR" -maxdepth 1 -type f -name "*.md" | sort)
100
+ done < <(collect_docs)
77
101
 
78
102
  # Absent in a registry install, which ships docs/ without .claude/
79
103
  if [ -d "$CONTEXT_DIR" ]; then
@@ -97,17 +121,12 @@ emit_json_entry() {
97
121
  }
98
122
 
99
123
  list_json() {
100
- local file name description category target
124
+ local name description category target
101
125
  JSON_FIRST=1
102
126
  printf '['
103
- while IFS= read -r file; do
104
- name=$(basename "$file" .md)
105
- [ "$name" = "index" ] && continue
106
- category=$(read_frontmatter_field "$file" "category")
107
- is_target_facing "$category" || continue
108
- description=$(read_frontmatter_field "$file" "description")
109
- emit_json_entry "$name" "$description" "$category" "docs/$(basename "$file")"
110
- done < <(find "$DOCS_DIR" -maxdepth 1 -type f -name "*.md" | sort)
127
+ while IFS=$'\t' read -r name description category target; do
128
+ emit_json_entry "$name" "$description" "$category" "$target"
129
+ done < <(collect_docs)
111
130
 
112
131
  if [ -d "$CONTEXT_DIR" ]; then
113
132
  while IFS=$'\t' read -r name description target; do
@@ -389,7 +389,7 @@ function runCheck(
389
389
 
390
390
  // The report always renders on stderr. `--json` adds the machine copy on
391
391
  // stdout rather than replacing the frame, per the stream contract in
392
- // `docs/agents.md`, so one invocation serves a human and a caller at once.
392
+ // `docs/agents/output-shape.md`, so one invocation serves a human and a caller at once.
393
393
  reportVerdict(verdict)
394
394
  if (options.json === true)
395
395
  process.stdout.write(`${JSON.stringify(verdict)}\n`)
package/src/ui.ts CHANGED
@@ -31,7 +31,7 @@ export function logRemove(message: string): void {
31
31
  }
32
32
 
33
33
  /**
34
- * Renders the `✗` shape `docs/agents.md` specifies for a failure inside an
34
+ * Renders the `✗` shape `docs/agents/output-shape.md` specifies for a failure inside an
35
35
  * open frame. It does not exit, so the caller closes the frame and returns an
36
36
  * exit code rather than terminating mid-write.
37
37
  */