@lssm/example.learning-journey-ui-shared 0.0.0-canary-20251216033905 → 0.0.0-canary-20251216062412

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.
@@ -6,7 +6,7 @@ $ tsdown
6
6
  ℹ target: esnext
7
7
  ℹ tsconfig: tsconfig.json
8
8
  ℹ Build start
9
- ℹ dist/index.mjs 121.60 kB │ gzip: 40.46 kB
9
+ ℹ dist/index.mjs 131.07 kB │ gzip: 43.50 kB
10
10
  ℹ dist/components/index.mjs  0.17 kB │ gzip: 0.14 kB
11
11
  ℹ dist/hooks/index.mjs  0.10 kB │ gzip: 0.09 kB
12
12
  ℹ dist/types.mjs  0.01 kB │ gzip: 0.03 kB
@@ -19,6 +19,6 @@ $ tsdown
19
19
  ℹ dist/types-BMAby_Ku.d.mts  1.70 kB │ gzip: 0.60 kB
20
20
  ℹ dist/index-EWErSKip.d.mts  0.95 kB │ gzip: 0.37 kB
21
21
  ℹ dist/index-D_7WU_xm.d.mts  0.68 kB │ gzip: 0.35 kB
22
- ℹ 13 files, total: 134.43 kB
23
- ✔ Build complete in 9127ms
22
+ ℹ 13 files, total: 143.90 kB
23
+ ✔ Build complete in 15676ms
24
24
  $ tsc --noEmit
package/CHANGELOG.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # @lssm/example.learning-journey-ui-shared
2
2
 
3
- ## 0.0.0-canary-20251216033905
3
+ ## 0.0.0-canary-20251216062412
4
4
 
5
5
  ### Patch Changes
6
6
 
7
7
  - Updated dependencies [3086383]
8
- - @lssm/lib.design-system@0.0.0-canary-20251216033905
9
- - @lssm/lib.ui-kit-web@0.0.0-canary-20251216033905
10
- - @lssm/module.learning-journey@0.0.0-canary-20251216033905
8
+ - @lssm/lib.design-system@0.0.0-canary-20251216062412
9
+ - @lssm/lib.ui-kit-web@0.0.0-canary-20251216062412
10
+ - @lssm/module.learning-journey@0.0.0-canary-20251216062412
package/dist/index.mjs CHANGED
@@ -1267,6 +1267,361 @@ Acceptance rules:
1267
1267
  }];
1268
1268
  registerDocBlocks(tech_studio_team_invitations_DocBlocks);
1269
1269
 
