chati-dev 4.2.2 → 4.3.1

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.
Files changed (221) hide show
  1. package/README.md +80 -53
  2. package/bin/chati.js +170 -5
  3. package/framework/agents/build/dev.md +509 -76
  4. package/framework/agents/deploy/devops.md +40 -25
  5. package/framework/agents/discover/brief.md +158 -22
  6. package/framework/agents/discover/brownfield-wu.md +26 -14
  7. package/framework/agents/discover/greenfield-wu.md +102 -14
  8. package/framework/agents/plan/architect-data-engineer.md +6 -6
  9. package/framework/agents/plan/architect-system.md +46 -12
  10. package/framework/agents/plan/architect.md +40 -20
  11. package/framework/agents/plan/detail.md +38 -24
  12. package/framework/agents/plan/phases.md +36 -26
  13. package/framework/agents/plan/tasks.md +114 -33
  14. package/framework/agents/plan/ux-brand-architect.md +240 -8
  15. package/framework/agents/plan/ux-component-engineer.md +28 -13
  16. package/framework/agents/plan/ux-researcher.md +7 -6
  17. package/framework/agents/plan/ux.md +55 -22
  18. package/framework/agents/quality/qa-implementation.md +143 -74
  19. package/framework/agents/quality/qa-planning.md +115 -42
  20. package/framework/agents/quality/qa-visual.md +448 -0
  21. package/framework/agents/shared/visualizer.md +128 -0
  22. package/framework/config.yaml +7 -6
  23. package/framework/constitution.md +127 -44
  24. package/framework/context/governance.md +12 -7
  25. package/framework/context/quality.md +6 -5
  26. package/framework/context/root.md +6 -6
  27. package/framework/data/entity-registry.yaml +377 -4
  28. package/framework/data/model-limits.json +19 -0
  29. package/framework/domains/agents/qa-visual.yaml +74 -0
  30. package/framework/domains/constitution.yaml +46 -2
  31. package/framework/domains/workflows/greenfield-fullstack.yaml +2 -2
  32. package/framework/hooks/advance-trigger.js +131 -0
  33. package/framework/hooks/brief-validator.js +83 -0
  34. package/framework/hooks/constitution-guard.js +24 -5
  35. package/framework/hooks/license-guard.js +62 -27
  36. package/framework/hooks/mode-governance.js +13 -2
  37. package/framework/hooks/model-governance.js +1 -0
  38. package/framework/hooks/post-dev.js +207 -0
  39. package/framework/hooks/prism-engine.js +274 -105
  40. package/framework/hooks/reasoning-escalator.js +371 -0
  41. package/framework/hooks/reference-trigger.js +117 -0
  42. package/framework/hooks/session-digest.js +50 -1
  43. package/framework/hooks/settings.json +32 -1
  44. package/framework/hooks/style-guard.js +25 -6
  45. package/framework/hooks/team-quality-gate.js +19 -12
  46. package/framework/hooks/undercover-guard.js +4 -2
  47. package/framework/i18n/en.yaml +3 -3
  48. package/framework/i18n/es.yaml +3 -3
  49. package/framework/i18n/fr.yaml +3 -3
  50. package/framework/i18n/pt.yaml +3 -3
  51. package/framework/intelligence/context-engine.md +4 -5
  52. package/framework/intelligence/decision-engine.md +1 -1
  53. package/framework/intelligence/hooks-performance.md +3 -3
  54. package/framework/migrations/v1.0-to-v1.1.yaml +1 -1
  55. package/framework/migrations/v1.4-to-v2.0.yaml +11 -11
  56. package/framework/migrations/v4.0-to-v4.1.yaml +2 -2
  57. package/framework/migrations/v4.2-to-v4.3.yaml +29 -0
  58. package/framework/orchestrator/chati-router.js +441 -0
  59. package/framework/orchestrator/chati-update.md +40 -40
  60. package/framework/orchestrator/chati.md +295 -94
  61. package/framework/rules/human-writing-style.md +47 -0
  62. package/framework/scaffold/motion-premium/README.md +99 -0
  63. package/framework/scaffold/motion-premium/app/globals.css.template +400 -0
  64. package/framework/scaffold/motion-premium/app/layout.tsx.template +110 -0
  65. package/framework/scaffold/motion-premium/components/animation/BackgroundCrossfadeProvider.tsx.template +170 -0
  66. package/framework/scaffold/motion-premium/components/animation/LenisProvider.tsx.template +49 -0
  67. package/framework/scaffold/motion-premium/components/animation/PageTransitionWrapper.tsx.template +83 -0
  68. package/framework/scaffold/motion-premium/components/animation/Preloader.tsx.template +171 -0
  69. package/framework/scaffold/motion-premium/components/ui/Container.tsx.template +69 -0
  70. package/framework/scaffold/motion-premium/components/ui/PageSection.tsx.template +74 -0
  71. package/framework/scaffold/motion-premium/lib/animations/gsap.ts.template +112 -0
  72. package/framework/scaffold/motion-premium/lib/animations/refreshCoordinator.ts.template +75 -0
  73. package/framework/scaffold/motion-premium/lib/animations/tokens.ts.template +119 -0
  74. package/framework/scaffold/motion-premium/lib/animations/useGsapContext.ts.template +92 -0
  75. package/framework/scaffold/motion-premium/lib/animations/useScrollSnapStepper.ts.template +265 -0
  76. package/framework/scaffold/motion-premium/lib/animations/useSmoothScroll.ts.template +67 -0
  77. package/framework/scaffold/motion-premium/lib/brand.ts.template +43 -0
  78. package/framework/scaffold/motion-premium/scaffold.yaml +178 -0
  79. package/framework/scaffold/motion-premium-3d/README.md +90 -0
  80. package/framework/scaffold/motion-premium-3d/app/(3d)/scroll-demo/ScrollDemoCanvas.tsx.template +81 -0
  81. package/framework/scaffold/motion-premium-3d/app/(3d)/scroll-demo/ScrollDemoClient.tsx.template +75 -0
  82. package/framework/scaffold/motion-premium-3d/app/(3d)/scroll-demo/page.tsx.template +26 -0
  83. package/framework/scaffold/motion-premium-3d/components/3d/CameraRig.tsx.template +100 -0
  84. package/framework/scaffold/motion-premium-3d/components/3d/CanvasProvider.tsx.template +85 -0
  85. package/framework/scaffold/motion-premium-3d/components/3d/InvalidateOnScroll.tsx.template +51 -0
  86. package/framework/scaffold/motion-premium-3d/components/3d/MeshCrossfade.tsx.template +79 -0
  87. package/framework/scaffold/motion-premium-3d/components/3d/ScrollCrossfade.tsx.template +88 -0
  88. package/framework/scaffold/motion-premium-3d/components/3d/ScrollScene.tsx.template +121 -0
  89. package/framework/scaffold/motion-premium-3d/components/webgl/SceneFallback.tsx.template +65 -0
  90. package/framework/scaffold/motion-premium-3d/components/webgl/WebGLContext.tsx.template +68 -0
  91. package/framework/scaffold/motion-premium-3d/lib/webgl/detect.ts.template +69 -0
  92. package/framework/scaffold/motion-premium-3d/scaffold.yaml +136 -0
  93. package/framework/schemas/session.schema.json +109 -21
  94. package/framework/scripts/reference-capture.js +430 -0
  95. package/framework/scripts/visual-qa.js +686 -0
  96. package/framework/tasks/orchestrator-handoff.md +1 -1
  97. package/framework/tasks/orchestrator-resume.md +1 -1
  98. package/framework/tasks/orchestrator-route.md +1 -1
  99. package/framework/tasks/orchestrator-status.md +3 -3
  100. package/framework/tasks/qa-planning-gate-define.md +1 -1
  101. package/framework/templates/brandbook-html-tmpl.md +2 -2
  102. package/framework/templates/brandbook-tmpl.yaml +1 -1
  103. package/framework/templates/component-spec-tmpl.yaml +1 -1
  104. package/framework/templates/design-token-tmpl.yaml +1 -1
  105. package/framework/templates/icon-system-tmpl.yaml +1 -1
  106. package/framework/templates/team-planning-tasks.yaml +6 -5
  107. package/framework/workflows/brownfield-discovery.yaml +2 -2
  108. package/framework/workflows/brownfield-fullstack.yaml +15 -11
  109. package/framework/workflows/brownfield-service.yaml +14 -10
  110. package/framework/workflows/brownfield-ui.yaml +15 -11
  111. package/framework/workflows/greenfield-fullstack.yaml +16 -13
  112. package/framework/workflows/quick-flow.yaml +3 -3
  113. package/framework/workflows/standard-flow.yaml +12 -9
  114. package/package.json +12 -6
  115. package/src/autonomy/autonomous-gate.js +1 -0
  116. package/src/autonomy/build-state.js +1 -2
  117. package/src/autonomy/progress-reporter.js +1 -1
  118. package/src/config/agent-customizer.js +11 -3
  119. package/src/config/claude-settings-generator.js +27 -7
  120. package/src/config/context-file-generator.js +41 -21
  121. package/src/config/framework-adapter.js +1 -0
  122. package/src/config/gemini-hooks-generator.js +19 -7
  123. package/src/config/mcp-configs.js +1 -0
  124. package/src/context/layers/l1-global.js +2 -1
  125. package/src/dashboard/data-reader.js +4 -3
  126. package/src/dashboard/layout.js +2 -1
  127. package/src/decision/analyzer.js +6 -30
  128. package/src/decision/engine.js +4 -28
  129. package/src/decision/registry-healer.js +3 -2
  130. package/src/decision/registry-updater.js +23 -14
  131. package/src/extensions/loader.js +2 -8
  132. package/src/gates/g1-planning-complete.js +2 -1
  133. package/src/gates/g2-qa-planning.js +2 -1
  134. package/src/gates/g3-implementation.js +2 -1
  135. package/src/gates/g4-qa-implementation.js +3 -2
  136. package/src/gates/g5-deploy-ready.js +2 -1
  137. package/src/health/engine.js +4 -3
  138. package/src/installer/core.js +431 -81
  139. package/src/installer/preflight.js +131 -0
  140. package/src/installer/provider-overlay.js +3 -3
  141. package/src/installer/scaffold-applier.js +358 -0
  142. package/src/installer/templates.js +46 -29
  143. package/src/installer/validator.js +17 -12
  144. package/src/intelligence/registry-manager.js +22 -29
  145. package/src/intelligence/timeline.js +11 -6
  146. package/src/license/commands.js +1 -1
  147. package/src/license/wait.js +102 -0
  148. package/src/memory/agent-memory.js +81 -0
  149. package/src/memory/dream.js +32 -1
  150. package/src/merger/replace-merger.js +28 -15
  151. package/src/orchestrator/agent-selector.js +2 -1
  152. package/src/orchestrator/cli.js +1880 -71
  153. package/src/orchestrator/doctor.js +270 -0
  154. package/src/orchestrator/handoff-engine.js +4 -3
  155. package/src/orchestrator/index.js +2 -0
  156. package/src/orchestrator/pipeline-manager.js +306 -15
  157. package/src/orchestrator/session-manager.js +339 -6
  158. package/src/tasks/handoff.js +3 -2
  159. package/src/telemetry/config.js +4 -3
  160. package/src/telemetry/schema.js +1 -0
  161. package/src/terminal/collector.js +3 -2
  162. package/src/terminal/index.js +1 -2
  163. package/src/terminal/isolation.js +52 -18
  164. package/src/terminal/prompt-builder.js +42 -25
  165. package/src/terminal/run-parallel.js +1 -1
  166. package/src/terminal/run-team.js +3 -3
  167. package/src/terminal/team-task-list.js +43 -4
  168. package/src/upgrade/backup.js +3 -2
  169. package/src/upgrade/checker.js +3 -2
  170. package/src/upgrade/migrator.js +65 -7
  171. package/src/upgrade/tracked-files-detector.js +86 -0
  172. package/src/upgrade/user-messages.js +94 -0
  173. package/src/utils/config-parser.js +2 -1
  174. package/src/utils/feature-flags.js +2 -1
  175. package/src/utils/flatten-entities.js +69 -0
  176. package/src/utils/framework-dir.js +16 -0
  177. package/src/utils/model-id.js +85 -0
  178. package/src/utils/provider-limits.js +84 -23
  179. package/src/utils/schema-validator.js +1 -1
  180. package/src/wizard/i18n.js +5 -4
  181. package/src/wizard/index.js +14 -0
  182. package/assets/logo - c/303/263pia.png +0 -0
  183. package/assets/logo.svg +0 -42
  184. package/assets/logo2.png +0 -0
  185. package/assets/social-preview.png +0 -0
  186. package/scripts/bundle-framework.js +0 -69
  187. package/scripts/changelog-generator.js +0 -222
  188. package/scripts/codebase-mapper.js +0 -728
  189. package/scripts/commit-message-generator.js +0 -167
  190. package/scripts/coverage-analyzer.js +0 -260
  191. package/scripts/dependency-analyzer.js +0 -280
  192. package/scripts/doctor/checks/agents.js +0 -77
  193. package/scripts/doctor/checks/constitution.js +0 -41
  194. package/scripts/doctor/checks/domain-alignment.js +0 -58
  195. package/scripts/doctor/checks/prism-layers.js +0 -84
  196. package/scripts/doctor/checks/registry.js +0 -55
  197. package/scripts/doctor/checks/schemas.js +0 -61
  198. package/scripts/doctor/fixes/reference-fix.js +0 -100
  199. package/scripts/doctor/fixes/registry-fix.js +0 -56
  200. package/scripts/doctor/index.js +0 -212
  201. package/scripts/framework-analyzer.js +0 -308
  202. package/scripts/generate-constitution-domain.js +0 -253
  203. package/scripts/generate-signing-key.js +0 -33
  204. package/scripts/health-check.js +0 -481
  205. package/scripts/ide-sync.js +0 -326
  206. package/scripts/performance-analyzer.js +0 -325
  207. package/scripts/plan-tracker.js +0 -278
  208. package/scripts/populate-entity-registry.js +0 -481
  209. package/scripts/pr-review.js +0 -317
  210. package/scripts/rollback-manager.js +0 -310
  211. package/scripts/semantic-lint.js +0 -328
  212. package/scripts/sign-manifest.js +0 -53
  213. package/scripts/stuck-detector.js +0 -343
  214. package/scripts/test-quality-assessment.js +0 -257
  215. package/scripts/validate-agents.js +0 -368
  216. package/scripts/validate-package.js +0 -505
  217. package/scripts/validate-tasks.js +0 -465
  218. package/src/autonomy/worktree-manager.js +0 -250
  219. package/src/intelligence/decision-engine.js +0 -256
  220. package/src/intelligence/document-sharder.js +0 -221
  221. package/src/intelligence/elicitation.js +0 -265
