rafters 0.0.56 → 0.0.58

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/README.md CHANGED
@@ -4,6 +4,10 @@ Design Intelligence CLI. Encodes a designer's judgment into queryable data so AI
4
4
 
5
5
  → [rafters.studio](https://rafters.studio)
6
6
 
7
+ **60+ components across React, Astro, and Web Components.** Triple-target parity from one design system — the same Button, Card, Dialog, Combobox, Editor, etc. as a React component, an Astro component, AND a Web Component element class. Component code is installed into your project via `rafters add` (shadcn-style copy), not imported as a dependency, so you own and can fork what ships.
8
+
9
+ **Composite manifests sit above components.** A composite is a designer-authored JSON manifest that bundles components into reusable patterns (login-form, copy-button, heading, paragraph) with designer intent baked in: `solves`, `appliesWhen`, do/never rules, cognitive load rating, I/O contracts, and a typed block tree. Agents query the composite registry via MCP and assemble pre-made decisions instead of inventing new ones.
10
+
7
11
  ## Quick Start
8
12
 
9
13
  ```bash
@@ -130,13 +134,12 @@ Full intelligence for a specific component: cognitive load, accessibility level,
130
134
 
131
135
  ## Architecture
132
136
 
133
- Three layers:
134
-
135
- - **What (Components)** — React components with embedded intelligence metadata
136
- - **Where (Tokens)** — token dependency graph with human override tracking
137
- - **Why (Decisions)** — composite manifests, do/never patterns, cognitive load scores, trust-building patterns
137
+ Four layers, stacked:
138
138
 
139
- The token system uses OKLCH color space, modular scales based on musical ratios, and a dependency engine that derives related values from primitive bases. Override a base `spacing-base`, `radius-base`, `font-size-base` and dependents recompute. Override a leaf (`primary` color, `spacing-4`) and the override anchors the subtree against future upstream changes.
139
+ - **Tokens** primitive design values (color OKLCH, spacing scale, radius, typography, motion, focus, shadow, depth, elevation, breakpoints). 13 namespaces; dependency graph with human override tracking. Override a base (`spacing-base`, `radius-base`, `font-size-base`) and dependents recompute. Override a leaf and the override anchors the subtree.
140
+ - **Primitives** — 62 framework-agnostic building blocks (clipboard, focus-trap, portal, roving-focus, selection, serializer, slot, token-sheet, typeahead, etc.). Headless behaviors components compose against.
141
+ - **Components** — 60+ React + 71 Astro + 32 Web Component element classes. Triple-target parity. Each component carries embedded intelligence metadata: cognitive load rating, accessibility level, do/never, variant semantics, attention economics. Installed into your project via `rafters add` — you own the code.
142
+ - **Composites** — designer-authored JSON manifests that bundle components into reusable patterns (login-form, copy-button, heading, paragraph, etc.). Each manifest carries `solves`, `appliesWhen`, `usagePatterns` (do/never), `cognitiveLoad`, I/O contracts, and a typed block tree. The composite owns the variant/size decisions — agents render blocks verbatim instead of choosing aesthetics.
140
143
 
141
144
  When a designer overrides a computed value, the system records the reason. Agents read the why before they read the what.
142
145
 
package/dist/index.js CHANGED
@@ -12565,6 +12565,17 @@ var RegistryFileSchema = external_exports.object({
12565
12565
  // e.g., ["vitest"] - from @devDependencies JSDoc
12566
12566
  });
12567
12567
  var RegistryItemTypeSchema = external_exports.enum(["ui", "primitive", "composite"]);
12568
+ var RegistryItemIntelligenceSchema = external_exports.object({
12569
+ cognitiveLoad: external_exports.number().optional(),
12570
+ attentionEconomics: external_exports.string().optional(),
12571
+ trustBuilding: external_exports.string().optional(),
12572
+ accessibility: external_exports.string().optional(),
12573
+ semanticMeaning: external_exports.string().optional(),
12574
+ usagePatterns: external_exports.object({
12575
+ dos: external_exports.array(external_exports.string()).default([]),
12576
+ nevers: external_exports.array(external_exports.string()).default([])
12577
+ }).optional()
12578
+ });
12568
12579
  var RegistryItemSchema = external_exports.object({
12569
12580
  name: external_exports.string(),
12570
12581
  type: RegistryItemTypeSchema,
@@ -12572,7 +12583,8 @@ var RegistryItemSchema = external_exports.object({
12572
12583
  primitives: external_exports.array(external_exports.string()),
12573
12584
  files: external_exports.array(RegistryFileSchema),
12574
12585
  rules: external_exports.array(external_exports.string()).default([]),
12575
- composites: external_exports.array(external_exports.string()).default([])
12586
+ composites: external_exports.array(external_exports.string()).default([]),
12587
+ intelligence: RegistryItemIntelligenceSchema.optional()
12576
12588
  });
12577
12589
  var RegistryIndexSchema = external_exports.object({
12578
12590
  name: external_exports.string(),
@@ -28494,7 +28506,6 @@ function firstFamilyFromStack(value) {
28494
28506
  for (const raw of parts) {
28495
28507
  const stripped = stripQuotes(raw.trim());
28496
28508
  if (stripped === "" || GENERIC_KEYWORDS.has(stripped.toLowerCase())) continue;
28497
- if (stripped.startsWith("var(") || stripped.includes("var(--")) continue;
28498
28509
  return stripped;
28499
28510
  }
28500
28511
  return null;
@@ -30441,7 +30452,16 @@ var RaftersToolHandler = class {
30441
30452
  type: item.type,
30442
30453
  description: item.description,
30443
30454
  primitives: item.primitives,
30444
- rules: item.rules
30455
+ rules: item.rules,
30456
+ composites: item.composites,
30457
+ files: item.files,
30458
+ // The intelligence field carries the WHY of the component:
30459
+ // cognitive load, accessibility, do/never, semantic meaning.
30460
+ // Extracted from JSDoc by the registry generator and present
30461
+ // on every component JSON. Previously stripped by the schema
30462
+ // (not declared) and not referenced by the handler -- the
30463
+ // tool's whole reason for existing went missing somewhere.
30464
+ intelligence: item.intelligence
30445
30465
  },
30446
30466
  null,
30447
30467
  2
@@ -27,6 +27,27 @@ declare const RegistryItemTypeSchema: z.ZodEnum<{
27
27
  composite: "composite";
28
28
  }>;
29
29
  type RegistryItemType = z.infer<typeof RegistryItemTypeSchema>;
30
+ /**
31
+ * Design intelligence carried per-component. The registry generator
32
+ * extracts these from JSDoc tags on the component source (see
33
+ * `@cognitive-load`, `@attention-economics`, `@trust-building`,
34
+ * `@accessibility`, `@semantic-meaning`, `@usage-patterns` in e.g.
35
+ * packages/ui/src/components/ui/button.tsx). Surfacing this is the
36
+ * whole point of rafters -- agents read the encoded judgment instead
37
+ * of guessing at the design surface.
38
+ */
39
+ declare const RegistryItemIntelligenceSchema: z.ZodObject<{
40
+ cognitiveLoad: z.ZodOptional<z.ZodNumber>;
41
+ attentionEconomics: z.ZodOptional<z.ZodString>;
42
+ trustBuilding: z.ZodOptional<z.ZodString>;
43
+ accessibility: z.ZodOptional<z.ZodString>;
44
+ semanticMeaning: z.ZodOptional<z.ZodString>;
45
+ usagePatterns: z.ZodOptional<z.ZodObject<{
46
+ dos: z.ZodDefault<z.ZodArray<z.ZodString>>;
47
+ nevers: z.ZodDefault<z.ZodArray<z.ZodString>>;
48
+ }, z.core.$strip>>;
49
+ }, z.core.$strip>;
50
+ type RegistryItemIntelligence = z.infer<typeof RegistryItemIntelligenceSchema>;
30
51
  /**
31
52
  * A component or primitive in the registry
32
53
  */
@@ -47,6 +68,17 @@ declare const RegistryItemSchema: z.ZodObject<{
47
68
  }, z.core.$strip>>;
48
69
  rules: z.ZodDefault<z.ZodArray<z.ZodString>>;
49
70
  composites: z.ZodDefault<z.ZodArray<z.ZodString>>;
71
+ intelligence: z.ZodOptional<z.ZodObject<{
72
+ cognitiveLoad: z.ZodOptional<z.ZodNumber>;
73
+ attentionEconomics: z.ZodOptional<z.ZodString>;
74
+ trustBuilding: z.ZodOptional<z.ZodString>;
75
+ accessibility: z.ZodOptional<z.ZodString>;
76
+ semanticMeaning: z.ZodOptional<z.ZodString>;
77
+ usagePatterns: z.ZodOptional<z.ZodObject<{
78
+ dos: z.ZodDefault<z.ZodArray<z.ZodString>>;
79
+ nevers: z.ZodDefault<z.ZodArray<z.ZodString>>;
80
+ }, z.core.$strip>>;
81
+ }, z.core.$strip>>;
50
82
  }, z.core.$strip>;
51
83
  type RegistryItem = z.infer<typeof RegistryItemSchema>;
52
84
  /**
@@ -62,4 +94,4 @@ declare const RegistryIndexSchema: z.ZodObject<{
62
94
  }, z.core.$strip>;
63
95
  type RegistryIndex = z.infer<typeof RegistryIndexSchema>;
64
96
 
65
- export { type RegistryFile, RegistryFileSchema, type RegistryIndex, RegistryIndexSchema, type RegistryItem, RegistryItemSchema, type RegistryItemType, RegistryItemTypeSchema };
97
+ export { type RegistryFile, RegistryFileSchema, type RegistryIndex, RegistryIndexSchema, type RegistryItem, type RegistryItemIntelligence, RegistryItemIntelligenceSchema, RegistryItemSchema, type RegistryItemType, RegistryItemTypeSchema };
@@ -9,6 +9,17 @@ var RegistryFileSchema = z.object({
9
9
  // e.g., ["vitest"] - from @devDependencies JSDoc
10
10
  });
11
11
  var RegistryItemTypeSchema = z.enum(["ui", "primitive", "composite"]);
12
+ var RegistryItemIntelligenceSchema = z.object({
13
+ cognitiveLoad: z.number().optional(),
14
+ attentionEconomics: z.string().optional(),
15
+ trustBuilding: z.string().optional(),
16
+ accessibility: z.string().optional(),
17
+ semanticMeaning: z.string().optional(),
18
+ usagePatterns: z.object({
19
+ dos: z.array(z.string()).default([]),
20
+ nevers: z.array(z.string()).default([])
21
+ }).optional()
22
+ });
12
23
  var RegistryItemSchema = z.object({
13
24
  name: z.string(),
14
25
  type: RegistryItemTypeSchema,
@@ -16,7 +27,8 @@ var RegistryItemSchema = z.object({
16
27
  primitives: z.array(z.string()),
17
28
  files: z.array(RegistryFileSchema),
18
29
  rules: z.array(z.string()).default([]),
19
- composites: z.array(z.string()).default([])
30
+ composites: z.array(z.string()).default([]),
31
+ intelligence: RegistryItemIntelligenceSchema.optional()
20
32
  });
21
33
  var RegistryIndexSchema = z.object({
22
34
  name: z.string(),
@@ -29,6 +41,7 @@ var RegistryIndexSchema = z.object({
29
41
  export {
30
42
  RegistryFileSchema,
31
43
  RegistryIndexSchema,
44
+ RegistryItemIntelligenceSchema,
32
45
  RegistryItemSchema,
33
46
  RegistryItemTypeSchema
34
47
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rafters",
3
- "version": "0.0.56",
3
+ "version": "0.0.58",
4
4
  "description": "Design Intelligence CLI. Scaffold tokens, import existing shadcn/Tailwind v4 sources, add components, and serve an MCP server so AI agents read decisions instead of guessing.",
5
5
  "homepage": "https://rafters.studio",
6
6
  "license": "MIT",