@lssm/example.learning-patterns 0.0.0-canary-20251217083314 → 1.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/.turbo/turbo-build.log +50 -52
  2. package/dist/docs/index.js +1 -1
  3. package/dist/docs/learning-patterns.docblock.js +11 -30
  4. package/dist/events.js +1 -15
  5. package/dist/example.js +1 -34
  6. package/dist/index.js +1 -9
  7. package/dist/libs/contracts/src/docs/PUBLISHING.docblock.js +76 -0
  8. package/dist/libs/contracts/src/docs/accessibility_wcag_compliance_specs.docblock.js +350 -0
  9. package/dist/libs/contracts/src/docs/index.js +1 -0
  10. package/dist/libs/contracts/src/docs/presentations.js +1 -0
  11. package/dist/libs/contracts/src/docs/registry.js +1 -0
  12. package/dist/libs/contracts/src/docs/tech/PHASE_1_QUICKSTART.docblock.js +383 -0
  13. package/dist/libs/contracts/src/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +68 -0
  14. package/dist/libs/contracts/src/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +140 -0
  15. package/dist/libs/contracts/src/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +86 -0
  16. package/dist/libs/contracts/src/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +1 -0
  17. package/dist/libs/contracts/{dist → src}/docs/tech/auth/better-auth-nextjs.docblock.js +2 -24
  18. package/dist/libs/contracts/{dist → src}/docs/tech/contracts/openapi-export.docblock.js +2 -21
  19. package/dist/libs/contracts/src/docs/tech/lifecycle-stage-system.docblock.js +213 -0
  20. package/dist/libs/contracts/{dist → src}/docs/tech/llm/llm-integration.docblock.js +5 -73
  21. package/dist/libs/contracts/src/docs/tech/mcp-endpoints.docblock.js +1 -0
  22. package/dist/libs/contracts/src/docs/tech/presentation-runtime.docblock.js +1 -0
  23. package/dist/libs/contracts/src/docs/tech/schema/README.docblock.js +262 -0
  24. package/dist/libs/contracts/src/docs/tech/studio/learning-events.docblock.js +1 -0
  25. package/dist/libs/contracts/{dist → src}/docs/tech/studio/learning-journeys.docblock.js +2 -24
  26. package/dist/libs/contracts/{dist → src}/docs/tech/studio/platform-admin-panel.docblock.js +2 -23
  27. package/dist/libs/contracts/src/docs/tech/studio/project-access-teams.docblock.js +36 -0
  28. package/dist/libs/contracts/src/docs/tech/studio/project-routing.docblock.js +1 -0
  29. package/dist/libs/contracts/src/docs/tech/studio/sandbox-unlogged.docblock.js +20 -0
  30. package/dist/libs/contracts/{dist → src}/docs/tech/studio/team-invitations.docblock.js +36 -40
  31. package/dist/libs/contracts/src/docs/tech/studio/workspace-ops.docblock.js +1 -0
  32. package/dist/libs/contracts/{dist → src}/docs/tech/studio/workspaces.docblock.js +2 -23
  33. package/dist/libs/contracts/{dist → src}/docs/tech/telemetry-ingest.docblock.js +3 -36
  34. package/dist/libs/contracts/src/docs/tech/templates/runtime.docblock.js +1 -0
  35. package/dist/libs/contracts/{dist → src}/docs/tech/vscode-extension.docblock.js +3 -36
  36. package/dist/libs/contracts/src/docs/tech/workflows/overview.docblock.js +1 -0
  37. package/dist/tracks/ambient-coach.js +1 -47
  38. package/dist/tracks/drills.js +1 -53
  39. package/dist/tracks/index.js +1 -5
  40. package/dist/tracks/quests.js +1 -55
  41. package/package.json +13 -17
  42. package/tsconfig.tsbuildinfo +1 -1
  43. package/tsdown.config.js +10 -0
  44. package/.turbo/turbo-build$colon$bundle.log +0 -59
  45. package/CHANGELOG.md +0 -14
  46. package/dist/docs/index.d.ts +0 -1
  47. package/dist/docs/learning-patterns.docblock.d.ts +0 -1
  48. package/dist/events.d.ts +0 -15
  49. package/dist/example.d.ts +0 -32
  50. package/dist/index.d.ts +0 -6
  51. package/dist/libs/contracts/dist/docs/PUBLISHING.docblock.js +0 -16
  52. package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +0 -16
  53. package/dist/libs/contracts/dist/docs/index.js +0 -29
  54. package/dist/libs/contracts/dist/docs/presentations.js +0 -71
  55. package/dist/libs/contracts/dist/docs/registry.js +0 -44
  56. package/dist/libs/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +0 -16
  57. package/dist/libs/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +0 -16
  58. package/dist/libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +0 -16
  59. package/dist/libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +0 -16
  60. package/dist/libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +0 -16
  61. package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +0 -16
  62. package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +0 -37
  63. package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +0 -16
  64. package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +0 -20
  65. package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +0 -48
  66. package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +0 -45
  67. package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +0 -67
  68. package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +0 -40
  69. package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +0 -47
  70. package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +0 -20
  71. package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +0 -20
  72. package/dist/tracks/ambient-coach.d.ts +0 -7
  73. package/dist/tracks/drills.d.ts +0 -7
  74. package/dist/tracks/index.d.ts +0 -4
  75. package/dist/tracks/quests.d.ts +0 -7
