@rafinery/cli 0.7.0 → 0.8.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/lib/push.mjs CHANGED
@@ -14,6 +14,7 @@ import { existsSync, readFileSync, writeFileSync } from "node:fs";
14
14
  import { join } from "node:path";
15
15
  import { runCompile } from "./gate/compile.mjs";
16
16
  import { runVerifyCitations } from "./gate/verify-citations.mjs";
17
+ import { runOkfEmit } from "./gate/okf-emit.mjs";
17
18
  import { ensureBrainRepo, remoteDefaultBranch, inDir, die } from "./brain-repo.mjs";
18
19
  import { CLI_VERSION } from "./releases.mjs";
19
20
 
@@ -40,6 +41,38 @@ export default async function push(args = []) {
40
41
  /* no origin — manifest.repo stays "" */
41
42
  }
42
43
 
44
+ // ── stamped contract copy rides the push (before emit so the root index
45
+ // lists it from the very first push) ──
46
+ const canonical = join(ROOT, ".claude", "rafa", "contract.md");
47
+ if (existsSync(canonical)) {
48
+ // The copy is itself a generated concept (contract §11): it self-describes.
49
+ const stampFm =
50
+ `---\n` +
51
+ `type: Reference\n` +
52
+ `title: "rafa brain contract (stamped copy)"\n` +
53
+ `description: "the file protocol this bundle conforms to — canonical: .claude/rafa/contract.md in the code repo"\n` +
54
+ `timestamp: ${new Date().toISOString()}\n` +
55
+ `---\n\n`;
56
+ const stampHeader =
57
+ `<!-- STAMPED COPY — canonical: .claude/rafa/contract.md in the code repo.\n` +
58
+ ` cli: ${CLI_VERSION} · brain-for: ${codeSha} · stamped: ${new Date().toISOString()} -->\n\n`;
59
+ writeFileSync(join(rafaDir, "contract.md"), stampFm + stampHeader + readFileSync(canonical, "utf8"));
60
+ } else {
61
+ console.log(
62
+ " ! no .claude/rafa/contract.md in this repo — pushing without the stamped contract copy " +
63
+ "(run `rafa update` to vendor it)",
64
+ );
65
+ }
66
+
67
+ // ── OKF surface (in-process, contract §11) ──
68
+ // Materialize the interchange surface BEFORE the gates so everything the
69
+ // emitter writes is checked like any authored file: stamps (type/description/
70
+ // timestamp/tags where derivable), wikilink→markdown-link transpile, generated
71
+ // `# Citations` sections, and the index.md tree. A pushed brain repo is a
72
+ // conformant OKF v0.1 bundle any foreign consumer can read without rafa.
73
+ console.log("• rafa okf — materializing the OKF surface (stamps · links · citations · indexes) …");
74
+ runOkfEmit([`--repo=${repoFull}`]);
75
+
43
76
  // ── citation gate (in-process) ──
44
77
  // Re-run the checker HERE so the record that rides the push is the record of
45
78
  // THIS push — a stale/hand-stamped citation-check.json can never ship
@@ -70,23 +103,6 @@ export default async function push(args = []) {
70
103
  "authoring agent (atlas/bloom/prism) correct them, then re-push.",
71
104
  );
72
105
 
73
- // ── stamped contract copy rides the push ──
74
- // The canonical contract lives in the CODE repo (.claude/rafa/contract.md);
75
- // the brain repo carries a stamped copy so any reader of the brain repo knows
76
- // exactly which contract version this brain conforms to.
77
- const canonical = join(ROOT, ".claude", "rafa", "contract.md");
78
- if (existsSync(canonical)) {
79
- const stampHeader =
80
- `<!-- STAMPED COPY — canonical: .claude/rafa/contract.md in the code repo.\n` +
81
- ` cli: ${CLI_VERSION} · brain-for: ${codeSha} · stamped: ${new Date().toISOString()} -->\n\n`;
82
- writeFileSync(join(rafaDir, "contract.md"), stampHeader + readFileSync(canonical, "utf8"));
83
- } else {
84
- console.log(
85
- " ! no .claude/rafa/contract.md in this repo — pushing without the stamped contract copy " +
86
- "(run `rafa update` to vendor it)",
87
- );
88
- }
89
-
90
106
  inRafa("git add -A");
