@pourkit/cli 0.0.0-next-20260613201753 → 0.0.0-next-20260614002607

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
@@ -425,8 +425,7 @@ var ReviewRefactorLoopStrategySchema = z.object({
425
425
  prdRun: z.object({
426
426
  mode: PrdRunModeSchema.optional(),
427
427
  // Uses promptTemplate (canonical StageAgentConfig field), not prompt as Issue contract may suggest
428
- finalReview: StageAgentConfigSchema,
429
- reconciliation: StageAgentConfigSchema.optional()
428
+ finalReview: StageAgentConfigSchema
430
429
  }).strict().optional()
431
430
  }).strict();
432
431
  var TargetSerenaConfigSchema = z.object({
@@ -661,6 +660,11 @@ function parseConfig(raw) {
661
660
  `targets[${i}].strategy.conflictResolution has been removed; use targets[${i}].strategy.failureResolution`
662
661
  );
663
662
  }
663
+ if (strategy && typeof strategy === "object" && strategy.prdRun && typeof strategy.prdRun === "object" && "reconciliation" in strategy.prdRun) {
664
+ throw new Error(
665
+ `targets[${i}].strategy.prdRun.reconciliation has been removed; PRD Run no longer invokes Architect reconciliation.`
666
+ );
667
+ }
664
668
  }
