@lssm/module.lifecycle-core 1.41.1 → 1.42.1

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.
Files changed (31) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +13 -0
  3. package/dist/adapters/analytics-adapter.d.ts +14 -0
  4. package/dist/adapters/analytics-adapter.d.ts.map +1 -0
  5. package/dist/adapters/intent-adapter.d.ts +12 -0
  6. package/dist/adapters/intent-adapter.d.ts.map +1 -0
  7. package/dist/adapters/questionnaire-adapter.d.ts +14 -0
  8. package/dist/adapters/questionnaire-adapter.d.ts.map +1 -0
  9. package/dist/collectors/signal-collector.d.ts +25 -0
  10. package/dist/collectors/signal-collector.d.ts.map +1 -0
  11. package/dist/collectors/signal-collector.js +65 -1
  12. package/dist/collectors/signal-collector.js.map +1 -0
  13. package/dist/data/milestones-catalog.js +74 -1
  14. package/dist/data/milestones-catalog.js.map +1 -0
  15. package/dist/data/stage-weights.js +170 -1
  16. package/dist/data/stage-weights.js.map +1 -0
  17. package/dist/index.d.ts +8 -0
  18. package/dist/index.js +6 -1
  19. package/dist/orchestrator/lifecycle-orchestrator.d.ts +22 -0
  20. package/dist/orchestrator/lifecycle-orchestrator.d.ts.map +1 -0
  21. package/dist/orchestrator/lifecycle-orchestrator.js +53 -1
  22. package/dist/orchestrator/lifecycle-orchestrator.js.map +1 -0
  23. package/dist/planning/milestone-planner.d.ts +11 -0
  24. package/dist/planning/milestone-planner.d.ts.map +1 -0
  25. package/dist/planning/milestone-planner.js +17 -1
  26. package/dist/planning/milestone-planner.js.map +1 -0
  27. package/dist/scoring/stage-scorer.d.ts +27 -0
  28. package/dist/scoring/stage-scorer.d.ts.map +1 -0
  29. package/dist/scoring/stage-scorer.js +64 -1
  30. package/dist/scoring/stage-scorer.js.map +1 -0
  31. package/package.json +15 -8
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 CHANGED
@@ -1,5 +1,8 @@
1
1
  # @lssm/module.lifecycle-core
2
2
 
3
+ Website: https://contractspec.lssm.tech/
4
+
5
+
3
6
  Signal collection + scoring module for ContractSpec lifecycle assessments. It wraps analytics/questionnaire adapters, applies weighting logic, and produces normalized `LifecycleAssessment` objects.
4
7
 
5
8
  ## Features
@@ -52,6 +55,16 @@ Adapters are interfaces—you can implement them inside bundles, Studio services
52
55
 
53
56
 
54
57
 
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
55
68
 
56
69
 
57
70
 