91
107
  try {
92
108
  inRafa(`git commit -m "brain: scan" -m "brain-for: ${codeSha}"`);
package/lib/releases.mjs CHANGED
@@ -168,6 +168,41 @@ export const RELEASES = [
168
168
  "never ship). Brain data schema unchanged; no re-scan; adopt with `rafa update` " +
169
169
  "(re-vendors hooks, merges settings + statusline, installs the pre-push boundary).",
170
170
  },
171
+ {
172
+ version: "0.8.0",
173
+ contract: 1,
174
+ plans: 2,
175
+ requires: "update",
176
+ recommends: ["push"],
177
+ summary:
178
+ "THE OKF SURFACE (contract §11): every generated .md self-describes, and a pushed " +
179
+ "brain repo is a conformant Open Knowledge Format v0.1 bundle any foreign agent can " +
180
+ "read without rafa tooling. New @rafinery/okf package (zero-dep: strict parser · " +
181
+ "concept primitives · links · citations · indexes · §9 validator · generator) — the " +
182
+ "gate now imports the parser from it. New `rafa okf` (emit — runs inside push, before " +
183
+ "the gates, so its output is gate-checked) · `rafa okf check` (conformance walk; " +
184
+ "documented exemptions surface as warnings) · `rafa okf new <class> <id>` (mint a " +
185
+ "conformant concept skeleton; the rafa-okf skill is the SOP). Emit stamps ONLY " +
186
+ "derivable values (description from summary · singleton type/title from the class " +
187
+ "registry · timestamp from authored created:/found: → brain-repo git history → the " +
188
+ "emit run; never a guess), renders `# Citations` (sha-pinned GitHub URLs when the " +
189
+ "repo is known) inside okf:citations markers, transpiles resolvable [[wikilinks]] to " +
190
+ "bundle-relative markdown links (the authored form going forward — SOPs updated), and " +
191
+ "generates the index.md tree (root index carries okf_version + repo + codeSha). " +
192
+ "Plan items carry the surface too (type: Plan Epic|Task|Subtask derived from kind; " +
193
+ "per-epic plans/index.md). " +
194
+ "Checker: non-failing LINKS warn lane (dangling link = not-yet-written knowledge, " +
195
+ "OKF §5.3 — prism's worklist; closes the 2026-06-19 [[…]]-lint ratchet) and the " +
196
+ "citation-check.md report now self-describes. index.md/log.md are reserved names " +
197
+ "(skipped by every walker). Agent cards: okf-surface duty on atlas · bloom · prism · " +
198
+ "sage; okf-awareness on compass (bundles are PORTABLE — person-scoped content never " +
199
+ "lands in one); the conductor verb map carries the protocol note. TOTALITY: "
200
+ + "*.theirs.md conflicts fail compile with a typed rule (walkers skip them); "
201
+ + "shipped SOPs (rafa-* skills + conductor) and sage learnings are compile-gated "
202
+ + "local classes beside the agent cards. WIRE UNCHANGED: " +
203
+ "manifest shape + schemaVersion 1 + checker v2 — all additive " +
204
+ "(§8); no re-scan, adopt with `rafa update`, then `rafa push` materializes the bundle.",
205
+ },
171
206
  ];
172
207
 
173
208
  // The release this CLI build ships (last entry).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rafinery/cli",
3
- "version": "0.7.0",
3
+ "version": "0.8.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": {
@@ -15,13 +15,12 @@
15
15
  "engines": {
16
16
  "node": ">=18"
17
17
  },
18
+ "dependencies": {
19
+ "@rafinery/okf": "0.1.0"
20
+ },
18
21
  "publishConfig": {
19
22
  "access": "public"
20
23
  },
21
- "scripts": {
22
- "bundle": "node scripts/bundle-blueprint.mjs",
23
- "prepare": "node scripts/bundle-blueprint.mjs"
24
- },
25
24
  "keywords": [
26
25
  "rafa",
27
26
  "rafinery",
@@ -37,5 +36,9 @@
37
36
  "url": "git+https://github.com/rafinery-ai/rafinery.git",
38
37
  "directory": "packages/cli"
39
38
  },
40
- "homepage": "https://github.com/rafinery-ai/rafinery/tree/main/packages/cli"
41
- }
39
+ "homepage": "https://github.com/rafinery-ai/rafinery/tree/main/packages/cli",
40
+ "scripts": {
41
+ "bundle": "node scripts/bundle-blueprint.mjs",
42
+ "test": "node --test"
43
+ }
44
+ }