oh-my-copilot 5.19.2 → 5.19.3
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/README.md +70 -67
- package/agents/planner.md +4 -4
- package/bin/oh-my-copilot.js +5 -1
- package/bridge/__pycache__/gyoshu_bridge.cpython-314.pyc +0 -0
- package/bridge/claude-md-coordinator.cjs +2 -2
- package/bridge/cli.cjs +2820 -2586
- package/bridge/mcp-server.cjs +968 -866
- package/bridge/runtime-cli.cjs +244 -184
- package/bridge/team-bridge.cjs +17 -1
- package/bridge/team-mcp.cjs +208 -140
- package/bridge/team.js +73 -13
- package/copilot/agents/planner.md +4 -4
- package/dist/__tests__/copilot-hooks-manifest.test.js +1 -0
- package/dist/__tests__/copilot-hooks-manifest.test.js.map +1 -1
- package/dist/__tests__/doctor-conflicts.test.js +6 -5
- package/dist/__tests__/doctor-conflicts.test.js.map +1 -1
- package/dist/__tests__/hud/cli-diagnostic.test.js +4 -3
- package/dist/__tests__/hud/cli-diagnostic.test.js.map +1 -1
- package/dist/__tests__/mnemosyne/detector.test.js +3 -2
- package/dist/__tests__/mnemosyne/detector.test.js.map +1 -1
- package/dist/__tests__/session-start-script-context.test.js +1 -1
- package/dist/__tests__/session-start-script-context.test.js.map +1 -1
- package/dist/__tests__/setup/stub-skill-list-probe.d.ts +2 -0
- package/dist/__tests__/setup/stub-skill-list-probe.d.ts.map +1 -0
- package/dist/__tests__/setup/stub-skill-list-probe.js +11 -0
- package/dist/__tests__/setup/stub-skill-list-probe.js.map +1 -0
- package/dist/__tests__/setup-config-script.test.d.ts +2 -0
- package/dist/__tests__/setup-config-script.test.d.ts.map +1 -0
- package/dist/__tests__/setup-config-script.test.js +350 -0
- package/dist/__tests__/setup-config-script.test.js.map +1 -0
- package/dist/__tests__/shipyard-seed-locale.test.js +1 -1
- package/dist/__tests__/shipyard-seed-locale.test.js.map +1 -1
- package/dist/__tests__/shipyard-skills.test.js +9 -9
- package/dist/__tests__/shipyard-skills.test.js.map +1 -1
- package/dist/__tests__/tier0-docs-consistency.test.js +5 -5
- package/dist/__tests__/tier0-docs-consistency.test.js.map +1 -1
- package/dist/__tests__/trusted-publishing-contract.test.js +9 -2
- package/dist/__tests__/trusted-publishing-contract.test.js.map +1 -1
- package/dist/__tests__/visual-verdict-skill.test.js +1 -1
- package/dist/__tests__/visual-verdict-skill.test.js.map +1 -1
- package/dist/cli/__tests__/autoresearch.test.js +3 -2
- package/dist/cli/__tests__/autoresearch.test.js.map +1 -1
- package/dist/cli/autoresearch.d.ts +1 -1
- package/dist/cli/autoresearch.d.ts.map +1 -1
- package/dist/cli/autoresearch.js +2 -1
- package/dist/cli/autoresearch.js.map +1 -1
- package/dist/cli/commands/__tests__/factory-init.test.js +2 -1
- package/dist/cli/commands/__tests__/factory-init.test.js.map +1 -1
- package/dist/cli/commands/__tests__/intake.test.js +26 -4
- package/dist/cli/commands/__tests__/intake.test.js.map +1 -1
- package/dist/cli/commands/doctor-conflicts.d.ts.map +1 -1
- package/dist/cli/commands/doctor-conflicts.js +5 -4
- package/dist/cli/commands/doctor-conflicts.js.map +1 -1
- package/dist/cli/commands/factory.d.ts.map +1 -1
- package/dist/cli/commands/factory.js +4 -3
- package/dist/cli/commands/factory.js.map +1 -1
- package/dist/cli/commands/intake.d.ts.map +1 -1
- package/dist/cli/commands/intake.js +13 -4
- package/dist/cli/commands/intake.js.map +1 -1
- package/dist/cli/commands/ship.d.ts +1 -1
- package/dist/cli/commands/ship.js +1 -1
- package/dist/copilot-run/job.d.ts.map +1 -1
- package/dist/copilot-run/job.js +4 -1
- package/dist/copilot-run/job.js.map +1 -1
- package/dist/copilot-run/sandbox.d.ts +2 -7
- package/dist/copilot-run/sandbox.d.ts.map +1 -1
- package/dist/copilot-run/sandbox.js +2 -26
- package/dist/copilot-run/sandbox.js.map +1 -1
- package/dist/factory/__tests__/listener.test.js +22 -4
- package/dist/factory/__tests__/listener.test.js.map +1 -1
- package/dist/factory/listener.d.ts +2 -2
- package/dist/factory/listener.d.ts.map +1 -1
- package/dist/factory/listener.js +20 -5
- package/dist/factory/listener.js.map +1 -1
- package/dist/factory/run/engine.d.ts.map +1 -1
- package/dist/factory/run/engine.js +1 -0
- package/dist/factory/run/engine.js.map +1 -1
- package/dist/features/continuation-enforcement.d.ts.map +1 -1
- package/dist/features/continuation-enforcement.js +2 -1
- package/dist/features/continuation-enforcement.js.map +1 -1
- package/dist/hooks/autopilot/__tests__/pipeline.test.js +2 -1
- package/dist/hooks/autopilot/__tests__/pipeline.test.js.map +1 -1
- package/dist/hooks/autopilot/adapters/execution-adapter.d.ts.map +1 -1
- package/dist/hooks/autopilot/adapters/execution-adapter.js +3 -2
- package/dist/hooks/autopilot/adapters/execution-adapter.js.map +1 -1
- package/dist/hooks/autopilot/adapters/ralplan-adapter.d.ts.map +1 -1
- package/dist/hooks/autopilot/adapters/ralplan-adapter.js +2 -1
- package/dist/hooks/autopilot/adapters/ralplan-adapter.js.map +1 -1
- package/dist/hooks/learner/detector.d.ts.map +1 -1
- package/dist/hooks/learner/detector.js +2 -6
- package/dist/hooks/learner/detector.js.map +1 -1
- package/dist/hooks/mode-registry/index.d.ts.map +1 -1
- package/dist/hooks/mode-registry/index.js +2 -1
- package/dist/hooks/mode-registry/index.js.map +1 -1
- package/dist/hooks/persistent-mode/index.d.ts +1 -1
- package/dist/hooks/persistent-mode/index.d.ts.map +1 -1
- package/dist/hooks/persistent-mode/index.js +6 -5
- package/dist/hooks/persistent-mode/index.js.map +1 -1
- package/dist/hooks/ralph/loop.d.ts +1 -1
- package/dist/hooks/ralph/loop.js +1 -1
- package/dist/hooks/ralph/prd.d.ts.map +1 -1
- package/dist/hooks/ralph/prd.js +2 -1
- package/dist/hooks/ralph/prd.js.map +1 -1
- package/dist/hooks/ralph/stale-prd.d.ts +2 -2
- package/dist/hooks/ralph/stale-prd.js +3 -3
- package/dist/hooks/ralph/stale-prd.js.map +1 -1
- package/dist/hooks/ralph/verifier.d.ts +1 -1
- package/dist/hooks/ralph/verifier.d.ts.map +1 -1
- package/dist/hooks/ralph/verifier.js +4 -3
- package/dist/hooks/ralph/verifier.js.map +1 -1
- package/dist/hooks/session-end/__tests__/spawn-next.test.js +31 -4
- package/dist/hooks/session-end/__tests__/spawn-next.test.js.map +1 -1
- package/dist/hooks/session-end/spawn-next.d.ts +6 -3
- package/dist/hooks/session-end/spawn-next.d.ts.map +1 -1
- package/dist/hooks/session-end/spawn-next.js +19 -6
- package/dist/hooks/session-end/spawn-next.js.map +1 -1
- package/dist/hud/index.d.ts.map +1 -1
- package/dist/hud/index.js +3 -2
- package/dist/hud/index.js.map +1 -1
- package/dist/installer/__tests__/hook-templates.test.js +3 -1
- package/dist/installer/__tests__/hook-templates.test.js.map +1 -1
- package/dist/installer/hooks.d.ts +1 -1
- package/dist/installer/hooks.d.ts.map +1 -1
- package/dist/installer/hooks.js +2 -1
- package/dist/installer/hooks.js.map +1 -1
- package/dist/ship/__tests__/exec-env.test.d.ts +2 -0
- package/dist/ship/__tests__/exec-env.test.d.ts.map +1 -0
- package/dist/ship/__tests__/exec-env.test.js +26 -0
- package/dist/ship/__tests__/exec-env.test.js.map +1 -0
- package/dist/ship/__tests__/exec-plant.test.d.ts +2 -0
- package/dist/ship/__tests__/exec-plant.test.d.ts.map +1 -0
- package/dist/ship/__tests__/exec-plant.test.js +34 -0
- package/dist/ship/__tests__/exec-plant.test.js.map +1 -0
- package/dist/ship/__tests__/workflow-checks.test.js +22 -4
- package/dist/ship/__tests__/workflow-checks.test.js.map +1 -1
- package/dist/ship/config.js +3 -3
- package/dist/ship/config.js.map +1 -1
- package/dist/ship/exec.d.ts.map +1 -1
- package/dist/ship/exec.js +10 -2
- package/dist/ship/exec.js.map +1 -1
- package/dist/skills/__tests__/mingw-escape.test.js +0 -35
- package/dist/skills/__tests__/mingw-escape.test.js.map +1 -1
- package/dist/skills/__tests__/omc-setup-optout.test.js +4 -3
- package/dist/skills/__tests__/omc-setup-optout.test.js.map +1 -1
- package/dist/smoke/copilot-sdk-scenarios.d.ts.map +1 -1
- package/dist/smoke/copilot-sdk-scenarios.js +2 -1
- package/dist/smoke/copilot-sdk-scenarios.js.map +1 -1
- package/dist/team/__tests__/git-worktree.test.js +10 -1
- package/dist/team/__tests__/git-worktree.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.test.js +16 -2
- package/dist/team/__tests__/tmux-session.test.js.map +1 -1
- package/dist/team/__tests__/worker-launch-ack.test.js +14 -0
- package/dist/team/__tests__/worker-launch-ack.test.js.map +1 -1
- package/dist/team/git-worktree.d.ts.map +1 -1
- package/dist/team/git-worktree.js +13 -5
- package/dist/team/git-worktree.js.map +1 -1
- package/dist/team/tmux-session.d.ts.map +1 -1
- package/dist/team/tmux-session.js +8 -6
- package/dist/team/tmux-session.js.map +1 -1
- package/dist/ultragoal/goal-record.d.ts.map +1 -1
- package/dist/ultragoal/goal-record.js +2 -1
- package/dist/ultragoal/goal-record.js.map +1 -1
- package/dist/utils/__tests__/skill-slash.test.d.ts +2 -0
- package/dist/utils/__tests__/skill-slash.test.d.ts.map +1 -0
- package/dist/utils/__tests__/skill-slash.test.js +307 -0
- package/dist/utils/__tests__/skill-slash.test.js.map +1 -0
- package/dist/utils/__tests__/windows-search.test.d.ts +2 -0
- package/dist/utils/__tests__/windows-search.test.d.ts.map +1 -0
- package/dist/utils/__tests__/windows-search.test.js +154 -0
- package/dist/utils/__tests__/windows-search.test.js.map +1 -0
- package/dist/utils/skill-registry.d.ts +51 -0
- package/dist/utils/skill-registry.d.ts.map +1 -0
- package/dist/utils/skill-registry.js +168 -0
- package/dist/utils/skill-registry.js.map +1 -0
- package/dist/utils/skill-slash.d.ts +18 -0
- package/dist/utils/skill-slash.d.ts.map +1 -0
- package/dist/utils/skill-slash.js +20 -0
- package/dist/utils/skill-slash.js.map +1 -0
- package/dist/utils/windows-search.d.ts +42 -0
- package/dist/utils/windows-search.d.ts.map +1 -0
- package/dist/utils/windows-search.js +94 -0
- package/dist/utils/windows-search.js.map +1 -0
- package/docs/ARCHITECTURE.md +29 -29
- package/docs/CLAUDE.md +4 -4
- package/docs/FIELD-TESTING.md +563 -0
- package/docs/GETTING-STARTED.md +11 -11
- package/docs/HOOKS.md +8 -8
- package/docs/MIGRATION.md +100 -100
- package/docs/PERFORMANCE-MONITORING.md +2 -2
- package/docs/REFERENCE.md +130 -130
- package/docs/TOOLS.md +1 -1
- package/docs/cancel-skill-active-state-gap.md +2 -2
- package/docs/copilot-instructions.md +3 -3
- package/docs/design/P2-RUN-LEDGER-AND-INTAKE-PLAN.md +1 -1
- package/docs/design/project-session-manager.md +1 -1
- package/docs/field-testing-first-prompt.md +36 -0
- package/docs/shared/features.md +5 -5
- package/docs/shipyard.md +8 -8
- package/package.json +2 -2
- package/plugin.json +1 -1
- package/scripts/build-workflow-stage-prompts.mjs +15 -6
- package/scripts/copilot/dispatch.cjs +3 -0
- package/scripts/find-node.sh +1 -1
- package/scripts/keyword-detector.mjs +5 -4
- package/scripts/lib/copilot-hook-adapter.cjs +3 -0
- package/scripts/lib/hud-wrapper-template.txt +2 -2
- package/scripts/lib/skill-slash.mjs +11 -0
- package/scripts/lib/windows-search.cjs +40 -0
- package/scripts/lib/windows-search.mjs +7 -0
- package/scripts/lib/workflow-stage-prompts.mjs +6 -2
- package/scripts/persistent-mode.cjs +11 -10
- package/scripts/persistent-mode.mjs +12 -11
- package/scripts/plugin-shipping-surface.mjs +1 -0
- package/scripts/pre-tool-enforcer.mjs +1 -1
- package/scripts/session-start.mjs +3 -3
- package/scripts/setup-claude-md.mjs +3 -0
- package/scripts/setup-config.mjs +420 -0
- package/scripts/setup-progress.mjs +3 -0
- package/scripts/shipyard-audit.mjs +2 -1
- package/scripts/stale-run-reporter.mjs +2 -1
- package/skills/AGENTS.md +4 -4
- package/skills/ai-slop-cleaner/SKILL.md +3 -3
- package/skills/ask/SKILL.md +7 -7
- package/skills/ask-navigator/SKILL.md +11 -11
- package/skills/autopilot/SKILL.md +5 -5
- package/skills/cancel/SKILL.md +5 -5
- package/skills/configure-notifications/SKILL.md +10 -10
- package/skills/critique/SKILL.md +1 -1
- package/skills/discover/SKILL.md +1 -1
- package/skills/drydock/SKILL.md +5 -5
- package/skills/external-context/SKILL.md +4 -4
- package/skills/graph/SKILL.md +2 -2
- package/skills/harbor/SKILL.md +7 -7
- package/skills/hud/SKILL.md +10 -10
- package/skills/intent/SKILL.md +1 -1
- package/skills/launch/SKILL.md +13 -13
- package/skills/loft/SKILL.md +2 -2
- package/skills/map/SKILL.md +1 -1
- package/skills/omc-ado-auto-review/SKILL.md +2 -2
- package/skills/omc-ado-review/SKILL.md +2 -2
- package/skills/omc-ado-setup/SKILL.md +1 -1
- package/skills/omc-ado-sprint/SKILL.md +2 -2
- package/skills/omc-ado-triage/SKILL.md +2 -2
- package/skills/omc-doctor/SKILL.md +1 -1
- package/skills/omc-gh-auto-review/SKILL.md +2 -2
- package/skills/omc-gh-project/SKILL.md +2 -2
- package/skills/omc-gh-review/SKILL.md +2 -2
- package/skills/omc-gh-setup/SKILL.md +2 -2
- package/skills/omc-gh-triage/SKILL.md +3 -3
- package/skills/omc-setup/SKILL.md +16 -14
- package/skills/omc-setup/phases/01-install-claude-md.md +1 -18
- package/skills/omc-setup/phases/02-configure.md +10 -30
- package/skills/omc-setup/phases/03-integrations.md +5 -5
- package/skills/omc-setup/phases/04-welcome.md +7 -7
- package/skills/plan/SKILL.md +1 -1
- package/skills/project-session-manager/SKILL.md +1 -1
- package/skills/ralph/SKILL.md +6 -6
- package/skills/ralph-experiment/SKILL.md +3 -3
- package/skills/ralplan/SKILL.md +4 -4
- package/skills/release/SKILL.md +1 -1
- package/skills/self-improve/SKILL.md +1 -1
- package/skills/skill/SKILL.md +12 -12
- package/skills/team/SKILL.md +8 -8
- package/skills/trace/SKILL.md +1 -1
- package/skills/visual-verdict/SKILL.md +1 -1
- package/templates/hooks/keyword-detector.mjs +4 -4
- package/templates/hooks/lib/workflow-stage-prompts.mjs +6 -2
- package/templates/hooks/persistent-mode.mjs +8 -8
- package/templates/hooks/session-start.mjs +1 -1
package/bridge/team-mcp.cjs
CHANGED
|
@@ -11695,6 +11695,14 @@ var init_security_config = __esm({
|
|
|
11695
11695
|
});
|
|
11696
11696
|
|
|
11697
11697
|
// src/utils/host-signal.ts
|
|
11698
|
+
function detectHostCliType(env = process.env) {
|
|
11699
|
+
return detectHostCliSignal(env) ?? "copilot";
|
|
11700
|
+
}
|
|
11701
|
+
function detectHostCliSignal(env = process.env) {
|
|
11702
|
+
if (env.COPILOT_CLI || env.COPILOT_AGENT_SESSION_ID) return "copilot";
|
|
11703
|
+
if (env.CLAUDE_CODE_ENTRYPOINT) return "claude";
|
|
11704
|
+
return null;
|
|
11705
|
+
}
|
|
11698
11706
|
var init_host_signal = __esm({
|
|
11699
11707
|
"src/utils/host-signal.ts"() {
|
|
11700
11708
|
"use strict";
|
|
@@ -12905,6 +12913,19 @@ var init_copilot_session_eval = __esm({
|
|
|
12905
12913
|
}
|
|
12906
12914
|
});
|
|
12907
12915
|
|
|
12916
|
+
// src/utils/skill-slash.ts
|
|
12917
|
+
function skillSlash(name, host = detectHostCliType()) {
|
|
12918
|
+
return host === "copilot" ? `/${name}` : `/${SKILL_NAMESPACE}:${name}`;
|
|
12919
|
+
}
|
|
12920
|
+
var SKILL_NAMESPACE;
|
|
12921
|
+
var init_skill_slash = __esm({
|
|
12922
|
+
"src/utils/skill-slash.ts"() {
|
|
12923
|
+
"use strict";
|
|
12924
|
+
init_host_signal();
|
|
12925
|
+
SKILL_NAMESPACE = "oh-my-copilot";
|
|
12926
|
+
}
|
|
12927
|
+
});
|
|
12928
|
+
|
|
12908
12929
|
// src/smoke/copilot-sdk-scenarios.ts
|
|
12909
12930
|
function samePathKey(p, platform) {
|
|
12910
12931
|
let out = (0, import_path26.resolve)(p);
|
|
@@ -12954,6 +12975,7 @@ var init_copilot_sdk_scenarios = __esm({
|
|
|
12954
12975
|
import_path26 = require("path");
|
|
12955
12976
|
init_ledger();
|
|
12956
12977
|
init_copilot_session_eval();
|
|
12978
|
+
init_skill_slash();
|
|
12957
12979
|
FACTORY_RUN_SCENARIOS = ["factory-run", "factory-run-fix"];
|
|
12958
12980
|
SANDBOX_LANE_SCENARIO = "sandbox-lane";
|
|
12959
12981
|
CLI_SCENARIOS = ["continuation", "prompt-context", "events", "ultragoal"];
|
|
@@ -13011,7 +13033,7 @@ var init_copilot_sdk_scenarios = __esm({
|
|
|
13011
13033
|
},
|
|
13012
13034
|
skill: {
|
|
13013
13035
|
name: "skill",
|
|
13014
|
-
prompt:
|
|
13036
|
+
prompt: `Use the ${skillSlash("omc-plan", "copilot")} skill to outline a two-step plan for adding a README. Keep it under 5 lines.`,
|
|
13015
13037
|
excludedTools: [...NO_SHELL_OR_WRITE_TOOLS],
|
|
13016
13038
|
permit: permitScopedRead
|
|
13017
13039
|
// loading SKILL.md is a read request
|
|
@@ -15599,11 +15621,11 @@ function buildWorkerStartCommand(config2) {
|
|
|
15599
15621
|
windowsEnvVars.OMC_RECOVERY_GATE_SPEC_B64 = Buffer.from(windowsEnvVars.OMC_RECOVERY_GATE_SPEC, "utf8").toString("base64");
|
|
15600
15622
|
delete windowsEnvVars.OMC_RECOVERY_GATE_SPEC;
|
|
15601
15623
|
}
|
|
15602
|
-
const envPrefix = Object.entries(windowsEnvVars).map(([key, value]) => {
|
|
15624
|
+
const envPrefix = ['set "NoDefaultCurrentDirectoryInExePath=1"', ...Object.entries(windowsEnvVars).filter(([key]) => key.toUpperCase() !== "NODEFAULTCURRENTDIRECTORYINEXEPATH").map(([key, value]) => {
|
|
15603
15625
|
assertSafeEnvKey(key);
|
|
15604
15626
|
assertSafeCmdValue2(value);
|
|
15605
15627
|
return `set "${key}=${escapeForCmdSet(value)}"`;
|
|
15606
|
-
}).join(" && ");
|
|
15628
|
+
})].join(" && ");
|
|
15607
15629
|
const launch = launchWords.map((part) => {
|
|
15608
15630
|
assertSafeCmdValue2(part);
|
|
15609
15631
|
return `"${escapeForCmdSet(part)}"`;
|
|
@@ -18231,12 +18253,50 @@ var init_mcp_comm = __esm({
|
|
|
18231
18253
|
}
|
|
18232
18254
|
});
|
|
18233
18255
|
|
|
18256
|
+
// src/utils/windows-search.ts
|
|
18257
|
+
function envValue(env, name) {
|
|
18258
|
+
const key = Object.keys(env).find((k) => k.toUpperCase() === name);
|
|
18259
|
+
const value = key === void 0 ? void 0 : env[key];
|
|
18260
|
+
return typeof value === "string" && value.trim() !== "" ? value : void 0;
|
|
18261
|
+
}
|
|
18262
|
+
function findOnPath(name, env, platform, exists = isFile) {
|
|
18263
|
+
const P = platform === "win32" ? import_node_path6.win32 : import_node_path6.posix;
|
|
18264
|
+
const exts = platform === "win32" ? (envValue(env, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean) : [""];
|
|
18265
|
+
const inNodeModules = platform === "win32" ? /(^|[\\/])node_modules([\\/]|$)/i : /(^|\/)node_modules(\/|$)/;
|
|
18266
|
+
for (const raw of (envValue(env, "PATH") ?? "").split(P.delimiter)) {
|
|
18267
|
+
const dir = raw.trim().replace(/^"(.*)"$/, "$1");
|
|
18268
|
+
if (!dir || !P.isAbsolute(dir) || inNodeModules.test(dir)) continue;
|
|
18269
|
+
for (const ext of exts) if (exists(P.join(dir, name + ext))) return P.join(dir, name + ext);
|
|
18270
|
+
}
|
|
18271
|
+
return null;
|
|
18272
|
+
}
|
|
18273
|
+
function resolveBareExe(cmd, env = process.env) {
|
|
18274
|
+
if (process.platform !== "win32" || /[\\/:]/.test(cmd)) return cmd;
|
|
18275
|
+
const pathext = (envValue(env, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").filter((e) => e && !/^\.(cmd|bat)$/i.test(e)).join(";") || ".COM;.EXE";
|
|
18276
|
+
return findOnPath(cmd, { ...env, PATHEXT: pathext }, "win32");
|
|
18277
|
+
}
|
|
18278
|
+
var import_node_fs5, import_node_path6, isFile;
|
|
18279
|
+
var init_windows_search = __esm({
|
|
18280
|
+
"src/utils/windows-search.ts"() {
|
|
18281
|
+
"use strict";
|
|
18282
|
+
import_node_fs5 = require("node:fs");
|
|
18283
|
+
import_node_path6 = require("node:path");
|
|
18284
|
+
isFile = (p) => {
|
|
18285
|
+
try {
|
|
18286
|
+
return (0, import_node_fs5.statSync)(p).isFile();
|
|
18287
|
+
} catch {
|
|
18288
|
+
return false;
|
|
18289
|
+
}
|
|
18290
|
+
};
|
|
18291
|
+
}
|
|
18292
|
+
});
|
|
18293
|
+
|
|
18234
18294
|
// src/lib/worktree-cleanup-safety.ts
|
|
18235
18295
|
function realpathOrResolve(path5) {
|
|
18236
18296
|
try {
|
|
18237
|
-
return (0,
|
|
18297
|
+
return (0, import_node_fs6.realpathSync)(path5);
|
|
18238
18298
|
} catch {
|
|
18239
|
-
return (0,
|
|
18299
|
+
return (0, import_node_path7.resolve)(path5);
|
|
18240
18300
|
}
|
|
18241
18301
|
}
|
|
18242
18302
|
function assertSafeBoundary(path5, label) {
|
|
@@ -18248,7 +18308,7 @@ function assertSafeBoundary(path5, label) {
|
|
|
18248
18308
|
throw new Error(`${label}_contains_nul`);
|
|
18249
18309
|
}
|
|
18250
18310
|
const resolved = realpathOrResolve(trimmed);
|
|
18251
|
-
const root = (0,
|
|
18311
|
+
const root = (0, import_node_path7.parse)(resolved).root;
|
|
18252
18312
|
const home = realpathOrResolve((0, import_node_os2.homedir)());
|
|
18253
18313
|
if (resolved === root) {
|
|
18254
18314
|
throw new Error(`${label}_is_filesystem_root:${resolved}`);
|
|
@@ -18259,8 +18319,8 @@ function assertSafeBoundary(path5, label) {
|
|
|
18259
18319
|
return resolved;
|
|
18260
18320
|
}
|
|
18261
18321
|
function isInside(parent, child) {
|
|
18262
|
-
const rel = (0,
|
|
18263
|
-
return rel.length > 0 && !rel.startsWith("..") && !(0,
|
|
18322
|
+
const rel = (0, import_node_path7.relative)(parent, child);
|
|
18323
|
+
return rel.length > 0 && !rel.startsWith("..") && !(0, import_node_path7.isAbsolute)(rel);
|
|
18264
18324
|
}
|
|
18265
18325
|
function validateWorktreeRemovalTarget(options) {
|
|
18266
18326
|
const { candidatePath, expectedRoots, mainRepoRoots = [], requireExisting = true } = options;
|
|
@@ -18277,13 +18337,13 @@ function validateWorktreeRemovalTarget(options) {
|
|
|
18277
18337
|
if (rawCandidate === "." || rawCandidate === ".." || rawCandidate === "~") {
|
|
18278
18338
|
throw new Error(`worktree_path_suspicious:${rawCandidate}`);
|
|
18279
18339
|
}
|
|
18280
|
-
const lexicalPath = (0,
|
|
18281
|
-
if (!(0,
|
|
18340
|
+
const lexicalPath = (0, import_node_path7.resolve)(rawCandidate);
|
|
18341
|
+
if (!(0, import_node_fs6.existsSync)(lexicalPath)) {
|
|
18282
18342
|
if (requireExisting) {
|
|
18283
18343
|
throw new Error(`worktree_path_missing:${lexicalPath}`);
|
|
18284
18344
|
}
|
|
18285
18345
|
} else {
|
|
18286
|
-
const stat2 = (0,
|
|
18346
|
+
const stat2 = (0, import_node_fs6.lstatSync)(lexicalPath);
|
|
18287
18347
|
if (stat2.isSymbolicLink()) {
|
|
18288
18348
|
throw new Error(`worktree_path_is_symlink:${lexicalPath}`);
|
|
18289
18349
|
}
|
|
@@ -18303,37 +18363,37 @@ function validateWorktreeRemovalTarget(options) {
|
|
|
18303
18363
|
throw new Error(`worktree_path_is_main_repo:${resolvedPath}`);
|
|
18304
18364
|
}
|
|
18305
18365
|
}
|
|
18306
|
-
if ((0,
|
|
18307
|
-
const gitStat = (0,
|
|
18366
|
+
if ((0, import_node_fs6.existsSync)((0, import_node_path7.join)(resolvedPath, ".git"))) {
|
|
18367
|
+
const gitStat = (0, import_node_fs6.lstatSync)((0, import_node_path7.join)(resolvedPath, ".git"));
|
|
18308
18368
|
if (gitStat.isDirectory()) {
|
|
18309
18369
|
throw new Error(`worktree_path_is_main_repo:${resolvedPath}`);
|
|
18310
18370
|
}
|
|
18311
18371
|
}
|
|
18312
18372
|
return { resolvedPath, matchedRoot };
|
|
18313
18373
|
}
|
|
18314
|
-
var
|
|
18374
|
+
var import_node_fs6, import_node_os2, import_node_path7;
|
|
18315
18375
|
var init_worktree_cleanup_safety = __esm({
|
|
18316
18376
|
"src/lib/worktree-cleanup-safety.ts"() {
|
|
18317
18377
|
"use strict";
|
|
18318
|
-
|
|
18378
|
+
import_node_fs6 = require("node:fs");
|
|
18319
18379
|
import_node_os2 = require("node:os");
|
|
18320
|
-
|
|
18380
|
+
import_node_path7 = require("node:path");
|
|
18321
18381
|
}
|
|
18322
18382
|
});
|
|
18323
18383
|
|
|
18324
18384
|
// src/team/git-worktree.ts
|
|
18325
18385
|
function getWorktreePath(repoRoot, teamName, workerName) {
|
|
18326
|
-
return (0,
|
|
18386
|
+
return (0, import_node_path8.join)(getOmcRoot(repoRoot), "team", sanitizeName(teamName), "worktrees", sanitizeName(workerName));
|
|
18327
18387
|
}
|
|
18328
18388
|
function getBranchName(teamName, workerName) {
|
|
18329
18389
|
return `omc-team/${sanitizeName(teamName)}/${sanitizeName(workerName)}`;
|
|
18330
18390
|
}
|
|
18331
18391
|
function hostHooksDir() {
|
|
18332
18392
|
try {
|
|
18333
|
-
if (emptyHooksDir && (0,
|
|
18393
|
+
if (emptyHooksDir && (0, import_node_fs7.readdirSync)(emptyHooksDir).length === 0) return emptyHooksDir;
|
|
18334
18394
|
} catch {
|
|
18335
18395
|
}
|
|
18336
|
-
emptyHooksDir = (0,
|
|
18396
|
+
emptyHooksDir = (0, import_node_fs7.mkdtempSync)((0, import_node_path8.join)((0, import_node_os3.tmpdir)(), "omg-host-git-nohooks-"));
|
|
18337
18397
|
return emptyHooksDir;
|
|
18338
18398
|
}
|
|
18339
18399
|
function hostGitHardeningArgs() {
|
|
@@ -18345,11 +18405,11 @@ function hostGitHardeningArgs() {
|
|
|
18345
18405
|
}
|
|
18346
18406
|
function hostAttributesFile() {
|
|
18347
18407
|
try {
|
|
18348
|
-
if (emptyAttributesFile && (0,
|
|
18408
|
+
if (emptyAttributesFile && (0, import_node_fs7.readFileSync)(emptyAttributesFile, "utf-8") === "") return emptyAttributesFile;
|
|
18349
18409
|
} catch {
|
|
18350
18410
|
}
|
|
18351
|
-
emptyAttributesFile = (0,
|
|
18352
|
-
(0,
|
|
18411
|
+
emptyAttributesFile = (0, import_node_path8.join)((0, import_node_fs7.mkdtempSync)((0, import_node_path8.join)((0, import_node_os3.tmpdir)(), "omg-host-git-noattrs-")), "attributes");
|
|
18412
|
+
(0, import_node_fs7.writeFileSync)(emptyAttributesFile, "");
|
|
18353
18413
|
return emptyAttributesFile;
|
|
18354
18414
|
}
|
|
18355
18415
|
function gitSubcommandIndex(args) {
|
|
@@ -18366,16 +18426,16 @@ function hostGitEnv(args, base = process.env) {
|
|
|
18366
18426
|
};
|
|
18367
18427
|
const gitDir = valueOf("--git-dir");
|
|
18368
18428
|
if (!gitDir) return { ...base, GIT_LFS_SKIP_SMUDGE: "1" };
|
|
18369
|
-
const env = { ...base, GIT_DIR: (0,
|
|
18429
|
+
const env = { ...base, GIT_DIR: (0, import_node_path8.resolve)(gitDir), GIT_LFS_SKIP_SMUDGE: "1" };
|
|
18370
18430
|
const workTree = valueOf("--work-tree");
|
|
18371
|
-
if (workTree) env.GIT_WORK_TREE = (0,
|
|
18372
|
-
if ((0,
|
|
18431
|
+
if (workTree) env.GIT_WORK_TREE = (0, import_node_path8.resolve)(workTree);
|
|
18432
|
+
if ((0, import_node_path8.basename)((0, import_node_path8.dirname)((0, import_node_path8.resolve)(gitDir))) === "worktrees") env.GIT_COMMON_DIR = (0, import_node_path8.dirname)((0, import_node_path8.dirname)((0, import_node_path8.resolve)(gitDir)));
|
|
18373
18433
|
return env;
|
|
18374
18434
|
}
|
|
18375
18435
|
function hostGitDriverOverrides(cwd, env, timeout) {
|
|
18376
18436
|
let out;
|
|
18377
18437
|
try {
|
|
18378
|
-
out = (0, import_node_child_process2.execFileSync)(
|
|
18438
|
+
out = (0, import_node_child_process2.execFileSync)(hostGitExe(), [...hostGitHardeningArgs(), "config", "--null", "--show-scope", "--name-only", "--get-regexp", "^(filter|diff)\\."], { cwd, env, encoding: "utf8", stdio: "pipe", windowsHide: true, timeout });
|
|
18379
18439
|
} catch (err) {
|
|
18380
18440
|
return err.status === 1 ? [] : null;
|
|
18381
18441
|
}
|
|
@@ -18400,6 +18460,11 @@ function hostGitDriverOverrides(cwd, env, timeout) {
|
|
|
18400
18460
|
...[...diffs].flatMap((n) => ["textconv=", "command="].flatMap((kv) => ["-c", `diff.${n}.${kv}`]))
|
|
18401
18461
|
];
|
|
18402
18462
|
}
|
|
18463
|
+
function hostGitExe() {
|
|
18464
|
+
const git2 = resolveBareExe("git");
|
|
18465
|
+
if (git2 === null) throw new Error("host git: git is not on PATH");
|
|
18466
|
+
return git2;
|
|
18467
|
+
}
|
|
18403
18468
|
function runHostGit(cwd, args, timeout, baseEnv = process.env) {
|
|
18404
18469
|
const env = hostGitEnv(args, baseEnv);
|
|
18405
18470
|
const recorded = env.GIT_DIR ? recordedGitDirs.get(env.GIT_DIR) : void 0;
|
|
@@ -18420,38 +18485,38 @@ function runHostGit(cwd, args, timeout, baseEnv = process.env) {
|
|
|
18420
18485
|
tree = [...tree, ...LANE_SUBMODULE_OVERRIDES.flatMap((kv) => ["-c", kv])];
|
|
18421
18486
|
if (IGNORE_SUBMODULES_SUBCOMMANDS.has(subcommand)) finalArgs = [...args.slice(0, at + 1), "--ignore-submodules=all", ...args.slice(at + 1)];
|
|
18422
18487
|
}
|
|
18423
|
-
return (0, import_node_child_process2.execFileSync)(
|
|
18488
|
+
return (0, import_node_child_process2.execFileSync)(hostGitExe(), [...hostGitHardeningArgs(), ...tree, ...finalArgs], { cwd, env, encoding: "utf-8", stdio: "pipe", windowsHide: true, timeout });
|
|
18424
18489
|
}
|
|
18425
18490
|
function git(repoRoot, args, cwd = repoRoot) {
|
|
18426
18491
|
return runHostGit(cwd, args).trim();
|
|
18427
18492
|
}
|
|
18428
18493
|
function readPlainFile(path5) {
|
|
18429
18494
|
try {
|
|
18430
|
-
return (0,
|
|
18495
|
+
return (0, import_node_fs7.lstatSync)(path5).isFile() ? (0, import_node_fs7.readFileSync)(path5, "utf-8") : null;
|
|
18431
18496
|
} catch {
|
|
18432
18497
|
return null;
|
|
18433
18498
|
}
|
|
18434
18499
|
}
|
|
18435
18500
|
function readWorktreeGitLinks(wtPath) {
|
|
18436
|
-
const dotGit = readPlainFile((0,
|
|
18501
|
+
const dotGit = readPlainFile((0, import_node_path8.join)(wtPath, ".git"));
|
|
18437
18502
|
const match = dotGit === null ? null : /^gitdir: (.+?)\r?\n?$/.exec(dotGit);
|
|
18438
18503
|
if (!dotGit || !match) return null;
|
|
18439
|
-
const adminDir = (0,
|
|
18504
|
+
const adminDir = (0, import_node_path8.resolve)(wtPath, match[1]);
|
|
18440
18505
|
try {
|
|
18441
|
-
if (!(0,
|
|
18506
|
+
if (!(0, import_node_fs7.lstatSync)(adminDir).isDirectory()) return null;
|
|
18442
18507
|
} catch {
|
|
18443
18508
|
return null;
|
|
18444
18509
|
}
|
|
18445
|
-
const gitdir = readPlainFile((0,
|
|
18446
|
-
const commondir = readPlainFile((0,
|
|
18510
|
+
const gitdir = readPlainFile((0, import_node_path8.join)(adminDir, "gitdir"));
|
|
18511
|
+
const commondir = readPlainFile((0, import_node_path8.join)(adminDir, "commondir"));
|
|
18447
18512
|
const configWorktree = configWorktreeState(adminDir);
|
|
18448
18513
|
if (gitdir === null || commondir === null || configWorktree === null) return null;
|
|
18449
18514
|
return { adminDir, dotGit, gitdir, commondir, configWorktree };
|
|
18450
18515
|
}
|
|
18451
18516
|
function configWorktreeState(adminDir) {
|
|
18452
|
-
const path5 = (0,
|
|
18517
|
+
const path5 = (0, import_node_path8.join)(adminDir, "config.worktree");
|
|
18453
18518
|
try {
|
|
18454
|
-
return (0,
|
|
18519
|
+
return (0, import_node_fs7.lstatSync)(path5).isFile() ? (0, import_node_crypto6.createHash)("sha256").update((0, import_node_fs7.readFileSync)(path5)).digest("hex") : null;
|
|
18455
18520
|
} catch (err) {
|
|
18456
18521
|
return err.code === "ENOENT" ? "absent" : null;
|
|
18457
18522
|
}
|
|
@@ -18463,24 +18528,24 @@ function recordedEntry(wtPath) {
|
|
|
18463
18528
|
return [...recordedGitDirs.values()].find((e) => pathKey(e.wtPath) === pathKey(wtPath));
|
|
18464
18529
|
}
|
|
18465
18530
|
function recordWorktreeGitLinks(wtPath, links) {
|
|
18466
|
-
const existing = recordedEntry(wtPath) ?? recordedGitDirs.get((0,
|
|
18531
|
+
const existing = recordedEntry(wtPath) ?? recordedGitDirs.get((0, import_node_path8.resolve)(links.adminDir));
|
|
18467
18532
|
if (existing) {
|
|
18468
18533
|
if (pathKey(existing.wtPath) === pathKey(wtPath) && sameGitLinks(existing.links, links)) return;
|
|
18469
18534
|
throw new Error(`sandbox-escaped: other git links are already recorded for ${wtPath}; the record is never replaced`);
|
|
18470
18535
|
}
|
|
18471
18536
|
const args = ["--git-dir", links.adminDir, "--work-tree", wtPath];
|
|
18472
|
-
const format = (0, import_node_child_process2.execFileSync)(
|
|
18537
|
+
const format = (0, import_node_child_process2.execFileSync)(hostGitExe(), [...hostGitHardeningArgs(), ...args, "rev-parse", "--show-object-format"], { cwd: wtPath, env: hostGitEnv(args), encoding: "utf-8", stdio: "pipe", windowsHide: true }).trim();
|
|
18473
18538
|
const emptyTree = EMPTY_TREE[format];
|
|
18474
18539
|
if (!emptyTree) throw new Error(`host git: unknown object format ${JSON.stringify(format)} in ${wtPath}`);
|
|
18475
|
-
recordedGitDirs.set((0,
|
|
18540
|
+
recordedGitDirs.set((0, import_node_path8.resolve)(links.adminDir), { wtPath, links, emptyTree });
|
|
18476
18541
|
}
|
|
18477
18542
|
function forgetWorktreeGitLinks(wtPath) {
|
|
18478
18543
|
const entry = recordedEntry(wtPath);
|
|
18479
|
-
if (entry) recordedGitDirs.delete((0,
|
|
18544
|
+
if (entry) recordedGitDirs.delete((0, import_node_path8.resolve)(entry.links.adminDir));
|
|
18480
18545
|
}
|
|
18481
18546
|
function isAdminDirOf(commonGitDir, adminDir) {
|
|
18482
|
-
const rel = (0,
|
|
18483
|
-
return rel !== "" && !rel.startsWith("..") && !(0,
|
|
18547
|
+
const rel = (0, import_node_path8.relative)((0, import_node_path8.resolve)(commonGitDir, "worktrees"), adminDir);
|
|
18548
|
+
return rel !== "" && !rel.startsWith("..") && !(0, import_node_path8.isAbsolute)(rel) && !rel.includes(import_node_path8.sep);
|
|
18484
18549
|
}
|
|
18485
18550
|
function worktreeGitLinksIntact(wtPath, expected, commonGitDir) {
|
|
18486
18551
|
return isAdminDirOf(commonGitDir, expected.adminDir) && sameGitLinks(readWorktreeGitLinks(wtPath), expected);
|
|
@@ -18491,20 +18556,20 @@ function worktreeGitDirArgs(wtPath) {
|
|
|
18491
18556
|
return ["--git-dir", entry.links.adminDir, "--work-tree", entry.wtPath];
|
|
18492
18557
|
}
|
|
18493
18558
|
function canonicalPathForComparison(path5) {
|
|
18494
|
-
let existing = (0,
|
|
18559
|
+
let existing = (0, import_node_path8.resolve)(path5);
|
|
18495
18560
|
const missingTail = [];
|
|
18496
18561
|
let canonical;
|
|
18497
18562
|
for (; ; ) {
|
|
18498
18563
|
try {
|
|
18499
|
-
canonical = (0,
|
|
18564
|
+
canonical = (0, import_node_path8.join)(import_node_fs7.realpathSync.native(existing), ...missingTail);
|
|
18500
18565
|
break;
|
|
18501
18566
|
} catch {
|
|
18502
|
-
const parent = (0,
|
|
18567
|
+
const parent = (0, import_node_path8.dirname)(existing);
|
|
18503
18568
|
if (parent === existing) {
|
|
18504
|
-
canonical = (0,
|
|
18569
|
+
canonical = (0, import_node_path8.resolve)(path5);
|
|
18505
18570
|
break;
|
|
18506
18571
|
}
|
|
18507
|
-
missingTail.unshift((0,
|
|
18572
|
+
missingTail.unshift((0, import_node_path8.basename)(existing));
|
|
18508
18573
|
existing = parent;
|
|
18509
18574
|
}
|
|
18510
18575
|
}
|
|
@@ -18551,10 +18616,10 @@ function statusEntryPath(line) {
|
|
|
18551
18616
|
return normalizeStatusPath(renameIndex >= 0 ? payload.slice(renameIndex + renameSeparator.length) : payload);
|
|
18552
18617
|
}
|
|
18553
18618
|
function worktreeRuntimeStatePrefixes(wtPath) {
|
|
18554
|
-
const root = (0,
|
|
18555
|
-
const omcRel = (0,
|
|
18556
|
-
if (!omcRel || omcRel.startsWith("..") || (0,
|
|
18557
|
-
return WORKTREE_RUNTIME_STATE_DIRS.map(([dir, rest]) => [`${(0,
|
|
18619
|
+
const root = (0, import_node_path8.resolve)(wtPath);
|
|
18620
|
+
const omcRel = (0, import_node_path8.relative)(root, (0, import_node_path8.resolve)(getOmcRoot(wtPath))).split(import_node_path8.sep).join("/");
|
|
18621
|
+
if (!omcRel || omcRel.startsWith("..") || (0, import_node_path8.isAbsolute)(omcRel) || omcRel.includes("/")) return [];
|
|
18622
|
+
return WORKTREE_RUNTIME_STATE_DIRS.map(([dir, rest]) => [`${(0, import_node_path8.relative)(root, resolveOmcPath(dir, wtPath)).split(import_node_path8.sep).join("/")}/`, rest]);
|
|
18558
18623
|
}
|
|
18559
18624
|
function isWorktreeDirtyExcept(wtPath, ignoredRootPaths = [], gitDirArgs = []) {
|
|
18560
18625
|
try {
|
|
@@ -18578,7 +18643,7 @@ function removeRuntimeLeftover(wtPath, retryMs = RUNTIME_LEFTOVER_RETRY_MS) {
|
|
|
18578
18643
|
const deadline = Date.now() + retryMs;
|
|
18579
18644
|
for (; ; ) {
|
|
18580
18645
|
try {
|
|
18581
|
-
(0,
|
|
18646
|
+
(0, import_node_fs7.rmSync)(wtPath, { recursive: true, force: true });
|
|
18582
18647
|
return;
|
|
18583
18648
|
} catch (err) {
|
|
18584
18649
|
if (Date.now() >= deadline) {
|
|
@@ -18592,33 +18657,33 @@ function removeRuntimeLeftover(wtPath, retryMs = RUNTIME_LEFTOVER_RETRY_MS) {
|
|
|
18592
18657
|
}
|
|
18593
18658
|
function unlinkUntrackedWorktreeLinks(wtPath, gitDirArgs = [], keepTracked = true) {
|
|
18594
18659
|
const tracked = new Set(
|
|
18595
|
-
(keepTracked ? gitOrNull([...gitDirArgs, "ls-files", "-z", "--stage"], wtPath) ?? "" : "").split("\0").filter((entry) => entry.startsWith("120000 ")).map((entry) => (0,
|
|
18660
|
+
(keepTracked ? gitOrNull([...gitDirArgs, "ls-files", "-z", "--stage"], wtPath) ?? "" : "").split("\0").filter((entry) => entry.startsWith("120000 ")).map((entry) => (0, import_node_path8.resolve)(wtPath, entry.slice(entry.indexOf(" ") + 1)))
|
|
18596
18661
|
);
|
|
18597
18662
|
const pending = [wtPath];
|
|
18598
18663
|
while (pending.length > 0) {
|
|
18599
18664
|
const dir = pending.pop();
|
|
18600
18665
|
let entries;
|
|
18601
18666
|
try {
|
|
18602
|
-
entries = (0,
|
|
18667
|
+
entries = (0, import_node_fs7.readdirSync)(dir, { withFileTypes: true });
|
|
18603
18668
|
} catch {
|
|
18604
18669
|
continue;
|
|
18605
18670
|
}
|
|
18606
18671
|
for (const entry of entries) {
|
|
18607
|
-
const path5 = (0,
|
|
18672
|
+
const path5 = (0, import_node_path8.join)(dir, entry.name);
|
|
18608
18673
|
if (keepTracked && dir === wtPath && entry.name === ".git") continue;
|
|
18609
18674
|
let stat2;
|
|
18610
18675
|
try {
|
|
18611
|
-
stat2 = (0,
|
|
18676
|
+
stat2 = (0, import_node_fs7.lstatSync)(path5);
|
|
18612
18677
|
} catch {
|
|
18613
18678
|
continue;
|
|
18614
18679
|
}
|
|
18615
18680
|
if (stat2.isSymbolicLink()) {
|
|
18616
|
-
if (tracked.has((0,
|
|
18681
|
+
if (tracked.has((0, import_node_path8.resolve)(path5))) continue;
|
|
18617
18682
|
try {
|
|
18618
|
-
(0,
|
|
18683
|
+
(0, import_node_fs7.unlinkSync)(path5);
|
|
18619
18684
|
} catch {
|
|
18620
18685
|
try {
|
|
18621
|
-
(0,
|
|
18686
|
+
(0, import_node_fs7.rmdirSync)(path5);
|
|
18622
18687
|
} catch (err) {
|
|
18623
18688
|
const error2 = new Error(`worktree_link_unremovable: preserving worker worktree at ${wtPath}; cannot unlink ${path5}: ${err instanceof Error ? err.message : String(err)}`);
|
|
18624
18689
|
error2.code = "worktree_link_unremovable";
|
|
@@ -18649,10 +18714,10 @@ function commitCheckFailedError(message) {
|
|
|
18649
18714
|
function branchRefStored(repoRoot, branch) {
|
|
18650
18715
|
const commonDir = gitOrNull(["rev-parse", "--git-common-dir"], repoRoot);
|
|
18651
18716
|
if (!commonDir) throw commitCheckFailedError(`keeping worker branch ${branch} (cannot locate the git directory)`);
|
|
18652
|
-
const gitDir = (0,
|
|
18653
|
-
if ((0,
|
|
18717
|
+
const gitDir = (0, import_node_path8.resolve)(repoRoot, commonDir);
|
|
18718
|
+
if ((0, import_node_fs7.existsSync)((0, import_node_path8.join)(gitDir, "refs", "heads", ...branch.split("/")))) return true;
|
|
18654
18719
|
try {
|
|
18655
|
-
return (0,
|
|
18720
|
+
return (0, import_node_fs7.readFileSync)((0, import_node_path8.join)(gitDir, "packed-refs"), "utf-8").split("\n").some((line) => line.trimEnd().endsWith(` refs/heads/${branch}`));
|
|
18656
18721
|
} catch (err) {
|
|
18657
18722
|
if (err.code === "ENOENT") return false;
|
|
18658
18723
|
throw commitCheckFailedError(`keeping worker branch ${branch} (cannot read packed-refs)`);
|
|
@@ -18696,16 +18761,16 @@ function countUnmergedCommits(repoRoot, head, baseCommit, contained = []) {
|
|
|
18696
18761
|
}
|
|
18697
18762
|
function hasInitializedSubmodules(wtPath, gitDirArgs = []) {
|
|
18698
18763
|
const modulesDir = gitOrNull([...gitDirArgs, "rev-parse", "--git-path", "modules"], wtPath);
|
|
18699
|
-
if (modulesDir && (0,
|
|
18764
|
+
if (modulesDir && (0, import_node_fs7.existsSync)((0, import_node_path8.resolve)(wtPath, modulesDir))) return true;
|
|
18700
18765
|
const staged = gitOrNull([...gitDirArgs, "ls-files", "--stage"], wtPath) ?? "";
|
|
18701
18766
|
return staged.split("\n").some((line) => {
|
|
18702
18767
|
if (!line.startsWith("160000 ")) return false;
|
|
18703
18768
|
const tab = line.indexOf(" ");
|
|
18704
|
-
return tab >= 0 && (0,
|
|
18769
|
+
return tab >= 0 && (0, import_node_fs7.existsSync)((0, import_node_path8.join)(wtPath, normalizeStatusPath(line.slice(tab + 1)), ".git"));
|
|
18705
18770
|
});
|
|
18706
18771
|
}
|
|
18707
18772
|
function unmergedCommitsError(info) {
|
|
18708
|
-
const what = (0,
|
|
18773
|
+
const what = (0, import_node_fs7.existsSync)(info.path) ? `worker worktree at ${info.path}` : `worker branch of the removed worktree ${info.path}`;
|
|
18709
18774
|
const error2 = new Error(
|
|
18710
18775
|
`worktree_unmerged_commits: preserving ${what} with ${info.commits} commit(s) not merged into the leader HEAD${info.branch ? ` (branch ${info.branch})` : " (detached)"}`
|
|
18711
18776
|
);
|
|
@@ -18713,34 +18778,34 @@ function unmergedCommitsError(info) {
|
|
|
18713
18778
|
return error2;
|
|
18714
18779
|
}
|
|
18715
18780
|
function getPreservedWorktreesRecordPath(repoRoot, teamName) {
|
|
18716
|
-
return (0,
|
|
18781
|
+
return (0, import_node_path8.join)(getOmcRoot(repoRoot), "state", "team-preserved-worktrees", `${sanitizeName(teamName)}.json`);
|
|
18717
18782
|
}
|
|
18718
18783
|
function writePreservedWorktreesRecord(repoRoot, teamName, preserved) {
|
|
18719
18784
|
const recordPath = getPreservedWorktreesRecordPath(repoRoot, teamName);
|
|
18720
18785
|
if (preserved.length === 0) {
|
|
18721
|
-
(0,
|
|
18786
|
+
(0, import_node_fs7.rmSync)(recordPath, { force: true });
|
|
18722
18787
|
return;
|
|
18723
18788
|
}
|
|
18724
|
-
ensureDirWithMode((0,
|
|
18789
|
+
ensureDirWithMode((0, import_node_path8.join)(getOmcRoot(repoRoot), "state", "team-preserved-worktrees"));
|
|
18725
18790
|
atomicWriteJson2(recordPath, { team: teamName, recorded_at: (/* @__PURE__ */ new Date()).toISOString(), preserved_worktrees: preserved });
|
|
18726
18791
|
}
|
|
18727
18792
|
function getMetadataPath(repoRoot, teamName) {
|
|
18728
|
-
return (0,
|
|
18793
|
+
return (0, import_node_path8.join)(getOmcRoot(repoRoot), "state", "team", sanitizeName(teamName), "worktrees.json");
|
|
18729
18794
|
}
|
|
18730
18795
|
function getLegacyMetadataPath(repoRoot, teamName) {
|
|
18731
|
-
return (0,
|
|
18796
|
+
return (0, import_node_path8.join)(getOmcRoot(repoRoot), "state", "team-bridge", sanitizeName(teamName), "worktrees.json");
|
|
18732
18797
|
}
|
|
18733
18798
|
function getWorkerStateDir(repoRoot, teamName, workerName) {
|
|
18734
|
-
return (0,
|
|
18799
|
+
return (0, import_node_path8.join)(getOmcRoot(repoRoot), "state", "team", sanitizeName(teamName), "workers", sanitizeName(workerName));
|
|
18735
18800
|
}
|
|
18736
18801
|
function getRootAgentsBackupPath(repoRoot, teamName, workerName) {
|
|
18737
|
-
return (0,
|
|
18802
|
+
return (0, import_node_path8.join)(getWorkerStateDir(repoRoot, teamName, workerName), "worktree-root-agents.json");
|
|
18738
18803
|
}
|
|
18739
18804
|
function readRootAgentsBackup(repoRoot, teamName, workerName) {
|
|
18740
18805
|
const backupPath = getRootAgentsBackupPath(repoRoot, teamName, workerName);
|
|
18741
|
-
if (!(0,
|
|
18806
|
+
if (!(0, import_node_fs7.existsSync)(backupPath)) return null;
|
|
18742
18807
|
try {
|
|
18743
|
-
return JSON.parse((0,
|
|
18808
|
+
return JSON.parse((0, import_node_fs7.readFileSync)(backupPath, "utf-8"));
|
|
18744
18809
|
} catch (err) {
|
|
18745
18810
|
const msg = err instanceof Error ? err.message : String(err);
|
|
18746
18811
|
process.stderr.write(`[omc] warning: worktree root AGENTS backup parse error: ${msg}
|
|
@@ -18758,27 +18823,27 @@ function restoreWorktreeRootAgents(teamName, workerName, repoRoot, worktreePath)
|
|
|
18758
18823
|
if (!backup) return { restored: false, reason: "no_backup" };
|
|
18759
18824
|
const resolvedWorktreePath = worktreePath ?? backup.worktreePath;
|
|
18760
18825
|
validateResolvedPath(resolvedWorktreePath, omcRoot);
|
|
18761
|
-
if (!(0,
|
|
18826
|
+
if (!(0, import_node_fs7.existsSync)(resolvedWorktreePath)) {
|
|
18762
18827
|
try {
|
|
18763
|
-
(0,
|
|
18828
|
+
(0, import_node_fs7.unlinkSync)(backupPath);
|
|
18764
18829
|
} catch {
|
|
18765
18830
|
}
|
|
18766
18831
|
return { restored: false, reason: "worktree_missing" };
|
|
18767
18832
|
}
|
|
18768
|
-
const agentsPath = (0,
|
|
18833
|
+
const agentsPath = (0, import_node_path8.join)(resolvedWorktreePath, "AGENTS.md");
|
|
18769
18834
|
validateResolvedPath(agentsPath, resolvedWorktreePath);
|
|
18770
|
-
const currentContent = (0,
|
|
18835
|
+
const currentContent = (0, import_node_fs7.existsSync)(agentsPath) ? (0, import_node_fs7.readFileSync)(agentsPath, "utf-8") : void 0;
|
|
18771
18836
|
const isPartialInstallOriginal = backup.hadOriginal && currentContent === (backup.originalContent ?? "");
|
|
18772
18837
|
if (currentContent !== void 0 && currentContent !== backup.installedContent && !isPartialInstallOriginal) {
|
|
18773
18838
|
return { restored: false, reason: "agents_dirty" };
|
|
18774
18839
|
}
|
|
18775
18840
|
if (backup.hadOriginal) {
|
|
18776
|
-
(0,
|
|
18777
|
-
} else if ((0,
|
|
18778
|
-
(0,
|
|
18841
|
+
(0, import_node_fs7.writeFileSync)(agentsPath, backup.originalContent ?? "", "utf-8");
|
|
18842
|
+
} else if ((0, import_node_fs7.existsSync)(agentsPath)) {
|
|
18843
|
+
(0, import_node_fs7.unlinkSync)(agentsPath);
|
|
18779
18844
|
}
|
|
18780
18845
|
try {
|
|
18781
|
-
(0,
|
|
18846
|
+
(0, import_node_fs7.unlinkSync)(backupPath);
|
|
18782
18847
|
} catch {
|
|
18783
18848
|
}
|
|
18784
18849
|
return { restored: true };
|
|
@@ -18788,9 +18853,9 @@ function readMetadataResult(repoRoot, teamName) {
|
|
|
18788
18853
|
const byWorker = /* @__PURE__ */ new Map();
|
|
18789
18854
|
const issues = [];
|
|
18790
18855
|
for (const metaPath of paths) {
|
|
18791
|
-
if (!(0,
|
|
18856
|
+
if (!(0, import_node_fs7.existsSync)(metaPath)) continue;
|
|
18792
18857
|
try {
|
|
18793
|
-
const entries = JSON.parse((0,
|
|
18858
|
+
const entries = JSON.parse((0, import_node_fs7.readFileSync)(metaPath, "utf-8"));
|
|
18794
18859
|
for (const entry of entries) byWorker.set(entry.workerName, entry);
|
|
18795
18860
|
} catch (err) {
|
|
18796
18861
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -18805,15 +18870,15 @@ function readMetadata(repoRoot, teamName) {
|
|
|
18805
18870
|
return readMetadataResult(repoRoot, teamName).entries;
|
|
18806
18871
|
}
|
|
18807
18872
|
function listRootAgentsBackupIssues(repoRoot, teamName, entries) {
|
|
18808
|
-
const workersDir = (0,
|
|
18809
|
-
if (!(0,
|
|
18873
|
+
const workersDir = (0, import_node_path8.join)(getOmcRoot(repoRoot), "state", "team", sanitizeName(teamName), "workers");
|
|
18874
|
+
if (!(0, import_node_fs7.existsSync)(workersDir)) return [];
|
|
18810
18875
|
const knownWorkers = new Set(entries.map((entry) => sanitizeName(entry.workerName)));
|
|
18811
18876
|
const issues = [];
|
|
18812
|
-
for (const workerName of (0,
|
|
18813
|
-
const backupPath = (0,
|
|
18814
|
-
if (!(0,
|
|
18877
|
+
for (const workerName of (0, import_node_fs7.readdirSync)(workersDir)) {
|
|
18878
|
+
const backupPath = (0, import_node_path8.join)(workersDir, workerName, "worktree-root-agents.json");
|
|
18879
|
+
if (!(0, import_node_fs7.existsSync)(backupPath)) continue;
|
|
18815
18880
|
try {
|
|
18816
|
-
JSON.parse((0,
|
|
18881
|
+
JSON.parse((0, import_node_fs7.readFileSync)(backupPath, "utf-8"));
|
|
18817
18882
|
} catch (error2) {
|
|
18818
18883
|
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
18819
18884
|
issues.push({ path: backupPath, message: `worktree_root_agents_backup_unreadable:${workerName}:${message}` });
|
|
@@ -18830,8 +18895,8 @@ function listRootAgentsBackupIssues(repoRoot, teamName, entries) {
|
|
|
18830
18895
|
}
|
|
18831
18896
|
function writeMetadata(repoRoot, teamName, entries) {
|
|
18832
18897
|
const metaPath = getMetadataPath(repoRoot, teamName);
|
|
18833
|
-
validateResolvedPath(metaPath, (0,
|
|
18834
|
-
ensureDirWithMode((0,
|
|
18898
|
+
validateResolvedPath(metaPath, (0, import_node_path8.join)(getOmcRoot(repoRoot), "state", "team"));
|
|
18899
|
+
ensureDirWithMode((0, import_node_path8.join)(getOmcRoot(repoRoot), "state", "team", sanitizeName(teamName)));
|
|
18835
18900
|
atomicWriteJson2(metaPath, entries);
|
|
18836
18901
|
}
|
|
18837
18902
|
function forgetMetadataUnlocked(repoRoot, teamName, workerName) {
|
|
@@ -18841,17 +18906,17 @@ function forgetMetadataUnlocked(repoRoot, teamName, workerName) {
|
|
|
18841
18906
|
function checkWorkerWorktreeRemovalSafety(teamName, workerName, repoRoot, worktreePath, gitDirArgs = []) {
|
|
18842
18907
|
const wtPath = worktreePath ?? getWorktreePath(repoRoot, teamName, workerName);
|
|
18843
18908
|
const backup = readRootAgentsBackup(repoRoot, teamName, workerName);
|
|
18844
|
-
if (!(0,
|
|
18909
|
+
if (!(0, import_node_fs7.existsSync)(wtPath)) return;
|
|
18845
18910
|
validateWorktreeRemovalTarget({
|
|
18846
18911
|
candidatePath: wtPath,
|
|
18847
|
-
expectedRoots: [(0,
|
|
18912
|
+
expectedRoots: [(0, import_node_path8.join)(getOmcRoot(repoRoot), "team", sanitizeName(teamName), "worktrees")],
|
|
18848
18913
|
mainRepoRoots: [repoRoot]
|
|
18849
18914
|
});
|
|
18850
18915
|
let ignoreRootAgents = false;
|
|
18851
18916
|
if (backup) {
|
|
18852
|
-
const agentsPath = (0,
|
|
18917
|
+
const agentsPath = (0, import_node_path8.join)(wtPath, "AGENTS.md");
|
|
18853
18918
|
validateResolvedPath(agentsPath, wtPath);
|
|
18854
|
-
const currentContent = (0,
|
|
18919
|
+
const currentContent = (0, import_node_fs7.existsSync)(agentsPath) ? (0, import_node_fs7.readFileSync)(agentsPath, "utf-8") : void 0;
|
|
18855
18920
|
const isPartialInstallOriginal = backup.hadOriginal && currentContent === (backup.originalContent ?? "");
|
|
18856
18921
|
if (currentContent !== void 0 && currentContent !== backup.installedContent && !isPartialInstallOriginal) {
|
|
18857
18922
|
const error2 = new Error(`agents_dirty: preserving modified worktree root AGENTS.md at ${agentsPath}`);
|
|
@@ -18872,7 +18937,7 @@ function prepareWorkerWorktreeForRemoval(teamName, workerName, repoRoot, worktre
|
|
|
18872
18937
|
checkWorkerWorktreeRemovalSafety(teamName, workerName, repoRoot, wtPath, gitDirArgs);
|
|
18873
18938
|
const agentsRestore = restoreWorktreeRootAgents(teamName, workerName, repoRoot, wtPath);
|
|
18874
18939
|
if (agentsRestore.reason === "agents_dirty") {
|
|
18875
|
-
const error2 = new Error(`agents_dirty: preserving modified worktree root AGENTS.md at ${(0,
|
|
18940
|
+
const error2 = new Error(`agents_dirty: preserving modified worktree root AGENTS.md at ${(0, import_node_path8.join)(wtPath, "AGENTS.md")}`);
|
|
18876
18941
|
error2.code = "agents_dirty";
|
|
18877
18942
|
throw error2;
|
|
18878
18943
|
}
|
|
@@ -18907,7 +18972,7 @@ function removeWorkerWorktree(teamName, workerName, repoRoot, options = {}) {
|
|
|
18907
18972
|
throw commitCheckFailedError(`preserving worker worktree at ${wtPath} (cannot list git worktrees)`);
|
|
18908
18973
|
}
|
|
18909
18974
|
const wasRegisteredWorktree = registered !== null;
|
|
18910
|
-
if (registered && (0,
|
|
18975
|
+
if (registered && (0, import_node_fs7.existsSync)(wtPath)) {
|
|
18911
18976
|
const toplevel = gitOrNull([...gitDirArgs, "rev-parse", "--show-toplevel"], wtPath);
|
|
18912
18977
|
if (!toplevel || canonicalPathForComparison(toplevel) !== canonicalPathForComparison(wtPath)) {
|
|
18913
18978
|
throw commitCheckFailedError(`preserving worker worktree at ${wtPath} (git does not resolve it to its own worktree)`);
|
|
@@ -18926,21 +18991,21 @@ function removeWorkerWorktree(teamName, workerName, repoRoot, options = {}) {
|
|
|
18926
18991
|
if (commits === null) throw commitCheckFailedError(`keeping worker branch ${branch} (cannot count its commits against the leader HEAD)`);
|
|
18927
18992
|
if (commits > 0) throw unmergedCommitsError({ workerName, path: wtPath, branch, commits });
|
|
18928
18993
|
}
|
|
18929
|
-
const runtimeOnly = (0,
|
|
18930
|
-
const submodules = (0,
|
|
18994
|
+
const runtimeOnly = (0, import_node_fs7.existsSync)(wtPath) && isWorktreeDirtyExcept(wtPath, ["AGENTS.md"], gitDirArgs).runtimeState;
|
|
18995
|
+
const submodules = (0, import_node_fs7.existsSync)(wtPath) && hasInitializedSubmodules(wtPath, gitDirArgs);
|
|
18931
18996
|
const force = runtimeOnly && !submodules;
|
|
18932
18997
|
if (wasRegisteredWorktree && submodules) {
|
|
18933
18998
|
const error2 = new Error(`worktree_remove_failed: preserving metadata for registered worker worktree at ${wtPath}: initialized submodules`);
|
|
18934
18999
|
error2.code = "worktree_remove_failed";
|
|
18935
19000
|
throw error2;
|
|
18936
19001
|
}
|
|
18937
|
-
if ((0,
|
|
19002
|
+
if ((0, import_node_fs7.existsSync)(wtPath)) unlinkUntrackedWorktreeLinks(wtPath, gitDirArgs);
|
|
18938
19003
|
try {
|
|
18939
19004
|
if (options.gitLinks && laneCommonDir) {
|
|
18940
|
-
if ((0,
|
|
19005
|
+
if ((0, import_node_fs7.existsSync)(wtPath)) {
|
|
18941
19006
|
validateWorktreeRemovalTarget({
|
|
18942
19007
|
candidatePath: wtPath,
|
|
18943
|
-
expectedRoots: [(0,
|
|
19008
|
+
expectedRoots: [(0, import_node_path8.join)(getOmcRoot(repoRoot), "team", sanitizeName(teamName), "worktrees")],
|
|
18944
19009
|
mainRepoRoots: [repoRoot]
|
|
18945
19010
|
});
|
|
18946
19011
|
}
|
|
@@ -18967,14 +19032,14 @@ function removeWorkerWorktree(teamName, workerName, repoRoot, options = {}) {
|
|
|
18967
19032
|
} catch {
|
|
18968
19033
|
}
|
|
18969
19034
|
if (branchHead) deleteWorkerBranchAt(repoRoot, branch, branchHead);
|
|
18970
|
-
if ((0,
|
|
19035
|
+
if ((0, import_node_fs7.existsSync)(wtPath) && !isRegisteredWorktreePath(repoRoot, wtPath)) {
|
|
18971
19036
|
validateWorktreeRemovalTarget({
|
|
18972
19037
|
candidatePath: wtPath,
|
|
18973
|
-
expectedRoots: [(0,
|
|
19038
|
+
expectedRoots: [(0, import_node_path8.join)(getOmcRoot(repoRoot), "team", sanitizeName(teamName), "worktrees")],
|
|
18974
19039
|
mainRepoRoots: [repoRoot]
|
|
18975
19040
|
});
|
|
18976
19041
|
if (force) removeRuntimeLeftover(wtPath);
|
|
18977
|
-
else (0,
|
|
19042
|
+
else (0, import_node_fs7.rmSync)(wtPath, { recursive: true, force: true });
|
|
18978
19043
|
}
|
|
18979
19044
|
forgetMetadataUnlocked(repoRoot, teamName, workerName);
|
|
18980
19045
|
forgetWorktreeGitLinks(wtPath);
|
|
@@ -18984,27 +19049,27 @@ function removeWorkerWorktree(teamName, workerName, repoRoot, options = {}) {
|
|
|
18984
19049
|
function removeTreeByPath(dir) {
|
|
18985
19050
|
let stat2;
|
|
18986
19051
|
try {
|
|
18987
|
-
stat2 = (0,
|
|
19052
|
+
stat2 = (0, import_node_fs7.lstatSync)(dir);
|
|
18988
19053
|
} catch {
|
|
18989
19054
|
return;
|
|
18990
19055
|
}
|
|
18991
19056
|
if (stat2.isSymbolicLink()) {
|
|
18992
19057
|
try {
|
|
18993
|
-
(0,
|
|
19058
|
+
(0, import_node_fs7.unlinkSync)(dir);
|
|
18994
19059
|
} catch {
|
|
18995
|
-
(0,
|
|
19060
|
+
(0, import_node_fs7.rmdirSync)(dir);
|
|
18996
19061
|
}
|
|
18997
19062
|
return;
|
|
18998
19063
|
}
|
|
18999
19064
|
unlinkUntrackedWorktreeLinks(dir, [], false);
|
|
19000
|
-
(0,
|
|
19065
|
+
(0, import_node_fs7.rmSync)(dir, { recursive: true, force: true });
|
|
19001
19066
|
}
|
|
19002
19067
|
function removeTamperedWorktree(repoRoot, teamName, workerName, wtPath, links, commonDir) {
|
|
19003
19068
|
const removeTree = removeTreeByPath;
|
|
19004
|
-
if ((0,
|
|
19069
|
+
if ((0, import_node_fs7.existsSync)(wtPath)) {
|
|
19005
19070
|
validateWorktreeRemovalTarget({
|
|
19006
19071
|
candidatePath: wtPath,
|
|
19007
|
-
expectedRoots: [(0,
|
|
19072
|
+
expectedRoots: [(0, import_node_path8.join)(getOmcRoot(repoRoot), "team", sanitizeName(teamName), "worktrees")],
|
|
19008
19073
|
mainRepoRoots: [repoRoot]
|
|
19009
19074
|
});
|
|
19010
19075
|
}
|
|
@@ -19061,15 +19126,16 @@ function cleanupTeamWorktrees(teamName, repoRoot) {
|
|
|
19061
19126
|
}
|
|
19062
19127
|
return { removed, preserved, retained };
|
|
19063
19128
|
}
|
|
19064
|
-
var
|
|
19129
|
+
var import_node_fs7, import_node_os3, import_node_path8, import_node_child_process2, import_node_crypto6, emptyHooksDir, EXEC_KEY_OVERRIDES, emptyAttributesFile, WORK_TREE_SUBCOMMANDS, GLOBAL_OPTIONS_WITH_VALUE, LANE_SUBMODULE_OVERRIDES, IGNORE_SUBMODULES_SUBCOMMANDS, EMPTY_TREE, recordedGitDirs, pathKey, UNTRACKED_OMC_STATE, WORKTREE_RUNTIME_STATE_DIRS, RUNTIME_LEFTOVER_RETRY_MS;
|
|
19065
19130
|
var init_git_worktree = __esm({
|
|
19066
19131
|
"src/team/git-worktree.ts"() {
|
|
19067
19132
|
"use strict";
|
|
19068
|
-
|
|
19133
|
+
import_node_fs7 = require("node:fs");
|
|
19069
19134
|
import_node_os3 = require("node:os");
|
|
19070
|
-
|
|
19135
|
+
import_node_path8 = require("node:path");
|
|
19071
19136
|
import_node_child_process2 = require("node:child_process");
|
|
19072
19137
|
import_node_crypto6 = require("node:crypto");
|
|
19138
|
+
init_windows_search();
|
|
19073
19139
|
init_fs_utils();
|
|
19074
19140
|
init_worktree_cleanup_safety();
|
|
19075
19141
|
init_tmux_session();
|
|
@@ -19120,7 +19186,7 @@ var init_git_worktree = __esm({
|
|
|
19120
19186
|
sha256: "6ef19b41225c5369f1c104d45d8d85efa9b057b53b14b4b9b939dd74decc5321"
|
|
19121
19187
|
};
|
|
19122
19188
|
recordedGitDirs = /* @__PURE__ */ new Map();
|
|
19123
|
-
pathKey = (path5) => process.platform === "win32" ? (0,
|
|
19189
|
+
pathKey = (path5) => process.platform === "win32" ? (0, import_node_path8.resolve)(path5).toLowerCase() : (0, import_node_path8.resolve)(path5);
|
|
19124
19190
|
UNTRACKED_OMC_STATE = new RegExp(
|
|
19125
19191
|
`^\\?\\? ${OmcPaths.ROOT.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(?:/|$)`
|
|
19126
19192
|
);
|
|
@@ -19272,32 +19338,32 @@ function isSdkTarget(value) {
|
|
|
19272
19338
|
return typeof value === "string" && value.startsWith(SDK_TARGET_PREFIX);
|
|
19273
19339
|
}
|
|
19274
19340
|
function sdkWorkerFiles(stateRoot, workerName) {
|
|
19275
|
-
const dir = (0,
|
|
19341
|
+
const dir = (0, import_node_path9.join)(stateRoot, "workers", workerName);
|
|
19276
19342
|
return {
|
|
19277
19343
|
dir,
|
|
19278
|
-
spec: (0,
|
|
19279
|
-
doorbell: (0,
|
|
19280
|
-
session: (0,
|
|
19281
|
-
probe: (0,
|
|
19282
|
-
events: (0,
|
|
19283
|
-
log: (0,
|
|
19284
|
-
home: (0,
|
|
19285
|
-
bin: (0,
|
|
19286
|
-
shutdownAck: (0,
|
|
19344
|
+
spec: (0, import_node_path9.join)(dir, "sdk-host-spec.json"),
|
|
19345
|
+
doorbell: (0, import_node_path9.join)(dir, "sdk-doorbell.jsonl"),
|
|
19346
|
+
session: (0, import_node_path9.join)(dir, "sdk-session.json"),
|
|
19347
|
+
probe: (0, import_node_path9.join)(dir, "sdk-probe.json"),
|
|
19348
|
+
events: (0, import_node_path9.join)(dir, "sdk-events.jsonl"),
|
|
19349
|
+
log: (0, import_node_path9.join)(dir, "sdk-host.log"),
|
|
19350
|
+
home: (0, import_node_path9.join)(dir, "copilot-home"),
|
|
19351
|
+
bin: (0, import_node_path9.join)(dir, "bin"),
|
|
19352
|
+
shutdownAck: (0, import_node_path9.join)(dir, "shutdown-ack.json")
|
|
19287
19353
|
};
|
|
19288
19354
|
}
|
|
19289
19355
|
function ringDoorbell(stateRoot, workerName, entry) {
|
|
19290
19356
|
const files = sdkWorkerFiles(stateRoot, workerName);
|
|
19291
|
-
(0,
|
|
19357
|
+
(0, import_node_fs8.mkdirSync)(files.dir, { recursive: true });
|
|
19292
19358
|
const id = entry.id ?? (0, import_node_crypto7.randomUUID)();
|
|
19293
19359
|
const line = { ...entry, id, at: (/* @__PURE__ */ new Date()).toISOString() };
|
|
19294
|
-
(0,
|
|
19360
|
+
(0, import_node_fs8.appendFileSync)(files.doorbell, `${JSON.stringify(line)}
|
|
19295
19361
|
`);
|
|
19296
19362
|
return id;
|
|
19297
19363
|
}
|
|
19298
19364
|
function readSdkSession(stateRoot, workerName) {
|
|
19299
19365
|
try {
|
|
19300
|
-
const parsed = JSON.parse((0,
|
|
19366
|
+
const parsed = JSON.parse((0, import_node_fs8.readFileSync)(sdkWorkerFiles(stateRoot, workerName).session, "utf8"));
|
|
19301
19367
|
return parsed && parsed.schema_version === 1 ? parsed : null;
|
|
19302
19368
|
} catch {
|
|
19303
19369
|
return null;
|
|
@@ -19309,7 +19375,7 @@ async function isTargetGone(target) {
|
|
|
19309
19375
|
return liveness === "dead" || liveness === "mismatch";
|
|
19310
19376
|
}
|
|
19311
19377
|
function failedBeforeProviderStarted(attempt, stateRoot) {
|
|
19312
|
-
return !(0,
|
|
19378
|
+
return !(0, import_node_fs8.existsSync)(attempt.startedPath) && failedThisAttempt(attempt, stateRoot);
|
|
19313
19379
|
}
|
|
19314
19380
|
function failedThisAttempt(attempt, stateRoot) {
|
|
19315
19381
|
const session = readSdkSession(stateRoot, attempt.worker_name);
|
|
@@ -19349,7 +19415,7 @@ async function stopSdkHost(attempt, stateRoot, opts = {}) {
|
|
|
19349
19415
|
}
|
|
19350
19416
|
function readStartedRecord(attempt) {
|
|
19351
19417
|
try {
|
|
19352
|
-
const record2 = JSON.parse((0,
|
|
19418
|
+
const record2 = JSON.parse((0, import_node_fs8.readFileSync)(attempt.startedPath, "utf8"));
|
|
19353
19419
|
return typeof record2.pid === "number" && record2.pid > 0 && typeof record2.process_start_identity === "string" ? { pid: record2.pid, process_start_identity: record2.process_start_identity } : null;
|
|
19354
19420
|
} catch {
|
|
19355
19421
|
return null;
|
|
@@ -19357,9 +19423,9 @@ function readStartedRecord(attempt) {
|
|
|
19357
19423
|
}
|
|
19358
19424
|
function writeTerminationComplete(attempt, pid, startIdentity) {
|
|
19359
19425
|
const path5 = `${attempt.startedPath}.termination-complete`;
|
|
19360
|
-
if ((0,
|
|
19426
|
+
if ((0, import_node_fs8.existsSync)(path5)) return;
|
|
19361
19427
|
try {
|
|
19362
|
-
(0,
|
|
19428
|
+
(0, import_node_fs8.writeFileSync)(path5, JSON.stringify({
|
|
19363
19429
|
schema_version: attempt.schema_version,
|
|
19364
19430
|
attempt_id: attempt.attempt_id,
|
|
19365
19431
|
nonce: attempt.nonce,
|
|
@@ -19379,13 +19445,13 @@ function writeTerminationComplete(attempt, pid, startIdentity) {
|
|
|
19379
19445
|
} catch {
|
|
19380
19446
|
}
|
|
19381
19447
|
}
|
|
19382
|
-
var import_node_crypto7,
|
|
19448
|
+
var import_node_crypto7, import_node_fs8, import_node_path9, SDK_TARGET_PREFIX, SDK_HOST_STOP_FLOOR_MS;
|
|
19383
19449
|
var init_sdk_transport = __esm({
|
|
19384
19450
|
"src/team/sdk-transport.ts"() {
|
|
19385
19451
|
"use strict";
|
|
19386
19452
|
import_node_crypto7 = require("node:crypto");
|
|
19387
|
-
|
|
19388
|
-
|
|
19453
|
+
import_node_fs8 = require("node:fs");
|
|
19454
|
+
import_node_path9 = require("node:path");
|
|
19389
19455
|
init_process_utils();
|
|
19390
19456
|
init_copilot_session_env();
|
|
19391
19457
|
init_runtime_owner_client();
|
|
@@ -19722,6 +19788,7 @@ var init_exec = __esm({
|
|
|
19722
19788
|
"use strict";
|
|
19723
19789
|
import_child_process9 = require("child_process");
|
|
19724
19790
|
init_guard();
|
|
19791
|
+
init_windows_search();
|
|
19725
19792
|
TRUSTED_READ_ENV = Object.freeze({ GIT_NO_REPLACE_OBJECTS: "1" });
|
|
19726
19793
|
}
|
|
19727
19794
|
});
|
|
@@ -19750,9 +19817,9 @@ var init_config2 = __esm({
|
|
|
19750
19817
|
"Socket Security: Pull Request Alerts",
|
|
19751
19818
|
"Socket Security: Project Report"
|
|
19752
19819
|
],
|
|
19753
|
-
// Every check this repo's CI reports on a PR to dev (ci.yml, pr-check.yml
|
|
19754
|
-
//
|
|
19755
|
-
// ci.yml
|
|
19820
|
+
// Every check this repo's CI reports on a PR to dev (ci.yml, pr-check.yml);
|
|
19821
|
+
// the jobs that consume the Build output start late (`needs: [build]`).
|
|
19822
|
+
// ci.yml runs only for PRs to main / dev
|
|
19756
19823
|
// (`pull_request.branches`): on a PR to another base their checks never
|
|
19757
19824
|
// report and stay pending, so such a base needs its own requiredChecks in
|
|
19758
19825
|
// the user config.
|
|
@@ -19844,6 +19911,7 @@ var init_sandbox = __esm({
|
|
|
19844
19911
|
init_copilot_session_env();
|
|
19845
19912
|
init_sdk_policy();
|
|
19846
19913
|
init_jsonc();
|
|
19914
|
+
init_windows_search();
|
|
19847
19915
|
DEFAULT_SANDBOX_SETTINGS = Object.freeze({
|
|
19848
19916
|
enabled: true,
|
|
19849
19917
|
reviewUnsandboxed: "no-shell",
|
|
@@ -19877,7 +19945,7 @@ var init_version = __esm({
|
|
|
19877
19945
|
});
|
|
19878
19946
|
|
|
19879
19947
|
// src/smoke/replay/redact.ts
|
|
19880
|
-
function userHomePatterns(win, pct,
|
|
19948
|
+
function userHomePatterns(win, pct, posix2, posixFlags) {
|
|
19881
19949
|
return [
|
|
19882
19950
|
// The separator spelling is captured once, so `\n` after an escaped `\\` is not taken for a tail separator.
|
|
19883
19951
|
// `\` doubles per JSON level, so any run of backslashes is a separator. The one after `Users` may be either
|
|
@@ -19886,7 +19954,7 @@ function userHomePatterns(win, pct, posix, posixFlags) {
|
|
|
19886
19954
|
// Percent-encoded (`file:///c%3A/Users/...`, `C%3A%5CUsers%5C...`, `%2Fhome%2Fname`).
|
|
19887
19955
|
new RegExp(String.raw`(?<head>(?:\b[A-Za-z]%3A${PCT_SEP}Users|%2F(?:home|Users))${PCT_SEP}(?!<user>)${pct})(?:${PCT_SEP}${PCT_SEG})*`, "gi"),
|
|
19888
19956
|
// POSIX, Git Bash (`/c/Users/...`) and WSL (`/mnt/c/Users/...`).
|
|
19889
|
-
new RegExp(String.raw`(?<head>(?<![\w.$}-])\/(?:home|Users|(?:mnt\/)?[A-Za-z]\/Users)\/(?!<user>)${
|
|
19957
|
+
new RegExp(String.raw`(?<head>(?<![\w.$}-])\/(?:home|Users|(?:mnt\/)?[A-Za-z]\/Users)\/(?!<user>)${posix2})(?:\/${POSIX_SEG})*`, posixFlags)
|
|
19890
19958
|
];
|
|
19891
19959
|
}
|
|
19892
19960
|
var PLACEHOLDER_VALUE, NOT_SECRET_SUFFIX, SECRET_NAME2, UNQUOTED_CHAR, UNQUOTED_VALUE, PCT_US, PCT_SECRET_NAME, PLAIN_VALUE, TOKEN_RULES, SEGMENT_CHAR, WIN_SEG, PCT_SEG, POSIX_SEG, PCT_SEP, spaced, USER_HOME_PATHS;
|