@open-code-review/cli 1.10.0 → 1.10.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.
@@ -26322,7 +26322,7 @@ var FilesystemSync = class {
26322
26322
  }
26323
26323
  let phase = "context";
26324
26324
  let phaseNumber = 1;
26325
- let status = "active";
26325
+ let status = "closed";
26326
26326
  if (workflowType === "review" && hasRoundsDir) {
26327
26327
  const roundDir = join11(sessionDir, "rounds", `round-${currentRound}`);
26328
26328
  if (existsSync6(join11(roundDir, "final.md"))) {
@@ -26370,6 +26370,7 @@ var FilesystemSync = class {
26370
26370
  [currentRound, currentMapRun, sessionId]
26371
26371
  );
26372
26372
  } else {
26373
+ if (!this.hasArtifacts(sessionDir)) return;
26373
26374
  this.db.run(
26374
26375
  `INSERT INTO sessions (id, branch, workflow_type, current_phase, phase_number, current_round, current_map_run, session_dir, status)
26375
26376
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
@@ -26379,6 +26380,21 @@ var FilesystemSync = class {
26379
26380
  }
26380
26381
  this.onSync?.();
26381
26382
  }
26383
+ // ── Artifact Check ──
26384
+ /** Returns true if the directory contains at least one .md or .json file (recursively). */
26385
+ hasArtifacts(dir) {
26386
+ try {
26387
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
26388
+ if (entry.isDirectory()) {
26389
+ if (this.hasArtifacts(join11(dir, entry.name))) return true;
26390
+ } else if (/\.(md|json)$/.test(entry.name)) {
26391
+ return true;
26392
+ }
26393
+ }
26394
+ } catch {
26395
+ }
26396
+ return false;
26397
+ }
26382
26398
  // ── Mtime Skip Check ──
26383
26399
  shouldSkip(filePath, existingParsedAt) {
26384
26400
  if (!existingParsedAt) return false;
package/dist/index.js CHANGED
@@ -20894,7 +20894,7 @@ ${hint}
20894
20894
  }
20895
20895
 
20896
20896
  // src/lib/version.ts
20897
- var CLI_VERSION = true ? "1.10.0" : createRequire(import.meta.url)("../../package.json").version;
20897
+ var CLI_VERSION = true ? "1.10.1" : createRequire(import.meta.url)("../../package.json").version;
20898
20898
 
20899
20899
  // src/lib/deps.ts
20900
20900
  import { execFileSync } from "node:child_process";
@@ -24850,6 +24850,19 @@ import {
24850
24850
  writeFileSync as writeFileSync8
24851
24851
  } from "node:fs";
24852
24852
  import { join as join14 } from "node:path";
24853
+ function hasArtifacts(dir) {
24854
+ try {
24855
+ for (const entry of readdirSync6(dir, { withFileTypes: true })) {
24856
+ if (entry.isDirectory()) {
24857
+ if (hasArtifacts(join14(dir, entry.name))) return true;
24858
+ } else if (/\.(md|json)$/.test(entry.name)) {
24859
+ return true;
24860
+ }
24861
+ }
24862
+ } catch {
24863
+ }
24864
+ return false;
24865
+ }
24853
24866
  async function stateInit(params) {
24854
24867
  const { sessionId, branch, workflowType, sessionDir, ocrDir } = params;
24855
24868
  const db = await ensureDatabase(ocrDir);
@@ -25286,25 +25299,49 @@ async function stateSync(ocrDir) {
25286
25299
  if (existing) {
25287
25300
  continue;
25288
25301
  }
25302
+ if (!hasArtifacts(dirPath)) {
25303
+ continue;
25304
+ }
25289
25305
  const hasRoundsDir = existsSync12(join14(dirPath, "rounds"));
25290
25306
  const hasMapDir = existsSync12(join14(dirPath, "map"));
25291
25307
  const workflowType = hasMapDir && !hasRoundsDir ? "map" : "review";
25292
25308
  const branchMatch = dirName.match(/^\d{4}-\d{2}-\d{2}-(.+)$/);
25293
25309
  const branch = branchMatch?.[1] ?? dirName;
25310
+ let inferredPhase = "context";
25311
+ if (workflowType === "review") {
25312
+ const roundsDir = join14(dirPath, "rounds");
25313
+ if (existsSync12(roundsDir)) {
25314
+ const roundDirs = readdirSync6(roundsDir).filter((d) => /^round-\d+$/.test(d)).sort((a, b) => parseInt(a.replace(/^\D+-/, ""), 10) - parseInt(b.replace(/^\D+-/, ""), 10));
25315
+ const latestRound = roundDirs[roundDirs.length - 1];
25316
+ if (latestRound && existsSync12(join14(roundsDir, latestRound, "final.md"))) {
25317
+ inferredPhase = "complete";
25318
+ }
25319
+ }
25320
+ } else if (workflowType === "map") {
25321
+ const runsDir = join14(dirPath, "map", "runs");
25322
+ if (existsSync12(runsDir)) {
25323
+ const runDirs = readdirSync6(runsDir).filter((d) => /^run-\d+$/.test(d)).sort((a, b) => parseInt(a.replace(/^\D+-/, ""), 10) - parseInt(b.replace(/^\D+-/, ""), 10));
25324
+ const latestRun = runDirs[runDirs.length - 1];
25325
+ if (latestRun && existsSync12(join14(runsDir, latestRun, "map.md"))) {
25326
+ inferredPhase = "complete";
25327
+ }
25328
+ }
25329
+ }
25294
25330
  insertSession(db, {
25295
25331
  id: dirName,
25296
25332
  branch,
25297
25333
  workflow_type: workflowType,
25298
- current_phase: "context",
25334
+ current_phase: inferredPhase,
25299
25335
  phase_number: 1,
25300
25336
  current_round: 1,
25301
25337
  current_map_run: 1,
25302
25338
  session_dir: dirPath
25303
25339
  });
25340
+ updateSession(db, dirName, { status: "closed" });
25304
25341
  insertEvent(db, {
25305
25342
  session_id: dirName,
25306
25343
  event_type: "session_synced",
25307
- phase: "context",
25344
+ phase: inferredPhase,
25308
25345
  phase_number: 1,
25309
25346
  metadata: JSON.stringify({ source: "filesystem_backfill" })
25310
25347
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-code-review/cli",
3
- "version": "1.10.0",
3
+ "version": "1.10.1",
4
4
  "description": "CLI for Open Code Review - Multi-environment setup and progress tracking",
5
5
  "type": "module",
6
6
  "bin": {
@@ -50,7 +50,7 @@
50
50
  "ora": "^8.1.1",
51
51
  "socket.io": "^4.8",
52
52
  "sql.js": "^1.14.1",
53
- "@open-code-review/agents": "1.10.0"
53
+ "@open-code-review/agents": "1.10.1"
54
54
  },
55
55
  "publishConfig": {
56
56
  "access": "public"