@lssm/example.learning-journey-registry 0.0.0-canary-20251212230121 → 0.0.0-canary-20251215220103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +21 -7
- package/CHANGELOG.md +12 -12
- package/dist/example.js +1 -0
- package/dist/index.js +1 -1
- package/dist/libs/contracts/src/docs/index.js +1 -1
- package/dist/libs/contracts/src/docs/tech/auth/better-auth-nextjs.docblock.js +58 -0
- package/dist/libs/contracts/src/docs/tech/contracts/openapi-export.docblock.js +38 -0
- package/dist/libs/contracts/src/docs/tech/mcp-endpoints.docblock.js +1 -1
- package/dist/libs/contracts/src/docs/tech/studio/learning-events.docblock.js +1 -0
- package/dist/libs/contracts/src/docs/tech/studio/learning-journeys.docblock.js +57 -0
- package/dist/libs/contracts/src/docs/tech/studio/platform-admin-panel.docblock.js +63 -0
- package/dist/libs/contracts/src/docs/tech/studio/project-access-teams.docblock.js +36 -0
- package/dist/libs/contracts/src/docs/tech/studio/project-routing.docblock.js +1 -0
- package/dist/libs/contracts/src/docs/tech/studio/sandbox-unlogged.docblock.js +20 -0
- package/dist/libs/contracts/src/docs/tech/studio/team-invitations.docblock.js +65 -0
- package/dist/libs/contracts/src/docs/tech/studio/workspace-ops.docblock.js +1 -0
- package/dist/libs/contracts/src/docs/tech/studio/workspaces.docblock.js +41 -0
- package/dist/libs/contracts/src/docs/tech/telemetry-ingest.docblock.js +122 -0
- package/dist/libs/contracts/src/docs/tech/vscode-extension.docblock.js +68 -0
- package/dist/tracks.js +1 -1
- package/example.ts +1 -0
- package/package.json +12 -10
- package/src/example.ts +24 -0
- package/src/index.ts +1 -0
- package/src/tracks.ts +6 -6
- package/src/ui/LearningMiniApp.tsx +0 -1
- package/src/ui/index.ts +0 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"../registry.js";e([{id:`docs.tech.telemetry.ingest`,title:`Telemetry Ingest Endpoint`,summary:`Server-side telemetry ingestion for ContractSpec clients (VS Code extension, CLI, etc.).`,kind:`reference`,visibility:`internal`,route:`/docs/tech/telemetry/ingest`,tags:[`telemetry`,`api`,`posthog`,`analytics`],body:`# Telemetry Ingest Endpoint
|
|
2
|
+
|
|
3
|
+
The ContractSpec API provides a telemetry ingest endpoint for clients to send product analytics events.
|
|
4
|
+
|
|
5
|
+
## Endpoint
|
|
6
|
+
|
|
7
|
+
\`\`\`
|
|
8
|
+
POST /api/telemetry/ingest
|
|
9
|
+
\`\`\`
|
|
10
|
+
|
|
11
|
+
## Request
|
|
12
|
+
|
|
13
|
+
\`\`\`json
|
|
14
|
+
{
|
|
15
|
+
"event": "contractspec.vscode.command_run",
|
|
16
|
+
"distinct_id": "client-uuid",
|
|
17
|
+
"properties": {
|
|
18
|
+
"command": "validate"
|
|
19
|
+
},
|
|
20
|
+
"timestamp": "2024-01-15T10:30:00.000Z"
|
|
21
|
+
}
|
|
22
|
+
\`\`\`
|
|
23
|
+
|
|
24
|
+
### Headers
|
|
25
|
+
|
|
26
|
+
| Header | Description |
|
|
27
|
+
|--------|-------------|
|
|
28
|
+
| \`x-contractspec-client-id\` | Optional client identifier (used as fallback for distinct_id) |
|
|
29
|
+
| \`Content-Type\` | Must be \`application/json\` |
|
|
30
|
+
|
|
31
|
+
### Body
|
|
32
|
+
|
|
33
|
+
| Field | Type | Required | Description |
|
|
34
|
+
|-------|------|----------|-------------|
|
|
35
|
+
| \`event\` | string | Yes | Event name (e.g., \`contractspec.vscode.activated\`) |
|
|
36
|
+
| \`distinct_id\` | string | Yes | Anonymous client identifier |
|
|
37
|
+
| \`properties\` | object | No | Event properties |
|
|
38
|
+
| \`timestamp\` | string | No | ISO 8601 timestamp |
|
|
39
|
+
|
|
40
|
+
## Response
|
|
41
|
+
|
|
42
|
+
\`\`\`json
|
|
43
|
+
{
|
|
44
|
+
"success": true
|
|
45
|
+
}
|
|
46
|
+
\`\`\`
|
|
47
|
+
|
|
48
|
+
## Configuration
|
|
49
|
+
|
|
50
|
+
The endpoint requires \`POSTHOG_PROJECT_KEY\` environment variable to be set. If not configured, events are accepted but not forwarded.
|
|
51
|
+
|
|
52
|
+
| Environment Variable | Description | Default |
|
|
53
|
+
|---------------------|-------------|---------|
|
|
54
|
+
| \`POSTHOG_HOST\` | PostHog host URL | \`https://eu.posthog.com\` |
|
|
55
|
+
| \`POSTHOG_PROJECT_KEY\` | PostHog project API key | (required) |
|
|
56
|
+
|
|
57
|
+
## Privacy
|
|
58
|
+
|
|
59
|
+
- No PII is collected or stored
|
|
60
|
+
- \`distinct_id\` is an anonymous client-generated UUID
|
|
61
|
+
- File paths and source code are never included in events
|
|
62
|
+
- Respects VS Code telemetry settings on the client side
|
|
63
|
+
|
|
64
|
+
## Events
|
|
65
|
+
|
|
66
|
+
### Extension Events
|
|
67
|
+
|
|
68
|
+
| Event | Description | Properties |
|
|
69
|
+
|-------|-------------|------------|
|
|
70
|
+
| \`contractspec.vscode.activated\` | Extension activated | \`version\` |
|
|
71
|
+
| \`contractspec.vscode.command_run\` | Command executed | \`command\` |
|
|
72
|
+
| \`contractspec.vscode.mcp_call\` | MCP call made | \`endpoint\`, \`tool\` |
|
|
73
|
+
|
|
74
|
+
### API Events
|
|
75
|
+
|
|
76
|
+
| Event | Description | Properties |
|
|
77
|
+
|-------|-------------|------------|
|
|
78
|
+
| \`contractspec.api.mcp_request\` | MCP request processed | \`endpoint\`, \`method\`, \`success\`, \`duration_ms\` |
|
|
79
|
+
`},{id:`docs.tech.telemetry.hybrid`,title:`Hybrid Telemetry Model`,summary:`How ContractSpec clients choose between direct PostHog and API-routed telemetry.`,kind:`usage`,visibility:`internal`,route:`/docs/tech/telemetry/hybrid`,tags:[`telemetry`,`architecture`,`posthog`],body:`# Hybrid Telemetry Model
|
|
80
|
+
|
|
81
|
+
ContractSpec uses a hybrid telemetry model where clients can send events either directly to PostHog or via the API server.
|
|
82
|
+
|
|
83
|
+
## Decision Flow
|
|
84
|
+
|
|
85
|
+
\`\`\`
|
|
86
|
+
Is contractspec.api.baseUrl configured?
|
|
87
|
+
├── Yes → Send via /api/telemetry/ingest
|
|
88
|
+
└── No → Is posthogProjectKey configured?
|
|
89
|
+
├── Yes → Send directly to PostHog
|
|
90
|
+
└── No → Telemetry disabled
|
|
91
|
+
\`\`\`
|
|
92
|
+
|
|
93
|
+
## Benefits
|
|
94
|
+
|
|
95
|
+
### Direct PostHog
|
|
96
|
+
- No server dependency
|
|
97
|
+
- Works offline (with batching)
|
|
98
|
+
- Lower latency
|
|
99
|
+
|
|
100
|
+
### Via API
|
|
101
|
+
- Centralized key management (no client-side keys)
|
|
102
|
+
- Server-side enrichment and validation
|
|
103
|
+
- Rate limiting and abuse prevention
|
|
104
|
+
- Easier migration to other providers
|
|
105
|
+
|
|
106
|
+
## Recommendation
|
|
107
|
+
|
|
108
|
+
- **Development**: Use direct PostHog with a dev project key
|
|
109
|
+
- **Production**: Route via API for better governance
|
|
110
|
+
|
|
111
|
+
## Future: OpenTelemetry
|
|
112
|
+
|
|
113
|
+
The current PostHog implementation is behind a simple interface that can be swapped for OpenTelemetry:
|
|
114
|
+
|
|
115
|
+
\`\`\`typescript
|
|
116
|
+
interface TelemetryClient {
|
|
117
|
+
send(event: TelemetryEvent): Promise<void>;
|
|
118
|
+
}
|
|
119
|
+
\`\`\`
|
|
120
|
+
|
|
121
|
+
This allows future migration without changing client code.
|
|
122
|
+
`}]);
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"../registry.js";e([{id:`docs.tech.vscode.extension`,title:`ContractSpec VS Code Extension`,summary:`VS Code extension for spec-first development with validation, scaffolding, and MCP integration.`,kind:`reference`,visibility:`public`,route:`/docs/tech/vscode/extension`,tags:[`vscode`,`extension`,`tooling`,`dx`],body:`# ContractSpec VS Code Extension
|
|
2
|
+
|
|
3
|
+
The ContractSpec VS Code extension provides spec-first development tooling directly in your editor.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Real-time Validation**: Get instant feedback on spec errors and warnings as you save files
|
|
8
|
+
- **Build/Scaffold**: Generate handler and component skeletons from specs (no AI required)
|
|
9
|
+
- **Spec Explorer**: List and navigate all specs in your workspace
|
|
10
|
+
- **Dependency Analysis**: Visualize spec dependencies and detect cycles
|
|
11
|
+
- **MCP Integration**: Search ContractSpec documentation via Model Context Protocol
|
|
12
|
+
- **Snippets**: Code snippets for common ContractSpec patterns
|
|
13
|
+
|
|
14
|
+
## Commands
|
|
15
|
+
|
|
16
|
+
| Command | Description |
|
|
17
|
+
|---------|-------------|
|
|
18
|
+
| \`ContractSpec: Validate Current Spec\` | Validate the currently open spec file |
|
|
19
|
+
| \`ContractSpec: Validate All Specs\` | Validate all spec files in the workspace |
|
|
20
|
+
| \`ContractSpec: Build/Scaffold\` | Generate handler/component from the current spec |
|
|
21
|
+
| \`ContractSpec: List All Specs\` | Show all specs in the workspace |
|
|
22
|
+
| \`ContractSpec: Analyze Dependencies\` | Analyze and visualize spec dependencies |
|
|
23
|
+
| \`ContractSpec: Search Docs (MCP)\` | Search documentation via MCP |
|
|
24
|
+
|
|
25
|
+
## Configuration
|
|
26
|
+
|
|
27
|
+
| Setting | Description | Default |
|
|
28
|
+
|---------|-------------|---------|
|
|
29
|
+
| \`contractspec.api.baseUrl\` | Base URL for ContractSpec API (enables MCP + remote telemetry) | \`""\` |
|
|
30
|
+
| \`contractspec.telemetry.posthogHost\` | PostHog host URL for direct telemetry | \`"https://eu.posthog.com"\` |
|
|
31
|
+
| \`contractspec.telemetry.posthogProjectKey\` | PostHog project key for direct telemetry | \`""\` |
|
|
32
|
+
| \`contractspec.validation.onSave\` | Run validation on save | \`true\` |
|
|
33
|
+
| \`contractspec.validation.onOpen\` | Run validation on open | \`true\` |
|
|
34
|
+
|
|
35
|
+
## Architecture
|
|
36
|
+
|
|
37
|
+
The extension uses:
|
|
38
|
+
- \`@lssm/module.contractspec-workspace\` for pure analysis + templates
|
|
39
|
+
- \`@lssm/bundle.contractspec-workspace\` for workspace services + adapters
|
|
40
|
+
|
|
41
|
+
This allows the extension to work without requiring the CLI to be installed.
|
|
42
|
+
|
|
43
|
+
## Telemetry
|
|
44
|
+
|
|
45
|
+
The extension uses a hybrid telemetry approach:
|
|
46
|
+
1. If \`contractspec.api.baseUrl\` is configured → send to API \`/api/telemetry/ingest\`
|
|
47
|
+
2. Otherwise → send directly to PostHog (if project key configured)
|
|
48
|
+
|
|
49
|
+
Telemetry respects VS Code's telemetry settings. No file paths, source code, or PII is collected.
|
|
50
|
+
`},{id:`docs.tech.vscode.snippets`,title:`ContractSpec Snippets`,summary:`Code snippets for common ContractSpec patterns in VS Code.`,kind:`reference`,visibility:`public`,route:`/docs/tech/vscode/snippets`,tags:[`vscode`,`snippets`,`dx`],body:`# ContractSpec Snippets
|
|
51
|
+
|
|
52
|
+
The VS Code extension includes snippets for common ContractSpec patterns.
|
|
53
|
+
|
|
54
|
+
## Available Snippets
|
|
55
|
+
|
|
56
|
+
| Prefix | Description |
|
|
57
|
+
|--------|-------------|
|
|
58
|
+
| \`contractspec-command\` | Create a new command (write operation) |
|
|
59
|
+
| \`contractspec-query\` | Create a new query (read-only operation) |
|
|
60
|
+
| \`contractspec-event\` | Create a new event |
|
|
61
|
+
| \`contractspec-docblock\` | Create a new DocBlock |
|
|
62
|
+
| \`contractspec-telemetry\` | Create a new TelemetrySpec |
|
|
63
|
+
| \`contractspec-presentation\` | Create a new Presentation |
|
|
64
|
+
|
|
65
|
+
## Usage
|
|
66
|
+
|
|
67
|
+
Type the prefix in a TypeScript file and press Tab to expand the snippet. Tab through the placeholders to fill in your values.
|
|
68
|
+
`}]);
|
package/dist/tracks.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{crmLearningTracks as e}from"@lssm/example.learning-journey
|
|
1
|
+
import{crmLearningTracks as e}from"@lssm/example.learning-journey-crm-onboarding/track";import{drillTracks as t}from"@lssm/example.learning-journey-duo-drills/track";import{ambientCoachTracks as n}from"@lssm/example.learning-journey-ambient-coach/track";import{questTracks as r}from"@lssm/example.learning-journey-quest-challenges/track";import{platformLearningTracks as i}from"@lssm/example.learning-journey-platform-tour/track";import{studioLearningTracks as a}from"@lssm/example.learning-journey-studio-onboarding/track";const o=e=>({id:e.id,title:e.title,description:e.description,completionEvent:e.completion.eventName,completionCondition:e.completion,xpReward:e.xpReward,isRequired:e.isRequired,canSkip:e.canSkip,actionUrl:e.actionUrl,actionLabel:e.actionLabel,availability:e.availability,metadata:e.metadata}),s=e=>({id:e.id,name:e.name,description:e.description,productId:e.productId,targetUserSegment:e.targetUserSegment,targetRole:e.targetRole,totalXp:e.totalXp,streakRule:e.streakRule,completionRewards:e.completionRewards,steps:e.steps.map(o),metadata:e.metadata}),c=[...a,...i,...e,...t,...n,...r],l=c.map(s);export{e as crmLearningTracks,c as learningJourneyTracks,o as mapStep,s as mapTrackSpecToDto,l as onboardingTrackCatalog,i as platformLearningTracks,a as studioLearningTracks};
|
package/example.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './src/example';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lssm/example.learning-journey-registry",
|
|
3
|
-
"version": "0.0.0-canary-
|
|
3
|
+
"version": "0.0.0-canary-20251215220103",
|
|
4
4
|
"description": "Registry that aggregates learning journey example tracks.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"./api-types": "./src/api-types.ts",
|
|
12
12
|
"./docs": "./src/docs/index.ts",
|
|
13
13
|
"./docs/learning-journey-registry.docblock": "./src/docs/learning-journey-registry.docblock.ts",
|
|
14
|
+
"./example": "./src/example.ts",
|
|
14
15
|
"./presentations": "./src/presentations/index.ts",
|
|
15
16
|
"./progress-store": "./src/progress-store.ts",
|
|
16
17
|
"./tracks": "./src/tracks.ts",
|
|
@@ -30,28 +31,28 @@
|
|
|
30
31
|
"lint:check": "eslint src"
|
|
31
32
|
},
|
|
32
33
|
"dependencies": {
|
|
33
|
-
"@lssm/example.learning-journey
|
|
34
|
-
"@lssm/example.learning-journey
|
|
35
|
-
"@lssm/example.learning-journey
|
|
36
|
-
"@lssm/example.learning-journey
|
|
37
|
-
"@lssm/example.learning-journey
|
|
38
|
-
"@lssm/example.learning-journey
|
|
34
|
+
"@lssm/example.learning-journey-ambient-coach": "workspace:*",
|
|
35
|
+
"@lssm/example.learning-journey-duo-drills": "workspace:*",
|
|
36
|
+
"@lssm/example.learning-journey-crm-onboarding": "workspace:*",
|
|
37
|
+
"@lssm/example.learning-journey-platform-tour": "workspace:*",
|
|
38
|
+
"@lssm/example.learning-journey-quest-challenges": "workspace:*",
|
|
39
|
+
"@lssm/example.learning-journey-studio-onboarding": "workspace:*",
|
|
39
40
|
"@lssm/example.learning-journey-ui-shared": "workspace:*",
|
|
40
41
|
"@lssm/example.learning-journey-ui-gamified": "workspace:*",
|
|
41
42
|
"@lssm/example.learning-journey-ui-onboarding": "workspace:*",
|
|
42
43
|
"@lssm/example.learning-journey-ui-coaching": "workspace:*",
|
|
43
44
|
"@lssm/module.learning-journey": "workspace:*",
|
|
44
|
-
"react": "^19.
|
|
45
|
+
"react": "^19.2.3"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
48
|
"@lssm/tool.tsdown": "workspace:*",
|
|
48
49
|
"@lssm/tool.typescript": "workspace:*",
|
|
49
50
|
"@types/react": "^19.1.6",
|
|
50
|
-
"tsdown": "^0.17.
|
|
51
|
+
"tsdown": "^0.17.4",
|
|
51
52
|
"typescript": "^5.9.3"
|
|
52
53
|
},
|
|
53
54
|
"peerDependencies": {
|
|
54
|
-
"react": "^
|
|
55
|
+
"react": "^19.2.3"
|
|
55
56
|
},
|
|
56
57
|
"module": "./dist/index.js",
|
|
57
58
|
"publishConfig": {
|
|
@@ -61,6 +62,7 @@
|
|
|
61
62
|
"./api-types": "./dist/api-types.js",
|
|
62
63
|
"./docs": "./dist/docs/index.js",
|
|
63
64
|
"./docs/learning-journey-registry.docblock": "./dist/docs/learning-journey-registry.docblock.js",
|
|
65
|
+
"./example": "./dist/example.js",
|
|
64
66
|
"./presentations": "./dist/presentations/index.js",
|
|
65
67
|
"./progress-store": "./dist/progress-store.js",
|
|
66
68
|
"./tracks": "./dist/tracks.js",
|
package/src/example.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const example = {
|
|
2
|
+
id: 'learning-journey-registry',
|
|
3
|
+
title: 'Learning Journey Registry',
|
|
4
|
+
summary:
|
|
5
|
+
'Registry of learning journey tracks + presentations + UI mini-app bindings.',
|
|
6
|
+
tags: ['learning', 'journey', 'registry'],
|
|
7
|
+
kind: 'library',
|
|
8
|
+
visibility: 'public',
|
|
9
|
+
docs: {
|
|
10
|
+
rootDocId: 'docs.examples.learning-journey-registry',
|
|
11
|
+
},
|
|
12
|
+
entrypoints: {
|
|
13
|
+
packageName: '@lssm/example.learning-journey-registry',
|
|
14
|
+
docs: './docs',
|
|
15
|
+
},
|
|
16
|
+
surfaces: {
|
|
17
|
+
templates: true,
|
|
18
|
+
sandbox: { enabled: true, modes: ['markdown', 'specs'] },
|
|
19
|
+
studio: { enabled: true, installable: true },
|
|
20
|
+
mcp: { enabled: true },
|
|
21
|
+
},
|
|
22
|
+
} as const;
|
|
23
|
+
|
|
24
|
+
export default example;
|
package/src/index.ts
CHANGED
package/src/tracks.ts
CHANGED
|
@@ -4,12 +4,12 @@ import type {
|
|
|
4
4
|
StepAvailabilitySpec,
|
|
5
5
|
StepCompletionConditionSpec,
|
|
6
6
|
} from '@lssm/module.learning-journey/track-spec';
|
|
7
|
-
import { crmLearningTracks } from '@lssm/example.learning-journey
|
|
8
|
-
import { drillTracks } from '@lssm/example.learning-journey
|
|
9
|
-
import { ambientCoachTracks } from '@lssm/example.learning-journey
|
|
10
|
-
import { questTracks } from '@lssm/example.learning-journey
|
|
11
|
-
import { platformLearningTracks } from '@lssm/example.learning-journey
|
|
12
|
-
import { studioLearningTracks } from '@lssm/example.learning-journey
|
|
7
|
+
import { crmLearningTracks } from '@lssm/example.learning-journey-crm-onboarding/track';
|
|
8
|
+
import { drillTracks } from '@lssm/example.learning-journey-duo-drills/track';
|
|
9
|
+
import { ambientCoachTracks } from '@lssm/example.learning-journey-ambient-coach/track';
|
|
10
|
+
import { questTracks } from '@lssm/example.learning-journey-quest-challenges/track';
|
|
11
|
+
import { platformLearningTracks } from '@lssm/example.learning-journey-platform-tour/track';
|
|
12
|
+
import { studioLearningTracks } from '@lssm/example.learning-journey-studio-onboarding/track';
|
|
13
13
|
|
|
14
14
|
export interface OnboardingStepDto {
|
|
15
15
|
id: string;
|
package/src/ui/index.ts
CHANGED