@pourkit/cli 0.0.0-next-20260620201514 → 0.0.0-next-20260621003351
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 +123 -109
- package/dist/cli.js.map +1 -1
- package/dist/e2e/run-live-e2e.js +119 -105
- package/dist/e2e/run-live-e2e.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -7037,157 +7037,171 @@ async function handlePublishedHistoryRisk(failure, context) {
|
|
|
7037
7037
|
throw new Error(message);
|
|
7038
7038
|
}
|
|
7039
7039
|
|
|
7040
|
-
//
|
|
7041
|
-
var
|
|
7040
|
+
// issues/issue-run-lifecycle.ts
|
|
7041
|
+
var IssueRunHumanHandoffStop = class extends Error {
|
|
7042
7042
|
constructor(message) {
|
|
7043
7043
|
super(message);
|
|
7044
7044
|
this.name = "HumanHandoffStop";
|
|
7045
7045
|
}
|
|
7046
7046
|
};
|
|
7047
|
-
async function
|
|
7048
|
-
const {
|
|
7049
|
-
issueNumber,
|
|
7050
|
-
config,
|
|
7051
|
-
issueProvider,
|
|
7052
|
-
prProvider,
|
|
7053
|
-
executionProvider,
|
|
7054
|
-
logger
|
|
7055
|
-
} = options;
|
|
7056
|
-
const ROOT = options.repoRoot;
|
|
7057
|
-
let executionSession;
|
|
7047
|
+
async function runIssueLifecycle(options) {
|
|
7058
7048
|
try {
|
|
7059
|
-
|
|
7060
|
-
const
|
|
7061
|
-
const startResult = await startIssueRun(runOptions);
|
|
7062
|
-
const {
|
|
7063
|
-
issue,
|
|
7064
|
-
parentPrdIssue,
|
|
7065
|
-
target,
|
|
7066
|
-
effectiveTarget,
|
|
7067
|
-
branchName,
|
|
7068
|
-
worktreeState,
|
|
7069
|
-
executionResult
|
|
7070
|
-
} = startResult;
|
|
7049
|
+
const startResult = await options.deps.startIssueRun(options.runOptions);
|
|
7050
|
+
const reviewAlreadyPassed = startResult.worktreeState?.review.lastVerdict && !startResult.worktreeState.review.exhaustedPreviousRun && (startResult.worktreeState.review.lastVerdict === "PASS" || startResult.worktreeState.review.lastVerdict === "PASS_WITH_NOTES");
|
|
7071
7051
|
let reviewArtifactPath;
|
|
7072
|
-
const reviewAlreadyPassed = worktreeState?.review.lastVerdict && ["PASS", "PASS_WITH_NOTES"].includes(worktreeState.review.lastVerdict) && !worktreeState.review.exhaustedPreviousRun;
|
|
7073
7052
|
if (reviewAlreadyPassed) {
|
|
7074
|
-
reviewArtifactPath = worktreeState.review.lastArtifactPath;
|
|
7053
|
+
reviewArtifactPath = startResult.worktreeState.review.lastArtifactPath;
|
|
7075
7054
|
} else {
|
|
7076
|
-
const
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
startingLifetimeIteration: lifetimeIterationsFromState,
|
|
7089
|
-
humanHandoffResolved,
|
|
7055
|
+
const reviewResult = await options.deps.advanceIssueRunReview({
|
|
7056
|
+
executionProvider: options.runOptions.executionProvider,
|
|
7057
|
+
config: options.config,
|
|
7058
|
+
target: startResult.effectiveTarget,
|
|
7059
|
+
issue: startResult.issue,
|
|
7060
|
+
parentPrdIssue: startResult.parentPrdIssue,
|
|
7061
|
+
builderBranch: startResult.branchName,
|
|
7062
|
+
worktreePath: startResult.executionResult.worktreePath,
|
|
7063
|
+
repoRoot: options.repoRoot,
|
|
7064
|
+
logger: options.logger,
|
|
7065
|
+
startingLifetimeIteration: startResult.worktreeState?.review.lifetimeIterations ?? 0,
|
|
7066
|
+
humanHandoffResolved: startResult.worktreeState?.review.lastVerdict === "NEEDS_HUMAN",
|
|
7090
7067
|
serena: startResult.serena,
|
|
7091
7068
|
memory: startResult.memory
|
|
7092
7069
|
});
|
|
7093
7070
|
if (reviewResult.exhaustedMaxIterations) {
|
|
7094
7071
|
throw new Error(
|
|
7095
|
-
|
|
7072
|
+
"Review loop exhausted maximum iterations without passing"
|
|
7096
7073
|
);
|
|
7097
7074
|
}
|
|
7098
7075
|
if (reviewResult.verdict === "FAIL") {
|
|
7099
|
-
|
|
7076
|
+
const summary = reviewResult.output?.trim() || "no summary provided";
|
|
7077
|
+
throw new Error(`Review loop failed: ${summary}`);
|
|
7100
7078
|
}
|
|
7101
7079
|
if (reviewResult.verdict === "NEEDS_HUMAN") {
|
|
7102
|
-
await
|
|
7103
|
-
issueProvider,
|
|
7104
|
-
issueNumber,
|
|
7105
|
-
config,
|
|
7106
|
-
logger,
|
|
7080
|
+
await options.deps.transitionReviewNeedsHumanToHandoff({
|
|
7081
|
+
issueProvider: options.issueProvider,
|
|
7082
|
+
issueNumber: options.issueNumber,
|
|
7083
|
+
config: options.config,
|
|
7084
|
+
logger: options.logger,
|
|
7107
7085
|
reviewResult
|
|
7108
7086
|
});
|
|
7109
|
-
throw new
|
|
7110
|
-
|
|
7087
|
+
throw new IssueRunHumanHandoffStop(
|
|
7088
|
+
"Review requires human handoff: NEEDS_HUMAN verdict"
|
|
7111
7089
|
);
|
|
7112
7090
|
}
|
|
7113
7091
|
reviewArtifactPath = reviewResult.artifactPath;
|
|
7114
7092
|
}
|
|
7115
|
-
const finalReviewResult = await advanceIssueFinalReview({
|
|
7116
|
-
executionProvider: runOptions.executionProvider,
|
|
7117
|
-
config,
|
|
7118
|
-
target: effectiveTarget,
|
|
7119
|
-
issue,
|
|
7120
|
-
parentPrdIssue,
|
|
7121
|
-
builderBranch: branchName,
|
|
7122
|
-
worktreePath: executionResult.worktreePath,
|
|
7123
|
-
repoRoot:
|
|
7124
|
-
logger,
|
|
7093
|
+
const finalReviewResult = await options.deps.advanceIssueFinalReview({
|
|
7094
|
+
executionProvider: options.runOptions.executionProvider,
|
|
7095
|
+
config: options.config,
|
|
7096
|
+
target: startResult.effectiveTarget,
|
|
7097
|
+
issue: startResult.issue,
|
|
7098
|
+
parentPrdIssue: startResult.parentPrdIssue,
|
|
7099
|
+
builderBranch: startResult.branchName,
|
|
7100
|
+
worktreePath: startResult.executionResult.worktreePath,
|
|
7101
|
+
repoRoot: options.repoRoot,
|
|
7102
|
+
logger: options.logger,
|
|
7125
7103
|
reviewArtifactPath,
|
|
7126
|
-
worktreeState,
|
|
7104
|
+
worktreeState: startResult.worktreeState,
|
|
7127
7105
|
memory: startResult.memory
|
|
7128
7106
|
});
|
|
7129
7107
|
if (finalReviewResult.verdict === "needs_human_review") {
|
|
7130
|
-
|
|
7131
|
-
|
|
7132
|
-
|
|
7133
|
-
|
|
7134
|
-
|
|
7135
|
-
closeIssue: issueProvider.closeIssue.bind(issueProvider)
|
|
7136
|
-
},
|
|
7137
|
-
{
|
|
7138
|
-
blocked: config.labels.blocked,
|
|
7139
|
-
readyForAgent: config.labels.readyForAgent,
|
|
7140
|
-
needsTriage: config.labels.needsTriage,
|
|
7141
|
-
agentInProgress: config.labels.agentInProgress,
|
|
7142
|
-
readyForHuman: config.labels.readyForHuman,
|
|
7143
|
-
prOpenAwaitingMerge: config.labels.prOpenAwaitingMerge
|
|
7144
|
-
}
|
|
7145
|
-
);
|
|
7146
|
-
await transitions.moveToReadyForHuman(issueNumber);
|
|
7147
|
-
const comment = [
|
|
7148
|
-
"Pourkit stopped the Issue Final Review because human review is needed.",
|
|
7149
|
-
"",
|
|
7150
|
-
finalReviewResult.needsHumanReason,
|
|
7151
|
-
"",
|
|
7152
|
-
"Artifacts:",
|
|
7153
|
-
`- Issue Final Review: ${finalReviewResult.artifactPath}`
|
|
7154
|
-
].join("\n");
|
|
7155
|
-
await issueProvider.commentIssue(issueNumber, comment);
|
|
7156
|
-
logger.step(
|
|
7157
|
-
"info",
|
|
7158
|
-
`Issue Final Review requires human handoff for issue ${issueNumber}`
|
|
7159
|
-
);
|
|
7160
|
-
throw new HumanHandoffStop(
|
|
7108
|
+
await options.deps.transitionIssueFinalReviewNeedsHumanToHandoff({
|
|
7109
|
+
issueNumber: options.issueNumber,
|
|
7110
|
+
finalReviewResult
|
|
7111
|
+
});
|
|
7112
|
+
throw new IssueRunHumanHandoffStop(
|
|
7161
7113
|
`Issue Final Review requires human handoff: ${finalReviewResult.needsHumanReason}`
|
|
7162
7114
|
);
|
|
7163
7115
|
}
|
|
7164
|
-
return await completeIssueRun({
|
|
7165
|
-
...runOptions,
|
|
7116
|
+
return await options.deps.completeIssueRun({
|
|
7117
|
+
...options.runOptions,
|
|
7166
7118
|
startResult,
|
|
7167
7119
|
reviewArtifactPath
|
|
7168
7120
|
});
|
|
7169
7121
|
} catch (error) {
|
|
7170
|
-
if (error instanceof
|
|
7122
|
+
if (error instanceof IssueRunHumanHandoffStop) {
|
|
7171
7123
|
throw error;
|
|
7172
7124
|
}
|
|
7173
7125
|
if (error instanceof Error && "_tag" in error) {
|
|
7174
|
-
await failIssueRun({
|
|
7175
|
-
issueProvider,
|
|
7176
|
-
issueNumber,
|
|
7177
|
-
config,
|
|
7178
|
-
logger,
|
|
7126
|
+
await options.deps.failIssueRun({
|
|
7127
|
+
issueProvider: options.issueProvider,
|
|
7128
|
+
issueNumber: options.issueNumber,
|
|
7129
|
+
config: options.config,
|
|
7130
|
+
logger: options.logger,
|
|
7179
7131
|
error: `[${error._tag}] ${error.message}`
|
|
7180
7132
|
});
|
|
7181
7133
|
} else {
|
|
7182
|
-
await failIssueRun({
|
|
7183
|
-
issueProvider,
|
|
7184
|
-
issueNumber,
|
|
7185
|
-
config,
|
|
7186
|
-
logger,
|
|
7134
|
+
await options.deps.failIssueRun({
|
|
7135
|
+
issueProvider: options.issueProvider,
|
|
7136
|
+
issueNumber: options.issueNumber,
|
|
7137
|
+
config: options.config,
|
|
7138
|
+
logger: options.logger,
|
|
7187
7139
|
error: error instanceof Error ? error : String(error)
|
|
7188
7140
|
});
|
|
7189
7141
|
}
|
|
7190
7142
|
throw error;
|
|
7143
|
+
}
|
|
7144
|
+
}
|
|
7145
|
+
|
|
7146
|
+
// commands/issue.ts
|
|
7147
|
+
async function runIssueCommand(options) {
|
|
7148
|
+
const { issueNumber, config, issueProvider, executionProvider, logger } = options;
|
|
7149
|
+
const ROOT = options.repoRoot;
|
|
7150
|
+
let executionSession;
|
|
7151
|
+
try {
|
|
7152
|
+
executionSession = await executionProvider.createSession?.();
|
|
7153
|
+
const runOptions = executionSession ? { ...options, executionProvider: executionSession } : options;
|
|
7154
|
+
return await runIssueLifecycle({
|
|
7155
|
+
issueNumber,
|
|
7156
|
+
config,
|
|
7157
|
+
issueProvider,
|
|
7158
|
+
logger,
|
|
7159
|
+
repoRoot: ROOT,
|
|
7160
|
+
runOptions,
|
|
7161
|
+
deps: {
|
|
7162
|
+
startIssueRun,
|
|
7163
|
+
advanceIssueRunReview,
|
|
7164
|
+
advanceIssueFinalReview,
|
|
7165
|
+
completeIssueRun,
|
|
7166
|
+
failIssueRun,
|
|
7167
|
+
transitionReviewNeedsHumanToHandoff: transitionIssueToHumanHandoff,
|
|
7168
|
+
transitionIssueFinalReviewNeedsHumanToHandoff: async ({
|
|
7169
|
+
issueNumber: issueNumber2,
|
|
7170
|
+
finalReviewResult
|
|
7171
|
+
}) => {
|
|
7172
|
+
const transitions = createIssueTransitions(
|
|
7173
|
+
{
|
|
7174
|
+
fetchIssue: issueProvider.fetchIssue.bind(issueProvider),
|
|
7175
|
+
addLabels: issueProvider.addLabels.bind(issueProvider),
|
|
7176
|
+
removeLabel: issueProvider.removeLabel.bind(issueProvider),
|
|
7177
|
+
closeIssue: issueProvider.closeIssue.bind(issueProvider)
|
|
7178
|
+
},
|
|
7179
|
+
{
|
|
7180
|
+
blocked: config.labels.blocked,
|
|
7181
|
+
readyForAgent: config.labels.readyForAgent,
|
|
7182
|
+
needsTriage: config.labels.needsTriage,
|
|
7183
|
+
agentInProgress: config.labels.agentInProgress,
|
|
7184
|
+
readyForHuman: config.labels.readyForHuman,
|
|
7185
|
+
prOpenAwaitingMerge: config.labels.prOpenAwaitingMerge
|
|
7186
|
+
}
|
|
7187
|
+
);
|
|
7188
|
+
await transitions.moveToReadyForHuman(issueNumber2);
|
|
7189
|
+
const comment = [
|
|
7190
|
+
"Pourkit stopped the Issue Final Review because human review is needed.",
|
|
7191
|
+
"",
|
|
7192
|
+
finalReviewResult.needsHumanReason,
|
|
7193
|
+
"",
|
|
7194
|
+
"Artifacts:",
|
|
7195
|
+
`- Issue Final Review: ${finalReviewResult.artifactPath}`
|
|
7196
|
+
].join("\n");
|
|
7197
|
+
await issueProvider.commentIssue(issueNumber2, comment);
|
|
7198
|
+
logger.step(
|
|
7199
|
+
"info",
|
|
7200
|
+
`Issue Final Review requires human handoff for issue ${issueNumber2}`
|
|
7201
|
+
);
|
|
7202
|
+
}
|
|
7203
|
+
}
|
|
7204
|
+
});
|
|
7191
7205
|
} finally {
|
|
7192
7206
|
await executionSession?.close();
|
|
7193
7207
|
}
|
|
@@ -15444,11 +15458,11 @@ function createCliProgram(version) {
|
|
|
15444
15458
|
return program;
|
|
15445
15459
|
}
|
|
15446
15460
|
async function resolveCliVersion() {
|
|
15447
|
-
if (isPackageVersion("0.0.0-next-
|
|
15448
|
-
return "0.0.0-next-
|
|
15461
|
+
if (isPackageVersion("0.0.0-next-20260621003351")) {
|
|
15462
|
+
return "0.0.0-next-20260621003351";
|
|
15449
15463
|
}
|
|
15450
|
-
if (isReleaseVersion("0.0.0-next-
|
|
15451
|
-
return "0.0.0-next-
|
|
15464
|
+
if (isReleaseVersion("0.0.0-next-20260621003351")) {
|
|
15465
|
+
return "0.0.0-next-20260621003351";
|
|
15452
15466
|
}
|
|
15453
15467
|
try {
|
|
15454
15468
|
const root = repoRoot();
|