@contractspec/bundle.library 3.8.11 → 3.9.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/.turbo/turbo-build.log +290 -282
- package/CHANGELOG.md +68 -0
- package/dist/application/index.js +11 -11
- package/dist/application/mcp/cliMcp.js +6 -6
- package/dist/application/mcp/cliMcp.onboarding.d.ts +4 -0
- package/dist/application/mcp/cliMcp.onboarding.js +2 -0
- package/dist/application/mcp/cliMcp.test.d.ts +1 -0
- package/dist/application/mcp/contractsMcp.js +2 -2
- package/dist/application/mcp/contractsMcp.test.d.ts +1 -0
- package/dist/application/mcp/contractsMcpAdoptionTools.d.ts +3 -0
- package/dist/application/mcp/contractsMcpAdoptionTools.js +2 -0
- package/dist/application/mcp/contractsMcpResources.js +1 -1
- package/dist/application/mcp/contractsMcpTools.js +1 -1
- package/dist/application/mcp/contractsMcpTypes.d.ts +16 -0
- package/dist/application/mcp/index.js +11 -11
- package/dist/components/docs/DocsIndexPage.js +1 -1
- package/dist/components/docs/docsManifest.js +1 -1
- package/dist/components/docs/examples/DocsExamplesPage.js +1 -17
- package/dist/components/docs/examples/ExampleShowcasePage.d.ts +1 -1
- package/dist/components/docs/examples/ExampleShowcasePage.js +2 -17
- package/dist/components/docs/examples/exampleShowcaseData.d.ts +2 -2
- package/dist/components/docs/examples/exampleShowcaseData.js +2 -17
- package/dist/components/docs/examples/exampleShowcaseData.test.d.ts +1 -0
- package/dist/components/docs/examples/index.js +2 -17
- package/dist/components/docs/getting-started/CLIPage.js +5 -4
- package/dist/components/docs/getting-started/DataViewTutorialPage.js +44 -67
- package/dist/components/docs/getting-started/StartHerePage.js +4 -2
- package/dist/components/docs/getting-started/index.js +56 -76
- package/dist/components/docs/guides/GuideConnectInRepoPage.js +29 -4
- package/dist/components/docs/guides/GuideHostBuilderWorkbenchPage.js +21 -6
- package/dist/components/docs/guides/GuideReleaseCapsulesPage.d.ts +1 -0
- package/dist/components/docs/guides/GuideReleaseCapsulesPage.js +16 -0
- package/dist/components/docs/guides/GuidesIndexPage.js +1 -1
- package/dist/components/docs/guides/index.d.ts +1 -0
- package/dist/components/docs/guides/index.js +93 -39
- package/dist/components/docs/index.js +572 -421
- package/dist/components/docs/libraries/LibrariesContractsPage.js +43 -18
- package/dist/components/docs/libraries/LibrariesDesignSystemPage.js +43 -31
- package/dist/components/docs/libraries/LibrariesOverviewPage.js +1 -1
- package/dist/components/docs/libraries/LibrariesUIKitPage.js +42 -16
- package/dist/components/docs/libraries/LibrariesUIKitWebPage.d.ts +1 -0
- package/dist/components/docs/libraries/LibrariesUIKitWebPage.js +47 -0
- package/dist/components/docs/libraries/index.d.ts +1 -0
- package/dist/components/docs/libraries/index.js +221 -113
- package/dist/components/docs/specs/SpecsBuilderControlPlanePage.js +18 -3
- package/dist/components/docs/specs/SpecsConnectPage.js +4 -2
- package/dist/components/docs/specs/SpecsDataViewsPage.js +39 -32
- package/dist/components/docs/specs/index.js +65 -41
- package/dist/index.js +583 -432
- package/dist/node/application/index.js +11 -11
- package/dist/node/application/mcp/cliMcp.js +6 -6
- package/dist/node/application/mcp/cliMcp.onboarding.js +1 -0
- package/dist/node/application/mcp/contractsMcp.js +2 -2
- package/dist/node/application/mcp/contractsMcpAdoptionTools.js +1 -0
- package/dist/node/application/mcp/contractsMcpResources.js +1 -1
- package/dist/node/application/mcp/contractsMcpTools.js +1 -1
- package/dist/node/application/mcp/index.js +11 -11
- package/dist/node/components/docs/DocsIndexPage.js +1 -1
- package/dist/node/components/docs/docsManifest.js +1 -1
- package/dist/node/components/docs/examples/DocsExamplesPage.js +1 -17
- package/dist/node/components/docs/examples/ExampleShowcasePage.js +2 -17
- package/dist/node/components/docs/examples/exampleShowcaseData.js +2 -17
- package/dist/node/components/docs/examples/index.js +2 -17
- package/dist/node/components/docs/getting-started/CLIPage.js +5 -4
- package/dist/node/components/docs/getting-started/DataViewTutorialPage.js +44 -67
- package/dist/node/components/docs/getting-started/StartHerePage.js +4 -2
- package/dist/node/components/docs/getting-started/index.js +56 -76
- package/dist/node/components/docs/guides/GuideConnectInRepoPage.js +29 -4
- package/dist/node/components/docs/guides/GuideHostBuilderWorkbenchPage.js +21 -6
- package/dist/node/components/docs/guides/GuideReleaseCapsulesPage.js +15 -0
- package/dist/node/components/docs/guides/GuidesIndexPage.js +1 -1
- package/dist/node/components/docs/guides/index.js +93 -39
- package/dist/node/components/docs/index.js +572 -421
- package/dist/node/components/docs/libraries/LibrariesContractsPage.js +43 -18
- package/dist/node/components/docs/libraries/LibrariesDesignSystemPage.js +43 -31
- package/dist/node/components/docs/libraries/LibrariesOverviewPage.js +1 -1
- package/dist/node/components/docs/libraries/LibrariesUIKitPage.js +42 -16
- package/dist/node/components/docs/libraries/LibrariesUIKitWebPage.js +46 -0
- package/dist/node/components/docs/libraries/index.js +221 -113
- package/dist/node/components/docs/specs/SpecsBuilderControlPlanePage.js +18 -3
- package/dist/node/components/docs/specs/SpecsConnectPage.js +4 -2
- package/dist/node/components/docs/specs/SpecsDataViewsPage.js +39 -32
- package/dist/node/components/docs/specs/index.js +65 -41
- package/dist/node/index.js +583 -432
- package/package.json +66 -17
- package/src/application/mcp/cliMcp.onboarding.ts +297 -0
- package/src/application/mcp/cliMcp.test.ts +99 -0
- package/src/application/mcp/cliMcp.ts +30 -3
- package/src/application/mcp/contractsMcp.test.ts +65 -0
- package/src/application/mcp/contractsMcpAdoptionTools.ts +131 -0
- package/src/application/mcp/contractsMcpResources.ts +49 -0
- package/src/application/mcp/contractsMcpTools.ts +2 -0
- package/src/application/mcp/contractsMcpTypes.ts +16 -0
- package/src/components/docs/docsManifest.ts +12 -0
- package/src/components/docs/examples/DocsExamplesPage.tsx +6 -14
- package/src/components/docs/examples/ExampleShowcasePage.tsx +22 -18
- package/src/components/docs/examples/exampleShowcaseData.test.ts +22 -0
- package/src/components/docs/examples/exampleShowcaseData.ts +75 -50
- package/src/components/docs/generated/docs-index._common.json +2008 -1691
- package/src/components/docs/generated/docs-index.agent-console.json +377 -377
- package/src/components/docs/generated/docs-index.ai-chat-assistant.json +17 -17
- package/src/components/docs/generated/docs-index.ai-chat.json +105 -105
- package/src/components/docs/generated/docs-index.ai-support-bot.json +9 -9
- package/src/components/docs/generated/docs-index.analytics-dashboard.json +169 -169
- package/src/components/docs/generated/docs-index.app-config.json +137 -137
- package/src/components/docs/generated/docs-index.artisan-knowledge-product.json +17 -17
- package/src/components/docs/generated/docs-index.artisan-payments-stripe.json +33 -33
- package/src/components/docs/generated/docs-index.audit-trail.json +49 -49
- package/src/components/docs/generated/docs-index.calendar-google.json +9 -9
- package/src/components/docs/generated/docs-index.content-generation.json +9 -9
- package/src/components/docs/generated/docs-index.control-plane.json +17 -17
- package/src/components/docs/generated/docs-index.crm-pipeline.json +161 -161
- package/src/components/docs/generated/docs-index.data-grid-showcase.json +25 -17
- package/src/components/docs/generated/docs-index.defineExample.json +9 -9
- package/src/components/docs/generated/docs-index.email-gmail.json +9 -9
- package/src/components/docs/generated/docs-index.feature-flags.json +217 -217
- package/src/components/docs/generated/docs-index.files.json +177 -177
- package/src/components/docs/generated/docs-index.generated.ts +20 -20
- package/src/components/docs/generated/docs-index.harness-lab.json +9 -9
- package/src/components/docs/generated/docs-index.health.json +97 -97
- package/src/components/docs/generated/docs-index.identity-rbac.json +313 -313
- package/src/components/docs/generated/docs-index.in-app-docs.json +9 -9
- package/src/components/docs/generated/docs-index.integration-hub.json +265 -265
- package/src/components/docs/generated/docs-index.integration-posthog.json +9 -9
- package/src/components/docs/generated/docs-index.integration-stripe.json +9 -9
- package/src/components/docs/generated/docs-index.integration-supabase.json +9 -9
- package/src/components/docs/generated/docs-index.jobs.json +137 -137
- package/src/components/docs/generated/docs-index.kb-update-pipeline.json +129 -129
- package/src/components/docs/generated/docs-index.knowledge-canon.json +9 -9
- package/src/components/docs/generated/docs-index.learning-journey-ambient-coach.json +9 -9
- package/src/components/docs/generated/docs-index.learning-journey-crm-onboarding.json +49 -49
- package/src/components/docs/generated/docs-index.learning-journey-duo-drills.json +9 -9
- package/src/components/docs/generated/docs-index.learning-journey-platform-tour.json +49 -49
- package/src/components/docs/generated/docs-index.learning-journey-quest-challenges.json +9 -9
- package/src/components/docs/generated/docs-index.learning-journey-registry.json +33 -33
- package/src/components/docs/generated/docs-index.learning-journey-studio-onboarding.json +49 -49
- package/src/components/docs/generated/docs-index.learning-journey-ui-coaching.json +9 -9
- package/src/components/docs/generated/docs-index.learning-journey-ui-gamified.json +9 -9
- package/src/components/docs/generated/docs-index.learning-journey-ui-onboarding.json +9 -9
- package/src/components/docs/generated/docs-index.learning-journey-ui-shared.json +9 -9
- package/src/components/docs/generated/docs-index.learning-journey.json +241 -217
- package/src/components/docs/generated/docs-index.learning-patterns.json +9 -9
- package/src/components/docs/generated/docs-index.lifecycle-cli.json +9 -9
- package/src/components/docs/generated/docs-index.lifecycle-dashboard.json +9 -9
- package/src/components/docs/generated/docs-index.locale-jurisdiction-gate.json +65 -57
- package/src/components/docs/generated/docs-index.manifest.json +432 -432
- package/src/components/docs/generated/docs-index.marketplace.json +337 -337
- package/src/components/docs/generated/docs-index.meeting-recorder-providers.json +9 -9
- package/src/components/docs/generated/docs-index.meeting-recorder.json +49 -49
- package/src/components/docs/generated/docs-index.messaging-agent-actions.json +17 -17
- package/src/components/docs/generated/docs-index.metrics.json +201 -201
- package/src/components/docs/generated/docs-index.minimal.json +17 -17
- package/src/components/docs/generated/docs-index.mobile-demo-tasks.json +33 -33
- package/src/components/docs/generated/docs-index.notifications.json +65 -65
- package/src/components/docs/generated/docs-index.openbanking-powens.json +9 -9
- package/src/components/docs/generated/docs-index.openbanking.json +65 -65
- package/src/components/docs/generated/docs-index.opencode-cli.json +17 -17
- package/src/components/docs/generated/docs-index.personalization.json +9 -9
- package/src/components/docs/generated/docs-index.platform-acp.json +137 -137
- package/src/components/docs/generated/docs-index.platform-agent.json +201 -185
- package/src/components/docs/generated/docs-index.platform-context.json +121 -105
- package/src/components/docs/generated/docs-index.platform-control-plane.json +321 -321
- package/src/components/docs/generated/docs-index.platform-database.json +89 -89
- package/src/components/docs/generated/docs-index.platform-docs.json +161 -153
- package/src/components/docs/generated/docs-index.platform-harness.json +177 -177
- package/src/components/docs/generated/docs-index.platform-integrations.json +329 -329
- package/src/components/docs/generated/docs-index.platform-knowledge.json +57 -57
- package/src/components/docs/generated/docs-index.platform-provider-ranking.json +217 -185
- package/src/components/docs/generated/docs-index.pocket-family-office.json +129 -129
- package/src/components/docs/generated/docs-index.policy-safe-knowledge-assistant.json +9 -9
- package/src/components/docs/generated/docs-index.product-intent.json +9 -9
- package/src/components/docs/generated/docs-index.project-management-sync.json +9 -9
- package/src/components/docs/generated/docs-index.saas-boilerplate.json +209 -209
- package/src/components/docs/generated/docs-index.service-business-os.json +193 -193
- package/src/components/docs/generated/docs-index.team-hub.json +185 -185
- package/src/components/docs/generated/docs-index.unknown.json +521 -521
- package/src/components/docs/generated/docs-index.versioned-knowledge-base.json +81 -81
- package/src/components/docs/generated/docs-index.video-api-showcase.json +33 -33
- package/src/components/docs/generated/docs-index.video-docs-terminal.json +9 -9
- package/src/components/docs/generated/docs-index.video-marketing-clip.json +9 -9
- package/src/components/docs/generated/docs-index.visualization-showcase.json +17 -17
- package/src/components/docs/generated/docs-index.voice-providers.json +9 -9
- package/src/components/docs/generated/docs-index.wealth-snapshot.json +153 -153
- package/src/components/docs/generated/docs-index.workflow-system.json +433 -433
- package/src/components/docs/generated/docs-index.workspace-cli.json +9 -9
- package/src/components/docs/getting-started/CLIPage.tsx +10 -2
- package/src/components/docs/getting-started/DataViewTutorialPage.tsx +63 -70
- package/src/components/docs/getting-started/StartHerePage.tsx +10 -9
- package/src/components/docs/guides/GuideConnectInRepoPage.tsx +52 -3
- package/src/components/docs/guides/GuideHostBuilderWorkbenchPage.tsx +55 -6
- package/src/components/docs/guides/GuideReleaseCapsulesPage.tsx +147 -0
- package/src/components/docs/guides/GuidesIndexPage.tsx +7 -0
- package/src/components/docs/guides/index.ts +1 -0
- package/src/components/docs/libraries/LibrariesContractsPage.tsx +72 -27
- package/src/components/docs/libraries/LibrariesDesignSystemPage.tsx +67 -61
- package/src/components/docs/libraries/LibrariesOverviewPage.tsx +7 -1
- package/src/components/docs/libraries/LibrariesUIKitPage.tsx +63 -25
- package/src/components/docs/libraries/LibrariesUIKitWebPage.tsx +115 -0
- package/src/components/docs/libraries/index.ts +1 -0
- package/src/components/docs/specs/SpecsBuilderControlPlanePage.tsx +58 -3
- package/src/components/docs/specs/SpecsConnectPage.tsx +30 -0
- package/src/components/docs/specs/SpecsDataViewsPage.tsx +63 -42
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { describe, expect, it } from 'bun:test';
|
|
2
|
+
import { buildContractsResources } from './contractsMcpResources';
|
|
3
|
+
import { buildContractsOps } from './contractsMcpTools';
|
|
4
|
+
import type { ContractsMcpServices } from './contractsMcpTypes';
|
|
5
|
+
|
|
6
|
+
const services: ContractsMcpServices = {
|
|
7
|
+
async buildSpec() {
|
|
8
|
+
return { results: [] };
|
|
9
|
+
},
|
|
10
|
+
async deleteSpec() {
|
|
11
|
+
return { cleanedFiles: [], deleted: true, errors: [] };
|
|
12
|
+
},
|
|
13
|
+
async fetchRegistryManifest() {
|
|
14
|
+
return {};
|
|
15
|
+
},
|
|
16
|
+
async getSpec() {
|
|
17
|
+
return null;
|
|
18
|
+
},
|
|
19
|
+
async listSpecs() {
|
|
20
|
+
return [];
|
|
21
|
+
},
|
|
22
|
+
async resolveAdoption(options) {
|
|
23
|
+
return {
|
|
24
|
+
ambiguous: false,
|
|
25
|
+
candidates: [],
|
|
26
|
+
exhausted: false,
|
|
27
|
+
family: options.family,
|
|
28
|
+
query: options.query,
|
|
29
|
+
reason: `Resolved ${options.family}`,
|
|
30
|
+
selected: null,
|
|
31
|
+
verdict: 'rewrite',
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
async searchAdoptionCatalog() {
|
|
35
|
+
return [{ packageRef: '@contractspec/lib.contracts-spec' }];
|
|
36
|
+
},
|
|
37
|
+
async syncAdoptionCatalog() {
|
|
38
|
+
return { catalogPath: '.contractspec/adoption/catalog.json', total: 1 };
|
|
39
|
+
},
|
|
40
|
+
async updateSpec() {
|
|
41
|
+
return { errors: [], updated: true, warnings: [] };
|
|
42
|
+
},
|
|
43
|
+
async validateSpec() {
|
|
44
|
+
return { errors: [], valid: true, warnings: [] };
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
describe('contracts MCP adoption extensions', () => {
|
|
49
|
+
it('registers adoption tools alongside contract tools', () => {
|
|
50
|
+
const registry = buildContractsOps(services);
|
|
51
|
+
const keys = registry.list().map((spec) => spec.meta.key);
|
|
52
|
+
|
|
53
|
+
expect(keys).toContain('adoption.catalog_search');
|
|
54
|
+
expect(keys).toContain('adoption.resolve');
|
|
55
|
+
expect(keys).toContain('adoption.sync');
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('registers adoption resources', () => {
|
|
59
|
+
const resources = buildContractsResources(services);
|
|
60
|
+
const uris = resources.listTemplates().map((tmpl) => tmpl.meta.uriTemplate);
|
|
61
|
+
|
|
62
|
+
expect(uris).toContain('adoption://catalog');
|
|
63
|
+
expect(uris).toContain('adoption://policy/{family}');
|
|
64
|
+
});
|
|
65
|
+
});
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineCommand,
|
|
3
|
+
installOp,
|
|
4
|
+
type OperationSpecRegistry,
|
|
5
|
+
} from '@contractspec/lib.contracts-spec';
|
|
6
|
+
import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
|
|
7
|
+
import type { ContractsMcpServices } from './contractsMcpTypes';
|
|
8
|
+
|
|
9
|
+
const OWNERS = ['@contractspec'];
|
|
10
|
+
const TAGS = ['contracts', 'mcp', 'adoption'];
|
|
11
|
+
|
|
12
|
+
export function registerAdoptionOps(
|
|
13
|
+
registry: OperationSpecRegistry,
|
|
14
|
+
services: ContractsMcpServices
|
|
15
|
+
) {
|
|
16
|
+
const SearchInput = defineSchemaModel({
|
|
17
|
+
name: 'AdoptionCatalogSearchInput',
|
|
18
|
+
fields: {
|
|
19
|
+
query: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
20
|
+
family: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
21
|
+
platform: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
const SearchOutput = defineSchemaModel({
|
|
25
|
+
name: 'AdoptionCatalogSearchOutput',
|
|
26
|
+
fields: {
|
|
27
|
+
results: { type: ScalarTypeEnum.JSON(), isOptional: false },
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
installOp(
|
|
31
|
+
registry,
|
|
32
|
+
defineCommand({
|
|
33
|
+
meta: {
|
|
34
|
+
key: 'adoption.catalog_search',
|
|
35
|
+
version: '1.0.0',
|
|
36
|
+
stability: 'beta',
|
|
37
|
+
owners: OWNERS,
|
|
38
|
+
tags: TAGS,
|
|
39
|
+
description: 'Search the local ContractSpec adoption catalog.',
|
|
40
|
+
goal: 'Find relevant ContractSpec reuse candidates for a query.',
|
|
41
|
+
context: 'Contracts MCP server.',
|
|
42
|
+
},
|
|
43
|
+
io: { input: SearchInput, output: SearchOutput },
|
|
44
|
+
policy: { auth: 'anonymous' },
|
|
45
|
+
}),
|
|
46
|
+
async ({ family, platform, query }) => ({
|
|
47
|
+
results: await services.searchAdoptionCatalog({
|
|
48
|
+
family,
|
|
49
|
+
platform,
|
|
50
|
+
query,
|
|
51
|
+
}),
|
|
52
|
+
})
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const ResolveInput = defineSchemaModel({
|
|
56
|
+
name: 'AdoptionResolveInput',
|
|
57
|
+
fields: {
|
|
58
|
+
family: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
59
|
+
query: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
60
|
+
paths: { type: ScalarTypeEnum.JSON(), isOptional: true },
|
|
61
|
+
platform: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
62
|
+
runtime: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
const ResolveOutput = defineSchemaModel({
|
|
66
|
+
name: 'AdoptionResolveOutput',
|
|
67
|
+
fields: {
|
|
68
|
+
resolution: { type: ScalarTypeEnum.JSON(), isOptional: false },
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
installOp(
|
|
72
|
+
registry,
|
|
73
|
+
defineCommand({
|
|
74
|
+
meta: {
|
|
75
|
+
key: 'adoption.resolve',
|
|
76
|
+
version: '1.0.0',
|
|
77
|
+
stability: 'beta',
|
|
78
|
+
owners: OWNERS,
|
|
79
|
+
tags: TAGS,
|
|
80
|
+
description: 'Resolve the best adoption candidate for one family.',
|
|
81
|
+
goal: 'Provide one ordered recommendation that matches Connect.',
|
|
82
|
+
context: 'Contracts MCP server.',
|
|
83
|
+
},
|
|
84
|
+
io: { input: ResolveInput, output: ResolveOutput },
|
|
85
|
+
policy: { auth: 'anonymous' },
|
|
86
|
+
}),
|
|
87
|
+
async ({ family, paths, platform, query, runtime }) => ({
|
|
88
|
+
resolution: await services.resolveAdoption({
|
|
89
|
+
family,
|
|
90
|
+
paths: Array.isArray(paths) ? (paths as string[]) : undefined,
|
|
91
|
+
platform,
|
|
92
|
+
query,
|
|
93
|
+
runtime,
|
|
94
|
+
}),
|
|
95
|
+
})
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const SyncInput = defineSchemaModel({
|
|
99
|
+
name: 'AdoptionSyncInput',
|
|
100
|
+
fields: {},
|
|
101
|
+
});
|
|
102
|
+
const SyncOutput = defineSchemaModel({
|
|
103
|
+
name: 'AdoptionSyncOutput',
|
|
104
|
+
fields: {
|
|
105
|
+
catalogPath: {
|
|
106
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
107
|
+
isOptional: false,
|
|
108
|
+
},
|
|
109
|
+
total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
installOp(
|
|
113
|
+
registry,
|
|
114
|
+
defineCommand({
|
|
115
|
+
meta: {
|
|
116
|
+
key: 'adoption.sync',
|
|
117
|
+
version: '1.0.0',
|
|
118
|
+
stability: 'beta',
|
|
119
|
+
owners: OWNERS,
|
|
120
|
+
tags: TAGS,
|
|
121
|
+
description:
|
|
122
|
+
'Mirror the bundled ContractSpec adoption catalog locally.',
|
|
123
|
+
goal: 'Refresh the local adoption catalog used by Connect and MCP.',
|
|
124
|
+
context: 'Contracts MCP server.',
|
|
125
|
+
},
|
|
126
|
+
io: { input: SyncInput, output: SyncOutput },
|
|
127
|
+
policy: { auth: 'user' },
|
|
128
|
+
}),
|
|
129
|
+
async () => services.syncAdoptionCatalog()
|
|
130
|
+
);
|
|
131
|
+
}
|
|
@@ -87,6 +87,54 @@ export function buildContractsResources(services: ContractsMcpServices) {
|
|
|
87
87
|
})
|
|
88
88
|
);
|
|
89
89
|
|
|
90
|
+
resources.register(
|
|
91
|
+
defineResourceTemplate({
|
|
92
|
+
meta: {
|
|
93
|
+
uriTemplate: 'adoption://catalog',
|
|
94
|
+
title: 'ContractSpec adoption catalog',
|
|
95
|
+
description:
|
|
96
|
+
'Bundled ContractSpec adoption catalog used by Connect and MCP.',
|
|
97
|
+
mimeType: 'application/json',
|
|
98
|
+
tags: TAGS,
|
|
99
|
+
},
|
|
100
|
+
input: z.object({}),
|
|
101
|
+
resolve: async () => {
|
|
102
|
+
const results = await services.searchAdoptionCatalog({
|
|
103
|
+
query: 'contractspec',
|
|
104
|
+
});
|
|
105
|
+
return {
|
|
106
|
+
uri: 'adoption://catalog',
|
|
107
|
+
mimeType: 'application/json',
|
|
108
|
+
data: JSON.stringify(results, null, 2),
|
|
109
|
+
};
|
|
110
|
+
},
|
|
111
|
+
})
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
resources.register(
|
|
115
|
+
defineResourceTemplate({
|
|
116
|
+
meta: {
|
|
117
|
+
uriTemplate: 'adoption://policy/{family}',
|
|
118
|
+
title: 'ContractSpec adoption policy',
|
|
119
|
+
description: 'Family-aware adoption recommendation and verdict policy.',
|
|
120
|
+
mimeType: 'application/json',
|
|
121
|
+
tags: TAGS,
|
|
122
|
+
},
|
|
123
|
+
input: z.object({ family: z.string() }),
|
|
124
|
+
resolve: async ({ family }) => {
|
|
125
|
+
const resolution = await services.resolveAdoption({
|
|
126
|
+
family,
|
|
127
|
+
query: family,
|
|
128
|
+
});
|
|
129
|
+
return {
|
|
130
|
+
uri: `adoption://policy/${encodeURIComponent(family)}`,
|
|
131
|
+
mimeType: 'application/json',
|
|
132
|
+
data: JSON.stringify(resolution, null, 2),
|
|
133
|
+
};
|
|
134
|
+
},
|
|
135
|
+
})
|
|
136
|
+
);
|
|
137
|
+
|
|
90
138
|
return resources;
|
|
91
139
|
}
|
|
92
140
|
|
|
@@ -124,6 +172,7 @@ export function buildContractsPrompts() {
|
|
|
124
172
|
'3. Edit content and call contracts.update',
|
|
125
173
|
'4. Run contracts.validate to verify changes',
|
|
126
174
|
'5. Run contracts.build to regenerate artifacts',
|
|
175
|
+
'6. Use adoption.resolve to prefer existing workspace or ContractSpec surfaces before inventing new ones',
|
|
127
176
|
goal ? `Agent goal: ${goal}` : '',
|
|
128
177
|
]
|
|
129
178
|
.filter(Boolean)
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
OperationSpecRegistry,
|
|
12
12
|
} from '@contractspec/lib.contracts-spec';
|
|
13
13
|
import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
|
|
14
|
+
import { registerAdoptionOps } from './contractsMcpAdoptionTools';
|
|
14
15
|
import type { ContractsMcpServices } from './contractsMcpTypes';
|
|
15
16
|
|
|
16
17
|
const OWNERS = ['@contractspec'];
|
|
@@ -161,6 +162,7 @@ export function buildContractsOps(services: ContractsMcpServices) {
|
|
|
161
162
|
);
|
|
162
163
|
|
|
163
164
|
registerMutationTools(registry, services);
|
|
165
|
+
registerAdoptionOps(registry, services);
|
|
164
166
|
|
|
165
167
|
return registry;
|
|
166
168
|
}
|
|
@@ -44,4 +44,20 @@ export interface ContractsMcpServices {
|
|
|
44
44
|
): Promise<{ deleted: boolean; cleanedFiles: string[]; errors: string[] }>;
|
|
45
45
|
|
|
46
46
|
fetchRegistryManifest(): Promise<unknown>;
|
|
47
|
+
|
|
48
|
+
searchAdoptionCatalog(options: {
|
|
49
|
+
family?: string;
|
|
50
|
+
platform?: string;
|
|
51
|
+
query: string;
|
|
52
|
+
}): Promise<unknown[]>;
|
|
53
|
+
|
|
54
|
+
resolveAdoption(options: {
|
|
55
|
+
family: string;
|
|
56
|
+
paths?: string[];
|
|
57
|
+
platform?: string;
|
|
58
|
+
query: string;
|
|
59
|
+
runtime?: string;
|
|
60
|
+
}): Promise<unknown>;
|
|
61
|
+
|
|
62
|
+
syncAdoptionCatalog(): Promise<{ catalogPath: string; total: number }>;
|
|
47
63
|
}
|
|
@@ -418,6 +418,18 @@ export const DOCS_PAGES: readonly DocsPageEntry[] = [
|
|
|
418
418
|
audience: 'operator',
|
|
419
419
|
ctaMode: 'oss-next',
|
|
420
420
|
},
|
|
421
|
+
{
|
|
422
|
+
href: '/docs/guides/release-capsules',
|
|
423
|
+
title: 'Author release capsules',
|
|
424
|
+
description:
|
|
425
|
+
'Pair changesets with structured release capsules, generate release artifacts, and keep changelog plus docs surfaces aligned.',
|
|
426
|
+
section: 'operate',
|
|
427
|
+
order: 25,
|
|
428
|
+
navTitle: 'Release capsules',
|
|
429
|
+
primaryNav: true,
|
|
430
|
+
audience: 'operator',
|
|
431
|
+
ctaMode: 'reference',
|
|
432
|
+
},
|
|
421
433
|
{
|
|
422
434
|
href: '/docs/safety/security-trust',
|
|
423
435
|
title: 'Security and trust',
|
|
@@ -8,8 +8,10 @@ import {
|
|
|
8
8
|
} from '@contractspec/lib.design-system';
|
|
9
9
|
import { HStack, VStack } from '@contractspec/lib.ui-kit-web/ui/stack';
|
|
10
10
|
import { H1, Muted } from '@contractspec/lib.ui-kit-web/ui/typography';
|
|
11
|
-
import {
|
|
12
|
-
|
|
11
|
+
import {
|
|
12
|
+
buildExampleDocsHref,
|
|
13
|
+
listPublicExamples,
|
|
14
|
+
} from '@contractspec/module.examples';
|
|
13
15
|
|
|
14
16
|
interface ExampleItem extends Record<string, unknown> {
|
|
15
17
|
id: string;
|
|
@@ -20,25 +22,15 @@ interface ExampleItem extends Record<string, unknown> {
|
|
|
20
22
|
sandboxEnabled: boolean;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
|
-
function buildReferenceRoute(key: string) {
|
|
24
|
-
return `/docs/reference/${key}/${key}`;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function buildDocsRoute(key: string) {
|
|
28
|
-
return getExampleShowcaseData(key)?.sandboxHref
|
|
29
|
-
? `/docs/examples/${key}`
|
|
30
|
-
: buildReferenceRoute(key);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
25
|
export function DocsExamplesPage() {
|
|
34
|
-
const items: ExampleItem[] =
|
|
26
|
+
const items: ExampleItem[] = listPublicExamples()
|
|
35
27
|
.map((example) => {
|
|
36
28
|
const title = example.meta.title ?? example.meta.key;
|
|
37
29
|
return {
|
|
38
30
|
id: example.meta.key,
|
|
39
31
|
title,
|
|
40
32
|
summary: example.meta.summary ?? example.meta.description,
|
|
41
|
-
route:
|
|
33
|
+
route: buildExampleDocsHref(example.meta.key),
|
|
42
34
|
tags: example.meta.tags,
|
|
43
35
|
sandboxEnabled: example.surfaces.sandbox.enabled,
|
|
44
36
|
};
|
|
@@ -5,7 +5,7 @@ import { FileCode2, Play, TerminalSquare } from 'lucide-react';
|
|
|
5
5
|
import { getExampleShowcaseData } from './exampleShowcaseData';
|
|
6
6
|
|
|
7
7
|
interface ExampleShowcasePageProps {
|
|
8
|
-
exampleKey:
|
|
8
|
+
exampleKey: string;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export function ExampleShowcasePage({ exampleKey }: ExampleShowcasePageProps) {
|
|
@@ -28,7 +28,9 @@ export function ExampleShowcasePage({ exampleKey }: ExampleShowcasePageProps) {
|
|
|
28
28
|
<p className="editorial-subtitle">{showcase.lead}</p>
|
|
29
29
|
<p className="editorial-copy max-w-4xl">{summary}</p>
|
|
30
30
|
<div className="flex flex-wrap gap-3">
|
|
31
|
-
|
|
31
|
+
{showcase.sandboxHref ? (
|
|
32
|
+
<ButtonLink href={showcase.sandboxHref}>Open sandbox</ButtonLink>
|
|
33
|
+
) : null}
|
|
32
34
|
<ButtonLink href={showcase.referenceHref} variant="outline">
|
|
33
35
|
Generated reference
|
|
34
36
|
</ButtonLink>
|
|
@@ -36,21 +38,23 @@ export function ExampleShowcasePage({ exampleKey }: ExampleShowcasePageProps) {
|
|
|
36
38
|
</section>
|
|
37
39
|
|
|
38
40
|
<section className="grid gap-5 lg:grid-cols-3">
|
|
39
|
-
|
|
40
|
-
<
|
|
41
|
-
<div className="
|
|
42
|
-
<
|
|
41
|
+
{showcase.sandboxHref ? (
|
|
42
|
+
<article className="editorial-panel space-y-4">
|
|
43
|
+
<div className="flex items-center gap-3">
|
|
44
|
+
<div className="rounded-full border border-border/80 bg-background/85 p-2">
|
|
45
|
+
<Play size={18} />
|
|
46
|
+
</div>
|
|
47
|
+
<h2 className="font-semibold text-xl">Sandbox preview</h2>
|
|
43
48
|
</div>
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
</article>
|
|
49
|
+
<p className="editorial-copy text-sm">
|
|
50
|
+
Load the same public browser surface used for the prepared live
|
|
51
|
+
demo.
|
|
52
|
+
</p>
|
|
53
|
+
<ButtonLink href={showcase.sandboxHref} size="sm">
|
|
54
|
+
Open preview
|
|
55
|
+
</ButtonLink>
|
|
56
|
+
</article>
|
|
57
|
+
) : null}
|
|
54
58
|
|
|
55
59
|
<article className="editorial-panel space-y-4">
|
|
56
60
|
<div className="flex items-center gap-3">
|
|
@@ -100,8 +104,8 @@ export function ExampleShowcasePage({ exampleKey }: ExampleShowcasePageProps) {
|
|
|
100
104
|
Exact local commands for the meetup lane
|
|
101
105
|
</h2>
|
|
102
106
|
<p className="editorial-copy text-sm">
|
|
103
|
-
|
|
104
|
-
|
|
107
|
+
Build the example package, then launch the web shell and open the
|
|
108
|
+
prepared docs or sandbox route.
|
|
105
109
|
</p>
|
|
106
110
|
</div>
|
|
107
111
|
<CodeBlock
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test';
|
|
2
|
+
import { listPublicExamples } from '@contractspec/module.examples';
|
|
3
|
+
import { getExampleShowcaseData } from './exampleShowcaseData';
|
|
4
|
+
|
|
5
|
+
describe('example showcase data', () => {
|
|
6
|
+
test('builds showcase data for every public example', () => {
|
|
7
|
+
for (const example of listPublicExamples()) {
|
|
8
|
+
expect(getExampleShowcaseData(example.meta.key)).toBeDefined();
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test('preserves override copy and generic fallback links', () => {
|
|
13
|
+
const dataGrid = getExampleShowcaseData('data-grid-showcase');
|
|
14
|
+
const calendar = getExampleShowcaseData('calendar-google');
|
|
15
|
+
|
|
16
|
+
expect(dataGrid?.lead).toContain('Canonical table example');
|
|
17
|
+
expect(calendar?.sandboxHref).toBe('/sandbox?template=calendar-google');
|
|
18
|
+
expect(calendar?.referenceHref).toBe(
|
|
19
|
+
'/docs/reference/calendar-google/calendar-google'
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -1,65 +1,90 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildExampleDocsHref,
|
|
3
|
+
buildExampleReferenceHref,
|
|
4
|
+
getExamplePreviewHref,
|
|
5
|
+
getPublicExample,
|
|
6
|
+
} from '@contractspec/module.examples';
|
|
7
|
+
|
|
1
8
|
export interface ExampleShowcaseData {
|
|
2
|
-
key:
|
|
9
|
+
key: string;
|
|
3
10
|
lead: string;
|
|
4
|
-
sandboxHref: string;
|
|
11
|
+
sandboxHref: string | null;
|
|
5
12
|
referenceHref: string;
|
|
6
13
|
llmsHref: string;
|
|
7
14
|
repoHref: string;
|
|
8
15
|
localCommands: string;
|
|
9
16
|
}
|
|
10
17
|
|
|
11
|
-
const
|
|
12
|
-
'agent-console':
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
bun run --cwd packages/examples/agent-console test
|
|
22
|
-
bun run --cwd packages/apps/web-landing dev
|
|
23
|
-
|
|
24
|
-
# Open in the browser
|
|
25
|
-
# http://localhost:3000/sandbox?template=agent-console`,
|
|
26
|
-
},
|
|
27
|
-
'ai-chat-assistant': {
|
|
28
|
-
key: 'ai-chat-assistant',
|
|
29
|
-
lead: 'Secondary meetup path for MCP-aware assistants: reasoning, sources, suggestions, and a minimal contract-backed search tool.',
|
|
30
|
-
sandboxHref: '/sandbox?template=ai-chat-assistant',
|
|
31
|
-
referenceHref: '/docs/reference/ai-chat-assistant/assistant.search',
|
|
32
|
-
llmsHref: '/llms/example.ai-chat-assistant',
|
|
33
|
-
repoHref:
|
|
34
|
-
'https://github.com/lssm-tech/contractspec/tree/main/packages/examples/ai-chat-assistant',
|
|
35
|
-
localCommands: `bun run --cwd packages/examples/ai-chat-assistant build
|
|
36
|
-
bun run --cwd packages/examples/ai-chat-assistant test
|
|
37
|
-
bun run --cwd packages/apps/web-landing dev
|
|
38
|
-
|
|
39
|
-
# Open in the browser
|
|
40
|
-
# http://localhost:3000/sandbox?template=ai-chat-assistant`,
|
|
41
|
-
},
|
|
42
|
-
'messaging-agent-actions': {
|
|
43
|
-
key: 'messaging-agent-actions',
|
|
44
|
-
lead: 'Live messaging lane for the meetup: inbound Slack, WhatsApp, or Telegram messages route through fixed intents, allowlisted actions, and deterministic confirmations.',
|
|
45
|
-
sandboxHref: '/sandbox?template=messaging-agent-actions',
|
|
46
|
-
referenceHref:
|
|
47
|
-
'/docs/reference/messaging-agent-actions/messaging.agentActions.process',
|
|
48
|
-
llmsHref: '/llms/example.messaging-agent-actions',
|
|
49
|
-
repoHref:
|
|
50
|
-
'https://github.com/lssm-tech/contractspec/tree/main/packages/examples/messaging-agent-actions',
|
|
51
|
-
localCommands: `bun run --cwd packages/examples/messaging-agent-actions build
|
|
52
|
-
bun run --cwd packages/examples/messaging-agent-actions test
|
|
53
|
-
bun run --cwd packages/examples/messaging-agent-actions proof
|
|
54
|
-
bun run --cwd packages/apps/web-landing dev
|
|
18
|
+
const LEAD_OVERRIDES: Record<string, string> = {
|
|
19
|
+
'agent-console':
|
|
20
|
+
'Primary meetup path for autonomous agents: typed tools, agent configs, run history, and execution logs in one regenerable surface.',
|
|
21
|
+
'ai-chat-assistant':
|
|
22
|
+
'Secondary meetup path for MCP-aware assistants: reasoning, sources, suggestions, and a minimal contract-backed search tool.',
|
|
23
|
+
'data-grid-showcase':
|
|
24
|
+
'Canonical table example for the full ContractSpec stack: declarative DataView contract, shared controller, raw web primitive, native-first primitive, and the composed design-system wrapper.',
|
|
25
|
+
'messaging-agent-actions':
|
|
26
|
+
'Live messaging lane for the meetup: inbound Slack, WhatsApp, or Telegram messages route through fixed intents, allowlisted actions, and deterministic confirmations.',
|
|
27
|
+
};
|
|
55
28
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
29
|
+
const REFERENCE_HREF_OVERRIDES: Record<string, string> = {
|
|
30
|
+
'agent-console': '/docs/reference/agent-console/agent-console',
|
|
31
|
+
'ai-chat-assistant': '/docs/reference/ai-chat-assistant/assistant.search',
|
|
32
|
+
'data-grid-showcase': '/docs/reference/data-grid-showcase/data-grid-showcase',
|
|
33
|
+
'messaging-agent-actions':
|
|
34
|
+
'/docs/reference/messaging-agent-actions/messaging.agentActions.process',
|
|
59
35
|
};
|
|
60
36
|
|
|
61
37
|
export function getExampleShowcaseData(
|
|
62
38
|
key: string
|
|
63
39
|
): ExampleShowcaseData | undefined {
|
|
64
|
-
|
|
40
|
+
const example = getPublicExample(key);
|
|
41
|
+
|
|
42
|
+
if (!example) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const directory = example.entrypoints.packageName.replace(
|
|
47
|
+
'@contractspec/example.',
|
|
48
|
+
''
|
|
49
|
+
);
|
|
50
|
+
const docsHref = buildExampleDocsHref(key);
|
|
51
|
+
const sandboxHref = getExamplePreviewHref(key);
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
key,
|
|
55
|
+
lead:
|
|
56
|
+
LEAD_OVERRIDES[key] ??
|
|
57
|
+
example.meta.summary ??
|
|
58
|
+
example.meta.description ??
|
|
59
|
+
'Public ContractSpec reference example.',
|
|
60
|
+
sandboxHref,
|
|
61
|
+
referenceHref:
|
|
62
|
+
REFERENCE_HREF_OVERRIDES[key] ?? buildExampleReferenceHref(key),
|
|
63
|
+
llmsHref: `/llms/${example.entrypoints.packageName.replace(
|
|
64
|
+
'@contractspec/',
|
|
65
|
+
''
|
|
66
|
+
)}`,
|
|
67
|
+
repoHref: `https://github.com/lssm-tech/contractspec/tree/main/packages/examples/${directory}`,
|
|
68
|
+
localCommands: buildLocalCommands(directory, docsHref, sandboxHref),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function buildLocalCommands(
|
|
73
|
+
directory: string,
|
|
74
|
+
docsHref: string,
|
|
75
|
+
sandboxHref: string | null
|
|
76
|
+
): string {
|
|
77
|
+
const lines = [
|
|
78
|
+
`bun run --cwd packages/examples/${directory} build`,
|
|
79
|
+
'bun run --cwd packages/apps/web-landing dev',
|
|
80
|
+
'',
|
|
81
|
+
'# Open in the browser',
|
|
82
|
+
`# http://localhost:3000${docsHref}`,
|
|
83
|
+
];
|
|
84
|
+
|
|
85
|
+
if (sandboxHref) {
|
|
86
|
+
lines.push(`# http://localhost:3000${sandboxHref}`);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return lines.join('\n');
|
|
65
90
|
}
|