@@ -1,22 +1,4 @@
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)
1
+ import{registerDocBlocks as e}from"../../registry.js";e([{id:`docs.tech.auth.better-auth-nextjs`,title:`Better Auth + Next.js integration (ContractSpec)`,summary:`How ContractSpec wires Better Auth into Next.js (server config, client singleton, and proxy cookie-only redirects).`,kind:`reference`,visibility:`public`,route:`/docs/tech/auth/better-auth-nextjs`,tags:[`auth`,`better-auth`,`nextjs`,`cookies`,`proxy`,`hmr`],body:`# Better Auth + Next.js integration (ContractSpec)
20
2
 
21
3
  This repo uses Better Auth as the primary auth layer (sessions, organizations, teams, API keys, and OAuth).
22
4
 
@@ -73,8 +55,4 @@ The Next.js proxy/middleware is used for **redirect decisions only**. It must no
73
55
  - \`getCookieCache(request)\`
74
56
 
75
57
  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
58
+ `}]);
@@ -1,19 +1,4 @@
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
1
+ import{registerDocBlocks as e}from"../../registry.js";e([{id:`docs.tech.contracts.openapi-export`,title:`OpenAPI export (OpenAPI 3.1) from SpecRegistry`,summary:`Generate a deterministic OpenAPI document from a SpecRegistry using jsonSchemaForSpec + REST transport metadata.`,kind:`reference`,visibility:`public`,route:`/docs/tech/contracts/openapi-export`,tags:[`contracts`,`openapi`,`rest`],body:`## OpenAPI export (OpenAPI 3.1) from SpecRegistry
17
2
 
18
3
  ### Purpose
19
4
 
@@ -50,8 +35,4 @@ The registry module must export one of:
50
35
 
51
36
  - Responses are generated as a basic \`200\` response (plus schemas when available).
52
37
  - 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
38
+ - Errors are not yet expanded into OpenAPI responses; that will be added when we standardize error envelopes.`}]);
@@ -0,0 +1,213 @@
1
+ import{registerDocBlocks as e}from"../registry.js";e([{id:`docs.tech.lifecycle-stage-system`,title:`ContractSpec Lifecycle Stage System – Technical Design`,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.`,kind:`reference`,visibility:`public`,route:`/docs/tech/lifecycle-stage-system`,tags:[`tech`,`lifecycle-stage-system`],body:`## ContractSpec Lifecycle Stage System – Technical Design
2
+
3
+ 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.
4
+
5
+ ---
6
+
7
+ ### 1. Architecture Overview
8
+
9
+ \`\`\`
10
+ ┌──────────────────────┐
11
+ │ @lssm/lib.lifecycle │ Types, enums, helpers (pure data)
12
+ └───────────┬──────────┘
13
+
14
+ ┌───────────▼──────────┐ ┌───────────────────────────┐
15
+ │ modules/lifecycle- │ │ modules/lifecycle-advisor │
16
+ │ core (detection) │ │ (guidance & ceremonies) │
17
+ └───────────┬──────────┘ └───────────┬───────────────┘
18
+ │ │
19
+ ├────────────┬──────────────┤
20
+ ▼ ▼ ▼
21
+ Adapters: analytics, intent, questionnaires
22
+
23
+ ┌───────────▼──────────┐
24
+ │ bundles/lifecycle- │ Managed service for Studio
25
+ │ managed │ (REST handlers, AI agent) │
26
+ └───────────┬──────────┘
27
+
28
+ ContractSpec Studio surfaces
29
+ (web/mobile APIs, CLI, docs)
30
+ \`\`\`
31
+
32
+ - **Libraries** provide shared vocabulary.
33
+ - **Modules** encapsulate logic, accepting adapters to avoid environment-specific code.
34
+ - **Bundles** compose modules, register agents/events, and expose APIs for Studio.
35
+ - **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.
36
+
37
+ ---
38
+
39
+ ### 2. Core Library (\`@lssm/lib.lifecycle\`)
40
+
41
+ - Stage enum (0–6) with metadata (\`question\`, \`signals\`, \`traps\`).
42
+ - Axes types (\`ProductPhase\`, \`CompanyPhase\`, \`CapitalPhase\`).
43
+ - \`LifecycleSignal\` (source, metric, value, timestamp).
44
+ - \`LifecycleMetricSnapshot\` (aggregated numbers).
45
+ - \`LifecycleMilestone\`, \`LifecycleAction\`, \`LifecycleAssessment\` interfaces.
46
+ - Utility helpers:
47
+ - \`formatStageSummary(stage, assessment)\`
48
+ - \`rankStageCandidates(scores)\`
49
+
50
+ The library exports **no runtime dependencies** so it can be imported from apps, modules, and bundles alike.
51
+
52
+ ---
53
+
54
+ ### 3. Lifecycle Core Module
55
+
56
+ **Location:** \`packages/modules/lifecycle-core/\`
57
+
58
+ #### Components
59
+ 1. **StageSignalCollector**
60
+ - Accepts adapter interfaces:
61
+ - \`AnalyticsAdapter\` (pulls metrics from \`@lssm/lib.analytics\` or fixture streams).
62
+ - \`IntentAdapter\` (hooks into \`@lssm/lib.observability\` intent detectors or logs).
63
+ - \`QuestionnaireAdapter\` (loads JSON questionnaires and responses).
64
+ - Produces normalized \`LifecycleSignal[]\`.
65
+
66
+ 2. **StageScorer**
67
+ - Weighted scoring model:
68
+ - Base weight per stage (reflecting expected maturity).
69
+ - Feature weights (retention, revenue, team size, qualitative feedback).
70
+ - Confidence computed via variance of contributing signals.
71
+ - Supports pluggable scoring matrices via JSON config.
72
+ - Accepts sparse metric snapshots; the orchestrator sanitizes metrics to numeric-only records before persisting assessments so downstream analytics stay consistent.
73
+
74
+ 3. **LifecycleOrchestrator**
75
+ - Coordinates collectors + scorer.
76
+ - Returns \`LifecycleAssessment\` with:
77
+ - \`stage\`, \`confidence\`, \`axisSnapshot\`, \`signalsUsed\`.
78
+ - Recommended focus areas (high-level categories only).
79
+ - Emits events (internally) when stage confidence crosses thresholds (consumed later by bundle).
80
+
81
+ 4. **LifecycleMilestonePlanner**
82
+ - Loads \`milestones-catalog.json\` (no DB).
83
+ - Filters upcoming milestones per stage + axis.
84
+ - Tracks completion using provided IDs (caller persists).
85
+
86
+ #### Data Files
87
+ - \`configs/stage-weights.json\`
88
+ - \`configs/milestones-catalog.json\`
89
+ - \`questionnaires/stage-readiness.json\`
90
+
91
+ #### Extension Hooks
92
+ - All adapters exported as TypeScript interfaces.
93
+ - Implementations for analytics/intent can live in bundles or apps without modifying module code.
94
+
95
+ ---
96
+
97
+ ### 4. Lifecycle Advisor Module
98
+
99
+ **Location:** \`packages/modules/lifecycle-advisor/\`
100
+
101
+ #### Components
102
+ 1. **LifecycleRecommendationEngine**
103
+ - Consumes \`LifecycleAssessment\`.
104
+ - Maps gaps to \`LifecycleAction[]\` using rule tables (\`stage-playbooks.ts\`).
105
+ - Supports override hooks for customer-specific rules.
106
+
107
+ 2. **ContractSpecLibraryRecommender**
108
+ - Maintains mapping from stage → recommended libraries/modules/bundles.
109
+ - Returns prioritized list with rationale and adoption prerequisites.
110
+
111
+ 3. **LifecycleCeremonyDesigner**
112
+ - Provides textual/structural data for ceremonies (title, copy, animation cues, soundtrack references).
113
+ - Ensures low-tech friendly instructions (clear copy, undo guidance).
114
+
115
+ 4. **AI Hooks**
116
+ - Defines prompt templates and tool manifests for lifecycle advisor agents (consumed by bundles).
117
+ - Keeps actual LLM integration outside module.
118
+
119
+ ---
120
+
121
+ ### 5. Managed Bundle (\`lifecycle-managed\`)
122
+
123
+ **Responsibilities**
124
+ - Wire modules together.
125
+ - Provide HTTP/GraphQL handlers (exact transport optional).
126
+ - Register LifecycleAdvisorAgent via \`@lssm/lib.ai-agent\`.
127
+ - LifecycleAdvisorAgent meta: domain \`operations\`, owners \`team-lifecycle\`, stability \`experimental\`, tags \`guide/lifecycle/ops\` so ops tooling can route incidents quickly.
128
+ - Emit lifecycle events through \`@lssm/lib.bus\` + \`@lssm/lib.analytics\`.
129
+ - Integrate with \`contractspec-studio\` packages:
130
+ - Use Studio contracts for authentication/tenant context (without accessing tenant DBs).
131
+ - Store assessments in Studio-managed storage abstractions (in-memory or file-based for now).
132
+
133
+ **APIs**
134
+ - \`POST /lifecycle/assessments\`: Accepts metrics + optional questionnaire answers. Returns \`LifecycleAssessment\`.
135
+ - \`GET /lifecycle/playbooks/:stage\`: Returns stage playbook + ceremonies.
136
+ - \`POST /lifecycle/advise\`: Invokes LifecycleAdvisorAgent with context.
137
+
138
+ **Events**
139
+ - \`LifecycleAssessmentCreated\`
140
+ - \`LifecycleStageChanged\`
141
+ - \`LifecycleGuidanceConsumed\`
142
+
143
+ ---
144
+
145
+ ### 6. Library Enhancements
146
+
147
+ | Library | Enhancement |
148
+ | --- | --- |
149
+ | \`@lssm/lib.analytics\` | Lifecycle metric collectors, helper to emit stage events, adapter implementation used by \`StageSignalCollector\`. |
150
+ | \`@lssm/lib.evolution\` | Accepts \`LifecycleContext\` when ranking spec anomalies/suggestions. |
151
+ | \`@lssm/lib.growth\` | Stage-specific experiment templates + guardrails referencing lifecycle enums. |
152
+ | \`@lssm/lib.observability\` | Lifecycle KPI pipeline definitions (drift detection, regression alerts). |
153
+
154
+ Each enhancement must import stage types from \`@lssm/lib.lifecycle\`.
155
+
156
+ ---
157
+
158
+ ### 7. Feature Flags & Progressive Delivery
159
+
160
+ - Add new flags in progressive-delivery library:
161
+ - \`LIFECYCLE_DETECTION_ALPHA\`
162
+ - \`LIFECYCLE_ADVISOR_ALPHA\`
163
+ - \`LIFECYCLE_MANAGED_SERVICE\`
164
+ - Bundles/modules should check flags before enabling workflows.
165
+ - Flags referenced in docs + Studio UI to avoid accidental exposure.
166
+
167
+ ---
168
+
169
+ ### 8. Analytics & Telemetry
170
+
171
+ - Events defined in analytics library; consumed by bundle/app:
172
+ - \`lifecycle_assessment_run\`
173
+ - \`lifecycle_stage_changed\`
174
+ - \`lifecycle_guidance_consumed\`
175
+ - Observability pipeline includes:
176
+ - Composite lifecycle health metric (weighted sum of KPIs).
177
+ - Drift detection comparing stage predictions over time.
178
+ - Alert manager recipes for regression (e.g., PMF drop).
179
+
180
+ ---
181
+
182
+ ### 9. Testing Strategy
183
+
184
+ 1. **Unit**
185
+ - StageScorer weight matrix.
186
+ - RecommendationEngine mapping.
187
+ - Library recommender stage coverage.
188
+
189
+ 2. **Contract**
190
+ - Adapters: ensure mock adapters satisfy interfaces.
191
+ - Bundles: ensure HTTP handlers respect request/response contracts even without persistence.
192
+
193
+ 3. **Integration**
194
+ - CLI example runs detection + guidance end-to-end on fixture data.
195
+ - Dashboard example renders assessments, verifying JSON structures remain stable.
196
+
197
+ ---
198
+
199
+ ### 10. Implementation Checklist
200
+
201
+ - [ ] Documentation (product, tech, ops, user).
202
+ - [ ] Library creation (\`@lssm/lib.lifecycle\`).
203
+ - [ ] Modules (\`lifecycle-core\`, \`lifecycle-advisor\`).
204
+ - [ ] Bundle (\`lifecycle-managed\`) + Studio wiring.
205
+ - [ ] Library enhancements (analytics/evolution/growth/observability).
206
+ - [ ] Examples (CLI + dashboard).
207
+ - [ ] Feature flags + telemetry.
208
+ - [ ] Automated tests + fixtures.
209
+
210
+ Keep 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
211
+
212
+
213
+ `}]);
@@ -1,22 +1,4 @@
1
- import { registerDocBlocks } from "../../registry.js";
2
-
3
- //#region ../../libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js
4
- const tech_llm_integration_DocBlocks = [
5
- {
6
- id: "docs.tech.llm.overview",
7
- title: "LLM Integration Overview",
8
- summary: "Export specs to LLM-friendly formats, generate implementation guides, and verify implementations.",
9
- kind: "reference",
10
- visibility: "public",
11
- route: "/docs/tech/llm/overview",
12
- tags: [
13
- "llm",
14
- "ai",
15
- "export",
16
- "guide",
17
- "verify"
18
- ],
19
- body: `# LLM Integration
1
+ import{registerDocBlocks as e}from"../../registry.js";e([{id:`docs.tech.llm.overview`,title:`LLM Integration Overview`,summary:`Export specs to LLM-friendly formats, generate implementation guides, and verify implementations.`,kind:`reference`,visibility:`public`,route:`/docs/tech/llm/overview`,tags:[`llm`,`ai`,`export`,`guide`,`verify`],body:`# LLM Integration
20
2
 
21
3
  ContractSpec provides first-class LLM integration to bridge specifications and AI coding agents.
22
4
 
@@ -104,21 +86,7 @@ const result = await verifyService.verify(mySpec, implementationCode, {
104
86
  tiers: ['structure', 'behavior']
105
87
  });
106
88
  \`\`\`
107
- `
108
- },
109
- {
110
- id: "docs.tech.llm.export-formats",
111
- title: "LLM Export Formats",
112
- summary: "Detailed explanation of the three export formats for LLM consumption.",
113
- kind: "reference",
114
- visibility: "public",
115
- route: "/docs/tech/llm/export-formats",
116
- tags: [
117
- "llm",
118
- "export",
119
- "markdown"
120
- ],
121
- body: `# LLM Export Formats
89
+ `},{id:`docs.tech.llm.export-formats`,title:`LLM Export Formats`,summary:`Detailed explanation of the three export formats for LLM consumption.`,kind:`reference`,visibility:`public`,route:`/docs/tech/llm/export-formats`,tags:[`llm`,`export`,`markdown`],body:`# LLM Export Formats
122
90
 
123
91
  ContractSpec provides three export formats optimized for different LLM use cases.
124
92
 
@@ -183,23 +151,7 @@ The prompt format adapts based on task type:
183
151
  - **test**: Test generation for existing code
184
152
  - **refactor**: Refactoring while maintaining behavior
185
153
  - **review**: Code review against spec
186
- `
187
- },
188
- {
189
- id: "docs.tech.llm.agent-adapters",
190
- title: "Agent Adapters",
191
- summary: "Adapters for different AI coding agents (Claude, Cursor, MCP).",
192
- kind: "reference",
193
- visibility: "public",
194
- route: "/docs/tech/llm/agent-adapters",
195
- tags: [
196
- "llm",
197
- "agents",
198
- "claude",
199
- "cursor",
200
- "mcp"
201
- ],
202
- body: `# Agent Adapters
154
+ `},{id:`docs.tech.llm.agent-adapters`,title:`Agent Adapters`,summary:`Adapters for different AI coding agents (Claude, Cursor, MCP).`,kind:`reference`,visibility:`public`,route:`/docs/tech/llm/agent-adapters`,tags:[`llm`,`agents`,`claude`,`cursor`,`mcp`],body:`# Agent Adapters
203
155
 
204
156
  ContractSpec provides specialized adapters for different AI coding agents.
205
157
 
@@ -256,22 +208,7 @@ The generic adapter is the default and works across all agents.
256
208
  | Claude Code | Complex implementations | Extended thinking, detailed steps |
257
209
  | Cursor CLI | IDE-integrated work | Cursor rules, compact format |
258
210
  | Generic MCP | Any MCP agent | Universal compatibility |
259
- `
260
- },
261
- {
262
- id: "docs.tech.llm.verification",
263
- title: "Implementation Verification",
264
- summary: "Tiered verification of implementations against specifications.",
265
- kind: "reference",
266
- visibility: "public",
267
- route: "/docs/tech/llm/verification",
268
- tags: [
269
- "llm",
270
- "verify",
271
- "validation",
272
- "testing"
273
- ],
274
- body: `# Implementation Verification
211
+ `},{id:`docs.tech.llm.verification`,title:`Implementation Verification`,summary:`Tiered verification of implementations against specifications.`,kind:`reference`,visibility:`public`,route:`/docs/tech/llm/verification`,tags:[`llm`,`verify`,`validation`,`testing`],body:`# Implementation Verification
275
212
 
276
213
  ContractSpec provides tiered verification to check if implementations comply with specs.
277
214
 
@@ -349,9 +286,4 @@ Each issue has:
349
286
  - **category**: type, export, import, scenario, error_handling, semantic
350
287
  - **message**: Description of the issue
351
288
  - **suggestion**: How to fix it
352
- `
353
- }
354
- ];
355
- registerDocBlocks(tech_llm_integration_DocBlocks);
356
-
357
- //#endregion
289
+ `}]);
@@ -0,0 +1 @@
1
+ import{registerDocBlocks as e}from"../registry.js";e([{id:`docs.tech.mcp.endpoints`,title:`ContractSpec MCP endpoints`,summary:`Dedicated MCP servers for docs, CLI usage, and internal development.`,kind:`reference`,visibility:`mixed`,route:`/docs/tech/mcp/endpoints`,tags:[`mcp`,`docs`,`cli`,`internal`],body:"# ContractSpec MCP endpoints\n\nThree dedicated MCP servers keep AI agents efficient and scoped:\n\n- **Docs MCP**: `/api/mcp/docs` — exposes DocBlocks as resources + presentations. Tool: `docs.search`.\n- **CLI MCP**: `/api/mcp/cli` — surfaces CLI quickstart/reference/README and suggests commands. Tool: `cli.suggestCommand`.\n- **Internal MCP**: `/api/mcp/internal` — internal routing hints, playbook, and example registry access. Tool: `internal.describe`.\n\n### Usage notes\n- Transports are HTTP POST (streamable HTTP); SSE is disabled.\n- Resources are namespaced (`docs://*`, `cli://*`, `internal://*`) and are read-only.\n- Internal MCP also exposes the examples registry via `examples://*` resources:\n - `examples://list?q=<query>`\n - `examples://example/<id>`\n- Prompts mirror each surface (navigator, usage, bootstrap) for quick agent onboarding.\n- GraphQL remains at `/graphql`; health at `/health`.\n"}]);
@@ -0,0 +1 @@
1
+ import{registerDocBlocks as e}from"../registry.js";e([{id:`docs.tech.presentation-runtime`,title:`Presentation Runtime`,summary:`Cross-platform runtime for list pages and presentation flows.`,kind:`reference`,visibility:`public`,route:`/docs/tech/presentation-runtime`,tags:[`tech`,`presentation-runtime`],body:"## Presentation Runtime\n\nCross-platform runtime for list pages and presentation flows.\n\n### Packages\n\n- `@lssm/lib.presentation-runtime-core`: shared types and config helpers\n- `@lssm/lib.presentation-runtime-react`: React hooks (web/native-compatible API)\n- `@lssm/lib.presentation-runtime-react-native`: Native entrypoint (re-exports React API for now)\n\n### Next.js config helper\n\n```ts\n// next.config.mjs\nimport { withPresentationNextAliases } from '@lssm/lib.presentation-runtime-core/next';\n\nconst nextConfig = {\n webpack: (config) => withPresentationNextAliases(config),\n};\n\nexport default nextConfig;\n```\n\n### Metro config helper\n\n```js\n// metro.config.js (CJS)\nconst { getDefaultConfig } = require('expo/metro-config');\nconst {\n withPresentationMetroAliases,\n} = require('@lssm/lib.presentation-runtime-core/src/metro.cjs');\n\nconst projectRoot = __dirname;\nconst config = getDefaultConfig(projectRoot);\n\nmodule.exports = withPresentationMetroAliases(config);\n```\n\n### React hooks\n\n- `useListCoordinator`: URL + RHF + derived variables (no fetching)\n- `usePresentationController`: Same plus `fetcher` integration\n- `DataViewRenderer` (design-system): render `DataViewSpec` projections (`list`, `table`, `detail`, `grid`) using shared UI atoms\n\nBoth accept a `useUrlState` adapter. On web, use `useListUrlState` (design-system) or a Next adapter.\n\n### KYC molecules (bundle)\n\n- `ComplianceBadge` in `@lssm/bundle.strit/presentation/components/kyc` renders a status badge for KYC/compliance snapshots. It accepts a `state` (missing_core | incomplete | complete | expiring | unknown) and optional localized `labels`. Prefer consuming apps to pass translated labels (e.g., via `useT('appPlatformAdmin')`).\n\n### Markdown routes and llms.txt\n\n- Each web app exposes `/llms` (and `/llms.txt`, `/llms.md`) via rewrites. See [llmstxt.org](https://llmstxt.org/).\n- Catch‑all markdown handler lives at `app/[...slug].md/route.ts`. It resolves a page descriptor from `app/.presentations.manifest.json` and renders via the `presentations.v2` engine (target: `markdown`).\n- Per‑page companion convention: add `app/<route>/ai.ts` exporting a `PresentationDescriptorV2`.\n- Build‑time tool: `tools/generate-presentations-manifest.mjs <app-root>` populates the manifest.\n- CI check: `pnpm llms:check` verifies coverage (% of pages with descriptors) and fails if below threshold.\n"}]);
@@ -0,0 +1,262 @@
1
+ import{registerDocBlocks as e}from"../../registry.js";e([{id:`docs.tech.schema.README`,title:`Multi‑File Prisma Schema Conventions (per database)`,summary:`We adopt Prisma multi‑file schema (GA ≥ v6.7) to organize each database’s models by domain and to import core LSSM module schemas locally.`,kind:`reference`,visibility:`public`,route:`/docs/tech/schema/README`,tags:[`tech`,`schema`,`README`],body:`# Multi‑File Prisma Schema Conventions (per database)
2
+
3
+ We adopt Prisma multi‑file schema (GA ≥ v6.7) to organize each database’s models by domain and to import core LSSM module schemas locally.
4
+
5
+ Canonical layout per DB:
6
+
7
+ \`\`\`
8
+ prisma/
9
+ schema/
10
+ main.prisma # datasource + generators only
11
+ imported/
12
+ lssm_sigil/*.prisma # imported models/enums only (no datasource/generator)
13
+ lssm_content/*.prisma # idem
14
+ <domain>/*.prisma # vertical‑specific models split by bounded context
15
+ \`\`\`
16
+
17
+ Notes:
18
+
19
+ - Imported files contain only \`model\` and \`enum\` blocks (strip \`datasource\`/\`generator\`).
20
+ - Preserve \`@@schema("…")\` annotations to keep tables in their Postgres schemas; we now explicitly list schemas in \`main.prisma\` to avoid P1012: \`schemas = ["public","lssm_sigil","lssm_content","lssm_featureflags","lssm_ops","lssm_planning","lssm_quill","lssm_geoterro"]\`.
21
+ - Use \`@lssm/app.cli-database\` CLI: \`database import|check|generate|migrate:*|seed\` to manage a single DB; \`@lssm/app.cli-databases\` orchestrates multiple DBs.
22
+
23
+ ## Typed merger config
24
+
25
+ - Define imported module list once per DB with a typed config:
26
+
27
+ \`\`\`ts
28
+ // prisma-merger.config.ts
29
+ import { defineMergedPrismaConfig } from '@lssm/app.cli-database';
30
+
31
+ export default defineMergedPrismaConfig({
32
+ modules: [
33
+ '@lssm/app.cli-database-sigil',
34
+ '@lssm/app.cli-database-content',
35
+ // ...
36
+ ],
37
+ });
38
+ \`\`\`
39
+
40
+ - Then run \`database import --target .\` (no need to pass \`--modules\`).
41
+
42
+ ## Prisma Config (prisma.config.ts)
43
+
44
+ We use Prisma Config per official docs to point Prisma to the multi-file schema folder and migrations:
45
+
46
+ \`\`\`ts
47
+ // prisma.config.ts
48
+ import path from 'node:path';
49
+ import { defineConfig } from 'prisma/config';
50
+
51
+ export default defineConfig({
52
+ schema: path.join('prisma', 'schema'),
53
+ migrations: { path: path.join('prisma', 'migrations') },
54
+ });
55
+ \`\`\`
56
+
57
+ Reference: Prisma blog – Organize Your Prisma Schema into Multiple Files: https://www.prisma.io/blog/organize-your-prisma-schema-with-multi-file-support
58
+
59
+ ---
60
+
61
+ # LSSM Auth (Sigil) – Models & Integration
62
+
63
+ This document tracks the identity models and integration points used by the LSSM Sigil module.
64
+
65
+ ## Models (Prisma \`lssm_sigil\`)
66
+
67
+ - \`User\` – core identity with email, optional phone, role, passkeys, apiKeys
68
+ - \`Session\` – session tokens and metadata; includes \`activeOrganizationId\`
69
+ - \`Account\` – external providers (password, OAuth)
70
+ - \`Organization\` – tenant boundary; includes \`type\` additional field
71
+ - \`Member\`, \`Invitation\`, \`Team\`, \`TeamMember\` – org/teams
72
+ - \`Role\`, \`Permission\`, \`PolicyBinding\` – RBAC
73
+ - \`ApiKey\`, \`Passkey\` – programmable access and WebAuthn
74
+ - \`SsoProvider\` – OIDC/SAML provider configuration (org- or user-scoped)
75
+ - \`OAuthApplication\`, \`OAuthAccessToken\`, \`OAuthConsent\` – first/third-party OAuth
76
+
77
+ These mirror STRIT additions so Better Auth advanced plugins (admin, organization, apiKey, passkey, genericOAuth) work uniformly across apps.
78
+
79
+ ## Better Auth (server)
80
+
81
+ Enabled methods:
82
+
83
+ - Email & password
84
+ - Phone OTP (Telnyx)
85
+ - Passkey (WebAuthn)
86
+ - API keys
87
+ - Organizations & Teams
88
+ - Generic OAuth (FranceConnect+ via OIDC with JWE/JWS using JOSE)
89
+
90
+ Server config lives at \`packages/lssm/modules/sigil/src/application/services/auth.ts\`.
91
+
92
+ ## Clients (Expo / React)
93
+
94
+ Client config lives at \`packages/lssm/modules/sigil/src/presentation/providers/auth/expo.ts\` with plugins for admin, passkey, apiKey, organization, phone, genericOAuth.
95
+
96
+ ## Environment Variables
97
+
98
+ Telnyx (phone OTP):
99
+
100
+ - \`TELNYX_API_KEY\`
101
+ - \`TELNYX_MESSAGING_PROFILE_ID\`
102
+ - \`TELNYX_FROM_NUMBER\`
103
+
104
+ FranceConnect+ (prefer LSSM*… but STRIT*… fallbacks are supported):
105
+
106
+ - \`LSSM_FRANCECONNECTPLUS_DISCOVERY_URL\`
107
+ - \`LSSM_FRANCECONNECTPLUS_CLIENT_ID\`
108
+ - \`LSSM_FRANCECONNECTPLUS_CLIENT_SECRET\`
109
+ - \`LSSM_FRANCECONNECTPLUS_ENC_PRIVATE_KEY_PEM\` (PKCS8; RSA-OAEP-256)
110
+
111
+ Generic:
112
+
113
+ - \`API_URL_IDENTITIES\` – base URL for Better Auth server
114
+ - \`BETTER_AUTH_SECRET\` – server secret
115
+
116
+ Keep this in sync with code changes to avoid drift.
117
+
118
+ ## HCircle domain splits and auth removal
119
+
120
+ - Auth/identity models are not defined locally anymore. They come from \`@lssm/app.cli-database-sigil\` under the \`lssm_sigil\` schema.
121
+ - \`packages/hcircle/libs/database-coliving/prisma/schema/domain/\` is split by domain; newsletter/waiting list lives in \`newsletter.prisma\` and uses \`@@map("waiting_list")\`.
122
+ - To avoid collisions with module names, the local event models were renamed to \`SocialEvent\`, \`SocialEventAttendee\`, and \`SocialEventRecurrence\` with \`@@map\` pointing to existing table names.
123
+
124
+ ---
125
+
126
+ ## Vertical profiles (current)
127
+
128
+ ### STRIT
129
+
130
+ - prisma-merger modules:
131
+ - \`@lssm/app.cli-database-sigil\`, \`@lssm/app.cli-database-content\`, \`@lssm/app.cli-database-ops\`, \`@lssm/app.cli-database-planning\`, \`@lssm/app.cli-database-quill\`, \`@lssm/app.cli-database-geoterro\`
132
+ - main.prisma schemas:
133
+ - \`schemas = ["public","lssm_sigil","lssm_content","lssm_ops","lssm_planning","lssm_quill","lssm_geoterro"]\`
134
+ - domain splits (\`packages/strit/libs/database/prisma/schema/domain/\`):
135
+ - \`bookings.prisma\` (Booking, StritDocument + links to Content \`File\` and Sigil \`Organization\`)
136
+ - \`commerce.prisma\` (Wholesale models; \`sellerId\` linked to Sigil \`Organization\`)
137
+ - \`files.prisma\` (PublicFile, PublicFileAccessLog; \`ownerId\`→Organization, \`uploadedBy\`→User)
138
+ - \`geo.prisma\` (PublicCountry, PublicAddress, City; links to Spots/Series)
139
+ - \`spots.prisma\`, \`urbanism.prisma\`, \`analytics.prisma\`, \`onboarding.prisma\`, \`referrals.prisma\`, \`subscriptions.prisma\`, \`content.prisma\`
140
+ - auth models are imported from Sigil (no local auth tables).
141
+ - Back-relations for \`Organization\` (e.g., \`files\`, seller relations) are declared in the Sigil module to avoid scattering.
142
+
143
+ ### ARTISANOS
144
+
145
+ - prisma-merger modules:
146
+ - \`@lssm/app.cli-database-sigil\`, \`@lssm/app.cli-database-content\`, \`@lssm/app.cli-database-featureflags\`, \`@lssm/app.cli-database-ops\`, \`@lssm/app.cli-database-planning\`, \`@lssm/app.cli-database-quill\`, \`@lssm/app.cli-database-geoterro\`
147
+ - main.prisma schemas:
148
+ - \`schemas = ["public","lssm_sigil","lssm_content","lssm_featureflags","lssm_ops","lssm_planning","lssm_quill","lssm_geoterro"]\`
149
+ - domain splits (\`packages/artisanos/libs/database-artisan/prisma/schema/domain/\`):
150
+ - \`sales.prisma\` (Client, Quote, QuoteTemplate, Invoice, FollowUps)
151
+ - \`subsidies.prisma\` (SubsidyProgram, AidApplication, SupportingDocument)
152
+ - \`projects.prisma\` (Project, ProjectPlanningSettings)
153
+ - \`crm.prisma\` (OrganizationProfessionalProfile, OrganizationCertification)
154
+ - \`professions.prisma\`, \`products.prisma\`, \`templates.prisma\`, \`analytics.prisma\`, \`onboarding.prisma\`, \`referrals.prisma\`, \`subscriptions.prisma\`, \`files.prisma\`
155
+ - auth/organization/team models are provided by Sigil; local legacy copies were removed.
156
+ - Where names collide with Content, local models are prefixed (e.g., \`PublicFile\`) and use \`@@map\` to keep existing table names where applicable.
157
+
158
+ ## Schema Dictionary: \`@lssm/lib.schema\`
159
+
160
+ ### Purpose
161
+
162
+ Describe operation I/O once and generate:
163
+
164
+ - zod (runtime validation)
165
+ - GraphQL (Pothos types/refs)
166
+ - JSON Schema (via \`zod-to-json-schema\` or native descriptors)
167
+
168
+ ### Primitives
169
+
170
+ - **FieldType<T>**: describes a scalar or composite field and carries:
171
+ - \`zod\` schema for validation
172
+ - optional JSON Schema descriptor
173
+ - optional GraphQL scalar reference/name
174
+ - **SchemaModel**: named object model composed of fields. Exposes helpers:
175
+ - \`getZod(): z.ZodObject<ZodShapeFromFields<Fields>> | z.ZodArray<z.ZodObject<...>>\`
176
+ - Preserves each field's schema, optionality, and array-ness
177
+ - Top-level lists are supported via \`config.isArray: true\`
178
+ - \`getJsonSchema(): JSONSchema7\` (export for docs, MCP, forms)
179
+ - \`getPothosInput()\` (GraphQL input object name)
180
+
181
+ ### Conventions
182
+
183
+ - Name models with PascalCase; suffix with \`Input\`/\`Result\` when ambiguous.
184
+ - Use explicit enums for multi-value constants; reuse the same enum across input/output.
185
+ - Define domain enums via \`defineEnum('Name', [...])\` in the relevant domain package (e.g., \`packages/strit/libs/contracts-strit/src/enums/\`), not in \`ScalarTypeEnum\`.
186
+ - Reference those enums in \`SchemaModel\` fields directly (they expose \`getZod\`, \`getPothos\`, \`getJsonSchema\`).
187
+
188
+ #### Example (STRIT)
189
+
190
+ \`\`\`ts
191
+ // packages/strit/libs/contracts-strit/src/enums/recurrence.ts
192
+ import { defineEnum } from '@lssm/lib.schema';
193
+ export const SpotEnum = {
194
+ Weekday: () =>
195
+ defineEnum('Weekday', ['MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU'] as const),
196
+ RecurrenceFrequency: () =>
197
+ defineEnum('RecurrenceFrequency', [
198
+ 'DAILY',
199
+ 'WEEKLY',
200
+ 'MONTHLY',
201
+ 'YEARLY',
202
+ ] as const),
203
+ } as const;
204
+ \`\`\`
205
+
206
+ \`\`\`ts
207
+ // usage in contracts
208
+ frequency: { type: SpotEnum.RecurrenceFrequency(), isOptional: false },
209
+ byWeekday: { type: SpotEnum.Weekday(), isOptional: true, isArray: true },
210
+ \`\`\`
211
+
212
+ - Use \`Date\` type for temporal values and ensure ISO strings in JSON transports where needed.
213
+
214
+ ### Mapping rules (summary)
215
+
216
+ - Strings → GraphQL \`String\`
217
+ - Numbers → \`Int\` if safe 32-bit integer else \`Float\`
218
+ - Booleans → \`Boolean\`
219
+ - Dates → custom \`Date\` scalar
220
+ - Arrays<T> → list of mapped T (set \`isArray: true\` on the field)
221
+ - Top-level arrays → set \`isArray: true\` on the model config
222
+ - Objects → input/output object types with stable field order
223
+ - Unions → supported for output; input unions map to JSON (structural input is not supported by GraphQL)
224
+
225
+ ### JSON Schema export
226
+
227
+ Prefer \`getZod()\` + \`zod-to-json-schema\` for consistency. For advanced cases, provide a custom \`getJsonSchema()\` on the model.
228
+
229
+ ### Example
230
+
231
+ \`\`\`ts
232
+ import { ScalarTypeEnum, SchemaModel } from '@lssm/lib.schema';
233
+
234
+ // Nested model
235
+ const Weekday = new SchemaModel({
236
+ name: 'Weekday',
237
+ fields: {
238
+ value: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
239
+ },
240
+ });
241
+
242
+ // Parent model with array field and nested object
243
+ const Rule = new SchemaModel({
244
+ name: 'Rule',
245
+ fields: {
246
+ timezone: { type: ScalarTypeEnum.TimeZone(), isOptional: false },
247
+ byWeekday: { type: Weekday, isOptional: true, isArray: true },
248
+ },
249
+ });
250
+
251
+ const CreateThingInput = new SchemaModel({
252
+ name: 'CreateThingInput',
253
+ fields: {
254
+ name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
255
+ rule: { type: Rule, isOptional: false },
256
+ },
257
+ });
258
+
259
+ // zod
260
+ const z = CreateThingInput.getZod();
261
+ \`\`\`
262
+ `}]);
@@ -0,0 +1 @@
1
+ import{registerDocBlocks as e}from"../../registry.js";e([{id:`docs.tech.studio.learning-events`,title:`Studio Learning Events`,summary:`Studio persists learning/activity events to the database; Sandbox keeps learning local-first and unlogged.`,kind:`reference`,visibility:`public`,route:`/docs/tech/studio/learning-events`,tags:[`studio`,`learning`,`events`,`analytics`,`sandbox`],body:"# Studio Learning Events\n\nStudio emits lightweight **learning/activity events** to support onboarding, ambient coaching, and learning journeys.\n\n## Persistence model\n\n- **Studio**: events are persisted to the database in `StudioLearningEvent` and are organization-scoped (optionally project-scoped).\n- **Sandbox**: events remain **local-only** (unlogged); they must never be sent to backend services.\n\n## GraphQL API\n\n- `recordLearningEvent(input: { name, projectId?, payload? })`\n- `myLearningEvents(projectId?, limit?)`\n- `myOnboardingTracks(productId?, includeProgress?)`\n- `myOnboardingProgress(trackKey)`\n- `dismissOnboardingTrack(trackKey)`\n\n## Common event names (convention)\n\n- `module.navigated` — user navigated to a Studio module (payload at minimum: `{ moduleId }`).\n- `studio.template.instantiated` — created a new Studio project (starter template). Payload commonly includes `{ templateId, projectSlug }`.\n- `spec.changed` — created or updated a Studio spec. Payload may include `{ action: 'create' | 'update', specId?, specType? }`.\n- `regeneration.completed` — finished a “regen/deploy” action (currently emitted on successful Studio deploy actions).\n- `studio.evolution.applied` — completed an Evolution session (payload commonly includes `{ evolutionSessionId }`).\n\nThese events are intentionally minimal and must avoid PII/secrets in payloads.\n"}]);