@rungs/cli 0.3.0 → 0.3.1
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 +1 -1
- package/dist/cli.js +29 -29
- package/dist/cli.js.map +3 -3
- package/package.json +1 -1
- package/src/engines.ts +22 -3
- package/src/engines2.ts +22 -10
- package/src/engines3.ts +4 -3
- package/src/lifecycle.ts +9 -4
package/README.md
CHANGED
|
@@ -220,7 +220,7 @@ Four promises that shape everything else:
|
|
|
220
220
|
|
|
221
221
|
## Status
|
|
222
222
|
|
|
223
|
-
**Current release: v0.3.
|
|
223
|
+
**Current release: v0.3.1** — that number is checked against [`package.json`](package.json) by the
|
|
224
224
|
`docs-version-claims` gate, so this sentence cannot drift from what ships — and the gate fails if
|
|
225
225
|
the sentence is reworded out of existence, because a claim nothing checks any more should not look
|
|
226
226
|
the same as a claim that passes.
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/cli.ts
|
|
4
|
-
import { fileURLToPath as
|
|
4
|
+
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
5
5
|
import { dirname as dirname9, join as join14, resolve as resolve5 } from "node:path";
|
|
6
6
|
|
|
7
7
|
// src/manifest.ts
|
|
@@ -850,14 +850,15 @@ function writeReport(repoRoot, entries, harnesses, stamp) {
|
|
|
850
850
|
|
|
851
851
|
// src/check.ts
|
|
852
852
|
import { appendFileSync, existsSync as existsSync7, readFileSync as readFileSync8 } from "node:fs";
|
|
853
|
-
import { execSync
|
|
853
|
+
import { execSync } from "node:child_process";
|
|
854
854
|
import { dirname as dirname5, join as join10 } from "node:path";
|
|
855
|
-
import { fileURLToPath } from "node:url";
|
|
855
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
856
856
|
import { parse as parse2 } from "smol-toml";
|
|
857
857
|
|
|
858
858
|
// src/engines.ts
|
|
859
859
|
import { existsSync as existsSync6, readFileSync as readFileSync7 } from "node:fs";
|
|
860
860
|
import { join as join9, dirname as dirname4, resolve as resolve2 } from "node:path";
|
|
861
|
+
import { fileURLToPath } from "node:url";
|
|
861
862
|
import { parse as parseToml } from "smol-toml";
|
|
862
863
|
|
|
863
864
|
// src/selftest.ts
|
|
@@ -986,7 +987,7 @@ function runSelfTests(gateId, engine, table, blocks) {
|
|
|
986
987
|
|
|
987
988
|
// src/engines2.ts
|
|
988
989
|
import { readFileSync as readFileSync5 } from "node:fs";
|
|
989
|
-
import {
|
|
990
|
+
import { execFileSync } from "node:child_process";
|
|
990
991
|
import { join as join7 } from "node:path";
|
|
991
992
|
var read = (root, rel) => {
|
|
992
993
|
try {
|
|
@@ -1237,12 +1238,13 @@ var crossReference = (t, root, files) => {
|
|
|
1237
1238
|
}
|
|
1238
1239
|
return { findings, examined: skills.length };
|
|
1239
1240
|
};
|
|
1241
|
+
var gitArgs = (root, args2) => execFileSync("git", args2, { cwd: root, stdio: "pipe" }).toString().trim();
|
|
1240
1242
|
function landedWork(root, branch, base) {
|
|
1241
|
-
const git2 = (
|
|
1243
|
+
const git2 = (...args2) => gitArgs(root, args2);
|
|
1242
1244
|
try {
|
|
1243
|
-
const tip = git2(
|
|
1244
|
-
if (tip === git2(
|
|
1245
|
-
return git2(
|
|
1245
|
+
const tip = git2("rev-parse", branch);
|
|
1246
|
+
if (tip === git2("rev-parse", base)) return false;
|
|
1247
|
+
return git2("log", base, "--merges", "--format=%P").split("\n").some((line) => line.trim().split(/\s+/).slice(1).includes(tip));
|
|
1246
1248
|
} catch {
|
|
1247
1249
|
return true;
|
|
1248
1250
|
}
|
|
@@ -1252,10 +1254,7 @@ var gitStatusReconcile = (t, root, files) => {
|
|
|
1252
1254
|
let merged;
|
|
1253
1255
|
try {
|
|
1254
1256
|
merged = new Set(
|
|
1255
|
-
|
|
1256
|
-
cwd: root,
|
|
1257
|
-
stdio: "pipe"
|
|
1258
|
-
}).toString().split("\n").map((s) => s.trim()).filter(Boolean)
|
|
1257
|
+
gitArgs(root, ["branch", "--merged", t.integration_branch ?? "main", "--format=%(refname:short)"]).split("\n").map((s) => s.trim()).filter(Boolean)
|
|
1259
1258
|
);
|
|
1260
1259
|
} catch {
|
|
1261
1260
|
return { findings: [{ message: "cannot read git branches; status not reconciled" }], examined: 0 };
|
|
@@ -1313,7 +1312,7 @@ var computedClaim = (t, root, files) => {
|
|
|
1313
1312
|
|
|
1314
1313
|
// src/engines3.ts
|
|
1315
1314
|
import { readFileSync as readFileSync6 } from "node:fs";
|
|
1316
|
-
import {
|
|
1315
|
+
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
1317
1316
|
import { join as join8 } from "node:path";
|
|
1318
1317
|
var read2 = (root, rel) => {
|
|
1319
1318
|
try {
|
|
@@ -1447,7 +1446,7 @@ var rulePropagation = (t, root, files) => {
|
|
|
1447
1446
|
var gitState = (t, root) => {
|
|
1448
1447
|
let out;
|
|
1449
1448
|
try {
|
|
1450
|
-
out =
|
|
1449
|
+
out = execFileSync2("git", ["worktree", "list", "--porcelain"], { cwd: root, stdio: "pipe" }).toString();
|
|
1451
1450
|
} catch {
|
|
1452
1451
|
return { findings: [{ message: "cannot read git worktrees; checkout state unknown" }], examined: 0 };
|
|
1453
1452
|
}
|
|
@@ -1472,7 +1471,7 @@ var mergeDriverCheck = (t, root) => {
|
|
|
1472
1471
|
for (const driver of required) {
|
|
1473
1472
|
let configured = "";
|
|
1474
1473
|
try {
|
|
1475
|
-
configured =
|
|
1474
|
+
configured = execFileSync2("git", ["config", "--get", `merge.${driver}.driver`], { cwd: root, stdio: "pipe" }).toString().trim();
|
|
1476
1475
|
} catch {
|
|
1477
1476
|
}
|
|
1478
1477
|
if (!configured) {
|
|
@@ -1524,6 +1523,7 @@ var boardReconcile = (t, root, _files) => {
|
|
|
1524
1523
|
};
|
|
1525
1524
|
|
|
1526
1525
|
// src/engines.ts
|
|
1526
|
+
var CLI_MODULES = join9(dirname4(fileURLToPath(import.meta.url)), "..", "modules");
|
|
1527
1527
|
var read3 = (root, rel) => {
|
|
1528
1528
|
try {
|
|
1529
1529
|
return readFileSync7(join9(root, rel), "utf8");
|
|
@@ -1725,7 +1725,7 @@ var gateMeta = (_t, root) => {
|
|
|
1725
1725
|
const table = entry.match(/^table\s*=\s*"(.+)"/m)?.[1];
|
|
1726
1726
|
if (!id || kind !== "declared" || !table) continue;
|
|
1727
1727
|
examined++;
|
|
1728
|
-
const tablePath = join9(
|
|
1728
|
+
const tablePath = join9(CLI_MODULES, dirname4(table), "gates", table.split("/").pop());
|
|
1729
1729
|
const src = existsSync6(tablePath) ? readFileSync7(tablePath, "utf8") : "";
|
|
1730
1730
|
const forGate = [...src.matchAll(/\[\[self_test\]\][\s\S]*?(?=\n\[\[|\n\[|$)/g)].map((m) => m[0]).filter((b) => b.includes(`gate = "${id}"`) || b.includes(`gate = "${id}"`) || b.includes(`gate = "${id}"`));
|
|
1731
1731
|
for (const direction of ["pass", "fail"]) {
|
|
@@ -1751,7 +1751,7 @@ function optedInExtensions(rel, spec) {
|
|
|
1751
1751
|
const name = rel.split("/").slice(-2)[0];
|
|
1752
1752
|
if (!name) return /* @__PURE__ */ new Set();
|
|
1753
1753
|
try {
|
|
1754
|
-
const mods = loadAllModules(
|
|
1754
|
+
const mods = loadAllModules(CLI_MODULES);
|
|
1755
1755
|
const owner = mods.find((m) => m.skills?.[name]?.extensions);
|
|
1756
1756
|
return new Set(Object.keys(owner?.skills?.[name]?.extensions ?? {}));
|
|
1757
1757
|
} catch {
|
|
@@ -1762,7 +1762,7 @@ var escapeRe3 = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
|
1762
1762
|
function parseTable(path, module) {
|
|
1763
1763
|
if (!existsSync6(path)) return null;
|
|
1764
1764
|
try {
|
|
1765
|
-
const mods = loadAllModules(
|
|
1765
|
+
const mods = loadAllModules(CLI_MODULES);
|
|
1766
1766
|
const params = resolveParams(mods, {}, ".");
|
|
1767
1767
|
return parseToml(substitute(readFileSync7(path, "utf8"), module, params));
|
|
1768
1768
|
} catch {
|
|
@@ -1815,7 +1815,7 @@ function isImplemented(engine) {
|
|
|
1815
1815
|
}
|
|
1816
1816
|
|
|
1817
1817
|
// src/check.ts
|
|
1818
|
-
var MODULES = join10(dirname5(
|
|
1818
|
+
var MODULES = join10(dirname5(fileURLToPath2(import.meta.url)), "..", "modules");
|
|
1819
1819
|
function loadRegistry(repoRoot) {
|
|
1820
1820
|
const path = join10(repoRoot, ".ai", "gates.toml");
|
|
1821
1821
|
if (!existsSync7(path)) return { runner: {}, gates: [] };
|
|
@@ -1856,7 +1856,7 @@ function runGates(repoRoot, tier, now = () => Date.now(), only) {
|
|
|
1856
1856
|
let examined = 0;
|
|
1857
1857
|
if (g.kind === "command" && g.command) {
|
|
1858
1858
|
try {
|
|
1859
|
-
|
|
1859
|
+
execSync(g.command, { cwd: repoRoot, stdio: "pipe" });
|
|
1860
1860
|
} catch (e) {
|
|
1861
1861
|
status = "fail";
|
|
1862
1862
|
findings = [{ message: String(e.stderr ?? e.stdout ?? e.message).trim().split("\n").slice(-3).join(" ") }];
|
|
@@ -1978,10 +1978,10 @@ function ledgerQuestions(repoRoot, gates) {
|
|
|
1978
1978
|
// src/lifecycle.ts
|
|
1979
1979
|
import { copyFileSync, existsSync as existsSync8, mkdirSync as mkdirSync4, readFileSync as readFileSync9, writeFileSync as writeFileSync4 } from "node:fs";
|
|
1980
1980
|
import { dirname as dirname6, join as join11 } from "node:path";
|
|
1981
|
-
import { fileURLToPath as
|
|
1982
|
-
import {
|
|
1981
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
1982
|
+
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
1983
1983
|
import { parse as parse3 } from "smol-toml";
|
|
1984
|
-
var SRC = dirname6(
|
|
1984
|
+
var SRC = dirname6(fileURLToPath3(import.meta.url));
|
|
1985
1985
|
var PROFILES = {
|
|
1986
1986
|
minimal: ["instructions"],
|
|
1987
1987
|
tracked: ["instructions", "gates", "backlog", "findings", "adr", "session"],
|
|
@@ -2194,8 +2194,8 @@ function setupGit(repoRoot, dryRun = false) {
|
|
|
2194
2194
|
');process.exit(1)"` : "git merge-file -L ours -L base -L theirs %A %O %B";
|
|
2195
2195
|
if (!dryRun) {
|
|
2196
2196
|
try {
|
|
2197
|
-
|
|
2198
|
-
|
|
2197
|
+
execFileSync3("git", ["config", `merge.${d}.name`, `rungs ${d.replace("rungs-", "")} driver`], { cwd: repoRoot, stdio: "pipe" });
|
|
2198
|
+
execFileSync3("git", ["config", `merge.${d}.driver`, cmd2], { cwd: repoRoot, stdio: "pipe" });
|
|
2199
2199
|
} catch {
|
|
2200
2200
|
continue;
|
|
2201
2201
|
}
|
|
@@ -2205,7 +2205,7 @@ function setupGit(repoRoot, dryRun = false) {
|
|
|
2205
2205
|
let rerere = false;
|
|
2206
2206
|
if (!dryRun) {
|
|
2207
2207
|
try {
|
|
2208
|
-
|
|
2208
|
+
execFileSync3("git", ["config", "rerere.enabled", "true"], { cwd: repoRoot, stdio: "pipe" });
|
|
2209
2209
|
rerere = true;
|
|
2210
2210
|
} catch {
|
|
2211
2211
|
}
|
|
@@ -2380,7 +2380,7 @@ function applyArchive(repoRoot, plan) {
|
|
|
2380
2380
|
|
|
2381
2381
|
// src/concurrency.ts
|
|
2382
2382
|
import { existsSync as existsSync10, mkdtempSync as mkdtempSync2, readFileSync as readFileSync11, rmSync as rmSync2, writeFileSync as writeFileSync6, unlinkSync } from "node:fs";
|
|
2383
|
-
import { execFileSync } from "node:child_process";
|
|
2383
|
+
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
2384
2384
|
import { hostname } from "node:os";
|
|
2385
2385
|
import { join as join13, resolve as resolve4, dirname as dirname8, basename as basename2 } from "node:path";
|
|
2386
2386
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
@@ -2397,7 +2397,7 @@ function loopParams(root) {
|
|
|
2397
2397
|
};
|
|
2398
2398
|
}
|
|
2399
2399
|
function git(root, args2) {
|
|
2400
|
-
return
|
|
2400
|
+
return execFileSync4("git", args2, { cwd: root, stdio: "pipe", encoding: "utf8" }).trim();
|
|
2401
2401
|
}
|
|
2402
2402
|
function gitOk(root, args2) {
|
|
2403
2403
|
try {
|
|
@@ -2638,7 +2638,7 @@ function worktrees(root) {
|
|
|
2638
2638
|
|
|
2639
2639
|
// src/cli.ts
|
|
2640
2640
|
import { existsSync as existsSync11 } from "node:fs";
|
|
2641
|
-
var HERE = dirname9(
|
|
2641
|
+
var HERE = dirname9(fileURLToPath4(import.meta.url));
|
|
2642
2642
|
var MODULES2 = join14(HERE, "..", "modules");
|
|
2643
2643
|
var c = {
|
|
2644
2644
|
dim: (s) => `\x1B[2m${s}\x1B[0m`,
|