tcsetup 1.0.5 → 1.1.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.
package/bin/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { execSync } from "node:child_process";
4
4
  import { argv } from "node:process";
5
- import { readFileSync } from "node:fs";
5
+ import { readFileSync, mkdirSync, copyFileSync, existsSync } from "node:fs";
6
6
  import { fileURLToPath } from "node:url";
7
7
  import { dirname, join } from "node:path";
8
8
 
@@ -89,4 +89,22 @@ for (const step of steps) {
89
89
  }
90
90
  }
91
91
 
92
+ // ── Install Claude Code commands ──────────────────────
93
+ const commandsSource = join(__dirname, "..", "commands");
94
+ const commandsDest = join(process.cwd(), ".claude", "commands");
95
+
96
+ if (existsSync(commandsSource)) {
97
+ const commandFiles = ["tcsetup.onboard.md"];
98
+ mkdirSync(commandsDest, { recursive: true });
99
+ for (const file of commandFiles) {
100
+ const src = join(commandsSource, file);
101
+ const dest = join(commandsDest, file);
102
+ if (existsSync(src)) {
103
+ copyFileSync(src, dest);
104
+ console.log(` [cmd] Installed .claude/commands/${file}`);
105
+ }
106
+ }
107
+ console.log();
108
+ }
109
+
92
110
  console.log(" Done! Project setup complete.\n");
