@contractspec/example.lifecycle-dashboard 1.56.1 → 1.58.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 +32 -26
- package/.turbo/turbo-prebuild.log +1 -0
- package/CHANGELOG.md +28 -0
- package/dist/browser/docs/index.js +22 -0
- package/dist/browser/docs/lifecycle-dashboard.docblock.js +22 -0
- package/dist/browser/example.js +32 -0
- package/dist/browser/index.js +109 -0
- package/dist/browser/snippets/page.js +56 -0
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +23 -1
- package/dist/docs/lifecycle-dashboard.docblock.d.ts +2 -1
- package/dist/docs/lifecycle-dashboard.docblock.d.ts.map +1 -0
- package/dist/docs/lifecycle-dashboard.docblock.js +21 -18
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +30 -40
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +109 -4
- package/dist/node/docs/index.js +22 -0
- package/dist/node/docs/lifecycle-dashboard.docblock.js +22 -0
- package/dist/node/example.js +32 -0
- package/dist/node/index.js +109 -0
- package/dist/node/snippets/page.js +56 -0
- package/dist/snippets/page.d.ts +1 -4
- package/dist/snippets/page.d.ts.map +1 -1
- package/dist/snippets/page.js +6 -12
- package/package.json +60 -23
- package/tsdown.config.js +1 -2
- package/.turbo/turbo-build$colon$bundle.log +0 -25
- package/dist/docs/lifecycle-dashboard.docblock.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/snippets/page.js.map +0 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,26 +1,32 @@
|
|
|
1
|
-
$ bun
|
|
2
|
-
$
|
|
3
|
-
$
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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 4ms
|
|
7
|
+
|
|
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 10ms
|
|
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 13ms
|
|
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,33 @@
|
|
|
1
1
|
# @contractspec/example.lifecycle-dashboard
|
|
2
2
|
|
|
3
|
+
## 1.58.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 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`.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [d1f0fd0]
|
|
12
|
+
- Updated dependencies [4355a9e]
|
|
13
|
+
- @contractspec/lib.contracts@1.58.0
|
|
14
|
+
|
|
15
|
+
## 1.57.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- 11a5a05: feat: improve product intent
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [8ecf3c1]
|
|
24
|
+
- Updated dependencies [47c48c2]
|
|
25
|
+
- Updated dependencies [a119963]
|
|
26
|
+
- Updated dependencies [4651e06]
|
|
27
|
+
- Updated dependencies [ad9d10a]
|
|
28
|
+
- Updated dependencies [11a5a05]
|
|
29
|
+
- @contractspec/lib.contracts@1.57.0
|
|
30
|
+
|
|
3
31
|
## 1.56.1
|
|
4
32
|
|
|
5
33
|
### Patch 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
|
+
};
|
package/dist/docs/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
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"}
|
package/dist/docs/index.js
CHANGED
|
@@ -1 +1,23 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
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
|
package/dist/example.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"example.d.ts","
|
|
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,43 +1,33 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/example.ts
|
|
1
3
|
import { defineExample } from "@contractspec/lib.contracts";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
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
30
|
var example_default = example;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
//# sourceMappingURL=example.js.map
|
|
31
|
+
export {
|
|
32
|
+
example_default as default
|
|
33
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
import "
|
|
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
|
-
|
|
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
|
+
};
|
|
@@ -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
|
+
};
|
package/dist/snippets/page.d.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
//#region src/snippets/page.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Deterministic snippet for a Next.js App Router page.
|
|
4
3
|
*
|
|
5
4
|
* We keep this as a string so `packages/examples/*` stays design-system-first and
|
|
6
5
|
* avoids raw HTML in runnable application code.
|
|
7
6
|
*/
|
|
8
|
-
declare const lifecycleDashboardNextPageSnippet = "'use client';\n\nimport { useEffect, useState } from 'react';\n\ntype StageCard = {\n stage: number;\n name: string;\n confidence: number;\n recommendation?: {\n actions: { id: string; title: string; description: string }[];\n };\n libraries?: { id: string; description: string }[];\n};\n\nexport default function LifecycleDashboardPage() {\n const [card, setCard] = useState<StageCard | null>(null);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string>();\n\n useEffect(() => {\n void runAssessment();\n }, []);\n\n async function runAssessment() {\n try {\n setLoading(true);\n setError(undefined);\n const response = await fetch('/api/lifecycle/assessments', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ tenantId: 'demo' }),\n });\n if (!response.ok) throw new Error('Failed assessment');\n const data = await response.json();\n setCard({\n stage: data.assessment.stage,\n name: data.assessment.stageName ?? `Stage ${data.assessment.stage}`,\n confidence: data.assessment.confidence,\n recommendation: data.recommendation,\n libraries: data.libraries,\n });\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Unknown error');\n } finally {\n setLoading(false);\n }\n }\n\n // Render using your app's design system components in real code.\n return null;\n}\n";
|
|
9
|
-
//#endregion
|
|
10
|
-
export { lifecycleDashboardNextPageSnippet };
|
|
7
|
+
export declare const lifecycleDashboardNextPageSnippet = "'use client';\n\nimport { useEffect, useState } from 'react';\n\ntype StageCard = {\n stage: number;\n name: string;\n confidence: number;\n recommendation?: {\n actions: { id: string; title: string; description: string }[];\n };\n libraries?: { id: string; description: string }[];\n};\n\nexport default function LifecycleDashboardPage() {\n const [card, setCard] = useState<StageCard | null>(null);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string>();\n\n useEffect(() => {\n void runAssessment();\n }, []);\n\n async function runAssessment() {\n try {\n setLoading(true);\n setError(undefined);\n const response = await fetch('/api/lifecycle/assessments', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ tenantId: 'demo' }),\n });\n if (!response.ok) throw new Error('Failed assessment');\n const data = await response.json();\n setCard({\n stage: data.assessment.stage,\n name: data.assessment.stageName ?? `Stage ${data.assessment.stage}`,\n confidence: data.assessment.confidence,\n recommendation: data.recommendation,\n libraries: data.libraries,\n });\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Unknown error');\n } finally {\n setLoading(false);\n }\n }\n\n // Render using your app's design system components in real code.\n return null;\n}\n";
|
|
11
8
|
//# sourceMappingURL=page.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.d.ts","
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../src/snippets/page.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC,y+CAmD7C,CAAC"}
|
package/dist/snippets/page.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* We keep this as a string so `packages/examples/*` stays design-system-first and
|
|
6
|
-
* avoids raw HTML in runnable application code.
|
|
7
|
-
*/
|
|
8
|
-
const lifecycleDashboardNextPageSnippet = `'use client';
|
|
1
|
+
// @bun
|
|
2
|
+
// src/snippets/page.ts
|
|
3
|
+
var lifecycleDashboardNextPageSnippet = `'use client';
|
|
9
4
|
|
|
10
5
|
import { useEffect, useState } from 'react';
|
|
11
6
|
|
|
@@ -57,7 +52,6 @@ export default function LifecycleDashboardPage() {
|
|
|
57
52
|
return null;
|
|
58
53
|
}
|
|
59
54
|
`;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
//# sourceMappingURL=page.js.map
|
|
55
|
+
export {
|
|
56
|
+
lifecycleDashboardNextPageSnippet
|
|
57
|
+
};
|
package/package.json
CHANGED
|
@@ -1,48 +1,85 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractspec/example.lifecycle-dashboard",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.58.0",
|
|
4
4
|
"description": "Lifecycle dashboard example (snippet): how to call lifecycle-managed APIs and render a status card.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
8
|
-
".": "./
|
|
9
|
-
"./docs": "./
|
|
10
|
-
"./docs/
|
|
11
|
-
"./
|
|
12
|
-
"./
|
|
13
|
-
"
|
|
8
|
+
".": "./src/index.ts",
|
|
9
|
+
"./docs": "./src/docs/index.ts",
|
|
10
|
+
"./docs/index": "./src/docs/index.ts",
|
|
11
|
+
"./docs/lifecycle-dashboard.docblock": "./src/docs/lifecycle-dashboard.docblock.ts",
|
|
12
|
+
"./example": "./src/example.ts",
|
|
13
|
+
"./snippets/page": "./src/snippets/page.ts"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
16
|
"publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
|
|
17
17
|
"publish:pkg:canary": "bun publish:pkg --tag canary",
|
|
18
|
-
"build": "bun build:
|
|
19
|
-
"build:bundle": "
|
|
20
|
-
"build:types": "
|
|
21
|
-
"dev": "bun
|
|
18
|
+
"build": "bun run prebuild && bun run build:bundle && bun run build:types",
|
|
19
|
+
"build:bundle": "contractspec-bun-build transpile",
|
|
20
|
+
"build:types": "contractspec-bun-build types",
|
|
21
|
+
"dev": "contractspec-bun-build dev",
|
|
22
22
|
"clean": "rimraf dist .turbo",
|
|
23
23
|
"lint": "bun lint:fix",
|
|
24
24
|
"lint:fix": "eslint src --fix",
|
|
25
25
|
"lint:check": "eslint src",
|
|
26
|
-
"test": "bun test"
|
|
26
|
+
"test": "bun test",
|
|
27
|
+
"prebuild": "contractspec-bun-build prebuild",
|
|
28
|
+
"typecheck": "tsc --noEmit"
|
|
27
29
|
},
|
|
28
30
|
"dependencies": {
|
|
29
|
-
"@contractspec/lib.contracts": "1.
|
|
31
|
+
"@contractspec/lib.contracts": "1.58.0"
|
|
30
32
|
},
|
|
31
33
|
"devDependencies": {
|
|
32
|
-
"@contractspec/tool.
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"typescript": "^5.9.3"
|
|
34
|
+
"@contractspec/tool.typescript": "1.58.0",
|
|
35
|
+
"typescript": "^5.9.3",
|
|
36
|
+
"@contractspec/tool.bun": "1.57.0"
|
|
36
37
|
},
|
|
37
38
|
"publishConfig": {
|
|
38
39
|
"access": "public",
|
|
39
40
|
"exports": {
|
|
40
|
-
".":
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
".": {
|
|
42
|
+
"types": "./dist/index.d.ts",
|
|
43
|
+
"bun": "./dist/index.js",
|
|
44
|
+
"node": "./dist/node/index.mjs",
|
|
45
|
+
"browser": "./dist/browser/index.js",
|
|
46
|
+
"default": "./dist/index.js"
|
|
47
|
+
},
|
|
48
|
+
"./docs": {
|
|
49
|
+
"types": "./dist/docs/index.d.ts",
|
|
50
|
+
"bun": "./dist/docs/index.js",
|
|
51
|
+
"node": "./dist/node/docs/index.mjs",
|
|
52
|
+
"browser": "./dist/browser/docs/index.js",
|
|
53
|
+
"default": "./dist/docs/index.js"
|
|
54
|
+
},
|
|
55
|
+
"./docs/index": {
|
|
56
|
+
"types": "./dist/docs/index.d.ts",
|
|
57
|
+
"bun": "./dist/docs/index.js",
|
|
58
|
+
"node": "./dist/node/docs/index.mjs",
|
|
59
|
+
"browser": "./dist/browser/docs/index.js",
|
|
60
|
+
"default": "./dist/docs/index.js"
|
|
61
|
+
},
|
|
62
|
+
"./docs/lifecycle-dashboard.docblock": {
|
|
63
|
+
"types": "./dist/docs/lifecycle-dashboard.docblock.d.ts",
|
|
64
|
+
"bun": "./dist/docs/lifecycle-dashboard.docblock.js",
|
|
65
|
+
"node": "./dist/node/docs/lifecycle-dashboard.docblock.mjs",
|
|
66
|
+
"browser": "./dist/browser/docs/lifecycle-dashboard.docblock.js",
|
|
67
|
+
"default": "./dist/docs/lifecycle-dashboard.docblock.js"
|
|
68
|
+
},
|
|
69
|
+
"./example": {
|
|
70
|
+
"types": "./dist/example.d.ts",
|
|
71
|
+
"bun": "./dist/example.js",
|
|
72
|
+
"node": "./dist/node/example.mjs",
|
|
73
|
+
"browser": "./dist/browser/example.js",
|
|
74
|
+
"default": "./dist/example.js"
|
|
75
|
+
},
|
|
76
|
+
"./snippets/page": {
|
|
77
|
+
"types": "./dist/snippets/page.d.ts",
|
|
78
|
+
"bun": "./dist/snippets/page.js",
|
|
79
|
+
"node": "./dist/node/snippets/page.mjs",
|
|
80
|
+
"browser": "./dist/browser/snippets/page.js",
|
|
81
|
+
"default": "./dist/snippets/page.js"
|
|
82
|
+
}
|
|
46
83
|
},
|
|
47
84
|
"registry": "https://registry.npmjs.org/"
|
|
48
85
|
},
|
package/tsdown.config.js
CHANGED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
$ tsdown
|
|
2
|
-
[34mℹ[39m tsdown [2mv0.19.0[22m powered by rolldown [2mv1.0.0-beta.59[22m
|
|
3
|
-
[34mℹ[39m config file: [4m/home/runner/work/contractspec/contractspec/packages/examples/lifecycle-dashboard/tsdown.config.js[24m
|
|
4
|
-
[34mℹ[39m entry: [34msrc/example.ts, src/index.ts, src/docs/index.ts, src/docs/lifecycle-dashboard.docblock.ts, src/snippets/page.ts[39m
|
|
5
|
-
[34mℹ[39m target: [34mesnext[39m
|
|
6
|
-
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
7
|
-
[34mℹ[39m Build start
|
|
8
|
-
[34mℹ[39m Cleaning 17 files
|
|
9
|
-
[34mℹ[39m [2mdist/[22m[1msnippets/page.js[22m [2m1.82 kB[22m [2m│ gzip: 0.87 kB[22m
|
|
10
|
-
[34mℹ[39m [2mdist/[22m[1mexample.js[22m [2m0.99 kB[22m [2m│ gzip: 0.53 kB[22m
|
|
11
|
-
[34mℹ[39m [2mdist/[22m[1mdocs/lifecycle-dashboard.docblock.js[22m [2m0.98 kB[22m [2m│ gzip: 0.56 kB[22m
|
|
12
|
-
[34mℹ[39m [2mdist/[22m[1mindex.js[22m [2m0.22 kB[22m [2m│ gzip: 0.14 kB[22m
|
|
13
|
-
[34mℹ[39m [2mdist/[22m[1mdocs/index.js[22m [2m0.04 kB[22m [2m│ gzip: 0.06 kB[22m
|
|
14
|
-
[34mℹ[39m [2mdist/[22msnippets/page.js.map [2m1.91 kB[22m [2m│ gzip: 0.91 kB[22m
|
|
15
|
-
[34mℹ[39m [2mdist/[22mexample.js.map [2m1.42 kB[22m [2m│ gzip: 0.72 kB[22m
|
|
16
|
-
[34mℹ[39m [2mdist/[22mdocs/lifecycle-dashboard.docblock.js.map [2m1.32 kB[22m [2m│ gzip: 0.72 kB[22m
|
|
17
|
-
[34mℹ[39m [2mdist/[22msnippets/page.d.ts.map [2m0.14 kB[22m [2m│ gzip: 0.13 kB[22m
|
|
18
|
-
[34mℹ[39m [2mdist/[22mexample.d.ts.map [2m0.14 kB[22m [2m│ gzip: 0.13 kB[22m
|
|
19
|
-
[34mℹ[39m [2mdist/[22m[32m[1msnippets/page.d.ts[22m[39m [2m1.89 kB[22m [2m│ gzip: 0.88 kB[22m
|
|
20
|
-
[34mℹ[39m [2mdist/[22m[32m[1mexample.d.ts[22m[39m [2m0.25 kB[22m [2m│ gzip: 0.17 kB[22m
|
|
21
|
-
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.ts[22m[39m [2m0.16 kB[22m [2m│ gzip: 0.11 kB[22m
|
|
22
|
-
[34mℹ[39m [2mdist/[22m[32m[1mdocs/index.d.ts[22m[39m [2m0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
23
|
-
[34mℹ[39m [2mdist/[22m[32m[1mdocs/lifecycle-dashboard.docblock.d.ts[22m[39m [2m0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
24
|
-
[34mℹ[39m 15 files, total: 11.31 kB
|
|
25
|
-
[32m✔[39m Build complete in [32m21337ms[39m
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle-dashboard.docblock.js","names":[],"sources":["../../src/docs/lifecycle-dashboard.docblock.ts"],"sourcesContent":["import type { DocBlock } from '@contractspec/lib.contracts/docs';\nimport { registerDocBlocks } from '@contractspec/lib.contracts/docs';\n\nconst blocks: DocBlock[] = [\n {\n id: 'docs.examples.lifecycle-dashboard',\n title: 'Lifecycle Dashboard (example snippet)',\n summary:\n 'Minimal dashboard page pattern that calls lifecycle-managed API routes and renders a status card.',\n kind: 'reference',\n visibility: 'public',\n route: '/docs/examples/lifecycle-dashboard',\n tags: ['lifecycle', 'dashboard', 'example'],\n 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.`,\n },\n];\n\nregisterDocBlocks(blocks);\n"],"mappings":";;;AAiBA,kBAd2B,CACzB;CACE,IAAI;CACJ,OAAO;CACP,SACE;CACF,MAAM;CACN,YAAY;CACZ,OAAO;CACP,MAAM;EAAC;EAAa;EAAa;EAAU;CAC3C,MAAM;CACP,CACF,CAEwB"}
|
package/dist/example.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example.js","names":[],"sources":["../src/example.ts"],"sourcesContent":["import { defineExample } from '@contractspec/lib.contracts';\n\nconst example = defineExample({\n meta: {\n key: 'lifecycle-dashboard',\n version: '1.0.0',\n title: 'Lifecycle Dashboard (snippet)',\n description:\n 'A minimal dashboard page pattern: call lifecycle-managed endpoints and render a mobile-friendly status card.',\n kind: 'blueprint',\n visibility: 'public',\n stability: 'experimental',\n owners: ['@platform.core'],\n tags: ['lifecycle', 'dashboard', 'nextjs', 'snippet'],\n },\n docs: {\n rootDocId: 'docs.examples.lifecycle-dashboard',\n },\n entrypoints: {\n packageName: '@contractspec/example.lifecycle-dashboard',\n docs: './docs',\n },\n surfaces: {\n templates: true,\n sandbox: { enabled: true, modes: ['markdown', 'specs'] },\n studio: { enabled: true, installable: true },\n mcp: { enabled: true },\n },\n});\n\nexport default example;\n"],"mappings":";;;AAEA,MAAM,UAAU,cAAc;CAC5B,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAa;GAAa;GAAU;GAAU;EACtD;CACD,MAAM,EACJ,WAAW,qCACZ;CACD,aAAa;EACX,aAAa;EACb,MAAM;EACP;CACD,UAAU;EACR,WAAW;EACX,SAAS;GAAE,SAAS;GAAM,OAAO,CAAC,YAAY,QAAQ;GAAE;EACxD,QAAQ;GAAE,SAAS;GAAM,aAAa;GAAM;EAC5C,KAAK,EAAE,SAAS,MAAM;EACvB;CACF,CAAC;AAEF,sBAAe"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"page.js","names":[],"sources":["../../src/snippets/page.ts"],"sourcesContent":["/**\n * Deterministic snippet for a Next.js App Router page.\n *\n * We keep this as a string so `packages/examples/*` stays design-system-first and\n * avoids raw HTML in runnable application code.\n */\nexport const lifecycleDashboardNextPageSnippet = `'use client';\n\nimport { useEffect, useState } from 'react';\n\ntype StageCard = {\n stage: number;\n name: string;\n confidence: number;\n recommendation?: {\n actions: { id: string; title: string; description: string }[];\n };\n libraries?: { id: string; description: string }[];\n};\n\nexport default function LifecycleDashboardPage() {\n const [card, setCard] = useState<StageCard | null>(null);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string>();\n\n useEffect(() => {\n void runAssessment();\n }, []);\n\n async function runAssessment() {\n try {\n setLoading(true);\n setError(undefined);\n const response = await fetch('/api/lifecycle/assessments', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ tenantId: 'demo' }),\n });\n if (!response.ok) throw new Error('Failed assessment');\n const data = await response.json();\n setCard({\n stage: data.assessment.stage,\n name: data.assessment.stageName ?? \\`Stage \\${data.assessment.stage}\\`,\n confidence: data.assessment.confidence,\n recommendation: data.recommendation,\n libraries: data.libraries,\n });\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Unknown error');\n } finally {\n setLoading(false);\n }\n }\n\n // Render using your app's design system components in real code.\n return null;\n}\n`;\n"],"mappings":";;;;;;;AAMA,MAAa,oCAAoC"}
|