@contractspec/example.lifecycle-dashboard 1.57.0 → 1.59.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.
@@ -1,31 +1,32 @@
1
- $ bun build:types && bun build:bundle
2
- $ tsc --noEmit
3
- $ tsdown
4
- ℹ tsdown v0.20.3 powered by rolldown v1.0.0-rc.3
5
- ℹ config file: /home/runner/work/contractspec/contractspec/packages/examples/lifecycle-dashboard/tsdown.config.js
6
- ℹ entry: src/example.ts, src/index.ts, src/docs/index.ts, src/docs/lifecycle-dashboard.docblock.ts, src/snippets/page.ts
7
- ℹ target: esnext
8
- ℹ tsconfig: tsconfig.json
9
- ℹ Build start
10
- ℹ dist/snippets/page.js 1.82 kB │ gzip: 0.87 kB
11
- ℹ dist/docs/lifecycle-dashboard.docblock.js 0.98 kB │ gzip: 0.56 kB
12
- ℹ dist/example.js 0.95 kB │ gzip: 0.52 kB
13
- ℹ dist/index.js 0.19 kB │ gzip: 0.13 kB
14
- ℹ dist/docs/index.js 0.04 kB │ gzip: 0.06 kB
15
- ℹ dist/snippets/page.js.map 1.91 kB │ gzip: 0.91 kB
16
- ℹ dist/example.js.map 1.41 kB │ gzip: 0.71 kB
17
- ℹ dist/docs/lifecycle-dashboard.docblock.js.map 1.32 kB │ gzip: 0.72 kB
18
- ℹ dist/example.d.ts.map 0.13 kB │ gzip: 0.13 kB
19
- ℹ dist/snippets/page.d.ts.map 0.12 kB │ gzip: 0.12 kB
20
- ℹ dist/snippets/page.d.ts 1.89 kB │ gzip: 0.88 kB
21
- ℹ dist/example.d.ts 0.25 kB │ gzip: 0.17 kB
22
- ℹ dist/index.d.ts 0.16 kB │ gzip: 0.11 kB
23
- ℹ dist/docs/index.d.ts 0.01 kB │ gzip: 0.03 kB
24
- ℹ dist/docs/lifecycle-dashboard.docblock.d.ts 0.01 kB │ gzip: 0.03 kB
25
- ℹ 15 files, total: 11.20 kB
26
- [PLUGIN_TIMINGS] Warning: Your build spent significant time in plugins. Here is a breakdown:
27
- - rolldown-plugin-dts:generate (59%)
28
- - tsdown:external (40%)
29
- See https://rolldown.rs/options/checks#plugintimings for more details.
1
+ $ contractspec-bun-build prebuild
2
+ $ bun run prebuild && bun run build:bundle && bun run build:types
3
+ $ contractspec-bun-build prebuild
4
+ $ contractspec-bun-build transpile
5
+ [contractspec-bun-build] transpile target=bun root=src entries=5
6
+ Bundled 5 modules in 18ms
30
7
 
31
- ✔ Build complete in 20887ms
8
+ docs/index.js 0.95 KB (entry point)
9
+ ./index.js 3.46 KB (entry point)
10
+ docs/lifecycle-dashboard.docblock.js 0.95 KB (entry point)
11
+ ./example.js 0.95 KB (entry point)
12
+ snippets/page.js 1.58 KB (entry point)
13
+
14
+ [contractspec-bun-build] transpile target=node root=src entries=5
15
+ Bundled 5 modules in 7ms
16
+
17
+ docs/index.js 0.94 KB (entry point)
18
+ ./index.js 3.45 KB (entry point)
19
+ docs/lifecycle-dashboard.docblock.js 0.94 KB (entry point)
20
+ ./example.js 0.94 KB (entry point)
21
+ snippets/page.js 1.58 KB (entry point)
22
+
23
+ [contractspec-bun-build] transpile target=browser root=src entries=5
24
+ Bundled 5 modules in 15ms
25
+
26
+ docs/index.js 0.94 KB (entry point)
27
+ ./index.js 3.45 KB (entry point)
28
+ docs/lifecycle-dashboard.docblock.js 0.94 KB (entry point)
29
+ ./example.js 0.94 KB (entry point)
30
+ snippets/page.js 1.58 KB (entry point)
31
+
32
+ $ contractspec-bun-build types
@@ -0,0 +1 @@
1
+ $ contractspec-bun-build prebuild
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @contractspec/example.lifecycle-dashboard
2
2
 
