@open-tomato/rafa 0.20.0 → 0.21.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.
@@ -4,7 +4,7 @@ import {
4
4
  openNdjsonStore,
5
5
  openSqliteStore,
6
6
  selectEffortStore
7
- } from "../../index-afersvp3.js";
7
+ } from "../../index-am92b8qp.js";
8
8
  import"../../index-twbp38kz.js";
9
9
  import"../../index-d6d0942q.js";
10
10
  import"../../index-28jzpyks.js";
@@ -176,10 +176,8 @@ function openNdjsonStore(repoRoot) {
176
176
  import { existsSync as existsSync2, mkdirSync as mkdirSync2 } from "fs";
177
177
  import { dirname as dirname2, join as join2 } from "path";
178
178
  import { Database } from "bun:sqlite";
179
- var STORE_FILE_NAME = "effort.sqlite";
180
- function sqliteStorePath(repoRoot) {
181
- return join2(repoRoot, EFFORT_STORE_DIR, STORE_FILE_NAME);
182
- }
179
+
180
+ // src/effort/store/migrations.ts
183
181
  var SQLITE_MIGRATIONS = [
184
182
  `
185
183
  CREATE TABLE sessions (
@@ -355,9 +353,32 @@ var SQLITE_MIGRATIONS = [
355
353
 
356
354
  CREATE UNIQUE INDEX skill_invocations_by_use
357
355
  ON skill_invocations (session_id, ifnull(name, ''), ifnull(sidechain, -1));
356
+ `,
357
+ `
358
+ ALTER TABLE task_reports
359
+ ADD COLUMN skills_used TEXT CHECK (skills_used IS NULL OR json_type(skills_used) = 'array');
360
+ `,
361
+ `
362
+ CREATE TABLE plan_ci (
363
+ seq INTEGER PRIMARY KEY,
364
+ plan_stub TEXT NOT NULL CHECK (plan_stub <> ''),
365
+ pr INTEGER NOT NULL CHECK (typeof(pr) = 'integer' AND pr > 0),
366
+ head_sha TEXT NOT NULL CHECK (head_sha <> ''),
367
+ verdict TEXT NOT NULL CHECK (verdict IN ('green', 'red', 'none')),
368
+ failing TEXT NOT NULL CHECK (json_valid(failing) AND json_type(failing) = 'array'),
369
+ read_at TEXT NOT NULL CHECK (read_at <> ''),
370
+ UNIQUE (pr, head_sha, read_at),
371
+ CHECK ((verdict = 'red') = (json_array_length(failing) > 0))
372
+ );
358
373
  `
359
374
  ];
360
375
  var SQLITE_SCHEMA_VERSION = SQLITE_MIGRATIONS.length;
376
+
377
+ // src/effort/store/sqlite.ts
378
+ var STORE_FILE_NAME = "effort.sqlite";
379
+ function sqliteStorePath(repoRoot) {
380
+ return join2(repoRoot, EFFORT_STORE_DIR, STORE_FILE_NAME);
381
+ }
361
382
  var KIND_TABLES = {
362
383
  sessions: { name: "sessions", keyColumn: "session_id" },
363
384
  commits: { name: "commits", keyColumn: "sha" }
@@ -2843,4 +2864,4 @@ function selectEffortStore(repoRoot, config) {
2843
2864
  return adapter.create({ repoRoot });
2844
2865
  }
2845
2866
 
2846
- export { EFFORT_STORE_DIR, effortStorePath, EFFORT_KEY_PROJECTIONS, openNdjsonStore, sqliteStorePath, SQLITE_MIGRATIONS, LONE_SURROGATE, migrateSchema, withSqliteStore, writeSqliteStore, openSqliteStore, SKILL_FILE, MARKDOWN_EXTENSION, scanLayout, declaredNameIssue, readFrontmatterDocument, readFrontmatter, renderFrontmatter, mergeFrontmatter, writeFrontmatter, normalizeRemote, gitRemoteUrl, ACTION_HEADING, CAUSE_HEADING, parseInstinct, writeInstinct, readScopes, allRecords, findRecords, instinctProject, toHeldRecords, sessionSpawnEnv, getClaudeUsagePercent, checkUsage, CLAUDE_BIN, claudeArgs, interruptClaudeSessions, runClaude, spawnClaudeCaptured, runClaudeCaptured, planFilePath, ClaudePlannerError, ISSUE_TYPES, ISSUE_PRIORITIES, ISSUE_STATES, GITHUB_LABELS, createGhRunner, typeOfLabels, moduleOfLabels, createLocalTracker, PORT_VERSIONS, createAdapterRegistry, CORE_ADAPTER_REGISTRY, selectEffortStore };
2867
+ export { EFFORT_STORE_DIR, effortStorePath, EFFORT_KEY_PROJECTIONS, openNdjsonStore, SQLITE_MIGRATIONS, sqliteStorePath, LONE_SURROGATE, migrateSchema, withSqliteStore, writeSqliteStore, openSqliteStore, SKILL_FILE, MARKDOWN_EXTENSION, scanLayout, declaredNameIssue, readFrontmatterDocument, readFrontmatter, renderFrontmatter, mergeFrontmatter, writeFrontmatter, normalizeRemote, gitRemoteUrl, ACTION_HEADING, CAUSE_HEADING, parseInstinct, writeInstinct, readScopes, allRecords, findRecords, instinctProject, toHeldRecords, sessionSpawnEnv, getClaudeUsagePercent, checkUsage, CLAUDE_BIN, claudeArgs, interruptClaudeSessions, runClaude, spawnClaudeCaptured, runClaudeCaptured, planFilePath, ClaudePlannerError, ISSUE_TYPES, ISSUE_PRIORITIES, ISSUE_STATES, GITHUB_LABELS, createGhRunner, typeOfLabels, moduleOfLabels, createLocalTracker, PORT_VERSIONS, createAdapterRegistry, CORE_ADAPTER_REGISTRY, selectEffortStore };
@@ -177,6 +177,7 @@ import {
177
177
  readTextFlag,
178
178
  readTrees,
179
179
  ready_default,
180
+ recordPlanCi,
180
181
  refusal,
181
182
  refuseMisplacedRuntime,
182
183
  remainingFrom,
@@ -227,7 +228,7 @@ import {
227
228
  versionLine,
228
229
  waitForChecks,
229
230
  writeSession
230
- } from "./index-02fx0mzf.js";
231
+ } from "./index-pzpk59ma.js";
231
232
  import {
232
233
  PROBE_TIMEOUT_MS,
233
234
  findNextTask,
@@ -279,7 +280,7 @@ import {
279
280
  toHeldRecords,
280
281
  typeOfLabels,
281
282
  writeFrontmatter
282
- } from "./index-afersvp3.js";
283
+ } from "./index-am92b8qp.js";
283
284
  import {
284
285
  CONFIG_DEFAULTS,
285
286
  CONFIG_FILE,
@@ -7443,7 +7444,7 @@ var report_default = wrapPhaseZeroCommand({
7443
7444
  subject: "effort",
7444
7445
  action: "report",
7445
7446
  summary: "roll the stored session rows up per plan, then tally the task reports and list preflight halts",
7446
- description: "Rolls the session rows `rafa effort collect` stored up per plan, or per branch for a" + " session no plan claims, then tallies the stored task reports by plan, status and outcome, and" + " lists the runs whose preflight halted, one row per required item that failed. It" + " reads only what is stored, so two runs over an unchanged store print the same bytes. With" + " `--output=json` the report is the data of the terminal result event. An unrecognised argument" + " and a config the loop cannot run on are each refused, one line per problem.",
7447
+ description: "Rolls the session rows `rafa effort collect` stored up per plan, or per branch for a" + " session no plan claims, then tallies the stored task reports by plan, status and outcome, and" + " lists the runs whose preflight halted, one row per required item that failed. It" + " reads only what is stored, so two runs over an unchanged store print the same bytes. With" + " `--output=json` the report is the data of the terminal result event. With `--skills` it prints" + " the skills report instead: per plan, and per resolver within one, whether each offered skill and" + " injected lesson co-occurred with a recurrence of the failure it should prevent, read from the stored" + " rows and the skills' frontmatter, never from a session log. An unrecognised argument" + " and a config the loop cannot run on are each refused, one line per problem.",
7447
7448
  args: [],
7448
7449
  flags: [
7449
7450
  {
@@ -7456,6 +7457,16 @@ var report_default = wrapPhaseZeroCommand({
7456
7457
  description: "Keeps only the sessions whose dominant entrypoint is one of these, comma-separated." + " `sdk-cli` is the loop.",
7457
7458
  type: "string"
7458
7459
  },
7460
+ {
7461
+ name: "skills",
7462
+ description: "Prints the skills report in place of the session tables: per plan and per resolver," + " each skill's and lesson's signal, the skills invoked and never offered, M1, M2 and plan CI." + " Refused beside `--kind` or `--entrypoint`, which narrow session rows it does not read.",
7463
+ type: "boolean"
7464
+ },
7465
+ {
7466
+ name: "plan",
7467
+ description: "Keeps only these plan stubs in the skills report, comma-separated, and may be" + " repeated. A stub the store holds no row for reads as no plan. Refused without `--skills`.",
7468
+ type: "string"
7469
+ },
7459
7470
  {
7460
7471
  name: "json",
7461
7472
  description: "Deprecated: the phase 0 spelling of `--output=json`, read as that flag after one" + " deprecation line on stderr.",
@@ -7468,6 +7479,10 @@ var report_default = wrapPhaseZeroCommand({
7468
7479
  cmd: "rafa effort report",
7469
7480
  note: "Prints the per-plan tables, the task report tallies, then the preflight halts."
7470
7481
  },
7482
+ {
7483
+ cmd: "rafa effort report --skills --plan=rafa-24-know-which-skills-earn",
7484
+ note: "Prints one plan's skills and lessons with their signals, per resolver, under the fixed" + " co-occurrence line."
7485
+ },
7471
7486
  {
7472
7487
  cmd: "rafa effort report --entrypoint=sdk-cli --kind=task --output=json",
7473
7488
  note: "Writes a start event, then a result event whose data is the report of the task sessions" + " the loop ran."
@@ -11857,6 +11872,7 @@ function openPrContext(context, seams = DEFAULT_PR_SEAMS) {
11857
11872
  resolveBudget: config.prResolveBudget,
11858
11873
  trustedAuthors: config.boardTrustedAuthors,
11859
11874
  roadmapIssue: config.roadmapIssue,
11875
+ planDir: config.planDir,
11860
11876
  readBranch: () => readBranch2(project.root)
11861
11877
  };
11862
11878
  }
@@ -12960,6 +12976,15 @@ async function runMerge(context, seams) {
12960
12976
  throw lineRefusal3(`No pull request #${pick.number} at ${pr.project.root}`, USAGE26);
12961
12977
  }
12962
12978
  const checks = await onProvider(`read the checks of #${pick.number}`, () => pr.pulls.checks(pick.number));
12979
+ recordPlanCi({
12980
+ repoRoot: pr.project.root,
12981
+ planDir: pr.planDir,
12982
+ pullRequest: detail,
12983
+ rows: checks.rows,
12984
+ warn: (message) => {
12985
+ context.output.warn(message);
12986
+ }
12987
+ });
12963
12988
  refuseFromGit(git, detail, checks, skipChecks);
12964
12989
  const summary = summaryLine2(detail, method);
12965
12990
  const answer2 = await askToMerge(context, pr, seams, { number: detail.number, summary, yes, skipChecks });
@@ -15100,6 +15125,14 @@ async function assessOne(options) {
15100
15125
  const { git, maxAttempts, number, pr } = options;
15101
15126
  const detail = await detailOf6(pr, number);
15102
15127
  const checks = await onProvider(`read the checks of #${number}`, () => pr.pulls.checks(number));
15128
+ recordPlanCi({
15129
+ repoRoot: pr.project.root,
15130
+ planDir: pr.planDir,
15131
+ pullRequest: detail,
15132
+ rows: checks.rows,
15133
+ warn: options.warn,
15134
+ now: () => new Date(options.at)
15135
+ });
15103
15136
  const found = await triageCommentOf(options, detail);
15104
15137
  const existing = found.comment;
15105
15138
  const rerun = readTriageRerun({
@@ -15168,7 +15201,10 @@ async function runTriage(context, seams) {
15168
15201
  wantsComment,
15169
15202
  maxAttempts,
15170
15203
  at: now(),
15171
- permissions
15204
+ permissions,
15205
+ warn: (message) => {
15206
+ context.output.warn(message);
15207
+ }
15172
15208
  });
15173
15209
  const reading = await assess();
15174
15210
  if (!wantsResolve) {