@contractspec/example.lifecycle-cli 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.
@@ -0,0 +1,25 @@
1
+ $ tsdown
2
+ ℹ tsdown v0.18.3 powered by rolldown v1.0.0-beta.57
3
+ ℹ config file: /home/runner/work/contractspec/contractspec/packages/examples/lifecycle-cli/tsdown.config.js
4
+ ℹ entry: src/demo.ts, src/example.ts, src/index.ts, src/docs/index.ts, src/docs/lifecycle-cli.docblock.ts
5
+ ℹ target: esnext
6
+ ℹ tsconfig: tsconfig.json
7
+ ℹ Build start
8
+ ℹ Cleaning 16 files
9
+ ℹ dist/demo.js 1.54 kB │ gzip: 0.77 kB
10
+ ℹ dist/docs/lifecycle-cli.docblock.js 1.44 kB │ gzip: 0.72 kB
11
+ ℹ dist/example.js 0.78 kB │ gzip: 0.43 kB
12
+ ℹ dist/index.js 0.18 kB │ gzip: 0.12 kB
13
+ ℹ dist/docs/index.js 0.04 kB │ gzip: 0.06 kB
14
+ ℹ dist/demo.js.map 2.79 kB │ gzip: 1.18 kB
15
+ ℹ dist/docs/lifecycle-cli.docblock.js.map 1.93 kB │ gzip: 0.90 kB
16
+ ℹ dist/example.js.map 1.14 kB │ gzip: 0.60 kB
17
+ ℹ dist/example.d.ts.map 0.14 kB │ gzip: 0.13 kB
18
+ ℹ dist/demo.d.ts.map 0.13 kB │ gzip: 0.13 kB
19
+ ℹ dist/example.d.ts 1.02 kB │ gzip: 0.43 kB
20
+ ℹ dist/demo.d.ts 0.16 kB │ gzip: 0.14 kB
21
+ ℹ dist/index.d.ts 0.13 kB │ gzip: 0.10 kB
22
+ ℹ dist/docs/index.d.ts 0.01 kB │ gzip: 0.03 kB
23
+ ℹ dist/docs/lifecycle-cli.docblock.d.ts 0.01 kB │ gzip: 0.03 kB
24
+ ℹ 15 files, total: 11.44 kB
25
+ ✔ Build complete in 14048ms
@@ -0,0 +1,26 @@
1
+ $ bun build:types && bun build:bundle
2
+ $ tsc --noEmit
3
+ $ tsdown
4
+ ℹ tsdown v0.18.3 powered by rolldown v1.0.0-beta.57
5
+ ℹ config file: /home/runner/work/contractspec/contractspec/packages/examples/lifecycle-cli/tsdown.config.js
6
+ ℹ entry: src/demo.ts, src/example.ts, src/index.ts, src/docs/index.ts, src/docs/lifecycle-cli.docblock.ts
7
+ ℹ target: esnext
8
+ ℹ tsconfig: tsconfig.json
9
+ ℹ Build start
10
+ ℹ dist/demo.js 1.54 kB │ gzip: 0.77 kB
11
+ ℹ dist/docs/lifecycle-cli.docblock.js 1.44 kB │ gzip: 0.72 kB
12
+ ℹ dist/example.js 0.78 kB │ gzip: 0.43 kB
13
+ ℹ dist/index.js 0.18 kB │ gzip: 0.12 kB
14
+ ℹ dist/docs/index.js 0.04 kB │ gzip: 0.06 kB
15
+ ℹ dist/demo.js.map 2.79 kB │ gzip: 1.18 kB
16
+ ℹ dist/docs/lifecycle-cli.docblock.js.map 1.93 kB │ gzip: 0.90 kB
17
+ ℹ dist/example.js.map 1.14 kB │ gzip: 0.60 kB
18
+ ℹ dist/example.d.ts.map 0.14 kB │ gzip: 0.13 kB
19
+ ℹ dist/demo.d.ts.map 0.13 kB │ gzip: 0.13 kB
20
+ ℹ dist/example.d.ts 1.02 kB │ gzip: 0.43 kB
21
+ ℹ dist/demo.d.ts 0.16 kB │ gzip: 0.14 kB
22
+ ℹ dist/index.d.ts 0.13 kB │ gzip: 0.10 kB
23
+ ℹ dist/docs/index.d.ts 0.01 kB │ gzip: 0.03 kB
24
+ ℹ dist/docs/lifecycle-cli.docblock.d.ts 0.01 kB │ gzip: 0.03 kB
25
+ ℹ 15 files, total: 11.44 kB
26
+ ✔ Build complete in 17290ms
package/CHANGELOG.md ADDED
@@ -0,0 +1,210 @@
1
+ # @contractspec/example.lifecycle-cli
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/bundle.lifecycle-managed@1.44.0
13
+ - @contractspec/lib.contracts@1.44.0
14
+ - @contractspec/lib.lifecycle@1.44.0
15
+ - @contractspec/lib.logger@1.44.0
16
+ - @contractspec/lib.schema@1.44.0
17
+
18
+ ## 1.43.4
19
+
20
+ ### Patch Changes
21
+
22
+ - 9216062: fix: cross-platform compatibility
23
+ - Updated dependencies [9216062]
24
+ - @contractspec/bundle.lifecycle-managed@1.43.4
25
+ - @contractspec/lib.contracts@1.43.4
26
+ - @contractspec/lib.lifecycle@1.43.3
27
+ - @contractspec/lib.logger@1.43.3
28
+ - @contractspec/lib.schema@1.43.3
29
+
30
+ ## 1.43.3
31
+
32
+ ### Patch Changes
33
+
34
+ - 24d9759: improve documentation
35
+ - Updated dependencies [24d9759]
36
+ - @contractspec/bundle.lifecycle-managed@1.43.3
37
+ - @contractspec/lib.contracts@1.43.3
38
+ - @contractspec/lib.lifecycle@1.43.2
39
+ - @contractspec/lib.logger@1.43.2
40
+ - @contractspec/lib.schema@1.43.2
41
+
42
+ ## 1.43.2
43
+
44
+ ### Patch Changes
45
+
46
+ - e147271: fix: improve stability
47
+ - Updated dependencies [e147271]
48
+ - @contractspec/bundle.lifecycle-managed@1.43.2
49
+ - @contractspec/lib.contracts@1.43.2
50
+ - @contractspec/lib.lifecycle@1.43.1
51
+ - @contractspec/lib.logger@1.43.1
52
+ - @contractspec/lib.schema@1.43.1
53
+
54
+ ## 1.43.1
55
+
56
+ ### Patch Changes
57
+
58
+ - Updated dependencies [f28fdad]
59
+ - @contractspec/lib.contracts@1.43.1
60
+ - @contractspec/bundle.lifecycle-managed@1.43.1
61
+
62
+ ## 1.43.0
63
+
64
+ ### Minor Changes
65
+
66
+ - 042d072: feat: schema declaration using json schema, including zod
67
+
68
+ ### Patch Changes
69
+
70
+ - Updated dependencies [042d072]
71
+ - @contractspec/bundle.lifecycle-managed@1.43.0
72
+ - @contractspec/lib.contracts@1.43.0
73
+ - @contractspec/lib.lifecycle@1.43.0
74
+ - @contractspec/lib.logger@1.43.0
75
+ - @contractspec/lib.schema@1.43.0
76
+
77
+ ## 1.42.10
78
+
79
+ ### Patch Changes
80
+
81
+ - 1e6a0f1: fix: mcp server
82
+ - Updated dependencies [1e6a0f1]
83
+ - @contractspec/bundle.lifecycle-managed@1.42.10
84
+ - @contractspec/lib.contracts@1.42.10
85
+ - @contractspec/lib.lifecycle@1.42.10
86
+ - @contractspec/lib.logger@1.42.10
87
+ - @contractspec/lib.schema@1.42.10
88
+
89
+ ## 1.42.9
90
+
91
+ ### Patch Changes
92
+
93
+ - 9281db7: fix ModelRegistry
94
+ - Updated dependencies [9281db7]
95
+ - @contractspec/bundle.lifecycle-managed@1.42.9
96
+ - @contractspec/lib.contracts@1.42.9
97
+ - @contractspec/lib.lifecycle@1.42.9
98
+ - @contractspec/lib.logger@1.42.9
99
+ - @contractspec/lib.schema@1.42.9
100
+
101
+ ## 1.42.8
102
+
103
+ ### Patch Changes
104
+
105
+ - e07b5ac: fix
106
+ - Updated dependencies [e07b5ac]
107
+ - @contractspec/bundle.lifecycle-managed@1.42.8
108
+ - @contractspec/lib.contracts@1.42.8
109
+ - @contractspec/lib.lifecycle@1.42.8
110
+ - @contractspec/lib.logger@1.42.8
111
+ - @contractspec/lib.schema@1.42.8
112
+
113
+ ## 1.42.7
114
+
115
+ ### Patch Changes
116
+
117
+ - e9b575d: fix release
118
+ - Updated dependencies [e9b575d]
119
+ - @contractspec/bundle.lifecycle-managed@1.42.7
120
+ - @contractspec/lib.contracts@1.42.7
121
+ - @contractspec/lib.lifecycle@1.42.7
122
+ - @contractspec/lib.logger@1.42.7
123
+ - @contractspec/lib.schema@1.42.7
124
+
125
+ ## 1.42.6
126
+
127
+ ### Patch Changes
128
+
129
+ - 1500242: fix tooling
130
+ - Updated dependencies [1500242]
131
+ - @contractspec/bundle.lifecycle-managed@1.42.6
132
+ - @contractspec/lib.contracts@1.42.6
133
+ - @contractspec/lib.lifecycle@1.42.6
134
+ - @contractspec/lib.logger@1.42.6
135
+ - @contractspec/lib.schema@1.42.6
136
+
137
+ ## 1.42.5
138
+
139
+ ### Patch Changes
140
+
141
+ - 1299719: fix vscode
142
+ - Updated dependencies [1299719]
143
+ - @contractspec/bundle.lifecycle-managed@1.42.5
144
+ - @contractspec/lib.contracts@1.42.5
145
+ - @contractspec/lib.lifecycle@1.42.5
146
+ - @contractspec/lib.logger@1.42.5
147
+ - @contractspec/lib.schema@1.42.5
148
+
149
+ ## 1.42.4
150
+
151
+ ### Patch Changes
152
+
153
+ - ac28b99: fix: generate from openapi
154
+ - Updated dependencies [ac28b99]
155
+ - @contractspec/bundle.lifecycle-managed@1.42.4
156
+ - @contractspec/lib.contracts@1.42.4
157
+ - @contractspec/lib.lifecycle@1.42.4
158
+ - @contractspec/lib.logger@1.42.4
159
+ - @contractspec/lib.schema@1.42.4
160
+
161
+ ## 1.42.3
162
+
163
+ ### Patch Changes
164
+
165
+ - 3f5d015: fix(tooling): cicd
166
+ - Updated dependencies [3f5d015]
167
+ - @contractspec/bundle.lifecycle-managed@1.42.3
168
+ - @contractspec/lib.contracts@1.42.3
169
+ - @contractspec/lib.lifecycle@1.42.3
170
+ - @contractspec/lib.logger@1.42.3
171
+ - @contractspec/lib.schema@1.42.3
172
+
173
+ ## 1.42.2
174
+
175
+ ### Patch Changes
176
+
177
+ - 1f9ac4c: fix
178
+ - Updated dependencies [1f9ac4c]
179
+ - @contractspec/bundle.lifecycle-managed@1.42.2
180
+ - @contractspec/lib.contracts@1.42.2
181
+ - @contractspec/lib.lifecycle@1.42.2
182
+ - @contractspec/lib.logger@1.42.2
183
+ - @contractspec/lib.schema@1.42.2
184
+
185
+ ## 1.42.1
186
+
187
+ ### Patch Changes
188
+
189
+ - f043995: Fix release
190
+ - Updated dependencies [f043995]
191
+ - @contractspec/bundle.lifecycle-managed@1.42.1
192
+ - @contractspec/lib.contracts@1.42.1
193
+ - @contractspec/lib.lifecycle@1.42.1
194
+ - @contractspec/lib.logger@1.42.1
195
+ - @contractspec/lib.schema@1.42.1
196
+
197
+ ## 1.42.0
198
+
199
+ ### Minor Changes
200
+
201
+ - 8eefd9c: initial release
202
+
203
+ ### Patch Changes
204
+
205
+ - Updated dependencies [8eefd9c]
206
+ - @contractspec/bundle.lifecycle-managed@1.42.0
207
+ - @contractspec/lib.contracts@1.42.0
208
+ - @contractspec/lib.lifecycle@1.42.0
209
+ - @contractspec/lib.logger@1.42.0
210
+ - @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,15 @@
1
+ ## Lifecycle CLI Demo
2
+
3
+ Website: https://contractspec.io/
4
+
5
+
6
+ Tiny script showing how to run the lifecycle managed service from a CLI (no HTTP server required). It stitches together mock analytics + questionnaire adapters, runs an assessment, and prints the resulting recommendation/libraries.
7
+
8
+ ### Run
9
+
10
+ ```bash
11
+ bunx tsx packages/examples/lifecycle-cli/demo.ts
12
+ ```
13
+
14
+ Feel free to tweak the mock data in `demo.ts` (or `src/demo.ts`) to experiment with different lifecycle stages.
15
+
package/demo.ts ADDED
@@ -0,0 +1,14 @@
1
+ import { runLifecycleCliDemo } from './src/demo';
2
+
3
+ void runLifecycleCliDemo().catch((error) => {
4
+ // Keep console usage limited to this demo entrypoint only.
5
+ // Prefer structured logging within the library (see src/demo.ts).
6
+ // eslint-disable-next-line no-console
7
+ console.error(error);
8
+ process.exitCode = 1;
9
+ });
10
+
11
+ /*
12
+
13
+ bun build --compile --minify-whitespace --minify-syntax --target bun --outfile server src/index.ts
14
+ */
package/dist/demo.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ //#region src/demo.d.ts
2
+ declare function runLifecycleCliDemo(): Promise<void>;
3
+ //#endregion
4
+ export { runLifecycleCliDemo };
5
+ //# sourceMappingURL=demo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"demo.d.ts","names":[],"sources":["../src/demo.ts"],"sourcesContent":[],"mappings":";iBAmBsB,mBAAA,CAAA,GAAuB"}
package/dist/demo.js ADDED
@@ -0,0 +1,49 @@
1
+ import { LifecycleAssessmentService, createLifecycleHandlers } from "@contractspec/bundle.lifecycle-managed";
2
+ import { CapitalPhase, CompanyPhase, ProductPhase } from "@contractspec/lib.lifecycle";
3
+ import { LogLevel, Logger } from "@contractspec/lib.logger";
4
+
5
+ //#region src/demo.ts
6
+ const logger = new Logger({
7
+ level: process.env.NODE_ENV === "production" ? LogLevel.INFO : LogLevel.DEBUG,
8
+ environment: process.env.NODE_ENV || "development",
9
+ enableColors: process.env.NODE_ENV !== "production"
10
+ });
11
+ async function runLifecycleCliDemo() {
12
+ const response = await createLifecycleHandlers(new LifecycleAssessmentService({ collector: {
13
+ analyticsAdapter: { async fetch() {
14
+ return { metrics: {
15
+ activeUsers: 32,
16
+ weeklyActiveUsers: 27,
17
+ retentionRate: .36,
18
+ monthlyRecurringRevenue: 1800,
19
+ customerCount: 22,
20
+ teamSize: 6
21
+ } };
22
+ } },
23
+ questionnaireAdapter: { async fetch() {
24
+ return {
25
+ axes: {
26
+ product: ProductPhase.Mvp,
27
+ company: CompanyPhase.TinyTeam,
28
+ capital: CapitalPhase.Seed
29
+ },
30
+ answers: {
31
+ interviewCount: 28,
32
+ primaryPain: "Manual onboarding takes 3 hours per customer."
33
+ }
34
+ };
35
+ } }
36
+ } })).runAssessment({ body: {
37
+ tenantId: "demo-tenant",
38
+ completedMilestones: ["stage0-problem-statement"]
39
+ } });
40
+ logger.info("Lifecycle assessment computed", {
41
+ assessment: response.body.assessment,
42
+ topRecommendation: response.body.recommendation.actions[0],
43
+ libraries: response.body.libraries
44
+ });
45
+ }
46
+
47
+ //#endregion
48
+ export { runLifecycleCliDemo };
49
+ //# sourceMappingURL=demo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"demo.js","names":[],"sources":["../src/demo.ts"],"sourcesContent":["import {\n createLifecycleHandlers,\n LifecycleAssessmentService,\n} from '@contractspec/bundle.lifecycle-managed';\nimport {\n CapitalPhase,\n CompanyPhase,\n ProductPhase,\n} from '@contractspec/lib.lifecycle';\nimport { Logger, LogLevel } from '@contractspec/lib.logger';\nimport type { LoggerConfig } from '@contractspec/lib.logger/types';\n\nconst logger = new Logger({\n level: process.env.NODE_ENV === 'production' ? LogLevel.INFO : LogLevel.DEBUG,\n environment:\n (process.env.NODE_ENV as LoggerConfig['environment']) || 'development',\n enableColors: process.env.NODE_ENV !== 'production',\n});\n\nexport async function runLifecycleCliDemo(): Promise<void> {\n const service = new LifecycleAssessmentService({\n collector: {\n analyticsAdapter: {\n async fetch() {\n return {\n metrics: {\n activeUsers: 32,\n weeklyActiveUsers: 27,\n retentionRate: 0.36,\n monthlyRecurringRevenue: 1800,\n customerCount: 22,\n teamSize: 6,\n },\n };\n },\n },\n questionnaireAdapter: {\n async fetch() {\n return {\n axes: {\n product: ProductPhase.Mvp,\n company: CompanyPhase.TinyTeam,\n capital: CapitalPhase.Seed,\n },\n answers: {\n interviewCount: 28,\n primaryPain: 'Manual onboarding takes 3 hours per customer.',\n },\n };\n },\n },\n },\n });\n\n const handlers = createLifecycleHandlers(service);\n\n const response = await handlers.runAssessment({\n body: {\n tenantId: 'demo-tenant',\n completedMilestones: ['stage0-problem-statement'],\n },\n });\n\n logger.info('Lifecycle assessment computed', {\n assessment: response.body.assessment,\n topRecommendation: response.body.recommendation.actions[0],\n libraries: response.body.libraries,\n });\n}\n"],"mappings":";;;;;AAYA,MAAM,SAAS,IAAI,OAAO;CACxB,OAAO,QAAQ,IAAI,aAAa,eAAe,SAAS,OAAO,SAAS;CACxE,aACG,QAAQ,IAAI,YAA4C;CAC3D,cAAc,QAAQ,IAAI,aAAa;CACxC,CAAC;AAEF,eAAsB,sBAAqC;CAqCzD,MAAM,WAAW,MAFA,wBAlCD,IAAI,2BAA2B,EAC7C,WAAW;EACT,kBAAkB,EAChB,MAAM,QAAQ;AACZ,UAAO,EACL,SAAS;IACP,aAAa;IACb,mBAAmB;IACnB,eAAe;IACf,yBAAyB;IACzB,eAAe;IACf,UAAU;IACX,EACF;KAEJ;EACD,sBAAsB,EACpB,MAAM,QAAQ;AACZ,UAAO;IACL,MAAM;KACJ,SAAS,aAAa;KACtB,SAAS,aAAa;KACtB,SAAS,aAAa;KACvB;IACD,SAAS;KACP,gBAAgB;KAChB,aAAa;KACd;IACF;KAEJ;EACF,EACF,CAAC,CAE+C,CAEjB,cAAc,EAC5C,MAAM;EACJ,UAAU;EACV,qBAAqB,CAAC,2BAA2B;EAClD,EACF,CAAC;AAEF,QAAO,KAAK,iCAAiC;EAC3C,YAAY,SAAS,KAAK;EAC1B,mBAAmB,SAAS,KAAK,eAAe,QAAQ;EACxD,WAAW,SAAS,KAAK;EAC1B,CAAC"}
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ import "./lifecycle-cli.docblock.js";
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,33 @@
1
+ import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
2
+
3
+ //#region src/docs/lifecycle-cli.docblock.ts
4
+ registerDocBlocks([{
5
+ id: "docs.examples.lifecycle-cli",
6
+ title: "Lifecycle CLI (demo)",
7
+ summary: "Run a lifecycle assessment from a CLI using the lifecycle-managed bundle (no HTTP server required).",
8
+ kind: "reference",
9
+ visibility: "public",
10
+ route: "/docs/examples/lifecycle-cli",
11
+ tags: [
12
+ "lifecycle",
13
+ "cli",
14
+ "example"
15
+ ],
16
+ body: `## What this example shows\n- How to call \`LifecycleAssessmentService\` from a Node/Bun script.\n- How to wire mock analytics + questionnaire adapters.\n\n## Run\n- Use the exported function \`runLifecycleCliDemo()\` (or call it from your own CLI wrapper).\n\n## Notes\n- Keep outputs structured; avoid \`console.log\` in production paths.\n- This example is deterministic (fixed inputs → stable output).`
17
+ }, {
18
+ id: "docs.examples.lifecycle-cli.usage",
19
+ title: "Lifecycle CLI — Usage",
20
+ summary: "How to run and tweak the lifecycle assessment demo.",
21
+ kind: "usage",
22
+ visibility: "public",
23
+ route: "/docs/examples/lifecycle-cli/usage",
24
+ tags: [
25
+ "lifecycle",
26
+ "cli",
27
+ "usage"
28
+ ],
29
+ body: `## Usage\n1) Call \`runLifecycleCliDemo()\`.\n2) Adjust the mock metrics/answers to explore stage outcomes.\n\n## Guardrails\n- Avoid PII in logs.\n- Keep adapters explicit and deterministic for reproducible demos.`
30
+ }]);
31
+
32
+ //#endregion
33
+ //# sourceMappingURL=lifecycle-cli.docblock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle-cli.docblock.js","names":[],"sources":["../../src/docs/lifecycle-cli.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-cli',\n title: 'Lifecycle CLI (demo)',\n summary:\n 'Run a lifecycle assessment from a CLI using the lifecycle-managed bundle (no HTTP server required).',\n kind: 'reference',\n visibility: 'public',\n route: '/docs/examples/lifecycle-cli',\n tags: ['lifecycle', 'cli', 'example'],\n body: `## What this example shows\\n- How to call \\`LifecycleAssessmentService\\` from a Node/Bun script.\\n- How to wire mock analytics + questionnaire adapters.\\n\\n## Run\\n- Use the exported function \\`runLifecycleCliDemo()\\` (or call it from your own CLI wrapper).\\n\\n## Notes\\n- Keep outputs structured; avoid \\`console.log\\` in production paths.\\n- This example is deterministic (fixed inputs → stable output).`,\n },\n {\n id: 'docs.examples.lifecycle-cli.usage',\n title: 'Lifecycle CLI — Usage',\n summary: 'How to run and tweak the lifecycle assessment demo.',\n kind: 'usage',\n visibility: 'public',\n route: '/docs/examples/lifecycle-cli/usage',\n tags: ['lifecycle', 'cli', 'usage'],\n body: `## Usage\\n1) Call \\`runLifecycleCliDemo()\\`.\\n2) Adjust the mock metrics/answers to explore stage outcomes.\\n\\n## Guardrails\\n- Avoid PII in logs.\\n- Keep adapters explicit and deterministic for reproducible demos.`,\n },\n];\n\nregisterDocBlocks(blocks);\n"],"mappings":";;;AA2BA,kBAxB2B,CACzB;CACE,IAAI;CACJ,OAAO;CACP,SACE;CACF,MAAM;CACN,YAAY;CACZ,OAAO;CACP,MAAM;EAAC;EAAa;EAAO;EAAU;CACrC,MAAM;CACP,EACD;CACE,IAAI;CACJ,OAAO;CACP,SAAS;CACT,MAAM;CACN,YAAY;CACZ,OAAO;CACP,MAAM;EAAC;EAAa;EAAO;EAAQ;CACnC,MAAM;CACP,CACF,CAEwB"}
@@ -0,0 +1,34 @@
1
+ //#region src/example.d.ts
2
+ declare const example: {
3
+ readonly id: "lifecycle-cli";
4
+ readonly title: "Lifecycle CLI";
5
+ readonly summary: "Tiny script showing how to run the lifecycle managed service from a CLI (no HTTP server required).";
6
+ readonly tags: readonly ["lifecycle", "cli", "demo"];
7
+ readonly kind: "script";
8
+ readonly visibility: "public";
9
+ readonly docs: {
10
+ readonly rootDocId: "docs.examples.lifecycle-cli";
11
+ readonly usageDocId: "docs.examples.lifecycle-cli.usage";
12
+ };
13
+ readonly entrypoints: {
14
+ readonly packageName: "@contractspec/example.lifecycle-cli";
15
+ readonly docs: "./docs";
16
+ };
17
+ readonly surfaces: {
18
+ readonly templates: true;
19
+ readonly sandbox: {
20
+ readonly enabled: true;
21
+ readonly modes: readonly ["markdown"];
22
+ };
23
+ readonly studio: {
24
+ readonly enabled: true;
25
+ readonly installable: true;
26
+ };
27
+ readonly mcp: {
28
+ readonly enabled: true;
29
+ };
30
+ };
31
+ };
32
+ //#endregion
33
+ export { example as default };
34
+ //# 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,EAsBI,EAAA,eAAA"}
@@ -0,0 +1,38 @@
1
+ //#region src/example.ts
2
+ const example = {
3
+ id: "lifecycle-cli",
4
+ title: "Lifecycle CLI",
5
+ summary: "Tiny script showing how to run the lifecycle managed service from a CLI (no HTTP server required).",
6
+ tags: [
7
+ "lifecycle",
8
+ "cli",
9
+ "demo"
10
+ ],
11
+ kind: "script",
12
+ visibility: "public",
13
+ docs: {
14
+ rootDocId: "docs.examples.lifecycle-cli",
15
+ usageDocId: "docs.examples.lifecycle-cli.usage"
16
+ },
17
+ entrypoints: {
18
+ packageName: "@contractspec/example.lifecycle-cli",
19
+ docs: "./docs"
20
+ },
21
+ surfaces: {
22
+ templates: true,
23
+ sandbox: {
24
+ enabled: true,
25
+ modes: ["markdown"]
26
+ },
27
+ studio: {
28
+ enabled: true,
29
+ installable: true
30
+ },
31
+ mcp: { enabled: true }
32
+ }
33
+ };
34
+ var example_default = example;
35
+
36
+ //#endregion
37
+ export { example_default as default };
38
+ //# sourceMappingURL=example.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.js","names":[],"sources":["../src/example.ts"],"sourcesContent":["const example = {\n id: 'lifecycle-cli',\n title: 'Lifecycle CLI',\n summary:\n 'Tiny script showing how to run the lifecycle managed service from a CLI (no HTTP server required).',\n tags: ['lifecycle', 'cli', 'demo'],\n kind: 'script',\n visibility: 'public',\n docs: {\n rootDocId: 'docs.examples.lifecycle-cli',\n usageDocId: 'docs.examples.lifecycle-cli.usage',\n },\n entrypoints: {\n packageName: '@contractspec/example.lifecycle-cli',\n docs: './docs',\n },\n surfaces: {\n templates: true,\n sandbox: { enabled: true, modes: ['markdown'] },\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;EAAO;EAAO;CAClC,MAAM;CACN,YAAY;CACZ,MAAM;EACJ,WAAW;EACX,YAAY;EACb;CACD,aAAa;EACX,aAAa;EACb,MAAM;EACP;CACD,UAAU;EACR,WAAW;EACX,SAAS;GAAE,SAAS;GAAM,OAAO,CAAC,WAAW;GAAE;EAC/C,QAAQ;GAAE,SAAS;GAAM,aAAa;GAAM;EAC5C,KAAK,EAAE,SAAS,MAAM;EACvB;CACF;AAED,sBAAe"}
@@ -0,0 +1,3 @@
1
+ import { runLifecycleCliDemo } from "./demo.js";
2
+ import example from "./example.js";
3
+ export { example, runLifecycleCliDemo };
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ import { runLifecycleCliDemo } from "./demo.js";
2
+ import example_default from "./example.js";
3
+ import "./docs/index.js";
4
+
5
+ export { example_default as example, runLifecycleCliDemo };
package/example.ts ADDED
@@ -0,0 +1 @@
1
+ export { default } from './src/example';
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@contractspec/example.lifecycle-cli",
3
+ "version": "1.44.0",
4
+ "description": "Lifecycle CLI demo (example): run lifecycle assessment without an HTTP server.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": "./dist/index.js",
10
+ "./demo": "./dist/demo.js",
11
+ "./docs": "./dist/docs/index.js",
12
+ "./docs/lifecycle-cli.docblock": "./dist/docs/lifecycle-cli.docblock.js",
13
+ "./example": "./dist/example.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/bundle.lifecycle-managed": "1.44.0",
31
+ "@contractspec/lib.lifecycle": "1.44.0",
32
+ "@contractspec/lib.schema": "1.44.0",
33
+ "@contractspec/lib.contracts": "1.44.0",
34
+ "@contractspec/lib.logger": "1.44.0"
35
+ },
36
+ "devDependencies": {
37
+ "@contractspec/tool.tsdown": "1.44.0",
38
+ "@contractspec/tool.typescript": "1.44.0",
39
+ "tsdown": "^0.18.3",
40
+ "typescript": "^5.9.3"
41
+ },
42
+ "publishConfig": {
43
+ "access": "public",
44
+ "exports": {
45
+ ".": "./dist/index.js",
46
+ "./demo": "./dist/demo.js",
47
+ "./docs": "./dist/docs/index.js",
48
+ "./docs/lifecycle-cli.docblock": "./dist/docs/lifecycle-cli.docblock.js",
49
+ "./example": "./dist/example.js",
50
+ "./*": "./*"
51
+ },
52
+ "registry": "https://registry.npmjs.org/"
53
+ },
54
+ "module": "./dist/index.js",
55
+ "license": "MIT",
56
+ "repository": {
57
+ "type": "git",
58
+ "url": "https://github.com/lssm-tech/contractspec.git",
59
+ "directory": "packages/examples/lifecycle-cli"
60
+ },
61
+ "homepage": "https://contractspec.io"
62
+ }
package/src/demo.ts ADDED
@@ -0,0 +1,69 @@
1
+ import {
2
+ createLifecycleHandlers,
3
+ LifecycleAssessmentService,
4
+ } from '@contractspec/bundle.lifecycle-managed';
5
+ import {
6
+ CapitalPhase,
7
+ CompanyPhase,
8
+ ProductPhase,
9
+ } from '@contractspec/lib.lifecycle';
10
+ import { Logger, LogLevel } from '@contractspec/lib.logger';
11
+ import type { LoggerConfig } from '@contractspec/lib.logger/types';
12
+
13
+ const logger = new Logger({
14
+ level: process.env.NODE_ENV === 'production' ? LogLevel.INFO : LogLevel.DEBUG,
15
+ environment:
16
+ (process.env.NODE_ENV as LoggerConfig['environment']) || 'development',
17
+ enableColors: process.env.NODE_ENV !== 'production',
18
+ });
19
+
20
+ export async function runLifecycleCliDemo(): Promise<void> {
21
+ const service = new LifecycleAssessmentService({
22
+ collector: {
23
+ analyticsAdapter: {
24
+ async fetch() {
25
+ return {
26
+ metrics: {
27
+ activeUsers: 32,
28
+ weeklyActiveUsers: 27,
29
+ retentionRate: 0.36,
30
+ monthlyRecurringRevenue: 1800,
31
+ customerCount: 22,
32
+ teamSize: 6,
33
+ },
34
+ };
35
+ },
36
+ },
37
+ questionnaireAdapter: {
38
+ async fetch() {
39
+ return {
40
+ axes: {
41
+ product: ProductPhase.Mvp,
42
+ company: CompanyPhase.TinyTeam,
43
+ capital: CapitalPhase.Seed,
44
+ },
45
+ answers: {
46
+ interviewCount: 28,
47
+ primaryPain: 'Manual onboarding takes 3 hours per customer.',
48
+ },
49
+ };
50
+ },
51
+ },
52
+ },
53
+ });
54
+
55
+ const handlers = createLifecycleHandlers(service);
56
+
57
+ const response = await handlers.runAssessment({
58
+ body: {
59
+ tenantId: 'demo-tenant',
60
+ completedMilestones: ['stage0-problem-statement'],
61
+ },
62
+ });
63
+
64
+ logger.info('Lifecycle assessment computed', {
65
+ assessment: response.body.assessment,
66
+ topRecommendation: response.body.recommendation.actions[0],
67
+ libraries: response.body.libraries,
68
+ });
69
+ }