@polymorphism-tech/morph-spec 4.21.0 → 5.0.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 (213) hide show
  1. package/CLAUDE.md +57 -71
  2. package/README.md +2 -2
  3. package/bin/morph-spec.js +224 -491
  4. package/claude-plugin.json +1 -1
  5. package/docs/CHEATSHEET.md +1 -1
  6. package/docs/QUICKSTART.md +1 -1
  7. package/framework/CLAUDE.md +55 -38
  8. package/framework/MORPH.md +244 -0
  9. package/framework/agents.json +127 -1183
  10. package/framework/commands/morph-apply.md +56 -240
  11. package/framework/commands/morph-archive.md +48 -85
  12. package/framework/commands/morph-preflight.md +7 -7
  13. package/framework/commands/morph-proposal.md +35 -191
  14. package/framework/commands/morph-status.md +19 -50
  15. package/framework/commands/morph-troubleshoot.md +2 -2
  16. package/framework/evals/rubrics/README.md +44 -0
  17. package/framework/evals/rubrics/architecture.md +46 -0
  18. package/framework/evals/rubrics/code-quality.md +50 -0
  19. package/framework/evals/rubrics/contracts.md +47 -0
  20. package/framework/evals/rubrics/test-coverage.md +50 -0
  21. package/framework/evals/scenarios/dotnet-crud.yaml +42 -0
  22. package/framework/evals/scenarios/nextjs-auth.yaml +38 -0
  23. package/framework/evals/suites/standard.yaml +5 -0
  24. package/framework/evals/trace-schema.md +67 -0
  25. package/framework/hooks/claude-code/core/README.md +3 -0
  26. package/framework/hooks/claude-code/core/denylist.json +14 -0
  27. package/framework/hooks/claude-code/{pre-tool-use → core}/enforce-phase-writes.js +5 -5
  28. package/framework/hooks/claude-code/core/post-edit-typecheck.js +69 -0
  29. package/framework/hooks/claude-code/core/pre-bash-denylist.js +29 -0
  30. package/framework/hooks/claude-code/{pre-tool-use → core}/protect-spec-files.js +4 -6
  31. package/framework/hooks/claude-code/{stop → core}/validate-completion.js +13 -82
  32. package/framework/hooks/shared/phase-utils.js +20 -28
  33. package/framework/hooks/shared/state-reader.js +4 -5
  34. package/framework/{skills/level-0-meta/mcp-registry.json → mcp/registry.json} +254 -210
  35. package/framework/phases.json +40 -114
  36. package/framework/rubrics/eval-rubric.json +66 -0
  37. package/framework/skills/README.md +39 -64
  38. package/framework/skills/core/README.md +3 -0
  39. package/framework/skills/core/morph-brainstorming/SKILL.md +102 -0
  40. package/framework/skills/core/morph-eval/SKILL.md +57 -0
  41. package/framework/skills/core/morph-implement/SKILL.md +83 -0
  42. package/framework/skills/core/morph-plan/SKILL.md +64 -0
  43. package/framework/skills/core/morph-review/SKILL.md +62 -0
  44. package/framework/skills/core/morph-stack-scan/SKILL.md +109 -0
  45. package/framework/skills/core/morph-standards/SKILL.md +49 -0
  46. package/framework/standards/STANDARDS.json +32 -0
  47. package/framework/standards/frontend/design-system/ai-image-generation.md +244 -0
  48. package/framework/standards/integration/mcp/mcp-tools.md +48 -0
  49. package/framework/templates/CLAUDE.md.core.guide.md +29 -0
  50. package/framework/templates/CLAUDE.md.core.template +22 -0
  51. package/framework/templates/REGISTRY.json +4 -4
  52. package/framework/workflows/configs/fast-track.json +5 -10
  53. package/framework/workflows/configs/full.json +4 -8
  54. package/framework/workflows/configs/quick.json +32 -0
  55. package/framework/workflows/configs/standard.json +57 -64
  56. package/package.json +7 -6
  57. package/src/commands/mcp/mcp-setup.js +58 -31
  58. package/src/commands/project/doctor.js +69 -70
  59. package/src/commands/project/init.js +26 -5
  60. package/src/commands/project/status.js +18 -19
  61. package/src/commands/state/approve.js +1 -1
  62. package/src/commands/validation/validate-feature.js +18 -112
  63. package/src/core/paths/output-schema.js +133 -151
  64. package/src/core/state/phase-state-machine.js +10 -24
  65. package/src/core/state/state-manager.js +17 -17
  66. package/src/core/workflows/workflow-detector.js +214 -31
  67. package/src/core/workflows/workflow-router.js +204 -0
  68. package/src/dashboard/app/pages/AgentMap.jsx +32 -33
  69. package/src/dashboard/app/pages/LiveState.jsx +1 -1
  70. package/src/dashboard/app/pages/PhasePipeline.jsx +2 -4
  71. package/src/dashboard/app/pages/SkillsLibrary.jsx +2 -3
  72. package/src/dashboard/app/pages/Workflows.jsx +2 -2
  73. package/src/dashboard/scanner/agents-scanner.js +30 -35
  74. package/src/lib/agents/metrics-aggregator.js +1 -1
  75. package/src/lib/agents/output-collector.js +7 -8
  76. package/src/lib/context/context-builder.js +289 -0
  77. package/src/lib/detectors/claude-config-detector.js +19 -3
  78. package/src/lib/generators/context-generator.js +20 -42
  79. package/src/lib/generators/index.js +1 -0
  80. package/src/lib/generators/mandate-generator.js +512 -0
  81. package/src/lib/generators/metadata-extractor.js +1 -1
  82. package/src/lib/generators/recap-generator.js +3 -4
  83. package/src/lib/installers/mcp-installer.js +300 -92
  84. package/src/lib/phase-chain/phase-validator.js +36 -40
  85. package/src/lib/stack/stack-profile.js +74 -91
  86. package/src/lib/tasks/task-parser.js +1 -1
  87. package/src/lib/tasks/wave-resolver.js +353 -0
  88. package/src/lib/validators/checkpoint-persistence.js +2 -2
  89. package/src/lib/validators/content/cross-phase-validator.js +281 -0
  90. package/src/lib/validators/content/index.js +1 -0
  91. package/src/lib/validators/shared/emit-validator-dispatch.js +6 -56
  92. package/src/scripts/global-install.js +2 -27
  93. package/src/utils/agents-installer.js +224 -447
  94. package/src/utils/claude-settings-manager.js +57 -15
  95. package/src/utils/file-copier.js +1 -0
  96. package/src/utils/hooks-installer.js +15 -117
  97. package/src/utils/skills-installer.js +12 -18
  98. package/bin/detect-agents.js +0 -226
  99. package/bin/task-manager.js +0 -1036
  100. package/framework/agents/README.md +0 -13
  101. package/framework/agents/ai-agents/ai-system-architect.md +0 -194
  102. package/framework/agents/ai-agents/vector-search-expert.md +0 -247
  103. package/framework/agents/architecture/architecture-expert.md +0 -98
  104. package/framework/agents/architecture/morph-spec-architect.md +0 -66
  105. package/framework/agents/architecture/packages-validator.md +0 -89
  106. package/framework/agents/architecture/security-expert.md +0 -79
  107. package/framework/agents/architecture/seo-growth-hacker.md +0 -168
  108. package/framework/agents/architecture/standards-architect.md +0 -153
  109. package/framework/agents/backend/dotnet-senior.md +0 -163
  110. package/framework/agents/backend/ef-modeler.md +0 -119
  111. package/framework/agents/backend/hangfire-orchestrator.md +0 -133
  112. package/framework/agents/backend/ms-agent-expert.md +0 -55
  113. package/framework/agents/backend/neon-expert.md +0 -379
  114. package/framework/agents/frontend/css-specialist.md +0 -89
  115. package/framework/agents/frontend/design-system-validator.md +0 -100
  116. package/framework/agents/frontend/gsap-animator.md +0 -131
  117. package/framework/agents/frontend/nextjs-component-validator.md +0 -97
  118. package/framework/agents/frontend/nextjs-expert.md +0 -201
  119. package/framework/agents/frontend/ui-designer.md +0 -259
  120. package/framework/agents/infrastructure/infra-architect.md +0 -215
  121. package/framework/agents/integrations/asaas-financial.md +0 -138
  122. package/framework/agents/integrations/neon-auth.md +0 -151
  123. package/framework/agents/integrations/resend-email.md +0 -127
  124. package/framework/hooks/claude-code/post-tool-use/agent-complete.js +0 -122
  125. package/framework/hooks/claude-code/post-tool-use/dispatch.js +0 -363
  126. package/framework/hooks/claude-code/post-tool-use/handle-tool-failure.js +0 -78
  127. package/framework/hooks/claude-code/post-tool-use/validator-feedback.js +0 -194
  128. package/framework/hooks/claude-code/pre-compact/save-morph-context.js +0 -199
  129. package/framework/hooks/claude-code/pre-tool-use/task-tracking-guard.js +0 -55
  130. package/framework/hooks/claude-code/session-start/inject-morph-context.js +0 -323
  131. package/framework/hooks/claude-code/session-start/post-compact-restore.js +0 -41
  132. package/framework/hooks/claude-code/session-start/resume-context.js +0 -77
  133. package/framework/hooks/claude-code/teammate-idle/teammate-idle.js +0 -90
  134. package/framework/hooks/claude-code/user-prompt/enrich-prompt.js +0 -114
  135. package/framework/hooks/shared/compact-restore.js +0 -123
  136. package/framework/hooks/shared/dispatch-helpers.js +0 -147
  137. package/framework/hooks/shared/skill-reminder-helpers.js +0 -79
  138. package/framework/hooks/shared/stale-task-reset.js +0 -57
  139. package/framework/hooks/shared/worktree-helpers.js +0 -75
  140. package/framework/skills/level-0-meta/README.md +0 -7
  141. package/framework/skills/level-0-meta/morph-agent-teams/SKILL.md +0 -472
  142. package/framework/skills/level-0-meta/morph-brainstorming/SKILL.md +0 -174
  143. package/framework/skills/level-0-meta/morph-brainstorming/references/proposal-example.md +0 -138
  144. package/framework/skills/level-0-meta/morph-checklist/SKILL.md +0 -145
  145. package/framework/skills/level-0-meta/morph-code-review/SKILL.md +0 -250
  146. package/framework/skills/level-0-meta/morph-code-review/references/review-example.md +0 -164
  147. package/framework/skills/level-0-meta/morph-code-review/references/review-guidelines.md +0 -100
  148. package/framework/skills/level-0-meta/morph-code-review/scripts/scan-csharp.mjs +0 -151
  149. package/framework/skills/level-0-meta/morph-code-review-nextjs/SKILL.md +0 -165
  150. package/framework/skills/level-0-meta/morph-code-review-nextjs/references/review-example-nextjs.md +0 -254
  151. package/framework/skills/level-0-meta/morph-code-review-nextjs/scripts/scan-nextjs.mjs +0 -189
  152. package/framework/skills/level-0-meta/morph-frontend-review/SKILL.md +0 -344
  153. package/framework/skills/level-0-meta/morph-frontend-review/scripts/scan-accessibility.mjs +0 -376
  154. package/framework/skills/level-0-meta/morph-init/SKILL.md +0 -537
  155. package/framework/skills/level-0-meta/morph-parallel-dispatch/SKILL.md +0 -225
  156. package/framework/skills/level-0-meta/morph-post-implementation/SKILL.md +0 -382
  157. package/framework/skills/level-0-meta/morph-post-implementation/scripts/detect-dev-server.mjs +0 -153
  158. package/framework/skills/level-0-meta/morph-post-implementation/scripts/detect-stack.mjs +0 -234
  159. package/framework/skills/level-0-meta/morph-simulation-checklist/SKILL.md +0 -106
  160. package/framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md +0 -243
  161. package/framework/skills/level-0-meta/morph-tool-usage-guide/references/tools-per-phase.md +0 -169
  162. package/framework/skills/level-0-meta/morph-verification-before-completion/SKILL.md +0 -148
  163. package/framework/skills/level-0-meta/morph-verification-before-completion/scripts/check-phase-outputs.mjs +0 -110
  164. package/framework/skills/level-1-workflows/README.md +0 -7
  165. package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +0 -269
  166. package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +0 -453
  167. package/framework/skills/level-1-workflows/morph-phase-design/references/architecture-analysis-guide.md +0 -44
  168. package/framework/skills/level-1-workflows/morph-phase-design/references/spec-authoring-guide.md +0 -55
  169. package/framework/skills/level-1-workflows/morph-phase-design/references/spec-example.md +0 -253
  170. package/framework/skills/level-1-workflows/morph-phase-implement/.morph/logs/activity.json +0 -38
  171. package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +0 -493
  172. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/code-quality-reviewer-prompt.md +0 -50
  173. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/implementer-prompt.md +0 -46
  174. package/framework/skills/level-1-workflows/morph-phase-implement/prompts/spec-reviewer-prompt.md +0 -47
  175. package/framework/skills/level-1-workflows/morph-phase-implement/references/recap-example.md +0 -132
  176. package/framework/skills/level-1-workflows/morph-phase-implement/references/vsa-implementation-guide.md +0 -92
  177. package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +0 -257
  178. package/framework/skills/level-1-workflows/morph-phase-tasks/.morph/logs/activity.json +0 -14
  179. package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +0 -291
  180. package/framework/skills/level-1-workflows/morph-phase-tasks/references/task-planning-patterns.md +0 -143
  181. package/framework/skills/level-1-workflows/morph-phase-tasks/references/tasks-example.md +0 -404
  182. package/framework/skills/level-1-workflows/morph-phase-tasks/scripts/validate-tasks.mjs +0 -112
  183. package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +0 -788
  184. package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +0 -147
  185. package/framework/squad-templates/backend-only.json +0 -47
  186. package/framework/squad-templates/frontend-only.json +0 -56
  187. package/framework/squad-templates/full-stack.json +0 -74
  188. package/src/commands/agents/agent-metrics.js +0 -174
  189. package/src/commands/agents/audit-dispatch.js +0 -82
  190. package/src/commands/agents/detect-agents.js +0 -275
  191. package/src/commands/agents/dispatch-agents.js +0 -461
  192. package/src/commands/agents/index.js +0 -13
  193. package/src/commands/agents/manage-agents.js +0 -352
  194. package/src/commands/agents/project-metrics.js +0 -74
  195. package/src/commands/phase/phase-reset.js +0 -74
  196. package/src/commands/scope/escalate.js +0 -217
  197. package/src/commands/state/advance-phase.js +0 -600
  198. package/src/commands/state/phase-runner.js +0 -215
  199. package/src/commands/state/state.js +0 -444
  200. package/src/commands/task/expand.js +0 -100
  201. package/src/commands/tasks/index.js +0 -4
  202. package/src/commands/tasks/task.js +0 -105
  203. package/src/commands/templates/index.js +0 -5
  204. package/src/commands/templates/template-render.js +0 -93
  205. package/src/commands/trust/trust.js +0 -118
  206. package/src/lib/agents/agents-manager.js +0 -349
  207. package/src/lib/build/build-runner.js +0 -99
  208. package/src/lib/checkpoints/checkpoint-hooks.js +0 -111
  209. package/src/lib/contracts/sprint-contract-generator.js +0 -137
  210. package/src/lib/scope/impact-analyzer.js +0 -106
  211. package/src/lib/trust/trust-manager.js +0 -157
  212. package/src/utils/tier-helpers.js +0 -24
  213. /package/framework/hooks/claude-code/{post-tool-use → core}/loop-detect.js +0 -0
