@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
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import{Logger as
|
|
1
|
+
import{Logger as Dj,LogLevel as Cj}from"@contractspec/lib.logger";function Aj(){return"production"}var LY=()=>new Dj({level:Cj.INFO,environment:Aj(),enableTracing:!0,enableTiming:!0,enableContext:!0,enableColors:!1}),D=LY(),OJ=new Dj({level:Cj.WARN,environment:Aj(),enableTracing:!0,enableTiming:!0,enableContext:!0,enableColors:!1}),RJ=new Dj({level:Cj.INFO,environment:Aj(),enableTracing:!0,enableTiming:!0,enableContext:!0,enableColors:!1});import{createNodeAdapters as qY,onboarding as Ej}from"@contractspec/bundle.workspace";import{defineCommand as Ij,definePrompt as _Y,defineResourceTemplate as Nj,installOp as zj}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as o,ScalarTypeEnum as q}from"@contractspec/lib.schema";import C from"zod";var E=["cli","mcp","onboarding"],Zj=["@contractspec"];function MY(j){return j?.split(",").map((Y)=>Y.trim()).filter(Boolean)}async function $j(j={}){let Y=qY({cwd:process.cwd(),silent:!0});return Ej.buildOnboardingPlan(Y,{forcedExampleKey:j.example,selectedTracks:MY(j.tracks)})}function pj(j){j.register(Nj({meta:{uriTemplate:"onboarding://tracks",title:"Onboarding tracks",description:"Primary ContractSpec onboarding tracks exposed by the CLI.",mimeType:"application/json",tags:E},input:C.object({}),resolve:async()=>({uri:"onboarding://tracks",mimeType:"application/json",data:JSON.stringify(Ej.listOnboardingTracks(),null,2)})})),j.register(Nj({meta:{uriTemplate:"onboarding://track/{id}",title:"Onboarding track",description:"Track-specific onboarding metadata and recommended commands.",mimeType:"application/json",tags:E},input:C.object({id:C.string()}),resolve:async({id:Y})=>({uri:`onboarding://track/${Y}`,mimeType:"application/json",data:JSON.stringify(Ej.getOnboardingTrack(Y)??null,null,2)})})),j.register(Nj({meta:{uriTemplate:"onboarding://artifacts/{id}{?tracks,example}",title:"Rendered onboarding artifact",description:"Render AGENTS.md or USAGE.md content for the current repo.",mimeType:"text/markdown",tags:E},input:C.object({example:C.string().optional(),id:C.enum(["agent-guide","human-guide"]),tracks:C.string().optional()}),resolve:async({example:Y,id:J,tracks:Q})=>{let $=await $j({example:Y,tracks:Q});return{uri:`onboarding://artifacts/${J}`,mimeType:"text/markdown",data:J==="agent-guide"?$.guides.agentGuide:$.guides.humanGuide}}}))}function lj(j){j.register(_Y({meta:{key:"cli.onboarding",version:"1.0.0",title:"Plan a ContractSpec onboarding flow",description:"Suggest the right onboarding track and artifacts for a repo.",tags:E,stability:"beta",owners:Zj},args:[{name:"goal",description:"Repository onboarding goal or focus area.",required:!1,schema:C.string().optional()}],input:C.object({goal:C.string().optional()}),render:async({goal:Y})=>[{type:"text",text:`Use onboarding://tracks and onboarding_suggestTracks-v1_0_0 before recommending repo-local ContractSpec adoption steps.${Y?` Goal: ${Y}.`:""}`},{type:"resource",uri:"onboarding://tracks",title:"Tracks"}]}))}function nj(j){let Y=o({name:"OnboardingSuggestTracksInput",fields:{example:{type:q.String_unsecure(),isOptional:!0},tracks:{type:q.String_unsecure(),isOptional:!0}}}),J=o({name:"OnboardingSuggestTracksOutput",fields:{nextCommands:{type:q.String_unsecure(),isArray:!0,isOptional:!1},primaryTrack:{type:q.String_unsecure(),isOptional:!1},reason:{type:q.String_unsecure(),isOptional:!1},tracks:{type:q.String_unsecure(),isArray:!0,isOptional:!1}}}),Q=o({name:"OnboardingRenderArtifactOutput",fields:{content:{type:q.String_unsecure(),isOptional:!1},primaryTrack:{type:q.String_unsecure(),isOptional:!1}}}),$=o({name:"OnboardingNextCommandOutput",fields:{nextCommand:{type:q.String_unsecure(),isOptional:!1},primaryTrack:{type:q.String_unsecure(),isOptional:!1}}});zj(j,Ij({meta:{key:"onboarding.suggestTracks",version:"1.0.0",stability:"stable",owners:Zj,tags:E,description:"Suggest the recommended ContractSpec onboarding tracks.",goal:"Help agents choose the right onboarding track before editing repo-local guides.",context:"Used inside the CLI MCP server."},io:{input:Y,output:J},policy:{auth:"anonymous"}}),async({example:Z,tracks:X})=>{let U=await $j({example:Z,tracks:X});return{nextCommands:U.nextCommands,primaryTrack:U.primaryTrack.id,reason:U.recommendations[0]?.reason??U.primaryTrack.summary,tracks:U.recommendations.map((V)=>V.track.id)}}),zj(j,Ij({meta:{key:"onboarding.renderArtifacts",version:"1.0.0",stability:"stable",owners:Zj,tags:E,description:"Render onboarding artifacts for the current repo.",goal:"Provide AGENTS.md or USAGE.md content without mutating the repo.",context:"Used inside the CLI MCP server."},io:{input:o({name:"OnboardingRenderArtifactInput",fields:{artifact:{type:q.String_unsecure(),isOptional:!1},example:{type:q.String_unsecure(),isOptional:!0},tracks:{type:q.String_unsecure(),isOptional:!0}}}),output:Q},policy:{auth:"anonymous"}}),async({artifact:Z,example:X,tracks:U})=>{let V=await $j({example:X,tracks:U});return{content:Z==="agent-guide"?V.guides.agentGuide:V.guides.humanGuide,primaryTrack:V.primaryTrack.id}}),zj(j,Ij({meta:{key:"onboarding.nextCommand",version:"1.0.0",stability:"stable",owners:Zj,tags:E,description:"Return the next recommended CLI command for onboarding.",goal:"Help agents choose the next onboarding command without mutating the repo.",context:"Used inside the CLI MCP server."},io:{input:Y,output:$},policy:{auth:"anonymous"}}),async({example:Z,tracks:X})=>{let U=await $j({example:Z,tracks:X});return{nextCommand:U.nextCommands[0]??"contractspec onboard",primaryTrack:U.primaryTrack.id}})}var cj=["application/json","text/event-stream"];function bY(j){return!j||j.includes("*/*")||j.includes("application/*")||cj.some((Y)=>j.includes(Y))}function kj(j){if(j.method!=="POST")return j;let Y=j.headers.get("accept");if(!bY(Y))return j;let J=cj.filter(($)=>!Y?.includes($));if(J.length===0)return j;let Q=new Headers(j.headers);return Q.set("accept",[Y,...J].filter(Boolean).join(", ")),new Request(j,{headers:Q})}import{createMcpServer as GY}from"@contractspec/lib.contracts-runtime-server-mcp/provider-mcp";import{PresentationRegistry as DY}from"@contractspec/lib.contracts-spec/presentations";import{McpServer as CY}from"@modelcontextprotocol/sdk/server/mcp.js";import{WebStandardStreamableHTTPServerTransport as AY}from"@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";import{randomUUID as IY}from"crypto";import{Elysia as NY}from"elysia";var zY={actor:"anonymous",decide:async()=>({effect:"allow"})};function vj(j,Y,J,Q){return new Response(JSON.stringify({jsonrpc:"2.0",error:{code:Y,message:J,...Q?{data:Q}:{}},id:null}),{status:j,headers:{"content-type":"application/json"}})}function ij({logger:j,serverName:Y,ops:J,resources:Q,prompts:$,presentations:Z,stateful:X}){let U=new CY({name:Y,version:"1.0.0"},{capabilities:{tools:{},resources:{},prompts:{},logging:{}}});j.info("Setting up MCP server..."),GY(U,J,Q,$,{logger:j,toolCtx:()=>zY,promptCtx:()=>({locale:"en"}),resourceCtx:()=>({locale:"en"}),presentations:new DY(Z)});let V=new AY({sessionIdGenerator:X?()=>IY():void 0,enableJsonResponse:!0});return U.connect(V).then(()=>({server:U,transport:V}))}async function Xj(j){await Promise.allSettled([j.transport.close(),j.server.close()])}function EY(j){return j instanceof Error?j.stack??j.message:String(j)}function A({logger:j,path:Y,serverName:J,ops:Q,resources:$,prompts:Z,presentations:X,validateAuth:U,requiredAuthMethods:V}){j.info("Setting up MCP handler...",{requiredAuthMethods:V??[]});let B=process.env.CONTRACTSPEC_MCP_STATEFUL==="1",H=new Map;async function K(W){let x=await ij({logger:j,path:Y,serverName:J,ops:Q,resources:$,prompts:Z,presentations:X,stateful:!1});try{return await x.transport.handleRequest(kj(W))}finally{await Xj(x)}}async function P(W){let x=H.get(W);if(!x)return;H.delete(W),await Xj(x)}async function Gj(W){let x=W.headers.get("mcp-session-id"),N,i=!1;if(x){let z=H.get(x);if(!z)return vj(404,-32001,"Session not found");N=z}else N=await ij({logger:j,path:Y,serverName:J,ops:Q,resources:$,prompts:Z,presentations:X,stateful:!0}),i=!0;try{let z=await N.transport.handleRequest(kj(W)),h=N.transport.sessionId;if(h&&!H.has(h))H.set(h,N);if(W.method==="DELETE"&&h)await P(h);else if(!h&&i)await Xj(N);return z}catch(z){if(i)await Xj(N);throw z}}return new NY({name:`mcp-${J}`}).all(Y,async({request:W})=>{try{if(U){let x=await U(W);if(!x.valid)return vj(401,-32002,"Authentication failed",x.reason)}if(B)return await Gj(W);return await K(W)}catch(x){return j.error("Error handling MCP request",{path:Y,method:W.method,error:EY(x)}),vj(500,-32000,"Internal error")}})}import kY from"node:fs/promises";import{defineCommand as vY,definePrompt as OY,defineResourceTemplate as oj,installOp as RY,OperationSpecRegistry as hY,PromptRegistry as TY,ResourceRegistry as fY}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as aj,ScalarTypeEnum as a}from"@contractspec/lib.schema";import t from"path";import T from"zod";var __dirname="/home/runner/work/contractspec/contractspec/packages/bundles/library/src/application/mcp",SY={quickstart:"packages/apps/cli-contractspec/QUICK_START.md",reference:"packages/apps/cli-contractspec/QUICK_REFERENCE.md",readme:"packages/apps/cli-contractspec/README.md"},yY={quickstart:`# ContractSpec CLI quickstart
|
|
2
2
|
|
|
3
|
-
contractspec
|
|
4
|
-
contractspec
|
|
5
|
-
contractspec validate
|
|
3
|
+
contractspec quickstart
|
|
4
|
+
contractspec onboard
|
|
5
|
+
contractspec validate`,reference:`# ContractSpec CLI reference
|
|
6
6
|
|
|
7
|
-
Key commands: create,
|
|
7
|
+
Key commands: onboard, create, generate, validate. See README for full options.`,readme:`# ContractSpec CLI
|
|
8
8
|
|
|
9
|
-
Stabilize AI-generated code across API, DB, UI, events. Use create/
|
|
10
|
-
`)},{type:"resource",uri:"contracts://list",title:"Available contracts"}]})),j}import{defineCommand as R,installOp as v,OperationSpecRegistry as AY}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as _,ScalarTypeEnum as B}from"@contractspec/lib.schema";var T=["@contractspec"],f=["contracts","mcp"];function Tj(j){let Y=new AY,J=_({name:"ContractsListInput",fields:{pattern:{type:B.String_unsecure(),isOptional:!0},type:{type:B.String_unsecure(),isOptional:!0}}}),Q=_({name:"ContractsListOutput",fields:{specs:{type:B.JSON(),isOptional:!1},total:{type:B.Int_unsecure(),isOptional:!1}}});v(Y,R({meta:{key:"contracts.list",version:"1.0.0",stability:"beta",owners:T,tags:f,description:"List contract specs in the workspace.",goal:"Discover available contracts by type, pattern, or owner.",context:"Contracts MCP server."},io:{input:J,output:Q},policy:{auth:"anonymous"}}),async({pattern:V,type:H})=>{let G=await j.listSpecs({pattern:V,type:H});return{specs:G,total:G.length}});let $=_({name:"ContractsGetInput",fields:{path:{type:B.String_unsecure(),isOptional:!1}}}),Z=_({name:"ContractsGetOutput",fields:{content:{type:B.String_unsecure(),isOptional:!1},info:{type:B.JSON(),isOptional:!1}}});v(Y,R({meta:{key:"contracts.get",version:"1.0.0",stability:"beta",owners:T,tags:f,description:"Read a single contract spec file.",goal:"Fetch spec content and parsed metadata.",context:"Contracts MCP server."},io:{input:$,output:Z},policy:{auth:"anonymous"}}),async({path:V})=>{let H=await j.getSpec(V);if(!H)throw Error(`Spec not found: ${V}`);return H});let X=_({name:"ContractsValidateInput",fields:{path:{type:B.String_unsecure(),isOptional:!1}}}),U=_({name:"ContractsValidateOutput",fields:{valid:{type:B.Boolean(),isOptional:!1},errors:{type:B.JSON(),isOptional:!1},warnings:{type:B.JSON(),isOptional:!1}}});v(Y,R({meta:{key:"contracts.validate",version:"1.0.0",stability:"beta",owners:T,tags:f,description:"Validate a contract spec structure.",goal:"Check spec for structural or policy issues.",context:"Contracts MCP server."},io:{input:X,output:U},policy:{auth:"anonymous"}}),async({path:V})=>j.validateSpec(V));let K=_({name:"ContractsBuildInput",fields:{path:{type:B.String_unsecure(),isOptional:!1},dryRun:{type:B.Boolean(),isOptional:!0}}}),P=_({name:"ContractsBuildOutput",fields:{results:{type:B.JSON(),isOptional:!1}}});return v(Y,R({meta:{key:"contracts.build",version:"1.0.0",stability:"beta",owners:T,tags:f,description:"Generate implementation code from a contract spec.",goal:"Produce handler, component, or test skeletons.",context:"Contracts MCP server."},io:{input:K,output:P},policy:{auth:"user"}}),async({path:V,dryRun:H})=>j.buildSpec(V,{dryRun:H})),CY(Y,j),Y}function CY(j,Y){let J=_({name:"ContractsUpdateInput",fields:{path:{type:B.String_unsecure(),isOptional:!1},content:{type:B.String_unsecure(),isOptional:!0},fields:{type:B.JSON(),isOptional:!0}}}),Q=_({name:"ContractsUpdateOutput",fields:{updated:{type:B.Boolean(),isOptional:!1},errors:{type:B.JSON(),isOptional:!1},warnings:{type:B.JSON(),isOptional:!1}}});v(j,R({meta:{key:"contracts.update",version:"1.0.0",stability:"beta",owners:T,tags:f,description:"Update an existing contract spec.",goal:"Modify spec content or individual fields with validation.",context:"Contracts MCP server."},io:{input:J,output:Q},policy:{auth:"user"}}),async({path:X,content:U,fields:K})=>Y.updateSpec(X,{content:U,fields:Array.isArray(K)?K:void 0}));let $=_({name:"ContractsDeleteInput",fields:{path:{type:B.String_unsecure(),isOptional:!1},clean:{type:B.Boolean(),isOptional:!0}}}),Z=_({name:"ContractsDeleteOutput",fields:{deleted:{type:B.Boolean(),isOptional:!1},cleanedFiles:{type:B.JSON(),isOptional:!1},errors:{type:B.JSON(),isOptional:!1}}});v(j,R({meta:{key:"contracts.delete",version:"1.0.0",stability:"beta",owners:T,tags:f,description:"Delete a contract spec and optionally its artifacts.",goal:"Remove a spec file and clean generated handlers/tests.",context:"Contracts MCP server."},io:{input:$,output:Z},policy:{auth:"user"}}),async({path:X,clean:U})=>Y.deleteSpec(X,{clean:U}))}function gJ(j="/api/mcp/contracts",Y){return M({logger:b,path:j,serverName:"contractspec-contracts-mcp",ops:Tj(Y),resources:Rj(Y),prompts:vj()})}import{defaultDocRegistry as IY}from"@contractspec/lib.contracts-spec/docs";var EY=20,zY=100;function q(j){return j?.trim().toLowerCase()??""}function fj(j){let Y=decodeURIComponent(j).trim();if(!Y)return"/";return Y.startsWith("/")?Y:`/${Y}`}function OY(j){return(Array.isArray(j)?j:j?[j]:[]).map((J)=>q(J)).filter(Boolean)}function kY(j){if(!j||Number.isNaN(j))return EY;return Math.min(Math.max(j,1),zY)}function RY(j){if(!j||Number.isNaN(j))return 0;return Math.max(j,0)}function _j({block:j,route:Y}){return{id:j.id,title:j.title,summary:j.summary??"",route:Y,visibility:j.visibility??"public",kind:j.kind??"reference",version:j.version??"1.0.0",tags:j.tags??[]}}function vY(j,Y){if(!Y)return 1;let J=Y.split(/\s+/).filter(Boolean),Q=q(j.block.title),$=q(j.block.id),Z=q(j.block.summary),X=q(j.block.body),U=q(j.route),K=(j.block.tags??[]).map((H)=>q(H)),P=[Q,$,Z,X,U,...K].join(" ");if(J.some((H)=>!P.includes(H)))return 0;let V=0;for(let H of J){if($.includes(H))V+=8;if(Q.includes(H))V+=7;if(K.some((G)=>G.includes(H)))V+=5;if(Z.includes(H))V+=4;if(U.includes(H))V+=3;if(X.includes(H))V+=2}return V}function h(j,Y){let J=q(typeof Y.query==="string"?Y.query:void 0),Q=OY(Y.tag),$=q(typeof Y.visibility==="string"?Y.visibility:void 0),Z=q(typeof Y.kind==="string"?Y.kind:void 0),X=kY(typeof Y.limit==="number"?Y.limit:void 0),U=RY(typeof Y.offset==="number"?Y.offset:void 0),K=j.map((H)=>({doc:_j(H),score:vY(H,J)})).filter(({doc:H,score:G})=>{let Fj=J?G>0:!0,F=Q.length?Q.every((d)=>H.tags.some((N)=>q(N).includes(d))):!0,W=$?q(H.visibility)===$:!0,D=Z?q(H.kind)===Z:!0;return Fj&&F&&W&&D}).sort((H,G)=>{if(G.score!==H.score)return G.score-H.score;return H.doc.title.localeCompare(G.doc.title)}),P=K.slice(U,U+X).map(({doc:H})=>H),V=U+P.length<K.length?U+P.length:void 0;return{docs:P,items:P,total:K.length,...V!=null?{nextOffset:V}:{}}}function jj(j){let Y=decodeURIComponent(j),J=IY.get(Y);if(!J)return;return{doc:_j(J),content:String(J.block.body??"")}}function Yj(j,Y){let J=fj(Y),Q=j.find(($)=>fj($.route)===J);if(!Q)return;return{doc:_j(Q),content:String(Q.block.body??"")}}function Jj(j){let Y=new Map,J=new Map,Q=new Map;for(let Z of j){let X=Z.block.kind??"reference",U=Z.block.visibility??"public";J.set(X,(J.get(X)??0)+1),Q.set(U,(Q.get(U)??0)+1);for(let K of Z.block.tags??[])Y.set(K,(Y.get(K)??0)+1)}let $=(Z,X)=>[...Z.entries()].sort((U,K)=>K[1]-U[1]||U[0].localeCompare(K[0])).map(([U,K])=>({[X]:U,count:K}));return{totalDocs:j.length,tags:$(Y,"tag"),kinds:$(J,"kind"),visibilities:$(Q,"visibility")}}import{EventRegistry as TY,OperationSpecRegistry as fY}from"@contractspec/lib.contracts-spec";import{DataViewRegistry as hY}from"@contractspec/lib.contracts-spec/data-views";import{ContractReferenceDataView as SY,ContractReferenceQuery as yY,DocsGenerateCommand as mY,DocsGeneratedEvent as gY,DocsIndexDataView as dY,DocsIndexQuery as uY,DocsLayoutPresentation as pY,DocsPublishCommand as lY,DocsPublishedEvent as nY,DocsReferencePagePresentation as cY,DocsSearchForm as iY,ExampleCatalogDataView as oY}from"@contractspec/lib.contracts-spec/docs";import{FormRegistry as aY}from"@contractspec/lib.contracts-spec/forms";import{PresentationRegistry as tY}from"@contractspec/lib.contracts-spec/presentations";import{serializeDataViewSpec as sY,serializeEventSpec as rY,serializeFormSpec as eY,serializeOperationSpec as j0,serializePresentationSpec as Y0}from"@contractspec/lib.contracts-spec/serialization";var Qj=null;function J0(){let j=new fY;return j.register(uY).register(yY).register(mY).register(lY),j}function Q0(){if(!Qj)Qj=J0();return Qj}function bj(j,Y){return Q0().get(j,Y)}var Zj=null;function Z0(){let j=new TY;return j.register(gY).register(nY),j}function $0(){if(!Zj)Zj=Z0();return Zj}function Mj(j,Y){return $0().get(j,Y)}var $j=null;function X0(){let j=new tY;return j.register(pY).register(cY),j}function U0(){if(!$j)$j=X0();return $j}function Dj(j,Y){return U0().get(j,Y)}var Xj=null;function V0(){let j=new hY;return j.register(dY).register(SY).register(oY),j}function H0(){if(!Xj)Xj=V0();return Xj}function Nj(j,Y){return H0().get(j,Y)}var Uj=null;function K0(){let j=new aY;return j.register(iY),j}function B0(){if(!Uj)Uj=K0();return Uj}function Aj(j,Y){return B0().get(j)}function hj(j,Y){let J=bj(j,Y);return j0(J)??void 0}function Sj(j,Y){let J=Mj(j,Y);return rY(J)??void 0}function yj(j,Y){let J=Dj(j,Y);return Y0(J)??void 0}function mj(j,Y){let J=Nj(j,Y);return sY(J)??void 0}function gj(j,Y){let J=Aj(j,Y);return eY(J)??void 0}function w0(){Qj=null}function F0(){Zj=null}function W0(){$j=null}function x0(){Xj=null}function P0(){Uj=null}function tJ(){w0(),F0(),W0(),x0(),P0()}import{defaultDocRegistry as q0}from"@contractspec/lib.contracts-spec/docs";function L0(j){return j?.trim().toLowerCase()??""}function G0(j){for(let Y of j??[]){let J=q0.get(Y);if(J)return J.route}return}function dj(j,Y,J,Q){let $=j.meta.title??j.meta.key,Z=G0(j.meta.docId),X=j.meta.description;return{key:j.meta.key,version:j.meta.version,type:Y,title:$,description:X,markdown:[`# ${$}`,`- Key: ${j.meta.key}`,`- Type: ${Y}`,`- Version: ${j.meta.version}`,Z?`- Docs route: ${Z}`:"",X?`
|
|
9
|
+
Stabilize AI-generated code across API, DB, UI, events. Use onboard/create/generate/validate commands.`},Vj=["cli","mcp"],tj=["@contractspec"],mY=(()=>{let j=new Set([process.cwd(),t.resolve(process.cwd(),".."),t.resolve(process.cwd(),"../.."),t.resolve(process.cwd(),"../../..")]);if(typeof __dirname==="string")j.add(t.resolve(__dirname,"../../../../.."));return[...j]})(),Uj=new Map;async function gY(j){if(Uj.has(j))return Uj.get(j);let Y=SY[j];for(let Q of mY){let $=t.resolve(Q,Y);try{let Z=await kY.readFile($,"utf8");return Uj.set(j,Z),Z}catch{}}let J=yY[j];return Uj.set(j,J),J}function dY(){let j=new fY;return j.register(oj({meta:{uriTemplate:"cli://doc/{slug}",title:"CLI documentation",description:"Quickstart, reference, and README for the CLI.",mimeType:"text/markdown",tags:Vj},input:T.object({slug:T.enum(["quickstart","reference","readme"])}),resolve:async({slug:Y})=>{let J=await gY(Y);return{uri:`cli://doc/${Y}`,mimeType:"text/markdown",data:J}}})),j.register(oj({meta:{uriTemplate:"cli://commands",title:"CLI commands summary",description:"Key ContractSpec CLI commands and when to use them.",mimeType:"application/json",tags:Vj},input:T.object({}),resolve:async()=>{return{uri:"cli://commands",mimeType:"application/json",data:JSON.stringify([{command:"contractspec onboard",summary:"Generate repo-local AGENTS.md and USAGE.md guidance plus recommended tracks.",doc:"cli://doc/quickstart"},{command:"contractspec create",summary:"Interactive wizard to author specs (with optional AI).",doc:"cli://doc/quickstart"},{command:"contractspec build <specPath>",summary:"Generate implementation code from a ContractSpec (agents + templates).",doc:"cli://doc/reference"},{command:"contractspec validate <specPath>",summary:"Validate specs and optionally check implementations against them.",doc:"cli://doc/reference"}],null,2)}}})),pj(j),j}function uY(){let j=new TY;return j.register(OY({meta:{key:"cli.usage",version:"1.0.0",title:"Use ContractSpec CLI safely",description:"Remind agents to read CLI docs and pick commands from the canonical list.",tags:Vj,stability:"beta",owners:tj},args:[{name:"goal",description:"Task the user wants to achieve.",required:!1,schema:T.string().optional()}],input:T.object({goal:T.string().optional()}),render:async({goal:Y})=>[{type:"text",text:`Use CLI commands only from cli://commands. Prefer quickstart for newcomers and reference for options.${Y?` Goal: ${Y}.`:""}`},{type:"resource",uri:"cli://commands",title:"Commands"},{type:"resource",uri:"cli://doc/quickstart",title:"Quickstart"}]})),lj(j),j}function pY(){let j=new hY,Y=aj({name:"CliSuggestInput",fields:{goal:{type:a.String_unsecure(),isOptional:!1},prefersAi:{type:a.Boolean(),isOptional:!0}}}),J=aj({name:"CliSuggestOutput",fields:{command:{type:a.String_unsecure(),isOptional:!1},docUri:{type:a.String_unsecure(),isOptional:!1},reason:{type:a.String_unsecure(),isOptional:!1}}}),Q=vY({meta:{key:"cli_suggestCommand",version:"1.0.0",stability:"stable",owners:tj,tags:Vj,description:"Recommend a CLI command for the requested goal.",goal:"Help AI agents choose the correct CLI entrypoint quickly.",context:"Used inside the CLI MCP server."},io:{input:Y,output:J},policy:{auth:"anonymous"}});return RY(j,Q,async({goal:$,prefersAi:Z})=>{let X=$.toLowerCase();if(X.includes("onboard")||X.includes("start")||X.includes("guide")||X.includes("install"))return{command:"contractspec onboard",docUri:"cli://doc/quickstart",reason:"Starts the CLI-first onboarding flow for the current repo."};if(X.includes("create")||X.includes("new"))return{command:Z?"contractspec create --ai":"contractspec create",docUri:"cli://doc/quickstart",reason:"Creates a new ContractSpec interactively (optionally with AI)."};if(X.includes("build")||X.includes("generate"))return{command:"contractspec build <path-to-spec>",docUri:"cli://doc/reference",reason:"Builds implementation code from a spec using agents + templates."};if(X.includes("validate")||X.includes("check"))return{command:"contractspec validate <path-to-spec>",docUri:"cli://doc/reference",reason:"Validates a spec and optionally checks its implementation for drift."};return{command:"contractspec --help",docUri:"cli://doc/readme",reason:"Fallback when the goal is unclear; read README for options."}}),nj(j),j}function QQ(j="/api/mcp/cli"){return A({logger:D,path:j,serverName:"contractspec-cli-mcp",ops:pY(),resources:dY(),prompts:uY()})}import{definePrompt as lY,defineResourceTemplate as s,PromptRegistry as nY,ResourceRegistry as cY}from"@contractspec/lib.contracts-spec";import I from"zod";var iY=["@contractspec"],f=["contracts","mcp"];function sj(j){let Y=new cY;return Y.register(s({meta:{uriTemplate:"contracts://list",title:"Contract specs list",description:"JSON list of all contract specs in the workspace.",mimeType:"application/json",tags:f},input:I.object({}),resolve:async()=>{let J=await j.listSpecs();return{uri:"contracts://list",mimeType:"application/json",data:JSON.stringify(J,null,2)}}})),Y.register(s({meta:{uriTemplate:"contracts://spec/{path}",title:"Contract spec content",description:"Read a single contract spec file by path.",mimeType:"text/plain",tags:f},input:I.object({path:I.string()}),resolve:async({path:J})=>{let Q=await j.getSpec(J);if(!Q)return{uri:`contracts://spec/${encodeURIComponent(J)}`,mimeType:"text/plain",data:`Spec not found: ${J}`};return{uri:`contracts://spec/${encodeURIComponent(J)}`,mimeType:"text/plain",data:Q.content}}})),Y.register(s({meta:{uriTemplate:"contracts://registry/manifest",title:"Remote registry manifest",description:"Contract registry manifest from the remote server.",mimeType:"application/json",tags:f},input:I.object({}),resolve:async()=>{let J=await j.fetchRegistryManifest();return{uri:"contracts://registry/manifest",mimeType:"application/json",data:JSON.stringify(J,null,2)}}})),Y.register(s({meta:{uriTemplate:"adoption://catalog",title:"ContractSpec adoption catalog",description:"Bundled ContractSpec adoption catalog used by Connect and MCP.",mimeType:"application/json",tags:f},input:I.object({}),resolve:async()=>{let J=await j.searchAdoptionCatalog({query:"contractspec"});return{uri:"adoption://catalog",mimeType:"application/json",data:JSON.stringify(J,null,2)}}})),Y.register(s({meta:{uriTemplate:"adoption://policy/{family}",title:"ContractSpec adoption policy",description:"Family-aware adoption recommendation and verdict policy.",mimeType:"application/json",tags:f},input:I.object({family:I.string()}),resolve:async({family:J})=>{let Q=await j.resolveAdoption({family:J,query:J});return{uri:`adoption://policy/${encodeURIComponent(J)}`,mimeType:"application/json",data:JSON.stringify(Q,null,2)}}})),Y}function rj(){let j=new nY;return j.register(lY({meta:{key:"contracts.editor",version:"1.0.0",title:"Contract editing guide",description:"Guide AI agents through reading, editing, and validating contracts.",tags:f,stability:"beta",owners:iY},args:[{name:"goal",description:"What the agent wants to achieve with the contract.",required:!1,schema:I.string().optional()}],input:I.object({goal:I.string().optional()}),render:async({goal:Y})=>[{type:"text",text:["Contract editing workflow:","1. Use contracts.list to discover specs","2. Use contracts.get to read a spec","3. Edit content and call contracts.update","4. Run contracts.validate to verify changes","5. Run contracts.build to regenerate artifacts","6. Use adoption.resolve to prefer existing workspace or ContractSpec surfaces before inventing new ones",Y?`Agent goal: ${Y}`:""].filter(Boolean).join(`
|
|
10
|
+
`)},{type:"resource",uri:"contracts://list",title:"Available contracts"}]})),j}import{defineCommand as Oj,installOp as Rj}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as S,ScalarTypeEnum as b}from"@contractspec/lib.schema";var hj=["@contractspec"],Tj=["contracts","mcp","adoption"];function ej(j,Y){let J=S({name:"AdoptionCatalogSearchInput",fields:{query:{type:b.String_unsecure(),isOptional:!1},family:{type:b.String_unsecure(),isOptional:!0},platform:{type:b.String_unsecure(),isOptional:!0}}}),Q=S({name:"AdoptionCatalogSearchOutput",fields:{results:{type:b.JSON(),isOptional:!1}}});Rj(j,Oj({meta:{key:"adoption.catalog_search",version:"1.0.0",stability:"beta",owners:hj,tags:Tj,description:"Search the local ContractSpec adoption catalog.",goal:"Find relevant ContractSpec reuse candidates for a query.",context:"Contracts MCP server."},io:{input:J,output:Q},policy:{auth:"anonymous"}}),async({family:V,platform:B,query:H})=>({results:await Y.searchAdoptionCatalog({family:V,platform:B,query:H})}));let $=S({name:"AdoptionResolveInput",fields:{family:{type:b.String_unsecure(),isOptional:!1},query:{type:b.String_unsecure(),isOptional:!1},paths:{type:b.JSON(),isOptional:!0},platform:{type:b.String_unsecure(),isOptional:!0},runtime:{type:b.String_unsecure(),isOptional:!0}}}),Z=S({name:"AdoptionResolveOutput",fields:{resolution:{type:b.JSON(),isOptional:!1}}});Rj(j,Oj({meta:{key:"adoption.resolve",version:"1.0.0",stability:"beta",owners:hj,tags:Tj,description:"Resolve the best adoption candidate for one family.",goal:"Provide one ordered recommendation that matches Connect.",context:"Contracts MCP server."},io:{input:$,output:Z},policy:{auth:"anonymous"}}),async({family:V,paths:B,platform:H,query:K,runtime:P})=>({resolution:await Y.resolveAdoption({family:V,paths:Array.isArray(B)?B:void 0,platform:H,query:K,runtime:P})}));let X=S({name:"AdoptionSyncInput",fields:{}}),U=S({name:"AdoptionSyncOutput",fields:{catalogPath:{type:b.String_unsecure(),isOptional:!1},total:{type:b.Int_unsecure(),isOptional:!1}}});Rj(j,Oj({meta:{key:"adoption.sync",version:"1.0.0",stability:"beta",owners:hj,tags:Tj,description:"Mirror the bundled ContractSpec adoption catalog locally.",goal:"Refresh the local adoption catalog used by Connect and MCP.",context:"Contracts MCP server."},io:{input:X,output:U},policy:{auth:"user"}}),async()=>Y.syncAdoptionCatalog())}import{defineCommand as y,installOp as m,OperationSpecRegistry as oY}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as G,ScalarTypeEnum as w}from"@contractspec/lib.schema";var g=["@contractspec"],d=["contracts","mcp"];function jY(j){let Y=new oY,J=G({name:"ContractsListInput",fields:{pattern:{type:w.String_unsecure(),isOptional:!0},type:{type:w.String_unsecure(),isOptional:!0}}}),Q=G({name:"ContractsListOutput",fields:{specs:{type:w.JSON(),isOptional:!1},total:{type:w.Int_unsecure(),isOptional:!1}}});m(Y,y({meta:{key:"contracts.list",version:"1.0.0",stability:"beta",owners:g,tags:d,description:"List contract specs in the workspace.",goal:"Discover available contracts by type, pattern, or owner.",context:"Contracts MCP server."},io:{input:J,output:Q},policy:{auth:"anonymous"}}),async({pattern:H,type:K})=>{let P=await j.listSpecs({pattern:H,type:K});return{specs:P,total:P.length}});let $=G({name:"ContractsGetInput",fields:{path:{type:w.String_unsecure(),isOptional:!1}}}),Z=G({name:"ContractsGetOutput",fields:{content:{type:w.String_unsecure(),isOptional:!1},info:{type:w.JSON(),isOptional:!1}}});m(Y,y({meta:{key:"contracts.get",version:"1.0.0",stability:"beta",owners:g,tags:d,description:"Read a single contract spec file.",goal:"Fetch spec content and parsed metadata.",context:"Contracts MCP server."},io:{input:$,output:Z},policy:{auth:"anonymous"}}),async({path:H})=>{let K=await j.getSpec(H);if(!K)throw Error(`Spec not found: ${H}`);return K});let X=G({name:"ContractsValidateInput",fields:{path:{type:w.String_unsecure(),isOptional:!1}}}),U=G({name:"ContractsValidateOutput",fields:{valid:{type:w.Boolean(),isOptional:!1},errors:{type:w.JSON(),isOptional:!1},warnings:{type:w.JSON(),isOptional:!1}}});m(Y,y({meta:{key:"contracts.validate",version:"1.0.0",stability:"beta",owners:g,tags:d,description:"Validate a contract spec structure.",goal:"Check spec for structural or policy issues.",context:"Contracts MCP server."},io:{input:X,output:U},policy:{auth:"anonymous"}}),async({path:H})=>j.validateSpec(H));let V=G({name:"ContractsBuildInput",fields:{path:{type:w.String_unsecure(),isOptional:!1},dryRun:{type:w.Boolean(),isOptional:!0}}}),B=G({name:"ContractsBuildOutput",fields:{results:{type:w.JSON(),isOptional:!1}}});return m(Y,y({meta:{key:"contracts.build",version:"1.0.0",stability:"beta",owners:g,tags:d,description:"Generate implementation code from a contract spec.",goal:"Produce handler, component, or test skeletons.",context:"Contracts MCP server."},io:{input:V,output:B},policy:{auth:"user"}}),async({path:H,dryRun:K})=>j.buildSpec(H,{dryRun:K})),aY(Y,j),ej(Y,j),Y}function aY(j,Y){let J=G({name:"ContractsUpdateInput",fields:{path:{type:w.String_unsecure(),isOptional:!1},content:{type:w.String_unsecure(),isOptional:!0},fields:{type:w.JSON(),isOptional:!0}}}),Q=G({name:"ContractsUpdateOutput",fields:{updated:{type:w.Boolean(),isOptional:!1},errors:{type:w.JSON(),isOptional:!1},warnings:{type:w.JSON(),isOptional:!1}}});m(j,y({meta:{key:"contracts.update",version:"1.0.0",stability:"beta",owners:g,tags:d,description:"Update an existing contract spec.",goal:"Modify spec content or individual fields with validation.",context:"Contracts MCP server."},io:{input:J,output:Q},policy:{auth:"user"}}),async({path:X,content:U,fields:V})=>Y.updateSpec(X,{content:U,fields:Array.isArray(V)?V:void 0}));let $=G({name:"ContractsDeleteInput",fields:{path:{type:w.String_unsecure(),isOptional:!1},clean:{type:w.Boolean(),isOptional:!0}}}),Z=G({name:"ContractsDeleteOutput",fields:{deleted:{type:w.Boolean(),isOptional:!1},cleanedFiles:{type:w.JSON(),isOptional:!1},errors:{type:w.JSON(),isOptional:!1}}});m(j,y({meta:{key:"contracts.delete",version:"1.0.0",stability:"beta",owners:g,tags:d,description:"Delete a contract spec and optionally its artifacts.",goal:"Remove a spec file and clean generated handlers/tests.",context:"Contracts MCP server."},io:{input:$,output:Z},policy:{auth:"user"}}),async({path:X,clean:U})=>Y.deleteSpec(X,{clean:U}))}function _Q(j="/api/mcp/contracts",Y){return A({logger:D,path:j,serverName:"contractspec-contracts-mcp",ops:jY(Y),resources:sj(Y),prompts:rj()})}import{defaultDocRegistry as tY}from"@contractspec/lib.contracts-spec/docs";var sY=20,rY=100;function _(j){return j?.trim().toLowerCase()??""}function YY(j){let Y=decodeURIComponent(j).trim();if(!Y)return"/";return Y.startsWith("/")?Y:`/${Y}`}function eY(j){return(Array.isArray(j)?j:j?[j]:[]).map((J)=>_(J)).filter(Boolean)}function j0(j){if(!j||Number.isNaN(j))return sY;return Math.min(Math.max(j,1),rY)}function Y0(j){if(!j||Number.isNaN(j))return 0;return Math.max(j,0)}function fj({block:j,route:Y}){return{id:j.id,title:j.title,summary:j.summary??"",route:Y,visibility:j.visibility??"public",kind:j.kind??"reference",version:j.version??"1.0.0",tags:j.tags??[]}}function J0(j,Y){if(!Y)return 1;let J=Y.split(/\s+/).filter(Boolean),Q=_(j.block.title),$=_(j.block.id),Z=_(j.block.summary),X=_(j.block.body),U=_(j.route),V=(j.block.tags??[]).map((K)=>_(K)),B=[Q,$,Z,X,U,...V].join(" ");if(J.some((K)=>!B.includes(K)))return 0;let H=0;for(let K of J){if($.includes(K))H+=8;if(Q.includes(K))H+=7;if(V.some((P)=>P.includes(K)))H+=5;if(Z.includes(K))H+=4;if(U.includes(K))H+=3;if(X.includes(K))H+=2}return H}function u(j,Y){let J=_(typeof Y.query==="string"?Y.query:void 0),Q=eY(Y.tag),$=_(typeof Y.visibility==="string"?Y.visibility:void 0),Z=_(typeof Y.kind==="string"?Y.kind:void 0),X=j0(typeof Y.limit==="number"?Y.limit:void 0),U=Y0(typeof Y.offset==="number"?Y.offset:void 0),V=j.map((K)=>({doc:fj(K),score:J0(K,J)})).filter(({doc:K,score:P})=>{let Gj=J?P>0:!0,W=Q.length?Q.every((i)=>K.tags.some((z)=>_(z).includes(i))):!0,x=$?_(K.visibility)===$:!0,N=Z?_(K.kind)===Z:!0;return Gj&&W&&x&&N}).sort((K,P)=>{if(P.score!==K.score)return P.score-K.score;return K.doc.title.localeCompare(P.doc.title)}),B=V.slice(U,U+X).map(({doc:K})=>K),H=U+B.length<V.length?U+B.length:void 0;return{docs:B,items:B,total:V.length,...H!=null?{nextOffset:H}:{}}}function Hj(j){let Y=decodeURIComponent(j),J=tY.get(Y);if(!J)return;return{doc:fj(J),content:String(J.block.body??"")}}function Kj(j,Y){let J=YY(Y),Q=j.find(($)=>YY($.route)===J);if(!Q)return;return{doc:fj(Q),content:String(Q.block.body??"")}}function wj(j){let Y=new Map,J=new Map,Q=new Map;for(let Z of j){let X=Z.block.kind??"reference",U=Z.block.visibility??"public";J.set(X,(J.get(X)??0)+1),Q.set(U,(Q.get(U)??0)+1);for(let V of Z.block.tags??[])Y.set(V,(Y.get(V)??0)+1)}let $=(Z,X)=>[...Z.entries()].sort((U,V)=>V[1]-U[1]||U[0].localeCompare(V[0])).map(([U,V])=>({[X]:U,count:V}));return{totalDocs:j.length,tags:$(Y,"tag"),kinds:$(J,"kind"),visibilities:$(Q,"visibility")}}import{EventRegistry as Q0,OperationSpecRegistry as Z0}from"@contractspec/lib.contracts-spec";import{DataViewRegistry as $0}from"@contractspec/lib.contracts-spec/data-views";import{ContractReferenceDataView as X0,ContractReferenceQuery as U0,DocsGenerateCommand as V0,DocsGeneratedEvent as H0,DocsIndexDataView as K0,DocsIndexQuery as w0,DocsLayoutPresentation as F0,DocsPublishCommand as B0,DocsPublishedEvent as W0,DocsReferencePagePresentation as x0,DocsSearchForm as P0,ExampleCatalogDataView as L0}from"@contractspec/lib.contracts-spec/docs";import{FormRegistry as q0}from"@contractspec/lib.contracts-spec/forms";import{PresentationRegistry as _0}from"@contractspec/lib.contracts-spec/presentations";import{serializeDataViewSpec as M0,serializeEventSpec as b0,serializeFormSpec as G0,serializeOperationSpec as D0,serializePresentationSpec as C0}from"@contractspec/lib.contracts-spec/serialization";var Fj=null;function A0(){let j=new Z0;return j.register(w0).register(U0).register(V0).register(B0),j}function I0(){if(!Fj)Fj=A0();return Fj}function Sj(j,Y){return I0().get(j,Y)}var Bj=null;function N0(){let j=new Q0;return j.register(H0).register(W0),j}function z0(){if(!Bj)Bj=N0();return Bj}function yj(j,Y){return z0().get(j,Y)}var Wj=null;function E0(){let j=new _0;return j.register(F0).register(x0),j}function k0(){if(!Wj)Wj=E0();return Wj}function mj(j,Y){return k0().get(j,Y)}var xj=null;function v0(){let j=new $0;return j.register(K0).register(X0).register(L0),j}function O0(){if(!xj)xj=v0();return xj}function gj(j,Y){return O0().get(j,Y)}var Pj=null;function R0(){let j=new q0;return j.register(P0),j}function h0(){if(!Pj)Pj=R0();return Pj}function dj(j,Y){return h0().get(j)}function JY(j,Y){let J=Sj(j,Y);return D0(J)??void 0}function QY(j,Y){let J=yj(j,Y);return b0(J)??void 0}function ZY(j,Y){let J=mj(j,Y);return C0(J)??void 0}function $Y(j,Y){let J=gj(j,Y);return M0(J)??void 0}function XY(j,Y){let J=dj(j,Y);return G0(J)??void 0}function T0(){Fj=null}function f0(){Bj=null}function S0(){Wj=null}function y0(){xj=null}function m0(){Pj=null}function EQ(){T0(),f0(),S0(),y0(),m0()}import{defaultDocRegistry as g0}from"@contractspec/lib.contracts-spec/docs";function d0(j){return j?.trim().toLowerCase()??""}function u0(j){for(let Y of j??[]){let J=g0.get(Y);if(J)return J.route}return}function UY(j,Y,J,Q){let $=j.meta.title??j.meta.key,Z=u0(j.meta.docId),X=j.meta.description;return{key:j.meta.key,version:j.meta.version,type:Y,title:$,description:X,markdown:[`# ${$}`,`- Key: ${j.meta.key}`,`- Type: ${Y}`,`- Version: ${j.meta.version}`,Z?`- Docs route: ${Z}`:"",X?`
|
|
11
11
|
${X}`:""].filter(Boolean).join(`
|
|
12
|
-
`),...Z?{route:Z}:{},...J?{schema:J}:{},...Q?{policy:Q}:{},tags:j.meta.tags??[],owners:j.meta.owners??[],stability:j.meta.stability}}function
|
|
12
|
+
`),...Z?{route:Z}:{},...J?{schema:J}:{},...Q?{policy:Q}:{},tags:j.meta.tags??[],owners:j.meta.owners??[],stability:j.meta.stability}}function p(j){let Y=j.includeSchema??!1,J=d0(j.type),Q=Sj(j.key,j.version);if(Q&&(!J||J==="operation"||J===Q.meta.kind))return{reference:UY(Q,Q.meta.kind,Y?JY(j.key,j.version):void 0,Q.policy)};let $=[{type:"data-view",spec:gj(j.key,j.version),schema:Y?$Y(j.key,j.version):void 0},{type:"form",spec:dj(j.key,j.version),schema:Y?XY(j.key,j.version):void 0},{type:"presentation",spec:mj(j.key,j.version),schema:Y?ZY(j.key,j.version):void 0},{type:"event",spec:yj(j.key,j.version),schema:Y?QY(j.key,j.version):void 0}];for(let Z of $)if(Z.spec&&(!J||J===Z.type))return{reference:UY(Z.spec,Z.type,Z.schema)};throw Error(`Contract reference not found: ${j.key}`)}import{definePrompt as VY,PromptRegistry as p0}from"@contractspec/lib.contracts-spec";import L from"zod";var HY=["@contractspec"],KY=["docs","mcp"];function wY(j){let Y=new p0;return Y.register(VY({meta:{key:"docs.navigator",version:"1.0.0",title:"Find relevant ContractSpec docs",description:"Guide agents to search, filter, and open the right ContractSpec docs.",tags:KY,stability:"beta",owners:HY},args:[{name:"topic",description:"Goal or subject to search for.",required:!1,schema:L.string().optional()},{name:"kind",description:"Optional doc kind filter.",required:!1,schema:L.string().optional()},{name:"tag",description:"Optional tag filter.",required:!1,schema:L.string().optional()}],input:L.object({topic:L.string().optional(),kind:L.string().optional(),tag:L.string().optional()}),render:async({topic:J,kind:Q,tag:$})=>{let Z=u(j,{query:J,kind:Q,tag:$,limit:3}),X=Z.docs.length?Z.docs.map((U)=>`- ${U.title} (${U.id}) -> ${U.route}`).join(`
|
|
13
13
|
`):"- No direct pre-match. Use docs_list_facets-v1_0_0 to browse tags and kinds.";return[{type:"text",text:["Use docs_search-v1_0_0 first, then read docs://doc/{id} for the strongest matches.","Use docs_resolve_route-v1_0_0 when the user already gives you a docs URL or route.","Use docs_list_facets-v1_0_0 or docs://facets to browse the docs taxonomy before guessing.",J?`Topic: ${J}`:"",Q?`Kind: ${Q}`:"",$?`Tag: ${$}`:"","Suggested starting docs:",X].filter(Boolean).join(`
|
|
14
|
-
`)},{type:"resource",uri:"docs://index",title:"DocBlocks index"},{type:"resource",uri:"docs://facets",title:"Docs facets"}]}})),Y.register(
|
|
15
|
-
`)},{type:"resource",uri:`docs://contract-reference/${encodeURIComponent(J)}`,title:"Contract reference"}]}})),Y}import{defineResourceTemplate as
|
|
16
|
-
`)})})),j}function
|
|
14
|
+
`)},{type:"resource",uri:"docs://index",title:"DocBlocks index"},{type:"resource",uri:"docs://facets",title:"Docs facets"}]}})),Y.register(VY({meta:{key:"docs.reference.guide",version:"1.0.0",title:"Resolve a ContractSpec reference",description:"Guide agents to fetch the canonical reference payload for a ContractSpec surface.",tags:KY,stability:"beta",owners:HY},args:[{name:"key",description:"ContractSpec key to resolve.",required:!0,schema:L.string()},{name:"version",description:"Optional version override.",required:!1,schema:L.string().optional()},{name:"type",description:"Optional surface type: command, query, form, data-view, presentation, event.",required:!1,schema:L.string().optional()}],input:L.object({key:L.string(),version:L.string().optional(),type:L.string().optional()}),render:async({key:J,version:Q,type:$})=>{let Z=p({key:J,version:Q,type:$,includeSchema:!0}).reference;return[{type:"text",text:["Use docs_contract_reference-v1_0_0 when you need the canonical docs payload for a ContractSpec surface.","Use docs_get-v1_0_0 only when you already know the exact DocBlock id and need raw markdown.",`Resolved key: ${Z.key}`,`Resolved type: ${Z.type}`,Z.route?`Docs route: ${Z.route}`:"",`Resource URI: docs://contract-reference/${encodeURIComponent(J)}`].filter(Boolean).join(`
|
|
15
|
+
`)},{type:"resource",uri:`docs://contract-reference/${encodeURIComponent(J)}`,title:"Contract reference"}]}})),Y}import{defineResourceTemplate as k,ResourceRegistry as l0}from"@contractspec/lib.contracts-spec";import F from"zod";var v=["docs","mcp"];function FY(j){let Y=new l0,J=(Q)=>u(j,Q);return Y.register(k({meta:{uriTemplate:"docs://index",title:"DocBlocks index",description:"Default ContractSpec docs index resource.",mimeType:"application/json",tags:v},input:F.object({}),resolve:async()=>({uri:"docs://index",mimeType:"application/json",data:JSON.stringify(J({}),null,2)})})),Y.register(k({meta:{uriTemplate:"docs://index{?query,tag,kind,visibility,limit,offset}",title:"DocBlocks index",description:"Search and paginate ContractSpec docs by query, tag, kind, or visibility.",mimeType:"application/json",tags:v},input:F.object({query:F.string().optional(),tag:F.string().optional(),kind:F.string().optional(),visibility:F.string().optional(),limit:F.coerce.number().optional(),offset:F.coerce.number().optional()}),resolve:async(Q)=>({uri:"docs://index",mimeType:"application/json",data:JSON.stringify(J(Q),null,2)})})),Y.register(k({meta:{uriTemplate:"docs://list",title:"DocBlocks index (legacy alias)",description:"Compatibility alias for the docs index resource.",mimeType:"application/json",tags:v},input:F.object({}),resolve:async()=>({uri:"docs://list",mimeType:"application/json",data:JSON.stringify(J({}),null,2)})})),Y.register(k({meta:{uriTemplate:"docs://doc/{id}",title:"Doc markdown",description:"Fetch a single DocBlock body by id as markdown.",mimeType:"text/markdown",tags:v},input:F.object({id:F.string()}),resolve:async({id:Q})=>{let $=Hj(Q);if(!$)return{uri:`docs://doc/${encodeURIComponent(Q)}`,mimeType:"text/plain",data:`DocBlock not found: ${Q}`};return{uri:`docs://doc/${encodeURIComponent(Q)}`,mimeType:"text/markdown",data:$.content}}})),Y.register(k({meta:{uriTemplate:"docs://route/{routePath}",title:"Doc by route",description:"Resolve a docs route to the matching DocBlock summary and body.",mimeType:"application/json",tags:v},input:F.object({routePath:F.string()}),resolve:async({routePath:Q})=>({uri:`docs://route/${encodeURIComponent(Q)}`,mimeType:"application/json",data:JSON.stringify(Kj(j,Q)??{error:"not_found",route:Q},null,2)})})),Y.register(k({meta:{uriTemplate:"docs://facets",title:"Docs facets",description:"Counts of available tags, kinds, and visibilities across docs.",mimeType:"application/json",tags:v},input:F.object({}),resolve:async()=>({uri:"docs://facets",mimeType:"application/json",data:JSON.stringify(wj(j),null,2)})})),Y.register(k({meta:{uriTemplate:"docs://contract-reference/{key}{?version,type,includeSchema}",title:"Contract reference",description:"Resolve a ContractSpec surface into a docs-ready reference payload.",mimeType:"application/json",tags:v},input:F.object({key:F.string(),version:F.string().optional(),type:F.string().optional(),includeSchema:F.coerce.boolean().optional()}),resolve:async({key:Q,version:$,type:Z,includeSchema:X})=>({uri:`docs://contract-reference/${encodeURIComponent(Q)}`,mimeType:"application/json",data:JSON.stringify(p({key:Q,version:$,type:Z,includeSchema:X}),null,2)})})),Y}import{defineCommand as r,defineSchemaModel as l,installOp as e,OperationSpecRegistry as n0}from"@contractspec/lib.contracts-spec";import{ContractReferenceInput as c0,ContractReferenceOutput as i0,DocsIndexInput as o0,DocsIndexOutput as a0}from"@contractspec/lib.contracts-spec/docs";import{ScalarTypeEnum as O}from"@contractspec/lib.schema";var jj=["@contractspec"],Yj=["docs","mcp"],t0=l({name:"DocsGetInput",fields:{id:{type:O.String_unsecure(),isOptional:!1}}}),s0=l({name:"DocsGetOutput",fields:{doc:{type:O.JSON(),isOptional:!1},content:{type:O.String_unsecure(),isOptional:!1}}}),r0=l({name:"DocsResolveRouteInput",fields:{route:{type:O.String_unsecure(),isOptional:!1}}}),e0=l({name:"DocsResolveRouteOutput",fields:{doc:{type:O.JSON(),isOptional:!1},content:{type:O.String_unsecure(),isOptional:!1}}}),jJ=l({name:"DocsFacetsInput",fields:{}}),YJ=l({name:"DocsFacetsOutput",fields:{facets:{type:O.JSON(),isOptional:!1}}});function BY(j){let Y=new n0;return e(Y,r({meta:{key:"docs.search",version:"1.0.0",stability:"beta",owners:jj,tags:Yj,description:"Search ContractSpec docs by query, tag, kind, or visibility.",goal:"Find the most relevant DocBlocks without browsing the full corpus.",context:"Read-only docs MCP search surface."},io:{input:o0,output:a0},policy:{auth:"anonymous"},transport:{mcp:{toolName:"docs_search-v1_0_0"}}}),async(J)=>u(j,J)),e(Y,r({meta:{key:"docs.get",version:"1.0.0",stability:"beta",owners:jj,tags:Yj,description:"Read a single DocBlock by id.",goal:"Fetch the exact markdown content and metadata for a known doc id.",context:"Read-only docs MCP surface."},io:{input:t0,output:s0},policy:{auth:"anonymous"},transport:{mcp:{toolName:"docs_get-v1_0_0"}}}),async({id:J})=>{let Q=Hj(J);if(!Q)throw Error(`DocBlock not found: ${J}`);return Q}),e(Y,r({meta:{key:"docs.resolveRoute",version:"1.0.0",stability:"beta",owners:jj,tags:Yj,description:"Resolve a docs route to the matching DocBlock.",goal:"Turn a route or URL path into a canonical doc id and markdown body.",context:"Read-only docs MCP surface."},io:{input:r0,output:e0},policy:{auth:"anonymous"},transport:{mcp:{toolName:"docs_resolve_route-v1_0_0"}}}),async({route:J})=>{let Q=Kj(j,J);if(!Q)throw Error(`Doc route not found: ${J}`);return Q}),e(Y,r({meta:{key:"docs.contract.lookup",version:"1.0.0",stability:"beta",owners:jj,tags:Yj,description:"Resolve a ContractSpec surface into a docs-ready reference payload.",goal:"Get canonical docs metadata, route, and optional schema for a spec key.",context:"Read-only docs MCP surface."},io:{input:c0,output:i0},policy:{auth:"anonymous"},transport:{mcp:{toolName:"docs_contract_reference-v1_0_0"}}}),async(J)=>p(J)),e(Y,r({meta:{key:"docs.list.facets",version:"1.0.0",stability:"beta",owners:jj,tags:Yj,description:"List docs taxonomy facets such as tags, kinds, and visibilities.",goal:"Help agents browse the docs corpus before making targeted reads.",context:"Read-only docs MCP surface."},io:{input:jJ,output:YJ},policy:{auth:"anonymous"},transport:{mcp:{toolName:"docs_list_facets-v1_0_0"}}}),async()=>({facets:wj(j)})),Y}import{defaultDocRegistry as JJ}from"@contractspec/lib.contracts-spec/docs";function JZ(j="/api/mcp/docs",Y={}){let J=JJ.list();return A({logger:D,path:j,serverName:"contractspec-docs-mcp",ops:BY(J),resources:FY(J),prompts:wY(J),presentations:Y.includePresentations?J.map(({descriptor:Q})=>Q):void 0})}import{defineCommand as QJ,definePrompt as ZJ,defineResourceTemplate as Lj,installOp as $J,OperationSpecRegistry as XJ,PromptRegistry as UJ,ResourceRegistry as VJ}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as WY,ScalarTypeEnum as xY}from"@contractspec/lib.schema";import{getExample as HJ,listExamples as KJ,searchExamples as wJ}from"@contractspec/module.examples";import R from"zod";var n=["internal","mcp"],PY=["@contractspec"],Jj={docs:"/api/mcp/docs",cli:"/api/mcp/cli",internal:"/api/mcp/internal",graphql:"/graphql",health:"/health"};function FJ(){let j=new VJ;return j.register(Lj({meta:{uriTemplate:"examples://list{?q}",title:"ContractSpec examples registry",description:"List available examples (templates, integrations, knowledge, scripts). Optional query `q` filters results.",mimeType:"application/json",tags:["examples",...n]},input:R.object({q:R.string().optional()}),resolve:async({q:Y})=>{let J=Y?wJ(Y):[...KJ()];return{uri:Y?`examples://list?q=${encodeURIComponent(Y)}`:"examples://list",mimeType:"application/json",data:JSON.stringify(J,null,2)}}})),j.register(Lj({meta:{uriTemplate:"examples://example/{id}",title:"ContractSpec example (by id)",description:"Fetch a single example manifest by id.",mimeType:"application/json",tags:["examples",...n]},input:R.object({id:R.string().min(1)}),resolve:async({id:Y})=>{let J=HJ(Y);if(!J)return{uri:`examples://example/${encodeURIComponent(Y)}`,mimeType:"application/json",data:JSON.stringify({error:"not_found",id:Y,message:`Unknown example id: ${Y}`},null,2)};return{uri:`examples://example/${encodeURIComponent(Y)}`,mimeType:"application/json",data:JSON.stringify(J,null,2)}}})),j.register(Lj({meta:{uriTemplate:"internal://endpoints",title:"ContractSpec MCP endpoints",description:"Endpoints for docs, CLI, internal MCP servers.",mimeType:"application/json",tags:n},input:R.object({}),resolve:async()=>({uri:"internal://endpoints",mimeType:"application/json",data:JSON.stringify(Jj,null,2)})})),j.register(Lj({meta:{uriTemplate:"internal://playbook",title:"Internal MCP usage playbook",description:"How internal agents should discover docs, CLI usage, and endpoints.",mimeType:"text/markdown",tags:n},input:R.object({}),resolve:async()=>({uri:"internal://playbook",mimeType:"text/markdown",data:["# Internal MCP playbook","- Connect to docs MCP first for canonical specs.","- Use CLI MCP to surface quickstart/reference before running commands.","- Keep calls read-only unless explicitly approved.",`- Endpoints: ${Jj.docs}, ${Jj.cli}, ${Jj.internal}.`,"- For API work, GraphQL at /graphql; health at /health."].join(`
|
|
16
|
+
`)})})),j}function BJ(){let j=new UJ;return j.register(ZJ({meta:{key:"internal_bootstrap",version:"1.0.0",title:"Bootstrap internal ContractSpec agent",description:"Points agents to the correct MCP endpoints and guardrails.",tags:n,owners:PY,stability:"beta"},args:[],input:R.object({}),render:async()=>[{type:"text",text:"Start with internal://endpoints to pick the right MCP. Use docs MCP for specifications and CLI MCP for commands. Keep actions read-only unless explicitly approved."},{type:"resource",uri:"internal://endpoints",title:"Endpoints"}]})),j}function WJ(){let j=new XJ,Y=WY({name:"InternalDescribeOutput",fields:{endpoints:{type:xY.JSONObject(),isOptional:!1},notes:{type:xY.String_unsecure(),isOptional:!1}}}),J=QJ({meta:{key:"internal_describe",version:"1.0.0",stability:"stable",owners:PY,tags:n,description:"Return MCP endpoints and guidance for internal ContractSpec agents.",goal:"Speed up internal development with the correct MCP entrypoints.",context:"Used by internal MCP surface; read-only."},io:{input:WY({name:"InternalDescribeInput",fields:{}}),output:Y},policy:{auth:"anonymous"}});return $J(j,J,async()=>({endpoints:Jj,notes:"Use docs MCP for canonical specs, CLI MCP for contractspec commands, and keep side-effecting actions gated behind human review."})),j}function KZ(j="/api/mcp/internal"){return A({logger:D,path:j,serverName:"contractspec-internal-mcp",ops:WJ(),resources:FJ(),prompts:BJ()})}import{getModelInfo as xJ}from"@contractspec/lib.ai-providers/models";import{definePrompt as PJ,defineResourceTemplate as qj,installOp as uj,OperationSpecRegistry as LJ,PromptRegistry as qJ,ResourceRegistry as _J}from"@contractspec/lib.contracts-spec";import{BenchmarkIngestCommand as MJ,BenchmarkRunCustomCommand as bJ,RankingRefreshCommand as GJ}from"@contractspec/lib.contracts-spec/provider-ranking";import{InMemoryProviderRankingStore as DJ}from"@contractspec/lib.provider-ranking/in-memory-store";import{createDefaultIngesterRegistry as CJ}from"@contractspec/lib.provider-ranking/ingesters";import{computeModelRankings as AJ,normalizeBenchmarkResults as IJ}from"@contractspec/lib.provider-ranking/scoring";import M from"zod";var Mj=M.enum(["rest","mcp","webhook","sdk"]).optional(),bj=M.enum(["api-key","oauth2","bearer","header","basic","webhook-signing","service-account"]).optional(),Qj=["ranking","mcp","ai"],NJ=["platform.ai"],_j=null;function c(){if(!_j)_j=new DJ;return _j}function zJ(){let j=new _J;return j.register(qj({meta:{uriTemplate:"ranking://leaderboard",title:"AI Model Leaderboard",description:"Current ranked list of AI models by composite score. Supports optional transport and authMethod query filters.",mimeType:"application/json",tags:Qj},input:M.object({transport:Mj,authMethod:bj}),resolve:async({transport:Y,authMethod:J})=>{let $=await c().listModelRankings({limit:100,requiredTransport:Y,requiredAuthMethod:J});return{uri:"ranking://leaderboard",mimeType:"application/json",data:JSON.stringify($,null,2)}}})),j.register(qj({meta:{uriTemplate:"ranking://leaderboard/{dimension}",title:"AI Model Leaderboard by Dimension",description:"Ranked list of AI models filtered by a specific dimension. Supports optional transport and authMethod query filters.",mimeType:"application/json",tags:Qj},input:M.object({dimension:M.string(),transport:Mj,authMethod:bj}),resolve:async({dimension:Y,transport:J,authMethod:Q})=>{let Z=await c().listModelRankings({dimension:Y,limit:100,requiredTransport:J,requiredAuthMethod:Q});return{uri:`ranking://leaderboard/${encodeURIComponent(Y)}`,mimeType:"application/json",data:JSON.stringify(Z,null,2)}}})),j.register(qj({meta:{uriTemplate:"ranking://model/{modelId}",title:"AI Model Profile",description:"Detailed profile for a specific AI model including scores and benchmarks.",mimeType:"application/json",tags:Qj},input:M.object({modelId:M.string()}),resolve:async({modelId:Y})=>{let Q=await c().getModelProfile(Y);if(!Q)return{uri:`ranking://model/${encodeURIComponent(Y)}`,mimeType:"application/json",data:JSON.stringify({error:"not_found",modelId:Y})};let $=Q.costPerMillion==null?(()=>{let Z=xJ(Q.modelId);return Z?.costPerMillion?{...Q,costPerMillion:Z.costPerMillion,displayName:Z.name,contextWindow:Z.contextWindow,capabilities:[...Z.capabilities.vision?["vision"]:[],...Z.capabilities.tools?["tools"]:[],...Z.capabilities.reasoning?["reasoning"]:[],...Z.capabilities.streaming?["streaming"]:[]]}:Q})():Q;return{uri:`ranking://model/${encodeURIComponent(Y)}`,mimeType:"application/json",data:JSON.stringify($,null,2)}}})),j.register(qj({meta:{uriTemplate:"ranking://results",title:"Benchmark Results",description:"List of raw benchmark results from all ingested sources.",mimeType:"application/json",tags:Qj},input:M.object({}),resolve:async()=>{let J=await c().listBenchmarkResults({limit:200});return{uri:"ranking://results",mimeType:"application/json",data:JSON.stringify(J,null,2)}}})),j}function EJ(){let j=new qJ;return j.register(PJ({meta:{key:"ranking.advisor",version:"1.0.0",title:"AI Model Advisor",description:"Which AI model is best for a given task? Uses the leaderboard to recommend.",tags:Qj,stability:"beta",owners:NJ},args:[{name:"task",description:"The task or use case to recommend a model for.",required:!0,schema:M.string()},{name:"priority",description:"Priority dimension (coding, reasoning, cost, latency, etc.).",required:!1,schema:M.string().optional()},{name:"transport",description:"Required transport type (rest, mcp, webhook, sdk).",required:!1,schema:Mj},{name:"authMethod",description:"Required auth method (api-key, oauth2, bearer, etc.).",required:!1,schema:bj}],input:M.object({task:M.string(),priority:M.string().optional(),transport:Mj,authMethod:bj}),render:async({task:Y,priority:J,transport:Q,authMethod:$})=>{let Z=[];if(J)Z.push(`Prioritize: ${J}.`);if(Q)Z.push(`Required transport: ${Q}.`);if($)Z.push(`Required auth: ${$}.`);return[{type:"text",text:`Recommend the best AI model for: "${Y}".${Z.length?` ${Z.join(" ")}`:""} Use the leaderboard data to justify your recommendation.`},{type:"resource",uri:J?`ranking://leaderboard/${J}`:"ranking://leaderboard",title:"Leaderboard"}]}})),j}function kJ(){let j=new LJ,Y=CJ();return uj(j,MJ,async(J)=>{let Q=c(),$=J.source,Z=Y.get($);if(!Z)throw Error(`No ingester registered for source: ${$}`);let X=await Z.ingest({sourceUrl:J.sourceUrl,dimensions:J.dimensions}),U=IJ(X);for(let V of U)await Q.upsertBenchmarkResult(V);return{ingestionId:`ingest-${$}-${Date.now()}`,source:$,resultsCount:U.length,status:"completed",ingestedAt:new Date}}),uj(j,bJ,async(J)=>{return{runId:`custom-${Date.now()}`,evalSuiteKey:J.evalSuiteKey,modelId:J.modelId,status:"started",startedAt:new Date}}),uj(j,GJ,async(J)=>{let Q=c(),$=[],Z=0,X=500;while(!0){let H=await Q.listBenchmarkResults({limit:X,offset:Z});if($.push(...H.results),$.length>=H.total||H.results.length<X)break;Z+=X}let U=new Map((await Q.listModelRankings({limit:1e4})).rankings.map((H)=>[H.modelId,H])),V=J.weightOverrides?Array.isArray(J.weightOverrides)?J.weightOverrides:[J.weightOverrides]:void 0,B=AJ($,V?{weightOverrides:V}:void 0,U);for(let H of B)await Q.upsertModelRanking(H);return{modelsRanked:B.length,updatedAt:new Date,status:"completed"}}),j}function bZ(j="/api/mcp/ranking"){return A({logger:D,path:j,serverName:"contractspec-ranking-mcp",ops:kJ(),resources:zJ(),prompts:EJ()})}function GZ(j){_j=j}export{GZ as setProviderRankingStore,bZ as createProviderRankingMcpHandler,KZ as createInternalMcpHandler,JZ as createDocsMcpHandler,_Q as createContractsMcpHandler,QQ as createCliMcpHandler};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var c=[{key:"start",title:"Start",description:"Install ContractSpec, wire a first contract, and adopt it into an existing codebase."},{key:"core-model",title:"Core Model",description:"Learn how contracts, generated surfaces, policies, overlays, and safe regeneration fit together."},{key:"build",title:"Build",description:"Use practical guides, libraries, architecture patterns, and examples to ship real surfaces."},{key:"operate",title:"Operate",description:"Run the system safely with governance, auditability, tracing, and operator-grade controls."},{key:"integrations",title:"Integrations",description:"Connect models, messaging, storage, payments, search, and external systems through typed bindings."},{key:"reference",title:"Reference",description:"Search generated contract docs, inspect example packages, and navigate the system as source of truth."},{key:"studio",title:"Studio",description:"Understand what Studio adds on top of the open system and when to adopt it."}],s=[{href:"/docs",title:"Documentation",description:"OSS-first documentation for ContractSpec, the open spec system for AI-native software.",audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/start-here",title:"Start here",description:"The fastest path from install to your first contract and generated surface.",section:"start",order:10,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/installation",title:"Installation",description:"Install the CLI and core packages, then prepare a workspace for incremental adoption.",section:"start",order:20,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/hello-world",title:"Hello world",description:"Define a first operation, generate the surface, and verify the end-to-end loop.",section:"start",order:30,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/compatibility",title:"Compatibility",description:"Check the supported runtimes, package managers, and adoption assumptions before rollout.",section:"start",order:40,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/tools",title:"Developer tools",description:"Use the CLI, editors, and helper tooling that make the OSS workflow practical day to day.",section:"start",order:50,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/troubleshooting",title:"Troubleshooting",description:"Resolve the common installation, validation, and runtime mistakes you hit during first adoption.",section:"start",order:60,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs",title:"Contracts and specs",description:"Understand the spec model that drives generated surfaces, validation, policy, and safe regeneration.",section:"core-model",order:10,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/capabilities",title:"Capabilities",description:"Model commands, queries, presentations, and events as explicit contract surfaces.",section:"core-model",order:20,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/dataviews",title:"Data views",description:"Define queryable, presentable views that stay aligned with the rest of the system.",section:"core-model",order:30,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/workflows",title:"Workflows",description:"Compose multi-step behavior from typed contracts, policies, and runtime orchestration.",section:"core-model",order:40,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/policy",title:"Policy",description:"Apply consistent governance, access rules, and risk controls across every surface.",section:"core-model",order:50,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/specs/overlays",title:"Overlays",description:"Customize generated surfaces safely without forking the system or breaking regeneration.",section:"core-model",order:60,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/module-bundles",title:"Module bundles",description:"Define AI-native surfaces as typed bundle specs that resolve into personalized, auditable runtime plans.",section:"core-model",order:70,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/connect",title:"ContractSpec Connect",description:"Guard coding-agent edits and shell actions with task-scoped context, plan packets, patch verdicts, and review packets.",section:"core-model",order:80,navTitle:"Connect",primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/specs/builder-control-plane",title:"Builder control plane",description:"Route multimodal authoring work through governed builder contracts, provider policies, readiness gates, and mobile review flows.",section:"core-model",order:90,primaryNav:!0,audience:"studio-bridge",ctaMode:"studio-bridge"},{href:"/docs/guides/contract-types",title:"Contract types",description:"Choose the right contract surface for the behavior you want to make explicit.",section:"core-model",order:100,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides",title:"Guides",description:"Follow concrete adoption paths for existing apps, generated docs, CI gating, and typed surfaces.",section:"build",order:10,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/nextjs-one-endpoint",title:"Adopt one endpoint in Next.js",description:"Start with one endpoint, one contract, and one generated surface in an existing Next.js app.",section:"build",order:20,navTitle:"Next.js endpoint",primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/import-existing-codebases",title:"Import an existing codebase",description:"Stabilize a live codebase incrementally instead of rewriting it from scratch.",section:"build",order:30,navTitle:"Import existing code",primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/spec-validation-and-typing",title:"Validation and typing",description:"Keep runtime validation and TypeScript types aligned from the same source definitions.",section:"build",order:40,navTitle:"Validation and typing",primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/generate-docs-clients-schemas",title:"Generate docs, clients, and schemas",description:"Export stable docs and client-facing artifacts from the same contract layer.",section:"build",order:50,navTitle:"Generate docs and clients",primaryNav:!0,audience:"oss",ctaMode:"reference"},{href:"/docs/guides/docs-generation-pipeline",title:"Docs generation pipeline",description:"Feed generated docs into the public docs site without breaking source-of-truth ownership.",section:"build",order:60,navTitle:"Docs pipeline",primaryNav:!0,audience:"oss",ctaMode:"reference"},{href:"/docs/guides/first-module-bundle",title:"Build a first module bundle",description:"Define one bundle spec, resolve a personalized surface plan, and render it through the React host layer.",section:"build",order:65,navTitle:"First module bundle",primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/host-builder-workbench",title:"Host the Builder workbench",description:"Load a Builder workspace snapshot, wire common commands, and keep runtime mode plus mobile review flows explicit.",section:"build",order:66,navTitle:"Host Builder workbench",primaryNav:!0,audience:"studio-bridge",ctaMode:"studio-bridge"},{href:"/docs/guides/connect-in-a-repo",title:"Use Connect in a repo",description:"Enable Connect in workspace config, verify agent actions, and inspect local review and replay artifacts.",section:"build",order:67,navTitle:"Connect in a repo",primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/libraries",title:"Libraries overview",description:"Navigate the core libraries, runtimes, and system packages that make up the open foundation.",section:"build",order:70,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/architecture",title:"Architecture",description:"See how the spec layer, runtimes, integrations, and multi-surface outputs fit together.",section:"build",order:80,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/safety",title:"Operate safely",description:"Add auditability, migrations, policy controls, and trustworthy release behavior from the start.",section:"operate",order:10,navTitle:"Safety overview",primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/guides/ci-contract-diff-gating",title:"CI diff gating",description:"Use deterministic checks to block drift and risky changes before they reach production.",section:"operate",order:20,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/safety/security-trust",title:"Security and trust",description:"Understand the trust model, artifact validation expectations, and operational boundaries.",section:"operate",order:30,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/safety/auditing",title:"Audit trails",description:"Track changes, policy decisions, and operational actions with a clear evidence trail.",section:"operate",order:40,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/safety/migrations",title:"Migrations",description:"Evolve schemas and data safely without abandoning the contract layer.",section:"operate",order:50,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/safety/tenant-isolation",title:"Tenant isolation",description:"Keep tenant data, config, policies, and integrations separated at runtime.",section:"operate",order:60,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/knowledge",title:"Knowledge and context",description:"Bind trusted knowledge sources to the system without losing governance or isolation.",section:"operate",order:70,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/advanced/telemetry",title:"Telemetry",description:"Instrument surfaces, collect evidence, and keep observability aligned with the contract model.",section:"operate",order:80,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/advanced/workflow-monitoring",title:"Workflow monitoring",description:"Observe multi-step execution with enough context to understand failures and regressions.",section:"operate",order:90,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/ops/distributed-tracing",title:"Distributed tracing",description:"Trace contract execution across integrations, workflows, and generated surfaces.",section:"operate",order:100,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/integrations",title:"Integrations overview",description:"Understand the binding model for external services, providers, and tenant-owned connections.",section:"integrations",order:10,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/spec-model",title:"Integration spec model",description:"Define what an integration provides before wiring it into an app or runtime.",section:"integrations",order:20,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/openai",title:"OpenAI integration",description:"Connect OpenAI through typed capabilities, explicit provider config, and governed runtime usage.",section:"integrations",order:30,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/mistral",title:"Mistral integration",description:"Use Mistral through the same provider contract model and runtime guardrails.",section:"integrations",order:40,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/qdrant",title:"Qdrant integration",description:"Store and retrieve knowledge embeddings with explicit provider configuration and ownership.",section:"integrations",order:50,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/integrations/stripe",title:"Stripe integration",description:"Bind payments and billing behavior without smearing provider logic across the codebase.",section:"integrations",order:60,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/twilio",title:"Twilio integration",description:"Handle messaging and telephony through typed transport boundaries and explicit configuration.",section:"integrations",order:70,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/github",title:"GitHub integration",description:"Push execution context into GitHub workflows and automation surfaces without hidden glue.",section:"integrations",order:80,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/reference",title:"Contract reference",description:"Browse the generated reference index for public contract surfaces, versions, and examples.",section:"reference",order:10,primaryNav:!0,audience:"reference",ctaMode:"reference"},{href:"/docs/examples",title:"Examples",description:"Explore runnable examples and use them as reference implementations for new systems.",section:"reference",order:20,primaryNav:!0,audience:"reference",ctaMode:"reference"},{href:"/docs/studio",title:"Studio overview",description:"See what Studio adds on top of OSS ContractSpec and when a team should adopt the operating layer.",section:"studio",order:10,primaryNav:!0,audience:"studio-bridge",ctaMode:"studio-bridge"},{href:"/docs/manifesto",title:"Manifesto",description:"Why ContractSpec is built as an open system, how incremental adoption works, and why Studio stays additive.",audience:"secondary"},{href:"/docs/intent/contract-first-api",title:"Contract-first API",description:"Use contracts as the durable source of truth for API behavior and generated surfaces.",audience:"secondary"},{href:"/docs/intent/spec-driven-development",title:"Spec-driven development",description:"See how explicit specs stabilize change across APIs, UI, data, and agent-facing surfaces.",audience:"secondary"},{href:"/docs/intent/deterministic-codegen",title:"Deterministic regeneration",description:"Understand safe regeneration, conflict boundaries, and why teams keep control of the output.",audience:"secondary"},{href:"/docs/intent/schema-validation-typescript",title:"Schema validation and TypeScript",description:"Keep schema, runtime validation, and TypeScript behavior aligned without duplicate work.",audience:"secondary"},{href:"/docs/intent/openapi-alternative",title:"OpenAPI alternative",description:"Compare a multi-surface contract system with API-only description tooling.",audience:"secondary"},{href:"/docs/intent/generate-client-from-schema",title:"Generate client from schema",description:"Generate client-facing artifacts from the same source that drives runtime behavior.",audience:"secondary"},{href:"/docs/comparison",title:"Comparison overview",description:"Compare ContractSpec with workflow engines, internal-tool builders, and enterprise orchestration products.",audience:"secondary"},{href:"/docs/comparison/workflow-engines",title:"Workflow engines",description:"Contrast a contract system with workflow-only orchestration approaches.",audience:"secondary"},{href:"/docs/comparison/internal-tool-builders",title:"Internal-tool builders",description:"Compare ContractSpec with builders that optimize for screens instead of durable system contracts.",audience:"secondary"},{href:"/docs/comparison/automation-platforms",title:"Automation platforms",description:"Compare automation-first tools with a system that owns explicit contracts and generated surfaces.",audience:"secondary"},{href:"/docs/comparison/windmill",title:"Windmill comparison",description:"Understand where Windmill fits and where ContractSpec solves a different class of system problem.",audience:"secondary"},{href:"/docs/comparison/enterprise-platforms",title:"Enterprise orchestrators",description:"Compare ContractSpec with enterprise platforms that centralize execution in a closed operating surface.",audience:"secondary"},{href:"/docs/ecosystem/templates",title:"Templates",description:"Use templates and starter systems as proof points and accelerators for OSS adoption.",audience:"secondary"},{href:"/docs/ecosystem/plugins",title:"Plugins",description:"Explore marketplace and editor integrations that support the OSS workflow.",audience:"secondary"},{href:"/docs/ecosystem/registry",title:"Registry",description:"Inspect registry and manifest concepts that help package reusable capability surfaces.",audience:"secondary"}];function N(i){return s.find((o)=>o.href===i)}function m(){return c.map((i)=>({...i,items:s.filter((o)=>o.section===i.key&&o.primaryNav).sort((o,t)=>(o.order??0)-(t.order??0))}))}function h(){return s.filter((i)=>i.primaryNav).sort((i,o)=>c.findIndex((t)=>t.key===i.section)-c.findIndex((t)=>t.key===o.section)||(i.order??0)-(o.order??0))}function k(i){let o=h(),t=o.findIndex((a)=>a.href===i);if(t<0)return{previous:null,next:null};return{previous:o[t-1]??null,next:o[t+1]??null}}function l(){return s.filter((i)=>i.audience==="secondary")}function p(){return m().map((i)=>({...i,featured:i.items.slice(0,3)}))}import{CodeBlock as f}from"@contractspec/lib.design-system";import n from"@contractspec/lib.ui-link";import{ArrowRight as d,Boxes as u,FileSearch as g,ShieldCheck as y,Waypoints as v}from"lucide-react";import{jsx as e,jsxs as r}from"react/jsx-runtime";var b=[{title:"One system, many surfaces",body:"Define explicit contracts once, then keep APIs, UI, data, events, and agent-facing surfaces aligned.",icon:u},{title:"Incremental adoption",body:"Start with one endpoint, one workflow, or one unsafe module. You do not need a rewrite to begin.",icon:v},{title:"Operator-grade controls",body:"Carry policy, auditability, migrations, tracing, and integration boundaries forward with the same system model.",icon:y}],w=[{title:"ContractSpec Connect",body:"Guard coding-agent edits and commands with local-first context, plan packets, patch verdicts, and review packets.",specHref:"/docs/specs/connect",guideHref:"/docs/guides/connect-in-a-repo"},{title:"Module bundles",body:"Define AI-native surfaces as typed bundle specs that resolve into auditable runtime plans.",specHref:"/docs/specs/module-bundles",guideHref:"/docs/guides/first-module-bundle"},{title:"Builder control plane",body:"Coordinate multimodal authoring, provider routing, readiness, export, and mobile review through governed contracts.",specHref:"/docs/specs/builder-control-plane",guideHref:"/docs/guides/host-builder-workbench"}];function D(){let i=p(),o=l().slice(0,6);return r("div",{className:"space-y-12",children:[r("section",{className:"space-y-6",children:[e("p",{className:"editorial-kicker",children:"OSS documentation"}),e("h1",{className:"editorial-title max-w-5xl",children:"Build AI-native systems on explicit contracts, then add Studio when you want the operating layer."}),e("p",{className:"editorial-subtitle",children:"These docs are optimized for OSS adopters first. Learn the contract model, generate and govern surfaces safely, wire integrations, and run the system in production without giving up ownership of your code."}),r("div",{className:"flex flex-wrap gap-3",children:[r(n,{href:"/docs/getting-started/start-here",className:"btn-primary text-sm",children:["Start with OSS ",e(d,{size:16})]}),e(n,{href:"/docs/studio",className:"btn-ghost text-sm",children:"See what Studio adds"})]})]}),e("section",{className:"grid gap-5 md:grid-cols-3",children:b.map((t)=>{let a=t.icon;return r("article",{className:"editorial-panel space-y-3",children:[r("div",{className:"flex items-center gap-3",children:[e("div",{className:"rounded-full border border-border/80 bg-background/85 p-2",children:e(a,{size:18})}),e("h2",{className:"font-semibold text-xl",children:t.title})]}),e("p",{className:"editorial-copy text-sm",children:t.body})]},t.title)})}),r("section",{className:"space-y-5",children:[r("div",{className:"space-y-2",children:[e("p",{className:"editorial-kicker",children:"Implemented packs"}),e("h2",{className:"editorial-panel-title",children:"Use the three higher-order systems that are already wired"}),e("p",{className:"editorial-copy text-sm",children:"These pages are the canonical landing points for agent enforcement, AI-native surface composition, and Builder authoring. Each one now has a matching practical guide."})]}),e("div",{className:"grid gap-4 lg:grid-cols-3",children:w.map((t)=>r("article",{className:"editorial-panel space-y-4",children:[r("div",{children:[e("h3",{className:"font-semibold text-xl",children:t.title}),e("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:t.body})]}),r("div",{className:"flex flex-wrap gap-3",children:[r(n,{href:t.specHref,className:"btn-primary text-sm",children:["Open spec page ",e(d,{size:16})]}),e(n,{href:t.guideHref,className:"btn-ghost text-sm",children:"Read practical guide"})]})]},t.title))})]}),r("section",{className:"editorial-panel space-y-5",children:[r("div",{className:"space-y-2",children:[e("p",{className:"editorial-kicker",children:"Quick start"}),e("h2",{className:"editorial-panel-title",children:"Start with one contract"}),e("p",{className:"editorial-copy text-sm",children:"Use the CLI and core libraries to define one explicit capability, generate the surface, and validate the contract boundary before you expand."})]}),e(f,{language:"bash",filename:"docs-quick-start",code:`bun add -D contractspec
|
|
1
|
+
var c=[{key:"start",title:"Start",description:"Install ContractSpec, wire a first contract, and adopt it into an existing codebase."},{key:"core-model",title:"Core Model",description:"Learn how contracts, generated surfaces, policies, overlays, and safe regeneration fit together."},{key:"build",title:"Build",description:"Use practical guides, libraries, architecture patterns, and examples to ship real surfaces."},{key:"operate",title:"Operate",description:"Run the system safely with governance, auditability, tracing, and operator-grade controls."},{key:"integrations",title:"Integrations",description:"Connect models, messaging, storage, payments, search, and external systems through typed bindings."},{key:"reference",title:"Reference",description:"Search generated contract docs, inspect example packages, and navigate the system as source of truth."},{key:"studio",title:"Studio",description:"Understand what Studio adds on top of the open system and when to adopt it."}],s=[{href:"/docs",title:"Documentation",description:"OSS-first documentation for ContractSpec, the open spec system for AI-native software.",audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/start-here",title:"Start here",description:"The fastest path from install to your first contract and generated surface.",section:"start",order:10,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/installation",title:"Installation",description:"Install the CLI and core packages, then prepare a workspace for incremental adoption.",section:"start",order:20,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/hello-world",title:"Hello world",description:"Define a first operation, generate the surface, and verify the end-to-end loop.",section:"start",order:30,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/compatibility",title:"Compatibility",description:"Check the supported runtimes, package managers, and adoption assumptions before rollout.",section:"start",order:40,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/tools",title:"Developer tools",description:"Use the CLI, editors, and helper tooling that make the OSS workflow practical day to day.",section:"start",order:50,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/troubleshooting",title:"Troubleshooting",description:"Resolve the common installation, validation, and runtime mistakes you hit during first adoption.",section:"start",order:60,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs",title:"Contracts and specs",description:"Understand the spec model that drives generated surfaces, validation, policy, and safe regeneration.",section:"core-model",order:10,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/capabilities",title:"Capabilities",description:"Model commands, queries, presentations, and events as explicit contract surfaces.",section:"core-model",order:20,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/dataviews",title:"Data views",description:"Define queryable, presentable views that stay aligned with the rest of the system.",section:"core-model",order:30,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/workflows",title:"Workflows",description:"Compose multi-step behavior from typed contracts, policies, and runtime orchestration.",section:"core-model",order:40,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/policy",title:"Policy",description:"Apply consistent governance, access rules, and risk controls across every surface.",section:"core-model",order:50,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/specs/overlays",title:"Overlays",description:"Customize generated surfaces safely without forking the system or breaking regeneration.",section:"core-model",order:60,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/module-bundles",title:"Module bundles",description:"Define AI-native surfaces as typed bundle specs that resolve into personalized, auditable runtime plans.",section:"core-model",order:70,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/connect",title:"ContractSpec Connect",description:"Guard coding-agent edits and shell actions with task-scoped context, plan packets, patch verdicts, and review packets.",section:"core-model",order:80,navTitle:"Connect",primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/specs/builder-control-plane",title:"Builder control plane",description:"Route multimodal authoring work through governed builder contracts, provider policies, readiness gates, and mobile review flows.",section:"core-model",order:90,primaryNav:!0,audience:"studio-bridge",ctaMode:"studio-bridge"},{href:"/docs/guides/contract-types",title:"Contract types",description:"Choose the right contract surface for the behavior you want to make explicit.",section:"core-model",order:100,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides",title:"Guides",description:"Follow concrete adoption paths for existing apps, generated docs, CI gating, and typed surfaces.",section:"build",order:10,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/nextjs-one-endpoint",title:"Adopt one endpoint in Next.js",description:"Start with one endpoint, one contract, and one generated surface in an existing Next.js app.",section:"build",order:20,navTitle:"Next.js endpoint",primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/import-existing-codebases",title:"Import an existing codebase",description:"Stabilize a live codebase incrementally instead of rewriting it from scratch.",section:"build",order:30,navTitle:"Import existing code",primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/spec-validation-and-typing",title:"Validation and typing",description:"Keep runtime validation and TypeScript types aligned from the same source definitions.",section:"build",order:40,navTitle:"Validation and typing",primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/generate-docs-clients-schemas",title:"Generate docs, clients, and schemas",description:"Export stable docs and client-facing artifacts from the same contract layer.",section:"build",order:50,navTitle:"Generate docs and clients",primaryNav:!0,audience:"oss",ctaMode:"reference"},{href:"/docs/guides/docs-generation-pipeline",title:"Docs generation pipeline",description:"Feed generated docs into the public docs site without breaking source-of-truth ownership.",section:"build",order:60,navTitle:"Docs pipeline",primaryNav:!0,audience:"oss",ctaMode:"reference"},{href:"/docs/guides/first-module-bundle",title:"Build a first module bundle",description:"Define one bundle spec, resolve a personalized surface plan, and render it through the React host layer.",section:"build",order:65,navTitle:"First module bundle",primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/host-builder-workbench",title:"Host the Builder workbench",description:"Load a Builder workspace snapshot, wire common commands, and keep runtime mode plus mobile review flows explicit.",section:"build",order:66,navTitle:"Host Builder workbench",primaryNav:!0,audience:"studio-bridge",ctaMode:"studio-bridge"},{href:"/docs/guides/connect-in-a-repo",title:"Use Connect in a repo",description:"Enable Connect in workspace config, verify agent actions, and inspect local review and replay artifacts.",section:"build",order:67,navTitle:"Connect in a repo",primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/libraries",title:"Libraries overview",description:"Navigate the core libraries, runtimes, and system packages that make up the open foundation.",section:"build",order:70,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/architecture",title:"Architecture",description:"See how the spec layer, runtimes, integrations, and multi-surface outputs fit together.",section:"build",order:80,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/safety",title:"Operate safely",description:"Add auditability, migrations, policy controls, and trustworthy release behavior from the start.",section:"operate",order:10,navTitle:"Safety overview",primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/guides/ci-contract-diff-gating",title:"CI diff gating",description:"Use deterministic checks to block drift and risky changes before they reach production.",section:"operate",order:20,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/guides/release-capsules",title:"Author release capsules",description:"Pair changesets with structured release capsules, generate release artifacts, and keep changelog plus docs surfaces aligned.",section:"operate",order:25,navTitle:"Release capsules",primaryNav:!0,audience:"operator",ctaMode:"reference"},{href:"/docs/safety/security-trust",title:"Security and trust",description:"Understand the trust model, artifact validation expectations, and operational boundaries.",section:"operate",order:30,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/safety/auditing",title:"Audit trails",description:"Track changes, policy decisions, and operational actions with a clear evidence trail.",section:"operate",order:40,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/safety/migrations",title:"Migrations",description:"Evolve schemas and data safely without abandoning the contract layer.",section:"operate",order:50,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/safety/tenant-isolation",title:"Tenant isolation",description:"Keep tenant data, config, policies, and integrations separated at runtime.",section:"operate",order:60,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/knowledge",title:"Knowledge and context",description:"Bind trusted knowledge sources to the system without losing governance or isolation.",section:"operate",order:70,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/advanced/telemetry",title:"Telemetry",description:"Instrument surfaces, collect evidence, and keep observability aligned with the contract model.",section:"operate",order:80,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/advanced/workflow-monitoring",title:"Workflow monitoring",description:"Observe multi-step execution with enough context to understand failures and regressions.",section:"operate",order:90,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/ops/distributed-tracing",title:"Distributed tracing",description:"Trace contract execution across integrations, workflows, and generated surfaces.",section:"operate",order:100,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/integrations",title:"Integrations overview",description:"Understand the binding model for external services, providers, and tenant-owned connections.",section:"integrations",order:10,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/spec-model",title:"Integration spec model",description:"Define what an integration provides before wiring it into an app or runtime.",section:"integrations",order:20,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/openai",title:"OpenAI integration",description:"Connect OpenAI through typed capabilities, explicit provider config, and governed runtime usage.",section:"integrations",order:30,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/mistral",title:"Mistral integration",description:"Use Mistral through the same provider contract model and runtime guardrails.",section:"integrations",order:40,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/qdrant",title:"Qdrant integration",description:"Store and retrieve knowledge embeddings with explicit provider configuration and ownership.",section:"integrations",order:50,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/integrations/stripe",title:"Stripe integration",description:"Bind payments and billing behavior without smearing provider logic across the codebase.",section:"integrations",order:60,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/twilio",title:"Twilio integration",description:"Handle messaging and telephony through typed transport boundaries and explicit configuration.",section:"integrations",order:70,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/github",title:"GitHub integration",description:"Push execution context into GitHub workflows and automation surfaces without hidden glue.",section:"integrations",order:80,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/reference",title:"Contract reference",description:"Browse the generated reference index for public contract surfaces, versions, and examples.",section:"reference",order:10,primaryNav:!0,audience:"reference",ctaMode:"reference"},{href:"/docs/examples",title:"Examples",description:"Explore runnable examples and use them as reference implementations for new systems.",section:"reference",order:20,primaryNav:!0,audience:"reference",ctaMode:"reference"},{href:"/docs/studio",title:"Studio overview",description:"See what Studio adds on top of OSS ContractSpec and when a team should adopt the operating layer.",section:"studio",order:10,primaryNav:!0,audience:"studio-bridge",ctaMode:"studio-bridge"},{href:"/docs/manifesto",title:"Manifesto",description:"Why ContractSpec is built as an open system, how incremental adoption works, and why Studio stays additive.",audience:"secondary"},{href:"/docs/intent/contract-first-api",title:"Contract-first API",description:"Use contracts as the durable source of truth for API behavior and generated surfaces.",audience:"secondary"},{href:"/docs/intent/spec-driven-development",title:"Spec-driven development",description:"See how explicit specs stabilize change across APIs, UI, data, and agent-facing surfaces.",audience:"secondary"},{href:"/docs/intent/deterministic-codegen",title:"Deterministic regeneration",description:"Understand safe regeneration, conflict boundaries, and why teams keep control of the output.",audience:"secondary"},{href:"/docs/intent/schema-validation-typescript",title:"Schema validation and TypeScript",description:"Keep schema, runtime validation, and TypeScript behavior aligned without duplicate work.",audience:"secondary"},{href:"/docs/intent/openapi-alternative",title:"OpenAPI alternative",description:"Compare a multi-surface contract system with API-only description tooling.",audience:"secondary"},{href:"/docs/intent/generate-client-from-schema",title:"Generate client from schema",description:"Generate client-facing artifacts from the same source that drives runtime behavior.",audience:"secondary"},{href:"/docs/comparison",title:"Comparison overview",description:"Compare ContractSpec with workflow engines, internal-tool builders, and enterprise orchestration products.",audience:"secondary"},{href:"/docs/comparison/workflow-engines",title:"Workflow engines",description:"Contrast a contract system with workflow-only orchestration approaches.",audience:"secondary"},{href:"/docs/comparison/internal-tool-builders",title:"Internal-tool builders",description:"Compare ContractSpec with builders that optimize for screens instead of durable system contracts.",audience:"secondary"},{href:"/docs/comparison/automation-platforms",title:"Automation platforms",description:"Compare automation-first tools with a system that owns explicit contracts and generated surfaces.",audience:"secondary"},{href:"/docs/comparison/windmill",title:"Windmill comparison",description:"Understand where Windmill fits and where ContractSpec solves a different class of system problem.",audience:"secondary"},{href:"/docs/comparison/enterprise-platforms",title:"Enterprise orchestrators",description:"Compare ContractSpec with enterprise platforms that centralize execution in a closed operating surface.",audience:"secondary"},{href:"/docs/ecosystem/templates",title:"Templates",description:"Use templates and starter systems as proof points and accelerators for OSS adoption.",audience:"secondary"},{href:"/docs/ecosystem/plugins",title:"Plugins",description:"Explore marketplace and editor integrations that support the OSS workflow.",audience:"secondary"},{href:"/docs/ecosystem/registry",title:"Registry",description:"Inspect registry and manifest concepts that help package reusable capability surfaces.",audience:"secondary"}];function N(i){return s.find((o)=>o.href===i)}function m(){return c.map((i)=>({...i,items:s.filter((o)=>o.section===i.key&&o.primaryNav).sort((o,t)=>(o.order??0)-(t.order??0))}))}function h(){return s.filter((i)=>i.primaryNav).sort((i,o)=>c.findIndex((t)=>t.key===i.section)-c.findIndex((t)=>t.key===o.section)||(i.order??0)-(o.order??0))}function k(i){let o=h(),t=o.findIndex((a)=>a.href===i);if(t<0)return{previous:null,next:null};return{previous:o[t-1]??null,next:o[t+1]??null}}function l(){return s.filter((i)=>i.audience==="secondary")}function p(){return m().map((i)=>({...i,featured:i.items.slice(0,3)}))}import{CodeBlock as f}from"@contractspec/lib.design-system";import n from"@contractspec/lib.ui-link";import{ArrowRight as d,Boxes as u,FileSearch as g,ShieldCheck as y,Waypoints as v}from"lucide-react";import{jsx as e,jsxs as r}from"react/jsx-runtime";var b=[{title:"One system, many surfaces",body:"Define explicit contracts once, then keep APIs, UI, data, events, and agent-facing surfaces aligned.",icon:u},{title:"Incremental adoption",body:"Start with one endpoint, one workflow, or one unsafe module. You do not need a rewrite to begin.",icon:v},{title:"Operator-grade controls",body:"Carry policy, auditability, migrations, tracing, and integration boundaries forward with the same system model.",icon:y}],w=[{title:"ContractSpec Connect",body:"Guard coding-agent edits and commands with local-first context, plan packets, patch verdicts, and review packets.",specHref:"/docs/specs/connect",guideHref:"/docs/guides/connect-in-a-repo"},{title:"Module bundles",body:"Define AI-native surfaces as typed bundle specs that resolve into auditable runtime plans.",specHref:"/docs/specs/module-bundles",guideHref:"/docs/guides/first-module-bundle"},{title:"Builder control plane",body:"Coordinate multimodal authoring, provider routing, readiness, export, and mobile review through governed contracts.",specHref:"/docs/specs/builder-control-plane",guideHref:"/docs/guides/host-builder-workbench"}];function D(){let i=p(),o=l().slice(0,6);return r("div",{className:"space-y-12",children:[r("section",{className:"space-y-6",children:[e("p",{className:"editorial-kicker",children:"OSS documentation"}),e("h1",{className:"editorial-title max-w-5xl",children:"Build AI-native systems on explicit contracts, then add Studio when you want the operating layer."}),e("p",{className:"editorial-subtitle",children:"These docs are optimized for OSS adopters first. Learn the contract model, generate and govern surfaces safely, wire integrations, and run the system in production without giving up ownership of your code."}),r("div",{className:"flex flex-wrap gap-3",children:[r(n,{href:"/docs/getting-started/start-here",className:"btn-primary text-sm",children:["Start with OSS ",e(d,{size:16})]}),e(n,{href:"/docs/studio",className:"btn-ghost text-sm",children:"See what Studio adds"})]})]}),e("section",{className:"grid gap-5 md:grid-cols-3",children:b.map((t)=>{let a=t.icon;return r("article",{className:"editorial-panel space-y-3",children:[r("div",{className:"flex items-center gap-3",children:[e("div",{className:"rounded-full border border-border/80 bg-background/85 p-2",children:e(a,{size:18})}),e("h2",{className:"font-semibold text-xl",children:t.title})]}),e("p",{className:"editorial-copy text-sm",children:t.body})]},t.title)})}),r("section",{className:"space-y-5",children:[r("div",{className:"space-y-2",children:[e("p",{className:"editorial-kicker",children:"Implemented packs"}),e("h2",{className:"editorial-panel-title",children:"Use the three higher-order systems that are already wired"}),e("p",{className:"editorial-copy text-sm",children:"These pages are the canonical landing points for agent enforcement, AI-native surface composition, and Builder authoring. Each one now has a matching practical guide."})]}),e("div",{className:"grid gap-4 lg:grid-cols-3",children:w.map((t)=>r("article",{className:"editorial-panel space-y-4",children:[r("div",{children:[e("h3",{className:"font-semibold text-xl",children:t.title}),e("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:t.body})]}),r("div",{className:"flex flex-wrap gap-3",children:[r(n,{href:t.specHref,className:"btn-primary text-sm",children:["Open spec page ",e(d,{size:16})]}),e(n,{href:t.guideHref,className:"btn-ghost text-sm",children:"Read practical guide"})]})]},t.title))})]}),r("section",{className:"editorial-panel space-y-5",children:[r("div",{className:"space-y-2",children:[e("p",{className:"editorial-kicker",children:"Quick start"}),e("h2",{className:"editorial-panel-title",children:"Start with one contract"}),e("p",{className:"editorial-copy text-sm",children:"Use the CLI and core libraries to define one explicit capability, generate the surface, and validate the contract boundary before you expand."})]}),e(f,{language:"bash",filename:"docs-quick-start",code:`bun add -D contractspec
|
|
2
2
|
bun add @contractspec/lib.contracts-spec @contractspec/lib.schema
|
|
3
3
|
|
|
4
4
|
contractspec init
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var i=[{key:"start",title:"Start",description:"Install ContractSpec, wire a first contract, and adopt it into an existing codebase."},{key:"core-model",title:"Core Model",description:"Learn how contracts, generated surfaces, policies, overlays, and safe regeneration fit together."},{key:"build",title:"Build",description:"Use practical guides, libraries, architecture patterns, and examples to ship real surfaces."},{key:"operate",title:"Operate",description:"Run the system safely with governance, auditability, tracing, and operator-grade controls."},{key:"integrations",title:"Integrations",description:"Connect models, messaging, storage, payments, search, and external systems through typed bindings."},{key:"reference",title:"Reference",description:"Search generated contract docs, inspect example packages, and navigate the system as source of truth."},{key:"studio",title:"Studio",description:"Understand what Studio adds on top of the open system and when to adopt it."}],o=[{href:"/docs",title:"Documentation",description:"OSS-first documentation for ContractSpec, the open spec system for AI-native software.",audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/start-here",title:"Start here",description:"The fastest path from install to your first contract and generated surface.",section:"start",order:10,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/installation",title:"Installation",description:"Install the CLI and core packages, then prepare a workspace for incremental adoption.",section:"start",order:20,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/hello-world",title:"Hello world",description:"Define a first operation, generate the surface, and verify the end-to-end loop.",section:"start",order:30,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/compatibility",title:"Compatibility",description:"Check the supported runtimes, package managers, and adoption assumptions before rollout.",section:"start",order:40,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/tools",title:"Developer tools",description:"Use the CLI, editors, and helper tooling that make the OSS workflow practical day to day.",section:"start",order:50,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/troubleshooting",title:"Troubleshooting",description:"Resolve the common installation, validation, and runtime mistakes you hit during first adoption.",section:"start",order:60,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs",title:"Contracts and specs",description:"Understand the spec model that drives generated surfaces, validation, policy, and safe regeneration.",section:"core-model",order:10,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/capabilities",title:"Capabilities",description:"Model commands, queries, presentations, and events as explicit contract surfaces.",section:"core-model",order:20,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/dataviews",title:"Data views",description:"Define queryable, presentable views that stay aligned with the rest of the system.",section:"core-model",order:30,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/workflows",title:"Workflows",description:"Compose multi-step behavior from typed contracts, policies, and runtime orchestration.",section:"core-model",order:40,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/policy",title:"Policy",description:"Apply consistent governance, access rules, and risk controls across every surface.",section:"core-model",order:50,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/specs/overlays",title:"Overlays",description:"Customize generated surfaces safely without forking the system or breaking regeneration.",section:"core-model",order:60,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/module-bundles",title:"Module bundles",description:"Define AI-native surfaces as typed bundle specs that resolve into personalized, auditable runtime plans.",section:"core-model",order:70,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/connect",title:"ContractSpec Connect",description:"Guard coding-agent edits and shell actions with task-scoped context, plan packets, patch verdicts, and review packets.",section:"core-model",order:80,navTitle:"Connect",primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/specs/builder-control-plane",title:"Builder control plane",description:"Route multimodal authoring work through governed builder contracts, provider policies, readiness gates, and mobile review flows.",section:"core-model",order:90,primaryNav:!0,audience:"studio-bridge",ctaMode:"studio-bridge"},{href:"/docs/guides/contract-types",title:"Contract types",description:"Choose the right contract surface for the behavior you want to make explicit.",section:"core-model",order:100,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides",title:"Guides",description:"Follow concrete adoption paths for existing apps, generated docs, CI gating, and typed surfaces.",section:"build",order:10,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/nextjs-one-endpoint",title:"Adopt one endpoint in Next.js",description:"Start with one endpoint, one contract, and one generated surface in an existing Next.js app.",section:"build",order:20,navTitle:"Next.js endpoint",primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/import-existing-codebases",title:"Import an existing codebase",description:"Stabilize a live codebase incrementally instead of rewriting it from scratch.",section:"build",order:30,navTitle:"Import existing code",primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/spec-validation-and-typing",title:"Validation and typing",description:"Keep runtime validation and TypeScript types aligned from the same source definitions.",section:"build",order:40,navTitle:"Validation and typing",primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/generate-docs-clients-schemas",title:"Generate docs, clients, and schemas",description:"Export stable docs and client-facing artifacts from the same contract layer.",section:"build",order:50,navTitle:"Generate docs and clients",primaryNav:!0,audience:"oss",ctaMode:"reference"},{href:"/docs/guides/docs-generation-pipeline",title:"Docs generation pipeline",description:"Feed generated docs into the public docs site without breaking source-of-truth ownership.",section:"build",order:60,navTitle:"Docs pipeline",primaryNav:!0,audience:"oss",ctaMode:"reference"},{href:"/docs/guides/first-module-bundle",title:"Build a first module bundle",description:"Define one bundle spec, resolve a personalized surface plan, and render it through the React host layer.",section:"build",order:65,navTitle:"First module bundle",primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/host-builder-workbench",title:"Host the Builder workbench",description:"Load a Builder workspace snapshot, wire common commands, and keep runtime mode plus mobile review flows explicit.",section:"build",order:66,navTitle:"Host Builder workbench",primaryNav:!0,audience:"studio-bridge",ctaMode:"studio-bridge"},{href:"/docs/guides/connect-in-a-repo",title:"Use Connect in a repo",description:"Enable Connect in workspace config, verify agent actions, and inspect local review and replay artifacts.",section:"build",order:67,navTitle:"Connect in a repo",primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/libraries",title:"Libraries overview",description:"Navigate the core libraries, runtimes, and system packages that make up the open foundation.",section:"build",order:70,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/architecture",title:"Architecture",description:"See how the spec layer, runtimes, integrations, and multi-surface outputs fit together.",section:"build",order:80,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/safety",title:"Operate safely",description:"Add auditability, migrations, policy controls, and trustworthy release behavior from the start.",section:"operate",order:10,navTitle:"Safety overview",primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/guides/ci-contract-diff-gating",title:"CI diff gating",description:"Use deterministic checks to block drift and risky changes before they reach production.",section:"operate",order:20,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/safety/security-trust",title:"Security and trust",description:"Understand the trust model, artifact validation expectations, and operational boundaries.",section:"operate",order:30,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/safety/auditing",title:"Audit trails",description:"Track changes, policy decisions, and operational actions with a clear evidence trail.",section:"operate",order:40,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/safety/migrations",title:"Migrations",description:"Evolve schemas and data safely without abandoning the contract layer.",section:"operate",order:50,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/safety/tenant-isolation",title:"Tenant isolation",description:"Keep tenant data, config, policies, and integrations separated at runtime.",section:"operate",order:60,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/knowledge",title:"Knowledge and context",description:"Bind trusted knowledge sources to the system without losing governance or isolation.",section:"operate",order:70,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/advanced/telemetry",title:"Telemetry",description:"Instrument surfaces, collect evidence, and keep observability aligned with the contract model.",section:"operate",order:80,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/advanced/workflow-monitoring",title:"Workflow monitoring",description:"Observe multi-step execution with enough context to understand failures and regressions.",section:"operate",order:90,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/ops/distributed-tracing",title:"Distributed tracing",description:"Trace contract execution across integrations, workflows, and generated surfaces.",section:"operate",order:100,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/integrations",title:"Integrations overview",description:"Understand the binding model for external services, providers, and tenant-owned connections.",section:"integrations",order:10,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/spec-model",title:"Integration spec model",description:"Define what an integration provides before wiring it into an app or runtime.",section:"integrations",order:20,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/openai",title:"OpenAI integration",description:"Connect OpenAI through typed capabilities, explicit provider config, and governed runtime usage.",section:"integrations",order:30,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/mistral",title:"Mistral integration",description:"Use Mistral through the same provider contract model and runtime guardrails.",section:"integrations",order:40,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/qdrant",title:"Qdrant integration",description:"Store and retrieve knowledge embeddings with explicit provider configuration and ownership.",section:"integrations",order:50,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/integrations/stripe",title:"Stripe integration",description:"Bind payments and billing behavior without smearing provider logic across the codebase.",section:"integrations",order:60,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/twilio",title:"Twilio integration",description:"Handle messaging and telephony through typed transport boundaries and explicit configuration.",section:"integrations",order:70,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/github",title:"GitHub integration",description:"Push execution context into GitHub workflows and automation surfaces without hidden glue.",section:"integrations",order:80,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/reference",title:"Contract reference",description:"Browse the generated reference index for public contract surfaces, versions, and examples.",section:"reference",order:10,primaryNav:!0,audience:"reference",ctaMode:"reference"},{href:"/docs/examples",title:"Examples",description:"Explore runnable examples and use them as reference implementations for new systems.",section:"reference",order:20,primaryNav:!0,audience:"reference",ctaMode:"reference"},{href:"/docs/studio",title:"Studio overview",description:"See what Studio adds on top of OSS ContractSpec and when a team should adopt the operating layer.",section:"studio",order:10,primaryNav:!0,audience:"studio-bridge",ctaMode:"studio-bridge"},{href:"/docs/manifesto",title:"Manifesto",description:"Why ContractSpec is built as an open system, how incremental adoption works, and why Studio stays additive.",audience:"secondary"},{href:"/docs/intent/contract-first-api",title:"Contract-first API",description:"Use contracts as the durable source of truth for API behavior and generated surfaces.",audience:"secondary"},{href:"/docs/intent/spec-driven-development",title:"Spec-driven development",description:"See how explicit specs stabilize change across APIs, UI, data, and agent-facing surfaces.",audience:"secondary"},{href:"/docs/intent/deterministic-codegen",title:"Deterministic regeneration",description:"Understand safe regeneration, conflict boundaries, and why teams keep control of the output.",audience:"secondary"},{href:"/docs/intent/schema-validation-typescript",title:"Schema validation and TypeScript",description:"Keep schema, runtime validation, and TypeScript behavior aligned without duplicate work.",audience:"secondary"},{href:"/docs/intent/openapi-alternative",title:"OpenAPI alternative",description:"Compare a multi-surface contract system with API-only description tooling.",audience:"secondary"},{href:"/docs/intent/generate-client-from-schema",title:"Generate client from schema",description:"Generate client-facing artifacts from the same source that drives runtime behavior.",audience:"secondary"},{href:"/docs/comparison",title:"Comparison overview",description:"Compare ContractSpec with workflow engines, internal-tool builders, and enterprise orchestration products.",audience:"secondary"},{href:"/docs/comparison/workflow-engines",title:"Workflow engines",description:"Contrast a contract system with workflow-only orchestration approaches.",audience:"secondary"},{href:"/docs/comparison/internal-tool-builders",title:"Internal-tool builders",description:"Compare ContractSpec with builders that optimize for screens instead of durable system contracts.",audience:"secondary"},{href:"/docs/comparison/automation-platforms",title:"Automation platforms",description:"Compare automation-first tools with a system that owns explicit contracts and generated surfaces.",audience:"secondary"},{href:"/docs/comparison/windmill",title:"Windmill comparison",description:"Understand where Windmill fits and where ContractSpec solves a different class of system problem.",audience:"secondary"},{href:"/docs/comparison/enterprise-platforms",title:"Enterprise orchestrators",description:"Compare ContractSpec with enterprise platforms that centralize execution in a closed operating surface.",audience:"secondary"},{href:"/docs/ecosystem/templates",title:"Templates",description:"Use templates and starter systems as proof points and accelerators for OSS adoption.",audience:"secondary"},{href:"/docs/ecosystem/plugins",title:"Plugins",description:"Explore marketplace and editor integrations that support the OSS workflow.",audience:"secondary"},{href:"/docs/ecosystem/registry",title:"Registry",description:"Inspect registry and manifest concepts that help package reusable capability surfaces.",audience:"secondary"}];function c(e){return o.find((t)=>t.href===e)}function s(){return i.map((e)=>({...e,items:o.filter((t)=>t.section===e.key&&t.primaryNav).sort((t,r)=>(t.order??0)-(r.order??0))}))}function a(){return o.filter((e)=>e.primaryNav).sort((e,t)=>i.findIndex((r)=>r.key===e.section)-i.findIndex((r)=>r.key===t.section)||(e.order??0)-(t.order??0))}function d(e){let t=a(),r=t.findIndex((n)=>n.href===e);if(r<0)return{previous:null,next:null};return{previous:t[r-1]??null,next:t[r+1]??null}}function p(){return o.filter((e)=>e.audience==="secondary")}function l(){return s().map((e)=>({...e,featured:e.items.slice(0,3)}))}export{p as getSecondaryDocsPages,a as getPrimaryDocsTraversal,s as getPrimaryDocsSections,c as getDocsPageByHref,d as getDocsNextPrevious,l as getDocsHomeSections,i as DOCS_PRIMARY_SECTIONS,o as DOCS_PAGES};
|
|
1
|
+
var i=[{key:"start",title:"Start",description:"Install ContractSpec, wire a first contract, and adopt it into an existing codebase."},{key:"core-model",title:"Core Model",description:"Learn how contracts, generated surfaces, policies, overlays, and safe regeneration fit together."},{key:"build",title:"Build",description:"Use practical guides, libraries, architecture patterns, and examples to ship real surfaces."},{key:"operate",title:"Operate",description:"Run the system safely with governance, auditability, tracing, and operator-grade controls."},{key:"integrations",title:"Integrations",description:"Connect models, messaging, storage, payments, search, and external systems through typed bindings."},{key:"reference",title:"Reference",description:"Search generated contract docs, inspect example packages, and navigate the system as source of truth."},{key:"studio",title:"Studio",description:"Understand what Studio adds on top of the open system and when to adopt it."}],o=[{href:"/docs",title:"Documentation",description:"OSS-first documentation for ContractSpec, the open spec system for AI-native software.",audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/start-here",title:"Start here",description:"The fastest path from install to your first contract and generated surface.",section:"start",order:10,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/installation",title:"Installation",description:"Install the CLI and core packages, then prepare a workspace for incremental adoption.",section:"start",order:20,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/hello-world",title:"Hello world",description:"Define a first operation, generate the surface, and verify the end-to-end loop.",section:"start",order:30,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/compatibility",title:"Compatibility",description:"Check the supported runtimes, package managers, and adoption assumptions before rollout.",section:"start",order:40,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/tools",title:"Developer tools",description:"Use the CLI, editors, and helper tooling that make the OSS workflow practical day to day.",section:"start",order:50,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/getting-started/troubleshooting",title:"Troubleshooting",description:"Resolve the common installation, validation, and runtime mistakes you hit during first adoption.",section:"start",order:60,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs",title:"Contracts and specs",description:"Understand the spec model that drives generated surfaces, validation, policy, and safe regeneration.",section:"core-model",order:10,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/capabilities",title:"Capabilities",description:"Model commands, queries, presentations, and events as explicit contract surfaces.",section:"core-model",order:20,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/dataviews",title:"Data views",description:"Define queryable, presentable views that stay aligned with the rest of the system.",section:"core-model",order:30,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/workflows",title:"Workflows",description:"Compose multi-step behavior from typed contracts, policies, and runtime orchestration.",section:"core-model",order:40,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/policy",title:"Policy",description:"Apply consistent governance, access rules, and risk controls across every surface.",section:"core-model",order:50,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/specs/overlays",title:"Overlays",description:"Customize generated surfaces safely without forking the system or breaking regeneration.",section:"core-model",order:60,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/module-bundles",title:"Module bundles",description:"Define AI-native surfaces as typed bundle specs that resolve into personalized, auditable runtime plans.",section:"core-model",order:70,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/specs/connect",title:"ContractSpec Connect",description:"Guard coding-agent edits and shell actions with task-scoped context, plan packets, patch verdicts, and review packets.",section:"core-model",order:80,navTitle:"Connect",primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/specs/builder-control-plane",title:"Builder control plane",description:"Route multimodal authoring work through governed builder contracts, provider policies, readiness gates, and mobile review flows.",section:"core-model",order:90,primaryNav:!0,audience:"studio-bridge",ctaMode:"studio-bridge"},{href:"/docs/guides/contract-types",title:"Contract types",description:"Choose the right contract surface for the behavior you want to make explicit.",section:"core-model",order:100,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides",title:"Guides",description:"Follow concrete adoption paths for existing apps, generated docs, CI gating, and typed surfaces.",section:"build",order:10,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/nextjs-one-endpoint",title:"Adopt one endpoint in Next.js",description:"Start with one endpoint, one contract, and one generated surface in an existing Next.js app.",section:"build",order:20,navTitle:"Next.js endpoint",primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/import-existing-codebases",title:"Import an existing codebase",description:"Stabilize a live codebase incrementally instead of rewriting it from scratch.",section:"build",order:30,navTitle:"Import existing code",primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/spec-validation-and-typing",title:"Validation and typing",description:"Keep runtime validation and TypeScript types aligned from the same source definitions.",section:"build",order:40,navTitle:"Validation and typing",primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/generate-docs-clients-schemas",title:"Generate docs, clients, and schemas",description:"Export stable docs and client-facing artifacts from the same contract layer.",section:"build",order:50,navTitle:"Generate docs and clients",primaryNav:!0,audience:"oss",ctaMode:"reference"},{href:"/docs/guides/docs-generation-pipeline",title:"Docs generation pipeline",description:"Feed generated docs into the public docs site without breaking source-of-truth ownership.",section:"build",order:60,navTitle:"Docs pipeline",primaryNav:!0,audience:"oss",ctaMode:"reference"},{href:"/docs/guides/first-module-bundle",title:"Build a first module bundle",description:"Define one bundle spec, resolve a personalized surface plan, and render it through the React host layer.",section:"build",order:65,navTitle:"First module bundle",primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/guides/host-builder-workbench",title:"Host the Builder workbench",description:"Load a Builder workspace snapshot, wire common commands, and keep runtime mode plus mobile review flows explicit.",section:"build",order:66,navTitle:"Host Builder workbench",primaryNav:!0,audience:"studio-bridge",ctaMode:"studio-bridge"},{href:"/docs/guides/connect-in-a-repo",title:"Use Connect in a repo",description:"Enable Connect in workspace config, verify agent actions, and inspect local review and replay artifacts.",section:"build",order:67,navTitle:"Connect in a repo",primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/libraries",title:"Libraries overview",description:"Navigate the core libraries, runtimes, and system packages that make up the open foundation.",section:"build",order:70,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/architecture",title:"Architecture",description:"See how the spec layer, runtimes, integrations, and multi-surface outputs fit together.",section:"build",order:80,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/safety",title:"Operate safely",description:"Add auditability, migrations, policy controls, and trustworthy release behavior from the start.",section:"operate",order:10,navTitle:"Safety overview",primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/guides/ci-contract-diff-gating",title:"CI diff gating",description:"Use deterministic checks to block drift and risky changes before they reach production.",section:"operate",order:20,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/guides/release-capsules",title:"Author release capsules",description:"Pair changesets with structured release capsules, generate release artifacts, and keep changelog plus docs surfaces aligned.",section:"operate",order:25,navTitle:"Release capsules",primaryNav:!0,audience:"operator",ctaMode:"reference"},{href:"/docs/safety/security-trust",title:"Security and trust",description:"Understand the trust model, artifact validation expectations, and operational boundaries.",section:"operate",order:30,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/safety/auditing",title:"Audit trails",description:"Track changes, policy decisions, and operational actions with a clear evidence trail.",section:"operate",order:40,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/safety/migrations",title:"Migrations",description:"Evolve schemas and data safely without abandoning the contract layer.",section:"operate",order:50,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/safety/tenant-isolation",title:"Tenant isolation",description:"Keep tenant data, config, policies, and integrations separated at runtime.",section:"operate",order:60,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/knowledge",title:"Knowledge and context",description:"Bind trusted knowledge sources to the system without losing governance or isolation.",section:"operate",order:70,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/advanced/telemetry",title:"Telemetry",description:"Instrument surfaces, collect evidence, and keep observability aligned with the contract model.",section:"operate",order:80,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/advanced/workflow-monitoring",title:"Workflow monitoring",description:"Observe multi-step execution with enough context to understand failures and regressions.",section:"operate",order:90,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/ops/distributed-tracing",title:"Distributed tracing",description:"Trace contract execution across integrations, workflows, and generated surfaces.",section:"operate",order:100,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/integrations",title:"Integrations overview",description:"Understand the binding model for external services, providers, and tenant-owned connections.",section:"integrations",order:10,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/spec-model",title:"Integration spec model",description:"Define what an integration provides before wiring it into an app or runtime.",section:"integrations",order:20,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/openai",title:"OpenAI integration",description:"Connect OpenAI through typed capabilities, explicit provider config, and governed runtime usage.",section:"integrations",order:30,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/mistral",title:"Mistral integration",description:"Use Mistral through the same provider contract model and runtime guardrails.",section:"integrations",order:40,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/qdrant",title:"Qdrant integration",description:"Store and retrieve knowledge embeddings with explicit provider configuration and ownership.",section:"integrations",order:50,primaryNav:!0,audience:"operator",ctaMode:"oss-next"},{href:"/docs/integrations/stripe",title:"Stripe integration",description:"Bind payments and billing behavior without smearing provider logic across the codebase.",section:"integrations",order:60,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/twilio",title:"Twilio integration",description:"Handle messaging and telephony through typed transport boundaries and explicit configuration.",section:"integrations",order:70,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/integrations/github",title:"GitHub integration",description:"Push execution context into GitHub workflows and automation surfaces without hidden glue.",section:"integrations",order:80,primaryNav:!0,audience:"oss",ctaMode:"oss-next"},{href:"/docs/reference",title:"Contract reference",description:"Browse the generated reference index for public contract surfaces, versions, and examples.",section:"reference",order:10,primaryNav:!0,audience:"reference",ctaMode:"reference"},{href:"/docs/examples",title:"Examples",description:"Explore runnable examples and use them as reference implementations for new systems.",section:"reference",order:20,primaryNav:!0,audience:"reference",ctaMode:"reference"},{href:"/docs/studio",title:"Studio overview",description:"See what Studio adds on top of OSS ContractSpec and when a team should adopt the operating layer.",section:"studio",order:10,primaryNav:!0,audience:"studio-bridge",ctaMode:"studio-bridge"},{href:"/docs/manifesto",title:"Manifesto",description:"Why ContractSpec is built as an open system, how incremental adoption works, and why Studio stays additive.",audience:"secondary"},{href:"/docs/intent/contract-first-api",title:"Contract-first API",description:"Use contracts as the durable source of truth for API behavior and generated surfaces.",audience:"secondary"},{href:"/docs/intent/spec-driven-development",title:"Spec-driven development",description:"See how explicit specs stabilize change across APIs, UI, data, and agent-facing surfaces.",audience:"secondary"},{href:"/docs/intent/deterministic-codegen",title:"Deterministic regeneration",description:"Understand safe regeneration, conflict boundaries, and why teams keep control of the output.",audience:"secondary"},{href:"/docs/intent/schema-validation-typescript",title:"Schema validation and TypeScript",description:"Keep schema, runtime validation, and TypeScript behavior aligned without duplicate work.",audience:"secondary"},{href:"/docs/intent/openapi-alternative",title:"OpenAPI alternative",description:"Compare a multi-surface contract system with API-only description tooling.",audience:"secondary"},{href:"/docs/intent/generate-client-from-schema",title:"Generate client from schema",description:"Generate client-facing artifacts from the same source that drives runtime behavior.",audience:"secondary"},{href:"/docs/comparison",title:"Comparison overview",description:"Compare ContractSpec with workflow engines, internal-tool builders, and enterprise orchestration products.",audience:"secondary"},{href:"/docs/comparison/workflow-engines",title:"Workflow engines",description:"Contrast a contract system with workflow-only orchestration approaches.",audience:"secondary"},{href:"/docs/comparison/internal-tool-builders",title:"Internal-tool builders",description:"Compare ContractSpec with builders that optimize for screens instead of durable system contracts.",audience:"secondary"},{href:"/docs/comparison/automation-platforms",title:"Automation platforms",description:"Compare automation-first tools with a system that owns explicit contracts and generated surfaces.",audience:"secondary"},{href:"/docs/comparison/windmill",title:"Windmill comparison",description:"Understand where Windmill fits and where ContractSpec solves a different class of system problem.",audience:"secondary"},{href:"/docs/comparison/enterprise-platforms",title:"Enterprise orchestrators",description:"Compare ContractSpec with enterprise platforms that centralize execution in a closed operating surface.",audience:"secondary"},{href:"/docs/ecosystem/templates",title:"Templates",description:"Use templates and starter systems as proof points and accelerators for OSS adoption.",audience:"secondary"},{href:"/docs/ecosystem/plugins",title:"Plugins",description:"Explore marketplace and editor integrations that support the OSS workflow.",audience:"secondary"},{href:"/docs/ecosystem/registry",title:"Registry",description:"Inspect registry and manifest concepts that help package reusable capability surfaces.",audience:"secondary"}];function c(e){return o.find((t)=>t.href===e)}function n(){return i.map((e)=>({...e,items:o.filter((t)=>t.section===e.key&&t.primaryNav).sort((t,r)=>(t.order??0)-(r.order??0))}))}function a(){return o.filter((e)=>e.primaryNav).sort((e,t)=>i.findIndex((r)=>r.key===e.section)-i.findIndex((r)=>r.key===t.section)||(e.order??0)-(t.order??0))}function d(e){let t=a(),r=t.findIndex((s)=>s.href===e);if(r<0)return{previous:null,next:null};return{previous:t[r-1]??null,next:t[r+1]??null}}function p(){return o.filter((e)=>e.audience==="secondary")}function l(){return n().map((e)=>({...e,featured:e.items.slice(0,3)}))}export{p as getSecondaryDocsPages,a as getPrimaryDocsTraversal,n as getPrimaryDocsSections,c as getDocsPageByHref,d as getDocsNextPrevious,l as getDocsHomeSections,i as DOCS_PRIMARY_SECTIONS,o as DOCS_PAGES};
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
bun run --cwd packages/examples/agent-console test
|
|
3
|
-
bun run --cwd packages/apps/web-landing dev
|
|
4
|
-
|
|
5
|
-
# Open in the browser
|
|
6
|
-
# http://localhost:3000/sandbox?template=agent-console`},"ai-chat-assistant":{key:"ai-chat-assistant",lead:"Secondary meetup path for MCP-aware assistants: reasoning, sources, suggestions, and a minimal contract-backed search tool.",sandboxHref:"/sandbox?template=ai-chat-assistant",referenceHref:"/docs/reference/ai-chat-assistant/assistant.search",llmsHref:"/llms/example.ai-chat-assistant",repoHref:"https://github.com/lssm-tech/contractspec/tree/main/packages/examples/ai-chat-assistant",localCommands:`bun run --cwd packages/examples/ai-chat-assistant build
|
|
7
|
-
bun run --cwd packages/examples/ai-chat-assistant test
|
|
8
|
-
bun run --cwd packages/apps/web-landing dev
|
|
9
|
-
|
|
10
|
-
# Open in the browser
|
|
11
|
-
# http://localhost:3000/sandbox?template=ai-chat-assistant`},"messaging-agent-actions":{key:"messaging-agent-actions",lead:"Live messaging lane for the meetup: inbound Slack, WhatsApp, or Telegram messages route through fixed intents, allowlisted actions, and deterministic confirmations.",sandboxHref:"/sandbox?template=messaging-agent-actions",referenceHref:"/docs/reference/messaging-agent-actions/messaging.agentActions.process",llmsHref:"/llms/example.messaging-agent-actions",repoHref:"https://github.com/lssm-tech/contractspec/tree/main/packages/examples/messaging-agent-actions",localCommands:`bun run --cwd packages/examples/messaging-agent-actions build
|
|
12
|
-
bun run --cwd packages/examples/messaging-agent-actions test
|
|
13
|
-
bun run --cwd packages/examples/messaging-agent-actions proof
|
|
14
|
-
bun run --cwd packages/apps/web-landing dev
|
|
15
|
-
|
|
16
|
-
# Open in the browser
|
|
17
|
-
# http://localhost:3000/sandbox?template=messaging-agent-actions`}};function o(n){return l[n]}import{ExampleCatalogDataView as c}from"@contractspec/lib.contracts-spec/docs";import{ButtonLink as r,DataViewList as h,StatusChip as m}from"@contractspec/lib.design-system";import{HStack as f,VStack as g}from"@contractspec/lib.ui-kit-web/ui/stack";import{H1 as p,Muted as i}from"@contractspec/lib.ui-kit-web/ui/typography";import{listExamples as b}from"@contractspec/module.examples";import{jsx as a,jsxs as t}from"react/jsx-runtime";function u(n){return`/docs/reference/${n}/${n}`}function w(n){return o(n)?.sandboxHref?`/docs/examples/${n}`:u(n)}function P(){let n=b().map((s)=>{let e=s.meta.title??s.meta.key;return{id:s.meta.key,title:e,summary:s.meta.summary??s.meta.description,route:w(s.meta.key),tags:s.meta.tags,sandboxEnabled:s.surfaces.sandbox.enabled}}).sort((s,e)=>s.title.localeCompare(e.title)),d={...c,view:{...c.view,kind:"list"}};return t(g,{gap:"xl",children:[t(g,{gap:"sm",children:[a(p,{children:"Examples"}),a(i,{children:"Reference implementations for real ContractSpec surfaces. Use them to study adoption patterns, inspect generated artifacts, and validate the OSS workflow against runnable systems."})]}),a(h,{spec:d,items:n,emptyState:a(i,{children:"No examples available."}),renderActions:(s)=>{return t(f,{gap:"xs",justify:"end",children:[s.sandboxEnabled?a(r,{href:`/sandbox?template=${s.id}`,size:"sm",variant:"outline",children:"Sandbox"}):null,a(r,{href:s.route,size:"sm",children:"Reference"}),s.tags?.[0]?a(m,{size:"sm",label:s.tags[0]}):null]})}})]})}export{P as DocsExamplesPage};
|
|
1
|
+
import{ExampleCatalogDataView as F}from"@contractspec/lib.contracts-spec/docs";import{ButtonLink as G,DataViewList as O,StatusChip as Q}from"@contractspec/lib.design-system";import{HStack as R,VStack as I}from"@contractspec/lib.ui-kit-web/ui/stack";import{H1 as T,Muted as J}from"@contractspec/lib.ui-kit-web/ui/typography";import{buildExampleDocsHref as U,listPublicExamples as W}from"@contractspec/module.examples";import{jsx as v,jsxs as A}from"react/jsx-runtime";function f(){let K=W().map((q)=>{let z=q.meta.title??q.meta.key;return{id:q.meta.key,title:z,summary:q.meta.summary??q.meta.description,route:U(q.meta.key),tags:q.meta.tags,sandboxEnabled:q.surfaces.sandbox.enabled}}).sort((q,z)=>q.title.localeCompare(z.title)),N={...F,view:{...F.view,kind:"list"}};return A(I,{gap:"xl",children:[A(I,{gap:"sm",children:[v(T,{children:"Examples"}),v(J,{children:"Reference implementations for real ContractSpec surfaces. Use them to study adoption patterns, inspect generated artifacts, and validate the OSS workflow against runnable systems."})]}),v(O,{spec:N,items:K,emptyState:v(J,{children:"No examples available."}),renderActions:(q)=>{return A(R,{gap:"xs",justify:"end",children:[q.sandboxEnabled?v(G,{href:`/sandbox?template=${q.id}`,size:"sm",variant:"outline",children:"Sandbox"}):null,v(G,{href:q.route,size:"sm",children:"Reference"}),q.tags?.[0]?v(Q,{size:"sm",label:q.tags[0]}):null]})}})]})}export{f as DocsExamplesPage};
|