@contractspec/example.lifecycle-dashboard 1.44.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$colon$bundle.log +25 -0
- package/.turbo/turbo-build.log +26 -0
- package/CHANGELOG.md +161 -0
- package/LICENSE +21 -0
- package/README.md +41 -0
- package/dist/docs/index.d.ts +1 -0
- package/dist/docs/index.js +1 -0
- package/dist/docs/lifecycle-dashboard.docblock.d.ts +1 -0
- package/dist/docs/lifecycle-dashboard.docblock.js +20 -0
- package/dist/docs/lifecycle-dashboard.docblock.js.map +1 -0
- package/dist/example.d.ts +33 -0
- package/dist/example.d.ts.map +1 -0
- package/dist/example.js +36 -0
- package/dist/example.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +5 -0
- package/dist/snippets/page.d.ts +11 -0
- package/dist/snippets/page.d.ts.map +1 -0
- package/dist/snippets/page.js +63 -0
- package/dist/snippets/page.js.map +1 -0
- package/example.ts +1 -0
- package/package.json +59 -0
- package/src/docs/index.ts +1 -0
- package/src/docs/lifecycle-dashboard.docblock.ts +18 -0
- package/src/example.ts +24 -0
- package/src/index.ts +3 -0
- package/src/snippets/page.ts +58 -0
- package/tsconfig.json +11 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/tsdown.config.js +6 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
$ tsdown
|
|
2
|
+
[34mℹ[39m tsdown [2mv0.18.3[22m powered by rolldown [2mv1.0.0-beta.57[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[1mdocs/lifecycle-dashboard.docblock.js[22m [2m0.98 kB[22m [2m│ gzip: 0.56 kB[22m
|
|
11
|
+
[34mℹ[39m [2mdist/[22m[1mexample.js[22m [2m0.81 kB[22m [2m│ gzip: 0.45 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/[22mdocs/lifecycle-dashboard.docblock.js.map [2m1.32 kB[22m [2m│ gzip: 0.72 kB[22m
|
|
16
|
+
[34mℹ[39m [2mdist/[22mexample.js.map [2m1.16 kB[22m [2m│ gzip: 0.61 kB[22m
|
|
17
|
+
[34mℹ[39m [2mdist/[22mexample.d.ts.map [2m0.14 kB[22m [2m│ gzip: 0.13 kB[22m
|
|
18
|
+
[34mℹ[39m [2mdist/[22msnippets/page.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 [2m1.03 kB[22m [2m│ gzip: 0.44 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.65 kB
|
|
25
|
+
[32m✔[39m Build complete in [32m12895ms[39m
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
$ bun build:types && bun build:bundle
|
|
2
|
+
$ tsc --noEmit
|
|
3
|
+
$ tsdown
|
|
4
|
+
[34mℹ[39m tsdown [2mv0.18.3[22m powered by rolldown [2mv1.0.0-beta.57[22m
|
|
5
|
+
[34mℹ[39m config file: [4m/home/runner/work/contractspec/contractspec/packages/examples/lifecycle-dashboard/tsdown.config.js[24m
|
|
6
|
+
[34mℹ[39m entry: [34msrc/example.ts, src/index.ts, src/docs/index.ts, src/docs/lifecycle-dashboard.docblock.ts, src/snippets/page.ts[39m
|
|
7
|
+
[34mℹ[39m target: [34mesnext[39m
|
|
8
|
+
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
9
|
+
[34mℹ[39m Build start
|
|
10
|
+
[34mℹ[39m [2mdist/[22m[1msnippets/page.js[22m [2m1.82 kB[22m [2m│ gzip: 0.87 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[1mexample.js[22m [2m0.81 kB[22m [2m│ gzip: 0.45 kB[22m
|
|
13
|
+
[34mℹ[39m [2mdist/[22m[1mindex.js[22m [2m0.22 kB[22m [2m│ gzip: 0.14 kB[22m
|
|
14
|
+
[34mℹ[39m [2mdist/[22m[1mdocs/index.js[22m [2m0.04 kB[22m [2m│ gzip: 0.06 kB[22m
|
|
15
|
+
[34mℹ[39m [2mdist/[22msnippets/page.js.map [2m1.91 kB[22m [2m│ gzip: 0.91 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/[22mexample.js.map [2m1.16 kB[22m [2m│ gzip: 0.61 kB[22m
|
|
18
|
+
[34mℹ[39m [2mdist/[22mexample.d.ts.map [2m0.14 kB[22m [2m│ gzip: 0.13 kB[22m
|
|
19
|
+
[34mℹ[39m [2mdist/[22msnippets/page.d.ts.map [2m0.14 kB[22m [2m│ gzip: 0.13 kB[22m
|
|
20
|
+
[34mℹ[39m [2mdist/[22m[32m[1msnippets/page.d.ts[22m[39m [2m1.89 kB[22m [2m│ gzip: 0.88 kB[22m
|
|
21
|
+
[34mℹ[39m [2mdist/[22m[32m[1mexample.d.ts[22m[39m [2m1.03 kB[22m [2m│ gzip: 0.44 kB[22m
|
|
22
|
+
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.ts[22m[39m [2m0.16 kB[22m [2m│ gzip: 0.11 kB[22m
|
|
23
|
+
[34mℹ[39m [2mdist/[22m[32m[1mdocs/index.d.ts[22m[39m [2m0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
24
|
+
[34mℹ[39m [2mdist/[22m[32m[1mdocs/lifecycle-dashboard.docblock.d.ts[22m[39m [2m0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
25
|
+
[34mℹ[39m 15 files, total: 11.65 kB
|
|
26
|
+
[32m✔[39m Build complete in [32m14662ms[39m
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# @contractspec/example.lifecycle-dashboard
|
|
2
|
+
|
|
3
|
+
## 1.44.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5f3a868: chore: isolate branding to contractspec.io
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [5f3a868]
|
|
12
|
+
- @contractspec/lib.contracts@1.44.0
|
|
13
|
+
- @contractspec/lib.schema@1.44.0
|
|
14
|
+
|
|
15
|
+
## 1.43.4
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 9216062: fix: cross-platform compatibility
|
|
20
|
+
- Updated dependencies [9216062]
|
|
21
|
+
- @contractspec/lib.contracts@1.43.4
|
|
22
|
+
- @contractspec/lib.schema@1.43.3
|
|
23
|
+
|
|
24
|
+
## 1.43.3
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- 24d9759: improve documentation
|
|
29
|
+
- Updated dependencies [24d9759]
|
|
30
|
+
- @contractspec/lib.contracts@1.43.3
|
|
31
|
+
- @contractspec/lib.schema@1.43.2
|
|
32
|
+
|
|
33
|
+
## 1.43.2
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- e147271: fix: improve stability
|
|
38
|
+
- Updated dependencies [e147271]
|
|
39
|
+
- @contractspec/lib.contracts@1.43.2
|
|
40
|
+
- @contractspec/lib.schema@1.43.1
|
|
41
|
+
|
|
42
|
+
## 1.43.1
|
|
43
|
+
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- Updated dependencies [f28fdad]
|
|
47
|
+
- @contractspec/lib.contracts@1.43.1
|
|
48
|
+
|
|
49
|
+
## 1.43.0
|
|
50
|
+
|
|
51
|
+
### Minor Changes
|
|
52
|
+
|
|
53
|
+
- 042d072: feat: schema declaration using json schema, including zod
|
|
54
|
+
|
|
55
|
+
### Patch Changes
|
|
56
|
+
|
|
57
|
+
- Updated dependencies [042d072]
|
|
58
|
+
- @contractspec/lib.contracts@1.43.0
|
|
59
|
+
- @contractspec/lib.schema@1.43.0
|
|
60
|
+
|
|
61
|
+
## 1.42.10
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- 1e6a0f1: fix: mcp server
|
|
66
|
+
- Updated dependencies [1e6a0f1]
|
|
67
|
+
- @contractspec/lib.contracts@1.42.10
|
|
68
|
+
- @contractspec/lib.schema@1.42.10
|
|
69
|
+
|
|
70
|
+
## 1.42.9
|
|
71
|
+
|
|
72
|
+
### Patch Changes
|
|
73
|
+
|
|
74
|
+
- 9281db7: fix ModelRegistry
|
|
75
|
+
- Updated dependencies [9281db7]
|
|
76
|
+
- @contractspec/lib.contracts@1.42.9
|
|
77
|
+
- @contractspec/lib.schema@1.42.9
|
|
78
|
+
|
|
79
|
+
## 1.42.8
|
|
80
|
+
|
|
81
|
+
### Patch Changes
|
|
82
|
+
|
|
83
|
+
- e07b5ac: fix
|
|
84
|
+
- Updated dependencies [e07b5ac]
|
|
85
|
+
- @contractspec/lib.contracts@1.42.8
|
|
86
|
+
- @contractspec/lib.schema@1.42.8
|
|
87
|
+
|
|
88
|
+
## 1.42.7
|
|
89
|
+
|
|
90
|
+
### Patch Changes
|
|
91
|
+
|
|
92
|
+
- e9b575d: fix release
|
|
93
|
+
- Updated dependencies [e9b575d]
|
|
94
|
+
- @contractspec/lib.contracts@1.42.7
|
|
95
|
+
- @contractspec/lib.schema@1.42.7
|
|
96
|
+
|
|
97
|
+
## 1.42.6
|
|
98
|
+
|
|
99
|
+
### Patch Changes
|
|
100
|
+
|
|
101
|
+
- 1500242: fix tooling
|
|
102
|
+
- Updated dependencies [1500242]
|
|
103
|
+
- @contractspec/lib.contracts@1.42.6
|
|
104
|
+
- @contractspec/lib.schema@1.42.6
|
|
105
|
+
|
|
106
|
+
## 1.42.5
|
|
107
|
+
|
|
108
|
+
### Patch Changes
|
|
109
|
+
|
|
110
|
+
- 1299719: fix vscode
|
|
111
|
+
- Updated dependencies [1299719]
|
|
112
|
+
- @contractspec/lib.contracts@1.42.5
|
|
113
|
+
- @contractspec/lib.schema@1.42.5
|
|
114
|
+
|
|
115
|
+
## 1.42.4
|
|
116
|
+
|
|
117
|
+
### Patch Changes
|
|
118
|
+
|
|
119
|
+
- ac28b99: fix: generate from openapi
|
|
120
|
+
- Updated dependencies [ac28b99]
|
|
121
|
+
- @contractspec/lib.contracts@1.42.4
|
|
122
|
+
- @contractspec/lib.schema@1.42.4
|
|
123
|
+
|
|
124
|
+
## 1.42.3
|
|
125
|
+
|
|
126
|
+
### Patch Changes
|
|
127
|
+
|
|
128
|
+
- 3f5d015: fix(tooling): cicd
|
|
129
|
+
- Updated dependencies [3f5d015]
|
|
130
|
+
- @contractspec/lib.contracts@1.42.3
|
|
131
|
+
- @contractspec/lib.schema@1.42.3
|
|
132
|
+
|
|
133
|
+
## 1.42.2
|
|
134
|
+
|
|
135
|
+
### Patch Changes
|
|
136
|
+
|
|
137
|
+
- 1f9ac4c: fix
|
|
138
|
+
- Updated dependencies [1f9ac4c]
|
|
139
|
+
- @contractspec/lib.contracts@1.42.2
|
|
140
|
+
- @contractspec/lib.schema@1.42.2
|
|
141
|
+
|
|
142
|
+
## 1.42.1
|
|
143
|
+
|
|
144
|
+
### Patch Changes
|
|
145
|
+
|
|
146
|
+
- f043995: Fix release
|
|
147
|
+
- Updated dependencies [f043995]
|
|
148
|
+
- @contractspec/lib.contracts@1.42.1
|
|
149
|
+
- @contractspec/lib.schema@1.42.1
|
|
150
|
+
|
|
151
|
+
## 1.42.0
|
|
152
|
+
|
|
153
|
+
### Minor Changes
|
|
154
|
+
|
|
155
|
+
- 8eefd9c: initial release
|
|
156
|
+
|
|
157
|
+
### Patch Changes
|
|
158
|
+
|
|
159
|
+
- Updated dependencies [8eefd9c]
|
|
160
|
+
- @contractspec/lib.contracts@1.42.0
|
|
161
|
+
- @contractspec/lib.schema@1.42.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Chaman Ventures, SASU
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
## Lifecycle Dashboard Example (Next.js)
|
|
2
|
+
|
|
3
|
+
Website: https://contractspec.io/
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
This example shows a minimal App Router page that calls the lifecycle managed bundle via `/api/lifecycle/*` routes and renders a mobile-friendly status card.
|
|
7
|
+
|
|
8
|
+
### Structure
|
|
9
|
+
|
|
10
|
+
- `app/page.tsx` – client component with tabs for Stage, Actions, Libraries.
|
|
11
|
+
- Expected API routes:
|
|
12
|
+
- `POST /api/lifecycle/assessments` → proxies to `LifecycleAssessmentService.runAssessment`
|
|
13
|
+
- `GET /api/lifecycle/playbooks/:stage` → proxies to `service.getStagePlaybook`
|
|
14
|
+
|
|
15
|
+
### Run
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
cd packages/examples/lifecycle-dashboard
|
|
19
|
+
bunx next dev
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Make sure you register the API routes in your actual Next.js app; the page assumes they exist.
|
|
23
|
+
|
|
24
|
+
This example is now packaged as `@contractspec/example.lifecycle-dashboard` and ships the page as a deterministic snippet:
|
|
25
|
+
- `@contractspec/example.lifecycle-dashboard/snippets/page`
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./lifecycle-dashboard.docblock.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
|
|
2
|
+
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region src/example.d.ts
|
|
2
|
+
declare const example: {
|
|
3
|
+
readonly id: "lifecycle-dashboard";
|
|
4
|
+
readonly title: "Lifecycle Dashboard (snippet)";
|
|
5
|
+
readonly summary: "A minimal dashboard page pattern: call lifecycle-managed endpoints and render a mobile-friendly status card.";
|
|
6
|
+
readonly tags: readonly ["lifecycle", "dashboard", "nextjs", "snippet"];
|
|
7
|
+
readonly kind: "blueprint";
|
|
8
|
+
readonly visibility: "public";
|
|
9
|
+
readonly docs: {
|
|
10
|
+
readonly rootDocId: "docs.examples.lifecycle-dashboard";
|
|
11
|
+
};
|
|
12
|
+
readonly entrypoints: {
|
|
13
|
+
readonly packageName: "@contractspec/example.lifecycle-dashboard";
|
|
14
|
+
readonly docs: "./docs";
|
|
15
|
+
};
|
|
16
|
+
readonly surfaces: {
|
|
17
|
+
readonly templates: true;
|
|
18
|
+
readonly sandbox: {
|
|
19
|
+
readonly enabled: true;
|
|
20
|
+
readonly modes: readonly ["markdown", "specs"];
|
|
21
|
+
};
|
|
22
|
+
readonly studio: {
|
|
23
|
+
readonly enabled: true;
|
|
24
|
+
readonly installable: true;
|
|
25
|
+
};
|
|
26
|
+
readonly mcp: {
|
|
27
|
+
readonly enabled: true;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { example as default };
|
|
33
|
+
//# sourceMappingURL=example.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"sourcesContent":[],"mappings":";cAAM;EAAA,SAAA,EAqBI,EAAA,qBAAA"}
|
package/dist/example.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//#region src/example.ts
|
|
2
|
+
const example = {
|
|
3
|
+
id: "lifecycle-dashboard",
|
|
4
|
+
title: "Lifecycle Dashboard (snippet)",
|
|
5
|
+
summary: "A minimal dashboard page pattern: call lifecycle-managed endpoints and render a mobile-friendly status card.",
|
|
6
|
+
tags: [
|
|
7
|
+
"lifecycle",
|
|
8
|
+
"dashboard",
|
|
9
|
+
"nextjs",
|
|
10
|
+
"snippet"
|
|
11
|
+
],
|
|
12
|
+
kind: "blueprint",
|
|
13
|
+
visibility: "public",
|
|
14
|
+
docs: { rootDocId: "docs.examples.lifecycle-dashboard" },
|
|
15
|
+
entrypoints: {
|
|
16
|
+
packageName: "@contractspec/example.lifecycle-dashboard",
|
|
17
|
+
docs: "./docs"
|
|
18
|
+
},
|
|
19
|
+
surfaces: {
|
|
20
|
+
templates: true,
|
|
21
|
+
sandbox: {
|
|
22
|
+
enabled: true,
|
|
23
|
+
modes: ["markdown", "specs"]
|
|
24
|
+
},
|
|
25
|
+
studio: {
|
|
26
|
+
enabled: true,
|
|
27
|
+
installable: true
|
|
28
|
+
},
|
|
29
|
+
mcp: { enabled: true }
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var example_default = example;
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { example_default as default };
|
|
36
|
+
//# sourceMappingURL=example.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example.js","names":[],"sources":["../src/example.ts"],"sourcesContent":["const example = {\n id: 'lifecycle-dashboard',\n title: 'Lifecycle Dashboard (snippet)',\n summary:\n 'A minimal dashboard page pattern: call lifecycle-managed endpoints and render a mobile-friendly status card.',\n tags: ['lifecycle', 'dashboard', 'nextjs', 'snippet'],\n kind: 'blueprint',\n visibility: 'public',\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} as const;\n\nexport default example;\n"],"mappings":";AAAA,MAAM,UAAU;CACd,IAAI;CACJ,OAAO;CACP,SACE;CACF,MAAM;EAAC;EAAa;EAAa;EAAU;EAAU;CACrD,MAAM;CACN,YAAY;CACZ,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;AAED,sBAAe"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/snippets/page.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Deterministic snippet for a Next.js App Router page.
|
|
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
|
+
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 };
|
|
11
|
+
//# sourceMappingURL=page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page.d.ts","names":[],"sources":["../../src/snippets/page.ts"],"sourcesContent":[],"mappings":";;AAMA;;;;;cAAa,iCAAA"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
//#region src/snippets/page.ts
|
|
2
|
+
/**
|
|
3
|
+
* Deterministic snippet for a Next.js App Router page.
|
|
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';
|
|
9
|
+
|
|
10
|
+
import { useEffect, useState } from 'react';
|
|
11
|
+
|
|
12
|
+
type StageCard = {
|
|
13
|
+
stage: number;
|
|
14
|
+
name: string;
|
|
15
|
+
confidence: number;
|
|
16
|
+
recommendation?: {
|
|
17
|
+
actions: { id: string; title: string; description: string }[];
|
|
18
|
+
};
|
|
19
|
+
libraries?: { id: string; description: string }[];
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default function LifecycleDashboardPage() {
|
|
23
|
+
const [card, setCard] = useState<StageCard | null>(null);
|
|
24
|
+
const [loading, setLoading] = useState(false);
|
|
25
|
+
const [error, setError] = useState<string>();
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
void runAssessment();
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
31
|
+
async function runAssessment() {
|
|
32
|
+
try {
|
|
33
|
+
setLoading(true);
|
|
34
|
+
setError(undefined);
|
|
35
|
+
const response = await fetch('/api/lifecycle/assessments', {
|
|
36
|
+
method: 'POST',
|
|
37
|
+
headers: { 'Content-Type': 'application/json' },
|
|
38
|
+
body: JSON.stringify({ tenantId: 'demo' }),
|
|
39
|
+
});
|
|
40
|
+
if (!response.ok) throw new Error('Failed assessment');
|
|
41
|
+
const data = await response.json();
|
|
42
|
+
setCard({
|
|
43
|
+
stage: data.assessment.stage,
|
|
44
|
+
name: data.assessment.stageName ?? \`Stage \${data.assessment.stage}\`,
|
|
45
|
+
confidence: data.assessment.confidence,
|
|
46
|
+
recommendation: data.recommendation,
|
|
47
|
+
libraries: data.libraries,
|
|
48
|
+
});
|
|
49
|
+
} catch (err) {
|
|
50
|
+
setError(err instanceof Error ? err.message : 'Unknown error');
|
|
51
|
+
} finally {
|
|
52
|
+
setLoading(false);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Render using your app's design system components in real code.
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
export { lifecycleDashboardNextPageSnippet };
|
|
63
|
+
//# sourceMappingURL=page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
package/example.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './src/example';
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@contractspec/example.lifecycle-dashboard",
|
|
3
|
+
"version": "1.44.0",
|
|
4
|
+
"description": "Lifecycle dashboard example (snippet): how to call lifecycle-managed APIs and render a status card.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./dist/index.js",
|
|
10
|
+
"./docs": "./dist/docs/index.js",
|
|
11
|
+
"./docs/lifecycle-dashboard.docblock": "./dist/docs/lifecycle-dashboard.docblock.js",
|
|
12
|
+
"./example": "./dist/example.js",
|
|
13
|
+
"./snippets/page": "./dist/snippets/page.js",
|
|
14
|
+
"./*": "./*"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
|
|
18
|
+
"publish:pkg:canary": "bun publish:pkg --tag canary",
|
|
19
|
+
"build": "bun build:types && bun build:bundle",
|
|
20
|
+
"build:bundle": "tsdown",
|
|
21
|
+
"build:types": "tsc --noEmit",
|
|
22
|
+
"dev": "bun build:bundle --watch",
|
|
23
|
+
"clean": "rimraf dist .turbo",
|
|
24
|
+
"lint": "bun lint:fix",
|
|
25
|
+
"lint:fix": "eslint src --fix",
|
|
26
|
+
"lint:check": "eslint src",
|
|
27
|
+
"test": "bun test"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@contractspec/lib.schema": "1.44.0",
|
|
31
|
+
"@contractspec/lib.contracts": "1.44.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@contractspec/tool.tsdown": "1.44.0",
|
|
35
|
+
"@contractspec/tool.typescript": "1.44.0",
|
|
36
|
+
"tsdown": "^0.18.3",
|
|
37
|
+
"typescript": "^5.9.3"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public",
|
|
41
|
+
"exports": {
|
|
42
|
+
".": "./dist/index.js",
|
|
43
|
+
"./docs": "./dist/docs/index.js",
|
|
44
|
+
"./docs/lifecycle-dashboard.docblock": "./dist/docs/lifecycle-dashboard.docblock.js",
|
|
45
|
+
"./example": "./dist/example.js",
|
|
46
|
+
"./snippets/page": "./dist/snippets/page.js",
|
|
47
|
+
"./*": "./*"
|
|
48
|
+
},
|
|
49
|
+
"registry": "https://registry.npmjs.org/"
|
|
50
|
+
},
|
|
51
|
+
"module": "./dist/index.js",
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "https://github.com/lssm-tech/contractspec.git",
|
|
56
|
+
"directory": "packages/examples/lifecycle-dashboard"
|
|
57
|
+
},
|
|
58
|
+
"homepage": "https://contractspec.io"
|
|
59
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './lifecycle-dashboard.docblock';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DocBlock } from '@contractspec/lib.contracts/docs';
|
|
2
|
+
import { registerDocBlocks } from '@contractspec/lib.contracts/docs';
|
|
3
|
+
|
|
4
|
+
const blocks: DocBlock[] = [
|
|
5
|
+
{
|
|
6
|
+
id: 'docs.examples.lifecycle-dashboard',
|
|
7
|
+
title: 'Lifecycle Dashboard (example snippet)',
|
|
8
|
+
summary:
|
|
9
|
+
'Minimal dashboard page pattern that calls lifecycle-managed API routes and renders a status card.',
|
|
10
|
+
kind: 'reference',
|
|
11
|
+
visibility: 'public',
|
|
12
|
+
route: '/docs/examples/lifecycle-dashboard',
|
|
13
|
+
tags: ['lifecycle', 'dashboard', 'example'],
|
|
14
|
+
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.`,
|
|
15
|
+
},
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
registerDocBlocks(blocks);
|
package/src/example.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const example = {
|
|
2
|
+
id: 'lifecycle-dashboard',
|
|
3
|
+
title: 'Lifecycle Dashboard (snippet)',
|
|
4
|
+
summary:
|
|
5
|
+
'A minimal dashboard page pattern: call lifecycle-managed endpoints and render a mobile-friendly status card.',
|
|
6
|
+
tags: ['lifecycle', 'dashboard', 'nextjs', 'snippet'],
|
|
7
|
+
kind: 'blueprint',
|
|
8
|
+
visibility: 'public',
|
|
9
|
+
docs: {
|
|
10
|
+
rootDocId: 'docs.examples.lifecycle-dashboard',
|
|
11
|
+
},
|
|
12
|
+
entrypoints: {
|
|
13
|
+
packageName: '@contractspec/example.lifecycle-dashboard',
|
|
14
|
+
docs: './docs',
|
|
15
|
+
},
|
|
16
|
+
surfaces: {
|
|
17
|
+
templates: true,
|
|
18
|
+
sandbox: { enabled: true, modes: ['markdown', 'specs'] },
|
|
19
|
+
studio: { enabled: true, installable: true },
|
|
20
|
+
mcp: { enabled: true },
|
|
21
|
+
},
|
|
22
|
+
} as const;
|
|
23
|
+
|
|
24
|
+
export default example;
|
package/src/index.ts
ADDED