@pourkit/cli 0.0.0-next-20260613223714 → 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 +75 -16
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -8015,6 +8015,7 @@ var PrdRunRecordSchema = z2.object({
|
|
|
8015
8015
|
"starting",
|
|
8016
8016
|
"running",
|
|
8017
8017
|
"drained",
|
|
8018
|
+
"completed_prd_branch",
|
|
8018
8019
|
"waiting_for_integration",
|
|
8019
8020
|
"finalizing",
|
|
8020
8021
|
"final_reviewed",
|
|
@@ -8097,7 +8098,7 @@ function readPrdRun(repoRoot2, prdRef) {
|
|
|
8097
8098
|
}
|
|
8098
8099
|
try {
|
|
8099
8100
|
const raw = JSON.parse(readFileSync15(recordPath, "utf-8"));
|
|
8100
|
-
const parsed = PrdRunRecordSchema.parse(raw);
|
|
8101
|
+
const parsed = normalizeLegacyPrdRunRecord(PrdRunRecordSchema.parse(raw));
|
|
8101
8102
|
return { record: parsed, diagnostics: [] };
|
|
8102
8103
|
} catch (error) {
|
|
8103
8104
|
try {
|
|
@@ -8134,8 +8135,8 @@ function listPrdRuns(repoRoot2) {
|
|
|
8134
8135
|
if (!entry.isFile() || !entry.name.endsWith(".json")) continue;
|
|
8135
8136
|
const recordPath = join16(stateDir, entry.name);
|
|
8136
8137
|
try {
|
|
8137
|
-
const record =
|
|
8138
|
-
JSON.parse(readFileSync15(recordPath, "utf-8"))
|
|
8138
|
+
const record = normalizeLegacyPrdRunRecord(
|
|
8139
|
+
PrdRunRecordSchema.parse(JSON.parse(readFileSync15(recordPath, "utf-8")))
|
|
8139
8140
|
);
|
|
8140
8141
|
records.push(record);
|
|
8141
8142
|
} catch (error) {
|
|
@@ -8157,6 +8158,16 @@ function writePrdRunRecord(repoRoot2, record) {
|
|
|
8157
8158
|
"utf-8"
|
|
8158
8159
|
);
|
|
8159
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
|
+
}
|
|
8160
8171
|
var LocalPrdRunRecordSchema = z2.object({
|
|
8161
8172
|
prdId: z2.string().regex(
|
|
8162
8173
|
/^PRD-\d{4}$/,
|
|
@@ -8550,6 +8561,7 @@ async function runLocalIssue(prdId, issueId, builder, repoRoot2) {
|
|
|
8550
8561
|
|
|
8551
8562
|
// prd-run/local-queue-loop.ts
|
|
8552
8563
|
var CHILD_CLEANUP_LABELS = ["agent-in-progress", "pr-open-awaiting-merge"];
|
|
8564
|
+
var LOCAL_ISSUE_ID_REGEX = /^I-(\d+)$/i;
|
|
8553
8565
|
function getIssueArtifactPath2(repoRoot2, prdId, issueId) {
|
|
8554
8566
|
return join19(
|
|
8555
8567
|
repoRoot2,
|
|
@@ -8578,6 +8590,16 @@ function writeIssueArtifact(repoRoot2, prdId, issue) {
|
|
|
8578
8590
|
"utf-8"
|
|
8579
8591
|
);
|
|
8580
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
|
+
}
|
|
8581
8603
|
async function reconcileLocalBlockedIssues(prdId, repoRoot2) {
|
|
8582
8604
|
const root = repoRoot2 ?? process.cwd();
|
|
8583
8605
|
const issuesResult = await resolveLocalIssueArtifacts(prdId, root);
|
|
@@ -8653,7 +8675,9 @@ async function runLocalQueueLoop(prdId, repoRoot2, issueProvider) {
|
|
|
8653
8675
|
}
|
|
8654
8676
|
break;
|
|
8655
8677
|
}
|
|
8656
|
-
const issue = runnable
|
|
8678
|
+
const issue = [...runnable].sort(
|
|
8679
|
+
(a, b) => compareLocalIssueIds(a.id, b.id)
|
|
8680
|
+
)[0];
|
|
8657
8681
|
const runResult = await runLocalIssue(prdId, issue.id, void 0, root);
|
|
8658
8682
|
if (!runResult.ok) {
|
|
8659
8683
|
return {
|
|
@@ -8781,6 +8805,18 @@ var TYPE_PRIORITY = {
|
|
|
8781
8805
|
"type:polish": 4,
|
|
8782
8806
|
"type:refactor": 5
|
|
8783
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
|
+
}
|
|
8784
8820
|
function selectIssue(candidates, options = {}) {
|
|
8785
8821
|
const blockedLabel = options.blockedLabel ?? "blocked";
|
|
8786
8822
|
const agentInProgressLabel = options.agentInProgressLabel ?? "agent-in-progress";
|
|
@@ -8820,6 +8856,13 @@ function selectIssue(candidates, options = {}) {
|
|
|
8820
8856
|
};
|
|
8821
8857
|
}
|
|
8822
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
|
+
}
|
|
8823
8866
|
if (a.priority !== b.priority) return a.priority - b.priority;
|
|
8824
8867
|
const ageCmp = a.issue.createdAt.localeCompare(b.issue.createdAt);
|
|
8825
8868
|
if (ageCmp !== 0) return ageCmp;
|
|
@@ -9213,7 +9256,7 @@ function planLaunchResume(record) {
|
|
|
9213
9256
|
return pipe(
|
|
9214
9257
|
record,
|
|
9215
9258
|
Match.value,
|
|
9216
|
-
Match.when({ status: "
|
|
9259
|
+
Match.when({ status: "completed_prd_branch" }, () => ({
|
|
9217
9260
|
attempted: [],
|
|
9218
9261
|
skipped: ["start", "queue"],
|
|
9219
9262
|
resumed: []
|
|
@@ -9380,7 +9423,7 @@ async function runPrdRunLaunchCommand(options) {
|
|
|
9380
9423
|
offendingPaths: []
|
|
9381
9424
|
};
|
|
9382
9425
|
}
|
|
9383
|
-
if (existingRecord.record?.status === "
|
|
9426
|
+
if (existingRecord.record?.status === "completed_prd_branch" || existingRecord.record?.status === "complete" || existingRecord.record?.status === "completed_local_branch") {
|
|
9384
9427
|
return {
|
|
9385
9428
|
prdRef,
|
|
9386
9429
|
status: existingRecord.record.status,
|
|
@@ -9388,7 +9431,12 @@ async function runPrdRunLaunchCommand(options) {
|
|
|
9388
9431
|
skipped,
|
|
9389
9432
|
resumed,
|
|
9390
9433
|
diagnostics: [
|
|
9391
|
-
`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
|
+
] : []
|
|
9392
9440
|
],
|
|
9393
9441
|
prdBranch: existingRecord.record.prdBranch
|
|
9394
9442
|
};
|
|
@@ -9470,7 +9518,7 @@ async function runPrdRunLaunchCommand(options) {
|
|
|
9470
9518
|
}
|
|
9471
9519
|
writePrdRunRecord(options.repoRoot, {
|
|
9472
9520
|
prdRef,
|
|
9473
|
-
status: "
|
|
9521
|
+
status: "completed_prd_branch",
|
|
9474
9522
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9475
9523
|
targetName: currentRecord?.targetName ?? options.targetName,
|
|
9476
9524
|
prdBranch: currentRecord?.prdBranch,
|
|
@@ -9479,14 +9527,15 @@ async function runPrdRunLaunchCommand(options) {
|
|
|
9479
9527
|
});
|
|
9480
9528
|
return {
|
|
9481
9529
|
prdRef,
|
|
9482
|
-
status: "
|
|
9530
|
+
status: "completed_prd_branch",
|
|
9483
9531
|
attempted,
|
|
9484
9532
|
skipped,
|
|
9485
9533
|
resumed,
|
|
9486
9534
|
diagnostics: [
|
|
9487
|
-
|
|
9535
|
+
buildCompletedPrdBranchHint(currentRecord?.prdBranch ?? prdRef)
|
|
9488
9536
|
],
|
|
9489
|
-
start: startResult
|
|
9537
|
+
start: startResult,
|
|
9538
|
+
prdBranch: currentRecord?.prdBranch ?? prdRef
|
|
9490
9539
|
};
|
|
9491
9540
|
}
|
|
9492
9541
|
async function runPrdRunStartCommand(options) {
|
|
@@ -10386,7 +10435,14 @@ async function ensurePrdBranchPublished(repoRoot2, prdRef, startBaseCommit) {
|
|
|
10386
10435
|
function runPrdRunStatusCommand(options) {
|
|
10387
10436
|
const prdRef = normalizePrdRunRef(options.prdRef);
|
|
10388
10437
|
const { record, diagnostics } = readPrdRun(options.repoRoot, prdRef);
|
|
10389
|
-
return {
|
|
10438
|
+
return {
|
|
10439
|
+
prdRef,
|
|
10440
|
+
record,
|
|
10441
|
+
diagnostics: record?.status === "completed_prd_branch" ? [
|
|
10442
|
+
...diagnostics,
|
|
10443
|
+
buildCompletedPrdBranchHint(record.prdBranch ?? prdRef)
|
|
10444
|
+
] : diagnostics
|
|
10445
|
+
};
|
|
10390
10446
|
}
|
|
10391
10447
|
function runPrdRunListCommand(options) {
|
|
10392
10448
|
return listPrdRuns(options.repoRoot);
|
|
@@ -10415,6 +10471,9 @@ function coercePrdRunRecordBlockedGate(gate) {
|
|
|
10415
10471
|
return "branch-state";
|
|
10416
10472
|
}
|
|
10417
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
|
+
}
|
|
10418
10477
|
function buildBlockedDiagnostics(failure) {
|
|
10419
10478
|
return failure.diagnostics ?? [
|
|
10420
10479
|
failure.reason,
|
|
@@ -14484,11 +14543,11 @@ function createCliProgram(version) {
|
|
|
14484
14543
|
return program;
|
|
14485
14544
|
}
|
|
14486
14545
|
async function resolveCliVersion() {
|
|
14487
|
-
if (isPackageVersion("0.0.0-next-
|
|
14488
|
-
return "0.0.0-next-
|
|
14546
|
+
if (isPackageVersion("0.0.0-next-20260614002607")) {
|
|
14547
|
+
return "0.0.0-next-20260614002607";
|
|
14489
14548
|
}
|
|
14490
|
-
if (isReleaseVersion("0.0.0-next-
|
|
14491
|
-
return "0.0.0-next-
|
|
14549
|
+
if (isReleaseVersion("0.0.0-next-20260614002607")) {
|
|
14550
|
+
return "0.0.0-next-20260614002607";
|
|
14492
14551
|
}
|
|
14493
14552
|
try {
|
|
14494
14553
|
const root = repoRoot();
|