rafters 0.0.57 → 0.0.59
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 +49 -8
- package/dist/registry/types.d.ts +33 -1
- package/dist/registry/types.js +14 -1
- package/package.json +1 -1
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(),
|
|
@@ -13377,6 +13389,7 @@ async function installWithPackageManager(packageManager, dependencies, options)
|
|
|
13377
13389
|
}
|
|
13378
13390
|
|
|
13379
13391
|
// src/utils/install-registry-deps.ts
|
|
13392
|
+
var REACT_RUNTIME_PACKAGES = /* @__PURE__ */ new Set(["react", "react-dom", "@types/react", "@types/react-dom"]);
|
|
13380
13393
|
function parseDependency(dep) {
|
|
13381
13394
|
const trimmed = dep.trim();
|
|
13382
13395
|
if (!trimmed) {
|
|
@@ -13427,8 +13440,12 @@ async function installRegistryDependencies(items, targetDir, options = {}) {
|
|
|
13427
13440
|
return result;
|
|
13428
13441
|
}
|
|
13429
13442
|
const externalDeps = [];
|
|
13443
|
+
const dropForTarget = options.target && options.target !== "react";
|
|
13430
13444
|
for (const dep of allDeps) {
|
|
13431
|
-
|
|
13445
|
+
const { name } = parseDependency(dep);
|
|
13446
|
+
if (name.startsWith("@rafters/")) {
|
|
13447
|
+
result.skipped.push(dep);
|
|
13448
|
+
} else if (dropForTarget && REACT_RUNTIME_PACKAGES.has(name)) {
|
|
13432
13449
|
result.skipped.push(dep);
|
|
13433
13450
|
} else {
|
|
13434
13451
|
externalDeps.push(dep);
|
|
@@ -13628,6 +13645,14 @@ function isAlreadyInstalled(config2, item) {
|
|
|
13628
13645
|
}
|
|
13629
13646
|
return config2.installed.primitives.includes(item.name);
|
|
13630
13647
|
}
|
|
13648
|
+
function isInstalledOnDisk(config2, item, cwd) {
|
|
13649
|
+
if (!isAlreadyInstalled(config2, item)) return false;
|
|
13650
|
+
const filesToCheck = item.type === "ui" ? selectFilesForFramework(item.files, getComponentTarget(config2)).files : item.files;
|
|
13651
|
+
for (const file2 of filesToCheck) {
|
|
13652
|
+
if (fileExists(cwd, transformPath(file2.path, config2, cwd))) return true;
|
|
13653
|
+
}
|
|
13654
|
+
return false;
|
|
13655
|
+
}
|
|
13631
13656
|
function trackInstalled(config2, items) {
|
|
13632
13657
|
if (!config2.installed) {
|
|
13633
13658
|
config2.installed = { components: [], primitives: [], composites: [], rules: [] };
|
|
@@ -13844,13 +13869,20 @@ async function add(componentArgs, options) {
|
|
|
13844
13869
|
const target = getComponentTarget(config2);
|
|
13845
13870
|
for (const item of allItems) {
|
|
13846
13871
|
if (!options.overwrite && isAlreadyInstalled(config2, item)) {
|
|
13872
|
+
if (isInstalledOnDisk(config2, item, cwd)) {
|
|
13873
|
+
log({
|
|
13874
|
+
event: "add:skip",
|
|
13875
|
+
component: item.name,
|
|
13876
|
+
reason: "already installed"
|
|
13877
|
+
});
|
|
13878
|
+
skipped.push(item.name);
|
|
13879
|
+
continue;
|
|
13880
|
+
}
|
|
13847
13881
|
log({
|
|
13848
|
-
event: "add:
|
|
13882
|
+
event: "add:warning",
|
|
13849
13883
|
component: item.name,
|
|
13850
|
-
|
|
13884
|
+
message: "Config tracks this as installed but no files found on disk -- reinstalling."
|
|
13851
13885
|
});
|
|
13852
|
-
skipped.push(item.name);
|
|
13853
|
-
continue;
|
|
13854
13886
|
}
|
|
13855
13887
|
try {
|
|
13856
13888
|
const result = await installItem(cwd, item, options, config2);
|
|
@@ -13891,7 +13923,7 @@ async function add(componentArgs, options) {
|
|
|
13891
13923
|
};
|
|
13892
13924
|
let depsResult = emptyDeps;
|
|
13893
13925
|
try {
|
|
13894
|
-
depsResult = await installRegistryDependencies(filteredItems, cwd);
|
|
13926
|
+
depsResult = await installRegistryDependencies(filteredItems, cwd, { target });
|
|
13895
13927
|
} catch (err) {
|
|
13896
13928
|
const message = err instanceof Error ? err.message : String(err);
|
|
13897
13929
|
log({
|
|
@@ -30440,7 +30472,16 @@ var RaftersToolHandler = class {
|
|
|
30440
30472
|
type: item.type,
|
|
30441
30473
|
description: item.description,
|
|
30442
30474
|
primitives: item.primitives,
|
|
30443
|
-
rules: item.rules
|
|
30475
|
+
rules: item.rules,
|
|
30476
|
+
composites: item.composites,
|
|
30477
|
+
files: item.files,
|
|
30478
|
+
// The intelligence field carries the WHY of the component:
|
|
30479
|
+
// cognitive load, accessibility, do/never, semantic meaning.
|
|
30480
|
+
// Extracted from JSDoc by the registry generator and present
|
|
30481
|
+
// on every component JSON. Previously stripped by the schema
|
|
30482
|
+
// (not declared) and not referenced by the handler -- the
|
|
30483
|
+
// tool's whole reason for existing went missing somewhere.
|
|
30484
|
+
intelligence: item.intelligence
|
|
30444
30485
|
},
|
|
30445
30486
|
null,
|
|
30446
30487
|
2
|
package/dist/registry/types.d.ts
CHANGED
|
@@ -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 };
|
package/dist/registry/types.js
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "0.0.59",
|
|
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",
|