@@ -0,0 +1,22 @@
1
+ # [Nome do Projeto]
2
+
3
+ [1-2 frases sobre o domínio do sistema, quem usa, qual o principal constraint.]
4
+
5
+ ## Stack
6
+
7
+ VSA + .NET 10 + EF Core + Neon (Postgres) + Microsoft Agent Framework + Next.js (App Router) + Tailwind + Framer Motion + Shadcn + Hangfire (quando necessário).
8
+
9
+ Padrões proibidos por padrão: `Guid.NewGuid()` (use `Guid.CreateVersion7()`), classes não-sealed sem justificativa, exceptions como fluxo de controle, Repository pattern.
10
+
11
+ ## Harness
12
+
13
+ morph-spec NLH — leia `.morph/framework/MORPH.md` ao iniciar cada sessão. Em seguida, leia `.morph/state.json` para identificar a feature ativa e a fase atual; assuma o papel correspondente (Orchestrator/Specialist/Evaluator) e continue o trabalho.
14
+
15
+ ## Standards do projeto
16
+
17
+ [Liste de 3 a 6 IDs de `.morph/framework/standards/STANDARDS.json` específicos deste projeto, se algum desviar do default. Caso contrário, deixe vazio — os defaults do stack já são aplicados pelo morph-plan.]
18
+
19
+ ## Slash commands
20
+
21
+ - `/morph-proposal {feature}` — entendimento de negócio + spec/mandate/tasks (Gates 1 e 2)
22
+ - `/morph-apply {feature}` — execução autônoma das tarefas + review (Gate 3)
@@ -50,7 +50,7 @@
50
50
  "path": "docs/spec.md",
