@pourkit/cli 0.0.0-next-20260531183322 → 0.0.0-next-20260531213458
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 +56 -21
- package/dist/cli.js.map +1 -1
- package/dist/e2e/run-live-e2e.js +52 -17
- package/dist/e2e/run-live-e2e.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -745,8 +745,7 @@ function getVerificationCommands(target) {
|
|
|
745
745
|
}
|
|
746
746
|
async function loadRepoConfig(repoRoot2, configFileName = "pourkit.config.ts") {
|
|
747
747
|
const { existsSync: existsSync10 } = await import("fs");
|
|
748
|
-
const {
|
|
749
|
-
const { tmpdir } = await import("os");
|
|
748
|
+
const { mkdir: mkdir5, writeFile: writeFile3, rm } = await import("fs/promises");
|
|
750
749
|
const { join: pjoin, basename } = await import("path");
|
|
751
750
|
const { pathToFileURL: pathToFileURL2 } = await import("url");
|
|
752
751
|
const { build } = await import("esbuild");
|
|
@@ -756,8 +755,10 @@ async function loadRepoConfig(repoRoot2, configFileName = "pourkit.config.ts") {
|
|
|
756
755
|
`No config file found at ${configPath}. Create a ${configFileName} that exports a default PourkitConfig.`
|
|
757
756
|
);
|
|
758
757
|
}
|
|
758
|
+
const tmpDir = pjoin(repoRoot2, ".pourkit", ".tmp", "config");
|
|
759
|
+
await mkdir5(tmpDir, { recursive: true });
|
|
759
760
|
const tmpFile = pjoin(
|
|
760
|
-
|
|
761
|
+
tmpDir,
|
|
761
762
|
`pourkit-config-${Date.now()}-${Math.random().toString(36).slice(2, 8)}.mjs`
|
|
762
763
|
);
|
|
763
764
|
try {
|
|
@@ -1295,6 +1296,30 @@ var RecoveryArtifactInvalid = class extends Error {
|
|
|
1295
1296
|
this.reason = args.reason;
|
|
1296
1297
|
}
|
|
1297
1298
|
};
|
|
1299
|
+
var ConfigFailure = class extends Error {
|
|
1300
|
+
_tag = "ConfigFailure";
|
|
1301
|
+
configKey;
|
|
1302
|
+
expectedType;
|
|
1303
|
+
message;
|
|
1304
|
+
constructor(args) {
|
|
1305
|
+
super(args.message);
|
|
1306
|
+
this.name = "ConfigFailure";
|
|
1307
|
+
this.configKey = args.configKey;
|
|
1308
|
+
this.expectedType = args.expectedType;
|
|
1309
|
+
this.message = args.message;
|
|
1310
|
+
}
|
|
1311
|
+
};
|
|
1312
|
+
var SafetyFailure = class extends Error {
|
|
1313
|
+
_tag = "SafetyFailure";
|
|
1314
|
+
sensitivityKind;
|
|
1315
|
+
message;
|
|
1316
|
+
constructor(args) {
|
|
1317
|
+
super(args.message);
|
|
1318
|
+
this.name = "SafetyFailure";
|
|
1319
|
+
this.sensitivityKind = args.sensitivityKind;
|
|
1320
|
+
this.message = args.message;
|
|
1321
|
+
}
|
|
1322
|
+
};
|
|
1298
1323
|
var SUPPORTED_DECISIONS = /* @__PURE__ */ new Set([
|
|
1299
1324
|
"RETRY_STAGE",
|
|
1300
1325
|
"HANDOFF_TO_HUMAN",
|
|
@@ -1875,7 +1900,7 @@ import { join as join6 } from "path";
|
|
|
1875
1900
|
|
|
1876
1901
|
// failure-resolution/recovery-policy.ts
|
|
1877
1902
|
function isSecuritySensitiveFailure(failure) {
|
|
1878
|
-
return failure instanceof PublishedHistoryRisk;
|
|
1903
|
+
return failure instanceof PublishedHistoryRisk || failure instanceof SafetyFailure;
|
|
1879
1904
|
}
|
|
1880
1905
|
async function evaluateRecoveryPolicy(params) {
|
|
1881
1906
|
if (isSecuritySensitiveFailure(params.failure)) {
|
|
@@ -1884,6 +1909,14 @@ async function evaluateRecoveryPolicy(params) {
|
|
|
1884
1909
|
reason: "Security-sensitive failure \u2014 AI recovery bypassed"
|
|
1885
1910
|
};
|
|
1886
1911
|
}
|
|
1912
|
+
if (params.failure instanceof ConfigFailure) {
|
|
1913
|
+
if (params.agentRecommendedDecision !== "FAIL_RUN" && params.agentRecommendedDecision !== "HANDOFF_TO_HUMAN") {
|
|
1914
|
+
return {
|
|
1915
|
+
decision: "HANDOFF_TO_HUMAN",
|
|
1916
|
+
reason: `ConfigFailure \u2014 agent recommended ${params.agentRecommendedDecision} but config errors are not AI-repairable`
|
|
1917
|
+
};
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1887
1920
|
const budget = recoveryBudgetForFailure(
|
|
1888
1921
|
params.worktreePath,
|
|
1889
1922
|
params.fingerprint,
|
|
@@ -1913,13 +1946,13 @@ async function evaluateRecoveryPolicy(params) {
|
|
|
1913
1946
|
// failure-resolution/failure-resolution-agent.ts
|
|
1914
1947
|
function constructFailureResolutionPacket(failure, context) {
|
|
1915
1948
|
return {
|
|
1916
|
-
failureType:
|
|
1949
|
+
failureType: failure._tag,
|
|
1917
1950
|
stageName: context.stageName,
|
|
1918
1951
|
attemptNumber: context.attemptNumber,
|
|
1919
1952
|
worktreePath: context.worktreePath,
|
|
1920
1953
|
branchName: context.branchName,
|
|
1921
1954
|
baseBranch: context.baseBranch,
|
|
1922
|
-
conflictedPaths: failure.conflictedPaths,
|
|
1955
|
+
conflictedPaths: failure instanceof RebaseConflict ? failure.conflictedPaths : void 0,
|
|
1923
1956
|
failureSummary: failure.message,
|
|
1924
1957
|
maxAttempts: context.maxAttempts,
|
|
1925
1958
|
allowedDecisions: context.allowedDecisions,
|
|
@@ -1940,10 +1973,7 @@ async function runFailureResolutionAgent(options) {
|
|
|
1940
1973
|
const frConfig = target.strategy.failureResolution;
|
|
1941
1974
|
const artifactPath = packet.artifactTarget;
|
|
1942
1975
|
const fullArtifactPath = join6(worktreePath, artifactPath);
|
|
1943
|
-
const fingerprint = computeFailureFingerprint(
|
|
1944
|
-
"baseRefresh",
|
|
1945
|
-
"RebaseConflict"
|
|
1946
|
-
);
|
|
1976
|
+
const fingerprint = computeFailureFingerprint(packet.stageName, failure._tag);
|
|
1947
1977
|
const prompt = [
|
|
1948
1978
|
`# Failure Resolution: ${packet.failureType}`,
|
|
1949
1979
|
"",
|
|
@@ -1982,7 +2012,8 @@ async function runFailureResolutionAgent(options) {
|
|
|
1982
2012
|
fingerprint,
|
|
1983
2013
|
`Agent execution failed: ${executionResult.error}`,
|
|
1984
2014
|
void 0,
|
|
1985
|
-
"HANDOFF_TO_HUMAN"
|
|
2015
|
+
"HANDOFF_TO_HUMAN",
|
|
2016
|
+
packet.stageName
|
|
1986
2017
|
);
|
|
1987
2018
|
return {
|
|
1988
2019
|
status: "handoff",
|
|
@@ -1997,7 +2028,8 @@ async function runFailureResolutionAgent(options) {
|
|
|
1997
2028
|
fingerprint,
|
|
1998
2029
|
"Agent did not write artifact",
|
|
1999
2030
|
void 0,
|
|
2000
|
-
"HANDOFF_TO_HUMAN"
|
|
2031
|
+
"HANDOFF_TO_HUMAN",
|
|
2032
|
+
packet.stageName
|
|
2001
2033
|
);
|
|
2002
2034
|
return {
|
|
2003
2035
|
status: "handoff",
|
|
@@ -2017,7 +2049,8 @@ async function runFailureResolutionAgent(options) {
|
|
|
2017
2049
|
fingerprint,
|
|
2018
2050
|
reason,
|
|
2019
2051
|
void 0,
|
|
2020
|
-
"HANDOFF_TO_HUMAN"
|
|
2052
|
+
"HANDOFF_TO_HUMAN",
|
|
2053
|
+
packet.stageName
|
|
2021
2054
|
);
|
|
2022
2055
|
return { status: "handoff", decision: "HANDOFF_TO_HUMAN", reason };
|
|
2023
2056
|
}
|
|
@@ -2032,7 +2065,8 @@ async function runFailureResolutionAgent(options) {
|
|
|
2032
2065
|
fingerprint,
|
|
2033
2066
|
validation.reason,
|
|
2034
2067
|
void 0,
|
|
2035
|
-
"HANDOFF_TO_HUMAN"
|
|
2068
|
+
"HANDOFF_TO_HUMAN",
|
|
2069
|
+
packet.stageName
|
|
2036
2070
|
);
|
|
2037
2071
|
return {
|
|
2038
2072
|
status: "handoff",
|
|
@@ -2054,7 +2088,8 @@ async function runFailureResolutionAgent(options) {
|
|
|
2054
2088
|
fingerprint,
|
|
2055
2089
|
policyResult.reason,
|
|
2056
2090
|
artifactPath,
|
|
2057
|
-
policyResult.decision
|
|
2091
|
+
policyResult.decision,
|
|
2092
|
+
packet.stageName
|
|
2058
2093
|
);
|
|
2059
2094
|
if (policyResult.decision === "HANDOFF_TO_HUMAN") {
|
|
2060
2095
|
return {
|
|
@@ -2076,12 +2111,12 @@ async function runFailureResolutionAgent(options) {
|
|
|
2076
2111
|
artifact
|
|
2077
2112
|
};
|
|
2078
2113
|
}
|
|
2079
|
-
async function writeRecoveryAttempt(worktreePath, outcome, fingerprint, summary, artifactRef, decision) {
|
|
2114
|
+
async function writeRecoveryAttempt(worktreePath, outcome, fingerprint, summary, artifactRef, decision, stageName = "baseRefresh") {
|
|
2080
2115
|
writeAttemptLog(worktreePath, {
|
|
2081
2116
|
attemptType: "recovery",
|
|
2082
2117
|
fingerprint,
|
|
2083
2118
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2084
|
-
stage:
|
|
2119
|
+
stage: stageName,
|
|
2085
2120
|
outcome,
|
|
2086
2121
|
artifactRef,
|
|
2087
2122
|
decision: decision ?? (outcome === "handoff" ? "HANDOFF_TO_HUMAN" : outcome === "success" ? "RETRY_STAGE" : void 0)
|
|
@@ -9041,11 +9076,11 @@ function createCliProgram(version) {
|
|
|
9041
9076
|
return program;
|
|
9042
9077
|
}
|
|
9043
9078
|
async function resolveCliVersion() {
|
|
9044
|
-
if (isPackageVersion("0.0.0-next-
|
|
9045
|
-
return "0.0.0-next-
|
|
9079
|
+
if (isPackageVersion("0.0.0-next-20260531213458")) {
|
|
9080
|
+
return "0.0.0-next-20260531213458";
|
|
9046
9081
|
}
|
|
9047
|
-
if (isReleaseVersion("0.0.0-next-
|
|
9048
|
-
return "0.0.0-next-
|
|
9082
|
+
if (isReleaseVersion("0.0.0-next-20260531213458")) {
|
|
9083
|
+
return "0.0.0-next-20260531213458";
|
|
9049
9084
|
}
|
|
9050
9085
|
try {
|
|
9051
9086
|
const root = repoRoot();
|