@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,100 +0,0 @@
|
|
|
1
|
-
import { PHASES, PHASE_INDEX, GATE_LABEL, phaseMeta } from '../lib/phases.js';
|
|
2
|
-
|
|
3
|
-
export function segmentStates(feature) {
|
|
4
|
-
const idx = PHASE_INDEX[feature.phase] ?? 0;
|
|
5
|
-
const finished = feature.status === 'completed';
|
|
6
|
-
const gate = (id) => feature.gates?.find((g) => g.gate === id);
|
|
7
|
-
return PHASES.map((p, i) => {
|
|
8
|
-
let state = 'todo';
|
|
9
|
-
if (p.optional && !gate(p.id)?.approved && (i < idx || finished)) state = 'skipped';
|
|
10
|
-
else if (finished || i < idx) state = 'done';
|
|
11
|
-
else if (i === idx) state = 'current';
|
|
12
|
-
return { ...p, state, gate: gate(p.id) || null };
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function notchState(g, segState) {
|
|
17
|
-
if (!g || g.skipped || segState === 'skipped') return null;
|
|
18
|
-
if (g.approved) return 'approved';
|
|
19
|
-
if (g.paused) return 'paused';
|
|
20
|
-
return 'pending';
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const NOTCH_CLASS = {
|
|
24
|
-
approved: 'bg-[var(--color-ok)] shadow-[0_0_0_3px_rgb(158_206_106_/_0.15)]',
|
|
25
|
-
paused: 'bg-transparent ring-2 ring-[var(--color-warn)] animate-pulse',
|
|
26
|
-
pending: 'bg-transparent ring-1 ring-[var(--color-hair-strong)]',
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
function gateTitle(g) {
|
|
30
|
-
const label = GATE_LABEL[g.gate] || g.gate;
|
|
31
|
-
if (g.approved) return `${label}: aprovada${g.approvedBy && g.approvedBy !== 'auto' ? ` por ${g.approvedBy}` : ''}`;
|
|
32
|
-
if (g.paused) return `${label}: esperando você${g.reason ? `, ${g.reason}` : ''}`;
|
|
33
|
-
return `${label}: ainda não chegou`;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export default function PhaseRail({ feature, size = 'sm' }) {
|
|
37
|
-
const segments = segmentStates(feature);
|
|
38
|
-
const lg = size === 'lg';
|
|
39
|
-
const current = phaseMeta(feature.phase);
|
|
40
|
-
const summary = feature.status === 'completed'
|
|
41
|
-
? 'Concluída'
|
|
42
|
-
: `Etapa atual: ${current.label}${feature.inEvaluation ? ' (revisão independente em andamento)' : ''}`;
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<div className={lg ? 'w-full' : 'w-full min-w-[9rem]'} role="img" aria-label={summary}>
|
|
46
|
-
<div className="flex items-center">
|
|
47
|
-
{segments.map((s, i) => {
|
|
48
|
-
const notch = notchState(s.gate, s.state);
|
|
49
|
-
return (
|
|
50
|
-
<div key={s.id} className="flex items-center flex-1 min-w-0" title={s.label}>
|
|
51
|
-
<div
|
|
52
|
-
className={[
|
|
53
|
-
'relative flex-1 overflow-hidden rounded-full',
|
|
54
|
-
lg ? 'h-2.5' : 'h-1.5',
|
|
55
|
-
s.state === 'skipped' ? 'border border-dashed border-[var(--color-hair-strong)] bg-transparent' : '',
|
|
56
|
-
s.state === 'todo' ? 'bg-white/[0.07]' : '',
|
|
57
|
-
].join(' ')}
|
|
58
|
-
style={s.state === 'done' || s.state === 'current' ? { background: s.color, opacity: s.state === 'done' ? 0.78 : 1 } : undefined}
|
|
59
|
-
>
|
|
60
|
-
{s.state === 'current' && feature.status !== 'completed' && (
|
|
61
|
-
<span className="rail-sheen absolute inset-0" aria-hidden="true" />
|
|
62
|
-
)}
|
|
63
|
-
</div>
|
|
64
|
-
{notch && (
|
|
65
|
-
<span
|
|
66
|
-
title={gateTitle(s.gate)}
|
|
67
|
-
className={['shrink-0 rounded-full', lg ? 'mx-1.5 h-3 w-3' : 'mx-1 h-2 w-2', NOTCH_CLASS[notch]].join(' ')}
|
|
68
|
-
/>
|
|
69
|
-
)}
|
|
70
|
-
{!notch && i < segments.length - 1 && <span className={lg ? 'w-3' : 'w-2'} />}
|
|
71
|
-
</div>
|
|
72
|
-
);
|
|
73
|
-
})}
|
|
74
|
-
</div>
|
|
75
|
-
{lg && (
|
|
76
|
-
<div className="mt-2.5 flex">
|
|
77
|
-
{segments.map((s) => (
|
|
78
|
-
<div key={s.id} className="flex-1 min-w-0 pr-3">
|
|
79
|
-
<p
|
|
80
|
-
className={[
|
|
81
|
-
'truncate text-xs',
|
|
82
|
-
s.state === 'current' ? 'font-medium text-[var(--color-fg)]' : 'text-[var(--color-dim)]',
|
|
83
|
-
s.state === 'skipped' ? 'line-through decoration-[var(--color-faint)]' : '',
|
|
84
|
-
].join(' ')}
|
|
85
|
-
>
|
|
86
|
-
{s.label}
|
|
87
|
-
</p>
|
|
88
|
-
{s.state === 'skipped' && <p className="truncate text-[11px] text-[var(--color-faint)]">etapa não usada</p>}
|
|
89
|
-
{s.state !== 'skipped' && s.gate && !s.gate.skipped && (
|
|
90
|
-
<p className="truncate text-[11px] text-[var(--color-faint)]">
|
|
91
|
-
{s.gate.approved ? `aprovada${s.gate.approvedBy && s.gate.approvedBy !== 'auto' ? `, ${s.gate.approvedBy}` : ''}` : s.gate.paused ? 'esperando você' : 'aprovação pendente'}
|
|
92
|
-
</p>
|
|
93
|
-
)}
|
|
94
|
-
</div>
|
|
95
|
-
))}
|
|
96
|
-
</div>
|
|
97
|
-
)}
|
|
98
|
-
</div>
|
|
99
|
-
);
|
|
100
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import { MagnifyingGlass } from '@phosphor-icons/react';
|
|
3
|
-
|
|
4
|
-
export default function SearchFilter({ placeholder = 'Buscar', filters = [], onSearchChange, onFilterChange, children }) {
|
|
5
|
-
const [search, setSearch] = useState('');
|
|
6
|
-
function handleSearchChange(e) {
|
|
7
|
-
setSearch(e.target.value);
|
|
8
|
-
onSearchChange?.(e.target.value);
|
|
9
|
-
}
|
|
10
|
-
return (
|
|
11
|
-
<div className="relative z-10 flex flex-wrap items-center gap-2 border-b border-[var(--color-hair)] bg-[var(--color-ink)]/70 px-4 py-3 backdrop-blur md:px-6">
|
|
12
|
-
<label className="relative min-w-[12rem] flex-1">
|
|
13
|
-
<span className="sr-only">{placeholder}</span>
|
|
14
|
-
<MagnifyingGlass weight="light" size={16} className="pointer-events-none absolute left-3.5 top-1/2 -translate-y-1/2 text-[var(--color-faint)]" />
|
|
15
|
-
<input
|
|
16
|
-
type="text" value={search} onChange={handleSearchChange} placeholder={placeholder}
|
|
17
|
-
onKeyDown={(e) => { if (e.key === 'Escape') handleSearchChange({ target: { value: '' } }); }}
|
|
18
|
-
className="fluid w-full rounded-full bg-white/[0.04] py-2 pl-10 pr-4 text-sm text-[var(--color-fg)] shadow-[inset_0_0_0_1px_var(--color-hair)] outline-none transition-shadow placeholder:text-[var(--color-faint)] focus:shadow-[inset_0_0_0_1px_var(--color-hair-strong)]"
|
|
19
|
-
/>
|
|
20
|
-
</label>
|
|
21
|
-
{filters.map(({ name, label, options, value }) => (
|
|
22
|
-
<label key={name} className="text-sm">
|
|
23
|
-
<span className="sr-only">{label}</span>
|
|
24
|
-
<select
|
|
25
|
-
value={value} onChange={(e) => onFilterChange?.(name, e.target.value)}
|
|
26
|
-
className="fluid rounded-full bg-white/[0.04] px-3 py-2 text-sm text-[var(--color-fg)] shadow-[inset_0_0_0_1px_var(--color-hair)] outline-none"
|
|
27
|
-
>
|
|
28
|
-
<option value="">{label}: todos</option>
|
|
29
|
-
{options.map((opt) => (<option key={opt} value={opt}>{opt}</option>))}
|
|
30
|
-
</select>
|
|
31
|
-
</label>
|
|
32
|
-
))}
|
|
33
|
-
{children}
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { clock, timeAgo } from '../lib/format.js';
|
|
2
|
-
|
|
3
|
-
const MARK = {
|
|
4
|
-
verify: { label: 'testes automáticos', color: (m) => (m.status === 'fail' ? 'var(--color-bad)' : 'var(--color-ok)') },
|
|
5
|
-
failure: { label: 'falha', color: () => 'var(--color-bad)' },
|
|
6
|
-
gate: { label: 'aprovação', color: () => 'var(--color-fg)' },
|
|
7
|
-
dispatch: { label: 'ajudante', color: () => 'var(--color-phase-uiux)' },
|
|
8
|
-
handback: { label: 'ajudante', color: () => 'var(--color-phase-uiux)' },
|
|
9
|
-
prompt: { label: 'você', color: () => 'var(--color-dim)' },
|
|
10
|
-
question: { label: 'você', color: () => 'var(--color-dim)' },
|
|
11
|
-
};
|
|
12
|
-
const LEGEND = [
|
|
13
|
-
['testes passaram', 'var(--color-ok)'], ['testes falharam ou erro', 'var(--color-bad)'],
|
|
14
|
-
['aprovação', 'var(--color-fg)'], ['ajudante', 'var(--color-phase-uiux)'], ['você', 'var(--color-dim)'],
|
|
15
|
-
];
|
|
16
|
-
|
|
17
|
-
function Strip({ session }) {
|
|
18
|
-
const start = Date.parse(session.start);
|
|
19
|
-
const span = Math.max(1, Date.parse(session.end) - start);
|
|
20
|
-
return (
|
|
21
|
-
<div className="relative h-6" role="img"
|
|
22
|
-
aria-label={`${session.marks.length} marcos entre ${clock(session.start)} e ${clock(session.end)}`}>
|
|
23
|
-
<div className="absolute inset-x-0 top-1/2 h-px -translate-y-1/2 bg-[var(--color-hair-strong)]" />
|
|
24
|
-
{session.marks.map((m, i) => {
|
|
25
|
-
const at = ((Date.parse(m.ts) - start) / span) * 100;
|
|
26
|
-
return (
|
|
27
|
-
<span key={`${m.ts}:${i}`} title={`${clock(m.ts)} · ${m.title}`}
|
|
28
|
-
className="absolute top-1/2 h-2.5 w-2.5 -translate-x-1/2 -translate-y-1/2 rounded-full ring-2 ring-[var(--color-core)]"
|
|
29
|
-
style={{ left: `${at}%`, background: (MARK[m.kind] ?? MARK.gate).color(m) }} />
|
|
30
|
-
);
|
|
31
|
-
})}
|
|
32
|
-
</div>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export default function SessionMap({ session, now = Date.now() }) {
|
|
37
|
-
if (session === undefined) return <p className="text-sm text-[var(--color-faint)]">Lendo o histórico…</p>;
|
|
38
|
-
if (!session) return <p className="text-sm text-[var(--color-faint)]">Nenhuma ação registrada para esta feature ainda.</p>;
|
|
39
|
-
return (
|
|
40
|
-
<div className="space-y-4">
|
|
41
|
-
<p className="text-sm text-[var(--color-dim)]">
|
|
42
|
-
Última sessão: <span className="text-[var(--color-fg)]">{clock(session.start)}–{clock(session.end)}</span>,
|
|
43
|
-
{' '}{timeAgo(session.end, now)} · {session.actions} ações
|
|
44
|
-
</p>
|
|
45
|
-
<div>
|
|
46
|
-
<Strip session={session} />
|
|
47
|
-
<div className="mt-1 flex justify-between font-mono text-[11px] text-[var(--color-faint)]">
|
|
48
|
-
<span>{clock(session.start)}</span><span>{clock(session.end)}</span>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
<div className="flex flex-wrap gap-x-4 gap-y-1 text-xs text-[var(--color-dim)]" aria-hidden="true">
|
|
52
|
-
{LEGEND.map(([label, color]) => (
|
|
53
|
-
<span key={label} className="flex items-center gap-1.5"><span className="h-2 w-2 rounded-full" style={{ background: color }} />{label}</span>
|
|
54
|
-
))}
|
|
55
|
-
</div>
|
|
56
|
-
{session.lastFailure && (
|
|
57
|
-
<p className="text-sm text-[var(--color-bad)]">
|
|
58
|
-
Parou em: {session.lastFailure.title}, {clock(session.lastFailure.ts)}
|
|
59
|
-
{session.lastFailure.detail && <span className="mt-0.5 block truncate font-mono text-xs text-[var(--color-dim)]">{session.lastFailure.detail}</span>}
|
|
60
|
-
</p>
|
|
61
|
-
)}
|
|
62
|
-
{session.files.length > 0 && (
|
|
63
|
-
<div>
|
|
64
|
-
<p className="mb-1.5 text-xs text-[var(--color-faint)]">Mexeu mais em</p>
|
|
65
|
-
<ul className="space-y-1">
|
|
66
|
-
{session.files.map((f) => (
|
|
67
|
-
<li key={f.path} className="flex items-baseline justify-between gap-3 text-sm">
|
|
68
|
-
<span className="min-w-0 truncate font-mono text-xs text-[var(--color-fg)]" title={f.path}>{f.path}</span>
|
|
69
|
-
<span className="shrink-0 tabular-nums text-xs text-[var(--color-dim)]">{f.edits}×</span>
|
|
70
|
-
</li>
|
|
71
|
-
))}
|
|
72
|
-
</ul>
|
|
73
|
-
</div>
|
|
74
|
-
)}
|
|
75
|
-
</div>
|
|
76
|
-
);
|
|
77
|
-
}
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { NavLink, useLocation, useNavigate } from 'react-router-dom';
|
|
2
|
-
import {
|
|
3
|
-
MagnifyingGlass, SquaresFour, Kanban, Pulse, BookOpen, FlowArrow, PuzzlePiece, UsersThree, Books, Ruler, Plug,
|
|
4
|
-
} from '@phosphor-icons/react';
|
|
5
|
-
import { projectHref } from '../lib/project.js';
|
|
6
|
-
|
|
7
|
-
const KNOWLEDGE = [
|
|
8
|
-
{ to: '/guide', label: 'Guia', icon: BookOpen },
|
|
9
|
-
{ to: '/phases', label: 'Fases', icon: FlowArrow },
|
|
10
|
-
{ to: '/skills', label: 'Skills', icon: PuzzlePiece },
|
|
11
|
-
{ to: '/agents', label: 'Personas', icon: UsersThree },
|
|
12
|
-
{ to: '/standards', label: 'Standards', icon: Books },
|
|
13
|
-
{ to: '/rules', label: 'Rules', icon: Ruler },
|
|
14
|
-
{ to: '/hooks', label: 'Hooks', icon: Plug },
|
|
15
|
-
];
|
|
16
|
-
|
|
17
|
-
function Badge({ pulse }) {
|
|
18
|
-
if (!pulse) return null;
|
|
19
|
-
if (pulse.awaiting) {
|
|
20
|
-
return <span className="ml-auto rounded-full bg-[var(--color-warn)]/15 px-1.5 font-mono text-[11px] text-[var(--color-warn)]" title="features esperando você">{pulse.awaiting}</span>;
|
|
21
|
-
}
|
|
22
|
-
if (pulse.working) {
|
|
23
|
-
return <span className="ml-auto h-1.5 w-1.5 rounded-full bg-[var(--color-phase-implement)]" title="agente trabalhando agora" />;
|
|
24
|
-
}
|
|
25
|
-
return pulse.active ? <span className="ml-auto font-mono text-[11px] text-[var(--color-faint)]">{pulse.active}</span> : null;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const linkClass = ({ isActive }) => [
|
|
29
|
-
'fluid flex items-center gap-2.5 rounded-lg px-3 py-1.5 text-sm transition-colors',
|
|
30
|
-
isActive ? 'bg-white/[0.08] text-[var(--color-fg)] shadow-[inset_0_1px_0_rgb(255_255_255_/_0.06)]' : 'text-[var(--color-dim)] hover:bg-white/[0.04] hover:text-[var(--color-fg)]',
|
|
31
|
-
].join(' ');
|
|
32
|
-
|
|
33
|
-
function ProjectSwitcher({ portfolio, current }) {
|
|
34
|
-
const navigate = useNavigate();
|
|
35
|
-
const { pathname } = useLocation();
|
|
36
|
-
const onChange = (id) => {
|
|
37
|
-
const sub = /^\/p\/[^/]+\/activity/.test(pathname) ? 'activity' : 'features';
|
|
38
|
-
navigate(projectHref(id, sub));
|
|
39
|
-
};
|
|
40
|
-
return (
|
|
41
|
-
<label className="mx-1 mb-1 block">
|
|
42
|
-
<span className="sr-only">Trocar de projeto</span>
|
|
43
|
-
<select
|
|
44
|
-
value={current || ''}
|
|
45
|
-
onChange={(e) => onChange(e.target.value)}
|
|
46
|
-
className="fluid w-full truncate rounded-lg bg-white/[0.04] px-2.5 py-1.5 text-sm font-medium text-[var(--color-fg)] shadow-[inset_0_0_0_1px_var(--color-hair)] outline-none"
|
|
47
|
-
>
|
|
48
|
-
{portfolio.projects.map((p) => <option key={p.id} value={p.id}>{p.name}</option>)}
|
|
49
|
-
</select>
|
|
50
|
-
</label>
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export default function Sidebar({ portfolio, current, pulse, onSearch }) {
|
|
55
|
-
const projects = portfolio?.projects || [];
|
|
56
|
-
const currentName = projects.find((p) => p.id === current)?.name;
|
|
57
|
-
return (
|
|
58
|
-
<nav aria-label="Navegação principal" className="relative z-10 hidden w-56 shrink-0 flex-col p-3 md:flex">
|
|
59
|
-
<div className="bezel flex flex-1 flex-col">
|
|
60
|
-
<div className="bezel-core flex flex-1 flex-col overflow-y-auto px-2 py-4">
|
|
61
|
-
<p className="px-3 pb-4 text-[15px] font-semibold tracking-tight">morph<span className="text-[var(--color-faint)]">-spec</span></p>
|
|
62
|
-
<button
|
|
63
|
-
type="button"
|
|
64
|
-
onClick={onSearch}
|
|
65
|
-
className="fluid mx-1 mb-5 flex items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm text-[var(--color-faint)] shadow-[inset_0_0_0_1px_var(--color-hair)] transition-colors hover:text-[var(--color-dim)]"
|
|
66
|
-
>
|
|
67
|
-
<MagnifyingGlass weight="light" size={15} /> Buscar
|
|
68
|
-
<kbd className="ml-auto font-mono text-[11px]">Ctrl K</kbd>
|
|
69
|
-
</button>
|
|
70
|
-
|
|
71
|
-
<ul className="mb-4">
|
|
72
|
-
<li>
|
|
73
|
-
<NavLink to="/" end className={linkClass}>
|
|
74
|
-
<SquaresFour weight="light" size={17} aria-hidden="true" /> Portfólio
|
|
75
|
-
{pulse?.awaiting > 0 && <Badge pulse={{ awaiting: pulse.awaiting }} />}
|
|
76
|
-
</NavLink>
|
|
77
|
-
</li>
|
|
78
|
-
</ul>
|
|
79
|
-
|
|
80
|
-
{current && (
|
|
81
|
-
<div className="mb-5">
|
|
82
|
-
<p className="px-3 pb-1.5 text-xs text-[var(--color-faint)]">Projeto</p>
|
|
83
|
-
{projects.length > 1
|
|
84
|
-
? <ProjectSwitcher portfolio={portfolio} current={current} />
|
|
85
|
-
: <p className="truncate px-3 pb-1 text-sm font-medium">{currentName}</p>}
|
|
86
|
-
<ul>
|
|
87
|
-
<li>
|
|
88
|
-
<NavLink to={projectHref(current)} className={linkClass}>
|
|
89
|
-
<Kanban weight="light" size={17} aria-hidden="true" /> Features
|
|
90
|
-
<Badge pulse={pulse?.byProject?.[current]} />
|
|
91
|
-
</NavLink>
|
|
92
|
-
</li>
|
|
93
|
-
<li>
|
|
94
|
-
<NavLink to={projectHref(current, 'activity')} className={linkClass}>
|
|
95
|
-
<Pulse weight="light" size={17} aria-hidden="true" /> Atividade
|
|
96
|
-
</NavLink>
|
|
97
|
-
</li>
|
|
98
|
-
</ul>
|
|
99
|
-
</div>
|
|
100
|
-
)}
|
|
101
|
-
|
|
102
|
-
<div className="mb-5">
|
|
103
|
-
<p className="px-3 pb-1.5 text-xs text-[var(--color-faint)]">Como funciona</p>
|
|
104
|
-
<ul>
|
|
105
|
-
{KNOWLEDGE.map(({ to, label, icon: Icon }) => (
|
|
106
|
-
<li key={to}>
|
|
107
|
-
<NavLink to={to} className={linkClass}>
|
|
108
|
-
<Icon weight="light" size={17} aria-hidden="true" />
|
|
109
|
-
{label}
|
|
110
|
-
</NavLink>
|
|
111
|
-
</li>
|
|
112
|
-
))}
|
|
113
|
-
</ul>
|
|
114
|
-
</div>
|
|
115
|
-
</div>
|
|
116
|
-
</div>
|
|
117
|
-
</nav>
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export function MobileNav({ current, onSearch }) {
|
|
122
|
-
const items = [
|
|
123
|
-
{ to: '/', label: 'Portfólio' },
|
|
124
|
-
...(current ? [{ to: projectHref(current), label: 'Features' }, { to: projectHref(current, 'activity'), label: 'Atividade' }] : []),
|
|
125
|
-
...KNOWLEDGE,
|
|
126
|
-
];
|
|
127
|
-
return (
|
|
128
|
-
<nav aria-label="Navegação" className="sticky top-0 z-20 flex gap-1 overflow-x-auto [scrollbar-width:none] border-b border-[var(--color-hair)] bg-[var(--color-ink)]/85 px-3 py-2 backdrop-blur md:hidden">
|
|
129
|
-
<button type="button" onClick={onSearch} aria-label="Buscar" className="shrink-0 rounded-full px-2.5 py-1 text-[var(--color-dim)]">
|
|
130
|
-
<MagnifyingGlass weight="light" size={16} />
|
|
131
|
-
</button>
|
|
132
|
-
{items.map(({ to, label }) => (
|
|
133
|
-
<NavLink
|
|
134
|
-
key={to}
|
|
135
|
-
to={to}
|
|
136
|
-
end={to === '/'}
|
|
137
|
-
className={({ isActive }) => [
|
|
138
|
-
'shrink-0 rounded-full px-3 py-1 text-sm',
|
|
139
|
-
isActive ? 'bg-white/[0.1] text-[var(--color-fg)]' : 'text-[var(--color-dim)]',
|
|
140
|
-
].join(' ')}
|
|
141
|
-
>
|
|
142
|
-
{label}
|
|
143
|
-
</NavLink>
|
|
144
|
-
))}
|
|
145
|
-
</nav>
|
|
146
|
-
);
|
|
147
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A refetch keeps the old data on screen until the new one arrives.
|
|
5
|
-
* @param {string|null} url - null skips the request
|
|
6
|
-
*/
|
|
7
|
-
export function useMorphQuery(url, { scope = 'features', project } = {}) {
|
|
8
|
-
const [state, setState] = useState({ data: null, error: null, loading: Boolean(url), refreshedAt: null });
|
|
9
|
-
const [tick, setTick] = useState(0);
|
|
10
|
-
const urlRef = useRef(url);
|
|
11
|
-
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
if (urlRef.current !== url) {
|
|
14
|
-
urlRef.current = url;
|
|
15
|
-
setState({ data: null, error: null, loading: Boolean(url), refreshedAt: null });
|
|
16
|
-
}
|
|
17
|
-
if (!url) return undefined;
|
|
18
|
-
let cancelled = false;
|
|
19
|
-
fetch(url)
|
|
20
|
-
.then(async (res) => {
|
|
21
|
-
const body = await res.json().catch(() => ({}));
|
|
22
|
-
if (!res.ok) throw new Error(body.error || `HTTP ${res.status}`);
|
|
23
|
-
return body;
|
|
24
|
-
})
|
|
25
|
-
.then((data) => { if (!cancelled) setState({ data, error: null, loading: false, refreshedAt: Date.now() }); })
|
|
26
|
-
.catch((err) => { if (!cancelled) setState((s) => ({ ...s, error: err.message, loading: false })); });
|
|
27
|
-
return () => { cancelled = true; };
|
|
28
|
-
}, [url, tick]);
|
|
29
|
-
|
|
30
|
-
const scopes = Array.isArray(scope) ? scope.join(',') : scope;
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
const hot = import.meta.hot;
|
|
33
|
-
if (!hot) return undefined;
|
|
34
|
-
const wanted = scopes.split(',');
|
|
35
|
-
const onChange = (payload) => {
|
|
36
|
-
if (payload?.project && project && payload.project !== project) return;
|
|
37
|
-
if (!payload?.scope || wanted.includes(payload.scope)) setTick((t) => t + 1);
|
|
38
|
-
};
|
|
39
|
-
hot.on('morph:changed', onChange);
|
|
40
|
-
return () => hot.off?.('morph:changed', onChange);
|
|
41
|
-
}, [scopes, project]);
|
|
42
|
-
|
|
43
|
-
return { ...state, refetch: () => setTick((t) => t + 1) };
|
|
44
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
const PREFIX = 'morph-dashboard:';
|
|
4
|
-
|
|
5
|
-
function read(key, fallback) {
|
|
6
|
-
try {
|
|
7
|
-
const raw = window.localStorage.getItem(PREFIX + key);
|
|
8
|
-
return raw === null ? fallback : JSON.parse(raw);
|
|
9
|
-
} catch {
|
|
10
|
-
return fallback;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/** Storage can be unavailable or throw (private mode, SSR); the value then does not persist. */
|
|
15
|
-
export function usePref(key, fallback) {
|
|
16
|
-
const [value, setValue] = useState(() => (typeof window === 'undefined' ? fallback : read(key, fallback)));
|
|
17
|
-
const set = useCallback((next) => {
|
|
18
|
-
setValue((prev) => {
|
|
19
|
-
const v = typeof next === 'function' ? next(prev) : next;
|
|
20
|
-
try { window.localStorage.setItem(PREFIX + key, JSON.stringify(v)); } catch { /* not persisted */ }
|
|
21
|
-
return v;
|
|
22
|
-
});
|
|
23
|
-
}, [key]);
|
|
24
|
-
return [value, set];
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function useNow(ms = 15_000) {
|
|
28
|
-
const [now, setNow] = useState(() => Date.now());
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
const id = setInterval(() => setNow(Date.now()), ms);
|
|
31
|
-
return () => clearInterval(id);
|
|
32
|
-
}, [ms]);
|
|
33
|
-
return now;
|
|
34
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { VERDICT_SAY } from '../../../../framework/hooks/shared/owner-words.js';
|
|
2
|
-
|
|
3
|
-
const rtf =new Intl.RelativeTimeFormat('pt-BR', { numeric: 'auto' });
|
|
4
|
-
const UNITS = [
|
|
5
|
-
['year', 365 * 24 * 3600],
|
|
6
|
-
['month', 30 * 24 * 3600],
|
|
7
|
-
['week', 7 * 24 * 3600],
|
|
8
|
-
['day', 24 * 3600],
|
|
9
|
-
['hour', 3600],
|
|
10
|
-
['minute', 60],
|
|
11
|
-
];
|
|
12
|
-
|
|
13
|
-
export function timeAgo(iso, now = Date.now()) {
|
|
14
|
-
const t = Date.parse(iso || '');
|
|
15
|
-
if (Number.isNaN(t)) return '—';
|
|
16
|
-
const diff = (t - now) / 1000;
|
|
17
|
-
for (const [unit, secs] of UNITS) {
|
|
18
|
-
if (Math.abs(diff) >= secs) return rtf.format(Math.round(diff / secs), unit);
|
|
19
|
-
}
|
|
20
|
-
return 'agora';
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function dateTime(iso) {
|
|
24
|
-
const t = Date.parse(iso || '');
|
|
25
|
-
if (Number.isNaN(t)) return '—';
|
|
26
|
-
return new Date(t).toLocaleString('pt-BR', { dateStyle: 'short', timeStyle: 'short' });
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function clock(iso) {
|
|
30
|
-
const t = Date.parse(iso || '');
|
|
31
|
-
if (Number.isNaN(t)) return '—';
|
|
32
|
-
return new Date(t).toLocaleTimeString('pt-BR', { hour: '2-digit', minute: '2-digit' });
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function dayLabel(iso) {
|
|
36
|
-
const t = Date.parse(iso || '');
|
|
37
|
-
if (Number.isNaN(t)) return '—';
|
|
38
|
-
return new Date(t).toLocaleDateString('pt-BR', { weekday: 'long', day: 'numeric', month: 'long' });
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const compact = new Intl.NumberFormat('pt-BR', { notation: 'compact', maximumFractionDigits: 1 });
|
|
42
|
-
export function num(n) {
|
|
43
|
-
return typeof n === 'number' && Number.isFinite(n) ? compact.format(n) : '—';
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function bytes(n) {
|
|
47
|
-
if (typeof n !== 'number' || !Number.isFinite(n)) return '—';
|
|
48
|
-
if (n < 1024) return `${n} B`;
|
|
49
|
-
if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
|
|
50
|
-
return `${(n / 1024 / 1024).toFixed(1)} MB`;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export function splitFrontmatter(text) {
|
|
54
|
-
const m = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?/.exec(text || '');
|
|
55
|
-
if (!m) return { meta: null, body: text || '' };
|
|
56
|
-
const meta = {};
|
|
57
|
-
for (const line of m[1].split(/\r?\n/)) {
|
|
58
|
-
const kv = /^([\w-]+):\s*(.*)$/.exec(line);
|
|
59
|
-
if (kv) meta[kv[1]] = kv[2].replace(/^["']|["']$/g, '');
|
|
60
|
-
}
|
|
61
|
-
return { meta, body: text.slice(m[0].length) };
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export function verdictLabel(f) {
|
|
65
|
-
if (!f?.verdict) return null;
|
|
66
|
-
const word = VERDICT_SAY[f.verdict] ?? f.verdict;
|
|
67
|
-
if (!f.blockers) return word;
|
|
68
|
-
return `${word} · ${f.blockers} ${f.blockers === 1 ? 'problema' : 'problemas'}`;
|
|
69
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import morphData from 'virtual:morph-data';
|
|
2
|
-
import {
|
|
3
|
-
PHASE_NAME, GATE_NAME, VERDICT_SAY, ROLE_NAME, STATUS_SAY, WORK_NAME, PROOF_SAY, CHECK_RESULT_SAY,
|
|
4
|
-
BLOCKER_SAY, VERIFY_STEP_SAY, RESULT_SAY, scenarioLabel,
|
|
5
|
-
} from '../../../../framework/hooks/shared/owner-words.js';
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
GATE_NAME as GATE_LABEL, VERDICT_SAY, ROLE_NAME, STATUS_SAY, WORK_NAME, PROOF_SAY, CHECK_RESULT_SAY,
|
|
9
|
-
BLOCKER_SAY, VERIFY_STEP_SAY, RESULT_SAY, scenarioLabel,
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const PHASES = (morphData.phases?.list || []).map((p) => ({
|
|
13
|
-
id: p.id,
|
|
14
|
-
label: PHASE_NAME[p.id] || p.displayName || p.id,
|
|
15
|
-
optional: Boolean(p.optional),
|
|
16
|
-
folder: p.folder || null,
|
|
17
|
-
skill: p.skill || null,
|
|
18
|
-
color: `var(--color-phase-${p.id})`,
|
|
19
|
-
}));
|
|
20
|
-
|
|
21
|
-
export const PHASE_INDEX = Object.fromEntries(PHASES.map((p, i) => [p.id, i]));
|
|
22
|
-
|
|
23
|
-
export function phaseMeta(id) {
|
|
24
|
-
return PHASES.find((p) => p.id === id) || { id, label: PHASE_NAME[id] || id || '—', color: 'var(--color-faint)', optional: false };
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const STATUS_LABEL = {
|
|
28
|
-
draft: 'Rascunho',
|
|
29
|
-
in_progress: 'Em andamento',
|
|
30
|
-
completed: 'Concluída',
|
|
31
|
-
abandoned: 'Abandonada',
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const LOCATION_LABEL = {
|
|
35
|
-
root: 'pasta principal',
|
|
36
|
-
worktree: 'cópia de trabalho separada',
|
|
37
|
-
archive: 'arquivo',
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const TRUST_SAY = {
|
|
41
|
-
auto: 'aprova sozinho quando não há risco',
|
|
42
|
-
manual: 'você aprova tudo',
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const SIGNAL_SAY = {
|
|
46
|
-
'design-system': 'tela fora do padrão visual do projeto',
|
|
47
|
-
'e2e-skip': 'o teste do fluxo completo não rodou',
|
|
48
|
-
hotfix: 'correção urgente sempre passa por você',
|
|
49
|
-
manual: 'você pediu para aprovar tudo',
|
|
50
|
-
'media-claims': 'a entrega gera imagem, áudio ou vídeo',
|
|
51
|
-
'plan-checks': 'o plano tem um cenário que precisa de você',
|
|
52
|
-
'plan-critique': 'a crítica do plano levantou dúvidas',
|
|
53
|
-
'prompt-model-eval-skip': 'a avaliação da IA não rodou',
|
|
54
|
-
'prompt-model-no-eval': 'mudança na IA sem avaliação da resposta',
|
|
55
|
-
'review-reports': 'a revisão independente pediu correção',
|
|
56
|
-
rung: 'um passo dá trabalho para desfazer',
|
|
57
|
-
'rung-undeclared': 'um passo sem volta que o plano não avisou',
|
|
58
|
-
'screen-checklist': 'a conferência das telas está incompleta',
|
|
59
|
-
standards: 'o código foge das regras do projeto',
|
|
60
|
-
'trust-manual': 'você pediu para aprovar tudo',
|
|
61
|
-
'uiux-checklist': 'a conferência das telas está incompleta',
|
|
62
|
-
'verify-missing': 'os testes automáticos ainda não rodaram',
|
|
63
|
-
'verify-red': 'os testes automáticos estão falhando',
|
|
64
|
-
'verify-stale': 'o código mudou depois dos testes automáticos',
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export const signalLabel = (key) => SIGNAL_SAY[key] ?? String(key ?? '').replace(/-/g, ' ');
|
|
68
|
-
|
|
69
|
-
export const workLabel = (type) => WORK_NAME[type || 'feature'] ?? type;
|
|
70
|
-
|
|
71
|
-
export const featureTitle = (f) => f?.title || f?.name || '';
|
|
72
|
-
|
|
73
|
-
export function verdictWord(verdict) {
|
|
74
|
-
return verdict ? VERDICT_SAY[verdict] ?? verdict : null;
|
|
75
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef } from 'react';
|
|
2
|
-
import { useLocation } from 'react-router-dom';
|
|
3
|
-
import { usePref } from '../hooks/usePref.js';
|
|
4
|
-
import { useMorphQuery } from '../hooks/useMorphQuery.js';
|
|
5
|
-
|
|
6
|
-
export const apiBase = (id) => `/api/morph/p/${encodeURIComponent(id)}`;
|
|
7
|
-
|
|
8
|
-
export const projectHref = (id, sub = 'features') => `/p/${encodeURIComponent(id)}/${sub}`;
|
|
9
|
-
|
|
10
|
-
export const featureHref = (project, name, query = '') =>
|
|
11
|
-
projectHref(project, `features/${encodeURIComponent(name)}`) + query;
|
|
12
|
-
|
|
13
|
-
const PROJECTS_CHANGED = 'morph:projects-changed';
|
|
14
|
-
|
|
15
|
-
export const announceProjectsChanged = () => window.dispatchEvent(new Event(PROJECTS_CHANGED));
|
|
16
|
-
|
|
17
|
-
export function useProjects() {
|
|
18
|
-
const q = useMorphQuery('/api/morph/projects', { scope: 'projects' });
|
|
19
|
-
const refetch = useRef(q.refetch);
|
|
20
|
-
refetch.current = q.refetch;
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
const on = () => refetch.current();
|
|
23
|
-
window.addEventListener(PROJECTS_CHANGED, on);
|
|
24
|
-
return () => window.removeEventListener(PROJECTS_CHANGED, on);
|
|
25
|
-
}, []);
|
|
26
|
-
return q;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function useCurrentProject(portfolio) {
|
|
30
|
-
const { pathname } = useLocation();
|
|
31
|
-
const m = /^\/p\/([^/]+)/.exec(pathname);
|
|
32
|
-
const fromUrl = m ? decodeURIComponent(m[1]) : null;
|
|
33
|
-
const [last, setLast] = usePref('project.last', null);
|
|
34
|
-
useEffect(() => { if (fromUrl && fromUrl !== last) setLast(fromUrl); }, [fromUrl, last, setLast]);
|
|
35
|
-
const known = (id) => id && (!portfolio?.projects || portfolio.projects.some((p) => p.id === id));
|
|
36
|
-
const id = fromUrl || (known(last) ? last : null) || portfolio?.launch || null;
|
|
37
|
-
return { id, inUrl: Boolean(fromUrl) };
|
|
38
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { StrictMode } from 'react';
|
|
2
|
-
import { createRoot } from 'react-dom/client';
|
|
3
|
-
import { BrowserRouter } from 'react-router-dom';
|
|
4
|
-
import App from './App.jsx';
|
|
5
|
-
import './styles/index.css';
|
|
6
|
-
|
|
7
|
-
createRoot(document.getElementById('root')).render(
|
|
8
|
-
<StrictMode>
|
|
9
|
-
<BrowserRouter>
|
|
10
|
-
<App />
|
|
11
|
-
</BrowserRouter>
|
|
12
|
-
</StrictMode>
|
|
13
|
-
);
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { useParams } from 'react-router-dom';
|
|
2
|
-
import ActivityFeed from '../components/ActivityFeed.jsx';
|
|
3
|
-
import GatePauses from '../components/GatePauses.jsx';
|
|
4
|
-
import { useProjects } from '../lib/project.js';
|
|
5
|
-
|
|
6
|
-
export default function Activity() {
|
|
7
|
-
const { project } = useParams();
|
|
8
|
-
const { data } = useProjects();
|
|
9
|
-
const name = data?.projects?.find((p) => p.id === project)?.name;
|
|
10
|
-
return (
|
|
11
|
-
<div className="mx-auto max-w-4xl px-4 pb-24 pt-10 md:px-10 md:pt-16">
|
|
12
|
-
<header className="rise mb-8">
|
|
13
|
-
{name && <p className="text-sm text-[var(--color-dim)]">{name}</p>}
|
|
14
|
-
<h1 className="mt-1 text-4xl font-semibold tracking-tight">Atividade</h1>
|
|
15
|
-
<p className="mt-3 max-w-2xl text-sm leading-relaxed text-[var(--color-dim)]">
|
|
16
|
-
O que o Claude fez no projeto, contado a partir da telemetria dos hooks: suas mensagens, as skills carregadas,
|
|
17
|
-
os sub-agents despachados, os verifies e os gates. Atualiza sozinho enquanto ele trabalha.
|
|
18
|
-
</p>
|
|
19
|
-
</header>
|
|
20
|
-
<div className="rise-2 bezel mb-6">
|
|
21
|
-
<div className="bezel-core px-5 py-5"><GatePauses project={project} /></div>
|
|
22
|
-
</div>
|
|
23
|
-
<div className="rise-2 bezel">
|
|
24
|
-
<div className="bezel-core px-5 py-5"><ActivityFeed project={project} showFeature /></div>
|
|
25
|
-
</div>
|
|
26
|
-
</div>
|
|
27
|
-
);
|
|
28
|
-
}
|