@@ -0,0 +1,596 @@
1
+ # tcsetup.onboard — Onboard an existing project onto the TC stack
2
+
3
+ You are the **Onboarding Orchestrator**. Your mission is to analyze an existing codebase and bootstrap the TC toolchain artifacts so they reflect the project's current state.
4
+
5
+ ## Pre-checks
6
+
7
+ Before anything, verify prerequisites:
8
+ 1. Check that `.agreements/`, `.adr/`, `.features/`, `.bmad_output/mermaid/` directories exist
9
+ 2. Check that template files exist: `.agreements/_templates/agreement.tpl.yaml`, `.adr/_templates/template.md`, `.features/_templates/feature.tpl.yaml`
10
+ 3. Check that `_bmad/modules/mermaid-workbench/config.yaml` exists
11
+ 4. If any is missing, tell the user to run `npx tcsetup` first and STOP.
12
+ 5. Add `.onboarding-context.json` to `.gitignore` if not already present (prevent accidental commits if interrupted)
13
+
14
+ ## Process
15
+
16
+ 4 phases: Discovery → User Validation → Parallel Scanning → Verify.
17
+
18
+ ---
19
+
20
+ ### Phase 0 — Discovery (you, the orchestrator)
21
+
22
+ Before launching agents, build a **discovery context** so agents don't waste tokens re-exploring the same files.
23
+
24
+ 1. Run `Glob` on `**/*.{js,ts,jsx,tsx,json,yaml,yml,md}` (exclude `node_modules`, `_bmad`, `.bmad_output`, `package-lock.json`, `retro-*`)
25
+ 2. Read every `package.json` found (root + packages)
26
+ 3. Read CI/CD workflows (`.github/workflows/*.yml`)
27
+ 4. Read config files (tsconfig, docker*, .env.example, etc.)
28
+ 5. Read 2-3 representative source files (entry points, a typical module)
29
+ 6. Run `git log --oneline -20` for recent history
30
+ 7. Read `_bmad/modules/mermaid-workbench/config.yaml` (mermaid output spec)
31
+
32
+ Write the results to `.onboarding-context.json` with this structure:
33
+
34
+ ```json
35
+ {
36
+ "project_name": "...",
37
+ "file_tree": ["list of all discovered files"],
38
+ "packages": {
39
+ "root": { "name": "...", "dependencies": {}, "scripts": {} },
40
+ "packages/foo": { "name": "...", "dependencies": {}, "scripts": {} }
41
+ },
42
+ "config_files": {
43
+ "path": "summary of what each config does"
44
+ },
45
+ "entry_points": ["list of bin/cli.js, index.js, main.ts, etc."],
46
+ "ci_workflows": {
47
+ "path": "summary of what each workflow does"
48
+ },
49
+ "recent_git_history": ["last 20 commit messages"],
50
+ "key_patterns_observed": [
51
+ "brief notes on patterns you noticed while reading source files"
52
+ ],
53
+ "feature_id_mapping": {
54
+ "001-short-name": "Human-readable title",
55
+ "002-short-name": "..."
56
+ },
57
+ "candidate_conventions": [
58
+ "brief description of each convention/pattern detected"
59
+ ],
60
+ "candidate_decisions": [
61
+ "brief description of each architecture decision detected"
62
+ ]
63
+ }
64
+ ```
65
+
66
+ **CRITICAL — Feature ID Mapping**: Identify the major features (3-8 max) and assign IDs (`XXX-short-name`). ALL agents will use this shared vocabulary.
67
+
68
+ This file is **ephemeral** — it will be deleted at the end.
69
+
70
+ ---
71
+
72
+ ### Phase 0.5 — User Validation
73
+
74
+ After writing `.onboarding-context.json`, use `AskUserQuestion` to validate with the user.
75
+
76
+ **CRITICAL**: The question text itself MUST contain the full structured lists — NOT in a separate message before the question. The user sees ONLY the AskUserQuestion content, so everything must be inside it.
77
+
78
+ Format the question like this (adapt content to actual data):
79
+
80
+ ```
81
+ Here is what I discovered in the codebase. Please review before I launch the scanning agents.
82
+
83
+ **Features identified:**
84
+ - 001-foo — Foo Module (packages/foo)
85
+ - 002-bar — Bar Service (packages/bar)
86
+ - 003-baz — Baz CLI (packages/baz)
87
+
88
+ **Conventions detected:**
89
+ - ESM-only modules with zero runtime dependencies
90
+ - Uniform CLI entry point structure (bin/cli.js)
91
+ - File-based state with YAML on disk
92
+
93
+ **Architecture decisions detected:**
94
+ - npm workspaces monorepo with git submodules
95
+ - Preact + Vite for viewer component
96
+ - Trusted npm publishing via GitHub Actions OIDC
97
+
98
+ Does this look correct? Any features to add/remove, conventions to adjust, or decisions I missed?
99
+ ```
100
+
101
+ Options: "Looks good, proceed" / "Needs adjustments" (if the user picks adjustments, ask what to change, update `.onboarding-context.json`, and re-present).
102
+
103
+ Do NOT proceed to Phase 1 until the user has validated.
104
+
105
+ ---
106
+
107
+ ### Phase 1 — Parallel Scanning (3 agents)
108
+
109
+ Launch ALL 3 agents simultaneously in a single message using the Task tool with `subagent_type: "general-purpose"`.
110
+
111
+ **IMPORTANT**: Each agent prompt MUST start with: `First, read .onboarding-context.json to understand the project structure. Use this as your starting point — only do additional file reads if you need deeper detail. Use the feature_id_mapping from the context file as the canonical feature IDs throughout your work.`
112
+
113
+ #### Agent 1: Architecture Analyst → Agreements + ADRs
114
+
115
+ This agent produces BOTH conventions AND ADRs in a single pass, guaranteeing coherence between them.
116
+
117
+ ```
118
+ prompt: |
119
+ You are the **Architecture Analyst**. Your mission is to analyze this codebase and produce two types of artifacts:
120
+ 1. **Convention Agreements** — document existing patterns/conventions
121
+ 2. **Architecture Decision Records** — document key architecture decisions
122
+
123
+ You produce BOTH in one pass because conventions and decisions often mirror each other (e.g., a "zero-deps" convention exists because of a "zero-deps" architecture decision). Producing them together guarantees coherence.
124
+
125
+ **First, read `.onboarding-context.json` to understand the project structure. Use this as your starting point — only do additional file reads if you need deeper detail. Use the `feature_id_mapping` from the context file as the canonical feature IDs throughout your work. Also read `candidate_conventions` and `candidate_decisions` as starting points.**
126
+
127
+ ---
128
+
129
+ ## Part A: Convention Agreements
130
+
131
+ ### What to scan
132
+
133
+ 1. **File/folder structure** — naming conventions, organization patterns
134
+ 2. **Code patterns** — error handling, logging, imports/exports style, module pattern
135
+ 3. **Stack & frameworks** — languages, frameworks, key dependencies
136
+ 4. **API/CLI conventions** — patterns, argument parsing, output format
137
+ 5. **Config patterns** — env vars, config files
138
+ 6. **Testing patterns** — test framework, file naming
139
+
140
+ ### Deduplication
141
+
142
+ Before writing, review all candidates and merge overlapping conventions. Two conventions describing aspects of the same decision = ONE convention. Example: "ESM-only" + "use node: protocol" → merge.
143
+
144
+ ### Output format
145
+
146
+ For each convention, create an Agreement YAML file following `.agreements/_templates/agreement.tpl.yaml`:
147
+
148
+ - Feature ID: `conv-XXX-short-name`
149
+ - Status: `active`
150
+ - Create in `.agreements/conv-XXX-short-name/agreement.yaml`
151
+ - Use `──` (em-dash unicode) for section separators
152
+ - `references.adr`: link to the ADR you create in Part B that corresponds to this convention (if one exists)
153
+
154
+ ### Feature coverage
155
+
156
+ Add at the end of each YAML:
157
+ ```yaml
158
+ # ── Feature Coverage ─────────────────────────────────
159
+ applies_to_features: ["001-xxx", "003-yyy"]
160
+ ```
161
+
162
+ **Semantics of "applies to"**: A convention applies to a feature if that feature is **constrained by** the convention — i.e., violating the convention in that feature's code would be considered a bug or regression. It does NOT mean the feature "produces" or "consumes" the convention's artifact.
163
+
164
+ Example: "zero runtime deps" applies to a package even if it has no imports at all — the constraint is that it MUST NOT add deps.
165
+
166
+ Rules:
167
+ - `["*"]` ONLY when ZERO exceptions across ALL features
168
+ - Otherwise list specific feature IDs
169
+ - When in doubt, include the feature — the verifier can remove false positives but can't easily add missing ones
170
+
171
+ ### Count: 5-10 conventions max.
172
+
173
+ ---
174
+
175
+ ## Part B: Architecture Decision Records
176
+
177
+ ### What to look for
178
+
179
+ 1. Language/runtime choice
180
+ 2. Framework choices
181
+ 3. Project structure (monorepo, module organization)
182
+ 4. Build/deploy (CI/CD, bundler)
183
+ 5. Key dependencies (non-obvious library choices)
184
+ 6. API design choices
185
+
186
+ ### Output format
187
+
188
+ Use `.adr/_templates/template.md` for each decision:
189
+
190
+ - Filename: `.adr/global/YYYYMMDD-short-title.md` (today's date)
191
+ - Status: `accepted`
192
+ - Honest trade-offs in Positive/Negative Consequences
193
+
194
+ ### Referential integrity for `relations`
195
+
196
+ - ONLY reference ADR files that YOU create in this session or that already exist on disk
197
+ - NEVER reference a non-existent ADR filename
198
+ - Conceptual relationships to decisions not written as ADRs go in the "Links" section as prose
199
+
200
+ ### Feature references — CRITICAL
201
+
202
+ For each ADR, populate `references.features` with impacted feature IDs:
203
+ - Specific impact → list that feature
204
+ - Global impact → list ALL feature IDs explicitly
205
+ - `references.features: []` is ALWAYS wrong
206
+
207
+ ### Update ADR index
208
+
209
+ After creating all ADRs, update `.adr/global/index.md`:
210
+ ```markdown
211
+ # Global ADRs
212
+
213
+ | Date | Decision | Status |
214
+ |------|----------|--------|
215
+ | YYYY-MM-DD | [Title](filename.md) | accepted |
216
+ ```
217
+
218
+ Include all ADRs in `.adr/global/` (yours + pre-existing).
219
+
220
+ ### Count: 3-7 ADRs max.
221
+
222
+ ---
223
+
224
+ ## Part C: Cross-reference Convention ↔ ADR
225
+
226
+ For each convention that has a corresponding ADR (e.g., conv-zero-deps ↔ ADR zero-deps):
227
+ - Add the ADR path in the convention's `references.adr` field
228
+ - Add the convention ID in the ADR's "Links" section
229
+
230
+ This is the key advantage of producing both in one pass.
231
+
232
+ ---
233
+
234
+ ## Final output
235
+
236
+ Update `.agreements/index.yaml` to register all conventions.
237
+
238
+ Output a summary:
239
+ - List of conventions: feature_id, title, applies_to_features, linked ADR (if any)
240
+ - List of ADRs: filename, title, references.features
241
+ ```
242
+
243
+ #### Agent 2: Architecture Mapper → Mermaid diagrams
244
+
245
+ ```
246
+ prompt: |
247
+ You are the **Architecture Mapper**. Your mission is to create Mermaid diagrams that visually document the existing architecture of this codebase.
248
+
249
+ **First, read `.onboarding-context.json` to understand the project structure. Use this as your starting point — only do additional file reads if you need deeper detail. Use the `feature_id_mapping` from the context file as the canonical feature IDs throughout your work.**
250
+
251
+ **ALSO read `_bmad/modules/mermaid-workbench/config.yaml` for output format specifications.**
252
+
253
+ ## Output format — CRITICAL
254
+
255
+ The mermaid-workbench module has a STRICT output format. You MUST follow it exactly.
256
+
257
+ ### File structure
258
+
259
+ Diagrams are organized by feature in subdirectories:
260
+ ```
261
+ .bmad_output/mermaid/<feature-id>/
262
+ ├── _index.yaml ← manifest (REQUIRED)
263
+ ├── L0-<id>.mmd ← .mmd extension (NOT .md)
264
+ ├── L1-<id>.mmd
265
+ └── L2-<id>.mmd
266
+ ```
267
+
268
+ For diagrams that are global (not feature-specific), use a `global/` subdirectory:
269
+ ```
270
+ .bmad_output/mermaid/global/
271
+ ├── _index.yaml
272
+ ├── L0-<id>.mmd
273
+ └── L1-<id>.mmd
274
+ ```
275
+
276
+ ### .mmd file format
277
+
278
+ Each `.mmd` file has YAML frontmatter then PURE Mermaid syntax (no markdown):
279
+
280
+ ```
281
+ ---
282
+ id: kebab-case-id
283
+ title: Human-readable Title
284
+ type: flowchart|architecture|state|sequence
285
+ layer: L0|L1|L2
286
+ parent: <diagram-id>#<node-id> # REQUIRED for L1/L2, OMIT for L0
287
+ children: []
288
+ feature: <feature-id> # or "global"
289
+ ---
290
+
291
+ flowchart TD
292
+ A[Node] --> B[Node]
293
+ ...
294
+ ```
295
+
296
+ Rules:
297
+ - `id` must be unique within the feature directory
298
+ - `parent` is REQUIRED for L1 and L2 diagrams (format: `<diagram-id>#<node-id>` where node-id is a node from the parent diagram)
299
+ - `parent` is FORBIDDEN for L0 diagrams
300
+ - `type` must be one of: flowchart, architecture, state, sequence
301
+ - Content after frontmatter is PURE Mermaid — no markdown headers, no ```mermaid fences
302
+ - `children` starts empty (updated when child diagrams are added)
303
+
304
+ ### _index.yaml manifest
305
+
306
+ Each feature directory MUST have a `_index.yaml`:
307
+
308
+ ```yaml
309
+ feature: <feature-id>
310
+ created: YYYY-MM-DD
311
+ updated: YYYY-MM-DD
312
+ diagrams:
313
+ L0:
314
+ - id: <id>
315
+ file: L0-<id>.mmd
316
+ type: architecture
317
+ title: <title>
318
+ L1:
319
+ - id: <id>
320
+ file: L1-<id>.mmd
321
+ type: flowchart
322
+ title: <title>
323
+ drills_from: <parent-id>#<node-id>
324
+ L2: []
325
+ ```
326
+
327
+ - `drills_from` is only for L1/L2 entries, matching the diagram's `parent` field
328
+
329
+ ## Diagrams to create
330
+
331
+ 1. **L0 — System Context** (global): How this project fits in a larger ecosystem
332
+ 2. **L1 — Component Overview** (global): Major components/modules and relationships
333
+ 3. **L2 — Key Flows** (feature-specific, 1-2 max): Important data/control flows
334
+
335
+ For L1 diagrams, `parent` must reference an L0 diagram node: `<L0-diagram-id>#<node-id>`
336
+ For L2 diagrams, `parent` must reference an L1 diagram node: `<L1-diagram-id>#<node-id>`
337
+
338
+ ## Diagram ownership
339
+
340
+ - L0 and L1 showing the whole system → `feature: "global"`, stored in `.bmad_output/mermaid/global/`
341
+ - L2 zooming into a specific feature → `feature: "<feature-id>"`, stored in `.bmad_output/mermaid/<feature-id>/`
342
+
343
+ ## Template conventions
344
+
345
+ Use the conventions from `_bmad/modules/mermaid-workbench/templates/architecture.md`:
346
+ - Rectangle `[Label]` for services
347
+ - Cylinder `[(Label)]` for data stores
348
+ - Trapezoid `[/Label/]` for external systems
349
+ - Stadium `([Label])` for API endpoints
350
+ - Subgraphs for system boundaries
351
+
352
+ ## Mermaid syntax validation
353
+
354
+ After writing each diagram:
355
+ - All node IDs referenced in links must be defined
356
+ - All node IDs unique within the diagram
357
+ - Subgraph names are quoted
358
+ - Direction declarations are valid
359
+
360
+ ## Count: 2-4 diagrams max. L1 is most important.
361
+
362
+ When done, output a summary listing each diagram: filename, layer, feature, and description.
363
+ ```
364
+
365
+ #### Agent 3: Feature Inventory → Features
366
+
367
+ ```
368
+ prompt: |
369
+ You are the **Feature Inventory Agent**. Your mission is to identify existing features in this codebase and register them in the Feature Lifecycle tracker.
370
+
371
+ **First, read `.onboarding-context.json` to understand the project structure. Use this as your starting point — only do additional file reads if you need deeper detail.**
372
+
373
+ ## CRITICAL — Use the canonical feature IDs
374
+
375
+ Use the `feature_id_mapping` from `.onboarding-context.json` as-is. Do NOT invent new IDs or rename them.
376
+
377
+ ## What counts as a feature
378
+
379
+ - A user-facing capability (API endpoint group, CLI command, UI page/component)
380
+ - A distinct functional module with clear boundaries
381
+ - NOT internal utilities, configs, or infrastructure code
382
+
383
+ ## Output format
384
+
385
+ Use `.features/_templates/feature.tpl.yaml`. For each feature:
386
+
387
+ - Use the feature ID from `feature_id_mapping` exactly
388
+ - Create at `.features/XXX-short-name.yaml`
389
+ - Status: `active`, Stage: `release`
390
+ - Use `──` (em-dash unicode) for section separators
391
+ - Update `.features/index.yaml` (preserve valid existing entries; remove orphans)
392
+
393
+ ## Retroactive onboarding
394
+
395
+ These features existed BEFORE the toolchain. Add to each:
396
+
397
+ ```yaml
398
+ lifecycle:
399
+ stage: "release"
400
+ stage_since: "<today's date>"
401
+ progress: 1.0
402
+ manual_override: null
403
+ retroactive: true
404
+ ```
405
+
406
+ For artifacts, only set `true` if the artifact actually exists on disk:
407
+ - `agreement.*`: set `exists: false`, `status: ""`, `check: "NOT_APPLICABLE"`
408
+ - `adr.*`: set `count: 0, ids: []` (verifier will populate)
409
+ - `mermaid.*`: set `count: 0` (verifier will populate)
410
+
411
+ For health:
412
+ ```yaml
413
+ health:
414
+ overall: "HEALTHY"
415
+ agreement: "NOT_APPLICABLE"
416
+ spec_completeness: 0.0
417
+ task_progress: 1.0
418
+ adr_coverage: 0
419
+ diagram_coverage: 0
420
+ warnings: []
421
+ ```
422
+
423
+ Add convention linking field:
424
+ ```yaml
425
+ # ── Conventions ───────────────────────────────────────
426
+ conventions: [] # populated by verifier
427
+ ```
428
+
429
+ When done, output a summary listing each feature_id and title.
430
+ ```
431
+
432
+ ---
433
+
434
+ ### Phase 2 — Verify & Cross-reference
435
+
436
+ After ALL 3 agents complete, run a verification agent using the Task tool with `subagent_type: "general-purpose"`.
437
+
438
+ The verifier's job is lighter now — the Architecture Analyst already cross-referenced conventions ↔ ADRs. The verifier checks, fills gaps, and links diagrams/ADRs to features.
439
+
440
+ ```
441
+ prompt: |
442
+ You are the **Onboarding Verifier**. The 3 scanning agents have populated the TC stack artifacts. Verify consistency, fill cross-reference gaps, and fix issues.
443
+
444
+ ## Step 1 — Read ALL artifacts
445
+
446
+ Read:
447
+ - All `.agreements/conv-*/agreement.yaml` files
448
+ - `.agreements/index.yaml`
449
+ - All `.adr/global/*.md` files (skip template.md)
450
+ - All `.bmad_output/mermaid/**/*.mmd` and `**/_index.yaml` files
451
+ - All `.features/*.yaml` files
452
+ - `.features/index.yaml`
453
+
454
+ Build an in-memory map before making changes.
455
+
456
+ ## Step 2 — Referential integrity (#1 PRIORITY)
457
+
458
+ ### ADR → ADR relations
459
+ For every ADR, check `relations.supersedes/amends/constrained_by/related`:
460
+ - Verify each referenced file exists on disk
461
+ - If NOT: REMOVE and add `<!-- Removed: ref to non-existent {filename} -->` in Links
462
+
463
+ ### ADR → Features
464
+ For every ADR, check `references.features`:
465
+ - If empty `[]`: analyze content and populate with impacted feature IDs
466
+ - Global decisions → list ALL feature IDs
467
+
468
+ ### Agreement → ADR
469
+ Verify that `references.adr` in each convention points to existing ADR files.
470
+ If a convention has no ADR reference but a matching ADR exists (by topic), add it.
471
+
472
+ ## Step 3 — Cross-reference conventions ↔ features
473
+
474
+ Read `applies_to_features` from each convention.
475
+ Populate `conventions` in each feature YAML:
476
+ - `"*"` → all features
477
+ - Specific IDs → those features only
478
+
479
+ ## Step 4 — Cross-reference diagrams ↔ features
480
+
481
+ Read `_index.yaml` manifests in `.bmad_output/mermaid/`.
482
+ For each feature that has its own mermaid directory:
483
+ - Update `artifacts.mermaid.count` in the feature YAML
484
+ - Update `health.diagram_coverage`
485
+ Global diagrams (`global/` directory) are NOT attributed to specific features.
486
+
487
+ ## Step 5 — Cross-reference ADRs ↔ features
488
+
489
+ Read `references.features` from each ADR.
490
+ Update each feature's `artifacts.adr.count` and `artifacts.adr.ids`.
491
+
492
+ ## Step 6 — Index consistency
493
+
494
+ - `.agreements/index.yaml`: must match actual `conv-*` directories on disk
495
+ - `.features/index.yaml`: must match actual feature YAML files on disk
496
+ - `.adr/global/index.md`: must list ALL ADR files as markdown table
497
+ - Each `.bmad_output/mermaid/<dir>/_index.yaml`: must match actual `.mmd` files in that directory
498
+ - Remove orphans, add missing entries
499
+
500
+ ## Step 7 — Mermaid format compliance
501
+
502
+ For each `.mmd` file, verify:
503
+ - File extension is `.mmd` (not `.md`)
504
+ - Frontmatter has required fields: `id`, `title`, `type`, `layer`, `feature`
505
+ - L1/L2 have `parent` field, L0 does not
506
+ - Content after frontmatter is pure Mermaid (no markdown fences, no `# headers`)
507
+ - Type is one of: flowchart, architecture, state, sequence
508
+ - Layer is one of: L0, L1, L2
509
+
510
+ Fix any violations.
511
+
512
+ ## Step 8 — Template compliance & quality
513
+
514
+ - No `{{...}}` placeholder tokens
515
+ - No empty required fields
516
+ - Valid ISO dates
517
+ - Valid status values
518
+ - `──` (em-dash) separators consistently
519
+
520
+ ## Step 9 — Machine validation
521
+
522
+ ```bash
523
+ node -e "
524
+ const fs = require('fs');
525
+ const path = require('path');
526
+ const dir = '.features';
527
+ const files = fs.readdirSync(dir).filter(f => f.match(/^\d{3}-.*\.yaml$/));
528
+ let ok = 0, fail = 0;
529
+ for (const f of files) {
530
+ try {
531
+ const c = fs.readFileSync(path.join(dir, f), 'utf8');
532
+ if (!c.includes('feature_id:')) { console.error('MISSING feature_id: ' + f); fail++; }
533
+ else if (!c.includes('status:')) { console.error('MISSING status: ' + f); fail++; }
534
+ else if (!c.includes('lifecycle:')) { console.error('MISSING lifecycle: ' + f); fail++; }
535
+ else ok++;
536
+ } catch(e) { console.error('ERROR: ' + f + ' ' + e.message); fail++; }
537
+ }
538
+ console.log(ok + '/' + (ok+fail) + ' features valid');
539
+ process.exit(fail > 0 ? 1 : 0);
540
+ "
541
+ ```
542
+
543
+ Fix any failures.
544
+
545
+ ## Step 10 — Cleanup
546
+
547
+ - Delete `.onboarding-context.json`
548
+
549
+ ## Step 11 — Write report
550
+
551
+ Write the report to `.onboarding-report.md` AND print it:
552
+
553
+ ```markdown
554
+ # Onboarding Report
555
+
556
+ ## Agreements (conventions)
557
+ - [conv-001-xxx] Title (linked ADR: yes|no) — OK|FIXED
558
+
559
+ ## ADRs
560
+ - [20260218-xxx] Title (features: [list]) — OK|FIXED
561
+
562
+ ## Diagrams
563
+ - [L0-xxx.mmd] Title (dir: global|feature-id) — OK|FIXED
564
+
565
+ ## Features
566
+ - [001-xxx] Title (retroactive, conventions: N, ADRs: N, diagrams: N) — OK|FIXED
567
+
568
+ ## Cross-references
569
+ - Conventions → Features: X conventions linked to Y features
570
+ - ADRs → Features: X ADRs referencing Y features (Z filled by verifier)
571
+ - Agreements ↔ ADRs: X linked pairs
572
+ - Diagrams: X in global/, Y in feature dirs
573
+
574
+ ## Machine validation
575
+ - Feature YAML: PASS|FAIL
576
+ - Mermaid format: PASS|FAIL
577
+
578
+ ## Issues remaining
579
+ - (any unresolved)
580
+
581
+ ## Summary
582
+ Status: PASS|NEEDS_ATTENTION
583
+ Artifacts: X conventions, Y ADRs, Z diagrams, W features
584
+ ```
585
+ ```
586
+
587
+ ---
588
+
589
+ ## Execution rules
590
+
591
+ 1. **Pre-checks**: Verify prerequisites + add `.onboarding-context.json` to `.gitignore`. STOP if missing.
592
+ 2. **Phase 0**: Build discovery context including feature IDs, candidate conventions, and candidate decisions.
593
+ 3. **Phase 0.5**: Present features + conventions + decisions to user with `AskUserQuestion`. Wait for validation.
594
+ 4. **Phase 1**: Launch ALL 3 agents in a single message (parallel).
595
+ 5. **Phase 2**: After ALL 3 agents return, run verifier. Present report to user.
596
+ 6. Do NOT commit. Let the user review first.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tcsetup",
3
- "version": "1.0.5",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "description": "Bootstrap a new project with BMAD, Spec Kit, Agreement System, and Mermaid Workbench in one command.",
6
6
  "bin": {
@@ -21,7 +21,8 @@
21
21
  "url": "https://github.com/tcanaud/tcsetup.git"
22
22
  },
23
23
  "files": [
24
- "bin/"
24
+ "bin/",
25
+ "commands/"
25
26
  ],
26
27
  "engines": {
27
28
  "node": ">=18.0.0"