@polymorphism-tech/morph-spec 10.12.1 → 11.0.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/CLAUDE.md +27 -57
- package/README.md +51 -340
- package/bin/morph-spec.js +22 -373
- package/docs/CHEATSHEET.md +37 -166
- package/docs/QUICKSTART.md +14 -74
- package/framework/CLAUDE.md +15 -26
- package/framework/MORPH.md +34 -101
- package/framework/agents.json +8 -8
- package/framework/commands/morph-apply.md +5 -5
- package/framework/commands/morph-infra.md +1 -1
- package/framework/docs/CLI.md +74 -886
- package/framework/evals/review-checklist.md +14 -14
- package/framework/hooks/README.md +21 -189
- package/framework/hooks/claude-code/core/README.md +2 -5
- package/framework/hooks/claude-code/core/conventional-commit.js +2 -2
- package/framework/hooks/claude-code/core/denylist.json +3 -3
- package/framework/hooks/claude-code/core/graph-refresh-kick.js +2 -2
- package/framework/hooks/claude-code/core/masked-exit.js +6 -6
- package/framework/hooks/claude-code/core/pre-bash-denylist.js +2 -2
- package/framework/hooks/claude-code/core/protect-spec-files.js +17 -61
- package/framework/hooks/claude-code/core/stack-changed.js +35 -0
- package/framework/hooks/claude-code/core/validate-completion.js +32 -87
- package/framework/hooks/shared/{heavy-command.js → command-kind.js} +6 -79
- package/framework/hooks/shared/command-tokens.js +0 -139
- package/framework/hooks/shared/contract.js +14 -0
- package/framework/hooks/shared/feature-slug.js +21 -0
- package/framework/hooks/shared/frontend-locations.js +0 -1
- package/framework/hooks/shared/git-paths.js +0 -15
- package/framework/hooks/shared/graph-freshness.js +0 -19
- package/framework/hooks/shared/hook-response.js +0 -7
- package/framework/hooks/shared/morph-cli.js +2 -81
- package/framework/hooks/shared/owner-words.js +2 -120
- package/framework/hooks/shared/payload-utils.js +0 -39
- package/framework/hooks/shared/report-progress.js +7 -101
- package/framework/hooks/statusline.js +16 -60
- package/framework/mcp/registry.json +2 -2
- package/framework/rules/ai-agents-standards.md +1 -1
- package/framework/rules/asaas-standards.md +1 -1
- package/framework/rules/ef-standards.md +1 -1
- package/framework/rules/gsap-standards.md +1 -1
- package/framework/rules/hangfire-standards.md +1 -1
- package/framework/rules/implement-report.md +3 -3
- package/framework/rules/neon-auth-standards.md +1 -1
- package/framework/rules/nextjs-standards.md +1 -1
- package/framework/rules/plan-grammar.md +13 -11
- package/framework/rules/resend-standards.md +1 -1
- package/framework/rules/ui-design.md +4 -0
- package/framework/schemas/config.schema.json +95 -310
- package/framework/skills/README.md +12 -32
- package/framework/skills/core/create-umbraco-lp/SKILL.md +1 -1
- package/framework/skills/core/migrate-lp-to-umbraco/SKILL.md +1 -1
- package/framework/skills/core/morph-apply/SKILL.md +21 -46
- package/framework/skills/core/morph-plan/SKILL.md +28 -63
- package/framework/skills/core/morph-uiux/SKILL.md +23 -25
- package/framework/{templates/docs/ui-mockups.md → skills/core/morph-uiux/references/mockups.md} +4 -4
- package/framework/standards/STANDARDS.json +10 -11
- package/framework/standards/STANDARDS.meta.json +1 -1
- package/framework/standards/ai-agents/evals-with-cache.md +18 -32
- package/framework/standards/ai-agents/observability-patterns.md +2 -2
- package/framework/standards/architecture/code-comments.md +2 -5
- package/framework/standards/architecture/engineering-lens.md +1 -1
- package/framework/standards/backend/dotnet/testing.md +4 -4
- package/framework/standards/frontend/nextjs/lint.md +24 -10
- package/framework/standards/frontend/nextjs/testing.md +2 -2
- package/framework/standards/infrastructure/docker/local-compose-isolation.md +14 -30
- package/framework/templates/CLAUDE.md.core.guide.md +2 -2
- package/framework/templates/README.md +1 -1
- package/framework/templates/REGISTRY.json +3 -33
- package/framework/templates/docs/plan.md +3 -2
- package/framework/templates/dotnet/ai-kit/README.md +2 -4
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalCacheMissException.cs +1 -1
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalFixture.cs +1 -1
- package/package.json +1 -2
- package/src/commands/graph/explain.js +2 -1
- package/src/commands/graph/status.js +2 -1
- package/src/commands/mcp/mcp-setup.js +1 -2
- package/src/commands/project/doctor.js +5 -341
- package/src/commands/project/env.js +21 -52
- package/src/commands/project/init-contract.js +47 -0
- package/src/commands/project/init.js +36 -66
- package/src/commands/project/stack-scan.js +1 -1
- package/src/commands/project/update.js +15 -50
- package/src/commands/validation/check.js +128 -0
- package/src/commands/validation/plan-check.js +41 -64
- package/src/commands/validation/prove-red.js +1 -1
- package/src/core/paths/output-schema.js +0 -22
- package/src/core/templates/template-renderer.js +0 -14
- package/src/lib/ai/ai-project-scan.js +1 -6
- package/src/lib/check/attempts.js +38 -0
- package/src/lib/check/signals.js +145 -0
- package/src/lib/config/project-config.js +13 -0
- package/src/lib/contract/apply.js +62 -0
- package/src/lib/contract/defaults.js +96 -0
- package/src/lib/contract/merge.js +79 -0
- package/src/lib/contract/ports.js +43 -0
- package/src/lib/contract/scan.js +102 -0
- package/src/lib/detectors/claude-config-detector.js +7 -0
- package/src/lib/{procs → detectors}/mcp-config.js +1 -37
- package/src/lib/diff/diff-lines.js +64 -0
- package/src/lib/generators/architecture-scanner.js +1 -1
- package/src/lib/generators/scaffold-generator.js +0 -7
- package/src/lib/git/default-branch.js +0 -122
- package/src/lib/graph/diff-tree.js +2 -1
- package/src/lib/graph/god-nodes.js +2 -1
- package/src/lib/graph/graphify-runtime.js +0 -1
- package/src/lib/graph/graphifyignore.js +1 -1
- package/src/lib/graph/sanitize.js +2 -8
- package/src/lib/installers/memory-installer.js +15 -30
- package/src/lib/installers/stack-sync.js +16 -9
- package/src/lib/plan/checks.js +20 -64
- package/src/lib/plan/media.js +1 -1
- package/src/lib/plan/plan-parser.js +5 -5
- package/src/lib/review-reports.js +3 -77
- package/src/lib/scan/worktree-dirs.js +3 -0
- package/src/lib/specs/adr-index.js +2 -2
- package/src/lib/stack/dotnet-build-ignores.js +10 -2
- package/src/lib/stack/stack-scan.js +2 -2
- package/src/lib/stack-filter.js +3 -2
- package/src/lib/tests-audit/audit.js +1 -1
- package/src/scripts/setup-infra.js +6 -59
- package/src/utils/agents-installer.js +1 -34
- package/src/utils/atomic-json.js +27 -0
- package/src/utils/file-copier.js +4 -12
- package/src/utils/hooks-installer.js +9 -107
- package/claude-plugin.json +0 -14
- package/framework/commands/morph-archive.md +0 -46
- package/framework/commands/morph-hotfix.md +0 -17
- package/framework/commands/morph-preflight.md +0 -180
- package/framework/commands/morph-review.md +0 -15
- package/framework/commands/morph-status.md +0 -37
- package/framework/hooks/claude-code/core/block-destructive-worktree-removal.js +0 -80
- package/framework/hooks/claude-code/core/block-raw-worktree-add.js +0 -72
- package/framework/hooks/claude-code/core/enforce-phase-writes.js +0 -100
- package/framework/hooks/claude-code/core/gate-guard.js +0 -148
- package/framework/hooks/claude-code/core/heavy-gate.js +0 -78
- package/framework/hooks/claude-code/core/heavy-release.js +0 -23
- package/framework/hooks/claude-code/core/loop-detect.js +0 -79
- package/framework/hooks/claude-code/core/state-sync.js +0 -214
- package/framework/hooks/claude-code/core/telemetry-log.js +0 -259
- package/framework/hooks/claude-code/core/test-budget.js +0 -29
- package/framework/hooks/claude-code/core/worktree-context.js +0 -249
- package/framework/hooks/claude-code/core/worktree-create.js +0 -119
- package/framework/hooks/claude-code/core/worktree-env-inject.js +0 -68
- package/framework/hooks/claude-code/core/worktree-remove.js +0 -55
- package/framework/hooks/shared/build-check.js +0 -120
- package/framework/hooks/shared/claim-registry.js +0 -125
- package/framework/hooks/shared/e2e-check.js +0 -1022
- package/framework/hooks/shared/feature-locator.js +0 -82
- package/framework/hooks/shared/gate-event.js +0 -18
- package/framework/hooks/shared/gate-question.js +0 -20
- package/framework/hooks/shared/heavy-config.js +0 -113
- package/framework/hooks/shared/heavy-holders.js +0 -85
- package/framework/hooks/shared/heavy-slots.js +0 -280
- package/framework/hooks/shared/host-services.js +0 -440
- package/framework/hooks/shared/next-step.js +0 -181
- package/framework/hooks/shared/redact-secrets.js +0 -44
- package/framework/hooks/shared/reparse-scan.js +0 -40
- package/framework/hooks/shared/state-reader.js +0 -220
- package/framework/hooks/shared/state-writer.js +0 -112
- package/framework/hooks/shared/telemetry-logger.js +0 -101
- package/framework/hooks/shared/transcript-usage.js +0 -58
- package/framework/hooks/shared/worktree-root.js +0 -71
- package/framework/phases.json +0 -92
- package/framework/schemas/feature.schema.json +0 -242
- package/framework/skills/core/morph-apply/references/hotfix.md +0 -46
- package/framework/skills/core/morph-apply/references/machine.md +0 -30
- package/framework/skills/core/morph-apply/references/review.md +0 -77
- package/framework/skills/core/morph-plan/references/critique.md +0 -51
- package/framework/skills/core/morph-plan/references/interview.md +0 -37
- package/framework/templates/state.template.json +0 -17
- package/src/commands/dashboard/dashboard.js +0 -74
- package/src/commands/e2e/e2e.js +0 -400
- package/src/commands/observability/cost.js +0 -283
- package/src/commands/project/branch.js +0 -129
- package/src/commands/project/claim.js +0 -132
- package/src/commands/project/doctor-procs.js +0 -162
- package/src/commands/project/fleet.js +0 -66
- package/src/commands/project/heavy.js +0 -81
- package/src/commands/project/install-plugin-cmd.js +0 -27
- package/src/commands/project/status.js +0 -61
- package/src/commands/project/worktree.js +0 -1234
- package/src/commands/state/advance.js +0 -248
- package/src/commands/state/approve.js +0 -303
- package/src/commands/state/archive.js +0 -231
- package/src/commands/state/auto-approval.js +0 -67
- package/src/commands/state/create.js +0 -274
- package/src/commands/state/delete.js +0 -192
- package/src/commands/state/finish.js +0 -1247
- package/src/commands/state/gate-check.js +0 -244
- package/src/commands/state/gate-decision.js +0 -122
- package/src/commands/state/list.js +0 -244
- package/src/commands/state/next.js +0 -24
- package/src/commands/state/recap.js +0 -80
- package/src/commands/state/report-check.js +0 -244
- package/src/commands/state/retype.js +0 -110
- package/src/commands/validation/verify.js +0 -421
- package/src/core/state/feature-identity.js +0 -10
- package/src/core/state/gate-order.js +0 -23
- package/src/core/state/lifecycle-audit.js +0 -171
- package/src/core/state/state-manager.js +0 -523
- package/src/core/templates/template-seed.js +0 -21
- package/src/core/work-types.js +0 -44
- package/src/dashboard/app/App.jsx +0 -84
- package/src/dashboard/app/components/ActivityFeed.jsx +0 -166
- package/src/dashboard/app/components/CommandPalette.jsx +0 -144
- package/src/dashboard/app/components/DetailPanel.jsx +0 -43
- package/src/dashboard/app/components/EntityLink.jsx +0 -42
- package/src/dashboard/app/components/ErrorBoundary.jsx +0 -47
- package/src/dashboard/app/components/FlowGraph.jsx +0 -19
- package/src/dashboard/app/components/GatePauses.jsx +0 -116
- package/src/dashboard/app/components/KnowledgeMarkdown.jsx +0 -42
- package/src/dashboard/app/components/Markdown.jsx +0 -38
- package/src/dashboard/app/components/PhaseRail.jsx +0 -100
- package/src/dashboard/app/components/SearchFilter.jsx +0 -36
- package/src/dashboard/app/components/SessionMap.jsx +0 -77
- package/src/dashboard/app/components/Sidebar.jsx +0 -147
- package/src/dashboard/app/hooks/useMorphQuery.js +0 -44
- package/src/dashboard/app/hooks/usePref.js +0 -34
- package/src/dashboard/app/lib/format.js +0 -69
- package/src/dashboard/app/lib/phases.js +0 -75
- package/src/dashboard/app/lib/project.js +0 -38
- package/src/dashboard/app/main.jsx +0 -13
- package/src/dashboard/app/pages/Activity.jsx +0 -28
- package/src/dashboard/app/pages/AgentMap.jsx +0 -363
- package/src/dashboard/app/pages/FeatureDetail.jsx +0 -579
- package/src/dashboard/app/pages/Features.jsx +0 -393
- package/src/dashboard/app/pages/Guide.jsx +0 -145
- package/src/dashboard/app/pages/HookInspector.jsx +0 -444
- package/src/dashboard/app/pages/PhasePipeline.jsx +0 -273
- package/src/dashboard/app/pages/Portfolio.jsx +0 -190
- package/src/dashboard/app/pages/RulesMap.jsx +0 -285
- package/src/dashboard/app/pages/SkillsLibrary.jsx +0 -468
- package/src/dashboard/app/pages/Standards.jsx +0 -392
- package/src/dashboard/app/styles/index.css +0 -187
- package/src/dashboard/index.html +0 -14
- package/src/dashboard/package.json +0 -32
- package/src/dashboard/scanner/activity-scanner.js +0 -321
- package/src/dashboard/scanner/agents-scanner.js +0 -67
- package/src/dashboard/scanner/docs-scanner.js +0 -34
- package/src/dashboard/scanner/feature-status.js +0 -7
- package/src/dashboard/scanner/features-scanner.js +0 -397
- package/src/dashboard/scanner/hooks-scanner.js +0 -96
- package/src/dashboard/scanner/index.js +0 -21
- package/src/dashboard/scanner/phases-scanner.js +0 -14
- package/src/dashboard/scanner/portfolio.js +0 -129
- package/src/dashboard/scanner/project-api.js +0 -160
- package/src/dashboard/scanner/rules-scanner.js +0 -46
- package/src/dashboard/scanner/skills-scanner.js +0 -104
- package/src/dashboard/scanner/standards-scanner.js +0 -38
- package/src/dashboard/vite-plugin-morph-data.js +0 -120
- package/src/dashboard/vite.config.js +0 -26
- package/src/lib/ci/ci-verify.js +0 -30
- package/src/lib/ci/github-ci.js +0 -52
- package/src/lib/ci/pr-checks.js +0 -76
- package/src/lib/e2e/applicability.js +0 -39
- package/src/lib/e2e/compose-env.js +0 -80
- package/src/lib/e2e/stack-teardown.js +0 -96
- package/src/lib/git/branch-classifier.js +0 -104
- package/src/lib/git/evidence-staleness.js +0 -40
- package/src/lib/git/gh.js +0 -15
- package/src/lib/git/pending-prs.js +0 -58
- package/src/lib/git/pr-files.js +0 -31
- package/src/lib/git/pr-index.js +0 -39
- package/src/lib/git/tree-fingerprint.js +0 -58
- package/src/lib/git/tree-state.js +0 -125
- package/src/lib/heavy/cleanup.js +0 -72
- package/src/lib/heavy/gate.js +0 -168
- package/src/lib/heavy/live-stacks.js +0 -64
- package/src/lib/heavy/reclaim.js +0 -107
- package/src/lib/heavy/watchdog.js +0 -46
- package/src/lib/next-step.js +0 -12
- package/src/lib/plan/critique.js +0 -67
- package/src/lib/plan/plan-template.js +0 -18
- package/src/lib/procs/classify.js +0 -91
- package/src/lib/procs/list.js +0 -124
- package/src/lib/procs/prune.js +0 -47
- package/src/lib/procs/wslconfig.js +0 -70
- package/src/lib/projects/registry.js +0 -121
- package/src/lib/recap/piper.js +0 -36
- package/src/lib/recap/recap.js +0 -259
- package/src/lib/review-confirmation.js +0 -66
- package/src/lib/risk/diff-risk.js +0 -137
- package/src/lib/risk-detector.js +0 -638
- package/src/lib/specs/design-seed.js +0 -18
- package/src/lib/specs/screen-checklist.js +0 -315
- package/src/lib/stack/stack-profile.js +0 -69
- package/src/lib/tasks/eval-node.js +0 -293
- package/src/lib/tasks/linux-runner.js +0 -200
- package/src/lib/tasks/test-nodes.js +0 -414
- package/src/lib/tasks/test-runner.js +0 -569
- package/src/lib/telemetry/metrics.js +0 -384
- package/src/lib/telemetry/telemetry-reader.js +0 -276
- package/src/lib/telemetry/verify-event.js +0 -57
- package/src/lib/validators/code-budget/code-budget-validator.js +0 -170
- package/src/lib/validators/contracts/contract-compliance-validator.js +0 -219
- package/src/lib/validators/nextjs/next-component-validator.js +0 -142
- package/src/lib/validators/packages/package-validator.js +0 -310
- package/src/lib/validators/reuse/reuse-validator.js +0 -202
- package/src/lib/validators/reuse/symbol-scanner.js +0 -64
- package/src/lib/validators/validation-runner.js +0 -188
- package/src/lib/validators/verify-cache.js +0 -63
- package/src/lib/validators/verify-runner.js +0 -971
- package/src/lib/verify/affected.js +0 -143
- package/src/lib/verify/detached.js +0 -159
- package/src/lib/view/feature-html.js +0 -480
- package/src/lib/view/feature-page.client.js +0 -109
- package/src/lib/view/feature-page.css +0 -278
- package/src/lib/view/feature-view.js +0 -113
- package/src/lib/view/flow-layers.js +0 -79
- package/src/lib/view/flow-svg.js +0 -63
- package/src/lib/view/tokens.css +0 -18
- package/src/lib/work-type-detector.js +0 -81
- package/src/lib/worktree/dirs.js +0 -3
- package/src/lib/worktree/docker-audit.js +0 -175
- package/src/lib/worktree/env-allocator.js +0 -177
- package/src/lib/worktree/feature-truth.js +0 -145
- package/src/lib/worktree/finish-backup.js +0 -529
- package/src/lib/worktree/fleet-scanner.js +0 -223
- package/src/lib/worktree/ignored-triage.js +0 -136
- package/src/lib/worktree/vscode-settings.js +0 -112
- package/src/lib/worktree/worktree-audit.js +0 -323
- package/src/lib/worktree/worktree-include.js +0 -44
- package/src/scripts/install-plugin.js +0 -114
|
@@ -1,44 +1,6 @@
|
|
|
1
|
-
export const
|
|
2
|
-
plan: 'Plano', uiux: 'Telas', implement: 'Construção', review: 'Revisão', 'aguardando-merge': 'Esperando o merge do PR',
|
|
3
|
-
};
|
|
4
|
-
export const GATE_NAME = { plan: 'Aprovação do plano', uiux: 'Aprovação das telas', review: 'Revisão independente' };
|
|
5
|
-
export const GATE_ASK = { plan: 'aprovar o plano', uiux: 'aprovar as telas', review: 'aprovar a entrega' };
|
|
6
|
-
export const RUNG_SAY = {
|
|
7
|
-
refazer: 'dá trabalho para refazer',
|
|
8
|
-
desfazer: 'dá trabalho para desfazer',
|
|
9
|
-
migrar: 'mexe na estrutura do banco; reverter o código não desfaz',
|
|
10
|
-
'irreversível': 'não tem volta',
|
|
11
|
-
};
|
|
12
|
-
export const VERDICT_SAY = { SHIP: 'aprovou', FIX: 'pediu correção' };
|
|
13
|
-
export const ROLE_NAME = { verifier: 'Conferência das entregas', reviewer: 'Revisão do código', security: 'Revisão de segurança' };
|
|
14
|
-
export const STATUS_SAY = { feito: 'feito', pendente: 'falta', bloqueado: 'travado' };
|
|
15
|
-
export const TESTS = 'os testes automáticos';
|
|
16
|
-
export const WORK_NAME = { feature: 'Funcionalidade nova', bug: 'Correção de bug', chore: 'Manutenção', hotfix: 'Correção urgente' };
|
|
17
|
-
export const PROOF_SAY = {
|
|
18
|
-
teste: 'teste automático', e2e: 'teste do fluxo completo, como um usuário', eval: 'avaliação da resposta da IA',
|
|
19
|
-
manual: 'conferência manual', leitura: 'leitura do código',
|
|
20
|
-
};
|
|
21
|
-
export const RISK_SAY = {
|
|
22
|
-
regra: 'regra de negócio', dinheiro: 'dinheiro', contrato: 'integração com outro sistema',
|
|
23
|
-
'concorrência': 'duas coisas ao mesmo tempo', dado: 'integridade dos dados', 'regressão': 'bug que já aconteceu',
|
|
24
|
-
};
|
|
25
|
-
export const REUSE_SAY = { REUSAR: 'usa o que já existe', ESTENDER: 'amplia o que já existe', CRIAR: 'novo' };
|
|
26
|
-
export const CHECK_RESULT_SAY = { PROVADO: 'conferido', 'NÃO PROVADO': 'não conferido', FALHA: 'falhou na conferência' };
|
|
27
|
-
export const BLOCKER_SAY = {
|
|
28
|
-
check: 'cenário não cumprido', teste: 'teste faltando ou fraco', regressao: 'quebrou algo que funcionava',
|
|
29
|
-
seguranca: 'falha de segurança', escopo: 'fora do combinado', arquitetura: 'desenho do código',
|
|
30
|
-
performance: 'lentidão', irreversivel: 'passo sem volta',
|
|
31
|
-
};
|
|
32
|
-
export const VERIFY_STEP_SAY = {
|
|
33
|
-
build: 'compilação', tests: 'testes', validators: 'regras do projeto', e2e: 'teste do fluxo completo', evals: 'avaliação da IA',
|
|
34
|
-
};
|
|
35
|
-
export const RESULT_SAY = { pass: 'passou', fail: 'falhou', skip: 'não rodou' };
|
|
1
|
+
export const SESSION_MARK = 'para a sessão:';
|
|
36
2
|
|
|
37
|
-
export
|
|
38
|
-
if (by === 'auto') return 'aprovada sozinha, sem sinal de risco';
|
|
39
|
-
if (!by || by === 'manual') return 'aprovada por você';
|
|
40
|
-
return `aprovada por ${by}`;
|
|
41
|
-
}
|
|
3
|
+
export const WORK_NAME = { feature: 'Funcionalidade nova', bug: 'Correção de bug', chore: 'Manutenção', hotfix: 'Correção urgente' };
|
|
42
4
|
|
|
43
5
|
const MAX_TITLE_WORDS = 10;
|
|
44
6
|
|
|
@@ -64,83 +26,3 @@ export function scenarioLabel(c) {
|
|
|
64
26
|
const title = scenarioTitle(c);
|
|
65
27
|
return title ? `Cenário ${n}: ${title}` : `Cenário ${n}`;
|
|
66
28
|
}
|
|
67
|
-
|
|
68
|
-
export function labelFor(checks, id) {
|
|
69
|
-
return scenarioLabel((checks ?? []).find((c) => c.id === id) ?? { id });
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export function featureName(slug, feature, summary) {
|
|
73
|
-
if (summary?.name) return summary.name;
|
|
74
|
-
const first = String(feature?.description ?? '').split(/\r?\n/).map((l) => l.replace(/^#+\s*/, '').trim()).find(Boolean);
|
|
75
|
-
return first ? clip(first) : slug;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/** How a feature is named where a hook or a gate answer must still find the slug. */
|
|
79
|
-
export const featureRef = (slug, feature, summary) => {
|
|
80
|
-
const name = featureName(slug, feature, summary);
|
|
81
|
-
return name === slug ? slug : `${name} (${slug})`;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export function gateQuestion(gate, slug, feature, summary) {
|
|
85
|
-
const what = { plan: 'o plano', uiux: 'as telas', review: 'a entrega' }[gate] ?? gate;
|
|
86
|
-
return `Aprovar ${what} de ${featureRef(slug, feature, summary)}?`;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const LIST_MAX = 3;
|
|
90
|
-
|
|
91
|
-
function stationsLine(phase, hasDesign, reviewApproved) {
|
|
92
|
-
const ids = ['plan', ...(hasDesign || phase === 'uiux' ? ['uiux'] : []), 'implement', 'review'];
|
|
93
|
-
const at = phase === 'aguardando-merge' || reviewApproved ? ids.length : ids.indexOf(phase);
|
|
94
|
-
if (at < 0) return `Passo: ${PHASE_NAME[phase] ?? phase}`;
|
|
95
|
-
const marks = ids.map((id, i) => `${PHASE_NAME[id]}${i < at ? ' ✓' : i === at ? ' ◀' : ''}`).join(' · ');
|
|
96
|
-
const now = at >= ids.length ? (phase === 'aguardando-merge' ? PHASE_NAME[phase] : 'Entrega') : PHASE_NAME[ids[at]];
|
|
97
|
-
return `Passo: ${now} (${marks})`;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function scenarioLines(progress, phase) {
|
|
101
|
-
if (!progress) return ['Cenários: ainda não definidos (o plano está sendo escrito).'];
|
|
102
|
-
if (phase === 'plan') return [`Cenários: ${progress.total} no plano, nenhum construído ainda.`];
|
|
103
|
-
const open = progress.checks.filter((c) => c.status === 'pendente');
|
|
104
|
-
const head = `Cenários: ${progress.done} de ${progress.total} feitos.`;
|
|
105
|
-
if (!open.length) return [head];
|
|
106
|
-
const lines = [`${head} Faltam:`, ...open.slice(0, LIST_MAX).map((c) => ` ${scenarioLabel(c)}`)];
|
|
107
|
-
if (open.length > LIST_MAX) lines.push(` +${open.length - LIST_MAX}`);
|
|
108
|
-
return lines;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function waitingOnOwner({ feature, progress, next, phase }) {
|
|
112
|
-
const out = [];
|
|
113
|
-
const gates = feature?.approvalGates ?? feature?.approvals ?? {};
|
|
114
|
-
for (const [gate, d] of Object.entries(feature?.gateDecisions ?? {})) {
|
|
115
|
-
// A decision taken in an earlier phase is stale until gate-check runs again in this one.
|
|
116
|
-
if (gate !== phase || gates[gate]?.approved || !d?.pause || d.resolver === 'session') continue;
|
|
117
|
-
out.push(`${GATE_ASK[gate] ?? gate}. ${d.reason ?? ''}`.trim());
|
|
118
|
-
}
|
|
119
|
-
for (const c of progress?.checks ?? []) {
|
|
120
|
-
if (c.status !== 'bloqueado') continue;
|
|
121
|
-
out.push(c.question ? `responder o ${scenarioLabel(c)}. ${c.question}` : `decidir o ${scenarioLabel(c)}.`);
|
|
122
|
-
}
|
|
123
|
-
if (next?.ask) out.push(next.ask);
|
|
124
|
-
return out;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* The glance view: what it delivers, which step, how many scenarios, what is stuck, what waits on the owner.
|
|
129
|
-
* @param {{ slug: string, feature: object, progress: object|null, phase: string, next?: object|null, hasDesign?: boolean }} s
|
|
130
|
-
*/
|
|
131
|
-
export function retrato({ slug, feature, progress, phase, next = null, hasDesign = false }) {
|
|
132
|
-
const summary = progress?.summary ?? null;
|
|
133
|
-
const lines = [featureName(slug, feature, summary)];
|
|
134
|
-
if (summary?.after) lines.push(`Entrega: ${summary.after}`);
|
|
135
|
-
lines.push(stationsLine(phase, hasDesign, feature?.approvalGates?.review?.approved === true));
|
|
136
|
-
lines.push(...scenarioLines(progress, phase));
|
|
137
|
-
const blocked = (progress?.checks ?? []).filter((c) => c.status === 'bloqueado').map(scenarioLabel);
|
|
138
|
-
const red = feature?.verification?.status === 'fail' && phase === 'implement';
|
|
139
|
-
const stuck = [...blocked, ...(red ? [`${TESTS} estão falhando`] : [])];
|
|
140
|
-
lines.push(`Travado: ${stuck.length ? stuck.join('; ') : 'nada'}.`.replace(/\.\.$/, '.'));
|
|
141
|
-
const wait = waitingOnOwner({ feature, progress, next, phase });
|
|
142
|
-
if (wait.length) lines.push(`Espera você: ${wait[0]}`, ...wait.slice(1).map((w) => ` ${w}`));
|
|
143
|
-
else lines.push('Espera você: nada agora.');
|
|
144
|
-
if (next?.say) lines.push(`Próximo: ${next.say}`);
|
|
145
|
-
return lines;
|
|
146
|
-
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createHash } from 'crypto';
|
|
2
1
|
import { join, isAbsolute } from 'path';
|
|
3
2
|
|
|
4
3
|
// State is resolved from the target PATH, never the session: a session in the
|
|
@@ -37,41 +36,3 @@ export function getFilePath(payload) {
|
|
|
37
36
|
export function getToolName(payload) {
|
|
38
37
|
return payload?.tool_name || 'unknown';
|
|
39
38
|
}
|
|
40
|
-
|
|
41
|
-
const BASH_SIGNATURE_MAX = 120;
|
|
42
|
-
|
|
43
|
-
// The input is part of the signature: the same tool on DIFFERENT targets is
|
|
44
|
-
// work, not a loop. Only an identical call repeats the signature.
|
|
45
|
-
export function getCommandSignature(payload) {
|
|
46
|
-
const tool = getToolName(payload);
|
|
47
|
-
if (tool === 'unknown') return 'unknown';
|
|
48
|
-
|
|
49
|
-
const input = payload?.tool_input;
|
|
50
|
-
if (!input) return tool;
|
|
51
|
-
|
|
52
|
-
if (tool === 'Edit' || tool === 'Write') {
|
|
53
|
-
const path = (input.file_path || input.path || '').replace(/\\/g, '/');
|
|
54
|
-
if (!path) return tool;
|
|
55
|
-
// O caminho sozinho confundia editar regiões diferentes com loop; o
|
|
56
|
-
// ping-pong A→B / B→A continua dando duas assinaturas.
|
|
57
|
-
const body = tool === 'Write'
|
|
58
|
-
? input.content
|
|
59
|
-
: (input.old_string !== undefined || input.new_string !== undefined)
|
|
60
|
-
? `${input.old_string ?? ''}\0${input.new_string ?? ''}\0${input.replace_all ? 1 : 0}`
|
|
61
|
-
: undefined;
|
|
62
|
-
if (body === undefined || body === null) return `${tool}:${path}`;
|
|
63
|
-
return `${tool}:${path}#${createHash('sha1').update(String(body)).digest('hex').slice(0, 8)}`;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (tool === 'Bash') {
|
|
67
|
-
const cmd = (input.command || '').replace(/\s+/g, ' ').trim();
|
|
68
|
-
return cmd ? `Bash:${cmd.slice(0, BASH_SIGNATURE_MAX)}` : 'Bash';
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
try {
|
|
72
|
-
const json = JSON.stringify(input).replace(/\\/g, '/');
|
|
73
|
-
return json ? `${tool}:${json.slice(0, 200)}` : tool;
|
|
74
|
-
} catch {
|
|
75
|
-
return tool;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from 'fs';
|
|
2
2
|
import { join } from 'path';
|
|
3
|
-
import {
|
|
3
|
+
import { scenarioTitle } from './owner-words.js';
|
|
4
4
|
|
|
5
5
|
/** `PARCIAL` on the report's first non-blank line, tolerating heading/bold/quote typography. */
|
|
6
6
|
export const PARTIAL_MARKER = /^[\s#>*_]*PARCIAL\b/;
|
|
@@ -16,7 +16,6 @@ export function reportPath(featureDir) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
const ROW = /^\|\s*(C\d+)\s*\|(.*)$/;
|
|
19
|
-
const NOTE = /^\s*[-*]\s+(?:.*?[—–-]\s+)?(C\d+)\s*:\s*(.+?)\s*$/;
|
|
20
19
|
|
|
21
20
|
// Two shapes: `| Cn | status | evidência |` and `| Cn | cenário | status | evidência |`.
|
|
22
21
|
function rowCells(rest) {
|
|
@@ -37,63 +36,8 @@ export function parseReport(text) {
|
|
|
37
36
|
return rows;
|
|
38
37
|
}
|
|
39
38
|
|
|
40
|
-
/**
|
|
41
|
-
export function
|
|
42
|
-
const notes = new Map();
|
|
43
|
-
let inNotes = false;
|
|
44
|
-
for (const line of String(text ?? '').split(/\r?\n/)) {
|
|
45
|
-
if (/^##\s/.test(line)) { inNotes = /^##\s+notas\b/i.test(line); continue; }
|
|
46
|
-
const m = inNotes && NOTE.exec(line);
|
|
47
|
-
if (m) notes.set(m[1], m[2]);
|
|
48
|
-
}
|
|
49
|
-
return notes;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Features started before 10.0 have per-slice reports and no report.md: a Cn counts as done when a
|
|
53
|
-
// slice that covers it has a final report, so an in-flight feature keeps moving after the upgrade.
|
|
54
|
-
function legacyRows(checks, readSliceReport) {
|
|
55
|
-
const rows = new Map();
|
|
56
|
-
for (const slice of Array.isArray(checks.slices) ? checks.slices : []) {
|
|
57
|
-
const first = String(readSliceReport(slice.id) ?? '').split(/\r?\n/).find((l) => l.trim() !== '');
|
|
58
|
-
if (first === undefined) continue;
|
|
59
|
-
const status = /^[\s#>*_]*BLOQUEADO\b/.test(first) ? 'bloqueado' : PARTIAL_MARKER.test(first) ? null : 'feito';
|
|
60
|
-
if (!status) continue;
|
|
61
|
-
for (const id of slice.covers ?? []) {
|
|
62
|
-
if (rows.get(id)?.status !== 'bloqueado') rows.set(id, { status, evidence: `${slice.id}.md` });
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return rows;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const SCENARIO_LINE = /^[-*]\s+\*\*(C\d+)\*\*/;
|
|
69
|
-
const TITLE_LINE = /^\s*t[ií]tulo\s*:\s*(.+?)\s*$/i;
|
|
70
|
-
const SUMMARY_LINE = /^\s*[-*]\s+\**\s*(nome|depois)\s*\**\s*:\s*\**\s*(.+?)\s*$/i;
|
|
71
|
-
|
|
72
|
-
// A checks.json extracted before titles existed: the names come from its plan.md, read only.
|
|
73
|
-
export function planNames(planText) {
|
|
74
|
-
const titles = new Map();
|
|
75
|
-
const summary = { name: null, after: null };
|
|
76
|
-
let current = null;
|
|
77
|
-
for (const line of String(planText ?? '').split(/\r?\n/)) {
|
|
78
|
-
const scenario = SCENARIO_LINE.exec(line);
|
|
79
|
-
if (scenario) { current = scenario[1]; continue; }
|
|
80
|
-
const title = current && TITLE_LINE.exec(line);
|
|
81
|
-
if (title && !titles.has(current)) { titles.set(current, title[1]); continue; }
|
|
82
|
-
const sum = SUMMARY_LINE.exec(line);
|
|
83
|
-
if (sum) {
|
|
84
|
-
const key = sum[1].toLowerCase() === 'nome' ? 'name' : 'after';
|
|
85
|
-
summary[key] ??= sum[2];
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return { titles, summary: summary.name || summary.after ? summary : null };
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function needsPlan(checks) {
|
|
92
|
-
return !checks?.summary || !(checks.checks ?? []).every((c) => c?.title);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/** @returns {{ total, done, blocked, pending, checks: Array<{id, status, evidence}>, legacy: boolean } | null} */
|
|
96
|
-
export function implementProgressFrom(checksText, reportText, readSliceReport = () => null, readPlan = () => null) {
|
|
39
|
+
/** @returns {{ total, done, blocked, pending, checks: Array<{id, title, status, evidence}> } | null} */
|
|
40
|
+
export function implementProgressFrom(checksText, reportText) {
|
|
97
41
|
let checks;
|
|
98
42
|
try {
|
|
99
43
|
checks = JSON.parse(checksText ?? '');
|
|
@@ -101,24 +45,12 @@ export function implementProgressFrom(checksText, reportText, readSliceReport =
|
|
|
101
45
|
return null;
|
|
102
46
|
}
|
|
103
47
|
if (!Array.isArray(checks?.checks)) return null;
|
|
104
|
-
const
|
|
105
|
-
const rows = legacy ? legacyRows(checks, readSliceReport) : parseReport(reportText);
|
|
106
|
-
const notes = legacy ? new Map() : parseNotes(reportText);
|
|
107
|
-
const plan = needsPlan(checks) ? planNames(readPlan()) : null;
|
|
48
|
+
const rows = parseReport(reportText);
|
|
108
49
|
const out = checks.checks
|
|
109
50
|
.filter((c) => c && typeof c.id === 'string')
|
|
110
|
-
.map((c) => {
|
|
111
|
-
const status = rows.get(c.id)?.status ?? 'pendente';
|
|
112
|
-
return {
|
|
113
|
-
id: c.id, title: scenarioTitle(c.title ? c : { ...c, title: plan?.titles.get(c.id) }), status, evidence: rows.get(c.id)?.evidence ?? '',
|
|
114
|
-
...(status === 'bloqueado' && notes.has(c.id) ? { question: notes.get(c.id) } : {}),
|
|
115
|
-
};
|
|
116
|
-
});
|
|
51
|
+
.map((c) => ({ id: c.id, title: scenarioTitle(c), status: rows.get(c.id)?.status ?? 'pendente', evidence: rows.get(c.id)?.evidence ?? '' }));
|
|
117
52
|
const count = (status) => out.filter((c) => c.status === status).length;
|
|
118
|
-
return {
|
|
119
|
-
total: out.length, done: count('feito'), blocked: count('bloqueado'), pending: count('pendente'), checks: out, legacy,
|
|
120
|
-
summary: checks.summary ?? plan?.summary ?? null,
|
|
121
|
-
};
|
|
53
|
+
return { total: out.length, done: count('feito'), blocked: count('bloqueado'), pending: count('pendente'), checks: out };
|
|
122
54
|
}
|
|
123
55
|
|
|
124
56
|
function readOrNull(path) {
|
|
@@ -129,32 +61,6 @@ function readOrNull(path) {
|
|
|
129
61
|
}
|
|
130
62
|
}
|
|
131
63
|
|
|
132
|
-
const planPath = (featureDir) => join(featureDir, '2-plan', 'plan.md');
|
|
133
|
-
|
|
134
|
-
export function featureSummary(featureDir) {
|
|
135
|
-
let checks = null;
|
|
136
|
-
try { checks = JSON.parse(readOrNull(checksPath(featureDir)) ?? 'null'); } catch { /* the plan still names it */ }
|
|
137
|
-
return checks?.summary ?? planNames(readOrNull(planPath(featureDir))).summary;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/** `Nome (slug)` with the plan's name, from the project root that holds `.morph/`. */
|
|
141
|
-
export function ownerRef(root, slug, feature) {
|
|
142
|
-
return featureRef(slug, feature, featureSummary(join(root, '.morph', 'features', slug)));
|
|
143
|
-
}
|
|
144
|
-
|
|
145
64
|
export function implementProgress(featureDir) {
|
|
146
|
-
|
|
147
|
-
return implementProgressFrom(
|
|
148
|
-
readOrNull(checksPath(featureDir)),
|
|
149
|
-
readOrNull(reportPath(featureDir)),
|
|
150
|
-
(id) => (existsSync(sliceDir) ? readOrNull(join(sliceDir, `${id}.md`)) : null),
|
|
151
|
-
() => readOrNull(planPath(featureDir)),
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/** The report template body for a feature's checks (ids or `{ id, title }`): every Cn starts `pendente`. */
|
|
156
|
-
export function reportSkeleton(featureName, checks) {
|
|
157
|
-
const rows = checks.map((c) => (typeof c === 'string' ? { id: c } : c))
|
|
158
|
-
.map((c) => `| ${c.id} | ${scenarioTitle(c).replaceAll('|', '/')} | pendente | |`).join('\n');
|
|
159
|
-
return `# ${featureName}\n\n| Cn | cenário | status | evidência |\n|----|---------|--------|-----------|\n${rows}\n\n## Notas\n\n`;
|
|
65
|
+
return implementProgressFrom(readOrNull(checksPath(featureDir)), readOrNull(reportPath(featureDir)));
|
|
160
66
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// so this file carries no copy of them. Stateless: it never writes to disk.
|
|
5
5
|
|
|
6
6
|
import { execFileSync } from 'node:child_process';
|
|
7
|
-
import { existsSync, readFileSync
|
|
7
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
8
8
|
import { homedir } from 'node:os';
|
|
9
9
|
import { join } from 'node:path';
|
|
10
10
|
import { pathToFileURL } from 'node:url';
|
|
@@ -20,9 +20,6 @@ const GRAY = '\x1b[90m';
|
|
|
20
20
|
const WHITE = '\x1b[97m';
|
|
21
21
|
const SEP = ` ${GRAY}│${R} `;
|
|
22
22
|
|
|
23
|
-
const PHASE_INDEX = { plan: 0, uiux: 1, implement: 2, review: 3 };
|
|
24
|
-
const PHASE_LABELS = { plan: 'planning', uiux: 'UI/UX', implement: 'implement', review: 'review' };
|
|
25
|
-
const GATE_PHASES = new Set(['plan', 'uiux', 'review']);
|
|
26
23
|
|
|
27
24
|
// Mirrors claude.exe: auto-compact fires at min(modelWindow, autoCompactWindow) − 20000 output reserve − 13000.
|
|
28
25
|
// Reproducible only when `autoCompactWindow` is set in settings; any other source is server-driven.
|
|
@@ -146,73 +143,34 @@ function gitInfo(cwd) {
|
|
|
146
143
|
return parts.join(' ');
|
|
147
144
|
}
|
|
148
145
|
|
|
149
|
-
const samePath = (a, b) => {
|
|
150
|
-
try { return realpathSync(a).toLowerCase() === realpathSync(b).toLowerCase(); } catch { return false; }
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
/** Worktree name of this session, or null in the primary tree. */
|
|
154
|
-
export function worktreeLabel(payload, cwd) {
|
|
155
|
-
if (payload.worktree?.name) return (payload.worktree.branch || '').replace('refs/heads/', '') || payload.worktree.name;
|
|
156
|
-
if (payload.workspace?.git_worktree) return payload.workspace.git_worktree;
|
|
157
|
-
if (!existsSync(join(cwd, '.morph', 'features'))) return null;
|
|
158
|
-
let out;
|
|
159
|
-
try { out = git(['worktree', 'list', '--porcelain'], cwd); } catch { return null; }
|
|
160
|
-
const entries = [];
|
|
161
|
-
let current = null;
|
|
162
|
-
for (const line of out.split(/\r?\n/)) {
|
|
163
|
-
if (line.startsWith('worktree ')) { current = { path: line.slice(9) }; entries.push(current); }
|
|
164
|
-
else if (line.startsWith('branch ') && current) current.branch = line.slice(7);
|
|
165
|
-
}
|
|
166
|
-
const mine = entries.slice(1).find((e) => samePath(e.path, cwd));
|
|
167
|
-
return mine ? (mine.branch || '').replace('refs/heads/', '') || null : null;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
146
|
async function importShared(projectDir, name) {
|
|
171
147
|
const path = join(projectDir, '.morph', 'framework', 'hooks', 'shared', name);
|
|
172
148
|
return existsSync(path) ? import(pathToFileURL(path).href) : null;
|
|
173
149
|
}
|
|
174
150
|
|
|
175
|
-
/**
|
|
176
|
-
export async function
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
let
|
|
151
|
+
/** The feature of the current branch, with scenario progress, read through the project's own installed rules. */
|
|
152
|
+
export async function activeFeature(projectDir, cwd) {
|
|
153
|
+
let branch;
|
|
154
|
+
try { branch = git(['symbolic-ref', '--short', 'HEAD'], cwd).trim(); } catch { return null; }
|
|
155
|
+
let slugRules;
|
|
180
156
|
let progressRules;
|
|
181
157
|
try {
|
|
182
|
-
[
|
|
158
|
+
[slugRules, progressRules] = await Promise.all([importShared(projectDir, 'feature-slug.js'), importShared(projectDir, 'report-progress.js')]);
|
|
183
159
|
} catch {
|
|
184
|
-
return
|
|
160
|
+
return null;
|
|
185
161
|
}
|
|
186
|
-
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
if (feature?.status !== 'in_progress') continue;
|
|
192
|
-
let phase = 'plan';
|
|
193
|
-
try { phase = stateReader.derivePhaseForFeature(name, projectDir) || 'plan'; } catch { /* plan */ }
|
|
194
|
-
const progress = progressRules?.implementProgress?.(join(base, name)) ?? null;
|
|
195
|
-
const gates = feature.approvalGates || {};
|
|
196
|
-
out.push({
|
|
197
|
-
name,
|
|
198
|
-
phase,
|
|
199
|
-
done: progress?.done ?? 0,
|
|
200
|
-
total: progress?.total ?? 0,
|
|
201
|
-
pending: GATE_PHASES.has(phase) && gates[phase]?.approved !== true ? phase : null,
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
return out;
|
|
162
|
+
const name = slugRules?.slugOfBranch?.(branch);
|
|
163
|
+
const dir = name && join(projectDir, '.morph', 'features', name);
|
|
164
|
+
if (!dir || !existsSync(dir)) return null;
|
|
165
|
+
const progress = progressRules?.implementProgress?.(dir) ?? null;
|
|
166
|
+
return { name, done: progress?.done ?? 0, total: progress?.total ?? 0 };
|
|
205
167
|
}
|
|
206
168
|
|
|
207
169
|
export function renderFeatureLine(feature, columns) {
|
|
208
170
|
const parts = [[0, `${CYAN}${BOLD}► ${feature.name}${R}`]];
|
|
209
|
-
const position = PHASE_INDEX[feature.phase];
|
|
210
|
-
const label = PHASE_LABELS[feature.phase] ?? feature.phase;
|
|
211
|
-
parts.push([1, position === undefined ? `${CYAN}${label}${R}` : `${CYAN}${label} ${position + 1}/4${R}`]);
|
|
212
171
|
if (feature.total > 0) {
|
|
213
|
-
parts.push([
|
|
172
|
+
parts.push([1, `${GREEN}${progressBar((feature.done / feature.total) * 100, 6)} ${feature.done}/${feature.total} cenários${R}`]);
|
|
214
173
|
}
|
|
215
|
-
if (feature.pending) parts.push([2, `${RED}⛔ gate: ${feature.pending}${R}`]);
|
|
216
174
|
return joinToWidth(parts, columns);
|
|
217
175
|
}
|
|
218
176
|
|
|
@@ -318,10 +276,8 @@ export async function main(raw, env = process.env, write = (s) => process.stdout
|
|
|
318
276
|
const cwd = payload.workspace?.current_dir || payload.cwd || process.cwd();
|
|
319
277
|
const projectDir = payload.workspace?.project_dir || cwd;
|
|
320
278
|
const columns = int(env.COLUMNS);
|
|
321
|
-
|
|
322
|
-
if (
|
|
323
|
-
for (const feature of await activeFeatures(projectDir)) write(renderFeatureLine(feature, columns));
|
|
324
|
-
}
|
|
279
|
+
const feature = await activeFeature(projectDir, cwd);
|
|
280
|
+
if (feature) write(renderFeatureLine(feature, columns));
|
|
325
281
|
const line = renderStatusLine(payload, cwd, readUserSettings(env), columns);
|
|
326
282
|
if (line) write(line);
|
|
327
283
|
} catch (err) {
|
|
@@ -253,7 +253,7 @@
|
|
|
253
253
|
"failureHint": "Neon MCP not responding. Re-run the OAuth flow: claude mcp add --transport http neon https://mcp.neon.tech/mcp"
|
|
254
254
|
},
|
|
255
255
|
"install": {
|
|
256
|
-
"autoInstall":
|
|
256
|
+
"autoInstall": true,
|
|
257
257
|
"transport": "http",
|
|
258
258
|
"config": {
|
|
259
259
|
"type": "http",
|
|
@@ -283,7 +283,7 @@
|
|
|
283
283
|
"failureHint": "Microsoft Learn MCP not responding. Re-add it: claude mcp add --transport http microsoft-learn https://learn.microsoft.com/api/mcp"
|
|
284
284
|
},
|
|
285
285
|
"install": {
|
|
286
|
-
"autoInstall":
|
|
286
|
+
"autoInstall": true,
|
|
287
287
|
"transport": "http",
|
|
288
288
|
"config": {
|
|
289
289
|
"type": "http",
|
|
@@ -5,7 +5,7 @@ paths:
|
|
|
5
5
|
|
|
6
6
|
# Formato do report.md
|
|
7
7
|
|
|
8
|
-
A memória da implementação depois de um `/compact
|
|
8
|
+
A memória da implementação depois de um `/compact`, e o que o `check --report` lê para o `## Resultado`.
|
|
9
9
|
|
|
10
10
|
```markdown
|
|
11
11
|
| Cn | cenário | status | evidência |
|
|
@@ -19,8 +19,8 @@ A memória da implementação depois de um `/compact` e o que o `next` lê para
|
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
- Status: `pendente` | `feito` | `bloqueado` (ao dono: falta, feito, travado). Uma linha por `Cn` do `checks.json`, sem inventar nem pular.
|
|
22
|
-
- `cenário` é o `título:` do plano
|
|
22
|
+
- `cenário` é o `título:` do plano: é por ele que o dono acompanha. Report antigo de três colunas segue lido; não precisa migrar.
|
|
23
23
|
- `feito` exige evidência: o teste que prova, o `arquivo:linha` (`prova: leitura`) ou `evidencias/{Cn}.md` (`eval`/`manual`). `feito` sem evidência é o que o hook de Stop aponta.
|
|
24
|
-
- `bloqueado` só com a pergunta em `## Notas
|
|
24
|
+
- `bloqueado` só com a pergunta em `## Notas`, em palavras do dono e nomeando o cenário (`Cenário 3: <título>`): o `check` sinaliza `bloqueado` e o PR sai como `precisa-humano`. Com humano na sessão, ela vira `AskUserQuestion`; respondida, a resposta vai em `## Notas` e o `Cn` volta a `pendente`.
|
|
25
25
|
- `## Notas` é append-only, uma linha datada por decisão ou fato novo. Fato errado do plano vai na `## Errata` do `plan.md`, não aqui.
|
|
26
26
|
- Atualize ao fechar cada `Cn` e commite junto (`feat(<f>): Cn …`, tipo do que o lote muda: `feat`, `fix`, `test`, `refactor`, `docs`, `chore`).
|
|
@@ -10,7 +10,7 @@ stacks:
|
|
|
10
10
|
|
|
11
11
|
**Ponto de vista:** Next.js App Router idiomático — Server Component por padrão, Client Component só com interação real; Tailwind + shadcn + Motion; tipos por Zod. Tipo local redeclarado em cada arquivo é o defeito mais comum aqui: confira a tabela `## Reuso` do plano antes de criar um tipo.
|
|
12
12
|
|
|
13
|
-
- **frontend-nextjs-lint** (`frontend/nextjs/lint.md`) — O lint cobra o mecânico: `framer-motion`, Zustand/Redux, driver de banco, Form legado, deep import de feature, fronteiras `components`/`features`/`app`/`hooks`, fetch em `useEffect`, elemento cru (`<button>`, `<input>`, `<select>`, `<textarea>`, `<table>`, `<dialog>`) fora de `components/ui/`, `'use client'` no layout raiz, `export default` fora de rota, `any`. O `verify` roda o eslint nos arquivos da feature quando há `eslint.config.*`; sem `eslint.config.mjs`: `morph-spec standards --show frontend-nextjs-lint#files`. Regra mecânica nova vira linha nele, nunca prosa.
|
|
13
|
+
- **frontend-nextjs-lint** (`frontend/nextjs/lint.md`) — O lint cobra o mecânico: `framer-motion`, Zustand/Redux, driver de banco, Form legado, deep import de feature, fronteiras `components`/`features`/`app`/`hooks`, fetch em `useEffect`, elemento cru (`<button>`, `<input>`, `<select>`, `<textarea>`, `<table>`, `<dialog>`) fora de `components/ui/`, acessibilidade (`jsx-a11y` como erro: `div` clicável sem teclado e foco, `tabIndex` positivo, `img` sem `alt`, ARIA errado), `'use client'` no layout raiz, `export default` fora de rota, `any`. O `verify` roda o eslint nos arquivos da feature quando há `eslint.config.*`; sem `eslint.config.mjs`: `morph-spec standards --show frontend-nextjs-lint#files`. Regra mecânica nova vira linha nele, nunca prosa.
|
|
14
14
|
- **frontend-nextjs-naming-conventions** (`frontend/nextjs/naming-conventions.md`) — Arquivo SEMPRE kebab-case (`user-card.tsx`); componente PascalCase. Zod em `.schemas.ts`, tipos em `.types.ts` via `z.infer`. Nunca misture casos na mesma categoria.
|
|
15
15
|
- **frontend-nextjs-project-structure** (`frontend/nextjs/project-structure.md`) — `src/app/` só roteia; a lógica da tela mora em `src/features/{f}/` (`components/`, `hooks/`, `types/`, `index.ts` como API pública). NUNCA uma feature importa outra (extraia para `components/` ou `lib/`); `components/ui/` é shadcn e não se edita.
|
|
16
16
|
- **frontend-nextjs-app-router** (`frontend/nextjs/app-router.md`) — Server Component por padrão; `'use client'` só para interação, browser API ou TanStack Query. `loading.tsx`/`error.tsx` ao lado do `page.tsx`. Server Component chama o .NET com `BACKEND_API_PREFIX`; evite `route.ts`.
|
|
@@ -9,11 +9,13 @@ paths:
|
|
|
9
9
|
|
|
10
10
|
## Resumo
|
|
11
11
|
|
|
12
|
-
É o que
|
|
12
|
+
É o que quem decide lê primeiro, sem abrir o código. Uma frase curta por linha, **sem nome de arquivo, classe, tabela ou sigla interna**:
|
|
13
13
|
|
|
14
|
-
- `- Nome:` como você chamaria a feature numa conversa, com acento ("Prazo de retenção de dados pessoais"); vira o título
|
|
15
|
-
- `-
|
|
14
|
+
- `- Nome:` como você chamaria a feature numa conversa, com acento ("Prazo de retenção de dados pessoais"); vira o título do PR.
|
|
15
|
+
- `- Tipo:` `feature` | `bug` | `chore` | `hotfix`. Num `bug` o `plan-check` exige um cenário `prova: teste` com `risco: regressão`: o sintoma reproduzido.
|
|
16
|
+
- `- Hoje:` o que acontece hoje e quem sente. `- Depois:` o que passa a acontecer e como essa pessoa percebe. As duas são o "antes → depois" do PR; sem elas o `plan-check` avisa.
|
|
16
17
|
- `- Atenção:` (opcional, repete) o que merece um olhar antes de aprovar: o que pode dar errado, o que não tem volta, o que depende de alguém.
|
|
18
|
+
- `- Origem:` `issue` quando os cenários vieram da issue; `proposta` quando a issue veio sem eles e você os propôs. Com `proposta`, o `check` sinaliza `precisa-humano` e ninguém implementa antes da aprovação.
|
|
17
19
|
|
|
18
20
|
Cada cenário leva `título:` junto de `prova:`: até dez palavras, na língua de quem usa ("Conversa parada há 13 meses é apagada"), nunca "o primeiro sai" nem identificador de código. É o nome com que o dono vê o cenário em todo lugar (`Cenário 3: <título>` na página, no `next`, na pergunta de gate e no `report.md`); o `Dado/quando/então` fica atrás de um clique. Escreva-o sempre. Plano congelado sem nada disso segue valendo: a página cai no `Resultado buscado` e no trecho depois de "então".
|
|
19
21
|
|
|
@@ -28,10 +30,10 @@ Cada cenário leva `título:` junto de `prova:`: até dez palavras, na língua d
|
|
|
28
30
|
- **Número que soma ou confere com outro** roda sobre dado com a forma do de produção; fixture feita à mão só tem as formas que você já imaginou.
|
|
29
31
|
- **Observável**: que asserção, ou que passo no navegador, prova? Sem resposta, reescreva ou descarte.
|
|
30
32
|
- **Artefato não é comportamento.** Cenário que cita `grep`, "contém a string", "o binário", "nenhum arquivo", "arquivo/pasta/diretório em" ou glob `**/` descreve o repositório; o glob entre crases não conta (é o valor que a mudança trata, como o caminho que um CI filtra). Tente o efeito em runtime; se o artefato É o entregável, justifique em `> Por que artefato:` logo abaixo (nunca na mesma linha, nunca `> [!note]`, que o parser não lê).
|
|
31
|
-
- **Saída de LLM** prova-se por `eval` de runtime, nunca pelo texto do prompt: evidência em `3-implement/evidencias/{Cn}.md`; com
|
|
32
|
-
- **"A suíte roda de ponta a ponta"** prova-se pelo `
|
|
33
|
-
- **Orçamento de teste:** um teste por cenário de risco; variantes são linhas de tabela (`[Theory]`/`it.each`); nenhum teste que só fixa texto, prompt, constante, DTO ou mapping; o mesmo comportamento numa camada só. Além disso é escopo para o revisor.
|
|
34
|
-
- **O risco do diff decide a cerimônia, não o tipo:** cenário de doc, config ou remoção é `leitura
|
|
33
|
+
- **Saída de LLM** prova-se por `eval` de runtime, nunca pelo texto do prompt: evidência em `3-implement/evidencias/{Cn}.md`; com o standard `ai-agents-evals-with-cache` o cenário mora no dataset.
|
|
34
|
+
- **"A suíte roda de ponta a ponta"** prova-se pelo `morph-spec check --tier full`; nunca uma execução avulsa.
|
|
35
|
+
- **Orçamento de teste:** um teste por cenário de risco; variantes são linhas de tabela (`[Theory]`/`it.each`); nenhum teste que só fixa texto, prompt, constante, DTO ou mapping; o mesmo comportamento numa camada só. Além disso é escopo para o revisor. A prova de que ele morde é o `morph-spec prove-red`.
|
|
36
|
+
- **O risco do diff decide a cerimônia, não o tipo:** cenário de doc, config ou remoção é `leitura`; um `Cn` com `risco:` põe lógica no diff e pede o teste que a prova.
|
|
35
37
|
|
|
36
38
|
```markdown
|
|
37
39
|
## Cenários
|
|
@@ -55,19 +57,19 @@ Todo valor de baixo risco que você decidiu sem perguntar (limite, intervalo, re
|
|
|
55
57
|
|
|
56
58
|
## Estados (opcional)
|
|
57
59
|
|
|
58
|
-
Só quando a feature tem algo que muda de estado (pedido, aprovação, assinatura): uma transição por linha, `- origem → destino: gatilho` (`->` também vale).
|
|
60
|
+
Só quando a feature tem algo que muda de estado (pedido, aprovação, assinatura): uma transição por linha, `- origem → destino: gatilho` (`->` também vale). Linha que não é transição, ou seção vazia, é erro. Sem estado, não escreva a seção.
|
|
59
61
|
|
|
60
62
|
## Fluxo (opcional)
|
|
61
63
|
|
|
62
|
-
O caminho de um pedido ou dado pelo sistema, na mesma forma e com as mesmas recusas de `## Estados`: `- origem → destino: o que passa`.
|
|
64
|
+
O caminho de um pedido ou dado pelo sistema, na mesma forma e com as mesmas recusas de `## Estados`: `- origem → destino: o que passa`.
|
|
63
65
|
|
|
64
66
|
## Reuso
|
|
65
67
|
|
|
66
|
-
`| conceito | veredito | alvo | why |`, veredito `REUSAR` | `ESTENDER` | `CRIAR`. **`CRIAR` exige `why`** (`graph explain X → not-found; grep -rn X → 0`). Abstração nova (interface, base, factory, camada) soma ao `why` o segundo uso que ela barateia; sem isso é excesso (`architecture-engineering-lens#excess`). Conceito de duas features vai a um módulo comum, nunca import cruzado.
|
|
68
|
+
`| conceito | veredito | alvo | why |`, veredito `REUSAR` | `ESTENDER` | `CRIAR`. **`CRIAR` exige `why`** (`graph explain X → not-found; grep -rn X → 0`). Abstração nova (interface, base, factory, camada) soma ao `why` o segundo uso que ela barateia; sem isso é excesso (`architecture-engineering-lens#excess`). Conceito de duas features vai a um módulo comum, nunca import cruzado. Símbolo novo homônimo de um existente é duplicação, e o revisor aponta.
|
|
67
69
|
|
|
68
70
|
## Decisões
|
|
69
71
|
|
|
70
|
-
`### ADR-001 — título` por decisão não trivial (alternativa descartada, motivo, quem decidiu) com `**Alcance:** feature` ou `projeto`, citando os `Cn` que sustenta
|
|
72
|
+
`### ADR-001 — título` por decisão não trivial (alternativa descartada, motivo, quem decidiu) com `**Alcance:** feature` ou `projeto`, citando os `Cn` que sustenta. Logo abaixo do alcance, três linhas de uma frase cada, sem código, que são o que quem aprova lê da decisão (sem elas o `plan-check` avisa): `**Decidimos:**` a decisão, `**Por quê:**` o motivo, `**O que custa:**` o que se perde ou se aceita. O título segue a mesma língua ("Lead abordado não é apagado, só perde os dados", nunca "lápide para o abordado"). Greenfield: decisão que fixa stack, layout, infraestrutura ou test runner é `projeto`. `### Conflitos com o acervo` sempre (`nenhum` vale). Proibição além das do standard `architecture-stack-baseline` é ADR.
|
|
71
73
|
|
|
72
74
|
## O que o plan-check recusa
|
|
73
75
|
|