oh-my-copilot 5.19.3 → 5.19.4
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/bridge/claude-md-coordinator.cjs +2 -2
- package/bridge/cli.cjs +315 -141
- package/bridge/mcp-server.cjs +1 -1
- package/dist/__tests__/ci-evidence.test.d.ts +2 -0
- package/dist/__tests__/ci-evidence.test.d.ts.map +1 -0
- package/dist/__tests__/ci-evidence.test.js +210 -0
- package/dist/__tests__/ci-evidence.test.js.map +1 -0
- package/dist/__tests__/run-cjs-windows-stdio-contract.test.js +50 -10
- package/dist/__tests__/run-cjs-windows-stdio-contract.test.js.map +1 -1
- package/dist/__tests__/session-end-process-exit.test.js +15 -5
- package/dist/__tests__/session-end-process-exit.test.js.map +1 -1
- package/dist/__tests__/setup-claude-md-script.test.js +7 -4
- package/dist/__tests__/setup-claude-md-script.test.js.map +1 -1
- package/dist/__tests__/trusted-publishing-contract.test.js +51 -9
- package/dist/__tests__/trusted-publishing-contract.test.js.map +1 -1
- package/dist/cli/commands/release.d.ts.map +1 -1
- package/dist/cli/commands/release.js +11 -2
- package/dist/cli/commands/release.js.map +1 -1
- package/dist/factory/run/__tests__/prepare-gates.test.js +7 -1
- package/dist/factory/run/__tests__/prepare-gates.test.js.map +1 -1
- package/dist/features/lookout/__tests__/lookout.test.js +9 -6
- package/dist/features/lookout/__tests__/lookout.test.js.map +1 -1
- package/dist/forge/__tests__/gh-argv-baseline.factory.test.js +7 -1
- package/dist/forge/__tests__/gh-argv-baseline.factory.test.js.map +1 -1
- package/dist/hooks/__tests__/bridge.test.js +10 -2
- package/dist/hooks/__tests__/bridge.test.js.map +1 -1
- package/dist/hooks/persistent-mode/__tests__/team-ralplan-stop.test.js +7 -0
- package/dist/hooks/persistent-mode/__tests__/team-ralplan-stop.test.js.map +1 -1
- package/dist/hooks/persistent-mode/session-isolation.test.js +23 -14
- package/dist/hooks/persistent-mode/session-isolation.test.js.map +1 -1
- package/dist/installer/__tests__/session-start-template.test.js +16 -8
- package/dist/installer/__tests__/session-start-template.test.js.map +1 -1
- package/dist/release/__tests__/checks.test.js +39 -1
- package/dist/release/__tests__/checks.test.js.map +1 -1
- package/dist/release/__tests__/engine.test.js +236 -3
- package/dist/release/__tests__/engine.test.js.map +1 -1
- package/dist/release/checks.d.ts +18 -1
- package/dist/release/checks.d.ts.map +1 -1
- package/dist/release/checks.js +40 -1
- package/dist/release/checks.js.map +1 -1
- package/dist/release/engine.d.ts +14 -2
- package/dist/release/engine.d.ts.map +1 -1
- package/dist/release/engine.js +211 -44
- package/dist/release/engine.js.map +1 -1
- package/dist/ship/__tests__/gates.test.js +35 -0
- package/dist/ship/__tests__/gates.test.js.map +1 -1
- package/dist/ship/__tests__/workflow-checks.test.js +14 -3
- package/dist/ship/__tests__/workflow-checks.test.js.map +1 -1
- package/dist/ship/gates.d.ts.map +1 -1
- package/dist/ship/gates.js +3 -1
- package/dist/ship/gates.js.map +1 -1
- package/dist/smoke/__tests__/copilot-factory-run-scenario.test.js +7 -1
- package/dist/smoke/__tests__/copilot-factory-run-scenario.test.js.map +1 -1
- package/dist/smoke/__tests__/copilot-sdk-driver.test.js +2 -2
- package/dist/smoke/__tests__/copilot-sdk-driver.test.js.map +1 -1
- package/dist/team/__tests__/runtime-cli.test.js +4 -4
- package/dist/team/__tests__/runtime-cli.test.js.map +1 -1
- package/docs/CLAUDE.md +1 -1
- package/docs/REFERENCE.md +1 -1
- package/package.json +2 -2
- package/plugin.json +1 -1
- package/scripts/ci/duration-sequencer.mjs +69 -0
- package/scripts/ci/durations-reporter.mjs +34 -0
- package/scripts/ci/tree-reuse.mjs +166 -0
- package/scripts/ci/update-test-durations.mjs +62 -0
- package/scripts/persistent-mode.mjs +4 -0
- package/templates/hooks/persistent-mode.mjs +4 -0
- package/bridge/__pycache__/gyoshu_bridge.cpython-314.pyc +0 -0
package/bridge/cli.cjs
CHANGED
|
@@ -83423,11 +83423,11 @@ function evaluateSdkSandbox(probe) {
|
|
|
83423
83423
|
if (probe.applyError) return { id, ok: false, detail: `supported, capabilities ${caps}; the review policy was not applied: ${probe.applyError}` };
|
|
83424
83424
|
const enf = probe.enforcement;
|
|
83425
83425
|
if (enf === void 0 || typeof enf === "string") return { id, ok: false, detail: `supported, capabilities ${caps}; review policy applied; enforcement unread: ${enf ?? "not asked"}` };
|
|
83426
|
-
const
|
|
83426
|
+
const spawn20 = probe.spawn ?? { ok: false, detail: "not run" };
|
|
83427
83427
|
return {
|
|
83428
83428
|
id,
|
|
83429
|
-
ok: !enf.blocked &&
|
|
83430
|
-
detail: `supported, capabilities ${caps}; review policy applied (options.update), enforcement required=${enf.required} blocked=${enf.blocked}${enf.reason ? ` (${enf.reason})` : ""}; spawn canary: ${
|
|
83429
|
+
ok: !enf.blocked && spawn20.ok,
|
|
83430
|
+
detail: `supported, capabilities ${caps}; review policy applied (options.update), enforcement required=${enf.required} blocked=${enf.blocked}${enf.reason ? ` (${enf.reason})` : ""}; spawn canary: ${spawn20.detail}`
|
|
83431
83431
|
};
|
|
83432
83432
|
}
|
|
83433
83433
|
function sliceLogByTime(text4, starts) {
|
|
@@ -96021,8 +96021,8 @@ function rpcMethod(root2, path30, name) {
|
|
|
96021
96021
|
return null;
|
|
96022
96022
|
}
|
|
96023
96023
|
}
|
|
96024
|
-
function bwrapTrialLaunchError(
|
|
96025
|
-
const r =
|
|
96024
|
+
function bwrapTrialLaunchError(spawn20 = defaultTrialSpawner, timeoutMs = 1e4) {
|
|
96025
|
+
const r = spawn20("bwrap", BWRAP_TRIAL_ARGS, timeoutMs);
|
|
96026
96026
|
if (r.error?.code === "ENOENT") return "bwrap (bubblewrap) is not on PATH, and the Linux sandbox runs every shell under it: install bubblewrap";
|
|
96027
96027
|
if (r.error) return `a trial bwrap launch failed: ${errText(r.error)}`;
|
|
96028
96028
|
if (r.status === 0) return null;
|
|
@@ -121348,7 +121348,7 @@ var init_gates = __esm({
|
|
|
121348
121348
|
ANSI = /\x1b\[[0-9;]*[A-Za-z]/g;
|
|
121349
121349
|
GH_LOG_PREFIX = /^[^\t]*\t[^\t]*\t(?:\d{4}-\d\d-\d\dT[\d:.]+Z ?)?/;
|
|
121350
121350
|
ADO_LOG_PREFIX = new RegExp("^\\p{Cf}?\\d{4}-\\d\\d-\\d\\dT[\\d:.]+Z ", "u");
|
|
121351
|
-
FAIL_LINE = /^\s*FAIL\s+(\S+\.(?:test|spec|bench)\.[cm]?[jt]sx?)(.*)$/;
|
|
121351
|
+
FAIL_LINE = /^\s*FAIL\s+(?:\|[^|]+\|\s+|(?!\S+\.(?:test|spec|bench)\.)\S+\s+(?=\S+\.(?:test|spec|bench)\.))?(\S+\.(?:test|spec|bench)\.[cm]?[jt]sx?)(.*)$/;
|
|
121352
121352
|
UNHANDLED = /\bUnhandled (?:Errors?|Rejections?)\b/;
|
|
121353
121353
|
FAILED_SUITES = /\bFailed Suites \d+/;
|
|
121354
121354
|
STEP_ERROR = /##\[error\]/;
|
|
@@ -139396,7 +139396,7 @@ function extractTargetSummary(input, toolName) {
|
|
|
139396
139396
|
if (toolName.includes("Edit") || toolName.includes("Write")) {
|
|
139397
139397
|
const filePath = inp.file_path;
|
|
139398
139398
|
if (filePath) {
|
|
139399
|
-
return (0,
|
|
139399
|
+
return (0, import_path231.basename)(filePath) || filePath;
|
|
139400
139400
|
}
|
|
139401
139401
|
}
|
|
139402
139402
|
if (toolName.includes("Bash")) {
|
|
@@ -139487,7 +139487,7 @@ function processEntry(entry2, agentMap, latestTodos, result, maxAgentMapSize = 5
|
|
|
139487
139487
|
if (block.name === "Task" || block.name === "proxy_Task" || block.name === "Agent" || block.name === "proxy_Agent") {
|
|
139488
139488
|
result.agentCallCount++;
|
|
139489
139489
|
const input = block.input;
|
|
139490
|
-
const
|
|
139490
|
+
const spawn20 = classifyAgentSpawn({
|
|
139491
139491
|
hasName: Boolean(input?.name),
|
|
139492
139492
|
sessionId: entry2.sessionId
|
|
139493
139493
|
});
|
|
@@ -139499,8 +139499,8 @@ function processEntry(entry2, agentMap, latestTodos, result, maxAgentMapSize = 5
|
|
|
139499
139499
|
description: input?.description,
|
|
139500
139500
|
status: "running",
|
|
139501
139501
|
startTime: timestamp2,
|
|
139502
|
-
kind:
|
|
139503
|
-
spawnedBy:
|
|
139502
|
+
kind: spawn20.kind,
|
|
139503
|
+
spawnedBy: spawn20.spawnedBy
|
|
139504
139504
|
};
|
|
139505
139505
|
if (agentMap.size >= maxAgentMapSize) {
|
|
139506
139506
|
let oldestCompleted = null;
|
|
@@ -139663,13 +139663,13 @@ function extractLastRequestTokenUsage(usage) {
|
|
|
139663
139663
|
function getNumericUsageValue(value) {
|
|
139664
139664
|
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
139665
139665
|
}
|
|
139666
|
-
var import_fs200, import_readline5,
|
|
139666
|
+
var import_fs200, import_readline5, import_path231, MAX_TAIL_BYTES, MAX_AGENT_MAP_SIZE, MAX_RECENT_TOOLS, RECENT_TOOLS_SKIP, PERMISSION_TOOLS, PERMISSION_THRESHOLD_MS, pendingPermissionMap, taskToolStates, TASK_STATUSES, THINKING_PART_TYPES2, THINKING_RECENCY_MS, transcriptCache, TRANSCRIPT_CACHE_MAX_SIZE;
|
|
139667
139667
|
var init_transcript = __esm({
|
|
139668
139668
|
"src/hud/transcript.ts"() {
|
|
139669
139669
|
"use strict";
|
|
139670
139670
|
import_fs200 = require("fs");
|
|
139671
139671
|
import_readline5 = require("readline");
|
|
139672
|
-
|
|
139672
|
+
import_path231 = require("path");
|
|
139673
139673
|
init_agent_kind();
|
|
139674
139674
|
MAX_TAIL_BYTES = 4 * 1024 * 1024;
|
|
139675
139675
|
MAX_AGENT_MAP_SIZE = 100;
|
|
@@ -139739,7 +139739,7 @@ function resolveCopilotEventsPath(transcriptPath, sessionId) {
|
|
|
139739
139739
|
if (transcriptPath) {
|
|
139740
139740
|
try {
|
|
139741
139741
|
const stat2 = (0, import_fs201.statSync)(transcriptPath);
|
|
139742
|
-
const candidate = stat2.isDirectory() ? (0,
|
|
139742
|
+
const candidate = stat2.isDirectory() ? (0, import_path232.join)(transcriptPath, "events.jsonl") : (0, import_path232.basename)(transcriptPath) === "events.jsonl" ? transcriptPath : (0, import_path232.join)((0, import_path232.dirname)(transcriptPath), "events.jsonl");
|
|
139743
139743
|
if (isFile3(candidate)) return candidate;
|
|
139744
139744
|
} catch {
|
|
139745
139745
|
}
|
|
@@ -139777,7 +139777,7 @@ function toolTarget(args) {
|
|
|
139777
139777
|
if (!args || typeof args !== "object") return null;
|
|
139778
139778
|
const input = args;
|
|
139779
139779
|
const path30 = str7(input.path) ?? str7(input.file_path) ?? str7(input.fileName);
|
|
139780
|
-
if (path30) return
|
|
139780
|
+
if (path30) return import_path232.win32.basename(path30) || path30;
|
|
139781
139781
|
const command = str7(input.command);
|
|
139782
139782
|
if (command) return command.length > 20 ? `${command.slice(0, 20)}...` : command;
|
|
139783
139783
|
return null;
|
|
@@ -139933,12 +139933,12 @@ function readCopilotEvents(eventsPath, options = {}) {
|
|
|
139933
139933
|
return emptyResult();
|
|
139934
139934
|
}
|
|
139935
139935
|
}
|
|
139936
|
-
var import_fs201,
|
|
139936
|
+
var import_fs201, import_path232, MAX_TAIL_BYTES2, MAX_AGENTS, MAX_RECENT_TOOLS2, CACHE_MAX_SIZE, RECENT_TOOLS_SKIP2, RELEVANT_TYPES, cache;
|
|
139937
139937
|
var init_copilot_events = __esm({
|
|
139938
139938
|
"src/hud/copilot-events.ts"() {
|
|
139939
139939
|
"use strict";
|
|
139940
139940
|
import_fs201 = require("fs");
|
|
139941
|
-
|
|
139941
|
+
import_path232 = require("path");
|
|
139942
139942
|
init_ledger();
|
|
139943
139943
|
MAX_TAIL_BYTES2 = 4 * 1024 * 1024;
|
|
139944
139944
|
MAX_AGENTS = 10;
|
|
@@ -139990,18 +139990,18 @@ function isStateFileStale(filePath) {
|
|
|
139990
139990
|
function resolveStatePath2(directory, filename, sessionId) {
|
|
139991
139991
|
const omcRoot = getOmcRoot(directory);
|
|
139992
139992
|
if (sessionId) {
|
|
139993
|
-
const sessionPath = (0,
|
|
139993
|
+
const sessionPath = (0, import_path233.join)(omcRoot, "state", "sessions", sessionId, filename);
|
|
139994
139994
|
return (0, import_fs202.existsSync)(sessionPath) ? sessionPath : null;
|
|
139995
139995
|
}
|
|
139996
139996
|
let bestPath = null;
|
|
139997
139997
|
let bestMtime = 0;
|
|
139998
|
-
const sessionsDir = (0,
|
|
139998
|
+
const sessionsDir = (0, import_path233.join)(omcRoot, "state", "sessions");
|
|
139999
139999
|
if ((0, import_fs202.existsSync)(sessionsDir)) {
|
|
140000
140000
|
try {
|
|
140001
140001
|
const entries = (0, import_fs202.readdirSync)(sessionsDir, { withFileTypes: true });
|
|
140002
140002
|
for (const entry2 of entries) {
|
|
140003
140003
|
if (!entry2.isDirectory()) continue;
|
|
140004
|
-
const sessionFile = (0,
|
|
140004
|
+
const sessionFile = (0, import_path233.join)(sessionsDir, entry2.name, filename);
|
|
140005
140005
|
if ((0, import_fs202.existsSync)(sessionFile)) {
|
|
140006
140006
|
try {
|
|
140007
140007
|
const mtime = (0, import_fs202.statSync)(sessionFile).mtimeMs;
|
|
@@ -140016,7 +140016,7 @@ function resolveStatePath2(directory, filename, sessionId) {
|
|
|
140016
140016
|
} catch {
|
|
140017
140017
|
}
|
|
140018
140018
|
}
|
|
140019
|
-
const newPath = (0,
|
|
140019
|
+
const newPath = (0, import_path233.join)(omcRoot, "state", filename);
|
|
140020
140020
|
if ((0, import_fs202.existsSync)(newPath)) {
|
|
140021
140021
|
try {
|
|
140022
140022
|
const mtime = (0, import_fs202.statSync)(newPath).mtimeMs;
|
|
@@ -140028,7 +140028,7 @@ function resolveStatePath2(directory, filename, sessionId) {
|
|
|
140028
140028
|
if (!bestPath) bestPath = newPath;
|
|
140029
140029
|
}
|
|
140030
140030
|
}
|
|
140031
|
-
const legacyPath = (0,
|
|
140031
|
+
const legacyPath = (0, import_path233.join)(omcRoot, filename);
|
|
140032
140032
|
if ((0, import_fs202.existsSync)(legacyPath)) {
|
|
140033
140033
|
try {
|
|
140034
140034
|
const mtime = (0, import_fs202.statSync)(legacyPath).mtimeMs;
|
|
@@ -140067,9 +140067,9 @@ function readRalphStateForHud(directory, sessionId) {
|
|
|
140067
140067
|
}
|
|
140068
140068
|
}
|
|
140069
140069
|
function readPrdStateForHud(directory) {
|
|
140070
|
-
let prdPath = (0,
|
|
140070
|
+
let prdPath = (0, import_path233.join)(directory, "prd.json");
|
|
140071
140071
|
if (!(0, import_fs202.existsSync)(prdPath)) {
|
|
140072
|
-
prdPath = (0,
|
|
140072
|
+
prdPath = (0, import_path233.join)(getOmcRoot(directory), "prd.json");
|
|
140073
140073
|
if (!(0, import_fs202.existsSync)(prdPath)) {
|
|
140074
140074
|
return null;
|
|
140075
140075
|
}
|
|
@@ -140151,12 +140151,12 @@ function readAutopilotStateForHud(directory, sessionId) {
|
|
|
140151
140151
|
return null;
|
|
140152
140152
|
}
|
|
140153
140153
|
}
|
|
140154
|
-
var import_fs202,
|
|
140154
|
+
var import_fs202, import_path233, MAX_STATE_AGE_MS2;
|
|
140155
140155
|
var init_omc_state = __esm({
|
|
140156
140156
|
"src/hud/omc-state.ts"() {
|
|
140157
140157
|
"use strict";
|
|
140158
140158
|
import_fs202 = require("fs");
|
|
140159
|
-
|
|
140159
|
+
import_path233 = require("path");
|
|
140160
140160
|
init_worktree_paths();
|
|
140161
140161
|
init_named_workflow_resume_validator();
|
|
140162
140162
|
MAX_STATE_AGE_MS2 = 2 * 60 * 60 * 1e3;
|
|
@@ -140165,7 +140165,7 @@ var init_omc_state = __esm({
|
|
|
140165
140165
|
|
|
140166
140166
|
// src/hud/custom-rate-provider.ts
|
|
140167
140167
|
function getCachePath2() {
|
|
140168
|
-
return (0,
|
|
140168
|
+
return (0, import_path234.join)(
|
|
140169
140169
|
getCopilotConfigDir(),
|
|
140170
140170
|
"plugins",
|
|
140171
140171
|
"oh-my-copilot",
|
|
@@ -140184,7 +140184,7 @@ function readCache2() {
|
|
|
140184
140184
|
function writeCache2(buckets, identity) {
|
|
140185
140185
|
try {
|
|
140186
140186
|
const p = getCachePath2();
|
|
140187
|
-
const dir = (0,
|
|
140187
|
+
const dir = (0, import_path234.dirname)(p);
|
|
140188
140188
|
if (!(0, import_fs203.existsSync)(dir)) (0, import_fs203.mkdirSync)(dir, { recursive: true });
|
|
140189
140189
|
const cache2 = { timestamp: Date.now(), buckets, identity };
|
|
140190
140190
|
(0, import_fs203.writeFileSync)(p, JSON.stringify(cache2, null, 2));
|
|
@@ -140305,14 +140305,14 @@ async function executeCustomProvider(config2) {
|
|
|
140305
140305
|
return { buckets: [], stale: false, error: "command failed" };
|
|
140306
140306
|
}
|
|
140307
140307
|
}
|
|
140308
|
-
var import_child_process60, import_node_crypto19, import_fs203,
|
|
140308
|
+
var import_child_process60, import_node_crypto19, import_fs203, import_path234, CACHE_TTL_MS2, DEFAULT_TIMEOUT_MS4;
|
|
140309
140309
|
var init_custom_rate_provider = __esm({
|
|
140310
140310
|
"src/hud/custom-rate-provider.ts"() {
|
|
140311
140311
|
"use strict";
|
|
140312
140312
|
import_child_process60 = require("child_process");
|
|
140313
140313
|
import_node_crypto19 = require("node:crypto");
|
|
140314
140314
|
import_fs203 = require("fs");
|
|
140315
|
-
|
|
140315
|
+
import_path234 = require("path");
|
|
140316
140316
|
init_config_dir();
|
|
140317
140317
|
CACHE_TTL_MS2 = 3e4;
|
|
140318
140318
|
DEFAULT_TIMEOUT_MS4 = 800;
|
|
@@ -141570,12 +141570,12 @@ function readPlan(path30) {
|
|
|
141570
141570
|
}
|
|
141571
141571
|
}
|
|
141572
141572
|
function readUltragoalStateForHud(directory, now2 = Date.now()) {
|
|
141573
|
-
const root2 = (0,
|
|
141573
|
+
const root2 = (0, import_path235.join)(getOmcRoot(directory), "ultragoal");
|
|
141574
141574
|
if (!(0, import_fs204.existsSync)(root2)) return null;
|
|
141575
|
-
const paths = [(0,
|
|
141575
|
+
const paths = [(0, import_path235.join)(root2, ULTRAGOAL_GOALS)];
|
|
141576
141576
|
try {
|
|
141577
|
-
for (const entry2 of (0, import_fs204.readdirSync)((0,
|
|
141578
|
-
if (entry2.isDirectory()) paths.push((0,
|
|
141577
|
+
for (const entry2 of (0, import_fs204.readdirSync)((0, import_path235.join)(root2, ULTRAGOAL_PLANS_SUBDIR), { withFileTypes: true })) {
|
|
141578
|
+
if (entry2.isDirectory()) paths.push((0, import_path235.join)(root2, ULTRAGOAL_PLANS_SUBDIR, entry2.name, ULTRAGOAL_GOALS));
|
|
141579
141579
|
}
|
|
141580
141580
|
} catch {
|
|
141581
141581
|
}
|
|
@@ -141595,12 +141595,12 @@ function renderUltragoal(state) {
|
|
|
141595
141595
|
const color = state.failed > 0 ? YELLOW10 : GREEN10;
|
|
141596
141596
|
return `goal:${color}${state.complete}/${state.total}${RESET}`;
|
|
141597
141597
|
}
|
|
141598
|
-
var import_fs204,
|
|
141598
|
+
var import_fs204, import_path235, GREEN10, YELLOW10, MAX_PLAN_AGE_MS;
|
|
141599
141599
|
var init_ultragoal = __esm({
|
|
141600
141600
|
"src/hud/elements/ultragoal.ts"() {
|
|
141601
141601
|
"use strict";
|
|
141602
141602
|
import_fs204 = require("fs");
|
|
141603
|
-
|
|
141603
|
+
import_path235 = require("path");
|
|
141604
141604
|
init_worktree_paths();
|
|
141605
141605
|
init_artifacts();
|
|
141606
141606
|
init_colors();
|
|
@@ -142103,10 +142103,10 @@ function settingsFileHasApiKey(filePath) {
|
|
|
142103
142103
|
}
|
|
142104
142104
|
function detectApiKeySource(cwd2) {
|
|
142105
142105
|
if (cwd2) {
|
|
142106
|
-
const projectSettings = (0,
|
|
142106
|
+
const projectSettings = (0, import_path236.join)(cwd2, ".copilot", "settings.local.json");
|
|
142107
142107
|
if (settingsFileHasApiKey(projectSettings)) return "project";
|
|
142108
142108
|
}
|
|
142109
|
-
const globalSettings = (0,
|
|
142109
|
+
const globalSettings = (0, import_path236.join)(getCopilotConfigDir(), "settings.json");
|
|
142110
142110
|
if (settingsFileHasApiKey(globalSettings)) return "global";
|
|
142111
142111
|
if (process.env.ANTHROPIC_API_KEY) return "env";
|
|
142112
142112
|
return null;
|
|
@@ -142115,12 +142115,12 @@ function renderApiKeySource(source) {
|
|
|
142115
142115
|
if (!source) return null;
|
|
142116
142116
|
return `${dim("key:")}${cyan(source)}`;
|
|
142117
142117
|
}
|
|
142118
|
-
var import_fs205,
|
|
142118
|
+
var import_fs205, import_path236;
|
|
142119
142119
|
var init_api_key_source = __esm({
|
|
142120
142120
|
"src/hud/elements/api-key-source.ts"() {
|
|
142121
142121
|
"use strict";
|
|
142122
142122
|
import_fs205 = require("fs");
|
|
142123
|
-
|
|
142123
|
+
import_path236 = require("path");
|
|
142124
142124
|
init_colors();
|
|
142125
142125
|
init_config_dir();
|
|
142126
142126
|
}
|
|
@@ -143122,7 +143122,7 @@ function mergeStdinRateLimits(stdinRateLimits, usageResult) {
|
|
|
143122
143122
|
};
|
|
143123
143123
|
}
|
|
143124
143124
|
function readSessionSummary(stateDir, sessionId) {
|
|
143125
|
-
const statePath = (0,
|
|
143125
|
+
const statePath = (0, import_path237.join)(stateDir, `session-summary-${sessionId}.json`);
|
|
143126
143126
|
if (!(0, import_fs207.existsSync)(statePath)) return null;
|
|
143127
143127
|
try {
|
|
143128
143128
|
return JSON.parse((0, import_fs207.readFileSync)(statePath, "utf-8"));
|
|
@@ -143151,8 +143151,8 @@ function spawnSessionSummaryScript(transcriptPath, stateDir, sessionId) {
|
|
|
143151
143151
|
return;
|
|
143152
143152
|
}
|
|
143153
143153
|
lastSummarySpawnTimestamp = now2;
|
|
143154
|
-
const thisDir = (0,
|
|
143155
|
-
const scriptPath = (0,
|
|
143154
|
+
const thisDir = (0, import_path237.dirname)((0, import_url27.fileURLToPath)(importMetaUrl));
|
|
143155
|
+
const scriptPath = (0, import_path237.join)(
|
|
143156
143156
|
thisDir,
|
|
143157
143157
|
"..",
|
|
143158
143158
|
"..",
|
|
@@ -143198,9 +143198,9 @@ async function calculateSessionHealth(sessionStart, contextPercent, reportedDura
|
|
|
143198
143198
|
function showDiagnostic() {
|
|
143199
143199
|
const version3 = getRuntimePackageVersion();
|
|
143200
143200
|
const configDir = getCopilotConfigDir();
|
|
143201
|
-
const hudScript = (0,
|
|
143202
|
-
const settingsFile = (0,
|
|
143203
|
-
const hudExists = HUD_SCRIPT_NAMES.some((name) => (0, import_fs207.existsSync)((0,
|
|
143201
|
+
const hudScript = (0, import_path237.join)(configDir, "hud", HUD_SCRIPT_NAMES[0]);
|
|
143202
|
+
const settingsFile = (0, import_path237.join)(configDir, "settings.json");
|
|
143203
|
+
const hudExists = HUD_SCRIPT_NAMES.some((name) => (0, import_fs207.existsSync)((0, import_path237.join)(configDir, "hud", name)));
|
|
143204
143204
|
let statusLineOk = false;
|
|
143205
143205
|
try {
|
|
143206
143206
|
const settings = JSON.parse((0, import_fs207.readFileSync)(settingsFile, "utf-8"));
|
|
@@ -143340,7 +143340,7 @@ async function mainImpl(watchMode = false, skipInit = false) {
|
|
|
143340
143340
|
let sessionSummary = null;
|
|
143341
143341
|
const sessionSummaryEnabled = !isCopilotHost && (config2.elements.sessionSummary ?? false);
|
|
143342
143342
|
if (sessionSummaryEnabled && resolvedTranscriptPath && currentSessionId) {
|
|
143343
|
-
const omcStateDir = (0,
|
|
143343
|
+
const omcStateDir = (0, import_path237.join)(getOmcRoot(cwd2), "state");
|
|
143344
143344
|
sessionSummary = readSessionSummary(omcStateDir, currentSessionId);
|
|
143345
143345
|
const shouldSpawn = !sessionSummary?.generatedAt || Date.now() - new Date(sessionSummary.generatedAt).getTime() > 6e4;
|
|
143346
143346
|
if (shouldSpawn) {
|
|
@@ -143404,7 +143404,7 @@ async function mainImpl(watchMode = false, skipInit = false) {
|
|
|
143404
143404
|
apiKeyMode: !isCopilotHost && detectApiKeySource(cwd2) !== null,
|
|
143405
143405
|
subscriptionType: subscriptionInfo.subscriptionType,
|
|
143406
143406
|
rateLimitTier: subscriptionInfo.rateLimitTier,
|
|
143407
|
-
profileName: process.env.COPILOT_HOME ? (0,
|
|
143407
|
+
profileName: process.env.COPILOT_HOME ? (0, import_path237.basename)(process.env.COPILOT_HOME).replace(/^\./, "") : null,
|
|
143408
143408
|
sessionSummary,
|
|
143409
143409
|
lastToolName: transcriptData.lastToolName,
|
|
143410
143410
|
recentTools: transcriptData.recentTools,
|
|
@@ -143430,9 +143430,9 @@ async function mainImpl(watchMode = false, skipInit = false) {
|
|
|
143430
143430
|
}
|
|
143431
143431
|
if (config2.contextLimitWarning.autoCompact && context.contextPercent >= config2.contextLimitWarning.threshold) {
|
|
143432
143432
|
try {
|
|
143433
|
-
const omcStateDir = (0,
|
|
143433
|
+
const omcStateDir = (0, import_path237.join)(getOmcRoot(cwd2), "state");
|
|
143434
143434
|
(0, import_fs207.mkdirSync)(omcStateDir, { recursive: true });
|
|
143435
|
-
const triggerFile = (0,
|
|
143435
|
+
const triggerFile = (0, import_path237.join)(omcStateDir, "compact-requested.json");
|
|
143436
143436
|
(0, import_fs207.writeFileSync)(
|
|
143437
143437
|
triggerFile,
|
|
143438
143438
|
JSON.stringify({
|
|
@@ -143475,7 +143475,7 @@ async function mainImpl(watchMode = false, skipInit = false) {
|
|
|
143475
143475
|
function main2(watchMode = false, skipInit = false) {
|
|
143476
143476
|
return withWorktreePathRenderScope(() => mainImpl(watchMode, skipInit));
|
|
143477
143477
|
}
|
|
143478
|
-
var import_fs207, import_promises39,
|
|
143478
|
+
var import_fs207, import_promises39, import_path237, import_child_process61, import_url27, HUD_SCRIPT_NAMES, HUD_COMMAND_MARKERS, SAME_WINDOW_TOLERANCE_MS, lastSummarySpawnTimestamp, summaryProcessPid;
|
|
143479
143479
|
var init_hud = __esm({
|
|
143480
143480
|
"src/hud/index.ts"() {
|
|
143481
143481
|
"use strict";
|
|
@@ -143500,7 +143500,7 @@ var init_hud = __esm({
|
|
|
143500
143500
|
init_worktree_paths();
|
|
143501
143501
|
import_fs207 = require("fs");
|
|
143502
143502
|
import_promises39 = require("fs/promises");
|
|
143503
|
-
|
|
143503
|
+
import_path237 = require("path");
|
|
143504
143504
|
import_child_process61 = require("child_process");
|
|
143505
143505
|
import_url27 = require("url");
|
|
143506
143506
|
init_worktree_paths();
|
|
@@ -143524,7 +143524,7 @@ __export(index_exports, {
|
|
|
143524
143524
|
module.exports = __toCommonJS(index_exports);
|
|
143525
143525
|
init_esm();
|
|
143526
143526
|
init_source();
|
|
143527
|
-
var
|
|
143527
|
+
var import_path238 = require("path");
|
|
143528
143528
|
var import_fs208 = require("fs");
|
|
143529
143529
|
init_config_dir();
|
|
143530
143530
|
init_env_vars();
|
|
@@ -162947,7 +162947,7 @@ init_factory();
|
|
|
162947
162947
|
// src/cli/commands/ship.ts
|
|
162948
162948
|
init_esm();
|
|
162949
162949
|
init_source();
|
|
162950
|
-
var
|
|
162950
|
+
var import_path225 = require("path");
|
|
162951
162951
|
init_config4();
|
|
162952
162952
|
init_exec();
|
|
162953
162953
|
init_gates();
|
|
@@ -162958,13 +162958,13 @@ init_agent_progress();
|
|
|
162958
162958
|
var import_child_process59 = require("child_process");
|
|
162959
162959
|
var import_fs195 = require("fs");
|
|
162960
162960
|
var import_os46 = require("os");
|
|
162961
|
-
var
|
|
162961
|
+
var import_path224 = require("path");
|
|
162962
162962
|
init_process_utils();
|
|
162963
162963
|
|
|
162964
162964
|
// src/release/engine.ts
|
|
162965
162965
|
var import_child_process58 = require("child_process");
|
|
162966
162966
|
var import_fs194 = require("fs");
|
|
162967
|
-
var
|
|
162967
|
+
var import_path223 = require("path");
|
|
162968
162968
|
var import_url25 = require("url");
|
|
162969
162969
|
init_atomic_write();
|
|
162970
162970
|
init_config4();
|
|
@@ -162973,6 +162973,7 @@ init_gates();
|
|
|
162973
162973
|
|
|
162974
162974
|
// src/release/checks.ts
|
|
162975
162975
|
var import_crypto63 = require("crypto");
|
|
162976
|
+
var import_path222 = require("path");
|
|
162976
162977
|
var VERSION_RE = /^\d+\.\d+\.\d+$/;
|
|
162977
162978
|
function parseReleaseVersion(raw) {
|
|
162978
162979
|
const v = raw.trim().replace(/^v/, "");
|
|
@@ -163134,6 +163135,32 @@ function tagTargetProblem(tag, objectType3, peeled, expected) {
|
|
|
163134
163135
|
if (peeled.trim() !== expected) return `${tag}^{} is ${peeled.trim().slice(0, 12) || "unresolved"}, not the main merge commit ${expected.slice(0, 12)}`;
|
|
163135
163136
|
return null;
|
|
163136
163137
|
}
|
|
163138
|
+
function isWslBash(path30, env2) {
|
|
163139
|
+
const slashed = (s) => s.toLowerCase().replace(/\\/g, "/");
|
|
163140
|
+
const p = slashed(path30);
|
|
163141
|
+
const system = `${slashed(env2.SystemRoot ?? env2.SYSTEMROOT ?? "C:/Windows").replace(/\/$/, "")}/`;
|
|
163142
|
+
return p.startsWith(`${system}system32/`) || p.startsWith(`${system}sysnative/`) || p.includes("/windowsapps/");
|
|
163143
|
+
}
|
|
163144
|
+
function suiteShellFor(platform, env2, exists, gitExecPath) {
|
|
163145
|
+
if (platform !== "win32") return { env: {} };
|
|
163146
|
+
const key = Object.keys(env2).find((k) => k.toUpperCase() === "PATH") ?? "PATH";
|
|
163147
|
+
const path30 = env2[key] ?? "";
|
|
163148
|
+
const first = path30.split(";").filter(Boolean).map((dir) => import_path222.win32.join(dir, "bash.exe")).find(exists);
|
|
163149
|
+
if (first && !isWslBash(first, env2)) return { env: {} };
|
|
163150
|
+
const roots = [
|
|
163151
|
+
...gitExecPath ? [import_path222.win32.resolve(gitExecPath.trim(), "..", "..", "..")] : [],
|
|
163152
|
+
...[env2.ProgramFiles, env2.ProgramW6432, env2["ProgramFiles(x86)"]].filter((d) => !!d).map((d) => import_path222.win32.join(d, "Git")),
|
|
163153
|
+
...env2.LOCALAPPDATA ? [import_path222.win32.join(env2.LOCALAPPDATA, "Programs", "Git")] : []
|
|
163154
|
+
];
|
|
163155
|
+
const hasBash = (dir) => exists(import_path222.win32.join(dir, "bash.exe"));
|
|
163156
|
+
const top = roots.map((r) => import_path222.win32.join(r, "bin")).find(hasBash);
|
|
163157
|
+
const bin = top ?? roots.map((r) => import_path222.win32.join(r, "usr", "bin")).find(hasBash);
|
|
163158
|
+
if (!bin) {
|
|
163159
|
+
return { problem: `the suite needs Git for Windows bash, but ${first ? `the first bash on PATH is WSL's (${first})` : "no bash.exe is on PATH"} and none was found under ${roots.join(", ") || "(no Git install dir)"}; install Git for Windows or put its bin directory first on PATH` };
|
|
163160
|
+
}
|
|
163161
|
+
const shell = { env: { [key]: `${bin};${path30}` } };
|
|
163162
|
+
return top ? shell : { ...shell, note: `no bash.exe in Git for Windows' bin directory; the suite uses ${import_path222.win32.join(bin, "bash.exe")}` };
|
|
163163
|
+
}
|
|
163137
163164
|
|
|
163138
163165
|
// src/release/engine.ts
|
|
163139
163166
|
init_copilot_binary();
|
|
@@ -163146,22 +163173,40 @@ var UsageError = class extends Error {
|
|
|
163146
163173
|
};
|
|
163147
163174
|
var PROSE_FILES = ["CHANGELOG.md", ".github/release-body.md", "README.md", "docs/REFERENCE.md", "docs/MIGRATION.md"];
|
|
163148
163175
|
var SHELL_SAFE_ARG = /^[\w@./:=-]+$/;
|
|
163149
|
-
|
|
163176
|
+
function releaseSpawn(cmd, args, opts) {
|
|
163150
163177
|
const shell = process.platform === "win32" && cmd === "npm";
|
|
163151
163178
|
if (shell && !args.every((a) => SHELL_SAFE_ARG.test(a))) {
|
|
163152
|
-
return { status: 1, stdout: "", stderr: `refusing to pass ${JSON.stringify(args)} to npm through cmd.exe` };
|
|
163179
|
+
return { refused: { status: 1, stdout: "", stderr: `refusing to pass ${JSON.stringify(args)} to npm through cmd.exe` } };
|
|
163153
163180
|
}
|
|
163154
163181
|
const base = scrubShipEnv(process.env);
|
|
163155
163182
|
if (opts?.suiteEnv) delete base.GIT_NO_REPLACE_OBJECTS;
|
|
163156
|
-
|
|
163157
|
-
|
|
163158
|
-
|
|
163159
|
-
|
|
163160
|
-
|
|
163161
|
-
|
|
163162
|
-
|
|
163163
|
-
|
|
163183
|
+
return {
|
|
163184
|
+
file: shell ? ["npm", ...args].join(" ") : cmd,
|
|
163185
|
+
args: shell ? [] : args,
|
|
163186
|
+
options: { cwd: opts?.cwd, env: { ...base, ...opts?.env }, windowsHide: true, shell, timeout: opts?.timeoutMs }
|
|
163187
|
+
};
|
|
163188
|
+
}
|
|
163189
|
+
var defaultReleaseExecAsync = (cmd, args, opts) => {
|
|
163190
|
+
const s = releaseSpawn(cmd, args, opts);
|
|
163191
|
+
if ("refused" in s) return Promise.resolve(s.refused);
|
|
163192
|
+
return new Promise((done) => {
|
|
163193
|
+
let stdout = "";
|
|
163194
|
+
let stderr = "";
|
|
163195
|
+
const child = (0, import_child_process58.spawn)(s.file, s.args, { ...s.options, stdio: ["ignore", "pipe", "pipe"] });
|
|
163196
|
+
child.stdout?.setEncoding("utf8").on("data", (d) => {
|
|
163197
|
+
stdout += d;
|
|
163198
|
+
});
|
|
163199
|
+
child.stderr?.setEncoding("utf8").on("data", (d) => {
|
|
163200
|
+
stderr += d;
|
|
163201
|
+
});
|
|
163202
|
+
child.on("error", (error2) => done({ status: 1, stdout, stderr: `${stderr}${error2.message}` }));
|
|
163203
|
+
child.on("close", (code, signal) => done({ status: code ?? 1, stdout, stderr: code === null ? `${stderr}killed by ${signal}` : stderr }));
|
|
163164
163204
|
});
|
|
163205
|
+
};
|
|
163206
|
+
var defaultReleaseExec = (cmd, args, opts) => {
|
|
163207
|
+
const s = releaseSpawn(cmd, args, opts);
|
|
163208
|
+
if ("refused" in s) return s.refused;
|
|
163209
|
+
const result = (0, import_child_process58.spawnSync)(s.file, s.args, { ...s.options, encoding: "utf8", maxBuffer: 512 * 1024 * 1024 });
|
|
163165
163210
|
return {
|
|
163166
163211
|
status: result.status ?? 1,
|
|
163167
163212
|
stdout: result.stdout ?? "",
|
|
@@ -163190,10 +163235,10 @@ var pendingWait = (note) => {
|
|
|
163190
163235
|
throw new PendingError({ status: "blocked", note });
|
|
163191
163236
|
};
|
|
163192
163237
|
function releaseStatePath(stateRoot2, version3) {
|
|
163193
|
-
return (0,
|
|
163238
|
+
return (0, import_path223.join)(stateRoot2, "release", `${version3}.json`);
|
|
163194
163239
|
}
|
|
163195
163240
|
function flakyCandidatesPath(stateRoot2, version3) {
|
|
163196
|
-
return (0,
|
|
163241
|
+
return (0, import_path223.join)(stateRoot2, "release", `${version3}-flaky-candidates.json`);
|
|
163197
163242
|
}
|
|
163198
163243
|
function readReleaseState(stateRoot2, version3) {
|
|
163199
163244
|
const path30 = releaseStatePath(stateRoot2, version3);
|
|
@@ -163273,7 +163318,8 @@ function phasePlan(id, v, opts) {
|
|
|
163273
163318
|
`git push origin HEAD:refs/heads/${branch} until the PR is merged (plain, never forced; a refused push blocks)`,
|
|
163274
163319
|
`gh pr create --base dev --head ${branch} (an open one is reused; a merged one when its merge contains HEAD, or the dev tip once a follow-up PR into dev carried HEAD; else blocks)`,
|
|
163275
163320
|
"wait for CI under the ship merge rule (ship.advisoryChecks never block); one rerun of failed jobs, awaited until its new attempt starts",
|
|
163276
|
-
"gh pr merge --admin --merge --match-head-commit <head> when the PR head is local HEAD, ship.allowAdminMerge and dev is a trusted base, else print it"
|
|
163321
|
+
"gh pr merge --admin --merge --match-head-commit <head> when the PR head is local HEAD, ship.allowAdminMerge and dev is a trusted base, else print it",
|
|
163322
|
+
"in one run with suite / smoke: pushed and opened before them, its CI watched while they run; merged only once they pass (a failure leaves the PR open and unmerged); not when a skipped smoke would block pr"
|
|
163277
163323
|
];
|
|
163278
163324
|
case "promote":
|
|
163279
163325
|
return [
|
|
@@ -163315,7 +163361,7 @@ var Release = class {
|
|
|
163315
163361
|
save(patch) {
|
|
163316
163362
|
this.state = { ...this.state, ...patch, updatedAt: new Date(this.deps.now()).toISOString() };
|
|
163317
163363
|
const path30 = releaseStatePath(this.deps.stateRoot, this.v);
|
|
163318
|
-
(0, import_fs194.mkdirSync)((0,
|
|
163364
|
+
(0, import_fs194.mkdirSync)((0, import_path223.join)(this.deps.stateRoot, "release"), { recursive: true });
|
|
163319
163365
|
atomicWriteJsonSync(path30, this.state);
|
|
163320
163366
|
}
|
|
163321
163367
|
run(cmd, args, opts) {
|
|
@@ -163342,7 +163388,7 @@ ${r.stderr}`)) throw new PendingError(outcome);
|
|
|
163342
163388
|
this.must(this.deps.node, [script, ...args], `node ${[script, ...args].join(" ")}`);
|
|
163343
163389
|
}
|
|
163344
163390
|
file(rel) {
|
|
163345
|
-
const path30 = (0,
|
|
163391
|
+
const path30 = (0, import_path223.join)(this.deps.root, rel);
|
|
163346
163392
|
return (0, import_fs194.existsSync)(path30) ? (0, import_fs194.readFileSync)(path30, "utf8") : null;
|
|
163347
163393
|
}
|
|
163348
163394
|
readPkgName() {
|
|
@@ -163362,7 +163408,7 @@ ${r.stderr}`)) throw new PendingError(outcome);
|
|
|
163362
163408
|
case "gates":
|
|
163363
163409
|
return this.gates();
|
|
163364
163410
|
case "suite":
|
|
163365
|
-
return this.suite();
|
|
163411
|
+
return await this.suite();
|
|
163366
163412
|
case "smoke":
|
|
163367
163413
|
return this.smoke();
|
|
163368
163414
|
case "commit":
|
|
@@ -163409,7 +163455,7 @@ ${r.stderr}`)) throw new PendingError(outcome);
|
|
|
163409
163455
|
} else if (!/E404/.test(latest2.stderr)) problems.push(`npm view ${this.pkgName} failed: ${tail2(latest2.stderr, 1).join("")}`);
|
|
163410
163456
|
if (this.run("gh", ["auth", "status"]).status !== 0) problems.push("gh is not authenticated (gh auth login)");
|
|
163411
163457
|
const lockRel = this.git("rev-parse", "--git-path", "index.lock");
|
|
163412
|
-
const lock = (0,
|
|
163458
|
+
const lock = (0, import_path223.isAbsolute)(lockRel) ? lockRel : (0, import_path223.join)(this.deps.root, lockRel);
|
|
163413
163459
|
if ((0, import_fs194.existsSync)(lock)) {
|
|
163414
163460
|
problems.push(`${lock} exists; another git process may hold it (not deleted; remove it only when no git process runs): ${this.gitProcesses()}`);
|
|
163415
163461
|
}
|
|
@@ -163436,7 +163482,7 @@ ${r.stderr}`)) throw new PendingError(outcome);
|
|
|
163436
163482
|
const content2 = this.file(stamp.file);
|
|
163437
163483
|
const next = content2 === null ? null : stampVersion(content2, stamp, v);
|
|
163438
163484
|
if (next === null) missing.push(`${stamp.file}: no version stamp`);
|
|
163439
|
-
else if (next !== content2) (0, import_fs194.writeFileSync)((0,
|
|
163485
|
+
else if (next !== content2) (0, import_fs194.writeFileSync)((0, import_path223.join)(this.deps.root, stamp.file), next);
|
|
163440
163486
|
}
|
|
163441
163487
|
if (missing.length > 0) fail8("version stamps missing", missing);
|
|
163442
163488
|
this.script("scripts/generate-prompt-projections.mjs");
|
|
@@ -163448,7 +163494,7 @@ ${r.stderr}`)) throw new PendingError(outcome);
|
|
|
163448
163494
|
this.must("npm", ["run", "build"], "npm run build");
|
|
163449
163495
|
this.git("add", "-f", "dist", "bridge");
|
|
163450
163496
|
const tracked = this.git("ls-files", "dist").split(/\r?\n/).filter(Boolean);
|
|
163451
|
-
const orphans = findDistOrphans(tracked, (p) => (0, import_fs194.existsSync)((0,
|
|
163497
|
+
const orphans = findDistOrphans(tracked, (p) => (0, import_fs194.existsSync)((0, import_path223.join)(this.deps.root, p)));
|
|
163452
163498
|
if (orphans.length > 0) {
|
|
163453
163499
|
if (!this.opts.fixOrphans) fail8(`${orphans.length} dist file(s) without a src source (re-run with --fix-orphans to remove them)`, orphans);
|
|
163454
163500
|
for (let i = 0; i < orphans.length; i += 100) this.git("rm", "-q", "--", ...orphans.slice(i, i + 100));
|
|
@@ -163456,7 +163502,7 @@ ${r.stderr}`)) throw new PendingError(outcome);
|
|
|
163456
163502
|
const untracked = this.git("ls-files", "--others", "dist", "bridge");
|
|
163457
163503
|
if (untracked) fail8("untracked files under dist/ or bridge/ after git add -f", untracked.split(/\r?\n/));
|
|
163458
163504
|
const probes = [];
|
|
163459
|
-
const importProbe = this.run(this.deps.node, ["--input-type=module", "-e", "await import(process.argv[1])", (0, import_url25.pathToFileURL)((0,
|
|
163505
|
+
const importProbe = this.run(this.deps.node, ["--input-type=module", "-e", "await import(process.argv[1])", (0, import_url25.pathToFileURL)((0, import_path223.join)(this.deps.root, "dist", "index.js")).href]);
|
|
163460
163506
|
if (importProbe.status !== 0) probes.push(`import dist/index.js failed: ${tail2(importProbe.stderr, 3).join(" ")}`);
|
|
163461
163507
|
for (const entry2 of ["dist/cli/index.js", "bridge/cli.cjs"]) {
|
|
163462
163508
|
const r = this.run(this.deps.node, [entry2, "--version"]);
|
|
@@ -163487,29 +163533,43 @@ ${r.stderr}`.trim().split(/\r?\n/);
|
|
|
163487
163533
|
this.script("scripts/ci/check-multirepo-paths.mjs");
|
|
163488
163534
|
return { status: "ok", note: "gates green" };
|
|
163489
163535
|
}
|
|
163536
|
+
/** A suite child: through execAsync when given (the release PR's CI is watched meanwhile), with the suite shell env. */
|
|
163537
|
+
async runSuite(args, opts = {}) {
|
|
163538
|
+
const full = { cwd: this.deps.root, ...opts, suiteEnv: true, env: { ...this.suiteEnv, ...opts.env } };
|
|
163539
|
+
return this.deps.execAsync ? this.deps.execAsync(this.deps.node, args, full) : this.deps.exec(this.deps.node, args, full);
|
|
163540
|
+
}
|
|
163541
|
+
suiteEnv = {};
|
|
163490
163542
|
/** After the commit phase: tests of committed state (pack, committed docs, inventory drift) need the release commits. */
|
|
163491
|
-
suite() {
|
|
163543
|
+
async suite() {
|
|
163492
163544
|
const suite = this.opts.suite ?? "none";
|
|
163493
163545
|
const head = this.git("rev-parse", "HEAD");
|
|
163494
163546
|
this.save({ suiteSha: head, suiteRan: suite });
|
|
163547
|
+
if (suite !== "none") {
|
|
163548
|
+
const shell = this.deps.suiteShell?.() ?? { env: {} };
|
|
163549
|
+
if ("problem" in shell) return fail8(`suite not started: ${shell.problem}`);
|
|
163550
|
+
if (shell.note) this.deps.log(` ${shell.note}`);
|
|
163551
|
+
this.suiteEnv = shell.env;
|
|
163552
|
+
}
|
|
163495
163553
|
if (suite === "targeted") {
|
|
163496
163554
|
const tag = this.run("git", ["describe", "--tags", "--abbrev=0", "--match", "v[0-9]*", "HEAD"]);
|
|
163497
163555
|
if (tag.status !== 0) fail8("no v* tag reachable from HEAD for --suite targeted", tail2(tag.stderr, 2));
|
|
163498
|
-
const changed = this.git("diff", "--name-only", `${tag.stdout.trim()}...HEAD`, "--", "src").split(/\r?\n/).filter((f) => /\.(?:ts|tsx|mts)$/.test(f) && !f.endsWith(".d.ts") && (0, import_fs194.existsSync)((0,
|
|
163556
|
+
const changed = this.git("diff", "--name-only", `${tag.stdout.trim()}...HEAD`, "--", "src").split(/\r?\n/).filter((f) => /\.(?:ts|tsx|mts)$/.test(f) && !f.endsWith(".d.ts") && (0, import_fs194.existsSync)((0, import_path223.join)(this.deps.root, f)));
|
|
163499
163557
|
if (changed.length === 0) return { status: "ok", note: `suite: no src changes since ${tag.stdout.trim()} for the targeted suite` };
|
|
163500
163558
|
const args = ["node_modules/vitest/vitest.mjs", "related", "--run", "--exclude", "tests/perf/**", ...changed];
|
|
163501
163559
|
this.deps.log(` node ${args.join(" ")}`);
|
|
163502
|
-
|
|
163560
|
+
const r = await this.runSuite(args);
|
|
163561
|
+
if (r.status !== 0) fail8(`node ${args.join(" ")} failed (exit ${r.status})`, tail2(`${r.stdout}
|
|
163562
|
+
${r.stderr}`));
|
|
163503
163563
|
this.requireClean("targeted suite");
|
|
163504
163564
|
return { status: "ok", note: `targeted suite over ${changed.length} changed src file(s)` };
|
|
163505
163565
|
}
|
|
163506
163566
|
if (suite === "full") {
|
|
163507
|
-
const out = (0,
|
|
163508
|
-
(0, import_fs194.mkdirSync)((0,
|
|
163567
|
+
const out = (0, import_path223.join)(this.deps.stateRoot, "release", `${this.v}-vitest.json`);
|
|
163568
|
+
(0, import_fs194.mkdirSync)((0, import_path223.join)(this.deps.stateRoot, "release"), { recursive: true });
|
|
163509
163569
|
(0, import_fs194.rmSync)(out, { force: true });
|
|
163510
163570
|
(0, import_fs194.rmSync)(flakyCandidatesPath(this.deps.stateRoot, this.v), { force: true });
|
|
163511
163571
|
this.deps.log(` node node_modules/vitest/vitest.mjs run --reporter=json --outputFile=${out}`);
|
|
163512
|
-
const r = this.
|
|
163572
|
+
const r = await this.runSuite(["node_modules/vitest/vitest.mjs", "run", "--exclude", "tests/perf/**", "--reporter=json", `--outputFile=${out}`]);
|
|
163513
163573
|
if (!(0, import_fs194.existsSync)(out)) fail8(`vitest wrote no JSON report (exit ${r.status})`, tail2(r.stderr));
|
|
163514
163574
|
const failing = failingTitlesFromVitestJson((0, import_fs194.readFileSync)(out, "utf8"));
|
|
163515
163575
|
const baseline = this.opts.baseline ? parseBaselineTitles((0, import_fs194.readFileSync)(this.opts.baseline, "utf8")) : [];
|
|
@@ -163519,7 +163579,7 @@ ${r.stderr}`.trim().split(/\r?\n/);
|
|
|
163519
163579
|
this.requireClean("full suite");
|
|
163520
163580
|
return { status: "ok", note: `full suite: ${failing.length} failing, all in the baseline` };
|
|
163521
163581
|
}
|
|
163522
|
-
const triage = this.triage(fresh, head);
|
|
163582
|
+
const triage = await this.triage(fresh, head);
|
|
163523
163583
|
const lines4 = triage.map((t) => `${t.class}: ${t.title} (passed ${t.passes}/${t.runs} isolated reruns)`);
|
|
163524
163584
|
const real2 = triage.filter((t) => t.class === "real").length;
|
|
163525
163585
|
const mixed = triage.filter((t) => t.class === "mixed").length;
|
|
@@ -163551,11 +163611,11 @@ ${r.stderr}`.trim().split(/\r?\n/);
|
|
|
163551
163611
|
* the suite's load. Saved after each title, so a re-run on the same HEAD
|
|
163552
163612
|
* does not repeat finished titles.
|
|
163553
163613
|
*/
|
|
163554
|
-
triage(titles, head) {
|
|
163614
|
+
async triage(titles, head) {
|
|
163555
163615
|
const runs = this.opts.triageRuns ?? 3;
|
|
163556
163616
|
const timeoutMs = (this.opts.triageTimeoutMinutes ?? 5) * 6e4;
|
|
163557
163617
|
const prior = this.state.suiteTriage?.sha === head ? this.state.suiteTriage.results : [];
|
|
163558
|
-
const out = (0,
|
|
163618
|
+
const out = (0, import_path223.join)(this.deps.stateRoot, "release", `${this.v}-triage.json`);
|
|
163559
163619
|
const results = [];
|
|
163560
163620
|
for (const [i, title] of titles.entries()) {
|
|
163561
163621
|
const { file, name } = splitFailingTitle(title);
|
|
@@ -163566,7 +163626,7 @@ ${r.stderr}`.trim().split(/\r?\n/);
|
|
|
163566
163626
|
(0, import_fs194.rmSync)(out, { force: true });
|
|
163567
163627
|
const args = ["node_modules/vitest/vitest.mjs", "run", file, `--testNamePattern=${escapeRe(name)}`, "--reporter=json", `--outputFile=${out}`];
|
|
163568
163628
|
this.deps.log(` node ${args.slice(0, 3).join(" ")} ${JSON.stringify(args[3])} --reporter=json (isolated rerun ${n + 1}/${runs})`);
|
|
163569
|
-
const r = this.
|
|
163629
|
+
const r = await this.runSuite(args, { timeoutMs });
|
|
163570
163630
|
if (r.status === 0 && (0, import_fs194.existsSync)(out) && testPassedInReport((0, import_fs194.readFileSync)(out, "utf8"), file, name)) passes++;
|
|
163571
163631
|
}
|
|
163572
163632
|
result = { title, file, runs: name === null ? 0 : runs, passes, class: classifyTriage(runs, passes, name === null) };
|
|
@@ -163778,11 +163838,49 @@ ${r.stderr}`;
|
|
|
163778
163838
|
if (!m) fail8(`gh pr create printed no PR url: ${out.trim()}`);
|
|
163779
163839
|
return Number(m[1]);
|
|
163780
163840
|
}
|
|
163781
|
-
|
|
163841
|
+
/** Why pr may not merge for want of a live smoke (null = it may). */
|
|
163842
|
+
smokeBlock() {
|
|
163782
163843
|
const smoke = this.state.phases.smoke?.status;
|
|
163783
|
-
if (smoke
|
|
163784
|
-
|
|
163785
|
-
|
|
163844
|
+
if (smoke === "ok" || this.opts.allowSkippedSmoke) return null;
|
|
163845
|
+
return `the live smoke ${smoke === "skipped" ? "was skipped" : "has not passed"}; run it (--from smoke --live-smoke, two prompts, about 0.6 AI credits), or pass --allow-skipped-smoke to release without it`;
|
|
163846
|
+
}
|
|
163847
|
+
/** Whether the smoke phase, run on HEAD now, would skip (no --live-smoke, no reusable green smoke): pr would then block. */
|
|
163848
|
+
smokeWouldSkip() {
|
|
163849
|
+
return !this.opts.liveSmoke && !this.opts.forceSmoke && this.state.lastSmoke?.inputHash !== this.smokeInputs();
|
|
163850
|
+
}
|
|
163851
|
+
/**
|
|
163852
|
+
* Set while pr runs alongside the suite (and smoke): land() awaits it before
|
|
163853
|
+
* merging, and it throws (PhaseStop) when they did not pass.
|
|
163854
|
+
*/
|
|
163855
|
+
mergeGate;
|
|
163856
|
+
/** Set when the suite (or smoke) beside pr did not pass: the CI wait stops at its next pause. */
|
|
163857
|
+
ciAbort;
|
|
163858
|
+
/** The local HEAD the pr phase lands (land()'s expectedHead), once pr has read it. */
|
|
163859
|
+
prHead;
|
|
163860
|
+
/**
|
|
163861
|
+
* Why the merge gate beside the suite must stay shut (null = it may open):
|
|
163862
|
+
* re-checked from the records, not trusted from control flow. The suite
|
|
163863
|
+
* passed at the required level, the smoke rule holds, and the suite's
|
|
163864
|
+
* commit, local HEAD and the head the PR lands are one commit.
|
|
163865
|
+
*/
|
|
163866
|
+
gateProblem() {
|
|
163867
|
+
const suite = this.postconditionProblem("suite");
|
|
163868
|
+
if (suite) return `the suite record does not hold: ${suite}`;
|
|
163869
|
+
const smoke = this.smokeBlock();
|
|
163870
|
+
if (smoke) return smoke;
|
|
163871
|
+
const head = this.git("rev-parse", "HEAD");
|
|
163872
|
+
if (this.state.suiteSha === head && this.prHead === head) return null;
|
|
163873
|
+
const short2 = (sha2) => sha2?.slice(0, 12) ?? "none";
|
|
163874
|
+
return `the suite ran on ${short2(this.state.suiteSha)}, the PR lands ${short2(this.prHead)} and HEAD is ${short2(head)}; they must be one commit (--from suite)`;
|
|
163875
|
+
}
|
|
163876
|
+
/** Every CI wait sleeps here, so a failed suite beside the CI wait ends it at the next poll. */
|
|
163877
|
+
async pause(ms) {
|
|
163878
|
+
await this.deps.sleep(ms);
|
|
163879
|
+
if (this.ciAbort) throw new PhaseStop(this.ciAbort);
|
|
163880
|
+
}
|
|
163881
|
+
async pr() {
|
|
163882
|
+
const smoke = this.mergeGate ? null : this.smokeBlock();
|
|
163883
|
+
if (smoke) blocked(smoke);
|
|
163786
163884
|
const branch = `release/v${this.v}`;
|
|
163787
163885
|
if (this.state.devPr === void 0 || this.viewPr(this.state.devPr).state !== "MERGED") {
|
|
163788
163886
|
const push = this.run("git", ["push", "origin", `HEAD:refs/heads/${branch}`]);
|
|
@@ -163794,7 +163892,8 @@ ${r.stderr}`;
|
|
|
163794
163892
|
this.save({ devPr: pr });
|
|
163795
163893
|
}
|
|
163796
163894
|
}
|
|
163797
|
-
|
|
163895
|
+
this.prHead = this.git("rev-parse", "HEAD");
|
|
163896
|
+
const sha2 = await this.land(this.state.devPr, "dev", "pr", this.prHead);
|
|
163798
163897
|
this.save({ devMergeSha: sha2 });
|
|
163799
163898
|
return { status: "ok", note: `PR #${this.state.devPr} merged into dev at ${sha2.slice(0, 12)}` };
|
|
163800
163899
|
}
|
|
@@ -163842,7 +163941,7 @@ ${rr.stderr}`) });
|
|
|
163842
163941
|
const note = `run ${id} was rerun but attempt ${before + 1} has not started; re-run omg release ${this.v} --from ${phase}`;
|
|
163843
163942
|
if (polls >= RERUN_START_POLLS) blocked(note);
|
|
163844
163943
|
if (this.deps.now() >= this.deadline) pendingWait(note);
|
|
163845
|
-
await this.
|
|
163944
|
+
await this.pause(pollMs);
|
|
163846
163945
|
}
|
|
163847
163946
|
}
|
|
163848
163947
|
return ready.length > 0;
|
|
@@ -163905,13 +164004,20 @@ ${rr.stderr}`) });
|
|
|
163905
164004
|
headSha: view.headRefOid,
|
|
163906
164005
|
watch: true,
|
|
163907
164006
|
reruns: this.rerunBudget,
|
|
163908
|
-
sleep: this.
|
|
164007
|
+
sleep: (ms) => this.pause(ms),
|
|
163909
164008
|
now: this.deps.now,
|
|
163910
164009
|
onReport: (r) => this.deps.progress({ phase, status: "heartbeat", note: `PR #${pr} gates ${r.verdict}: ${r.pending.length} pending, ${r.failed.length} failed` }),
|
|
163911
164010
|
retryTransient: this.opts.drive,
|
|
163912
164011
|
onTransient: (message4) => this.deps.progress({ phase, status: "heartbeat", note: `PR #${pr}: transient GitHub error, retrying (${message4.slice(0, 120)})` })
|
|
163913
164012
|
});
|
|
163914
164013
|
if (report3.verdict === "green") {
|
|
164014
|
+
if (this.mergeGate) {
|
|
164015
|
+
const gate = this.mergeGate;
|
|
164016
|
+
this.mergeGate = void 0;
|
|
164017
|
+
this.deps.progress({ phase, status: "heartbeat", note: `PR #${pr} gates green; merge waits for the suite` });
|
|
164018
|
+
await gate();
|
|
164019
|
+
continue;
|
|
164020
|
+
}
|
|
163915
164021
|
const command = ["pr", "merge", String(pr), "--admin", "--merge", "--match-head-commit", view.headRefOid];
|
|
163916
164022
|
if (!config2.allowAdminMerge || !config2.trustedBases.includes(base)) {
|
|
163917
164023
|
blocked(`PR #${pr} is green; ship.allowAdminMerge is off or ${base} is not a trusted base, so run the merge yourself, then re-run omg release ${this.v} --from ${phase}`, [`gh ${command.join(" ")}`]);
|
|
@@ -163924,7 +164030,7 @@ ${rr.stderr}`) });
|
|
|
163924
164030
|
const failedRuns = [...new Set(report3.checks.filter((c) => c.class === "failed" && c.runId).map((c) => c.runId))];
|
|
163925
164031
|
const finished = failedRuns.filter((id) => !report3.checks.some((c) => c.runId === id && c.class === "pending"));
|
|
163926
164032
|
if (finished.length < failedRuns.length) {
|
|
163927
|
-
await this.
|
|
164033
|
+
await this.pause(config2.pollIntervalSeconds * 1e3);
|
|
163928
164034
|
continue;
|
|
163929
164035
|
}
|
|
163930
164036
|
if (await this.rerunOnce(finished, phase, config2.pollIntervalSeconds * 1e3)) continue;
|
|
@@ -163947,7 +164053,7 @@ ${rr.stderr}`) });
|
|
|
163947
164053
|
if (expected ? view.headRefOid === expected : this.headContains(ancestor, base, view.headRefOid)) return;
|
|
163948
164054
|
const note = expected ? `PR #${pr} head is ${view.headRefOid.slice(0, 12)}, not local HEAD ${expected.slice(0, 12)}; push or merge until they match, then re-run omg release ${this.v} --from ${phase}` : `PR #${pr} head ${view.headRefOid.slice(0, 12)} does not contain ${ancestor.slice(0, 12)}; update the PR, then re-run omg release ${this.v} --from ${phase}`;
|
|
163949
164055
|
if (polls >= HEAD_SYNC_POLLS) blocked(note);
|
|
163950
|
-
await this.
|
|
164056
|
+
await this.pause(HEAD_SYNC_POLL_MS);
|
|
163951
164057
|
}
|
|
163952
164058
|
}
|
|
163953
164059
|
/**
|
|
@@ -164108,7 +164214,7 @@ async function runRelease(deps, requested) {
|
|
|
164108
164214
|
deps.log(`[${start ?? "verify"}] blocked: ${note}`);
|
|
164109
164215
|
return { ok: false, version: v, dryRun: Boolean(requested.dryRun), statePath, phases: [{ id: start ?? "verify", status: "blocked", note }] };
|
|
164110
164216
|
}
|
|
164111
|
-
const baseline = requested.baseline ? (0,
|
|
164217
|
+
const baseline = requested.baseline ? (0, import_path223.resolve)(requested.baseline) : start === "preflight" ? void 0 : existing?.baseline;
|
|
164112
164218
|
const opts = { ...requested, suite: requested.suite ?? recorded ?? "none", baseline };
|
|
164113
164219
|
if (requested.baseline && opts.suite !== "full") throw new UsageError(`--baseline needs --suite full (this release's suite is ${opts.suite})`);
|
|
164114
164220
|
const last = PHASES2.indexOf(opts.to ?? "verify");
|
|
@@ -164149,26 +164255,86 @@ async function runRelease(deps, requested) {
|
|
|
164149
164255
|
return { ok: false, version: v, dryRun: false, statePath, phases: [{ id: selected[0], status: "blocked", note, details: skip }] };
|
|
164150
164256
|
}
|
|
164151
164257
|
if (release.current.suite !== opts.suite || release.current.baseline !== opts.baseline) release.save({ suite: opts.suite, baseline: opts.baseline });
|
|
164152
|
-
|
|
164153
|
-
|
|
164154
|
-
deps.progress({ phase: id, status: "start" });
|
|
164155
|
-
let outcome;
|
|
164156
|
-
try {
|
|
164157
|
-
outcome = await release.phase(id);
|
|
164158
|
-
} catch (error2) {
|
|
164159
|
-
if (error2 instanceof PendingError) return pendingResult(id, error2);
|
|
164160
|
-
throw error2;
|
|
164161
|
-
}
|
|
164162
|
-
const record3 = { ...outcome, at: new Date(deps.now()).toISOString() };
|
|
164258
|
+
const record3 = (id, outcome) => {
|
|
164259
|
+
const entry2 = { ...outcome, at: new Date(deps.now()).toISOString() };
|
|
164163
164260
|
const kept = Object.fromEntries(Object.entries(release.current.phases).filter(([p]) => PHASES2.indexOf(p) < PHASES2.indexOf(id)));
|
|
164164
|
-
release.save({ phases: { ...kept, [id]:
|
|
164261
|
+
release.save({ phases: { ...kept, [id]: entry2 } });
|
|
164165
164262
|
results.push({ id, ...outcome });
|
|
164166
164263
|
deps.progress({ phase: id, status: outcome.status === "skipped" ? "ok" : outcome.status, note: outcome.note });
|
|
164167
164264
|
deps.log(`[${id}] ${outcome.status}: ${outcome.note}`);
|
|
164168
164265
|
for (const d of outcome.details ?? []) deps.log(` ${d}`);
|
|
164169
|
-
|
|
164170
|
-
|
|
164266
|
+
return outcome.status !== "fail" && outcome.status !== "blocked";
|
|
164267
|
+
};
|
|
164268
|
+
const beside = selected.includes("pr") ? selected.filter((id) => id === "suite" || id === "smoke") : [];
|
|
164269
|
+
const besideOk = beside.length > 0 && (opts.allowSkippedSmoke || (beside.includes("smoke") ? !release.smokeWouldSkip() : !release.smokeBlock()));
|
|
164270
|
+
let ci;
|
|
164271
|
+
let gateOpen = false;
|
|
164272
|
+
const stopCi = async (why) => {
|
|
164273
|
+
const pr = `release PR #${release.current.devPr ?? "?"}`;
|
|
164274
|
+
const stop = { status: "blocked", note: `${pr} left open and unmerged: ${why}` };
|
|
164275
|
+
release.ciAbort = stop;
|
|
164276
|
+
ci.shut(stop);
|
|
164277
|
+
const r = await ci.done;
|
|
164278
|
+
if (r.outcome?.status === "ok") return { status: "blocked", note: `${pr} was merged outside the release, although ${why}` };
|
|
164279
|
+
if (r.outcome) return r.outcome;
|
|
164280
|
+
if (r.error instanceof PendingError) return stop;
|
|
164281
|
+
throw r.error;
|
|
164282
|
+
};
|
|
164283
|
+
try {
|
|
164284
|
+
for (const id of selected) {
|
|
164285
|
+
if (id === "pr" && ci) {
|
|
164286
|
+
const problem = release.gateProblem();
|
|
164287
|
+
let r;
|
|
164288
|
+
if (problem) {
|
|
164289
|
+
r = { outcome: await stopCi(problem) };
|
|
164290
|
+
} else {
|
|
164291
|
+
gateOpen = true;
|
|
164292
|
+
ci.open();
|
|
164293
|
+
r = await ci.done;
|
|
164294
|
+
}
|
|
164295
|
+
if (r.error instanceof PendingError) return pendingResult(id, r.error);
|
|
164296
|
+
if (r.error) throw r.error;
|
|
164297
|
+
if (!record3(id, r.outcome)) return { ok: false, version: v, dryRun: false, statePath, phases: results };
|
|
164298
|
+
continue;
|
|
164299
|
+
}
|
|
164300
|
+
if (besideOk && id === beside[0]) {
|
|
164301
|
+
let open9;
|
|
164302
|
+
let shut;
|
|
164303
|
+
const gate = new Promise((resolveGate, reject2) => {
|
|
164304
|
+
open9 = resolveGate;
|
|
164305
|
+
shut = (o) => reject2(new PhaseStop(o));
|
|
164306
|
+
});
|
|
164307
|
+
gate.catch(() => {
|
|
164308
|
+
});
|
|
164309
|
+
release.mergeGate = () => gate;
|
|
164310
|
+
deps.log(`[pr] ${phasePlan("pr", v, opts)[0]} (beside the ${beside.join(" and ")}: merged only once they pass)`);
|
|
164311
|
+
deps.progress({ phase: "pr", status: "start", note: `release PR CI runs beside the ${beside.join(" and ")}` });
|
|
164312
|
+
const done = release.phase("pr").then((outcome2) => ({ outcome: outcome2 }), (error2) => ({ error: error2 }));
|
|
164313
|
+
ci = { done, open: open9, shut };
|
|
164314
|
+
}
|
|
164315
|
+
deps.log(`[${id}] ${phasePlan(id, v, opts)[0]}`);
|
|
164316
|
+
deps.progress({ phase: id, status: "start" });
|
|
164317
|
+
let outcome;
|
|
164318
|
+
try {
|
|
164319
|
+
outcome = await release.phase(id);
|
|
164320
|
+
} catch (error2) {
|
|
164321
|
+
if (error2 instanceof PendingError) {
|
|
164322
|
+
if (ci) await stopCi(`the ${id} phase is pending`);
|
|
164323
|
+
return pendingResult(id, error2);
|
|
164324
|
+
}
|
|
164325
|
+
throw error2;
|
|
164326
|
+
}
|
|
164327
|
+
if (!record3(id, outcome)) {
|
|
164328
|
+
if (ci) {
|
|
164329
|
+
record3("pr", await stopCi(`the ${id} phase ${outcome.status} (${outcome.note}); fix it, then re-run omg release ${v} --from ${id}`));
|
|
164330
|
+
}
|
|
164331
|
+
return { ok: false, version: v, dryRun: false, statePath, phases: results };
|
|
164332
|
+
}
|
|
164171
164333
|
}
|
|
164334
|
+
} catch (error2) {
|
|
164335
|
+
if (ci && !gateOpen) await stopCi(`the release run stopped on an error (${error2 instanceof Error ? error2.message : String(error2)})`).catch(() => {
|
|
164336
|
+
});
|
|
164337
|
+
throw error2;
|
|
164172
164338
|
}
|
|
164173
164339
|
const triage = release.current.suiteTriage;
|
|
164174
164340
|
const flaky = triage && triage.sha === release.current.suiteSha ? triage.results.filter((t) => t.class === "load-flaky").length : 0;
|
|
@@ -164192,10 +164358,10 @@ var defaultDriveProcess = {
|
|
|
164192
164358
|
kill: (pid) => killProcessTree(pid, process.platform === "win32" ? "SIGKILL" : "SIGTERM")
|
|
164193
164359
|
};
|
|
164194
164360
|
function driveLockPath(dir, name) {
|
|
164195
|
-
return (0,
|
|
164361
|
+
return (0, import_path224.join)(dir, `${name}.drive.json`);
|
|
164196
164362
|
}
|
|
164197
164363
|
function driveLogPath(dir, name) {
|
|
164198
|
-
return (0,
|
|
164364
|
+
return (0, import_path224.join)(dir, `${name}.drive.log`);
|
|
164199
164365
|
}
|
|
164200
164366
|
function readDriveLock(path30) {
|
|
164201
164367
|
try {
|
|
@@ -164209,7 +164375,7 @@ async function acquireDriveLock(path30, argv, proc, log3, now2 = Date.now, fsx =
|
|
|
164209
164375
|
const identity = await proc.identity(process.pid) ?? await proc.identity(process.pid);
|
|
164210
164376
|
if (!identity) throw new Error(`cannot read the start identity of pid ${process.pid}; refusing to drive (${path30} could not be told apart from a reused pid by --stop)`);
|
|
164211
164377
|
const lock = { pid: process.pid, startedAt: new Date(now2()).toISOString(), argv, host: (0, import_os46.hostname)(), identity };
|
|
164212
|
-
(0, import_fs195.mkdirSync)((0,
|
|
164378
|
+
(0, import_fs195.mkdirSync)((0, import_path224.dirname)(path30), { recursive: true });
|
|
164213
164379
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
164214
164380
|
try {
|
|
164215
164381
|
(0, import_fs195.writeFileSync)(path30, `${JSON.stringify(lock, null, 2)}
|
|
@@ -164282,7 +164448,7 @@ async function driveRelease(deps, opts, drive = {}) {
|
|
|
164282
164448
|
}
|
|
164283
164449
|
}
|
|
164284
164450
|
function spawnDetachedDriver(entry2, argv, logPath, cwd2, spawnImpl = import_child_process59.spawn) {
|
|
164285
|
-
(0, import_fs195.mkdirSync)((0,
|
|
164451
|
+
(0, import_fs195.mkdirSync)((0, import_path224.dirname)(logPath), { recursive: true });
|
|
164286
164452
|
const fd = (0, import_fs195.openSync)(logPath, "a");
|
|
164287
164453
|
try {
|
|
164288
164454
|
const child = spawnImpl(process.execPath, [entry2, ...argv], { cwd: cwd2, detached: true, stdio: ["ignore", fd, fd], windowsHide: true, env: process.env });
|
|
@@ -164554,7 +164720,7 @@ function shipCommand(execImpl = defaultExec, loadShipConfig = shipConfig, drive
|
|
|
164554
164720
|
const progress = (phase, status, note) => {
|
|
164555
164721
|
emitProgress({ phase, status, note, agent, cwd: root2 });
|
|
164556
164722
|
};
|
|
164557
|
-
const driveDir = (0,
|
|
164723
|
+
const driveDir = (0, import_path225.dirname)(shipStatePath(root2, pr));
|
|
164558
164724
|
const lockPath2 = driveLockPath(driveDir, String(pr));
|
|
164559
164725
|
const logPath = driveLogPath(driveDir, String(pr));
|
|
164560
164726
|
const monitor = `omg progress watch --file ${progressFile} --until settled --stall 30m`;
|
|
@@ -164762,14 +164928,15 @@ function shipCommand(execImpl = defaultExec, loadShipConfig = shipConfig, drive
|
|
|
164762
164928
|
init_esm();
|
|
164763
164929
|
init_source();
|
|
164764
164930
|
var import_fs197 = require("fs");
|
|
164765
|
-
var
|
|
164931
|
+
var import_path227 = require("path");
|
|
164766
164932
|
var import_promises38 = require("readline/promises");
|
|
164767
164933
|
init_config4();
|
|
164768
164934
|
init_worktree_paths();
|
|
164935
|
+
init_windows_search();
|
|
164769
164936
|
|
|
164770
164937
|
// src/release/progress.ts
|
|
164771
164938
|
var import_fs196 = require("fs");
|
|
164772
|
-
var
|
|
164939
|
+
var import_path226 = require("path");
|
|
164773
164940
|
var BARE_VALUE = /^[A-Za-z0-9._:/@+,%#~-]+$/;
|
|
164774
164941
|
var MAX_NOTE = 500;
|
|
164775
164942
|
function quote3(value) {
|
|
@@ -164783,12 +164950,12 @@ function formatReleaseProgress(input, at = /* @__PURE__ */ new Date()) {
|
|
|
164783
164950
|
return parts.join(" ");
|
|
164784
164951
|
}
|
|
164785
164952
|
function releaseProgressFile(stateRoot2) {
|
|
164786
|
-
return process.env.OMG_PROGRESS_FILE || (0,
|
|
164953
|
+
return process.env.OMG_PROGRESS_FILE || (0, import_path226.join)(stateRoot2, "progress", "release.log");
|
|
164787
164954
|
}
|
|
164788
164955
|
function emitReleaseProgress(input, stateRoot2) {
|
|
164789
164956
|
try {
|
|
164790
164957
|
const path30 = input.file || releaseProgressFile(stateRoot2);
|
|
164791
|
-
(0, import_fs196.mkdirSync)((0,
|
|
164958
|
+
(0, import_fs196.mkdirSync)((0, import_path226.dirname)(path30), { recursive: true });
|
|
164792
164959
|
(0, import_fs196.appendFileSync)(path30, `${formatReleaseProgress(input)}
|
|
164793
164960
|
`, "utf8");
|
|
164794
164961
|
return true;
|
|
@@ -164892,6 +165059,13 @@ function releaseCommand(overrides = {}) {
|
|
|
164892
165059
|
const stateRoot2 = overrides.stateRoot ?? getOmcRoot(root2);
|
|
164893
165060
|
const deps = {
|
|
164894
165061
|
exec: exec3,
|
|
165062
|
+
// A scripted exec (tests) runs the suite through itself too, with no PATH check.
|
|
165063
|
+
execAsync: overrides.execAsync ?? (overrides.exec ? void 0 : defaultReleaseExecAsync),
|
|
165064
|
+
suiteShell: overrides.suiteShell ?? (overrides.exec ? void 0 : () => {
|
|
165065
|
+
const gitExe = process.platform === "win32" ? resolveBareExe("git") : null;
|
|
165066
|
+
const git7 = gitExe ? exec3(gitExe, ["--exec-path"]) : null;
|
|
165067
|
+
return suiteShellFor(process.platform, process.env, import_fs197.existsSync, git7?.status === 0 && git7.stdout.trim() ? git7.stdout : null);
|
|
165068
|
+
}),
|
|
164895
165069
|
root: root2,
|
|
164896
165070
|
stateRoot: stateRoot2,
|
|
164897
165071
|
node: overrides.node ?? process.execPath,
|
|
@@ -164907,7 +165081,7 @@ function releaseCommand(overrides = {}) {
|
|
|
164907
165081
|
now: overrides.now ?? (() => Date.now())
|
|
164908
165082
|
};
|
|
164909
165083
|
const proc = overrides.driveProcess ?? defaultDriveProcess;
|
|
164910
|
-
const releaseDir = (0,
|
|
165084
|
+
const releaseDir = (0, import_path227.join)(stateRoot2, "release");
|
|
164911
165085
|
const lockPath2 = driveLockPath(releaseDir, version3);
|
|
164912
165086
|
const logPath = driveLogPath(releaseDir, version3);
|
|
164913
165087
|
const progressFile = releaseProgressFile(stateRoot2);
|
|
@@ -164962,7 +165136,7 @@ function releaseCommand(overrides = {}) {
|
|
|
164962
165136
|
process.exitCode = !stopped.stopped && stopped.refused ? 1 : 0;
|
|
164963
165137
|
return;
|
|
164964
165138
|
}
|
|
164965
|
-
const baseline = o.baseline ? (0,
|
|
165139
|
+
const baseline = o.baseline ? (0, import_path227.resolve)(o.baseline) : void 0;
|
|
164966
165140
|
if (o.detach) {
|
|
164967
165141
|
const argv = releaseDriveArgv(version3, o, baseline);
|
|
164968
165142
|
const detached = await detachDriver({
|
|
@@ -165037,7 +165211,7 @@ function releaseCommand(overrides = {}) {
|
|
|
165037
165211
|
// src/cli/commands/port.ts
|
|
165038
165212
|
init_esm();
|
|
165039
165213
|
init_source();
|
|
165040
|
-
var
|
|
165214
|
+
var import_path229 = require("path");
|
|
165041
165215
|
init_job();
|
|
165042
165216
|
init_lane();
|
|
165043
165217
|
init_worktree_paths();
|
|
@@ -165045,7 +165219,7 @@ init_worktree_paths();
|
|
|
165045
165219
|
// src/port/engine.ts
|
|
165046
165220
|
var import_crypto64 = require("crypto");
|
|
165047
165221
|
var import_fs198 = require("fs");
|
|
165048
|
-
var
|
|
165222
|
+
var import_path228 = require("path");
|
|
165049
165223
|
init_lane();
|
|
165050
165224
|
init_ledger2();
|
|
165051
165225
|
init_review_guard();
|
|
@@ -165202,7 +165376,7 @@ var listed = (paths, n = 10) => `${paths.slice(0, n).join(", ")}${paths.length >
|
|
|
165202
165376
|
var isJunk = (p) => JUNK_PATHS.some((j) => p === j || p.startsWith(`${j}/`));
|
|
165203
165377
|
var chunks = (items, size = 100) => Array.from({ length: Math.ceil(items.length / size) }, (_, i) => items.slice(i * size, (i + 1) * size));
|
|
165204
165378
|
function forkFeaturesSection(cwd2) {
|
|
165205
|
-
const path30 = (0,
|
|
165379
|
+
const path30 = (0, import_path228.join)(cwd2, ".omc", "skills", "port-upstream.md");
|
|
165206
165380
|
if (!(0, import_fs198.existsSync)(path30)) return "";
|
|
165207
165381
|
const text4 = (0, import_fs198.readFileSync)(path30, "utf8").replace(/\r/g, "");
|
|
165208
165382
|
const m = /^## Fork Features to Preserve\n([\s\S]*?)(?=^## )/m.exec(text4);
|
|
@@ -165247,15 +165421,15 @@ async function runPortDrive(opts) {
|
|
|
165247
165421
|
const push = opts.push !== false;
|
|
165248
165422
|
const date3 = opts.date ?? (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
165249
165423
|
const stateRoot2 = getOmcRoot(cwd2);
|
|
165250
|
-
const rel = (0,
|
|
165251
|
-
const stateRootRel2 = rel && !rel.startsWith("..") && !(0,
|
|
165252
|
-
const hooksDir = (0,
|
|
165424
|
+
const rel = (0, import_path228.relative)(cwd2, stateRoot2).replace(/\\/g, "/");
|
|
165425
|
+
const stateRootRel2 = rel && !rel.startsWith("..") && !(0, import_path228.isAbsolute)(rel) ? rel : null;
|
|
165426
|
+
const hooksDir = (0, import_path228.join)(stateRoot2, "port", "empty-hooks");
|
|
165253
165427
|
const exec3 = portGuardExec(opts.exec, hooksDir);
|
|
165254
165428
|
const scriptEnv = hardenedScriptEnv(hooksDir);
|
|
165255
165429
|
const git7 = (...args) => exec3("git", args, { cwd: cwd2 });
|
|
165256
165430
|
const script = (...args) => exec3(node, args, { cwd: cwd2 });
|
|
165257
165431
|
const repoScript = (...args) => exec3(node, args, { cwd: cwd2, env: scriptEnv });
|
|
165258
|
-
const exists = (p) => (0, import_fs198.existsSync)((0,
|
|
165432
|
+
const exists = (p) => (0, import_fs198.existsSync)((0, import_path228.isAbsolute)(p) ? p : (0, import_path228.join)(cwd2, p));
|
|
165259
165433
|
const result = {
|
|
165260
165434
|
status: "fail",
|
|
165261
165435
|
exitCode: 1,
|
|
@@ -165288,7 +165462,7 @@ async function runPortDrive(opts) {
|
|
|
165288
165462
|
};
|
|
165289
165463
|
try {
|
|
165290
165464
|
begin("preflight", opts.head);
|
|
165291
|
-
emptyHooksDir2((0,
|
|
165465
|
+
emptyHooksDir2((0, import_path228.join)(stateRoot2, "port"));
|
|
165292
165466
|
const head = git7("rev-parse", "--verify", "--quiet", `${opts.head}^{commit}`).stdout.trim();
|
|
165293
165467
|
if (!/^[0-9a-f]{40}$/.test(head)) throw new PortStop("fail", phase, `upstream head ${JSON.stringify(opts.head)} is not a commit here; fetch upstream first (git fetch upstream dev)`);
|
|
165294
165468
|
result.upstreamHead = head;
|
|
@@ -165298,8 +165472,8 @@ async function runPortDrive(opts) {
|
|
|
165298
165472
|
}
|
|
165299
165473
|
const branch = `port/upstream-${short(head)}`;
|
|
165300
165474
|
result.branch = branch;
|
|
165301
|
-
const portDir = (0,
|
|
165302
|
-
const progressFile = opts.progressFile || process.env.OMG_PROGRESS_FILE || (0,
|
|
165475
|
+
const portDir = (0, import_path228.join)(stateRoot2, "port", short(head));
|
|
165476
|
+
const progressFile = opts.progressFile || process.env.OMG_PROGRESS_FILE || (0, import_path228.join)(stateRoot2, "progress", "port.log");
|
|
165303
165477
|
const resumeCmd = `omg port drive --head ${head} --continue`;
|
|
165304
165478
|
const current = git7("rev-parse", "--abbrev-ref", "HEAD").stdout.trim();
|
|
165305
165479
|
if (opts.resume) {
|
|
@@ -165341,7 +165515,7 @@ ${dirty}`);
|
|
|
165341
165515
|
ok2(junk.length > 0 ? `unstaged ${junk.length} junk file(s): ${junk.slice(0, 5).join(", ")}` : "none");
|
|
165342
165516
|
begin("delta", "package.json");
|
|
165343
165517
|
const blockers = [];
|
|
165344
|
-
const deltaFile = (0,
|
|
165518
|
+
const deltaFile = (0, import_path228.join)(portDir, "package-delta.json");
|
|
165345
165519
|
if (opts.resume && (0, import_fs198.existsSync)(deltaFile)) {
|
|
165346
165520
|
result.packageDelta = JSON.parse((0, import_fs198.readFileSync)(deltaFile, "utf8"));
|
|
165347
165521
|
ok2("ran before; skipped on --continue (the human handled it)");
|
|
@@ -165363,9 +165537,9 @@ ${dirty}`);
|
|
|
165363
165537
|
if (accept !== void 0) {
|
|
165364
165538
|
result.acceptedLeaks = report3.leaks.map((l) => `${l.path}:${l.line}`);
|
|
165365
165539
|
(0, import_fs198.mkdirSync)(portDir, { recursive: true });
|
|
165366
|
-
(0, import_fs198.writeFileSync)((0,
|
|
165540
|
+
(0, import_fs198.writeFileSync)((0, import_path228.join)(portDir, "accepted-leaks.json"), `${JSON.stringify({ head, acceptedAt: (/* @__PURE__ */ new Date()).toISOString(), leaks: report3.leaks }, null, 2)}
|
|
165367
165541
|
`);
|
|
165368
|
-
opts.log(`reconcile: ${report3.leaks.length} leak line(s) accepted with --accept-leaks ${short(head)} (${(0,
|
|
165542
|
+
opts.log(`reconcile: ${report3.leaks.length} leak line(s) accepted with --accept-leaks ${short(head)} (${(0, import_path228.join)(portDir, "accepted-leaks.json")})`);
|
|
165369
165543
|
} else {
|
|
165370
165544
|
blockers.push(`leak sweep: ${report3.leaks.length} new oh-my-claudecode line(s), first ${report3.leaks[0].path}:${report3.leaks[0].line}; fix them, or accept them with --accept-leaks ${head}`);
|
|
165371
165545
|
}
|
|
@@ -165373,7 +165547,7 @@ ${dirty}`);
|
|
|
165373
165547
|
const conflicts = report3.conflicts;
|
|
165374
165548
|
if (conflicts.length > 0) {
|
|
165375
165549
|
(0, import_fs198.mkdirSync)(portDir, { recursive: true });
|
|
165376
|
-
const brief = (0,
|
|
165550
|
+
const brief = (0, import_path228.join)(portDir, "brief.md");
|
|
165377
165551
|
(0, import_fs198.writeFileSync)(brief, renderReconcileBrief({ cwd: cwd2, base: rangeBase, head, conflicts, progressFile, date: date3 }));
|
|
165378
165552
|
result.brief = brief;
|
|
165379
165553
|
const sensitive = conflicts.filter((c) => HUMAN_REVIEW_PREFIXES.some((p) => c.path.startsWith(p)) || laneForbidden([c.path]).length > 0);
|
|
@@ -165476,7 +165650,7 @@ ${[...errors, tail3(out, 10)].join("\n")}`, `fix, stage, then ${resumeCmd}`);
|
|
|
165476
165650
|
if (pushed.status !== 0) throw new PortStop("fail", phase, `git push ${remote} ${branch} failed: ${tail3(pushed.stderr || pushed.stdout, 5)}`, resumeCmd);
|
|
165477
165651
|
const md = repoScript(DRIFT_SCRIPT, "--report", "--base", rangeBase, "--head", head, "--markdown");
|
|
165478
165652
|
(0, import_fs198.mkdirSync)(portDir, { recursive: true });
|
|
165479
|
-
const bodyFile = (0,
|
|
165653
|
+
const bodyFile = (0, import_path228.join)(portDir, "pr-body.md");
|
|
165480
165654
|
const gates = result.gates.length > 0 ? result.gates.join(", ") : "green before the port commit (resumed with --continue)";
|
|
165481
165655
|
const leaks = result.acceptedLeaks.length > 0 ? `
|
|
165482
165656
|
- leak sweep: ${result.acceptedLeaks.length} line(s) accepted with --accept-leaks: ${listed(result.acceptedLeaks)}` : "";
|
|
@@ -165601,7 +165775,7 @@ function contentHash(path30) {
|
|
|
165601
165775
|
if (st.isDirectory()) return "d";
|
|
165602
165776
|
return `f ${st.mode & 73 ? "x" : "-"} ${sha2566((0, import_fs198.readFileSync)(path30))}`;
|
|
165603
165777
|
}
|
|
165604
|
-
var hashPaths = (cwd2, paths) => sha2566([...paths].sort().map((p) => `${p} ${contentHash((0,
|
|
165778
|
+
var hashPaths = (cwd2, paths) => sha2566([...paths].sort().map((p) => `${p} ${contentHash((0, import_path228.join)(cwd2, p))}`).join("\n"));
|
|
165605
165779
|
function hostBaseline(gitOk, cwd2, preApply, conflicted) {
|
|
165606
165780
|
const applied = gitOk(["diff", "--cached", "--name-only", "-z", "--no-renames", preApply]).split("\0").filter(Boolean);
|
|
165607
165781
|
const tracked = gitOk(["ls-files", "-z"]).split("\0").filter(Boolean);
|
|
@@ -165694,7 +165868,7 @@ function portCommand(deps = {}) {
|
|
|
165694
165868
|
const top = exec3("git", ["rev-parse", "--show-toplevel"]);
|
|
165695
165869
|
if (top.status !== 0) throw new PortUsageError("omg port drive must run inside a git repository");
|
|
165696
165870
|
const cwd2 = top.stdout.trim();
|
|
165697
|
-
const progressFile = o.progressFile ?? process.env.OMG_PROGRESS_FILE ?? (0,
|
|
165871
|
+
const progressFile = o.progressFile ?? process.env.OMG_PROGRESS_FILE ?? (0, import_path229.join)(getOmcRoot(cwd2), "progress", "port.log");
|
|
165698
165872
|
const result = await runPortDrive({
|
|
165699
165873
|
cwd: cwd2,
|
|
165700
165874
|
head: o.head,
|
|
@@ -165732,7 +165906,7 @@ function portCommand(deps = {}) {
|
|
|
165732
165906
|
// src/cli/commands/progress.ts
|
|
165733
165907
|
init_esm();
|
|
165734
165908
|
var import_fs199 = require("fs");
|
|
165735
|
-
var
|
|
165909
|
+
var import_path230 = require("path");
|
|
165736
165910
|
init_agent_progress();
|
|
165737
165911
|
var UsageError3 = class extends Error {
|
|
165738
165912
|
};
|
|
@@ -165755,7 +165929,7 @@ function resolveSources(o, cwd2) {
|
|
|
165755
165929
|
function listSources(sources) {
|
|
165756
165930
|
if (sources.files) return sources.files;
|
|
165757
165931
|
try {
|
|
165758
|
-
return (0, import_fs199.readdirSync)(sources.dir).filter((name) => name.endsWith(".log")).sort().map((name) => (0,
|
|
165932
|
+
return (0, import_fs199.readdirSync)(sources.dir).filter((name) => name.endsWith(".log")).sort().map((name) => (0, import_path230.join)(sources.dir, name));
|
|
165759
165933
|
} catch {
|
|
165760
165934
|
return [];
|
|
165761
165935
|
}
|
|
@@ -166284,7 +166458,7 @@ Profile types (use with --profile):
|
|
|
166284
166458
|
webhook Generic webhook (POST with JSON body)
|
|
166285
166459
|
|
|
166286
166460
|
Examples:
|
|
166287
|
-
$ omg config-stop-callback file --enable --path ${(0,
|
|
166461
|
+
$ omg config-stop-callback file --enable --path ${(0, import_path238.join)(getCopilotConfigDir(), "logs/{date}.md")}
|
|
166288
166462
|
$ omg config-stop-callback telegram --enable --token <token> --chat <id>
|
|
166289
166463
|
$ omg config-stop-callback discord --enable --webhook <url>
|
|
166290
166464
|
$ omg config-stop-callback file --disable
|
|
@@ -166469,7 +166643,7 @@ Examples:
|
|
|
166469
166643
|
const current = config2.stopHookCallbacks.file;
|
|
166470
166644
|
config2.stopHookCallbacks.file = {
|
|
166471
166645
|
enabled: enabled ?? current?.enabled ?? false,
|
|
166472
|
-
path: options.path ?? current?.path ?? (0,
|
|
166646
|
+
path: options.path ?? current?.path ?? (0, import_path238.join)(getCopilotConfigDir(), "session-logs/{session_id}.md"),
|
|
166473
166647
|
format: options.format ?? current?.format ?? "markdown"
|
|
166474
166648
|
};
|
|
166475
166649
|
break;
|