51
51
  "location": "framework",
52
52
  "category": "documentation",
53
- "phase": "design",
53
+ "phase": "plan",
54
54
  "required": true,
55
55
  "description": "Detailed technical spec with architecture, data model, API contracts",
56
56
  "outputName": "spec.md",
@@ -70,7 +70,7 @@
70
70
  "path": "feature/tasks.md",
71
71
  "location": "framework",
72
72
  "category": "documentation",
73
- "phase": "tasks",
73
+ "phase": "plan",
74
74
  "required": true,
75
75
  "description": "Task breakdown with IDs, dependencies, estimates, and checkpoints",
76
76
  "outputName": "tasks.md",
@@ -89,7 +89,7 @@
89
89
  "path": "feature/decisions.md",
90
90
  "location": "framework",
91
91
  "category": "documentation",
92
- "phase": "design",
92
+ "phase": "plan",
93
93
  "required": true,
94
94
  "description": "ADR format for documenting architectural decisions with context, alternatives, consequences",
95
95
  "outputName": "decisions.md",
@@ -109,7 +109,7 @@
109
109
  "path": "feature/recap.md",
110
110
  "location": "framework",
111
111
  "category": "documentation",
112
- "phase": "completed",
112
+ "phase": "implement",
113
113
  "required": true,