665
669
  if (config.sandbox && typeof config.sandbox === "object") {
666
670
  assertKnownKeys(config.sandbox, "sandbox", [
@@ -719,8 +723,7 @@ function parseConfig(raw) {
719
723
  ...t.strategy.prdRun ? {
720
724
  prdRun: {
721
725
  ...t.strategy.prdRun.mode ? { mode: t.strategy.prdRun.mode } : {},
722
- finalReview: t.strategy.prdRun.finalReview,
723
- ...t.strategy.prdRun.reconciliation ? { reconciliation: t.strategy.prdRun.reconciliation } : {}
726
+ finalReview: t.strategy.prdRun.finalReview
724
727
  }
725
728
  } : {}
726
729
  }
@@ -3270,7 +3273,7 @@ function validateFinalReviewAgentOutputs(options) {
3270
3273
  return { ok: true, artifact, retouch };
3271
3274
  }
3272
3275
  function isRetouchScopePath(path9) {
3273
- if (path9.startsWith(".pourkit/architecture/") || path9 === ".pourkit/CONTEXT.md" || path9.startsWith(".pourkit/docs/adr/") || /^\.pourkit\/prd-runs\/[^/]+\.json$/.test(path9)) {
3276
+ if (path9.startsWith(".pourkit/plans/") || path9 === ".pourkit/CONTEXT.md" || path9.startsWith(".pourkit/docs/") || /^\.pourkit\/prd-runs\/[^/]+\.json$/.test(path9)) {
3274
3277
  return false;
3275
3278
  }
3276
3279
  return true;
@@ -8012,6 +8015,7 @@ var PrdRunRecordSchema = z2.object({
8012
8015
  "starting",
8013
8016
  "running",
8014
8017
  "drained",
8018
+ "completed_prd_branch",
8015
8019
  "waiting_for_integration",
8016
8020
  "finalizing",
8017
8021
  "final_reviewed",
@@ -8094,7 +8098,7 @@ function readPrdRun(repoRoot2, prdRef) {
8094
8098
  }
8095
8099
  try {
8096
8100
  const raw = JSON.parse(readFileSync15(recordPath, "utf-8"));
8097
- const parsed = PrdRunRecordSchema.parse(raw);
8101
+ const parsed = normalizeLegacyPrdRunRecord(PrdRunRecordSchema.parse(raw));
8098
8102
  return { record: parsed, diagnostics: [] };
8099
8103
  } catch (error) {
8100
8104
  try {
@@ -8131,8 +8135,8 @@ function listPrdRuns(repoRoot2) {
8131
8135
  if (!entry.isFile() || !entry.name.endsWith(".json")) continue;
8132
8136
  const recordPath = join16(stateDir, entry.name);
8133
8137
  try {
8134
- const record = PrdRunRecordSchema.parse(
8135
- JSON.parse(readFileSync15(recordPath, "utf-8"))
8138
+ const record = normalizeLegacyPrdRunRecord(
8139
+ PrdRunRecordSchema.parse(JSON.parse(readFileSync15(recordPath, "utf-8")))
8136
8140
  );
8137
8141
  records.push(record);
8138
8142
  } catch (error) {
@@ -8154,6 +8158,16 @@ function writePrdRunRecord(repoRoot2, record) {
8154
8158
  "utf-8"
8155
8159
  );
8156
8160
  }
8161
+ function normalizeLegacyPrdRunRecord(record) {
8162
+ if (record.status !== "waiting_for_integration") return record;
8163
+ return {
8164
+ ...record,
8165
+ status: "completed_prd_branch",
8166
+ blockedGate: void 0,
8167
+ blockedReason: void 0,
8168
+ offendingPaths: void 0
8169
+ };
8170
+ }
8157
8171
  var LocalPrdRunRecordSchema = z2.object({
8158
8172
  prdId: z2.string().regex(
8159
8173
  /^PRD-\d{4}$/,
@@ -8547,6 +8561,7 @@ async function runLocalIssue(prdId, issueId, builder, repoRoot2) {
8547
8561
 
8548
8562
  // prd-run/local-queue-loop.ts
8549
8563
  var CHILD_CLEANUP_LABELS = ["agent-in-progress", "pr-open-awaiting-merge"];
8564
+ var LOCAL_ISSUE_ID_REGEX = /^I-(\d+)$/i;
8550
8565
  function getIssueArtifactPath2(repoRoot2, prdId, issueId) {
8551
8566
  return join19(
8552
8567
  repoRoot2,
@@ -8575,6 +8590,16 @@ function writeIssueArtifact(repoRoot2, prdId, issue) {
8575
8590
  "utf-8"
8576
8591
  );
8577
8592
  }
8593
+ function compareLocalIssueIds(a, b) {
8594
+ const aMatch = a.match(LOCAL_ISSUE_ID_REGEX);
8595
+ const bMatch = b.match(LOCAL_ISSUE_ID_REGEX);
8596
+ if (aMatch && bMatch) {
8597
+ const aNumber = Number.parseInt(aMatch[1], 10);
8598
+ const bNumber = Number.parseInt(bMatch[1], 10);
8599
+ if (aNumber !== bNumber) return aNumber - bNumber;
8600
+ }
8601
+ return a.localeCompare(b);
8602
+ }
8578
8603
  async function reconcileLocalBlockedIssues(prdId, repoRoot2) {
8579
8604
  const root = repoRoot2 ?? process.cwd();
8580
8605
  const issuesResult = await resolveLocalIssueArtifacts(prdId, root);
@@ -8650,7 +8675,9 @@ async function runLocalQueueLoop(prdId, repoRoot2, issueProvider) {
8650
8675
  }
8651
8676
  break;
8652
8677
  }
8653
- const issue = runnable[0];
8678
+ const issue = [...runnable].sort(
8679
+ (a, b) => compareLocalIssueIds(a.id, b.id)
8680
+ )[0];
8654
8681
  const runResult = await runLocalIssue(prdId, issue.id, void 0, root);
8655
8682
  if (!runResult.ok) {
8656
8683
  return {
@@ -8778,6 +8805,18 @@ var TYPE_PRIORITY = {
8778
8805
  "type:polish": 4,
8779
8806
  "type:refactor": 5
8780
8807
  };
8808
+ var CHILD_ISSUE_TITLE_REGEX = /\bI-(\d+)\b/i;
8809
+ var PRD_TITLE_REGEX = /\bPRD-(\d+)\b/i;
8810
+ function parseChildIssueOrder(value) {
8811
+ const match = value.match(CHILD_ISSUE_TITLE_REGEX);
8812
+ if (!match) return null;
8813
+ return Number.parseInt(match[1], 10);
8814
+ }
8815
+ function parsePrdOrder(value) {
8816
+ const match = value.match(PRD_TITLE_REGEX);
8817
+ if (!match) return null;
8818
+ return Number.parseInt(match[1], 10);
8819
+ }
8781
8820
  function selectIssue(candidates, options = {}) {
8782
8821
  const blockedLabel = options.blockedLabel ?? "blocked";
8783
8822
  const agentInProgressLabel = options.agentInProgressLabel ?? "agent-in-progress";
@@ -8817,6 +8856,13 @@ function selectIssue(candidates, options = {}) {
8817
8856
  };
8818
8857
  }
8819
8858
  valid2.sort((a, b) => {
8859
+ const aChildOrder = parseChildIssueOrder(a.issue.title);
8860
+ const bChildOrder = parseChildIssueOrder(b.issue.title);
8861
+ const aPrdOrder = parsePrdOrder(a.issue.title);
8862
+ const bPrdOrder = parsePrdOrder(b.issue.title);
8863
+ if (aChildOrder !== null && bChildOrder !== null && aPrdOrder !== null && aPrdOrder === bPrdOrder) {
8864
+ if (aChildOrder !== bChildOrder) return aChildOrder - bChildOrder;
8865
+ }
8820
8866
  if (a.priority !== b.priority) return a.priority - b.priority;
8821
8867
  const ageCmp = a.issue.createdAt.localeCompare(b.issue.createdAt);
8822
8868
  if (ageCmp !== 0) return ageCmp;
@@ -9210,7 +9256,7 @@ function planLaunchResume(record) {
9210
9256
  return pipe(
9211
9257
  record,
9212
9258
  Match.value,
9213
- Match.when({ status: "waiting_for_integration" }, () => ({
9259
+ Match.when({ status: "completed_prd_branch" }, () => ({
9214
9260
  attempted: [],
9215
9261
  skipped: ["start", "queue"],
9216
9262
  resumed: []
@@ -9377,7 +9423,7 @@ async function runPrdRunLaunchCommand(options) {
9377
9423
  offendingPaths: []
9378
9424
  };
9379
9425
  }
9380
- if (existingRecord.record?.status === "waiting_for_integration" || existingRecord.record?.status === "complete" || existingRecord.record?.status === "completed_local_branch") {
9426
+ if (existingRecord.record?.status === "completed_prd_branch" || existingRecord.record?.status === "complete" || existingRecord.record?.status === "completed_local_branch") {
9381
9427
  return {
9382
9428
  prdRef,
9383
9429
  status: existingRecord.record.status,
@@ -9385,7 +9431,12 @@ async function runPrdRunLaunchCommand(options) {
9385
9431
  skipped,
9386
9432
  resumed,
9387
9433
  diagnostics: [
9388
- `PRD Run ${prdRef} is already in status "${existingRecord.record.status}".`
9434
+ `PRD Run ${prdRef} is already in status "${existingRecord.record.status}".`,
9435
+ ...existingRecord.record.status === "completed_prd_branch" ? [
9436
+ buildCompletedPrdBranchHint(
9437
+ existingRecord.record.prdBranch ?? prdRef
9438
+ )
9439
+ ] : []
9389
9440
  ],
9390
9441
  prdBranch: existingRecord.record.prdBranch
9391
9442
  };
@@ -9467,7 +9518,7 @@ async function runPrdRunLaunchCommand(options) {
9467
9518
  }
9468
9519
  writePrdRunRecord(options.repoRoot, {
9469
9520
  prdRef,
9470
- status: "waiting_for_integration",
9521
+ status: "completed_prd_branch",
9471
9522
  updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
9472
9523
  targetName: currentRecord?.targetName ?? options.targetName,
9473
9524
  prdBranch: currentRecord?.prdBranch,
@@ -9476,14 +9527,15 @@ async function runPrdRunLaunchCommand(options) {
9476
9527
  });
9477
9528
  return {
9478
9529
  prdRef,
9479
- status: "waiting_for_integration",
9530
+ status: "completed_prd_branch",
9480
9531
  attempted,
9481
9532
  skipped,
9482
9533
  resumed,
9483
9534
  diagnostics: [
9484
- `Integration Gate is not implemented. PRD Run is waiting for manual integration back to ${currentRecord?.start?.startBaseBranch ?? "(missing startBaseBranch)"}.`
9535
+ buildCompletedPrdBranchHint(currentRecord?.prdBranch ?? prdRef)
9485
9536
  ],
9486
- start: startResult
9537
+ start: startResult,
9538
+ prdBranch: currentRecord?.prdBranch ?? prdRef
9487
9539
  };
9488
9540
  }
9489
9541
  async function runPrdRunStartCommand(options) {
@@ -10383,7 +10435,14 @@ async function ensurePrdBranchPublished(repoRoot2, prdRef, startBaseCommit) {
10383
10435
  function runPrdRunStatusCommand(options) {
10384
10436
  const prdRef = normalizePrdRunRef(options.prdRef);
10385
10437
  const { record, diagnostics } = readPrdRun(options.repoRoot, prdRef);
10386
- return { prdRef, record, diagnostics };
10438
+ return {
10439
+ prdRef,
10440
+ record,
10441
+ diagnostics: record?.status === "completed_prd_branch" ? [
10442
+ ...diagnostics,
10443
+ buildCompletedPrdBranchHint(record.prdBranch ?? prdRef)
10444
+ ] : diagnostics
10445
+ };
10387
10446
  }
10388
10447
  function runPrdRunListCommand(options) {
10389
10448
  return listPrdRuns(options.repoRoot);
@@ -10412,6 +10471,9 @@ function coercePrdRunRecordBlockedGate(gate) {
10412
10471
  return "branch-state";
10413
10472
  }
10414
10473
  }
10474
+ function buildCompletedPrdBranchHint(prdBranch) {
10475
+ return `PRD Run completed on branch ${prdBranch}. Next: checkout ${prdBranch} for human review, or use release promotion workflow when ready.`;
10476
+ }
10415
10477
  function buildBlockedDiagnostics(failure) {
10416
10478
  return failure.diagnostics ?? [
10417
10479
  failure.reason,
@@ -14481,11 +14543,11 @@ function createCliProgram(version) {
14481
14543
  return program;
14482
14544
  }
14483
14545
  async function resolveCliVersion() {
14484
- if (isPackageVersion("0.0.0-next-20260613201753")) {
14485
- return "0.0.0-next-20260613201753";
14546
+ if (isPackageVersion("0.0.0-next-20260614002607")) {
14547
+ return "0.0.0-next-20260614002607";
14486
14548
  }
14487
- if (isReleaseVersion("0.0.0-next-20260613201753")) {
14488
- return "0.0.0-next-20260613201753";
14549
+ if (isReleaseVersion("0.0.0-next-20260614002607")) {
14550
+ return "0.0.0-next-20260614002607";
14489
14551
  }
14490
14552
  try {
14491
14553
  const root = repoRoot();