@contractspec/example.lifecycle-cli 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 +34 -0
- package/dist/browser/demo.js +66 -0
- package/dist/browser/docs/index.js +40 -0
- package/dist/browser/docs/lifecycle-cli.docblock.js +40 -0
- package/dist/browser/example.js +33 -0
- package/dist/browser/index.js +138 -0
- package/dist/demo.d.ts +1 -4
- package/dist/demo.d.ts.map +1 -1
- package/dist/demo.js +64 -46
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +41 -1
- package/dist/docs/lifecycle-cli.docblock.d.ts +2 -1
- package/dist/docs/lifecycle-cli.docblock.d.ts.map +1 -0
- package/dist/docs/lifecycle-cli.docblock.js +38 -30
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +31 -42
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +138 -4
- package/dist/node/demo.js +66 -0
- package/dist/node/docs/index.js +40 -0
- package/dist/node/docs/lifecycle-cli.docblock.js +40 -0
- package/dist/node/example.js +33 -0
- package/dist/node/index.js +138 -0
- package/package.json +63 -26
- package/tsdown.config.js +1 -2
- package/.turbo/turbo-build$colon$bundle.log +0 -25
- package/dist/demo.js.map +0 -1
- package/dist/docs/lifecycle-cli.docblock.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/tsconfig.tsbuildinfo +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 5ms
|
|
7
|
+
|
|
8
|
+
./demo.js 1.73 KB (entry point)
|
|
9
|
+
./index.js 4.1 KB (entry point)
|
|
10
|
+
docs/index.js 1.43 KB (entry point)
|
|
11
|
+
docs/lifecycle-cli.docblock.js 1.43 KB (entry point)
|
|
12
|
+
./example.js 0.93 KB (entry point)
|
|
13
|
+
|
|
14
|
+
[contractspec-bun-build] transpile target=node root=src entries=5
|
|
15
|
+
Bundled 5 modules in 4ms
|
|
16
|
+
|
|
17
|
+
./demo.js 1.72 KB (entry point)
|
|
18
|
+
./index.js 4.0 KB (entry point)
|
|
19
|
+
docs/index.js 1.41 KB (entry point)
|
|
20
|
+
docs/lifecycle-cli.docblock.js 1.41 KB (entry point)
|
|
21
|
+
./example.js 0.92 KB (entry point)
|
|
22
|
+
|
|
23
|
+
[contractspec-bun-build] transpile target=browser root=src entries=5
|
|
24
|
+
Bundled 5 modules in 9ms
|
|
25
|
+
|
|
26
|
+
./demo.js 1.72 KB (entry point)
|
|
27
|
+
./index.js 4.0 KB (entry point)
|
|
28
|
+
docs/index.js 1.41 KB (entry point)
|
|
29
|
+
docs/lifecycle-cli.docblock.js 1.41 KB (entry point)
|
|
30
|
+
./example.js 0.92 KB (entry point)
|
|
31
|
+
|
|
32
|
+
$ contractspec-bun-build types
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$ contractspec-bun-build prebuild
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @contractspec/example.lifecycle-cli
|
|
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/bundle.lifecycle-managed@1.58.0
|
|
14
|
+
- @contractspec/lib.contracts@1.58.0
|
|
15
|
+
- @contractspec/lib.lifecycle@1.58.0
|
|
16
|
+
- @contractspec/lib.logger@1.58.0
|
|
17
|
+
|
|
18
|
+
## 1.57.0
|
|
19
|
+
|
|
20
|
+
### Minor Changes
|
|
21
|
+
|
|
22
|
+
- 11a5a05: feat: improve product intent
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [8ecf3c1]
|
|
27
|
+
- Updated dependencies [47c48c2]
|
|
28
|
+
- Updated dependencies [a119963]
|
|
29
|
+
- Updated dependencies [4651e06]
|
|
30
|
+
- Updated dependencies [ad9d10a]
|
|
31
|
+
- Updated dependencies [11a5a05]
|
|
32
|
+
- @contractspec/lib.contracts@1.57.0
|
|
33
|
+
- @contractspec/bundle.lifecycle-managed@1.57.0
|
|
34
|
+
- @contractspec/lib.lifecycle@1.57.0
|
|
35
|
+
- @contractspec/lib.logger@1.57.0
|
|
36
|
+
|
|
3
37
|
## 1.56.1
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
|
@@ -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
|
+
};
|
package/dist/demo.d.ts
CHANGED
package/dist/demo.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"demo.d.ts","
|
|
1
|
+
{"version":3,"file":"demo.d.ts","sourceRoot":"","sources":["../src/demo.ts"],"names":[],"mappings":"AAmBA,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAiDzD"}
|
package/dist/demo.js
CHANGED
|
@@ -1,49 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
|
10
17
|
});
|
|
11
18
|
async function runLifecycleCliDemo() {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
+
});
|
|
45
64
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
//# sourceMappingURL=demo.js.map
|
|
65
|
+
export {
|
|
66
|
+
runLifecycleCliDemo
|
|
67
|
+
};
|
package/dist/docs/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import './lifecycle-cli.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,0BAA0B,CAAC"}
|
package/dist/docs/index.js
CHANGED
|
@@ -1 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
// @bun
|
|
2
|
+
// src/docs/lifecycle-cli.docblock.ts
|
|
3
|
+
import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
|
|
4
|
+
var blocks = [
|
|
5
|
+
{
|
|
6
|
+
id: "docs.examples.lifecycle-cli",
|
|
7
|
+
title: "Lifecycle CLI (demo)",
|
|
8
|
+
summary: "Run a lifecycle assessment from a CLI using the lifecycle-managed bundle (no HTTP server required).",
|
|
9
|
+
kind: "reference",
|
|
10
|
+
visibility: "public",
|
|
11
|
+
route: "/docs/examples/lifecycle-cli",
|
|
12
|
+
tags: ["lifecycle", "cli", "example"],
|
|
13
|
+
body: `## What this example shows
|
|
14
|
+
- How to call \`LifecycleAssessmentService\` from a Node/Bun script.
|
|
15
|
+
- How to wire mock analytics + questionnaire adapters.
|
|
16
|
+
|
|
17
|
+
## Run
|
|
18
|
+
- Use the exported function \`runLifecycleCliDemo()\` (or call it from your own CLI wrapper).
|
|
19
|
+
|
|
20
|
+
## Notes
|
|
21
|
+
- Keep outputs structured; avoid \`console.log\` in production paths.
|
|
22
|
+
- This example is deterministic (fixed inputs \u2192 stable output).`
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: "docs.examples.lifecycle-cli.usage",
|
|
26
|
+
title: "Lifecycle CLI \u2014 Usage",
|
|
27
|
+
summary: "How to run and tweak the lifecycle assessment demo.",
|
|
28
|
+
kind: "usage",
|
|
29
|
+
visibility: "public",
|
|
30
|
+
route: "/docs/examples/lifecycle-cli/usage",
|
|
31
|
+
tags: ["lifecycle", "cli", "usage"],
|
|
32
|
+
body: `## Usage
|
|
33
|
+
1) Call \`runLifecycleCliDemo()\`.
|
|
34
|
+
2) Adjust the mock metrics/answers to explore stage outcomes.
|
|
35
|
+
|
|
36
|
+
## Guardrails
|
|
37
|
+
- Avoid PII in logs.
|
|
38
|
+
- Keep adapters explicit and deterministic for reproducible demos.`
|
|
39
|
+
}
|
|
40
|
+
];
|
|
41
|
+
registerDocBlocks(blocks);
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=lifecycle-cli.docblock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle-cli.docblock.d.ts","sourceRoot":"","sources":["../../src/docs/lifecycle-cli.docblock.ts"],"names":[],"mappings":""}
|