package/README.md CHANGED
@@ -20,9 +20,9 @@
20
20
 
21
21
  ## What is Chati.dev?
22
22
 
23
- Chati.dev is a system that **turns AI into a structured development team**. Instead of chatting with a single AI that forgets everything between sessions, you get specialized agents each with a clear role working together through a defined pipeline.
23
+ Chati.dev is a system that **turns AI into a structured development team**. Instead of chatting with a single AI that forgets everything between sessions, you get specialized agents - each with a clear role - working together through a defined pipeline.
24
24
 
25
- You describe what you want to build. The agents handle requirements, architecture, planning, coding, testing, and deployment in order, with quality gates between each phase.
25
+ You describe what you want to build. The agents handle requirements, architecture, planning, coding, testing, and deployment - in order, with quality gates between each phase.
26
26
 
27
27
  ```
28
28
  You → DISCOVER → PLAN → BUILD → DEPLOY → Done
@@ -39,9 +39,9 @@ Every decision is saved. Every artifact is validated. If you close your laptop a
39
39
 
40
40
  AI-assisted development today has three critical issues:
41
41
 
42
- 1. **Context Loss** AI forgets decisions across sessions, leading to inconsistent implementations
43
- 2. **Planning Gaps** Jumping straight to code without structured requirements leads to rework
44
- 3. **Vendor Lock-in** Most AI dev tools only work with one provider, limiting flexibility
42
+ 1. **Context Loss** - AI forgets decisions across sessions, leading to inconsistent implementations
43
+ 2. **Planning Gaps** - Jumping straight to code without structured requirements leads to rework
44
+ 3. **Vendor Lock-in** - Most AI dev tools only work with one provider, limiting flexibility
45
45
 
46
46
  ### The Solution
47
47
 
@@ -54,7 +54,7 @@ Chati.dev introduces **Agent-Driven Development**: a pipeline where each agent o
54
54
  ### Prerequisites
55
55
 
56
56
  - **Node.js** >= 20.0.0 ([download](https://nodejs.org/))
57
- - **An AI CLI** at least one of:
57
+ - **An AI CLI** - at least one of:
58
58
  - [Claude Code](https://docs.anthropic.com/en/docs/claude-code/overview) (recommended)
59
59
  - [Gemini CLI](https://github.com/google-gemini/gemini-cli)
60
60
  - [Codex CLI](https://github.com/openai/codex)
@@ -73,7 +73,7 @@ The wizard guides you through 4 steps:
73
73
  |------|-------------|
74
74
  | **Language** | English, Portuguese, Spanish, or French |
75
75
  | **Project Type** | Greenfield (new) or Brownfield (existing) |
76
- | **AI Provider** | Claude, Gemini, or Codex auto-configures optimal models per agent |
76
+ | **AI Provider** | Claude, Gemini, or Codex - auto-configures optimal models per agent |
77
77
  | **Confirm** | Review summary and proceed |
78
78
 
79
79
  ### 2. Activate the orchestrator
@@ -101,7 +101,7 @@ The agents guide you through each phase:
101
101
  | **BUILD** | Dev agent implements the code, task by task | Review code as it's built |
102
102
  | **DEPLOY** | DevOps agent handles git, deployment, and documentation | Confirm deployment settings |
103
103
 
104
- Quality gates run automatically between phases if something doesn't meet the threshold, the system loops back and fixes it.
104
+ Quality gates run automatically between phases. If something doesn't meet the threshold, the system loops back and fixes it.
105
105
 
106
106
  ### Monitor progress
107
107
 
@@ -118,7 +118,7 @@ npx chati-dev status --watch # Auto-refresh every 5s
118
118
  | **Gemini CLI** | `/chati exit` | `/chati` |
119
119
  | **Codex CLI** | `$chati exit` | `$chati` |
120
120
 
121
- The system saves your full session state pipeline position, current agent, decisions, and context. You resume exactly where you left off, even across days or machines.
121
+ The system saves your full session state (pipeline position, current agent, decisions, and context). You resume exactly where you left off, even across days or machines.
122
122
 
123
123
  ---
124
124
 
@@ -126,14 +126,18 @@ The system saves your full session state — pipeline position, current agent, d
126
126
 
127
127
  | Feature | What it means |
128
128
  |---------|--------------|
129
- | **Specialized Agents** | Each agent has a defined mission, success criteria, and handoff protocol not one AI trying to do everything |
129
+ | **Specialized Agents** | Each agent has a defined mission, success criteria, and handoff protocol. Not one AI trying to do everything |
130
+ | **Agent Teams** | Planning Team (Detail + Architect + UX + QA-Planning) and Build Team (Dev + QA-Implementation) with Wave-Based Pipeline. Teams work in parallel with peer-to-peer communication, cross-review, and intra-team quality assurance. No single agent bottleneck |
131
+ | **Visual QA** | QA-Visual agent validates the visual experience: screenshots at 5 scroll positions, hover states, GSAP/Lenis verification, brandbook compliance. Powered by Playwright. |
132
+ | **Premium Animations** | GSAP + ScrollTrigger + Lenis as mandatory stack for UI projects. Every page has scroll reveals, micro-interactions, and smooth scrolling. |
130
133
  | **Multi-CLI Architecture** | Choose your AI provider at install time: Claude, Gemini, or Codex. Each agent gets the optimal model for that provider |
131
- | **Quality Gates** | Every phase is validated before moving forward. 3-tier verdicts: APPROVED, NEEDS_REVISION, or BLOCKED |
132
- | **Context Persistence** | Sessions survive restarts. Close your IDE, come back next week the system remembers everything |
134
+ | **Quality Gates** | Every phase is validated before moving forward, including QA-Visual for visual quality. 3-tier verdicts: APPROVED, NEEDS_REVISION, or BLOCKED |
135
+ | **Fault Vector Protocol** | Root Layer Routing classifies bugs by origin (INTENT/SPEC/CODE/DEFER). Evidence-Bound Verdicts, Decision Trail, and Echo Detection prevent cyclical rework |
136
+ | **Context Persistence** | Sessions survive restarts. Close your IDE, come back next week - the system remembers everything |
133
137
  | **Session Lock** | Once activated, you stay inside the system. No accidentally "falling out" into generic AI mode |
134
- | **Multi-Terminal** | Autonomous agents run in parallel in separate terminals. Detail, Architect Manager, and UX Manager coordinate sub-agent pools simultaneously |
138
+ | **Multi-Terminal** | Autonomous agents run in parallel. Planning Team (Detail + Architect + UX + QA-Planning) and Build Team (Dev + QA-Implementation) coordinate via peer-to-peer mailbox |
135
139
  | **Memory System** | The system learns from mistakes. Gotchas are captured automatically and recalled when relevant |
136
- | **Execution Profiles** | Three profiles explore (read-only), guided (default), autonomous (gate >= 95%) with safety net and circuit breaker |
140
+ | **Execution Profiles** | Three profiles: explore (read-only), guided (default), autonomous (gate >= 95%). Includes safety net and circuit breaker |
137
141
  | **IDE-Agnostic** | Works with Claude Code, VS Code, Cursor, Gemini CLI, Codex CLI, and AntiGravity |
138
142
  | **4 Languages** | Interface supports English, Portuguese, Spanish, and French. Artifacts are always generated in English |
139
143
  | **Supply Chain Security** | Every file is cryptographically signed (Ed25519). Tampered packages are blocked on install |
@@ -182,7 +186,7 @@ Each provider uses its own CLI syntax. Chati.dev handles this transparently:
182
186
  | Gemini | `gemini --model <id>` | `gemini --model gemini-2.5-pro` |
183
187
  | Codex | `codex exec -m <id>` | `codex exec -m gpt-5.3-codex` |
184
188
 
185
- Prompts are piped via stdin for all providers. You can override individual agent models in `chati.dev/config.yaml` under `agent_overrides`.
189
+ Prompts are piped via stdin for all providers. You can override individual agent models in `.chati.dev/config.yaml` under `agent_overrides`.
186
190
 
187
191
  ---
188
192
 
@@ -207,10 +211,9 @@ The system starts in `guided` mode. Transition to `autonomous` requires both QA
207
211
  | Phase | Agents | What they do |
208
212
  |-------|--------|-------------|
209
213
  | **DISCOVER** | Greenfield WU, Brownfield WU, Brief | Interview you, understand your project, extract requirements |
210
- | **PLAN** | Detail, Architect Manager (System Architect + Data Engineer), UX Manager (Brand Architect + Researcher + Component Engineer), Phases, Tasks | Create PRD, design architecture, define UX, break work into phases and tasks |
211
- | **BUILD** | Dev | Implement code task by task, following the plan |
214
+ | **PLAN** | Planning Team (Detail + Architect + UX + QA-Planning), Phases, Tasks | Create PRD, architecture, UX spec with cross-review. QA-Planning validates all 3 artifacts before the team dissolves |
215
+ | **BUILD** | Build Team (Dev + QA-Implementation) with Wave-Based Pipeline. After build: QA-Visual validates visual quality. | Implement code task by task, with per-task quality review and visual validation |
212
216
  | **DEPLOY** | DevOps | Handle git operations, deployment, and documentation |
213
- | **Quality** | QA-Planning, QA-Implementation | Validate plan coherence (>= 95%) and code quality (>= 95%) between phases |
214
217
 
215
218
  ### How the Pipeline Works
216
219
 
@@ -230,30 +233,30 @@ The system starts in `guided` mode. Transition to `autonomous` requires both QA
230
233
  │ WU interviews you → Brief compiles │
231
234
  │ requirements into a structured doc │
232
235
  │ │
233
- ├─ Spawns separate terminals ────────────┐
234
- │ (using your selected AI provider)
236
+ ├─ Spawns Planning Team ──────────────────┐
237
+ │ (4 agents, peer communication)
235
238
  │ │
236
- │ PLAN (autonomous, parallel)
239
+ │ PLAN
237
240
  │ Detail ───┐ │
238
241
  │ Architect ├─ run simultaneously │
239
- │ UX ───────┘
242
+ │ UX ───────┘ with cross-review
243
+ │ │ │
244
+ │ QA-Planning activates after trio │
245
+ │ Reviews all 3 artifacts (>= 95%) │
246
+ │ Sends feedback via mailbox │
247
+ │ Team dissolves when approved │
248
+ │ │ │
240
249
  │ Then: Phases → Tasks │
241
250
  │ │
242
- ├─ Quality Gate ─────────────────────────┐
243
-
244
- │ QA-Planning validates the plan │
245
- │ Must score >= 95% to proceed │
246
- │ │
247
- ├─ Spawns terminal(s) ───────────────────┐
251
+ ├─ Spawns Build Team ────────────────────┐
252
+ (2 agents, Wave-Based Pipeline)
248
253
  │ │
249
254
  │ BUILD │
250
- │ Dev implements tasks (parallel
251
- when tasks are independent)
252
-
253
- ├─ Quality Gate ─────────────────────────┐
254
-
255
- │ QA-Implementation validates code │
256
- │ Tests + static analysis + coverage │
255
+ Build Waves: Dev + QA in parallel
256
+ Cleanup Wave: fixes remaining warns
257
+ Visual QA Wave: QA-Visual validates
258
+ │ screenshots, GSAP/Lenis, brandbook
259
+ Final QA: Triple Review
257
260
  │ │
258
261
  └─ Spawns terminal ──────────────────────┐
259
262
 
@@ -277,18 +280,18 @@ Three systems operate transparently behind the pipeline:
277
280
 
278
281
  ### Constitution
279
282
 
280
- The system is governed by a **22-article Constitution** that enforces agent behavior, quality standards, security, and system integrity:
283
+ The system is governed by a **23-article Constitution** that enforces agent behavior, quality standards, security, and system integrity:
281
284
 
282
- - **Agent Governance** Every agent has a defined mission, scope, and success criteria
283
- - **Quality Standards** Minimum 95% score on quality gates. 3-tier verdicts (APPROVED / NEEDS_REVISION / BLOCKED)
284
- - **Security** No secrets in system files. No destructive operations without confirmation. Ed25519 supply chain verification
285
- - **Mode Governance** Planning mode can't modify project code. Build mode has full access
286
- - **Session Lock** Once activated, all messages route through the orchestrator
287
- - **Model Governance** Each agent runs on its designated model, enforced by the CLI adapter
288
- - **Execution Profiles** Explore, guided, and autonomous modes with safety net and circuit breaker
289
- - **Multi-CLI** Provider-agnostic architecture with adapter pattern and automatic model mapping
290
- - **Agent Teams** Real-time peer communication between agents with cross-review, per-task QA, and sealed-bid quality assurance
291
- - **Fault Vector Protocol** Root Layer Routing, Evidence-Bound Verdicts, Decision Trail, and Echo Detection for adversarial quality
285
+ - **Agent Governance** - Every agent has a defined mission, scope, and success criteria
286
+ - **Quality Standards** - Minimum 95% score on quality gates. 3-tier verdicts (APPROVED / NEEDS_REVISION / BLOCKED)
287
+ - **Security** - No secrets in system files. No destructive operations without confirmation. Ed25519 supply chain verification
288
+ - **Mode Governance** - Planning mode can't modify project code. Build mode has full access
289
+ - **Session Lock** - Once activated, all messages route through the orchestrator
290
+ - **Model Governance** - Each agent runs on its designated model, enforced by the CLI adapter
291
+ - **Execution Profiles** - Explore, guided, and autonomous modes with safety net and circuit breaker
292
+ - **Multi-CLI** - Provider-agnostic architecture with adapter pattern and automatic model mapping
293
+ - **Agent Teams** - Real-time peer communication between agents with cross-review, per-task QA, and sealed-bid quality assurance
294
+ - **Fault Vector Protocol** - Root Layer Routing, Evidence-Bound Verdicts, Decision Trail, and Echo Detection for adversarial quality
292
295
 
293
296
  ---
294
297
 
@@ -350,7 +353,31 @@ All IDEs use a thin router file that points to the same orchestrator. Your proje
350
353
 
351
354
  ## Project Structure
352
355
 
353
- The structure below shows the Claude Code layout (default). Gemini and Codex get equivalent files in their native locations.
356
+ At a glance, an installed project looks like this:
357
+
358
+ ```
359
+ your-project/
360
+ ├── CLAUDE.md # Project context (auto-generated)
361
+ ├── CLAUDE.local.md # Runtime session lock
362
+ ├── artifacts/ # Pipeline output (visible to user)
363
+ │ ├── 0-WU/
364
+ │ ├── 1-Brief/
365
+ │ ├── 2-PRD/
366
+ │ ├── 3-Architecture/
367
+ │ ├── 4-UX/
368
+ │ └── handoffs/
369
+ ├── .chati.dev/ # Framework (hidden)
370
+ │ ├── agents/
371
+ │ ├── hooks/
372
+ │ ├── orchestrator/
373
+ │ ├── constitution.md
374
+ │ └── config.yaml
375
+ ├── .chati/ # Runtime session state (hidden)
376
+ ├── .claude/ # Claude Code settings + rules (hidden)
377
+ └── .gitignore
378
+ ```
379
+
380
+ The full layout below shows the Claude Code layout (default). Gemini and Codex get equivalent files in their native locations.
354
381
 
355
382
  ```
