@pourkit/cli 0.0.0-next-20260614182520 → 0.0.0-next-20260614201555

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/dist/cli.js CHANGED
@@ -353,13 +353,20 @@ import { pathToFileURL } from "url";
353
353
  import { Command, Option, CommanderError } from "commander";
354
354
 
355
355
  // shared/config.ts
356
- import { readFileSync } from "fs";
356
+ import { existsSync, readFileSync } from "fs";
357
357
  import { fileURLToPath } from "url";
358
358
  import { dirname, isAbsolute, join, normalize, sep, resolve } from "path";
359
359
  import Ajv from "ajv";
360
360
  var __filename = fileURLToPath(import.meta.url);
361
361
  var __dirname = dirname(__filename);
362
- var SCHEMA_PATH = resolve(__dirname, "../schema/pourkit.schema.json");
362
+ function resolvePackagedAssetPath(fileName) {
363
+ const candidates = [
364
+ resolve(__dirname, "schema", fileName),
365
+ resolve(__dirname, "../schema", fileName)
366
+ ];
367
+ return candidates.find((candidate) => existsSync(candidate)) ?? candidates[0];
368
+ }
369
+ var SCHEMA_PATH = resolvePackagedAssetPath("pourkit.schema.json");
363
370
  var _schema = null;
364
371
  var _validate = null;
365
372
  var _ajvErrors = null;
@@ -882,11 +889,11 @@ var OBSOLETE_CONFIG_PATHS = [
882
889
  ];
883
890
  var CANONICAL_CONFIG_PATH = ".pourkit/config.json";