3
+ ## 1.59.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 1a0cf44: fix: publishConfig not supported by bun
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [1a0cf44]
12
+ - @contractspec/lib.contracts@1.59.0
13
+
14
+ ## 1.58.0
15
+
16
+ ### Minor Changes
17
+
18
+ - d1f0fd0: chore: Migrate non-app package builds from tsdown to shared Bun tooling, add `@contractspec/tool.bun`, and standardize `prebuild`/`build`/`typecheck` with platform-aware exports and `tsc` declaration emission into `dist`.
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [d1f0fd0]
23
+ - Updated dependencies [4355a9e]
24
+ - @contractspec/lib.contracts@1.58.0
25
+
3
26
  ## 1.57.0
4
27
 
5
28
  ### Minor Changes
@@ -0,0 +1,22 @@
1
+ // src/docs/lifecycle-dashboard.docblock.ts
2
+ import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
3
+ var blocks = [
4
+ {
5
+ id: "docs.examples.lifecycle-dashboard",
6
+ title: "Lifecycle Dashboard (example snippet)",
7
+ summary: "Minimal dashboard page pattern that calls lifecycle-managed API routes and renders a status card.",
8
+ kind: "reference",
9
+ visibility: "public",
10
+ route: "/docs/examples/lifecycle-dashboard",
11
+ tags: ["lifecycle", "dashboard", "example"],
12
+ body: `## What this example shows
13
+ - A simple client-driven fetch to \`POST /api/lifecycle/assessments\`.
14
+ - A card-shaped UI pattern for stage + confidence + recommendations.
15
+
16
+ ## Notes
17
+ - Keep your app design-system-first (no raw HTML in application code).
18
+ - Add explicit loading/error/empty states with accessible messaging.
19
+ - Implement API routes in your app as thin adapters over lifecycle-managed services.`
20
+ }
21
+ ];
22
+ registerDocBlocks(blocks);
@@ -0,0 +1,22 @@
1
+ // src/docs/lifecycle-dashboard.docblock.ts
2
+ import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
3
+ var blocks = [
4
+ {
5
+ id: "docs.examples.lifecycle-dashboard",
6
+ title: "Lifecycle Dashboard (example snippet)",
7
+ summary: "Minimal dashboard page pattern that calls lifecycle-managed API routes and renders a status card.",
8
+ kind: "reference",
9
+ visibility: "public",
10
+ route: "/docs/examples/lifecycle-dashboard",
11
+ tags: ["lifecycle", "dashboard", "example"],
12
+ body: `## What this example shows
13
+ - A simple client-driven fetch to \`POST /api/lifecycle/assessments\`.
14
+ - A card-shaped UI pattern for stage + confidence + recommendations.
15
+
16
+ ## Notes
17
+ - Keep your app design-system-first (no raw HTML in application code).
18
+ - Add explicit loading/error/empty states with accessible messaging.
19
+ - Implement API routes in your app as thin adapters over lifecycle-managed services.`
20
+ }
21
+ ];
22
+ registerDocBlocks(blocks);
@@ -0,0 +1,32 @@
1
+ // src/example.ts
2
+ import { defineExample } from "@contractspec/lib.contracts";
3
+ var example = defineExample({
4
+ meta: {
5
+ key: "lifecycle-dashboard",
6
+ version: "1.0.0",
7
+ title: "Lifecycle Dashboard (snippet)",
8
+ description: "A minimal dashboard page pattern: call lifecycle-managed endpoints and render a mobile-friendly status card.",
9
+ kind: "blueprint",
10
+ visibility: "public",
11
+ stability: "experimental",
12
+ owners: ["@platform.core"],
13
+ tags: ["lifecycle", "dashboard", "nextjs", "snippet"]
14
+ },
15
+ docs: {
16
+ rootDocId: "docs.examples.lifecycle-dashboard"
17
+ },
18
+ entrypoints: {
19
+ packageName: "@contractspec/example.lifecycle-dashboard",
20
+ docs: "./docs"
21
+ },
22
+ surfaces: {
23
+ templates: true,
24
+ sandbox: { enabled: true, modes: ["markdown", "specs"] },
25
+ studio: { enabled: true, installable: true },
26
+ mcp: { enabled: true }
27
+ }
28
+ });
29
+ var example_default = example;
30
+ export {
31
+ example_default as default
32
+ };
@@ -0,0 +1,109 @@
1
+ // src/docs/lifecycle-dashboard.docblock.ts
2
+ import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
3
+ var blocks = [
4
+ {
5
+ id: "docs.examples.lifecycle-dashboard",
6
+ title: "Lifecycle Dashboard (example snippet)",
7
+ summary: "Minimal dashboard page pattern that calls lifecycle-managed API routes and renders a status card.",
8
+ kind: "reference",
9
+ visibility: "public",
10
+ route: "/docs/examples/lifecycle-dashboard",
11
+ tags: ["lifecycle", "dashboard", "example"],
12
+ body: `## What this example shows
13
+ - A simple client-driven fetch to \`POST /api/lifecycle/assessments\`.
14
+ - A card-shaped UI pattern for stage + confidence + recommendations.
15
+
16
+ ## Notes
17
+ - Keep your app design-system-first (no raw HTML in application code).
18
+ - Add explicit loading/error/empty states with accessible messaging.
19
+ - Implement API routes in your app as thin adapters over lifecycle-managed services.`
20
+ }
21
+ ];
22
+ registerDocBlocks(blocks);
23
+ // src/example.ts
24
+ import { defineExample } from "@contractspec/lib.contracts";
25
+ var example = defineExample({
26
+ meta: {
27
+ key: "lifecycle-dashboard",
28
+ version: "1.0.0",
29
+ title: "Lifecycle Dashboard (snippet)",
30
+ description: "A minimal dashboard page pattern: call lifecycle-managed endpoints and render a mobile-friendly status card.",
31
+ kind: "blueprint",
32
+ visibility: "public",
33
+ stability: "experimental",
34
+ owners: ["@platform.core"],
35
+ tags: ["lifecycle", "dashboard", "nextjs", "snippet"]
36
+ },
37
+ docs: {
38
+ rootDocId: "docs.examples.lifecycle-dashboard"
39
+ },
40
+ entrypoints: {
41
+ packageName: "@contractspec/example.lifecycle-dashboard",
42
+ docs: "./docs"
43
+ },
44
+ surfaces: {
45
+ templates: true,
46
+ sandbox: { enabled: true, modes: ["markdown", "specs"] },
47
+ studio: { enabled: true, installable: true },
48
+ mcp: { enabled: true }
49
+ }
50
+ });
51
+ var example_default = example;
52
+
53
+ // src/snippets/page.ts
54
+ var lifecycleDashboardNextPageSnippet = `'use client';
55
+
56
+ import { useEffect, useState } from 'react';
57
+
58
+ type StageCard = {
59
+ stage: number;
60
+ name: string;
61
+ confidence: number;
62
+ recommendation?: {
63
+ actions: { id: string; title: string; description: string }[];
64
+ };
65
+ libraries?: { id: string; description: string }[];
66
+ };
67
+
68
+ export default function LifecycleDashboardPage() {
69
+ const [card, setCard] = useState<StageCard | null>(null);
70
+ const [loading, setLoading] = useState(false);
71
+ const [error, setError] = useState<string>();
72
+
73
+ useEffect(() => {
74
+ void runAssessment();
75
+ }, []);
76
+
77
+ async function runAssessment() {
78
+ try {
79
+ setLoading(true);
80
+ setError(undefined);
81
+ const response = await fetch('/api/lifecycle/assessments', {
82
+ method: 'POST',
83
+ headers: { 'Content-Type': 'application/json' },
84
+ body: JSON.stringify({ tenantId: 'demo' }),
85
+ });
86
+ if (!response.ok) throw new Error('Failed assessment');
87
+ const data = await response.json();
88
+ setCard({
89
+ stage: data.assessment.stage,
90
+ name: data.assessment.stageName ?? \`Stage \${data.assessment.stage}\`,
91
+ confidence: data.assessment.confidence,
92
+ recommendation: data.recommendation,
93
+ libraries: data.libraries,
94
+ });
95
+ } catch (err) {
96
+ setError(err instanceof Error ? err.message : 'Unknown error');
97
+ } finally {
98
+ setLoading(false);
99
+ }
100
+ }
101
+
102
+ // Render using your app's design system components in real code.
103
+ return null;
104
+ }
105
+ `;
106
+ export {
107
+ lifecycleDashboardNextPageSnippet,
108
+ example_default as example
109
+ };
@@ -0,0 +1,56 @@
1
+ // src/snippets/page.ts
2
+ var lifecycleDashboardNextPageSnippet = `'use client';
3
+
4
+ import { useEffect, useState } from 'react';
5
+
6
+ type StageCard = {
7
+ stage: number;
8
+ name: string;
9
+ confidence: number;
10
+ recommendation?: {
11
+ actions: { id: string; title: string; description: string }[];
12
+ };
13
+ libraries?: { id: string; description: string }[];
14
+ };
15
+
16
+ export default function LifecycleDashboardPage() {
17
+ const [card, setCard] = useState<StageCard | null>(null);
18
+ const [loading, setLoading] = useState(false);
19
+ const [error, setError] = useState<string>();
20
+
21
+ useEffect(() => {
22
+ void runAssessment();
23
+ }, []);
24
+
25
+ async function runAssessment() {
26
+ try {
27
+ setLoading(true);
28
+ setError(undefined);
29
+ const response = await fetch('/api/lifecycle/assessments', {
30
+ method: 'POST',
31
+ headers: { 'Content-Type': 'application/json' },
32
+ body: JSON.stringify({ tenantId: 'demo' }),
33
+ });
34
+ if (!response.ok) throw new Error('Failed assessment');
35
+ const data = await response.json();
36
+ setCard({
37
+ stage: data.assessment.stage,
38
+ name: data.assessment.stageName ?? \`Stage \${data.assessment.stage}\`,
39
+ confidence: data.assessment.confidence,
40
+ recommendation: data.recommendation,
41
+ libraries: data.libraries,
42
+ });
43
+ } catch (err) {
44
+ setError(err instanceof Error ? err.message : 'Unknown error');
45
+ } finally {
46
+ setLoading(false);
47
+ }
48
+ }
49
+
50
+ // Render using your app's design system components in real code.
51
+ return null;
52
+ }
53
+ `;
54
+ export {
55
+ lifecycleDashboardNextPageSnippet
56
+ };
@@ -1 +1,2 @@
1
- export { };
1
+ import './lifecycle-dashboard.docblock';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/docs/index.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC"}
@@ -1 +1,23 @@
1
- import "./lifecycle-dashboard.docblock.js";
1
+ // @bun
2
+ // src/docs/lifecycle-dashboard.docblock.ts
3
+ import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
4
+ var blocks = [
5
+ {
6
+ id: "docs.examples.lifecycle-dashboard",
7
+ title: "Lifecycle Dashboard (example snippet)",
8
+ summary: "Minimal dashboard page pattern that calls lifecycle-managed API routes and renders a status card.",
9
+ kind: "reference",
10
+ visibility: "public",
11
+ route: "/docs/examples/lifecycle-dashboard",
12
+ tags: ["lifecycle", "dashboard", "example"],
13
+ body: `## What this example shows
14
+ - A simple client-driven fetch to \`POST /api/lifecycle/assessments\`.
15
+ - A card-shaped UI pattern for stage + confidence + recommendations.
16
+
17
+ ## Notes
18
+ - Keep your app design-system-first (no raw HTML in application code).
19
+ - Add explicit loading/error/empty states with accessible messaging.
20
+ - Implement API routes in your app as thin adapters over lifecycle-managed services.`
21
+ }
22
+ ];
23
+ registerDocBlocks(blocks);
@@ -1 +1,2 @@
1
- export { };
1
+ export {};
2
+ //# sourceMappingURL=lifecycle-dashboard.docblock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle-dashboard.docblock.d.ts","sourceRoot":"","sources":["../../src/docs/lifecycle-dashboard.docblock.ts"],"names":[],"mappings":""}
@@ -1,20 +1,23 @@
1
+ // @bun
2
+ // src/docs/lifecycle-dashboard.docblock.ts
1
3
  import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