356
383
  your-project/
@@ -388,8 +415,8 @@ your-project/
388
415
  ├── AGENTS.md # Project context with inline governance
389
416
  ├── AGENTS.override.md # Runtime state / session lock (gitignored)
390
417
 
391
- │── # ─── Framework ─────────────────────
392
- ├── chati.dev/
418
+ │── # ─── Framework (hidden) ────────────
419
+ ├── .chati.dev/
393
420
  │ ├── orchestrator/ # Main orchestrator
394
421
  │ ├── agents/ # Agent definitions
395
422
  │ │ ├── discover/ # Greenfield WU, Brownfield WU, Brief
@@ -410,7 +437,7 @@ your-project/
410
437
  │ ├── data/ # Entity registry
411
438
  │ ├── i18n/ # EN, PT, ES, FR translations
412
439
  │ ├── migrations/ # Version migration scripts
413
- │ ├── constitution.md # 22 Articles + Preamble
440
+ │ ├── constitution.md # 23 Articles + Preamble
414
441
  │ └── config.yaml # System configuration
415
442
  └── packages/
416
443
  └── chati-dev/ # CLI + runtime engine
@@ -447,7 +474,7 @@ Upgrades include automatic backup, migrations, validation, and config merging. R
447
474
 
448
475
  ## Contributing
