@almadar/skills 2.1.0 → 2.4.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.
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import { existsSync, mkdirSync, writeFileSync } from 'fs';
2
2
  import { join } from 'path';
3
3
  import { generateBehaviorsDocs, getAllBehaviors, generateModulesDocs, getAllStdOperators } from '@almadar/std';
4
4
  import { OPERATORS, UI_SLOTS, PATTERN_TYPES, ViewTypeSchema, isInlineTrait as isInlineTrait$1 } from '@almadar/core/types';
5
- import { getPatternPropsCompact, getPatternActionsRef, getAllPatternTypes } from '@almadar/patterns';
5
+ import { getPatternPropsCompact, getPatternActionsRef, getOrbAllowedPatternsCompact, getAllPatternTypes } from '@almadar/patterns';
6
6
  import { BINDING_DOCS, CORE_BINDINGS, isInlineTrait } from '@almadar/core';
7
7
  import { generateDomainLanguageReference } from '@almadar/core/domain-language';
8
8
 
@@ -1369,6 +1369,190 @@ ${getPatternPropsCompact()}
1369
1369
  ${getPatternActionsRef()}
1370
1370
  `;
1371
1371
  }
1372
+ function getOrbRenderUIGuide() {
1373
+ const patternsRef = getOrbAllowedPatternsCompact();
1374
+ return `## .orb Render-UI Composition Guide
1375
+
1376
+ ### Golden Behavior Pattern
1377
+
1378
+ Every render-ui tree in .orb follows the same structure observed across all 107 golden behaviors:
1379
+
1380
+ \`\`\`
1381
+ stack (vertical, gap: lg) \u2190 root wrapper, ALWAYS
1382
+ \u251C\u2500\u2500 stack (horizontal) \u2190 header row (icon + title + actions)
1383
+ \u2502 \u251C\u2500\u2500 icon
1384
+ \u2502 \u251C\u2500\u2500 typography (h2/h3)
1385
+ \u2502 \u2514\u2500\u2500 button (primary action)
1386
+ \u251C\u2500\u2500 divider \u2190 visual separation
1387
+ \u251C\u2500\u2500 stat-display / badge row \u2190 optional summary stats
1388
+ \u2514\u2500\u2500 data-list / data-grid \u2190 main content
1389
+ OR form-section \u2190 for create/edit states
1390
+ \`\`\`
1391
+
1392
+ The most-used patterns (by frequency across all behaviors):
1393
+ 1. \`stack\` (2820) - ALL layout
1394
+ 2. \`typography\` (1332) - ALL text
1395
+ 3. \`divider\` (803) - section separation
1396
+ 4. \`icon\` (796) - decorative/semantic icons
1397
+ 5. \`button\` (782) - ALL actions
1398
+ 6. \`badge\` (697) - status indicators
1399
+ 7. \`stat-display\` (691) - metric cards
1400
+ 8. \`data-list\` (178) - list views
1401
+ 9. \`progress-bar\` (131) - progress indicators
1402
+ 10. \`card\` (108) - content grouping
1403
+
1404
+ ---
1405
+
1406
+ ### Composition Rules
1407
+
1408
+ | Rule | Requirement |
1409
+ |------|-------------|
1410
+ | **1** | Root element MUST be \`stack\` (vertical) or \`box\` |
1411
+ | **2** | Use ONLY atoms, molecules, and allowed exceptions (see pattern list below) |
1412
+ | **3** | Single \`render-ui\` per transition (compose children, never multiple flat calls) |
1413
+ | **4** | ALL visual props use CSS theme variables (no hex colors, no pixels) |
1414
+ | **5** | Every action button's \`event\` must match a state machine event key |
1415
+
1416
+ **Allowed exceptions** (entity-aware but standard in .orb):
1417
+ \`data-list\`, \`data-grid\`, \`search-input\`, \`form-section\`, \`meter\`
1418
+
1419
+ **BANNED from .orb render-ui** (organisms, resolved by compiler/runtime):
1420
+ \`entity-table\`, \`entity-list\`, \`entity-cards\`, \`page-header\`, \`detail-panel\`,
1421
+ \`stats\`, \`dashboard-grid\`, \`header\`, \`sidebar\`, \`navigation\`, \`master-detail\`
1422
+
1423
+ ---
1424
+
1425
+ ### Layout Reference
1426
+
1427
+ **Stack** (use for ALL layout):
1428
+ \`\`\`json
1429
+ {
1430
+ "type": "stack",
1431
+ "direction": "vertical" | "horizontal",
1432
+ "gap": "xs" | "sm" | "md" | "lg" | "xl",
1433
+ "align": "start" | "center" | "end" | "stretch",
1434
+ "justify": "start" | "center" | "end" | "between"
1435
+ }
1436
+ \`\`\`
1437
+
1438
+ **Box** (styled container):
1439
+ \`\`\`json
1440
+ {
1441
+ "type": "box",
1442
+ "padding": "sm" | "md" | "lg",
1443
+ "bg": "var(--color-card)",
1444
+ "border": true,
1445
+ "borderColor": "var(--color-border)",
1446
+ "rounded": "var(--radius-md)",
1447
+ "shadow": "var(--shadow-sm)"
1448
+ }
1449
+ \`\`\`
1450
+
1451
+ ---
1452
+
1453
+ ### Theme Variables (MANDATORY)
1454
+
1455
+ | Property | Use | Never |
1456
+ |----------|-----|-------|
1457
+ | Colors | \`var(--color-primary)\` | \`#3b82f6\` |
1458
+ | Backgrounds | \`var(--color-card)\` | \`white\` |
1459
+ | Text | \`var(--color-foreground)\` | \`black\` |
1460
+ | Muted text | \`var(--color-muted-foreground)\` | \`gray\` |
1461
+ | Borders | \`var(--color-border)\` | \`#e5e7eb\` |
1462
+ | Radius | \`var(--radius-md)\` | \`8px\` |
1463
+ | Shadows | \`var(--shadow-sm)\` | \`0 2px 4px...\` |
1464
+
1465
+ ---
1466
+
1467
+ ### Example: Browsing State (from golden behaviors)
1468
+
1469
+ \`\`\`json
1470
+ ["render-ui", "main", {
1471
+ "type": "stack", "direction": "vertical", "gap": "lg",
1472
+ "children": [
1473
+ {
1474
+ "type": "stack", "direction": "horizontal", "gap": "md",
1475
+ "justify": "between", "align": "center",
1476
+ "children": [
1477
+ {
1478
+ "type": "stack", "direction": "horizontal", "gap": "sm", "align": "center",
1479
+ "children": [
1480
+ { "type": "icon", "name": "list", "size": "lg" },
1481
+ { "type": "typography", "variant": "h2", "content": "Items" }
1482
+ ]
1483
+ },
1484
+ { "type": "button", "label": "Create", "event": "CREATE", "variant": "primary" }
1485
+ ]
1486
+ },
1487
+ { "type": "divider" },
1488
+ {
1489
+ "type": "stack", "direction": "horizontal", "gap": "md",
1490
+ "children": [
1491
+ { "type": "stat-display", "label": "Total", "value": "@entity.total", "icon": "package" },
1492
+ { "type": "stat-display", "label": "Price", "value": "@entity.price", "icon": "dollar-sign" }
1493
+ ]
1494
+ },
1495
+ {
1496
+ "type": "data-list", "entity": "Item",
1497
+ "emptyIcon": "inbox",
1498
+ "itemActions": [
1499
+ { "label": "Edit", "event": "EDIT" },
1500
+ { "label": "Delete", "event": "DELETE", "variant": "danger" }
1501
+ ]
1502
+ }
1503
+ ]
1504
+ }]
1505
+ \`\`\`
1506
+
1507
+ ### Example: Modal Form (from golden behaviors)
1508
+
1509
+ \`\`\`json
1510
+ ["render-ui", "modal", {
1511
+ "type": "stack", "direction": "vertical", "gap": "md",
1512
+ "children": [
1513
+ {
1514
+ "type": "stack", "direction": "horizontal", "gap": "sm", "align": "center",
1515
+ "children": [
1516
+ { "type": "icon", "name": "plus-circle", "size": "md" },
1517
+ { "type": "typography", "variant": "h3", "content": "Create Item" }
1518
+ ]
1519
+ },
1520
+ { "type": "divider" },
1521
+ {
1522
+ "type": "form-section", "entity": "Item",
1523
+ "mode": "create",
1524
+ "submitEvent": "SAVE",
1525
+ "cancelEvent": "CANCEL"
1526
+ }
1527
+ ]
1528
+ }]
1529
+ \`\`\`
1530
+
1531
+ ---
1532
+
1533
+ ${getBindingsGuide()}
1534
+
1535
+ ---
1536
+
1537
+ ### Available Patterns (derived from registry)
1538
+
1539
+ ${patternsRef}
1540
+
1541
+ ---
1542
+
1543
+ ### BANNED Patterns
1544
+
1545
+ | Wrong | Correct |
1546
+ |-------|---------|
1547
+ | \`entity-table\` | \`data-list\` or \`data-grid\` |
1548
+ | \`page-header\` | \`stack\` with \`icon\` + \`typography\` + \`button\` |
1549
+ | \`detail-panel\` | \`stack\` with field \`typography\` rows |
1550
+ | \`stats\` | \`stat-display\` atoms in a \`stack\` |
1551
+ | Multiple flat render-ui calls | Single composed render-ui |
1552
+ | Hex colors / pixels | Theme CSS variables |
1553
+ | \`onSubmit\` / \`onCancel\` | \`submitEvent\` / \`cancelEvent\` |
1554
+ `;
1555
+ }
1372
1556
 
