@polymorphism-tech/morph-spec 8.38.0 → 8.40.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 +19 -8
- package/README.md +2 -2
- package/bin/morph-spec.js +60 -43
- package/claude-plugin.json +1 -1
- package/docs/CHEATSHEET.md +1 -1
- package/docs/QUICKSTART.md +1 -1
- package/framework/CLAUDE.md +3 -2
- package/framework/MORPH.md +1 -1
- package/framework/agents.json +36 -25
- package/framework/docs/CLI.md +2 -2
- package/framework/evals/rubrics/code-quality.md +4 -4
- package/framework/evals/rubrics/condensed.md +2 -2
- package/framework/mcp/registry.json +33 -2
- package/framework/rules/infrastructure-standards.md +0 -1
- package/framework/rules/morph-workflow.md +9 -4
- 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 +5 -1
- package/framework/skills/core/morph-brainstorming/SKILL.md +1 -1
- package/framework/skills/core/morph-eval/SKILL.md +1 -1
- package/framework/skills/core/morph-hotfix/SKILL.md +1 -1
- package/framework/skills/core/morph-implement/SKILL.md +6 -1
- package/framework/skills/core/morph-media/SKILL.md +1 -1
- package/framework/skills/core/morph-plan/SKILL.md +4 -3
- package/framework/skills/core/morph-proposal/SKILL.md +1 -1
- package/framework/skills/core/morph-review/SKILL.md +1 -1
- package/framework/skills/core/morph-stack-scan/SKILL.md +1 -1
- package/framework/skills/core/morph-standards/SKILL.md +1 -1
- package/framework/skills/core/morph-uiux/SKILL.md +6 -5
- package/framework/standards/STANDARDS.json +3 -3
- package/framework/standards/ai-agents/context-providers.md +16 -26
- package/framework/standards/ai-agents/durable-workflows-hitl.md +15 -21
- package/framework/standards/ai-agents/modalities-image-gen.md +21 -25
- package/framework/standards/ai-agents/modalities-speech-to-text.md +4 -15
- package/framework/standards/ai-agents/modalities-text-to-speech.md +2 -11
- package/framework/standards/ai-agents/modalities-vision.md +1 -18
- package/framework/standards/ai-agents/prompt-sources.md +0 -4
- package/framework/standards/architecture/code-comments.md +52 -16
- package/framework/standards/backend/integrations/neon-auth/neon-auth.md +63 -50
- package/framework/standards/frontend/design-system/ai-image-generation.md +5 -5
- package/framework/standards/integration/mcp/mcp-tools.md +48 -117
- package/framework/templates/code/dotnet/abstractions/result.cs +0 -2
- package/framework/templates/code/dotnet/ai-agents/AgentBootstrap.cs.template +26 -39
- package/framework/templates/code/dotnet/ai-agents/EmbeddingService.cs.template +28 -68
- package/framework/templates/code/dotnet/ai-agents/ModelRegistry.cs.template +99 -117
- package/framework/templates/code/dotnet/ai-agents/PromptRepository.cs.template +2 -44
- package/framework/templates/code/dotnet/ai-agents/ResilientToolMiddleware.cs.template +40 -61
- package/framework/templates/code/dotnet/ai-agents/VectorSearchTool.cs.template +54 -107
- package/framework/templates/code/dotnet/ai-agents/model-registry.json.template +53 -58
- package/framework/templates/code/dotnet/contracts/contracts-vsa.cs +192 -281
- package/framework/templates/code/dotnet/database/migration.cs +49 -83
- package/framework/templates/code/dotnet/database/vector-entity.cs +2 -46
- package/framework/templates/code/dotnet/extensions/result-extensions.cs +0 -2
- package/framework/templates/code/dotnet/feature/validator.cs.hbs +11 -15
- package/framework/templates/code/dotnet/jobs/agent.cs +3 -51
- package/framework/templates/code/dotnet/jobs/job.cs +2 -97
- package/framework/templates/code/dotnet/test.cs +2 -87
- package/framework/templates/code/typescript/contracts.ts +140 -167
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Agents/AgentApi.cs +1 -48
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Agents/AgentFactory.cs +3 -79
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Agents/AgentFactoryOptions.cs +1 -70
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Agents/AgentSpec.cs +1 -47
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Agents/AgentSpecOptions.cs +2 -99
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/AiKitAssemblyMarker.cs +0 -6
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Conversation/ConversationStore.cs +3 -88
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Conversation/IConversationStore.cs +1 -41
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Conversation/InMemoryConversationStore.cs +0 -21
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/CountingChatClient.cs +1 -25
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalAssertion.cs +2 -63
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalCacheMissException.cs +0 -30
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalCacheOptions.cs +1 -52
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalCacheStamp.cs +3 -78
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalFixture.cs +4 -109
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalMode.cs +0 -22
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalQualityEvaluators.cs +1 -36
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalScenario.cs +2 -57
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/EvalSummary.cs +0 -75
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/OfflineChatClient.cs +2 -59
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Evals/ShortPathResponseCache.cs +4 -111
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/IMediaGenerator.cs +0 -34
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/IMediaProvider.cs +1 -57
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaArtifact.cs +0 -19
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaDisclosure.cs +2 -74
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaGenerator.cs +2 -33
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaIdempotencyKey.cs +1 -43
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaJob.cs +1 -96
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaJobId.cs +0 -13
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaJobState.cs +0 -27
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaPricing.cs +0 -33
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaProvenance.cs +0 -31
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaRequest.cs +3 -75
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaResult.cs +0 -42
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaReview.cs +0 -39
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaSeams.cs +1 -55
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MediaStore.cs +3 -59
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/MorphMedia.cs +0 -46
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/Providers/GoogleImageProvider.cs +3 -28
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/Providers/OpenAIImageProvider.cs +7 -61
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Media/Providers/VeoVideoProvider.cs +2 -37
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Middleware/IUsageCostSink.cs +1 -23
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Middleware/UsageCostMiddleware.cs +2 -82
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Middleware/UsageCostRecord.cs +1 -68
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Observability/MorphOpenTelemetryExtensions.cs +1 -62
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Observability/MorphTelemetryOptions.cs +2 -62
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Providers/IProviderClientFactory.cs +1 -25
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Providers/ModelAlias.cs +0 -124
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Providers/ModelRegistry.cs +1 -73
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Rag/DeltaIngest.cs +1 -66
- package/framework/templates/dotnet/ai-kit/src/Morph.AiKit/Rag/DeltaPlan.cs +0 -41
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/AgentFactoryTests.cs +2 -112
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/AgentSpecTests.cs +2 -43
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/ConversationStoreTests.cs +5 -110
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/DeltaIngestTests.cs +7 -103
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/EvalAssertionTests.cs +1 -42
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/EvalCacheMissTests.cs +1 -30
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/EvalCacheStampTests.cs +1 -19
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/EvalFailuresTests.cs +0 -48
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/EvalFixtureTests.cs +1 -29
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/EvalRefreshTests.cs +2 -38
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/EvalWorkspace.cs +1 -14
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/KitEvals.cs +4 -69
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Evals/OfflineChatClientTests.cs +1 -10
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Fakes/FakeChatClient.cs +1 -57
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Fakes/FakeChatClientTests.cs +0 -26
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Fakes/FakeClock.cs +1 -19
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Fakes/FakeMediaProvider.cs +0 -32
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Fakes/FakeProviderClientFactory.cs +0 -14
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Fakes/FakeUsageCostSink.cs +0 -24
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/Fakes/InMemoryMediaStore.cs +0 -32
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaAccessibilityTests.cs +0 -37
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaAliasIsNotAnAgentTests.cs +0 -24
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaDisclosureTests.cs +0 -78
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaGeneratorTests.cs +0 -53
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaIdempotencyKeyTests.cs +0 -44
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaJobStateTests.cs +0 -44
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaReviewTests.cs +0 -19
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/MediaStoreTests.cs +0 -24
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/ModelRegistryTests.cs +6 -48
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/SkeletonSmokeTests.cs +1 -13
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/TelemetryTests.cs +2 -71
- package/framework/templates/dotnet/ai-kit/tests/Morph.AiKit.Tests/UsageCostMiddlewareTests.cs +5 -100
- package/framework/templates/frontend/nextjs/Dockerfile.nextjs.hbs +39 -43
- package/framework/templates/frontend/nextjs/env.mjs.hbs +29 -32
- package/framework/templates/frontend/nextjs/page.tsx.hbs +21 -22
- package/framework/templates/frontend/nextjs/use-feature.ts.hbs +42 -54
- package/framework/templates/integrations/asaas-client.cs +332 -387
- package/framework/templates/integrations/asaas-webhook.cs +290 -351
- package/framework/templates/integrations/neon-auth-config.cs +9 -105
- package/framework/templates/project/validate.js +97 -120
- package/package.json +2 -2
- package/src/commands/dashboard/dashboard.js +80 -53
- package/src/commands/mcp/mcp-setup.js +37 -9
- package/src/commands/project/doctor.js +3 -5
- package/src/commands/project/init.js +6 -3
- package/src/commands/project/install-plugin-cmd.js +1 -1
- package/src/commands/project/update.js +5 -0
- package/src/dashboard/app/App.jsx +80 -16
- package/src/dashboard/app/components/ActivityFeed.jsx +172 -0
- package/src/dashboard/app/components/CommandPalette.jsx +155 -0
- package/src/dashboard/app/components/DetailPanel.jsx +47 -11
- package/src/dashboard/app/components/EntityLink.jsx +55 -0
- package/src/dashboard/app/components/ErrorBoundary.jsx +54 -0
- package/src/dashboard/app/components/FlowGraph.jsx +19 -17
- package/src/dashboard/app/components/KnowledgeMarkdown.jsx +53 -0
- package/src/dashboard/app/components/Markdown.jsx +47 -0
- package/src/dashboard/app/components/PhaseRail.jsx +111 -0
- package/src/dashboard/app/components/SearchFilter.jsx +40 -22
- package/src/dashboard/app/components/Sidebar.jsx +146 -37
- package/src/dashboard/app/hooks/useMorphQuery.js +54 -0
- package/src/dashboard/app/hooks/usePref.js +38 -0
- package/src/dashboard/app/lib/format.js +69 -0
- package/src/dashboard/app/lib/phases.js +56 -0
- package/src/dashboard/app/lib/project.js +50 -0
- package/src/dashboard/app/pages/Activity.jsx +24 -0
- package/src/dashboard/app/pages/AgentMap.jsx +371 -370
- package/src/dashboard/app/pages/FeatureDetail.jsx +604 -0
- package/src/dashboard/app/pages/Features.jsx +400 -0
- package/src/dashboard/app/pages/Guide.jsx +146 -0
- package/src/dashboard/app/pages/HookInspector.jsx +357 -322
- package/src/dashboard/app/pages/PhasePipeline.jsx +277 -408
- package/src/dashboard/app/pages/Portfolio.jsx +156 -0
- package/src/dashboard/app/pages/Rubrics.jsx +101 -0
- package/src/dashboard/app/pages/RulesMap.jsx +300 -273
- package/src/dashboard/app/pages/SkillsLibrary.jsx +483 -366
- package/src/dashboard/app/pages/Standards.jsx +407 -332
- package/src/dashboard/app/styles/index.css +187 -47
- package/src/dashboard/index.html +14 -12
- package/src/dashboard/package.json +32 -24
- package/src/dashboard/scanner/activity-scanner.js +351 -0
- package/src/dashboard/scanner/agents-scanner.js +59 -1
- package/src/dashboard/scanner/docs-scanner.js +59 -0
- package/src/dashboard/scanner/feature-status.js +10 -0
- package/src/dashboard/scanner/features-scanner.js +360 -0
- package/src/dashboard/scanner/index.js +14 -7
- package/src/dashboard/scanner/phases-scanner.js +14 -15
- package/src/dashboard/scanner/portfolio.js +153 -0
- package/src/dashboard/scanner/project-api.js +195 -0
- package/src/dashboard/scanner/rules-scanner.js +42 -37
- package/src/dashboard/scanner/skills-scanner.js +105 -43
- package/src/dashboard/scanner/standards-scanner.js +2 -0
- package/src/dashboard/vite-plugin-morph-data.js +134 -17
- package/src/lib/detectors/claude-config-detector.js +2 -7
- package/src/lib/detectors/index.js +5 -1
- package/src/lib/evaluator-report.js +22 -0
- package/src/lib/generators/settings-generator.js +208 -209
- package/src/lib/installers/mcp-installer.js +724 -719
- package/src/lib/installers/memory-installer.js +1 -2
- package/src/lib/projects/registry.js +154 -0
- package/src/lib/validators/code-budget/code-budget-validator.js +32 -4
- package/src/scripts/install-plugin.js +1 -1
- package/src/scripts/setup-infra.js +2 -4
- package/src/utils/agents-installer.js +57 -12
- package/src/utils/banner.js +1 -1
- package/src/commands/index.js +0 -13
- package/src/commands/project/checkpoint.js +0 -209
- package/src/core/state/phase-state-machine.js +0 -197
- package/src/dashboard/app/hooks/useDetailPanel.js +0 -15
- package/src/dashboard/app/pages/LiveState.jsx +0 -206
- package/src/dashboard/scanner/squads-scanner.js +0 -13
- package/src/dashboard/scanner/state-scanner.js +0 -85
- package/src/lib/generators/index.js +0 -10
- package/src/lib/hooks/hook-executor.js +0 -167
- package/src/lib/validators/checkpoint-persistence.js +0 -39
- package/src/lib/validators/shared/emit-validator-dispatch.js +0 -14
- package/src/lib/validators/shared/index.js +0 -12
- package/src/lib/validators/shared/issue-counter.js +0 -14
- package/src/lib/validators/shared/result-formatter.js +0 -124
|
@@ -1,273 +1,300 @@
|
|
|
1
|
-
import { useState, useMemo, useCallback } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
boxShadow: data.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
);
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
1
|
+
import { useState, useMemo, useCallback } from 'react';
|
|
2
|
+
import { useNavigate } from 'react-router-dom';
|
|
3
|
+
import { Handle, Position } from '@xyflow/react';
|
|
4
|
+
import morphData from 'virtual:morph-data';
|
|
5
|
+
import FlowGraph from '../components/FlowGraph.jsx';
|
|
6
|
+
import DetailPanel from '../components/DetailPanel.jsx';
|
|
7
|
+
import SearchFilter from '../components/SearchFilter.jsx';
|
|
8
|
+
import Markdown from '../components/Markdown.jsx';
|
|
9
|
+
import EntityLink, { useSelection, standardKey } from '../components/EntityLink.jsx';
|
|
10
|
+
|
|
11
|
+
const RULE_COLOR = 'var(--color-phase-plan)';
|
|
12
|
+
const STD_COLOR = 'var(--color-phase-proposal)';
|
|
13
|
+
const NODE_W = 260;
|
|
14
|
+
|
|
15
|
+
// ─── Standard resolution ──────────────────────────────────────────────────────
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A rule's @-import → the standard it names in the registry. `id` is what the
|
|
19
|
+
* Standards page selects by; with no registry match the path itself is passed,
|
|
20
|
+
* so the link still says which file the rule meant.
|
|
21
|
+
*/
|
|
22
|
+
function resolveStandard(ref, byPath) {
|
|
23
|
+
const path = standardKey(ref);
|
|
24
|
+
const std = byPath.get(path);
|
|
25
|
+
return {
|
|
26
|
+
path,
|
|
27
|
+
id: std?.id ?? path,
|
|
28
|
+
name: std?.name ?? path.replace(/\.md$/, '').split('/').pop(),
|
|
29
|
+
known: Boolean(std),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// ─── Node Components ──────────────────────────────────────────────────────────
|
|
34
|
+
|
|
35
|
+
function RuleNode({ data }) {
|
|
36
|
+
return (
|
|
37
|
+
<div
|
|
38
|
+
className="cursor-pointer select-none rounded-xl bg-[var(--color-raised)] px-3.5 py-2.5 transition-opacity"
|
|
39
|
+
style={{
|
|
40
|
+
width: NODE_W,
|
|
41
|
+
boxShadow: data.selected
|
|
42
|
+
? `inset 0 0 0 1.5px ${RULE_COLOR}`
|
|
43
|
+
: 'inset 0 0 0 1px var(--color-hair-strong)',
|
|
44
|
+
opacity: data.dimmed ? 0.3 : 1,
|
|
45
|
+
}}
|
|
46
|
+
>
|
|
47
|
+
<Handle type="source" position={Position.Right} style={{ background: RULE_COLOR, width: 7, height: 7, border: 'none' }} />
|
|
48
|
+
<div className="truncate text-[13px] font-medium leading-snug text-[var(--color-fg)]" title={data.label}>
|
|
49
|
+
{data.label}
|
|
50
|
+
</div>
|
|
51
|
+
<div className="mt-0.5 truncate text-xs text-[var(--color-dim)]">
|
|
52
|
+
{data.pathCount} {data.pathCount === 1 ? 'padrão de arquivo' : 'padrões de arquivo'}
|
|
53
|
+
{data.stacks.length > 0 ? ` · ${data.stacks.join(', ')}` : ''}
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function StandardRefNode({ data }) {
|
|
60
|
+
return (
|
|
61
|
+
<div
|
|
62
|
+
className="cursor-pointer select-none rounded-xl bg-[var(--color-core)] px-3.5 py-2.5 transition-opacity"
|
|
63
|
+
style={{
|
|
64
|
+
width: NODE_W,
|
|
65
|
+
boxShadow: `inset 0 0 0 1px ${data.known ? 'var(--color-hair-strong)' : 'var(--color-hair)'}`,
|
|
66
|
+
opacity: data.dimmed ? 0.3 : 1,
|
|
67
|
+
}}
|
|
68
|
+
title={data.known ? `Abrir o standard ${data.path}` : `${data.path} (não está no registro de standards)`}
|
|
69
|
+
>
|
|
70
|
+
<Handle type="target" position={Position.Left} style={{ background: STD_COLOR, width: 7, height: 7, border: 'none' }} />
|
|
71
|
+
<div className="truncate text-[13px] font-medium leading-snug" style={{ color: STD_COLOR }}>
|
|
72
|
+
{data.label}
|
|
73
|
+
</div>
|
|
74
|
+
<div className="mt-0.5 truncate font-mono text-xs text-[var(--color-faint)]">{data.path}</div>
|
|
75
|
+
</div>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const nodeTypes = { ruleNode: RuleNode, standardRefNode: StandardRefNode };
|
|
80
|
+
|
|
81
|
+
// ─── Graph Builder ────────────────────────────────────────────────────────────
|
|
82
|
+
|
|
83
|
+
function matchesFilter(rule, search, stackFilter) {
|
|
84
|
+
const q = search.toLowerCase();
|
|
85
|
+
const matchSearch = !q || rule.name.toLowerCase().includes(q) || rule.stacks.some((s) => s.toLowerCase().includes(q));
|
|
86
|
+
const matchStack = !stackFilter || rule.stacks.includes(stackFilter);
|
|
87
|
+
return matchSearch && matchStack;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function buildGraph(rules, byPath, search, stackFilter, selected) {
|
|
91
|
+
const nodes = [];
|
|
92
|
+
const edges = [];
|
|
93
|
+
const RULE_X = 0;
|
|
94
|
+
const STD_X = NODE_W + 180;
|
|
95
|
+
const ROW_H = 78;
|
|
96
|
+
|
|
97
|
+
const hasFilter = Boolean(search || stackFilter);
|
|
98
|
+
const visible = new Set(rules.filter((r) => matchesFilter(r, search, stackFilter)).map((r) => r.name));
|
|
99
|
+
const isDimmed = (rule) => hasFilter && !visible.has(rule.name);
|
|
100
|
+
|
|
101
|
+
// A standard stays lit while at least one lit rule imports it.
|
|
102
|
+
const refs = new Map();
|
|
103
|
+
for (const rule of rules) {
|
|
104
|
+
for (const ref of rule.standardRefs) {
|
|
105
|
+
const entry = refs.get(ref) || { lit: false };
|
|
106
|
+
if (!isDimmed(rule)) entry.lit = true;
|
|
107
|
+
refs.set(ref, entry);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
rules.forEach((rule, i) => {
|
|
112
|
+
nodes.push({
|
|
113
|
+
id: `rule-${rule.name}`,
|
|
114
|
+
type: 'ruleNode',
|
|
115
|
+
position: { x: RULE_X, y: i * ROW_H },
|
|
116
|
+
data: {
|
|
117
|
+
label: rule.name,
|
|
118
|
+
ruleName: rule.name,
|
|
119
|
+
pathCount: rule.paths.length,
|
|
120
|
+
stacks: rule.stacks,
|
|
121
|
+
dimmed: isDimmed(rule),
|
|
122
|
+
selected: rule.name === selected,
|
|
123
|
+
color: '#e0af68',
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const refList = [...refs.keys()];
|
|
129
|
+
const offset = (rules.length * ROW_H - refList.length * ROW_H) / 2;
|
|
130
|
+
refList.forEach((ref, i) => {
|
|
131
|
+
const std = resolveStandard(ref, byPath);
|
|
132
|
+
nodes.push({
|
|
133
|
+
id: `std-${ref}`,
|
|
134
|
+
type: 'standardRefNode',
|
|
135
|
+
position: { x: STD_X, y: i * ROW_H + offset },
|
|
136
|
+
data: { label: std.name, path: std.path, standardId: std.id, known: std.known, dimmed: !refs.get(ref).lit, color: '#7aa2f7' },
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
for (const rule of rules) {
|
|
141
|
+
const dim = isDimmed(rule);
|
|
142
|
+
for (const ref of rule.standardRefs) {
|
|
143
|
+
edges.push({
|
|
144
|
+
id: `edge-${rule.name}-${ref}`,
|
|
145
|
+
source: `rule-${rule.name}`,
|
|
146
|
+
target: `std-${ref}`,
|
|
147
|
+
type: 'smoothstep',
|
|
148
|
+
style: { stroke: dim ? '#2a303b' : '#e0af68', strokeWidth: rule.name === selected ? 2 : 1.2, opacity: dim ? 0.3 : 0.6 },
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return { nodes, edges };
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// ─── Detail Content ───────────────────────────────────────────────────────────
|
|
157
|
+
|
|
158
|
+
function Section({ title, children }) {
|
|
159
|
+
return (
|
|
160
|
+
<section>
|
|
161
|
+
<h3 className="mb-2 text-xs font-medium text-[var(--color-faint)]">{title}</h3>
|
|
162
|
+
{children}
|
|
163
|
+
</section>
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function RuleDetail({ rule, byPath }) {
|
|
168
|
+
return (
|
|
169
|
+
<div className="space-y-6 text-sm text-[var(--color-dim)]">
|
|
170
|
+
<p className="leading-relaxed">
|
|
171
|
+
Regra do Claude Code: carregada quando o Claude edita arquivos que casam com um dos padrões abaixo, e traz junto
|
|
172
|
+
os standards que ela importa.
|
|
173
|
+
</p>
|
|
174
|
+
|
|
175
|
+
<Section title="Padrões de arquivo">
|
|
176
|
+
{rule.paths.length > 0 ? (
|
|
177
|
+
<div className="space-y-1">
|
|
178
|
+
{rule.paths.map((p) => (
|
|
179
|
+
<code key={p} className="block rounded-lg bg-white/[0.03] px-2.5 py-1.5 font-mono text-xs text-[var(--color-fg)] shadow-[inset_0_0_0_1px_var(--color-hair)]">{p}</code>
|
|
180
|
+
))}
|
|
181
|
+
</div>
|
|
182
|
+
) : (
|
|
183
|
+
<p className="text-xs">Nenhum padrão declarado: a regra vale para qualquer arquivo.</p>
|
|
184
|
+
)}
|
|
185
|
+
</Section>
|
|
186
|
+
|
|
187
|
+
<Section title="Stacks">
|
|
188
|
+
{rule.stacks.length > 0 ? (
|
|
189
|
+
<div className="flex flex-wrap gap-1.5">
|
|
190
|
+
{rule.stacks.map((s) => (
|
|
191
|
+
<span key={s} className="rounded-full px-2 py-0.5 font-mono text-[11px] text-[var(--color-ok)] shadow-[inset_0_0_0_1px_var(--color-hair)]">{s}</span>
|
|
192
|
+
))}
|
|
193
|
+
</div>
|
|
194
|
+
) : (
|
|
195
|
+
<p className="text-xs">Instalada em qualquer stack.</p>
|
|
196
|
+
)}
|
|
197
|
+
</Section>
|
|
198
|
+
|
|
199
|
+
<Section title="Standards importados">
|
|
200
|
+
{rule.standardRefs.length > 0 ? (
|
|
201
|
+
<div className="flex flex-wrap gap-1.5">
|
|
202
|
+
{rule.standardRefs.map((ref) => {
|
|
203
|
+
const std = resolveStandard(ref, byPath);
|
|
204
|
+
return (
|
|
205
|
+
<EntityLink key={ref} kind="standard" id={std.id} chip title={std.path}>
|
|
206
|
+
{std.name}
|
|
207
|
+
</EntityLink>
|
|
208
|
+
);
|
|
209
|
+
})}
|
|
210
|
+
</div>
|
|
211
|
+
) : (
|
|
212
|
+
<p className="text-xs">Esta regra não importa nenhum standard.</p>
|
|
213
|
+
)}
|
|
214
|
+
</Section>
|
|
215
|
+
|
|
216
|
+
<Section title="Conteúdo">
|
|
217
|
+
<p className="mb-3 font-mono text-xs text-[var(--color-faint)]">{rule.filename}</p>
|
|
218
|
+
<Markdown text={rule.content} size="sm" />
|
|
219
|
+
</Section>
|
|
220
|
+
</div>
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// ─── Main Page ────────────────────────────────────────────────────────────────
|
|
225
|
+
|
|
226
|
+
/** `?sel=` holds the rule `name` (the file name without `.md`). */
|
|
227
|
+
export default function RulesMap() {
|
|
228
|
+
const { rules } = morphData;
|
|
229
|
+
const [search, setSearch] = useState('');
|
|
230
|
+
const [stackFilter, setStackFilter] = useState('');
|
|
231
|
+
const [sel, setSel] = useSelection();
|
|
232
|
+
const navigate = useNavigate();
|
|
233
|
+
|
|
234
|
+
const byPath = useMemo(
|
|
235
|
+
() => new Map((morphData.standards?.list || []).map((s) => [s.path, s])),
|
|
236
|
+
[]
|
|
237
|
+
);
|
|
238
|
+
|
|
239
|
+
const allStacks = useMemo(() => [...new Set(rules.flatMap((r) => r.stacks))].sort(), [rules]);
|
|
240
|
+
|
|
241
|
+
const selectedRule = rules.find((r) => r.name === sel) || null;
|
|
242
|
+
|
|
243
|
+
const { nodes, edges } = useMemo(
|
|
244
|
+
() => buildGraph(rules, byPath, search, stackFilter, selectedRule?.name),
|
|
245
|
+
[rules, byPath, search, stackFilter, selectedRule]
|
|
246
|
+
);
|
|
247
|
+
|
|
248
|
+
const handleNodeClick = useCallback((_event, node) => {
|
|
249
|
+
if (node.type === 'ruleNode') setSel(node.data.ruleName);
|
|
250
|
+
else if (node.type === 'standardRefNode') navigate(`/standards?sel=${encodeURIComponent(node.data.standardId)}`);
|
|
251
|
+
}, [setSel, navigate]);
|
|
252
|
+
|
|
253
|
+
const closePanel = useCallback(() => setSel(null), [setSel]);
|
|
254
|
+
|
|
255
|
+
const filterConfig = [{ name: 'stack', label: 'Stack', options: allStacks, value: stackFilter }];
|
|
256
|
+
|
|
257
|
+
return (
|
|
258
|
+
<div className="flex h-full flex-col">
|
|
259
|
+
<SearchFilter
|
|
260
|
+
placeholder="Buscar regra por nome ou stack"
|
|
261
|
+
filters={filterConfig}
|
|
262
|
+
onSearchChange={setSearch}
|
|
263
|
+
onFilterChange={(name, value) => { if (name === 'stack') setStackFilter(value); }}
|
|
264
|
+
/>
|
|
265
|
+
|
|
266
|
+
<div className="relative flex-1">
|
|
267
|
+
<FlowGraph nodes={nodes} edges={edges} nodeTypes={nodeTypes} onNodeClick={handleNodeClick} fitView />
|
|
268
|
+
|
|
269
|
+
<div className="absolute left-3 top-3 z-10 space-y-2 rounded-xl bg-[var(--color-ink)]/85 p-3 text-xs shadow-[inset_0_0_0_1px_var(--color-hair)] backdrop-blur">
|
|
270
|
+
<p className="mb-1 text-[var(--color-faint)]">Legenda</p>
|
|
271
|
+
<div className="flex items-center gap-2">
|
|
272
|
+
<span className="inline-block h-3.5 w-3.5 rounded bg-[var(--color-raised)] shadow-[inset_0_0_0_1px_var(--color-hair-strong)]" />
|
|
273
|
+
<span className="text-[var(--color-dim)]">Regra (clique para ler)</span>
|
|
274
|
+
</div>
|
|
275
|
+
<div className="flex items-center gap-2">
|
|
276
|
+
<span className="inline-block h-3.5 w-3.5 rounded" style={{ background: 'var(--color-core)', boxShadow: `inset 0 0 0 1px ${STD_COLOR}` }} />
|
|
277
|
+
<span className="text-[var(--color-dim)]">Standard importado (clique para abrir)</span>
|
|
278
|
+
</div>
|
|
279
|
+
<div className="flex items-center gap-2">
|
|
280
|
+
<span className="inline-block w-5 border-t" style={{ borderColor: RULE_COLOR, opacity: 0.7 }} />
|
|
281
|
+
<span className="text-[var(--color-dim)]">importa</span>
|
|
282
|
+
</div>
|
|
283
|
+
</div>
|
|
284
|
+
|
|
285
|
+
<div className="absolute right-3 top-3 z-10 rounded-full bg-[var(--color-ink)]/85 px-3 py-1.5 text-xs text-[var(--color-dim)] shadow-[inset_0_0_0_1px_var(--color-hair)] backdrop-blur">
|
|
286
|
+
{rules.length} {rules.length === 1 ? 'regra' : 'regras'}
|
|
287
|
+
</div>
|
|
288
|
+
</div>
|
|
289
|
+
|
|
290
|
+
<DetailPanel
|
|
291
|
+
open={Boolean(selectedRule)}
|
|
292
|
+
title={selectedRule?.name ?? ''}
|
|
293
|
+
subtitle={selectedRule ? 'Regra do Claude Code' : undefined}
|
|
294
|
+
onClose={closePanel}
|
|
295
|
+
>
|
|
296
|
+
{selectedRule && <RuleDetail rule={selectedRule} byPath={byPath} />}
|
|
297
|
+
</DetailPanel>
|
|
298
|
+
</div>
|
|
299
|
+
);
|
|
300
|
+
}
|