@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,166 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
import { Link } from 'react-router-dom';
|
|
3
|
-
import {
|
|
4
|
-
ChatCircleText, Question, BookOpenText, PaperPlaneTilt, ArrowBendDownLeft, ShieldCheck, Flag, WarningOctagon,
|
|
5
|
-
PencilSimpleLine, Eye, TerminalWindow, Wrench,
|
|
6
|
-
} from '@phosphor-icons/react';
|
|
7
|
-
import { useMorphQuery } from '../hooks/useMorphQuery.js';
|
|
8
|
-
import EntityLink from './EntityLink.jsx';
|
|
9
|
-
import { apiBase, featureHref } from '../lib/project.js';
|
|
10
|
-
import { clock, dayLabel } from '../lib/format.js';
|
|
11
|
-
import { phaseMeta } from '../lib/phases.js';
|
|
12
|
-
|
|
13
|
-
export const KIND_META = {
|
|
14
|
-
prompt: { label: 'Você', icon: ChatCircleText },
|
|
15
|
-
question: { label: 'Perguntas', icon: Question },
|
|
16
|
-
skill: { label: 'Skills', icon: BookOpenText },
|
|
17
|
-
dispatch: { label: 'Ajudantes chamados', icon: PaperPlaneTilt },
|
|
18
|
-
handback: { label: 'Retornos', icon: ArrowBendDownLeft },
|
|
19
|
-
verify: { label: 'Testes automáticos', icon: ShieldCheck },
|
|
20
|
-
gate: { label: 'Aprovações', icon: Flag },
|
|
21
|
-
failure: { label: 'Falhas', icon: WarningOctagon },
|
|
22
|
-
write: { label: 'Escritas', icon: PencilSimpleLine },
|
|
23
|
-
read: { label: 'Leituras', icon: Eye },
|
|
24
|
-
command: { label: 'Comandos', icon: TerminalWindow },
|
|
25
|
-
tool: { label: 'Outras ferramentas', icon: Wrench },
|
|
26
|
-
};
|
|
27
|
-
const DEFAULT = ['prompt', 'question', 'skill', 'dispatch', 'handback', 'verify', 'gate', 'failure'];
|
|
28
|
-
|
|
29
|
-
const NODE_TONE = { pass: 'text-[var(--color-ok)]', fail: 'text-[var(--color-bad)]', skip: 'text-[var(--color-faint)]' };
|
|
30
|
-
|
|
31
|
-
function Line({ item, showFeature, project }) {
|
|
32
|
-
const Icon = KIND_META[item.kind]?.icon || Wrench;
|
|
33
|
-
const tone = item.status === 'fail' ? 'text-[var(--color-bad)]' : item.status === 'ok' ? 'text-[var(--color-ok)]' : 'text-[var(--color-dim)]';
|
|
34
|
-
return (
|
|
35
|
-
<li className="grid grid-cols-[3rem_1.25rem_minmax(0,1fr)] gap-3 py-2.5">
|
|
36
|
-
<time className="pt-px font-mono text-xs tabular-nums text-[var(--color-faint)]" dateTime={item.ts}>{clock(item.ts)}</time>
|
|
37
|
-
<Icon weight="light" size={17} className={tone} aria-hidden="true" />
|
|
38
|
-
<div className="min-w-0">
|
|
39
|
-
<p className="text-sm text-[var(--color-fg)]">
|
|
40
|
-
{item.refs?.persona ? (
|
|
41
|
-
<>Chamou <EntityLink kind="persona" id={item.refs.persona}>{item.title.replace(/^Chamou /, '')}</EntityLink></>
|
|
42
|
-
) : item.refs?.skill ? (
|
|
43
|
-
<>Carregou a skill <EntityLink kind="skill" id={item.refs.skill} /></>
|
|
44
|
-
) : item.title}
|
|
45
|
-
{showFeature && item.feature && (
|
|
46
|
-
<Link to={featureHref(project, item.feature)} className="ml-2 text-xs text-[var(--color-faint)] hover:text-[var(--color-dim)]">{item.featureTitle ?? item.feature}</Link>
|
|
47
|
-
)}
|
|
48
|
-
{item.phase && (
|
|
49
|
-
<span className="ml-2 text-xs" style={{ color: phaseMeta(item.phase).color }}>{phaseMeta(item.phase).label.toLowerCase()}</span>
|
|
50
|
-
)}
|
|
51
|
-
{item.agent && item.kind !== 'handback' && (
|
|
52
|
-
<span className="ml-2 text-xs text-[var(--color-faint)]">por {item.agent}</span>
|
|
53
|
-
)}
|
|
54
|
-
</p>
|
|
55
|
-
{item.detail && <p className="mt-0.5 line-clamp-2 break-words text-sm text-[var(--color-dim)]">{item.detail}</p>}
|
|
56
|
-
{item.nodes?.length > 0 && (
|
|
57
|
-
<p className="mt-1 flex flex-wrap gap-x-3 gap-y-1 font-mono text-xs">
|
|
58
|
-
{item.nodes.map((n) => (
|
|
59
|
-
<span key={n.name} className={NODE_TONE[n.status] || 'text-[var(--color-dim)]'}>{n.label ?? `${n.name} ${n.status}`}</span>
|
|
60
|
-
))}
|
|
61
|
-
</p>
|
|
62
|
-
)}
|
|
63
|
-
</div>
|
|
64
|
-
</li>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function byDay(items) {
|
|
69
|
-
const groups = [];
|
|
70
|
-
for (const it of items) {
|
|
71
|
-
const key = (it.ts || '').slice(0, 10);
|
|
72
|
-
const last = groups[groups.length - 1];
|
|
73
|
-
if (last && last.key === key) last.items.push(it);
|
|
74
|
-
else groups.push({ key, ts: it.ts, items: [it] });
|
|
75
|
-
}
|
|
76
|
-
return groups;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export function FeedView({ items, kinds, onToggleKind, showFeature, onMore, hasMore, total, project }) {
|
|
80
|
-
return (
|
|
81
|
-
<div>
|
|
82
|
-
<div className="mb-5 flex flex-wrap gap-2" role="group" aria-label="Tipos de evento">
|
|
83
|
-
{Object.entries(KIND_META).map(([kind, meta]) => {
|
|
84
|
-
const on = kinds.includes(kind);
|
|
85
|
-
return (
|
|
86
|
-
<button
|
|
87
|
-
key={kind}
|
|
88
|
-
type="button"
|
|
89
|
-
aria-pressed={on}
|
|
90
|
-
onClick={() => onToggleKind(kind)}
|
|
91
|
-
className={[
|
|
92
|
-
'fluid rounded-full px-3 py-1 text-xs transition-colors active:scale-[0.98]',
|
|
93
|
-
on ? 'bg-white/[0.09] text-[var(--color-fg)] shadow-[inset_0_0_0_1px_var(--color-hair-strong)]' : 'text-[var(--color-faint)] shadow-[inset_0_0_0_1px_var(--color-hair)] hover:text-[var(--color-dim)]',
|
|
94
|
-
].join(' ')}
|
|
95
|
-
>
|
|
96
|
-
{meta.label}
|
|
97
|
-
</button>
|
|
98
|
-
);
|
|
99
|
-
})}
|
|
100
|
-
</div>
|
|
101
|
-
{items.length === 0 && (
|
|
102
|
-
<p className="text-sm text-[var(--color-dim)]">
|
|
103
|
-
Nada registrado com esses filtros. O histórico é gravado automaticamente enquanto o Claude trabalha.
|
|
104
|
-
</p>
|
|
105
|
-
)}
|
|
106
|
-
{byDay(items).map((g) => (
|
|
107
|
-
<section key={g.key} className="mb-6">
|
|
108
|
-
<h3 className="sticky top-0 z-10 -mx-1 bg-[var(--color-core)] px-1 py-1.5 text-xs font-medium text-[var(--color-dim)] first-letter:uppercase">{dayLabel(g.ts)}</h3>
|
|
109
|
-
<ul className="divide-y divide-[var(--color-hair)]">
|
|
110
|
-
{g.items.map((it) => <Line key={it.id} item={it} showFeature={showFeature} project={project} />)}
|
|
111
|
-
</ul>
|
|
112
|
-
</section>
|
|
113
|
-
))}
|
|
114
|
-
{hasMore && (
|
|
115
|
-
<button
|
|
116
|
-
type="button"
|
|
117
|
-
onClick={onMore}
|
|
118
|
-
className="fluid rounded-full px-4 py-2 text-sm text-[var(--color-dim)] shadow-[inset_0_0_0_1px_var(--color-hair)] transition-colors hover:text-[var(--color-fg)] active:scale-[0.98]"
|
|
119
|
-
>
|
|
120
|
-
Carregar anteriores
|
|
121
|
-
</button>
|
|
122
|
-
)}
|
|
123
|
-
{typeof total === 'number' && items.length > 0 && (
|
|
124
|
-
<p className="mt-3 text-xs text-[var(--color-faint)]">{items.length} de {total} eventos</p>
|
|
125
|
-
)}
|
|
126
|
-
</div>
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export default function ActivityFeed({ project, feature, showFeature = false }) {
|
|
131
|
-
const [kinds, setKinds] = useState(DEFAULT);
|
|
132
|
-
const [older, setOlder] = useState([]);
|
|
133
|
-
const [cursor, setCursor] = useState(null);
|
|
134
|
-
const params = new URLSearchParams({ kinds: kinds.join(','), limit: '80' });
|
|
135
|
-
if (feature) params.set('feature', feature);
|
|
136
|
-
const { data, error } = useMorphQuery(`${apiBase(project)}/activity?${params}`, { scope: 'activity', project });
|
|
137
|
-
|
|
138
|
-
useEffect(() => { setOlder([]); setCursor(null); }, [feature, kinds.join(',')]);
|
|
139
|
-
|
|
140
|
-
const next = cursor === null ? data?.next : cursor;
|
|
141
|
-
const loadMore = async () => {
|
|
142
|
-
if (!next) return;
|
|
143
|
-
const p = new URLSearchParams(params);
|
|
144
|
-
p.set('before', next);
|
|
145
|
-
const res = await fetch(`${apiBase(project)}/activity?${p}`);
|
|
146
|
-
const page = await res.json();
|
|
147
|
-
setOlder((o) => [...o, ...page.items]);
|
|
148
|
-
setCursor(page.next || '');
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
if (error) return <p className="text-sm text-[var(--color-bad)]">Não consegui ler a atividade: {error}</p>;
|
|
152
|
-
if (!data) return <p className="text-sm text-[var(--color-faint)]">Lendo a telemetria…</p>;
|
|
153
|
-
const toggle = (k) => setKinds((ks) => (ks.includes(k) ? ks.filter((x) => x !== k) : [...ks, k]));
|
|
154
|
-
return (
|
|
155
|
-
<FeedView
|
|
156
|
-
items={[...data.items, ...older]}
|
|
157
|
-
kinds={kinds}
|
|
158
|
-
onToggleKind={toggle}
|
|
159
|
-
showFeature={showFeature}
|
|
160
|
-
onMore={loadMore}
|
|
161
|
-
hasMore={Boolean(next)}
|
|
162
|
-
total={data.total}
|
|
163
|
-
project={project}
|
|
164
|
-
/>
|
|
165
|
-
);
|
|
166
|
-
}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
-
import { useNavigate } from 'react-router-dom';
|
|
3
|
-
import morphData from 'virtual:morph-data';
|
|
4
|
-
import { MagnifyingGlass } from '@phosphor-icons/react';
|
|
5
|
-
import { entityHref } from './EntityLink.jsx';
|
|
6
|
-
import { tocOf } from '../pages/Guide.jsx';
|
|
7
|
-
import { useMorphQuery } from '../hooks/useMorphQuery.js';
|
|
8
|
-
import { apiBase, projectHref, featureHref } from '../lib/project.js';
|
|
9
|
-
|
|
10
|
-
const KIND_LABEL = {
|
|
11
|
-
page: 'Página', project: 'Projeto', feature: 'Feature', skill: 'Skill', persona: 'Persona',
|
|
12
|
-
standard: 'Standard', rule: 'Rule', hook: 'Hook', guide: 'Guia',
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const PAGES = [
|
|
16
|
-
['Portfólio', '/'], ['Guia', '/guide'], ['Fases', '/phases'], ['Skills', '/skills'],
|
|
17
|
-
['Personas', '/agents'], ['Standards', '/standards'], ['Rules', '/rules'], ['Hooks', '/hooks'],
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
function knowledgeIndex() {
|
|
21
|
-
const out = PAGES.map(([title, to]) => ({ kind: 'page', title, to, hay: title }));
|
|
22
|
-
for (const s of morphData.skills || []) out.push({ kind: 'skill', title: s.id, hint: s.description, to: entityHref('skill', s.id), hay: `${s.id} ${s.description}` });
|
|
23
|
-
for (const a of morphData.agents?.list || []) out.push({ kind: 'persona', title: `morph-${a.id}`, hint: a.title, to: entityHref('persona', a.id), hay: `${a.id} ${a.title} ${(a.keywords || []).join(' ')}` });
|
|
24
|
-
for (const s of morphData.standards?.list || []) out.push({ kind: 'standard', title: s.name, hint: s.id, to: entityHref('standard', s.id), hay: `${s.name} ${s.id} ${(s.aliases || []).join(' ')} ${(s.tags || []).join(' ')}` });
|
|
25
|
-
for (const r of morphData.rules || []) out.push({ kind: 'rule', title: r.name, hint: (r.paths || []).join(', '), to: entityHref('rule', r.name), hay: `${r.name} ${(r.paths || []).join(' ')}` });
|
|
26
|
-
const hooks = new Set();
|
|
27
|
-
for (const h of morphData.hooks || []) {
|
|
28
|
-
if (hooks.has(h.name)) continue;
|
|
29
|
-
hooks.add(h.name);
|
|
30
|
-
out.push({ kind: 'hook', title: h.name, hint: h.description, to: entityHref('hook', h.name), hay: `${h.name} ${h.description || ''}` });
|
|
31
|
-
}
|
|
32
|
-
for (const d of morphData.docs?.guide || []) {
|
|
33
|
-
for (const h of tocOf(d).filter((x) => x.depth >= 2)) {
|
|
34
|
-
out.push({ kind: 'guide', title: h.text, hint: d.title, to: `/guide/${d.id}#${h.slug}`, hay: `${h.text} ${d.title}` });
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return out;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function projectIndex(portfolio) {
|
|
41
|
-
return (portfolio?.projects || []).map((p) => ({ kind: 'project', title: p.name, hint: p.dir, to: projectHref(p.id), hay: `${p.name} ${p.dir}` }));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function featureIndex(project, features, projectName = null) {
|
|
45
|
-
const out = [];
|
|
46
|
-
const where = (text) => (projectName ? (text ? `${projectName}: ${text}` : projectName) : text);
|
|
47
|
-
for (const f of features || []) {
|
|
48
|
-
out.push({ kind: 'feature', title: f.title || f.name, hint: where(f.description), to: featureHref(project, f.name), hay: `${f.title || ''} ${f.name} ${f.description || ''} ${projectName || ''}` });
|
|
49
|
-
}
|
|
50
|
-
return out;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function otherProjectsIndex(portfolio, project) {
|
|
54
|
-
return (portfolio?.projects || [])
|
|
55
|
-
.filter((p) => p.id !== project && p.summary)
|
|
56
|
-
.flatMap((p) => featureIndex(p.id, p.summary.activeFeatures, p.name));
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export function searchIndex(index, query, limit = 40) {
|
|
60
|
-
const words = query.toLowerCase().split(/\s+/).filter(Boolean);
|
|
61
|
-
if (!words.length) return [];
|
|
62
|
-
const scored = [];
|
|
63
|
-
for (const item of index) {
|
|
64
|
-
const hay = item.hay.toLowerCase();
|
|
65
|
-
if (!words.every((w) => hay.includes(w))) continue;
|
|
66
|
-
const title = item.title.toLowerCase();
|
|
67
|
-
const score = (title.startsWith(words[0]) ? 0 : title.includes(words[0]) ? 1 : 2) + (item.kind === 'page' ? -1 : 0);
|
|
68
|
-
scored.push({ item, score });
|
|
69
|
-
}
|
|
70
|
-
return scored.sort((a, b) => a.score - b.score || a.item.title.length - b.item.title.length).slice(0, limit).map((s) => s.item);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export default function CommandPalette({ open, onClose, portfolio, project }) {
|
|
74
|
-
const navigate = useNavigate();
|
|
75
|
-
const [query, setQuery] = useState('');
|
|
76
|
-
const [active, setActive] = useState(0);
|
|
77
|
-
const inputRef = useRef(null);
|
|
78
|
-
const knowledge = useMemo(knowledgeIndex, []);
|
|
79
|
-
const { data } = useMorphQuery(open && project ? `${apiBase(project)}/features` : null, { project });
|
|
80
|
-
const index = useMemo(
|
|
81
|
-
() => [...featureIndex(project, data?.features), ...otherProjectsIndex(portfolio, project), ...projectIndex(portfolio), ...knowledge],
|
|
82
|
-
[data, knowledge, portfolio, project],
|
|
83
|
-
);
|
|
84
|
-
const results = useMemo(() => searchIndex(index, query), [index, query]);
|
|
85
|
-
|
|
86
|
-
useEffect(() => {
|
|
87
|
-
if (open) { setQuery(''); setActive(0); setTimeout(() => inputRef.current?.focus(), 0); }
|
|
88
|
-
}, [open]);
|
|
89
|
-
useEffect(() => { setActive(0); }, [query]);
|
|
90
|
-
|
|
91
|
-
if (!open) return null;
|
|
92
|
-
const go = (item) => { onClose(); navigate(item.to); };
|
|
93
|
-
const onKey = (e) => {
|
|
94
|
-
if (e.key === 'Escape') onClose();
|
|
95
|
-
else if (e.key === 'ArrowDown') { e.preventDefault(); setActive((i) => Math.min(i + 1, results.length - 1)); }
|
|
96
|
-
else if (e.key === 'ArrowUp') { e.preventDefault(); setActive((i) => Math.max(i - 1, 0)); }
|
|
97
|
-
else if (e.key === 'Enter' && results[active]) go(results[active]);
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
return (
|
|
101
|
-
<div className="fixed inset-0 z-50 flex items-start justify-center bg-black/60 px-4 pt-[12vh] backdrop-blur-sm" onMouseDown={onClose} role="presentation">
|
|
102
|
-
<div role="dialog" aria-modal="true" aria-label="Busca" className="bezel w-full max-w-2xl" onMouseDown={(e) => e.stopPropagation()}>
|
|
103
|
-
<div className="bezel-core overflow-hidden">
|
|
104
|
-
<label className="flex items-center gap-3 border-b border-[var(--color-hair)] px-5 py-4">
|
|
105
|
-
<MagnifyingGlass weight="light" size={18} className="text-[var(--color-faint)]" />
|
|
106
|
-
<span className="sr-only">Buscar em tudo</span>
|
|
107
|
-
<input
|
|
108
|
-
ref={inputRef}
|
|
109
|
-
value={query}
|
|
110
|
-
onChange={(e) => setQuery(e.target.value)}
|
|
111
|
-
onKeyDown={onKey}
|
|
112
|
-
placeholder="Buscar features, skills, personas, standards, seções do guia…"
|
|
113
|
-
className="w-full bg-transparent text-base text-[var(--color-fg)] outline-none focus-visible:outline-none placeholder:text-[var(--color-faint)]"
|
|
114
|
-
aria-controls="palette-results"
|
|
115
|
-
aria-activedescendant={results[active] ? `palette-${active}` : undefined}
|
|
116
|
-
/>
|
|
117
|
-
<kbd className="rounded-md px-1.5 font-mono text-[11px] text-[var(--color-faint)] shadow-[inset_0_0_0_1px_var(--color-hair)]">Esc</kbd>
|
|
118
|
-
</label>
|
|
119
|
-
<ul id="palette-results" role="listbox" className="max-h-[55vh] overflow-y-auto p-2">
|
|
120
|
-
{query && results.length === 0 && <li className="px-3 py-6 text-center text-sm text-[var(--color-dim)]">Nada encontrado para “{query}”.</li>}
|
|
121
|
-
{!query && <li className="px-3 py-6 text-center text-sm text-[var(--color-faint)]">Digite para buscar. Setas navegam, Enter abre.</li>}
|
|
122
|
-
{results.map((r, i) => (
|
|
123
|
-
<li
|
|
124
|
-
key={`${r.kind}:${r.to}:${r.title}`}
|
|
125
|
-
id={`palette-${i}`}
|
|
126
|
-
role="option"
|
|
127
|
-
aria-selected={i === active}
|
|
128
|
-
onMouseEnter={() => setActive(i)}
|
|
129
|
-
onClick={() => go(r)}
|
|
130
|
-
className={['flex cursor-pointer items-baseline gap-3 rounded-lg px-3 py-2', i === active ? 'bg-white/[0.07]' : ''].join(' ')}
|
|
131
|
-
>
|
|
132
|
-
<span className="w-16 shrink-0 text-xs text-[var(--color-faint)]">{KIND_LABEL[r.kind]}</span>
|
|
133
|
-
<span className="min-w-0 flex-1">
|
|
134
|
-
<span className="block truncate text-sm text-[var(--color-fg)]">{r.title}</span>
|
|
135
|
-
{r.hint && <span className="block truncate text-xs text-[var(--color-dim)]">{r.hint}</span>}
|
|
136
|
-
</span>
|
|
137
|
-
</li>
|
|
138
|
-
))}
|
|
139
|
-
</ul>
|
|
140
|
-
</div>
|
|
141
|
-
</div>
|
|
142
|
-
</div>
|
|
143
|
-
);
|
|
144
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
import { X } from '@phosphor-icons/react';
|
|
3
|
-
|
|
4
|
-
/** No backdrop: the graph stays visible beside the drawer. */
|
|
5
|
-
export default function DetailPanel({ open, title, subtitle, onClose, children }) {
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
if (!open) return undefined;
|
|
8
|
-
const onKey = (e) => { if (e.key === 'Escape') onClose?.(); };
|
|
9
|
-
window.addEventListener('keydown', onKey);
|
|
10
|
-
return () => window.removeEventListener('keydown', onKey);
|
|
11
|
-
}, [open, onClose]);
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<aside
|
|
15
|
-
aria-hidden={!open}
|
|
16
|
-
aria-label={title}
|
|
17
|
-
className={[
|
|
18
|
-
'fluid fixed inset-y-0 right-0 z-40 flex w-full max-w-[44rem] flex-col p-3 transition-transform',
|
|
19
|
-
open ? 'translate-x-0' : 'pointer-events-none translate-x-full',
|
|
20
|
-
].join(' ')}
|
|
21
|
-
>
|
|
22
|
-
<div className="bezel flex min-h-0 flex-1 flex-col bg-[var(--color-ink)]/80 backdrop-blur-xl">
|
|
23
|
-
<div className="bezel-core flex min-h-0 flex-1 flex-col">
|
|
24
|
-
<header className="flex items-start justify-between gap-4 border-b border-[var(--color-hair)] px-6 py-4">
|
|
25
|
-
<div className="min-w-0">
|
|
26
|
-
<h2 className="truncate text-lg font-semibold tracking-tight">{title}</h2>
|
|
27
|
-
{subtitle && <p className="mt-0.5 truncate text-sm text-[var(--color-dim)]">{subtitle}</p>}
|
|
28
|
-
</div>
|
|
29
|
-
<button
|
|
30
|
-
type="button"
|
|
31
|
-
onClick={onClose}
|
|
32
|
-
aria-label="Fechar painel"
|
|
33
|
-
className="fluid flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-white/[0.05] text-[var(--color-dim)] transition-colors hover:bg-white/[0.1] hover:text-[var(--color-fg)]"
|
|
34
|
-
>
|
|
35
|
-
<X weight="light" size={16} />
|
|
36
|
-
</button>
|
|
37
|
-
</header>
|
|
38
|
-
<div className="min-h-0 flex-1 overflow-y-auto px-6 py-5">{children}</div>
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
</aside>
|
|
42
|
-
);
|
|
43
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Link, useSearchParams } from 'react-router-dom';
|
|
2
|
-
import { useCallback } from 'react';
|
|
3
|
-
|
|
4
|
-
export function entityHref(kind, id) {
|
|
5
|
-
const q = (page) => `/${page}?sel=${encodeURIComponent(id)}`;
|
|
6
|
-
switch (kind) {
|
|
7
|
-
case 'persona': return q('agents');
|
|
8
|
-
case 'skill': return q('skills');
|
|
9
|
-
case 'standard': return q('standards');
|
|
10
|
-
case 'rule': return q('rules');
|
|
11
|
-
case 'hook': return q('hooks');
|
|
12
|
-
case 'phase': return q('phases');
|
|
13
|
-
case 'guide': return `/guide/${encodeURIComponent(id)}`;
|
|
14
|
-
default: return '#';
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function standardKey(ref) {
|
|
19
|
-
return String(ref).replace(/^\.?\/?(\.morph\/framework\/)?standards\//, '');
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const TONE = 'text-[var(--color-phase-proposal)] hover:underline underline-offset-2';
|
|
23
|
-
|
|
24
|
-
export default function EntityLink({ kind, id, children, className = '', chip = false, plain = false, title }) {
|
|
25
|
-
const cls = chip
|
|
26
|
-
? `inline-flex items-center rounded-full px-2 py-0.5 font-mono text-[11px] text-[var(--color-dim)] shadow-[inset_0_0_0_1px_var(--color-hair)] transition-colors hover:text-[var(--color-fg)] hover:shadow-[inset_0_0_0_1px_var(--color-hair-strong)] ${className}`
|
|
27
|
-
: plain ? className : `${TONE} ${className}`;
|
|
28
|
-
return <Link to={entityHref(kind, id)} className={cls} title={title}>{children ?? id}</Link>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function useSelection() {
|
|
32
|
-
const [params, setParams] = useSearchParams();
|
|
33
|
-
const sel = params.get('sel');
|
|
34
|
-
const setSel = useCallback((id) => {
|
|
35
|
-
setParams((p) => {
|
|
36
|
-
const n = new URLSearchParams(p);
|
|
37
|
-
if (id) n.set('sel', id); else n.delete('sel');
|
|
38
|
-
return n;
|
|
39
|
-
}, { replace: false });
|
|
40
|
-
}, [setParams]);
|
|
41
|
-
return [sel, setSel];
|
|
42
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Component } from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Mount it with `key={location.pathname}`: a boundary that already caught an
|
|
5
|
-
* error stays in fallback until it remounts.
|
|
6
|
-
*/
|
|
7
|
-
export default class ErrorBoundary extends Component {
|
|
8
|
-
constructor(props) {
|
|
9
|
-
super(props);
|
|
10
|
-
this.state = { error: null };
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
static getDerivedStateFromError(error) {
|
|
14
|
-
return { error };
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
componentDidCatch(error, info) {
|
|
18
|
-
console.error(`[dashboard] ${this.props.page || 'page'} failed to render:`, error, info?.componentStack);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
render() {
|
|
22
|
-
const { error } = this.state;
|
|
23
|
-
if (!error) return this.props.children;
|
|
24
|
-
return (
|
|
25
|
-
<div role="alert" className="p-6 max-w-3xl">
|
|
26
|
-
<h2 className="text-red-400 text-sm font-semibold uppercase tracking-wide mb-2">
|
|
27
|
-
This page failed to render
|
|
28
|
-
</h2>
|
|
29
|
-
<p className="text-gray-300 text-sm mb-3">
|
|
30
|
-
<span className="font-mono text-gray-400">{this.props.page}</span> threw while rendering.
|
|
31
|
-
The other pages still work — pick one in the sidebar.
|
|
32
|
-
</p>
|
|
33
|
-
<pre className="p-3 bg-gray-900 border border-red-900 rounded text-xs text-red-300 whitespace-pre-wrap font-mono overflow-x-auto">
|
|
34
|
-
{error.name}: {error.message}
|
|
35
|
-
</pre>
|
|
36
|
-
{error.stack && (
|
|
37
|
-
<details className="mt-2">
|
|
38
|
-
<summary className="text-gray-500 text-xs cursor-pointer">Stack trace</summary>
|
|
39
|
-
<pre className="mt-1 p-3 bg-gray-950 border border-gray-800 rounded text-[10px] text-gray-500 whitespace-pre-wrap font-mono overflow-x-auto">
|
|
40
|
-
{error.stack}
|
|
41
|
-
</pre>
|
|
42
|
-
</details>
|
|
43
|
-
)}
|
|
44
|
-
</div>
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ReactFlow, Controls, MiniMap, Background } from '@xyflow/react';
|
|
2
|
-
|
|
3
|
-
// The React Flow attribution stays: hiding it is licensed to Pro subscribers only.
|
|
4
|
-
export default function FlowGraph({ nodes, edges, nodeTypes, onNodeClick, fitView = true, className = '' }) {
|
|
5
|
-
return (
|
|
6
|
-
<div className={`w-full h-full ${className}`} style={{ minHeight: '500px' }}>
|
|
7
|
-
<ReactFlow
|
|
8
|
-
nodes={nodes} edges={edges} nodeTypes={nodeTypes} onNodeClick={onNodeClick}
|
|
9
|
-
fitView={fitView} fitViewOptions={{ padding: 0.15, maxZoom: 1.1 }} minZoom={0.2}
|
|
10
|
-
|
|
11
|
-
defaultEdgeOptions={{ type: 'smoothstep', animated: false, style: { stroke: '#3a4250', strokeWidth: 1.5 } }}
|
|
12
|
-
>
|
|
13
|
-
<Background color="rgb(255 255 255 / 0.05)" gap={22} />
|
|
14
|
-
<Controls position="bottom-right" />
|
|
15
|
-
<MiniMap nodeColor={(node) => node.data?.color || '#4a5260'} maskColor="rgba(5, 5, 5, 0.72)" position="bottom-left" pannable zoomable />
|
|
16
|
-
</ReactFlow>
|
|
17
|
-
</div>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { useMorphQuery } from '../hooks/useMorphQuery.js';
|
|
2
|
-
import { apiBase } from '../lib/project.js';
|
|
3
|
-
import { GATE_LABEL, signalLabel } from '../lib/phases.js';
|
|
4
|
-
|
|
5
|
-
// Validated with the dataviz palette checker against --color-core (#12151b), dark mode.
|
|
6
|
-
const SESSION = '#26a69a';
|
|
7
|
-
const HUMAN = '#d07f27';
|
|
8
|
-
// Not a series: pauses logged before the resolver existed, so nobody knows who cleared them.
|
|
9
|
-
const UNKNOWN = 'var(--color-gray-500)';
|
|
10
|
-
const GATE_ORDER = ['plan', 'uiux', 'review'];
|
|
11
|
-
|
|
12
|
-
function split(s = {}) {
|
|
13
|
-
const unknown = s.pausedUnattributed ?? 0;
|
|
14
|
-
const human = Math.max(0, (s.pausedForHuman ?? 0) - unknown);
|
|
15
|
-
return { human, unknown, session: Math.max(0, (s.paused ?? 0) - human - unknown) };
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function gateRows(gates = {}) {
|
|
19
|
-
const known = GATE_ORDER.filter((g) => gates[g]);
|
|
20
|
-
const extra = Object.keys(gates).filter((g) => !GATE_ORDER.includes(g)).sort();
|
|
21
|
-
return [...known, ...extra].map((g) => ({ gate: g, label: GATE_LABEL[g] ?? g, decisions: gates[g].decisions ?? 0, ...split(gates[g]) }));
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function humanSignals(gates = {}, top = 5) {
|
|
25
|
-
return Object.entries(gates)
|
|
26
|
-
.flatMap(([gate, slot]) => Object.entries(slot.bySignal ?? {}).map(([signal, s]) => ({ gate, signal, ...split(s) })))
|
|
27
|
-
.filter((r) => r.human > 0 || r.unknown > 0)
|
|
28
|
-
.sort((a, b) => b.human - a.human || b.unknown - a.unknown || a.signal.localeCompare(b.signal))
|
|
29
|
-
.slice(0, top);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function Swatch({ color, children }) {
|
|
33
|
-
return <span className="flex items-center gap-1.5"><span className="h-2.5 w-2.5 rounded-sm" style={{ background: color }} />{children}</span>;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function Bar({ row, max }) {
|
|
37
|
-
const parts = [
|
|
38
|
-
['session', row.session, SESSION, 'a sessão resolveu'],
|
|
39
|
-
['human', row.human, HUMAN, 'foi para você'],
|
|
40
|
-
['unknown', row.unknown, UNKNOWN, 'antes do registro'],
|
|
41
|
-
].filter(([, n]) => n > 0);
|
|
42
|
-
const total = row.session + row.human + row.unknown;
|
|
43
|
-
const describe = parts.map(([, n, , what]) => `${what} ${n}`).join(', ');
|
|
44
|
-
return (
|
|
45
|
-
<div className="grid grid-cols-[10rem_1fr_auto] items-center gap-3">
|
|
46
|
-
<span className="text-sm text-[var(--color-fg)]">{row.label}</span>
|
|
47
|
-
<div className="flex h-3 gap-[2px]" role="img" aria-label={`${row.label}: ${describe || 'nenhuma pausa'}`}>
|
|
48
|
-
{parts.map(([key, n, color, what], i) => (
|
|
49
|
-
<span key={key} className={`h-full ${i === 0 ? 'rounded-l-[4px]' : ''} ${i === parts.length - 1 ? 'rounded-r-[4px]' : ''}`}
|
|
50
|
-
style={{ width: `${(n / max) * 100}%`, background: color }} title={`${row.label} · ${what}: ${n}`} />
|
|
51
|
-
))}
|
|
52
|
-
</div>
|
|
53
|
-
<span className="text-right text-xs tabular-nums text-[var(--color-dim)]">
|
|
54
|
-
{total === 0 ? `nenhuma pausa em ${row.decisions}` : `${row.human} de ${total} para você`}
|
|
55
|
-
</span>
|
|
56
|
-
</div>
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export function GatePausesView({ gates }) {
|
|
61
|
-
const rows = gateRows(gates);
|
|
62
|
-
if (rows.length === 0) {
|
|
63
|
-
return <p className="text-sm text-[var(--color-faint)]">Nenhuma aprovação registrada ainda.</p>;
|
|
64
|
-
}
|
|
65
|
-
const max = Math.max(1, ...rows.map((r) => r.session + r.human + r.unknown));
|
|
66
|
-
const signals = humanSignals(gates);
|
|
67
|
-
const anyUnknown = rows.some((r) => r.unknown > 0);
|
|
68
|
-
return (
|
|
69
|
-
<div className="space-y-5">
|
|
70
|
-
<div className="flex flex-wrap items-baseline justify-between gap-2">
|
|
71
|
-
<h2 className="text-base font-semibold">Paradas em cada aprovação</h2>
|
|
72
|
-
<div className="flex flex-wrap gap-x-4 gap-y-1 text-xs text-[var(--color-dim)]" aria-hidden="true">
|
|
73
|
-
<Swatch color={SESSION}>a sessão resolveu</Swatch>
|
|
74
|
-
<Swatch color={HUMAN}>foi para você</Swatch>
|
|
75
|
-
{anyUnknown && <Swatch color={UNKNOWN}>antes do registro</Swatch>}
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
78
|
-
<div className="space-y-2.5">{rows.map((r) => <Bar key={r.gate} row={r} max={max} />)}</div>
|
|
79
|
-
{anyUnknown && (
|
|
80
|
-
<p className="text-xs text-[var(--color-faint)]">Pausas gravadas antes de o morph-spec registrar quem resolve cada uma: não entram na conta de "para você".</p>
|
|
81
|
-
)}
|
|
82
|
-
{signals.length > 0 && (
|
|
83
|
-
<table className="w-full text-sm">
|
|
84
|
-
<caption className="mb-2 text-left text-xs text-[var(--color-dim)]">O que mais te chamou</caption>
|
|
85
|
-
<thead className="text-xs text-[var(--color-faint)]">
|
|
86
|
-
<tr>
|
|
87
|
-
<th className="pb-1 text-left font-normal">motivo</th>
|
|
88
|
-
<th className="pb-1 text-left font-normal">aprovação</th>
|
|
89
|
-
<th className="pb-1 text-right font-normal">para você</th>
|
|
90
|
-
<th className="pb-1 text-right font-normal">sessão</th>
|
|
91
|
-
{anyUnknown && <th className="pb-1 text-right font-normal">antes</th>}
|
|
92
|
-
</tr>
|
|
93
|
-
</thead>
|
|
94
|
-
<tbody>
|
|
95
|
-
{signals.map((s) => (
|
|
96
|
-
<tr key={`${s.gate}:${s.signal}`} className="border-t border-[var(--color-hair)]">
|
|
97
|
-
<td className="py-1.5 text-[var(--color-fg)]" title={s.signal}>{signalLabel(s.signal)}</td>
|
|
98
|
-
<td className="py-1.5 text-[var(--color-dim)]">{GATE_LABEL[s.gate] ?? s.gate}</td>
|
|
99
|
-
<td className="py-1.5 text-right tabular-nums text-[var(--color-fg)]">{s.human}</td>
|
|
100
|
-
<td className="py-1.5 text-right tabular-nums text-[var(--color-dim)]">{s.session}</td>
|
|
101
|
-
{anyUnknown && <td className="py-1.5 text-right tabular-nums text-[var(--color-faint)]">{s.unknown}</td>}
|
|
102
|
-
</tr>
|
|
103
|
-
))}
|
|
104
|
-
</tbody>
|
|
105
|
-
</table>
|
|
106
|
-
)}
|
|
107
|
-
</div>
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export default function GatePauses({ project }) {
|
|
112
|
-
const { data, error } = useMorphQuery(`${apiBase(project)}/gates`, { scope: 'activity', project });
|
|
113
|
-
if (error) return <p className="text-sm text-[var(--color-bad)]">Não consegui ler as aprovações: {error}</p>;
|
|
114
|
-
if (!data) return <p className="text-sm text-[var(--color-faint)]">Lendo a telemetria…</p>;
|
|
115
|
-
return <GatePausesView gates={data.gates} />;
|
|
116
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import morphData from 'virtual:morph-data';
|
|
2
|
-
import Markdown from './Markdown.jsx';
|
|
3
|
-
import EntityLink, { standardKey } from './EntityLink.jsx';
|
|
4
|
-
|
|
5
|
-
const skillIds = new Set((morphData.skills || []).map((s) => s.id));
|
|
6
|
-
const personaIds = new Set((morphData.agents?.list || []).map((a) => a.id));
|
|
7
|
-
const standardByKey = new Map();
|
|
8
|
-
for (const s of morphData.standards?.list || []) {
|
|
9
|
-
standardByKey.set(s.id, s.id);
|
|
10
|
-
standardByKey.set(s.path, s.id);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function resolveMention(text) {
|
|
14
|
-
const t = String(text).trim();
|
|
15
|
-
const bare = t.replace(/^\//, '');
|
|
16
|
-
if (skillIds.has(bare)) return { kind: 'skill', id: bare };
|
|
17
|
-
const persona = /^morph-(.+)$/.exec(bare);
|
|
18
|
-
if (persona && personaIds.has(persona[1])) return { kind: 'persona', id: persona[1] };
|
|
19
|
-
const std = standardByKey.get(standardKey(t));
|
|
20
|
-
if (std) return { kind: 'standard', id: std };
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function InlineCode({ className, children, node, ...rest }) {
|
|
25
|
-
const text = Array.isArray(children) ? children.join('') : String(children ?? '');
|
|
26
|
-
const block = Boolean(className) || text.includes('\n');
|
|
27
|
-
if (!block) {
|
|
28
|
-
const hit = resolveMention(text);
|
|
29
|
-
if (hit) {
|
|
30
|
-
return (
|
|
31
|
-
<EntityLink kind={hit.kind} id={hit.id} className="no-underline">
|
|
32
|
-
<code>{text}</code>
|
|
33
|
-
</EntityLink>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return <code className={className} {...rest}>{children}</code>;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export default function KnowledgeMarkdown({ components, ...props }) {
|
|
41
|
-
return <Markdown {...props} components={{ code: InlineCode, ...components }} />;
|
|
42
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import ReactMarkdown from 'react-markdown';
|
|
2
|
-
import remarkGfm from 'remark-gfm';
|
|
3
|
-
import rehypeSlug from 'rehype-slug';
|
|
4
|
-
import { splitFrontmatter } from '../lib/format.js';
|
|
5
|
-
|
|
6
|
-
const REMARK = [remarkGfm];
|
|
7
|
-
const REHYPE = [rehypeSlug];
|
|
8
|
-
|
|
9
|
-
const META_ORDER = ['name', 'description', 'when_to_use', 'user-invocable', 'stacks', 'version', 'cliVersion'];
|
|
10
|
-
|
|
11
|
-
function MetaBlock({ meta }) {
|
|
12
|
-
const keys = Object.keys(meta).sort((a, b) => {
|
|
13
|
-
const ia = META_ORDER.indexOf(a); const ib = META_ORDER.indexOf(b);
|
|
14
|
-
return (ia === -1 ? 99 : ia) - (ib === -1 ? 99 : ib);
|
|
15
|
-
});
|
|
16
|
-
return (
|
|
17
|
-
<dl className="mb-6 grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1.5 rounded-xl bg-white/[0.03] px-4 py-3 text-sm shadow-[inset_0_0_0_1px_var(--color-hair)]">
|
|
18
|
-
{keys.map((k) => (
|
|
19
|
-
<div key={k} className="contents">
|
|
20
|
-
<dt className="font-mono text-xs leading-6 text-[var(--color-faint)]">{k}</dt>
|
|
21
|
-
<dd className="leading-6 text-[var(--color-dim)]">{meta[k] || '—'}</dd>
|
|
22
|
-
</div>
|
|
23
|
-
))}
|
|
24
|
-
</dl>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export default function Markdown({ text, components, className = '', size = 'md' }) {
|
|
29
|
-
const { meta, body } = splitFrontmatter(text || '');
|
|
30
|
-
return (
|
|
31
|
-
<article className={`prose-morph ${size === 'sm' ? 'prose-morph-sm' : ''} ${className}`}>
|
|
32
|
-
{meta && Object.keys(meta).length > 0 && <MetaBlock meta={meta} />}
|
|
33
|
-
<ReactMarkdown remarkPlugins={REMARK} rehypePlugins={REHYPE} components={components}>
|
|
34
|
-
{body}
|
|
35
|
-
</ReactMarkdown>
|
|
36
|
-
</article>
|
|
37
|
-
);
|
|
38
|
-
}
|