@lssm/example.learning-journey-ui-shared 0.0.0-canary-20251217080011 → 0.0.0-canary-20251219202229

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 (119) hide show
  1. package/.turbo/turbo-build$colon$bundle.log +383 -24
  2. package/.turbo/turbo-build.log +384 -26
  3. package/CHANGELOG.md +6 -6
  4. package/LICENSE +21 -0
  5. package/dist/components/BadgeDisplay.d.ts +12 -0
  6. package/dist/components/BadgeDisplay.d.ts.map +1 -0
  7. package/dist/components/BadgeDisplay.js +45 -0
  8. package/dist/components/BadgeDisplay.js.map +1 -0
  9. package/dist/components/StreakCounter.d.ts +12 -0
  10. package/dist/components/StreakCounter.d.ts.map +1 -0
  11. package/dist/components/StreakCounter.js +46 -0
  12. package/dist/components/StreakCounter.js.map +1 -0
  13. package/dist/components/ViewTabs.d.ts +12 -0
  14. package/dist/components/ViewTabs.d.ts.map +1 -0
  15. package/dist/components/ViewTabs.js +49 -0
  16. package/dist/components/ViewTabs.js.map +1 -0
  17. package/dist/components/XpBar.d.ts +14 -0
  18. package/dist/components/XpBar.d.ts.map +1 -0
  19. package/dist/components/XpBar.js +47 -0
  20. package/dist/components/XpBar.js.map +1 -0
  21. package/dist/components/index.d.ts +5 -0
  22. package/dist/components/index.js +6 -0
  23. package/dist/docs/index.d.ts +1 -0
  24. package/dist/docs/index.js +1 -0
  25. package/dist/docs/learning-journey-ui-shared.docblock.d.ts +1 -0
  26. package/dist/docs/learning-journey-ui-shared.docblock.js +21 -0
  27. package/dist/docs/learning-journey-ui-shared.docblock.js.map +1 -0
  28. package/dist/{index.d.mts → example.d.ts} +2 -5
  29. package/dist/example.d.ts.map +1 -0
  30. package/dist/example.js +35 -0
  31. package/dist/example.js.map +1 -0
  32. package/dist/hooks/index.d.ts +2 -0
  33. package/dist/hooks/index.js +3 -0
  34. package/dist/{index-D_7WU_xm.d.mts → hooks/useLearningProgress.d.ts} +3 -2
  35. package/dist/hooks/useLearningProgress.d.ts.map +1 -0
  36. package/dist/{hooks-B-tDvppY.mjs → hooks/useLearningProgress.js} +4 -1
  37. package/dist/hooks/useLearningProgress.js.map +1 -0
  38. package/dist/index.d.ts +9 -0
  39. package/dist/index.js +11 -0
  40. package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +17 -0
  41. package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js.map +1 -0
  42. package/dist/libs/contracts/dist/docs/index.js +25 -0
  43. package/dist/libs/contracts/dist/docs/meta.docs.js +30 -0
  44. package/dist/libs/contracts/dist/docs/meta.docs.js.map +1 -0
  45. package/dist/libs/contracts/dist/docs/presentations.js +72 -0
  46. package/dist/libs/contracts/dist/docs/presentations.js.map +1 -0
  47. package/dist/libs/contracts/dist/docs/registry.js +45 -0
  48. package/dist/libs/contracts/dist/docs/registry.js.map +1 -0
  49. package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +81 -0
  50. package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js.map +1 -0
  51. package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +58 -0
  52. package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js.map +1 -0
  53. package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +17 -0
  54. package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js.map +1 -0
  55. package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +358 -0
  56. package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js.map +1 -0
  57. package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +38 -0
  58. package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js.map +1 -0
  59. package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +17 -0
  60. package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js.map +1 -0
  61. package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +21 -0
  62. package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js.map +1 -0
  63. package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +49 -0
  64. package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js.map +1 -0
  65. package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +80 -0
  66. package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js.map +1 -0
  67. package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +85 -0
  68. package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js.map +1 -0
  69. package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +46 -0
  70. package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js.map +1 -0
  71. package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +68 -0
  72. package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js.map +1 -0
  73. package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +41 -0
  74. package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js.map +1 -0
  75. package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +70 -0
  76. package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js.map +1 -0
  77. package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +48 -0
  78. package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js.map +1 -0
  79. package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +63 -0
  80. package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js.map +1 -0
  81. package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +156 -0
  82. package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js.map +1 -0
  83. package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +21 -0
  84. package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js.map +1 -0
  85. package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +102 -0
  86. package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js.map +1 -0
  87. package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +21 -0
  88. package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js.map +1 -0
  89. package/dist/libs/contracts/dist/docs/tech-contracts.docs.js +97 -0
  90. package/dist/libs/contracts/dist/docs/tech-contracts.docs.js.map +1 -0
  91. package/dist/libs/design-system/dist/_virtual/rolldown_runtime.js +6 -0
  92. package/dist/libs/design-system/dist/_virtual/rolldown_runtime.js.map +1 -0
  93. package/dist/libs/design-system/dist/components/atoms/Button.js +34 -0
  94. package/dist/libs/design-system/dist/components/atoms/Button.js.map +1 -0
  95. package/dist/libs/design-system/dist/ui-kit-web/dist/ui/button.js +56 -0
  96. package/dist/libs/design-system/dist/ui-kit-web/dist/ui/button.js.map +1 -0
  97. package/dist/libs/design-system/dist/ui-kit-web/dist/ui-kit-core/dist/utils.js +14 -0
  98. package/dist/libs/design-system/dist/ui-kit-web/dist/ui-kit-core/dist/utils.js.map +1 -0
  99. package/dist/libs/ui-kit-web/dist/ui/progress.js +24 -0
  100. package/dist/libs/ui-kit-web/dist/ui/progress.js.map +1 -0
  101. package/dist/libs/ui-kit-web/dist/ui/utils.js +11 -0
  102. package/dist/libs/ui-kit-web/dist/ui/utils.js.map +1 -0
  103. package/dist/libs/ui-kit-web/dist/ui-kit-core/dist/utils.js +11 -0
  104. package/dist/libs/ui-kit-web/dist/ui-kit-core/dist/utils.js.map +1 -0
  105. package/dist/{types-BMAby_Ku.d.mts → types.d.ts} +2 -1
  106. package/dist/types.d.ts.map +1 -0
  107. package/dist/types.js +0 -0
  108. package/package.json +23 -16
  109. package/tsconfig.tsbuildinfo +1 -1
  110. package/tsdown.config.js +14 -11
  111. package/dist/components/index.d.mts +0 -2
  112. package/dist/components/index.mjs +0 -3
  113. package/dist/components-tyJAN4Ru.mjs +0 -164
  114. package/dist/hooks/index.d.mts +0 -2
  115. package/dist/hooks/index.mjs +0 -3
  116. package/dist/index-EWErSKip.d.mts +0 -34
  117. package/dist/index.mjs +0 -55
  118. package/dist/types.d.mts +0 -2
  119. package/dist/types.mjs +0 -1
