@lssm/module.lifecycle-core 0.0.0-canary-20251221193616 → 0.0.0-canary-20251223010757
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/adapters/analytics-adapter.d.ts +11 -7
- package/dist/adapters/analytics-adapter.d.ts.map +1 -1
- package/dist/adapters/intent-adapter.d.ts +9 -5
- package/dist/adapters/intent-adapter.d.ts.map +1 -1
- package/dist/adapters/questionnaire-adapter.d.ts +11 -7
- package/dist/adapters/questionnaire-adapter.d.ts.map +1 -1
- package/dist/collectors/signal-collector.d.ts +21 -17
- package/dist/collectors/signal-collector.d.ts.map +1 -1
- package/dist/collectors/signal-collector.js +65 -0
- package/dist/collectors/signal-collector.js.map +1 -0
- package/dist/data/milestones-catalog.js +74 -0
- package/dist/data/milestones-catalog.js.map +1 -0
- package/dist/data/stage-weights.js +170 -0
- package/dist/data/stage-weights.js.map +1 -0
- package/dist/index.d.ts +8 -8
- package/dist/index.js +6 -1
- package/dist/orchestrator/lifecycle-orchestrator.d.ts +19 -16
- package/dist/orchestrator/lifecycle-orchestrator.d.ts.map +1 -1
- package/dist/orchestrator/lifecycle-orchestrator.js +53 -0
- package/dist/orchestrator/lifecycle-orchestrator.js.map +1 -0
- package/dist/planning/milestone-planner.d.ts +9 -5
- package/dist/planning/milestone-planner.d.ts.map +1 -1
- package/dist/planning/milestone-planner.js +17 -0
- package/dist/planning/milestone-planner.js.map +1 -0
- package/dist/scoring/stage-scorer.d.ts +19 -18
- package/dist/scoring/stage-scorer.d.ts.map +1 -1
- package/dist/scoring/stage-scorer.js +64 -0
- package/dist/scoring/stage-scorer.js.map +1 -0
- package/package.json +6 -6
- package/dist/__tests__/stage-scorer.test.d.ts +0 -2
- package/dist/__tests__/stage-scorer.test.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { LifecycleAxes, LifecycleMetricSnapshot, LifecycleSignal } from "@lssm/lib.lifecycle";
|
|
2
|
+
|
|
3
|
+
//#region src/adapters/analytics-adapter.d.ts
|
|
4
|
+
interface AnalyticsAdapterResult {
|
|
5
|
+
metrics?: LifecycleMetricSnapshot;
|
|
6
|
+
signals?: LifecycleSignal[];
|
|
7
|
+
axes?: Partial<LifecycleAxes>;
|
|
6
8
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
interface AnalyticsAdapter {
|
|
10
|
+
fetch(): Promise<AnalyticsAdapterResult>;
|
|
9
11
|
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { AnalyticsAdapter, AnalyticsAdapterResult };
|
|
10
14
|
//# sourceMappingURL=analytics-adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics-adapter.d.ts","
|
|
1
|
+
{"version":3,"file":"analytics-adapter.d.ts","names":[],"sources":["../../src/adapters/analytics-adapter.ts"],"sourcesContent":[],"mappings":";;;UAMiB,sBAAA;YACL;EADK,OAAA,CAAA,EAEL,eAF2B,EAAA;EAC3B,IAAA,CAAA,EAEH,OAFG,CAEK,aAFL,CAAA;;AAEK,UAGA,gBAAA,CAHA;EAAR,KAAA,EAAA,EAIE,OAJF,CAIU,sBAJV,CAAA"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { LifecycleSignal } from "@lssm/lib.lifecycle";
|
|
2
|
+
|
|
3
|
+
//#region src/adapters/intent-adapter.d.ts
|
|
4
|
+
interface IntentAdapterResult {
|
|
5
|
+
signals?: LifecycleSignal[];
|
|
4
6
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
interface IntentAdapter {
|
|
8
|
+
fetch(): Promise<IntentAdapterResult>;
|
|
7
9
|
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { IntentAdapter, IntentAdapterResult };
|
|
8
12
|
//# sourceMappingURL=intent-adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intent-adapter.d.ts","
|
|
1
|
+
{"version":3,"file":"intent-adapter.d.ts","names":[],"sources":["../../src/adapters/intent-adapter.ts"],"sourcesContent":[],"mappings":";;;UAEiB,mBAAA;YACL;AADZ;AAIiB,UAAA,aAAA,CACE;WAAR,QAAQ"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { LifecycleAxes, LifecycleSignal } from "@lssm/lib.lifecycle";
|
|
2
|
+
|
|
3
|
+
//#region src/adapters/questionnaire-adapter.d.ts
|
|
4
|
+
interface QuestionnaireAdapterResult {
|
|
5
|
+
axes?: Partial<LifecycleAxes>;
|
|
6
|
+
signals?: LifecycleSignal[];
|
|
7
|
+
answers?: Record<string, unknown>;
|
|
6
8
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
interface QuestionnaireAdapter {
|
|
10
|
+
fetch(): Promise<QuestionnaireAdapterResult>;
|
|
9
11
|
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { QuestionnaireAdapter, QuestionnaireAdapterResult };
|
|
10
14
|
//# sourceMappingURL=questionnaire-adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"questionnaire-adapter.d.ts","
|
|
1
|
+
{"version":3,"file":"questionnaire-adapter.d.ts","names":[],"sources":["../../src/adapters/questionnaire-adapter.ts"],"sourcesContent":[],"mappings":";;;UAEiB,0BAAA;SACR,QAAQ;EADA,OAAA,CAAA,EAEL,eAFK,EAAA;EACA,OAAA,CAAA,EAEL,MAFK,CAAA,MAAA,EAAA,OAAA,CAAA;;AACL,UAIK,oBAAA,CAJL;EACA,KAAA,EAAA,EAID,OAJC,CAIO,0BAJP,CAAA"}
|
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { AnalyticsAdapter } from "../adapters/analytics-adapter.js";
|
|
2
|
+
import { QuestionnaireAdapter } from "../adapters/questionnaire-adapter.js";
|
|
3
|
+
import { IntentAdapter } from "../adapters/intent-adapter.js";
|
|
4
|
+
import { LifecycleAssessmentInput, LifecycleAxes, LifecycleMetricSnapshot, LifecycleSignal } from "@lssm/lib.lifecycle";
|
|
5
|
+
|
|
6
|
+
//#region src/collectors/signal-collector.d.ts
|
|
7
|
+
interface StageSignalCollectorOptions {
|
|
8
|
+
analyticsAdapter?: AnalyticsAdapter;
|
|
9
|
+
questionnaireAdapter?: QuestionnaireAdapter;
|
|
10
|
+
intentAdapter?: IntentAdapter;
|
|
9
11
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
interface StageSignalCollectorResult {
|
|
13
|
+
axes: LifecycleAxes;
|
|
14
|
+
metrics: LifecycleMetricSnapshot;
|
|
15
|
+
signals: LifecycleSignal[];
|
|
16
|
+
questionnaireAnswers?: Record<string, unknown>;
|
|
15
17
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
declare class StageSignalCollector {
|
|
19
|
+
private readonly options;
|
|
20
|
+
constructor(options: StageSignalCollectorOptions);
|
|
21
|
+
collect(input?: LifecycleAssessmentInput): Promise<StageSignalCollectorResult>;
|
|
20
22
|
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { StageSignalCollector, StageSignalCollectorOptions, StageSignalCollectorResult };
|
|
21
25
|
//# sourceMappingURL=signal-collector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signal-collector.d.ts","
|
|
1
|
+
{"version":3,"file":"signal-collector.d.ts","names":[],"sources":["../../src/collectors/signal-collector.ts"],"sourcesContent":[],"mappings":";;;;;;UAiBiB,2BAAA;qBACI;EADJ,oBAAA,CAAA,EAEQ,oBAFmB;EACvB,aAAA,CAAA,EAEH,aAFG;;AAEH,UAGD,0BAAA,CAHC;EAAa,IAAA,EAIvB,aAJuB;EAGd,OAAA,EAEN,uBAFgC;EACnC,OAAA,EAEG,eAFH,EAAA;EACG,oBAAA,CAAA,EAEc,MAFd,CAAA,MAAA,EAAA,OAAA,CAAA;;AAEc,cAGZ,oBAAA,CAHY;EAAM,iBAAA,OAAA;EAGlB,WAAA,CAAA,OAAA,EAGU,2BAHU;EAGV,OAAA,CAAA,KAAA,CAAA,EAKZ,wBALY,CAAA,EAMlB,OANkB,CAMV,0BANU,CAAA"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { CapitalPhase, CompanyPhase, ProductPhase } from "@lssm/lib.lifecycle";
|
|
2
|
+
|
|
3
|
+
//#region src/collectors/signal-collector.ts
|
|
4
|
+
const DEFAULT_AXES = {
|
|
5
|
+
product: ProductPhase.Sketch,
|
|
6
|
+
company: CompanyPhase.Solo,
|
|
7
|
+
capital: CapitalPhase.Bootstrapped
|
|
8
|
+
};
|
|
9
|
+
var StageSignalCollector = class {
|
|
10
|
+
options;
|
|
11
|
+
constructor(options) {
|
|
12
|
+
this.options = options;
|
|
13
|
+
}
|
|
14
|
+
async collect(input = {}) {
|
|
15
|
+
const axes = {
|
|
16
|
+
...DEFAULT_AXES,
|
|
17
|
+
...input.axes ?? {}
|
|
18
|
+
};
|
|
19
|
+
const metricsSnapshots = [];
|
|
20
|
+
const aggregatedSignals = [...input.signals ?? []];
|
|
21
|
+
const questionnaireAnswers = { ...input.questionnaireAnswers ?? {} };
|
|
22
|
+
if (input.metrics) metricsSnapshots.push(input.metrics);
|
|
23
|
+
if (this.options.analyticsAdapter) {
|
|
24
|
+
const result = await this.options.analyticsAdapter.fetch();
|
|
25
|
+
if (result.axes) Object.assign(axes, result.axes);
|
|
26
|
+
if (result.metrics) metricsSnapshots.push(result.metrics);
|
|
27
|
+
if (result.signals) aggregatedSignals.push(...result.signals);
|
|
28
|
+
}
|
|
29
|
+
if (this.options.questionnaireAdapter) {
|
|
30
|
+
const result = await this.options.questionnaireAdapter.fetch();
|
|
31
|
+
if (result.axes) Object.assign(axes, result.axes);
|
|
32
|
+
if (result.signals) aggregatedSignals.push(...result.signals);
|
|
33
|
+
Object.assign(questionnaireAnswers, result.answers);
|
|
34
|
+
}
|
|
35
|
+
if (this.options.intentAdapter) {
|
|
36
|
+
const result = await this.options.intentAdapter.fetch();
|
|
37
|
+
if (result.signals) aggregatedSignals.push(...result.signals);
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
axes,
|
|
41
|
+
metrics: mergeMetricSnapshots(metricsSnapshots),
|
|
42
|
+
signals: dedupeSignals(aggregatedSignals),
|
|
43
|
+
questionnaireAnswers: Object.keys(questionnaireAnswers).length ? questionnaireAnswers : void 0
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const mergeMetricSnapshots = (snapshots) => snapshots.reduce((acc, snapshot) => {
|
|
48
|
+
Object.entries(snapshot ?? {}).forEach(([key, value]) => {
|
|
49
|
+
if (value !== void 0 && value !== null) acc[key] = value;
|
|
50
|
+
});
|
|
51
|
+
return acc;
|
|
52
|
+
}, {});
|
|
53
|
+
const dedupeSignals = (signals) => {
|
|
54
|
+
const seen = /* @__PURE__ */ new Set();
|
|
55
|
+
return signals.filter((signal) => {
|
|
56
|
+
if (!signal.id) return true;
|
|
57
|
+
if (seen.has(signal.id)) return false;
|
|
58
|
+
seen.add(signal.id);
|
|
59
|
+
return true;
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
export { StageSignalCollector };
|
|
65
|
+
//# sourceMappingURL=signal-collector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signal-collector.js","names":["DEFAULT_AXES: LifecycleAxes","axes: LifecycleAxes","metricsSnapshots: LifecycleMetricSnapshot[]","aggregatedSignals: LifecycleSignal[]","questionnaireAnswers: Record<string, unknown>"],"sources":["../../src/collectors/signal-collector.ts"],"sourcesContent":["import type {\n LifecycleAssessmentInput,\n LifecycleAxes,\n LifecycleMetricSnapshot,\n LifecycleSignal,\n} from '@lssm/lib.lifecycle';\nimport { CapitalPhase, CompanyPhase, ProductPhase } from '@lssm/lib.lifecycle';\nimport type { AnalyticsAdapter } from '../adapters/analytics-adapter';\nimport type { QuestionnaireAdapter } from '../adapters/questionnaire-adapter';\nimport type { IntentAdapter } from '../adapters/intent-adapter';\n\nconst DEFAULT_AXES: LifecycleAxes = {\n product: ProductPhase.Sketch,\n company: CompanyPhase.Solo,\n capital: CapitalPhase.Bootstrapped,\n};\n\nexport interface StageSignalCollectorOptions {\n analyticsAdapter?: AnalyticsAdapter;\n questionnaireAdapter?: QuestionnaireAdapter;\n intentAdapter?: IntentAdapter;\n}\n\nexport interface StageSignalCollectorResult {\n axes: LifecycleAxes;\n metrics: LifecycleMetricSnapshot;\n signals: LifecycleSignal[];\n questionnaireAnswers?: Record<string, unknown>;\n}\n\nexport class StageSignalCollector {\n private readonly options: StageSignalCollectorOptions;\n\n constructor(options: StageSignalCollectorOptions) {\n this.options = options;\n }\n\n async collect(\n input: LifecycleAssessmentInput = {}\n ): Promise<StageSignalCollectorResult> {\n const axes: LifecycleAxes = {\n ...DEFAULT_AXES,\n ...(input.axes ?? {}),\n };\n const metricsSnapshots: LifecycleMetricSnapshot[] = [];\n const aggregatedSignals: LifecycleSignal[] = [...(input.signals ?? [])];\n const questionnaireAnswers: Record<string, unknown> = {\n ...(input.questionnaireAnswers ?? {}),\n };\n\n if (input.metrics) {\n metricsSnapshots.push(input.metrics);\n }\n\n if (this.options.analyticsAdapter) {\n const result = await this.options.analyticsAdapter.fetch();\n if (result.axes) Object.assign(axes, result.axes);\n if (result.metrics) metricsSnapshots.push(result.metrics);\n if (result.signals) aggregatedSignals.push(...result.signals);\n }\n\n if (this.options.questionnaireAdapter) {\n const result = await this.options.questionnaireAdapter.fetch();\n if (result.axes) Object.assign(axes, result.axes);\n if (result.signals) aggregatedSignals.push(...result.signals);\n Object.assign(questionnaireAnswers, result.answers);\n }\n\n if (this.options.intentAdapter) {\n const result = await this.options.intentAdapter.fetch();\n if (result.signals) aggregatedSignals.push(...result.signals);\n }\n\n const metrics = mergeMetricSnapshots(metricsSnapshots);\n\n return {\n axes,\n metrics,\n signals: dedupeSignals(aggregatedSignals),\n questionnaireAnswers: Object.keys(questionnaireAnswers).length\n ? questionnaireAnswers\n : undefined,\n };\n }\n}\n\nconst mergeMetricSnapshots = (\n snapshots: LifecycleMetricSnapshot[]\n): LifecycleMetricSnapshot =>\n snapshots.reduce<LifecycleMetricSnapshot>((acc, snapshot) => {\n Object.entries(snapshot ?? {}).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n acc[key as keyof LifecycleMetricSnapshot] = value as never;\n }\n });\n return acc;\n }, {});\n\nconst dedupeSignals = (signals: LifecycleSignal[]): LifecycleSignal[] => {\n const seen = new Set<string>();\n return signals.filter((signal) => {\n if (!signal.id) return true;\n if (seen.has(signal.id)) return false;\n seen.add(signal.id);\n return true;\n });\n};\n"],"mappings":";;;AAWA,MAAMA,eAA8B;CAClC,SAAS,aAAa;CACtB,SAAS,aAAa;CACtB,SAAS,aAAa;CACvB;AAeD,IAAa,uBAAb,MAAkC;CAChC,AAAiB;CAEjB,YAAY,SAAsC;AAChD,OAAK,UAAU;;CAGjB,MAAM,QACJ,QAAkC,EAAE,EACC;EACrC,MAAMC,OAAsB;GAC1B,GAAG;GACH,GAAI,MAAM,QAAQ,EAAE;GACrB;EACD,MAAMC,mBAA8C,EAAE;EACtD,MAAMC,oBAAuC,CAAC,GAAI,MAAM,WAAW,EAAE,CAAE;EACvE,MAAMC,uBAAgD,EACpD,GAAI,MAAM,wBAAwB,EAAE,EACrC;AAED,MAAI,MAAM,QACR,kBAAiB,KAAK,MAAM,QAAQ;AAGtC,MAAI,KAAK,QAAQ,kBAAkB;GACjC,MAAM,SAAS,MAAM,KAAK,QAAQ,iBAAiB,OAAO;AAC1D,OAAI,OAAO,KAAM,QAAO,OAAO,MAAM,OAAO,KAAK;AACjD,OAAI,OAAO,QAAS,kBAAiB,KAAK,OAAO,QAAQ;AACzD,OAAI,OAAO,QAAS,mBAAkB,KAAK,GAAG,OAAO,QAAQ;;AAG/D,MAAI,KAAK,QAAQ,sBAAsB;GACrC,MAAM,SAAS,MAAM,KAAK,QAAQ,qBAAqB,OAAO;AAC9D,OAAI,OAAO,KAAM,QAAO,OAAO,MAAM,OAAO,KAAK;AACjD,OAAI,OAAO,QAAS,mBAAkB,KAAK,GAAG,OAAO,QAAQ;AAC7D,UAAO,OAAO,sBAAsB,OAAO,QAAQ;;AAGrD,MAAI,KAAK,QAAQ,eAAe;GAC9B,MAAM,SAAS,MAAM,KAAK,QAAQ,cAAc,OAAO;AACvD,OAAI,OAAO,QAAS,mBAAkB,KAAK,GAAG,OAAO,QAAQ;;AAK/D,SAAO;GACL;GACA,SAJc,qBAAqB,iBAAiB;GAKpD,SAAS,cAAc,kBAAkB;GACzC,sBAAsB,OAAO,KAAK,qBAAqB,CAAC,SACpD,uBACA;GACL;;;AAIL,MAAM,wBACJ,cAEA,UAAU,QAAiC,KAAK,aAAa;AAC3D,QAAO,QAAQ,YAAY,EAAE,CAAC,CAAC,SAAS,CAAC,KAAK,WAAW;AACvD,MAAI,UAAU,UAAa,UAAU,KACnC,KAAI,OAAwC;GAE9C;AACF,QAAO;GACN,EAAE,CAAC;AAER,MAAM,iBAAiB,YAAkD;CACvE,MAAM,uBAAO,IAAI,KAAa;AAC9B,QAAO,QAAQ,QAAQ,WAAW;AAChC,MAAI,CAAC,OAAO,GAAI,QAAO;AACvB,MAAI,KAAK,IAAI,OAAO,GAAG,CAAE,QAAO;AAChC,OAAK,IAAI,OAAO,GAAG;AACnB,SAAO;GACP"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
//#region src/data/milestones-catalog.json
|
|
2
|
+
var milestones_catalog_default = [
|
|
3
|
+
{
|
|
4
|
+
"id": "stage0-problem-statement",
|
|
5
|
+
"stage": 0,
|
|
6
|
+
"category": "product",
|
|
7
|
+
"title": "Write the pain statement",
|
|
8
|
+
"description": "Capture the clearest description of the top problem in the customer’s own words.",
|
|
9
|
+
"priority": 1,
|
|
10
|
+
"actionItems": ["Interview at least 5 ideal customers", "Synthesize quotes into a one-page brief"]
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"id": "stage1-prototype-loop",
|
|
14
|
+
"stage": 1,
|
|
15
|
+
"category": "product",
|
|
16
|
+
"title": "Prototype feedback loop",
|
|
17
|
+
"description": "Ship a clickable prototype and gather 3 rounds of feedback.",
|
|
18
|
+
"priority": 2,
|
|
19
|
+
"actionItems": ["Create a low-fidelity prototype", "Schedule standing feedback calls"]
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"id": "stage2-activation",
|
|
23
|
+
"stage": 2,
|
|
24
|
+
"category": "operations",
|
|
25
|
+
"title": "Activation checklist",
|
|
26
|
+
"description": "Define the minimum steps required for a new user to succeed.",
|
|
27
|
+
"priority": 1,
|
|
28
|
+
"actionItems": ["Document onboarding flow", "Instrument activation analytics"]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"id": "stage3-retention-narrative",
|
|
32
|
+
"stage": 3,
|
|
33
|
+
"category": "product",
|
|
34
|
+
"title": "Retention narrative",
|
|
35
|
+
"description": "Create the before/after story that proves why users stay.",
|
|
36
|
+
"priority": 2,
|
|
37
|
+
"actionItems": ["Interview 3 retained users", "Publish a one-pager with concrete metrics"]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"id": "stage4-growth-loop",
|
|
41
|
+
"stage": 4,
|
|
42
|
+
"category": "growth",
|
|
43
|
+
"title": "Install a growth loop",
|
|
44
|
+
"description": "Stand up a repeatable acquisition → activation → referral motion.",
|
|
45
|
+
"priority": 1,
|
|
46
|
+
"actionItems": [
|
|
47
|
+
"Define loop metrics",
|
|
48
|
+
"Assign owners for each stage",
|
|
49
|
+
"Review weekly"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"id": "stage5-platform-blueprint",
|
|
54
|
+
"stage": 5,
|
|
55
|
+
"category": "product",
|
|
56
|
+
"title": "Platform blueprint",
|
|
57
|
+
"description": "Align on APIs, integrations, and governance for partners.",
|
|
58
|
+
"priority": 2,
|
|
59
|
+
"actionItems": ["Create integration scoring rubric", "Publish partner onboarding checklist"]
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"id": "stage6-renewal-ops",
|
|
63
|
+
"stage": 6,
|
|
64
|
+
"category": "operations",
|
|
65
|
+
"title": "Renewal operating rhythm",
|
|
66
|
+
"description": "Decide whether to optimize, reinvest, or sunset each major surface.",
|
|
67
|
+
"priority": 1,
|
|
68
|
+
"actionItems": ["Hold quarterly renewal review", "Document reinvestment bets"]
|
|
69
|
+
}
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
export { milestones_catalog_default as default };
|
|
74
|
+
//# sourceMappingURL=milestones-catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"milestones-catalog.js","names":[],"sources":["../../src/data/milestones-catalog.json"],"sourcesContent":[""],"mappings":""}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
//#region src/data/stage-weights.json
|
|
2
|
+
var stage_weights_default = {
|
|
3
|
+
Exploration: {
|
|
4
|
+
"base": .35,
|
|
5
|
+
"metrics": {
|
|
6
|
+
"activeUsers": {
|
|
7
|
+
"weight": -.3,
|
|
8
|
+
"direction": "lte",
|
|
9
|
+
"threshold": 5
|
|
10
|
+
},
|
|
11
|
+
"customerCount": {
|
|
12
|
+
"weight": -.2,
|
|
13
|
+
"direction": "lte",
|
|
14
|
+
"threshold": 3
|
|
15
|
+
},
|
|
16
|
+
"teamSize": {
|
|
17
|
+
"weight": -.1,
|
|
18
|
+
"direction": "lte",
|
|
19
|
+
"threshold": 3
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"signalKinds": {
|
|
23
|
+
"qualitative": .4,
|
|
24
|
+
"metric": .1
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
ProblemSolutionFit: {
|
|
28
|
+
"base": .4,
|
|
29
|
+
"metrics": {
|
|
30
|
+
"activeUsers": {
|
|
31
|
+
"weight": .2,
|
|
32
|
+
"direction": "gte",
|
|
33
|
+
"threshold": 5
|
|
34
|
+
},
|
|
35
|
+
"customerCount": {
|
|
36
|
+
"weight": .2,
|
|
37
|
+
"direction": "gte",
|
|
38
|
+
"threshold": 3
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"signalKinds": {
|
|
42
|
+
"qualitative": .3,
|
|
43
|
+
"event": .1
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
MvpEarlyTraction: {
|
|
47
|
+
"base": .45,
|
|
48
|
+
"metrics": {
|
|
49
|
+
"activeUsers": {
|
|
50
|
+
"weight": .25,
|
|
51
|
+
"direction": "gte",
|
|
52
|
+
"threshold": 25
|
|
53
|
+
},
|
|
54
|
+
"weeklyActiveUsers": {
|
|
55
|
+
"weight": .25,
|
|
56
|
+
"direction": "gte",
|
|
57
|
+
"threshold": 20
|
|
58
|
+
},
|
|
59
|
+
"retentionRate": {
|
|
60
|
+
"weight": .2,
|
|
61
|
+
"direction": "gte",
|
|
62
|
+
"threshold": .25
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"signalKinds": {
|
|
66
|
+
"metric": .15,
|
|
67
|
+
"event": .1
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
ProductMarketFit: {
|
|
71
|
+
"base": .5,
|
|
72
|
+
"metrics": {
|
|
73
|
+
"retentionRate": {
|
|
74
|
+
"weight": .35,
|
|
75
|
+
"direction": "gte",
|
|
76
|
+
"threshold": .45
|
|
77
|
+
},
|
|
78
|
+
"monthlyRecurringRevenue": {
|
|
79
|
+
"weight": .25,
|
|
80
|
+
"direction": "gte",
|
|
81
|
+
"threshold": 1e4
|
|
82
|
+
},
|
|
83
|
+
"customerCount": {
|
|
84
|
+
"weight": .2,
|
|
85
|
+
"direction": "gte",
|
|
86
|
+
"threshold": 30
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"signalKinds": {
|
|
90
|
+
"metric": .15,
|
|
91
|
+
"event": .1
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
GrowthScaleUp: {
|
|
95
|
+
"base": .55,
|
|
96
|
+
"metrics": {
|
|
97
|
+
"retentionRate": {
|
|
98
|
+
"weight": .2,
|
|
99
|
+
"direction": "gte",
|
|
100
|
+
"threshold": .55
|
|
101
|
+
},
|
|
102
|
+
"monthlyRecurringRevenue": {
|
|
103
|
+
"weight": .3,
|
|
104
|
+
"direction": "gte",
|
|
105
|
+
"threshold": 5e4
|
|
106
|
+
},
|
|
107
|
+
"teamSize": {
|
|
108
|
+
"weight": .15,
|
|
109
|
+
"direction": "gte",
|
|
110
|
+
"threshold": 15
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"signalKinds": {
|
|
114
|
+
"event": .2,
|
|
115
|
+
"metric": .15
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
ExpansionPlatform: {
|
|
119
|
+
"base": .6,
|
|
120
|
+
"metrics": {
|
|
121
|
+
"monthlyRecurringRevenue": {
|
|
122
|
+
"weight": .35,
|
|
123
|
+
"direction": "gte",
|
|
124
|
+
"threshold": 15e4
|
|
125
|
+
},
|
|
126
|
+
"customerCount": {
|
|
127
|
+
"weight": .2,
|
|
128
|
+
"direction": "gte",
|
|
129
|
+
"threshold": 100
|
|
130
|
+
},
|
|
131
|
+
"teamSize": {
|
|
132
|
+
"weight": .15,
|
|
133
|
+
"direction": "gte",
|
|
134
|
+
"threshold": 40
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"signalKinds": {
|
|
138
|
+
"event": .2,
|
|
139
|
+
"milestone": .1
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
MaturityRenewal: {
|
|
143
|
+
"base": .6,
|
|
144
|
+
"metrics": {
|
|
145
|
+
"monthlyRecurringRevenue": {
|
|
146
|
+
"weight": .25,
|
|
147
|
+
"direction": "gte",
|
|
148
|
+
"threshold": 25e4
|
|
149
|
+
},
|
|
150
|
+
"teamSize": {
|
|
151
|
+
"weight": .15,
|
|
152
|
+
"direction": "gte",
|
|
153
|
+
"threshold": 80
|
|
154
|
+
},
|
|
155
|
+
"burnMultiple": {
|
|
156
|
+
"weight": .2,
|
|
157
|
+
"direction": "lte",
|
|
158
|
+
"threshold": 1.5
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"signalKinds": {
|
|
162
|
+
"event": .2,
|
|
163
|
+
"milestone": .15
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
//#endregion
|
|
169
|
+
export { stage_weights_default as default };
|
|
170
|
+
//# sourceMappingURL=stage-weights.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stage-weights.js","names":[],"sources":["../../src/data/stage-weights.json"],"sourcesContent":[""],"mappings":""}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { AnalyticsAdapter, AnalyticsAdapterResult } from "./adapters/analytics-adapter.js";
|
|
2
|
+
import { QuestionnaireAdapter, QuestionnaireAdapterResult } from "./adapters/questionnaire-adapter.js";
|
|
3
|
+
import { IntentAdapter, IntentAdapterResult } from "./adapters/intent-adapter.js";
|
|
4
|
+
import { StageSignalCollector, StageSignalCollectorOptions, StageSignalCollectorResult } from "./collectors/signal-collector.js";
|
|
5
|
+
import { StageScoreInput, StageScorer } from "./scoring/stage-scorer.js";
|
|
6
|
+
import { LifecycleMilestonePlanner } from "./planning/milestone-planner.js";
|
|
7
|
+
import { LifecycleOrchestrator, LifecycleOrchestratorOptions } from "./orchestrator/lifecycle-orchestrator.js";
|
|
8
|
+
export { AnalyticsAdapter, AnalyticsAdapterResult, IntentAdapter, IntentAdapterResult, LifecycleMilestonePlanner, LifecycleOrchestrator, LifecycleOrchestratorOptions, QuestionnaireAdapter, QuestionnaireAdapterResult, StageScoreInput, StageScorer, StageSignalCollector, StageSignalCollectorOptions, StageSignalCollectorResult };
|
package/dist/index.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { StageSignalCollector } from "./collectors/signal-collector.js";
|
|
2
|
+
import { StageScorer } from "./scoring/stage-scorer.js";
|
|
3
|
+
import { LifecycleMilestonePlanner } from "./planning/milestone-planner.js";
|
|
4
|
+
import { LifecycleOrchestrator } from "./orchestrator/lifecycle-orchestrator.js";
|
|
5
|
+
|
|
6
|
+
export { LifecycleMilestonePlanner, LifecycleOrchestrator, StageScorer, StageSignalCollector };
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { StageSignalCollector } from "../collectors/signal-collector.js";
|
|
2
|
+
import { StageScorer } from "../scoring/stage-scorer.js";
|
|
3
|
+
import { LifecycleMilestonePlanner } from "../planning/milestone-planner.js";
|
|
4
|
+
import { LifecycleAssessment, LifecycleAssessmentInput, LifecycleMilestone, LifecycleStage } from "@lssm/lib.lifecycle";
|
|
5
|
+
|
|
6
|
+
//#region src/orchestrator/lifecycle-orchestrator.d.ts
|
|
7
|
+
interface LifecycleOrchestratorOptions {
|
|
8
|
+
collector: StageSignalCollector;
|
|
9
|
+
scorer: StageScorer;
|
|
10
|
+
milestonePlanner?: LifecycleMilestonePlanner;
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
declare class LifecycleOrchestrator {
|
|
13
|
+
private readonly collector;
|
|
14
|
+
private readonly scorer;
|
|
15
|
+
private readonly planner?;
|
|
16
|
+
constructor(options: LifecycleOrchestratorOptions);
|
|
17
|
+
run(input?: LifecycleAssessmentInput): Promise<LifecycleAssessment>;
|
|
18
|
+
getUpcomingMilestones(stage: LifecycleStage, completedMilestoneIds?: string[], limit?: number): LifecycleMilestone[];
|
|
18
19
|
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { LifecycleOrchestrator, LifecycleOrchestratorOptions };
|
|
19
22
|
//# sourceMappingURL=lifecycle-orchestrator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle-orchestrator.d.ts","
|
|
1
|
+
{"version":3,"file":"lifecycle-orchestrator.d.ts","names":[],"sources":["../../src/orchestrator/lifecycle-orchestrator.ts"],"sourcesContent":[],"mappings":";;;;;;UAWiB,4BAAA;EAAA,SAAA,EACJ,oBADgC;EAChC,MAAA,EACH,WADG;EACH,gBAAA,CAAA,EACW,yBADX;;AACoC,cAGjC,qBAAA,CAHiC;EAGjC,iBAAA,SAAqB;EAKX,iBAAA,MAAA;EAMH,iBAAA,OAAA;EAAmC,WAAA,CAAA,OAAA,EANhC,4BAMgC;EAAR,GAAA,CAAA,KAAA,CAAA,EAA3B,wBAA2B,CAAA,EAAA,OAAA,CAAQ,mBAAR,CAAA;EAuBpC,qBAAA,CAAA,KAAA,EAAA,cAAA,EAAA,qBAAA,CAAA,EAAA,MAAA,EAAA,EAAA,KAAA,CAAA,EAAA,MAAA,CAAA,EAGN,kBAHM,EAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import "../collectors/signal-collector.js";
|
|
2
|
+
import "../scoring/stage-scorer.js";
|
|
3
|
+
import { LIFECYCLE_STAGE_META, LifecycleStage } from "@lssm/lib.lifecycle";
|
|
4
|
+
|
|
5
|
+
//#region src/orchestrator/lifecycle-orchestrator.ts
|
|
6
|
+
var LifecycleOrchestrator = class {
|
|
7
|
+
collector;
|
|
8
|
+
scorer;
|
|
9
|
+
planner;
|
|
10
|
+
constructor(options) {
|
|
11
|
+
this.collector = options.collector;
|
|
12
|
+
this.scorer = options.scorer;
|
|
13
|
+
this.planner = options.milestonePlanner;
|
|
14
|
+
}
|
|
15
|
+
async run(input) {
|
|
16
|
+
const collected = await this.collector.collect(input);
|
|
17
|
+
const scorecard = this.scorer.score({
|
|
18
|
+
metrics: collected.metrics,
|
|
19
|
+
signals: collected.signals
|
|
20
|
+
});
|
|
21
|
+
const top = scorecard[0] ?? fallbackScore();
|
|
22
|
+
const meta = LIFECYCLE_STAGE_META[top.stage];
|
|
23
|
+
return {
|
|
24
|
+
stage: top.stage,
|
|
25
|
+
confidence: top.confidence,
|
|
26
|
+
axes: collected.axes,
|
|
27
|
+
signals: collected.signals,
|
|
28
|
+
metrics: toMetricRecord(collected.metrics),
|
|
29
|
+
gaps: meta.focusAreas.slice(0, 3),
|
|
30
|
+
focusAreas: meta.focusAreas,
|
|
31
|
+
scorecard,
|
|
32
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
getUpcomingMilestones(stage, completedMilestoneIds = [], limit = 5) {
|
|
36
|
+
if (!this.planner) return [];
|
|
37
|
+
return this.planner.getUpcoming(stage, completedMilestoneIds, limit);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const fallbackScore = () => ({
|
|
41
|
+
stage: LifecycleStage.Exploration,
|
|
42
|
+
score: .3,
|
|
43
|
+
confidence: .3,
|
|
44
|
+
supportingSignals: []
|
|
45
|
+
});
|
|
46
|
+
const toMetricRecord = (snapshot) => Object.entries(snapshot ?? {}).reduce((acc, [key, value]) => {
|
|
47
|
+
if (typeof value === "number") acc[key] = value;
|
|
48
|
+
return acc;
|
|
49
|
+
}, {});
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
export { LifecycleOrchestrator };
|
|
53
|
+
//# sourceMappingURL=lifecycle-orchestrator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle-orchestrator.js","names":[],"sources":["../../src/orchestrator/lifecycle-orchestrator.ts"],"sourcesContent":["import type {\n LifecycleAssessment,\n LifecycleAssessmentInput,\n LifecycleMilestone,\n LifecycleMetricSnapshot,\n} from '@lssm/lib.lifecycle';\nimport { LIFECYCLE_STAGE_META, LifecycleStage } from '@lssm/lib.lifecycle';\nimport { StageSignalCollector } from '../collectors/signal-collector';\nimport { StageScorer } from '../scoring/stage-scorer';\nimport { LifecycleMilestonePlanner } from '../planning/milestone-planner';\n\nexport interface LifecycleOrchestratorOptions {\n collector: StageSignalCollector;\n scorer: StageScorer;\n milestonePlanner?: LifecycleMilestonePlanner;\n}\n\nexport class LifecycleOrchestrator {\n private readonly collector: StageSignalCollector;\n private readonly scorer: StageScorer;\n private readonly planner?: LifecycleMilestonePlanner;\n\n constructor(options: LifecycleOrchestratorOptions) {\n this.collector = options.collector;\n this.scorer = options.scorer;\n this.planner = options.milestonePlanner;\n }\n\n async run(input?: LifecycleAssessmentInput): Promise<LifecycleAssessment> {\n const collected = await this.collector.collect(input);\n const scorecard = this.scorer.score({\n metrics: collected.metrics,\n signals: collected.signals,\n });\n const top = scorecard[0] ?? fallbackScore();\n const meta = LIFECYCLE_STAGE_META[top.stage];\n\n return {\n stage: top.stage,\n confidence: top.confidence,\n axes: collected.axes,\n signals: collected.signals,\n metrics: toMetricRecord(collected.metrics),\n gaps: meta.focusAreas.slice(0, 3),\n focusAreas: meta.focusAreas,\n scorecard,\n generatedAt: new Date().toISOString(),\n };\n }\n\n getUpcomingMilestones(\n stage: LifecycleStage,\n completedMilestoneIds: string[] = [],\n limit = 5\n ): LifecycleMilestone[] {\n if (!this.planner) return [];\n return this.planner.getUpcoming(stage, completedMilestoneIds, limit);\n }\n}\n\nconst fallbackScore = () => ({\n stage: LifecycleStage.Exploration,\n score: 0.3,\n confidence: 0.3,\n supportingSignals: [],\n});\n\nconst toMetricRecord = (\n snapshot: LifecycleMetricSnapshot\n): Record<string, number | undefined> =>\n Object.entries(snapshot ?? {}).reduce<Record<string, number | undefined>>(\n (acc, [key, value]) => {\n if (typeof value === 'number') {\n acc[key] = value;\n }\n return acc;\n },\n {}\n );\n"],"mappings":";;;;;AAiBA,IAAa,wBAAb,MAAmC;CACjC,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CAEjB,YAAY,SAAuC;AACjD,OAAK,YAAY,QAAQ;AACzB,OAAK,SAAS,QAAQ;AACtB,OAAK,UAAU,QAAQ;;CAGzB,MAAM,IAAI,OAAgE;EACxE,MAAM,YAAY,MAAM,KAAK,UAAU,QAAQ,MAAM;EACrD,MAAM,YAAY,KAAK,OAAO,MAAM;GAClC,SAAS,UAAU;GACnB,SAAS,UAAU;GACpB,CAAC;EACF,MAAM,MAAM,UAAU,MAAM,eAAe;EAC3C,MAAM,OAAO,qBAAqB,IAAI;AAEtC,SAAO;GACL,OAAO,IAAI;GACX,YAAY,IAAI;GAChB,MAAM,UAAU;GAChB,SAAS,UAAU;GACnB,SAAS,eAAe,UAAU,QAAQ;GAC1C,MAAM,KAAK,WAAW,MAAM,GAAG,EAAE;GACjC,YAAY,KAAK;GACjB;GACA,8BAAa,IAAI,MAAM,EAAC,aAAa;GACtC;;CAGH,sBACE,OACA,wBAAkC,EAAE,EACpC,QAAQ,GACc;AACtB,MAAI,CAAC,KAAK,QAAS,QAAO,EAAE;AAC5B,SAAO,KAAK,QAAQ,YAAY,OAAO,uBAAuB,MAAM;;;AAIxE,MAAM,uBAAuB;CAC3B,OAAO,eAAe;CACtB,OAAO;CACP,YAAY;CACZ,mBAAmB,EAAE;CACtB;AAED,MAAM,kBACJ,aAEA,OAAO,QAAQ,YAAY,EAAE,CAAC,CAAC,QAC5B,KAAK,CAAC,KAAK,WAAW;AACrB,KAAI,OAAO,UAAU,SACnB,KAAI,OAAO;AAEb,QAAO;GAET,EAAE,CACH"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { LifecycleMilestone, LifecycleStage } from "@lssm/lib.lifecycle";
|
|
2
|
+
|
|
3
|
+
//#region src/planning/milestone-planner.d.ts
|
|
4
|
+
declare class LifecycleMilestonePlanner {
|
|
5
|
+
private readonly milestones;
|
|
6
|
+
constructor(customCatalog?: LifecycleMilestone[]);
|
|
7
|
+
getUpcoming(stage: LifecycleStage, completedIds?: string[], limit?: number): LifecycleMilestone[];
|
|
6
8
|
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { LifecycleMilestonePlanner };
|
|
7
11
|
//# sourceMappingURL=milestone-planner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"milestone-planner.d.ts","
|
|
1
|
+
{"version":3,"file":"milestone-planner.d.ts","names":[],"sources":["../../src/planning/milestone-planner.ts"],"sourcesContent":[],"mappings":";;;cAGa,yBAAA;;EAAA,WAAA,CAAA,aAAyB,CAAzB,EAGiB,kBAHQ,EAAA;EAGR,WAAA,CAAA,KAAA,EAKnB,cALmB,EAAA,YAAA,CAAA,EAAA,MAAA,EAAA,EAAA,KAAA,CAAA,EAAA,MAAA,CAAA,EAQzB,kBARyB,EAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import milestones_catalog_default from "../data/milestones-catalog.js";
|
|
2
|
+
|
|
3
|
+
//#region src/planning/milestone-planner.ts
|
|
4
|
+
var LifecycleMilestonePlanner = class {
|
|
5
|
+
milestones;
|
|
6
|
+
constructor(customCatalog) {
|
|
7
|
+
this.milestones = customCatalog ?? milestones_catalog_default;
|
|
8
|
+
}
|
|
9
|
+
getUpcoming(stage, completedIds = [], limit = 5) {
|
|
10
|
+
const completedSet = new Set(completedIds);
|
|
11
|
+
return this.milestones.filter((milestone) => milestone.stage === stage && !completedSet.has(milestone.id)).sort((a, b) => a.priority - b.priority).slice(0, limit);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { LifecycleMilestonePlanner };
|
|
17
|
+
//# sourceMappingURL=milestone-planner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"milestone-planner.js","names":["catalog"],"sources":["../../src/planning/milestone-planner.ts"],"sourcesContent":["import type { LifecycleMilestone, LifecycleStage } from '@lssm/lib.lifecycle';\nimport catalog from '../data/milestones-catalog.json' assert { type: 'json' };\n\nexport class LifecycleMilestonePlanner {\n private readonly milestones: LifecycleMilestone[];\n\n constructor(customCatalog?: LifecycleMilestone[]) {\n this.milestones = customCatalog ?? (catalog as LifecycleMilestone[]);\n }\n\n getUpcoming(\n stage: LifecycleStage,\n completedIds: string[] = [],\n limit = 5\n ): LifecycleMilestone[] {\n const completedSet = new Set(completedIds);\n return this.milestones\n .filter(\n (milestone) =>\n milestone.stage === stage && !completedSet.has(milestone.id)\n )\n .sort((a, b) => a.priority - b.priority)\n .slice(0, limit);\n }\n}\n"],"mappings":";;;AAGA,IAAa,4BAAb,MAAuC;CACrC,AAAiB;CAEjB,YAAY,eAAsC;AAChD,OAAK,aAAa,iBAAkBA;;CAGtC,YACE,OACA,eAAyB,EAAE,EAC3B,QAAQ,GACc;EACtB,MAAM,eAAe,IAAI,IAAI,aAAa;AAC1C,SAAO,KAAK,WACT,QACE,cACC,UAAU,UAAU,SAAS,CAAC,aAAa,IAAI,UAAU,GAAG,CAC/D,CACA,MAAM,GAAG,MAAM,EAAE,WAAW,EAAE,SAAS,CACvC,MAAM,GAAG,MAAM"}
|
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}[keyof LifecycleMetricSnapshot], string>;
|
|
1
|
+
import { LifecycleMetricSnapshot, LifecycleScore, LifecycleSignal } from "@lssm/lib.lifecycle";
|
|
2
|
+
|
|
3
|
+
//#region src/scoring/stage-scorer.d.ts
|
|
4
|
+
type NumericMetricKey = Extract<{ [Key in keyof LifecycleMetricSnapshot]: LifecycleMetricSnapshot[Key] extends number | undefined ? Key : never }[keyof LifecycleMetricSnapshot], string>;
|
|
5
5
|
interface MetricWeightConfig {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
weight: number;
|
|
7
|
+
threshold: number;
|
|
8
|
+
direction?: 'gte' | 'lte';
|
|
9
9
|
}
|
|
10
10
|
interface StageWeightConfig {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
base: number;
|
|
12
|
+
metrics?: Partial<Record<NumericMetricKey, MetricWeightConfig>>;
|
|
13
|
+
signalKinds?: Partial<Record<string, number>>;
|
|
14
14
|
}
|
|
15
15
|
type StageWeights = Record<string, StageWeightConfig>;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
interface StageScoreInput {
|
|
17
|
+
metrics: LifecycleMetricSnapshot;
|
|
18
|
+
signals: LifecycleSignal[];
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
declare class StageScorer {
|
|
21
|
+
private readonly weights;
|
|
22
|
+
constructor(weights?: StageWeights);
|
|
23
|
+
score(input: StageScoreInput): LifecycleScore[];
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
//#endregion
|
|
26
|
+
export { StageScoreInput, StageScorer };
|
|
26
27
|
//# sourceMappingURL=stage-scorer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stage-scorer.d.ts","
|
|
1
|
+
{"version":3,"file":"stage-scorer.d.ts","names":[],"sources":["../../src/scoring/stage-scorer.ts"],"sourcesContent":[],"mappings":";;;KAQK,gBAAA,GAAmB,wBAEN,0BAA0B,wBAAwB,kCAG5D,aATqB,CAAA,MAWnB,uBAPW,CAAA,EAAA,MAAA,CAAA;UAWX,kBAAA,CATQ;EAA0B,MAAA,EAAA,MAAA;EAAwB,SAAA,EAAA,MAAA;EAG5D,SAAA,CAAA,EAAA,KAAA,GAAA,KAAA;;UAYE,iBAAA,CAjBc;EAAO,IAAA,EAAA,MAAA;EAWrB,OAAA,CAAA,EAQE,OARF,CAQU,MARQ,CAQD,gBARC,EAQiB,kBARjB,CAAA,CAAA;EAMlB,WAAA,CAAA,EAGM,OAHW,CAGH,MAHG,CAAA,MAAA,EAAA,MAAA,CAAA,CAAA;;KAMtB,YAAA,GAAe,MAJyB,CAAA,MAAA,EAIV,iBAJU,CAAA;AAAzB,UAQH,eAAA,CARG;EAAR,OAAA,EASD,uBATC;EACY,OAAA,EASb,eATa,EAAA;;AAAD,cAYV,WAAA,CAZU;EAGlB,iBAAY,OAAA;EAIA,WAAA,CAAA,OACN,CADqB,EAQT,YAPZ;EAIE,KAAA,CAAA,KAAA,EAOE,eAPS,CAAA,EAOS,cAPT,EAAA"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import stage_weights_default from "../data/stage-weights.js";
|
|
2
|
+
import { LIFECYCLE_STAGE_META, LifecycleStage } from "@lssm/lib.lifecycle";
|
|
3
|
+
|
|
4
|
+
//#region src/scoring/stage-scorer.ts
|
|
5
|
+
const DEFAULT_WEIGHTS = stage_weights_default;
|
|
6
|
+
var StageScorer = class {
|
|
7
|
+
weights;
|
|
8
|
+
constructor(weights = DEFAULT_WEIGHTS) {
|
|
9
|
+
this.weights = weights;
|
|
10
|
+
}
|
|
11
|
+
score(input) {
|
|
12
|
+
const kindStrength = evaluateSignalKinds(input.signals);
|
|
13
|
+
return Object.values(LifecycleStage).filter(isStageValue).map((stage) => {
|
|
14
|
+
const stageName = LifecycleStage[stage];
|
|
15
|
+
const config = this.weights[stageName] ?? { base: .5 };
|
|
16
|
+
let score = config.base ?? .5;
|
|
17
|
+
let contributions = 0;
|
|
18
|
+
const totalPossible = Object.keys(config.metrics ?? {}).length + Object.keys(config.signalKinds ?? {}).length || 1;
|
|
19
|
+
const supportingSignals = [];
|
|
20
|
+
if (config.metrics) Object.entries(config.metrics).forEach(([metricKey, metricConfig]) => {
|
|
21
|
+
const value = input.metrics[metricKey];
|
|
22
|
+
if (value === void 0 || value === null) return;
|
|
23
|
+
if (passesThreshold(value, metricConfig)) {
|
|
24
|
+
score += metricConfig.weight;
|
|
25
|
+
contributions += 1;
|
|
26
|
+
supportingSignals.push(`metric:${metricKey}`);
|
|
27
|
+
} else score += metricConfig.weight * .25;
|
|
28
|
+
});
|
|
29
|
+
if (config.signalKinds) Object.entries(config.signalKinds).forEach(([kind, weight]) => {
|
|
30
|
+
if ((kindStrength[kind] ?? 0) > 0 && typeof weight === "number") {
|
|
31
|
+
score += weight;
|
|
32
|
+
contributions += 1;
|
|
33
|
+
supportingSignals.push(`signal:${kind}`);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
score = clamp(score, 0, 1.25);
|
|
37
|
+
const confidence = clamp(contributions / totalPossible, .1, 1);
|
|
38
|
+
return {
|
|
39
|
+
stage,
|
|
40
|
+
score,
|
|
41
|
+
confidence,
|
|
42
|
+
supportingSignals
|
|
43
|
+
};
|
|
44
|
+
}).sort((a, b) => {
|
|
45
|
+
if (b.score === a.score) return b.confidence - a.confidence;
|
|
46
|
+
return b.score - a.score;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const passesThreshold = (value, config) => {
|
|
51
|
+
if ((config.direction ?? "gte") === "gte") return value >= config.threshold;
|
|
52
|
+
return value <= config.threshold;
|
|
53
|
+
};
|
|
54
|
+
const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
55
|
+
const evaluateSignalKinds = (signals) => signals.reduce((acc, signal) => {
|
|
56
|
+
const key = signal.kind ?? "unknown";
|
|
57
|
+
acc[key] = (acc[key] ?? 0) + (signal.weight ?? 1);
|
|
58
|
+
return acc;
|
|
59
|
+
}, {});
|
|
60
|
+
const isStageValue = (value) => typeof value === "number" && value in LIFECYCLE_STAGE_META;
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
export { StageScorer };
|
|
64
|
+
//# sourceMappingURL=stage-scorer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stage-scorer.js","names":["stageWeights","supportingSignals: string[]"],"sources":["../../src/scoring/stage-scorer.ts"],"sourcesContent":["import type {\n LifecycleMetricSnapshot,\n LifecycleScore,\n LifecycleSignal,\n} from '@lssm/lib.lifecycle';\nimport { LIFECYCLE_STAGE_META, LifecycleStage } from '@lssm/lib.lifecycle';\nimport stageWeights from '../data/stage-weights.json' assert { type: 'json' };\n\ntype NumericMetricKey = Extract<\n {\n [Key in keyof LifecycleMetricSnapshot]: LifecycleMetricSnapshot[Key] extends\n | number\n | undefined\n ? Key\n : never;\n }[keyof LifecycleMetricSnapshot],\n string\n>;\n\ninterface MetricWeightConfig {\n weight: number;\n threshold: number;\n direction?: 'gte' | 'lte';\n}\n\ninterface StageWeightConfig {\n base: number;\n metrics?: Partial<Record<NumericMetricKey, MetricWeightConfig>>;\n signalKinds?: Partial<Record<string, number>>;\n}\n\ntype StageWeights = Record<string, StageWeightConfig>;\n\nconst DEFAULT_WEIGHTS = stageWeights as StageWeights;\n\nexport interface StageScoreInput {\n metrics: LifecycleMetricSnapshot;\n signals: LifecycleSignal[];\n}\n\nexport class StageScorer {\n private readonly weights: StageWeights;\n\n constructor(weights: StageWeights = DEFAULT_WEIGHTS) {\n this.weights = weights;\n }\n\n score(input: StageScoreInput): LifecycleScore[] {\n const kindStrength = evaluateSignalKinds(input.signals);\n\n const scores = Object.values(LifecycleStage)\n .filter(isStageValue)\n .map((stage) => {\n const stageName = LifecycleStage[stage];\n const config = this.weights[stageName] ?? { base: 0.5 };\n let score = config.base ?? 0.5;\n let contributions = 0;\n const totalPossible =\n Object.keys(config.metrics ?? {}).length +\n Object.keys(config.signalKinds ?? {}).length || 1;\n const supportingSignals: string[] = [];\n\n if (config.metrics) {\n Object.entries(config.metrics).forEach(\n ([metricKey, metricConfig]) => {\n const value = input.metrics[metricKey as NumericMetricKey];\n if (value === undefined || value === null) return;\n if (passesThreshold(value, metricConfig)) {\n score += metricConfig.weight;\n contributions += 1;\n supportingSignals.push(`metric:${metricKey}`);\n } else {\n score += metricConfig.weight * 0.25;\n }\n }\n );\n }\n\n if (config.signalKinds) {\n Object.entries(config.signalKinds).forEach(([kind, weight]) => {\n const strength = kindStrength[kind] ?? 0;\n if (strength > 0 && typeof weight === 'number') {\n score += weight;\n contributions += 1;\n supportingSignals.push(`signal:${kind}`);\n }\n });\n }\n\n score = clamp(score, 0, 1.25); // allow slight overage before clamp\n const confidence = clamp(contributions / totalPossible, 0.1, 1);\n\n return {\n stage,\n score,\n confidence,\n supportingSignals,\n };\n });\n\n return scores.sort((a, b) => {\n if (b.score === a.score) {\n return b.confidence - a.confidence;\n }\n return b.score - a.score;\n });\n }\n}\n\nconst passesThreshold = (\n value: number,\n config: MetricWeightConfig\n): boolean => {\n const direction = config.direction ?? 'gte';\n if (direction === 'gte') {\n return value >= config.threshold;\n }\n return value <= config.threshold;\n};\n\nconst clamp = (value: number, min: number, max: number): number =>\n Math.min(Math.max(value, min), max);\n\nconst evaluateSignalKinds = (\n signals: LifecycleSignal[]\n): Record<string, number> =>\n signals.reduce<Record<string, number>>((acc, signal) => {\n const key = signal.kind ?? 'unknown';\n acc[key] = (acc[key] ?? 0) + (signal.weight ?? 1);\n return acc;\n }, {});\n\nconst isStageValue = (\n value: string | LifecycleStage\n): value is LifecycleStage =>\n typeof value === 'number' && value in LIFECYCLE_STAGE_META;\n"],"mappings":";;;;AAiCA,MAAM,kBAAkBA;AAOxB,IAAa,cAAb,MAAyB;CACvB,AAAiB;CAEjB,YAAY,UAAwB,iBAAiB;AACnD,OAAK,UAAU;;CAGjB,MAAM,OAA0C;EAC9C,MAAM,eAAe,oBAAoB,MAAM,QAAQ;AAoDvD,SAlDe,OAAO,OAAO,eAAe,CACzC,OAAO,aAAa,CACpB,KAAK,UAAU;GACd,MAAM,YAAY,eAAe;GACjC,MAAM,SAAS,KAAK,QAAQ,cAAc,EAAE,MAAM,IAAK;GACvD,IAAI,QAAQ,OAAO,QAAQ;GAC3B,IAAI,gBAAgB;GACpB,MAAM,gBACJ,OAAO,KAAK,OAAO,WAAW,EAAE,CAAC,CAAC,SAChC,OAAO,KAAK,OAAO,eAAe,EAAE,CAAC,CAAC,UAAU;GACpD,MAAMC,oBAA8B,EAAE;AAEtC,OAAI,OAAO,QACT,QAAO,QAAQ,OAAO,QAAQ,CAAC,SAC5B,CAAC,WAAW,kBAAkB;IAC7B,MAAM,QAAQ,MAAM,QAAQ;AAC5B,QAAI,UAAU,UAAa,UAAU,KAAM;AAC3C,QAAI,gBAAgB,OAAO,aAAa,EAAE;AACxC,cAAS,aAAa;AACtB,sBAAiB;AACjB,uBAAkB,KAAK,UAAU,YAAY;UAE7C,UAAS,aAAa,SAAS;KAGpC;AAGH,OAAI,OAAO,YACT,QAAO,QAAQ,OAAO,YAAY,CAAC,SAAS,CAAC,MAAM,YAAY;AAE7D,SADiB,aAAa,SAAS,KACxB,KAAK,OAAO,WAAW,UAAU;AAC9C,cAAS;AACT,sBAAiB;AACjB,uBAAkB,KAAK,UAAU,OAAO;;KAE1C;AAGJ,WAAQ,MAAM,OAAO,GAAG,KAAK;GAC7B,MAAM,aAAa,MAAM,gBAAgB,eAAe,IAAK,EAAE;AAE/D,UAAO;IACL;IACA;IACA;IACA;IACD;IACD,CAEU,MAAM,GAAG,MAAM;AAC3B,OAAI,EAAE,UAAU,EAAE,MAChB,QAAO,EAAE,aAAa,EAAE;AAE1B,UAAO,EAAE,QAAQ,EAAE;IACnB;;;AAIN,MAAM,mBACJ,OACA,WACY;AAEZ,MADkB,OAAO,aAAa,WACpB,MAChB,QAAO,SAAS,OAAO;AAEzB,QAAO,SAAS,OAAO;;AAGzB,MAAM,SAAS,OAAe,KAAa,QACzC,KAAK,IAAI,KAAK,IAAI,OAAO,IAAI,EAAE,IAAI;AAErC,MAAM,uBACJ,YAEA,QAAQ,QAAgC,KAAK,WAAW;CACtD,MAAM,MAAM,OAAO,QAAQ;AAC3B,KAAI,QAAQ,IAAI,QAAQ,MAAM,OAAO,UAAU;AAC/C,QAAO;GACN,EAAE,CAAC;AAER,MAAM,gBACJ,UAEA,OAAO,UAAU,YAAY,SAAS"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lssm/module.lifecycle-core",
|
|
3
|
-
"version": "0.0.0-canary-
|
|
3
|
+
"version": "0.0.0-canary-20251223010757",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
|
|
15
15
|
"publish:pkg:canary": "bun publish:pkg --tag canary",
|
|
16
16
|
"build": "bun build:types && bun build:bundle",
|
|
17
|
-
"build:bundle": "
|
|
18
|
-
"build:types": "tsc --
|
|
17
|
+
"build:bundle": "tsdown",
|
|
18
|
+
"build:types": "tsc --noEmit",
|
|
19
19
|
"dev": "bun build:bundle --watch",
|
|
20
20
|
"clean": "rimraf dist .turbo",
|
|
21
21
|
"lint": "bun lint:fix",
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"test": "bun run"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@lssm/lib.lifecycle": "0.0.0-canary-
|
|
27
|
+
"@lssm/lib.lifecycle": "0.0.0-canary-20251223010757"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@lssm/tool.tsdown": "0.0.0-canary-
|
|
31
|
-
"@lssm/tool.typescript": "0.0.0-canary-
|
|
30
|
+
"@lssm/tool.tsdown": "0.0.0-canary-20251223010757",
|
|
31
|
+
"@lssm/tool.typescript": "0.0.0-canary-20251223010757",
|
|
32
32
|
"tsdown": "^0.18.1",
|
|
33
33
|
"typescript": "^5.9.3"
|
|
34
34
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stage-scorer.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/stage-scorer.test.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uCAAuC,CAAC;AACtD,cAAc,8BAA8B,CAAC"}
|