1373
1557
  // src/prompts/skill-sections/theme-guide.ts
1374
1558
  function getThemeGuide() {
@@ -4076,6 +4260,647 @@ When answering:
4076
4260
  };
4077
4261
  }
4078
4262
 
4263
+ // src/generators/orb.ts
4264
+ function generateOrbSkill() {
4265
+ const frontmatter = {
4266
+ name: "orb",
4267
+ description: "Generate .orb programs using molecule-first composition. Atoms + molecules only, no organisms.",
4268
+ allowedTools: ["Read", "Write", "Edit", "generate_orbital", "generate_schema_orchestrated", "finish_task", "query_schema_structure", "extract_chunk", "apply_chunk"],
4269
+ version: "1.0.0"
4270
+ };
4271
+ const content = generateOrbSkillContent();
4272
+ return {
4273
+ name: "orb",
4274
+ frontmatter,
4275
+ content
4276
+ };
4277
+ }
4278
+ function generateOrbSkillContent() {
4279
+ return `# Orb Generation Skill (Molecule-First)
4280
+
4281
+ > Generate .orb programs using Orbital Units: Entity x Traits x Patterns
4282
+ > Pattern vocabulary: atoms + molecules only. No organisms.
4283
+
4284
+ ${getArchitectureSection()}
4285
+
4286
+ ---
4287
+
4288
+ ${getSExprQuickRef()}
4289
+
4290
+ ---
4291
+
4292
+ ${getMoleculeFirstDesignGuide()}
4293
+
4294
+ ---
4295
+
4296
+ ${getThemeGuide()}
4297
+
4298
+ ---
4299
+
4300
+ ${getBannedProps()}
4301
+
4302
+ ---
4303
+
4304
+ ${getFlowPatternSection()}
4305
+
4306
+ ---
4307
+
4308
+ ${getDecompositionCompact()}
4309
+
4310
+ ---
4311
+
4312
+ ${getPortableOrbitalOutputSection()}
4313
+
4314
+ ---
4315
+
4316
+ ${getConnectivityCompact()}
4317
+
4318
+ ---
4319
+
4320
+ ${getContextUsageCompact()}
4321
+
4322
+ ---
4323
+
4324
+ ${getCommonErrorsSection("top6")}
4325
+
4326
+ ${getToolWorkflowSection2()}
4327
+
4328
+ ${getCriticalOutputRequirements2()}
4329
+
4330
+ ${getMoleculeFirstExample()}
4331
+ `;
4332
+ }
4333
+ function getMoleculeFirstDesignGuide() {
4334
+ return `## Render-UI Molecule-First Design Guide
4335
+
4336
+ ### The Five Rules of Composition (MANDATORY)
4337
+
4338
+ | Rule | Requirement |
4339
+ |------|-------------|
4340
+ | **1** | **Single Render-UI** per transition |
4341
+ | **2** | **Two Levels**: Atoms (2+) + Molecules (1+) |
4342
+ | **3** | **Layout Wrapper**: Root must be \`stack\`, \`card\`, \`box\`, or \`simple-grid\` |
4343
+ | **4** | **Theme Variables**: ALL visual props use CSS vars |
4344
+ | **5** | **Composable**: Build from small pieces, never use rigid organisms |
4345
+
4346
+ ---
4347
+
4348
+ ### Pattern Vocabulary
4349
+
4350
+ These are the ONLY patterns you may use. They are derived from 104 production behaviors across 18 domains.
4351
+
4352
+ #### Atoms (Basic UI Elements)
4353
+
4354
+ | Pattern | Purpose | Key Props |
4355
+ |---------|---------|-----------|
4356
+ | \`typography\` | All text content | \`variant\` (h1-h6, body, caption), \`text\`, \`color\` |
4357
+ | \`button\` | User actions | \`label\`, \`event\`, \`variant\` (primary, secondary, ghost, destructive) |
4358
+ | \`icon\` | Lucide icons | \`name\`, \`size\`, \`color\` |
4359
+ | \`badge\` | Status indicators | \`text\`, \`variant\` (primary, success, warning, error) |
4360
+ | \`divider\` | Visual separation | \`orientation\` |
4361
+ | \`avatar\` | User/entity images | \`src\`, \`name\`, \`size\` |
4362
+ | \`progress-bar\` | Progress indicators | \`value\`, \`max\`, \`label\` |
4363
+ | \`status-dot\` | Status indicator dots | \`status\`, \`label\` |
4364
+ | \`star-rating\` | Rating display | \`value\`, \`max\` |
4365
+
4366
+ #### Layout Molecules
4367
+
4368
+ | Pattern | Purpose | Key Props |
4369
+ |---------|---------|-----------|
4370
+ | \`stack\` | Flex layout (V/H) | \`direction\` (vertical/horizontal), \`gap\`, \`align\`, \`justify\`, \`wrap\` |
4371
+ | \`card\` | Content grouping | \`padding\`, \`border\`, \`rounded\`, \`shadow\`, \`children\` |
4372
+ | \`box\` | Visual container | \`padding\`, \`bg\`, \`border\`, \`rounded\`, \`shadow\`, \`children\` |
4373
+ | \`simple-grid\` | Grid layout | \`cols\`, \`gap\`, \`children\` |
4374
+
4375
+ #### Data Molecules
4376
+
4377
+ | Pattern | Purpose | Key Props |
4378
+ |---------|---------|-----------|
4379
+ | \`data-grid\` | Tabular data display | \`entity\`, \`fields\`, \`itemActions\`, \`cols\`, \`gap\` |
4380
+ | \`data-list\` | Vertical list display | \`entity\`, \`fields\`, \`itemActions\` |
4381
+ | \`form-section\` | Form input groups | \`entity\`, \`fields\`, \`submitEvent\`, \`cancelEvent\` |
4382
+ | \`search-input\` | Search fields | \`placeholder\`, \`event\` |
4383
+ | \`filter-group\` | Filter controls | \`filters\`, \`event\` |
4384
+ | \`tabs\` | Tabbed content | \`tabs\`, \`activeTab\` |
4385
+
4386
+ #### Metric/Chart Molecules
4387
+
4388
+ | Pattern | Purpose | Key Props |
4389
+ |---------|---------|-----------|
4390
+ | \`stat-display\` | Single KPI display | \`label\`, \`value\`, \`icon\` |
4391
+ | \`stats\` | Multiple stat cards | \`entity\`, \`items\` |
4392
+ | \`stat-badge\` | Stat with badge | \`label\`, \`value\`, \`variant\` |
4393
+ | \`meter\` | Metric gauge | \`value\`, \`max\`, \`label\` |
4394
+ | \`line-chart\` | Line chart | \`entity\`, \`xField\`, \`yField\` |
4395
+ | \`chart\` | Generic chart | \`entity\`, \`type\`, \`fields\` |
4396
+ | \`trend-indicator\` | Trend up/down | \`value\`, \`direction\` |
4397
+ | \`score-display\` | Score/count | \`value\`, \`label\` |
4398
+
4399
+ #### State Molecules
4400
+
4401
+ | Pattern | Purpose | Key Props |
4402
+ |---------|---------|-----------|
4403
+ | \`empty-state\` | No data fallback | \`title\`, \`description\`, \`icon\` |
4404
+ | \`loading-state\` | Loading spinner | \`message\` |
4405
+
4406
+ #### Form Molecules
4407
+
4408
+ | Pattern | Purpose | Key Props |
4409
+ |---------|---------|-----------|
4410
+ | \`textarea\` | Multi-line input | \`placeholder\`, \`rows\` |
4411
+ | \`range-slider\` | Range input | \`min\`, \`max\`, \`step\`, \`value\` |
4412
+ | \`upload-drop-zone\` | File upload | \`accept\`, \`maxSize\` |
4413
+ | \`calendar-grid\` | Date picker grid | \`selectedDate\`, \`event\` |
4414
+
4415
+ #### Navigation Molecules
4416
+
4417
+ | Pattern | Purpose | Key Props |
4418
+ |---------|---------|-----------|
4419
+ | \`wizard-progress\` | Multi-step progress | \`steps\`, \`currentStep\` |
4420
+ | \`wizard-navigation\` | Step navigation | \`steps\`, \`currentStep\` |
4421
+ | \`action-buttons\` | Action button group | \`actions\` |
4422
+
4423
+ #### Specialty Molecules
4424
+
4425
+ | Pattern | Purpose | Key Props |
4426
+ |---------|---------|-----------|
4427
+ | \`lightbox\` | Image/media viewer | \`src\`, \`alt\` |
4428
+ | \`map-view\` | Map display | \`center\`, \`zoom\`, \`markers\` |
4429
+ | \`health-bar\` | Health/HP bar | \`value\`, \`max\` |
4430
+ | \`d-pad\` | Directional pad | \`events\` |
4431
+ | \`combat-log\` | Event log | \`entries\` |
4432
+ | \`dialogue-box\` | Dialogue/chat | \`speaker\`, \`text\` |
4433
+
4434
+ #### Game Canvas Molecules
4435
+
4436
+ | Pattern | Purpose | Key Props |
4437
+ |---------|---------|-----------|
4438
+ | \`isometric-canvas\` | 3D isometric canvas | \`tiles\`, \`units\` |
4439
+ | \`platformer-canvas\` | 2D platformer | \`entities\`, \`viewport\` |
4440
+ | \`simulation-canvas\` | Simulation display | \`entities\`, \`viewport\` |
4441
+ | \`canvas-effect\` | Canvas visual effects | \`effect\`, \`duration\` |
4442
+ | \`game-hud\` | Game HUD overlay | \`stats\`, \`actions\` |
4443
+ | \`game-menu\` | Game menu | \`items\` |
4444
+ | \`game-over-screen\` | End screen | \`score\`, \`message\` |
4445
+ | \`inventory-panel\` | Inventory display | \`items\`, \`slots\` |
4446
+
4447
+ ---
4448
+
4449
+ ### BANNED Patterns (NEVER USE)
4450
+
4451
+ These organism-level patterns are deprecated. Use the molecule equivalents:
4452
+
4453
+ | Banned Pattern | Use Instead |
4454
+ |---------------|-------------|
4455
+ | \`entity-table\` | \`data-grid\` with \`entity\`, \`fields\`, \`itemActions\` |
4456
+ | \`entity-list\` | \`data-list\` with \`entity\`, \`fields\`, \`itemActions\` |
4457
+ | \`entity-cards\` | \`data-grid\` with \`cols: 3\`, or compose with \`card\` children in a \`simple-grid\` |
4458
+ | \`page-header\` | Compose with \`stack\` (horizontal) + \`typography\` (h1) + \`button\` |
4459
+ | \`detail-panel\` | Compose with \`stack\` (vertical) + \`typography\` + \`badge\` + \`divider\` |
4460
+ | \`timeline\` | Compose with \`data-list\` or \`stack\` + timestamp items |
4461
+ | \`crud-template\` | Compose from \`data-grid\` + \`form-section\` + layout molecules |
4462
+ | \`list-template\` | Compose from \`data-list\` + \`search-input\` + layout molecules |
4463
+ | \`detail-template\` | Compose from \`stack\` + \`typography\` + \`badge\` + \`button\` |
4464
+
4465
+ ---
4466
+
4467
+ ### Layout-First Structure (Rule 3)
4468
+
4469
+ Root element MUST be a layout molecule:
4470
+
4471
+ \`\`\`json
4472
+ { "type": "stack", "direction": "vertical", "gap": "lg", "children": [...] }
4473
+ { "type": "stack", "direction": "horizontal", "gap": "md", "children": [...] }
4474
+ { "type": "box", "padding": "lg", "bg": "var(--color-card)", "children": [...] }
4475
+ { "type": "simple-grid", "cols": 3, "gap": "md", "children": [...] }
4476
+ \`\`\`
4477
+
4478
+ #### Layout Props Reference
4479
+
4480
+ **Stack (VStack/HStack)**
4481
+ \`\`\`json
4482
+ {
4483
+ "type": "stack",
4484
+ "direction": "vertical" | "horizontal",
4485
+ "gap": "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl",
4486
+ "align": "start" | "center" | "end" | "stretch",
4487
+ "justify": "start" | "center" | "end" | "between" | "around",
4488
+ "wrap": true | false
4489
+ }
4490
+ \`\`\`
4491
+
4492
+ **Box**
4493
+ \`\`\`json
4494
+ {
4495
+ "type": "box",
4496
+ "padding": "none" | "xs" | "sm" | "md" | "lg" | "xl",
4497
+ "bg": "var(--color-card)" | "var(--color-muted)" | "var(--color-primary)",
4498
+ "border": true | false,
4499
+ "rounded": "var(--radius-md)" | "var(--radius-lg)",
4500
+ "shadow": "var(--shadow-sm)" | "var(--shadow-md)"
4501
+ }
4502
+ \`\`\`
4503
+
4504
+ ---
4505
+
4506
+ ### Composition Pattern: Header Row
4507
+
4508
+ Instead of \`page-header\`, compose with atoms:
4509
+
4510
+ \`\`\`json
4511
+ {
4512
+ "type": "stack", "direction": "horizontal", "justify": "between", "align": "center",
4513
+ "children": [
4514
+ { "type": "typography", "variant": "h1", "text": "Tasks" },
4515
+ { "type": "button", "label": "New Task", "event": "CREATE", "variant": "primary", "icon": "plus" }
4516
+ ]
4517
+ }
4518
+ \`\`\`
4519
+
4520
+ ### Composition Pattern: Stat Cards
4521
+
4522
+ \`\`\`json
4523
+ {
4524
+ "type": "stack", "direction": "horizontal", "gap": "md", "wrap": true,
4525
+ "children": [
4526
+ { "type": "stat-display", "label": "Total", "value": "--", "icon": "list" },
4527
+ { "type": "stat-display", "label": "Active", "value": "--", "icon": "activity" },
4528
+ { "type": "stat-display", "label": "Done", "value": "--", "icon": "check-circle" }
4529
+ ]
4530
+ }
4531
+ \`\`\`
4532
+
4533
+ ### Composition Pattern: Data View with Actions
4534
+
4535
+ \`\`\`json
4536
+ {
4537
+ "type": "data-grid", "entity": "Task", "fields": ["title", "status", "priority"],
4538
+ "itemActions": [
4539
+ { "event": "VIEW", "label": "View" },
4540
+ { "event": "EDIT", "label": "Edit" },
4541
+ { "event": "DELETE", "label": "Delete" }
4542
+ ]
4543
+ }
4544
+ \`\`\`
4545
+
4546
+ ---
4547
+
4548
+ ### Critical Validation Rules
4549
+
4550
+ | Element | Correct Format | Wrong Format | Error |
4551
+ |---------|----------------|--------------|-------|
4552
+ | **Events** | \`{ "key": "INIT", "name": "Init" }\` | \`"INIT"\` | ORB_T_EVT_INVALID_FORMAT |
4553
+ | **Emits** | \`[{ "event": "INIT", "scope": "internal" }]\` | \`["INIT"]\` | ORB_T_UNDEFINED_TRAIT |
4554
+ | **Payload events** | \`{ "key": "SAVE", "payload": [...] }\` | No payload | ORB_BINDING_PAYLOAD_FIELD_UNDECLARED |
4555
+ | **Page traits** | \`{ "ref": "TraitName" }\` | With linkedEntity | ORB_P_INVALID_TRAIT_REF |
4556
+ | **Category** | \`"category": "interaction"\` | Missing | ORB_T_MISSING_CATEGORY |
4557
+
4558
+ ---
4559
+
4560
+ ### Composition Quality Checklist
4561
+
4562
+ Before calling \`finish_task\`, verify:
4563
+
4564
+ \`\`\`
4565
+ [] Single render-ui per transition
4566
+ [] Root element is layout (stack/box/simple-grid)
4567
+ [] Contains 2+ atoms (typography, badge, button, icon)
4568
+ [] Contains 1+ data molecules (data-grid, data-list, form-section, stats)
4569
+ [] NO organism patterns (entity-table, entity-list, page-header, etc.)
4570
+ [] Uses theme variables for ALL visual properties
4571
+ [] Matches production quality from standard behaviors
4572
+ [] Passes orbital validate with zero errors and zero warnings
4573
+ \`\`\`
4574
+
4575
+ ---
4576
+
4577
+ ### BANNED Patterns (Additional)
4578
+
4579
+ | Wrong | Correct |
4580
+ |-------|---------|
4581
+ | Multiple flat render-ui calls | Single composed render-ui |
4582
+ | Root organism without layout | Layout wrapper required |
4583
+ | Hex colors | Theme CSS variables |
4584
+ | Pixel values | Theme spacing variables |
4585
+ | Events as strings \`"INIT"\` | Event objects \`{ "key": "INIT" }\` |
4586
+ | Emits as strings \`["INIT"]\` | Emit objects \`[{ "event": "INIT" }]\` |
4587
+ | \`onSubmit\` / \`onCancel\` | \`submitEvent\` / \`cancelEvent\` |
4588
+ | \`headerActions\` | \`actions\` |
4589
+ | \`entity-table\` | \`data-grid\` |
4590
+ | \`entity-list\` | \`data-list\` |
4591
+ | \`page-header\` | \`stack\` + \`typography\` + \`button\` |
4592
+
4593
+ ---
4594
+
4595
+ ${getBindingsGuide()}
4596
+ `;
4597
+ }
4598
+ function getToolWorkflowSection2() {
4599
+ return `---
4600
+
4601
+ ## Tool Workflow
4602
+
4603
+ ### Phase 1: DECOMPOSE
4604
+ Break requirements into OrbitalUnits (pure reasoning, no tools).
4605
+
4606
+ ### Phase 2: GENERATE
4607
+
4608
+ **Option A: Orchestrated Generation (RECOMMENDED for 3+ orbitals)**
4609
+ Use \`generate_schema_orchestrated\` for automatic complexity-based routing:
4610
+
4611
+ \`\`\`
4612
+ generate_schema_orchestrated({ prompt: "Full app description with all entities and features" })
4613
+ \`\`\`
4614
+
4615
+ **Option B: Per-Orbital Generation (for simple cases or fine-grained control)**
4616
+ Call \`generate_orbital\` for each orbital:
4617
+
4618
+ \`\`\`
4619
+ generate_orbital({ orbital: {...}, orbitalIndex: 0, totalOrbitals: N })
4620
+ \`\`\`
4621
+
4622
+ ### Phase 3: COMBINE
4623
+ Call \`finish_task\` to auto-combine orbitals into schema.orb:
4624
+
4625
+ \`\`\`
4626
+ finish_task({ appName: "App" })
4627
+ \`\`\`
4628
+
4629
+ ### Phase 4: VALIDATE (CRITICAL)
4630
+ After combining, validate the schema:
4631
+
4632
+ \`\`\`
4633
+ validate_schema()
4634
+ \`\`\`
4635
+
4636
+ ### Phase 5: VERIFY COMPOSITION QUALITY
4637
+
4638
+ Before calling \`finish_task\`, verify each INIT transition:
4639
+
4640
+ 1. **Uses a single \`render-ui\` call** with top-level \`stack\` and \`children\`
4641
+ 2. **Has 3+ composed sections**: header (HStack: title + action), metrics (stat-display/stats), data (data-grid/data-list)
4642
+ 3. **Uses domain-appropriate atoms**: \`badge\` for status, \`typography\` for labels/values, \`button\` for actions
4643
+ 4. **NO organisms**: Never \`entity-table\`, \`entity-list\`, \`page-header\`, \`detail-panel\`
4644
+ 5. **Props are correct**: \`submitEvent\` not \`onSubmit\`, \`fields\` not \`fieldNames\`
4645
+ `;
4646
+ }
4647
+ function getCriticalOutputRequirements2() {
4648
+ return `---
4649
+
4650
+ ## CRITICAL: Output Requirements
4651
+
4652
+ Every orbital MUST include:
4653
+
4654
+ ### 1. domainContext (REQUIRED)
4655
+ \`\`\`json
4656
+ "domainContext": {
4657
+ "request": "<original user request>",
4658
+ "requestFragment": "<what part produced THIS orbital>",
4659
+ "category": "business",
4660
+ "vocabulary": { "item": "Task", "create": "Add", "delete": "Remove" }
4661
+ }
4662
+ \`\`\`
4663
+
4664
+ ### 2. design (REQUIRED)
4665
+ \`\`\`json
4666
+ "design": {
4667
+ "style": "modern",
4668
+ "uxHints": {
4669
+ "flowPattern": "crud-cycle",
4670
+ "listPattern": "data-grid",
4671
+ "formPattern": "modal"
4672
+ }
4673
+ }
4674
+ \`\`\`
4675
+
4676
+ ### 3. Business Rule Guards on SAVE (when rules exist)
4677
+ If the user specifies validation constraints, add S-expression guards:
4678
+ \`\`\`json
4679
+ {
4680
+ "from": "Creating", "to": "Browsing", "event": "SAVE",
4681
+ "guard": ["<=", "@payload.data.score", 100],
4682
+ "effects": [["persist", "create", "Entry", "@payload.data"], ...]
4683
+ }
4684
+ \`\`\`
4685
+
4686
+ ### 4. ONE Orbital Per Entity
4687
+
4688
+ ### 5. Entity Field is REQUIRED (CRITICAL)
4689
+ Every orbital MUST have an entity field. No exceptions.`;
4690
+ }
4691
+ function getMoleculeFirstExample() {
4692
+ return `---
4693
+
4694
+ ## Example: Task Manager (Molecule-First - VALIDATED)
4695
+
4696
+ This example passes \`orbital validate\` with zero errors and zero warnings.
4697
+ Uses only atoms and molecules. No organisms.
4698
+
4699
+ \`\`\`json
4700
+ {
4701
+ "name": "Taskly",
4702
+ "version": "1.0.0",
4703
+ "orbitals": [{
4704
+ "name": "Task Management",
4705
+ "entity": {
4706
+ "name": "Task",
4707
+ "collection": "tasks",
4708
+ "fields": [
4709
+ { "name": "title", "type": "string", "required": true },
4710
+ { "name": "description", "type": "string" },
4711
+ { "name": "status", "type": "enum", "values": ["todo", "in-progress", "done"] },
4712
+ { "name": "priority", "type": "enum", "values": ["low", "medium", "high"] }
4713
+ ]
4714
+ },
4715
+ "traits": [{
4716
+ "name": "TaskInteraction",
4717
+ "category": "interaction",
4718
+ "linkedEntity": "Task",
4719
+ "emits": [{ "event": "INIT", "scope": "internal" }],
4720
+ "stateMachine": {
4721
+ "states": [
4722
+ { "name": "Browsing", "isInitial": true },
4723
+ { "name": "Creating" },
4724
+ { "name": "Editing" },
4725
+ { "name": "Viewing" }
4726
+ ],
4727
+ "events": [
4728
+ { "key": "INIT", "name": "Initialize" },
4729
+ { "key": "CREATE", "name": "Create" },
4730
+ { "key": "VIEW", "name": "View", "payload": [{ "name": "id", "type": "string" }] },
4731
+ { "key": "EDIT", "name": "Edit", "payload": [{ "name": "id", "type": "string" }] },
4732
+ { "key": "DELETE", "name": "Delete", "payload": [{ "name": "id", "type": "string" }] },
4733
+ { "key": "SAVE", "name": "Save", "payload": [{ "name": "data", "type": "object" }] },
4734
+ { "key": "CANCEL", "name": "Cancel" },
4735
+ { "key": "CLOSE", "name": "Close" }
4736
+ ],
4737
+ "transitions": [
4738
+ {
4739
+ "from": "Browsing", "to": "Browsing", "event": "INIT",
4740
+ "effects": [
4741
+ ["fetch", "Task"],
4742
+ ["render-ui", "main", {
4743
+ "type": "stack", "direction": "vertical", "gap": "lg",
4744
+ "children": [
4745
+ {
4746
+ "type": "stack", "direction": "horizontal", "justify": "between", "align": "center",
4747
+ "children": [
4748
+ { "type": "typography", "variant": "h1", "text": "Task Management" },
4749
+ { "type": "button", "label": "New Task", "event": "CREATE", "variant": "primary", "icon": "plus" }
4750
+ ]
4751
+ },
4752
+ {
4753
+ "type": "stack", "direction": "horizontal", "gap": "md", "wrap": true,
4754
+ "children": [
4755
+ { "type": "stat-display", "label": "Total Tasks", "value": "--", "icon": "list" },
4756
+ { "type": "stat-display", "label": "In Progress", "value": "--", "icon": "clock" },
4757
+ { "type": "stat-display", "label": "Completed", "value": "--", "icon": "check-circle" }
4758
+ ]
4759
+ },
4760
+ {
4761
+ "type": "search-input", "placeholder": "Search tasks..."
4762
+ },
4763
+ {
4764
+ "type": "data-grid", "entity": "Task",
4765
+ "fields": ["title", "status", "priority"],
4766
+ "itemActions": [
4767
+ { "event": "VIEW", "label": "View" },
4768
+ { "event": "EDIT", "label": "Edit" },
4769
+ { "event": "DELETE", "label": "Delete" }
4770
+ ]
4771
+ }
4772
+ ]
4773
+ }]
4774
+ ]
4775
+ },
4776
+ {
4777
+ "from": "Browsing", "to": "Creating", "event": "CREATE",
4778
+ "effects": [
4779
+ ["render-ui", "modal", {
4780
+ "type": "form-section", "entity": "Task",
4781
+ "fields": ["title", "description", "status", "priority"],
4782
+ "submitEvent": "SAVE", "cancelEvent": "CANCEL"
4783
+ }]
4784
+ ]
4785
+ },
4786
+ {
4787
+ "from": "Browsing", "to": "Viewing", "event": "VIEW",
4788
+ "effects": [
4789
+ ["fetch", "Task", "@payload.id"],
4790
+ ["render-ui", "modal", {
4791
+ "type": "stack", "direction": "vertical", "gap": "md",
4792
+ "children": [
4793
+ { "type": "typography", "variant": "h2", "text": "@entity.title" },
4794
+ { "type": "badge", "text": "@entity.status", "variant": "primary" },
4795
+ { "type": "badge", "text": "@entity.priority", "variant": "secondary" },
4796
+ { "type": "divider" },
4797
+ { "type": "typography", "variant": "body", "text": "@entity.description" },
4798
+ { "type": "stack", "direction": "horizontal", "gap": "sm", "justify": "end",
4799
+ "children": [
4800
+ { "type": "button", "label": "Edit", "event": "EDIT", "variant": "secondary" },
4801
+ { "type": "button", "label": "Close", "event": "CLOSE", "variant": "ghost" }
4802
+ ]
4803
+ }
4804
+ ]
4805
+ }]
4806
+ ]
4807
+ },
4808
+ {
4809
+ "from": "Browsing", "to": "Editing", "event": "EDIT",
4810
+ "effects": [
4811
+ ["fetch", "Task", "@payload.id"],
4812
+ ["render-ui", "modal", {
4813
+ "type": "form-section", "entity": "Task",
4814
+ "fields": ["title", "description", "status", "priority"],
4815
+ "submitEvent": "SAVE", "cancelEvent": "CANCEL"
4816
+ }]
4817
+ ]
4818
+ },
4819
+ {
4820
+ "from": "Creating", "to": "Browsing", "event": "SAVE",
4821
+ "effects": [
4822
+ ["persist", "create", "Task", "@payload.data"],
4823
+ ["render-ui", "modal", null],
4824
+ ["emit", "INIT"]
4825
+ ]
4826
+ },
4827
+ {
4828
+ "from": "Editing", "to": "Browsing", "event": "SAVE",
4829
+ "effects": [
4830
+ ["persist", "update", "Task", "@entity.id", "@payload.data"],
4831
+ ["render-ui", "modal", null],
4832
+ ["emit", "INIT"]
4833
+ ]
4834
+ },
4835
+ {
4836
+ "from": "Creating", "to": "Browsing", "event": "CANCEL",
4837
+ "effects": [["render-ui", "modal", null]]
4838
+ },
4839
+ {
4840
+ "from": "Creating", "to": "Browsing", "event": "CLOSE",
4841
+ "effects": [["render-ui", "modal", null]]
4842
+ },
4843
+ {
4844
+ "from": "Editing", "to": "Browsing", "event": "CANCEL",
4845
+ "effects": [["render-ui", "modal", null]]
4846
+ },
4847
+ {
4848
+ "from": "Editing", "to": "Browsing", "event": "CLOSE",
4849
+ "effects": [["render-ui", "modal", null]]
4850
+ },
4851
+ {
4852
+ "from": "Viewing", "to": "Browsing", "event": "CLOSE",
4853
+ "effects": [["render-ui", "modal", null]]
4854
+ },
4855
+ {
4856
+ "from": "Viewing", "to": "Browsing", "event": "CANCEL",
4857
+ "effects": [["render-ui", "modal", null]]
4858
+ },
4859
+ {
4860
+ "from": "Viewing", "to": "Editing", "event": "EDIT",
4861
+ "effects": [
4862
+ ["render-ui", "modal", {
4863
+ "type": "form-section", "entity": "Task",
4864
+ "fields": ["title", "description", "status", "priority"],
4865
+ "submitEvent": "SAVE", "cancelEvent": "CANCEL"
4866
+ }]
4867
+ ]
4868
+ },
4869
+ {
4870
+ "from": "Browsing", "to": "Browsing", "event": "DELETE",
4871
+ "effects": [
4872
+ ["persist", "delete", "Task", "@payload.id"],
4873
+ ["emit", "INIT"]
4874
+ ]
4875
+ }
4876
+ ]
4877
+ }
4878
+ }],
4879
+ "pages": [{
4880
+ "name": "TasksPage",
4881
+ "path": "/tasks",
4882
+ "viewType": "list",
4883
+ "isInitial": true,
4884
+ "entity": "Task",
4885
+ "traits": [{ "ref": "TaskInteraction" }]
4886
+ }],
4887
+ "emits": [],
4888
+ "listens": []
4889
+ }]
4890
+ }
4891
+ \`\`\`
4892
+
4893
+ **Key points (molecule-first composition):**
4894
+ - **Header**: \`stack\` (horizontal) + \`typography\` (h1) + \`button\` (composed, NOT \`page-header\`)
4895
+ - **Stats**: \`stat-display\` molecules in a horizontal \`stack\` (NOT \`stats\` organism)
4896
+ - **Search**: \`search-input\` molecule
4897
+ - **Data**: \`data-grid\` with \`entity\`, \`fields\`, \`itemActions\` (NOT \`entity-table\`)
4898
+ - **Detail view**: \`stack\` + \`typography\` + \`badge\` + \`divider\` (NOT \`detail-panel\`)
4899
+ - **Forms**: \`form-section\` with \`submitEvent\`/\`cancelEvent\`
4900
+ - **Theme**: All visual props use CSS variables
4901
+ `;
4902
+ }
4903
+
4079
4904
  // src/orbitals-skills-generators/lean/lean-orbital-generator.ts