884
891
  async function loadRepoConfig(repoRoot2, _configFileName) {
885
- const { existsSync: existsSync19 } = await import("fs");
892
+ const { existsSync: existsSync20 } = await import("fs");
886
893
  const { join: pjoin } = await import("path");
887
894
  for (const obPath of OBSOLETE_CONFIG_PATHS) {
888
895
  const fullPath = pjoin(repoRoot2, obPath);
889
- if (existsSync19(fullPath)) {
896
+ if (existsSync20(fullPath)) {
890
897
  const isRootJson = obPath === "pourkit.json";
891
898
  throw new Error(
892
899
  isRootJson ? `Found root ${obPath}, but Pourkit config now lives at ${CANONICAL_CONFIG_PATH}. Move the file and update "$schema" to "./schema/pourkit.schema.json".` : `Found ${obPath}, but executable config is no longer supported. Move configuration to ${CANONICAL_CONFIG_PATH} with "$schema": "./schema/pourkit.schema.json".`
@@ -894,7 +901,7 @@ async function loadRepoConfig(repoRoot2, _configFileName) {
894
901
  }
895
902
  }
896
903
  const configPath = pjoin(repoRoot2, CANONICAL_CONFIG_PATH);
897
- if (!existsSync19(configPath)) {
904
+ if (!existsSync20(configPath)) {
898
905
  throw new Error(
899
906
  `No Pourkit config found at ${CANONICAL_CONFIG_PATH}. Run pourkit init or create ${CANONICAL_CONFIG_PATH} with "$schema": "./schema/pourkit.schema.json".`
900
907
  );
@@ -947,12 +954,12 @@ function resolveTarget(config, explicitTarget) {
947
954
  init_common();
948
955
 
949
956
  // shared/worktree-run-state.ts
950
- import { existsSync, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync } from "fs";
957
+ import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync } from "fs";
951
958
  import { dirname as dirname2, join as join2 } from "path";
952
959
  var WORKTREE_RUN_STATE_PATH = ".pourkit/state.json";
953
960
  function readWorktreeRunState(worktreePath) {
954
961
  const statePath = join2(worktreePath, WORKTREE_RUN_STATE_PATH);
955
- if (!existsSync(statePath)) {
962
+ if (!existsSync2(statePath)) {
956
963
  return null;
957
964
  }
958
965
  try {
@@ -1124,7 +1131,7 @@ async function cleanupRepository(options) {
1124
1131
  // commands/artifact-validation.ts
1125
1132
  import { createHash } from "crypto";
1126
1133
  import { execSync } from "child_process";
1127
- import { existsSync as existsSync6, readdirSync as readdirSync3, readFileSync as readFileSync7 } from "fs";
1134
+ import { existsSync as existsSync7, readdirSync as readdirSync3, readFileSync as readFileSync7 } from "fs";
1128
1135
  import { isAbsolute as isAbsolute3, join as join7, resolve as resolve3 } from "path";
1129
1136
 
1130
1137
  // pr/review-verdict.ts
@@ -1158,7 +1165,7 @@ function parseReviewVerdict(output) {
1158
1165
 
1159
1166
  // commands/review.ts
1160
1167
  import {
1161
- existsSync as existsSync5,
1168
+ existsSync as existsSync6,
1162
1169
  mkdirSync as mkdirSync5,
1163
1170
  readFileSync as readFileSync6,
1164
1171
  readdirSync as readdirSync2,
@@ -1167,7 +1174,7 @@ import {
1167
1174
  import { join as join6 } from "path";
1168
1175
 
1169
1176
  // execution/agent-output-retry.ts
1170
- import { existsSync as existsSync2, mkdirSync as mkdirSync3, readFileSync as readFileSync3, rmSync } from "fs";
1177
+ import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync3, rmSync } from "fs";
1171
1178
  import { dirname as dirname3, join as join4 } from "path";
1172
1179
  async function executeWithMissingOrEmptyArtifactRetry({
1173
1180
  executionProvider,
@@ -1225,7 +1232,7 @@ async function executeWithMissingOrEmptyArtifactRetry({
1225
1232
  };
1226
1233
  }
1227
1234
  function readArtifactOutput(artifactPath) {
1228
- if (!existsSync2(artifactPath)) {
1235
+ if (!existsSync3(artifactPath)) {
1229
1236
  return { _tag: "missing", path: artifactPath };
1230
1237
  }
1231
1238
  const output = readFileSync3(artifactPath, "utf-8");
@@ -1240,7 +1247,7 @@ function prepareArtifactPath(artifactPath) {
1240
1247
  }
1241
1248
 
1242
1249
  // shared/run-context.ts
1243
- import { existsSync as existsSync3, readFileSync as readFileSync4, readdirSync } from "fs";
1250
+ import { existsSync as existsSync4, readFileSync as readFileSync4, readdirSync } from "fs";
1244
1251
  import { isAbsolute as isAbsolute2, join as join5, relative, resolve as resolve2 } from "path";
1245
1252
 
1246
1253
  // commands/run-verification.ts
@@ -1535,7 +1542,7 @@ function renderPrdContext(issue, parentPrdIssue, repoRoot2) {
1535
1542
  }
1536
1543
  for (const documentPath of documentPaths) {
1537
1544
  const absolutePath = resolveRepoPath(repoRoot2, documentPath);
1538
- if (!absolutePath || !existsSync3(absolutePath)) continue;
1545
+ if (!absolutePath || !existsSync4(absolutePath)) continue;
1539
1546
  parts.push(
1540
1547
  `### Document Content: \`${documentPath}\``,
1541
1548
  "",
@@ -1573,7 +1580,7 @@ function resolveRepoPath(repoRoot2, path9) {
1573
1580
  }
1574
1581
  function findParentPrdPath(repoRoot2, parentRef) {
1575
1582
  const plansRoot = join5(repoRoot2, ".pourkit", "plans");
1576
- if (!existsSync3(plansRoot)) return null;
1583
+ if (!existsSync4(plansRoot)) return null;
1577
1584
  return findPrdInPlans(plansRoot, parentRef);
1578
1585
  }
1579
1586
  function findPrdInPlans(directory, parentRef) {
@@ -1583,7 +1590,7 @@ function findPrdInPlans(directory, parentRef) {
1583
1590
  const prdNumber = parentRef.match(/^PRD-(\d+)$/)?.[1];
1584
1591
  if (entry.name.startsWith(parentRef) || prdNumber && entry.name.startsWith(`${prdNumber}-`)) {
1585
1592
  const prdPath = join5(entryPath, "PRD.md");
1586
- if (existsSync3(prdPath)) return prdPath;
1593
+ if (existsSync4(prdPath)) return prdPath;
1587
1594
  }
1588
1595
  const nested = findPrdInPlans(entryPath, parentRef);
1589
1596
  if (nested) return nested;
@@ -1617,7 +1624,7 @@ function appendProtectedWorkGuidance(promptBody) {
1617
1624
 
1618
1625
  // shared/effect-services.ts
1619
1626
  import { Context, Effect, Layer } from "effect";
1620
- import { existsSync as existsSync4, mkdirSync as mkdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync2, rmSync as rmSync2 } from "fs";
1627
+ import { existsSync as existsSync5, mkdirSync as mkdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync2, rmSync as rmSync2 } from "fs";
1621
1628
  var GitExecutionError = class extends Error {
1622
1629
  _tag = "GitExecutionError";
1623
1630
  message;
@@ -1645,7 +1652,7 @@ var FileSystemDefault = Layer.succeed(
1645
1652
  )
1646
1653
  }),
1647
1654
  exists: (path9) => Effect.try({
1648
- try: () => existsSync4(path9),
1655
+ try: () => existsSync5(path9),
1649
1656
  catch: (error) => new Error(
1650
1657
  `Failed to check existence of ${path9}: ${error instanceof Error ? error.message : String(error)}`
1651
1658
  )
@@ -2029,7 +2036,7 @@ function extractLatestFindingIds(reviewOutput, iteration) {
2029
2036
  return ids;
2030
2037
  }
2031
2038
  function validateRefactorArtifact(artifactPath, findingIds) {
2032
- if (!existsSync5(artifactPath)) {
2039
+ if (!existsSync6(artifactPath)) {
2033
2040
  throw new RefactorArtifactValidationError(
2034
2041
  `Refactor artifact missing at ${artifactPath}`
2035
2042
  );
@@ -2520,14 +2527,14 @@ function recoverReviewOutputFromString(logContent) {
2520
2527
  return recoveredOutput.length > 0 ? recoveredOutput : null;
2521
2528
  }
2522
2529
  function recoverReviewOutputFromLog(logPath) {
2523
- if (!existsSync5(logPath)) {
2530
+ if (!existsSync6(logPath)) {
2524
2531
  return null;
2525
2532
  }
2526
2533
  const logContent = readFileSync6(logPath, "utf-8");
2527
2534
  return recoverReviewOutputFromString(logContent);
2528
2535
  }
2529
2536
  function readReviewArtifact(artifactPath, logPath) {
2530
- if (existsSync5(artifactPath)) {
2537
+ if (existsSync6(artifactPath)) {
2531
2538
  const output = readFileSync6(artifactPath, "utf-8");
2532
2539
  if (output.trim()) {
2533
2540
  return output;
@@ -2538,7 +2545,7 @@ function readReviewArtifact(artifactPath, logPath) {
2538
2545
  writeFileSync3(artifactPath, recoveredOutput, "utf-8");
2539
2546
  return recoveredOutput;
2540
2547
  }
2541
- if (!existsSync5(artifactPath)) {
2548
+ if (!existsSync6(artifactPath)) {
2542
2549
  throw new Error(`Reviewer did not produce output at ${artifactPath}`);
2543
2550
  }
2544
2551
  throw new Error(`Reviewer produced empty output at ${artifactPath}`);
@@ -3197,7 +3204,7 @@ function valid(options, diagnostics = []) {
3197
3204
  };
3198
3205
  }
3199
3206
  function readArtifact(options) {
3200
- if (!existsSync6(options.artifactPath)) {
3207
+ if (!existsSync7(options.artifactPath)) {
3201
3208
  return {
3202
3209
  ok: false,
3203
3210
  result: invalid(options, `Artifact missing at ${options.artifactPath}`)
@@ -4235,7 +4242,7 @@ function validateLocalTriage(prdPath, issuePaths) {
4235
4242
  }
4236
4243
 
4237
4244
  // commands/issue-run.ts
4238
- import { existsSync as existsSync11, readFileSync as readFileSync14 } from "fs";
4245
+ import { existsSync as existsSync12, readFileSync as readFileSync14 } from "fs";
4239
4246
  import { isAbsolute as isAbsolute4, join as join15 } from "path";
4240
4247
 
4241
4248
  // pr/templates.ts
@@ -4371,7 +4378,7 @@ function runEffectAndMapExit(program) {
4371
4378
  }
4372
4379
 
4373
4380
  // shared/attempt-log.ts
4374
- import { appendFileSync, existsSync as existsSync7, mkdirSync as mkdirSync6, readFileSync as readFileSync8 } from "fs";
4381
+ import { appendFileSync, existsSync as existsSync8, mkdirSync as mkdirSync6, readFileSync as readFileSync8 } from "fs";
4375
4382
  import { dirname as dirname4, join as join8 } from "path";
4376
4383
  var ATTEMPT_LOG_PATH = ".pourkit/attempt-log.jsonl";
4377
4384
  function writeAttemptLog(worktreePath, entry) {
@@ -4381,7 +4388,7 @@ function writeAttemptLog(worktreePath, entry) {
4381
4388
  }
4382
4389
  function readAttemptLog(worktreePath) {
4383
4390
  const logPath = join8(worktreePath, ATTEMPT_LOG_PATH);
4384
- if (!existsSync7(logPath)) {
4391
+ if (!existsSync8(logPath)) {
4385
4392
  return [];
4386
4393
  }
4387
4394
  const raw = readFileSync8(logPath, "utf-8");
@@ -4503,7 +4510,7 @@ async function runBaseRefreshAttempt(options) {
4503
4510
  }
4504
4511
 
4505
4512
  // commands/conflict-resolution.ts
4506
- import { existsSync as existsSync8, readFileSync as readFileSync9 } from "fs";
4513
+ import { existsSync as existsSync9, readFileSync as readFileSync9 } from "fs";
4507
4514
  import { join as join9 } from "path";
4508
4515
  init_common();
4509
4516
  var CONFLICT_MARKER_PATTERN2 = /<<<<<<<|=======|>>>>>>>/m;
@@ -5412,7 +5419,7 @@ function persistGeneratedArtifactEffect(worktreePath, output, fs) {
5412
5419
 
5413
5420
  // prd-run/local-merge-coordinator.ts
5414
5421
  import { execFileSync as execFileSync2 } from "child_process";
5415
- import { existsSync as existsSync9, mkdirSync as mkdirSync7, readFileSync as readFileSync12, writeFileSync as writeFileSync4 } from "fs";
5422
+ import { existsSync as existsSync10, mkdirSync as mkdirSync7, readFileSync as readFileSync12, writeFileSync as writeFileSync4 } from "fs";
5416
5423
  import { join as join13 } from "path";
5417
5424
 
5418
5425
  // prd-run/local-branches.ts
@@ -5513,7 +5520,7 @@ function getIssueArtifactPath(repoRoot2, prdId, issueId) {
5513
5520
  }
5514
5521
  function readIssueBranchName(repoRoot2, prdId, issueId) {
5515
5522
  const issuePath = getIssueArtifactPath(repoRoot2, prdId, issueId);
5516
- if (!existsSync9(issuePath)) return null;
5523
+ if (!existsSync10(issuePath)) return null;
5517
5524
  try {
5518
5525
  const content = readFileSync12(issuePath, "utf-8");
5519
5526
  const parsed = JSON.parse(content);
@@ -5525,7 +5532,7 @@ function readIssueBranchName(repoRoot2, prdId, issueId) {
5525
5532
  async function hasLocalIssueMergeReceipt(prdId, issueId, repoRoot2) {
5526
5533
  const root = repoRoot2 ?? process.cwd();
5527
5534
  const receiptPath = getMergeReceiptPath(root, prdId, issueId);
5528
- if (!existsSync9(receiptPath)) return null;
5535
+ if (!existsSync10(receiptPath)) return null;
5529
5536
  try {
5530
5537
  const content = readFileSync12(receiptPath, "utf-8");
5531
5538
  const parsed = JSON.parse(content);
@@ -5540,7 +5547,7 @@ async function hasLocalIssueMergeReceipt(prdId, issueId, repoRoot2) {
5540
5547
  async function squashMergeLocalIssue(prdId, issueId, input, repoRoot2) {
5541
5548
  const root = repoRoot2 ?? process.cwd();
5542
5549
  const receiptPath = getMergeReceiptPath(root, prdId, issueId);
5543
- if (existsSync9(receiptPath)) {
5550
+ if (existsSync10(receiptPath)) {
5544
5551
  try {
5545
5552
  const existing = JSON.parse(
5546
5553
  readFileSync12(receiptPath, "utf-8")
@@ -5952,7 +5959,7 @@ function runMergeCoordinator(options) {
5952
5959
  }
5953
5960
 
5954
5961
  // commands/issue-final-review-agent.ts
5955
- import { existsSync as existsSync10, readFileSync as readFileSync13 } from "fs";
5962
+ import { existsSync as existsSync11, readFileSync as readFileSync13 } from "fs";
5956
5963
  import { join as join14 } from "path";
5957
5964
  var ISSUE_FINAL_REVIEW_ARTIFACT_PATH = join14(
5958
5965
  ".pourkit",
@@ -6066,7 +6073,7 @@ async function runIssueFinalReviewAgent(options) {
6066
6073
  }
6067
6074
  function loadIssueFinalReviewPrompt(repoRoot2, promptTemplate) {
6068
6075
  const promptPath = resolvePromptTemplatePath(repoRoot2, promptTemplate);
6069
- const promptBody = existsSync10(promptPath) ? readFileSync13(promptPath, "utf-8") : promptTemplate;
6076
+ const promptBody = existsSync11(promptPath) ? readFileSync13(promptPath, "utf-8") : promptTemplate;
6070
6077
  return appendProtectedWorkGuidance(`${promptBody}
6071
6078
 
6072
6079
  ## Shared Run Context
@@ -6683,7 +6690,7 @@ async function completeIssueRun(options) {
6683
6690
  prTitle = finalizerFromState.title;
6684
6691
  prBody = finalizerFromState.body;
6685
6692
  } else if (finalizerFromState.artifactPath) {
6686
- if (!existsSync11(finalizerFromState.artifactPath)) {
6693
+ if (!existsSync12(finalizerFromState.artifactPath)) {
6687
6694
  throw new FinalizerFailure({
6688
6695
  message: `Finalizer artifact missing at ${finalizerFromState.artifactPath}`
6689
6696
  });
@@ -7402,7 +7409,7 @@ async function syncTargetBranch(root, baseBranch, logger) {
7402
7409
  }
7403
7410
  function loadBuilderPrompt(repoRoot2, promptTemplate) {
7404
7411
  const promptPath = resolvePromptTemplatePath(repoRoot2, promptTemplate);
7405
- const promptBody = existsSync11(promptPath) ? readFileSync14(promptPath, "utf-8") : promptTemplate;
7412
+ const promptBody = existsSync12(promptPath) ? readFileSync14(promptPath, "utf-8") : promptTemplate;
7406
7413
  return appendProtectedWorkGuidance(`${promptBody}
7407
7414
 
7408
7415
  ## Shared Run Context
@@ -7893,14 +7900,14 @@ async function runIssueCreateCommand(args, issueProvider, logger) {
7893
7900
  }
7894
7901
 
7895
7902
  // commands/prd-run.ts
7896
- import { existsSync as existsSync15, lstatSync, readFileSync as readFileSync18, realpathSync } from "fs";
7903
+ import { existsSync as existsSync16, lstatSync, readFileSync as readFileSync18, realpathSync } from "fs";
7897
7904
  import { spawnSync as spawnSync3 } from "child_process";
7898
7905
  import { join as join19, relative as relative2 } from "path";
7899
7906
  import { Match, pipe } from "effect";
7900
7907
 
7901
7908
  // prd-run/state.ts
7902
7909
  import {
7903
- existsSync as existsSync12,
7910
+ existsSync as existsSync13,
7904
7911
  mkdirSync as mkdirSync8,
7905
7912
  readFileSync as readFileSync15,
7906
7913
  readdirSync as readdirSync4,
@@ -7998,7 +8005,7 @@ function normalizePrdRunRef(ref) {
7998
8005
  function readPrdRun(repoRoot2, prdRef) {
7999
8006
  const normalized = normalizePrdRunRef(prdRef);
8000
8007
  const recordPath = getRecordPath(repoRoot2, normalized);
8001
- if (!existsSync12(recordPath)) {
8008
+ if (!existsSync13(recordPath)) {
8002
8009
  return { record: null, diagnostics: [] };
8003
8010
  }
8004
8011
  try {
@@ -8029,7 +8036,7 @@ function readPrdRun(repoRoot2, prdRef) {
8029
8036
  }
8030
8037
  function listPrdRuns(repoRoot2) {
8031
8038
  const stateDir = join16(repoRoot2, PRD_RUN_STATE_DIR);
8032
- if (!existsSync12(stateDir)) {
8039
+ if (!existsSync13(stateDir)) {
8033
8040
  return { records: [], diagnostics: [] };
8034
8041
  }
8035
8042
  const records = [];
@@ -8121,7 +8128,7 @@ import { readFileSync as readFileSync16, writeFileSync as writeFileSync6 } from
8121
8128
  import { join as join18 } from "path";
8122
8129
 
8123
8130
  // prd-run/local-artifacts.ts
8124
- import { existsSync as existsSync13 } from "fs";
8131
+ import { existsSync as existsSync14 } from "fs";
8125
8132
  import { join as join17 } from "path";
8126
8133
  var REQUIRED_PRD_FIELDS = [
8127
8134
  "schemaVersion",
@@ -8174,7 +8181,7 @@ function hasRequiredFields(data, requiredFields) {
8174
8181
  async function resolveLocalPrdArtifact(prdId, repoRoot2) {
8175
8182
  const root = repoRoot2 ?? process.cwd();
8176
8183
  const prdPath = prdArtifactPath(root, prdId);
8177
- if (!existsSync13(prdPath)) {
8184
+ if (!existsSync14(prdPath)) {
8178
8185
  return {
8179
8186
  ok: false,
8180
8187
  failureCode: "missing_prd_artifact",
@@ -8219,7 +8226,7 @@ async function resolveLocalIssueArtifacts(prdId, repoRoot2) {
8219
8226
  const issues = [];
8220
8227
  for (const childId of childIssueIds) {
8221
8228
  const issuePath = issueArtifactPath(root, prdId, childId);
8222
- if (!existsSync13(issuePath)) {
8229
+ if (!existsSync14(issuePath)) {
8223
8230
  return {
8224
8231
  ok: false,
8225
8232
  failureCode: "missing_child_issue",
@@ -9130,7 +9137,7 @@ async function runQueueCommand(options) {
9130
9137
  }
9131
9138
 
9132
9139
  // prd-run/final-review-validation.ts
9133
- import { existsSync as existsSync14, readFileSync as readFileSync17 } from "fs";
9140
+ import { existsSync as existsSync15, readFileSync as readFileSync17 } from "fs";
9134
9141
 
9135
9142
  // commands/prd-run.ts
9136
9143
  function planLaunchResume(record) {
@@ -9195,7 +9202,7 @@ function planLaunchResume(record) {
9195
9202
  function validateLocalStartStore(repoRoot2, prdRef) {
9196
9203
  const localStoreDir = join19(repoRoot2, ".pourkit", "local-prd-runs", prdRef);
9197
9204
  let localStoreReady = false;
9198
- if (existsSync15(localStoreDir)) {
9205
+ if (existsSync16(localStoreDir)) {
9199
9206
  const localStorePath = join19(localStoreDir, "prd.json");
9200
9207
  try {
9201
9208
  const content = JSON.parse(readFileSync18(localStorePath, "utf8"));
@@ -9204,7 +9211,7 @@ function validateLocalStartStore(repoRoot2, prdRef) {
9204
9211
  localStoreReady = false;
9205
9212
  }
9206
9213
  }
9207
- if (existsSync15(localStoreDir) && !localStoreReady) {
9214
+ if (existsSync16(localStoreDir) && !localStoreReady) {
9208
9215
  return {
9209
9216
  ok: false,
9210
9217
  gate: "branch-state",
@@ -9374,7 +9381,7 @@ async function runPrdRunLaunchCommand(options) {
9374
9381
  "local-prd-runs",
9375
9382
  prdRef
9376
9383
  );
9377
- if (existsSync15(localStorePath)) {
9384
+ if (existsSync16(localStorePath)) {
9378
9385
  writePrdRunRecord(options.repoRoot, {
9379
9386
  prdRef,
9380
9387
  status: "completed_local_branch",
@@ -9886,7 +9893,7 @@ async function processStartResult(startResult, options) {
9886
9893
  mode: modeForRecord
9887
9894
  });
9888
9895
  const localStorePath = join19(repoRoot2, ".pourkit", "local-prd-runs", prdRef);
9889
- if (existsSync15(localStorePath)) {
9896
+ if (existsSync16(localStorePath)) {
9890
9897
  const queueResult = await runLocalQueueLoop(
9891
9898
  prdRef,
9892
9899
  repoRoot2,
@@ -10774,7 +10781,7 @@ async function runPrMergeCommand(args, logger, prProvider, config) {
10774
10781
  }
10775
10782
 
10776
10783
  // commands/init.ts
10777
- import { existsSync as existsSync16, statSync } from "fs";
10784
+ import { existsSync as existsSync17, statSync } from "fs";
10778
10785
  import {
10779
10786
  copyFile,
10780
10787
  mkdir as mkdir5,
@@ -11262,7 +11269,7 @@ async function computeFileChecksum(filePath) {
11262
11269
  return createHash2("sha256").update(content).digest("hex");
11263
11270
  }
11264
11271
  function lockfileExists(root, name) {
11265
- return existsSync16(path5.join(root, name));
11272
+ return existsSync17(path5.join(root, name));
11266
11273
  }
11267
11274
  function detectPackageManager(root) {
11268
11275
  if (lockfileExists(root, "pnpm-lock.yaml")) return "pnpm";
@@ -11306,7 +11313,7 @@ async function discoverLocalSource(sourcePath) {
11306
11313
  async function discoverReadme(root) {
11307
11314
  for (const name of ["README.md", "readme.md"]) {
11308
11315
  const p = path5.join(root, name);
11309
- if (existsSync16(p)) {
11316
+ if (existsSync17(p)) {
11310
11317
  return p;
11311
11318
  }
11312
11319
  }
@@ -11316,7 +11323,7 @@ async function discoverAgentFiles(root) {
11316
11323
  const files = [];
11317
11324
  for (const name of ["AGENTS.md", "CLAUDE.md"]) {
11318
11325
  const p = path5.join(root, name);
11319
- if (existsSync16(p)) {
11326
+ if (existsSync17(p)) {
11320
11327
  files.push(p);
11321
11328
  }
11322
11329
  }
@@ -11324,7 +11331,7 @@ async function discoverAgentFiles(root) {
11324
11331
  }
11325
11332
  async function discoverMerlleState(root) {
11326
11333
  const p = path5.join(root, ".pourkit", "state.json");
11327
- return existsSync16(p) ? p : null;
11334
+ return existsSync17(p) ? p : null;
11328
11335
  }
11329
11336
  async function discoverAgentSkills(root) {
11330
11337
  const dirs = [
@@ -11333,7 +11340,7 @@ async function discoverAgentSkills(root) {
11333
11340
  ];
11334
11341
  const found = [];
11335
11342
  for (const d of dirs) {
11336
- if (existsSync16(d)) {
11343
+ if (existsSync17(d)) {
11337
11344
  found.push(d);
11338
11345
  }
11339
11346
  }
@@ -11343,12 +11350,12 @@ async function discoverRootDomainDocs(root) {
11343
11350
  const docs = [];
11344
11351
  for (const name of ["CONTEXT.md", "CONTEXT-MAP.md"]) {
11345
11352
  const p = path5.join(root, name);
11346
- if (existsSync16(p)) {
11353
+ if (existsSync17(p)) {
11347
11354
  docs.push(p);
11348
11355
  }
11349
11356
  }
11350
11357
  const adrDir = path5.join(root, "docs", "adr");
11351
- if (existsSync16(adrDir)) {
11358
+ if (existsSync17(adrDir)) {
11352
11359
  const entries = await readdir(adrDir, { withFileTypes: true });
11353
11360
  for (const entry of entries) {
11354
11361
  if (entry.isFile() && entry.name.endsWith(".md")) {
@@ -11491,7 +11498,7 @@ async function planInit(options) {
11491
11498
  for (const file of skillFiles) {
11492
11499
  const relPath = path5.relative(s, file);
11493
11500
  const destPath = path5.join(targetRoot, ".agents", "skills", relPath);
11494
- if (!existsSync16(destPath)) {
11501
+ if (!existsSync17(destPath)) {
11495
11502
  operations.push({
11496
11503
  kind: "copy",
11497
11504
  sourcePath: file,
@@ -11554,7 +11561,7 @@ async function planInit(options) {
11554
11561
  });
11555
11562
  }
11556
11563
  if (sourceRoot) {
11557
- if (!existsSync16(sourceRoot) || !statSync(sourceRoot).isDirectory()) {
11564
+ if (!existsSync17(sourceRoot) || !statSync(sourceRoot).isDirectory()) {
11558
11565
  warnings.push(
11559
11566
  `--from-local path does not exist or is not a directory: ${sourceRoot}`
11560
11567
  );
@@ -11673,7 +11680,7 @@ async function planInit(options) {
11673
11680
  requiresConfirmation: false,
11674
11681
  destructive: false
11675
11682
  });
11676
- } else if (existsSync16(destPath)) {
11683
+ } else if (existsSync17(destPath)) {
11677
11684
  operations.push({
11678
11685
  kind: "skip",
11679
11686
  path: destPath,
@@ -11731,7 +11738,7 @@ async function planInit(options) {
11731
11738
  }
11732
11739
  }
11733
11740
  const contextPath = path5.join(targetRoot, ".pourkit", "CONTEXT.md");
11734
- if (!existsSync16(contextPath) && !merleDestPaths.has(contextPath)) {
11741
+ if (!existsSync17(contextPath) && !merleDestPaths.has(contextPath)) {
11735
11742
  operations.push({
11736
11743
  kind: "create",
11737
11744
  path: contextPath,
@@ -11749,7 +11756,7 @@ async function planInit(options) {
11749
11756
  "adr",
11750
11757
  ".gitkeep"
11751
11758
  );
11752
- if (!existsSync16(adrGitkeep)) {
11759
+ if (!existsSync17(adrGitkeep)) {
11753
11760
  operations.push({
11754
11761
  kind: "create",
11755
11762
  path: adrGitkeep,
@@ -11761,7 +11768,7 @@ async function planInit(options) {
11761
11768
  }
11762
11769
  const srcDocAgents = path5.join(sourceRoot, ".pourkit", "docs", "agents");
11763
11770
  const tgtDocAgents = path5.join(targetRoot, ".pourkit", "docs", "agents");
11764
- if (existsSync16(srcDocAgents) && !existsSync16(tgtDocAgents)) {
11771
+ if (existsSync17(srcDocAgents) && !existsSync17(tgtDocAgents)) {
11765
11772
  const docFiles = await walkDir(srcDocAgents);
11766
11773
  for (const file of docFiles) {
11767
11774
  const relPath = path5.relative(srcDocAgents, file);
@@ -11794,7 +11801,7 @@ async function planInit(options) {
11794
11801
  }
11795
11802
  const srcPrompts = path5.join(sourceRoot, ".pourkit", "prompts");
11796
11803
  const tgtPrompts = path5.join(targetRoot, ".pourkit", "prompts");
11797
- if (existsSync16(srcPrompts) && !existsSync16(tgtPrompts)) {
11804
+ if (existsSync17(srcPrompts) && !existsSync17(tgtPrompts)) {
11798
11805
  const promptFiles = await walkDir(srcPrompts);
11799
11806
  for (const file of promptFiles) {
11800
11807
  const relPath = path5.relative(srcPrompts, file);
@@ -11821,7 +11828,7 @@ async function planInit(options) {
11821
11828
  ".sandcastle",
11822
11829
  "Dockerfile"
11823
11830
  );
11824
- if (existsSync16(tgtSandboxDockerfile)) {
11831
+ if (existsSync17(tgtSandboxDockerfile)) {
11825
11832
  operations.push({
11826
11833
  kind: "skip",
11827
11834
  path: tgtSandboxDockerfile,
@@ -11830,7 +11837,7 @@ async function planInit(options) {
11830
11837
  requiresConfirmation: false,
11831
11838
  destructive: false
11832
11839
  });
11833
- } else if (existsSync16(srcSandboxDockerfile)) {
11840
+ } else if (existsSync17(srcSandboxDockerfile)) {
11834
11841
  const checksum = await computeFileChecksum(srcSandboxDockerfile);
11835
11842
  operations.push({
11836
11843
  kind: "copy",
@@ -11844,7 +11851,7 @@ async function planInit(options) {
11844
11851
  });
11845
11852
  }
11846
11853
  const configJsonPath = path5.join(targetRoot, ".pourkit", "config.json");
11847
- if (!existsSync16(configJsonPath)) {
11854
+ if (!existsSync17(configJsonPath)) {
11848
11855
  const verifyCommands = inferVerificationCommands(
11849
11856
  packageScripts,
11850
11857
  pm || "npm"
@@ -11887,9 +11894,9 @@ async function planInit(options) {
11887
11894
  "schema",
11888
11895
  "pourkit.schema.json"
11889
11896
  );
11890
- if (existsSync16(srcSchemaJson)) {
11897
+ if (existsSync17(srcSchemaJson)) {
11891
11898
  const checksum = await computeFileChecksum(srcSchemaJson);
11892
- if (!existsSync16(schemaJsonPath)) {
11899
+ if (!existsSync17(schemaJsonPath)) {
11893
11900
  operations.push({
11894
11901
  kind: "copy",
11895
11902
  sourcePath: srcSchemaJson,
@@ -11923,9 +11930,9 @@ async function planInit(options) {
11923
11930
  "schema",
11924
11931
  "pourkit.schema.hash"
11925
11932
  );
11926
- if (existsSync16(srcSchemaHash)) {
11933
+ if (existsSync17(srcSchemaHash)) {
11927
11934
  const checksum = await computeFileChecksum(srcSchemaHash);
11928
- if (!existsSync16(schemaHashPath)) {
11935
+ if (!existsSync17(schemaHashPath)) {
11929
11936
  operations.push({
11930
11937
  kind: "copy",
11931
11938
  sourcePath: srcSchemaHash,
@@ -11951,7 +11958,7 @@ async function planInit(options) {
11951
11958
  const hasExistingAgents = operations.some(
11952
11959
  (op) => (op.kind === "skip" || op.kind === "update") && op.path?.endsWith("AGENTS.md")
11953
11960
  );
11954
- if ((agentFileMode === "agents" || agentFileMode === "both") && !hasExistingAgents && !existsSync16(path5.join(targetRoot, "AGENTS.md"))) {
11961
+ if ((agentFileMode === "agents" || agentFileMode === "both") && !hasExistingAgents && !existsSync17(path5.join(targetRoot, "AGENTS.md"))) {
11955
11962
  operations.push({
11956
11963
  kind: "create",
11957
11964
  path: path5.join(targetRoot, "AGENTS.md"),
@@ -11967,7 +11974,7 @@ ${managedAgentContent}${MANAGED_BLOCK_END}
11967
11974
  const hasExistingClaude = operations.some(
11968
11975
  (op) => (op.kind === "skip" || op.kind === "update") && op.path?.endsWith("CLAUDE.md")
11969
11976
  );
11970
- if ((agentFileMode === "claude" || agentFileMode === "both") && !hasExistingClaude && !existsSync16(path5.join(targetRoot, "CLAUDE.md"))) {
11977
+ if ((agentFileMode === "claude" || agentFileMode === "both") && !hasExistingClaude && !existsSync17(path5.join(targetRoot, "CLAUDE.md"))) {
11971
11978
  operations.push({
11972
11979
  kind: "create",
11973
11980
  path: path5.join(targetRoot, "CLAUDE.md"),
@@ -11982,7 +11989,7 @@ ${managedAgentContent}${MANAGED_BLOCK_END}
11982
11989
  }
11983
11990
  const gitignoreTarget = path5.join(targetRoot, ".gitignore");
11984
11991
  const gitignoreContent = generateGitignoreBlock();
11985
- if (!existsSync16(gitignoreTarget)) {
11992
+ if (!existsSync17(gitignoreTarget)) {
11986
11993
  operations.push({
11987
11994
  kind: "create",
11988
11995
  path: gitignoreTarget,
@@ -12006,7 +12013,7 @@ ${gitignoreContent}${MANAGED_BLOCK_END}
12006
12013
  });
12007
12014
  }
12008
12015
  const openCodePath = path5.join(targetRoot, "opencode.json");
12009
- if (!existsSync16(openCodePath)) {
12016
+ if (!existsSync17(openCodePath)) {
12010
12017
  operations.push({
12011
12018
  kind: "create",
12012
12019
  path: openCodePath,
@@ -12063,7 +12070,7 @@ ${gitignoreContent}${MANAGED_BLOCK_END}
12063
12070
  }
12064
12071
  }
12065
12072
  const manifestPath = path5.join(targetRoot, ".pourkit", "manifest.json");
12066
- if (existsSync16(manifestPath)) {
12073
+ if (existsSync17(manifestPath)) {
12067
12074
  operations.push({
12068
12075
  kind: "skip",
12069
12076
  path: manifestPath,
@@ -12382,7 +12389,7 @@ async function updateManagedBlock(filePath, content) {
12382
12389
  const blockContent = `${MANAGED_BLOCK_BEGIN}
12383
12390
  ${content}${MANAGED_BLOCK_END}
12384
12391
  `;
12385
- if (!existsSync16(filePath)) {
12392
+ if (!existsSync17(filePath)) {
12386
12393
  const dir = path5.dirname(filePath);
12387
12394
  await mkdir5(dir, { recursive: true });
12388
12395
  await writeFileAtomic(filePath, blockContent);
@@ -12411,7 +12418,7 @@ async function writeManifest(plan, sourceMeta, agentFiles, packageManager) {
12411
12418
  if (op.requiresConfirmation) continue;
12412
12419
  const relPath = path5.relative(plan.targetRoot, op.path);
12413
12420
  if (relPath === ".pourkit/manifest.json") continue;
12414
- if (existsSync16(op.path)) {
12421
+ if (existsSync17(op.path)) {
12415
12422
  const sha256 = await computeFileChecksum(op.path);
12416
12423
  assets[relPath] = {
12417
12424
  ownership: op.ownership || "managed",
@@ -12456,7 +12463,7 @@ async function applyInitPlan(plan, options) {
12456
12463
  skipped++;
12457
12464
  continue;
12458
12465
  }
12459
- if (existsSync16(op.path) && !op.destructive) {
12466
+ if (existsSync17(op.path) && !op.destructive) {
12460
12467
  skipped++;
12461
12468
  continue;
12462
12469
  }
@@ -12471,7 +12478,7 @@ async function applyInitPlan(plan, options) {
12471
12478
  skipped++;
12472
12479
  continue;
12473
12480
  }
12474
- if (existsSync16(op.path)) {
12481
+ if (existsSync17(op.path)) {
12475
12482
  skipped++;
12476
12483
  continue;
12477
12484
  }
@@ -12500,7 +12507,7 @@ async function applyInitPlan(plan, options) {
12500
12507
  skipped++;
12501
12508
  continue;
12502
12509
  }
12503
- if (existsSync16(op.path)) {
12510
+ if (existsSync17(op.path)) {
12504
12511
  skipped++;
12505
12512
  continue;
12506
12513
  }
@@ -12640,7 +12647,7 @@ async function applyInitFromSource(options) {
12640
12647
  if (!manifestSkipped) {
12641
12648
  const agentFiles = [];
12642
12649
  for (const name of ["AGENTS.md", "CLAUDE.md"]) {
12643
- if (existsSync16(path5.join(targetRoot, name))) {
12650
+ if (existsSync17(path5.join(targetRoot, name))) {
12644
12651
  agentFiles.push(path5.join(targetRoot, name));
12645
12652
  }
12646
12653
  }
@@ -12932,18 +12939,22 @@ async function runSerenaStatusCommand(options) {
12932
12939
  }
12933
12940
 
12934
12941
  // commands/config-schema.ts
12935
- import { readFileSync as readFileSync19, existsSync as existsSync17 } from "fs";
12942
+ import { readFileSync as readFileSync19, existsSync as existsSync18 } from "fs";
12936
12943
  import { mkdir as mkdir6, readFile as readFile6, writeFile as writeFile3 } from "fs/promises";
12937
12944
  import { resolve as resolve4, dirname as dirname5 } from "path";
12938
12945
  import { fileURLToPath as fileURLToPath2 } from "url";
12939
12946
  import Ajv2 from "ajv";
12940
12947
  var __filename2 = fileURLToPath2(import.meta.url);
12941
12948
  var __dirname2 = dirname5(__filename2);
12942
- var PACKAGED_SCHEMA_PATH = resolve4(
12943
- __dirname2,
12944
- "../schema/pourkit.schema.json"
12945
- );
12946
- var PACKAGED_HASH_PATH = resolve4(__dirname2, "../schema/pourkit.schema.hash");
12949
+ function resolvePackagedAssetPath2(fileName) {
12950
+ const candidates = [
12951
+ resolve4(__dirname2, "schema", fileName),
12952
+ resolve4(__dirname2, "../schema", fileName)
12953
+ ];
12954
+ return candidates.find((candidate) => existsSync18(candidate)) ?? candidates[0];
12955
+ }
12956
+ var PACKAGED_SCHEMA_PATH = resolvePackagedAssetPath2("pourkit.schema.json");
12957
+ var PACKAGED_HASH_PATH = resolvePackagedAssetPath2("pourkit.schema.hash");
12947
12958
  var _schemaValidator = null;
12948
12959
  var _schemaErrors = null;
12949
12960
  function getSchemaValidator() {
@@ -12972,8 +12983,8 @@ async function runDoctorCommand(options) {
12972
12983
  const schemaDir = localSchemaDir(repoRootPath);
12973
12984
  const localSchemaPath = resolve4(schemaDir, "pourkit.schema.json");
12974
12985
  const localHashPath = resolve4(schemaDir, "pourkit.schema.hash");
12975
- const localSchemaExists = existsSync17(localSchemaPath);
12976
- const localHashExists = existsSync17(localHashPath);
12986
+ const localSchemaExists = existsSync18(localSchemaPath);
12987
+ const localHashExists = existsSync18(localHashPath);
12977
12988
  let packagedHash = null;
12978
12989
  try {
12979
12990
  packagedHash = readPackagedHash();
@@ -12991,7 +13002,7 @@ async function runDoctorCommand(options) {
12991
13002
  const overall = schema === "fresh" && hash === "fresh" ? "fresh" : schema === "missing" || hash === "missing" ? "missing" : "stale";
12992
13003
  const configPath = resolve4(repoRootPath, ".pourkit/config.json");
12993
13004
  let configValidation;
12994
- if (existsSync17(configPath)) {
13005
+ if (existsSync18(configPath)) {
12995
13006
  try {
12996
13007
  const raw = JSON.parse(readFileSync19(configPath, "utf-8"));
12997
13008
  const validate = getSchemaValidator();
@@ -13025,7 +13036,7 @@ async function runDoctorCommand(options) {
13025
13036
  "pourkit.config.mjs",
13026
13037
  "pourkit.config.js",
13027
13038
  "pourkit.json"
13028
- ].filter((p) => existsSync17(resolve4(repoRootPath, p)));
13039
+ ].filter((p) => existsSync18(resolve4(repoRootPath, p)));
13029
13040
  let recommendation = null;
13030
13041
  if (!configValidation.ok || overall !== "fresh" || obsoleteConfigs.length > 0) {
13031
13042
  const parts = [];
@@ -13063,7 +13074,7 @@ async function runConfigSyncSchemaCommand(options) {
13063
13074
  const localHashPath = resolve4(schemaDir, "pourkit.schema.hash");
13064
13075
  let schemaWritten = false;
13065
13076
  let hashWritten = false;
13066
- if (existsSync17(localSchemaPath)) {
13077
+ if (existsSync18(localSchemaPath)) {
13067
13078
  const existing = await readFile6(localSchemaPath, "utf-8");
13068
13079
  if (existing !== packagedSchema) {
13069
13080
  await writeFile3(localSchemaPath, packagedSchema, "utf-8");
@@ -13073,7 +13084,7 @@ async function runConfigSyncSchemaCommand(options) {
13073
13084
  await writeFile3(localSchemaPath, packagedSchema, "utf-8");
13074
13085
  schemaWritten = true;
13075
13086
  }
13076
- if (existsSync17(localHashPath)) {
13087
+ if (existsSync18(localHashPath)) {
13077
13088
  const existing = await readFile6(localHashPath, "utf-8");
13078
13089
  if (existing !== packagedHash) {
13079
13090
  await writeFile3(localHashPath, packagedHash, "utf-8");
@@ -13644,14 +13655,14 @@ import path7 from "path";
13644
13655
 
13645
13656
  // execution/sandbox-image.ts
13646
13657
  import { createHash as createHash3 } from "crypto";
13647
- import { existsSync as existsSync18, readFileSync as readFileSync20 } from "fs";
13658
+ import { existsSync as existsSync19, readFileSync as readFileSync20 } from "fs";
13648
13659
  import path6 from "path";
13649
13660
  function sandboxImageName(repoRoot2) {
13650
13661
  const dirName = path6.basename(repoRoot2.replace(/[\\/]+$/, "")) || "local";
13651
13662
  const sanitized = dirName.toLowerCase().replace(/[^a-z0-9_.-]/g, "-");
13652
13663
  const baseName = sanitized || "local";
13653
13664
  const dockerfilePath = path6.join(repoRoot2, ".sandcastle", "Dockerfile");
13654
- if (!existsSync18(dockerfilePath)) {
13665
+ if (!existsSync19(dockerfilePath)) {
13655
13666
  return `sandcastle:${baseName}`;
13656
13667
  }
13657
13668
  const fingerprint = createHash3("sha256").update(readFileSync20(dockerfilePath)).digest("hex").slice(0, 8);
@@ -14649,11 +14660,11 @@ function createCliProgram(version) {
14649
14660
  return program;
14650
14661
  }
14651
14662
  async function resolveCliVersion() {
14652
- if (isPackageVersion("0.0.0-next-20260614182520")) {
14653
- return "0.0.0-next-20260614182520";
14663
+ if (isPackageVersion("0.0.0-next-20260614201555")) {
14664
+ return "0.0.0-next-20260614201555";
14654
14665
  }
14655
- if (isReleaseVersion("0.0.0-next-20260614182520")) {
14656
- return "0.0.0-next-20260614182520";
14666
+ if (isReleaseVersion("0.0.0-next-20260614201555")) {
14667
+ return "0.0.0-next-20260614201555";
14657
14668
  }
14658
14669
  try {
14659
14670
  const root = repoRoot();