@contractspec/example.lifecycle-cli 1.57.0 → 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/dist/example.d.ts CHANGED
@@ -1,7 +1,3 @@
1
- import * as _contractspec_lib_contracts0 from "@contractspec/lib.contracts";
2
-
3
- //#region src/example.d.ts
4
- declare const example: _contractspec_lib_contracts0.ExampleSpec;
5
- //#endregion
6
- export { example as default };
1
+ declare const example: import("@contractspec/lib.contracts").ExampleSpec;
2
+ export default example;
7
3
  //# sourceMappingURL=example.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"mappings":";;;cAEM,OAAA,EA2BJ,4BAAA,CA3BW,WAAA"}
1
+ {"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../src/example.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,OAAO,mDA2BX,CAAC;AAEH,eAAe,OAAO,CAAC"}
package/dist/example.js CHANGED
@@ -1,44 +1,34 @@
1
+ // @bun
2
+ // src/example.ts
1
3
  import { defineExample } from "@contractspec/lib.contracts";
2
-
3
- //#region src/example.ts
4
- const example = defineExample({
5
- meta: {
6
- key: "lifecycle-cli",
7
- version: "1.0.0",
8
- title: "Lifecycle CLI",
9
- description: "Tiny script showing how to run the lifecycle managed service from a CLI (no HTTP server required).",
10
- kind: "script",
11
- visibility: "public",
12
- stability: "experimental",
13
- owners: ["@platform.core"],
14
- tags: [
15
- "lifecycle",
16
- "cli",
17
- "demo"
18
- ]
19
- },
20
- docs: {
21
- rootDocId: "docs.examples.lifecycle-cli",
22
- usageDocId: "docs.examples.lifecycle-cli.usage"
23
- },
24
- entrypoints: {
25
- packageName: "@contractspec/example.lifecycle-cli",
26
- docs: "./docs"
27
- },
28
- surfaces: {
29
- templates: true,
30
- sandbox: {
31
- enabled: true,
32
- modes: ["markdown"]
33
- },
34
- studio: {
35
- enabled: true,
36
- installable: true
37
- },
38
- mcp: { enabled: true }
39
- }
4
+ var example = defineExample({
5
+ meta: {
6
+ key: "lifecycle-cli",
7
+ version: "1.0.0",
8
+ title: "Lifecycle CLI",
9
+ description: "Tiny script showing how to run the lifecycle managed service from a CLI (no HTTP server required).",
10
+ kind: "script",
11
+ visibility: "public",
12
+ stability: "experimental",
13
+ owners: ["@platform.core"],
14
+ tags: ["lifecycle", "cli", "demo"]
15
+ },
16
+ docs: {
17
+ rootDocId: "docs.examples.lifecycle-cli",
18
+ usageDocId: "docs.examples.lifecycle-cli.usage"
19
+ },
20
+ entrypoints: {
21
+ packageName: "@contractspec/example.lifecycle-cli",
22
+ docs: "./docs"
23
+ },
24
+ surfaces: {
25
+ templates: true,
26
+ sandbox: { enabled: true, modes: ["markdown"] },
27
+ studio: { enabled: true, installable: true },
28
+ mcp: { enabled: true }
29
+ }
40
30
  });
41
-
42
- //#endregion
43
- export { example as default };
44
- //# sourceMappingURL=example.js.map
31
+ var example_default = example;
32
+ export {
33
+ example_default as default
34
+ };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
- import { runLifecycleCliDemo } from "./demo.js";
2
- import example from "./example.js";
3
- export { example, runLifecycleCliDemo };
1
+ export * from './demo';
2
+ export { default as example } from './example';
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,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,QAAQ,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,139 @@
1
- import { runLifecycleCliDemo } from "./demo.js";
2
- import example from "./example.js";
3
- import "./docs/index.js";
1
+ // @bun
2
+ // src/demo.ts
3
+ import {
4
+ createLifecycleHandlers,
5
+ LifecycleAssessmentService
6
+ } from "@contractspec/bundle.lifecycle-managed";
7
+ import {
8
+ CapitalPhase,
9
+ CompanyPhase,
10
+ ProductPhase
11
+ } from "@contractspec/lib.lifecycle";
12
+ import { Logger, LogLevel } from "@contractspec/lib.logger";
13
+ var logger = new Logger({
14
+ level: LogLevel.DEBUG,
15
+ environment: "development",
16
+ enableColors: true
17
+ });
18
+ async function runLifecycleCliDemo() {
19
+ const service = new LifecycleAssessmentService({
20
+ collector: {
21
+ analyticsAdapter: {
22
+ async fetch() {
23
+ return {
24
+ metrics: {
25
+ activeUsers: 32,
26
+ weeklyActiveUsers: 27,
27
+ retentionRate: 0.36,
28
+ monthlyRecurringRevenue: 1800,
29
+ customerCount: 22,
30
+ teamSize: 6
31
+ }
32
+ };
33
+ }
34
+ },
35
+ questionnaireAdapter: {
36
+ async fetch() {
37
+ return {
38
+ axes: {
39
+ product: ProductPhase.Mvp,
40
+ company: CompanyPhase.TinyTeam,
41
+ capital: CapitalPhase.Seed
42
+ },
43
+ answers: {
44
+ interviewCount: 28,
45
+ primaryPain: "Manual onboarding takes 3 hours per customer."
46
+ }
47
+ };
48
+ }
49
+ }
50
+ }
51
+ });
52
+ const handlers = createLifecycleHandlers(service);
53
+ const response = await handlers.runAssessment({
54
+ body: {
55
+ tenantId: "demo-tenant",
56
+ completedMilestones: ["stage0-problem-statement"]
57
+ }
58
+ });
59
+ logger.info("Lifecycle assessment computed", {
60
+ assessment: response.body.assessment,
61
+ topRecommendation: response.body.recommendation.actions[0],
62
+ libraries: response.body.libraries
63
+ });
64
+ }
4
65
 
5
- export { example, runLifecycleCliDemo };
66
+ // src/docs/lifecycle-cli.docblock.ts
67
+ import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
68
+ var blocks = [
69
+ {
70
+ id: "docs.examples.lifecycle-cli",
71
+ title: "Lifecycle CLI (demo)",
72
+ summary: "Run a lifecycle assessment from a CLI using the lifecycle-managed bundle (no HTTP server required).",
73
+ kind: "reference",
74
+ visibility: "public",
75
+ route: "/docs/examples/lifecycle-cli",
76
+ tags: ["lifecycle", "cli", "example"],
77
+ body: `## What this example shows
78
+ - How to call \`LifecycleAssessmentService\` from a Node/Bun script.
79
+ - How to wire mock analytics + questionnaire adapters.
80
+
81
+ ## Run
82
+ - Use the exported function \`runLifecycleCliDemo()\` (or call it from your own CLI wrapper).
83
+
84
+ ## Notes
85
+ - Keep outputs structured; avoid \`console.log\` in production paths.
86
+ - This example is deterministic (fixed inputs \u2192 stable output).`
87
+ },
88
+ {
89
+ id: "docs.examples.lifecycle-cli.usage",
90
+ title: "Lifecycle CLI \u2014 Usage",
91
+ summary: "How to run and tweak the lifecycle assessment demo.",
92
+ kind: "usage",
93
+ visibility: "public",
94
+ route: "/docs/examples/lifecycle-cli/usage",
95
+ tags: ["lifecycle", "cli", "usage"],
96
+ body: `## Usage
97
+ 1) Call \`runLifecycleCliDemo()\`.
98
+ 2) Adjust the mock metrics/answers to explore stage outcomes.
99
+
100
+ ## Guardrails
101
+ - Avoid PII in logs.
102
+ - Keep adapters explicit and deterministic for reproducible demos.`
103
+ }
104
+ ];
105
+ registerDocBlocks(blocks);
106
+ // src/example.ts
107
+ import { defineExample } from "@contractspec/lib.contracts";
108
+ var example = defineExample({
109
+ meta: {
110
+ key: "lifecycle-cli",
111
+ version: "1.0.0",
112
+ title: "Lifecycle CLI",
113
+ description: "Tiny script showing how to run the lifecycle managed service from a CLI (no HTTP server required).",
114
+ kind: "script",
115
+ visibility: "public",
116
+ stability: "experimental",
117
+ owners: ["@platform.core"],
118
+ tags: ["lifecycle", "cli", "demo"]
119
+ },
120
+ docs: {
121
+ rootDocId: "docs.examples.lifecycle-cli",
122
+ usageDocId: "docs.examples.lifecycle-cli.usage"
123
+ },
124
+ entrypoints: {
125
+ packageName: "@contractspec/example.lifecycle-cli",
126
+ docs: "./docs"
127
+ },
128
+ surfaces: {
129
+ templates: true,
130
+ sandbox: { enabled: true, modes: ["markdown"] },
131
+ studio: { enabled: true, installable: true },
132
+ mcp: { enabled: true }
133
+ }
134
+ });
135
+ var example_default = example;
136
+ export {
137
+ runLifecycleCliDemo,
138
+ example_default as example
139
+ };
@@ -0,0 +1,66 @@
1
+ // src/demo.ts
2
+ import {
3
+ createLifecycleHandlers,
4
+ LifecycleAssessmentService
5
+ } from "@contractspec/bundle.lifecycle-managed";
6
+ import {
7
+ CapitalPhase,
8
+ CompanyPhase,
9
+ ProductPhase
10
+ } from "@contractspec/lib.lifecycle";
11
+ import { Logger, LogLevel } from "@contractspec/lib.logger";
12
+ var logger = new Logger({
13
+ level: LogLevel.DEBUG,
14
+ environment: "development",
15
+ enableColors: true
16
+ });
17
+ async function runLifecycleCliDemo() {
18
+ const service = new LifecycleAssessmentService({
19
+ collector: {
20
+ analyticsAdapter: {
21
+ async fetch() {
22
+ return {
23
+ metrics: {
24
+ activeUsers: 32,
25
+ weeklyActiveUsers: 27,
26
+ retentionRate: 0.36,
27
+ monthlyRecurringRevenue: 1800,
28
+ customerCount: 22,
29
+ teamSize: 6
30
+ }
31
+ };
32
+ }
33
+ },
34
+ questionnaireAdapter: {
35
+ async fetch() {
36
+ return {
37
+ axes: {
38
+ product: ProductPhase.Mvp,
39
+ company: CompanyPhase.TinyTeam,
40
+ capital: CapitalPhase.Seed
41
+ },
42
+ answers: {
43
+ interviewCount: 28,
44
+ primaryPain: "Manual onboarding takes 3 hours per customer."
45
+ }
46
+ };
47
+ }
48
+ }
49
+ }
50
+ });
51
+ const handlers = createLifecycleHandlers(service);
52
+ const response = await handlers.runAssessment({
53
+ body: {
54
+ tenantId: "demo-tenant",
55
+ completedMilestones: ["stage0-problem-statement"]
56
+ }
57
+ });
58
+ logger.info("Lifecycle assessment computed", {
59
+ assessment: response.body.assessment,
60
+ topRecommendation: response.body.recommendation.actions[0],
61
+ libraries: response.body.libraries
62
+ });
63
+ }
64
+ export {
65
+ runLifecycleCliDemo
66
+ };
@@ -0,0 +1,40 @@
1
+ // src/docs/lifecycle-cli.docblock.ts
2
+ import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
3
+ var blocks = [
4
+ {
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: ["lifecycle", "cli", "example"],
12
+ body: `## What this example shows
13
+ - How to call \`LifecycleAssessmentService\` from a Node/Bun script.
14
+ - How to wire mock analytics + questionnaire adapters.
15
+
16
+ ## Run
17
+ - Use the exported function \`runLifecycleCliDemo()\` (or call it from your own CLI wrapper).
18
+
19
+ ## Notes
20
+ - Keep outputs structured; avoid \`console.log\` in production paths.
21
+ - This example is deterministic (fixed inputs → stable output).`
22
+ },
23
+ {
24
+ id: "docs.examples.lifecycle-cli.usage",
25
+ title: "Lifecycle CLI — Usage",
26
+ summary: "How to run and tweak the lifecycle assessment demo.",
27
+ kind: "usage",
28
+ visibility: "public",
29
+ route: "/docs/examples/lifecycle-cli/usage",
30
+ tags: ["lifecycle", "cli", "usage"],
31
+ body: `## Usage
32
+ 1) Call \`runLifecycleCliDemo()\`.
33
+ 2) Adjust the mock metrics/answers to explore stage outcomes.
34
+
35
+ ## Guardrails
36
+ - Avoid PII in logs.
37
+ - Keep adapters explicit and deterministic for reproducible demos.`
38
+ }
39
+ ];
40
+ registerDocBlocks(blocks);
@@ -0,0 +1,40 @@
1
+ // src/docs/lifecycle-cli.docblock.ts
2
+ import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
3
+ var blocks = [
4
+ {
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: ["lifecycle", "cli", "example"],
12
+ body: `## What this example shows
13
+ - How to call \`LifecycleAssessmentService\` from a Node/Bun script.
14
+ - How to wire mock analytics + questionnaire adapters.
15
+
16
+ ## Run
17
+ - Use the exported function \`runLifecycleCliDemo()\` (or call it from your own CLI wrapper).
18
+
19
+ ## Notes
20
+ - Keep outputs structured; avoid \`console.log\` in production paths.
21
+ - This example is deterministic (fixed inputs → stable output).`
22
+ },
23
+ {
24
+ id: "docs.examples.lifecycle-cli.usage",
25
+ title: "Lifecycle CLI — Usage",
26
+ summary: "How to run and tweak the lifecycle assessment demo.",
27
+ kind: "usage",
28
+ visibility: "public",
29
+ route: "/docs/examples/lifecycle-cli/usage",
30
+ tags: ["lifecycle", "cli", "usage"],
31
+ body: `## Usage
32
+ 1) Call \`runLifecycleCliDemo()\`.
33
+ 2) Adjust the mock metrics/answers to explore stage outcomes.
34
+
35
+ ## Guardrails
36
+ - Avoid PII in logs.
37
+ - Keep adapters explicit and deterministic for reproducible demos.`
38
+ }
39
+ ];
40
+ registerDocBlocks(blocks);
@@ -0,0 +1,33 @@
1
+ // src/example.ts
2
+ import { defineExample } from "@contractspec/lib.contracts";
3
+ var example = defineExample({
4
+ meta: {
5
+ key: "lifecycle-cli",
6
+ version: "1.0.0",
7
+ title: "Lifecycle CLI",
8
+ description: "Tiny script showing how to run the lifecycle managed service from a CLI (no HTTP server required).",
9
+ kind: "script",
10
+ visibility: "public",
11
+ stability: "experimental",
12
+ owners: ["@platform.core"],
13
+ tags: ["lifecycle", "cli", "demo"]
14
+ },
15
+ docs: {
16
+ rootDocId: "docs.examples.lifecycle-cli",
17
+ usageDocId: "docs.examples.lifecycle-cli.usage"
18
+ },
19
+ entrypoints: {
20
+ packageName: "@contractspec/example.lifecycle-cli",
21
+ docs: "./docs"
22
+ },
23
+ surfaces: {
24
+ templates: true,
25
+ sandbox: { enabled: true, modes: ["markdown"] },
26
+ studio: { enabled: true, installable: true },
27
+ mcp: { enabled: true }
28
+ }
29
+ });
30
+ var example_default = example;
31
+ export {
32
+ example_default as default
33
+ };
@@ -0,0 +1,138 @@
1
+ // src/demo.ts
2
+ import {
3
+ createLifecycleHandlers,
4
+ LifecycleAssessmentService
5
+ } from "@contractspec/bundle.lifecycle-managed";
6
+ import {
7
+ CapitalPhase,
8
+ CompanyPhase,
9
+ ProductPhase
10
+ } from "@contractspec/lib.lifecycle";
11
+ import { Logger, LogLevel } from "@contractspec/lib.logger";
12
+ var logger = new Logger({
13
+ level: LogLevel.DEBUG,
14
+ environment: "development",
15
+ enableColors: true
16
+ });
17
+ async function runLifecycleCliDemo() {
18
+ const service = new LifecycleAssessmentService({
19
+ collector: {
20
+ analyticsAdapter: {
21
+ async fetch() {
22
+ return {
23
+ metrics: {
24
+ activeUsers: 32,
25
+ weeklyActiveUsers: 27,
26
+ retentionRate: 0.36,
27
+ monthlyRecurringRevenue: 1800,
28
+ customerCount: 22,
29
+ teamSize: 6
30
+ }
31
+ };
32
+ }
33
+ },
34
+ questionnaireAdapter: {
35
+ async fetch() {
36
+ return {
37
+ axes: {
38
+ product: ProductPhase.Mvp,
39
+ company: CompanyPhase.TinyTeam,
40
+ capital: CapitalPhase.Seed
41
+ },
42
+ answers: {
43
+ interviewCount: 28,
44
+ primaryPain: "Manual onboarding takes 3 hours per customer."
45
+ }
46
+ };
47
+ }
48
+ }
49
+ }
50
+ });
51
+ const handlers = createLifecycleHandlers(service);
52
+ const response = await handlers.runAssessment({
53
+ body: {
54
+ tenantId: "demo-tenant",
55
+ completedMilestones: ["stage0-problem-statement"]
56
+ }
57
+ });
58
+ logger.info("Lifecycle assessment computed", {
59
+ assessment: response.body.assessment,
60
+ topRecommendation: response.body.recommendation.actions[0],
61
+ libraries: response.body.libraries
62
+ });
63
+ }
64
+
65
+ // src/docs/lifecycle-cli.docblock.ts
66
+ import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
67
+ var blocks = [
68
+ {
69
+ id: "docs.examples.lifecycle-cli",
70
+ title: "Lifecycle CLI (demo)",
71
+ summary: "Run a lifecycle assessment from a CLI using the lifecycle-managed bundle (no HTTP server required).",
72
+ kind: "reference",
73
+ visibility: "public",
74
+ route: "/docs/examples/lifecycle-cli",
75
+ tags: ["lifecycle", "cli", "example"],
76
+ body: `## What this example shows
77
+ - How to call \`LifecycleAssessmentService\` from a Node/Bun script.
78
+ - How to wire mock analytics + questionnaire adapters.
79
+
80
+ ## Run
81
+ - Use the exported function \`runLifecycleCliDemo()\` (or call it from your own CLI wrapper).
82
+
83
+ ## Notes
84
+ - Keep outputs structured; avoid \`console.log\` in production paths.
85
+ - This example is deterministic (fixed inputs → stable output).`
86
+ },
87
+ {
88
+ id: "docs.examples.lifecycle-cli.usage",
89
+ title: "Lifecycle CLI — Usage",
90
+ summary: "How to run and tweak the lifecycle assessment demo.",
91
+ kind: "usage",
92
+ visibility: "public",
93
+ route: "/docs/examples/lifecycle-cli/usage",
94
+ tags: ["lifecycle", "cli", "usage"],
95
+ body: `## Usage
96
+ 1) Call \`runLifecycleCliDemo()\`.
97
+ 2) Adjust the mock metrics/answers to explore stage outcomes.
98
+
99
+ ## Guardrails
100
+ - Avoid PII in logs.
101
+ - Keep adapters explicit and deterministic for reproducible demos.`
102
+ }
103
+ ];
104
+ registerDocBlocks(blocks);
105
+ // src/example.ts
106
+ import { defineExample } from "@contractspec/lib.contracts";
107
+ var example = defineExample({
108
+ meta: {
109
+ key: "lifecycle-cli",
110
+ version: "1.0.0",
111
+ title: "Lifecycle CLI",
112
+ description: "Tiny script showing how to run the lifecycle managed service from a CLI (no HTTP server required).",
113
+ kind: "script",
114
+ visibility: "public",
115
+ stability: "experimental",
116
+ owners: ["@platform.core"],
117
+ tags: ["lifecycle", "cli", "demo"]
118
+ },
119
+ docs: {
120
+ rootDocId: "docs.examples.lifecycle-cli",
121
+ usageDocId: "docs.examples.lifecycle-cli.usage"
122
+ },
123
+ entrypoints: {
124
+ packageName: "@contractspec/example.lifecycle-cli",
125
+ docs: "./docs"
126
+ },
127
+ surfaces: {
128
+ templates: true,
129
+ sandbox: { enabled: true, modes: ["markdown"] },
130
+ studio: { enabled: true, installable: true },
131
+ mcp: { enabled: true }
132
+ }
133
+ });
134
+ var example_default = example;
135
+ export {
136
+ runLifecycleCliDemo,
137
+ example_default as example
138
+ };