449
476
 
450
- We welcome contributions agents, templates, workflows, translations, and CLI improvements. See [CONTRIBUTING.md](.github/CONTRIBUTING.md) for guidelines.
477
+ We welcome contributions: agents, templates, workflows, translations, and CLI improvements. See [CONTRIBUTING.md](.github/CONTRIBUTING.md) for guidelines.
451
478
 
452
479
  ## Security
453
480
 
@@ -455,11 +482,11 @@ For security concerns, see our [Security Policy](.github/SECURITY.md).
455
482
 
456
483
  ## License
457
484
 
458
- [Elastic License 2.0](LICENSE) free to use for any purpose; you may not offer it as a hosted/managed service to third parties or remove licensing notices.
485
+ [Elastic License 2.0](LICENSE) - free to use for any purpose; you may not offer it as a hosted/managed service to third parties or remove licensing notices.
459
486
 
460
487
  ---
461
488
 
462
489
  <p align="center">
463
490
  <sub>Built with structure, validated by agents, governed by constitution.</sub><br>
464
- <sub>Chati.dev v4.2 "Phoenix" &copy; 2026</sub>
491
+ <sub>Chati.dev v4.3.0 "Phoenix" &copy; 2026</sub>
465
492
  </p>
package/bin/chati.js CHANGED
@@ -9,6 +9,7 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
9
9
  const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf-8'));