114
114
  "description": "Post-implementation summary with deliverables, metrics, lessons learned",
115
115
  "outputName": "recap.md",
@@ -31,21 +31,16 @@
31
31
  "tooltip"
32
32
  ],
33
33
  "phases": {
34
- "run": ["proposal", "tasks", "implement"],
35
- "skip": ["uiux", "design", "plan", "sync"],
34
+ "run": ["proposal", "implement"],
35
+ "skip": ["uiux", "plan", "review", "sync"],
36
36
  "skipIfCondition": {},
37
37
  "combined": {}
38
38
  },
39
- "pausePoints": [
40
- {
41
- "phase": "tasks",
42
- "question": "Approve task breakdown?"
43
- }
44
- ],
39
+ "pausePoints": [],
45
40
  "outputs": {
46
- "required": ["proposal.md", "tasks.md"],
41
+ "required": ["proposal.md"],
47
42
  "optional": ["recap.md"],
48
- "skip": ["spec.md", "contracts.cs", "contracts.ts", "plan.md", "design-system.md", "schema-analysis.md"]
43
+ "skip": ["spec.md", "contracts.cs", "contracts.ts", "plan.md", "tasks.md", "mandate.md", "design-system.md", "schema-analysis.md"]
49
44
  },
50
45
  "priority": 1
