@open-tomato/rafa 0.48.0 → 0.50.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.
@@ -13,10 +13,10 @@ import {
13
13
  openNdjsonStore,
14
14
  openSqliteStore,
15
15
  selectEffortStore
16
- } from "../../index-jx3x70xh.js";
16
+ } from "../../index-kcbs6fp9.js";
17
17
  import {
18
18
  TRUSTED_PERMISSIONS
19
- } from "../../index-2xzkzwm6.js";
19
+ } from "../../index-7rg3jbsz.js";
20
20
  import"../../index-2a7nb3an.js";
21
21
  import"../../index-m672ptpg.js";
22
22
  import {
@@ -220,7 +220,7 @@ var HINT_FLAG_SPEC = Object.freeze({
220
220
  });
221
221
  var DEFAULT_CI_TIMEOUT_MIN = 20;
222
222
  // package.json
223
- var version = "0.48.0";
223
+ var version = "0.50.0";
224
224
 
225
225
  // packages/rafa/src/core/command/version.ts
226
226
  var RAFA_VERSION = version;
@@ -8,7 +8,7 @@ import {
8
8
  createGitRunner,
9
9
  normalizeRemote,
10
10
  runningCommand
11
- } from "./index-2xzkzwm6.js";
11
+ } from "./index-7rg3jbsz.js";
12
12
  import {
13
13
  activeOutput,
14
14
  activeOutputMode,
@@ -20,7 +20,7 @@ import {
20
20
  isRecord,
21
21
  normalizeRemote,
22
22
  setActiveStoreSettings
23
- } from "./index-2xzkzwm6.js";
23
+ } from "./index-7rg3jbsz.js";
24
24
  import {
25
25
  activeOutput,
26
26
  activeOutputMode
@@ -3847,6 +3847,7 @@ var NEVER_RETRIED = Object.freeze([
3847
3847
  var RETRIED = Object.freeze([
3848
3848
  /operation timed out|i\/o timeout|TLS handshake timeout/u,
3849
3849
  /connection reset|\bEOF\b/u,
3850
+ /unexpected end of JSON input/u,
3850
3851
  /\bHTTP 50[234]\b/u
3851
3852
  ]);
3852
3853
  var UNKNOWN_REASON = "unknown error";
package/dist/index.js CHANGED
@@ -82,7 +82,7 @@ import {
82
82
  withSqliteStore,
83
83
  writeNames,
84
84
  writeSqliteStore
85
- } from "./index-jx3x70xh.js";
85
+ } from "./index-kcbs6fp9.js";
86
86
  import {
87
87
  ACTION_SHAPE,
88
88
  CONFIG_DEFAULTS,
@@ -269,7 +269,7 @@ import {
269
269
  writeHopRecord,
270
270
  writePositionFile,
271
271
  writeRefsBlock
272
- } from "./index-z4r20zwr.js";
272
+ } from "./index-q1tkqxnh.js";
273
273
  import {
274
274
  BLOCKER_GAP,
275
275
  PLAN_BLOCK_KINDS,
@@ -321,7 +321,7 @@ import {
321
321
  parseWorkingTree,
322
322
  registerAdapters,
323
323
  restoreAdapters
324
- } from "./index-2xzkzwm6.js";
324
+ } from "./index-7rg3jbsz.js";
325
325
  import {
326
326
  activeOutput,
327
327
  activeOutputMode,
@@ -8274,6 +8274,7 @@ function renderLessonsSection(lessons) {
8274
8274
  }
8275
8275
  // packages/rafa-inventory/src/task/select-lessons.ts
8276
8276
  var LESSON_LIMIT = 5;
8277
+ var TRIGGER_WORD_FLOOR = 2;
8277
8278
  function isArtifactPath(artifact) {
8278
8279
  return artifact !== "" && !/\s/.test(artifact) && /[/.]/.test(artifact);
8279
8280
  }
@@ -8308,7 +8309,7 @@ function triggerCandidate(lesson) {
8308
8309
  return { record, description: null, body: "" };
8309
8310
  }
8310
8311
  function triggerMatches(lesson, words) {
8311
- return words.length > 0 && scoreCandidate(triggerCandidate(lesson), words).score > RANK_FLOOR;
8312
+ return scoreCandidate(triggerCandidate(lesson), words).words.length >= TRIGGER_WORD_FLOOR;
8312
8313
  }
8313
8314
  function selectLessons(task, bundle) {
8314
8315
  const words = questionWords(task.text);
@@ -8316,7 +8317,9 @@ function selectLessons(task, bundle) {
8316
8317
  return [...kept].sort((a, b) => b.confidence - a.confidence).slice(0, LESSON_LIMIT);
8317
8318
  }
8318
8319
  // packages/rafa-effort/src/effort/skill-use.ts
8319
- var SKILL_USE_CLI_VERSION = "2.1.280";
8320
+ var SKILL_USE_CLI_FLOOR = "2.1.280";
8321
+ var SKILL_USE_FIXTURE_VERSION = "2.1.280";
8322
+ var CLI_VERSION_SHAPE = /^(\d+)\.(\d+)\.(\d+)$/u;
8320
8323
  var SKILL_TOOL = "Skill";
8321
8324
  var SUBAGENT_LOG_NAME = /^agent-.+\.jsonl$/;
8322
8325
  function asObject3(value) {
@@ -8335,14 +8338,35 @@ function subagentLogPaths(sessionLogPath) {
8335
8338
  return [];
8336
8339
  return readdirSync5(dir, { withFileTypes: true }).filter((entry) => entry.isFile() && SUBAGENT_LOG_NAME.test(entry.name)).map((entry) => join21(dir, entry.name)).sort((a, b) => a.localeCompare(b));
8337
8340
  }
8338
- function applyVersion(tally, record, cliVersion) {
8341
+ function versionFields(version) {
8342
+ if (typeof version !== "string")
8343
+ return null;
8344
+ const match = CLI_VERSION_SHAPE.exec(version);
8345
+ return match === null ? null : match.slice(1).map(Number);
8346
+ }
8347
+ function compareCliVersions(a, b) {
8348
+ const left = versionFields(a);
8349
+ const right = versionFields(b);
8350
+ if (left === null || right === null) {
8351
+ if (left !== right) {
8352
+ return left === null ? -1 : 1;
8353
+ }
8354
+ return a.localeCompare(b);
8355
+ }
8356
+ const differing = left.findIndex((field3, index) => field3 !== right[index]);
8357
+ return differing === -1 ? 0 : (left[differing] ?? 0) - (right[differing] ?? 0);
8358
+ }
8359
+ function applyVersion(tally, record, floor) {
8339
8360
  const version = record["version"];
8340
8361
  if (version === undefined)
8341
8362
  return;
8342
- if (version === cliVersion)
8343
- tally.pinned += 1;
8344
- else
8345
- tally.mismatched += 1;
8363
+ const text = String(version);
8364
+ tally.versions.add(text);
8365
+ if (typeof version === "string" && compareCliVersions(version, floor) >= 0) {
8366
+ tally.atOrAbove += 1;
8367
+ } else {
8368
+ tally.belowFloor += 1;
8369
+ }
8346
8370
  }
8347
8371
  function applyCalls(tally, record, sidechain) {
8348
8372
  if (record["type"] !== "assistant")
@@ -8363,7 +8387,7 @@ function applyCalls(tally, record, sidechain) {
8363
8387
  tally.counts.set(key, (tally.counts.get(key) ?? 0) + 1);
8364
8388
  }
8365
8389
  }
8366
- async function applySource(tally, source, cliVersion) {
8390
+ async function applySource(tally, source, floor) {
8367
8391
  for await (const rawLine of source.lines) {
8368
8392
  const line = rawLine.trim();
8369
8393
  if (line.length === 0)
@@ -8373,7 +8397,7 @@ async function applySource(tally, source, cliVersion) {
8373
8397
  tally.unreadable += 1;
8374
8398
  continue;
8375
8399
  }
8376
- applyVersion(tally, record, cliVersion);
8400
+ applyVersion(tally, record, floor);
8377
8401
  applyCalls(tally, record, source.subagent || record["isSidechain"] === true);
8378
8402
  }
8379
8403
  }
@@ -8384,27 +8408,36 @@ function usesOf(counts) {
8384
8408
  });
8385
8409
  return uses.sort((a, b) => a.name.localeCompare(b.name) || Number(a.sidechain) - Number(b.sidechain));
8386
8410
  }
8387
- async function collectSkillUse(sessionId, sources, cliVersion = SKILL_USE_CLI_VERSION) {
8388
- const tally = { counts: new Map, mismatched: 0, pinned: 0, unreadable: 0 };
8411
+ async function collectSkillUse(sessionId, sources, floor = SKILL_USE_CLI_FLOOR) {
8412
+ if (versionFields(floor) === null)
8413
+ throw new TypeError(`skill-use floor ${JSON.stringify(floor)} is not an X.Y.Z version`);
8414
+ const tally = { counts: new Map, belowFloor: 0, atOrAbove: 0, versions: new Set, unreadable: 0 };
8389
8415
  for (const source of sources)
8390
- await applySource(tally, source, cliVersion);
8391
- if (tally.mismatched > 0 || tally.pinned === 0 || tally.unreadable > 0) {
8392
- return { sessionId, uses: UNKNOWN_SKILL_COUNT };
8416
+ await applySource(tally, source, floor);
8417
+ const versions = [...tally.versions].sort(compareCliVersions);
8418
+ if (tally.belowFloor > 0 || tally.atOrAbove === 0 || tally.unreadable > 0) {
8419
+ return { sessionId, uses: UNKNOWN_SKILL_COUNT, vouched: false, versions };
8393
8420
  }
8394
- return { sessionId, uses: usesOf(tally.counts) };
8421
+ const vouched = versions.length === 1 && versions[0] === SKILL_USE_FIXTURE_VERSION;
8422
+ return { sessionId, uses: usesOf(tally.counts), vouched, versions };
8395
8423
  }
8396
- async function readSkillUse(sessionLogPath, cliVersion = SKILL_USE_CLI_VERSION) {
8424
+ async function readSkillUse(sessionLogPath, floor = SKILL_USE_CLI_FLOOR) {
8397
8425
  const sources = [
8398
8426
  { lines: readLines(sessionLogPath), subagent: false },
8399
8427
  ...subagentLogPaths(sessionLogPath).map((path2) => ({ lines: readLines(path2), subagent: true }))
8400
8428
  ];
8401
- return collectSkillUse(sessionIdFromPath(sessionLogPath), sources, cliVersion);
8429
+ return collectSkillUse(sessionIdFromPath(sessionLogPath), sources, floor);
8402
8430
  }
8403
8431
 
8404
8432
  // packages/rafa-effort/src/effort/collect-skills.ts
8405
8433
  function messageOf3(error) {
8406
8434
  return error instanceof Error ? error.message : String(error);
8407
8435
  }
8436
+ function readingNote(reading) {
8437
+ const versions = reading.versions.length === 0 ? "no version" : reading.versions.join(", ");
8438
+ const standing = reading.uses === UNKNOWN_SKILL_COUNT ? "unknown" : reading.vouched ? "vouched" : "unvouched";
8439
+ return `skills: read ${reading.sessionId} (${versions}, ${standing})`;
8440
+ }
8408
8441
  function countedSessions(repoRoot) {
8409
8442
  return new Set(readSkillInvocations(repoRoot).map((row) => row.sessionId));
8410
8443
  }
@@ -8415,8 +8448,9 @@ async function collectSkillHalf(input) {
8415
8448
  let failed2 = 0;
8416
8449
  for (const log of pending) {
8417
8450
  try {
8418
- readings.push(await readSkillUse(log.path));
8419
- input.note(`skills: read ${log.sessionId}`);
8451
+ const reading = await readSkillUse(log.path);
8452
+ readings.push(reading);
8453
+ input.note(readingNote(reading));
8420
8454
  } catch (error) {
8421
8455
  failed2 += 1;
8422
8456
  input.log(`skills: FAILED ${log.path}: ${messageOf3(error)}`);
@@ -8429,6 +8463,7 @@ async function collectSkillHalf(input) {
8429
8463
  candidates: input.logs.length,
8430
8464
  alreadyCounted: input.logs.length - pending.length,
8431
8465
  read: readings.length,
8466
+ unvouched: readings.filter((reading) => reading.uses !== UNKNOWN_SKILL_COUNT && !reading.vouched).length,
8432
8467
  unknown: readings.filter((reading) => reading.uses === UNKNOWN_SKILL_COUNT).length,
8433
8468
  failed: failed2,
8434
8469
  appended: written.appended,
@@ -8439,7 +8474,7 @@ function formatSkillSummary(skills) {
8439
8474
  if (skills === null)
8440
8475
  return " skills skipped (--no-sessions)";
8441
8476
  const scope = skills.scope === "held" ? "stored" : "appended";
8442
- return ` skills ${skills.candidates} ${scope} sessions` + `, ${skills.alreadyCounted} already counted` + `, ${skills.read} read` + `, ${skills.unknown} unknown` + `, ${skills.failed} failed` + `, +${skills.appended} rows`;
8477
+ return ` skills ${skills.candidates} ${scope} sessions` + `, ${skills.alreadyCounted} already counted` + `, ${skills.read} read` + `, ${skills.unvouched} unvouched` + `, ${skills.unknown} unknown` + `, ${skills.failed} failed` + `, +${skills.appended} rows`;
8443
8478
  }
8444
8479
 
8445
8480
  // packages/rafa-effort/src/effort/commits.ts
@@ -13976,7 +14011,7 @@ var PR_MERGE_DECLARATION = Object.freeze({
13976
14011
  subject: PR_SUBJECT.name,
13977
14012
  action: "merge",
13978
14013
  summary: "merge a pull request and clean up both branches",
13979
- description: "Merges one pull request through the GitHub CLI and then, in code, switches to the base branch," + " pulls it fast-forward only, deletes the head branch locally and on the remote where it is still there," + " and prunes, reporting each step; a head branch this checkout has no local branch for is reported as a" + " skipped local delete, and the rest still run. Refuses before it asks anything on a tracked change in the working tree or an" + " untracked path the pull request's head or the base's remote-tracking branch holds, on a pull" + " request that is not green or does not merge, and on a head branch checked out in another worktree, except a" + " clean, ended loop worktree under `loop.worktreeDir`, which it removes after copying its two plan files out. It" + " shows the pull request, its branches and the method and asks `Merge? [y/N]`; `--yes` skips the question," + " and without a terminal and without `--yes` it refuses. A pull request that reports no checks at all is" + " refused unless `--skip-checks` is given, which is refused on any pull request that does report checks;" + " with it the command reads how many workflows the repository defines, prints a warning for that case, asks" + " `Merge #<n> with no checks? [y/N]` (which `--yes` answers only where the repository defines no workflow, or" + " where no workflow file on the base has a `pull_request` trigger naming it)," + " and after the merge posts one comment on the pull request saying so. Where the release runs, the release" + " guard reads the branch before the question: a `collision` is refused unless" + " `dangerous.acceptVersionCollision` is true, and `pr.versionCollision` sets whether a `missing` or" + " `stale` branch merges silently, with a warning, after its own question, or not at all. A step that fails never undoes the merge: it" + " prints what is left as commands to paste and exits 1. After the merge it ticks the `Closes #<n>` line of" + " every issue the pull request closes, first on the checklist of the open epic that issue's `epic:` label" + " names, printing one line per epic, then on every open board whose checklist lists it, or on the roadmap" + " issue while no issue carries `type:roadmap`, warning rather than failing when one of those writes" + ' does not land. It ends by reading every open issue whose "Blocked by:" line names an issue this pull' + " request closes, asking whether to remove `spec:blocked` from each one whose blockers have all closed;" + " `--yes` does not answer that question, and every failure of that reading is a warning. With" + " board.relationships set to native it ticks no epic checklist and, in place of that reading, prints the" + " open issues the merge freed, whose blockers GitHub clears by itself, asking nothing and writing nothing. With" + " `--output=json` the pull request, the method, the steps that ran, the follow-ups, the roadmap tick and" + " the unblock reading, or the freed issues in native mode, are the data of the terminal result event;" + " the tick of each closed issue's epic checklist is one line per epic and no key of that data, and under" + " native there is none. Refuses with exit code 2 where" + " `pr.provider` is not `gh`.",
14014
+ description: "Merges one pull request through the GitHub CLI and then, in code, switches to the base branch," + " pulls it fast-forward only, deletes the head branch locally and on the remote where it is still there," + " and prunes, reporting each step; a head branch this checkout has no local branch for is reported as a" + " skipped local delete, and the rest still run. A head branch that is a trunk (`pr.base`, the remote's default" + " branch, `main` where `pr.base` names none, or a branch `cleanup.keep` names) is kept on both sides, with one" + " line saying so, and `--keep-branch` keeps any other head branch the same way. Refuses before it asks anything on a tracked change in the working tree or an" + " untracked path the pull request's head or the base's remote-tracking branch holds, on a pull" + " request that is not green or does not merge, and on a head branch checked out in another worktree, except a" + " clean, ended loop worktree under `loop.worktreeDir`, which it removes after copying its two plan files out. It" + " shows the pull request, its branches and the method and asks `Merge? [y/N]`; `--yes` skips the question," + " and without a terminal and without `--yes` it refuses. A pull request that reports no checks at all is" + " refused unless `--skip-checks` is given, which is refused on any pull request that does report checks;" + " with it the command reads how many workflows the repository defines, prints a warning for that case, asks" + " `Merge #<n> with no checks? [y/N]` (which `--yes` answers only where the repository defines no workflow, or" + " where no workflow file on the base has a `pull_request` trigger naming it)," + " and after the merge posts one comment on the pull request saying so. Where the release runs, the release" + " guard reads the branch before the question: a `collision` is refused unless" + " `dangerous.acceptVersionCollision` is true, and `pr.versionCollision` sets whether a `missing` or" + " `stale` branch merges silently, with a warning, after its own question, or not at all. A step that fails never undoes the merge: it" + " prints what is left as commands to paste and exits 1. After the merge it ticks the `Closes #<n>` line of" + " every issue the pull request closes, first on the checklist of the open epic that issue's `epic:` label" + " names, printing one line per epic, then on every open board whose checklist lists it, or on the roadmap" + " issue while no issue carries `type:roadmap`, warning rather than failing when one of those writes" + ' does not land. It ends by reading every open issue whose "Blocked by:" line names an issue this pull' + " request closes, asking whether to remove `spec:blocked` from each one whose blockers have all closed;" + " `--yes` does not answer that question, and every failure of that reading is a warning. With" + " board.relationships set to native it ticks no epic checklist and, in place of that reading, prints the" + " open issues the merge freed, whose blockers GitHub clears by itself, asking nothing and writing nothing. With" + " `--output=json` the pull request, the method, the steps that ran, the follow-ups, the roadmap tick and" + " the unblock reading, or the freed issues in native mode, are the data of the terminal result event;" + " the tick of each closed issue's epic checklist is one line per epic and no key of that data, and under" + " native there is none. Refuses with exit code 2 where" + " `pr.provider` is not `gh`.",
13980
14015
  args: [
13981
14016
  {
13982
14017
  name: "n",
@@ -13995,6 +14030,11 @@ var PR_MERGE_DECLARATION = Object.freeze({
13995
14030
  description: "Merge a pull request that reports no checks at all, after a warning and its own question." + " Refused where the pull request reports any check; `--yes` beside it is refused where the repository" + " defines a workflow that may run on pull requests into the base, or its workflow count could not be read.",
13996
14031
  type: "boolean"
13997
14032
  },
14033
+ {
14034
+ name: "keep-branch",
14035
+ description: "Keep the head branch locally and on the remote after the merge. A trunk is kept without it.",
14036
+ type: "boolean"
14037
+ },
13998
14038
  {
13999
14039
  name: "method",
14000
14040
  description: "How to merge: squash, merge or rebase. `pr.mergeMethod` when it is left out.",
@@ -14015,6 +14055,10 @@ var PR_MERGE_DECLARATION = Object.freeze({
14015
14055
  cmd: "rafa pr merge 41 --skip-checks",
14016
14056
  note: "Warns that nothing on GitHub tested pull request 41, asks, merges it and comments that it had no checks."
14017
14057
  },
14058
+ {
14059
+ cmd: "rafa pr merge 41 --keep-branch",
14060
+ note: "Merges pull request 41 and keeps its head branch on both sides, deleting neither."
14061
+ },
14018
14062
  {
14019
14063
  cmd: "rafa pr merge 41 --method=rebase --output=json",
14020
14064
  note: "Merges by rebase and writes a result event holding each clean-up step and the follow-ups."
@@ -14671,7 +14715,7 @@ var PR_USAGE = Object.freeze({
14671
14715
  show: "rafa pr show [<n>]",
14672
14716
  view: "rafa pr view [<n>]",
14673
14717
  list: "rafa pr list",
14674
- merge: "rafa pr merge [<n>] [--yes] [--skip-checks] [--method=squash|merge|rebase]",
14718
+ merge: "rafa pr merge [<n>] [--yes] [--skip-checks] [--keep-branch] [--method=squash|merge|rebase]",
14675
14719
  triage: "rafa pr triage [<n>] [--no-comment] [--resolve] [--allow-local-config] [--max-attempts=<count>]",
14676
14720
  wait: "rafa pr wait [<n>] [--timeout=<minutes>]",
14677
14721
  open: "rafa pr open --head=<branch> --base=<branch> --title=<text> --body-file=<path>",
@@ -28664,7 +28708,7 @@ function createPlanBlockedOffer(seams = DEFAULT_BLOCKED_SEAMS) {
28664
28708
 
28665
28709
  // src/commands/plan/ready-offer.ts
28666
28710
  var runIssueReadyLazily = async (options) => {
28667
- const { runIssueReady: run } = await import("./ready-gax3hhtt.js");
28711
+ const { runIssueReady: run } = await import("./ready-stwsr9ws.js");
28668
28712
  return run(options);
28669
28713
  };
28670
28714
  var DEFAULT_OFFER_SEAMS = Object.freeze({});
@@ -24,14 +24,14 @@ import {
24
24
  requireCompleteSpec,
25
25
  requireTrustedBoardAuthor,
26
26
  typeOfLabels
27
- } from "./index-z4r20zwr.js";
27
+ } from "./index-q1tkqxnh.js";
28
28
  import"./index-ajv88fkm.js";
29
29
  import {
30
30
  CommandExit,
31
31
  createGitRunner,
32
32
  createLinePrompter,
33
33
  lazyPrompter
34
- } from "./index-2xzkzwm6.js";
34
+ } from "./index-7rg3jbsz.js";
35
35
  import"./index-2a7nb3an.js";
36
36
  import"./index-g91ys6kw.js";
37
37
  import"./index-m672ptpg.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tomato/rafa",
3
- "version": "0.48.0",
3
+ "version": "0.50.0",
4
4
  "description": "Alpha. Runs a plan through the ralph loop: one Claude Code session per task, one commit per task, then a pull request and a CI wait.",
5
5
  "private": false,
6
6
  "publishConfig": {