@@ -0,0 +1,14 @@
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>;
8
+ }
9
+ interface AnalyticsAdapter {
10
+ fetch(): Promise<AnalyticsAdapterResult>;
11
+ }
12
+ //#endregion
13
+ export { AnalyticsAdapter, AnalyticsAdapterResult };
14
+ //# sourceMappingURL=analytics-adapter.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,12 @@
1
+ import { LifecycleSignal } from "@lssm/lib.lifecycle";
2
+
3
+ //#region src/adapters/intent-adapter.d.ts
4
+ interface IntentAdapterResult {
5
+ signals?: LifecycleSignal[];
6
+ }
7
+ interface IntentAdapter {
8
+ fetch(): Promise<IntentAdapterResult>;
9
+ }
10
+ //#endregion
11
+ export { IntentAdapter, IntentAdapterResult };
12
+ //# sourceMappingURL=intent-adapter.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,14 @@
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>;
8
+ }
9
+ interface QuestionnaireAdapter {
10
+ fetch(): Promise<QuestionnaireAdapterResult>;
11
+ }
12
+ //#endregion
13
+ export { QuestionnaireAdapter, QuestionnaireAdapterResult };
14
+ //# sourceMappingURL=questionnaire-adapter.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,25 @@
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;
11
+ }
12
+ interface StageSignalCollectorResult {
13
+ axes: LifecycleAxes;
14
+ metrics: LifecycleMetricSnapshot;
15
+ signals: LifecycleSignal[];
16
+ questionnaireAnswers?: Record<string, unknown>;
17
+ }
18
+ declare class StageSignalCollector {
19
+ private readonly options;
20
+ constructor(options: StageSignalCollectorOptions);
21
+ collect(input?: LifecycleAssessmentInput): Promise<StageSignalCollectorResult>;
22
+ }
23
+ //#endregion
24
+ export { StageSignalCollector, StageSignalCollectorOptions, StageSignalCollectorResult };
25
+ //# sourceMappingURL=signal-collector.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -1 +1,65 @@
1
- import{CapitalPhase as e,CompanyPhase as t,ProductPhase as n}from"@lssm/lib.lifecycle";const r={product:n.Sketch,company:t.Solo,capital:e.Bootstrapped};var i=class{options;constructor(e){this.options=e}async collect(e={}){let t={...r,...e.axes??{}},n=[],i=[...e.signals??[]],s={...e.questionnaireAnswers??{}};if(e.metrics&&n.push(e.metrics),this.options.analyticsAdapter){let e=await this.options.analyticsAdapter.fetch();e.axes&&Object.assign(t,e.axes),e.metrics&&n.push(e.metrics),e.signals&&i.push(...e.signals)}if(this.options.questionnaireAdapter){let e=await this.options.questionnaireAdapter.fetch();e.axes&&Object.assign(t,e.axes),e.signals&&i.push(...e.signals),Object.assign(s,e.answers)}if(this.options.intentAdapter){let e=await this.options.intentAdapter.fetch();e.signals&&i.push(...e.signals)}return{axes:t,metrics:a(n),signals:o(i),questionnaireAnswers:Object.keys(s).length?s:void 0}}};const a=e=>e.reduce((e,t)=>(Object.entries(t??{}).forEach(([t,n])=>{n!=null&&(e[t]=n)}),e),{}),o=e=>{let t=new Set;return e.filter(e=>e.id?t.has(e.id)?!1:(t.add(e.id),!0):!0)};export{i as StageSignalCollector};
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"}
@@ -1 +1,74 @@
1
- var e=[{id:`stage0-problem-statement`,stage:0,category:`product`,title:`Write the pain statement`,description:`Capture the clearest description of the top problem in the customer’s own words.`,priority:1,actionItems:[`Interview at least 5 ideal customers`,`Synthesize quotes into a one-page brief`]},{id:`stage1-prototype-loop`,stage:1,category:`product`,title:`Prototype feedback loop`,description:`Ship a clickable prototype and gather 3 rounds of feedback.`,priority:2,actionItems:[`Create a low-fidelity prototype`,`Schedule standing feedback calls`]},{id:`stage2-activation`,stage:2,category:`operations`,title:`Activation checklist`,description:`Define the minimum steps required for a new user to succeed.`,priority:1,actionItems:[`Document onboarding flow`,`Instrument activation analytics`]},{id:`stage3-retention-narrative`,stage:3,category:`product`,title:`Retention narrative`,description:`Create the before/after story that proves why users stay.`,priority:2,actionItems:[`Interview 3 retained users`,`Publish a one-pager with concrete metrics`]},{id:`stage4-growth-loop`,stage:4,category:`growth`,title:`Install a growth loop`,description:`Stand up a repeatable acquisition → activation → referral motion.`,priority:1,actionItems:[`Define loop metrics`,`Assign owners for each stage`,`Review weekly`]},{id:`stage5-platform-blueprint`,stage:5,category:`product`,title:`Platform blueprint`,description:`Align on APIs, integrations, and governance for partners.`,priority:2,actionItems:[`Create integration scoring rubric`,`Publish partner onboarding checklist`]},{id:`stage6-renewal-ops`,stage:6,category:`operations`,title:`Renewal operating rhythm`,description:`Decide whether to optimize, reinvest, or sunset each major surface.`,priority:1,actionItems:[`Hold quarterly renewal review`,`Document reinvestment bets`]}];export{e as default};
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":""}
@@ -1 +1,170 @@
1
- var e={Exploration:{base:.35,metrics:{activeUsers:{weight:-.3,direction:`lte`,threshold:5},customerCount:{weight:-.2,direction:`lte`,threshold:3},teamSize:{weight:-.1,direction:`lte`,threshold:3}},signalKinds:{qualitative:.4,metric:.1}},ProblemSolutionFit:{base:.4,metrics:{activeUsers:{weight:.2,direction:`gte`,threshold:5},customerCount:{weight:.2,direction:`gte`,threshold:3}},signalKinds:{qualitative:.3,event:.1}},MvpEarlyTraction:{base:.45,metrics:{activeUsers:{weight:.25,direction:`gte`,threshold:25},weeklyActiveUsers:{weight:.25,direction:`gte`,threshold:20},retentionRate:{weight:.2,direction:`gte`,threshold:.25}},signalKinds:{metric:.15,event:.1}},ProductMarketFit:{base:.5,metrics:{retentionRate:{weight:.35,direction:`gte`,threshold:.45},monthlyRecurringRevenue:{weight:.25,direction:`gte`,threshold:1e4},customerCount:{weight:.2,direction:`gte`,threshold:30}},signalKinds:{metric:.15,event:.1}},GrowthScaleUp:{base:.55,metrics:{retentionRate:{weight:.2,direction:`gte`,threshold:.55},monthlyRecurringRevenue:{weight:.3,direction:`gte`,threshold:5e4},teamSize:{weight:.15,direction:`gte`,threshold:15}},signalKinds:{event:.2,metric:.15}},ExpansionPlatform:{base:.6,metrics:{monthlyRecurringRevenue:{weight:.35,direction:`gte`,threshold:15e4},customerCount:{weight:.2,direction:`gte`,threshold:100},teamSize:{weight:.15,direction:`gte`,threshold:40}},signalKinds:{event:.2,milestone:.1}},MaturityRenewal:{base:.6,metrics:{monthlyRecurringRevenue:{weight:.25,direction:`gte`,threshold:25e4},teamSize:{weight:.15,direction:`gte`,threshold:80},burnMultiple:{weight:.2,direction:`lte`,threshold:1.5}},signalKinds:{event:.2,milestone:.15}}};export{e as default};
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":""}
@@ -0,0 +1,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
- import{StageSignalCollector as e}from"./collectors/signal-collector.js";import{StageScorer as t}from"./scoring/stage-scorer.js";import{LifecycleMilestonePlanner as n}from"./planning/milestone-planner.js";import{LifecycleOrchestrator as r}from"./orchestrator/lifecycle-orchestrator.js";export{n as LifecycleMilestonePlanner,r as LifecycleOrchestrator,t as StageScorer,e as StageSignalCollector};
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 };
@@ -0,0 +1,22 @@
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;
11
+ }
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[];
19
+ }
20
+ //#endregion
21
+ export { LifecycleOrchestrator, LifecycleOrchestratorOptions };
22
+ //# sourceMappingURL=lifecycle-orchestrator.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -1 +1,53 @@
1
- import"../collectors/signal-collector.js";import"../scoring/stage-scorer.js";import{LIFECYCLE_STAGE_META as e,LifecycleStage as t}from"@lssm/lib.lifecycle";var n=class{collector;scorer;planner;constructor(e){this.collector=e.collector,this.scorer=e.scorer,this.planner=e.milestonePlanner}async run(t){let n=await this.collector.collect(t),a=this.scorer.score({metrics:n.metrics,signals:n.signals}),o=a[0]??r(),s=e[o.stage];return{stage:o.stage,confidence:o.confidence,axes:n.axes,signals:n.signals,metrics:i(n.metrics),gaps:s.focusAreas.slice(0,3),focusAreas:s.focusAreas,scorecard:a,generatedAt:new Date().toISOString()}}getUpcomingMilestones(e,t=[],n=5){return this.planner?this.planner.getUpcoming(e,t,n):[]}};const r=()=>({stage:t.Exploration,score:.3,confidence:.3,supportingSignals:[]}),i=e=>Object.entries(e??{}).reduce((e,[t,n])=>(typeof n==`number`&&(e[t]=n),e),{});export{n as LifecycleOrchestrator};
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"}
@@ -0,0 +1,11 @@
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[];
8
+ }
9
+ //#endregion
10
+ export { LifecycleMilestonePlanner };
11
+ //# sourceMappingURL=milestone-planner.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -1 +1,17 @@
1
- import e from"../data/milestones-catalog.js";var t=class{milestones;constructor(t){this.milestones=t??e}getUpcoming(e,t=[],n=5){let r=new Set(t);return this.milestones.filter(t=>t.stage===e&&!r.has(t.id)).sort((e,t)=>e.priority-t.priority).slice(0,n)}};export{t as LifecycleMilestonePlanner};
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"}
@@ -0,0 +1,27 @@
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
+ interface MetricWeightConfig {
6
+ weight: number;
7
+ threshold: number;
8
+ direction?: 'gte' | 'lte';
9
+ }
10
+ interface StageWeightConfig {
11
+ base: number;
12
+ metrics?: Partial<Record<NumericMetricKey, MetricWeightConfig>>;
13
+ signalKinds?: Partial<Record<string, number>>;
14
+ }
15
+ type StageWeights = Record<string, StageWeightConfig>;
16
+ interface StageScoreInput {
17
+ metrics: LifecycleMetricSnapshot;
18
+ signals: LifecycleSignal[];
19
+ }
20
+ declare class StageScorer {
21
+ private readonly weights;
22
+ constructor(weights?: StageWeights);
23
+ score(input: StageScoreInput): LifecycleScore[];
24
+ }
25
+ //#endregion
26
+ export { StageScoreInput, StageScorer };
27
+ //# sourceMappingURL=stage-scorer.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -1 +1,64 @@
1
- import e from"../data/stage-weights.js";import{LIFECYCLE_STAGE_META as t,LifecycleStage as n}from"@lssm/lib.lifecycle";const r=e;var i=class{weights;constructor(e=r){this.weights=e}score(e){let t=s(e.signals);return Object.values(n).filter(c).map(r=>{let i=n[r],s=this.weights[i]??{base:.5},c=s.base??.5,l=0,u=Object.keys(s.metrics??{}).length+Object.keys(s.signalKinds??{}).length||1,d=[];s.metrics&&Object.entries(s.metrics).forEach(([t,n])=>{let r=e.metrics[t];r!=null&&(a(r,n)?(c+=n.weight,l+=1,d.push(`metric:${t}`)):c+=n.weight*.25)}),s.signalKinds&&Object.entries(s.signalKinds).forEach(([e,n])=>{(t[e]??0)>0&&typeof n==`number`&&(c+=n,l+=1,d.push(`signal:${e}`))}),c=o(c,0,1.25);let f=o(l/u,.1,1);return{stage:r,score:c,confidence:f,supportingSignals:d}}).sort((e,t)=>t.score===e.score?t.confidence-e.confidence:t.score-e.score)}};const a=(e,t)=>(t.direction??`gte`)===`gte`?e>=t.threshold:e<=t.threshold,o=(e,t,n)=>Math.min(Math.max(e,t),n),s=e=>e.reduce((e,t)=>{let n=t.kind??`unknown`;return e[n]=(e[n]??0)+(t.weight??1),e},{}),c=e=>typeof e==`number`&&e in t;export{i as StageScorer};
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": "1.41.1",
3
+ "version": "1.42.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -13,7 +13,7 @@
13
13
  "scripts": {
14
14
  "publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
15
15
  "publish:pkg:canary": "bun publish:pkg --tag canary",
16
- "build": "bun build:bundle && bun build:types",
16
+ "build": "bun build:types && bun build:bundle",
17
17
  "build:bundle": "tsdown",
18
18
  "build:types": "tsc --noEmit",
19
19
  "dev": "bun build:bundle --watch",
@@ -24,16 +24,16 @@
24
24
  "test": "bun run"
25
25
  },
26
26
  "dependencies": {
27
- "@lssm/lib.lifecycle": "1.41.1"
27
+ "@lssm/lib.lifecycle": "1.42.1"
28
28
  },
29
29
  "devDependencies": {
30
- "@lssm/tool.tsdown": "1.41.1",
31
- "@lssm/tool.typescript": "1.41.1",
32
- "tsdown": "^0.17.4",
30
+ "@lssm/tool.tsdown": "1.42.1",
31
+ "@lssm/tool.typescript": "1.42.1",
32
+ "tsdown": "^0.18.3",
33
33
  "typescript": "^5.9.3"
34
34
  },
35
35
  "exports": {
36
- ".": "./src/index.ts",
36
+ ".": "./dist/index.js",
37
37
  "./*": "./*"
38
38
  },
39
39
  "publishConfig": {
@@ -41,6 +41,13 @@
41
41
  "exports": {
42
42
  ".": "./dist/index.js",
43
43
  "./*": "./*"
44
- }
44
+ },
45
+ "registry": "https://registry.npmjs.org/"
46
+ },
47
+ "license": "MIT",
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "https://github.com/lssm-tech/contractspec.git",
51
+ "directory": "packages/modules/lifecycle-core"
45
52
  }
46
53
  }