51
46
  }
@@ -29,7 +29,7 @@
29
29
  "integração"
30
30
  ],
31
31
  "phases": {
32
- "run": ["proposal", "uiux", "design", "plan", "tasks", "implement", "sync"],
32
+ "run": ["proposal", "uiux", "plan", "implement", "review", "sync"],
33
33
  "skip": [],
34
34
  "skipIfCondition": {
35
35
  "uiux": "!hasUIAgents"
@@ -46,17 +46,13 @@
46
46
  "question": "Approve UI/UX designs?",
47
47
  "condition": "hasUIAgents"
48
48
  },
49
- {
50
- "phase": "design",
51
- "question": "Approve technical specification?"
52
- },
53
49
  {
54
50
  "phase": "plan",
55
- "question": "Approve implementation plan?"
51
+ "question": "Approve spec, plan, and task breakdown?"
56
52
  },
57
53
  {
58
- "phase": "tasks",
59
- "question": "Approve task breakdown?"
54
+ "phase": "review",
55
+ "question": "Approve for merge/PR?"
60
56
  }
61
57
  ],
62
58
  "outputs": {
@@ -0,0 +1,32 @@
1
+ {
2
+ "id": "quick",
3
+ "name": "Quick (Single-Shot)",
4
+ "description": "Single-shot for trivial changes — skips all ceremony. Typo fixes, config changes, small bug fixes.",
5
+ "priority": 0,
6
+ "criteria": {
7
+ "maxFiles": 2,
8
+ "maxLines": 20,
9
+ "maxComponents": 0,
10
+ "noInfrastructure": true
11
+ },
12
+ "keywords": [
13
+ "fix", "typo", "rename", "update", "change", "add", "remove",
14
+ "bump", "config", "label", "text", "string", "color", "css",
15
+ "toggle", "flag", "icon", "badge", "tooltip", "placeholder"
16
+ ],
17
+ "phases": {
18
+ "run": ["proposal", "implement"],
19
+ "skip": ["uiux", "plan", "review", "sync"],
20
+ "skipIfCondition": {},
21
+ "combined": {}
22
+ },
23
+ "pausePoints": [],
24
+ "outputs": {
25
+ "required": ["proposal.md"],
26
+ "optional": [],
27
+ "skip": ["spec.md", "contracts.cs", "contracts.ts", "plan.md", "tasks.md", "mandate.md", "design-system.md", "schema-analysis.md", "review-report.md"]
28
+ },
29
+ "gates": {
30
+ "autoApproveAll": true
31
+ }
32
+ }
@@ -1,64 +1,57 @@
1
- {
2
- "id": "standard",
3
- "name": "Standard (Medium Complexity)",
4
- "description": "Medium complexity features - 3-10 files, tactical decisions",
5
- "criteria": {
6
- "minFiles": 3,
7
- "maxFiles": 10,
8
- "minLines": 50,
9
- "maxLines": 500,
10
- "maxComponents": 2,
11
- "noInfrastructure": true,
12
- "tacticalDecisions": true
13
- },
14
- "keywords": [
15
- "paginação",
16
- "pagination",
17
- "paginate",
18
- "filtro",
19
- "filter",
20
- "filtering",
21
- "refatorar",
22
- "refactor",
23
- "performance",
24
- "exportar",
25
- "export",
26
- "optimize",
27
- "sorting",
28
- "search",
29
- "busca"
30
- ],
31
- "phases": {
32
- "run": ["proposal", "design", "plan", "tasks", "implement", "sync"],
33
- "skip": [],
34
- "skipIfCondition": {
35
- "uiux": "!hasUIAgents"
36
- },
37
- "combined": {}
38
- },
39
- "pausePoints": [
40
- {
41
- "phase": "proposal",
42
- "question": "Approve feature proposal?"
43
- },
44
- {
45
- "phase": "design",
46
- "question": "Approve spec (concise, 1-2 pages)?"
47
- },
48
- {
49
- "phase": "plan",
50
- "question": "Approve implementation plan?"
51
- },
52
- {
53
- "phase": "tasks",
54
- "question": "Approve task breakdown?",
55
- "condition": "taskCount > 5"
56
- }
57
- ],
58
- "outputs": {
59
- "required": ["proposal.md", "spec.md", "plan.md", "recap.md"],
60
- "optional": ["decisions.md"],
61
- "skip": ["contracts.cs"]
62
- },
63
- "priority": 2
64
- }
1
+ {
2
+ "id": "standard",
3
+ "name": "Standard (Medium Complexity)",
4
+ "description": "Medium complexity features - 3-10 files, tactical decisions",
5
+ "criteria": {
6
+ "minFiles": 3,
7
+ "maxFiles": 10,
8
+ "minLines": 50,
9
+ "maxLines": 500,
10
+ "maxComponents": 2,
11
+ "noInfrastructure": true,
12
+ "tacticalDecisions": true
13
+ },
14
+ "keywords": [
15
+ "paginação",
16
+ "pagination",
17
+ "paginate",
18
+ "filtro",
19
+ "filter",
20
+ "filtering",
21
+ "refatorar",
22
+ "refactor",
23
+ "performance",
24
+ "exportar",
25
+ "export",
26
+ "optimize",
27
+ "sorting",
28
+ "search",
29
+ "busca"
30
+ ],
31
+ "phases": {
32
+ "run": ["proposal", "plan", "implement", "review", "sync"],
33
+ "skip": ["uiux"],
34
+ "skipIfCondition": {},
35
+ "combined": {}
36
+ },
37
+ "pausePoints": [
38
+ {
39
+ "phase": "proposal",
40
+ "question": "Approve feature proposal?"
41
+ },
42
+ {
43
+ "phase": "plan",
44
+ "question": "Approve plan and task breakdown?"
45
+ },
46
+ {
47
+ "phase": "review",
48
+ "question": "Approve for merge/PR?"
49
+ }
50
+ ],
51
+ "outputs": {
52
+ "required": ["proposal.md", "spec.md", "plan.md", "recap.md"],
53
+ "optional": ["decisions.md"],
54
+ "skip": ["contracts.cs"]
55
+ },
56
+ "priority": 2
57
+ }
package/package.json CHANGED
@@ -1,23 +1,24 @@
1
1
  {
2
2
  "name": "@polymorphism-tech/morph-spec",
3
- "version": "4.21.0",
4
- "description": "MORPH-SPEC: AI-First development framework with validation pipeline and multi-stack support",
3
+ "version": "5.0.1",
4
+ "description": "MORPH-SPEC: NLH (Natural Language Harness) for spec-driven development with Claude Code",
5
5
  "keywords": [
6
6
  "claude-code",
7
7
  "claude",
8
8
  "ai-coding",
9
9
  "ai-first",
10
10
  "spec-driven",
11
+ "nlh",
12
+ "natural-language-harness",
13
+ "autonomy",
11
14
  "dotnet",
12
15
  "dotnet10",
13
16
  "nextjs",
14
- "agent-framework",
15
17
  "vsa",
18
+ "vertical-slice",
16
19
  "framework",
17
- "developer-tools",
18
20
  "morph",
19
- "polymorphism",
20
- "micro-saas"
21
+ "polymorphism"
21
22
  ],
22
23
  "main": "src/index.js",
23
24
  "bin": {
@@ -25,11 +25,11 @@ import {
25
25
  loadMcpRegistry,
26
26
  isRemoteMcp,
27
27
  generateStitchProxy,
28
- patchConfigForPlatform
28
+ patchConfigForPlatform,
29
+ setupStitch
29
30
  } from '../../lib/installers/mcp-installer.js';
30
31
  import { detectClaudeConfig } from '../../lib/detectors/claude-config-detector.js';
31
32
  import { detectProject } from '../../lib/detectors/index.js';
32
- import { installMcpServers } from '../../utils/claude-settings-manager.js';
33
33
 
34
34
  /**
35
35
  * Detect the current project's stack.
@@ -207,35 +207,58 @@ async function setupSpecificMcp(targetPath, name, stack, existingMcps) {
207
207
 
208
208
  const credentials = mcpEntry.install.credentials || [];
209
209
 
210
- // Stitch MCP — custom OAuth proxy setup
210
+ // Stitch MCP — automated setup via setupStitch()
211
211
  if (name === 'stitch' && !mcpEntry.install.autoInstall) {
212
- console.log(chalk.cyan(`\n Setting up Stitch MCP (OAuth proxy)\n`));
212
+ console.log(chalk.cyan(`\n Setting up Stitch MCP (automated)\n`));
213
213
  console.log(chalk.gray(` Usage: ${mcpEntry.usage}`));
214
214
  console.log('');
215
215
 
216
+ // Allow user to provide GCP project if auto-detection might fail
217
+ let gcpProject;
216
218
  const gcpCred = credentials.find(c => c.envVar === 'STITCH_GCP_PROJECT');
217
- const { gcpProject } = await inquirer.prompt([{
219
+ const { gcpProjectInput } = await inquirer.prompt([{
218
220
  type: 'input',
219
- name: 'gcpProject',
220
- message: gcpCred ? `${gcpCred.name}:` : 'GCP Project ID:',
221
+ name: 'gcpProjectInput',
222
+ message: gcpCred ? `${gcpCred.name} (leave blank for auto-detect):` : 'GCP Project ID (blank for auto-detect):',
221
223
  }]);
222
-
223
- if (!gcpProject || !gcpProject.trim()) {
224
- console.log(chalk.red(' GCP Project ID is required.'));
225
- console.log('');
226
- return;
224
+ if (gcpProjectInput?.trim()) gcpProject = gcpProjectInput.trim();
225
+
226
+ const spinner = ora('Setting up Stitch MCP...').start();
227
+ const result = await setupStitch(targetPath, { gcpProject });
228
+
229
+ // Report step-by-step results
230
+ for (const step of result.steps) {
231
+ if (step.success) {
232
+ switch (step.step) {
233
+ case 'find-gcloud': spinner.text = `gcloud found (${step.source})`; break;
234
+ case 'verify-adc': spinner.text = 'ADC credentials verified'; break;
235
+ case 'detect-project': spinner.text = `GCP project: ${step.gcpProject}`; break;
236
+ case 'enable-api': spinner.text = 'Stitch API enabled'; break;
237
+ case 'generate-proxy': spinner.text = `Proxy generated: ${step.proxyPath}`; break;
238
+ case 'install-mcp': spinner.text = 'MCP config installed in .mcp.json'; break;
239
+ case 'health-check': spinner.text = `Health-check passed (protocol ${step.protocolVersion})`; break;
240
+ }
241
+ }
227
242
  }
228
243
 
229
- const spinner = ora('Generating Stitch proxy...').start();
230
- const { proxyPath } = generateStitchProxy(targetPath, gcpProject.trim());
231
- spinner.succeed(`Proxy script generated: ${proxyPath}`);
232
-
233
- const config = { ...mcpEntry.install.config };
234
- const result = await installMcpServers(targetPath, { stitch: patchConfigForPlatform(config) });
235
- if (result.added.length > 0) {
236
- console.log(chalk.green(` ✓ Stitch MCP configured (using OAuth proxy)`));
244
+ if (result.success) {
245
+ spinner.succeed('Stitch MCP setup complete');
246
+ for (const step of result.steps) {
247
+ if (step.step === 'health-check' && step.success) {
248
+ console.log(chalk.green(` ✓ Health-check passed (protocol ${step.protocolVersion})`));
249
+ }
250
+ }
237
251
  } else {
238
- console.log(chalk.yellow(` ⚠ Stitch MCP already configured`));
252
+ const failedStep = result.steps.find(s => !s.success && s.step !== 'enable-api' && s.step !== 'health-check');
253
+ spinner.fail(`Stitch setup failed at: ${failedStep?.step || 'unknown'}`);
254
+ if (failedStep?.error) {
255
+ console.log(chalk.red(` ${failedStep.error}`));
256
+ }
257
+ // Show health-check warning if it failed but setup otherwise succeeded
258
+ const healthStep = result.steps.find(s => s.step === 'health-check');
259
+ if (healthStep && !healthStep.success) {
260
+ console.log(chalk.yellow(` ⚠ Health-check: ${healthStep.error}`));
261
+ }
239
262
  }
240
263
 
241
264
  if (mcpEntry.companionSkills?.installCommand) {
@@ -292,7 +315,7 @@ async function setupSpecificMcp(targetPath, name, stack, existingMcps) {
292
315
  const { installNow } = await inquirer.prompt([{
293
316
  type: 'confirm',
294
317
  name: 'installNow',
295
- message: 'Add to .claude/settings.local.json now?',
318
+ message: 'Add to .mcp.json now?',
296
319
  default: true
297
320
  }]);
298
321
 
@@ -345,7 +368,7 @@ async function setupSpecificMcp(targetPath, name, stack, existingMcps) {
345
368
  } else {
346
369
  // Show config snippet
347
370
  const instructions = generateSetupInstructions(name, mcpEntry);
348
- console.log(chalk.gray('\n Add to .claude/settings.local.json → mcpServers:'));
371
+ console.log(chalk.gray('\n Add to .mcp.json → mcpServers:'));
349
372
  console.log(chalk.gray(' ' + '─'.repeat(55)));
350
373
  for (const line of instructions.configSnippet.split('\n')) {
351
374
  console.log(chalk.gray(` ${line}`));
@@ -424,20 +447,24 @@ async function interactiveWizard(targetPath, stack, existingMcps) {
424
447
  }]);
425
448
 
426
449
  if (setupNow) {
427
- // Stitch — custom OAuth proxy flow
450
+ // Stitch — automated setup via setupStitch()
428
451
  if (name === 'stitch' && !entry.install.autoInstall) {
429
452
  const gcpCred = entry.install.credentials?.find(c => c.envVar === 'STITCH_GCP_PROJECT');
430
453
  const { gcpProject } = await inquirer.prompt([{
431
454
  type: 'input',
432
455
  name: 'gcpProject',
433
- message: gcpCred ? `${gcpCred.name}:` : 'GCP Project ID:',
456
+ message: gcpCred ? `${gcpCred.name} (blank for auto-detect):` : 'GCP Project ID (blank for auto-detect):',
434
457
  }]);
435
- if (gcpProject?.trim()) {
436
- const { proxyPath } = generateStitchProxy(targetPath, gcpProject.trim());
437
- console.log(chalk.green(` ✓ Proxy generated: ${proxyPath}`));
438
- const config = { ...entry.install.config };
439
- await installMcpServers(targetPath, { stitch: patchConfigForPlatform(config) });
440
- console.log(chalk.green(` ✓ Stitch configured (OAuth proxy)`));
458
+
459
+ const stitchSpinner = ora('Setting up Stitch MCP...').start();
460
+ const stitchResult = await setupStitch(targetPath, { gcpProject: gcpProject?.trim() || undefined });
461
+ if (stitchResult.success) {
462
+ stitchSpinner.succeed('Stitch MCP setup complete');
463
+ } else {
464
+ const failedStep = stitchResult.steps.find(s => !s.success && s.step !== 'enable-api' && s.step !== 'health-check');
465
+ stitchSpinner.fail(`Stitch setup failed: ${failedStep?.error || 'unknown'}`);
466
+ }
467
+ if (entry.companionSkills?.installCommand) {
441
468
  const skillResults = installCompanionSkills({ stitch: entry });
442
469
  for (const r of skillResults) {
443
470
  if (r.success) console.log(chalk.green(` ✓ Companion skills: ${r.repo}`));