1270
+ //#endregion
1271
+ //#region ../../libs/contracts/src/docs/tech/llm/llm-integration.docblock.ts
1272
+ const tech_llm_integration_DocBlocks = [
1273
+ {
1274
+ id: "docs.tech.llm.overview",
1275
+ title: "LLM Integration Overview",
1276
+ summary: "Export specs to LLM-friendly formats, generate implementation guides, and verify implementations.",
1277
+ kind: "reference",
1278
+ visibility: "public",
1279
+ route: "/docs/tech/llm/overview",
1280
+ tags: [
1281
+ "llm",
1282
+ "ai",
1283
+ "export",
1284
+ "guide",
1285
+ "verify"
1286
+ ],
1287
+ body: `# LLM Integration
1288
+
1289
+ ContractSpec provides first-class LLM integration to bridge specifications and AI coding agents.
1290
+
1291
+ ## Core Features
1292
+
1293
+ ### 1. Multi-Format Export
1294
+
1295
+ Export specs to markdown in formats optimized for LLM consumption:
1296
+
1297
+ - **Context format**: Summary for understanding (goal, context, acceptance criteria)
1298
+ - **Full format**: Complete spec with all details (I/O schemas, policy, events)
1299
+ - **Prompt format**: Actionable prompt with implementation instructions
1300
+
1301
+ ### 2. Implementation Guidance
1302
+
1303
+ Generate agent-specific implementation plans:
1304
+
1305
+ - **Claude Code**: Extended thinking mode with structured prompts
1306
+ - **Cursor CLI**: Background/composer mode with .mdc rules generation
1307
+ - **Generic MCP**: Standard format for any MCP-compatible agent
1308
+
1309
+ ### 3. Tiered Verification
1310
+
1311
+ Verify implementations against specs:
1312
+
1313
+ - **Tier 1 (Structure)**: Types, exports, imports validation
1314
+ - **Tier 2 (Behavior)**: Scenario coverage, error handling, events
1315
+ - **Tier 3 (AI Review)**: Semantic compliance analysis via LLM
1316
+
1317
+ ## Access Points
1318
+
1319
+ | Surface | Commands/Tools |
1320
+ |---------|---------------|
1321
+ | CLI | \`contractspec llm export\`, \`guide\`, \`verify\`, \`copy\` |
1322
+ | MCP | \`llm.export\`, \`llm.guide\`, \`llm.verify\` tools |
1323
+ | VSCode | Export to LLM, Generate Guide, Verify, Copy commands |
1324
+
1325
+ ## Quick Start
1326
+
1327
+ ### CLI Usage
1328
+
1329
+ \`\`\`bash
1330
+ # Export spec as markdown
1331
+ contractspec llm export path/to/my.spec.ts --format full
1332
+
1333
+ # Generate implementation guide
1334
+ contractspec llm guide path/to/my.spec.ts --agent claude-code
1335
+
1336
+ # Verify implementation
1337
+ contractspec llm verify path/to/my.spec.ts path/to/impl.ts --tier 2
1338
+
1339
+ # Copy spec to clipboard
1340
+ contractspec llm copy path/to/my.spec.ts --format context
1341
+ \`\`\`
1342
+
1343
+ ### MCP Usage
1344
+
1345
+ \`\`\`
1346
+ # Export spec
1347
+ llm.export { specPath: "path/to/my.spec.ts", format: "full" }
1348
+
1349
+ # Generate guide
1350
+ llm.guide { specPath: "path/to/my.spec.ts", agent: "cursor-cli" }
1351
+
1352
+ # Verify implementation
1353
+ llm.verify { specPath: "path/to/my.spec.ts", implementationPath: "path/to/impl.ts", tier: "2" }
1354
+ \`\`\`
1355
+
1356
+ ### Programmatic Usage
1357
+
1358
+ \`\`\`typescript
1359
+ import { specToFullMarkdown, specToAgentPrompt } from '@lssm/lib.contracts/llm';
1360
+ import { createAgentGuideService, createVerifyService } from '@lssm/bundle.contractspec-workspace';
1361
+
1362
+ // Export
1363
+ const markdown = specToFullMarkdown(mySpec);
1364
+
1365
+ // Generate guide
1366
+ const guideService = createAgentGuideService({ defaultAgent: 'claude-code' });
1367
+ const guide = guideService.generateGuide(mySpec);
1368
+
1369
+ // Verify
1370
+ const verifyService = createVerifyService();
1371
+ const result = await verifyService.verify(mySpec, implementationCode, {
1372
+ tiers: ['structure', 'behavior']
1373
+ });
1374
+ \`\`\`
1375
+ `
1376
+ },
1377
+ {
1378
+ id: "docs.tech.llm.export-formats",
1379
+ title: "LLM Export Formats",
1380
+ summary: "Detailed explanation of the three export formats for LLM consumption.",
1381
+ kind: "reference",
1382
+ visibility: "public",
1383
+ route: "/docs/tech/llm/export-formats",
1384
+ tags: [
1385
+ "llm",
1386
+ "export",
1387
+ "markdown"
1388
+ ],
1389
+ body: `# LLM Export Formats
1390
+
1391
+ ContractSpec provides three export formats optimized for different LLM use cases.
1392
+
1393
+ ## Context Format
1394
+
1395
+ Best for: Understanding what a spec does, providing background to LLMs.
1396
+
1397
+ Includes:
1398
+ - Spec name, version, type
1399
+ - Goal and context
1400
+ - Description
1401
+ - Acceptance scenarios
1402
+
1403
+ Example:
1404
+
1405
+ \`\`\`markdown
1406
+ # users.createUser (v1)
1407
+
1408
+ > Create a new user account with email verification.
1409
+
1410
+ **Type:** command | **Stability:** stable
1411
+
1412
+ ## Goal
1413
+ Create a new user in the system and trigger email verification.
1414
+
1415
+ ## Context
1416
+ Part of the user onboarding flow. Called after signup form submission.
1417
+
1418
+ ## Acceptance Criteria
1419
+ ### Happy path
1420
+ **Given:** Valid email and password
1421
+ **When:** User submits registration
1422
+ **Then:** Account is created, verification email is sent
1423
+ \`\`\`
1424
+
1425
+ ## Full Format
1426
+
1427
+ Best for: Complete documentation, implementation reference.
1428
+
1429
+ Includes everything:
1430
+ - All metadata
1431
+ - JSON schemas for I/O
1432
+ - Error definitions
1433
+ - Policy (auth, rate limits, PII)
1434
+ - Events emitted
1435
+ - Examples
1436
+ - Transport configuration
1437
+
1438
+ ## Prompt Format
1439
+
1440
+ Best for: Feeding directly to coding agents.
1441
+
1442
+ Includes:
1443
+ - Task header with clear instructions
1444
+ - Full spec context
1445
+ - Implementation requirements
1446
+ - Task-specific guidance (implement/test/refactor/review)
1447
+ - Expected output format
1448
+
1449
+ The prompt format adapts based on task type:
1450
+ - **implement**: Full implementation with tests
1451
+ - **test**: Test generation for existing code
1452
+ - **refactor**: Refactoring while maintaining behavior
1453
+ - **review**: Code review against spec
1454
+ `
1455
+ },
1456
+ {
1457
+ id: "docs.tech.llm.agent-adapters",
1458
+ title: "Agent Adapters",
1459
+ summary: "Adapters for different AI coding agents (Claude, Cursor, MCP).",
1460
+ kind: "reference",
1461
+ visibility: "public",
1462
+ route: "/docs/tech/llm/agent-adapters",
1463
+ tags: [
1464
+ "llm",
1465
+ "agents",
1466
+ "claude",
1467
+ "cursor",
1468
+ "mcp"
1469
+ ],
1470
+ body: `# Agent Adapters
1471
+
1472
+ ContractSpec provides specialized adapters for different AI coding agents.
1473
+
1474
+ ## Claude Code Adapter
1475
+
1476
+ Optimized for Anthropic Claude's extended thinking and code generation.
1477
+
1478
+ Features:
1479
+ - Structured markdown with clear sections
1480
+ - Checklists for steps and verification
1481
+ - Icons for file operations (📝 create, ✏️ modify)
1482
+ - System prompt for ContractSpec context
1483
+
1484
+ Usage:
1485
+ \`\`\`typescript
1486
+ const guideService = createAgentGuideService({ defaultAgent: 'claude-code' });
1487
+ const result = guideService.generateGuide(spec, { agent: 'claude-code' });
1488
+ // result.prompt.systemPrompt - Claude system context
1489
+ // result.prompt.taskPrompt - Task-specific instructions
1490
+ \`\`\`
1491
+
1492
+ ## Cursor CLI Adapter
1493
+
1494
+ Optimized for Cursor's background/composer mode.
1495
+
1496
+ Features:
1497
+ - Compact format for context efficiency
1498
+ - .mdc cursor rules generation
1499
+ - Integration with Cursor's file system
1500
+ - Concise step lists
1501
+
1502
+ Generate Cursor Rules:
1503
+ \`\`\`typescript
1504
+ const cursorRules = guideService.generateAgentConfig(spec, 'cursor-cli');
1505
+ // Save to .cursor/rules/my-spec.mdc
1506
+ \`\`\`
1507
+
1508
+ ## Generic MCP Adapter
1509
+
1510
+ Works with any MCP-compatible agent (Cline, Aider, etc.).
1511
+
1512
+ Features:
1513
+ - Standard markdown format
1514
+ - Table-based metadata
1515
+ - JSON resource format support
1516
+ - Prompt message format
1517
+
1518
+ The generic adapter is the default and works across all agents.
1519
+
1520
+ ## Choosing an Adapter
1521
+
1522
+ | Agent | Best For | Key Features |
1523
+ |-------|----------|--------------|
1524
+ | Claude Code | Complex implementations | Extended thinking, detailed steps |
1525
+ | Cursor CLI | IDE-integrated work | Cursor rules, compact format |
1526
+ | Generic MCP | Any MCP agent | Universal compatibility |
1527
+ `
1528
+ },
1529
+ {
1530
+ id: "docs.tech.llm.verification",
1531
+ title: "Implementation Verification",
1532
+ summary: "Tiered verification of implementations against specifications.",
1533
+ kind: "reference",
1534
+ visibility: "public",
1535
+ route: "/docs/tech/llm/verification",
1536
+ tags: [
1537
+ "llm",
1538
+ "verify",
1539
+ "validation",
1540
+ "testing"
1541
+ ],
1542
+ body: `# Implementation Verification
1543
+
1544
+ ContractSpec provides tiered verification to check if implementations comply with specs.
1545
+
1546
+ ## Verification Tiers
1547
+
1548
+ ### Tier 1: Structure (Fast)
1549
+
1550
+ Checks TypeScript structure against spec requirements:
1551
+
1552
+ | Check | What it validates |
1553
+ |-------|------------------|
1554
+ | Handler export | Function is properly exported |
1555
+ | Contracts import | Imports from @lssm/lib.contracts |
1556
+ | Schema import | Imports from @lssm/lib.schema |
1557
+ | No \`any\` type | TypeScript strict compliance |
1558
+ | Error handling | Error codes are referenced |
1559
+ | Event emission | Event patterns exist |
1560
+ | Input validation | Validation patterns used |
1561
+ | Async patterns | Async/await for commands |
1562
+
1563
+ ### Tier 2: Behavior (Comprehensive)
1564
+
1565
+ Checks implementation coverage of spec behaviors:
1566
+
1567
+ | Check | What it validates |
1568
+ |-------|------------------|
1569
+ | Scenario coverage | Acceptance scenarios implemented |
1570
+ | Example coverage | Example I/O values referenced |
1571
+ | Error cases | All error conditions handled |
1572
+ | Event conditions | Events emitted correctly |
1573
+ | Idempotency | Idempotent patterns (if required) |
1574
+
1575
+ ### Tier 3: AI Review (Deep)
1576
+
1577
+ Uses LLM for semantic analysis:
1578
+
1579
+ - Does the implementation fulfill the spec's intent?
1580
+ - Are edge cases properly handled?
1581
+ - Is the code quality acceptable?
1582
+ - Are there any subtle violations?
1583
+
1584
+ Requires AI API key configuration.
1585
+
1586
+ ## Running Verification
1587
+
1588
+ \`\`\`typescript
1589
+ const verifyService = createVerifyService({
1590
+ aiApiKey: process.env.ANTHROPIC_API_KEY, // Optional, for Tier 3
1591
+ aiProvider: 'anthropic',
1592
+ });
1593
+
1594
+ const result = await verifyService.verify(spec, implementationCode, {
1595
+ tiers: ['structure', 'behavior'],
1596
+ failFast: false,
1597
+ includeSuggestions: true,
1598
+ });
1599
+
1600
+ console.log(result.passed); // true/false
1601
+ console.log(result.score); // 0-100
1602
+ console.log(result.summary); // Human-readable summary
1603
+ \`\`\`
1604
+
1605
+ ## Verification Report
1606
+
1607
+ The report includes:
1608
+
1609
+ - **passed**: Overall compliance
1610
+ - **score**: 0-100 score
1611
+ - **issues**: Array of problems found
1612
+ - **suggestions**: Recommended fixes
1613
+ - **coverage**: Metrics on scenario/error/field coverage
1614
+
1615
+ Each issue has:
1616
+ - **severity**: error, warning, or info
1617
+ - **category**: type, export, import, scenario, error_handling, semantic
1618
+ - **message**: Description of the issue
1619
+ - **suggestion**: How to fix it
1620
+ `
1621
+ }
1622
+ ];
1623
+ registerDocBlocks(tech_llm_integration_DocBlocks);
1624
+
1270
1625
  //#endregion
1271
1626
  //#region src/docs/learning-journey-ui-shared.docblock.ts
1272
1627
  registerDocBlocks([{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lssm/example.learning-journey-ui-shared",
3
- "version": "0.0.0-canary-20251216033905",
3
+ "version": "0.0.0-canary-20251216062412",
4
4
  "description": "Shared UI components and hooks for learning journey mini-apps.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",