4
+ var blocks = [
5
+ {
6
+ id: "docs.examples.lifecycle-dashboard",
7
+ title: "Lifecycle Dashboard (example snippet)",
8
+ summary: "Minimal dashboard page pattern that calls lifecycle-managed API routes and renders a status card.",
9
+ kind: "reference",
10
+ visibility: "public",
11
+ route: "/docs/examples/lifecycle-dashboard",
12
+ tags: ["lifecycle", "dashboard", "example"],
13
+ body: `## What this example shows
14
+ - A simple client-driven fetch to \`POST /api/lifecycle/assessments\`.
15
+ - A card-shaped UI pattern for stage + confidence + recommendations.
2
16
 
3
- //#region src/docs/lifecycle-dashboard.docblock.ts
4
- registerDocBlocks([{
5
- id: "docs.examples.lifecycle-dashboard",
6
- title: "Lifecycle Dashboard (example snippet)",
7
- summary: "Minimal dashboard page pattern that calls lifecycle-managed API routes and renders a status card.",
8
- kind: "reference",
9
- visibility: "public",
10
- route: "/docs/examples/lifecycle-dashboard",
11
- tags: [
12
- "lifecycle",
13
- "dashboard",
14
- "example"
15
- ],
16
- body: `## What this example shows\n- A simple client-driven fetch to \`POST /api/lifecycle/assessments\`.\n- A card-shaped UI pattern for stage + confidence + recommendations.\n\n## Notes\n- Keep your app design-system-first (no raw HTML in application code).\n- Add explicit loading/error/empty states with accessible messaging.\n- Implement API routes in your app as thin adapters over lifecycle-managed services.`
17
- }]);
18
-
19
- //#endregion
20
- //# sourceMappingURL=lifecycle-dashboard.docblock.js.map
17
+ ## Notes
18
+ - Keep your app design-system-first (no raw HTML in application code).
19
+ - Add explicit loading/error/empty states with accessible messaging.
20
+ - Implement API routes in your app as thin adapters over lifecycle-managed services.`
21
+ }
22
+ ];
23
+ registerDocBlocks(blocks);
package/dist/example.d.ts CHANGED
@@ -1,7 +1,3 @@
1
- import * as _contractspec_lib_contracts0 from "@contractspec/lib.contracts";
2
-
3
- //#region src/example.d.ts
4
- declare const example: _contractspec_lib_contracts0.ExampleSpec;
5
- //#endregion
6
- export { example as default };
1
+ declare const example: import("@contractspec/lib.contracts").ExampleSpec;
2
+ export default example;
7
3
  //# sourceMappingURL=example.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"mappings":";;;cAEM,OAAA,EA0BJ,4BAAA,CA1BW,WAAA"}
1
+ {"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../src/example.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,OAAO,mDA0BX,CAAC;AAEH,eAAe,OAAO,CAAC"}
package/dist/example.js CHANGED
@@ -1,42 +1,33 @@
1
+ // @bun
2
+ // src/example.ts
1
3
  import { defineExample } from "@contractspec/lib.contracts";
2
-
3
- //#region src/example.ts
4
- const example = defineExample({
5
- meta: {
6
- key: "lifecycle-dashboard",
7
- version: "1.0.0",
8
- title: "Lifecycle Dashboard (snippet)",
9
- description: "A minimal dashboard page pattern: call lifecycle-managed endpoints and render a mobile-friendly status card.",
10
- kind: "blueprint",
11
- visibility: "public",
12
- stability: "experimental",
13
- owners: ["@platform.core"],
14
- tags: [
15
- "lifecycle",
16
- "dashboard",
17
- "nextjs",
18
- "snippet"
19
- ]
20
- },
21
- docs: { rootDocId: "docs.examples.lifecycle-dashboard" },
22
- entrypoints: {
23
- packageName: "@contractspec/example.lifecycle-dashboard",
24
- docs: "./docs"
25
- },
26
- surfaces: {
27
- templates: true,
28
- sandbox: {
29
- enabled: true,
30
- modes: ["markdown", "specs"]
31
- },
32
- studio: {
33
- enabled: true,
34
- installable: true
35
- },
36
- mcp: { enabled: true }
37
- }
4
+ var example = defineExample({
5
+ meta: {
6
+ key: "lifecycle-dashboard",
7
+ version: "1.0.0",
8
+ title: "Lifecycle Dashboard (snippet)",
9
+ description: "A minimal dashboard page pattern: call lifecycle-managed endpoints and render a mobile-friendly status card.",
10
+ kind: "blueprint",
11
+ visibility: "public",
12
+ stability: "experimental",
13
+ owners: ["@platform.core"],
14
+ tags: ["lifecycle", "dashboard", "nextjs", "snippet"]
15
+ },
16
+ docs: {
17
+ rootDocId: "docs.examples.lifecycle-dashboard"
18
+ },
19
+ entrypoints: {
20
+ packageName: "@contractspec/example.lifecycle-dashboard",
21
+ docs: "./docs"
22
+ },
23
+ surfaces: {
24
+ templates: true,
25
+ sandbox: { enabled: true, modes: ["markdown", "specs"] },
26
+ studio: { enabled: true, installable: true },
27
+ mcp: { enabled: true }
28
+ }
38
29
  });
39
-
40
- //#endregion
41
- export { example as default };
42
- //# sourceMappingURL=example.js.map
30
+ var example_default = example;
31
+ export {
32
+ example_default as default
33
+ };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
- import example from "./example.js";
2
- import { lifecycleDashboardNextPageSnippet } from "./snippets/page.js";
3
- export { example, lifecycleDashboardNextPageSnippet };
1
+ export { default as example } from './example';
2
+ export * from './snippets/page';
3
+ import './docs';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,cAAc,iBAAiB,CAAC;AAChC,OAAO,QAAQ,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,110 @@
1
- import example from "./example.js";
2
- import { lifecycleDashboardNextPageSnippet } from "./snippets/page.js";
3
- import "./docs/index.js";
1
+ // @bun
2
+ // src/docs/lifecycle-dashboard.docblock.ts
3
+ import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
4
+ var blocks = [
5
+ {
6
+ id: "docs.examples.lifecycle-dashboard",
7
+ title: "Lifecycle Dashboard (example snippet)",
8
+ summary: "Minimal dashboard page pattern that calls lifecycle-managed API routes and renders a status card.",
9
+ kind: "reference",
10
+ visibility: "public",
11
+ route: "/docs/examples/lifecycle-dashboard",
12
+ tags: ["lifecycle", "dashboard", "example"],
13
+ body: `## What this example shows
14
+ - A simple client-driven fetch to \`POST /api/lifecycle/assessments\`.
15
+ - A card-shaped UI pattern for stage + confidence + recommendations.
4
16
 
5
- export { example, lifecycleDashboardNextPageSnippet };
17
+ ## Notes
18
+ - Keep your app design-system-first (no raw HTML in application code).
19
+ - Add explicit loading/error/empty states with accessible messaging.
20
+ - Implement API routes in your app as thin adapters over lifecycle-managed services.`
21
+ }
22
+ ];
23
+ registerDocBlocks(blocks);
24
+ // src/example.ts
25
+ import { defineExample } from "@contractspec/lib.contracts";
26
+ var example = defineExample({
27
+ meta: {
28
+ key: "lifecycle-dashboard",
29
+ version: "1.0.0",
30
+ title: "Lifecycle Dashboard (snippet)",
31
+ description: "A minimal dashboard page pattern: call lifecycle-managed endpoints and render a mobile-friendly status card.",
32
+ kind: "blueprint",
33
+ visibility: "public",
34
+ stability: "experimental",
35
+ owners: ["@platform.core"],
36
+ tags: ["lifecycle", "dashboard", "nextjs", "snippet"]
37
+ },
38
+ docs: {
39
+ rootDocId: "docs.examples.lifecycle-dashboard"
40
+ },
41
+ entrypoints: {
42
+ packageName: "@contractspec/example.lifecycle-dashboard",
43
+ docs: "./docs"
44
+ },
45
+ surfaces: {
46
+ templates: true,
47
+ sandbox: { enabled: true, modes: ["markdown", "specs"] },
48
+ studio: { enabled: true, installable: true },
49
+ mcp: { enabled: true }
50
+ }
51
+ });
52
+ var example_default = example;
53
+
54
+ // src/snippets/page.ts
55
+ var lifecycleDashboardNextPageSnippet = `'use client';
56
+
57
+ import { useEffect, useState } from 'react';
58
+
59
+ type StageCard = {
60
+ stage: number;
61
+ name: string;
62
+ confidence: number;
63
+ recommendation?: {
64
+ actions: { id: string; title: string; description: string }[];
65
+ };
66
+ libraries?: { id: string; description: string }[];
67
+ };
68
+
69
+ export default function LifecycleDashboardPage() {
70
+ const [card, setCard] = useState<StageCard | null>(null);
71
+ const [loading, setLoading] = useState(false);
72
+ const [error, setError] = useState<string>();
73
+
74
+ useEffect(() => {
75
+ void runAssessment();
76
+ }, []);
77
+
78
+ async function runAssessment() {
79
+ try {
80
+ setLoading(true);
81
+ setError(undefined);
82
+ const response = await fetch('/api/lifecycle/assessments', {
83
+ method: 'POST',
84
+ headers: { 'Content-Type': 'application/json' },
85
+ body: JSON.stringify({ tenantId: 'demo' }),
86
+ });
87
+ if (!response.ok) throw new Error('Failed assessment');
88
+ const data = await response.json();
89
+ setCard({
90
+ stage: data.assessment.stage,
91
+ name: data.assessment.stageName ?? \`Stage \${data.assessment.stage}\`,
92
+ confidence: data.assessment.confidence,
93
+ recommendation: data.recommendation,
94
+ libraries: data.libraries,
95
+ });
96
+ } catch (err) {
97
+ setError(err instanceof Error ? err.message : 'Unknown error');
98
+ } finally {
99
+ setLoading(false);
100
+ }
101
+ }
102
+
103
+ // Render using your app's design system components in real code.
104
+ return null;
105
+ }
106
+ `;
107
+ export {
108
+ lifecycleDashboardNextPageSnippet,
109
+ example_default as example
110
+ };