10
10
 
11
11
  import { logBanner } from '../src/utils/logger.js';
12
+ import { resolveFrameworkDir } from '../src/utils/framework-dir.js';
12
13
 
13
14
  function showBanner() {
14
15
  let logoText;
@@ -22,7 +23,32 @@ function showBanner() {
22
23
 
23
24
  const args = process.argv.slice(2);
24
25
  const command = args[0] || 'init';
25
- const targetDir = resolve(args.find(a => !a.startsWith('-') && a !== command) || process.cwd());
26
+ // Known subcommands and agent names that should NOT be mistaken for targetDir paths.
27
+ // Without this, `chati orchestrate advance --agent detail` resolves targetDir to `<cwd>/detail/`.
28
+ const KNOWN_SUBCOMMANDS = new Set([
29
+ // CLI subcommands
30
+ 'next', 'advance', 'init', 'status', 'validate-handoff', 'deviation', 'exit',
31
+ 'providers', 'detect-flow', 'backlog', 'qa-plan-score', 'qa-impl-score', 'scan',
32
+ 'spawn-team', 'team-status', 'team-dissolve',
33
+ 'stats', 'list', 'search', 'clean', 'check', // memory/registry subcommands
34
+ 'scaffold', // scaffold preset commands
35
+ // Scaffold preset ids (prevent consumption as targetDir after `scaffold <preset>`)
36
+ 'motion-premium',
37
+ // Agent names (prevent consumption as targetDir when passed via --agent flag)
38
+ 'greenfield-wu', 'brownfield-wu', 'brief', 'detail', 'architect', 'ux',
39
+ 'phases', 'tasks', 'qa-planning', 'qa-implementation', 'qa-visual', 'dev', 'devops',
40
+ ]);
41
+ // Skip values that follow --flag patterns (e.g., --agent detail, --score 100)
42
+ const flagValues = new Set();
43
+ for (let i = 0; i < args.length; i++) {
44
+ if (args[i].startsWith('--') && i + 1 < args.length && !args[i + 1].startsWith('-')) {
45
+ flagValues.add(args[i + 1]);
46
+ }
47
+ }
48
+ const targetDir = resolve(
49
+ args.find(a => !a.startsWith('-') && a !== command && !KNOWN_SUBCOMMANDS.has(a) && !flagValues.has(a))
50
+ || process.cwd()
51
+ );
26
52
 
27
53
  async function main() {
28
54
  switch (command) {
@@ -109,12 +135,44 @@ async function main() {
109
135
  console.log(' Syncing framework files...');
110
136
  try {
111
137
  const { copyFrameworkFiles } = await import('../src/installer/core.js');
112
- copyFrameworkFiles(join(targetDir, 'chati.dev'));
138
+ copyFrameworkFiles(join(targetDir, resolveFrameworkDir(targetDir)));
113
139
  console.log(' Framework files synced.');
114
140
  } catch (err) {
115
141
  console.log(` Framework sync skipped: ${err.message}`);
116
142
  }
117
143
 
144
+ // 2.6. Re-bundle CLI (Bug 4 part 3, v4.3.1+) — refreshes .chati.dev/_cli/
145
+ // and writes version.json so chati-router.js mismatch detection clears
146
+ // on the next invocation.
147
+ console.log(' Re-bundling CLI...');
148
+ try {
149
+ const { copyCliSource, copyCliDependencies } = await import('../src/installer/core.js');
150
+ const { writeFileSync } = await import('fs');
151
+ const fwDir = resolveFrameworkDir(targetDir);
152
+ const frameworkDir = join(targetDir, fwDir);
153
+ copyCliSource(join(__dirname, '..', 'src'), join(frameworkDir, '_cli'));
154
+ copyCliDependencies(join(__dirname, '..'), join(frameworkDir, '_cli', 'node_modules'));
155
+ writeFileSync(
156
+ join(frameworkDir, '_cli', 'version.json'),
157
+ JSON.stringify({ version: pkg.version, bundled_at: new Date().toISOString() }, null, 2),
158
+ );
159
+ console.log(' CLI re-bundled.');
160
+ } catch (err) {
161
+ console.log(` CLI rebundle skipped: ${err.message}`);
162
+ }
163
+
164
+ // 2.6. Detect tracked framework files and warn user (non-blocking)
165
+ try {
166
+ const { detectTrackedFrameworkFiles } = await import('../src/upgrade/tracked-files-detector.js');
167
+ const { renderTrackedFilesWarning } = await import('../src/upgrade/user-messages.js');
168
+ const trackedFiles = detectTrackedFrameworkFiles(targetDir);
169
+ if (trackedFiles.length > 0) {
170
+ process.stdout.write(renderTrackedFilesWarning(trackedFiles));
171
+ }
172
+ } catch {
173
+ // Non-critical — skip silently if git is unavailable
174
+ }
175
+
118
176
  // 3. Validate
119
177
  console.log(' Validating...');
120
178
  const validation = await validateInstallation(targetDir);
@@ -305,7 +363,7 @@ async function main() {
305
363
  console.log(' - Specialized agents across DISCOVER, PLAN, BUILD, DEPLOY phases');
306
364
  console.log(' - 6 workflow blueprints');
307
365
  console.log(' - 6 templates');
308
- console.log(' - Constitution (19 Articles + Preamble)');
366
+ console.log(' - Constitution (23 Articles + Preamble)');
309
367
  console.log(' - Dashboard TUI');
310
368
  console.log(' - Upgrade system with migrations');
311
369
  console.log(' - 6 IDE support');
@@ -357,6 +415,12 @@ Intelligence:
357
415
  npx chati-dev registry [stats|check] Entity registry
358
416
  npx chati-dev health System health check
359
417
 
418
+ Scaffold:
419
+ npx chati-dev scaffold List available scaffold presets
420
+ npx chati-dev scaffold <preset> Apply a scaffold preset (e.g. motion-premium)
421
+ npx chati-dev scaffold <preset> --dry-run Show what would be applied, write nothing
422
+ npx chati-dev scaffold <preset> --force Overwrite existing files
423
+
360
424
  License:
361
425
  npx chati-dev activate [--key=CHATI-XXXX] Activate license on this machine
362
426
  npx chati-dev deactivate Remove license key locally
@@ -402,10 +466,111 @@ Telemetry:
402
466
  break;
403
467
  }
404
468
 
469
+ case 'scaffold': {
470
+ const sub = args[1];
471
+ const {
472
+ resolveScaffoldSource, listPresets, applyScaffold, syncBrand, upgradeScaffold,
473
+ } = await import('../src/installer/scaffold-applier.js');
474
+
475
+ const scaffoldSrc = (() => {
476
+ try { return resolveScaffoldSource(targetDir); }
477
+ catch (e) { console.error(`Error: ${e.message}`); process.exit(1); }
478
+ })();
479
+
480
+ if (!sub || sub === 'list') {
481
+ const presets = listPresets(scaffoldSrc);
482
+ if (presets.length === 0) {
483
+ console.log('No scaffold presets found.');
484
+ } else {
485
+ console.log('Available scaffold presets:\n');
486
+ for (const p of presets) {
487
+ console.log(` ${p.id}@${p.version}`);
488
+ if (p.description) console.log(` ${p.description}`);
489
+ }
490
+ console.log(`\nApply: npx chati-dev scaffold <preset-id>`);
491
+ }
492
+ break;
493
+ }
494
+
495
+ const preset = sub;
496
+ const dryRun = args.includes('--dry-run');
497
+ const force = args.includes('--force');
498
+
499
+ if (args.includes('--sync-brand')) {
500
+ try { syncBrand(); }
501
+ catch (e) { console.log(e.message); process.exit(1); }
502
+ break;
503
+ }
504
+ if (args.includes('--upgrade')) {
505
+ try { upgradeScaffold(); }
506
+ catch (e) { console.log(e.message); process.exit(1); }
507
+ break;
508
+ }
509
+
510
+ let result;
511
+ try {
512
+ result = applyScaffold({
513
+ projectDir: targetDir,
514
+ scaffoldSourceDir: scaffoldSrc,
515
+ preset,
516
+ dryRun,
517
+ force,
518
+ });
519
+ } catch (e) {
520
+ console.error(`Error: ${e.message}`);
521
+ process.exit(1);
522
+ }
523
+
524
+ const verb = dryRun ? 'Would apply' : 'Applied';
525
+ console.log(`${verb} scaffold "${result.preset}@${result.version}" — ${result.applied.length} files:\n`);
526
+ for (const f of result.applied) console.log(` + ${f}`);
527
+ if (result.skipped.length > 0) {
528
+ console.log(`\nSkipped ${result.skipped.length} file(s):`);
529
+ for (const s of result.skipped) console.log(` - ${s.target} (${s.reason})`);
530
+ }
531
+ console.log(`\nBrand source: ${result.brandSource}`);
532
+ if (result.manifestPath) {
533
+ console.log(`Manifest: ${result.manifestPath}`);
534
+ }
535
+ if (result.skipped.some(s => s.reason === 'already-exists')) {
536
+ console.log('\nTip: use --force to overwrite existing files.');
537
+ }
538
+ break;
539
+ }
540
+
405
541
  case 'orchestrate': {
406
- const { runOrchestrate } = await import('../src/orchestrator/cli.js');
407
542
  const subCommand = args[1] || 'next';
408
- await runOrchestrate(subCommand, args.slice(1), targetDir);
543
+ // Validate subcommand exists in KNOWN_SUBCOMMANDS to prevent misparsing
544
+ // (e.g., `chati orchestrate xyz` should not silently create cwd/xyz/ as targetDir)
545
+ const VALID_ORCHESTRATE_SUBS = new Set([
546
+ 'next', 'advance', 'init', 'status', 'validate-handoff',
547
+ 'deviation', 'exit', 'providers', 'detect-flow', 'backlog',
548
+ 'qa-plan-score', 'qa-impl-score', 'scan',
549
+ 'spawn-team', 'team-status', 'team-dissolve',
550
+ ]);
551
+ if (!VALID_ORCHESTRATE_SUBS.has(subCommand)) {
552
+ console.error(`Error: Unknown orchestrate subcommand "${subCommand}".`);
553
+ console.error(`Valid: ${[...VALID_ORCHESTRATE_SUBS].join(', ')}`);
554
+ process.exit(1);
555
+ }
556
+ // Reject positional args after subcommand (orchestrate accepts only --flags).
557
+ // Prevents `chati orchestrate init <free-text>` from being misparsed as targetDir.
558
+ const orchArgs = args.slice(2);
559
+ const stray = orchArgs.find((a, i) => {
560
+ if (a.startsWith('-')) return false;
561
+ const prev = i > 0 ? orchArgs[i - 1] : null;
562
+ // skip values that follow a --flag
563
+ if (prev && prev.startsWith('--')) return false;
564
+ return true;
565
+ });
566
+ if (stray) {
567
+ console.error(`Error: Unexpected positional argument "${stray}" for orchestrate ${subCommand}.`);
568
+ console.error('orchestrate subcommands accept only --flag arguments. To set the project name, use --name "<name>".');
569
+ process.exit(1);
570
+ }
571
+ // targetDir for orchestrate is ALWAYS cwd (or auto-resolved by handleInit)
572
+ const { runOrchestrate } = await import('../src/orchestrator/cli.js');
573
+ await runOrchestrate(subCommand, args.slice(1), process.cwd());
409
574
  break;
410
575
  }
411
576