@@ -0,0 +1,72 @@
1
+ //#region ../../libs/contracts/dist/docs/presentations.js
2
+ const DEFAULT_TARGETS = [
3
+ "markdown",
4
+ "application/json",
5
+ "application/xml",
6
+ "react"
7
+ ];
8
+ function normalizeRoute(route) {
9
+ if (!route.length) return "/";
10
+ const withLeading = route.startsWith("/") ? route : `/${route}`;
11
+ return withLeading === "/" ? "/" : withLeading.replace(/\/+$/, "");
12
+ }
13
+ function deriveRoute(block, routePrefix) {
14
+ if (block.route) return normalizeRoute(block.route);
15
+ const prefix = routePrefix ?? "/docs";
16
+ const slug = block.id.replace(/^docs\.?/, "").replace(/\./g, "/").replace(/\/+/g, "/");
17
+ return normalizeRoute(slug.startsWith("/") ? slug : `${prefix}/${slug}`);
18
+ }
19
+ function buildName(block, namespace) {
20
+ return namespace ? `${namespace}.${block.id}` : block.id;
21
+ }
22
+ function docBlockToPresentationV2(block, options) {
23
+ const targets = options?.defaultTargets ?? DEFAULT_TARGETS;
24
+ const version = block.version ?? options?.defaultVersion ?? 1;
25
+ const stability = block.stability ?? options?.defaultStability ?? "stable";
26
+ return {
27
+ meta: {
28
+ name: buildName(block, options?.namespace),
29
+ version,
30
+ description: block.summary ?? block.title,
31
+ tags: block.tags,
32
+ owners: block.owners,
33
+ domain: block.domain,
34
+ stability
35
+ },
36
+ policy: block.visibility && block.visibility !== "public" ? { flags: [block.visibility] } : void 0,
37
+ source: {
38
+ type: "blocknotejs",
39
+ docJson: block.body
40
+ },
41
+ targets
42
+ };
43
+ }
44
+ function docBlockToPresentationSpec(block, options) {
45
+ const version = block.version ?? options?.defaultVersion ?? 1;
46
+ const stability = block.stability ?? options?.defaultStability ?? "stable";
47
+ return {
48
+ meta: {
49
+ name: buildName(block, options?.namespace),
50
+ version,
51
+ stability,
52
+ tags: block.tags,
53
+ owners: block.owners,
54
+ description: block.summary ?? block.title
55
+ },
56
+ content: {
57
+ kind: "markdown",
58
+ content: block.body
59
+ }
60
+ };
61
+ }
62
+ function docBlocksToPresentationRoutes(blocks, options) {
63
+ return blocks.map((block) => ({
64
+ block,
65
+ route: deriveRoute(block, options?.routePrefix),
66
+ descriptor: docBlockToPresentationV2(block, options)
67
+ }));
68
+ }
69
+
70
+ //#endregion
71
+ export { docBlockToPresentationSpec, docBlockToPresentationV2, docBlocksToPresentationRoutes };
72
+ //# sourceMappingURL=presentations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentations.js","names":[],"sources":["../../../../../../../libs/contracts/dist/docs/presentations.js"],"sourcesContent":["//#region src/docs/presentations.ts\nconst DEFAULT_TARGETS = [\n\t\"markdown\",\n\t\"application/json\",\n\t\"application/xml\",\n\t\"react\"\n];\nfunction normalizeRoute(route) {\n\tif (!route.length) return \"/\";\n\tconst withLeading = route.startsWith(\"/\") ? route : `/${route}`;\n\treturn withLeading === \"/\" ? \"/\" : withLeading.replace(/\\/+$/, \"\");\n}\nfunction deriveRoute(block, routePrefix) {\n\tif (block.route) return normalizeRoute(block.route);\n\tconst prefix = routePrefix ?? \"/docs\";\n\tconst slug = block.id.replace(/^docs\\.?/, \"\").replace(/\\./g, \"/\").replace(/\\/+/g, \"/\");\n\treturn normalizeRoute(slug.startsWith(\"/\") ? slug : `${prefix}/${slug}`);\n}\nfunction buildName(block, namespace) {\n\treturn namespace ? `${namespace}.${block.id}` : block.id;\n}\nfunction docBlockToPresentationV2(block, options) {\n\tconst targets = options?.defaultTargets ?? DEFAULT_TARGETS;\n\tconst version = block.version ?? options?.defaultVersion ?? 1;\n\tconst stability = block.stability ?? options?.defaultStability ?? \"stable\";\n\treturn {\n\t\tmeta: {\n\t\t\tname: buildName(block, options?.namespace),\n\t\t\tversion,\n\t\t\tdescription: block.summary ?? block.title,\n\t\t\ttags: block.tags,\n\t\t\towners: block.owners,\n\t\t\tdomain: block.domain,\n\t\t\tstability\n\t\t},\n\t\tpolicy: block.visibility && block.visibility !== \"public\" ? { flags: [block.visibility] } : void 0,\n\t\tsource: {\n\t\t\ttype: \"blocknotejs\",\n\t\t\tdocJson: block.body\n\t\t},\n\t\ttargets\n\t};\n}\nfunction docBlockToPresentationSpec(block, options) {\n\tconst version = block.version ?? options?.defaultVersion ?? 1;\n\tconst stability = block.stability ?? options?.defaultStability ?? \"stable\";\n\treturn {\n\t\tmeta: {\n\t\t\tname: buildName(block, options?.namespace),\n\t\t\tversion,\n\t\t\tstability,\n\t\t\ttags: block.tags,\n\t\t\towners: block.owners,\n\t\t\tdescription: block.summary ?? block.title\n\t\t},\n\t\tcontent: {\n\t\t\tkind: \"markdown\",\n\t\t\tcontent: block.body\n\t\t}\n\t};\n}\nfunction docBlocksToPresentationRoutes(blocks, options) {\n\treturn blocks.map((block) => ({\n\t\tblock,\n\t\troute: deriveRoute(block, options?.routePrefix),\n\t\tdescriptor: docBlockToPresentationV2(block, options)\n\t}));\n}\nfunction docBlocksToPresentationSpecs(blocks, options) {\n\treturn blocks.map((block) => docBlockToPresentationSpec(block, options));\n}\nfunction mapDocRoutes(routes) {\n\treturn routes.map(({ route, descriptor }) => [route, descriptor]);\n}\n\n//#endregion\nexport { docBlockToPresentationSpec, docBlockToPresentationV2, docBlocksToPresentationRoutes, docBlocksToPresentationSpecs, mapDocRoutes };\n//# sourceMappingURL=presentations.js.map"],"mappings":";AACA,MAAM,kBAAkB;CACvB;CACA;CACA;CACA;CACA;AACD,SAAS,eAAe,OAAO;AAC9B,KAAI,CAAC,MAAM,OAAQ,QAAO;CAC1B,MAAM,cAAc,MAAM,WAAW,IAAI,GAAG,QAAQ,IAAI;AACxD,QAAO,gBAAgB,MAAM,MAAM,YAAY,QAAQ,QAAQ,GAAG;;AAEnE,SAAS,YAAY,OAAO,aAAa;AACxC,KAAI,MAAM,MAAO,QAAO,eAAe,MAAM,MAAM;CACnD,MAAM,SAAS,eAAe;CAC9B,MAAM,OAAO,MAAM,GAAG,QAAQ,YAAY,GAAG,CAAC,QAAQ,OAAO,IAAI,CAAC,QAAQ,QAAQ,IAAI;AACtF,QAAO,eAAe,KAAK,WAAW,IAAI,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO;;AAEzE,SAAS,UAAU,OAAO,WAAW;AACpC,QAAO,YAAY,GAAG,UAAU,GAAG,MAAM,OAAO,MAAM;;AAEvD,SAAS,yBAAyB,OAAO,SAAS;CACjD,MAAM,UAAU,SAAS,kBAAkB;CAC3C,MAAM,UAAU,MAAM,WAAW,SAAS,kBAAkB;CAC5D,MAAM,YAAY,MAAM,aAAa,SAAS,oBAAoB;AAClE,QAAO;EACN,MAAM;GACL,MAAM,UAAU,OAAO,SAAS,UAAU;GAC1C;GACA,aAAa,MAAM,WAAW,MAAM;GACpC,MAAM,MAAM;GACZ,QAAQ,MAAM;GACd,QAAQ,MAAM;GACd;GACA;EACD,QAAQ,MAAM,cAAc,MAAM,eAAe,WAAW,EAAE,OAAO,CAAC,MAAM,WAAW,EAAE,GAAG,KAAK;EACjG,QAAQ;GACP,MAAM;GACN,SAAS,MAAM;GACf;EACD;EACA;;AAEF,SAAS,2BAA2B,OAAO,SAAS;CACnD,MAAM,UAAU,MAAM,WAAW,SAAS,kBAAkB;CAC5D,MAAM,YAAY,MAAM,aAAa,SAAS,oBAAoB;AAClE,QAAO;EACN,MAAM;GACL,MAAM,UAAU,OAAO,SAAS,UAAU;GAC1C;GACA;GACA,MAAM,MAAM;GACZ,QAAQ,MAAM;GACd,aAAa,MAAM,WAAW,MAAM;GACpC;EACD,SAAS;GACR,MAAM;GACN,SAAS,MAAM;GACf;EACD;;AAEF,SAAS,8BAA8B,QAAQ,SAAS;AACvD,QAAO,OAAO,KAAK,WAAW;EAC7B;EACA,OAAO,YAAY,OAAO,SAAS,YAAY;EAC/C,YAAY,yBAAyB,OAAO,QAAQ;EACpD,EAAE"}
@@ -0,0 +1,45 @@
1
+ import { docBlockToPresentationSpec, docBlocksToPresentationRoutes } from "./presentations.js";
2
+
3
+ //#region ../../libs/contracts/dist/docs/registry.js
4
+ var DocRegistry = class {
5
+ routes = /* @__PURE__ */ new Map();
6
+ constructor(blocks = [], options) {
7
+ blocks.forEach((block) => this.register(block, options));
8
+ }
9
+ register(block, options) {
10
+ const [route] = docBlocksToPresentationRoutes([block], options);
11
+ if (route) this.routes.set(block.id, route);
12
+ return this;
13
+ }
14
+ list() {
15
+ return [...this.routes.values()];
16
+ }
17
+ get(id) {
18
+ return this.routes.get(id);
19
+ }
20
+ toRouteTuples() {
21
+ return this.list().map(({ route, descriptor }) => [route, descriptor]);
22
+ }
23
+ toPresentationSpecs(options) {
24
+ return this.list().map(({ block }) => docBlockToPresentationSpec(block, options));
25
+ }
26
+ };
27
+ const requiredFields = [
28
+ "id",
29
+ "title",
30
+ "body",
31
+ "kind",
32
+ "visibility",
33
+ "route"
34
+ ];
35
+ const defaultDocRegistry = new DocRegistry();
36
+ function registerDocBlocks(blocks) {
37
+ for (const block of blocks) {
38
+ for (const field of requiredFields) if (!block[field]) throw new Error(`DocBlock ${block.id ?? "<missing id>"} missing field ${String(field)}`);
39
+ defaultDocRegistry.register(block);
40
+ }
41
+ }
42
+
43
+ //#endregion
44
+ export { DocRegistry, defaultDocRegistry, registerDocBlocks };
45
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","names":[],"sources":["../../../../../../../libs/contracts/dist/docs/registry.js"],"sourcesContent":["import { docBlockToPresentationSpec, docBlocksToPresentationRoutes } from \"./presentations.js\";\n\n//#region src/docs/registry.ts\nvar DocRegistry = class {\n\troutes = /* @__PURE__ */ new Map();\n\tconstructor(blocks = [], options) {\n\t\tblocks.forEach((block) => this.register(block, options));\n\t}\n\tregister(block, options) {\n\t\tconst [route] = docBlocksToPresentationRoutes([block], options);\n\t\tif (route) this.routes.set(block.id, route);\n\t\treturn this;\n\t}\n\tlist() {\n\t\treturn [...this.routes.values()];\n\t}\n\tget(id) {\n\t\treturn this.routes.get(id);\n\t}\n\ttoRouteTuples() {\n\t\treturn this.list().map(({ route, descriptor }) => [route, descriptor]);\n\t}\n\ttoPresentationSpecs(options) {\n\t\treturn this.list().map(({ block }) => docBlockToPresentationSpec(block, options));\n\t}\n};\nconst requiredFields = [\n\t\"id\",\n\t\"title\",\n\t\"body\",\n\t\"kind\",\n\t\"visibility\",\n\t\"route\"\n];\nconst defaultDocRegistry = new DocRegistry();\nfunction registerDocBlocks(blocks) {\n\tfor (const block of blocks) {\n\t\tfor (const field of requiredFields) if (!block[field]) throw new Error(`DocBlock ${block.id ?? \"<missing id>\"} missing field ${String(field)}`);\n\t\tdefaultDocRegistry.register(block);\n\t}\n}\nfunction listRegisteredDocBlocks() {\n\treturn defaultDocRegistry.list().map((r) => r.block);\n}\nfunction docId(id) {\n\tif (!defaultDocRegistry.get(id)) throw new Error(`DocBlock not registered: ${id}`);\n\treturn id;\n}\n\n//#endregion\nexport { DocRegistry, defaultDocRegistry, docId, listRegisteredDocBlocks, registerDocBlocks };\n//# sourceMappingURL=registry.js.map"],"mappings":";;;AAGA,IAAI,cAAc,MAAM;CACvB,yBAAyB,IAAI,KAAK;CAClC,YAAY,SAAS,EAAE,EAAE,SAAS;AACjC,SAAO,SAAS,UAAU,KAAK,SAAS,OAAO,QAAQ,CAAC;;CAEzD,SAAS,OAAO,SAAS;EACxB,MAAM,CAAC,SAAS,8BAA8B,CAAC,MAAM,EAAE,QAAQ;AAC/D,MAAI,MAAO,MAAK,OAAO,IAAI,MAAM,IAAI,MAAM;AAC3C,SAAO;;CAER,OAAO;AACN,SAAO,CAAC,GAAG,KAAK,OAAO,QAAQ,CAAC;;CAEjC,IAAI,IAAI;AACP,SAAO,KAAK,OAAO,IAAI,GAAG;;CAE3B,gBAAgB;AACf,SAAO,KAAK,MAAM,CAAC,KAAK,EAAE,OAAO,iBAAiB,CAAC,OAAO,WAAW,CAAC;;CAEvE,oBAAoB,SAAS;AAC5B,SAAO,KAAK,MAAM,CAAC,KAAK,EAAE,YAAY,2BAA2B,OAAO,QAAQ,CAAC;;;AAGnF,MAAM,iBAAiB;CACtB;CACA;CACA;CACA;CACA;CACA;CACA;AACD,MAAM,qBAAqB,IAAI,aAAa;AAC5C,SAAS,kBAAkB,QAAQ;AAClC,MAAK,MAAM,SAAS,QAAQ;AAC3B,OAAK,MAAM,SAAS,eAAgB,KAAI,CAAC,MAAM,OAAQ,OAAM,IAAI,MAAM,YAAY,MAAM,MAAM,eAAe,iBAAiB,OAAO,MAAM,GAAG;AAC/I,qBAAmB,SAAS,MAAM"}
@@ -0,0 +1,81 @@
1
+ import { registerDocBlocks } from "../../registry.js";
2
+
3
+ //#region ../../libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js
4
+ const tech_auth_better_auth_nextjs_DocBlocks = [{
5
+ id: "docs.tech.auth.better-auth-nextjs",
6
+ title: "Better Auth + Next.js integration (ContractSpec)",
7
+ summary: "How ContractSpec wires Better Auth into Next.js (server config, client singleton, and proxy cookie-only redirects).",
8
+ kind: "reference",
9
+ visibility: "public",
10
+ route: "/docs/tech/auth/better-auth-nextjs",
11
+ tags: [
12
+ "auth",
13
+ "better-auth",
14
+ "nextjs",
15
+ "cookies",
16
+ "proxy",
17
+ "hmr"
18
+ ],
19
+ body: `# Better Auth + Next.js integration (ContractSpec)
20
+
21
+ This repo uses Better Auth as the primary auth layer (sessions, organizations, teams, API keys, and OAuth).
22
+
23
+ ## Server config (Better Auth)
24
+
25
+ - Source: \`packages/bundles/contractspec-studio/src/application/services/auth.ts\`
26
+ - Important: \`nextCookies()\` must be the **last** plugin in the Better Auth plugin list so \`Set-Cookie\` is applied correctly in Next.js environments.
27
+
28
+ ## Better Auth Admin plugin
29
+
30
+ ContractSpec Studio enables the Better Auth **Admin plugin** to support platform-admin user operations (list users, impersonation, etc.).
31
+
32
+ - Server: \`admin()\` plugin in \`packages/bundles/contractspec-studio/src/application/services/auth.ts\`
33
+ - Client: \`adminClient()\` in \`packages/bundles/contractspec-studio/src/presentation/providers/auth/client.ts\`
34
+
35
+ ### PLATFORM_ADMIN ⇒ Better Auth admin role
36
+
37
+ Better Auth Admin endpoints authorize via \`user.role\`. ContractSpec enforces an org-driven rule:
38
+
39
+ - If the **active organization** has \`type = PLATFORM_ADMIN\`, the signed-in user is ensured to have \`User.role\` containing \`admin\`.
40
+ - This is applied in the session creation hook and re-checked in \`assertsPlatformAdmin()\`.
41
+
42
+ This keeps admin enablement deterministic and avoids manual role backfills.
43
+
44
+ ## Client config (React web + Expo)
45
+
46
+ To avoid duplicate background refresh/polling loops in dev (Fast Refresh/HMR), the Better Auth client is implemented as a singleton cached on \`globalThis\`.
47
+
48
+ - Web client: \`packages/bundles/contractspec-studio/src/presentation/providers/auth/client.ts\`
49
+ - Native client: \`packages/bundles/contractspec-studio/src/presentation/providers/auth/client.native.ts\`
50
+
51
+ Import guidance:
52
+
53
+ - If you only need the context/hook, prefer importing from \`@lssm/bundle.contractspec-studio/presentation/providers/auth\`.
54
+ - If you explicitly need the Better Auth client instance (e.g. admin impersonation, direct API calls), import from \`@lssm/bundle.contractspec-studio/presentation/providers/auth/client\`.
55
+
56
+ ## Public routes (login / signup)
57
+
58
+ Public auth pages should avoid eager \`authClient\` initialization.
59
+
60
+ Pattern used:
61
+
62
+ - In the submit handler, dynamically import \`@lssm/bundle.contractspec-studio/presentation/providers/auth/index.web\` and call \`authClient.signIn.*\` / \`authClient.signUp.*\`.
63
+
64
+ This prevents session refresh behavior from starting just because a public page rendered.
65
+
66
+ ## Next.js proxy auth (web-landing)
67
+
68
+ The Next.js proxy/middleware is used for **redirect decisions only**. It must not perform DB-backed session reads on every request.
69
+
70
+ - Source: \`packages/apps/web-landing/src/proxy.ts\`
71
+ - Approach: cookie-only checks via Better Auth cookies helpers:
72
+ - \`getSessionCookie(request)\`
73
+ - \`getCookieCache(request)\`
74
+
75
+ These checks are intentionally optimistic and should only gate routing. Full authorization must still be enforced on server-side actions/routes and GraphQL resolvers.
76
+ `
77
+ }];
78
+ registerDocBlocks(tech_auth_better_auth_nextjs_DocBlocks);
79
+
80
+ //#endregion
81
+ //# sourceMappingURL=better-auth-nextjs.docblock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"better-auth-nextjs.docblock.js","names":[],"sources":["../../../../../../../../../libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js"],"sourcesContent":["import { registerDocBlocks } from \"../../registry.js\";\n\n//#region src/docs/tech/auth/better-auth-nextjs.docblock.ts\nconst tech_auth_better_auth_nextjs_DocBlocks = [{\n\tid: \"docs.tech.auth.better-auth-nextjs\",\n\ttitle: \"Better Auth + Next.js integration (ContractSpec)\",\n\tsummary: \"How ContractSpec wires Better Auth into Next.js (server config, client singleton, and proxy cookie-only redirects).\",\n\tkind: \"reference\",\n\tvisibility: \"public\",\n\troute: \"/docs/tech/auth/better-auth-nextjs\",\n\ttags: [\n\t\t\"auth\",\n\t\t\"better-auth\",\n\t\t\"nextjs\",\n\t\t\"cookies\",\n\t\t\"proxy\",\n\t\t\"hmr\"\n\t],\n\tbody: `# Better Auth + Next.js integration (ContractSpec)\n\nThis repo uses Better Auth as the primary auth layer (sessions, organizations, teams, API keys, and OAuth).\n\n## Server config (Better Auth)\n\n- Source: \\`packages/bundles/contractspec-studio/src/application/services/auth.ts\\`\n- Important: \\`nextCookies()\\` must be the **last** plugin in the Better Auth plugin list so \\`Set-Cookie\\` is applied correctly in Next.js environments.\n\n## Better Auth Admin plugin\n\nContractSpec Studio enables the Better Auth **Admin plugin** to support platform-admin user operations (list users, impersonation, etc.).\n\n- Server: \\`admin()\\` plugin in \\`packages/bundles/contractspec-studio/src/application/services/auth.ts\\`\n- Client: \\`adminClient()\\` in \\`packages/bundles/contractspec-studio/src/presentation/providers/auth/client.ts\\`\n\n### PLATFORM_ADMIN ⇒ Better Auth admin role\n\nBetter Auth Admin endpoints authorize via \\`user.role\\`. ContractSpec enforces an org-driven rule:\n\n- If the **active organization** has \\`type = PLATFORM_ADMIN\\`, the signed-in user is ensured to have \\`User.role\\` containing \\`admin\\`.\n- This is applied in the session creation hook and re-checked in \\`assertsPlatformAdmin()\\`.\n\nThis keeps admin enablement deterministic and avoids manual role backfills.\n\n## Client config (React web + Expo)\n\nTo avoid duplicate background refresh/polling loops in dev (Fast Refresh/HMR), the Better Auth client is implemented as a singleton cached on \\`globalThis\\`.\n\n- Web client: \\`packages/bundles/contractspec-studio/src/presentation/providers/auth/client.ts\\`\n- Native client: \\`packages/bundles/contractspec-studio/src/presentation/providers/auth/client.native.ts\\`\n\nImport guidance:\n\n- If you only need the context/hook, prefer importing from \\`@lssm/bundle.contractspec-studio/presentation/providers/auth\\`.\n- If you explicitly need the Better Auth client instance (e.g. admin impersonation, direct API calls), import from \\`@lssm/bundle.contractspec-studio/presentation/providers/auth/client\\`.\n\n## Public routes (login / signup)\n\nPublic auth pages should avoid eager \\`authClient\\` initialization.\n\nPattern used:\n\n- In the submit handler, dynamically import \\`@lssm/bundle.contractspec-studio/presentation/providers/auth/index.web\\` and call \\`authClient.signIn.*\\` / \\`authClient.signUp.*\\`.\n\nThis prevents session refresh behavior from starting just because a public page rendered.\n\n## Next.js proxy auth (web-landing)\n\nThe Next.js proxy/middleware is used for **redirect decisions only**. It must not perform DB-backed session reads on every request.\n\n- Source: \\`packages/apps/web-landing/src/proxy.ts\\`\n- Approach: cookie-only checks via Better Auth cookies helpers:\n - \\`getSessionCookie(request)\\`\n - \\`getCookieCache(request)\\`\n\nThese checks are intentionally optimistic and should only gate routing. Full authorization must still be enforced on server-side actions/routes and GraphQL resolvers.\n`\n}];\nregisterDocBlocks(tech_auth_better_auth_nextjs_DocBlocks);\n\n//#endregion\nexport { tech_auth_better_auth_nextjs_DocBlocks };\n//# sourceMappingURL=better-auth-nextjs.docblock.js.map"],"mappings":";;;AAGA,MAAM,yCAAyC,CAAC;CAC/C,IAAI;CACJ,OAAO;CACP,SAAS;CACT,MAAM;CACN,YAAY;CACZ,OAAO;CACP,MAAM;EACL;EACA;EACA;EACA;EACA;EACA;EACA;CACD,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DN,CAAC;AACF,kBAAkB,uCAAuC"}
@@ -0,0 +1,58 @@
1
+ import { registerDocBlocks } from "../../registry.js";
2
+
3
+ //#region ../../libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js
4
+ const tech_contracts_openapi_export_DocBlocks = [{
5
+ id: "docs.tech.contracts.openapi-export",
6
+ title: "OpenAPI export (OpenAPI 3.1) from SpecRegistry",
7
+ summary: "Generate a deterministic OpenAPI document from a SpecRegistry using jsonSchemaForSpec + REST transport metadata.",
8
+ kind: "reference",
9
+ visibility: "public",
10
+ route: "/docs/tech/contracts/openapi-export",
11
+ tags: [
12
+ "contracts",
13
+ "openapi",
14
+ "rest"
15
+ ],
16
+ body: `## OpenAPI export (OpenAPI 3.1) from SpecRegistry
17
+
18
+ ### Purpose
19
+
20
+ ContractSpec specs can be exported into an **OpenAPI 3.1** document for tooling (SDK generation, docs, gateways).
21
+
22
+ The export is **spec-first**:
23
+
24
+ - Uses \`jsonSchemaForSpec(spec)\` for input/output JSON Schema (from SchemaModel → zod → JSON Schema)
25
+ - Uses \`spec.transport.rest.method/path\` when present
26
+ - Falls back to deterministic defaults:
27
+ - Method: \`POST\` for commands, \`GET\` for queries
28
+ - Path: \`defaultRestPath(name, version)\` → \`/<dot/name>/v<version>\`
29
+
30
+ ### Library API
31
+
32
+ - Function: \`openApiForRegistry(registry, options?)\`
33
+ - Location: \`@lssm/lib.contracts/openapi\`
34
+
35
+ ### CLI
36
+
37
+ Export OpenAPI from a registry module:
38
+
39
+ \`\`\`bash
40
+ contractspec openapi --registry ./src/registry.ts --out ./openapi.json
41
+ \`\`\`
42
+
43
+ The registry module must export one of:
44
+
45
+ - \`registry: SpecRegistry\`
46
+ - \`default(): SpecRegistry | Promise<SpecRegistry>\`
47
+ - \`createRegistry(): SpecRegistry | Promise<SpecRegistry>\`
48
+
49
+ ### Notes / limitations (current)
50
+
51
+ - Responses are generated as a basic \`200\` response (plus schemas when available).
52
+ - Query (GET) inputs are currently represented as a JSON request body when an input schema exists.
53
+ - Errors are not yet expanded into OpenAPI responses; that will be added when we standardize error envelopes.`
54
+ }];
55
+ registerDocBlocks(tech_contracts_openapi_export_DocBlocks);
56
+
57
+ //#endregion
58
+ //# sourceMappingURL=openapi-export.docblock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openapi-export.docblock.js","names":[],"sources":["../../../../../../../../../libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js"],"sourcesContent":["import { registerDocBlocks } from \"../../registry.js\";\n\n//#region src/docs/tech/contracts/openapi-export.docblock.ts\nconst tech_contracts_openapi_export_DocBlocks = [{\n\tid: \"docs.tech.contracts.openapi-export\",\n\ttitle: \"OpenAPI export (OpenAPI 3.1) from SpecRegistry\",\n\tsummary: \"Generate a deterministic OpenAPI document from a SpecRegistry using jsonSchemaForSpec + REST transport metadata.\",\n\tkind: \"reference\",\n\tvisibility: \"public\",\n\troute: \"/docs/tech/contracts/openapi-export\",\n\ttags: [\n\t\t\"contracts\",\n\t\t\"openapi\",\n\t\t\"rest\"\n\t],\n\tbody: `## OpenAPI export (OpenAPI 3.1) from SpecRegistry\n\n### Purpose\n\nContractSpec specs can be exported into an **OpenAPI 3.1** document for tooling (SDK generation, docs, gateways).\n\nThe export is **spec-first**:\n\n- Uses \\`jsonSchemaForSpec(spec)\\` for input/output JSON Schema (from SchemaModel → zod → JSON Schema)\n- Uses \\`spec.transport.rest.method/path\\` when present\n- Falls back to deterministic defaults:\n - Method: \\`POST\\` for commands, \\`GET\\` for queries\n - Path: \\`defaultRestPath(name, version)\\` → \\`/<dot/name>/v<version>\\`\n\n### Library API\n\n- Function: \\`openApiForRegistry(registry, options?)\\`\n- Location: \\`@lssm/lib.contracts/openapi\\`\n\n### CLI\n\nExport OpenAPI from a registry module:\n\n\\`\\`\\`bash\ncontractspec openapi --registry ./src/registry.ts --out ./openapi.json\n\\`\\`\\`\n\nThe registry module must export one of:\n\n- \\`registry: SpecRegistry\\`\n- \\`default(): SpecRegistry | Promise<SpecRegistry>\\`\n- \\`createRegistry(): SpecRegistry | Promise<SpecRegistry>\\`\n\n### Notes / limitations (current)\n\n- Responses are generated as a basic \\`200\\` response (plus schemas when available).\n- Query (GET) inputs are currently represented as a JSON request body when an input schema exists.\n- Errors are not yet expanded into OpenAPI responses; that will be added when we standardize error envelopes.`\n}];\nregisterDocBlocks(tech_contracts_openapi_export_DocBlocks);\n\n//#endregion\nexport { tech_contracts_openapi_export_DocBlocks };\n//# sourceMappingURL=openapi-export.docblock.js.map"],"mappings":";;;AAGA,MAAM,0CAA0C,CAAC;CAChD,IAAI;CACJ,OAAO;CACP,SAAS;CACT,MAAM;CACN,YAAY;CACZ,OAAO;CACP,MAAM;EACL;EACA;EACA;EACA;CACD,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCN,CAAC;AACF,kBAAkB,wCAAwC"}
@@ -0,0 +1,17 @@
1
+ import { registerDocBlocks } from "../registry.js";
2
+
3
+ //#region ../../libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js
4
+ const tech_lifecycle_stage_system_DocBlocks = [{
5
+ id: "docs.tech.lifecycle-stage-system",
6
+ title: "ContractSpec Lifecycle Stage System – Technical Design",
7
+ summary: "This document describes how ContractSpec implements lifecycle detection and guidance. It covers architecture, module boundaries, scoring heuristics, and integration points so libraries, modules, bundles, and Studio surfaces stay synchronized.",
8
+ kind: "reference",
9
+ visibility: "public",
10
+ route: "/docs/tech/lifecycle-stage-system",
11
+ tags: ["tech", "lifecycle-stage-system"],
12
+ body: "## ContractSpec Lifecycle Stage System – Technical Design\n\nThis document describes how ContractSpec implements lifecycle detection and guidance. It covers architecture, module boundaries, scoring heuristics, and integration points so libraries, modules, bundles, and Studio surfaces stay synchronized.\n\n---\n\n### 1. Architecture Overview\n\n```\n┌──────────────────────┐\n│ @lssm/lib.lifecycle │ Types, enums, helpers (pure data)\n└───────────┬──────────┘\n │\n┌───────────▼──────────┐ ┌───────────────────────────┐\n│ modules/lifecycle- │ │ modules/lifecycle-advisor │\n│ core (detection) │ │ (guidance & ceremonies) │\n└───────────┬──────────┘ └───────────┬───────────────┘\n │ │\n ├────────────┬──────────────┤\n ▼ ▼ ▼\n Adapters: analytics, intent, questionnaires\n │\n┌───────────▼──────────┐\n│ bundles/lifecycle- │ Managed service for Studio\n│ managed │ (REST handlers, AI agent) │\n└───────────┬──────────┘\n │\n ContractSpec Studio surfaces\n (web/mobile APIs, CLI, docs)\n```\n\n- **Libraries** provide shared vocabulary.\n- **Modules** encapsulate logic, accepting adapters to avoid environment-specific code.\n- **Bundles** compose modules, register agents/events, and expose APIs for Studio.\n- **Apps** (web-landing, future Studio views) consume bundle APIs; they do not reimplement logic. For web-landing we now resolve `@lssm/bundle.contractspec-studio` and `@lssm/lib.database-contractspec-studio` directly from their `packages/.../src` folders via `tsconfig` path aliases so Prisma stays on the server build and Turbopack no longer pulls the prebundled `dist` artifacts into client chunks.\n\n---\n\n### 2. Core Library (`@lssm/lib.lifecycle`)\n\n- Stage enum (0–6) with metadata (`question`, `signals`, `traps`).\n- Axes types (`ProductPhase`, `CompanyPhase`, `CapitalPhase`).\n- `LifecycleSignal` (source, metric, value, timestamp).\n- `LifecycleMetricSnapshot` (aggregated numbers).\n- `LifecycleMilestone`, `LifecycleAction`, `LifecycleAssessment` interfaces.\n- Utility helpers:\n - `formatStageSummary(stage, assessment)`\n - `rankStageCandidates(scores)`\n\nThe library exports **no runtime dependencies** so it can be imported from apps, modules, and bundles alike.\n\n---\n\n### 3. Lifecycle Core Module\n\n**Location:** `packages/modules/lifecycle-core/`\n\n#### Components\n1. **StageSignalCollector**\n - Accepts adapter interfaces:\n - `AnalyticsAdapter` (pulls metrics from `@lssm/lib.analytics` or fixture streams).\n - `IntentAdapter` (hooks into `@lssm/lib.observability` intent detectors or logs).\n - `QuestionnaireAdapter` (loads JSON questionnaires and responses).\n - Produces normalized `LifecycleSignal[]`.\n\n2. **StageScorer**\n - Weighted scoring model:\n - Base weight per stage (reflecting expected maturity).\n - Feature weights (retention, revenue, team size, qualitative feedback).\n - Confidence computed via variance of contributing signals.\n - Supports pluggable scoring matrices via JSON config.\n - Accepts sparse metric snapshots; the orchestrator sanitizes metrics to numeric-only records before persisting assessments so downstream analytics stay consistent.\n\n3. **LifecycleOrchestrator**\n - Coordinates collectors + scorer.\n - Returns `LifecycleAssessment` with:\n - `stage`, `confidence`, `axisSnapshot`, `signalsUsed`.\n - Recommended focus areas (high-level categories only).\n - Emits events (internally) when stage confidence crosses thresholds (consumed later by bundle).\n\n4. **LifecycleMilestonePlanner**\n - Loads `milestones-catalog.json` (no DB).\n - Filters upcoming milestones per stage + axis.\n - Tracks completion using provided IDs (caller persists).\n\n#### Data Files\n- `configs/stage-weights.json`\n- `configs/milestones-catalog.json`\n- `questionnaires/stage-readiness.json`\n\n#### Extension Hooks\n- All adapters exported as TypeScript interfaces.\n- Implementations for analytics/intent can live in bundles or apps without modifying module code.\n\n---\n\n### 4. Lifecycle Advisor Module\n\n**Location:** `packages/modules/lifecycle-advisor/`\n\n#### Components\n1. **LifecycleRecommendationEngine**\n - Consumes `LifecycleAssessment`.\n - Maps gaps to `LifecycleAction[]` using rule tables (`stage-playbooks.ts`).\n - Supports override hooks for customer-specific rules.\n\n2. **ContractSpecLibraryRecommender**\n - Maintains mapping from stage → recommended libraries/modules/bundles.\n - Returns prioritized list with rationale and adoption prerequisites.\n\n3. **LifecycleCeremonyDesigner**\n - Provides textual/structural data for ceremonies (title, copy, animation cues, soundtrack references).\n - Ensures low-tech friendly instructions (clear copy, undo guidance).\n\n4. **AI Hooks**\n - Defines prompt templates and tool manifests for lifecycle advisor agents (consumed by bundles).\n - Keeps actual LLM integration outside module.\n\n---\n\n### 5. Managed Bundle (`lifecycle-managed`)\n\n**Responsibilities**\n- Wire modules together.\n- Provide HTTP/GraphQL handlers (exact transport optional).\n- Register LifecycleAdvisorAgent via `@lssm/lib.ai-agent`.\n- LifecycleAdvisorAgent meta: domain `operations`, owners `team-lifecycle`, stability `experimental`, tags `guide/lifecycle/ops` so ops tooling can route incidents quickly.\n- Emit lifecycle events through `@lssm/lib.bus` + `@lssm/lib.analytics`.\n- Integrate with `contractspec-studio` packages:\n - Use Studio contracts for authentication/tenant context (without accessing tenant DBs).\n - Store assessments in Studio-managed storage abstractions (in-memory or file-based for now).\n\n**APIs**\n- `POST /lifecycle/assessments`: Accepts metrics + optional questionnaire answers. Returns `LifecycleAssessment`.\n- `GET /lifecycle/playbooks/:stage`: Returns stage playbook + ceremonies.\n- `POST /lifecycle/advise`: Invokes LifecycleAdvisorAgent with context.\n\n**Events**\n- `LifecycleAssessmentCreated`\n- `LifecycleStageChanged`\n- `LifecycleGuidanceConsumed`\n\n---\n\n### 6. Library Enhancements\n\n| Library | Enhancement |\n| --- | --- |\n| `@lssm/lib.analytics` | Lifecycle metric collectors, helper to emit stage events, adapter implementation used by `StageSignalCollector`. |\n| `@lssm/lib.evolution` | Accepts `LifecycleContext` when ranking spec anomalies/suggestions. |\n| `@lssm/lib.growth` | Stage-specific experiment templates + guardrails referencing lifecycle enums. |\n| `@lssm/lib.observability` | Lifecycle KPI pipeline definitions (drift detection, regression alerts). |\n\nEach enhancement must import stage types from `@lssm/lib.lifecycle`.\n\n---\n\n### 7. Feature Flags & Progressive Delivery\n\n- Add new flags in progressive-delivery library:\n - `LIFECYCLE_DETECTION_ALPHA`\n - `LIFECYCLE_ADVISOR_ALPHA`\n - `LIFECYCLE_MANAGED_SERVICE`\n- Bundles/modules should check flags before enabling workflows.\n- Flags referenced in docs + Studio UI to avoid accidental exposure.\n\n---\n\n### 8. Analytics & Telemetry\n\n- Events defined in analytics library; consumed by bundle/app:\n - `lifecycle_assessment_run`\n - `lifecycle_stage_changed`\n - `lifecycle_guidance_consumed`\n- Observability pipeline includes:\n - Composite lifecycle health metric (weighted sum of KPIs).\n - Drift detection comparing stage predictions over time.\n - Alert manager recipes for regression (e.g., PMF drop).\n\n---\n\n### 9. Testing Strategy\n\n1. **Unit**\n - StageScorer weight matrix.\n - RecommendationEngine mapping.\n - Library recommender stage coverage.\n\n2. **Contract**\n - Adapters: ensure mock adapters satisfy interfaces.\n - Bundles: ensure HTTP handlers respect request/response contracts even without persistence.\n\n3. **Integration**\n - CLI example runs detection + guidance end-to-end on fixture data.\n - Dashboard example renders assessments, verifying JSON structures remain stable.\n\n---\n\n### 10. Implementation Checklist\n\n- [ ] Documentation (product, tech, ops, user).\n- [ ] Library creation (`@lssm/lib.lifecycle`).\n- [ ] Modules (`lifecycle-core`, `lifecycle-advisor`).\n- [ ] Bundle (`lifecycle-managed`) + Studio wiring.\n- [ ] Library enhancements (analytics/evolution/growth/observability).\n- [ ] Examples (CLI + dashboard).\n- [ ] Feature flags + telemetry.\n- [ ] Automated tests + fixtures.\n\nKeep this document in sync as modules evolve. When adding new stages or axes, update `@lssm/lib.lifecycle` first, then cascade to adapters, then refresh docs + Studio copy.*** End Patch*** End Patch\n\n\n"
13
+ }];
14
+ registerDocBlocks(tech_lifecycle_stage_system_DocBlocks);
15
+
16
+ //#endregion
17
+ //# sourceMappingURL=lifecycle-stage-system.docblock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle-stage-system.docblock.js","names":[],"sources":["../../../../../../../../libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js"],"sourcesContent":["import { registerDocBlocks } from \"../registry.js\";\n\n//#region src/docs/tech/lifecycle-stage-system.docblock.ts\nconst tech_lifecycle_stage_system_DocBlocks = [{\n\tid: \"docs.tech.lifecycle-stage-system\",\n\ttitle: \"ContractSpec Lifecycle Stage System – Technical Design\",\n\tsummary: \"This document describes how ContractSpec implements lifecycle detection and guidance. It covers architecture, module boundaries, scoring heuristics, and integration points so libraries, modules, bundles, and Studio surfaces stay synchronized.\",\n\tkind: \"reference\",\n\tvisibility: \"public\",\n\troute: \"/docs/tech/lifecycle-stage-system\",\n\ttags: [\"tech\", \"lifecycle-stage-system\"],\n\tbody: \"## ContractSpec Lifecycle Stage System – Technical Design\\n\\nThis document describes how ContractSpec implements lifecycle detection and guidance. It covers architecture, module boundaries, scoring heuristics, and integration points so libraries, modules, bundles, and Studio surfaces stay synchronized.\\n\\n---\\n\\n### 1. Architecture Overview\\n\\n```\\n┌──────────────────────┐\\n│ @lssm/lib.lifecycle │ Types, enums, helpers (pure data)\\n└───────────┬──────────┘\\n │\\n┌───────────▼──────────┐ ┌───────────────────────────┐\\n│ modules/lifecycle- │ │ modules/lifecycle-advisor │\\n│ core (detection) │ │ (guidance & ceremonies) │\\n└───────────┬──────────┘ └───────────┬───────────────┘\\n │ │\\n ├────────────┬──────────────┤\\n ▼ ▼ ▼\\n Adapters: analytics, intent, questionnaires\\n │\\n┌───────────▼──────────┐\\n│ bundles/lifecycle- │ Managed service for Studio\\n│ managed │ (REST handlers, AI agent) │\\n└───────────┬──────────┘\\n │\\n ContractSpec Studio surfaces\\n (web/mobile APIs, CLI, docs)\\n```\\n\\n- **Libraries** provide shared vocabulary.\\n- **Modules** encapsulate logic, accepting adapters to avoid environment-specific code.\\n- **Bundles** compose modules, register agents/events, and expose APIs for Studio.\\n- **Apps** (web-landing, future Studio views) consume bundle APIs; they do not reimplement logic. For web-landing we now resolve `@lssm/bundle.contractspec-studio` and `@lssm/lib.database-contractspec-studio` directly from their `packages/.../src` folders via `tsconfig` path aliases so Prisma stays on the server build and Turbopack no longer pulls the prebundled `dist` artifacts into client chunks.\\n\\n---\\n\\n### 2. Core Library (`@lssm/lib.lifecycle`)\\n\\n- Stage enum (0–6) with metadata (`question`, `signals`, `traps`).\\n- Axes types (`ProductPhase`, `CompanyPhase`, `CapitalPhase`).\\n- `LifecycleSignal` (source, metric, value, timestamp).\\n- `LifecycleMetricSnapshot` (aggregated numbers).\\n- `LifecycleMilestone`, `LifecycleAction`, `LifecycleAssessment` interfaces.\\n- Utility helpers:\\n - `formatStageSummary(stage, assessment)`\\n - `rankStageCandidates(scores)`\\n\\nThe library exports **no runtime dependencies** so it can be imported from apps, modules, and bundles alike.\\n\\n---\\n\\n### 3. Lifecycle Core Module\\n\\n**Location:** `packages/modules/lifecycle-core/`\\n\\n#### Components\\n1. **StageSignalCollector**\\n - Accepts adapter interfaces:\\n - `AnalyticsAdapter` (pulls metrics from `@lssm/lib.analytics` or fixture streams).\\n - `IntentAdapter` (hooks into `@lssm/lib.observability` intent detectors or logs).\\n - `QuestionnaireAdapter` (loads JSON questionnaires and responses).\\n - Produces normalized `LifecycleSignal[]`.\\n\\n2. **StageScorer**\\n - Weighted scoring model:\\n - Base weight per stage (reflecting expected maturity).\\n - Feature weights (retention, revenue, team size, qualitative feedback).\\n - Confidence computed via variance of contributing signals.\\n - Supports pluggable scoring matrices via JSON config.\\n - Accepts sparse metric snapshots; the orchestrator sanitizes metrics to numeric-only records before persisting assessments so downstream analytics stay consistent.\\n\\n3. **LifecycleOrchestrator**\\n - Coordinates collectors + scorer.\\n - Returns `LifecycleAssessment` with:\\n - `stage`, `confidence`, `axisSnapshot`, `signalsUsed`.\\n - Recommended focus areas (high-level categories only).\\n - Emits events (internally) when stage confidence crosses thresholds (consumed later by bundle).\\n\\n4. **LifecycleMilestonePlanner**\\n - Loads `milestones-catalog.json` (no DB).\\n - Filters upcoming milestones per stage + axis.\\n - Tracks completion using provided IDs (caller persists).\\n\\n#### Data Files\\n- `configs/stage-weights.json`\\n- `configs/milestones-catalog.json`\\n- `questionnaires/stage-readiness.json`\\n\\n#### Extension Hooks\\n- All adapters exported as TypeScript interfaces.\\n- Implementations for analytics/intent can live in bundles or apps without modifying module code.\\n\\n---\\n\\n### 4. Lifecycle Advisor Module\\n\\n**Location:** `packages/modules/lifecycle-advisor/`\\n\\n#### Components\\n1. **LifecycleRecommendationEngine**\\n - Consumes `LifecycleAssessment`.\\n - Maps gaps to `LifecycleAction[]` using rule tables (`stage-playbooks.ts`).\\n - Supports override hooks for customer-specific rules.\\n\\n2. **ContractSpecLibraryRecommender**\\n - Maintains mapping from stage → recommended libraries/modules/bundles.\\n - Returns prioritized list with rationale and adoption prerequisites.\\n\\n3. **LifecycleCeremonyDesigner**\\n - Provides textual/structural data for ceremonies (title, copy, animation cues, soundtrack references).\\n - Ensures low-tech friendly instructions (clear copy, undo guidance).\\n\\n4. **AI Hooks**\\n - Defines prompt templates and tool manifests for lifecycle advisor agents (consumed by bundles).\\n - Keeps actual LLM integration outside module.\\n\\n---\\n\\n### 5. Managed Bundle (`lifecycle-managed`)\\n\\n**Responsibilities**\\n- Wire modules together.\\n- Provide HTTP/GraphQL handlers (exact transport optional).\\n- Register LifecycleAdvisorAgent via `@lssm/lib.ai-agent`.\\n- LifecycleAdvisorAgent meta: domain `operations`, owners `team-lifecycle`, stability `experimental`, tags `guide/lifecycle/ops` so ops tooling can route incidents quickly.\\n- Emit lifecycle events through `@lssm/lib.bus` + `@lssm/lib.analytics`.\\n- Integrate with `contractspec-studio` packages:\\n - Use Studio contracts for authentication/tenant context (without accessing tenant DBs).\\n - Store assessments in Studio-managed storage abstractions (in-memory or file-based for now).\\n\\n**APIs**\\n- `POST /lifecycle/assessments`: Accepts metrics + optional questionnaire answers. Returns `LifecycleAssessment`.\\n- `GET /lifecycle/playbooks/:stage`: Returns stage playbook + ceremonies.\\n- `POST /lifecycle/advise`: Invokes LifecycleAdvisorAgent with context.\\n\\n**Events**\\n- `LifecycleAssessmentCreated`\\n- `LifecycleStageChanged`\\n- `LifecycleGuidanceConsumed`\\n\\n---\\n\\n### 6. Library Enhancements\\n\\n| Library | Enhancement |\\n| --- | --- |\\n| `@lssm/lib.analytics` | Lifecycle metric collectors, helper to emit stage events, adapter implementation used by `StageSignalCollector`. |\\n| `@lssm/lib.evolution` | Accepts `LifecycleContext` when ranking spec anomalies/suggestions. |\\n| `@lssm/lib.growth` | Stage-specific experiment templates + guardrails referencing lifecycle enums. |\\n| `@lssm/lib.observability` | Lifecycle KPI pipeline definitions (drift detection, regression alerts). |\\n\\nEach enhancement must import stage types from `@lssm/lib.lifecycle`.\\n\\n---\\n\\n### 7. Feature Flags & Progressive Delivery\\n\\n- Add new flags in progressive-delivery library:\\n - `LIFECYCLE_DETECTION_ALPHA`\\n - `LIFECYCLE_ADVISOR_ALPHA`\\n - `LIFECYCLE_MANAGED_SERVICE`\\n- Bundles/modules should check flags before enabling workflows.\\n- Flags referenced in docs + Studio UI to avoid accidental exposure.\\n\\n---\\n\\n### 8. Analytics & Telemetry\\n\\n- Events defined in analytics library; consumed by bundle/app:\\n - `lifecycle_assessment_run`\\n - `lifecycle_stage_changed`\\n - `lifecycle_guidance_consumed`\\n- Observability pipeline includes:\\n - Composite lifecycle health metric (weighted sum of KPIs).\\n - Drift detection comparing stage predictions over time.\\n - Alert manager recipes for regression (e.g., PMF drop).\\n\\n---\\n\\n### 9. Testing Strategy\\n\\n1. **Unit**\\n - StageScorer weight matrix.\\n - RecommendationEngine mapping.\\n - Library recommender stage coverage.\\n\\n2. **Contract**\\n - Adapters: ensure mock adapters satisfy interfaces.\\n - Bundles: ensure HTTP handlers respect request/response contracts even without persistence.\\n\\n3. **Integration**\\n - CLI example runs detection + guidance end-to-end on fixture data.\\n - Dashboard example renders assessments, verifying JSON structures remain stable.\\n\\n---\\n\\n### 10. Implementation Checklist\\n\\n- [ ] Documentation (product, tech, ops, user).\\n- [ ] Library creation (`@lssm/lib.lifecycle`).\\n- [ ] Modules (`lifecycle-core`, `lifecycle-advisor`).\\n- [ ] Bundle (`lifecycle-managed`) + Studio wiring.\\n- [ ] Library enhancements (analytics/evolution/growth/observability).\\n- [ ] Examples (CLI + dashboard).\\n- [ ] Feature flags + telemetry.\\n- [ ] Automated tests + fixtures.\\n\\nKeep this document in sync as modules evolve. When adding new stages or axes, update `@lssm/lib.lifecycle` first, then cascade to adapters, then refresh docs + Studio copy.*** End Patch*** End Patch\\n\\n\\n\"\n}];\nregisterDocBlocks(tech_lifecycle_stage_system_DocBlocks);\n\n//#endregion\nexport { tech_lifecycle_stage_system_DocBlocks };\n//# sourceMappingURL=lifecycle-stage-system.docblock.js.map"],"mappings":";;;AAGA,MAAM,wCAAwC,CAAC;CAC9C,IAAI;CACJ,OAAO;CACP,SAAS;CACT,MAAM;CACN,YAAY;CACZ,OAAO;CACP,MAAM,CAAC,QAAQ,yBAAyB;CACxC,MAAM;CACN,CAAC;AACF,kBAAkB,sCAAsC"}