@rafinery/cli 0.8.16 → 0.10.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/CHANGELOG.md +81 -0
- package/bin/rafa.mjs +11 -0
- package/blueprint/.claude/agents/atlas.md +21 -3
- package/blueprint/.claude/agents/bloom.md +2 -2
- package/blueprint/.claude/agents/prism.md +42 -3
- package/blueprint/.claude/agents/sage.md +1 -1
- package/blueprint/.claude/commands/rafa.md +24 -13
- package/blueprint/.claude/rafa/contract.md +6 -0
- package/blueprint/.claude/rafa/hooks/brain-commit.mjs +4 -0
- package/blueprint/.claude/rafa/hooks/session-start.mjs +66 -0
- package/blueprint/.claude/skills/rafa-build/SKILL.md +111 -20
- package/blueprint/.claude/skills/rafa-improve/SKILL.md +22 -0
- package/blueprint/.claude/skills/rafa-leverage/SKILL.md +6 -1
- package/blueprint/.claude/skills/rafa-plan/SKILL.md +36 -1
- package/blueprint/.claude/skills/rafa-review/SKILL.md +16 -2
- package/blueprint/.claude/skills/rafa-sage/SKILL.md +8 -2
- package/blueprint/.claude/skills/rafa-scan/SKILL.md +4 -1
- package/lib/brain-repo.mjs +1 -1
- package/lib/checkpoint.mjs +12 -10
- package/lib/distiller/doctrine.mjs +5 -16
- package/lib/doctor.mjs +19 -1
- package/lib/facts.mjs +130 -0
- package/lib/gate/compile.mjs +12 -0
- package/lib/gate/verify-citations.mjs +78 -1
- package/lib/hydrate.mjs +45 -0
- package/lib/init.mjs +9 -1
- package/lib/leverage/engine.mjs +32 -3
- package/lib/leverage.mjs +11 -2
- package/lib/loop-cache.mjs +67 -0
- package/lib/mcp-client.mjs +12 -0
- package/lib/push.mjs +9 -1
- package/lib/reflex.mjs +5 -1
- package/lib/releases.mjs +51 -0
- package/lib/review.mjs +32 -6
- package/lib/session-facts.mjs +108 -0
- package/lib/skill-deps.mjs +377 -0
- package/lib/update.mjs +9 -0
- package/package.json +3 -2
- package/skills-bundle/frontend-design/LICENSE.txt +177 -0
- package/skills-bundle/frontend-design/SKILL.md +55 -0
- package/{LICENSE → skills-bundle/grill-me/LICENSE} +6 -6
- package/skills-bundle/grill-me/SKILL.md +7 -0
- package/skills-bundle/grill-me/agents/openai.yaml +5 -0
- package/skills-bundle/grilling/SKILL.md +53 -0
- package/skills-bundle/improve-codebase-architecture/HTML-REPORT.md +123 -0
- package/skills-bundle/improve-codebase-architecture/LICENSE +21 -0
- package/skills-bundle/improve-codebase-architecture/SKILL.md +71 -0
- package/skills-bundle/improve-codebase-architecture/agents/openai.yaml +5 -0
- package/skills-bundle/requesting-code-review/LICENSE +21 -0
- package/skills-bundle/requesting-code-review/SKILL.md +95 -0
- package/skills-bundle/requesting-code-review/code-reviewer.md +172 -0
- package/skills-bundle/skills-manifest.json +72 -0
- package/skills-bundle/tdd/LICENSE +21 -0
- package/skills-bundle/tdd/SKILL.md +36 -0
- package/skills-bundle/tdd/agents/openai.yaml +3 -0
- package/skills-bundle/tdd/mocking.md +59 -0
- package/skills-bundle/tdd/tests.md +77 -0
- package/skills-bundle/vercel-composition-patterns/AGENTS.md +946 -0
- package/skills-bundle/vercel-composition-patterns/README.md +60 -0
- package/skills-bundle/vercel-composition-patterns/SKILL.md +89 -0
- package/skills-bundle/vercel-composition-patterns/metadata.json +11 -0
- package/skills-bundle/vercel-composition-patterns/rules/_sections.md +29 -0
- package/skills-bundle/vercel-composition-patterns/rules/_template.md +24 -0
- package/skills-bundle/vercel-composition-patterns/rules/architecture-avoid-boolean-props.md +100 -0
- package/skills-bundle/vercel-composition-patterns/rules/architecture-compound-components.md +112 -0
- package/skills-bundle/vercel-composition-patterns/rules/patterns-children-over-render-props.md +87 -0
- package/skills-bundle/vercel-composition-patterns/rules/patterns-explicit-variants.md +100 -0
- package/skills-bundle/vercel-composition-patterns/rules/react19-no-forwardref.md +42 -0
- package/skills-bundle/vercel-composition-patterns/rules/state-context-interface.md +191 -0
- package/skills-bundle/vercel-composition-patterns/rules/state-decouple-implementation.md +113 -0
- package/skills-bundle/vercel-composition-patterns/rules/state-lift-state.md +125 -0
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
// Skill dependencies (wave 6 — the capability arc).
|
|
2
|
+
//
|
|
3
|
+
// rafa's agents lean on a small set of third-party skills (TDD, design method,
|
|
4
|
+
// composition rules, review taxonomy, the grilling interview). They are NOT
|
|
5
|
+
// baked into the blueprint: the dev owns their toolbox, so the CLI DECLARES
|
|
6
|
+
// them here and `rafa update`/`init` offers them ONCE with per-skill reasons —
|
|
7
|
+
// package-manager style: consent → sequential install with progress → verify
|
|
8
|
+
// (frontmatter parses · hashes match · licenses present) → stamp. A decline is
|
|
9
|
+
// remembered (`rafa.json → rafa.skills.declined`; re-offer with `rafa update
|
|
10
|
+
// --skills`), `--yes` installs unprompted (CI), and a verify failure removes
|
|
11
|
+
// the partial dir and NEVER blocks provisioning — a missing capability
|
|
12
|
+
// degrades the SOPs gracefully, it never bricks a repo.
|
|
13
|
+
//
|
|
14
|
+
// The skills ship inside the npm tarball (skills-bundle/, hashed at prepack —
|
|
15
|
+
// deterministic, offline, license-complete). Install target: .agents/skills/
|
|
16
|
+
// (committed — the repo owns the copies; the harness-neutral home, Codex
|
|
17
|
+
// manifests ride along). Agent adoption is the point: the conductor's toolbox
|
|
18
|
+
// slice + the rafa-* SOPs reference these BY CAPABILITY with when-installed
|
|
19
|
+
// semantics — agent-card duty paths NEVER point here (F1: a declined skill
|
|
20
|
+
// must never break a consumer's compile gate).
|
|
21
|
+
|
|
22
|
+
import { createHash } from "node:crypto";
|
|
23
|
+
import {
|
|
24
|
+
cpSync,
|
|
25
|
+
existsSync,
|
|
26
|
+
mkdirSync,
|
|
27
|
+
readFileSync,
|
|
28
|
+
readdirSync,
|
|
29
|
+
rmSync,
|
|
30
|
+
statSync,
|
|
31
|
+
} from "node:fs";
|
|
32
|
+
import { dirname, join } from "node:path";
|
|
33
|
+
import { fileURLToPath } from "node:url";
|
|
34
|
+
import { readStamp, writeStamp } from "./stamp.mjs";
|
|
35
|
+
import { isInteractive, ask } from "./prompt.mjs";
|
|
36
|
+
|
|
37
|
+
const HERE = dirname(fileURLToPath(import.meta.url)); // …/packages/cli/lib
|
|
38
|
+
|
|
39
|
+
// The declared dependencies. `version` is rafa's pin for the vendored snapshot;
|
|
40
|
+
// `source`/`upstreamHash` mirror skills-lock.json provenance at authoring time;
|
|
41
|
+
// `why` is the one-line reason shown in the consent prompt; `licenseFile` names
|
|
42
|
+
// the in-dir license the verify pass requires (null = license carried in
|
|
43
|
+
// frontmatter/metadata, or rafa-authored).
|
|
44
|
+
export const SKILL_DEPS = [
|
|
45
|
+
{
|
|
46
|
+
name: "tdd",
|
|
47
|
+
version: "1.0.0",
|
|
48
|
+
source: "mattpocock/skills",
|
|
49
|
+
upstreamHash: "81eca2a5b53a",
|
|
50
|
+
targetDir: ".agents/skills/tdd",
|
|
51
|
+
license: "MIT",
|
|
52
|
+
licenseFile: "LICENSE",
|
|
53
|
+
why: "atlas builds test-first — the Done-check becomes an executable test (red → green)",
|
|
54
|
+
requiredBy: "atlas · rafa-build",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "frontend-design",
|
|
58
|
+
version: "1.0.0",
|
|
59
|
+
source: "anthropics/skills",
|
|
60
|
+
upstreamHash: "4eabc6618376",
|
|
61
|
+
targetDir: ".agents/skills/frontend-design",
|
|
62
|
+
license: "Apache-2.0",
|
|
63
|
+
licenseFile: "LICENSE.txt",
|
|
64
|
+
why: "UI tasks get a design method (token system · signature element) instead of template defaults",
|
|
65
|
+
requiredBy: "atlas · rafa-build",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: "vercel-composition-patterns",
|
|
69
|
+
version: "1.0.0",
|
|
70
|
+
source: "vercel-labs/agent-skills",
|
|
71
|
+
upstreamHash: "575757e3e257",
|
|
72
|
+
targetDir: ".agents/skills/vercel-composition-patterns",
|
|
73
|
+
license: "MIT",
|
|
74
|
+
licenseFile: null, // license declared in SKILL.md frontmatter + metadata.json
|
|
75
|
+
why: "React composition rules for component tasks (no boolean-prop sprawl · compound components · React 19)",
|
|
76
|
+
requiredBy: "atlas · rafa-build",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: "requesting-code-review",
|
|
80
|
+
version: "1.0.0",
|
|
81
|
+
source: "obra/superpowers",
|
|
82
|
+
upstreamHash: "2304d2073c62",
|
|
83
|
+
targetDir: ".agents/skills/requesting-code-review",
|
|
84
|
+
license: "MIT",
|
|
85
|
+
licenseFile: "LICENSE",
|
|
86
|
+
why: "review findings get Critical/Important/Minor severity — Minor never blocks",
|
|
87
|
+
requiredBy: "prism · rafa-review",
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: "improve-codebase-architecture",
|
|
91
|
+
version: "1.0.0",
|
|
92
|
+
source: "mattpocock/skills",
|
|
93
|
+
upstreamHash: "66e8a50c83c3",
|
|
94
|
+
targetDir: ".agents/skills/improve-codebase-architecture",
|
|
95
|
+
license: "MIT",
|
|
96
|
+
licenseFile: "LICENSE",
|
|
97
|
+
why: "bloom's architecture lens gets a real method (deletion test · deep/shallow modules)",
|
|
98
|
+
requiredBy: "bloom · rafa-improve",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: "grill-me",
|
|
102
|
+
version: "1.0.0",
|
|
103
|
+
source: "mattpocock/skills",
|
|
104
|
+
upstreamHash: "f361db4e15e6",
|
|
105
|
+
targetDir: ".agents/skills/grill-me",
|
|
106
|
+
license: "MIT",
|
|
107
|
+
licenseFile: "LICENSE",
|
|
108
|
+
why: "/grill-me — adversarial interview of any plan (human-invoked)",
|
|
109
|
+
requiredBy: "dev · prism plan-gate",
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: "grilling",
|
|
113
|
+
version: "1.0.0",
|
|
114
|
+
source: "rafinery",
|
|
115
|
+
upstreamHash: null,
|
|
116
|
+
targetDir: ".agents/skills/grilling",
|
|
117
|
+
license: "rafinery (ships with the CLI)",
|
|
118
|
+
licenseFile: null,
|
|
119
|
+
why: "the interview procedure grill-me and the plan gate run (one probe at a time · survives-three ends it)",
|
|
120
|
+
requiredBy: "grill-me · prism plan-gate",
|
|
121
|
+
},
|
|
122
|
+
];
|
|
123
|
+
|
|
124
|
+
// ── bundle resolution (mirrors blueprintSource: bundled copy first, monorepo dev fallback) ──
|
|
125
|
+
|
|
126
|
+
const walkFiles = (dir, base = dir) =>
|
|
127
|
+
readdirSync(dir).flatMap((e) => {
|
|
128
|
+
const p = join(dir, e);
|
|
129
|
+
if (statSync(p).isDirectory()) return walkFiles(p, base);
|
|
130
|
+
return [p.slice(base.length + 1)];
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
export const hashFile = (abs) =>
|
|
134
|
+
createHash("sha256").update(readFileSync(abs)).digest("hex");
|
|
135
|
+
|
|
136
|
+
// {dir, manifest: {skills: {name: {version, files: {rel: sha256}}}}} or null.
|
|
137
|
+
export function loadSkillsBundle() {
|
|
138
|
+
const bundled = join(HERE, "..", "skills-bundle");
|
|
139
|
+
if (existsSync(join(bundled, "skills-manifest.json"))) {
|
|
140
|
+
try {
|
|
141
|
+
return {
|
|
142
|
+
dir: bundled,
|
|
143
|
+
manifest: JSON.parse(readFileSync(join(bundled, "skills-manifest.json"), "utf8")),
|
|
144
|
+
};
|
|
145
|
+
} catch {
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
// Dev fallback: the monorepo's .agents/skills IS the source — manifest computed live.
|
|
150
|
+
const dev = join(HERE, "..", "..", "..", ".agents", "skills");
|
|
151
|
+
if (!existsSync(dev)) return null;
|
|
152
|
+
const skills = {};
|
|
153
|
+
for (const d of SKILL_DEPS) {
|
|
154
|
+
const src = join(dev, d.name);
|
|
155
|
+
if (!existsSync(src)) continue;
|
|
156
|
+
skills[d.name] = {
|
|
157
|
+
version: d.version,
|
|
158
|
+
files: Object.fromEntries(walkFiles(src).map((rel) => [rel, hashFile(join(src, rel))])),
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
return { dir: dev, manifest: { skills } };
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// ── stamp helpers ──────────────────────────────────────────────────────────────
|
|
165
|
+
|
|
166
|
+
export function skillsStamp(cwd) {
|
|
167
|
+
const s = readStamp(cwd).rafa?.skills ?? {};
|
|
168
|
+
return { installed: s.installed ?? {}, declined: s.declined ?? [] };
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function writeSkillsStamp(cwd, { installed, declined }) {
|
|
172
|
+
writeStamp(cwd, { rafa: { skills: { installed, declined } } });
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export function neededSkills(cwd, { reoffer = false } = {}) {
|
|
176
|
+
const { installed, declined } = skillsStamp(cwd);
|
|
177
|
+
const declinedSet = new Set(declined);
|
|
178
|
+
return SKILL_DEPS.filter(
|
|
179
|
+
(d) => installed[d.name] === undefined && (reoffer || !declinedSet.has(d.name)),
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// ── verify (also the doctor's capabilities check) ─────────────────────────────
|
|
184
|
+
|
|
185
|
+
// Lenient head-parse for FOREIGN skill files: third-party SKILL.md frontmatter
|
|
186
|
+
// is general YAML (folded scalars, nested maps) that the strict OKF grammar
|
|
187
|
+
// rightly rejects — these are Claude skills, not OKF concepts. Verify only what
|
|
188
|
+
// a skill needs to be loadable: a fenced frontmatter block carrying `name:`.
|
|
189
|
+
export function skillHead(abs) {
|
|
190
|
+
let text;
|
|
191
|
+
try {
|
|
192
|
+
text = readFileSync(abs, "utf8");
|
|
193
|
+
} catch {
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
if (!text.startsWith("---")) return null;
|
|
197
|
+
const end = text.indexOf("\n---", 3);
|
|
198
|
+
if (end === -1) return null;
|
|
199
|
+
const fm = text.slice(3, end);
|
|
200
|
+
const name = fm.match(/^name:\s*(.+)$/m)?.[1]?.trim();
|
|
201
|
+
const description = fm.match(/^description:\s*(.+)$/m)?.[1]?.trim() ?? "";
|
|
202
|
+
return name ? { name, description } : null;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// The harness-neutral third-party toolbox inventory: every .agents/skills/<name>
|
|
206
|
+
// with a loadable SKILL.md, as {name, description}. `.agents/` is the
|
|
207
|
+
// cross-harness home (Claude Code · Codex · Cursor — the vendored skills ship
|
|
208
|
+
// Codex `agents/openai.yaml` manifests alongside SKILL.md), so this reader
|
|
209
|
+
// lives HERE, not inside any one toolchain adapter; the leverage engine's
|
|
210
|
+
// repoContext, the conductor's spawn-prompt slice, and the scan's toolbox
|
|
211
|
+
// domain all consume this one implementation.
|
|
212
|
+
export function listAgentSkills(cwd) {
|
|
213
|
+
const root = join(cwd, ".agents", "skills");
|
|
214
|
+
if (!existsSync(root)) return [];
|
|
215
|
+
return readdirSync(root)
|
|
216
|
+
.filter((e) => {
|
|
217
|
+
try {
|
|
218
|
+
return statSync(join(root, e)).isDirectory();
|
|
219
|
+
} catch {
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
})
|
|
223
|
+
.map((e) => {
|
|
224
|
+
const head = skillHead(join(root, e, "SKILL.md"));
|
|
225
|
+
return head ? { name: head.name, description: head.description } : null;
|
|
226
|
+
})
|
|
227
|
+
.filter(Boolean);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function verifySkill(cwd, dep, bundleManifest) {
|
|
231
|
+
const dst = join(cwd, dep.targetDir);
|
|
232
|
+
if (!existsSync(join(dst, "SKILL.md"))) return { ok: false, reason: "SKILL.md missing" };
|
|
233
|
+
const head = skillHead(join(dst, "SKILL.md"));
|
|
234
|
+
if (!head) return { ok: false, reason: "SKILL.md frontmatter does not parse (no fenced name:)" };
|
|
235
|
+
if (dep.licenseFile && !existsSync(join(dst, dep.licenseFile)))
|
|
236
|
+
return { ok: false, reason: `license file ${dep.licenseFile} missing` };
|
|
237
|
+
const expect = bundleManifest?.skills?.[dep.name]?.files;
|
|
238
|
+
if (expect) {
|
|
239
|
+
for (const [rel, sha] of Object.entries(expect)) {
|
|
240
|
+
const abs = join(dst, rel);
|
|
241
|
+
if (!existsSync(abs)) return { ok: false, reason: `${rel} missing` };
|
|
242
|
+
if (hashFile(abs) !== sha) return { ok: false, reason: `${rel} hash mismatch` };
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return { ok: true };
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// Doctor's read: every STAMPED-installed skill re-verified against disk.
|
|
249
|
+
export function verifyInstalled(cwd) {
|
|
250
|
+
const { installed } = skillsStamp(cwd);
|
|
251
|
+
const bundle = loadSkillsBundle();
|
|
252
|
+
const results = [];
|
|
253
|
+
for (const [name] of Object.entries(installed)) {
|
|
254
|
+
const dep = SKILL_DEPS.find((d) => d.name === name);
|
|
255
|
+
if (!dep) {
|
|
256
|
+
results.push({ name, ok: false, reason: "stamped but no longer a declared dependency" });
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
results.push({ name, ...verifySkill(cwd, dep, bundle?.manifest) });
|
|
260
|
+
}
|
|
261
|
+
return results;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// ── the consent-gated installer (owner's design, wave 6) ──────────────────────
|
|
265
|
+
//
|
|
266
|
+
// prompt is injectable for tests: async (question) => "y" | "n" | … | null
|
|
267
|
+
// (null = non-interactive). Returns { installed, declined, failed, skipped }.
|
|
268
|
+
export async function installSkillDeps(cwd, { prompt = null, args = [] } = {}) {
|
|
269
|
+
const reoffer = args.includes("--skills");
|
|
270
|
+
const yes = args.includes("--yes");
|
|
271
|
+
const needed = neededSkills(cwd, { reoffer });
|
|
272
|
+
const result = { installed: [], declined: [], failed: [], skipped: false };
|
|
273
|
+
if (needed.length === 0) return { ...result, skipped: true };
|
|
274
|
+
|
|
275
|
+
const bundle = loadSkillsBundle();
|
|
276
|
+
if (!bundle) {
|
|
277
|
+
console.log(" ! skill dependencies declared but no skills bundle in this CLI build — skipped");
|
|
278
|
+
return { ...result, skipped: true };
|
|
279
|
+
}
|
|
280
|
+
const available = needed.filter((d) => bundle.manifest.skills?.[d.name]);
|
|
281
|
+
if (available.length === 0) return { ...result, skipped: true };
|
|
282
|
+
|
|
283
|
+
console.log(`\nrafa needs ${available.length} skill(s) for better performance in this release:\n`);
|
|
284
|
+
for (const d of available)
|
|
285
|
+
console.log(
|
|
286
|
+
` ${(d.name + " " + d.version).padEnd(38)}${d.why} [${d.license}]`,
|
|
287
|
+
);
|
|
288
|
+
console.log(
|
|
289
|
+
"\n They install to .agents/skills/ (committed — your repo owns the copies)." +
|
|
290
|
+
"\n Decline with n; re-offer any time with `rafa update --skills`.\n",
|
|
291
|
+
);
|
|
292
|
+
|
|
293
|
+
const doAsk = prompt ?? (async (q) => (isInteractive() ? ask(q) : null));
|
|
294
|
+
|
|
295
|
+
let toInstall = [];
|
|
296
|
+
const newlyDeclined = [];
|
|
297
|
+
if (yes) {
|
|
298
|
+
toInstall = available;
|
|
299
|
+
} else if (reoffer) {
|
|
300
|
+
// Per-skill grammar (the makeConflictResolver interaction): y/N/a/q.
|
|
301
|
+
let all = false;
|
|
302
|
+
let quit = false;
|
|
303
|
+
for (const d of available) {
|
|
304
|
+
if (all) {
|
|
305
|
+
toInstall.push(d);
|
|
306
|
+
continue;
|
|
307
|
+
}
|
|
308
|
+
if (quit) {
|
|
309
|
+
newlyDeclined.push(d.name);
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
const a = await doAsk(` • install ${d.name} ${d.version}? [y = yes · N = no · a = all · q = none] `);
|
|
313
|
+
if (a === null) return { ...result, skipped: true }; // non-TTY: record NOTHING
|
|
314
|
+
if (a === "a") {
|
|
315
|
+
all = true;
|
|
316
|
+
toInstall.push(d);
|
|
317
|
+
} else if (a === "q") {
|
|
318
|
+
quit = true;
|
|
319
|
+
newlyDeclined.push(d.name);
|
|
320
|
+
} else if (a === "y" || a === "yes") toInstall.push(d);
|
|
321
|
+
else newlyDeclined.push(d.name);
|
|
322
|
+
}
|
|
323
|
+
} else {
|
|
324
|
+
const a = await doAsk(` Install all ${available.length}? [Y/n] `);
|
|
325
|
+
if (a === null) {
|
|
326
|
+
// Non-TTY without --yes: skip, stamp NOTHING — a human must decide;
|
|
327
|
+
// CI silently declining for them would be an assumed value.
|
|
328
|
+
console.log(" · non-interactive — skipped (install later: `rafa update --skills`, or pass --yes)");
|
|
329
|
+
return { ...result, skipped: true };
|
|
330
|
+
}
|
|
331
|
+
if (a === "" || a === "y" || a === "yes") toInstall = available;
|
|
332
|
+
else newlyDeclined.push(...available.map((d) => d.name));
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
for (const d of toInstall) {
|
|
336
|
+
const src = join(bundle.dir, d.name);
|
|
337
|
+
const dst = join(cwd, d.targetDir);
|
|
338
|
+
try {
|
|
339
|
+
mkdirSync(dirname(dst), { recursive: true });
|
|
340
|
+
cpSync(src, dst, { recursive: true });
|
|
341
|
+
const v = verifySkill(cwd, d, bundle.manifest);
|
|
342
|
+
if (!v.ok) {
|
|
343
|
+
rmSync(dst, { recursive: true, force: true });
|
|
344
|
+
console.log(` ✗ ${d.name} ${d.version} — verify failed (${v.reason}); not installed`);
|
|
345
|
+
result.failed.push({ name: d.name, reason: v.reason });
|
|
346
|
+
continue;
|
|
347
|
+
}
|
|
348
|
+
console.log(` ✓ ${d.name} ${d.version} — installed (${d.targetDir})`);
|
|
349
|
+
result.installed.push(d.name);
|
|
350
|
+
} catch (e) {
|
|
351
|
+
rmSync(dst, { recursive: true, force: true });
|
|
352
|
+
const reason = e instanceof Error ? e.message : String(e);
|
|
353
|
+
console.log(` ✗ ${d.name} ${d.version} — install failed (${reason}); not installed`);
|
|
354
|
+
result.failed.push({ name: d.name, reason });
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// Stamp: installed adds; declined = explicit human "no" only, deduped.
|
|
359
|
+
const cur = skillsStamp(cwd);
|
|
360
|
+
const installed = { ...cur.installed };
|
|
361
|
+
for (const n of result.installed) {
|
|
362
|
+
const dep = SKILL_DEPS.find((d) => d.name === n);
|
|
363
|
+
installed[n] = dep.version;
|
|
364
|
+
}
|
|
365
|
+
const declined = [...new Set([...cur.declined.filter((n) => !result.installed.includes(n)), ...newlyDeclined])];
|
|
366
|
+
writeSkillsStamp(cwd, { installed, declined });
|
|
367
|
+
result.declined = newlyDeclined;
|
|
368
|
+
|
|
369
|
+
if (result.installed.length)
|
|
370
|
+
console.log(
|
|
371
|
+
` ✓ verified ${result.installed.length}/${toInstall.length} (frontmatter parses · hashes match · licenses present)` +
|
|
372
|
+
`\n → commit .agents/skills/ — the repo owns its toolbox`,
|
|
373
|
+
);
|
|
374
|
+
if (newlyDeclined.length)
|
|
375
|
+
console.log(` · declined ${newlyDeclined.length} — remembered; agents fall back per SOP (re-offer: rafa update --skills)`);
|
|
376
|
+
return result;
|
|
377
|
+
}
|
package/lib/update.mjs
CHANGED
|
@@ -26,6 +26,15 @@ export default async function update(args = []) {
|
|
|
26
26
|
|
|
27
27
|
await notifyIfBehind();
|
|
28
28
|
|
|
29
|
+
// Wave 6 — skill dependencies FIRST (owner: consent → install one-by-one →
|
|
30
|
+
// verify → then the rest of the update proceeds). Declined is remembered;
|
|
31
|
+
// `--skills` re-offers, `--yes` installs unprompted (CI). A failure never
|
|
32
|
+
// blocks the update — agents degrade per SOP.
|
|
33
|
+
{
|
|
34
|
+
const { installSkillDeps } = await import("./skill-deps.mjs");
|
|
35
|
+
await installSkillDeps(TARGET, { args });
|
|
36
|
+
}
|
|
37
|
+
|
|
29
38
|
console.log("rafa update — syncing the blueprint (non-destructive)");
|
|
30
39
|
reportBlueprint(
|
|
31
40
|
await copyBlueprint(blueprintSource(), TARGET, { onConflict: makeConflictResolver(args) }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rafinery/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "rafa — the AI engineer CLI. Vendors the rafa blueprint into your repo (shadcn-style) and runs the deterministic contract gates.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"bin",
|
|
12
12
|
"lib",
|
|
13
13
|
"blueprint",
|
|
14
|
-
"CHANGELOG.md"
|
|
14
|
+
"CHANGELOG.md",
|
|
15
|
+
"skills-bundle"
|
|
15
16
|
],
|
|
16
17
|
"engines": {
|
|
17
18
|
"node": ">=18"
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: frontend-design
|
|
3
|
+
description: Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.
|
|
4
|
+
license: Complete terms in LICENSE.txt
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Frontend Design
|
|
8
|
+
|
|
9
|
+
Approach this as the design lead at a small studio known for giving every client a visual identity that could not be mistaken for anyone else's. This client has already rejected proposals that felt templated, and is paying for a distinctive point of view: make deliberate, opinionated choices about palette, typography, and layout that are specific to this brief, and take one real aesthetic risk you can justify.
|
|
10
|
+
|
|
11
|
+
## Ground it in the subject
|
|
12
|
+
|
|
13
|
+
If the brief does not pin down what the product or subject is, pin it yourself before designing: name one concrete subject, its audience, and the page's single job, and state your choice. If there's any information in your memory about the human's preferences, context about what they're building, or designs you've made before – use that as a hint. The subject's own world, its materials, instruments, artifacts, and vernacular, is where distinctive choices come from. Build with the brief's real content and subject matter throughout.
|
|
14
|
+
|
|
15
|
+
## Design principles
|
|
16
|
+
|
|
17
|
+
For web designs, the hero is a thesis. Open with the most characteristic thing in the subject's world, in whatever form makes sense for it: a headline, an image, an animation, a live demo, an interactive moment. Be deliberate with your choice: a big number with a small label, supporting stats, and a gradient accent is the template answer, only use if that's truly the best option.
|
|
18
|
+
|
|
19
|
+
Typography carries the personality of the page. Pair the display and body faces deliberately, not the same families you would reach for on any other project, and set a clear type scale with intentional weights, widths, and spacing. Make the type treatment itself a memorable part of the design, not a neutral delivery vehicle for the content.
|
|
20
|
+
|
|
21
|
+
Structure is information. Structural devices, numbering, eyebrows, dividers, labels, should encode something true about the content, not decorate it. Many generic designs use numbered markers (01 / 02 / 03), but that's only appropriate if the content actually is a sequence - like a real process or a typed timeline where order carries information the reader needs. Question if choices like numbered markers actually make sense before incorporating them.
|
|
22
|
+
|
|
23
|
+
Leverage motion deliberately. Think about where and if animation can serve the subject: a page-load sequence, a scroll-triggered reveal, hover micro-interactions, ambient atmosphere. An orchestrated moment usually lands harder than scattered effects; choose what the direction calls for. However, sometimes less is more, and extra animation contributes to the feeling that the design is AI-generated.
|
|
24
|
+
|
|
25
|
+
Match complexity to the vision. Maximalist directions need elaborate execution; minimal directions need precision in spacing, type, and detail. Elegance is executing the chosen vision well.
|
|
26
|
+
|
|
27
|
+
Consider written content carefully. Often a design brief may not contain real content, and it's up to you to come up with copy. Copy can make a design feel as templated as the design itself. See the below section on writing for more guidance.
|
|
28
|
+
|
|
29
|
+
## Process: brainstorm, explore, plan, critique, build, critique again
|
|
30
|
+
|
|
31
|
+
For calibration: AI-generated design right now clusters around three looks: (1) a warm cream background (near #F4F1EA) with a high-contrast serif display and a terracotta accent; (2) a near-black background with a single bright acid-green or vermilion accent; (3) a broadsheet-style layout with hairline rules, zero border-radius, and dense newspaper-like columns. All three are legitimate for some briefs, but they are defaults rather than choices, and they appear regardless of subject. Where the brief pins down a visual direction, follow it exactly — the brief's own words always win, including when it asks for one of these looks. Where it leaves an axis free, don't spend that freedom on one of these defaults. Just like a human designer who's hired, there's often a careful balance between doing what you're good at and taking each project as a chance to experiment and learn.
|
|
32
|
+
|
|
33
|
+
Work in two passes. First, brainstorm a short design plan based on the human's design brief: create a compact token system with color, type, layout, and signature. Color: describe the palette as 4–6 named hex values. Type: the typefaces for 2+ roles (a characterful display face that's used with restraint, a complementary body face, and a utility face for captions or data if needed). Layout: a layout concept, using one-sentence prose descriptions and ASCII wireframes to ideate and compare. Signature: the single unique element this page will be remembered by that embodies the brief in an appropriate way.
|
|
34
|
+
|
|
35
|
+
Then review that plan against the brief before building: if any part of it reads like the generic default you would produce for any similar page (work through a similar prompt to see if you arrive somewhere similar) rather than a choice made for this specific brief — revise that part, say what you changed and why. Only after you've confirmed the relative uniqueness of your design plan should you start to write the code, following the revised plan exactly and deriving every color and type decision from it.
|
|
36
|
+
|
|
37
|
+
When writing the code, be careful of structuring your CSS selector specificities. It's easy to generate CSS classes that cancel each other out (especially with a type-based selector like .section and a element-based selector like .cta). This can happen often with paddings/margins between sections.
|
|
38
|
+
|
|
39
|
+
Try to do a lot of this planning and iteration in your thinking, and only show ideas to the user when you have higher confidence it'll delight them.
|
|
40
|
+
|
|
41
|
+
## Restraint and self-critique
|
|
42
|
+
|
|
43
|
+
Spend your boldness in one place. Let the signature element be the one memorable thing, keep everything around it quiet and disciplined, and cut any decoration that does not serve the brief. Not taking a risk can be a risk itself! Build to a quality floor without announcing it: responsive down to mobile, visible keyboard focus, reduced motion respected. Critique your own work as you build, taking screenshots if your environment supports it – a picture is worth 1000 tokens. Consider Chanel's advice: before leaving the house, take a look in the mirror and remove one accessory. Human creators have memory and always try to do something new, so if you have a space to quickly jot down notes about what you've tried, it can help you in future passes.
|
|
44
|
+
|
|
45
|
+
## More on writing in design
|
|
46
|
+
|
|
47
|
+
Words appear in a design for one reason: to make it easier to understand, and therefore easier to use. They are design material, not decoration. Bring the same intentionality to copy that you would bring to spacing and color. Before writing anything, ask what the design needs to say, and how it can best be said to help the person navigate the experience.
|
|
48
|
+
|
|
49
|
+
Write from the end user's side of the screen. Name things by what people control and recognize, never by how the system is built. A person manages notifications, not webhook config. Describe what something does in plain terms rather than selling it. Being specific is always better than being clever.
|
|
50
|
+
|
|
51
|
+
Use active voice as default. A control should say exactly what happens when it's used: "Save changes," not "Submit." An action keeps the same name through the whole flow, so the button that says "Publish" produces a toast that says "Published." The vocabulary of an interface is the signposting for someone navigating the product. Cohesion and consistency are how people learn their way around.
|
|
52
|
+
|
|
53
|
+
Treat failure and emptiness as moments for direction, not mood. Explain what went wrong and how to fix it, in the interface's voice rather than a person's. Errors don't apologize, and they are never vague about what happened. An empty screen is an invitation to act.
|
|
54
|
+
|
|
55
|
+
Keep the register conversational and tuned: plain verbs, sentence case, no filler, with tone matched to the brand and the audience. Let each element do exactly one job. A label labels, an example demonstrates, and nothing quietly does double duty.
|