@polymorphism-tech/morph-spec 10.12.0 → 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 +31 -86
- 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,579 +0,0 @@
|
|
|
1
|
-
import { useCallback, useState } from 'react';
|
|
2
|
-
import { Link, useParams, useSearchParams } from 'react-router-dom';
|
|
3
|
-
import {
|
|
4
|
-
ArrowLeft, CheckCircle, PauseCircle, Circle, WarningCircle, FileText, FileCode, Copy, Check, ArrowSquareOut,
|
|
5
|
-
} from '@phosphor-icons/react';
|
|
6
|
-
import PhaseRail, { segmentStates } from '../components/PhaseRail.jsx';
|
|
7
|
-
import KnowledgeMarkdown from '../components/KnowledgeMarkdown.jsx';
|
|
8
|
-
import ActivityFeed from '../components/ActivityFeed.jsx';
|
|
9
|
-
import SessionMap from '../components/SessionMap.jsx';
|
|
10
|
-
import { useMorphQuery } from '../hooks/useMorphQuery.js';
|
|
11
|
-
import { usePref, useNow } from '../hooks/usePref.js';
|
|
12
|
-
import { isWorking } from './Features.jsx';
|
|
13
|
-
import { apiBase, projectHref } from '../lib/project.js';
|
|
14
|
-
import {
|
|
15
|
-
PHASES, GATE_LABEL, STATUS_LABEL, LOCATION_LABEL, phaseMeta, ROLE_NAME, STATUS_SAY, BLOCKER_SAY, VERIFY_STEP_SAY,
|
|
16
|
-
RESULT_SAY, CHECK_RESULT_SAY, PROOF_SAY, TRUST_SAY, workLabel, featureTitle, verdictWord, scenarioLabel,
|
|
17
|
-
} from '../lib/phases.js';
|
|
18
|
-
import { timeAgo, dateTime, num, bytes, verdictLabel } from '../lib/format.js';
|
|
19
|
-
|
|
20
|
-
const TABS = [
|
|
21
|
-
{ id: 'overview', label: 'Visão geral' },
|
|
22
|
-
{ id: 'checks', label: 'Cenários' },
|
|
23
|
-
{ id: 'docs', label: 'Documentos' },
|
|
24
|
-
{ id: 'activity', label: 'Atividade' },
|
|
25
|
-
];
|
|
26
|
-
|
|
27
|
-
const IMPLEMENT_STATUS = {
|
|
28
|
-
feito: { label: STATUS_SAY.feito, tone: 'text-[var(--color-ok)]', icon: CheckCircle },
|
|
29
|
-
bloqueado: { label: STATUS_SAY.bloqueado, tone: 'text-[var(--color-warn)]', icon: PauseCircle },
|
|
30
|
-
pendente: { label: STATUS_SAY.pendente, tone: 'text-[var(--color-faint)]', icon: Circle },
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const labelOf = (f, id) => f.checksList?.find((c) => c.id === id)?.label ?? scenarioLabel({ id });
|
|
34
|
-
|
|
35
|
-
export function editorLink(absPath) {
|
|
36
|
-
return `vscode://file/${encodeURI(String(absPath).replace(/\\/g, '/'))}`;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function CopyButton({ text, label = 'Copiar caminho' }) {
|
|
40
|
-
const [done, setDone] = useState(false);
|
|
41
|
-
const copy = async () => {
|
|
42
|
-
try { await navigator.clipboard.writeText(text); setDone(true); setTimeout(() => setDone(false), 1500); } catch { /* clipboard blocked */ }
|
|
43
|
-
};
|
|
44
|
-
return (
|
|
45
|
-
<button type="button" onClick={copy} title={text}
|
|
46
|
-
className="fluid inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 font-sans text-xs text-[var(--color-dim)] shadow-[inset_0_0_0_1px_var(--color-hair)] transition-colors hover:text-[var(--color-fg)] active:scale-[0.98]">
|
|
47
|
-
{done ? <Check weight="light" size={13} /> : <Copy weight="light" size={13} />}{done ? 'Copiado' : label}
|
|
48
|
-
</button>
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function EditorButton({ path, label = 'Abrir no VS Code' }) {
|
|
53
|
-
return (
|
|
54
|
-
<a href={editorLink(path)}
|
|
55
|
-
className="fluid inline-flex items-center gap-1.5 rounded-full bg-white/[0.06] px-2.5 py-1 font-sans text-xs text-[var(--color-fg)] transition-colors hover:bg-white/[0.1] active:scale-[0.98]">
|
|
56
|
-
<ArrowSquareOut weight="light" size={13} />{label}
|
|
57
|
-
</a>
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function nextAction(f) {
|
|
62
|
-
if (f.status === 'completed') return `Concluída${f.archivedAt ? ` ${timeAgo(f.archivedAt)}` : ''}.`;
|
|
63
|
-
if (f.status === 'abandoned') return 'Abandonada.';
|
|
64
|
-
const paused = f.gates.find((g) => g.paused);
|
|
65
|
-
if (paused) return `A ${(GATE_LABEL[paused.gate] || paused.gate).toLowerCase()} está esperando você${paused.reason ? `: ${paused.reason}` : ''}. A decisão é sua, no Claude Code.`;
|
|
66
|
-
if (f.inEvaluation) return 'A revisão independente terminou. A decisão sai do que ela aprovou, dos problemas que achou e dos cenários conferidos.';
|
|
67
|
-
if (f.phase === 'implement' && f.checksList?.length) {
|
|
68
|
-
const blocked = f.checksList.find((c) => c.implement === 'bloqueado');
|
|
69
|
-
if (blocked) return `${blocked.label} está travado: há uma pergunta que só você responde, no Claude Code.${blocked.question ? ` ${blocked.question}` : ''}`;
|
|
70
|
-
const open = f.checksList.find((c) => c.implement !== 'feito');
|
|
71
|
-
if (open) return `${f.scenarios.done} de ${f.scenarios.total} cenários feitos. Próximo: ${open.label}.`;
|
|
72
|
-
return 'Todos os cenários feitos. Faltam os testes automáticos da entrega e a revisão independente.';
|
|
73
|
-
}
|
|
74
|
-
const text = {
|
|
75
|
-
plan: 'O plano está sendo escrito: os cenários que provam a entrega e as decisões. Depois vem a aprovação do plano.',
|
|
76
|
-
uiux: 'As telas estão sendo desenhadas.',
|
|
77
|
-
implement: 'A construção está em andamento.',
|
|
78
|
-
review: 'Em revisão independente.',
|
|
79
|
-
};
|
|
80
|
-
return text[f.phase] || '';
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function Panel({ title, children, className = '' }) {
|
|
84
|
-
return (
|
|
85
|
-
<section className={`bezel ${className}`}>
|
|
86
|
-
<div className="bezel-core px-5 py-5">
|
|
87
|
-
{title && <h2 className="mb-4 text-sm font-medium text-[var(--color-fg)]">{title}</h2>}
|
|
88
|
-
{children}
|
|
89
|
-
</div>
|
|
90
|
-
</section>
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function GateList({ f }) {
|
|
95
|
-
const unused = new Set(segmentStates(f).filter((s) => s.state === 'skipped').map((s) => s.id));
|
|
96
|
-
return (
|
|
97
|
-
<ol className="space-y-4">
|
|
98
|
-
{f.gates.map((g) => {
|
|
99
|
-
const decision = f.gateDecisions?.[g.gate];
|
|
100
|
-
const state = g.skipped || unused.has(g.gate) ? 'etapa não usada' : g.approved ? 'aprovada' : g.paused ? 'esperando você' : 'ainda não chegou';
|
|
101
|
-
const by = g.approvedBy === 'auto' ? 'automaticamente' : g.approvedBy;
|
|
102
|
-
const Icon = g.approved ? CheckCircle : g.paused ? PauseCircle : Circle;
|
|
103
|
-
const tone = g.approved ? 'text-[var(--color-ok)]' : g.paused ? 'text-[var(--color-warn)]' : 'text-[var(--color-faint)]';
|
|
104
|
-
return (
|
|
105
|
-
<li key={g.gate} className="grid grid-cols-[1.25rem_minmax(0,1fr)] gap-3">
|
|
106
|
-
<Icon weight="light" size={18} className={tone} />
|
|
107
|
-
<div className="min-w-0">
|
|
108
|
-
<p className="text-sm">
|
|
109
|
-
<span className="text-[var(--color-fg)]">{GATE_LABEL[g.gate] || g.gate}</span>
|
|
110
|
-
<span className="ml-2 text-[var(--color-dim)]">{state}{by ? (by === 'automaticamente' ? `, ${by}` : `, por ${by}`) : ''}</span>
|
|
111
|
-
</p>
|
|
112
|
-
{g.at && <p className="text-xs text-[var(--color-faint)]">{dateTime(g.at)}</p>}
|
|
113
|
-
{decision?.reason && <p className="mt-1 text-sm text-[var(--color-dim)]">{decision.reason}</p>}
|
|
114
|
-
{decision?.trust && <p className="text-xs text-[var(--color-faint)]">Regra do projeto: {TRUST_SAY[decision.trust] ?? decision.trust}</p>}
|
|
115
|
-
</div>
|
|
116
|
-
</li>
|
|
117
|
-
);
|
|
118
|
-
})}
|
|
119
|
-
</ol>
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function NodeChips({ nodes }) {
|
|
124
|
-
if (!nodes) return <p className="text-sm text-[var(--color-faint)]">Os testes automáticos ainda não rodaram.</p>;
|
|
125
|
-
return (
|
|
126
|
-
<ul className="flex flex-wrap gap-2">
|
|
127
|
-
{Object.entries(nodes).map(([name, v]) => {
|
|
128
|
-
const status = typeof v === 'string' ? v : v?.status;
|
|
129
|
-
const tone = status === 'pass' ? 'text-[var(--color-ok)]' : status === 'fail' ? 'text-[var(--color-bad)]' : 'text-[var(--color-faint)]';
|
|
130
|
-
return (
|
|
131
|
-
<li key={name} className="rounded-full px-3 py-1 text-xs shadow-[inset_0_0_0_1px_var(--color-hair)]">
|
|
132
|
-
<span className="text-[var(--color-dim)]">{VERIFY_STEP_SAY[name] ?? name}</span> <span className={tone}>{RESULT_SAY[status] ?? status ?? '—'}</span>
|
|
133
|
-
</li>
|
|
134
|
-
);
|
|
135
|
-
})}
|
|
136
|
-
</ul>
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
const ROLE_SHORT = { verifier: 'Entregas', reviewer: 'Código', security: 'Segurança' };
|
|
141
|
-
const REVIEW_STATUS_LABEL = { missing: 'ainda não revisou', partial: 'revisão incompleta', unverdicted: 'sem conclusão', ok: null };
|
|
142
|
-
const problems = (n) => `${n} ${n === 1 ? 'problema' : 'problemas'}`;
|
|
143
|
-
|
|
144
|
-
function ReviewRows({ reviews }) {
|
|
145
|
-
if (!reviews?.length) return null;
|
|
146
|
-
return (
|
|
147
|
-
<ul className="mt-4 space-y-2 text-sm">
|
|
148
|
-
{reviews.map((r) => {
|
|
149
|
-
const state = REVIEW_STATUS_LABEL[r.status] ?? verdictWord(r.verdict);
|
|
150
|
-
const tone = r.verdict === 'SHIP' && r.status === 'ok' ? 'text-[var(--color-ok)]' : r.verdict === 'FIX' ? 'text-[var(--color-bad)]' : 'text-[var(--color-faint)]';
|
|
151
|
-
return (
|
|
152
|
-
<li key={r.role} className="grid grid-cols-[11rem_minmax(0,1fr)_auto] items-baseline gap-3">
|
|
153
|
-
<span className="text-[var(--color-dim)]">{ROLE_NAME[r.role] || r.role}</span>
|
|
154
|
-
<span className={tone}>
|
|
155
|
-
{state}{r.blockers ? ` · ${problems(r.blockers)}` : ''}
|
|
156
|
-
{r.reviewedSha && <span className="ml-2 font-mono text-xs text-[var(--color-faint)]">{r.reviewedSha.slice(0, 7)}</span>}
|
|
157
|
-
</span>
|
|
158
|
-
{r.status !== 'missing' && (
|
|
159
|
-
<Link to={`?tab=docs&doc=${encodeURIComponent(r.path)}`} className="text-xs text-[var(--color-dim)] underline decoration-[var(--color-hair-strong)] underline-offset-2 hover:text-[var(--color-fg)]">abrir</Link>
|
|
160
|
-
)}
|
|
161
|
-
</li>
|
|
162
|
-
);
|
|
163
|
-
})}
|
|
164
|
-
</ul>
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
function VerdictBlock({ f }) {
|
|
169
|
-
return (
|
|
170
|
-
<div>
|
|
171
|
-
<p className="flex items-baseline gap-2">
|
|
172
|
-
<span className="text-3xl font-semibold tracking-tight">{verdictWord(f.verdict) ?? '—'}</span>
|
|
173
|
-
<span className="text-sm text-[var(--color-dim)]">{f.verdict ? problems(f.blockers ?? 0) : 'a revisão independente ainda não terminou'}</span>
|
|
174
|
-
</p>
|
|
175
|
-
<ReviewRows reviews={f.reviews} />
|
|
176
|
-
{f.blockerList?.length > 0 && (
|
|
177
|
-
<ul className="mt-4 space-y-1.5 text-xs">
|
|
178
|
-
{f.blockerList.map((b) => (
|
|
179
|
-
<li key={b.id} className="grid grid-cols-[3rem_9rem_minmax(0,1fr)] gap-3">
|
|
180
|
-
<span className="font-mono text-[var(--color-dim)]">{b.id}</span>
|
|
181
|
-
<span className="text-[var(--color-warn)]">{BLOCKER_SAY[b.type] ?? b.type}</span>
|
|
182
|
-
<span className="truncate text-[var(--color-dim)]" title={b.evidence}>{b.where}</span>
|
|
183
|
-
</li>
|
|
184
|
-
))}
|
|
185
|
-
</ul>
|
|
186
|
-
)}
|
|
187
|
-
</div>
|
|
188
|
-
);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
function CostBlock({ cost }) {
|
|
192
|
-
if (!cost) return <p className="text-sm text-[var(--color-faint)]">Lendo a telemetria…</p>;
|
|
193
|
-
const tokens = (u) => (u ? u.inputTokens + u.outputTokens + u.cacheCreationTokens : null);
|
|
194
|
-
const rows = [
|
|
195
|
-
['Tokens da sessão', cost.sessionUsage ? num(tokens(cost.sessionUsage)) : 'desconhecido', cost.sessionUsage ? `${num(cost.sessionUsage.cacheReadTokens)} lidos do cache` : cost.legacyUsageSamples ? 'telemetria v1, sem delta somável' : null],
|
|
196
|
-
['Tokens dos ajudantes', cost.agentUsage ? num(tokens(cost.agentUsage)) : 'desconhecido', cost.agentUsage ? `${cost.agentUsage.agents} ajudantes` : null],
|
|
197
|
-
['Ajudantes chamados', String(cost.dispatches?.count ?? 0), cost.dispatches?.promptChars ? `${num(cost.dispatches.promptChars)} caracteres de instrução` : null],
|
|
198
|
-
['Lido para o contexto', bytes(cost.bytesTotal), null],
|
|
199
|
-
];
|
|
200
|
-
return (
|
|
201
|
-
<dl className="space-y-3">
|
|
202
|
-
{rows.map(([k, v, hint]) => (
|
|
203
|
-
<div key={k} className="flex items-baseline justify-between gap-4">
|
|
204
|
-
<dt className="text-sm text-[var(--color-dim)]">{k}</dt>
|
|
205
|
-
<dd className="text-right">
|
|
206
|
-
<span className="font-mono text-sm tabular-nums">{v}</span>
|
|
207
|
-
{hint && <span className="block text-xs text-[var(--color-faint)]">{hint}</span>}
|
|
208
|
-
</dd>
|
|
209
|
-
</div>
|
|
210
|
-
))}
|
|
211
|
-
</dl>
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
function OverviewTab({ f, cost, session, now }) {
|
|
216
|
-
return (
|
|
217
|
-
<div className="grid gap-5 lg:grid-cols-[minmax(0,1.2fr)_minmax(0,1fr)]">
|
|
218
|
-
{f.status !== 'completed' && (
|
|
219
|
-
<Panel title="Onde parou" className="min-w-0 lg:col-span-2"><SessionMap session={session} now={now} /></Panel>
|
|
220
|
-
)}
|
|
221
|
-
<div className="space-y-5">
|
|
222
|
-
{f.description && (
|
|
223
|
-
<Panel title="O pedido">
|
|
224
|
-
<p className="text-sm leading-relaxed text-[var(--color-dim)]">{f.description}</p>
|
|
225
|
-
</Panel>
|
|
226
|
-
)}
|
|
227
|
-
<Panel title="Aprovações"><GateList f={f} /></Panel>
|
|
228
|
-
</div>
|
|
229
|
-
<div className="space-y-5">
|
|
230
|
-
<Panel title="Revisão independente"><VerdictBlock f={f} /></Panel>
|
|
231
|
-
<Panel title="Testes automáticos">
|
|
232
|
-
{f.verification && (
|
|
233
|
-
<p className="mb-3 text-xs text-[var(--color-faint)]">{timeAgo(f.verification.ts)}</p>
|
|
234
|
-
)}
|
|
235
|
-
<NodeChips nodes={f.verificationNodes} />
|
|
236
|
-
</Panel>
|
|
237
|
-
<Panel title="Custo"><CostBlock cost={cost} /></Panel>
|
|
238
|
-
</div>
|
|
239
|
-
</div>
|
|
240
|
-
);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
function ImplementIcon({ status }) {
|
|
244
|
-
const st = IMPLEMENT_STATUS[status] || IMPLEMENT_STATUS.pendente;
|
|
245
|
-
const Icon = st.icon;
|
|
246
|
-
return <Icon weight="light" size={17} className={st.tone} aria-label={`construção: ${st.label}`} />;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
const SCORE_ROLES = ['verifier', 'reviewer', 'security'];
|
|
250
|
-
const CELL = {
|
|
251
|
-
ok: { icon: '✓', tone: 'bg-[var(--color-ok)]/15 text-[var(--color-ok)]' },
|
|
252
|
-
bad: { icon: '✗', tone: 'bg-[var(--color-bad)]/15 text-[var(--color-bad)]' },
|
|
253
|
-
warn: { icon: '?', tone: 'bg-[var(--color-warn)]/15 text-[var(--color-warn)]' },
|
|
254
|
-
na: { icon: '·', tone: 'bg-white/[0.04] text-[var(--color-faint)]' },
|
|
255
|
-
};
|
|
256
|
-
const CHECK_CELL = { PROVADO: 'ok', FALHA: 'bad', 'NÃO PROVADO': 'warn' };
|
|
257
|
-
|
|
258
|
-
export function scoreCell(round, id, role) {
|
|
259
|
-
const r = round.roles[role];
|
|
260
|
-
if (!r) return { kind: 'na', text: 'ainda não revisou' };
|
|
261
|
-
const cited = r.blockers.filter((b) => b.checks.includes(id));
|
|
262
|
-
if (cited.length) return { kind: 'bad', text: cited.map((b) => `${b.id}: ${b.evidence}`).join(' · ') };
|
|
263
|
-
if (role === 'verifier') {
|
|
264
|
-
const row = round.checks.find((c) => c.id === id);
|
|
265
|
-
if (!row) return { kind: 'warn', text: 'a conferência não falou deste cenário' };
|
|
266
|
-
return { kind: CHECK_CELL[row.status] ?? 'warn', text: `${CHECK_RESULT_SAY[row.status] ?? row.status}. ${row.evidence}` };
|
|
267
|
-
}
|
|
268
|
-
return { kind: 'na', text: `olha o código todo, não cenário por cenário; ${verdictWord(r.verdict) ?? 'sem conclusão'}` };
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
// Same rule as the gate: a Cn the verifier did not prove keeps the round at FIX, whatever the reports say.
|
|
272
|
-
const roundVerdict = (round, ids) => (Object.values(round.roles).some((r) => r.verdict !== 'SHIP' || r.blockers.length)
|
|
273
|
-
|| (round.roles.verifier && ids.some((id) => scoreCell(round, id, 'verifier').kind !== 'ok')) ? 'FIX' : 'SHIP');
|
|
274
|
-
const roundSha = (round) => (round.roles.verifier ?? Object.values(round.roles)[0])?.reviewedSha?.slice(0, 7) ?? null;
|
|
275
|
-
const blockersOf = (round) => SCORE_ROLES.flatMap((role) => (round.roles[role]?.carried ? [] : round.roles[role]?.blockers ?? []).map((b) => ({ ...b, role })));
|
|
276
|
-
|
|
277
|
-
function ChecksTab({ f }) {
|
|
278
|
-
const rounds = f.rounds ?? [];
|
|
279
|
-
const [pick, setPick] = useState(null);
|
|
280
|
-
const [open, setOpen] = useState(null);
|
|
281
|
-
if (!f.checksList?.length) {
|
|
282
|
-
return <Panel><p className="text-sm text-[var(--color-dim)]">Os cenários aparecem aqui quando o plano estiver pronto e conferido.</p></Panel>;
|
|
283
|
-
}
|
|
284
|
-
const i = pick ?? rounds.length - 1;
|
|
285
|
-
const round = rounds[i];
|
|
286
|
-
const proven = round ? f.checksList.filter((c) => scoreCell(round, c.id, 'verifier').kind === 'ok').length : null;
|
|
287
|
-
const blockers = round ? blockersOf(round) : [];
|
|
288
|
-
const closed = round && i > 0 && !blockers.length ? blockersOf(rounds[i - 1]) : [];
|
|
289
|
-
const ids = f.checksList.map((c) => c.id);
|
|
290
|
-
const verdict = round ? roundVerdict(round, ids) : null;
|
|
291
|
-
return (
|
|
292
|
-
<div className="space-y-5">
|
|
293
|
-
<Panel>
|
|
294
|
-
<div className="flex flex-wrap items-baseline gap-4">
|
|
295
|
-
<span className={`text-3xl font-semibold tracking-tight ${verdict === 'SHIP' ? 'text-[var(--color-ok)]' : verdict === 'FIX' ? 'text-[var(--color-bad)]' : ''}`}>{verdictWord(verdict) ?? '—'}</span>
|
|
296
|
-
<span className="text-sm text-[var(--color-dim)]">
|
|
297
|
-
{round ? `${proven} de ${f.checksList.length} cenários conferidos · ${problems(blockers.length)}` : 'Esperando a revisão independente'}
|
|
298
|
-
</span>
|
|
299
|
-
</div>
|
|
300
|
-
{rounds.length > 1 && (
|
|
301
|
-
<div className="mt-4 flex flex-wrap gap-2">
|
|
302
|
-
{rounds.map((r, k) => (
|
|
303
|
-
<button key={k} type="button" aria-pressed={k === i} onClick={() => setPick(k)}
|
|
304
|
-
className={`fluid inline-flex items-center gap-2 rounded-full px-3 py-1 text-xs shadow-[inset_0_0_0_1px_var(--color-hair)] ${k === i ? 'bg-white/[0.1] text-[var(--color-fg)]' : 'text-[var(--color-dim)] hover:text-[var(--color-fg)]'}`}>
|
|
305
|
-
<span className={`h-2 w-2 rounded-full ${roundVerdict(r, ids) === 'SHIP' ? 'bg-[var(--color-ok)]' : 'bg-[var(--color-bad)]'}`} />
|
|
306
|
-
Rodada {k + 1} · {verdictWord(roundVerdict(r, ids))}{roundSha(r) && <span className="font-mono text-[var(--color-faint)]">{roundSha(r)}</span>}
|
|
307
|
-
</button>
|
|
308
|
-
))}
|
|
309
|
-
</div>
|
|
310
|
-
)}
|
|
311
|
-
</Panel>
|
|
312
|
-
<Panel>
|
|
313
|
-
<div className="grid grid-cols-[1.25rem_minmax(0,1fr)_repeat(3,4.5rem)] gap-3 pb-2 text-xs text-[var(--color-faint)]">
|
|
314
|
-
<span /><span>Cenário</span>
|
|
315
|
-
{SCORE_ROLES.map((role) => <span key={role} className="text-center" title={ROLE_NAME[role]}>{ROLE_SHORT[role]}</span>)}
|
|
316
|
-
</div>
|
|
317
|
-
<ul className="divide-y divide-[var(--color-hair)]">
|
|
318
|
-
{f.checksList.map((c) => {
|
|
319
|
-
const cells = SCORE_ROLES.map((role) => (round ? scoreCell(round, c.id, role) : { kind: 'na', text: '' }));
|
|
320
|
-
const expanded = open === c.id;
|
|
321
|
-
return (
|
|
322
|
-
<li key={c.id} className="py-3 text-sm">
|
|
323
|
-
<button type="button" onClick={() => setOpen(expanded ? null : c.id)} aria-expanded={expanded}
|
|
324
|
-
className="grid w-full grid-cols-[1.25rem_minmax(0,1fr)_repeat(3,4.5rem)] items-center gap-3 text-left">
|
|
325
|
-
<ImplementIcon status={c.implement} />
|
|
326
|
-
<span className="min-w-0">
|
|
327
|
-
<span className={`block text-[var(--color-fg)] ${expanded ? '' : 'truncate'}`}>{c.label}</span>
|
|
328
|
-
{c.text && <span className={`block text-xs text-[var(--color-faint)] ${expanded ? '' : 'truncate'}`} title={c.text}>{c.text}</span>}
|
|
329
|
-
</span>
|
|
330
|
-
{cells.map((cell, k) => (
|
|
331
|
-
<span key={k} title={cell.text} className={`mx-auto grid h-8 w-8 place-items-center rounded-lg font-semibold ${CELL[cell.kind].tone}`}>{CELL[cell.kind].icon}</span>
|
|
332
|
-
))}
|
|
333
|
-
</button>
|
|
334
|
-
{expanded && (
|
|
335
|
-
<div className="mt-3 space-y-2 pl-8 text-xs">
|
|
336
|
-
{c.question && <p className="text-[var(--color-warn)]">Pergunta para você: {c.question}</p>}
|
|
337
|
-
{c.proof && <p className="text-[var(--color-faint)]">Como se confere: {PROOF_SAY[c.proof] ?? c.proof}</p>}
|
|
338
|
-
{cells.map((cell, k) => cell.kind !== 'na' && (
|
|
339
|
-
<p key={k}><span className="mr-2 text-[var(--color-faint)]">{ROLE_NAME[SCORE_ROLES[k]]}</span><span className="text-[var(--color-dim)]">{cell.text}</span></p>
|
|
340
|
-
))}
|
|
341
|
-
</div>
|
|
342
|
-
)}
|
|
343
|
-
</li>
|
|
344
|
-
);
|
|
345
|
-
})}
|
|
346
|
-
</ul>
|
|
347
|
-
</Panel>
|
|
348
|
-
{round && (
|
|
349
|
-
<Panel title={blockers.length ? 'Problemas achados nesta rodada' : closed.length ? 'Corrigidos nesta rodada' : 'Nenhum problema'}>
|
|
350
|
-
<ul className="space-y-2 text-xs">
|
|
351
|
-
{(blockers.length ? blockers : closed).map((b) => (
|
|
352
|
-
<li key={`${b.role}-${b.id}`} className="grid grid-cols-[3rem_minmax(0,1fr)] gap-3">
|
|
353
|
-
<span className={`font-mono ${blockers.length ? 'text-[var(--color-bad)]' : 'text-[var(--color-ok)]'}`}>{b.id}</span>
|
|
354
|
-
<div className="min-w-0">
|
|
355
|
-
<p className="text-[var(--color-faint)]">{ROLE_NAME[b.role]} · {BLOCKER_SAY[b.type] ?? b.type} · {b.checks.length ? b.checks.map((id) => labelOf(f, id)).join('; ') : 'nenhum cenário citado'} · <span className="font-mono">{b.where}</span></p>
|
|
356
|
-
<p className="mt-0.5 truncate text-[var(--color-dim)]" title={b.evidence}>{b.evidence}</p>
|
|
357
|
-
</div>
|
|
358
|
-
</li>
|
|
359
|
-
))}
|
|
360
|
-
</ul>
|
|
361
|
-
</Panel>
|
|
362
|
-
)}
|
|
363
|
-
</div>
|
|
364
|
-
);
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
function groupDocuments(documents) {
|
|
368
|
-
const groups = PHASES.map((p) => ({ ...p, files: documents.filter((d) => d.phase === p.id) })).filter((g) => g.files.length);
|
|
369
|
-
const other = documents.filter((d) => !d.phase);
|
|
370
|
-
if (other.length) groups.push({ id: 'other', label: 'Estado e outros', color: 'var(--color-faint)', files: other });
|
|
371
|
-
return groups;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
function DocViewer({ project, feature, path, dir }) {
|
|
375
|
-
const url = path ? `${apiBase(project)}/file?feature=${encodeURIComponent(feature)}&path=${encodeURIComponent(path)}` : null;
|
|
376
|
-
const { data, error, loading } = useMorphQuery(url, { project });
|
|
377
|
-
if (!path) return <p className="text-sm text-[var(--color-dim)]">Escolha um documento à esquerda.</p>;
|
|
378
|
-
if (error) return <p className="text-sm text-[var(--color-bad)]">{error}</p>;
|
|
379
|
-
if (loading || !data) return <p className="text-sm text-[var(--color-faint)]">Abrindo…</p>;
|
|
380
|
-
// One separator: `dir` comes from path.join (backslashes on win32), `path` from the API (slashes).
|
|
381
|
-
const abs = dir ? `${dir.replace(/\\/g, '/').replace(/\/$/, '')}/${path}` : null;
|
|
382
|
-
const header = (
|
|
383
|
-
<div className="mb-6 flex flex-wrap items-center justify-between gap-3 font-mono text-xs text-[var(--color-faint)]">
|
|
384
|
-
<span className="min-w-0 truncate">{path}, atualizado {timeAgo(data.mtime)}</span>
|
|
385
|
-
{abs && <span className="flex shrink-0 gap-2"><CopyButton text={abs} /><EditorButton path={abs} /></span>}
|
|
386
|
-
</div>
|
|
387
|
-
);
|
|
388
|
-
if (path.endsWith('.md')) return <>{header}<KnowledgeMarkdown text={data.content} /></>;
|
|
389
|
-
let text = data.content;
|
|
390
|
-
if (path.endsWith('.json')) {
|
|
391
|
-
try { text = JSON.stringify(JSON.parse(text), null, 2); } catch { /* shown as is */ }
|
|
392
|
-
}
|
|
393
|
-
return (
|
|
394
|
-
<>
|
|
395
|
-
{header}
|
|
396
|
-
<pre className="overflow-x-auto rounded-xl bg-[var(--color-ink)] p-4 font-mono text-xs leading-relaxed text-[var(--color-dim)] shadow-[inset_0_0_0_1px_var(--color-hair)]">{text}</pre>
|
|
397
|
-
</>
|
|
398
|
-
);
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
function DocsTab({ f, doc, onDoc, project }) {
|
|
402
|
-
const groups = groupDocuments(f.documents);
|
|
403
|
-
const selected = doc || f.documents.find((d) => d.path.endsWith('plan.md'))?.path || f.documents.find((d) => d.path.endsWith('.md'))?.path || null;
|
|
404
|
-
return (
|
|
405
|
-
<div className="grid gap-5 lg:grid-cols-[16rem_minmax(0,1fr)]">
|
|
406
|
-
<nav aria-label="Documentos da feature" className="lg:sticky lg:top-4 lg:self-start">
|
|
407
|
-
{groups.length === 0 && <p className="text-sm text-[var(--color-dim)]">Nenhum arquivo ainda.</p>}
|
|
408
|
-
{groups.map((g) => (
|
|
409
|
-
<div key={g.id} className="mb-5">
|
|
410
|
-
<p className="mb-1.5 flex items-center gap-2 px-2 text-xs text-[var(--color-dim)]">
|
|
411
|
-
<span className="h-2 w-2 rounded-full" style={{ background: g.color }} />{g.label}
|
|
412
|
-
</p>
|
|
413
|
-
<ul>
|
|
414
|
-
{g.files.map((d) => {
|
|
415
|
-
const active = d.path === selected;
|
|
416
|
-
const Icon = d.path.endsWith('.md') ? FileText : FileCode;
|
|
417
|
-
const name = d.path.split('/').slice(1).join('/') || d.path;
|
|
418
|
-
return (
|
|
419
|
-
<li key={d.path}>
|
|
420
|
-
<button
|
|
421
|
-
type="button"
|
|
422
|
-
onClick={() => onDoc(d.path)}
|
|
423
|
-
aria-current={active ? 'page' : undefined}
|
|
424
|
-
className={[
|
|
425
|
-
'fluid flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left text-sm transition-colors',
|
|
426
|
-
active ? 'bg-white/[0.08] text-[var(--color-fg)]' : 'text-[var(--color-dim)] hover:bg-white/[0.04] hover:text-[var(--color-fg)]',
|
|
427
|
-
].join(' ')}
|
|
428
|
-
>
|
|
429
|
-
<Icon weight="light" size={15} className="shrink-0" />
|
|
430
|
-
<span className="truncate" title={d.path}>{name}</span>
|
|
431
|
-
</button>
|
|
432
|
-
</li>
|
|
433
|
-
);
|
|
434
|
-
})}
|
|
435
|
-
</ul>
|
|
436
|
-
</div>
|
|
437
|
-
))}
|
|
438
|
-
</nav>
|
|
439
|
-
<div className="bezel min-w-0">
|
|
440
|
-
<div className="bezel-core min-w-0 px-6 py-6 md:px-10 md:py-8">
|
|
441
|
-
<DocViewer project={project} feature={f.name} path={selected} dir={f.dir} />
|
|
442
|
-
</div>
|
|
443
|
-
</div>
|
|
444
|
-
</div>
|
|
445
|
-
);
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
export function Retrato({ lines, waiting = [] }) {
|
|
449
|
-
if (!lines?.length) return null;
|
|
450
|
-
const [, ...rest] = lines;
|
|
451
|
-
return (
|
|
452
|
-
<section aria-label="Retrato da feature" className="mt-6 rounded-xl bg-[var(--color-ink)] px-5 py-4 shadow-[inset_0_0_0_1px_var(--color-hair)]">
|
|
453
|
-
<ul className="space-y-1 font-mono text-[13px] leading-relaxed text-[var(--color-dim)]">
|
|
454
|
-
{rest.map((line, i) => {
|
|
455
|
-
const tone = line.startsWith('Espera você:') && waiting.length ? 'text-[var(--color-warn)]'
|
|
456
|
-
: line.startsWith('Travado:') && !line.includes('nada') ? 'text-[var(--color-bad)]' : '';
|
|
457
|
-
return <li key={i} className={`whitespace-pre-wrap break-words ${tone}`}>{line}</li>;
|
|
458
|
-
})}
|
|
459
|
-
</ul>
|
|
460
|
-
</section>
|
|
461
|
-
);
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
export function FeatureDetailView({ f, tab, onTab, doc, onDoc, cost, session, latest = null, now = Date.now(), project, projectName }) {
|
|
465
|
-
const verdict = verdictLabel(f);
|
|
466
|
-
const working = latest && isWorking({ ...f, lastActivity: latest }, now);
|
|
467
|
-
return (
|
|
468
|
-
<div className="mx-auto max-w-6xl px-4 pb-24 pt-8 md:px-10 md:pt-12">
|
|
469
|
-
<Link to={projectHref(project)} className="fluid mb-6 inline-flex items-center gap-2 text-sm text-[var(--color-dim)] transition-colors hover:text-[var(--color-fg)]">
|
|
470
|
-
<ArrowLeft weight="light" size={15} /> {projectName ? `Features de ${projectName}` : 'Features'}
|
|
471
|
-
</Link>
|
|
472
|
-
|
|
473
|
-
<header className="rise bezel mb-8">
|
|
474
|
-
<div className="bezel-core px-6 py-7 md:px-9 md:py-9">
|
|
475
|
-
<div className="flex flex-col gap-4 md:flex-row md:items-start md:justify-between">
|
|
476
|
-
<div className="min-w-0">
|
|
477
|
-
<h1 className="break-words text-3xl font-semibold tracking-tight md:text-4xl">{featureTitle(f)}</h1>
|
|
478
|
-
{featureTitle(f) !== f.name && <p className="mt-1 font-mono text-xs text-[var(--color-faint)]">{f.name}</p>}
|
|
479
|
-
<p className="mt-2 text-sm text-[var(--color-dim)]">
|
|
480
|
-
{STATUS_LABEL[f.status] || f.status}, {workLabel(f.workType).toLowerCase()}, na {LOCATION_LABEL[f.location]}, atualizada {timeAgo(f.updatedAt)}
|
|
481
|
-
</p>
|
|
482
|
-
</div>
|
|
483
|
-
<div className="flex shrink-0 gap-6 text-right">
|
|
484
|
-
<div><p className="text-2xl font-semibold tabular-nums">{f.scenarios.total ? `${f.scenarios.done}/${f.scenarios.total}` : '—'}</p><p className="text-xs text-[var(--color-faint)]">cenários feitos</p></div>
|
|
485
|
-
<div><p className="text-2xl font-semibold">{verdict ?? '—'}</p><p className="text-xs text-[var(--color-faint)]">revisão independente</p></div>
|
|
486
|
-
</div>
|
|
487
|
-
</div>
|
|
488
|
-
<Retrato lines={f.retrato} waiting={f.waitingOnOwner} />
|
|
489
|
-
<div className="mt-8"><PhaseRail feature={f} size="lg" /></div>
|
|
490
|
-
<p className="mt-6 text-sm text-[var(--color-fg)]">
|
|
491
|
-
<span style={{ color: phaseMeta(f.phase).color }}>●</span> {nextAction(f)}
|
|
492
|
-
</p>
|
|
493
|
-
{latest && f.status !== 'completed' && (
|
|
494
|
-
<p className="mt-2 flex items-center gap-2 text-sm text-[var(--color-dim)]">
|
|
495
|
-
{working && (
|
|
496
|
-
<span className="relative inline-flex h-2 w-2" aria-label="trabalhando agora">
|
|
497
|
-
<span className="absolute inset-0 animate-ping rounded-full bg-[var(--color-phase-implement)] opacity-60 motion-reduce:hidden" />
|
|
498
|
-
<span className="relative h-2 w-2 rounded-full bg-[var(--color-phase-implement)]" />
|
|
499
|
-
</span>
|
|
500
|
-
)}
|
|
501
|
-
<span>Último evento: {latest.title}, {timeAgo(latest.ts, now)}</span>
|
|
502
|
-
<button type="button" onClick={() => onTab('activity')} className="text-[var(--color-phase-proposal)] hover:underline">ver atividade</button>
|
|
503
|
-
</p>
|
|
504
|
-
)}
|
|
505
|
-
<div className="mt-5 flex flex-wrap gap-2">
|
|
506
|
-
<EditorButton path={f.dir} label="Abrir pasta da feature no VS Code" />
|
|
507
|
-
<CopyButton text={f.name} label="Copiar identificador" />
|
|
508
|
-
</div>
|
|
509
|
-
{f.rootStale && (
|
|
510
|
-
<p className="mt-3 flex items-start gap-2 text-sm text-[var(--color-warn)]">
|
|
511
|
-
<WarningCircle weight="light" size={17} className="mt-0.5 shrink-0" />
|
|
512
|
-
A worktree dona desta feature não tem os arquivos dela. O que aparece é a cópia da raiz, que pode estar desatualizada.
|
|
513
|
-
</p>
|
|
514
|
-
)}
|
|
515
|
-
</div>
|
|
516
|
-
</header>
|
|
517
|
-
|
|
518
|
-
<div role="tablist" aria-label="Seções da feature" className="rise-2 mb-6 inline-flex rounded-full bg-white/[0.03] p-1 shadow-[inset_0_0_0_1px_var(--color-hair)]">
|
|
519
|
-
{TABS.map((t) => (
|
|
520
|
-
<button
|
|
521
|
-
key={t.id}
|
|
522
|
-
role="tab"
|
|
523
|
-
type="button"
|
|
524
|
-
aria-selected={tab === t.id}
|
|
525
|
-
onClick={() => onTab(t.id)}
|
|
526
|
-
className={[
|
|
527
|
-
'fluid rounded-full px-4 py-1.5 text-sm transition-colors active:scale-[0.98]',
|
|
528
|
-
tab === t.id ? 'bg-white/[0.1] text-[var(--color-fg)] shadow-[inset_0_1px_0_rgb(255_255_255_/_0.08)]' : 'text-[var(--color-dim)] hover:text-[var(--color-fg)]',
|
|
529
|
-
].join(' ')}
|
|
530
|
-
>
|
|
531
|
-
{t.label}{t.id === 'checks' && f.checksList?.length ? ` ${f.checksList.length}` : ''}{t.id === 'docs' ? ` ${f.documents.length}` : ''}
|
|
532
|
-
</button>
|
|
533
|
-
))}
|
|
534
|
-
</div>
|
|
535
|
-
|
|
536
|
-
<div className="rise-3">
|
|
537
|
-
{tab === 'overview' && <OverviewTab f={f} cost={cost} session={session} now={now} />}
|
|
538
|
-
{tab === 'checks' && <ChecksTab f={f} />}
|
|
539
|
-
{tab === 'docs' && <DocsTab f={f} doc={doc} onDoc={onDoc} project={project} />}
|
|
540
|
-
{tab === 'activity' && (
|
|
541
|
-
<div className="bezel"><div className="bezel-core px-5 py-5"><ActivityFeed project={project} feature={f.name} /></div></div>
|
|
542
|
-
)}
|
|
543
|
-
</div>
|
|
544
|
-
</div>
|
|
545
|
-
);
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
export default function FeatureDetail() {
|
|
549
|
-
const { name, project } = useParams();
|
|
550
|
-
const [params, setParams] = useSearchParams();
|
|
551
|
-
const tab = TABS.some((t) => t.id === params.get('tab')) ? params.get('tab') : 'overview';
|
|
552
|
-
const doc = params.get('doc');
|
|
553
|
-
const { data, error, loading } = useMorphQuery(`${apiBase(project)}/features/${encodeURIComponent(name)}`, { project });
|
|
554
|
-
// The cost rides on the activity endpoint (it owns the event stream).
|
|
555
|
-
const costQuery = useMorphQuery(`${apiBase(project)}/activity?feature=${encodeURIComponent(name)}&limit=1`, { scope: 'activity', project });
|
|
556
|
-
const now = useNow();
|
|
557
|
-
|
|
558
|
-
const onTab = useCallback((id) => setParams((p) => { const n = new URLSearchParams(p); n.set('tab', id); if (id !== 'docs') n.delete('doc'); return n; }), [setParams]);
|
|
559
|
-
const onDoc = useCallback((path) => setParams((p) => { const n = new URLSearchParams(p); n.set('tab', 'docs'); n.set('doc', path); return n; }), [setParams]);
|
|
560
|
-
|
|
561
|
-
if (error) {
|
|
562
|
-
return (
|
|
563
|
-
<div className="mx-auto max-w-3xl px-4 pt-16 md:px-10">
|
|
564
|
-
<Link to={projectHref(project)} className="text-sm text-[var(--color-dim)] hover:text-[var(--color-fg)]">Voltar para Features</Link>
|
|
565
|
-
<p className="mt-6 text-lg">Não encontrei a feature “{name}”.</p>
|
|
566
|
-
<p className="mt-1 text-sm text-[var(--color-dim)]">{error}</p>
|
|
567
|
-
</div>
|
|
568
|
-
);
|
|
569
|
-
}
|
|
570
|
-
if (loading || !data) return <p className="px-10 pt-16 text-sm text-[var(--color-faint)]">Lendo a feature…</p>;
|
|
571
|
-
return (
|
|
572
|
-
<FeatureDetailView
|
|
573
|
-
f={data} tab={tab} onTab={onTab} doc={doc} onDoc={onDoc}
|
|
574
|
-
cost={costQuery.data?.cost ?? null} latest={costQuery.data?.items?.[0] ?? null}
|
|
575
|
-
session={costQuery.data ? costQuery.data.session : undefined}
|
|
576
|
-
now={now} project={project}
|
|
577
|
-
/>
|
|
578
|
-
);
|
|
579
|
-
}
|