@contractspec/bundle.library 3.9.6 → 3.9.8
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 +238 -230
- package/CHANGELOG.md +88 -0
- package/dist/components/docs/DocsIndexPage.js +2 -2
- package/dist/components/docs/docsManifest.js +1 -1
- package/dist/components/docs/getting-started/DataViewTutorialPage.js +40 -4
- package/dist/components/docs/getting-started/index.js +46 -10
- package/dist/components/docs/guides/GuideContractDrivenFormsPage.content.d.ts +3 -0
- package/dist/components/docs/guides/GuideContractDrivenFormsPage.content.js +95 -0
- package/dist/components/docs/guides/GuideContractDrivenFormsPage.d.ts +1 -0
- package/dist/components/docs/guides/GuideContractDrivenFormsPage.js +95 -0
- package/dist/components/docs/guides/GuideSpecValidationTypingPage.js +1 -1
- package/dist/components/docs/guides/GuidesIndexPage.js +2 -2
- package/dist/components/docs/guides/guides.docblocks.js +3 -1
- package/dist/components/docs/guides/index.d.ts +1 -0
- package/dist/components/docs/guides/index.js +139 -44
- package/dist/components/docs/index.js +586 -266
- package/dist/components/docs/libraries/LibrariesApplicationShellPage.content.d.ts +16 -0
- package/dist/components/docs/libraries/LibrariesApplicationShellPage.content.js +148 -0
- package/dist/components/docs/libraries/LibrariesApplicationShellPage.d.ts +1 -0
- package/dist/components/docs/libraries/LibrariesApplicationShellPage.js +148 -0
- package/dist/components/docs/libraries/LibrariesDataViewsPage.js +13 -6
- package/dist/components/docs/libraries/LibrariesDesignSystemPage.js +3 -3
- package/dist/components/docs/libraries/LibrariesOverviewPage.js +1 -1
- package/dist/components/docs/libraries/index.d.ts +1 -0
- package/dist/components/docs/libraries/index.js +217 -64
- package/dist/components/docs/specs/SpecsDataViewsPage.js +37 -1
- package/dist/components/docs/specs/index.js +37 -1
- package/dist/index.js +597 -277
- package/dist/libs/posthog/client.js +1 -1
- package/dist/node/components/docs/DocsIndexPage.js +2 -2
- package/dist/node/components/docs/docsManifest.js +1 -1
- package/dist/node/components/docs/getting-started/DataViewTutorialPage.js +40 -4
- package/dist/node/components/docs/getting-started/index.js +46 -10
- package/dist/node/components/docs/guides/GuideContractDrivenFormsPage.content.js +94 -0
- package/dist/node/components/docs/guides/GuideContractDrivenFormsPage.js +94 -0
- package/dist/node/components/docs/guides/GuideSpecValidationTypingPage.js +1 -1
- package/dist/node/components/docs/guides/GuidesIndexPage.js +2 -2
- package/dist/node/components/docs/guides/guides.docblocks.js +3 -1
- package/dist/node/components/docs/guides/index.js +139 -44
- package/dist/node/components/docs/index.js +586 -266
- package/dist/node/components/docs/libraries/LibrariesApplicationShellPage.content.js +147 -0
- package/dist/node/components/docs/libraries/LibrariesApplicationShellPage.js +147 -0
- package/dist/node/components/docs/libraries/LibrariesDataViewsPage.js +13 -6
- package/dist/node/components/docs/libraries/LibrariesDesignSystemPage.js +3 -3
- package/dist/node/components/docs/libraries/LibrariesOverviewPage.js +1 -1
- package/dist/node/components/docs/libraries/index.js +217 -64
- package/dist/node/components/docs/specs/SpecsDataViewsPage.js +37 -1
- package/dist/node/components/docs/specs/index.js +37 -1
- package/dist/node/index.js +597 -277
- package/dist/node/libs/posthog/client.js +1 -1
- package/package.json +71 -23
- package/src/components/docs/docsManifest.ts +22 -0
- package/src/components/docs/generated/docs-index._common.json +2008 -1699
- 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 -25
- 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 -241
- 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 -65
- 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-landing.json +41 -41
- 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 -201
- package/src/components/docs/generated/docs-index.platform-context.json +121 -121
- 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 -161
- 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 -217
- 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/DataViewTutorialPage.tsx +40 -1
- package/src/components/docs/guides/GuideContractDrivenFormsPage.content.ts +98 -0
- package/src/components/docs/guides/GuideContractDrivenFormsPage.tsx +143 -0
- package/src/components/docs/guides/GuideSpecValidationTypingPage.tsx +2 -2
- package/src/components/docs/guides/GuidesIndexPage.tsx +7 -0
- package/src/components/docs/guides/guides.docblocks.ts +12 -0
- package/src/components/docs/guides/index.ts +1 -0
- package/src/components/docs/libraries/LibrariesApplicationShellPage.content.ts +170 -0
- package/src/components/docs/libraries/LibrariesApplicationShellPage.tsx +112 -0
- package/src/components/docs/libraries/LibrariesDataViewsPage.tsx +26 -5
- package/src/components/docs/libraries/LibrariesDesignSystemPage.tsx +9 -0
- package/src/components/docs/libraries/LibrariesOverviewPage.tsx +6 -0
- package/src/components/docs/libraries/index.ts +1 -0
- package/src/components/docs/specs/SpecsDataViewsPage.tsx +39 -3
- package/src/libs/posthog/client.ts +11 -9
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var M=Object.defineProperty;var q=(h)=>h;function H(h,n){this[h]=q.bind(null,n)}var ve=(h,n)=>{for(var g in n)M(h,g,{get:n[g],enumerable:!0,configurable:!0,set:H.bind(n,g)})};var ye=(h,n)=>()=>(h&&(n=h(h=0)),n);import{CodeBlock as w,InstallCommand as F}from"@contractspec/lib.design-system";import V from"@contractspec/lib.ui-link";import{ChevronRight as U}from"lucide-react";import{jsx as a,jsxs as s}from"react/jsx-runtime";function W(){return s("div",{className:"space-y-8",children:[s("div",{className:"space-y-2",children:[a("h1",{className:"font-bold text-4xl",children:"ContractSpec CLI"}),a("p",{className:"text-lg text-muted-foreground",children:"Command-line interface for creating, building, and validating contract specifications with AI-powered code generation."})]}),s("div",{className:"space-y-6",children:[s("div",{className:"space-y-3",children:[a("h2",{className:"font-bold text-2xl",children:"Installation"}),a(F,{package:"contractspec",dev:!0})]}),s("div",{className:"space-y-3",children:[a("h2",{className:"font-bold text-2xl",children:"Quick Start"}),a(w,{language:"bash",code:`# Initialize project
|
|
2
2
|
contractspec onboard
|
|
3
3
|
bunx contractspec init
|
|
4
4
|
|
|
@@ -23,7 +23,7 @@ contractspec validate`})]}),s("div",{className:"space-y-4",children:[a("h2",{cla
|
|
|
23
23
|
"operations": "interactions/commands|queries",
|
|
24
24
|
"events": "events"
|
|
25
25
|
}
|
|
26
|
-
}`})]})]}),s("div",{className:"flex items-center gap-4 pt-4",children:[s(V,{href:"/docs/getting-started/tools/vscode",className:"btn-primary",children:["Next: VS Code Extension ",a(
|
|
26
|
+
}`})]})]}),s("div",{className:"flex items-center gap-4 pt-4",children:[s(V,{href:"/docs/getting-started/tools/vscode",className:"btn-primary",children:["Next: VS Code Extension ",a(U,{size:16})]}),a(V,{href:"/docs/getting-started/tools",className:"btn-ghost",children:"Back to Tools"})]})]})}import k from"@contractspec/lib.ui-link";import{ChevronRight as G}from"lucide-react";import{jsx as i,jsxs as p}from"react/jsx-runtime";function Q(){return p("div",{className:"space-y-8",children:[p("div",{className:"space-y-2",children:[i("h1",{className:"font-bold text-4xl",children:"Compatibility"}),i("p",{className:"text-lg text-muted-foreground",children:"Supported runtimes, frameworks, and agent modes for ContractSpec."})]}),p("div",{className:"space-y-6",children:[p("div",{className:"card-subtle space-y-3 p-6",children:[i("h2",{className:"font-bold text-2xl",children:"Runtimes"}),p("ul",{className:"space-y-2 text-muted-foreground",children:[i("li",{children:"Node.js 20+"}),i("li",{children:"Bun 1.0+"})]})]}),p("div",{className:"card-subtle space-y-3 p-6",children:[i("h2",{className:"font-bold text-2xl",children:"Frameworks"}),p("ul",{className:"space-y-2 text-muted-foreground",children:[i("li",{children:"Next.js 14+ (App Router preferred)"}),i("li",{children:"Bun + Elysia or compatible HTTP servers"})]})]}),p("div",{className:"card-subtle space-y-3 p-6",children:[i("h2",{className:"font-bold text-2xl",children:"Package managers"}),p("ul",{className:"space-y-2 text-muted-foreground",children:[i("li",{children:"bun (recommended)"}),i("li",{children:"npm"}),i("li",{children:"pnpm"})]})]}),p("div",{className:"card-subtle space-y-3 p-6",children:[i("h2",{className:"font-bold text-2xl",children:"AI agent modes"}),p("ul",{className:"space-y-2 text-muted-foreground",children:[i("li",{children:"claude-code"}),i("li",{children:"openai-codex"}),i("li",{children:"cursor"}),i("li",{children:"opencode"}),i("li",{children:"simple (direct LLM)"})]})]}),p("div",{className:"card-subtle space-y-3 p-6",children:[i("h2",{className:"font-bold text-2xl",children:"Datastores"}),i("p",{className:"text-muted-foreground",children:"ContractSpec ships with Prisma-friendly defaults and can integrate with custom adapters for other databases."}),p("ul",{className:"space-y-2 text-muted-foreground",children:[i("li",{children:"PostgreSQL via Prisma"}),i("li",{children:"Custom adapters for other SQL/NoSQL stores"})]})]}),p("div",{className:"card-subtle space-y-3 p-6",children:[i("h2",{className:"font-bold text-2xl",children:"Cross-platform UI architecture"}),p("p",{className:"text-muted-foreground",children:["Need the React and React Native component compatibility story? Read"," ",i(k,{href:"/docs/libraries/cross-platform-ui",className:"text-[color:var(--rust)] underline underline-offset-4",children:"Cross-platform UI"})," ","for the runtime and UI-layer split."]})]})]}),p("div",{className:"flex flex-wrap items-center gap-3 pt-2",children:[i(k,{href:"/docs/getting-started/start-here",className:"btn-ghost",children:"Start here"}),i(k,{href:"/docs/getting-started/troubleshooting",className:"btn-ghost",children:"Troubleshooting"}),p(k,{href:"/docs/getting-started/installation",className:"btn-primary",children:["Next: Installation ",i(G,{size:16})]})]})]})}import{CodeBlock as P}from"@contractspec/lib.design-system";import L from"@contractspec/lib.ui-link";import{ChevronRight as _}from"lucide-react";import{jsx as r,jsxs as b}from"react/jsx-runtime";var J=`import { defineDataView } from '@contractspec/lib.contracts-spec/data-views';
|
|
27
27
|
import { ListTransactions } from './list-transactions';
|
|
28
28
|
|
|
29
29
|
export const TransactionHistory = defineDataView({
|
|
@@ -66,8 +66,44 @@ export const TransactionHistory = defineDataView({
|
|
|
66
66
|
{ key: 'account', label: 'Account', dataPath: 'account', sortable: true },
|
|
67
67
|
{ key: 'owner', label: 'Owner', dataPath: 'owner', sortable: true },
|
|
68
68
|
{ key: 'status', label: 'Status', dataPath: 'status', sortable: true },
|
|
69
|
+
{
|
|
70
|
+
key: 'amount',
|
|
71
|
+
label: 'Amount',
|
|
72
|
+
dataPath: 'amount',
|
|
73
|
+
sortable: true,
|
|
74
|
+
format: { type: 'currency', currency: 'EUR', rounded: true },
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
key: 'renewalDate',
|
|
78
|
+
label: 'Renewal',
|
|
79
|
+
dataPath: 'renewalDate',
|
|
80
|
+
format: { type: 'date', dateStyle: 'medium' },
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
key: 'processingTime',
|
|
84
|
+
label: 'Processing time',
|
|
85
|
+
dataPath: 'processingMinutes',
|
|
86
|
+
format: { type: 'duration', unit: 'minute', display: 'digital' },
|
|
87
|
+
},
|
|
69
88
|
{ key: 'notes', label: 'Notes', dataPath: 'notes' },
|
|
70
89
|
],
|
|
90
|
+
filters: [
|
|
91
|
+
{ key: 'status', label: 'Status', field: 'status', type: 'enum' },
|
|
92
|
+
{
|
|
93
|
+
key: 'amount',
|
|
94
|
+
label: 'Amount',
|
|
95
|
+
field: 'amount',
|
|
96
|
+
type: 'currency',
|
|
97
|
+
valueMode: 'range',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
key: 'renewalDate',
|
|
101
|
+
label: 'Renewal',
|
|
102
|
+
field: 'renewalDate',
|
|
103
|
+
type: 'date',
|
|
104
|
+
valueMode: 'range',
|
|
105
|
+
},
|
|
106
|
+
],
|
|
71
107
|
},
|
|
72
108
|
});`;function X(){return b("div",{className:"space-y-8",children:[b("div",{className:"space-y-4",children:[r("h1",{className:"font-bold text-4xl",children:"Display Data with DataViews"}),r("p",{className:"text-lg text-muted-foreground",children:"Define a filterable, sortable transaction history view that works across web and mobile without duplicating UI code."})]}),b("div",{className:"space-y-4",children:[r("h2",{className:"font-bold text-2xl",children:"1. Define the underlying query"}),r("p",{className:"text-muted-foreground",children:"First, create a query operation to fetch the data:"}),r(P,{language:"typescript",filename:"lib/specs/billing/list-transactions.ts",code:`import { defineQuery } from '@contractspec/lib.contracts-spec';
|
|
73
109
|
|
|
@@ -107,7 +143,7 @@ export function TransactionsPage() {
|
|
|
107
143
|
/>
|
|
108
144
|
</div>
|
|
109
145
|
);
|
|
110
|
-
}`})]}),b("div",{className:"card-subtle space-y-4 p-6",children:[r("h3",{className:"font-bold",children:"Why DataViews?"}),b("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[r("li",{children:"Same spec renders on web (React) and mobile (React Native)"}),r("li",{children:"Filters, sorting, and pagination handled automatically"}),r("li",{children:"Column visibility, pinning, resizing, and row expansion stay contract-driven"}),r("li",{children:"
|
|
146
|
+
}`})]}),b("div",{className:"card-subtle space-y-4 p-6",children:[r("h3",{className:"font-bold",children:"Why DataViews?"}),b("ul",{className:"space-y-2 text-muted-foreground text-sm",children:[r("li",{children:"Same spec renders on web (React) and mobile (React Native)"}),r("li",{children:"Filters, sorting, and pagination handled automatically"}),r("li",{children:"Column visibility, pinning, resizing, and row expansion stay contract-driven"}),r("li",{children:"Typed format rules for numbers, percent values, currency, dates, times, datetimes, and durations applied consistently"}),r("li",{children:"Export to CSV/PDF using the same spec"}),r("li",{children:"A/B test different layouts without touching the backend"})]})]}),b("div",{className:"flex items-center gap-4 pt-4",children:[b(L,{href:"/docs/libraries/data-views",className:"btn-primary",children:["DataView API Reference ",r(_,{size:16})]}),r(L,{href:"/docs/specs/workflows",className:"btn-ghost",children:"Next: Workflows"})]})]})}import{CodeBlock as K,InstallCommand as Y}from"@contractspec/lib.design-system";import T from"@contractspec/lib.ui-link";import{ChevronRight as B,Code2 as $,Cpu as Z,Layers as x,Terminal as j}from"lucide-react";import{jsx as d,jsxs as v}from"react/jsx-runtime";function Me(){return v("div",{className:"space-y-8",children:[v("div",{className:"space-y-2",children:[d("h1",{className:"font-bold text-4xl",children:"Developer Tools"}),d("p",{className:"text-lg text-muted-foreground",children:"Use the OSS toolchain to define contracts, validate changes, inspect generated surfaces, and adopt the system incrementally across different environments."})]}),d("div",{className:"grid gap-6 md:grid-cols-2",children:[{name:"CLI",href:"/docs/getting-started/tools/cli",description:"Command-line interface for spec creation, building, validation, and CI/CD integration.",icon:j,status:"available",highlights:["AI-powered code generation","Multiple agent modes","SARIF/JSON output"]},{name:"VS Code Extension",href:"/docs/getting-started/tools/vscode",description:"Real-time validation, scaffolding, and navigation directly in your editor.",icon:$,status:"available",highlights:["Specs Explorer sidebar","Watch mode","Interactive walkthroughs"]},{name:"ContractSpec Studio",href:"https://www.contractspec.studio",description:"The operating layer on top of OSS ContractSpec for teams that want evidence-backed decisions, workflow automation, and managed delivery loops.",icon:x,status:"available",highlights:["Evidence-to-decision loop","Compiled spec diffs and task packs","Exports to Linear, Jira, Notion, and GitHub"]},{name:"JetBrains Plugin",href:"#",description:"Full ContractSpec support for IntelliJ, WebStorm, and other JetBrains IDEs.",icon:Z,status:"coming-soon",highlights:["Code navigation","Inline validation","Refactoring support"]}].map((n)=>{let g=n.icon,C=n.status==="coming-soon";return v("div",{className:`card-subtle relative space-y-4 p-6 ${C?"opacity-75":""}`,children:[C&&d("span",{className:"absolute -top-2 right-4 rounded-full bg-violet-500/20 px-2 py-0.5 font-medium text-violet-400 text-xs",children:"Coming Soon"}),v("div",{className:"flex items-center gap-3",children:[d("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-violet-500/10",children:d(g,{className:"h-5 w-5 text-violet-400"})}),d("h3",{className:"font-bold text-lg",children:n.name})]}),d("p",{className:"text-muted-foreground text-sm",children:n.description}),d("ul",{className:"space-y-1",children:n.highlights.map((E)=>v("li",{className:"flex items-center gap-2 text-muted-foreground text-sm",children:[d("span",{className:"text-violet-400",children:"-"}),E]},E))}),!C&&v(T,{href:n.href,className:"btn-ghost inline-flex items-center gap-1 text-sm",children:["Learn more ",d(B,{size:14})]})]},n.name)})}),v("div",{className:"card-subtle space-y-4 p-6",children:[d("h3",{className:"font-bold",children:"Quick Install"}),v("div",{className:"space-y-3",children:[v("div",{children:[d("p",{className:"mb-2 font-medium text-muted-foreground text-xs",children:"CLI"}),d(Y,{package:"contractspec",dev:!0})]}),v("div",{children:[d("p",{className:"mb-2 font-medium text-muted-foreground text-xs",children:"VS Code Extension"}),d(K,{language:"bash",code:"code --install-extension lssm.vscode-contractspec"})]})]})]}),v("div",{className:"flex items-center gap-4 pt-4",children:[v(T,{href:"/docs/getting-started/tools/cli",className:"btn-primary",children:["Get Started with CLI ",d(B,{size:16})]}),d(T,{href:"/docs/getting-started/tools/vscode",className:"btn-ghost",children:"VS Code Extension"})]})]})}import{CodeBlock as S}from"@contractspec/lib.design-system";import ee from"@contractspec/lib.ui-link";import{ChevronRight as te}from"lucide-react";import{jsx as o,jsxs as f}from"react/jsx-runtime";function ae(){return f("div",{className:"space-y-8",children:[f("div",{className:"space-y-2",children:[o("h1",{className:"font-bold text-4xl",children:"Your First Operation"}),o("p",{className:"text-lg text-muted-foreground",children:"Build a payment capture operation with policy enforcement in under 10 minutes."})]}),f("div",{className:"space-y-6",children:[f("div",{className:"space-y-3",children:[o("h2",{className:"font-bold text-2xl",children:"What you'll build"}),o("p",{className:"text-muted-foreground",children:"A real-world payment processing operation that validates input, enforces business rules, integrates with Stripe, and audits every transaction. This is production-ready code, not a toy example."})]}),f("div",{className:"space-y-3",children:[o("h2",{className:"font-bold text-2xl",children:"1. Define the operation spec"}),f("p",{className:"text-muted-foreground",children:["Create ",o("code",{children:"lib/specs/billing/capture-payment.ts"}),":"]}),o(S,{language:"typescript",filename:"lib/specs/billing/capture-payment.ts",code:`import { defineCommand } from '@contractspec/lib.contracts-spec';
|
|
111
147
|
import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
|
|
112
148
|
|
|
113
149
|
const CapturePaymentInput = new SchemaModel({
|
|
@@ -150,7 +186,7 @@ export const CapturePayment = defineCommand({
|
|
|
150
186
|
{ resource: 'invoice', action: 'pay', condition: 'owner' },
|
|
151
187
|
],
|
|
152
188
|
},
|
|
153
|
-
});`})]}),f("div",{className:"space-y-3",children:[o("h2",{className:"font-bold text-2xl",children:"2. Implement the handler"}),f("p",{className:"text-muted-foreground",children:["Create ",o("code",{children:"lib/handlers/billing/capture-payment.ts"}),":"]}),o(
|
|
189
|
+
});`})]}),f("div",{className:"space-y-3",children:[o("h2",{className:"font-bold text-2xl",children:"2. Implement the handler"}),f("p",{className:"text-muted-foreground",children:["Create ",o("code",{children:"lib/handlers/billing/capture-payment.ts"}),":"]}),o(S,{language:"typescript",filename:"lib/handlers/billing/capture-payment.ts",code:`import { CapturePayment } from '@/lib/specs/billing/capture-payment';
|
|
154
190
|
import { stripe } from '@/lib/integrations/stripe';
|
|
155
191
|
import { db } from '@/lib/db';
|
|
156
192
|
|
|
@@ -187,12 +223,12 @@ export async function handleCapturePayment(input, ctx) {
|
|
|
187
223
|
status: paymentIntent.status,
|
|
188
224
|
receiptUrl: paymentIntent.charges.data[0]?.receipt_url,
|
|
189
225
|
};
|
|
190
|
-
}`})]}),f("div",{className:"space-y-3",children:[o("h2",{className:"font-bold text-2xl",children:"3. Register and serve"}),f("p",{className:"text-muted-foreground",children:["Wire it up in ",o("code",{children:"lib/registry.ts"})," and"," ",o("code",{children:"app/api/ops/[...route]/route.ts"}),":"]}),o(
|
|
226
|
+
}`})]}),f("div",{className:"space-y-3",children:[o("h2",{className:"font-bold text-2xl",children:"3. Register and serve"}),f("p",{className:"text-muted-foreground",children:["Wire it up in ",o("code",{children:"lib/registry.ts"})," and"," ",o("code",{children:"app/api/ops/[...route]/route.ts"}),":"]}),o(S,{language:"typescript",filename:"lib/registry.ts",code:`import { OperationSpecRegistry, installOp } from '@contractspec/lib.contracts-spec';
|
|
191
227
|
import { CapturePayment } from './specs/billing/capture-payment';
|
|
192
228
|
import { handleCapturePayment } from './handlers/billing/capture-payment';
|
|
193
229
|
|
|
194
230
|
export const registry = new OperationSpecRegistry();
|
|
195
|
-
installOp(registry, CapturePayment, handleCapturePayment);`}),o(
|
|
231
|
+
installOp(registry, CapturePayment, handleCapturePayment);`}),o(S,{language:"typescript",filename:"app/api/ops/[...route]/route.ts",code:`import { makeNextAppHandler } from '@contractspec/lib.contracts-runtime-server-rest/rest-next-app';
|
|
196
232
|
import { registry } from '@/lib/registry';
|
|
197
233
|
import { auth } from '@/lib/auth';
|
|
198
234
|
|
|
@@ -205,12 +241,12 @@ export { handler as GET, handler as POST };`})]}),f("div",{className:"card-subtl
|
|
|
205
241
|
# Follow the interactive prompts to configure your project`})]}),y("div",{className:"space-y-3",children:[c("h2",{className:"font-bold text-2xl",children:"Initialize the database"}),c("p",{className:"text-muted-foreground",children:"If using Prisma, set up your schema and generate the client:"}),c(z,{language:"bash",filename:"installation-prisma",code:`bunx prisma init
|
|
206
242
|
# Edit prisma/schema.prisma with your models
|
|
207
243
|
bunx prisma generate
|
|
208
|
-
bunx prisma migrate dev --name init`})]}),c("div",{className:"flex items-center gap-4 pt-4",children:y(ie,{href:"/docs/getting-started/hello-world",className:"btn-primary",children:["Next: First Operation ",c(oe,{size:16})]})})]})]})}import{CodeBlock as I,InstallCommand as re}from"@contractspec/lib.design-system";import
|
|
244
|
+
bunx prisma migrate dev --name init`})]}),c("div",{className:"flex items-center gap-4 pt-4",children:y(ie,{href:"/docs/getting-started/hello-world",className:"btn-primary",children:["Next: First Operation ",c(oe,{size:16})]})})]})]})}import{CodeBlock as I,InstallCommand as re}from"@contractspec/lib.design-system";import D from"@contractspec/lib.ui-link";import{ChevronRight as ce}from"lucide-react";import{jsx as u,jsxs as N}from"react/jsx-runtime";function le(){return N("div",{className:"space-y-8",children:[N("div",{className:"space-y-2",children:[u("h1",{className:"font-bold text-4xl",children:"Start here"}),u("p",{className:"text-lg text-muted-foreground",children:"A fast onboarding path from install to your first generated contract."})]}),N("div",{className:"space-y-6",children:[N("div",{className:"space-y-3",children:[u("h2",{className:"font-bold text-2xl",children:"Install the CLI"}),u(re,{package:"contractspec",dev:!0})]}),N("div",{className:"space-y-3",children:[u("h2",{className:"font-bold text-2xl",children:"Generate repo-local guidance"}),u(I,{language:"bash",filename:"start-here-onboard",code:`contractspec onboard
|
|
209
245
|
# optional focused track
|
|
210
246
|
contractspec onboard knowledge --example knowledge-canon`})]}),N("div",{className:"space-y-3",children:[u("h2",{className:"font-bold text-2xl",children:"Initialize your project"}),u(I,{language:"bash",filename:"start-here-init",code:"bunx contractspec init"})]}),N("div",{className:"space-y-3",children:[u("h2",{className:"font-bold text-2xl",children:"Author your first contract"}),u(I,{language:"bash",filename:"start-here-create",code:"contractspec create --type operation"})]}),N("div",{className:"space-y-3",children:[u("h2",{className:"font-bold text-2xl",children:"Generate implementation"}),u(I,{language:"bash",filename:"start-here-build",code:`contractspec generate
|
|
211
|
-
contractspec validate`})]})]}),N("div",{className:"flex flex-wrap items-center gap-3 pt-2",children:[N(
|
|
247
|
+
contractspec validate`})]})]}),N("div",{className:"flex flex-wrap items-center gap-3 pt-2",children:[N(D,{href:"/docs/getting-started/hello-world",className:"btn-primary",children:["Next: Hello World ",u(ce,{size:16})]}),u(D,{href:"/docs/getting-started/troubleshooting",className:"btn-ghost",children:"Troubleshooting"}),u(D,{href:"/docs/getting-started/compatibility",className:"btn-ghost",children:"Compatibility"})]})]})}import{CodeBlock as se}from"@contractspec/lib.design-system";import A from"@contractspec/lib.ui-link";import{ChevronRight as de}from"lucide-react";import{jsx as l,jsxs as m}from"react/jsx-runtime";function pe(){return m("div",{className:"space-y-8",children:[m("div",{className:"space-y-2",children:[l("h1",{className:"font-bold text-4xl",children:"Troubleshooting"}),l("p",{className:"text-lg text-muted-foreground",children:"Common issues and fixes when installing or generating with ContractSpec."})]}),m("div",{className:"space-y-6",children:[m("div",{className:"card-subtle space-y-3 p-6",children:[l("h2",{className:"font-bold text-2xl",children:"Command not found"}),m("ul",{className:"space-y-2 text-muted-foreground",children:[l("li",{children:"Reinstall the CLI and ensure it is in your PATH."}),l("li",{children:"Confirm Node.js 20+ or Bun 1.0+ is installed."})]})]}),m("div",{className:"card-subtle space-y-3 p-6",children:[l("h2",{className:"font-bold text-2xl",children:"Specs not discovered"}),m("ul",{className:"space-y-2 text-muted-foreground",children:[m("li",{children:["Run ",l("code",{children:"contractspec list"})," to see discovered specs."]}),l("li",{children:"Verify your spec path conventions in .contractsrc.json."})]})]}),m("div",{className:"card-subtle space-y-3 p-6",children:[l("h2",{className:"font-bold text-2xl",children:"Build or validate fails"}),m("ul",{className:"space-y-2 text-muted-foreground",children:[m("li",{children:["Run ",l("code",{children:"contractspec validate"})," to surface schema errors."]}),l("li",{children:"Check that generated files were not manually edited."})]})]}),m("div",{className:"space-y-3",children:[l("h2",{className:"font-bold text-2xl",children:"Diagnostics"}),l(se,{language:"bash",filename:"troubleshooting-diagnostics",code:`contractspec --version
|
|
212
248
|
contractspec list
|
|
213
|
-
contractspec validate src/contracts/mySpec.ts`})]}),m("div",{className:"card-subtle space-y-3 p-6",children:[l("h2",{className:"font-bold text-2xl",children:"Still blocked?"}),m("ul",{className:"space-y-2 text-muted-foreground",children:[l("li",{children:"Confirm compatibility requirements for runtime and framework."}),l("li",{children:"Re-run builds on a clean branch to isolate changes."}),l("li",{children:"Use a new spec and minimal adapter to validate setup."})]})]})]}),m("div",{className:"flex flex-wrap items-center gap-3 pt-2",children:[l(
|
|
249
|
+
contractspec validate src/contracts/mySpec.ts`})]}),m("div",{className:"card-subtle space-y-3 p-6",children:[l("h2",{className:"font-bold text-2xl",children:"Still blocked?"}),m("ul",{className:"space-y-2 text-muted-foreground",children:[l("li",{children:"Confirm compatibility requirements for runtime and framework."}),l("li",{children:"Re-run builds on a clean branch to isolate changes."}),l("li",{children:"Use a new spec and minimal adapter to validate setup."})]})]})]}),m("div",{className:"flex flex-wrap items-center gap-3 pt-2",children:[l(A,{href:"/docs/getting-started/start-here",className:"btn-ghost",children:"Start here"}),l(A,{href:"/docs/getting-started/compatibility",className:"btn-ghost",children:"Compatibility"}),m(A,{href:"/docs/getting-started/installation",className:"btn-primary",children:["Next: Installation ",l(de,{size:16})]})]})]})}import{CodeBlock as me}from"@contractspec/lib.design-system";import O from"@contractspec/lib.ui-link";import{ChevronRight as ue,ExternalLink as fe}from"lucide-react";import{jsx as e,jsxs as t}from"react/jsx-runtime";function st(){let h=[{category:"Core Functionality",items:["Real-time validation with instant feedback on spec errors","Build/Scaffold handlers and components from specs","Interactive spec creation wizard","Watch mode for auto-rebuild on changes","Sync all specs in workspace with one command"]},{category:"Visual Navigation",items:["Specs Explorer sidebar with organized tree view","Dependencies view to visualize spec relationships","Build Results tracking with history","Circular dependency detection"]},{category:"Comparison & Export",items:["Semantic and text diff between specs","Git comparison with baseline branches","OpenAPI 3.1 specification export"]}],n=[{name:"Create New Spec",description:"Interactive wizard to create specs"},{name:"Validate Current Spec",description:"Validate the currently open spec"},{name:"Build/Scaffold from Current Spec",description:"Generate handler/component"},{name:"Toggle Watch Mode",description:"Auto-rebuild on changes"},{name:"Sync All Specs",description:"Build all specs in workspace"},{name:"Analyze Spec Dependencies",description:"Visualize spec dependencies"},{name:"Compare Specs",description:"Semantic or text diff between specs"},{name:"Export to OpenAPI",description:"Generate OpenAPI specification"}];return t("div",{className:"space-y-8",children:[t("div",{className:"space-y-2",children:[e("h1",{className:"font-bold text-4xl",children:"VS Code Extension"}),e("p",{className:"text-lg text-muted-foreground",children:"Spec-first development directly in VS Code. Validate, scaffold, and explore your contract specifications with real-time feedback."})]}),t("div",{className:"flex flex-wrap gap-3",children:[t("a",{href:"https://marketplace.visualstudio.com/items?itemName=lssm.vscode-contractspec",target:"_blank",rel:"noopener noreferrer",className:"btn-primary inline-flex items-center gap-2",children:["Install Extension ",e(fe,{size:16})]}),e("a",{href:"vscode:extension/lssm.vscode-contractspec",className:"btn-ghost inline-flex items-center gap-2",children:"Open in VS Code"})]}),t("div",{className:"space-y-6",children:[t("div",{className:"space-y-3",children:[e("h2",{className:"font-bold text-2xl",children:"Installation"}),t("div",{className:"space-y-2",children:[t("p",{className:"text-muted-foreground text-sm",children:[e("strong",{children:"Option 1:"})," Install from VS Code Marketplace"]}),e(me,{language:"bash",code:"code --install-extension lssm.vscode-contractspec"}),t("p",{className:"mt-4 text-muted-foreground text-sm",children:[e("strong",{children:"Option 2:"}),' Search for "ContractSpec" in VS Code Extensions (Ctrl/Cmd+Shift+X)']})]})]}),t("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Features"}),e("div",{className:"grid gap-4 md:grid-cols-3",children:h.map((g)=>t("div",{className:"card-subtle space-y-3 p-4",children:[e("h3",{className:"font-bold text-violet-400",children:g.category}),e("ul",{className:"space-y-2",children:g.items.map((C)=>t("li",{className:"flex items-start gap-2 text-muted-foreground text-sm",children:[e("span",{className:"mt-1 text-violet-400",children:"-"}),e("span",{children:C})]},C))})]},g.category))})]}),t("div",{className:"space-y-4",children:[e("h2",{className:"font-bold text-2xl",children:"Commands"}),t("p",{className:"text-muted-foreground",children:["Access commands via Command Palette (Ctrl/Cmd+Shift+P) with prefix"," ",e("code",{children:"ContractSpec:"})]}),e("div",{className:"grid gap-3 md:grid-cols-2",children:n.map((g)=>e("div",{className:"card-subtle flex items-center gap-3 p-3",children:t("div",{className:"flex-1",children:[e("p",{className:"font-medium font-mono text-sm",children:g.name}),e("p",{className:"text-muted-foreground text-xs",children:g.description})]})},g.name))})]}),t("div",{className:"space-y-3",children:[e("h2",{className:"font-bold text-2xl",children:"Sidebar Views"}),e("p",{className:"text-muted-foreground",children:"The extension adds a ContractSpec activity bar (icon in sidebar) with three views:"}),t("div",{className:"grid gap-4 md:grid-cols-3",children:[t("div",{className:"card-subtle space-y-2 p-4",children:[e("h4",{className:"font-bold",children:"Specs Explorer"}),e("p",{className:"text-muted-foreground text-sm",children:"Browse all specs organized by type. Shows name, version, and stability. Click to open, right-click for actions."})]}),t("div",{className:"card-subtle space-y-2 p-4",children:[e("h4",{className:"font-bold",children:"Dependencies"}),e("p",{className:"text-muted-foreground text-sm",children:"Visualize spec relationships. Detect circular dependencies. Navigate to referenced specs."})]}),t("div",{className:"card-subtle space-y-2 p-4",children:[e("h4",{className:"font-bold",children:"Build Results"}),e("p",{className:"text-muted-foreground text-sm",children:"Track build history (last 20). Success/failure indicators. Click to open generated files."})]})]})]}),t("div",{className:"space-y-3",children:[e("h2",{className:"font-bold text-2xl",children:"Getting Started"}),t("ol",{className:"list-inside list-decimal space-y-2 text-muted-foreground",children:[e("li",{children:"Install the extension from VS Code Marketplace"}),e("li",{children:"Open a workspace with ContractSpec files (or create one)"}),e("li",{children:"Start the walkthrough: Help - Welcome - ContractSpec"}),t("li",{children:["Create your first spec: Click ",e("strong",{children:"+"})," in Specs Explorer or run ",e("code",{children:"ContractSpec: Create New Spec"})]}),e("li",{children:"Build from it: Click the build icon in the editor title bar"})]})]}),t("div",{className:"card-subtle space-y-4 p-6",children:[e("h3",{className:"font-bold",children:"Configuration"}),e("p",{className:"text-muted-foreground text-sm",children:"Configure the extension in VS Code Settings:"}),e("div",{className:"overflow-x-auto",children:t("table",{className:"w-full text-muted-foreground text-sm",children:[e("thead",{children:t("tr",{className:"border-border border-b",children:[e("th",{className:"p-2 text-left font-medium",children:"Setting"}),e("th",{className:"p-2 text-left font-medium",children:"Description"}),e("th",{className:"p-2 text-left font-medium",children:"Default"})]})}),t("tbody",{children:[t("tr",{className:"border-border border-b",children:[e("td",{className:"p-2 font-mono text-xs",children:"validation.onSave"}),e("td",{className:"p-2",children:"Run validation on save"}),e("td",{className:"p-2",children:"true"})]}),t("tr",{className:"border-border border-b",children:[e("td",{className:"p-2 font-mono text-xs",children:"validation.onOpen"}),e("td",{className:"p-2",children:"Run validation on open"}),e("td",{className:"p-2",children:"true"})]}),t("tr",{className:"border-border border-b",children:[e("td",{className:"p-2 font-mono text-xs",children:"api.baseUrl"}),e("td",{className:"p-2",children:"Base URL for ContractSpec API"}),e("td",{className:"p-2",children:"(empty)"})]})]})]})})]})]}),t("div",{className:"flex items-center gap-4 pt-4",children:[e(O,{href:"/docs/getting-started/tools/cli",className:"btn-ghost",children:"Back: CLI"}),t(O,{href:"/docs/specs",className:"btn-primary",children:["Next: Core Concepts ",e(ue,{size:16})]})]})]})}import{registerDocBlocks as he}from"@contractspec/lib.contracts-spec/docs";var ge=[{id:"docs.getting-started.start-here",title:"Start here",summary:"Fast onboarding path from install to first generated contract.",kind:"usage",visibility:"public",route:"/docs/getting-started/start-here",tags:["getting-started","onboarding"],body:`# Start Here
|
|
214
250
|
|
|
215
251
|
Get ContractSpec running quickly and generate your first contract-backed code.
|
|
216
252
|
|
|
@@ -309,4 +345,4 @@ ContractSpec supports modern TypeScript stacks with spec-first workflows.
|
|
|
309
345
|
|
|
310
346
|
- PostgreSQL via Prisma
|
|
311
347
|
- Bring your own adapter for other databases
|
|
312
|
-
`}];he(ge);export{st as VSCodeExtensionPage,pe as TroubleshootingPage,le as StartHerePage,ne as InstallationPage,ae as HelloWorldPage,
|
|
348
|
+
`}];he(ge);export{st as VSCodeExtensionPage,pe as TroubleshootingPage,le as StartHerePage,ne as InstallationPage,ae as HelloWorldPage,Me as DeveloperToolsPage,X as DataViewTutorialPage,Q as CompatibilityPage,W as CLIPage};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
var a=Object.defineProperty;var r=(e)=>e;function n(e,t){this[e]=r.bind(null,t)}var l=(e,t)=>{for(var o in t)a(e,o,{get:t[o],enumerable:!0,configurable:!0,set:n.bind(t,o)})};var i=(e,t)=>()=>(e&&(t=e(e=0)),t);var s=`import {
|
|
2
|
+
defineFormSpec,
|
|
3
|
+
FormRegistry,
|
|
4
|
+
responsiveFormColumns,
|
|
5
|
+
} from "@contractspec/lib.contracts-spec/forms";
|
|
6
|
+
import { fromZod } from "@contractspec/lib.schema";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
|
|
9
|
+
const LeadCaptureModel = fromZod(
|
|
10
|
+
z.object({
|
|
11
|
+
fullName: z.string().min(1),
|
|
12
|
+
email: z.string().email(),
|
|
13
|
+
company: z.string().min(1),
|
|
14
|
+
intent: z.enum(["demo", "pricing", "pilot"]),
|
|
15
|
+
notes: z.string().max(1000).optional(),
|
|
16
|
+
newsletter: z.boolean().optional(),
|
|
17
|
+
}),
|
|
18
|
+
{ name: "LeadCaptureModel" },
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
export const LeadCaptureForm = defineFormSpec({
|
|
22
|
+
meta: {
|
|
23
|
+
key: "marketing.lead.form",
|
|
24
|
+
version: "1.0.0",
|
|
25
|
+
title: "Lead capture form",
|
|
26
|
+
description: "Collect qualified OSS and Studio leads.",
|
|
27
|
+
domain: "marketing",
|
|
28
|
+
owners: ["@growth"],
|
|
29
|
+
tags: ["forms", "leads"],
|
|
30
|
+
stability: "experimental",
|
|
31
|
+
},
|
|
32
|
+
model: LeadCaptureModel,
|
|
33
|
+
layout: {
|
|
34
|
+
columns: responsiveFormColumns(2),
|
|
35
|
+
gap: "md",
|
|
36
|
+
flow: {
|
|
37
|
+
kind: "sections",
|
|
38
|
+
sections: [
|
|
39
|
+
{ key: "identity", titleI18n: "Who you are", fieldNames: ["fullName", "email", "company"] },
|
|
40
|
+
{ key: "request", titleI18n: "What you need", fieldNames: ["intent", "notes", "newsletter"] },
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
fields: [
|
|
45
|
+
{ kind: "text", name: "fullName", labelI18n: "Full name", required: true, autoComplete: "name" },
|
|
46
|
+
{ kind: "email", name: "email", labelI18n: "Work email", required: true, autoComplete: "email" },
|
|
47
|
+
{ kind: "text", name: "company", labelI18n: "Company", required: true, autoComplete: "organization" },
|
|
48
|
+
{
|
|
49
|
+
kind: "select",
|
|
50
|
+
name: "intent",
|
|
51
|
+
labelI18n: "Primary goal",
|
|
52
|
+
required: true,
|
|
53
|
+
options: [
|
|
54
|
+
{ labelI18n: "Book a demo", value: "demo" },
|
|
55
|
+
{ labelI18n: "Understand pricing", value: "pricing" },
|
|
56
|
+
{ labelI18n: "Plan a pilot", value: "pilot" },
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
{ kind: "textarea", name: "notes", labelI18n: "Context", rows: 4, layout: { colSpan: "full" } },
|
|
60
|
+
{ kind: "checkbox", name: "newsletter", labelI18n: "Send product updates" },
|
|
61
|
+
],
|
|
62
|
+
actions: [{ key: "submit", labelI18n: "Send request", op: { name: "lead.create", version: "1.0.0" } }],
|
|
63
|
+
policy: { flags: ["lead-capture"], pii: ["fullName", "email", "company", "notes"] },
|
|
64
|
+
renderHints: { ui: "shadcn", form: "react-hook-form" },
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
export const formRegistry = new FormRegistry().register(LeadCaptureForm);`,d=`"use client";
|
|
68
|
+
|
|
69
|
+
import { formRenderer } from "@contractspec/lib.design-system/renderers/form-contract";
|
|
70
|
+
import { LeadCaptureForm } from "../contracts/forms/lead-capture.form";
|
|
71
|
+
|
|
72
|
+
export function LeadCapturePanel() {
|
|
73
|
+
return formRenderer.render(LeadCaptureForm, {
|
|
74
|
+
defaultValues: { newsletter: true },
|
|
75
|
+
overrides: {
|
|
76
|
+
onSubmitOverride: async (values, actionKey) => {
|
|
77
|
+
await fetch("/api/leads", {
|
|
78
|
+
method: "POST",
|
|
79
|
+
headers: { "content-type": "application/json" },
|
|
80
|
+
body: JSON.stringify({ actionKey, values }),
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
}`,p=`bun add @contractspec/example.form-showcase
|
|
86
|
+
|
|
87
|
+
# Full form-only example docs
|
|
88
|
+
open https://www.contractspec.io/docs/examples/form-showcase
|
|
89
|
+
|
|
90
|
+
# Template catalog filtered to forms
|
|
91
|
+
open https://www.contractspec.io/templates?tag=forms
|
|
92
|
+
|
|
93
|
+
# Sandbox spec preview
|
|
94
|
+
open https://www.contractspec.io/sandbox?template=form-showcase`;export{d as leadCapturePanelCode,s as leadCaptureFormCode,p as formShowcaseTemplateCode};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
var v=Object.defineProperty;var N=(o)=>o;function F(o,r){this[o]=N.bind(null,r)}var L=(o,r)=>{for(var i in r)v(o,i,{get:r[i],enumerable:!0,configurable:!0,set:F.bind(r,i)})};var R=(o,r)=>()=>(o&&(r=o(o=0)),r);import S from"@contractspec/lib.ui-link";import{jsx as c,jsxs as z}from"react/jsx-runtime";function s({title:o="Need the operating layer on top of OSS ContractSpec?",body:r="ContractSpec Studio helps teams turn evidence into proposed spec changes, governed delivery loops, and execution-ready task packs while keeping the open contract system as the source of truth.",ctaLabel:i="See what Studio adds",href:h="https://www.contractspec.studio/docs"}){return z("div",{className:"card-subtle space-y-3 p-6",children:[c("h3",{className:"font-semibold text-lg",children:o}),c("p",{className:"text-muted-foreground text-sm",children:r}),c(S,{href:h,className:"btn-primary",children:i})]})}var f=`import {
|
|
2
|
+
defineFormSpec,
|
|
3
|
+
FormRegistry,
|
|
4
|
+
responsiveFormColumns,
|
|
5
|
+
} from "@contractspec/lib.contracts-spec/forms";
|
|
6
|
+
import { fromZod } from "@contractspec/lib.schema";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
|
|
9
|
+
const LeadCaptureModel = fromZod(
|
|
10
|
+
z.object({
|
|
11
|
+
fullName: z.string().min(1),
|
|
12
|
+
email: z.string().email(),
|
|
13
|
+
company: z.string().min(1),
|
|
14
|
+
intent: z.enum(["demo", "pricing", "pilot"]),
|
|
15
|
+
notes: z.string().max(1000).optional(),
|
|
16
|
+
newsletter: z.boolean().optional(),
|
|
17
|
+
}),
|
|
18
|
+
{ name: "LeadCaptureModel" },
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
export const LeadCaptureForm = defineFormSpec({
|
|
22
|
+
meta: {
|
|
23
|
+
key: "marketing.lead.form",
|
|
24
|
+
version: "1.0.0",
|
|
25
|
+
title: "Lead capture form",
|
|
26
|
+
description: "Collect qualified OSS and Studio leads.",
|
|
27
|
+
domain: "marketing",
|
|
28
|
+
owners: ["@growth"],
|
|
29
|
+
tags: ["forms", "leads"],
|
|
30
|
+
stability: "experimental",
|
|
31
|
+
},
|
|
32
|
+
model: LeadCaptureModel,
|
|
33
|
+
layout: {
|
|
34
|
+
columns: responsiveFormColumns(2),
|
|
35
|
+
gap: "md",
|
|
36
|
+
flow: {
|
|
37
|
+
kind: "sections",
|
|
38
|
+
sections: [
|
|
39
|
+
{ key: "identity", titleI18n: "Who you are", fieldNames: ["fullName", "email", "company"] },
|
|
40
|
+
{ key: "request", titleI18n: "What you need", fieldNames: ["intent", "notes", "newsletter"] },
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
fields: [
|
|
45
|
+
{ kind: "text", name: "fullName", labelI18n: "Full name", required: true, autoComplete: "name" },
|
|
46
|
+
{ kind: "email", name: "email", labelI18n: "Work email", required: true, autoComplete: "email" },
|
|
47
|
+
{ kind: "text", name: "company", labelI18n: "Company", required: true, autoComplete: "organization" },
|
|
48
|
+
{
|
|
49
|
+
kind: "select",
|
|
50
|
+
name: "intent",
|
|
51
|
+
labelI18n: "Primary goal",
|
|
52
|
+
required: true,
|
|
53
|
+
options: [
|
|
54
|
+
{ labelI18n: "Book a demo", value: "demo" },
|
|
55
|
+
{ labelI18n: "Understand pricing", value: "pricing" },
|
|
56
|
+
{ labelI18n: "Plan a pilot", value: "pilot" },
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
{ kind: "textarea", name: "notes", labelI18n: "Context", rows: 4, layout: { colSpan: "full" } },
|
|
60
|
+
{ kind: "checkbox", name: "newsletter", labelI18n: "Send product updates" },
|
|
61
|
+
],
|
|
62
|
+
actions: [{ key: "submit", labelI18n: "Send request", op: { name: "lead.create", version: "1.0.0" } }],
|
|
63
|
+
policy: { flags: ["lead-capture"], pii: ["fullName", "email", "company", "notes"] },
|
|
64
|
+
renderHints: { ui: "shadcn", form: "react-hook-form" },
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
export const formRegistry = new FormRegistry().register(LeadCaptureForm);`,y=`"use client";
|
|
68
|
+
|
|
69
|
+
import { formRenderer } from "@contractspec/lib.design-system/renderers/form-contract";
|
|
70
|
+
import { LeadCaptureForm } from "../contracts/forms/lead-capture.form";
|
|
71
|
+
|
|
72
|
+
export function LeadCapturePanel() {
|
|
73
|
+
return formRenderer.render(LeadCaptureForm, {
|
|
74
|
+
defaultValues: { newsletter: true },
|
|
75
|
+
overrides: {
|
|
76
|
+
onSubmitOverride: async (values, actionKey) => {
|
|
77
|
+
await fetch("/api/leads", {
|
|
78
|
+
method: "POST",
|
|
79
|
+
headers: { "content-type": "application/json" },
|
|
80
|
+
body: JSON.stringify({ actionKey, values }),
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
}`,g=`bun add @contractspec/example.form-showcase
|
|
86
|
+
|
|
87
|
+
# Full form-only example docs
|
|
88
|
+
open https://www.contractspec.io/docs/examples/form-showcase
|
|
89
|
+
|
|
90
|
+
# Template catalog filtered to forms
|
|
91
|
+
open https://www.contractspec.io/templates?tag=forms
|
|
92
|
+
|
|
93
|
+
# Sandbox spec preview
|
|
94
|
+
open https://www.contractspec.io/sandbox?template=form-showcase`;import{CodeBlock as l}from"@contractspec/lib.design-system";import{HStack as C,VStack as a}from"@contractspec/lib.design-system/layout";import{List as I,ListItem as u}from"@contractspec/lib.design-system/list";import{Code as b,H1 as q,H2 as p,H3 as w,P as n,Text as m}from"@contractspec/lib.design-system/typography";import d from"@contractspec/lib.ui-link";import{ChevronRight as O}from"lucide-react";import{jsx as e,jsxs as t}from"react/jsx-runtime";function _(){return t(a,{className:"space-y-8",children:[t(a,{className:"space-y-3",children:[e(q,{className:"font-bold text-4xl",children:"Build a contract-driven form"}),e(n,{className:"text-lg text-muted-foreground",children:"Define form data, fields, layout, policy, and submit behavior once, then let your app render from the same ContractSpec surface."})]}),t(a,{className:"card-subtle space-y-4 p-6",children:[e(p,{className:"font-bold text-2xl",children:"What you'll build"}),t(I,{className:"space-y-2 text-muted-foreground text-sm",children:[e(u,{children:e(m,{children:"A schema-backed FormSpec for a lead capture form."})}),e(u,{children:e(m,{children:"A FormRegistry that exposes the latest version by stable key."})}),e(u,{children:e(m,{children:"A React renderer that keeps UI, validation, and policy aligned."})})]})]}),t(a,{className:"space-y-6",children:[t(a,{className:"space-y-3",children:[e(p,{className:"font-bold text-2xl",children:"1) Define the form spec"}),t(n,{className:"text-muted-foreground text-sm",children:["Create ",e(b,{children:"src/contracts/forms/lead-capture.form.ts"}),":"]}),e(l,{language:"typescript",filename:"src/contracts/forms/lead-capture.form.ts",code:f})]}),t(a,{className:"card-subtle space-y-3 p-6",children:[e(w,{className:"font-semibold text-lg",children:"Need every form field?"}),t(n,{className:"text-muted-foreground text-sm",children:["Start from the"," ",e(d,{href:"/docs/examples/form-showcase",children:"Form Showcase example"})," ","or the"," ",e(d,{href:"/templates?tag=forms",children:"form template catalog"}),". It is focused only on forms and covers field kinds, section layouts, step layouts, arrays, groups, conditionals, and validation hints."]}),e(l,{language:"bash",filename:"form-showcase-template",code:g})]}),t(a,{className:"space-y-3",children:[e(p,{className:"font-bold text-2xl",children:"2) Render from the contract"}),e(n,{className:"text-muted-foreground text-sm",children:"Use the shared renderer, or provide your own driver if your app uses a different component library."}),e(l,{language:"tsx",filename:"src/components/LeadCapturePanel.tsx",code:y})]}),t(a,{className:"space-y-3",children:[e(p,{className:"font-bold text-2xl",children:"3) Validate and evolve"}),e(l,{language:"bash",filename:"validate-form",code:"contractspec validate src/contracts/forms/lead-capture.form.ts"}),t(n,{className:"text-muted-foreground text-sm",children:["Expected output: ",e(b,{children:"Validation passed"}),". When the form becomes public contract surface, version changes deliberately instead of editing field meaning in place."]})]}),t(a,{className:"card-subtle space-y-3 p-6",children:[e(w,{className:"font-semibold text-lg",children:"Repo tutorial"}),e(n,{className:"text-muted-foreground text-sm",children:"The repository guide adds the longer implementation checklist, custom renderer notes, and rollout rules."}),e(l,{language:"bash",filename:"repo-guide",code:"open docs/tutorials/contract-driven-forms.md"})]}),e(s,{title:"Need governed form changes?",body:"Studio can connect form edits to customer evidence, approval packets, and rollout checks before teams regenerate public surfaces."})]}),t(C,{className:"flex items-center gap-4 pt-4",children:[t(d,{href:"/docs/guides/generate-docs-clients-schemas",className:"btn-primary",children:[e(m,{children:"Next: Generate docs + clients"}),e(O,{size:16})]}),e(d,{href:"/docs/guides",className:"btn-ghost",children:e(m,{children:"Back to guides"})})]})]})}export{_ as GuideContractDrivenFormsPage};
|
|
@@ -60,4 +60,4 @@ export const ContactCreateCommand = defineCommand({
|
|
|
60
60
|
cd packages/examples/crm-pipeline
|
|
61
61
|
bun install
|
|
62
62
|
bun run build
|
|
63
|
-
bun run validate`})]}),e(r,{title:"Need validation tied to real outcomes?",body:"Studio links checks to evidence, focus decisions, and post-release verification so specs evolve with product truth."})]}),t("div",{className:"flex items-center gap-4 pt-4",children:[t(s,{href:"/docs/guides/
|
|
63
|
+
bun run validate`})]}),e(r,{title:"Need validation tied to real outcomes?",body:"Studio links checks to evidence, focus decisions, and post-release verification so specs evolve with product truth."})]}),t("div",{className:"flex items-center gap-4 pt-4",children:[t(s,{href:"/docs/guides/contract-driven-forms",className:"btn-primary",children:["Next: Contract-driven forms ",e(f,{size:16})]}),e(s,{href:"/docs/guides",className:"btn-ghost",children:"Back to guides"})]})]})}export{O as GuideSpecValidationTypingPage};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var r=Object.defineProperty;var s=(t)=>t;function o(t,a){this[t]=s.bind(null,a)}var u=(t,a)=>{for(var n in a)r(t,n,{get:a[n],enumerable:!0,configurable:!0,set:o.bind(a,n)})};var f=(t,a)=>()=>(t&&(a=t(t=0)),a);import{CodeBlock as d}from"@contractspec/lib.design-system";import c from"@contractspec/lib.ui-link";import{ArrowRight as l,CheckCircle2 as m,GitBranch as p}from"lucide-react";import{jsx as e,jsxs as i}from"react/jsx-runtime";var h=[{title:"Adopt one endpoint in Next.js",description:"Start inside a live app with one operation, one generated surface, and one clearly bounded change.",href:"/docs/guides/nextjs-one-endpoint",time:"25 min"},{title:"Import an existing codebase",description:"Stabilize what already exists instead of treating adoption as a rewrite project.",href:"/docs/guides/import-existing-codebases",time:"20 min"},{title:"Validation and typing",description:"Keep runtime validation and TypeScript behavior aligned from the same source definitions.",href:"/docs/guides/spec-validation-and-typing",time:"20 min"},{title:"Generate docs and clients",description:"Publish stable docs, schemas, and client-facing artifacts from the contract layer.",href:"/docs/guides/generate-docs-clients-schemas",time:"20 min"},{title:"Docs pipeline",description:"Feed generated reference material into the docs site without confusing ownership.",href:"/docs/guides/docs-generation-pipeline",time:"20 min"},{title:"Build a first module bundle",description:"Define one bundle spec, resolve a surface plan, and render it through the React host layer.",href:"/docs/guides/first-module-bundle",time:"20 min"},{title:"Host the Builder workbench",description:"Wire a Builder workspace snapshot, common commands, runtime modes, and mobile review links into the reusable host.",href:"/docs/guides/host-builder-workbench",time:"20 min"},{title:"Use Connect in a repo",description:"Enable Connect, verify agent actions locally, and inspect the resulting review and replay artifacts.",href:"/docs/guides/connect-in-a-repo",time:"15 min"},{title:"Author release capsules",description:"Pair changesets with structured release capsules and generate the artifacts that changelog and upgrade flows consume.",href:"/docs/guides/release-capsules",time:"15 min"},{title:"CI diff gating",description:"Use deterministic checks to catch drift and risky changes before they ship.",href:"/docs/guides/ci-contract-diff-gating",time:"15 min"}];function
|
|
1
|
+
var r=Object.defineProperty;var s=(t)=>t;function o(t,a){this[t]=s.bind(null,a)}var u=(t,a)=>{for(var n in a)r(t,n,{get:a[n],enumerable:!0,configurable:!0,set:o.bind(a,n)})};var f=(t,a)=>()=>(t&&(a=t(t=0)),a);import{CodeBlock as d}from"@contractspec/lib.design-system";import c from"@contractspec/lib.ui-link";import{ArrowRight as l,CheckCircle2 as m,GitBranch as p}from"lucide-react";import{jsx as e,jsxs as i}from"react/jsx-runtime";var h=[{title:"Adopt one endpoint in Next.js",description:"Start inside a live app with one operation, one generated surface, and one clearly bounded change.",href:"/docs/guides/nextjs-one-endpoint",time:"25 min"},{title:"Import an existing codebase",description:"Stabilize what already exists instead of treating adoption as a rewrite project.",href:"/docs/guides/import-existing-codebases",time:"20 min"},{title:"Validation and typing",description:"Keep runtime validation and TypeScript behavior aligned from the same source definitions.",href:"/docs/guides/spec-validation-and-typing",time:"20 min"},{title:"Build a contract-driven form",description:"Use FormSpec to keep data shape, fields, layout, policy, and submit behavior aligned.",href:"/docs/guides/contract-driven-forms",time:"25 min"},{title:"Generate docs and clients",description:"Publish stable docs, schemas, and client-facing artifacts from the contract layer.",href:"/docs/guides/generate-docs-clients-schemas",time:"20 min"},{title:"Docs pipeline",description:"Feed generated reference material into the docs site without confusing ownership.",href:"/docs/guides/docs-generation-pipeline",time:"20 min"},{title:"Build a first module bundle",description:"Define one bundle spec, resolve a surface plan, and render it through the React host layer.",href:"/docs/guides/first-module-bundle",time:"20 min"},{title:"Host the Builder workbench",description:"Wire a Builder workspace snapshot, common commands, runtime modes, and mobile review links into the reusable host.",href:"/docs/guides/host-builder-workbench",time:"20 min"},{title:"Use Connect in a repo",description:"Enable Connect, verify agent actions locally, and inspect the resulting review and replay artifacts.",href:"/docs/guides/connect-in-a-repo",time:"15 min"},{title:"Author release capsules",description:"Pair changesets with structured release capsules and generate the artifacts that changelog and upgrade flows consume.",href:"/docs/guides/release-capsules",time:"15 min"},{title:"CI diff gating",description:"Use deterministic checks to catch drift and risky changes before they ship.",href:"/docs/guides/ci-contract-diff-gating",time:"15 min"}];function y(){return i("div",{className:"space-y-10",children:[i("div",{className:"space-y-3",children:[e("p",{className:"editorial-kicker",children:"Build"}),e("h1",{className:"font-serif text-4xl tracking-[-0.04em] md:text-5xl",children:"Adoption guides for teams that want to keep their code."}),e("p",{className:"max-w-3xl text-lg text-muted-foreground leading-8",children:"These guides assume you are introducing ContractSpec into a real code base. Start with a narrow surface, verify the generated outputs, and expand only after the contract loop feels trustworthy."})]}),e("div",{className:"grid gap-4 md:grid-cols-2",children:h.map((t)=>i(c,{href:t.href,className:"editorial-panel",children:[i("div",{className:"flex items-start justify-between gap-4",children:[i("div",{children:[e("h2",{className:"font-semibold text-xl",children:t.title}),e("p",{className:"mt-2 text-muted-foreground text-sm leading-7",children:t.description})]}),e(l,{className:"mt-1 shrink-0",size:18})]}),i("div",{className:"mt-4 flex items-center gap-2 text-muted-foreground text-xs",children:[e(m,{size:14}),i("span",{children:["Target time: ",t.time]})]})]},t.href))}),i("div",{className:"editorial-panel space-y-4",children:[i("div",{className:"flex items-center gap-2 font-semibold text-[color:var(--rust)] text-sm uppercase tracking-[0.2em]",children:[e(p,{size:16}),"Working style"]}),i("ul",{className:"editorial-list",children:[i("li",{children:[e("span",{className:"editorial-list-marker"}),e("span",{children:"Run each guide in a branch or sandboxed workspace."})]}),i("li",{children:[e("span",{className:"editorial-list-marker"}),e("span",{children:"Prefer one bounded surface at a time: one endpoint, one workflow, one integration, one unsafe module."})]}),i("li",{children:[e("span",{className:"editorial-list-marker"}),e("span",{children:"Use the example and reference outputs to verify what changed, not just the narrative page."})]})]}),e(d,{language:"bash",filename:"guides-quickstart",code:`# list example systems
|
|
2
2
|
contractspec examples list
|
|
3
3
|
|
|
4
4
|
# validate the examples in this workspace
|
|
5
|
-
contractspec examples validate --repo-root .`})]})]})}export{
|
|
5
|
+
contractspec examples validate --repo-root .`})]})]})}export{y as GuidesIndexPage};
|
|
@@ -4,7 +4,9 @@ Hands-on, runnable guides that map to real adoption scenarios. Each guide includ
|
|
|
4
4
|
|
|
5
5
|
Create a single OperationSpec, register it, and expose it through a Next.js App Router handler.`},{id:"docs.guides.spec-validation-typing",title:"Spec validation and typing",summary:"Define an operation spec with validation and types, no rewrites.",kind:"usage",visibility:"public",route:"/docs/guides/spec-validation-and-typing",tags:["guides","validation","typing"],body:`# Spec-driven validation and typing
|
|
6
6
|
|
|
7
|
-
Define command/query specs that enforce validation and generate types without rewriting your app.`},{id:"docs.guides.
|
|
7
|
+
Define command/query specs that enforce validation and generate types without rewriting your app.`},{id:"docs.guides.contract-driven-forms",title:"Contract-driven forms",summary:"Define schema-backed FormSpec surfaces and render them safely.",kind:"usage",visibility:"public",route:"/docs/guides/contract-driven-forms",tags:["guides","forms","ui"],body:`# Build a contract-driven form
|
|
8
|
+
|
|
9
|
+
Define a FormSpec with model, fields, layout, policy, and actions, then render it through a shared or app-specific renderer.`},{id:"docs.guides.docs-clients-schemas",title:"Generate docs, clients, schemas",summary:"Generate docs and OpenAPI for client SDKs from specs.",kind:"usage",visibility:"public",route:"/docs/guides/generate-docs-clients-schemas",tags:["guides","docs","openapi"],body:`# Generate docs and client schemas
|
|
8
10
|
|
|
9
11
|
Use ContractSpec to generate documentation and OpenAPI exports for client SDKs.
|
|
10
12
|
|