4080
4905
  var LEAN_CORE_INSTRUCTIONS = `
4081
4906
  ## Core Instructions
@@ -4651,6 +5476,7 @@ Example workflow:
4651
5476
  // src/generators/index.ts
4652
5477
  function generateAllBuilderSkills() {
4653
5478
  return [
5479
+ generateOrbSkill(),
4654
5480
  generateKflowOrbitalsSkill(),
4655
5481
  generateKflowOrbitalFixingSkill(),
4656
5482
  {
@@ -5306,6 +6132,6 @@ function generateComparisonMatrix(comparisons) {
5306
6132
  return markdown;
5307
6133
  }
5308
6134
 
5309
- export { EVAL_CASES, analyzeComposition, calculateTotalScore, formatFrontmatter, generateAllBuilderSkills, generateAlmadarAssistantSkill, generateComparisonMatrix, generateDomainLanguageSkill, generateKflowOrbitalFixingSkill, generateKflowOrbitalsSkill, generateLeanFixingSkill2 as generateLeanFixingSkill, generateLeanFixingSkill as generateLeanFixingSkillFull, generateLeanOrbitalSkill2 as generateLeanOrbitalSkill, generateLeanOrbitalSkill as generateLeanOrbitalSkillFull, getArchitectureSection, getAssetRefSection, getBannedProps, getBindingContextRules, getBindingsCompact, getBindingsGuide, getCommonErrorsSection, getCommonFixPatternsSection, getCompletionRulesSection, getConnectivityCompact, getContextUsageCompact, getContextUsageSection, getCustomTraitCompact, getCustomTraitSection, getDecompositionChecklist, getDecompositionCompact, getDecompositionSection, getDesignErrorsCompact, getDesignErrorsSection, getEfficiencySection, getFieldTypesCompact, getFixingWorkflowSection, getFlowPatternSection, getFullOrbitalPrompt, getGameAsOrbitalsSection, getGameEntityTemplatesSection, getGamePatternsSection, getGameTraitsSection, getGameTypesSection, getIconLibraryCompact, getIconLibrarySection, getKeyBehaviorsReference2 as getKeyBehaviorsReference, getMinimalTypeReference, getMultiFileSection, getOrbitalConnectivitySection, getOrbitalDecompositionPrompt, getOverGenerationSection, getPatternTypesCompact, getPortableOrbitalOutputSection, getRenderUIDesignGuide, getRenderUIQuickRef2 as getRenderUIQuickRef, getRequirementsDecomposePrompt, getRequirementsTraitPrompt, getSExprQuickRef2 as getSExprQuickRef, getSchemaUpdateCompact, getSchemaUpdateSection, getSubagentSystemPrompt, getThemeGuide, getUsesImportCompact, getUsesImportSection, getValidationHintsSection, writeAllSkills, writeSkill };
6135
+ export { EVAL_CASES, analyzeComposition, calculateTotalScore, formatFrontmatter, generateAllBuilderSkills, generateAlmadarAssistantSkill, generateComparisonMatrix, generateDomainLanguageSkill, generateKflowOrbitalFixingSkill, generateKflowOrbitalsSkill, generateLeanFixingSkill2 as generateLeanFixingSkill, generateLeanFixingSkill as generateLeanFixingSkillFull, generateLeanOrbitalSkill2 as generateLeanOrbitalSkill, generateLeanOrbitalSkill as generateLeanOrbitalSkillFull, generateOrbSkill, getArchitectureSection, getAssetRefSection, getBannedProps, getBindingContextRules, getBindingsCompact, getBindingsGuide, getCommonErrorsSection, getCommonFixPatternsSection, getCompletionRulesSection, getConnectivityCompact, getContextUsageCompact, getContextUsageSection, getCustomTraitCompact, getCustomTraitSection, getDecompositionChecklist, getDecompositionCompact, getDecompositionSection, getDesignErrorsCompact, getDesignErrorsSection, getEfficiencySection, getFieldTypesCompact, getFixingWorkflowSection, getFlowPatternSection, getFullOrbitalPrompt, getGameAsOrbitalsSection, getGameEntityTemplatesSection, getGamePatternsSection, getGameTraitsSection, getGameTypesSection, getIconLibraryCompact, getIconLibrarySection, getKeyBehaviorsReference2 as getKeyBehaviorsReference, getMinimalTypeReference, getMultiFileSection, getOrbRenderUIGuide, getOrbitalConnectivitySection, getOrbitalDecompositionPrompt, getOverGenerationSection, getPatternTypesCompact, getPortableOrbitalOutputSection, getRenderUIDesignGuide, getRenderUIQuickRef2 as getRenderUIQuickRef, getRequirementsDecomposePrompt, getRequirementsTraitPrompt, getSExprQuickRef2 as getSExprQuickRef, getSchemaUpdateCompact, getSchemaUpdateSection, getSubagentSystemPrompt, getThemeGuide, getUsesImportCompact, getUsesImportSection, getValidationHintsSection, writeAllSkills, writeSkill };
5310
6136
  //# sourceMappingURL=index.js.map
5311
6137
  //# sourceMappingURL=index.js.map