@polymorphism-tech/morph-spec 8.38.0 → 8.41.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 +20 -9
- 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 +4 -3
- package/framework/MORPH.md +10 -9
- package/framework/agents.json +43 -26
- package/framework/docs/CLI.md +7 -5
- package/framework/evals/rubrics/code-quality.md +4 -4
- package/framework/evals/rubrics/condensed.md +2 -2
- package/framework/hooks/README.md +1 -1
- package/framework/hooks/claude-code/core/telemetry-log.js +39 -8
- package/framework/hooks/claude-code/core/worktree-create.js +22 -6
- package/framework/hooks/shared/git-paths.js +38 -5
- package/framework/mcp/registry.json +58 -66
- 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 +59 -25
- 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 +2 -2
- package/framework/skills/core/morph-implement/SKILL.md +48 -24
- package/framework/skills/core/morph-media/SKILL.md +2 -2
- package/framework/skills/core/morph-plan/SKILL.md +10 -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 +7 -6
- package/framework/standards/PROVENANCE.json +4 -4
- package/framework/standards/STANDARDS.json +9 -9
- 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/dotnet/testing.md +4 -2
- package/framework/standards/backend/integrations/neon-auth/neon-auth.md +63 -50
- package/framework/standards/frontend/design-system/ai-image-generation.md +42 -28
- package/framework/standards/frontend/design-system/ai-video-generation.md +24 -9
- package/framework/standards/frontend/nextjs/testing.md +4 -2
- package/framework/standards/integration/mcp/mcp-tools.md +64 -126
- 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 +12 -6
- 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/commands/project/worktree.js +60 -4
- package/src/commands/state/gate-check.js +5 -0
- package/src/commands/tasks/dag.js +27 -4
- package/src/commands/validation/verify.js +22 -38
- 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/risk-detector.js +13 -0
- package/src/lib/tasks/tasks-json-parser.js +21 -0
- package/src/lib/validators/code-budget/code-budget-validator.js +32 -4
- package/src/lib/worktree/env-allocator.js +9 -3
- package/src/scripts/install-plugin.js +1 -1
- package/src/scripts/setup-infra.js +2 -4
- package/src/utils/agents-installer.js +108 -13
- 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
|
@@ -5,32 +5,26 @@
|
|
|
5
5
|
> **Keywords:** mcp, model-context-protocol, mcp-tools, context7, playwright, mcp-client
|
|
6
6
|
> **Load When:** an MCP tool is used in any morph-spec phase
|
|
7
7
|
|
|
8
|
-
**Verified against:** Claude Code MCP tooling — context7, Playwright; GitHub via `gh` CLI; Neon via `neonctl`. Last-verified: 2026-
|
|
8
|
+
**Verified against:** Claude Code 2.1.282 MCP tooling — context7, Playwright (as plugin and as a project MCP server); GitHub via `gh` CLI; Neon via its MCP or `neonctl`. Last-verified: 2026-09-24.
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
12
|
Reference for using Model Context Protocol (MCP) tools across morph-spec phases. Each phase benefits from different MCPs depending on what data is needed.
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## Tool Names Depend on Where the Server Is Configured
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
The names below use the `.mcp.json` form, `mcp__<server>__<tool>`. The same server installed as a **plugin** is named `mcp__plugin_<plugin>_<server>__<tool>`: context7 from the plugin is `mcp__plugin_context7_context7__query-docs`, not `mcp__context7__query-docs`. Call the name that exists in your session. The tool part (`query-docs`, `browser_navigate`) is the same under both prefixes.
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
In a morph persona the grant follows the same rule: the installer emits one `mcp__<name>` per spelling in the registry's `serverNames`, and a grant matches only its own spelling. If a tool you expect is missing, it may be deferred: load it with `ToolSearch` before calling it.
|
|
19
|
+
|
|
20
|
+
## MCP Availability Detection
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
// gh repo view --json name,defaultBranchRef,languages
|
|
22
|
+
Before using any MCP tool, check if it's available in the current session. There is no "list MCPs" command: attempt the most common operation, and Claude Code reports a tool that doesn't exist. GitHub and Neon are not checked this way — o morph-spec NÃO usa MCP do GitHub nem do Neon: use o `gh` CLI (`gh repo view --json name,defaultBranchRef,languages`) e o `neonctl` + `psql` (`neonctl connection-string` dá a URL do banco) via Bash.
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
await
|
|
24
|
+
```javascript
|
|
25
|
+
await mcp__context7__resolve-library-id({ libraryName: "react" });
|
|
27
26
|
|
|
28
|
-
// Playwright (browser automation)
|
|
29
27
|
await mcp__playwright__browser_navigate({ url: "https://example.com" });
|
|
30
|
-
|
|
31
|
-
// Neon — use `neonctl` CLI + `psql`
|
|
32
|
-
// neonctl connection-string → get DB URL
|
|
33
|
-
// psql <DB_URL> -c "SELECT ..."
|
|
34
28
|
```
|
|
35
29
|
|
|
36
30
|
**Fallback rule:** If an MCP is not available, every phase has a manual alternative using Claude Code native tools (Read, Grep, Glob, Bash).
|
|
@@ -61,71 +55,71 @@ gh issue list --limit 10 --json title,labels
|
|
|
61
55
|
| MCP | Use Case | Example |
|
|
62
56
|
|-----|----------|---------|
|
|
63
57
|
| **Playwright** | Navigate, screenshot, inspect live pages | `mcp__playwright__browser_navigate({ url })` |
|
|
64
|
-
| **Context7** | Component library documentation | `
|
|
58
|
+
| **Context7** | Component library documentation | `mcp__context7__query-docs({ libraryId, query })` |
|
|
59
|
+
|
|
60
|
+
The screenshot is the visual reference; the snapshot is the accessibility tree (headings, buttons, inputs); the resize tests the mobile layout; Context7 brings the component docs for the UI spec.
|
|
65
61
|
|
|
66
62
|
```javascript
|
|
67
|
-
// Screenshot existing app for design reference
|
|
68
63
|
await mcp__playwright__browser_navigate({ url: "https://app.example.com/dashboard" });
|
|
69
64
|
const screenshot = await mcp__playwright__browser_take_screenshot();
|
|
70
|
-
// → Visual reference for UI/UX design
|
|
71
65
|
|
|
72
|
-
// Inspect page structure via accessibility tree
|
|
73
66
|
const snapshot = await mcp__playwright__browser_snapshot();
|
|
74
|
-
// → Structured element tree (headings, buttons, inputs, etc.)
|
|
75
67
|
|
|
76
|
-
// Test responsive layout
|
|
77
68
|
await mcp__playwright__browser_resize({ width: 375, height: 812 });
|
|
78
69
|
const mobileScreenshot = await mcp__playwright__browser_take_screenshot();
|
|
79
70
|
|
|
80
|
-
|
|
81
|
-
const libId = await mcp__context7__resolve_library_id({
|
|
71
|
+
const libId = await mcp__context7__resolve-library-id({
|
|
82
72
|
libraryName: "mudblazor",
|
|
83
73
|
query: "data grid with sorting and filtering"
|
|
84
74
|
});
|
|
85
|
-
const docs = await
|
|
75
|
+
const docs = await mcp__context7__query-docs({
|
|
86
76
|
libraryId: libId,
|
|
87
77
|
query: "DataGrid component props and events"
|
|
88
78
|
});
|
|
89
|
-
|
|
90
|
-
// Fallback: WebSearch for component documentation
|
|
91
|
-
// WebFetch for specific component API pages
|
|
92
79
|
```
|
|
93
80
|
|
|
94
|
-
|
|
81
|
+
Fallback: WebSearch for component documentation, WebFetch for specific component API pages.
|
|
82
|
+
|
|
83
|
+
### morph-assets MCP — AI Image and Video Generation
|
|
95
84
|
|
|
96
85
|
> Available in: **UI/UX** (preview generation), **Implement** (production assets)
|
|
97
86
|
|
|
87
|
+
One MCP for image, video and local post-production, all models through OpenRouter. Default image model `openai/gpt-image-2.5-flare`; default video model `bytedance/seedance-1-5-pro` (draft/loop), final `bytedance/seedance-2.0` 1080p via `promoteFrom`. `model` accepts any OpenRouter model by id or alias; `models: [...]` compares the same request across models.
|
|
88
|
+
|
|
98
89
|
| Tool | Use Case | Example |
|
|
99
90
|
|------|----------|---------|
|
|
100
|
-
| `generate_image` | Create new image from text prompt | `
|
|
101
|
-
| `edit_image` | Modify existing image | `
|
|
102
|
-
| `continue_editing` | Iterate on last generated/edited image | `
|
|
103
|
-
| `
|
|
104
|
-
| `
|
|
91
|
+
| `generate_image` | Create new image from text prompt | `mcp__morph-assets__generate_image({ prompt, aspectRatio, outputPath })` |
|
|
92
|
+
| `edit_image` | Modify existing image | `mcp__morph-assets__edit_image({ image, prompt, references })` |
|
|
93
|
+
| `continue_editing` | Iterate on last generated/edited image | `mcp__morph-assets__continue_editing({ prompt })` |
|
|
94
|
+
| `generate_video` / `generate_loop_video` | Directional footage (`image` + `endImage`) / ambient loop | `mcp__morph-assets__generate_video({ prompt, image, endImage })` |
|
|
95
|
+
| `get_video` | Poll one or more video jobs (never resend `generate_video`) | `mcp__morph-assets__get_video({ ids })` |
|
|
96
|
+
| `media_tool` | ffmpeg post-production: scrub frames, poster, concat, compress, approval picker | `mcp__morph-assets__media_tool({ op: "scrub_frames", input })` |
|
|
97
|
+
| `library` | History and metadata (replaces `list_images` / `get_image_info` / `list_videos`) | `mcp__morph-assets__library({ op: "list" })` |
|
|
98
|
+
| `list_models` / `usage` | Pick a model from the curation / spend and credit balance | `mcp__morph-assets__usage({ op: "balance" })` |
|
|
99
|
+
|
|
100
|
+
Read `design-system.md` first to get the project colors and aesthetic direction. Keep edits short and targeted, and iterate with `continue_editing` one change at a time.
|
|
105
101
|
|
|
106
102
|
```javascript
|
|
107
|
-
|
|
108
|
-
// Read design-system.md first to get project colors and aesthetic direction
|
|
109
|
-
const image = await mcp__gemini_image_mcp__generate_image({
|
|
103
|
+
const image = await mcp__morph-assets__generate_image({
|
|
110
104
|
prompt: "A floating tablet showing a modern dashboard interface on a dark charcoal background with copper and gold accent lighting. Premium luxury aesthetic, photorealistic, cinematic lighting with warm rim light.",
|
|
111
105
|
aspectRatio: "16:9",
|
|
112
106
|
outputPath: "public/images/my-feature/hero-mockup.png"
|
|
113
107
|
});
|
|
114
108
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
imageSource: "public/images/my-feature/hero-mockup.png",
|
|
109
|
+
await mcp__morph-assets__edit_image({
|
|
110
|
+
image: "public/images/my-feature/hero-mockup.png",
|
|
118
111
|
prompt: "Make the lighting warmer and add a subtle copper glow around the tablet edges."
|
|
119
112
|
});
|
|
120
113
|
|
|
121
|
-
|
|
122
|
-
await mcp__gemini_image_mcp__continue_editing({
|
|
114
|
+
await mcp__morph-assets__continue_editing({
|
|
123
115
|
prompt: "More contrast in the shadows."
|
|
124
116
|
});
|
|
125
|
-
|
|
126
|
-
// Fallback: Manual image creation, stock photos, or placeholder divs
|
|
127
117
|
```
|
|
128
118
|
|
|
119
|
+
Paid per generation: above US$2, over the project budget or with an unknown price the tool returns `CONFIRMATION_REQUIRED` + `confirmToken` (get human approval, then repeat the same call with the token); `dryRun: true` only estimates.
|
|
120
|
+
|
|
121
|
+
Fallback: manual image creation, stock photos, or placeholder divs.
|
|
122
|
+
|
|
129
123
|
**Use cases by phase:**
|
|
130
124
|
|
|
131
125
|
| Phase | Use Case | Tool |
|
|
@@ -134,7 +128,7 @@ await mcp__gemini_image_mcp__continue_editing({
|
|
|
134
128
|
| Implement (7) | Generate production assets from assets.md specs | `generate_image` + `edit_image` |
|
|
135
129
|
| Implement (7) | Iterate on generated images for quality | `continue_editing` |
|
|
136
130
|
|
|
137
|
-
> **Standard:** See `frontend/design-system/ai-image-generation.md` for prompt engineering patterns, aspect ratio guide, and `assets.md` format.
|
|
131
|
+
> **Standard:** See `frontend/design-system/ai-image-generation.md` for prompt engineering patterns, aspect ratio guide, and `assets.md` format, and `frontend/design-system/ai-video-generation.md` for directional footage and the video cost ladder.
|
|
138
132
|
|
|
139
133
|
---
|
|
140
134
|
|
|
@@ -143,7 +137,7 @@ await mcp__gemini_image_mcp__continue_editing({
|
|
|
143
137
|
| Tool | Use Case | Example |
|
|
144
138
|
|------|----------|---------|
|
|
145
139
|
| **Neon CLI (`neonctl`) / psql** | Database schema, tables, relationships, RLS | `psql <DB_URL> -c "SELECT ..."` |
|
|
146
|
-
| **Context7** | Library docs for architecture decisions | `
|
|
140
|
+
| **Context7** | Library docs for architecture decisions | `mcp__context7__query-docs()` |
|
|
147
141
|
| **GitHub CLI (`gh`)** | Check existing code patterns, PRs | `gh search code` (Bash) |
|
|
148
142
|
|
|
149
143
|
```bash
|
|
@@ -183,26 +177,26 @@ psql $(neonctl connection-string) -c "SELECT tablename, policyname, cmd, qual FR
|
|
|
183
177
|
|
|
184
178
|
| MCP | Use Case | Example |
|
|
185
179
|
|-----|----------|---------|
|
|
186
|
-
| **Context7** | Verify library capabilities, API limits | `
|
|
180
|
+
| **Context7** | Verify library capabilities, API limits | `mcp__context7__query-docs()` |
|
|
187
181
|
| **GitHub CLI (`gh`)** | Check issue discussions, known limitations | `gh search issues` (Bash) |
|
|
188
182
|
|
|
183
|
+
The answer confirms a capability or identifies a limitation for the spec update:
|
|
184
|
+
|
|
189
185
|
```javascript
|
|
190
|
-
|
|
191
|
-
const docs = await mcp__context7__query_docs({
|
|
186
|
+
const docs = await mcp__context7__query-docs({
|
|
192
187
|
libraryId: "/mudblazor/mudblazor",
|
|
193
188
|
query: "DataGrid server-side pagination with virtual scrolling"
|
|
194
189
|
});
|
|
195
|
-
// → Confirms capability or identifies limitation for spec update
|
|
196
|
-
|
|
197
|
-
// Fallback: WebSearch for library capabilities
|
|
198
190
|
```
|
|
199
191
|
|
|
192
|
+
Fallback: WebSearch for library capabilities.
|
|
193
|
+
|
|
200
194
|
### Phase 6 (Tasks) — Planning & Organization
|
|
201
195
|
|
|
202
196
|
| Tool | Use Case | Example |
|
|
203
197
|
|------|----------|---------|
|
|
204
198
|
| **GitHub CLI (`gh`)** | Create issues from tasks, link to milestone | `gh issue create` (Bash) |
|
|
205
|
-
| **Context7** | Estimate complexity based on library docs | `
|
|
199
|
+
| **Context7** | Estimate complexity based on library docs | `mcp__context7__query-docs()` |
|
|
206
200
|
|
|
207
201
|
```bash
|
|
208
202
|
# Create GitHub issues from tasks.json (if team uses GitHub Projects)
|
|
@@ -218,7 +212,7 @@ gh issue create --title "T001: Create Entity Lead" \
|
|
|
218
212
|
|------|----------|---------|
|
|
219
213
|
| **Neon CLI (`neonctl`) / psql** | Run migrations, create RLS policies | `dotnet ef database update` |
|
|
220
214
|
| **GitHub CLI (`gh`)** | Create PR, push branches | `gh pr create` (Bash) |
|
|
221
|
-
| **Context7** | Look up API usage during coding | `
|
|
215
|
+
| **Context7** | Look up API usage during coding | `mcp__context7__query-docs()` |
|
|
222
216
|
| **Playwright** | Smoke test deployed features, verify UI | `mcp__playwright__browser_navigate()` |
|
|
223
217
|
| **Vercel** | Deploy, check logs, manage env vars | `mcp__vercel__list_projects()` |
|
|
224
218
|
| **Azure CLI** | Resource management, deployments | `az` commands |
|
|
@@ -240,35 +234,23 @@ psql $(neonctl connection-string) -c "SELECT column_name, data_type FROM informa
|
|
|
240
234
|
psql $(neonctl connection-string) -c "SELECT policyname, cmd, qual FROM pg_policies WHERE tablename = 'leads'"
|
|
241
235
|
```
|
|
242
236
|
|
|
237
|
+
Look up the API while coding, then smoke test the deployed feature: the snapshot shows whether the page renders, the console messages catch JavaScript errors and failed API calls, and the screenshot goes to `recap.md`. Vercel covers deployment status, logs and environment variables.
|
|
238
|
+
|
|
243
239
|
```javascript
|
|
244
|
-
|
|
245
|
-
const docs = await mcp__context7__query_docs({
|
|
240
|
+
const docs = await mcp__context7__query-docs({
|
|
246
241
|
libraryId: "/dotnet/efcore",
|
|
247
242
|
query: "owned entity types configuration"
|
|
248
243
|
});
|
|
249
244
|
|
|
250
|
-
// Smoke test deployed feature via browser
|
|
251
245
|
await mcp__playwright__browser_navigate({ url: "https://localhost:5001/leads" });
|
|
252
246
|
const snapshot = await mcp__playwright__browser_snapshot();
|
|
253
|
-
// → Verify page renders correctly, check for errors
|
|
254
|
-
|
|
255
|
-
// Check for console errors after deploy
|
|
256
247
|
const logs = await mcp__playwright__browser_console_messages();
|
|
257
|
-
// → Catch JavaScript errors, failed API calls
|
|
258
|
-
|
|
259
|
-
// Screenshot for recap.md documentation
|
|
260
248
|
const screenshot = await mcp__playwright__browser_take_screenshot();
|
|
261
249
|
|
|
262
|
-
// === VERCEL (Deployment & Environment) ===
|
|
263
|
-
|
|
264
|
-
// List projects
|
|
265
250
|
const projects = await mcp__vercel__list_projects();
|
|
266
|
-
|
|
267
|
-
// Check deployment status and logs
|
|
268
251
|
const deployments = await mcp__vercel__get_deployments({ projectId: 'my-project' });
|
|
269
|
-
const
|
|
252
|
+
const deploymentLogs = await mcp__vercel__get_deployment_logs({ deploymentId: deployments[0].uid });
|
|
270
253
|
|
|
271
|
-
// Manage environment variables
|
|
272
254
|
await mcp__vercel__manage_env_vars({
|
|
273
255
|
projectId: 'my-project',
|
|
274
256
|
action: 'set',
|
|
@@ -276,10 +258,10 @@ await mcp__vercel__manage_env_vars({
|
|
|
276
258
|
value: process.env.DATABASE_URL,
|
|
277
259
|
target: ['production', 'preview']
|
|
278
260
|
});
|
|
279
|
-
|
|
280
|
-
// PRs/issues: sempre `gh` CLI (Bash). Deployments fallback: vercel CLI
|
|
281
261
|
```
|
|
282
262
|
|
|
263
|
+
PRs/issues: sempre `gh` CLI (Bash). Deployments fallback: `vercel` CLI.
|
|
264
|
+
|
|
283
265
|
---
|
|
284
266
|
|
|
285
267
|
## MCP vs Native Tools Decision
|
|
@@ -296,7 +278,7 @@ await mcp__vercel__manage_env_vars({
|
|
|
296
278
|
| Container ops | Docker CLI (`docker ps`, `docker logs`, `docker compose`) | — |
|
|
297
279
|
| Cloud resources | Azure CLI (`az resource`, `az deployment`) | — |
|
|
298
280
|
| Vercel deployments | Vercel MCP | Bash `vercel` CLI |
|
|
299
|
-
| AI image generation |
|
|
281
|
+
| AI image and video generation | morph-assets MCP | Manual creation or stock photos |
|
|
300
282
|
|
|
301
283
|
**Rule:** MCP tools provide structured data (JSON responses). Native tools require manual parsing. **Always prefer MCP when available** — fall back to native when not. **Exceptions:** Neon, Docker, Azure **and GitHub** always use their respective CLIs directly — never MCP (`gh` já retorna JSON estruturado via `--json`, sem Docker nem PAT em env var).
|
|
302
284
|
|
|
@@ -306,76 +288,33 @@ await mcp__vercel__manage_env_vars({
|
|
|
306
288
|
|
|
307
289
|
### Browser (Playwright): Page Automation & Analysis
|
|
308
290
|
|
|
309
|
-
|
|
310
|
-
// === SETUP ===
|
|
311
|
-
// Playwright MCP: npx @playwright/mcp@latest
|
|
312
|
-
// Config in .claude/settings.json or claude_desktop_config.json:
|
|
313
|
-
// { "mcpServers": { "playwright": { "command": "npx", "args": ["@playwright/mcp@latest"] } } }
|
|
291
|
+
Setup: `npx @playwright/mcp@latest`, configured in `.claude/settings.json` or `claude_desktop_config.json` as `{ "mcpServers": { "playwright": { "command": "npx", "args": ["@playwright/mcp@latest"] } } }`.
|
|
314
292
|
|
|
315
|
-
|
|
293
|
+
Prefer the accessibility snapshot to the screenshot: it is structured, LLM-friendly, and returns the element `ref`s that the interaction calls take. `browser_fill_form` replaces the field's existing value; `browser_handle_dialog` answers alert, confirm and prompt.
|
|
316
294
|
|
|
317
|
-
|
|
295
|
+
```javascript
|
|
318
296
|
await mcp__playwright__browser_navigate({ url: "https://app.example.com/dashboard" });
|
|
319
|
-
|
|
320
|
-
// 2. Take accessibility snapshot (preferred — structured, LLM-friendly)
|
|
321
297
|
const snapshot = await mcp__playwright__browser_snapshot();
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
// 3. Take visual screenshot (requires --caps vision)
|
|
325
|
-
const screenshot = await mcp__playwright__browser_take_screenshot();
|
|
326
|
-
// → Returns PNG image of current page
|
|
298
|
+
const screenshot = await mcp__playwright__browser_take_screenshot(); // requires --caps vision
|
|
327
299
|
|
|
328
|
-
// === INTERACTION ===
|
|
329
|
-
|
|
330
|
-
// 4. Click an element (use ref from snapshot)
|
|
331
300
|
await mcp__playwright__browser_click({ element: "Submit button", ref: "s1e15" });
|
|
332
|
-
|
|
333
|
-
// 5. Type into an input field
|
|
334
301
|
await mcp__playwright__browser_type({ element: "Search input", ref: "s1e8", text: "query" });
|
|
335
|
-
|
|
336
|
-
// 6. Fill a form field (replaces existing value)
|
|
337
302
|
await mcp__playwright__browser_fill_form({ ref: "s1e8", value: "new value" });
|
|
338
|
-
|
|
339
|
-
// 7. Select dropdown option
|
|
340
303
|
await mcp__playwright__browser_select_option({ element: "Status", ref: "s1e12", values: ["active"] });
|
|
341
|
-
|
|
342
|
-
// 8. Press keyboard key
|
|
343
304
|
await mcp__playwright__browser_press_key({ key: "Enter" });
|
|
344
305
|
|
|
345
|
-
// === TABS & NAVIGATION ===
|
|
346
|
-
|
|
347
|
-
// 9. List open tabs
|
|
348
306
|
const tabs = await mcp__playwright__browser_tabs();
|
|
349
|
-
|
|
350
|
-
// 10. Navigate back
|
|
351
307
|
await mcp__playwright__browser_navigate_back();
|
|
352
|
-
|
|
353
|
-
// 11. Close current tab
|
|
354
308
|
await mcp__playwright__browser_close();
|
|
355
309
|
|
|
356
|
-
// === ADVANCED ===
|
|
357
|
-
|
|
358
|
-
// 12. Evaluate JavaScript in page context
|
|
359
310
|
const result = await mcp__playwright__browser_evaluate({
|
|
360
311
|
expression: "document.querySelectorAll('.error').length"
|
|
361
312
|
});
|
|
362
|
-
|
|
363
|
-
// 13. Get console messages (debug)
|
|
364
313
|
const logs = await mcp__playwright__browser_console_messages();
|
|
365
|
-
|
|
366
|
-
// 14. Get network requests
|
|
367
314
|
const requests = await mcp__playwright__browser_network_requests();
|
|
368
|
-
|
|
369
|
-
// 15. Handle dialog (alert, confirm, prompt)
|
|
370
315
|
await mcp__playwright__browser_handle_dialog({ accept: true });
|
|
371
|
-
|
|
372
|
-
//
|
|
373
|
-
await mcp__playwright__browser_resize({ width: 375, height: 812 }); // iPhone viewport
|
|
374
|
-
|
|
375
|
-
// 17. Save page as PDF (requires --caps pdf)
|
|
376
|
-
await mcp__playwright__browser_pdf_save();
|
|
377
|
-
|
|
378
|
-
// 18. Upload file
|
|
316
|
+
await mcp__playwright__browser_resize({ width: 375, height: 812 });
|
|
317
|
+
await mcp__playwright__browser_pdf_save(); // requires --caps pdf
|
|
379
318
|
await mcp__playwright__browser_file_upload({ ref: "s1e20", paths: ["/path/to/file.png"] });
|
|
380
319
|
```
|
|
381
320
|
|
|
@@ -424,16 +363,15 @@ psql $(neonctl connection-string) -c "SELECT tc.table_name, kcu.column_name, ccu
|
|
|
424
363
|
|
|
425
364
|
### Context7: Library Research
|
|
426
365
|
|
|
366
|
+
For any phase needing library documentation: resolve the library ID first, then query the specific documentation with it.
|
|
367
|
+
|
|
427
368
|
```javascript
|
|
428
|
-
|
|
429
|
-
// Step 1: Resolve library ID
|
|
430
|
-
const lib = await mcp__context7__resolve_library_id({
|
|
369
|
+
const lib = await mcp__context7__resolve-library-id({
|
|
431
370
|
libraryName: "fluent-ui-blazor",
|
|
432
371
|
query: "dialog component with form validation"
|
|
433
372
|
});
|
|
434
373
|
|
|
435
|
-
|
|
436
|
-
const docs = await mcp__context7__query_docs({
|
|
374
|
+
const docs = await mcp__context7__query-docs({
|
|
437
375
|
libraryId: lib.id,
|
|
438
376
|
query: "FluentDialog component usage with EditForm validation"
|
|
439
377
|
});
|
|
@@ -63,10 +63,8 @@ namespace {{pascalCase PROJECT_NAME}}.Abstractions
|
|
|
63
63
|
? _value!
|
|
64
64
|
: throw new InvalidOperationException("The value of a failure result can not be accessed.");
|
|
65
65
|
|
|
66
|
-
// ✅ SUCCESS implicit conversion
|
|
67
66
|
public static implicit operator Result<TValue>(TValue? value) => Create(value);
|
|
68
67
|
|
|
69
|
-
// ✅ ADD THIS (Failure implicit conversion)
|
|
70
68
|
public static implicit operator Result<TValue>(Error error)
|
|
71
69
|
=> Failure<TValue>(error);
|
|
72
70
|
}
|
|
@@ -1,39 +1,26 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// Default agent — uses the default alias from model-registry.json
|
|
28
|
-
builder.Services.AddKeyedSingleton<AIAgent>("{{DEFAULT_AGENT_NAME}}", (sp, _) =>
|
|
29
|
-
{
|
|
30
|
-
var registry = sp.GetRequiredService<ModelRegistry>();
|
|
31
|
-
var chatClient = registry.GetChatClient(registry.DefaultAlias);
|
|
32
|
-
return chatClient.AsAIAgent(
|
|
33
|
-
instructions: "{{DEFAULT_INSTRUCTIONS}}",
|
|
34
|
-
name: "{{DEFAULT_AGENT_NAME}}");
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
return builder;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
1
|
+
// READS STANDARDS: ai-agents-setup, ai-agents-providers-model-registry
|
|
2
|
+
|
|
3
|
+
using Microsoft.Agents.AI;
|
|
4
|
+
using Microsoft.Extensions.AI;
|
|
5
|
+
using Microsoft.Extensions.DependencyInjection;
|
|
6
|
+
|
|
7
|
+
namespace {{PROJECT_NAMESPACE}}.AI;
|
|
8
|
+
|
|
9
|
+
public static class AgentBootstrap
|
|
10
|
+
{
|
|
11
|
+
public static WebApplicationBuilder AddMafAgents(this WebApplicationBuilder builder)
|
|
12
|
+
{
|
|
13
|
+
builder.Services.AddSingleton<ModelRegistry>();
|
|
14
|
+
|
|
15
|
+
builder.Services.AddKeyedSingleton<AIAgent>("{{DEFAULT_AGENT_NAME}}", (sp, _) =>
|
|
16
|
+
{
|
|
17
|
+
var registry = sp.GetRequiredService<ModelRegistry>();
|
|
18
|
+
var chatClient = registry.GetChatClient(registry.DefaultAlias);
|
|
19
|
+
return chatClient.AsAIAgent(
|
|
20
|
+
instructions: "{{DEFAULT_INSTRUCTIONS}}",
|
|
21
|
+
name: "{{DEFAULT_AGENT_NAME}}");
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
return builder;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,68 +1,28 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
/// Wraps <see cref="IEmbeddingGenerator{TInput,TEmbedding}"/> so the rest of the project
|
|
30
|
-
/// does not take a direct dependency on the underlying provider SDK.
|
|
31
|
-
/// </summary>
|
|
32
|
-
public sealed class EmbeddingService(IEmbeddingGenerator<string, Embedding<float>> generator)
|
|
33
|
-
{
|
|
34
|
-
/// <summary>
|
|
35
|
-
/// Generates an embedding vector for a single text (used at query time).
|
|
36
|
-
/// </summary>
|
|
37
|
-
/// <param name="text">The text to embed.</param>
|
|
38
|
-
/// <param name="ct">Cancellation token.</param>
|
|
39
|
-
/// <returns>The embedding vector as <see cref="ReadOnlyMemory{T}"/> of float.</returns>
|
|
40
|
-
public async Task<ReadOnlyMemory<float>> EmbedAsync(
|
|
41
|
-
string text,
|
|
42
|
-
CancellationToken ct = default)
|
|
43
|
-
{
|
|
44
|
-
// GenerateAsync is the verified API: returns GeneratedEmbeddings<Embedding<float>>.
|
|
45
|
-
// Each Embedding<float>.Vector is a ReadOnlyMemory<float>.
|
|
46
|
-
// Source: Microsoft Learn — microsoft-extensions-ai (verified 2026-05-19).
|
|
47
|
-
GeneratedEmbeddings<Embedding<float>> result =
|
|
48
|
-
await generator.GenerateAsync([text], cancellationToken: ct);
|
|
49
|
-
|
|
50
|
-
return result[0].Vector;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/// <summary>
|
|
54
|
-
/// Generates embedding vectors for a batch of texts (used during document indexing).
|
|
55
|
-
/// </summary>
|
|
56
|
-
/// <param name="texts">The texts to embed.</param>
|
|
57
|
-
/// <param name="ct">Cancellation token.</param>
|
|
58
|
-
/// <returns>Embedding vectors in the same order as the input texts.</returns>
|
|
59
|
-
public async Task<IReadOnlyList<ReadOnlyMemory<float>>> EmbedBatchAsync(
|
|
60
|
-
IReadOnlyList<string> texts,
|
|
61
|
-
CancellationToken ct = default)
|
|
62
|
-
{
|
|
63
|
-
GeneratedEmbeddings<Embedding<float>> result =
|
|
64
|
-
await generator.GenerateAsync(texts, cancellationToken: ct);
|
|
65
|
-
|
|
66
|
-
return [.. result.Select(e => e.Vector)];
|
|
67
|
-
}
|
|
68
|
-
}
|
|
1
|
+
// READS STANDARD: ai-agents-rag-custom-pgvector
|
|
2
|
+
|
|
3
|
+
using Microsoft.Extensions.AI;
|
|
4
|
+
|
|
5
|
+
namespace {{PROJECT_NAMESPACE}}.AI;
|
|
6
|
+
|
|
7
|
+
public sealed class EmbeddingService(IEmbeddingGenerator<string, Embedding<float>> generator)
|
|
8
|
+
{
|
|
9
|
+
public async Task<ReadOnlyMemory<float>> EmbedAsync(
|
|
10
|
+
string text,
|
|
11
|
+
CancellationToken ct = default)
|
|
12
|
+
{
|
|
13
|
+
GeneratedEmbeddings<Embedding<float>> result =
|
|
14
|
+
await generator.GenerateAsync([text], cancellationToken: ct);
|
|
15
|
+
|
|
16
|
+
return result[0].Vector;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public async Task<IReadOnlyList<ReadOnlyMemory<float>>> EmbedBatchAsync(
|
|
20
|
+
IReadOnlyList<string> texts,
|
|
21
|
+
CancellationToken ct = default)
|
|
22
|
+
{
|
|
23
|
+
GeneratedEmbeddings<Embedding<float>> result =
|
|
24
|
+
await generator.GenerateAsync(texts, cancellationToken: ct);
|
|
25
|
+
|
|
26
|
+
return [.. result.Select(e => e.Vector)];
|
|
27
|
+
}
|
|
28
|
+
}
|