@staff0rd/assist 0.1140.0 → 0.1140.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/built-version +1 -1
- package/dist/commands/sessions/web/bundle.js +440 -440
- package/dist/index.js +878 -805
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.1140.
|
|
9
|
+
version: "0.1140.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -393,11 +393,11 @@ async function isDaemonRunning() {
|
|
|
393
393
|
var SPAWN_TIMEOUT_MS = 1e4;
|
|
394
394
|
var RETRY_DELAY_MS = 200;
|
|
395
395
|
var STALE_LOCK_MS = SPAWN_TIMEOUT_MS + 5e3;
|
|
396
|
-
async function ensureDaemonRunning(
|
|
396
|
+
async function ensureDaemonRunning(reason6 = "unspecified") {
|
|
397
397
|
if (await isDaemonRunning()) return;
|
|
398
398
|
mkdirSync(daemonPaths.dir, { recursive: true });
|
|
399
399
|
const holdsLock = acquireSpawnLock();
|
|
400
|
-
if (holdsLock) spawnDaemon(
|
|
400
|
+
if (holdsLock) spawnDaemon(reason6);
|
|
401
401
|
try {
|
|
402
402
|
await waitForDaemon();
|
|
403
403
|
} finally {
|
|
@@ -446,13 +446,13 @@ function releaseSpawnLock() {
|
|
|
446
446
|
} catch {
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
|
-
function spawnDaemon(
|
|
449
|
+
function spawnDaemon(reason6) {
|
|
450
450
|
const log2 = openSync(daemonPaths.log, "a");
|
|
451
451
|
const child2 = spawn(process.execPath, [process.argv[1], "daemon", "run"], {
|
|
452
452
|
detached: true,
|
|
453
453
|
windowsHide: true,
|
|
454
454
|
stdio: ["ignore", log2, log2],
|
|
455
|
-
env: { ...process.env, ASSIST_DAEMON_SPAWN_REASON:
|
|
455
|
+
env: { ...process.env, ASSIST_DAEMON_SPAWN_REASON: reason6 }
|
|
456
456
|
});
|
|
457
457
|
child2.unref();
|
|
458
458
|
}
|
|
@@ -979,7 +979,7 @@ var assistConfigShape = {
|
|
|
979
979
|
hotkeys: hotkeysSchema.optional(),
|
|
980
980
|
askQuestion: z6.boolean().default(true),
|
|
981
981
|
askQuestionAutoSubmit: z6.boolean().default(false),
|
|
982
|
-
|
|
982
|
+
cleanLeftovers: z6.boolean().default(true)
|
|
983
983
|
}).optional(),
|
|
984
984
|
database: z6.strictObject({
|
|
985
985
|
url: secretConfigValue(z6.string()).optional()
|
|
@@ -1495,7 +1495,8 @@ var LEGACY_SECTION_KEYS = {
|
|
|
1495
1495
|
"floatWaiting",
|
|
1496
1496
|
"floatWaitingAfterMs",
|
|
1497
1497
|
"parkWaitingAfterMs",
|
|
1498
|
-
"askQuestionAutoApprove"
|
|
1498
|
+
"askQuestionAutoApprove",
|
|
1499
|
+
"reportLeftovers"
|
|
1499
1500
|
],
|
|
1500
1501
|
worktree: ["watcher", "includeDrafts"],
|
|
1501
1502
|
devlog: ["skip"],
|
|
@@ -4860,8 +4861,8 @@ async function resolveTarget(port, deps2) {
|
|
|
4860
4861
|
);
|
|
4861
4862
|
return { ok: true, url: plan2.url, name: deps2.nodeName() };
|
|
4862
4863
|
}
|
|
4863
|
-
function notServing(
|
|
4864
|
-
return { ok: false, reason:
|
|
4864
|
+
function notServing(reason6, remediation) {
|
|
4865
|
+
return { ok: false, reason: reason6, remediation };
|
|
4865
4866
|
}
|
|
4866
4867
|
|
|
4867
4868
|
// src/commands/sessions/web/connectMobileTarget.ts
|
|
@@ -5725,8 +5726,8 @@ import { join as join17 } from "path";
|
|
|
5725
5726
|
|
|
5726
5727
|
// src/shared/harnessAdapters/unsupported.ts
|
|
5727
5728
|
var supported = { supported: true };
|
|
5728
|
-
function unsupported(
|
|
5729
|
-
return followUp ? { supported: false, reason:
|
|
5729
|
+
function unsupported(reason6, remediation, followUp) {
|
|
5730
|
+
return followUp ? { supported: false, reason: reason6, remediation, followUp } : { supported: false, reason: reason6, remediation };
|
|
5730
5731
|
}
|
|
5731
5732
|
|
|
5732
5733
|
// src/shared/harnessAdapters/claudeConnectorProbe.ts
|
|
@@ -11625,9 +11626,9 @@ var sessionsConfigHelp = [
|
|
|
11625
11626
|
note: "ceiling on concurrent live sessions one daemon holds; spawning past it is refused, and restore respawns at most this many persisted sessions (default: 24)"
|
|
11626
11627
|
},
|
|
11627
11628
|
{
|
|
11628
|
-
key: "sessions.
|
|
11629
|
-
setter: "assist config set sessions.
|
|
11630
|
-
note: "default on:
|
|
11629
|
+
key: "sessions.cleanLeftovers",
|
|
11630
|
+
setter: "assist config set sessions.cleanLeftovers false --node",
|
|
11631
|
+
note: "default on: reaping a worktree removes Docker containers bind-mounting inside it, and each daemon restart deletes reaped worktree paths that reappeared with no .git (through Docker when root-owned; deferred to the next restart and listed in `assist sessions nodes doctor` while Docker is unreachable). Set false to skip both"
|
|
11631
11632
|
},
|
|
11632
11633
|
{
|
|
11633
11634
|
key: "sessions.newSessionMode",
|
|
@@ -11859,19 +11860,19 @@ function configWritableScopes(key) {
|
|
|
11859
11860
|
|
|
11860
11861
|
// src/commands/config/resolveConfigSources.ts
|
|
11861
11862
|
function resolveConfigSources(key, layers) {
|
|
11862
|
-
const
|
|
11863
|
+
const sources2 = [];
|
|
11863
11864
|
if (getNestedValue(layers.project, key) !== void 0)
|
|
11864
|
-
|
|
11865
|
+
sources2.push("project");
|
|
11865
11866
|
if (getNestedValue(layers.repoOverride, key) !== void 0)
|
|
11866
|
-
|
|
11867
|
-
if (getNestedValue(layers.global, key) !== void 0)
|
|
11868
|
-
if (getNestedValue(layers.user, key) !== void 0)
|
|
11869
|
-
return
|
|
11867
|
+
sources2.push("repo");
|
|
11868
|
+
if (getNestedValue(layers.global, key) !== void 0) sources2.push("global");
|
|
11869
|
+
if (getNestedValue(layers.user, key) !== void 0) sources2.push("user");
|
|
11870
|
+
return sources2;
|
|
11870
11871
|
}
|
|
11871
11872
|
|
|
11872
11873
|
// src/commands/config/configEntryFor.ts
|
|
11873
11874
|
function configEntryFor(leaf, { config, layers, globalConfigFile, schema: schema2 }) {
|
|
11874
|
-
const
|
|
11875
|
+
const sources2 = resolveConfigSources(leaf.key, layers);
|
|
11875
11876
|
const node = configEntryNode(schema2, leaf.key);
|
|
11876
11877
|
const help = configHelpForKey(leaf.key);
|
|
11877
11878
|
const writableScopes = configWritableScopes(leaf.key);
|
|
@@ -11880,8 +11881,8 @@ function configEntryFor(leaf, { config, layers, globalConfigFile, schema: schema
|
|
|
11880
11881
|
...help ? { note: help.note, setter: help.setter } : {},
|
|
11881
11882
|
...leaf.defaultValue === void 0 ? {} : { defaultValue: redactConfigSecrets(leaf.defaultValue, node) },
|
|
11882
11883
|
value: redactConfigSecrets(getNestedValue(config, leaf.key), node),
|
|
11883
|
-
source:
|
|
11884
|
-
sources,
|
|
11884
|
+
source: sources2[0] ?? "default",
|
|
11885
|
+
sources: sources2,
|
|
11885
11886
|
layers: configEntryLayers(leaf.key, layers, node),
|
|
11886
11887
|
...layers.repoKey ? { repoKey: layers.repoKey } : {},
|
|
11887
11888
|
...layers.repoSource ? { repoSource: layers.repoSource } : {},
|
|
@@ -13174,7 +13175,7 @@ function writeSignal(event, data) {
|
|
|
13174
13175
|
}
|
|
13175
13176
|
|
|
13176
13177
|
// src/commands/backlog/rewindItemToPhase.ts
|
|
13177
|
-
async function rewindItemToPhase(orm, item, phaseNumber,
|
|
13178
|
+
async function rewindItemToPhase(orm, item, phaseNumber, reason6) {
|
|
13178
13179
|
const plan2 = resolveRewindPlan(item);
|
|
13179
13180
|
if (phaseNumber < 1 || phaseNumber > plan2.length) {
|
|
13180
13181
|
return {
|
|
@@ -13193,7 +13194,7 @@ async function rewindItemToPhase(orm, item, phaseNumber, reason4) {
|
|
|
13193
13194
|
await appendComment(
|
|
13194
13195
|
orm,
|
|
13195
13196
|
item.id,
|
|
13196
|
-
`Rewound to phase ${phaseNumber} (${phaseName}): ${
|
|
13197
|
+
`Rewound to phase ${phaseNumber} (${phaseName}): ${reason6}`,
|
|
13197
13198
|
{ phase: phaseNumber }
|
|
13198
13199
|
);
|
|
13199
13200
|
await updateCurrentPhase(orm, item.id, phaseNumber);
|
|
@@ -13204,11 +13205,11 @@ async function rewindItemToPhase(orm, item, phaseNumber, reason4) {
|
|
|
13204
13205
|
|
|
13205
13206
|
// src/commands/backlog/web/rewindItemPhase.ts
|
|
13206
13207
|
async function rewindItemPhase(req, res, id) {
|
|
13207
|
-
const { phase, reason:
|
|
13208
|
+
const { phase, reason: reason6 } = await parseRewindBody(req);
|
|
13208
13209
|
const result = await findItemOr404(res, id);
|
|
13209
13210
|
if (!result) return;
|
|
13210
13211
|
const { orm, item } = result;
|
|
13211
|
-
const outcome = await rewindItemToPhase(orm, item, phase,
|
|
13212
|
+
const outcome = await rewindItemToPhase(orm, item, phase, reason6);
|
|
13212
13213
|
if (!outcome.ok) {
|
|
13213
13214
|
respondJson(res, 400, { error: outcome.error });
|
|
13214
13215
|
return;
|
|
@@ -14149,8 +14150,8 @@ function subsequenceScore(text18, query2) {
|
|
|
14149
14150
|
function scoreFilePath(path128, query2) {
|
|
14150
14151
|
const needle = query2.trim().toLowerCase();
|
|
14151
14152
|
if (!needle) return 0;
|
|
14152
|
-
const
|
|
14153
|
-
const inBasename = subsequenceScore(
|
|
14153
|
+
const basename39 = path128.slice(path128.lastIndexOf("/") + 1);
|
|
14154
|
+
const inBasename = subsequenceScore(basename39, needle);
|
|
14154
14155
|
if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
|
|
14155
14156
|
return subsequenceScore(path128, needle);
|
|
14156
14157
|
}
|
|
@@ -14696,8 +14697,8 @@ async function readProjectItems(cwd, project) {
|
|
|
14696
14697
|
const response = await readProjectPage(cwd, owner, number, after);
|
|
14697
14698
|
const projectV2 = response.data?.repositoryOwner?.projectV2;
|
|
14698
14699
|
if (!projectV2?.items) {
|
|
14699
|
-
const
|
|
14700
|
-
throw new Error(
|
|
14700
|
+
const reason6 = response.errors?.[0]?.message;
|
|
14701
|
+
throw new Error(reason6 ?? `No project ${number} owned by ${owner}`);
|
|
14701
14702
|
}
|
|
14702
14703
|
board.title = projectV2.title ?? project;
|
|
14703
14704
|
board.url = projectV2.url ?? "";
|
|
@@ -16547,17 +16548,17 @@ async function hasChanges(cwd, path128) {
|
|
|
16547
16548
|
}
|
|
16548
16549
|
async function renameSources(cwd, path128) {
|
|
16549
16550
|
const fields = (await git(cwd, ["diff", "HEAD", "--name-status", "-z"])).split("\0");
|
|
16550
|
-
const
|
|
16551
|
+
const sources2 = [];
|
|
16551
16552
|
for (let i = 0; i < fields.length; ) {
|
|
16552
16553
|
const status2 = fields[i];
|
|
16553
16554
|
if (status2.startsWith("R")) {
|
|
16554
|
-
if (fields[i + 2] === path128)
|
|
16555
|
+
if (fields[i + 2] === path128) sources2.push(fields[i + 1]);
|
|
16555
16556
|
i += 3;
|
|
16556
16557
|
} else {
|
|
16557
16558
|
i += status2.startsWith("C") ? 3 : 2;
|
|
16558
16559
|
}
|
|
16559
16560
|
}
|
|
16560
|
-
return
|
|
16561
|
+
return sources2;
|
|
16561
16562
|
}
|
|
16562
16563
|
async function restorePath(cwd, path128) {
|
|
16563
16564
|
if (await isInHead(cwd, path128)) {
|
|
@@ -16800,126 +16801,6 @@ function newSessionDefaults(req, res) {
|
|
|
16800
16801
|
respondJson(res, 200, { mode: parsed.data, ...resolved2 });
|
|
16801
16802
|
}
|
|
16802
16803
|
|
|
16803
|
-
// src/commands/sessions/daemon/worktree/leftoverContents.ts
|
|
16804
|
-
import { lstatSync, readdirSync as readdirSync10 } from "fs";
|
|
16805
|
-
import { join as join37 } from "path";
|
|
16806
|
-
function leftoverContents(path128) {
|
|
16807
|
-
const contents = { holdsFiles: false, foreignOwned: false };
|
|
16808
|
-
walk2(path128, contents, process.getuid?.());
|
|
16809
|
-
return contents;
|
|
16810
|
-
}
|
|
16811
|
-
function walk2(path128, contents, uid) {
|
|
16812
|
-
const stat5 = lstatSync(path128, { throwIfNoEntry: false });
|
|
16813
|
-
if (!stat5) return;
|
|
16814
|
-
if (uid !== void 0 && stat5.uid !== uid) contents.foreignOwned = true;
|
|
16815
|
-
if (!stat5.isDirectory()) {
|
|
16816
|
-
contents.holdsFiles = true;
|
|
16817
|
-
return;
|
|
16818
|
-
}
|
|
16819
|
-
let entries2;
|
|
16820
|
-
try {
|
|
16821
|
-
entries2 = readdirSync10(path128);
|
|
16822
|
-
} catch {
|
|
16823
|
-
contents.foreignOwned = true;
|
|
16824
|
-
contents.holdsFiles = true;
|
|
16825
|
-
return;
|
|
16826
|
-
}
|
|
16827
|
-
for (const entry of entries2) walk2(join37(path128, entry), contents, uid);
|
|
16828
|
-
}
|
|
16829
|
-
|
|
16830
|
-
// src/commands/sessions/daemon/worktree/leftoverRemovalCommand.ts
|
|
16831
|
-
function leftoverRemovalCommand(leftovers2) {
|
|
16832
|
-
if (leftovers2.length === 0) return null;
|
|
16833
|
-
const sudo = leftovers2.some((l) => leftoverContents(l.path).foreignOwned);
|
|
16834
|
-
return `${sudo ? "sudo " : ""}rm -rf ${leftovers2.map((l) => shellQuote(l.path)).join(" ")}`;
|
|
16835
|
-
}
|
|
16836
|
-
function shellQuote(path128) {
|
|
16837
|
-
return /^[\w@%+=:,./-]+$/.test(path128) ? path128 : `'${path128.replaceAll("'", `'\\''`)}'`;
|
|
16838
|
-
}
|
|
16839
|
-
|
|
16840
|
-
// src/commands/sessions/daemon/worktree/listLeftovers.ts
|
|
16841
|
-
import { existsSync as existsSync31 } from "fs";
|
|
16842
|
-
|
|
16843
|
-
// src/commands/sessions/daemon/worktree/readWorktreeRegistry.ts
|
|
16844
|
-
var REGISTRY_FILE = "worktrees.json";
|
|
16845
|
-
function readWorktreeRegistry() {
|
|
16846
|
-
const data = loadJson(REGISTRY_FILE);
|
|
16847
|
-
return Object.entries(data).filter(([, record3]) => !record3.reaped).map(([path128, { reaped: _reaped, ...record3 }]) => ({ path: path128, ...record3 }));
|
|
16848
|
-
}
|
|
16849
|
-
function readReapedWorktreeRegistry() {
|
|
16850
|
-
const data = loadJson(REGISTRY_FILE);
|
|
16851
|
-
return Object.entries(data).filter(([, record3]) => record3.reaped).map(([path128, { reaped: _reaped, ...record3 }]) => ({ path: path128, ...record3 }));
|
|
16852
|
-
}
|
|
16853
|
-
function worktreeAttributionIncludingReaped(path128) {
|
|
16854
|
-
const record3 = loadJson(REGISTRY_FILE)[path128];
|
|
16855
|
-
return record3 ? { clone: record3.clone, origin: record3.origin } : void 0;
|
|
16856
|
-
}
|
|
16857
|
-
function recordWorktree(path128, clone, origin) {
|
|
16858
|
-
const data = loadJson(REGISTRY_FILE);
|
|
16859
|
-
data[path128] = { clone, origin };
|
|
16860
|
-
saveJson(REGISTRY_FILE, data);
|
|
16861
|
-
}
|
|
16862
|
-
function recordWorktreeHarness(path128, harness) {
|
|
16863
|
-
const data = loadJson(REGISTRY_FILE);
|
|
16864
|
-
const record3 = data[path128];
|
|
16865
|
-
if (!record3 || record3.reaped || record3.harness === harness) return;
|
|
16866
|
-
data[path128] = { ...record3, harness };
|
|
16867
|
-
saveJson(REGISTRY_FILE, data);
|
|
16868
|
-
}
|
|
16869
|
-
function forgetWorktree(path128) {
|
|
16870
|
-
const data = loadJson(REGISTRY_FILE);
|
|
16871
|
-
const record3 = data[path128];
|
|
16872
|
-
if (!record3 || record3.reaped) return;
|
|
16873
|
-
data[path128] = { ...record3, reaped: true };
|
|
16874
|
-
saveJson(REGISTRY_FILE, data);
|
|
16875
|
-
}
|
|
16876
|
-
function markLeftover(path128, reason4) {
|
|
16877
|
-
const data = loadJson(REGISTRY_FILE);
|
|
16878
|
-
const record3 = data[path128];
|
|
16879
|
-
if (!record3) return;
|
|
16880
|
-
data[path128] = { ...record3, reaped: true, leftover: reason4 };
|
|
16881
|
-
saveJson(REGISTRY_FILE, data);
|
|
16882
|
-
}
|
|
16883
|
-
function clearLeftover(path128) {
|
|
16884
|
-
const data = loadJson(REGISTRY_FILE);
|
|
16885
|
-
const record3 = data[path128];
|
|
16886
|
-
if (!record3?.leftover) return;
|
|
16887
|
-
const { leftover: _leftover, ...rest } = record3;
|
|
16888
|
-
data[path128] = rest;
|
|
16889
|
-
saveJson(REGISTRY_FILE, data);
|
|
16890
|
-
}
|
|
16891
|
-
|
|
16892
|
-
// src/commands/sessions/daemon/worktree/listLeftovers.ts
|
|
16893
|
-
function listLeftovers() {
|
|
16894
|
-
const leftovers2 = [];
|
|
16895
|
-
for (const { path: path128, leftover } of readReapedWorktreeRegistry()) {
|
|
16896
|
-
if (!leftover) continue;
|
|
16897
|
-
if (existsSync31(path128)) leftovers2.push({ path: path128, reason: leftover });
|
|
16898
|
-
else clearLeftover(path128);
|
|
16899
|
-
}
|
|
16900
|
-
return leftovers2;
|
|
16901
|
-
}
|
|
16902
|
-
|
|
16903
|
-
// src/commands/sessions/daemon/worktree/reportLeftoversEnabled.ts
|
|
16904
|
-
function reportLeftoversEnabled() {
|
|
16905
|
-
return loadConfig().sessions?.reportLeftovers ?? true;
|
|
16906
|
-
}
|
|
16907
|
-
|
|
16908
|
-
// src/commands/sessions/daemon/worktree/leftoverReport.ts
|
|
16909
|
-
function leftoverReport() {
|
|
16910
|
-
const leftovers2 = reportLeftoversEnabled() ? listLeftovers() : [];
|
|
16911
|
-
return {
|
|
16912
|
-
nodeName: resolveNodeName(),
|
|
16913
|
-
leftovers: leftovers2,
|
|
16914
|
-
command: leftoverRemovalCommand(leftovers2)
|
|
16915
|
-
};
|
|
16916
|
-
}
|
|
16917
|
-
|
|
16918
|
-
// src/commands/sessions/web/leftovers.ts
|
|
16919
|
-
async function leftovers(_req, res) {
|
|
16920
|
-
respondJson(res, 200, leftoverReport());
|
|
16921
|
-
}
|
|
16922
|
-
|
|
16923
16804
|
// src/commands/sessions/nodes/fetchPeerJson.ts
|
|
16924
16805
|
var PEER_TIMEOUT_MS = 3e3;
|
|
16925
16806
|
function peerErrorCode(error) {
|
|
@@ -16975,8 +16856,8 @@ function connectLinkWebSocket(url, handlers) {
|
|
|
16975
16856
|
ws.on("error", (error) => {
|
|
16976
16857
|
if (!open) reject(error);
|
|
16977
16858
|
});
|
|
16978
|
-
ws.on("close", (code,
|
|
16979
|
-
const detail = `code ${code}${
|
|
16859
|
+
ws.on("close", (code, reason6) => {
|
|
16860
|
+
const detail = `code ${code}${reason6.length ? ` ${reason6.toString()}` : ""}`;
|
|
16980
16861
|
if (open) handlers.onClose(detail);
|
|
16981
16862
|
else reject(new Error(`closed before open (${detail})`));
|
|
16982
16863
|
});
|
|
@@ -16999,7 +16880,7 @@ async function probePeerHello(url) {
|
|
|
16999
16880
|
} catch {
|
|
17000
16881
|
}
|
|
17001
16882
|
},
|
|
17002
|
-
onClose: (
|
|
16883
|
+
onClose: (reason6) => settle(new Error(`closed before hello reply (${reason6})`))
|
|
17003
16884
|
});
|
|
17004
16885
|
const timer = setTimeout(
|
|
17005
16886
|
() => settle(new Error(`no hello reply within ${HELLO_TIMEOUT_MS / 1e3}s`)),
|
|
@@ -17673,8 +17554,8 @@ async function send(fetchFn, token, method, path128, body) {
|
|
|
17673
17554
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
17674
17555
|
});
|
|
17675
17556
|
} catch (error) {
|
|
17676
|
-
const
|
|
17677
|
-
throw new TestflightError(`Failed to reach App Store Connect: ${
|
|
17557
|
+
const reason6 = error instanceof Error ? error.message : String(error);
|
|
17558
|
+
throw new TestflightError(`Failed to reach App Store Connect: ${reason6}`);
|
|
17678
17559
|
}
|
|
17679
17560
|
}
|
|
17680
17561
|
async function ascRequest(fetchFn, token, method, path128, body) {
|
|
@@ -17765,11 +17646,11 @@ var runOp = async (args) => {
|
|
|
17765
17646
|
error: "the 1Password CLI (op) is not installed or not on PATH",
|
|
17766
17647
|
missing: false
|
|
17767
17648
|
};
|
|
17768
|
-
const
|
|
17649
|
+
const reason6 = cleanOpStderr(stderr ?? "") || (error instanceof Error ? error.message : String(error));
|
|
17769
17650
|
return {
|
|
17770
17651
|
ok: false,
|
|
17771
|
-
error:
|
|
17772
|
-
missing: /isn't an item|isn't a vault/i.test(
|
|
17652
|
+
error: reason6,
|
|
17653
|
+
missing: /isn't an item|isn't a vault/i.test(reason6)
|
|
17773
17654
|
};
|
|
17774
17655
|
}
|
|
17775
17656
|
};
|
|
@@ -17781,9 +17662,9 @@ async function listAccounts(op) {
|
|
|
17781
17662
|
const accounts2 = JSON.parse(result.stdout);
|
|
17782
17663
|
return accounts2.map((account) => account.url);
|
|
17783
17664
|
}
|
|
17784
|
-
function failure(
|
|
17665
|
+
function failure(reason6) {
|
|
17785
17666
|
return new TestflightError(
|
|
17786
|
-
`Failed to read testflight.keyRef from 1Password: ${
|
|
17667
|
+
`Failed to read testflight.keyRef from 1Password: ${reason6}`
|
|
17787
17668
|
);
|
|
17788
17669
|
}
|
|
17789
17670
|
async function readAscKey(reference, op = runOp) {
|
|
@@ -18742,17 +18623,17 @@ var autoRestartWait = {
|
|
|
18742
18623
|
|
|
18743
18624
|
// src/commands/extension/fetchLatestSignedExtension.ts
|
|
18744
18625
|
import { readFile as readFile2 } from "fs/promises";
|
|
18745
|
-
import { join as
|
|
18626
|
+
import { join as join38 } from "path";
|
|
18746
18627
|
|
|
18747
18628
|
// src/commands/extension/extensionDir.ts
|
|
18748
|
-
import { existsSync as
|
|
18749
|
-
import { dirname as dirname16, join as
|
|
18629
|
+
import { existsSync as existsSync31 } from "fs";
|
|
18630
|
+
import { dirname as dirname16, join as join37 } from "path";
|
|
18750
18631
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
18751
18632
|
var moduleDir = dirname16(fileURLToPath2(import.meta.url));
|
|
18752
18633
|
function extensionDir() {
|
|
18753
|
-
const bundled =
|
|
18754
|
-
if (
|
|
18755
|
-
return
|
|
18634
|
+
const bundled = join37(moduleDir, "commands", "extension", "extension");
|
|
18635
|
+
if (existsSync31(bundled)) return bundled;
|
|
18636
|
+
return join37(moduleDir, "..", "..", "..", "extension");
|
|
18756
18637
|
}
|
|
18757
18638
|
|
|
18758
18639
|
// src/commands/extension/latestUpdate.ts
|
|
@@ -18764,7 +18645,7 @@ function latestUpdate(manifest, updates2) {
|
|
|
18764
18645
|
// src/commands/extension/fetchLatestSignedExtension.ts
|
|
18765
18646
|
async function fetchLatestSignedExtension() {
|
|
18766
18647
|
const manifest = await readFile2(
|
|
18767
|
-
|
|
18648
|
+
join38(extensionDir(), "manifest.json"),
|
|
18768
18649
|
"utf8"
|
|
18769
18650
|
);
|
|
18770
18651
|
const updateUrl = JSON.parse(manifest).browser_specific_settings.gecko.update_url;
|
|
@@ -18791,7 +18672,7 @@ function latestSignedExtension(now = Date.now()) {
|
|
|
18791
18672
|
}
|
|
18792
18673
|
|
|
18793
18674
|
// src/commands/watch/isBuildPending.ts
|
|
18794
|
-
import { existsSync as
|
|
18675
|
+
import { existsSync as existsSync33 } from "fs";
|
|
18795
18676
|
|
|
18796
18677
|
// src/commands/watch/gitMarkerPath.ts
|
|
18797
18678
|
import { resolve as resolve11 } from "path";
|
|
@@ -18808,7 +18689,7 @@ function buildPendingPath(cwd) {
|
|
|
18808
18689
|
}
|
|
18809
18690
|
|
|
18810
18691
|
// src/commands/watch/readBuiltVersion.ts
|
|
18811
|
-
import { join as
|
|
18692
|
+
import { join as join40 } from "path";
|
|
18812
18693
|
|
|
18813
18694
|
// src/shared/readPackageJson.ts
|
|
18814
18695
|
import * as fs18 from "fs";
|
|
@@ -18858,7 +18739,7 @@ function findPackageJsonWithVerifyScripts(startDir) {
|
|
|
18858
18739
|
function readBuiltVersion(cwd) {
|
|
18859
18740
|
try {
|
|
18860
18741
|
const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
18861
|
-
return readPackageJson(
|
|
18742
|
+
return readPackageJson(join40(root2, "package.json")).version ?? "unknown";
|
|
18862
18743
|
} catch {
|
|
18863
18744
|
return "unknown";
|
|
18864
18745
|
}
|
|
@@ -18866,11 +18747,11 @@ function readBuiltVersion(cwd) {
|
|
|
18866
18747
|
|
|
18867
18748
|
// src/commands/watch/readDistVersion.ts
|
|
18868
18749
|
import { readFileSync as readFileSync18 } from "fs";
|
|
18869
|
-
import { join as
|
|
18750
|
+
import { join as join41 } from "path";
|
|
18870
18751
|
function readDistVersion(cwd) {
|
|
18871
18752
|
try {
|
|
18872
18753
|
const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
18873
|
-
return readFileSync18(
|
|
18754
|
+
return readFileSync18(join41(root2, "dist", "built-version"), "utf8").trim();
|
|
18874
18755
|
} catch {
|
|
18875
18756
|
return void 0;
|
|
18876
18757
|
}
|
|
@@ -18885,7 +18766,7 @@ function isDistBehind(cwd) {
|
|
|
18885
18766
|
// src/commands/watch/isBuildPending.ts
|
|
18886
18767
|
function markedPending(cwd) {
|
|
18887
18768
|
try {
|
|
18888
|
-
return
|
|
18769
|
+
return existsSync33(buildPendingPath(cwd));
|
|
18889
18770
|
} catch {
|
|
18890
18771
|
return false;
|
|
18891
18772
|
}
|
|
@@ -18981,7 +18862,7 @@ function stripAnsi(text18) {
|
|
|
18981
18862
|
// src/commands/sessions/daemon/worktree/watcherLogPath.ts
|
|
18982
18863
|
import { createHash } from "crypto";
|
|
18983
18864
|
import { homedir as homedir15 } from "os";
|
|
18984
|
-
import { basename as basename13, join as
|
|
18865
|
+
import { basename as basename13, join as join42 } from "path";
|
|
18985
18866
|
|
|
18986
18867
|
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
18987
18868
|
import { realpathSync as realpathSync2 } from "fs";
|
|
@@ -18998,8 +18879,8 @@ function canonicalTreePath(path128) {
|
|
|
18998
18879
|
function watcherLogPath(cwd) {
|
|
18999
18880
|
const clone = canonicalTreePath(cwd);
|
|
19000
18881
|
const key = createHash("sha1").update(clone).digest("hex").slice(0, 8);
|
|
19001
|
-
const dir = process.env.ASSIST_WATCHER_LOG_DIR ??
|
|
19002
|
-
return
|
|
18882
|
+
const dir = process.env.ASSIST_WATCHER_LOG_DIR ?? join42(homedir15(), ".assist", "watchers");
|
|
18883
|
+
return join42(dir, `${basename13(clone) || "root"}-${key}.log`);
|
|
19003
18884
|
}
|
|
19004
18885
|
|
|
19005
18886
|
// src/commands/sessions/web/updates/readUpdateHistory.ts
|
|
@@ -19132,7 +19013,7 @@ async function readRequestBuffer(req, limit) {
|
|
|
19132
19013
|
|
|
19133
19014
|
// src/commands/sessions/web/stageAttachment.ts
|
|
19134
19015
|
import { mkdir, mkdtemp, writeFile } from "fs/promises";
|
|
19135
|
-
import { extname as extname2, join as
|
|
19016
|
+
import { extname as extname2, join as join43 } from "path";
|
|
19136
19017
|
|
|
19137
19018
|
// src/commands/sessions/web/ghAttachableExtensions.ts
|
|
19138
19019
|
var ghAttachableExtensions = /* @__PURE__ */ new Set([
|
|
@@ -19164,9 +19045,9 @@ function safeBaseName(name2) {
|
|
|
19164
19045
|
async function stageAttachment(name2, contentType, body) {
|
|
19165
19046
|
const ext = pickExtension(name2, contentType);
|
|
19166
19047
|
await mkdir(stagedAttachmentsDir, { recursive: true });
|
|
19167
|
-
const dir = await mkdtemp(
|
|
19048
|
+
const dir = await mkdtemp(join43(stagedAttachmentsDir, "upload-"));
|
|
19168
19049
|
const alt = safeBaseName(name2);
|
|
19169
|
-
const filePath =
|
|
19050
|
+
const filePath = join43(dir, `${alt}.${ext}`);
|
|
19170
19051
|
await writeFile(filePath, body);
|
|
19171
19052
|
return { dir, filePath, alt };
|
|
19172
19053
|
}
|
|
@@ -19215,16 +19096,16 @@ import { readFile as readFile3, stat as stat3, writeFile as writeFile2 } from "f
|
|
|
19215
19096
|
|
|
19216
19097
|
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
19217
19098
|
import { execFile as execFile13 } from "child_process";
|
|
19218
|
-
import { existsSync as
|
|
19219
|
-
import { dirname as dirname18, join as
|
|
19099
|
+
import { existsSync as existsSync34 } from "fs";
|
|
19100
|
+
import { dirname as dirname18, join as join44 } from "path";
|
|
19220
19101
|
import { promisify as promisify13 } from "util";
|
|
19221
19102
|
var execFileAsync11 = promisify13(execFile13);
|
|
19222
19103
|
var TIMEOUT_MS2 = 15e3;
|
|
19223
19104
|
function findOxfmtScript(root2) {
|
|
19224
19105
|
let dir = root2;
|
|
19225
19106
|
for (; ; ) {
|
|
19226
|
-
const candidate =
|
|
19227
|
-
if (
|
|
19107
|
+
const candidate = join44(dir, "node_modules", "oxfmt", "bin", "oxfmt");
|
|
19108
|
+
if (existsSync34(candidate)) return candidate;
|
|
19228
19109
|
const parent = dirname18(dir);
|
|
19229
19110
|
if (parent === dir) return void 0;
|
|
19230
19111
|
dir = parent;
|
|
@@ -19296,10 +19177,10 @@ async function writeFileContent(req, res) {
|
|
|
19296
19177
|
// src/shared/createBundleHandler.ts
|
|
19297
19178
|
import { createHash as createHash2 } from "crypto";
|
|
19298
19179
|
import { readFileSync as readFileSync19, statSync as statSync10 } from "fs";
|
|
19299
|
-
import { dirname as dirname19, join as
|
|
19180
|
+
import { dirname as dirname19, join as join45 } from "path";
|
|
19300
19181
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
19301
19182
|
function createBundleHandler(importMetaUrl, bundlePath, contentType = "application/javascript") {
|
|
19302
|
-
const file =
|
|
19183
|
+
const file = join45(dirname19(fileURLToPath3(importMetaUrl)), bundlePath);
|
|
19303
19184
|
let cache7;
|
|
19304
19185
|
return (req, res) => {
|
|
19305
19186
|
const mtimeMs = statSync10(file).mtimeMs;
|
|
@@ -19418,7 +19299,6 @@ var routes2 = {
|
|
|
19418
19299
|
"POST /api/pr-preview/upload-image": uploadPrImage,
|
|
19419
19300
|
"GET /api/pr-preview/image": previewImage,
|
|
19420
19301
|
"POST /api/restart": restartWeb,
|
|
19421
|
-
"GET /api/leftovers": leftovers,
|
|
19422
19302
|
"GET /api/node-doctor": nodeDoctor,
|
|
19423
19303
|
"POST /api/nodes/probe": postNodeProbe,
|
|
19424
19304
|
"POST /api/nodes/link": postNodeLink,
|
|
@@ -19744,8 +19624,8 @@ function scheduleReconnect() {
|
|
|
19744
19624
|
|
|
19745
19625
|
// src/commands/sessions/web/updates/autoRestart/autoRestartAttempts.ts
|
|
19746
19626
|
import { mkdirSync as mkdirSync12, readFileSync as readFileSync21, writeFileSync as writeFileSync10 } from "fs";
|
|
19747
|
-
import { dirname as dirname20, join as
|
|
19748
|
-
var defaultPath =
|
|
19627
|
+
import { dirname as dirname20, join as join46 } from "path";
|
|
19628
|
+
var defaultPath = join46(daemonPaths.dir, "auto-restart-attempts.json");
|
|
19749
19629
|
function read(path128) {
|
|
19750
19630
|
try {
|
|
19751
19631
|
return JSON.parse(readFileSync21(path128, "utf8"));
|
|
@@ -19968,9 +19848,9 @@ function originForCwd(cwd) {
|
|
|
19968
19848
|
}
|
|
19969
19849
|
|
|
19970
19850
|
// src/commands/sessions/daemon/repoDirExists.ts
|
|
19971
|
-
import { existsSync as
|
|
19851
|
+
import { existsSync as existsSync35 } from "fs";
|
|
19972
19852
|
function repoDirExists(cwd) {
|
|
19973
|
-
return
|
|
19853
|
+
return existsSync35(cwd);
|
|
19974
19854
|
}
|
|
19975
19855
|
|
|
19976
19856
|
// src/commands/sessions/daemon/worktree/git.ts
|
|
@@ -20067,6 +19947,60 @@ function gitCommonDir(cwd) {
|
|
|
20067
19947
|
]);
|
|
20068
19948
|
}
|
|
20069
19949
|
|
|
19950
|
+
// src/commands/sessions/daemon/worktree/readWorktreeRegistry.ts
|
|
19951
|
+
var REGISTRY_FILE = "worktrees.json";
|
|
19952
|
+
function readWorktreeRegistry() {
|
|
19953
|
+
const data = loadJson(REGISTRY_FILE);
|
|
19954
|
+
return Object.entries(data).filter(([, record3]) => !record3.reaped).map(([path128, { reaped: _reaped, ...record3 }]) => ({ path: path128, ...record3 }));
|
|
19955
|
+
}
|
|
19956
|
+
function readReapedWorktreeRegistry() {
|
|
19957
|
+
const data = loadJson(REGISTRY_FILE);
|
|
19958
|
+
return Object.entries(data).filter(([, record3]) => record3.reaped).map(([path128, { reaped: _reaped, ...record3 }]) => ({ path: path128, ...record3 }));
|
|
19959
|
+
}
|
|
19960
|
+
function worktreeAttributionIncludingReaped(path128) {
|
|
19961
|
+
const record3 = loadJson(REGISTRY_FILE)[path128];
|
|
19962
|
+
return record3 ? { clone: record3.clone, origin: record3.origin } : void 0;
|
|
19963
|
+
}
|
|
19964
|
+
function recordWorktree(path128, clone, origin) {
|
|
19965
|
+
const data = loadJson(REGISTRY_FILE);
|
|
19966
|
+
data[path128] = { clone, origin };
|
|
19967
|
+
saveJson(REGISTRY_FILE, data);
|
|
19968
|
+
}
|
|
19969
|
+
function recordWorktreeHarness(path128, harness) {
|
|
19970
|
+
const data = loadJson(REGISTRY_FILE);
|
|
19971
|
+
const record3 = data[path128];
|
|
19972
|
+
if (!record3 || record3.reaped || record3.harness === harness) return;
|
|
19973
|
+
data[path128] = { ...record3, harness };
|
|
19974
|
+
saveJson(REGISTRY_FILE, data);
|
|
19975
|
+
}
|
|
19976
|
+
function forgetWorktree(path128) {
|
|
19977
|
+
const data = loadJson(REGISTRY_FILE);
|
|
19978
|
+
const record3 = data[path128];
|
|
19979
|
+
if (!record3 || record3.reaped) return;
|
|
19980
|
+
data[path128] = { ...record3, reaped: true };
|
|
19981
|
+
saveJson(REGISTRY_FILE, data);
|
|
19982
|
+
}
|
|
19983
|
+
function markLeftover(path128, deferredReason) {
|
|
19984
|
+
const data = loadJson(REGISTRY_FILE);
|
|
19985
|
+
const record3 = data[path128];
|
|
19986
|
+
if (!record3) return;
|
|
19987
|
+
const { leftover: _leftover, ...rest } = record3;
|
|
19988
|
+
data[path128] = {
|
|
19989
|
+
...rest,
|
|
19990
|
+
reaped: true,
|
|
19991
|
+
...deferredReason ? { leftover: deferredReason } : {}
|
|
19992
|
+
};
|
|
19993
|
+
saveJson(REGISTRY_FILE, data);
|
|
19994
|
+
}
|
|
19995
|
+
function clearLeftover(path128) {
|
|
19996
|
+
const data = loadJson(REGISTRY_FILE);
|
|
19997
|
+
const record3 = data[path128];
|
|
19998
|
+
if (!record3?.leftover) return;
|
|
19999
|
+
const { leftover: _leftover, ...rest } = record3;
|
|
20000
|
+
data[path128] = rest;
|
|
20001
|
+
saveJson(REGISTRY_FILE, data);
|
|
20002
|
+
}
|
|
20003
|
+
|
|
20070
20004
|
// src/commands/sessions/daemon/repoGroupForCwd.ts
|
|
20071
20005
|
var cache6 = /* @__PURE__ */ new Map();
|
|
20072
20006
|
function repoGroupForCwd(cwd) {
|
|
@@ -20439,17 +20373,17 @@ import * as path27 from "path";
|
|
|
20439
20373
|
import chalk22 from "chalk";
|
|
20440
20374
|
|
|
20441
20375
|
// src/commands/verify/addToKnipIgnoreBinaries.ts
|
|
20442
|
-
import { existsSync as
|
|
20443
|
-
import { join as
|
|
20376
|
+
import { existsSync as existsSync36, readFileSync as readFileSync22, writeFileSync as writeFileSync12 } from "fs";
|
|
20377
|
+
import { join as join47 } from "path";
|
|
20444
20378
|
import chalk21 from "chalk";
|
|
20445
20379
|
function loadKnipConfig(knipJsonPath) {
|
|
20446
|
-
if (
|
|
20380
|
+
if (existsSync36(knipJsonPath)) {
|
|
20447
20381
|
return JSON.parse(readFileSync22(knipJsonPath, "utf8"));
|
|
20448
20382
|
}
|
|
20449
20383
|
return { $schema: "https://unpkg.com/knip@5/schema.json" };
|
|
20450
20384
|
}
|
|
20451
20385
|
function addToKnipIgnoreBinaries(cwd, binary) {
|
|
20452
|
-
const knipJsonPath =
|
|
20386
|
+
const knipJsonPath = join47(cwd, "knip.json");
|
|
20453
20387
|
try {
|
|
20454
20388
|
const knipConfig = loadKnipConfig(knipJsonPath);
|
|
20455
20389
|
const ignoreBinaries = knipConfig.ignoreBinaries ?? [];
|
|
@@ -20496,7 +20430,7 @@ import * as path29 from "path";
|
|
|
20496
20430
|
import chalk27 from "chalk";
|
|
20497
20431
|
|
|
20498
20432
|
// src/commands/format/init.ts
|
|
20499
|
-
import { existsSync as
|
|
20433
|
+
import { existsSync as existsSync37, readFileSync as readFileSync23, writeFileSync as writeFileSync13 } from "fs";
|
|
20500
20434
|
import chalk25 from "chalk";
|
|
20501
20435
|
|
|
20502
20436
|
// src/utils/printDiff.ts
|
|
@@ -20539,7 +20473,7 @@ async function init() {
|
|
|
20539
20473
|
const newContent = `${JSON.stringify(oxfmtrc_template_default, null, " ")}
|
|
20540
20474
|
`;
|
|
20541
20475
|
const configPath = ".oxfmtrc.json";
|
|
20542
|
-
const oldContent =
|
|
20476
|
+
const oldContent = existsSync37(configPath) ? readFileSync23(configPath, "utf8") : "";
|
|
20543
20477
|
if (oldContent === newContent) {
|
|
20544
20478
|
console.log(".oxfmtrc.json already has the baseline formatter config");
|
|
20545
20479
|
return;
|
|
@@ -20562,15 +20496,15 @@ async function init() {
|
|
|
20562
20496
|
}
|
|
20563
20497
|
|
|
20564
20498
|
// src/commands/lint/init.ts
|
|
20565
|
-
import { existsSync as
|
|
20499
|
+
import { existsSync as existsSync40, readFileSync as readFileSync25, writeFileSync as writeFileSync15 } from "fs";
|
|
20566
20500
|
import chalk26 from "chalk";
|
|
20567
20501
|
|
|
20568
20502
|
// src/shared/removeEslint.ts
|
|
20569
20503
|
import { execSync as execSync7 } from "child_process";
|
|
20570
|
-
import { existsSync as
|
|
20504
|
+
import { existsSync as existsSync39, readFileSync as readFileSync24, writeFileSync as writeFileSync14 } from "fs";
|
|
20571
20505
|
|
|
20572
20506
|
// src/shared/removeEslint/removeEslintConfigFiles.ts
|
|
20573
|
-
import { existsSync as
|
|
20507
|
+
import { existsSync as existsSync38, unlinkSync as unlinkSync3 } from "fs";
|
|
20574
20508
|
var ESLINT_CONFIG_FILES = [
|
|
20575
20509
|
"eslint.config.js",
|
|
20576
20510
|
"eslint.config.mjs",
|
|
@@ -20586,7 +20520,7 @@ var ESLINT_CONFIG_FILES = [
|
|
|
20586
20520
|
function removeEslintConfigFiles() {
|
|
20587
20521
|
let removed = false;
|
|
20588
20522
|
for (const configFile of ESLINT_CONFIG_FILES) {
|
|
20589
|
-
if (
|
|
20523
|
+
if (existsSync38(configFile)) {
|
|
20590
20524
|
unlinkSync3(configFile);
|
|
20591
20525
|
console.log(`Removed ${configFile}`);
|
|
20592
20526
|
removed = true;
|
|
@@ -20608,7 +20542,7 @@ function removeEslint(options2 = {}) {
|
|
|
20608
20542
|
}
|
|
20609
20543
|
function removeEslintFromPackageJson(options2) {
|
|
20610
20544
|
const packageJsonPath = "package.json";
|
|
20611
|
-
if (!
|
|
20545
|
+
if (!existsSync39(packageJsonPath)) {
|
|
20612
20546
|
return false;
|
|
20613
20547
|
}
|
|
20614
20548
|
const packageJson = JSON.parse(readFileSync24(packageJsonPath, "utf8"));
|
|
@@ -20675,7 +20609,7 @@ async function writeOxlintConfig() {
|
|
|
20675
20609
|
const newContent = `${JSON.stringify(oxlintrc_template_default, null, " ")}
|
|
20676
20610
|
`;
|
|
20677
20611
|
const configPath = ".oxlintrc.json";
|
|
20678
|
-
const oldContent =
|
|
20612
|
+
const oldContent = existsSync40(configPath) ? readFileSync25(configPath, "utf8") : "";
|
|
20679
20613
|
if (oldContent === newContent) {
|
|
20680
20614
|
console.log(".oxlintrc.json already has the baseline linter config");
|
|
20681
20615
|
return;
|
|
@@ -21152,7 +21086,7 @@ function printMeasureTable(records, totalMs) {
|
|
|
21152
21086
|
import * as path38 from "path";
|
|
21153
21087
|
|
|
21154
21088
|
// src/shared/shellQuote.ts
|
|
21155
|
-
function
|
|
21089
|
+
function shellQuote(arg) {
|
|
21156
21090
|
if (/[^a-zA-Z0-9_./:=@%^+,-]/.test(arg)) {
|
|
21157
21091
|
if (process.platform === "win32") {
|
|
21158
21092
|
return `"${arg.replace(/"/g, String.raw`\"`)}"`;
|
|
@@ -21209,7 +21143,7 @@ function selectEntriesForMode(entries2, mode) {
|
|
|
21209
21143
|
|
|
21210
21144
|
// src/commands/verify/run/resolveEntries.ts
|
|
21211
21145
|
function buildFullCommand(command, args) {
|
|
21212
|
-
return [
|
|
21146
|
+
return [shellQuote(command), ...(args ?? []).map(shellQuote)].join(" ");
|
|
21213
21147
|
}
|
|
21214
21148
|
function getRunEntries() {
|
|
21215
21149
|
const { run: run5 } = loadConfig();
|
|
@@ -21463,7 +21397,7 @@ async function newCli() {
|
|
|
21463
21397
|
|
|
21464
21398
|
// src/commands/new/registerNew/newProject.ts
|
|
21465
21399
|
import { execSync as execSync14 } from "child_process";
|
|
21466
|
-
import { existsSync as
|
|
21400
|
+
import { existsSync as existsSync45, readFileSync as readFileSync29, writeFileSync as writeFileSync22 } from "fs";
|
|
21467
21401
|
|
|
21468
21402
|
// src/commands/deploy/init.ts
|
|
21469
21403
|
import { execSync as execSync13 } from "child_process";
|
|
@@ -21471,14 +21405,14 @@ import chalk37 from "chalk";
|
|
|
21471
21405
|
import enquirer3 from "enquirer";
|
|
21472
21406
|
|
|
21473
21407
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
21474
|
-
import { existsSync as
|
|
21475
|
-
import { dirname as dirname28, join as
|
|
21408
|
+
import { existsSync as existsSync44, mkdirSync as mkdirSync15, readFileSync as readFileSync28, writeFileSync as writeFileSync21 } from "fs";
|
|
21409
|
+
import { dirname as dirname28, join as join54 } from "path";
|
|
21476
21410
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
21477
21411
|
import chalk36 from "chalk";
|
|
21478
21412
|
var WORKFLOW_PATH = ".github/workflows/build.yml";
|
|
21479
21413
|
var __dirname3 = dirname28(fileURLToPath4(import.meta.url));
|
|
21480
21414
|
function getExistingSiteId() {
|
|
21481
|
-
if (!
|
|
21415
|
+
if (!existsSync44(WORKFLOW_PATH)) {
|
|
21482
21416
|
return null;
|
|
21483
21417
|
}
|
|
21484
21418
|
const content = readFileSync28(WORKFLOW_PATH, "utf8");
|
|
@@ -21486,17 +21420,17 @@ function getExistingSiteId() {
|
|
|
21486
21420
|
return match ? match[1] : null;
|
|
21487
21421
|
}
|
|
21488
21422
|
function getTemplateContent(siteId) {
|
|
21489
|
-
const templatePath =
|
|
21423
|
+
const templatePath = join54(__dirname3, "commands/deploy/build.yml");
|
|
21490
21424
|
const template = readFileSync28(templatePath, "utf8");
|
|
21491
21425
|
return template.replace("{{NETLIFY_SITE_ID}}", siteId);
|
|
21492
21426
|
}
|
|
21493
21427
|
async function updateWorkflow(siteId) {
|
|
21494
21428
|
const newContent = getTemplateContent(siteId);
|
|
21495
21429
|
const workflowDir = ".github/workflows";
|
|
21496
|
-
if (!
|
|
21430
|
+
if (!existsSync44(workflowDir)) {
|
|
21497
21431
|
mkdirSync15(workflowDir, { recursive: true });
|
|
21498
21432
|
}
|
|
21499
|
-
if (
|
|
21433
|
+
if (existsSync44(WORKFLOW_PATH)) {
|
|
21500
21434
|
const oldContent = readFileSync28(WORKFLOW_PATH, "utf8");
|
|
21501
21435
|
if (oldContent === newContent) {
|
|
21502
21436
|
console.log(chalk36.green("build.yml is already up to date"));
|
|
@@ -21591,7 +21525,7 @@ async function newProject() {
|
|
|
21591
21525
|
}
|
|
21592
21526
|
function addViteBaseConfig() {
|
|
21593
21527
|
const viteConfigPath = "vite.config.ts";
|
|
21594
|
-
if (!
|
|
21528
|
+
if (!existsSync45(viteConfigPath)) {
|
|
21595
21529
|
console.log("No vite.config.ts found, skipping base config");
|
|
21596
21530
|
return;
|
|
21597
21531
|
}
|
|
@@ -21794,18 +21728,18 @@ function adviceContextFor(cwd, env = process.env) {
|
|
|
21794
21728
|
}
|
|
21795
21729
|
|
|
21796
21730
|
// src/commands/advise/loadAdviceFragments.ts
|
|
21797
|
-
import { readdirSync as
|
|
21798
|
-
import { basename as basename15, join as
|
|
21731
|
+
import { readdirSync as readdirSync10, readFileSync as readFileSync30 } from "fs";
|
|
21732
|
+
import { basename as basename15, join as join56 } from "path";
|
|
21799
21733
|
|
|
21800
21734
|
// src/commands/advise/adviceDir.ts
|
|
21801
|
-
import { existsSync as
|
|
21802
|
-
import { dirname as dirname29, join as
|
|
21735
|
+
import { existsSync as existsSync46 } from "fs";
|
|
21736
|
+
import { dirname as dirname29, join as join55 } from "path";
|
|
21803
21737
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
21804
21738
|
function adviceDir() {
|
|
21805
21739
|
let current2 = dirname29(fileURLToPath5(import.meta.url));
|
|
21806
21740
|
while (current2 !== dirname29(current2)) {
|
|
21807
|
-
const candidate =
|
|
21808
|
-
if (
|
|
21741
|
+
const candidate = join55(current2, "agent", "advice");
|
|
21742
|
+
if (existsSync46(candidate)) return candidate;
|
|
21809
21743
|
current2 = dirname29(current2);
|
|
21810
21744
|
}
|
|
21811
21745
|
throw new Error("Could not locate the shipped agent/advice directory");
|
|
@@ -21834,10 +21768,10 @@ function parseAdviceFragment(name2, content) {
|
|
|
21834
21768
|
|
|
21835
21769
|
// src/commands/advise/loadAdviceFragments.ts
|
|
21836
21770
|
function loadAdviceFragments(dir = adviceDir()) {
|
|
21837
|
-
return
|
|
21771
|
+
return readdirSync10(dir).filter((file) => file.endsWith(".md")).sort().map(
|
|
21838
21772
|
(file) => parseAdviceFragment(
|
|
21839
21773
|
basename15(file, ".md"),
|
|
21840
|
-
readFileSync30(
|
|
21774
|
+
readFileSync30(join56(dir, file), "utf8")
|
|
21841
21775
|
)
|
|
21842
21776
|
);
|
|
21843
21777
|
}
|
|
@@ -21871,13 +21805,13 @@ function renderAdviceBody(fragment, context) {
|
|
|
21871
21805
|
}
|
|
21872
21806
|
|
|
21873
21807
|
// src/commands/advise/adviceConditions.ts
|
|
21874
|
-
import { existsSync as
|
|
21875
|
-
import { join as
|
|
21808
|
+
import { existsSync as existsSync47 } from "fs";
|
|
21809
|
+
import { join as join57 } from "path";
|
|
21876
21810
|
function repoFile(file, label) {
|
|
21877
21811
|
return {
|
|
21878
21812
|
whenMet: `the repo has ${label}`,
|
|
21879
21813
|
whenUnmet: `the repo has no ${label}`,
|
|
21880
|
-
matches: ({ rootDir }) =>
|
|
21814
|
+
matches: ({ rootDir }) => existsSync47(join57(rootDir, file))
|
|
21881
21815
|
};
|
|
21882
21816
|
}
|
|
21883
21817
|
var adviceConditions = {
|
|
@@ -21903,11 +21837,11 @@ var adviceConditions = {
|
|
|
21903
21837
|
},
|
|
21904
21838
|
typescript: repoFile("tsconfig.json", "a tsconfig.json"),
|
|
21905
21839
|
filenameConvention: repoFile(
|
|
21906
|
-
|
|
21840
|
+
join57("oxlint-rules", "filenameConvention.ts"),
|
|
21907
21841
|
"oxlint-rules/filenameConvention.ts"
|
|
21908
21842
|
),
|
|
21909
21843
|
claudeSettings: repoFile(
|
|
21910
|
-
|
|
21844
|
+
join57("claude", "settings.json"),
|
|
21911
21845
|
"claude/settings.json"
|
|
21912
21846
|
),
|
|
21913
21847
|
verify: {
|
|
@@ -21991,7 +21925,7 @@ function explainAdvice(context, fragments = loadAdviceFragments()) {
|
|
|
21991
21925
|
...decisions.map((decision) => decision.fragment.title.length)
|
|
21992
21926
|
);
|
|
21993
21927
|
return decisions.map(
|
|
21994
|
-
({ fragment, included, reason:
|
|
21928
|
+
({ fragment, included, reason: reason6 }) => `${included ? chalk38.green("\u2713") : chalk38.dim("\u2717")} ${fragment.name.padEnd(width2)} ${chalk38.dim(fragment.title.padEnd(titleWidth))} ${reason6}`
|
|
21995
21929
|
).join("\n");
|
|
21996
21930
|
}
|
|
21997
21931
|
|
|
@@ -22489,9 +22423,9 @@ async function isLiveDaemonSession(sessionId2) {
|
|
|
22489
22423
|
}
|
|
22490
22424
|
|
|
22491
22425
|
// src/commands/askCheck/requireCheckSession.ts
|
|
22492
|
-
function askInChat(
|
|
22426
|
+
function askInChat(reason6) {
|
|
22493
22427
|
console.error(
|
|
22494
|
-
`Error: ${
|
|
22428
|
+
`Error: ${reason6}; ask the user to perform the check in chat instead.`
|
|
22495
22429
|
);
|
|
22496
22430
|
process.exit(1);
|
|
22497
22431
|
}
|
|
@@ -22762,8 +22696,8 @@ function rejectLongQuestions(questions) {
|
|
|
22762
22696
|
}
|
|
22763
22697
|
|
|
22764
22698
|
// src/commands/askQuestion/requireQuestionSession.ts
|
|
22765
|
-
function useBuiltIn(
|
|
22766
|
-
console.error(`Error: ${
|
|
22699
|
+
function useBuiltIn(reason6) {
|
|
22700
|
+
console.error(`Error: ${reason6}; use the built-in AskUserQuestion tool.`);
|
|
22767
22701
|
process.exit(1);
|
|
22768
22702
|
}
|
|
22769
22703
|
async function requireQuestionSession() {
|
|
@@ -22853,7 +22787,7 @@ function registerAskQuestion(program) {
|
|
|
22853
22787
|
|
|
22854
22788
|
// src/commands/registerBackup.ts
|
|
22855
22789
|
import { mkdir as mkdir3, stat as stat4 } from "fs/promises";
|
|
22856
|
-
import { join as
|
|
22790
|
+
import { join as join59, resolve as resolve16 } from "path";
|
|
22857
22791
|
import chalk42 from "chalk";
|
|
22858
22792
|
|
|
22859
22793
|
// src/shared/db/recordBackup.ts
|
|
@@ -22867,7 +22801,7 @@ async function recordBackup(db, {
|
|
|
22867
22801
|
|
|
22868
22802
|
// src/commands/backup/scheduleBackup.ts
|
|
22869
22803
|
import { mkdir as mkdir2 } from "fs/promises";
|
|
22870
|
-
import { join as
|
|
22804
|
+
import { join as join58 } from "path";
|
|
22871
22805
|
import chalk40 from "chalk";
|
|
22872
22806
|
|
|
22873
22807
|
// src/commands/backup/readCrontab.ts
|
|
@@ -23009,7 +22943,7 @@ async function scheduleBackup({
|
|
|
23009
22943
|
const cronExpr = durationToCron(every);
|
|
23010
22944
|
const dir = expandTilde(loadConfig().backup.dir);
|
|
23011
22945
|
await mkdir2(dir, { recursive: true });
|
|
23012
|
-
const logPath2 =
|
|
22946
|
+
const logPath2 = join58(dir, "cron.log");
|
|
23013
22947
|
const cronLine = `${cronExpr} ${resolveAssistCommand()} backup >> ${logPath2} 2>&1`;
|
|
23014
22948
|
writeCrontab(upsertScheduleBlock(readCrontab(), every, cronLine));
|
|
23015
22949
|
console.error(
|
|
@@ -23188,7 +23122,7 @@ async function backup({ out }) {
|
|
|
23188
23122
|
await mkdir3(dir, { recursive: true });
|
|
23189
23123
|
const start2 = Date.now();
|
|
23190
23124
|
const timestamp9 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
23191
|
-
const filePath = resolve16(
|
|
23125
|
+
const filePath = resolve16(join59(dir, `backup-${timestamp9}.dump`));
|
|
23192
23126
|
await exportBacklog(filePath);
|
|
23193
23127
|
const { size } = await stat4(filePath);
|
|
23194
23128
|
const durationMs = Date.now() - start2;
|
|
@@ -23717,7 +23651,7 @@ function registerAssociateJiraCommand(cmd) {
|
|
|
23717
23651
|
|
|
23718
23652
|
// src/commands/backlog/cloneRepo.ts
|
|
23719
23653
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
23720
|
-
import { existsSync as
|
|
23654
|
+
import { existsSync as existsSync48 } from "fs";
|
|
23721
23655
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
23722
23656
|
import chalk49 from "chalk";
|
|
23723
23657
|
|
|
@@ -23753,7 +23687,7 @@ async function cloneRepo(originRaw) {
|
|
|
23753
23687
|
if (!target) {
|
|
23754
23688
|
return fail3(`Could not derive a repository name from "${origin}".`);
|
|
23755
23689
|
}
|
|
23756
|
-
if (
|
|
23690
|
+
if (existsSync48(target)) {
|
|
23757
23691
|
return fail3(`Clone target already exists: ${target}`);
|
|
23758
23692
|
}
|
|
23759
23693
|
await mkdir4(baseDir, { recursive: true });
|
|
@@ -23896,8 +23830,8 @@ function countCopyRows(data) {
|
|
|
23896
23830
|
|
|
23897
23831
|
// src/commands/backlog/dump/parseDump.ts
|
|
23898
23832
|
var NEWLINE = 10;
|
|
23899
|
-
function invalid(
|
|
23900
|
-
throw new Error(`Invalid dump: ${
|
|
23833
|
+
function invalid(reason6) {
|
|
23834
|
+
throw new Error(`Invalid dump: ${reason6}`);
|
|
23901
23835
|
}
|
|
23902
23836
|
function readLine(dump, start2) {
|
|
23903
23837
|
const eol = dump.indexOf(NEWLINE, start2);
|
|
@@ -24099,7 +24033,7 @@ function ensureRemoteOrigin() {
|
|
|
24099
24033
|
import { spawnSync as spawnSync7 } from "child_process";
|
|
24100
24034
|
import { mkdtempSync, readFileSync as readFileSync32, unlinkSync as unlinkSync4, writeFileSync as writeFileSync23 } from "fs";
|
|
24101
24035
|
import { tmpdir as tmpdir2 } from "os";
|
|
24102
|
-
import { join as
|
|
24036
|
+
import { join as join60 } from "path";
|
|
24103
24037
|
import enquirer4 from "enquirer";
|
|
24104
24038
|
async function promptType() {
|
|
24105
24039
|
const { type } = await enquirer4.prompt({
|
|
@@ -24139,8 +24073,8 @@ async function promptDescription() {
|
|
|
24139
24073
|
}
|
|
24140
24074
|
function openEditor() {
|
|
24141
24075
|
const editor = process.env.EDITOR || process.env.VISUAL || "vi";
|
|
24142
|
-
const dir = mkdtempSync(
|
|
24143
|
-
const filePath =
|
|
24076
|
+
const dir = mkdtempSync(join60(tmpdir2(), "assist-"));
|
|
24077
|
+
const filePath = join60(dir, "description.md");
|
|
24144
24078
|
writeFileSync23(filePath, "");
|
|
24145
24079
|
const result = spawnSync7(editor, [filePath], { stdio: "inherit" });
|
|
24146
24080
|
if (result.status !== 0) {
|
|
@@ -24626,9 +24560,9 @@ async function findPredecessor(path128, token, startedAt) {
|
|
|
24626
24560
|
|
|
24627
24561
|
// src/commands/backlog/propose/proposalLedgerPath.ts
|
|
24628
24562
|
import { homedir as homedir16 } from "os";
|
|
24629
|
-
import { join as
|
|
24563
|
+
import { join as join61 } from "path";
|
|
24630
24564
|
function proposalLedgerPath(sessionId2) {
|
|
24631
|
-
return
|
|
24565
|
+
return join61(homedir16(), ".assist", "proposals", `session-${sessionId2}.json`);
|
|
24632
24566
|
}
|
|
24633
24567
|
|
|
24634
24568
|
// src/commands/backlog/propose/trackProposal.ts
|
|
@@ -24989,7 +24923,7 @@ import chalk70 from "chalk";
|
|
|
24989
24923
|
|
|
24990
24924
|
// src/shared/waitForIndexUnlocked.ts
|
|
24991
24925
|
import { execSync as execSync18 } from "child_process";
|
|
24992
|
-
import { existsSync as
|
|
24926
|
+
import { existsSync as existsSync49 } from "fs";
|
|
24993
24927
|
import { resolve as resolve17 } from "path";
|
|
24994
24928
|
var POLL_MS2 = 200;
|
|
24995
24929
|
function indexLockPath() {
|
|
@@ -25010,7 +24944,7 @@ function waitForIndexUnlocked(timeoutMs) {
|
|
|
25010
24944
|
const lock2 = indexLockPath();
|
|
25011
24945
|
if (!lock2) return true;
|
|
25012
24946
|
const deadline = Date.now() + timeoutMs;
|
|
25013
|
-
while (
|
|
24947
|
+
while (existsSync49(lock2)) {
|
|
25014
24948
|
if (Date.now() >= deadline) return false;
|
|
25015
24949
|
sleepSync(POLL_MS2);
|
|
25016
24950
|
}
|
|
@@ -25066,8 +25000,8 @@ async function catchUpToRemoteDefault() {
|
|
|
25066
25000
|
process.exit(1);
|
|
25067
25001
|
}
|
|
25068
25002
|
}
|
|
25069
|
-
function skip(
|
|
25070
|
-
console.warn(chalk71.yellow(`git pull skipped: ${
|
|
25003
|
+
function skip(reason6) {
|
|
25004
|
+
console.warn(chalk71.yellow(`git pull skipped: ${reason6}. Continuing.`));
|
|
25071
25005
|
}
|
|
25072
25006
|
function succeeds(command) {
|
|
25073
25007
|
try {
|
|
@@ -25126,14 +25060,14 @@ function hasLocalChanges() {
|
|
|
25126
25060
|
|
|
25127
25061
|
// src/commands/backlog/acquireLock.ts
|
|
25128
25062
|
import {
|
|
25129
|
-
existsSync as
|
|
25063
|
+
existsSync as existsSync50,
|
|
25130
25064
|
mkdirSync as mkdirSync17,
|
|
25131
25065
|
readFileSync as readFileSync35,
|
|
25132
25066
|
unlinkSync as unlinkSync5,
|
|
25133
25067
|
writeFileSync as writeFileSync25
|
|
25134
25068
|
} from "fs";
|
|
25135
25069
|
import { homedir as homedir17 } from "os";
|
|
25136
|
-
import { join as
|
|
25070
|
+
import { join as join62 } from "path";
|
|
25137
25071
|
|
|
25138
25072
|
// src/commands/backlog/bootedAt.ts
|
|
25139
25073
|
import { uptime } from "os";
|
|
@@ -25169,10 +25103,10 @@ function isStaleLock(pid, timestamp9) {
|
|
|
25169
25103
|
|
|
25170
25104
|
// src/commands/backlog/acquireLock.ts
|
|
25171
25105
|
function getLocksDir() {
|
|
25172
|
-
return
|
|
25106
|
+
return join62(homedir17(), ".assist", "locks");
|
|
25173
25107
|
}
|
|
25174
25108
|
function getLockPath(itemId2) {
|
|
25175
|
-
return
|
|
25109
|
+
return join62(getLocksDir(), `lock-${itemId2}.json`);
|
|
25176
25110
|
}
|
|
25177
25111
|
function isProcessAlive(pid) {
|
|
25178
25112
|
try {
|
|
@@ -25184,7 +25118,7 @@ function isProcessAlive(pid) {
|
|
|
25184
25118
|
}
|
|
25185
25119
|
function foreignLockHolder(itemId2) {
|
|
25186
25120
|
const lockPath = getLockPath(itemId2);
|
|
25187
|
-
if (!
|
|
25121
|
+
if (!existsSync50(lockPath)) return null;
|
|
25188
25122
|
try {
|
|
25189
25123
|
const lock2 = JSON.parse(readFileSync35(lockPath, "utf8"));
|
|
25190
25124
|
if (typeof lock2.pid !== "number" || lock2.pid === process.pid) return null;
|
|
@@ -25312,7 +25246,7 @@ async function createBranch({
|
|
|
25312
25246
|
let baseRef;
|
|
25313
25247
|
if (from) {
|
|
25314
25248
|
try {
|
|
25315
|
-
execSync23(`git rev-parse --verify ${
|
|
25249
|
+
execSync23(`git rev-parse --verify ${shellQuote(from)}`, {
|
|
25316
25250
|
stdio: ["pipe", "pipe", "pipe"]
|
|
25317
25251
|
});
|
|
25318
25252
|
} catch {
|
|
@@ -25322,7 +25256,7 @@ async function createBranch({
|
|
|
25322
25256
|
} else {
|
|
25323
25257
|
baseRef = `origin/${resolveDefaultBranch(config.branch?.defaultBranch)}`;
|
|
25324
25258
|
}
|
|
25325
|
-
execSync23(`git switch -c ${
|
|
25259
|
+
execSync23(`git switch -c ${shellQuote(branchName)} ${shellQuote(baseRef)}`, {
|
|
25326
25260
|
stdio: "inherit"
|
|
25327
25261
|
});
|
|
25328
25262
|
await recordBranchActivity(branchName);
|
|
@@ -25465,7 +25399,7 @@ function adoptRecordedBranch(item, branch2) {
|
|
|
25465
25399
|
} catch {
|
|
25466
25400
|
}
|
|
25467
25401
|
try {
|
|
25468
|
-
execSync24(`git switch ${
|
|
25402
|
+
execSync24(`git switch ${shellQuote(branch2)}`, { stdio: "pipe" });
|
|
25469
25403
|
log(
|
|
25470
25404
|
item,
|
|
25471
25405
|
`branch ${branch2} already recorded; switched off ${parked} onto it`
|
|
@@ -25601,10 +25535,10 @@ var duplicateRunExitCode = 75;
|
|
|
25601
25535
|
// src/commands/backlog/reportDuplicateRun.ts
|
|
25602
25536
|
function reportDuplicateRun(itemId2, holder) {
|
|
25603
25537
|
const since = holder.timestamp ? `, started ${holder.timestamp}` : "";
|
|
25604
|
-
const
|
|
25538
|
+
const reason6 = `another session is already running it (pid ${holder.pid}${since}); close that session before running it again`;
|
|
25605
25539
|
console.log(chalk77.yellow(`Already running: ${formatItemId(itemId2)}`));
|
|
25606
|
-
console.log(chalk77.dim(`Refusing to start a second run \u2014 ${
|
|
25607
|
-
appendDaemonLog(`backlog run ${itemId2}: refused \u2014 ${
|
|
25540
|
+
console.log(chalk77.dim(`Refusing to start a second run \u2014 ${reason6}.`));
|
|
25541
|
+
appendDaemonLog(`backlog run ${itemId2}: refused \u2014 ${reason6}`);
|
|
25608
25542
|
process.exitCode = duplicateRunExitCode;
|
|
25609
25543
|
}
|
|
25610
25544
|
|
|
@@ -25643,14 +25577,14 @@ async function resumeDoneConversation({ item, resumeSessionId }, spawnOptions) {
|
|
|
25643
25577
|
}
|
|
25644
25578
|
|
|
25645
25579
|
// src/commands/backlog/consumePause.ts
|
|
25646
|
-
import { existsSync as
|
|
25580
|
+
import { existsSync as existsSync51, mkdirSync as mkdirSync18, unlinkSync as unlinkSync6, writeFileSync as writeFileSync26 } from "fs";
|
|
25647
25581
|
import { homedir as homedir18 } from "os";
|
|
25648
|
-
import { join as
|
|
25582
|
+
import { join as join63 } from "path";
|
|
25649
25583
|
function getControlsDir() {
|
|
25650
|
-
return
|
|
25584
|
+
return join63(homedir18(), ".assist", "controls");
|
|
25651
25585
|
}
|
|
25652
25586
|
function getPausePath(itemId2) {
|
|
25653
|
-
return
|
|
25587
|
+
return join63(getControlsDir(), `pause-${itemId2}.json`);
|
|
25654
25588
|
}
|
|
25655
25589
|
function requestPause(itemId2) {
|
|
25656
25590
|
mkdirSync18(getControlsDir(), { recursive: true });
|
|
@@ -25660,7 +25594,7 @@ function requestPause(itemId2) {
|
|
|
25660
25594
|
);
|
|
25661
25595
|
}
|
|
25662
25596
|
function isPausePending(itemId2) {
|
|
25663
|
-
return
|
|
25597
|
+
return existsSync51(getPausePath(itemId2));
|
|
25664
25598
|
}
|
|
25665
25599
|
function clearPause(itemId2) {
|
|
25666
25600
|
try {
|
|
@@ -25670,7 +25604,7 @@ function clearPause(itemId2) {
|
|
|
25670
25604
|
}
|
|
25671
25605
|
function consumePause(itemId2) {
|
|
25672
25606
|
const pausePath = getPausePath(itemId2);
|
|
25673
|
-
if (!
|
|
25607
|
+
if (!existsSync51(pausePath)) return false;
|
|
25674
25608
|
try {
|
|
25675
25609
|
unlinkSync6(pausePath);
|
|
25676
25610
|
} catch {
|
|
@@ -25791,13 +25725,13 @@ function logHookFired(status2, sessionId2, source) {
|
|
|
25791
25725
|
}
|
|
25792
25726
|
|
|
25793
25727
|
// src/commands/backlog/watchForMarker.ts
|
|
25794
|
-
import { existsSync as
|
|
25728
|
+
import { existsSync as existsSync53, unwatchFile, watchFile } from "fs";
|
|
25795
25729
|
|
|
25796
25730
|
// src/commands/backlog/readSignal.ts
|
|
25797
|
-
import { existsSync as
|
|
25731
|
+
import { existsSync as existsSync52, readFileSync as readFileSync36 } from "fs";
|
|
25798
25732
|
function readSignal() {
|
|
25799
25733
|
const path128 = getSignalPath();
|
|
25800
|
-
if (!path128 || !
|
|
25734
|
+
if (!path128 || !existsSync52(path128)) return void 0;
|
|
25801
25735
|
try {
|
|
25802
25736
|
return JSON.parse(readFileSync36(path128, "utf8"));
|
|
25803
25737
|
} catch {
|
|
@@ -25811,7 +25745,7 @@ function watchForMarker(child2, options2) {
|
|
|
25811
25745
|
const statusPath = getSignalPath();
|
|
25812
25746
|
if (!statusPath) return { killedOnMarker: () => killed };
|
|
25813
25747
|
watchFile(statusPath, { interval: 1e3 }, () => {
|
|
25814
|
-
if (!
|
|
25748
|
+
if (!existsSync53(statusPath)) return;
|
|
25815
25749
|
const signal = readSignal();
|
|
25816
25750
|
if (!signal) return;
|
|
25817
25751
|
if (signal.event === "done" && !options2?.actOnDone) return;
|
|
@@ -25868,7 +25802,7 @@ function launchPhaseSession(item, phaseNumber, phase, phaseLabel2, claudeSession
|
|
|
25868
25802
|
}
|
|
25869
25803
|
|
|
25870
25804
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
25871
|
-
import { existsSync as
|
|
25805
|
+
import { existsSync as existsSync54, unlinkSync as unlinkSync7 } from "fs";
|
|
25872
25806
|
import chalk80 from "chalk";
|
|
25873
25807
|
|
|
25874
25808
|
// src/commands/backlog/handleIncompletePhase.ts
|
|
@@ -25890,7 +25824,7 @@ async function handleIncompletePhase() {
|
|
|
25890
25824
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
25891
25825
|
function cleanupSignal() {
|
|
25892
25826
|
const statusPath = getSignalPath();
|
|
25893
|
-
if (statusPath &&
|
|
25827
|
+
if (statusPath && existsSync54(statusPath)) {
|
|
25894
25828
|
unlinkSync7(statusPath);
|
|
25895
25829
|
}
|
|
25896
25830
|
}
|
|
@@ -25901,7 +25835,7 @@ async function isTerminalStatus(itemId2) {
|
|
|
25901
25835
|
}
|
|
25902
25836
|
async function resolvePhaseResult(phaseIndex, itemId2) {
|
|
25903
25837
|
const signalPath = getSignalPath();
|
|
25904
|
-
if (!signalPath || !
|
|
25838
|
+
if (!signalPath || !existsSync54(signalPath)) {
|
|
25905
25839
|
if (await isTerminalStatus(itemId2)) return { kind: "abort" };
|
|
25906
25840
|
const action = await handleIncompletePhase();
|
|
25907
25841
|
if (action === "abort") return { kind: "abort" };
|
|
@@ -25988,7 +25922,7 @@ async function persistPhaseSessionId(itemId2, phaseIdx, claudeSessionId) {
|
|
|
25988
25922
|
// src/shared/emitActivity.ts
|
|
25989
25923
|
import { mkdirSync as mkdirSync19, readFileSync as readFileSync37, rmSync as rmSync4, writeFileSync as writeFileSync27 } from "fs";
|
|
25990
25924
|
import { homedir as homedir19 } from "os";
|
|
25991
|
-
import { dirname as dirname31, join as
|
|
25925
|
+
import { dirname as dirname31, join as join64 } from "path";
|
|
25992
25926
|
import { z as z19 } from "zod";
|
|
25993
25927
|
var activitySchema = z19.object({
|
|
25994
25928
|
kind: z19.enum(["command", "backlog"]),
|
|
@@ -26006,7 +25940,7 @@ var activitySchema = z19.object({
|
|
|
26006
25940
|
startedAt: z19.number()
|
|
26007
25941
|
});
|
|
26008
25942
|
function activityPath(sessionId2) {
|
|
26009
|
-
return
|
|
25943
|
+
return join64(homedir19(), ".assist", "activity", `activity-${sessionId2}.json`);
|
|
26010
25944
|
}
|
|
26011
25945
|
function emitActivity(activity2) {
|
|
26012
25946
|
const sessionId2 = process.env.ASSIST_ACTIVITY_ID;
|
|
@@ -26944,14 +26878,14 @@ async function unstar(id) {
|
|
|
26944
26878
|
|
|
26945
26879
|
// src/commands/backlog/wontdo.ts
|
|
26946
26880
|
import chalk103 from "chalk";
|
|
26947
|
-
async function wontdo(id,
|
|
26881
|
+
async function wontdo(id, reason6) {
|
|
26948
26882
|
const found = await findOneItem(id);
|
|
26949
26883
|
if (!found) return;
|
|
26950
26884
|
const { orm, item } = found;
|
|
26951
26885
|
await updateStatus(orm, item.id, "wontdo");
|
|
26952
|
-
if (
|
|
26886
|
+
if (reason6) {
|
|
26953
26887
|
const phase = item.currentPhase ?? 1;
|
|
26954
|
-
await appendComment(orm, item.id,
|
|
26888
|
+
await appendComment(orm, item.id, reason6, { phase, type: "summary" });
|
|
26955
26889
|
}
|
|
26956
26890
|
console.log(
|
|
26957
26891
|
chalk103.red(`Won't do item ${formatItemId(item.id)}: ${item.name}`)
|
|
@@ -28765,7 +28699,7 @@ function extractGraphqlQuery(args) {
|
|
|
28765
28699
|
}
|
|
28766
28700
|
|
|
28767
28701
|
// src/shared/loadCliReads.ts
|
|
28768
|
-
import { existsSync as
|
|
28702
|
+
import { existsSync as existsSync55, readFileSync as readFileSync39, writeFileSync as writeFileSync28 } from "fs";
|
|
28769
28703
|
import { dirname as dirname32, resolve as resolve18 } from "path";
|
|
28770
28704
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
28771
28705
|
var __filename3 = fileURLToPath6(import.meta.url);
|
|
@@ -28774,7 +28708,7 @@ function packageRoot() {
|
|
|
28774
28708
|
return __dirname4;
|
|
28775
28709
|
}
|
|
28776
28710
|
function readLines(path128) {
|
|
28777
|
-
if (!
|
|
28711
|
+
if (!existsSync55(path128)) return [];
|
|
28778
28712
|
return readFileSync39(path128, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
28779
28713
|
}
|
|
28780
28714
|
var cachedReads;
|
|
@@ -28821,14 +28755,14 @@ function findCliWrite(command) {
|
|
|
28821
28755
|
}
|
|
28822
28756
|
|
|
28823
28757
|
// src/shared/readSettingsPerms.ts
|
|
28824
|
-
import { existsSync as
|
|
28758
|
+
import { existsSync as existsSync56, readFileSync as readFileSync40 } from "fs";
|
|
28825
28759
|
import { homedir as homedir20 } from "os";
|
|
28826
|
-
import { join as
|
|
28760
|
+
import { join as join65 } from "path";
|
|
28827
28761
|
function readSettingsPerms(key) {
|
|
28828
28762
|
const paths = [
|
|
28829
|
-
|
|
28830
|
-
|
|
28831
|
-
|
|
28763
|
+
join65(homedir20(), ".claude", "settings.json"),
|
|
28764
|
+
join65(process.cwd(), ".claude", "settings.json"),
|
|
28765
|
+
join65(process.cwd(), ".claude", "settings.local.json")
|
|
28832
28766
|
];
|
|
28833
28767
|
const entries2 = [];
|
|
28834
28768
|
for (const p of paths) {
|
|
@@ -28840,7 +28774,7 @@ function readSettingsPerms(key) {
|
|
|
28840
28774
|
return entries2;
|
|
28841
28775
|
}
|
|
28842
28776
|
function readPermissionArray(filePath, key) {
|
|
28843
|
-
if (!
|
|
28777
|
+
if (!existsSync56(filePath)) return [];
|
|
28844
28778
|
try {
|
|
28845
28779
|
const data = JSON.parse(readFileSync40(filePath, "utf8"));
|
|
28846
28780
|
const arr = data?.permissions?.[key];
|
|
@@ -29035,9 +28969,9 @@ function resolvePermission(toolName, parts2) {
|
|
|
29035
28969
|
if (denied) return denied;
|
|
29036
28970
|
const reasons = [];
|
|
29037
28971
|
for (const part of parts2) {
|
|
29038
|
-
const
|
|
29039
|
-
if (!
|
|
29040
|
-
reasons.push(
|
|
28972
|
+
const reason6 = isApprovedRead(part, toolName);
|
|
28973
|
+
if (!reason6) return void 0;
|
|
28974
|
+
reasons.push(reason6);
|
|
29041
28975
|
}
|
|
29042
28976
|
return {
|
|
29043
28977
|
permissionDecision: "allow",
|
|
@@ -29194,32 +29128,32 @@ async function decideDocsGuard({
|
|
|
29194
29128
|
}
|
|
29195
29129
|
|
|
29196
29130
|
// src/commands/schema/isSchemaLocked.ts
|
|
29197
|
-
import { existsSync as
|
|
29131
|
+
import { existsSync as existsSync57, readFileSync as readFileSync42 } from "fs";
|
|
29198
29132
|
|
|
29199
29133
|
// src/commands/schema/getSchemaSessionApprovalPath.ts
|
|
29200
|
-
import { join as
|
|
29134
|
+
import { join as join67 } from "path";
|
|
29201
29135
|
|
|
29202
29136
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
29203
29137
|
import { homedir as homedir21 } from "os";
|
|
29204
|
-
import { join as
|
|
29138
|
+
import { join as join66 } from "path";
|
|
29205
29139
|
function getRestrictedDir() {
|
|
29206
|
-
return
|
|
29140
|
+
return join66(homedir21(), ".assist", "restricted");
|
|
29207
29141
|
}
|
|
29208
29142
|
function getPinStatePath(pin2) {
|
|
29209
|
-
return
|
|
29143
|
+
return join66(getRestrictedDir(), `code-comment-${pin2}.json`);
|
|
29210
29144
|
}
|
|
29211
29145
|
|
|
29212
29146
|
// src/commands/schema/getSchemaSessionApprovalPath.ts
|
|
29213
29147
|
var SESSION_ID = /^[\w-]+$/;
|
|
29214
29148
|
function getSchemaSessionApprovalDir() {
|
|
29215
|
-
return
|
|
29149
|
+
return join67(getRestrictedDir(), "schema-sessions");
|
|
29216
29150
|
}
|
|
29217
29151
|
function getSchemaSessionApprovalPath(scope) {
|
|
29218
29152
|
const { harness, conversationId } = scope;
|
|
29219
29153
|
if (!SESSION_ID.test(conversationId) || !SESSION_ID.test(harness))
|
|
29220
29154
|
return void 0;
|
|
29221
29155
|
const name2 = harness === legacyDefaultHarness ? conversationId : `${harness}-${conversationId}`;
|
|
29222
|
-
return
|
|
29156
|
+
return join67(getSchemaSessionApprovalDir(), `${name2}.json`);
|
|
29223
29157
|
}
|
|
29224
29158
|
|
|
29225
29159
|
// src/commands/schema/isSchemaLocked.ts
|
|
@@ -29240,7 +29174,7 @@ function hasSessionApproval(identity) {
|
|
|
29240
29174
|
const { harness, conversationId } = identity;
|
|
29241
29175
|
if (!conversationId) return false;
|
|
29242
29176
|
const path128 = getSchemaSessionApprovalPath({ harness, conversationId });
|
|
29243
|
-
return path128 !== void 0 &&
|
|
29177
|
+
return path128 !== void 0 && existsSync57(path128) && approvalMatches(path128, identity);
|
|
29244
29178
|
}
|
|
29245
29179
|
async function isSchemaLocked(identity = currentExecutionIdentity()) {
|
|
29246
29180
|
if (!identity) return false;
|
|
@@ -29266,9 +29200,9 @@ async function decideSchemaGuard({ path: path128, contents }, identity) {
|
|
|
29266
29200
|
}
|
|
29267
29201
|
|
|
29268
29202
|
// src/commands/toolPolicy/decideToolOperations.ts
|
|
29269
|
-
var deny = (
|
|
29203
|
+
var deny = (reason6) => ({
|
|
29270
29204
|
permissionDecision: "deny",
|
|
29271
|
-
permissionDecisionReason:
|
|
29205
|
+
permissionDecisionReason: reason6
|
|
29272
29206
|
});
|
|
29273
29207
|
async function decideCommandOperation({ tool, command }, identity) {
|
|
29274
29208
|
const decision = decideCommand(tool, command);
|
|
@@ -29282,8 +29216,8 @@ async function decideCommandOperation({ tool, command }, identity) {
|
|
|
29282
29216
|
async function decideFileWrite(operation, identity) {
|
|
29283
29217
|
const restricted = findRestrictedPathDeny([operation.path]);
|
|
29284
29218
|
if (restricted) return restricted;
|
|
29285
|
-
const
|
|
29286
|
-
return
|
|
29219
|
+
const reason6 = await decideSchemaGuard(operation, identity) ?? await decideDocsGuard(operation);
|
|
29220
|
+
return reason6 ? deny(reason6) : void 0;
|
|
29287
29221
|
}
|
|
29288
29222
|
function decideOperation(operation, identity) {
|
|
29289
29223
|
switch (operation.kind) {
|
|
@@ -29314,11 +29248,11 @@ import { basename as basename17 } from "path";
|
|
|
29314
29248
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
29315
29249
|
import { mkdirSync as mkdirSync20 } from "fs";
|
|
29316
29250
|
import { homedir as homedir22 } from "os";
|
|
29317
|
-
import { join as
|
|
29251
|
+
import { join as join68 } from "path";
|
|
29318
29252
|
import Database from "better-sqlite3";
|
|
29319
29253
|
var _db;
|
|
29320
29254
|
function getDbDir() {
|
|
29321
|
-
return
|
|
29255
|
+
return join68(homedir22(), ".assist");
|
|
29322
29256
|
}
|
|
29323
29257
|
function initSchema(db) {
|
|
29324
29258
|
db.exec(`
|
|
@@ -29337,7 +29271,7 @@ function openPromptsDb(dir) {
|
|
|
29337
29271
|
if (_db) return _db;
|
|
29338
29272
|
const dbDir = dir ?? getDbDir();
|
|
29339
29273
|
mkdirSync20(dbDir, { recursive: true });
|
|
29340
|
-
const db = new Database(
|
|
29274
|
+
const db = new Database(join68(dbDir, "assist.db"));
|
|
29341
29275
|
db.pragma("journal_mode = WAL");
|
|
29342
29276
|
initSchema(db);
|
|
29343
29277
|
_db = db;
|
|
@@ -29428,22 +29362,22 @@ function cliHookCheck(command, toolName = "Bash") {
|
|
|
29428
29362
|
if (reportDeny(toolName, parts2)) return;
|
|
29429
29363
|
const reasons = [];
|
|
29430
29364
|
for (const part of parts2) {
|
|
29431
|
-
const
|
|
29432
|
-
if (!
|
|
29365
|
+
const reason6 = isApprovedRead(part, toolName);
|
|
29366
|
+
if (!reason6) {
|
|
29433
29367
|
console.log(`not approved (unrecognised: ${part})`);
|
|
29434
29368
|
process.exitCode = 1;
|
|
29435
29369
|
return;
|
|
29436
29370
|
}
|
|
29437
|
-
reasons.push(` ${part} -> ${
|
|
29371
|
+
reasons.push(` ${part} -> ${reason6}`);
|
|
29438
29372
|
}
|
|
29439
29373
|
console.log(`approved
|
|
29440
29374
|
${reasons.join("\n")}`);
|
|
29441
29375
|
}
|
|
29442
29376
|
|
|
29443
29377
|
// src/commands/permitCliReads.ts
|
|
29444
|
-
import { existsSync as
|
|
29378
|
+
import { existsSync as existsSync58, mkdirSync as mkdirSync21, readFileSync as readFileSync43, writeFileSync as writeFileSync29 } from "fs";
|
|
29445
29379
|
import { homedir as homedir23 } from "os";
|
|
29446
|
-
import { join as
|
|
29380
|
+
import { join as join69 } from "path";
|
|
29447
29381
|
|
|
29448
29382
|
// src/commands/permitCliReads/assertCliExists.ts
|
|
29449
29383
|
function assertCliExists(cli) {
|
|
@@ -29706,15 +29640,15 @@ function updateSettings(cli, commands) {
|
|
|
29706
29640
|
// src/commands/permitCliReads.ts
|
|
29707
29641
|
function logPath(cli) {
|
|
29708
29642
|
const safeName = cli.replace(/\s+/g, "-");
|
|
29709
|
-
return
|
|
29643
|
+
return join69(homedir23(), ".assist", `cli-discover-${safeName}.log`);
|
|
29710
29644
|
}
|
|
29711
29645
|
function readCache(cli) {
|
|
29712
29646
|
const path128 = logPath(cli);
|
|
29713
|
-
if (!
|
|
29647
|
+
if (!existsSync58(path128)) return void 0;
|
|
29714
29648
|
return readFileSync43(path128, "utf8");
|
|
29715
29649
|
}
|
|
29716
29650
|
function writeCache(cli, output) {
|
|
29717
|
-
const dir =
|
|
29651
|
+
const dir = join69(homedir23(), ".assist");
|
|
29718
29652
|
mkdirSync21(dir, { recursive: true });
|
|
29719
29653
|
writeFileSync29(logPath(cli), output);
|
|
29720
29654
|
}
|
|
@@ -29846,7 +29780,7 @@ function registerCliHook(program) {
|
|
|
29846
29780
|
}
|
|
29847
29781
|
|
|
29848
29782
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
29849
|
-
import { existsSync as
|
|
29783
|
+
import { existsSync as existsSync60, readFileSync as readFileSync45, unlinkSync as unlinkSync9, writeFileSync as writeFileSync30 } from "fs";
|
|
29850
29784
|
import chalk125 from "chalk";
|
|
29851
29785
|
|
|
29852
29786
|
// src/shared/isHashCommentFile.ts
|
|
@@ -29879,19 +29813,19 @@ function isHashCommentFile(filePath) {
|
|
|
29879
29813
|
}
|
|
29880
29814
|
|
|
29881
29815
|
// src/commands/codeComment/sweepRestrictedDir.ts
|
|
29882
|
-
import { readdirSync as
|
|
29883
|
-
import { join as
|
|
29816
|
+
import { readdirSync as readdirSync11, statSync as statSync11, unlinkSync as unlinkSync8 } from "fs";
|
|
29817
|
+
import { join as join70 } from "path";
|
|
29884
29818
|
var STALE_AFTER_MS = 30 * 60 * 1e3;
|
|
29885
29819
|
function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
29886
29820
|
let entries2;
|
|
29887
29821
|
try {
|
|
29888
|
-
entries2 =
|
|
29822
|
+
entries2 = readdirSync11(dir);
|
|
29889
29823
|
} catch {
|
|
29890
29824
|
return;
|
|
29891
29825
|
}
|
|
29892
29826
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
29893
29827
|
for (const entry of entries2) {
|
|
29894
|
-
const path128 =
|
|
29828
|
+
const path128 = join70(dir, entry);
|
|
29895
29829
|
try {
|
|
29896
29830
|
if (statSync11(path128).mtimeMs < cutoff) unlinkSync8(path128);
|
|
29897
29831
|
} catch {
|
|
@@ -29901,10 +29835,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
29901
29835
|
}
|
|
29902
29836
|
|
|
29903
29837
|
// src/commands/codeComment/readPinState.ts
|
|
29904
|
-
import { existsSync as
|
|
29838
|
+
import { existsSync as existsSync59, readFileSync as readFileSync44 } from "fs";
|
|
29905
29839
|
function readPinState(pin2) {
|
|
29906
29840
|
const path128 = getPinStatePath(pin2);
|
|
29907
|
-
if (!
|
|
29841
|
+
if (!existsSync59(path128)) return void 0;
|
|
29908
29842
|
try {
|
|
29909
29843
|
const state = JSON.parse(readFileSync44(path128, "utf8"));
|
|
29910
29844
|
if (state.pin !== pin2) return void 0;
|
|
@@ -29923,7 +29857,7 @@ function codeCommentConfirm(pin2) {
|
|
|
29923
29857
|
process.exitCode = 1;
|
|
29924
29858
|
return;
|
|
29925
29859
|
}
|
|
29926
|
-
if (!
|
|
29860
|
+
if (!existsSync60(state.file)) {
|
|
29927
29861
|
console.error(chalk125.red(`Target file no longer exists: ${state.file}`));
|
|
29928
29862
|
process.exitCode = 1;
|
|
29929
29863
|
return;
|
|
@@ -30617,7 +30551,7 @@ function gitCheckOutput(cmd) {
|
|
|
30617
30551
|
}
|
|
30618
30552
|
function checkCommands(files) {
|
|
30619
30553
|
if (files.length === 0) return ["git diff --cached --check"];
|
|
30620
|
-
const scope = files.map(
|
|
30554
|
+
const scope = files.map(shellQuote).join(" ");
|
|
30621
30555
|
return [
|
|
30622
30556
|
`git diff --check -- ${scope}`,
|
|
30623
30557
|
`git diff --cached --check -- ${scope}`
|
|
@@ -30732,11 +30666,11 @@ function stashRef(sha) {
|
|
|
30732
30666
|
const index3 = listStashShas().indexOf(sha);
|
|
30733
30667
|
return index3 === -1 ? sha : `stash@{${index3}}`;
|
|
30734
30668
|
}
|
|
30735
|
-
function strandedError(sha,
|
|
30669
|
+
function strandedError(sha, reason6) {
|
|
30736
30670
|
const unmerged = findUnmergedPaths();
|
|
30737
30671
|
const guidance = unmerged.length > 0 ? `They were applied with conflicts in ${unmerged.join(", ")}: resolve those, drop that entry by its SHA, then re-run the commit.` : `Restore them with \`git stash apply ${sha}\`, resolve any conflicts, drop that entry by its SHA, then re-run the commit.`;
|
|
30738
30672
|
const message4 = [
|
|
30739
|
-
`Error: refusing to commit \u2014 git pull --autostash left your local changes in stash entry ${stashRef(sha)} (${sha}): ${
|
|
30673
|
+
`Error: refusing to commit \u2014 git pull --autostash left your local changes in stash entry ${stashRef(sha)} (${sha}): ${reason6}`,
|
|
30740
30674
|
guidance,
|
|
30741
30675
|
"Nothing was committed or pushed."
|
|
30742
30676
|
].join("\n");
|
|
@@ -30799,17 +30733,17 @@ import { execSync as execSync30 } from "child_process";
|
|
|
30799
30733
|
var HEADS_PREFIX = "refs/heads/";
|
|
30800
30734
|
function pushCommit(trunkMode) {
|
|
30801
30735
|
const target = pushTargetForRenamedUpstream(trunkMode);
|
|
30802
|
-
const command = target ? `git push ${target.setUpstream ? "--set-upstream " : ""}${
|
|
30736
|
+
const command = target ? `git push ${target.setUpstream ? "--set-upstream " : ""}${shellQuote(target.remote)} HEAD:${shellQuote(target.branch)}` : "git push";
|
|
30803
30737
|
execSync30(command, { stdio: "inherit" });
|
|
30804
30738
|
}
|
|
30805
30739
|
function pushTargetForRenamedUpstream(trunkMode) {
|
|
30806
30740
|
const branch2 = gitOrNull2("git symbolic-ref --short HEAD");
|
|
30807
30741
|
if (!branch2) return null;
|
|
30808
30742
|
const remote = gitOrNull2(
|
|
30809
|
-
`git config --get branch.${
|
|
30743
|
+
`git config --get branch.${shellQuote(branch2)}.remote`
|
|
30810
30744
|
);
|
|
30811
30745
|
const merge2 = gitOrNull2(
|
|
30812
|
-
`git config --get branch.${
|
|
30746
|
+
`git config --get branch.${shellQuote(branch2)}.merge`
|
|
30813
30747
|
);
|
|
30814
30748
|
if (!remote || !merge2) return null;
|
|
30815
30749
|
const upstream = merge2.startsWith(HEADS_PREFIX) ? merge2.slice(HEADS_PREFIX.length) : merge2;
|
|
@@ -30904,7 +30838,7 @@ async function refuseLockedSchema() {
|
|
|
30904
30838
|
// src/commands/commit/commitStaged.ts
|
|
30905
30839
|
import { execSync as execSync33 } from "child_process";
|
|
30906
30840
|
function commitStaged(message4) {
|
|
30907
|
-
execSync33(`git commit -m ${
|
|
30841
|
+
execSync33(`git commit -m ${shellQuote(message4)}`, { stdio: "inherit" });
|
|
30908
30842
|
return execSync33("git rev-parse --short=7 HEAD", {
|
|
30909
30843
|
encoding: "utf8"
|
|
30910
30844
|
}).trim();
|
|
@@ -30913,7 +30847,7 @@ function commitStaged(message4) {
|
|
|
30913
30847
|
// src/commands/commit/stageFiles.ts
|
|
30914
30848
|
import { execSync as execSync34 } from "child_process";
|
|
30915
30849
|
function stageFiles(files) {
|
|
30916
|
-
const escaped = files.map(
|
|
30850
|
+
const escaped = files.map(shellQuote).join(" ");
|
|
30917
30851
|
execSync34(`git add ${escaped}`, { stdio: "inherit" });
|
|
30918
30852
|
}
|
|
30919
30853
|
|
|
@@ -32458,11 +32392,11 @@ import { dirname as dirname35 } from "path";
|
|
|
32458
32392
|
|
|
32459
32393
|
// src/commands/browser/snapshotPath.ts
|
|
32460
32394
|
import { homedir as homedir24 } from "os";
|
|
32461
|
-
import { join as
|
|
32395
|
+
import { join as join73 } from "path";
|
|
32462
32396
|
function snapshotPath(tabUrl, now) {
|
|
32463
32397
|
const host = new URL(tabUrl).host.replace(/[^\w.-]/g, "-");
|
|
32464
32398
|
const timestamp9 = now.toISOString().replace(/[:.]/g, "-");
|
|
32465
|
-
return
|
|
32399
|
+
return join73(homedir24(), ".assist", "browser", `${host}-${timestamp9}.html`);
|
|
32466
32400
|
}
|
|
32467
32401
|
|
|
32468
32402
|
// src/commands/browser/browserSnapshot.ts
|
|
@@ -32669,28 +32603,28 @@ async function printExtensionUrl() {
|
|
|
32669
32603
|
// src/commands/extension/signExtension.ts
|
|
32670
32604
|
import { rm as rm2 } from "fs/promises";
|
|
32671
32605
|
import { homedir as homedir25, tmpdir as tmpdir4 } from "os";
|
|
32672
|
-
import { join as
|
|
32606
|
+
import { join as join79 } from "path";
|
|
32673
32607
|
import chalk159 from "chalk";
|
|
32674
32608
|
|
|
32675
32609
|
// src/commands/extension/copySignedXpi.ts
|
|
32676
32610
|
import { copyFile } from "fs/promises";
|
|
32677
|
-
import { join as
|
|
32611
|
+
import { join as join74 } from "path";
|
|
32678
32612
|
var SIGNED_XPI_NAME = "assist-extension.xpi";
|
|
32679
32613
|
async function copySignedXpi(xpi, dir) {
|
|
32680
|
-
const fixed2 =
|
|
32614
|
+
const fixed2 = join74(dir, SIGNED_XPI_NAME);
|
|
32681
32615
|
if (fixed2 === xpi) return fixed2;
|
|
32682
32616
|
await copyFile(xpi, fixed2);
|
|
32683
32617
|
return fixed2;
|
|
32684
32618
|
}
|
|
32685
32619
|
|
|
32686
32620
|
// src/commands/extension/findSignedXpi.ts
|
|
32687
|
-
import { existsSync as
|
|
32621
|
+
import { existsSync as existsSync62 } from "fs";
|
|
32688
32622
|
import { readdir } from "fs/promises";
|
|
32689
|
-
import { join as
|
|
32623
|
+
import { join as join75 } from "path";
|
|
32690
32624
|
async function findSignedXpi(dir) {
|
|
32691
|
-
if (!
|
|
32625
|
+
if (!existsSync62(dir)) return null;
|
|
32692
32626
|
const name2 = (await readdir(dir)).find((entry) => entry.endsWith(".xpi"));
|
|
32693
|
-
return name2 ?
|
|
32627
|
+
return name2 ? join75(dir, name2) : null;
|
|
32694
32628
|
}
|
|
32695
32629
|
|
|
32696
32630
|
// src/commands/extension/signedAddonInstallPath.ts
|
|
@@ -32712,11 +32646,11 @@ async function signedAddonInstallPath(xpi) {
|
|
|
32712
32646
|
}
|
|
32713
32647
|
|
|
32714
32648
|
// src/commands/extension/signPreflightProblem.ts
|
|
32715
|
-
import { existsSync as
|
|
32716
|
-
import { join as
|
|
32649
|
+
import { existsSync as existsSync63 } from "fs";
|
|
32650
|
+
import { join as join76 } from "path";
|
|
32717
32651
|
var KEY_URL = "https://addons.mozilla.org/en-US/developers/addon/api/key/";
|
|
32718
32652
|
function signPreflightProblem(source) {
|
|
32719
|
-
if (!
|
|
32653
|
+
if (!existsSync63(join76(source, "content.js")))
|
|
32720
32654
|
return {
|
|
32721
32655
|
message: `no content.js in ${source}`,
|
|
32722
32656
|
hint: "run npm run build to bundle the content script"
|
|
@@ -32731,7 +32665,7 @@ function signPreflightProblem(source) {
|
|
|
32731
32665
|
|
|
32732
32666
|
// src/commands/extension/stageExtension.ts
|
|
32733
32667
|
import { cp as cp3, mkdir as mkdir5, readFile as readFile5, rm, writeFile as writeFile4 } from "fs/promises";
|
|
32734
|
-
import { basename as basename18, join as
|
|
32668
|
+
import { basename as basename18, join as join77 } from "path";
|
|
32735
32669
|
|
|
32736
32670
|
// src/commands/extension/stampManifestVersion.ts
|
|
32737
32671
|
function stampManifestVersion(manifest, version2) {
|
|
@@ -32748,7 +32682,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
32748
32682
|
recursive: true,
|
|
32749
32683
|
filter: (path128) => basename18(path128) !== "updates.json"
|
|
32750
32684
|
});
|
|
32751
|
-
const manifest =
|
|
32685
|
+
const manifest = join77(staging, "manifest.json");
|
|
32752
32686
|
const stamped = stampManifestVersion(
|
|
32753
32687
|
await readFile5(manifest, "utf8"),
|
|
32754
32688
|
version2
|
|
@@ -32758,7 +32692,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
32758
32692
|
|
|
32759
32693
|
// src/commands/extension/writeUpdateManifest.ts
|
|
32760
32694
|
import { readFile as readFile6, writeFile as writeFile5 } from "fs/promises";
|
|
32761
|
-
import { join as
|
|
32695
|
+
import { join as join78 } from "path";
|
|
32762
32696
|
|
|
32763
32697
|
// src/commands/extension/buildUpdateManifest.ts
|
|
32764
32698
|
var RELEASE_DOWNLOAD_URL = "https://github.com/staff0rd/assist/releases/download";
|
|
@@ -32783,17 +32717,17 @@ function buildUpdateManifest(manifest, version2) {
|
|
|
32783
32717
|
// src/commands/extension/writeUpdateManifest.ts
|
|
32784
32718
|
async function writeUpdateManifest(source, dir, version2) {
|
|
32785
32719
|
await writeFile5(
|
|
32786
|
-
|
|
32720
|
+
join78(dir, "updates.json"),
|
|
32787
32721
|
buildUpdateManifest(
|
|
32788
|
-
await readFile6(
|
|
32722
|
+
await readFile6(join78(source, "manifest.json"), "utf8"),
|
|
32789
32723
|
version2
|
|
32790
32724
|
)
|
|
32791
32725
|
);
|
|
32792
32726
|
}
|
|
32793
32727
|
|
|
32794
32728
|
// src/commands/extension/signExtension.ts
|
|
32795
|
-
var ARTIFACTS_DIR =
|
|
32796
|
-
var STAGING_DIR =
|
|
32729
|
+
var ARTIFACTS_DIR = join79(homedir25(), ".assist", "extension");
|
|
32730
|
+
var STAGING_DIR = join79(tmpdir4(), "assist-extension");
|
|
32797
32731
|
async function signExtension() {
|
|
32798
32732
|
const source = extensionDir();
|
|
32799
32733
|
const problem = signPreflightProblem(source);
|
|
@@ -32979,7 +32913,7 @@ function registerDb(program) {
|
|
|
32979
32913
|
}
|
|
32980
32914
|
|
|
32981
32915
|
// src/commands/deploy/redirect.ts
|
|
32982
|
-
import { existsSync as
|
|
32916
|
+
import { existsSync as existsSync64, readFileSync as readFileSync48, writeFileSync as writeFileSync33 } from "fs";
|
|
32983
32917
|
import chalk162 from "chalk";
|
|
32984
32918
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
32985
32919
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -32988,7 +32922,7 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
32988
32922
|
</script>`;
|
|
32989
32923
|
function redirect() {
|
|
32990
32924
|
const indexPath = "index.html";
|
|
32991
|
-
if (!
|
|
32925
|
+
if (!existsSync64(indexPath)) {
|
|
32992
32926
|
console.log(chalk162.yellow("No index.html found"));
|
|
32993
32927
|
return;
|
|
32994
32928
|
}
|
|
@@ -33087,9 +33021,9 @@ import { readFileSync as readFileSync49 } from "fs";
|
|
|
33087
33021
|
import { parse as parseYaml3 } from "yaml";
|
|
33088
33022
|
|
|
33089
33023
|
// src/commands/devlog/devEntryPath.ts
|
|
33090
|
-
import { join as
|
|
33024
|
+
import { join as join80 } from "path";
|
|
33091
33025
|
function devEntryPath(repoName, week, devDir) {
|
|
33092
|
-
return
|
|
33026
|
+
return join80(devDir, repoName, `${week.toLowerCase()}.md`);
|
|
33093
33027
|
}
|
|
33094
33028
|
|
|
33095
33029
|
// src/commands/devlog/loadDevEntry.ts
|
|
@@ -33201,15 +33135,15 @@ function findTargetWeek(weeks, { lastWeek, skip: skip3, today }) {
|
|
|
33201
33135
|
import chalk165 from "chalk";
|
|
33202
33136
|
|
|
33203
33137
|
// src/shared/getRepoName.ts
|
|
33204
|
-
import { existsSync as
|
|
33205
|
-
import { basename as basename19, join as
|
|
33138
|
+
import { existsSync as existsSync65, readFileSync as readFileSync50 } from "fs";
|
|
33139
|
+
import { basename as basename19, join as join81 } from "path";
|
|
33206
33140
|
function getRepoName() {
|
|
33207
33141
|
const config = loadConfig();
|
|
33208
33142
|
if (config.devlog?.name) {
|
|
33209
33143
|
return config.devlog.name;
|
|
33210
33144
|
}
|
|
33211
|
-
const packageJsonPath =
|
|
33212
|
-
if (
|
|
33145
|
+
const packageJsonPath = join81(process.cwd(), "package.json");
|
|
33146
|
+
if (existsSync65(packageJsonPath)) {
|
|
33213
33147
|
try {
|
|
33214
33148
|
const content = readFileSync50(packageJsonPath, "utf8");
|
|
33215
33149
|
const pkg = JSON.parse(content);
|
|
@@ -33286,8 +33220,8 @@ function list2(options2) {
|
|
|
33286
33220
|
}
|
|
33287
33221
|
|
|
33288
33222
|
// src/commands/devlog/loadDevWeeks.ts
|
|
33289
|
-
import { readdirSync as
|
|
33290
|
-
import { join as
|
|
33223
|
+
import { readdirSync as readdirSync12 } from "fs";
|
|
33224
|
+
import { join as join82 } from "path";
|
|
33291
33225
|
var DEV_FILENAME_PATTERN = /^(\d{4})-w(\d{2})\.md$/;
|
|
33292
33226
|
function parseDevWeekFilename(filename) {
|
|
33293
33227
|
const match = filename.match(DEV_FILENAME_PATTERN);
|
|
@@ -33295,13 +33229,13 @@ function parseDevWeekFilename(filename) {
|
|
|
33295
33229
|
}
|
|
33296
33230
|
function readFilenames(dir) {
|
|
33297
33231
|
try {
|
|
33298
|
-
return
|
|
33232
|
+
return readdirSync12(dir);
|
|
33299
33233
|
} catch {
|
|
33300
33234
|
return [];
|
|
33301
33235
|
}
|
|
33302
33236
|
}
|
|
33303
33237
|
function loadDevWeeks(repoName, devDir) {
|
|
33304
|
-
return readFilenames(
|
|
33238
|
+
return readFilenames(join82(devDir, repoName)).map(parseDevWeekFilename).filter((week) => week !== null).sort();
|
|
33305
33239
|
}
|
|
33306
33240
|
|
|
33307
33241
|
// src/commands/devlog/next/displayNextEntry.ts
|
|
@@ -33619,12 +33553,12 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
33619
33553
|
}
|
|
33620
33554
|
|
|
33621
33555
|
// src/commands/slack/slackWorkingFile.ts
|
|
33622
|
-
import { join as
|
|
33556
|
+
import { join as join83 } from "path";
|
|
33623
33557
|
function slackWorkingFile(channel, partIndex) {
|
|
33624
33558
|
const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
|
|
33625
|
-
const dir =
|
|
33559
|
+
const dir = join83(getStoreDir(), "slack");
|
|
33626
33560
|
const name2 = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
|
|
33627
|
-
return { dir, bodyPath:
|
|
33561
|
+
return { dir, bodyPath: join83(dir, `${name2}.md`) };
|
|
33628
33562
|
}
|
|
33629
33563
|
|
|
33630
33564
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
@@ -34005,10 +33939,10 @@ function registerDevlogEntryCommands(devlogCommand) {
|
|
|
34005
33939
|
import { execSync as execSync38 } from "child_process";
|
|
34006
33940
|
|
|
34007
33941
|
// src/commands/devlog/loadAllDevLatestWeeks.ts
|
|
34008
|
-
import { readdirSync as
|
|
33942
|
+
import { readdirSync as readdirSync13 } from "fs";
|
|
34009
33943
|
function readRepoDirs(devDir) {
|
|
34010
33944
|
try {
|
|
34011
|
-
return
|
|
33945
|
+
return readdirSync13(devDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
34012
33946
|
} catch {
|
|
34013
33947
|
return [];
|
|
34014
33948
|
}
|
|
@@ -34166,19 +34100,19 @@ async function findPhaseUnlockItem(itemId2, phase) {
|
|
|
34166
34100
|
}
|
|
34167
34101
|
|
|
34168
34102
|
// src/commands/docs/getDocsUnlockPinPath.ts
|
|
34169
|
-
import { join as
|
|
34103
|
+
import { join as join84 } from "path";
|
|
34170
34104
|
function getDocsUnlockPinPath(pin2) {
|
|
34171
|
-
return
|
|
34105
|
+
return join84(getRestrictedDir(), `docs-unlock-pin-${pin2}.json`);
|
|
34172
34106
|
}
|
|
34173
34107
|
|
|
34174
34108
|
// src/commands/docs/readDocsUnlockPinState.ts
|
|
34175
|
-
import { existsSync as
|
|
34109
|
+
import { existsSync as existsSync66, readFileSync as readFileSync54 } from "fs";
|
|
34176
34110
|
function isPositiveInteger(value) {
|
|
34177
34111
|
return Number.isInteger(value) && value > 0;
|
|
34178
34112
|
}
|
|
34179
34113
|
function readDocsUnlockPinState(pin2) {
|
|
34180
34114
|
const path128 = getDocsUnlockPinPath(pin2);
|
|
34181
|
-
if (!
|
|
34115
|
+
if (!existsSync66(path128)) return void 0;
|
|
34182
34116
|
try {
|
|
34183
34117
|
const state = JSON.parse(readFileSync54(path128, "utf8"));
|
|
34184
34118
|
if (state.pin !== pin2) return void 0;
|
|
@@ -34356,13 +34290,13 @@ async function approveSchemaUnlock(state) {
|
|
|
34356
34290
|
}
|
|
34357
34291
|
|
|
34358
34292
|
// src/commands/schema/getSchemaUnlockPinPath.ts
|
|
34359
|
-
import { join as
|
|
34293
|
+
import { join as join85 } from "path";
|
|
34360
34294
|
function getSchemaUnlockPinPath(pin2) {
|
|
34361
|
-
return
|
|
34295
|
+
return join85(getRestrictedDir(), `schema-unlock-pin-${pin2}.json`);
|
|
34362
34296
|
}
|
|
34363
34297
|
|
|
34364
34298
|
// src/commands/schema/readSchemaUnlockPinState.ts
|
|
34365
|
-
import { existsSync as
|
|
34299
|
+
import { existsSync as existsSync67, readFileSync as readFileSync55 } from "fs";
|
|
34366
34300
|
function isPositiveInteger2(value) {
|
|
34367
34301
|
return Number.isInteger(value) && value > 0;
|
|
34368
34302
|
}
|
|
@@ -34387,7 +34321,7 @@ function toState(raw) {
|
|
|
34387
34321
|
}
|
|
34388
34322
|
function readSchemaUnlockPinState(pin2) {
|
|
34389
34323
|
const path128 = getSchemaUnlockPinPath(pin2);
|
|
34390
|
-
if (!
|
|
34324
|
+
if (!existsSync67(path128)) return void 0;
|
|
34391
34325
|
try {
|
|
34392
34326
|
const raw = JSON.parse(readFileSync55(path128, "utf8"));
|
|
34393
34327
|
if (raw.pin !== pin2) return void 0;
|
|
@@ -34516,20 +34450,20 @@ function registerSchema(parent) {
|
|
|
34516
34450
|
}
|
|
34517
34451
|
|
|
34518
34452
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
34519
|
-
import { closeSync as closeSync6, openSync as openSync7, readdirSync as
|
|
34520
|
-
import { join as
|
|
34453
|
+
import { closeSync as closeSync6, openSync as openSync7, readdirSync as readdirSync14 } from "fs";
|
|
34454
|
+
import { join as join86 } from "path";
|
|
34521
34455
|
import chalk182 from "chalk";
|
|
34522
34456
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
34523
34457
|
function isLockedDll(debugDir) {
|
|
34524
34458
|
let files;
|
|
34525
34459
|
try {
|
|
34526
|
-
files =
|
|
34460
|
+
files = readdirSync14(debugDir, { recursive: true });
|
|
34527
34461
|
} catch {
|
|
34528
34462
|
return null;
|
|
34529
34463
|
}
|
|
34530
34464
|
for (const file of files) {
|
|
34531
34465
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
34532
|
-
const dllPath =
|
|
34466
|
+
const dllPath = join86(debugDir, file);
|
|
34533
34467
|
try {
|
|
34534
34468
|
const fd = openSync7(dllPath, "r+");
|
|
34535
34469
|
closeSync6(fd);
|
|
@@ -34542,18 +34476,18 @@ function isLockedDll(debugDir) {
|
|
|
34542
34476
|
function findFirstLockedDll(dir) {
|
|
34543
34477
|
let entries2;
|
|
34544
34478
|
try {
|
|
34545
|
-
entries2 =
|
|
34479
|
+
entries2 = readdirSync14(dir);
|
|
34546
34480
|
} catch {
|
|
34547
34481
|
return null;
|
|
34548
34482
|
}
|
|
34549
34483
|
if (entries2.includes("bin")) {
|
|
34550
|
-
const locked = isLockedDll(
|
|
34484
|
+
const locked = isLockedDll(join86(dir, "bin", "Debug"));
|
|
34551
34485
|
if (locked) return locked;
|
|
34552
34486
|
}
|
|
34553
34487
|
for (const entry of entries2) {
|
|
34554
34488
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
34555
34489
|
continue;
|
|
34556
|
-
const found = findFirstLockedDll(
|
|
34490
|
+
const found = findFirstLockedDll(join86(dir, entry));
|
|
34557
34491
|
if (found) return found;
|
|
34558
34492
|
}
|
|
34559
34493
|
return null;
|
|
@@ -34611,25 +34545,25 @@ function buildTree(csprojPath, repoRoot3, visited = /* @__PURE__ */ new Set()) {
|
|
|
34611
34545
|
}
|
|
34612
34546
|
function collectAllDeps(node) {
|
|
34613
34547
|
const result = /* @__PURE__ */ new Set();
|
|
34614
|
-
function
|
|
34548
|
+
function walk2(n) {
|
|
34615
34549
|
for (const child2 of n.children) {
|
|
34616
34550
|
result.add(child2.path);
|
|
34617
|
-
|
|
34551
|
+
walk2(child2);
|
|
34618
34552
|
}
|
|
34619
34553
|
}
|
|
34620
|
-
|
|
34554
|
+
walk2(node);
|
|
34621
34555
|
return result;
|
|
34622
34556
|
}
|
|
34623
34557
|
|
|
34624
34558
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
34625
|
-
import { readdirSync as
|
|
34559
|
+
import { readdirSync as readdirSync15, readFileSync as readFileSync57, statSync as statSync12 } from "fs";
|
|
34626
34560
|
import path49 from "path";
|
|
34627
34561
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
34628
34562
|
if (depth > maxDepth) return [];
|
|
34629
34563
|
const results = [];
|
|
34630
34564
|
let entries2;
|
|
34631
34565
|
try {
|
|
34632
|
-
entries2 =
|
|
34566
|
+
entries2 = readdirSync15(dir);
|
|
34633
34567
|
} catch {
|
|
34634
34568
|
return results;
|
|
34635
34569
|
}
|
|
@@ -34721,12 +34655,12 @@ function printJson(tree, totalCount, solutions) {
|
|
|
34721
34655
|
}
|
|
34722
34656
|
|
|
34723
34657
|
// src/commands/dotnet/resolveCsproj.ts
|
|
34724
|
-
import { existsSync as
|
|
34658
|
+
import { existsSync as existsSync68 } from "fs";
|
|
34725
34659
|
import path50 from "path";
|
|
34726
34660
|
import chalk184 from "chalk";
|
|
34727
34661
|
function resolveCsproj(csprojPath) {
|
|
34728
34662
|
const resolved2 = path50.resolve(csprojPath);
|
|
34729
|
-
if (!
|
|
34663
|
+
if (!existsSync68(resolved2)) {
|
|
34730
34664
|
console.error(chalk184.red(`File not found: ${resolved2}`));
|
|
34731
34665
|
process.exit(1);
|
|
34732
34666
|
}
|
|
@@ -34894,17 +34828,17 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
34894
34828
|
}
|
|
34895
34829
|
|
|
34896
34830
|
// src/commands/dotnet/resolveSolution.ts
|
|
34897
|
-
import { existsSync as
|
|
34831
|
+
import { existsSync as existsSync69 } from "fs";
|
|
34898
34832
|
import path51 from "path";
|
|
34899
34833
|
import chalk188 from "chalk";
|
|
34900
34834
|
|
|
34901
34835
|
// src/commands/dotnet/findSolution.ts
|
|
34902
|
-
import { readdirSync as
|
|
34903
|
-
import { dirname as dirname37, join as
|
|
34836
|
+
import { readdirSync as readdirSync16 } from "fs";
|
|
34837
|
+
import { dirname as dirname37, join as join87 } from "path";
|
|
34904
34838
|
import chalk187 from "chalk";
|
|
34905
34839
|
function findSlnInDir(dir) {
|
|
34906
34840
|
try {
|
|
34907
|
-
return
|
|
34841
|
+
return readdirSync16(dir).filter((f) => f.endsWith(".sln")).map((f) => join87(dir, f));
|
|
34908
34842
|
} catch {
|
|
34909
34843
|
return [];
|
|
34910
34844
|
}
|
|
@@ -34935,7 +34869,7 @@ function findSolution() {
|
|
|
34935
34869
|
function resolveSolution(sln) {
|
|
34936
34870
|
if (sln) {
|
|
34937
34871
|
const resolved2 = path51.resolve(sln);
|
|
34938
|
-
if (!
|
|
34872
|
+
if (!existsSync69(resolved2)) {
|
|
34939
34873
|
console.error(chalk188.red(`Solution file not found: ${resolved2}`));
|
|
34940
34874
|
process.exit(1);
|
|
34941
34875
|
}
|
|
@@ -34975,7 +34909,7 @@ function parseInspectReport(json) {
|
|
|
34975
34909
|
|
|
34976
34910
|
// src/commands/dotnet/runInspectCode.ts
|
|
34977
34911
|
import { execSync as execSync40 } from "child_process";
|
|
34978
|
-
import { existsSync as
|
|
34912
|
+
import { existsSync as existsSync70, readFileSync as readFileSync58, unlinkSync as unlinkSync13 } from "fs";
|
|
34979
34913
|
import { tmpdir as tmpdir5 } from "os";
|
|
34980
34914
|
import path52 from "path";
|
|
34981
34915
|
import chalk189 from "chalk";
|
|
@@ -35006,7 +34940,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
35006
34940
|
console.error(chalk189.red("jb inspectcode failed"));
|
|
35007
34941
|
process.exit(1);
|
|
35008
34942
|
}
|
|
35009
|
-
if (!
|
|
34943
|
+
if (!existsSync70(reportPath)) {
|
|
35010
34944
|
console.error(chalk189.red("Report file not generated"));
|
|
35011
34945
|
process.exit(1);
|
|
35012
34946
|
}
|
|
@@ -35902,18 +35836,18 @@ async function editHook() {
|
|
|
35902
35836
|
const input = tryParseInput2(await readStdin());
|
|
35903
35837
|
if (!input) return;
|
|
35904
35838
|
const existing = readExisting(input.tool_input.file_path);
|
|
35905
|
-
const
|
|
35839
|
+
const reason6 = decideOverrideGuard(input, existing) ?? decideCommentGuard(
|
|
35906
35840
|
input,
|
|
35907
35841
|
existing,
|
|
35908
35842
|
loadConfig().blockCodeComments?.ignore
|
|
35909
35843
|
) ?? await decidePolicy(input);
|
|
35910
|
-
if (!
|
|
35844
|
+
if (!reason6) return;
|
|
35911
35845
|
console.log(
|
|
35912
35846
|
JSON.stringify({
|
|
35913
35847
|
hookSpecificOutput: {
|
|
35914
35848
|
hookEventName: "PreToolUse",
|
|
35915
35849
|
permissionDecision: "deny",
|
|
35916
|
-
permissionDecisionReason:
|
|
35850
|
+
permissionDecisionReason: reason6
|
|
35917
35851
|
}
|
|
35918
35852
|
})
|
|
35919
35853
|
);
|
|
@@ -35946,7 +35880,7 @@ function aggregateCommitters(authorLists) {
|
|
|
35946
35880
|
import { spawnSync as spawnSync8 } from "child_process";
|
|
35947
35881
|
import { unlinkSync as unlinkSync14, writeFileSync as writeFileSync41 } from "fs";
|
|
35948
35882
|
import { tmpdir as tmpdir6 } from "os";
|
|
35949
|
-
import { join as
|
|
35883
|
+
import { join as join88 } from "path";
|
|
35950
35884
|
function buildArgs3(queryFile, vars) {
|
|
35951
35885
|
const args = ["api", "graphql", "-F", `query=@${queryFile}`];
|
|
35952
35886
|
for (const [key, value] of Object.entries(vars)) {
|
|
@@ -35956,7 +35890,7 @@ function buildArgs3(queryFile, vars) {
|
|
|
35956
35890
|
return args;
|
|
35957
35891
|
}
|
|
35958
35892
|
function runGhGraphql(mutation, vars) {
|
|
35959
|
-
const queryFile =
|
|
35893
|
+
const queryFile = join88(tmpdir6(), `gh-query-${Date.now()}.graphql`);
|
|
35960
35894
|
writeFileSync41(queryFile, mutation);
|
|
35961
35895
|
try {
|
|
35962
35896
|
const result = spawnSync8("gh", buildArgs3(queryFile, vars), {
|
|
@@ -37435,14 +37369,14 @@ function slugFromUrl(url) {
|
|
|
37435
37369
|
import { mkdirSync as mkdirSync30, writeFileSync as writeFileSync42 } from "fs";
|
|
37436
37370
|
|
|
37437
37371
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
37438
|
-
import { join as
|
|
37372
|
+
import { join as join89 } from "path";
|
|
37439
37373
|
function issueWorkingFile(slug2, number) {
|
|
37440
37374
|
const [owner = "unknown", repo = "unknown"] = slug2.split("/");
|
|
37441
|
-
const dir =
|
|
37375
|
+
const dir = join89(getStoreDir(), "github-issues", owner, repo);
|
|
37442
37376
|
return {
|
|
37443
37377
|
dir,
|
|
37444
|
-
bodyPath:
|
|
37445
|
-
metaPath:
|
|
37378
|
+
bodyPath: join89(dir, `${number}.md`),
|
|
37379
|
+
metaPath: join89(dir, `${number}.json`)
|
|
37446
37380
|
};
|
|
37447
37381
|
}
|
|
37448
37382
|
|
|
@@ -37477,10 +37411,10 @@ function fetchIssueToWorkingFile(number, repo) {
|
|
|
37477
37411
|
}
|
|
37478
37412
|
|
|
37479
37413
|
// src/commands/github/issue/resumeIssueBody.ts
|
|
37480
|
-
import { existsSync as
|
|
37414
|
+
import { existsSync as existsSync71, readFileSync as readFileSync59 } from "fs";
|
|
37481
37415
|
function resumeIssueBody(slug2, number, updatedAt) {
|
|
37482
37416
|
const { bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
37483
|
-
if (!
|
|
37417
|
+
if (!existsSync71(bodyPath) || !existsSync71(metaPath)) return void 0;
|
|
37484
37418
|
try {
|
|
37485
37419
|
const meta = JSON.parse(readFileSync59(metaPath, "utf8"));
|
|
37486
37420
|
if (meta.updatedAt !== updatedAt) return void 0;
|
|
@@ -38625,15 +38559,15 @@ function clearStalePrBranch(cwd, branch2) {
|
|
|
38625
38559
|
}
|
|
38626
38560
|
|
|
38627
38561
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
38628
|
-
import { existsSync as
|
|
38562
|
+
import { existsSync as existsSync72 } from "fs";
|
|
38629
38563
|
import { basename as basename22, dirname as dirname39 } from "path";
|
|
38630
38564
|
|
|
38631
38565
|
// src/commands/sessions/daemon/worktree/nextWorktreePath.ts
|
|
38632
|
-
import { basename as basename21, join as
|
|
38566
|
+
import { basename as basename21, join as join90 } from "path";
|
|
38633
38567
|
function nextWorktreePath(clone, base, isTaken) {
|
|
38634
38568
|
const name2 = basename21(clone);
|
|
38635
38569
|
for (let n = 2; n < 1e3; n++) {
|
|
38636
|
-
const candidate =
|
|
38570
|
+
const candidate = join90(base, `${name2}-${n}`);
|
|
38637
38571
|
if (!isTaken(candidate)) return candidate;
|
|
38638
38572
|
}
|
|
38639
38573
|
throw new Error(`no free worktree suffix for ${clone}`);
|
|
@@ -38657,7 +38591,7 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
38657
38591
|
const base = strategy.root ? expandTilde(strategy.root) : dirname39(clone);
|
|
38658
38592
|
const registered = new Set(listWorktreePaths(clone));
|
|
38659
38593
|
const branches = new Set(listLocalBranches(clone));
|
|
38660
|
-
const isTaken = (candidate) => registered.has(candidate) ||
|
|
38594
|
+
const isTaken = (candidate) => registered.has(candidate) || existsSync72(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename22(candidate));
|
|
38661
38595
|
const path128 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
38662
38596
|
const ready = addWorktree(clone, path128, strategy.trunk);
|
|
38663
38597
|
ready.catch(() => {
|
|
@@ -38691,8 +38625,8 @@ async function addWorktree(clone, path128, trunk) {
|
|
|
38691
38625
|
}
|
|
38692
38626
|
|
|
38693
38627
|
// src/commands/sessions/daemon/worktree/keptInTree.ts
|
|
38694
|
-
function keptInTree(cwd,
|
|
38695
|
-
daemonLog(`session kept in ${cwd}: ${
|
|
38628
|
+
function keptInTree(cwd, reason6) {
|
|
38629
|
+
daemonLog(`session kept in ${cwd}: ${reason6}`);
|
|
38696
38630
|
return { cwd, kind: "primary", created: false };
|
|
38697
38631
|
}
|
|
38698
38632
|
|
|
@@ -38899,8 +38833,8 @@ function persistedTreeRoots() {
|
|
|
38899
38833
|
}
|
|
38900
38834
|
|
|
38901
38835
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
38902
|
-
import { copyFileSync as copyFileSync3, existsSync as
|
|
38903
|
-
import { dirname as dirname40, join as
|
|
38836
|
+
import { copyFileSync as copyFileSync3, existsSync as existsSync74, mkdirSync as mkdirSync31 } from "fs";
|
|
38837
|
+
import { dirname as dirname40, join as join92 } from "path";
|
|
38904
38838
|
|
|
38905
38839
|
// src/commands/sessions/daemon/worktree/installPaths.ts
|
|
38906
38840
|
import { resolve as resolve22 } from "path";
|
|
@@ -38930,14 +38864,14 @@ function pendingPathAction(enclosing, states2, paths, stopped) {
|
|
|
38930
38864
|
}
|
|
38931
38865
|
|
|
38932
38866
|
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
38933
|
-
import { existsSync as
|
|
38934
|
-
import { join as
|
|
38867
|
+
import { existsSync as existsSync73 } from "fs";
|
|
38868
|
+
import { join as join91 } from "path";
|
|
38935
38869
|
function detectInstallCommand(dir) {
|
|
38936
|
-
if (!
|
|
38937
|
-
if (
|
|
38938
|
-
if (
|
|
38939
|
-
if (
|
|
38940
|
-
if (
|
|
38870
|
+
if (!existsSync73(join91(dir, "package.json"))) return null;
|
|
38871
|
+
if (existsSync73(join91(dir, "pnpm-lock.yaml"))) return "pnpm install";
|
|
38872
|
+
if (existsSync73(join91(dir, "yarn.lock"))) return "yarn install";
|
|
38873
|
+
if (existsSync73(join91(dir, "bun.lockb"))) return "bun install";
|
|
38874
|
+
if (existsSync73(join91(dir, "package-lock.json"))) return "npm ci";
|
|
38941
38875
|
return "npm install";
|
|
38942
38876
|
}
|
|
38943
38877
|
|
|
@@ -39129,9 +39063,9 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
39129
39063
|
}
|
|
39130
39064
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
39131
39065
|
for (const rel of copy) {
|
|
39132
|
-
const src =
|
|
39133
|
-
if (!
|
|
39134
|
-
const dest =
|
|
39066
|
+
const src = join92(clone, rel);
|
|
39067
|
+
if (!existsSync74(src)) continue;
|
|
39068
|
+
const dest = join92(worktreePath, rel);
|
|
39135
39069
|
try {
|
|
39136
39070
|
mkdirSync31(dirname40(dest), { recursive: true });
|
|
39137
39071
|
copyFileSync3(src, dest);
|
|
@@ -39609,9 +39543,9 @@ async function listModels(options2) {
|
|
|
39609
39543
|
}
|
|
39610
39544
|
});
|
|
39611
39545
|
} catch (error) {
|
|
39612
|
-
const
|
|
39546
|
+
const reason6 = error instanceof Error ? error.message : String(error);
|
|
39613
39547
|
console.error(
|
|
39614
|
-
chalk204.red(`Failed to reach LiteLLM at ${baseUrl2}: ${
|
|
39548
|
+
chalk204.red(`Failed to reach LiteLLM at ${baseUrl2}: ${reason6}`)
|
|
39615
39549
|
);
|
|
39616
39550
|
process.exit(1);
|
|
39617
39551
|
}
|
|
@@ -39635,7 +39569,7 @@ function registerLitellm(program) {
|
|
|
39635
39569
|
}
|
|
39636
39570
|
|
|
39637
39571
|
// src/commands/mermaidExport.ts
|
|
39638
|
-
import { mkdirSync as mkdirSync32, readdirSync as
|
|
39572
|
+
import { mkdirSync as mkdirSync32, readdirSync as readdirSync17 } from "fs";
|
|
39639
39573
|
import { resolve as resolve24 } from "path";
|
|
39640
39574
|
import chalk207 from "chalk";
|
|
39641
39575
|
|
|
@@ -39717,7 +39651,7 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
39717
39651
|
process.exit(1);
|
|
39718
39652
|
}
|
|
39719
39653
|
}
|
|
39720
|
-
const files = file ? [file] :
|
|
39654
|
+
const files = file ? [file] : readdirSync17(process.cwd()).filter((name2) => name2.toLowerCase().endsWith(".md")).sort();
|
|
39721
39655
|
if (files.length === 0) {
|
|
39722
39656
|
console.log(chalk207.gray("No markdown files found in current directory."));
|
|
39723
39657
|
return;
|
|
@@ -39878,10 +39812,10 @@ function applyIgnore(texts, ignore3) {
|
|
|
39878
39812
|
}
|
|
39879
39813
|
|
|
39880
39814
|
// src/commands/miro/readIgnoreList.ts
|
|
39881
|
-
import { existsSync as
|
|
39815
|
+
import { existsSync as existsSync75, readFileSync as readFileSync61 } from "fs";
|
|
39882
39816
|
import { parse as parse2 } from "yaml";
|
|
39883
39817
|
function readIgnoreList(file) {
|
|
39884
|
-
if (!
|
|
39818
|
+
if (!existsSync75(file))
|
|
39885
39819
|
throw new MiroExtractError(
|
|
39886
39820
|
`No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
|
|
39887
39821
|
);
|
|
@@ -40366,15 +40300,15 @@ function createNetcapHandler(options2) {
|
|
|
40366
40300
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
40367
40301
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
40368
40302
|
import { networkInterfaces } from "os";
|
|
40369
|
-
import { join as
|
|
40303
|
+
import { join as join94 } from "path";
|
|
40370
40304
|
import chalk210 from "chalk";
|
|
40371
40305
|
|
|
40372
40306
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
40373
|
-
import { dirname as dirname42, join as
|
|
40307
|
+
import { dirname as dirname42, join as join93 } from "path";
|
|
40374
40308
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
40375
40309
|
var moduleDir2 = dirname42(fileURLToPath8(import.meta.url));
|
|
40376
40310
|
function netcapExtensionDir() {
|
|
40377
|
-
return
|
|
40311
|
+
return join93(moduleDir2, "commands", "netcap", "netcap-extension");
|
|
40378
40312
|
}
|
|
40379
40313
|
|
|
40380
40314
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
@@ -40389,7 +40323,7 @@ function lanIPv4() {
|
|
|
40389
40323
|
return void 0;
|
|
40390
40324
|
}
|
|
40391
40325
|
async function configureBackground(dir, host, port, filter) {
|
|
40392
|
-
const file =
|
|
40326
|
+
const file = join94(dir, "background.js");
|
|
40393
40327
|
const source = await readFile7(file, "utf8");
|
|
40394
40328
|
await writeFile6(
|
|
40395
40329
|
file,
|
|
@@ -40429,20 +40363,20 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
40429
40363
|
}
|
|
40430
40364
|
|
|
40431
40365
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
40432
|
-
import { isAbsolute as isAbsolute6, join as
|
|
40366
|
+
import { isAbsolute as isAbsolute6, join as join96, resolve as resolve26 } from "path";
|
|
40433
40367
|
|
|
40434
40368
|
// src/commands/netcap/defaultCapturePath.ts
|
|
40435
40369
|
import { homedir as homedir26 } from "os";
|
|
40436
|
-
import { join as
|
|
40370
|
+
import { join as join95 } from "path";
|
|
40437
40371
|
function defaultCapturePath() {
|
|
40438
|
-
return
|
|
40372
|
+
return join95(homedir26(), ".assist", "netcap", "capture.jsonl");
|
|
40439
40373
|
}
|
|
40440
40374
|
|
|
40441
40375
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
40442
40376
|
function resolveNetcapOutPath(out) {
|
|
40443
40377
|
if (!out) return defaultCapturePath();
|
|
40444
40378
|
const dir = isAbsolute6(out) ? out : resolve26(process.cwd(), out);
|
|
40445
|
-
return
|
|
40379
|
+
return join96(dir, "capture.jsonl");
|
|
40446
40380
|
}
|
|
40447
40381
|
|
|
40448
40382
|
// src/commands/netcap/netcap.ts
|
|
@@ -40489,7 +40423,7 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
|
|
|
40489
40423
|
|
|
40490
40424
|
// src/commands/netcap/netcapExtract.ts
|
|
40491
40425
|
import { writeFileSync as writeFileSync45 } from "fs";
|
|
40492
|
-
import { join as
|
|
40426
|
+
import { join as join97 } from "path";
|
|
40493
40427
|
import chalk212 from "chalk";
|
|
40494
40428
|
|
|
40495
40429
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
@@ -40934,7 +40868,7 @@ function extractPostsFromCapture(captureFile) {
|
|
|
40934
40868
|
function netcapExtract(file) {
|
|
40935
40869
|
const captureFile = file ?? defaultCapturePath();
|
|
40936
40870
|
const posts = extractPostsFromCapture(captureFile);
|
|
40937
|
-
const outFile =
|
|
40871
|
+
const outFile = join97(captureFile, "..", "posts.json");
|
|
40938
40872
|
writeFileSync45(outFile, `${JSON.stringify(posts, null, 2)}
|
|
40939
40873
|
`);
|
|
40940
40874
|
console.log(
|
|
@@ -41330,9 +41264,9 @@ async function comment2(path128, line, body, options2 = {}) {
|
|
|
41330
41264
|
|
|
41331
41265
|
// src/commands/prs/commentsCachePath.ts
|
|
41332
41266
|
import { homedir as homedir27 } from "os";
|
|
41333
|
-
import { join as
|
|
41267
|
+
import { join as join98 } from "path";
|
|
41334
41268
|
function commentsCachePath(org, repo, prNumber) {
|
|
41335
|
-
return
|
|
41269
|
+
return join98(
|
|
41336
41270
|
homedir27(),
|
|
41337
41271
|
".assist",
|
|
41338
41272
|
"pr-comments",
|
|
@@ -41348,11 +41282,11 @@ import { dirname as dirname44 } from "path";
|
|
|
41348
41282
|
import { stringify as stringify3 } from "yaml";
|
|
41349
41283
|
|
|
41350
41284
|
// src/commands/prs/loadCommentsCache.ts
|
|
41351
|
-
import { existsSync as
|
|
41285
|
+
import { existsSync as existsSync76, readFileSync as readFileSync64, unlinkSync as unlinkSync15 } from "fs";
|
|
41352
41286
|
import { parse as parse3 } from "yaml";
|
|
41353
41287
|
function loadCommentsCache(org, repo, prNumber) {
|
|
41354
41288
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
41355
|
-
if (!
|
|
41289
|
+
if (!existsSync76(cachePath)) {
|
|
41356
41290
|
return null;
|
|
41357
41291
|
}
|
|
41358
41292
|
const content = readFileSync64(cachePath, "utf8");
|
|
@@ -41360,26 +41294,26 @@ function loadCommentsCache(org, repo, prNumber) {
|
|
|
41360
41294
|
}
|
|
41361
41295
|
function deleteCommentsCache(org, repo, prNumber) {
|
|
41362
41296
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
41363
|
-
if (
|
|
41297
|
+
if (existsSync76(cachePath)) {
|
|
41364
41298
|
unlinkSync15(cachePath);
|
|
41365
41299
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
41366
41300
|
}
|
|
41367
41301
|
}
|
|
41368
41302
|
|
|
41369
41303
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
41370
|
-
import { readdirSync as
|
|
41371
|
-
import { join as
|
|
41304
|
+
import { readdirSync as readdirSync18, unlinkSync as unlinkSync16 } from "fs";
|
|
41305
|
+
import { join as join99 } from "path";
|
|
41372
41306
|
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
41373
41307
|
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
41374
|
-
const dir =
|
|
41308
|
+
const dir = join99(cwd, ".assist");
|
|
41375
41309
|
let entries2;
|
|
41376
41310
|
try {
|
|
41377
|
-
entries2 =
|
|
41311
|
+
entries2 = readdirSync18(dir);
|
|
41378
41312
|
} catch {
|
|
41379
41313
|
return;
|
|
41380
41314
|
}
|
|
41381
41315
|
for (const entry of entries2.filter((e) => STALE_PATTERN.test(e))) {
|
|
41382
|
-
unlinkSync16(
|
|
41316
|
+
unlinkSync16(join99(dir, entry));
|
|
41383
41317
|
}
|
|
41384
41318
|
}
|
|
41385
41319
|
|
|
@@ -41497,7 +41431,7 @@ function failAzureDevops(error) {
|
|
|
41497
41431
|
import { execFileSync as execFileSync23 } from "child_process";
|
|
41498
41432
|
import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as writeFileSync47 } from "fs";
|
|
41499
41433
|
import { tmpdir as tmpdir7 } from "os";
|
|
41500
|
-
import { join as
|
|
41434
|
+
import { join as join100 } from "path";
|
|
41501
41435
|
function azDevopsInvokeArgs(request, inFile) {
|
|
41502
41436
|
return [
|
|
41503
41437
|
"devops",
|
|
@@ -41532,8 +41466,8 @@ function runAz2(args) {
|
|
|
41532
41466
|
}
|
|
41533
41467
|
function invokeAzDevops(request) {
|
|
41534
41468
|
if (request.body === void 0) return runAz2(azDevopsInvokeArgs(request));
|
|
41535
|
-
const dir = mkdtempSync2(
|
|
41536
|
-
const inFile =
|
|
41469
|
+
const dir = mkdtempSync2(join100(tmpdir7(), "assist-az-"));
|
|
41470
|
+
const inFile = join100(dir, "body.json");
|
|
41537
41471
|
try {
|
|
41538
41472
|
writeFileSync47(inFile, JSON.stringify(request.body));
|
|
41539
41473
|
return runAz2(azDevopsInvokeArgs(request, inFile));
|
|
@@ -42062,17 +41996,17 @@ async function reply(commentId, body) {
|
|
|
42062
41996
|
|
|
42063
41997
|
// src/commands/prs/wontfix.ts
|
|
42064
41998
|
import { execSync as execSync47 } from "child_process";
|
|
42065
|
-
function validateReason(
|
|
42066
|
-
const lowerReason =
|
|
41999
|
+
function validateReason(reason6) {
|
|
42000
|
+
const lowerReason = reason6.toLowerCase();
|
|
42067
42001
|
if (lowerReason.includes("claude") || lowerReason.includes("opus")) {
|
|
42068
42002
|
console.error('Error: Reason must not contain "claude" or "opus"');
|
|
42069
42003
|
process.exit(1);
|
|
42070
42004
|
}
|
|
42071
|
-
rejectHarnessAttribution("Reason",
|
|
42005
|
+
rejectHarnessAttribution("Reason", reason6);
|
|
42072
42006
|
}
|
|
42073
|
-
function validateShaReferences(
|
|
42007
|
+
function validateShaReferences(reason6) {
|
|
42074
42008
|
const commitLinkPattern = /\[[0-9a-f]{7}\]\(https:\/\/(?:github\.com\/[^/]+\/[^/]+|dev\.azure\.com\/[^/]+\/[^/]+\/_git\/[^/]+)\/commit\/([0-9a-f]{40})\)/gi;
|
|
42075
|
-
const shas = Array.from(
|
|
42009
|
+
const shas = Array.from(reason6.matchAll(commitLinkPattern), (m) => m[1]);
|
|
42076
42010
|
if (shas.length === 0) {
|
|
42077
42011
|
return;
|
|
42078
42012
|
}
|
|
@@ -42091,16 +42025,16 @@ function validateShaReferences(reason4) {
|
|
|
42091
42025
|
process.exit(1);
|
|
42092
42026
|
}
|
|
42093
42027
|
}
|
|
42094
|
-
async function wontfix(commentId,
|
|
42095
|
-
validateReason(
|
|
42096
|
-
validateShaReferences(
|
|
42028
|
+
async function wontfix(commentId, reason6) {
|
|
42029
|
+
validateReason(reason6);
|
|
42030
|
+
validateShaReferences(reason6);
|
|
42097
42031
|
await reviewProposedPrComment(
|
|
42098
42032
|
`Won't fix comment #${commentId}`,
|
|
42099
|
-
|
|
42033
|
+
reason6,
|
|
42100
42034
|
null
|
|
42101
42035
|
);
|
|
42102
42036
|
try {
|
|
42103
|
-
resolveCommentWithReply(commentId,
|
|
42037
|
+
resolveCommentWithReply(commentId, reason6, "wontFix");
|
|
42104
42038
|
} catch (error) {
|
|
42105
42039
|
if (isGhNotInstalled(error)) {
|
|
42106
42040
|
console.error("Error: GitHub CLI (gh) is not installed.");
|
|
@@ -42122,10 +42056,10 @@ function registerPrsThreadReplies(prsCommand, calledBy5) {
|
|
|
42122
42056
|
internalCommand(
|
|
42123
42057
|
prsCommand.command("wontfix <comment-id> <reason>").description(
|
|
42124
42058
|
"Reply with reason and resolve thread (reason of - reads it from stdin)"
|
|
42125
|
-
).action(async (commentId,
|
|
42059
|
+
).action(async (commentId, reason6) => {
|
|
42126
42060
|
await wontfix(
|
|
42127
42061
|
Number.parseInt(commentId, 10),
|
|
42128
|
-
await readBodyArgument(
|
|
42062
|
+
await readBodyArgument(reason6)
|
|
42129
42063
|
);
|
|
42130
42064
|
}),
|
|
42131
42065
|
calledBy5
|
|
@@ -42728,8 +42662,8 @@ function resolvePrNumber(prNumber) {
|
|
|
42728
42662
|
return null;
|
|
42729
42663
|
}
|
|
42730
42664
|
}
|
|
42731
|
-
function warn(
|
|
42732
|
-
console.error(`Warning: could not chain sessions after raising: ${
|
|
42665
|
+
function warn(reason6) {
|
|
42666
|
+
console.error(`Warning: could not chain sessions after raising: ${reason6}`);
|
|
42733
42667
|
}
|
|
42734
42668
|
|
|
42735
42669
|
// src/commands/prs/enableAutoMerge.ts
|
|
@@ -44663,9 +44597,9 @@ async function notify() {
|
|
|
44663
44597
|
|
|
44664
44598
|
// src/commands/screenshot.ts
|
|
44665
44599
|
import { execSync as execSync54 } from "child_process";
|
|
44666
|
-
import { existsSync as
|
|
44600
|
+
import { existsSync as existsSync77, mkdirSync as mkdirSync35, unlinkSync as unlinkSync17, writeFileSync as writeFileSync48 } from "fs";
|
|
44667
44601
|
import { tmpdir as tmpdir8 } from "os";
|
|
44668
|
-
import { join as
|
|
44602
|
+
import { join as join101, resolve as resolve28 } from "path";
|
|
44669
44603
|
import chalk239 from "chalk";
|
|
44670
44604
|
|
|
44671
44605
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -44795,14 +44729,14 @@ Write-Output $OutputPath
|
|
|
44795
44729
|
|
|
44796
44730
|
// src/commands/screenshot.ts
|
|
44797
44731
|
function buildOutputPath(outputDir, processName) {
|
|
44798
|
-
if (!
|
|
44732
|
+
if (!existsSync77(outputDir)) {
|
|
44799
44733
|
mkdirSync35(outputDir, { recursive: true });
|
|
44800
44734
|
}
|
|
44801
44735
|
const timestamp9 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
44802
44736
|
return resolve28(outputDir, `${processName}-${timestamp9}.png`);
|
|
44803
44737
|
}
|
|
44804
44738
|
function runPowerShellScript(processName, outputPath) {
|
|
44805
|
-
const scriptPath =
|
|
44739
|
+
const scriptPath = join101(tmpdir8(), `assist-screenshot-${Date.now()}.ps1`);
|
|
44806
44740
|
writeFileSync48(scriptPath, captureWindowPs1, "utf8");
|
|
44807
44741
|
try {
|
|
44808
44742
|
execSync54(
|
|
@@ -44904,9 +44838,9 @@ function buildLimitsSegment(rateLimits) {
|
|
|
44904
44838
|
|
|
44905
44839
|
// src/commands/readGitBranch.ts
|
|
44906
44840
|
import { readFileSync as readFileSync67, statSync as statSync14 } from "fs";
|
|
44907
|
-
import { isAbsolute as isAbsolute7, join as
|
|
44841
|
+
import { isAbsolute as isAbsolute7, join as join102, resolve as resolve29 } from "path";
|
|
44908
44842
|
function resolveGitDir(cwd) {
|
|
44909
|
-
const dotGit =
|
|
44843
|
+
const dotGit = join102(cwd, ".git");
|
|
44910
44844
|
let stat5;
|
|
44911
44845
|
try {
|
|
44912
44846
|
stat5 = statSync14(dotGit);
|
|
@@ -44936,7 +44870,7 @@ function readGitBranch(cwd) {
|
|
|
44936
44870
|
}
|
|
44937
44871
|
let head;
|
|
44938
44872
|
try {
|
|
44939
|
-
head = readFileSync67(
|
|
44873
|
+
head = readFileSync67(join102(gitDir, "HEAD"), "utf8");
|
|
44940
44874
|
} catch {
|
|
44941
44875
|
return null;
|
|
44942
44876
|
}
|
|
@@ -46553,8 +46487,8 @@ function moduleStem(file) {
|
|
|
46553
46487
|
function sorted(set) {
|
|
46554
46488
|
return [...set ?? []].sort();
|
|
46555
46489
|
}
|
|
46556
|
-
function root(
|
|
46557
|
-
return { root: true, anchors: [], reason:
|
|
46490
|
+
function root(reason6) {
|
|
46491
|
+
return { root: true, anchors: [], reason: reason6 };
|
|
46558
46492
|
}
|
|
46559
46493
|
function pin(anchoring) {
|
|
46560
46494
|
if (anchoring.root) return anchoring;
|
|
@@ -46614,8 +46548,8 @@ function findCollisions(targets, scopeRoot) {
|
|
|
46614
46548
|
}
|
|
46615
46549
|
return [...byModule].filter(([, files]) => files.length > 1).map(([key, files]) => {
|
|
46616
46550
|
const where = path81.relative(scopeRoot, path81.dirname(key)) || ".";
|
|
46617
|
-
const
|
|
46618
|
-
return `Basename collision in ${where}/: ${
|
|
46551
|
+
const sources2 = files.sort().map((f) => path81.relative(scopeRoot, f));
|
|
46552
|
+
return `Basename collision in ${where}/: ${sources2.join(", ")}`;
|
|
46619
46553
|
}).sort();
|
|
46620
46554
|
}
|
|
46621
46555
|
|
|
@@ -46803,10 +46737,10 @@ function planRestructure(input) {
|
|
|
46803
46737
|
const targets = /* @__PURE__ */ new Map();
|
|
46804
46738
|
const moves = [];
|
|
46805
46739
|
for (const file of files) {
|
|
46806
|
-
const { dir, reason:
|
|
46740
|
+
const { dir, reason: reason6 } = placements.get(file);
|
|
46807
46741
|
const to = path86.join(dir, path86.basename(file));
|
|
46808
46742
|
targets.set(file, to);
|
|
46809
|
-
if (to !== file) moves.push({ from: file, to, reason:
|
|
46743
|
+
if (to !== file) moves.push({ from: file, to, reason: reason6 });
|
|
46810
46744
|
}
|
|
46811
46745
|
return { targets, moves, errors: findCollisions(targets, scopeRoot) };
|
|
46812
46746
|
}
|
|
@@ -48112,12 +48046,12 @@ function formatSlicingRequest(hunks) {
|
|
|
48112
48046
|
}
|
|
48113
48047
|
|
|
48114
48048
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
48115
|
-
import { join as
|
|
48049
|
+
import { join as join103 } from "path";
|
|
48116
48050
|
function slug(value) {
|
|
48117
48051
|
return value.replace(/[^\w.-]+/g, "-");
|
|
48118
48052
|
}
|
|
48119
48053
|
function highLevelReviewPath(repo, headRef, headSha) {
|
|
48120
|
-
return
|
|
48054
|
+
return join103(
|
|
48121
48055
|
getStoreDir(),
|
|
48122
48056
|
"high-level-reviews",
|
|
48123
48057
|
slug(repo),
|
|
@@ -48169,9 +48103,9 @@ function listHighLevelHunks(files) {
|
|
|
48169
48103
|
}
|
|
48170
48104
|
|
|
48171
48105
|
// src/commands/review/highLevel/readJsonFile.ts
|
|
48172
|
-
import { existsSync as
|
|
48106
|
+
import { existsSync as existsSync78, readFileSync as readFileSync68 } from "fs";
|
|
48173
48107
|
function readJsonFile(path128) {
|
|
48174
|
-
if (!
|
|
48108
|
+
if (!existsSync78(path128)) return void 0;
|
|
48175
48109
|
try {
|
|
48176
48110
|
return JSON.parse(readFileSync68(path128, "utf8"));
|
|
48177
48111
|
} catch {
|
|
@@ -49280,7 +49214,7 @@ import { format } from "util";
|
|
|
49280
49214
|
|
|
49281
49215
|
// src/commands/review/createReviewLogSink.ts
|
|
49282
49216
|
import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync37 } from "fs";
|
|
49283
|
-
import { join as
|
|
49217
|
+
import { join as join104 } from "path";
|
|
49284
49218
|
var LOG_FILE = "review.log";
|
|
49285
49219
|
function createReviewLogSink() {
|
|
49286
49220
|
let logPath2;
|
|
@@ -49297,7 +49231,7 @@ function createReviewLogSink() {
|
|
|
49297
49231
|
},
|
|
49298
49232
|
attach(reviewDir) {
|
|
49299
49233
|
mkdirSync37(reviewDir, { recursive: true });
|
|
49300
|
-
logPath2 =
|
|
49234
|
+
logPath2 = join104(reviewDir, LOG_FILE);
|
|
49301
49235
|
const lines = [
|
|
49302
49236
|
"",
|
|
49303
49237
|
`=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
|
|
@@ -49636,7 +49570,7 @@ async function runReviewers(reviewers, context) {
|
|
|
49636
49570
|
}
|
|
49637
49571
|
|
|
49638
49572
|
// src/commands/review/synthesiseAfterReviewers.ts
|
|
49639
|
-
import { existsSync as
|
|
49573
|
+
import { existsSync as existsSync79, unlinkSync as unlinkSync18 } from "fs";
|
|
49640
49574
|
|
|
49641
49575
|
// src/commands/review/synthesise.ts
|
|
49642
49576
|
import { readFileSync as readFileSync70 } from "fs";
|
|
@@ -49870,7 +49804,7 @@ async function synthesise(paths, options2) {
|
|
|
49870
49804
|
// src/commands/review/synthesiseAfterReviewers.ts
|
|
49871
49805
|
async function synthesiseAfterReviewers(input) {
|
|
49872
49806
|
const { paths, failures } = input;
|
|
49873
|
-
if (input.anyFresh &&
|
|
49807
|
+
if (input.anyFresh && existsSync79(paths.synthesisPath)) {
|
|
49874
49808
|
unlinkSync18(paths.synthesisPath);
|
|
49875
49809
|
}
|
|
49876
49810
|
const synthesisResult = await synthesise(paths, { multi: input.multi });
|
|
@@ -49905,9 +49839,9 @@ async function runAndSynthesise(args) {
|
|
|
49905
49839
|
});
|
|
49906
49840
|
if (args.job) await recordReviewerRuns(fresh, args.job, startedAt);
|
|
49907
49841
|
const failures = failed2(results);
|
|
49908
|
-
const
|
|
49909
|
-
if (
|
|
49910
|
-
console.error(
|
|
49842
|
+
const reason6 = skipReason(results, failures);
|
|
49843
|
+
if (reason6) {
|
|
49844
|
+
console.error(reason6);
|
|
49911
49845
|
return { ok: false, failures, slots: results };
|
|
49912
49846
|
}
|
|
49913
49847
|
return synthesiseAfterReviewers({
|
|
@@ -50084,9 +50018,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
50084
50018
|
|
|
50085
50019
|
// src/commands/review/buildReviewPaths.ts
|
|
50086
50020
|
import { homedir as homedir28 } from "os";
|
|
50087
|
-
import { basename as basename27, join as
|
|
50021
|
+
import { basename as basename27, join as join105 } from "path";
|
|
50088
50022
|
function buildReviewPaths(repoRoot3, key) {
|
|
50089
|
-
const reviewDir =
|
|
50023
|
+
const reviewDir = join105(
|
|
50090
50024
|
homedir28(),
|
|
50091
50025
|
".assist",
|
|
50092
50026
|
"reviews",
|
|
@@ -50095,10 +50029,10 @@ function buildReviewPaths(repoRoot3, key) {
|
|
|
50095
50029
|
);
|
|
50096
50030
|
return {
|
|
50097
50031
|
reviewDir,
|
|
50098
|
-
requestPath:
|
|
50099
|
-
claudePath:
|
|
50100
|
-
codexPath:
|
|
50101
|
-
synthesisPath:
|
|
50032
|
+
requestPath: join105(reviewDir, "request.md"),
|
|
50033
|
+
claudePath: join105(reviewDir, "claude.md"),
|
|
50034
|
+
codexPath: join105(reviewDir, "codex.md"),
|
|
50035
|
+
synthesisPath: join105(reviewDir, "synthesis.md")
|
|
50102
50036
|
};
|
|
50103
50037
|
}
|
|
50104
50038
|
|
|
@@ -50136,10 +50070,10 @@ function fetchExistingComments() {
|
|
|
50136
50070
|
}
|
|
50137
50071
|
|
|
50138
50072
|
// src/commands/review/prepareReviewDir.ts
|
|
50139
|
-
import { existsSync as
|
|
50073
|
+
import { existsSync as existsSync80, mkdirSync as mkdirSync38, unlinkSync as unlinkSync19, writeFileSync as writeFileSync50 } from "fs";
|
|
50140
50074
|
function clearReviewFiles(paths) {
|
|
50141
50075
|
for (const path128 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
50142
|
-
if (
|
|
50076
|
+
if (existsSync80(path128)) unlinkSync19(path128);
|
|
50143
50077
|
}
|
|
50144
50078
|
}
|
|
50145
50079
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -51045,7 +50979,7 @@ import path101 from "path";
|
|
|
51045
50979
|
import chalk276 from "chalk";
|
|
51046
50980
|
|
|
51047
50981
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
51048
|
-
import { existsSync as
|
|
50982
|
+
import { existsSync as existsSync81, readFileSync as readFileSync73, writeFileSync as writeFileSync51 } from "fs";
|
|
51049
50983
|
import path100 from "path";
|
|
51050
50984
|
|
|
51051
50985
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
@@ -51053,12 +50987,12 @@ import { readFileSync as readFileSync72 } from "fs";
|
|
|
51053
50987
|
import path99 from "path";
|
|
51054
50988
|
|
|
51055
50989
|
// src/commands/rules/findClaudeFiles.ts
|
|
51056
|
-
import { readdirSync as
|
|
50990
|
+
import { readdirSync as readdirSync19 } from "fs";
|
|
51057
50991
|
import path98 from "path";
|
|
51058
50992
|
var SKIP_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage"]);
|
|
51059
50993
|
function findClaudeFiles(dir) {
|
|
51060
50994
|
const results = [];
|
|
51061
|
-
for (const entry of
|
|
50995
|
+
for (const entry of readdirSync19(dir, { withFileTypes: true })) {
|
|
51062
50996
|
if (entry.isDirectory()) {
|
|
51063
50997
|
if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name))
|
|
51064
50998
|
continue;
|
|
@@ -51115,7 +51049,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
51115
51049
|
function updateScopedRulesIndex(root2) {
|
|
51116
51050
|
const directories = scopedRuleDirectories(root2);
|
|
51117
51051
|
const rootFile = path100.join(root2, "CLAUDE.md");
|
|
51118
|
-
const before =
|
|
51052
|
+
const before = existsSync81(rootFile) ? readFileSync73(rootFile, "utf8") : "";
|
|
51119
51053
|
const after = upsertScopedRulesPointer(before, directories);
|
|
51120
51054
|
if (after !== before) writeFileSync51(rootFile, after);
|
|
51121
51055
|
return directories;
|
|
@@ -51168,7 +51102,7 @@ function listRules(target, options2 = {}) {
|
|
|
51168
51102
|
}
|
|
51169
51103
|
|
|
51170
51104
|
// src/commands/rules/addRule.ts
|
|
51171
|
-
import { existsSync as
|
|
51105
|
+
import { existsSync as existsSync83, readFileSync as readFileSync75, writeFileSync as writeFileSync52 } from "fs";
|
|
51172
51106
|
import path104 from "path";
|
|
51173
51107
|
import chalk278 from "chalk";
|
|
51174
51108
|
|
|
@@ -51205,7 +51139,7 @@ function nextRuleCode(root2) {
|
|
|
51205
51139
|
}
|
|
51206
51140
|
|
|
51207
51141
|
// src/commands/rules/resolveRuleScope.ts
|
|
51208
|
-
import { existsSync as
|
|
51142
|
+
import { existsSync as existsSync82 } from "fs";
|
|
51209
51143
|
import path103 from "path";
|
|
51210
51144
|
function resolveRuleScope(target) {
|
|
51211
51145
|
const resolved2 = path103.resolve(target);
|
|
@@ -51215,7 +51149,7 @@ function resolveRuleScope(target) {
|
|
|
51215
51149
|
let current2 = startDir;
|
|
51216
51150
|
while (true) {
|
|
51217
51151
|
const candidate = path103.join(current2, "CLAUDE.md");
|
|
51218
|
-
if (
|
|
51152
|
+
if (existsSync82(candidate)) return candidate;
|
|
51219
51153
|
if (current2 === root2 || current2 === path103.dirname(current2)) break;
|
|
51220
51154
|
current2 = path103.dirname(current2);
|
|
51221
51155
|
}
|
|
@@ -51224,7 +51158,7 @@ function resolveRuleScope(target) {
|
|
|
51224
51158
|
|
|
51225
51159
|
// src/commands/rules/addRule.ts
|
|
51226
51160
|
function read3(file) {
|
|
51227
|
-
return
|
|
51161
|
+
return existsSync83(file) ? readFileSync75(file, "utf8") : "";
|
|
51228
51162
|
}
|
|
51229
51163
|
function addRule(text18, options2) {
|
|
51230
51164
|
const rule = text18.trim();
|
|
@@ -52361,9 +52295,9 @@ function pruneEntry(entry, targetDir, keep, shape, options2, result) {
|
|
|
52361
52295
|
return;
|
|
52362
52296
|
}
|
|
52363
52297
|
result.orphans.push(entry.name);
|
|
52364
|
-
const
|
|
52365
|
-
if (
|
|
52366
|
-
result.skipped.push({ name: entry.name, reason:
|
|
52298
|
+
const reason6 = options2.owner.owns(entryPath) ? void 0 : shape.blockedBy?.(entryPath);
|
|
52299
|
+
if (reason6) {
|
|
52300
|
+
result.skipped.push({ name: entry.name, reason: reason6 });
|
|
52367
52301
|
return;
|
|
52368
52302
|
}
|
|
52369
52303
|
if (!options2.force) return;
|
|
@@ -52439,8 +52373,8 @@ function reportPrune(label, result, force) {
|
|
|
52439
52373
|
}
|
|
52440
52374
|
if (result.skipped.length > 0) {
|
|
52441
52375
|
console.log(`Left in place in ${label} (not written by sync):`);
|
|
52442
|
-
for (const { name: name2, reason:
|
|
52443
|
-
console.log(` ${name2} - ${
|
|
52376
|
+
for (const { name: name2, reason: reason6 } of result.skipped) {
|
|
52377
|
+
console.log(` ${name2} - ${reason6}`);
|
|
52444
52378
|
}
|
|
52445
52379
|
}
|
|
52446
52380
|
if (result.unmanaged.length === 0) return;
|
|
@@ -52547,12 +52481,12 @@ var retired = [
|
|
|
52547
52481
|
path114.join(harnesses.pi.homeDir, "AGENTS.md")
|
|
52548
52482
|
];
|
|
52549
52483
|
function reportRetiredAgentsFiles() {
|
|
52550
|
-
const
|
|
52551
|
-
if (
|
|
52484
|
+
const leftovers = retired.filter((file) => fs61.existsSync(file));
|
|
52485
|
+
if (leftovers.length === 0) return;
|
|
52552
52486
|
console.log(
|
|
52553
52487
|
"No longer written by sync \u2014 each harness now composes its own advice at session start:"
|
|
52554
52488
|
);
|
|
52555
|
-
for (const file of
|
|
52489
|
+
for (const file of leftovers) console.log(` ${file}`);
|
|
52556
52490
|
console.log(
|
|
52557
52491
|
" Delete them, or they keep injecting the retired global instructions."
|
|
52558
52492
|
);
|
|
@@ -53011,7 +52945,7 @@ function registerTestflight(program) {
|
|
|
53011
52945
|
}
|
|
53012
52946
|
|
|
53013
52947
|
// src/commands/transcript/clean.ts
|
|
53014
|
-
import { existsSync as
|
|
52948
|
+
import { existsSync as existsSync92 } from "fs";
|
|
53015
52949
|
|
|
53016
52950
|
// src/commands/transcript/convert/formatTimestamp.ts
|
|
53017
52951
|
function pad2(value, width2) {
|
|
@@ -53289,7 +53223,7 @@ function clean(file, options2 = {}) {
|
|
|
53289
53223
|
);
|
|
53290
53224
|
process.exit(1);
|
|
53291
53225
|
}
|
|
53292
|
-
if (!
|
|
53226
|
+
if (!existsSync92(file)) {
|
|
53293
53227
|
console.error(`Error: VTT file not found: ${file}`);
|
|
53294
53228
|
process.exit(1);
|
|
53295
53229
|
}
|
|
@@ -53372,21 +53306,21 @@ async function configure() {
|
|
|
53372
53306
|
}
|
|
53373
53307
|
|
|
53374
53308
|
// src/commands/transcript/list.ts
|
|
53375
|
-
import { existsSync as
|
|
53376
|
-
import { join as
|
|
53309
|
+
import { existsSync as existsSync93, readdirSync as readdirSync25, statSync as statSync17 } from "fs";
|
|
53310
|
+
import { join as join122 } from "path";
|
|
53377
53311
|
function list5() {
|
|
53378
53312
|
const { vttDir } = getTranscriptConfig();
|
|
53379
|
-
if (!
|
|
53380
|
-
for (const entry of
|
|
53313
|
+
if (!existsSync93(vttDir)) return;
|
|
53314
|
+
for (const entry of readdirSync25(vttDir)) {
|
|
53381
53315
|
if (!entry.endsWith(".vtt")) continue;
|
|
53382
|
-
if (statSync17(
|
|
53316
|
+
if (statSync17(join122(vttDir, entry)).isDirectory()) continue;
|
|
53383
53317
|
console.log(entry);
|
|
53384
53318
|
}
|
|
53385
53319
|
}
|
|
53386
53320
|
|
|
53387
53321
|
// src/commands/transcript/move.ts
|
|
53388
|
-
import { existsSync as
|
|
53389
|
-
import { basename as basename31, join as
|
|
53322
|
+
import { existsSync as existsSync94, mkdirSync as mkdirSync41, renameSync as renameSync5, writeFileSync as writeFileSync56 } from "fs";
|
|
53323
|
+
import { basename as basename31, join as join123 } from "path";
|
|
53390
53324
|
|
|
53391
53325
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
53392
53326
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -53396,9 +53330,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
53396
53330
|
// src/commands/transcript/move.ts
|
|
53397
53331
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
53398
53332
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
53399
|
-
const processedDir =
|
|
53333
|
+
const processedDir = join123(vttDir, "processed");
|
|
53400
53334
|
mkdirSync41(processedDir, { recursive: true });
|
|
53401
|
-
renameSync5(sourcePath,
|
|
53335
|
+
renameSync5(sourcePath, join123(processedDir, filename));
|
|
53402
53336
|
}
|
|
53403
53337
|
function move(file, options2) {
|
|
53404
53338
|
const { date, client } = options2;
|
|
@@ -53408,25 +53342,25 @@ function move(file, options2) {
|
|
|
53408
53342
|
}
|
|
53409
53343
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
53410
53344
|
const filename = basename31(file);
|
|
53411
|
-
const sourcePath =
|
|
53412
|
-
if (!
|
|
53345
|
+
const sourcePath = join123(vttDir, filename);
|
|
53346
|
+
if (!existsSync94(sourcePath)) {
|
|
53413
53347
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
53414
53348
|
process.exit(1);
|
|
53415
53349
|
}
|
|
53416
53350
|
const base = basename31(filename, ".vtt").replace(/ Transcription$/, "");
|
|
53417
53351
|
const outputName = `${date} ${base}.md`;
|
|
53418
|
-
const formattedDir =
|
|
53352
|
+
const formattedDir = join123(transcriptsDir, client);
|
|
53419
53353
|
mkdirSync41(formattedDir, { recursive: true });
|
|
53420
|
-
const formattedPath =
|
|
53354
|
+
const formattedPath = join123(formattedDir, outputName);
|
|
53421
53355
|
writeFileSync56(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
53422
53356
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
53423
|
-
const summaryPath =
|
|
53357
|
+
const summaryPath = join123(summaryDir, client, outputName);
|
|
53424
53358
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
53425
53359
|
console.log(`Summary target: ${summaryPath}`);
|
|
53426
53360
|
}
|
|
53427
53361
|
|
|
53428
53362
|
// src/commands/transcript/merge.ts
|
|
53429
|
-
import { existsSync as
|
|
53363
|
+
import { existsSync as existsSync95, writeFileSync as writeFileSync57 } from "fs";
|
|
53430
53364
|
import { basename as basename32 } from "path";
|
|
53431
53365
|
|
|
53432
53366
|
// src/commands/transcript/failTranscript.ts
|
|
@@ -53442,10 +53376,10 @@ function removedNote(removed) {
|
|
|
53442
53376
|
const noun = removed.length === 1 ? "passage" : "passages";
|
|
53443
53377
|
return [`${removed.length} ${noun} removed: ${distinct.join(", ")}`];
|
|
53444
53378
|
}
|
|
53445
|
-
function headerNotes(
|
|
53379
|
+
function headerNotes(sources2, removed) {
|
|
53446
53380
|
return [
|
|
53447
53381
|
`Collapsed ${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)} from:`,
|
|
53448
|
-
...
|
|
53382
|
+
...sources2.map((source) => ` ${source.name}`),
|
|
53449
53383
|
...removedNote(removed)
|
|
53450
53384
|
];
|
|
53451
53385
|
}
|
|
@@ -53486,8 +53420,8 @@ function parseClock(value, range) {
|
|
|
53486
53420
|
const [, hours, minutes, seconds, millis] = match;
|
|
53487
53421
|
return (Number(hours ?? 0) * 3600 + Number(minutes) * 60 + Number(seconds)) * 1e3 + Number((millis ?? "").padEnd(3, "0"));
|
|
53488
53422
|
}
|
|
53489
|
-
function findSource(
|
|
53490
|
-
const match =
|
|
53423
|
+
function findSource(sources2, range) {
|
|
53424
|
+
const match = sources2.find(
|
|
53491
53425
|
(source) => source.path === range.file || source.name === range.file
|
|
53492
53426
|
);
|
|
53493
53427
|
return match ?? failTranscript(`selection names a file that was not given: ${range.file}`);
|
|
@@ -53523,9 +53457,9 @@ function cuesInRange(source, range) {
|
|
|
53523
53457
|
function toPassage(source, cues) {
|
|
53524
53458
|
return { source: source.name, sourceStartMs: cues[0].startMs, cues };
|
|
53525
53459
|
}
|
|
53526
|
-
function selectPassages(
|
|
53460
|
+
function selectPassages(sources2, selection) {
|
|
53527
53461
|
const passages = selection.keep.flatMap((range) => {
|
|
53528
|
-
const source = findSource(
|
|
53462
|
+
const source = findSource(sources2, range);
|
|
53529
53463
|
const cues = cuesInRange(source, range);
|
|
53530
53464
|
return cues.length ? [toPassage(source, cues)] : [];
|
|
53531
53465
|
});
|
|
@@ -53570,13 +53504,13 @@ function widenAudience(passages) {
|
|
|
53570
53504
|
|
|
53571
53505
|
// src/commands/transcript/merge.ts
|
|
53572
53506
|
function readSource3(file) {
|
|
53573
|
-
if (!
|
|
53507
|
+
if (!existsSync95(file)) failTranscript(`VTT file not found: ${file}`);
|
|
53574
53508
|
const cues = readCleanedCues(file);
|
|
53575
53509
|
if (cues.length === 0) failTranscript(`no cues found in: ${file}`);
|
|
53576
53510
|
return { path: file, name: basename32(file), cues };
|
|
53577
53511
|
}
|
|
53578
|
-
function wholePassages(
|
|
53579
|
-
return
|
|
53512
|
+
function wholePassages(sources2) {
|
|
53513
|
+
return sources2.map((source) => ({
|
|
53580
53514
|
source: source.name,
|
|
53581
53515
|
sourceStartMs: source.cues[0].startMs,
|
|
53582
53516
|
cues: source.cues
|
|
@@ -53587,16 +53521,16 @@ async function readSelection(source) {
|
|
|
53587
53521
|
return readJsonPayload(source, selectionSchema, "transcript selection");
|
|
53588
53522
|
}
|
|
53589
53523
|
async function merge(files, options2 = {}) {
|
|
53590
|
-
const
|
|
53524
|
+
const sources2 = files.map(readSource3);
|
|
53591
53525
|
const selection = await readSelection(options2.select);
|
|
53592
|
-
const selected = selection ? selectPassages(
|
|
53526
|
+
const selected = selection ? selectPassages(sources2, selection) : wholePassages(sources2);
|
|
53593
53527
|
const passages = rebasePassages(
|
|
53594
53528
|
options2.widenAudience ? widenAudience(selected) : selected
|
|
53595
53529
|
);
|
|
53596
53530
|
const provenance = options2.provenance !== false;
|
|
53597
53531
|
const document = formatVttPassages(
|
|
53598
53532
|
passages,
|
|
53599
|
-
provenance ? headerNotes(
|
|
53533
|
+
provenance ? headerNotes(sources2, selection?.removed ?? []) : [],
|
|
53600
53534
|
{ sourceMarks: provenance }
|
|
53601
53535
|
);
|
|
53602
53536
|
if (!options2.out) {
|
|
@@ -54042,7 +53976,7 @@ function configKeys2() {
|
|
|
54042
53976
|
}
|
|
54043
53977
|
|
|
54044
53978
|
// src/commands/verify/forbiddenStrings.ts
|
|
54045
|
-
import { existsSync as
|
|
53979
|
+
import { existsSync as existsSync96, readFileSync as readFileSync85 } from "fs";
|
|
54046
53980
|
|
|
54047
53981
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
54048
53982
|
import { minimatch as minimatch10 } from "minimatch";
|
|
@@ -54083,7 +54017,7 @@ function forbiddenStrings() {
|
|
|
54083
54017
|
const cache7 = /* @__PURE__ */ new Map();
|
|
54084
54018
|
const readJson2 = (file) => {
|
|
54085
54019
|
if (cache7.has(file)) return cache7.get(file);
|
|
54086
|
-
if (!
|
|
54020
|
+
if (!existsSync96(file)) {
|
|
54087
54021
|
console.log(`Forbidden-strings file not found: ${file}`);
|
|
54088
54022
|
process.exit(1);
|
|
54089
54023
|
}
|
|
@@ -54278,10 +54212,10 @@ function checkSequential(migrations3, files) {
|
|
|
54278
54212
|
}
|
|
54279
54213
|
|
|
54280
54214
|
// src/commands/verify/migrations/listMigrationFiles.ts
|
|
54281
|
-
import { readdirSync as
|
|
54215
|
+
import { readdirSync as readdirSync26 } from "fs";
|
|
54282
54216
|
var MIGRATION_FILE2 = /^migration\d+[A-Za-z0-9]*\.ts$/;
|
|
54283
54217
|
function listMigrationFiles(dir) {
|
|
54284
|
-
return
|
|
54218
|
+
return readdirSync26(dir).filter((file) => MIGRATION_FILE2.test(file));
|
|
54285
54219
|
}
|
|
54286
54220
|
|
|
54287
54221
|
// src/commands/verify/migrations/readBaselineMigrations.ts
|
|
@@ -54564,7 +54498,7 @@ function clearBuildPending() {
|
|
|
54564
54498
|
}
|
|
54565
54499
|
|
|
54566
54500
|
// src/commands/watch/isSyncPending.ts
|
|
54567
|
-
import { existsSync as
|
|
54501
|
+
import { existsSync as existsSync97 } from "fs";
|
|
54568
54502
|
|
|
54569
54503
|
// src/commands/watch/syncPendingPath.ts
|
|
54570
54504
|
function syncPendingPath(cwd) {
|
|
@@ -54574,7 +54508,7 @@ function syncPendingPath(cwd) {
|
|
|
54574
54508
|
// src/commands/watch/isSyncPending.ts
|
|
54575
54509
|
function isSyncPending() {
|
|
54576
54510
|
try {
|
|
54577
|
-
return
|
|
54511
|
+
return existsSync97(syncPendingPath());
|
|
54578
54512
|
} catch {
|
|
54579
54513
|
return false;
|
|
54580
54514
|
}
|
|
@@ -54701,7 +54635,7 @@ function resolveParams(params, cliArgs) {
|
|
|
54701
54635
|
}
|
|
54702
54636
|
|
|
54703
54637
|
// src/commands/run/resolveRunCwd.ts
|
|
54704
|
-
import { existsSync as
|
|
54638
|
+
import { existsSync as existsSync98 } from "fs";
|
|
54705
54639
|
import { resolve as resolve32 } from "path";
|
|
54706
54640
|
var MissingRunCwdError = class extends Error {
|
|
54707
54641
|
constructor(runName, cwd) {
|
|
@@ -54716,7 +54650,7 @@ var MissingRunCwdError = class extends Error {
|
|
|
54716
54650
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
54717
54651
|
if (!config.cwd) return void 0;
|
|
54718
54652
|
const cwd = resolve32(baseDir, config.cwd);
|
|
54719
|
-
if (!
|
|
54653
|
+
if (!existsSync98(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
54720
54654
|
return cwd;
|
|
54721
54655
|
}
|
|
54722
54656
|
|
|
@@ -55051,10 +54985,10 @@ ${buildWatchReport(from)}`);
|
|
|
55051
54985
|
}
|
|
55052
54986
|
|
|
55053
54987
|
// src/commands/watch/consumeMarker.ts
|
|
55054
|
-
import { existsSync as
|
|
54988
|
+
import { existsSync as existsSync99, rmSync as rmSync15 } from "fs";
|
|
55055
54989
|
function consumeMarker(path128) {
|
|
55056
54990
|
try {
|
|
55057
|
-
if (!
|
|
54991
|
+
if (!existsSync99(path128)) return false;
|
|
55058
54992
|
rmSync15(path128);
|
|
55059
54993
|
return true;
|
|
55060
54994
|
} catch {
|
|
@@ -55351,17 +55285,17 @@ function registerWatch(program) {
|
|
|
55351
55285
|
|
|
55352
55286
|
// src/commands/roam/postRoamActivity.ts
|
|
55353
55287
|
import { execFileSync as execFileSync34 } from "child_process";
|
|
55354
|
-
import { readdirSync as
|
|
55355
|
-
import { join as
|
|
55288
|
+
import { readdirSync as readdirSync27, readFileSync as readFileSync87, statSync as statSync18 } from "fs";
|
|
55289
|
+
import { join as join124 } from "path";
|
|
55356
55290
|
function findPortFile(roamDir) {
|
|
55357
55291
|
let entries2;
|
|
55358
55292
|
try {
|
|
55359
|
-
entries2 =
|
|
55293
|
+
entries2 = readdirSync27(roamDir);
|
|
55360
55294
|
} catch {
|
|
55361
55295
|
return void 0;
|
|
55362
55296
|
}
|
|
55363
55297
|
const candidates = entries2.filter((name2) => /^roam-local-api(-[^.]+)?\.port$/.test(name2)).map((name2) => {
|
|
55364
|
-
const path128 =
|
|
55298
|
+
const path128 = join124(roamDir, name2);
|
|
55365
55299
|
try {
|
|
55366
55300
|
return { path: path128, mtimeMs: statSync18(path128).mtimeMs };
|
|
55367
55301
|
} catch {
|
|
@@ -55378,7 +55312,7 @@ var PID_BY_APP = {
|
|
|
55378
55312
|
function postRoamActivity(app, event) {
|
|
55379
55313
|
const appData = process.env.APPDATA;
|
|
55380
55314
|
if (!appData) return;
|
|
55381
|
-
const portFile = findPortFile(
|
|
55315
|
+
const portFile = findPortFile(join124(appData, "Roam"));
|
|
55382
55316
|
if (!portFile) return;
|
|
55383
55317
|
let port;
|
|
55384
55318
|
try {
|
|
@@ -55737,11 +55671,11 @@ function requireParsedArgs() {
|
|
|
55737
55671
|
}
|
|
55738
55672
|
|
|
55739
55673
|
// src/commands/run/runCommandFilePath.ts
|
|
55740
|
-
import { join as
|
|
55674
|
+
import { join as join125 } from "path";
|
|
55741
55675
|
function runCommandFilePath(name2) {
|
|
55742
55676
|
const segments = name2.split(":");
|
|
55743
55677
|
const file = `${segments.pop()}.md`;
|
|
55744
|
-
return
|
|
55678
|
+
return join125(".claude", "commands", ...segments, file);
|
|
55745
55679
|
}
|
|
55746
55680
|
|
|
55747
55681
|
// src/commands/run/add.ts
|
|
@@ -55885,8 +55819,8 @@ function registerRunAdd(runCommand) {
|
|
|
55885
55819
|
}
|
|
55886
55820
|
|
|
55887
55821
|
// src/commands/run/remove.ts
|
|
55888
|
-
import { existsSync as
|
|
55889
|
-
import { dirname as dirname52, join as
|
|
55822
|
+
import { existsSync as existsSync100, readdirSync as readdirSync28, rmdirSync, unlinkSync as unlinkSync20 } from "fs";
|
|
55823
|
+
import { dirname as dirname52, join as join126 } from "path";
|
|
55890
55824
|
|
|
55891
55825
|
// src/commands/run/removeRepoRunConfig.ts
|
|
55892
55826
|
function isNamed(entry, name2) {
|
|
@@ -55904,17 +55838,17 @@ function removeRepoRunConfig(name2, repoName, cwd = process.cwd()) {
|
|
|
55904
55838
|
|
|
55905
55839
|
// src/commands/run/remove.ts
|
|
55906
55840
|
function removeEmptyNamespaceDirs(filePath) {
|
|
55907
|
-
const root2 =
|
|
55841
|
+
const root2 = join126(".claude", "commands");
|
|
55908
55842
|
for (let dir = dirname52(filePath); dir !== root2; dir = dirname52(dir)) {
|
|
55909
|
-
if (!
|
|
55843
|
+
if (!existsSync100(dir) || readdirSync28(dir).length > 0) return;
|
|
55910
55844
|
rmdirSync(dir);
|
|
55911
55845
|
}
|
|
55912
55846
|
}
|
|
55913
55847
|
function deleteCommandFile(name2) {
|
|
55914
55848
|
const filePath = runCommandFilePath(name2);
|
|
55915
|
-
const legacyPath =
|
|
55849
|
+
const legacyPath = join126(".claude", "commands", `${name2}.md`);
|
|
55916
55850
|
for (const path128 of /* @__PURE__ */ new Set([filePath, legacyPath])) {
|
|
55917
|
-
if (
|
|
55851
|
+
if (existsSync100(path128)) {
|
|
55918
55852
|
unlinkSync20(path128);
|
|
55919
55853
|
console.log(`Deleted command file: ${path128}`);
|
|
55920
55854
|
}
|
|
@@ -56358,8 +56292,8 @@ function readInboxSchedule() {
|
|
|
56358
56292
|
try {
|
|
56359
56293
|
minutes = readInboxIntervalMinutes();
|
|
56360
56294
|
} catch (error) {
|
|
56361
|
-
const
|
|
56362
|
-
return { description: `off (invalid inbox.intervalMinutes: ${
|
|
56295
|
+
const reason6 = error instanceof Error ? error.message : String(error);
|
|
56296
|
+
return { description: `off (invalid inbox.intervalMinutes: ${reason6})` };
|
|
56363
56297
|
}
|
|
56364
56298
|
if (!minutes) return { description: "off (inbox.intervalMinutes unset)" };
|
|
56365
56299
|
if (!process.env.ASSIST_DATABASE_URL && !loadConfig().database.url)
|
|
@@ -56402,14 +56336,14 @@ async function isScheduledScanDue(intervalMinutes) {
|
|
|
56402
56336
|
}
|
|
56403
56337
|
|
|
56404
56338
|
// src/commands/sessions/daemon/inbox/runLoggedInboxScan.ts
|
|
56405
|
-
async function runLoggedInboxScan(
|
|
56339
|
+
async function runLoggedInboxScan(reason6, listener, harness) {
|
|
56406
56340
|
const adapter = harnessAdapter(harness);
|
|
56407
|
-
daemonLog(`inbox: scan started (${
|
|
56341
|
+
daemonLog(`inbox: scan started (${reason6}, ${adapter.label})`);
|
|
56408
56342
|
try {
|
|
56409
56343
|
const { flagged, added, usage } = await runInboxScan(await getDb(), {
|
|
56410
56344
|
...listener,
|
|
56411
56345
|
adapter,
|
|
56412
|
-
trigger:
|
|
56346
|
+
trigger: reason6 === "scheduled" ? "scheduled" : "manual"
|
|
56413
56347
|
});
|
|
56414
56348
|
daemonLog(
|
|
56415
56349
|
`inbox: scan flagged ${flagged} message(s), ${added} new (${formatScanUsage(usage)})`
|
|
@@ -56431,11 +56365,11 @@ function createInboxScanner() {
|
|
|
56431
56365
|
};
|
|
56432
56366
|
const schedule = createScheduleTracker();
|
|
56433
56367
|
const runLog = createScanRunLog(() => notify2("inbox-activity"));
|
|
56434
|
-
const scan2 = async (
|
|
56368
|
+
const scan2 = async (reason6, harness) => {
|
|
56435
56369
|
scanning = true;
|
|
56436
56370
|
runLog.begin();
|
|
56437
56371
|
notify2("inbox");
|
|
56438
|
-
const outcome = await runLoggedInboxScan(
|
|
56372
|
+
const outcome = await runLoggedInboxScan(reason6, runLog, harness);
|
|
56439
56373
|
lastError = outcome.ok ? void 0 : outcome.error;
|
|
56440
56374
|
await runLog.end(outcome);
|
|
56441
56375
|
scanning = false;
|
|
@@ -56685,12 +56619,12 @@ function toSessionViewInfo({
|
|
|
56685
56619
|
}
|
|
56686
56620
|
|
|
56687
56621
|
// src/commands/sessions/daemon/worktree/joinRefusal.ts
|
|
56688
|
-
import { existsSync as
|
|
56622
|
+
import { existsSync as existsSync101 } from "fs";
|
|
56689
56623
|
function joinRefusal(session) {
|
|
56690
56624
|
if (session.commandType === "run") return "a server run has no agent stream";
|
|
56691
56625
|
if (session.closing === true) return "the session is closing";
|
|
56692
56626
|
if (!session.cwd) return "the session has no working directory";
|
|
56693
|
-
if (!
|
|
56627
|
+
if (!existsSync101(session.cwd))
|
|
56694
56628
|
return "the session's workspace no longer exists";
|
|
56695
56629
|
return void 0;
|
|
56696
56630
|
}
|
|
@@ -56780,8 +56714,8 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
|
|
|
56780
56714
|
}
|
|
56781
56715
|
|
|
56782
56716
|
// src/commands/sessions/daemon/findServerParents.ts
|
|
56783
|
-
import { existsSync as
|
|
56784
|
-
import { join as
|
|
56717
|
+
import { existsSync as existsSync102 } from "fs";
|
|
56718
|
+
import { join as join127, resolve as resolve33 } from "path";
|
|
56785
56719
|
function isLive(session) {
|
|
56786
56720
|
return !!session.pty && session.status !== "done" && session.status !== "error";
|
|
56787
56721
|
}
|
|
@@ -56790,7 +56724,7 @@ function isLiveAgent(session) {
|
|
|
56790
56724
|
}
|
|
56791
56725
|
function serverRunDirs(sessions, file) {
|
|
56792
56726
|
return new Set(
|
|
56793
|
-
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve33(s.cwd)).filter((dir) =>
|
|
56727
|
+
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve33(s.cwd)).filter((dir) => existsSync102(join127(dir, file)))
|
|
56794
56728
|
);
|
|
56795
56729
|
}
|
|
56796
56730
|
function findServerParents(sessions, file) {
|
|
@@ -57459,7 +57393,7 @@ var ClientHub = class extends Set {
|
|
|
57459
57393
|
};
|
|
57460
57394
|
|
|
57461
57395
|
// src/commands/sessions/daemon/autoUpdate/autoUpdateControl.ts
|
|
57462
|
-
import { existsSync as
|
|
57396
|
+
import { existsSync as existsSync103, rmSync as rmSync16, writeFileSync as writeFileSync62 } from "fs";
|
|
57463
57397
|
var paused;
|
|
57464
57398
|
var wake;
|
|
57465
57399
|
var holdReleased = false;
|
|
@@ -57472,7 +57406,7 @@ function persist2(value) {
|
|
|
57472
57406
|
}
|
|
57473
57407
|
var autoUpdateControl = {
|
|
57474
57408
|
paused: () => {
|
|
57475
|
-
paused ??=
|
|
57409
|
+
paused ??= existsSync103(daemonPaths.autoUpdatePaused);
|
|
57476
57410
|
return paused;
|
|
57477
57411
|
},
|
|
57478
57412
|
setPaused: (value) => {
|
|
@@ -57533,9 +57467,9 @@ var autoUpdateState = {
|
|
|
57533
57467
|
|
|
57534
57468
|
// src/commands/sessions/daemon/autoUpdate/backOff.ts
|
|
57535
57469
|
var RETRY_AFTER_FAILURE_MS = 5 * 60 * 1e3;
|
|
57536
|
-
async function backOff(
|
|
57537
|
-
deps2.enter("retrying", { reason:
|
|
57538
|
-
deps2.note(`${
|
|
57470
|
+
async function backOff(reason6, deps2) {
|
|
57471
|
+
deps2.enter("retrying", { reason: reason6 });
|
|
57472
|
+
deps2.note(`${reason6}; retrying in ${RETRY_AFTER_FAILURE_MS / 6e4}m`);
|
|
57539
57473
|
await deps2.sleep(RETRY_AFTER_FAILURE_MS);
|
|
57540
57474
|
}
|
|
57541
57475
|
|
|
@@ -57575,9 +57509,9 @@ async function settleLap(lap, { end, tail }, deps2) {
|
|
|
57575
57509
|
try {
|
|
57576
57510
|
held = deps2.escalate(tail);
|
|
57577
57511
|
} catch (error) {
|
|
57578
|
-
const
|
|
57512
|
+
const reason6 = error instanceof Error ? error.message : String(error);
|
|
57579
57513
|
await backOff(
|
|
57580
|
-
`lap ${lap} ${how} (divergence); escalation refused: ${
|
|
57514
|
+
`lap ${lap} ${how} (divergence); escalation refused: ${reason6.replaceAll("\n", " ")}`,
|
|
57581
57515
|
deps2
|
|
57582
57516
|
);
|
|
57583
57517
|
return void 0;
|
|
@@ -57758,12 +57692,12 @@ function noteWorktreeHarness(session) {
|
|
|
57758
57692
|
|
|
57759
57693
|
// src/commands/sessions/daemon/worktree/refuseUnallocatedStart.ts
|
|
57760
57694
|
function refuseUnallocatedStart(session, path128, error, startHeld) {
|
|
57761
|
-
const
|
|
57695
|
+
const reason6 = error instanceof Error ? error.message : String(error);
|
|
57762
57696
|
daemonLog(
|
|
57763
|
-
`session ${session.id} worktree ${path128} could not be created: ${
|
|
57697
|
+
`session ${session.id} worktree ${path128} could not be created: ${reason6}`
|
|
57764
57698
|
);
|
|
57765
57699
|
session.pendingStart = () => {
|
|
57766
|
-
throw new Error(`worktree ${path128} could not be created: ${
|
|
57700
|
+
throw new Error(`worktree ${path128} could not be created: ${reason6}`);
|
|
57767
57701
|
};
|
|
57768
57702
|
startHeld(session);
|
|
57769
57703
|
}
|
|
@@ -57815,13 +57749,13 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
57815
57749
|
}
|
|
57816
57750
|
|
|
57817
57751
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
57818
|
-
import { existsSync as
|
|
57752
|
+
import { existsSync as existsSync105 } from "fs";
|
|
57819
57753
|
|
|
57820
57754
|
// src/commands/sessions/daemon/worktree/holdsNoCheckout.ts
|
|
57821
|
-
import { existsSync as
|
|
57822
|
-
import { join as
|
|
57755
|
+
import { existsSync as existsSync104 } from "fs";
|
|
57756
|
+
import { join as join129 } from "path";
|
|
57823
57757
|
function holdsNoCheckout(path128) {
|
|
57824
|
-
return
|
|
57758
|
+
return existsSync104(path128) && !existsSync104(join129(path128, ".git"));
|
|
57825
57759
|
}
|
|
57826
57760
|
|
|
57827
57761
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
@@ -57859,14 +57793,14 @@ function notACheckout(cwd, error) {
|
|
|
57859
57793
|
return holdsNoCheckout(cwd) && /not a git repository/i.test(error);
|
|
57860
57794
|
}
|
|
57861
57795
|
async function checkDurability(cwd) {
|
|
57862
|
-
if (!
|
|
57796
|
+
if (!existsSync105(cwd)) return treeIsGone;
|
|
57863
57797
|
const probes = durabilityProbes(cwd);
|
|
57864
57798
|
let step3 = probes.next();
|
|
57865
57799
|
while (!step3.done) step3 = probes.next(await gitResult(cwd, step3.value));
|
|
57866
57800
|
return step3.value;
|
|
57867
57801
|
}
|
|
57868
57802
|
function checkDurabilitySync(cwd) {
|
|
57869
|
-
if (!
|
|
57803
|
+
if (!existsSync105(cwd)) return treeIsGone;
|
|
57870
57804
|
const probes = durabilityProbes(cwd);
|
|
57871
57805
|
let step3 = probes.next();
|
|
57872
57806
|
while (!step3.done) step3 = probes.next(gitSyncResult(cwd, step3.value));
|
|
@@ -57941,15 +57875,15 @@ function divergenceReason(scrollback) {
|
|
|
57941
57875
|
return stripAnsi(scrollback).split(/\r?\n|\r/).map((line) => line.trimEnd()).filter((line) => line.trim().length > 0).slice(-MAX_REASON_LINES).join("\n").slice(-MAX_REASON_CHARS);
|
|
57942
57876
|
}
|
|
57943
57877
|
function divergencePrompt(clone, scrollback) {
|
|
57944
|
-
const
|
|
57878
|
+
const reason6 = divergenceReason(scrollback);
|
|
57945
57879
|
return [
|
|
57946
57880
|
`The daemon's auto-update loop for the assist install in ${clone} paused because \`assist watch wait --pull --build\` could not fast-forward the branch (exit 3). The tail of its output:`,
|
|
57947
57881
|
"",
|
|
57948
57882
|
"```",
|
|
57949
|
-
|
|
57883
|
+
reason6 || "(no output captured)",
|
|
57950
57884
|
"```",
|
|
57951
57885
|
"",
|
|
57952
|
-
...
|
|
57886
|
+
...reason6.includes(simulatedDivergenceNote) ? SIMULATED_STEPS : RECONCILE_STEPS
|
|
57953
57887
|
].join("\n");
|
|
57954
57888
|
}
|
|
57955
57889
|
|
|
@@ -58087,9 +58021,9 @@ function loopDeps(installDir, ctx) {
|
|
|
58087
58021
|
}
|
|
58088
58022
|
|
|
58089
58023
|
// src/commands/sessions/daemon/autoUpdate/startAutoUpdate.ts
|
|
58090
|
-
function stayOff(
|
|
58091
|
-
autoUpdateState.enter("off", { reason:
|
|
58092
|
-
daemonLog(`auto-update: off (${
|
|
58024
|
+
function stayOff(reason6) {
|
|
58025
|
+
autoUpdateState.enter("off", { reason: reason6 });
|
|
58026
|
+
daemonLog(`auto-update: off (${reason6})`);
|
|
58093
58027
|
}
|
|
58094
58028
|
function startAutoUpdate(ctx) {
|
|
58095
58029
|
const installDir = getInstallDir();
|
|
@@ -58160,16 +58094,158 @@ function setStatus2(session, newStatus) {
|
|
|
58160
58094
|
|
|
58161
58095
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
58162
58096
|
import { existsSync as existsSync108 } from "fs";
|
|
58163
|
-
import { basename as
|
|
58097
|
+
import { basename as basename35 } from "path";
|
|
58098
|
+
|
|
58099
|
+
// src/commands/sessions/daemon/worktree/cleanLeftoversEnabled.ts
|
|
58100
|
+
function cleanLeftoversEnabled() {
|
|
58101
|
+
return loadConfig().sessions?.cleanLeftovers ?? true;
|
|
58102
|
+
}
|
|
58103
|
+
|
|
58104
|
+
// src/commands/sessions/daemon/worktree/docker.ts
|
|
58105
|
+
import { execFile as execFile16 } from "child_process";
|
|
58106
|
+
function docker(args, timeout = 15e3) {
|
|
58107
|
+
return new Promise((resolve36, reject) => {
|
|
58108
|
+
execFile16(
|
|
58109
|
+
"docker",
|
|
58110
|
+
args,
|
|
58111
|
+
{ encoding: "utf8", windowsHide: true, timeout },
|
|
58112
|
+
(error, stdout, stderr) => {
|
|
58113
|
+
if (error) reject(new Error(stderr.trim() || error.message));
|
|
58114
|
+
else resolve36(stdout);
|
|
58115
|
+
}
|
|
58116
|
+
);
|
|
58117
|
+
});
|
|
58118
|
+
}
|
|
58119
|
+
|
|
58120
|
+
// src/commands/sessions/daemon/worktree/dockerReachable.ts
|
|
58121
|
+
async function dockerReachable() {
|
|
58122
|
+
try {
|
|
58123
|
+
await docker(["info", "--format", "{{.ServerVersion}}"], 1e4);
|
|
58124
|
+
return true;
|
|
58125
|
+
} catch {
|
|
58126
|
+
return false;
|
|
58127
|
+
}
|
|
58128
|
+
}
|
|
58129
|
+
|
|
58130
|
+
// src/commands/sessions/daemon/worktree/containersInside.ts
|
|
58131
|
+
import { sep as sep6 } from "path";
|
|
58132
|
+
var COMPOSE_WORKING_DIR = "com.docker.compose.project.working_dir";
|
|
58133
|
+
async function containersInside(worktreePath) {
|
|
58134
|
+
const ids = (await docker(["ps", "-aq", "--no-trunc"])).split("\n").map((id) => id.trim()).filter(Boolean);
|
|
58135
|
+
if (ids.length === 0) return [];
|
|
58136
|
+
const inspected = JSON.parse(
|
|
58137
|
+
await docker(["inspect", ...ids])
|
|
58138
|
+
);
|
|
58139
|
+
return inspected.filter(
|
|
58140
|
+
(c) => sources(c).some((source) => inside(source, worktreePath))
|
|
58141
|
+
);
|
|
58142
|
+
}
|
|
58143
|
+
function sources(container) {
|
|
58144
|
+
return [
|
|
58145
|
+
...(container.Mounts ?? []).filter((m) => m.Type === "bind").map((m) => m.Source),
|
|
58146
|
+
...(container.HostConfig?.Binds ?? []).map((b) => b.split(":")[0]),
|
|
58147
|
+
...(container.HostConfig?.Mounts ?? []).map((m) => m.Source),
|
|
58148
|
+
container.Config?.Labels?.[COMPOSE_WORKING_DIR]
|
|
58149
|
+
].filter((s) => Boolean(s));
|
|
58150
|
+
}
|
|
58151
|
+
function inside(source, worktreePath) {
|
|
58152
|
+
return source === worktreePath || source.startsWith(`${worktreePath}/`) || source.startsWith(`${worktreePath}${sep6}`);
|
|
58153
|
+
}
|
|
58154
|
+
|
|
58155
|
+
// src/commands/sessions/daemon/worktree/removeBindMountContainers.ts
|
|
58156
|
+
async function removeBindMountContainers(worktreePath) {
|
|
58157
|
+
if (!cleanLeftoversEnabled()) return;
|
|
58158
|
+
if (!await dockerReachable()) {
|
|
58159
|
+
daemonLog(
|
|
58160
|
+
`worktree ${worktreePath} container cleanup skipped: Docker is not reachable`
|
|
58161
|
+
);
|
|
58162
|
+
return;
|
|
58163
|
+
}
|
|
58164
|
+
try {
|
|
58165
|
+
for (const container of await containersInside(worktreePath))
|
|
58166
|
+
await removeContainer(worktreePath, container);
|
|
58167
|
+
} catch (error) {
|
|
58168
|
+
daemonLog(
|
|
58169
|
+
`worktree ${worktreePath} container cleanup failed: ${reason(error)}`
|
|
58170
|
+
);
|
|
58171
|
+
}
|
|
58172
|
+
}
|
|
58173
|
+
async function removeContainer(worktreePath, container) {
|
|
58174
|
+
const name2 = container.Name?.replace(/^\//, "") || container.Id;
|
|
58175
|
+
try {
|
|
58176
|
+
await docker(["rm", "--force", container.Id], 6e4);
|
|
58177
|
+
daemonLog(
|
|
58178
|
+
`worktree ${worktreePath} container ${name2} removed (docker rm --force) so it cannot recreate the worktree's bind-mount sources`
|
|
58179
|
+
);
|
|
58180
|
+
} catch (error) {
|
|
58181
|
+
daemonLog(
|
|
58182
|
+
`worktree ${worktreePath} container ${name2} removal failed: ${reason(error)}`
|
|
58183
|
+
);
|
|
58184
|
+
}
|
|
58185
|
+
}
|
|
58186
|
+
function reason(error) {
|
|
58187
|
+
return error instanceof Error ? error.message : String(error);
|
|
58188
|
+
}
|
|
58164
58189
|
|
|
58165
58190
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
58166
58191
|
import { existsSync as existsSync107 } from "fs";
|
|
58167
|
-
import { join as
|
|
58192
|
+
import { join as join131 } from "path";
|
|
58168
58193
|
|
|
58169
58194
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
58170
58195
|
import { statSync as statSync19 } from "fs";
|
|
58171
58196
|
import { rm as rm3 } from "fs/promises";
|
|
58172
|
-
import { join as
|
|
58197
|
+
import { join as join130 } from "path";
|
|
58198
|
+
|
|
58199
|
+
// src/commands/sessions/daemon/worktree/deleteViaDocker.ts
|
|
58200
|
+
import { existsSync as existsSync106 } from "fs";
|
|
58201
|
+
import { basename as basename34, dirname as dirname55 } from "path";
|
|
58202
|
+
var IMAGE = "alpine:3";
|
|
58203
|
+
async function deleteViaDocker(worktreePath, cause) {
|
|
58204
|
+
if (!await dockerReachable()) {
|
|
58205
|
+
const reason6 = `it holds files owned by another user (e.g. root, from a Docker bind mount) and Docker is not reachable to delete them; retried on each daemon restart (${cause})`;
|
|
58206
|
+
daemonLog(`worktree ${worktreePath} delete deferred: ${reason6}`);
|
|
58207
|
+
return { removed: false, reason: reason6, deferred: true };
|
|
58208
|
+
}
|
|
58209
|
+
const parent = dirname55(worktreePath);
|
|
58210
|
+
const target = `/p/${basename34(worktreePath)}`;
|
|
58211
|
+
const how = `docker run --rm -v ${parent}:/p ${IMAGE} rm -rf ${target}`;
|
|
58212
|
+
try {
|
|
58213
|
+
await docker(
|
|
58214
|
+
["run", "--rm", "-v", `${parent}:/p`, IMAGE, "rm", "-rf", target],
|
|
58215
|
+
18e4
|
|
58216
|
+
);
|
|
58217
|
+
} catch (error) {
|
|
58218
|
+
const reason6 = `${how} failed: ${error instanceof Error ? error.message : String(error)}`;
|
|
58219
|
+
daemonLog(`worktree ${worktreePath} Docker delete failed: ${reason6}`);
|
|
58220
|
+
return { removed: false, reason: reason6 };
|
|
58221
|
+
}
|
|
58222
|
+
if (existsSync106(worktreePath)) {
|
|
58223
|
+
const reason6 = `${how} exited cleanly but the path is still there`;
|
|
58224
|
+
daemonLog(`worktree ${worktreePath} Docker delete failed: ${reason6}`);
|
|
58225
|
+
return { removed: false, reason: reason6 };
|
|
58226
|
+
}
|
|
58227
|
+
daemonLog(`worktree ${worktreePath} deleted through Docker (${how})`);
|
|
58228
|
+
return { removed: true };
|
|
58229
|
+
}
|
|
58230
|
+
|
|
58231
|
+
// src/commands/sessions/daemon/worktree/pruneBookkeeping.ts
|
|
58232
|
+
async function pruneBookkeeping(clone, worktreePath) {
|
|
58233
|
+
try {
|
|
58234
|
+
await git2(clone, ["worktree", "prune"]);
|
|
58235
|
+
daemonLog(
|
|
58236
|
+
`worktree bookkeeping pruned in clone ${clone} after deleting ${worktreePath} directly`
|
|
58237
|
+
);
|
|
58238
|
+
} catch (error) {
|
|
58239
|
+
daemonLog(
|
|
58240
|
+
`worktree bookkeeping prune failed in clone ${clone} after deleting ${worktreePath}: ${reason2(error)}`
|
|
58241
|
+
);
|
|
58242
|
+
}
|
|
58243
|
+
}
|
|
58244
|
+
function reason2(error) {
|
|
58245
|
+
return error instanceof Error ? error.message : String(error);
|
|
58246
|
+
}
|
|
58247
|
+
|
|
58248
|
+
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
58173
58249
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
58174
58250
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
58175
58251
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -58187,39 +58263,34 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
58187
58263
|
retryDelay: 200
|
|
58188
58264
|
});
|
|
58189
58265
|
} catch (error) {
|
|
58190
|
-
|
|
58266
|
+
if (!ownedByAnotherUser(error)) {
|
|
58267
|
+
daemonLog(
|
|
58268
|
+
`worktree ${worktreePath} directory delete failed, left in place for the next reconcile: ${reason3(error)}`
|
|
58269
|
+
);
|
|
58270
|
+
return { removed: false, reason: reason3(error) };
|
|
58271
|
+
}
|
|
58191
58272
|
daemonLog(
|
|
58192
|
-
`worktree ${worktreePath} directory delete
|
|
58273
|
+
`worktree ${worktreePath} directory delete hit files owned by another user, falling back to Docker: ${reason3(error)}`
|
|
58193
58274
|
);
|
|
58194
|
-
|
|
58275
|
+
const viaDocker = await deleteViaDocker(worktreePath, reason3(error));
|
|
58276
|
+
if (!viaDocker.removed) return viaDocker;
|
|
58277
|
+
await pruneBookkeeping(clone, worktreePath);
|
|
58278
|
+
return viaDocker;
|
|
58195
58279
|
}
|
|
58196
58280
|
daemonLog(`worktree ${worktreePath} directory deleted directly`);
|
|
58197
58281
|
await pruneBookkeeping(clone, worktreePath);
|
|
58198
58282
|
return { removed: true };
|
|
58199
58283
|
}
|
|
58200
58284
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
58201
|
-
return statSync19(
|
|
58285
|
+
return statSync19(join130(worktreePath, ".git"), {
|
|
58202
58286
|
throwIfNoEntry: false
|
|
58203
58287
|
})?.isDirectory() === true;
|
|
58204
58288
|
}
|
|
58205
|
-
|
|
58206
|
-
try {
|
|
58207
|
-
await git2(clone, ["worktree", "prune"]);
|
|
58208
|
-
daemonLog(
|
|
58209
|
-
`worktree bookkeeping pruned in clone ${clone} after deleting ${worktreePath} directly`
|
|
58210
|
-
);
|
|
58211
|
-
} catch (error) {
|
|
58212
|
-
daemonLog(
|
|
58213
|
-
`worktree bookkeeping prune failed in clone ${clone} after deleting ${worktreePath}: ${reason(error)}`
|
|
58214
|
-
);
|
|
58215
|
-
}
|
|
58216
|
-
}
|
|
58217
|
-
function deleteFailure(worktreePath, error) {
|
|
58289
|
+
function ownedByAnotherUser(error) {
|
|
58218
58290
|
const code = error?.code;
|
|
58219
|
-
|
|
58220
|
-
return `${worktreePath} holds files owned by another user (e.g. root, from a Docker bind mount) that assist cannot delete; remove it with \`sudo rm -rf ${worktreePath}\` (${reason(error)})`;
|
|
58291
|
+
return code === "EACCES" || code === "EPERM";
|
|
58221
58292
|
}
|
|
58222
|
-
function
|
|
58293
|
+
function reason3(error) {
|
|
58223
58294
|
return error instanceof Error ? error.message : String(error);
|
|
58224
58295
|
}
|
|
58225
58296
|
|
|
@@ -58228,9 +58299,9 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
58228
58299
|
const stranded = strandedReason(worktreePath, cause);
|
|
58229
58300
|
if (!stranded) {
|
|
58230
58301
|
daemonLog(
|
|
58231
|
-
`worktree ${worktreePath} left in place for the next reconcile: ${
|
|
58302
|
+
`worktree ${worktreePath} left in place for the next reconcile: ${reason4(cause)}`
|
|
58232
58303
|
);
|
|
58233
|
-
return { removed: false, reason:
|
|
58304
|
+
return { removed: false, reason: reason4(cause) };
|
|
58234
58305
|
}
|
|
58235
58306
|
return await deleteTreeDirectly(
|
|
58236
58307
|
clone,
|
|
@@ -58239,13 +58310,13 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
58239
58310
|
);
|
|
58240
58311
|
}
|
|
58241
58312
|
function strandedReason(worktreePath, cause) {
|
|
58242
|
-
if (!existsSync107(
|
|
58313
|
+
if (!existsSync107(join131(worktreePath, ".git")))
|
|
58243
58314
|
return "its .git link is already gone";
|
|
58244
|
-
if (/not a working tree|not a git repository/i.test(
|
|
58315
|
+
if (/not a working tree|not a git repository/i.test(reason4(cause)))
|
|
58245
58316
|
return "git no longer recognises it as a working tree";
|
|
58246
58317
|
return null;
|
|
58247
58318
|
}
|
|
58248
|
-
function
|
|
58319
|
+
function reason4(error) {
|
|
58249
58320
|
return error instanceof Error ? error.message : String(error);
|
|
58250
58321
|
}
|
|
58251
58322
|
|
|
@@ -58261,12 +58332,12 @@ async function removeTree(clone, worktreePath, force) {
|
|
|
58261
58332
|
await remove3(force);
|
|
58262
58333
|
return { removed: true };
|
|
58263
58334
|
} catch (error) {
|
|
58264
|
-
daemonLog(`worktree ${worktreePath} removal failed: ${
|
|
58335
|
+
daemonLog(`worktree ${worktreePath} removal failed: ${reason5(error)}`);
|
|
58265
58336
|
if (force)
|
|
58266
58337
|
return await deleteTreeDirectly(
|
|
58267
58338
|
clone,
|
|
58268
58339
|
worktreePath,
|
|
58269
|
-
`its work was discarded and git could not remove it: ${
|
|
58340
|
+
`its work was discarded and git could not remove it: ${reason5(error)}`
|
|
58270
58341
|
);
|
|
58271
58342
|
}
|
|
58272
58343
|
return await removeIgnoringLeftovers(clone, remove3, worktreePath);
|
|
@@ -58280,18 +58351,34 @@ async function removeIgnoringLeftovers(clone, remove3, worktreePath) {
|
|
|
58280
58351
|
return { removed: true };
|
|
58281
58352
|
} catch (error) {
|
|
58282
58353
|
daemonLog(
|
|
58283
|
-
`worktree ${worktreePath} forced removal failed: ${
|
|
58354
|
+
`worktree ${worktreePath} forced removal failed: ${reason5(error)}`
|
|
58284
58355
|
);
|
|
58285
58356
|
return await deleteStrandedTree(clone, worktreePath, error);
|
|
58286
58357
|
}
|
|
58287
58358
|
}
|
|
58288
|
-
function
|
|
58359
|
+
function reason5(error) {
|
|
58289
58360
|
return error instanceof Error ? error.message : String(error);
|
|
58290
58361
|
}
|
|
58291
58362
|
|
|
58363
|
+
// src/commands/sessions/daemon/worktree/deleteWorktreeBranch.ts
|
|
58364
|
+
async function deleteWorktreeBranch(clone, branch2) {
|
|
58365
|
+
if (!listLocalBranches(clone).includes(branch2)) return;
|
|
58366
|
+
const current2 = await gitOrNull(clone, ["symbolic-ref", "--short", "HEAD"]);
|
|
58367
|
+
if (branch2 === current2) return;
|
|
58368
|
+
try {
|
|
58369
|
+
await git2(clone, ["branch", "-D", branch2]);
|
|
58370
|
+
daemonLog(`worktree branch ${branch2} deleted from clone ${clone}`);
|
|
58371
|
+
} catch (error) {
|
|
58372
|
+
daemonLog(
|
|
58373
|
+
`worktree branch ${branch2} retained in clone ${clone}: ${error instanceof Error ? error.message : String(error)}`
|
|
58374
|
+
);
|
|
58375
|
+
}
|
|
58376
|
+
}
|
|
58377
|
+
|
|
58292
58378
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
58293
58379
|
async function reapWorktree(worktreePath, force = false) {
|
|
58294
58380
|
if (!existsSync108(worktreePath)) {
|
|
58381
|
+
await removeBindMountContainers(worktreePath);
|
|
58295
58382
|
forgetWorktree(worktreePath);
|
|
58296
58383
|
daemonLog(
|
|
58297
58384
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -58306,10 +58393,11 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
58306
58393
|
}
|
|
58307
58394
|
}
|
|
58308
58395
|
stopInstall(worktreePath);
|
|
58396
|
+
await removeBindMountContainers(worktreePath);
|
|
58309
58397
|
const clone = owningClone(worktreePath);
|
|
58310
58398
|
const removal = await removeTree(clone, worktreePath, force);
|
|
58311
58399
|
if (!removal.removed) return removal;
|
|
58312
|
-
await deleteWorktreeBranch(clone,
|
|
58400
|
+
await deleteWorktreeBranch(clone, basename35(worktreePath));
|
|
58313
58401
|
forgetWorktree(worktreePath);
|
|
58314
58402
|
daemonLog(`worktree ${worktreePath} reaped${force ? " (forced)" : ""}`);
|
|
58315
58403
|
return removal;
|
|
@@ -58324,28 +58412,18 @@ function owningClone(worktreePath) {
|
|
|
58324
58412
|
);
|
|
58325
58413
|
return worktreePath;
|
|
58326
58414
|
}
|
|
58327
|
-
async function deleteWorktreeBranch(clone, branch2) {
|
|
58328
|
-
if (!listLocalBranches(clone).includes(branch2)) return;
|
|
58329
|
-
const current2 = await gitOrNull(clone, ["symbolic-ref", "--short", "HEAD"]);
|
|
58330
|
-
if (branch2 === current2) return;
|
|
58331
|
-
try {
|
|
58332
|
-
await git2(clone, ["branch", "-D", branch2]);
|
|
58333
|
-
daemonLog(`worktree branch ${branch2} deleted from clone ${clone}`);
|
|
58334
|
-
} catch (error) {
|
|
58335
|
-
daemonLog(
|
|
58336
|
-
`worktree branch ${branch2} retained in clone ${clone}: ${error instanceof Error ? error.message : String(error)}`
|
|
58337
|
-
);
|
|
58338
|
-
}
|
|
58339
|
-
}
|
|
58340
58415
|
|
|
58341
58416
|
// src/commands/sessions/daemon/discardTree.ts
|
|
58342
58417
|
async function discardTree(session, discarded, notify2) {
|
|
58343
58418
|
if (session.worktree) {
|
|
58344
58419
|
const removal = await reapWorktree(session.worktree.path, true);
|
|
58345
58420
|
if (!removal.removed) {
|
|
58346
|
-
if (holdsNoCheckout(session.worktree.path))
|
|
58347
|
-
|
|
58348
|
-
|
|
58421
|
+
if (!holdsNoCheckout(session.worktree.path)) {
|
|
58422
|
+
holdFailedDiscard(session, removal.reason, notify2);
|
|
58423
|
+
return;
|
|
58424
|
+
}
|
|
58425
|
+
handOffUndeletableLeftover(session, removal);
|
|
58426
|
+
discarded();
|
|
58349
58427
|
return;
|
|
58350
58428
|
}
|
|
58351
58429
|
session.releasedFromClone = session.worktree.clone;
|
|
@@ -58353,35 +58431,27 @@ async function discardTree(session, discarded, notify2) {
|
|
|
58353
58431
|
}
|
|
58354
58432
|
discarded();
|
|
58355
58433
|
}
|
|
58356
|
-
function holdFailedDiscard(session,
|
|
58434
|
+
function holdFailedDiscard(session, reason6, notify2) {
|
|
58357
58435
|
daemonLog(
|
|
58358
|
-
`session ${session.id} discard failed for ${session.worktree?.path}: ${
|
|
58436
|
+
`session ${session.id} discard failed for ${session.worktree?.path}: ${reason6}; card kept so the workspace is not orphaned invisibly`
|
|
58359
58437
|
);
|
|
58360
58438
|
session.closing = void 0;
|
|
58361
58439
|
session.undurable = {
|
|
58362
|
-
reason: `discard failed: ${
|
|
58440
|
+
reason: `discard failed: ${reason6}`,
|
|
58363
58441
|
removesTree: true
|
|
58364
58442
|
};
|
|
58365
58443
|
setStatus2(session, "stopped");
|
|
58366
58444
|
notify2();
|
|
58367
58445
|
}
|
|
58368
|
-
function
|
|
58446
|
+
function handOffUndeletableLeftover(session, removal) {
|
|
58369
58447
|
const path128 = session.worktree?.path;
|
|
58448
|
+
if (!path128) return;
|
|
58449
|
+
markLeftover(path128, removal.deferred ? removal.reason : void 0);
|
|
58370
58450
|
daemonLog(
|
|
58371
|
-
`session ${session.id} discard could not delete ${path128}, which holds no git checkout and so no work: ${
|
|
58451
|
+
`session ${session.id} discard could not delete ${path128}, which holds no git checkout and so no work: ${removal.reason}; marked reaped so each daemon restart retries its removal, and the card is discarded`
|
|
58372
58452
|
);
|
|
58373
|
-
|
|
58374
|
-
if (session.worktree) session.releasedFromClone = session.worktree.clone;
|
|
58453
|
+
session.releasedFromClone = session.worktree?.clone;
|
|
58375
58454
|
session.worktree = void 0;
|
|
58376
|
-
session.closing = void 0;
|
|
58377
|
-
session.undurable = void 0;
|
|
58378
|
-
session.error = message4;
|
|
58379
|
-
session.subtitle = message4;
|
|
58380
|
-
session.scrollback += `\r
|
|
58381
|
-
\x1B[31m${message4}\x1B[0m\r
|
|
58382
|
-
`;
|
|
58383
|
-
setStatus2(session, "error");
|
|
58384
|
-
notify2();
|
|
58385
58455
|
}
|
|
58386
58456
|
|
|
58387
58457
|
// src/commands/sessions/daemon/killPtyTree.ts
|
|
@@ -58485,8 +58555,8 @@ function closeGateApplies(sessions, session) {
|
|
|
58485
58555
|
}
|
|
58486
58556
|
|
|
58487
58557
|
// src/commands/sessions/daemon/worktree/liveProcessesInTree.ts
|
|
58488
|
-
import { readdirSync as
|
|
58489
|
-
import { sep as
|
|
58558
|
+
import { readdirSync as readdirSync29, readlinkSync } from "fs";
|
|
58559
|
+
import { sep as sep7 } from "path";
|
|
58490
58560
|
|
|
58491
58561
|
// src/commands/sessions/daemon/worktree/readProc.ts
|
|
58492
58562
|
import { readFileSync as readFileSync90 } from "fs";
|
|
@@ -58508,7 +58578,7 @@ function isCodexAppServer(pid, procRoot = "/proc") {
|
|
|
58508
58578
|
function liveProcessesInTree(treePath, procRoot = "/proc") {
|
|
58509
58579
|
let entries2;
|
|
58510
58580
|
try {
|
|
58511
|
-
entries2 =
|
|
58581
|
+
entries2 = readdirSync29(procRoot);
|
|
58512
58582
|
} catch {
|
|
58513
58583
|
return [];
|
|
58514
58584
|
}
|
|
@@ -58517,7 +58587,7 @@ function liveProcessesInTree(treePath, procRoot = "/proc") {
|
|
|
58517
58587
|
const pid = Number(entry);
|
|
58518
58588
|
if (!Number.isInteger(pid) || pid === process.pid) continue;
|
|
58519
58589
|
const cwd = processCwd(`${procRoot}/${entry}/cwd`);
|
|
58520
|
-
if (cwd && (cwd === treePath || cwd.startsWith(treePath +
|
|
58590
|
+
if (cwd && (cwd === treePath || cwd.startsWith(treePath + sep7)) && !isCodexAppServer(pid, procRoot))
|
|
58521
58591
|
pids.push(pid);
|
|
58522
58592
|
}
|
|
58523
58593
|
return pids;
|
|
@@ -58673,12 +58743,12 @@ function pollGitState(cwd, onChange) {
|
|
|
58673
58743
|
}
|
|
58674
58744
|
|
|
58675
58745
|
// src/commands/sessions/daemon/worktree/holdStopped.ts
|
|
58676
|
-
function holdStopped(session, tree,
|
|
58677
|
-
if (session.undurable?.reason !==
|
|
58746
|
+
function holdStopped(session, tree, reason6, recheck, notify2) {
|
|
58747
|
+
if (session.undurable?.reason !== reason6)
|
|
58678
58748
|
daemonLog(
|
|
58679
|
-
`session ${session.id} stopped; ${tree.removable ? "reap" : "close"} blocked in ${tree.path}: ${
|
|
58749
|
+
`session ${session.id} stopped; ${tree.removable ? "reap" : "close"} blocked in ${tree.path}: ${reason6}`
|
|
58680
58750
|
);
|
|
58681
|
-
session.undurable = { reason:
|
|
58751
|
+
session.undurable = { reason: reason6, removesTree: tree.removable };
|
|
58682
58752
|
session.closing = void 0;
|
|
58683
58753
|
setStatus2(session, "stopped");
|
|
58684
58754
|
if (!session.gitWatcher) {
|
|
@@ -58851,7 +58921,7 @@ async function flushAllPhaseActiveMs(sessions) {
|
|
|
58851
58921
|
}
|
|
58852
58922
|
|
|
58853
58923
|
// src/commands/sessions/daemon/closeSessionPreviews.ts
|
|
58854
|
-
function closeSessionPreviews(session, waiters,
|
|
58924
|
+
function closeSessionPreviews(session, waiters, reason6) {
|
|
58855
58925
|
const previews = [session.pendingPrPreview, session.pendingShow].filter(
|
|
58856
58926
|
(p) => p !== void 0
|
|
58857
58927
|
);
|
|
@@ -58862,7 +58932,7 @@ function closeSessionPreviews(session, waiters, reason4) {
|
|
|
58862
58932
|
type: "pr-decision",
|
|
58863
58933
|
requestId: blocking.requestId,
|
|
58864
58934
|
decision: "reject",
|
|
58865
|
-
reason:
|
|
58935
|
+
reason: reason6,
|
|
58866
58936
|
dismissed: true
|
|
58867
58937
|
});
|
|
58868
58938
|
waiters.delete(session.id);
|
|
@@ -58870,7 +58940,7 @@ function closeSessionPreviews(session, waiters, reason4) {
|
|
|
58870
58940
|
session.pendingShow = void 0;
|
|
58871
58941
|
for (const p of previews)
|
|
58872
58942
|
daemonLog(
|
|
58873
|
-
`pr-preview closed: id=${session.id} requestId=${p.requestId} kind=${p.kind ?? "pr"} (${
|
|
58943
|
+
`pr-preview closed: id=${session.id} requestId=${p.requestId} kind=${p.kind ?? "pr"} (${reason6})`
|
|
58874
58944
|
);
|
|
58875
58945
|
return previews.length > 0;
|
|
58876
58946
|
}
|
|
@@ -59137,9 +59207,9 @@ var PrPreviewCoordinator = class {
|
|
|
59137
59207
|
decide(d) {
|
|
59138
59208
|
decidePrPreview(this.sessions, this.waiters, this.notify, d);
|
|
59139
59209
|
}
|
|
59140
|
-
closeAll(id,
|
|
59210
|
+
closeAll(id, reason6) {
|
|
59141
59211
|
const session = this.sessions.get(id);
|
|
59142
|
-
if (session && closeSessionPreviews(session, this.waiters,
|
|
59212
|
+
if (session && closeSessionPreviews(session, this.waiters, reason6))
|
|
59143
59213
|
this.notify();
|
|
59144
59214
|
}
|
|
59145
59215
|
clearWaiter(client) {
|
|
@@ -59484,7 +59554,7 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
|
|
|
59484
59554
|
|
|
59485
59555
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
59486
59556
|
import { existsSync as existsSync111, mkdirSync as mkdirSync44, watch as watch2 } from "fs";
|
|
59487
|
-
import { dirname as
|
|
59557
|
+
import { dirname as dirname56 } from "path";
|
|
59488
59558
|
|
|
59489
59559
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
59490
59560
|
function applyActivityToSession(session, activity2) {
|
|
@@ -59668,7 +59738,7 @@ var DEBOUNCE_MS2 = 50;
|
|
|
59668
59738
|
function watchActivity(session, notify2, onConversation) {
|
|
59669
59739
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
59670
59740
|
const path128 = activityPath(session.id);
|
|
59671
|
-
const dir =
|
|
59741
|
+
const dir = dirname56(path128);
|
|
59672
59742
|
try {
|
|
59673
59743
|
mkdirSync44(dir, { recursive: true });
|
|
59674
59744
|
} catch {
|
|
@@ -60476,7 +60546,7 @@ function transferRefusal(s, target, links2) {
|
|
|
60476
60546
|
}
|
|
60477
60547
|
|
|
60478
60548
|
// src/commands/sessions/daemon/transfer/pushTransferSnapshot.ts
|
|
60479
|
-
import { basename as
|
|
60549
|
+
import { basename as basename36 } from "path";
|
|
60480
60550
|
|
|
60481
60551
|
// src/commands/sessions/daemon/transfer/TransferSnapshot.ts
|
|
60482
60552
|
function transferRefFor(itemId2) {
|
|
@@ -60512,7 +60582,7 @@ var WIP_COMMIT = [
|
|
|
60512
60582
|
];
|
|
60513
60583
|
async function currentBranch6(path128, treeRoot) {
|
|
60514
60584
|
const branch2 = await gitOrNull(path128, ["symbolic-ref", "--short", "HEAD"]);
|
|
60515
|
-
if (!branch2 || treeRoot && branch2 ===
|
|
60585
|
+
if (!branch2 || treeRoot && branch2 === basename36(treeRoot)) return void 0;
|
|
60516
60586
|
return branch2;
|
|
60517
60587
|
}
|
|
60518
60588
|
async function upstreamBranch2(path128) {
|
|
@@ -60560,8 +60630,8 @@ async function snapshotOrFail(s, args, traceId) {
|
|
|
60560
60630
|
try {
|
|
60561
60631
|
return { ok: true, snapshot: await snapshotTree(s, args, traceId) };
|
|
60562
60632
|
} catch (error) {
|
|
60563
|
-
const
|
|
60564
|
-
return { ok: false, error: `push failed: ${
|
|
60633
|
+
const reason6 = error instanceof Error ? error.message : String(error);
|
|
60634
|
+
return { ok: false, error: `push failed: ${reason6}` };
|
|
60565
60635
|
}
|
|
60566
60636
|
}
|
|
60567
60637
|
|
|
@@ -60714,12 +60784,12 @@ function setStatusFromHook(sessions, report, notify2, onStatusChange) {
|
|
|
60714
60784
|
}
|
|
60715
60785
|
|
|
60716
60786
|
// src/commands/sessions/daemon/announceFreshRestart.ts
|
|
60717
|
-
function announceFreshRestart(session, clients,
|
|
60787
|
+
function announceFreshRestart(session, clients, reason6) {
|
|
60718
60788
|
emitSessionOutput(
|
|
60719
60789
|
session,
|
|
60720
60790
|
clients,
|
|
60721
60791
|
`\r
|
|
60722
|
-
\x1B[33mRestarted without the previous conversation: ${
|
|
60792
|
+
\x1B[33mRestarted without the previous conversation: ${reason6}\x1B[0m\r
|
|
60723
60793
|
\r
|
|
60724
60794
|
`
|
|
60725
60795
|
);
|
|
@@ -60727,19 +60797,19 @@ function announceFreshRestart(session, clients, reason4) {
|
|
|
60727
60797
|
|
|
60728
60798
|
// src/commands/sessions/daemon/refuseSpawn.ts
|
|
60729
60799
|
function refuseSpawn(session, error, clients, onStatusChange, stage = "respawned") {
|
|
60730
|
-
const
|
|
60800
|
+
const reason6 = error instanceof Error ? error.message : String(error);
|
|
60731
60801
|
session.pty = null;
|
|
60732
60802
|
session.pendingStart = void 0;
|
|
60733
|
-
session.error =
|
|
60803
|
+
session.error = reason6;
|
|
60734
60804
|
daemonLog(
|
|
60735
|
-
`session ${session.id} ("${session.name}") not ${stage}: ${
|
|
60805
|
+
`session ${session.id} ("${session.name}") not ${stage}: ${reason6}`
|
|
60736
60806
|
);
|
|
60737
60807
|
broadcast(clients, { type: "clear", sessionId: session.id });
|
|
60738
60808
|
emitSessionOutput(
|
|
60739
60809
|
session,
|
|
60740
60810
|
clients,
|
|
60741
60811
|
`\r
|
|
60742
|
-
\x1B[31mCannot start this session: ${
|
|
60812
|
+
\x1B[31mCannot start this session: ${reason6}\x1B[0m\r
|
|
60743
60813
|
`
|
|
60744
60814
|
);
|
|
60745
60815
|
onStatusChange(session, "error");
|
|
@@ -61153,7 +61223,7 @@ function deferralNotice(persisted, cap2) {
|
|
|
61153
61223
|
// src/commands/sessions/daemon/worktree/underTempRoot.ts
|
|
61154
61224
|
import { realpathSync as realpathSync5 } from "fs";
|
|
61155
61225
|
import { tmpdir as tmpdir9 } from "os";
|
|
61156
|
-
import { sep as
|
|
61226
|
+
import { sep as sep8 } from "path";
|
|
61157
61227
|
function tempRoots() {
|
|
61158
61228
|
const raw = tmpdir9();
|
|
61159
61229
|
const roots = /* @__PURE__ */ new Set([raw]);
|
|
@@ -61166,7 +61236,7 @@ function tempRoots() {
|
|
|
61166
61236
|
}
|
|
61167
61237
|
function underTempRoot(path128) {
|
|
61168
61238
|
return tempRoots().some(
|
|
61169
|
-
(root2) => path128.startsWith(root2.endsWith(
|
|
61239
|
+
(root2) => path128.startsWith(root2.endsWith(sep8) ? root2 : root2 + sep8)
|
|
61170
61240
|
);
|
|
61171
61241
|
}
|
|
61172
61242
|
|
|
@@ -61179,10 +61249,10 @@ function droppedReason(entry) {
|
|
|
61179
61249
|
}
|
|
61180
61250
|
function dropUnrestorableSessions(persisted) {
|
|
61181
61251
|
return persisted.filter((entry) => {
|
|
61182
|
-
const
|
|
61183
|
-
if (!
|
|
61252
|
+
const reason6 = droppedReason(entry);
|
|
61253
|
+
if (!reason6) return true;
|
|
61184
61254
|
daemonLog(
|
|
61185
|
-
`persisted session ${describePersistedSession(entry)} ${
|
|
61255
|
+
`persisted session ${describePersistedSession(entry)} ${reason6}; dropped rather than restored`
|
|
61186
61256
|
);
|
|
61187
61257
|
return false;
|
|
61188
61258
|
});
|
|
@@ -61190,9 +61260,9 @@ function dropUnrestorableSessions(persisted) {
|
|
|
61190
61260
|
|
|
61191
61261
|
// src/commands/sessions/daemon/logDroppedSession.ts
|
|
61192
61262
|
function logDroppedSession(persisted, error) {
|
|
61193
|
-
const
|
|
61263
|
+
const reason6 = error instanceof Error ? error.message : String(error);
|
|
61194
61264
|
daemonLog(
|
|
61195
|
-
`dropped persisted session ${describePersistedSession(persisted)}: ${
|
|
61265
|
+
`dropped persisted session ${describePersistedSession(persisted)}: ${reason6}`
|
|
61196
61266
|
);
|
|
61197
61267
|
}
|
|
61198
61268
|
|
|
@@ -61620,14 +61690,14 @@ function restoreOne(persisted, spawner, sessions) {
|
|
|
61620
61690
|
else logUnresumable(persisted.name, id, sessions.get(id));
|
|
61621
61691
|
return id;
|
|
61622
61692
|
} catch (error) {
|
|
61623
|
-
const
|
|
61624
|
-
spawnErrorCard(persisted, spawner,
|
|
61693
|
+
const reason6 = logRestoreError(persisted, error);
|
|
61694
|
+
spawnErrorCard(persisted, spawner, reason6);
|
|
61625
61695
|
return void 0;
|
|
61626
61696
|
}
|
|
61627
61697
|
}
|
|
61628
|
-
function spawnErrorCard(persisted, spawner,
|
|
61698
|
+
function spawnErrorCard(persisted, spawner, reason6) {
|
|
61629
61699
|
try {
|
|
61630
|
-
spawner.recoveryCard((id) => errorSession(id, persisted,
|
|
61700
|
+
spawner.recoveryCard((id) => errorSession(id, persisted, reason6));
|
|
61631
61701
|
} catch (cardError) {
|
|
61632
61702
|
logDroppedSession(persisted, cardError);
|
|
61633
61703
|
}
|
|
@@ -61639,11 +61709,11 @@ function logUnresumable(name2, id, session) {
|
|
|
61639
61709
|
);
|
|
61640
61710
|
}
|
|
61641
61711
|
function logRestoreError(persisted, error) {
|
|
61642
|
-
const
|
|
61712
|
+
const reason6 = error instanceof Error ? error.message : String(error);
|
|
61643
61713
|
daemonLog(
|
|
61644
|
-
`failed to restore session ${describePersistedSession(persisted)}: ${
|
|
61714
|
+
`failed to restore session ${describePersistedSession(persisted)}: ${reason6}`
|
|
61645
61715
|
);
|
|
61646
|
-
return
|
|
61716
|
+
return reason6;
|
|
61647
61717
|
}
|
|
61648
61718
|
|
|
61649
61719
|
// src/commands/sessions/daemon/restoreAll.ts
|
|
@@ -61691,7 +61761,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
61691
61761
|
|
|
61692
61762
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
61693
61763
|
import { existsSync as existsSync113 } from "fs";
|
|
61694
|
-
import { basename as
|
|
61764
|
+
import { basename as basename38 } from "path";
|
|
61695
61765
|
|
|
61696
61766
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
61697
61767
|
function accountedTrees(sessions) {
|
|
@@ -61713,6 +61783,7 @@ function accountedTrees(sessions) {
|
|
|
61713
61783
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
61714
61784
|
import { existsSync as existsSync112 } from "fs";
|
|
61715
61785
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
61786
|
+
for (const { path: path128 } of paths) await removeBindMountContainers(path128);
|
|
61716
61787
|
if (!existsSync112(clone)) {
|
|
61717
61788
|
for (const { path: path128 } of paths) forgetWorktree(path128);
|
|
61718
61789
|
daemonLog(
|
|
@@ -61765,10 +61836,10 @@ function logVanishedTree(sessions, path128) {
|
|
|
61765
61836
|
|
|
61766
61837
|
// src/commands/sessions/daemon/worktree/describeHeldWork.ts
|
|
61767
61838
|
var MAX_ITEMS = 20;
|
|
61768
|
-
async function describeHeldWork(path128,
|
|
61769
|
-
if (
|
|
61770
|
-
if (
|
|
61771
|
-
return { summary:
|
|
61839
|
+
async function describeHeldWork(path128, reason6) {
|
|
61840
|
+
if (reason6.startsWith("uncommitted")) return await changedFiles(path128);
|
|
61841
|
+
if (reason6.startsWith("unpushed")) return await unpushedCommits(path128, reason6);
|
|
61842
|
+
return { summary: reason6, items: [] };
|
|
61772
61843
|
}
|
|
61773
61844
|
async function changedFiles(path128) {
|
|
61774
61845
|
const status2 = await gitResult(path128, ["status", "--porcelain"]);
|
|
@@ -61778,9 +61849,9 @@ async function changedFiles(path128) {
|
|
|
61778
61849
|
items: capped2(lines)
|
|
61779
61850
|
};
|
|
61780
61851
|
}
|
|
61781
|
-
async function unpushedCommits(path128,
|
|
61852
|
+
async function unpushedCommits(path128, reason6) {
|
|
61782
61853
|
const log2 = await gitResult(path128, ["log", "--oneline", "@{upstream}..HEAD"]);
|
|
61783
|
-
if (!log2.ok) return { summary:
|
|
61854
|
+
if (!log2.ok) return { summary: reason6, items: [] };
|
|
61784
61855
|
const lines = nonEmptyLines(log2.out);
|
|
61785
61856
|
return {
|
|
61786
61857
|
summary: `${lines.length} unpushed ${lines.length === 1 ? "commit" : "commits"}`,
|
|
@@ -61799,9 +61870,9 @@ function capped2(lines) {
|
|
|
61799
61870
|
}
|
|
61800
61871
|
|
|
61801
61872
|
// src/commands/sessions/daemon/worktree/resurfaceOrphanedWorktree.ts
|
|
61802
|
-
import { basename as
|
|
61873
|
+
import { basename as basename37 } from "path";
|
|
61803
61874
|
function resurfaceOrphanedWorktree(sessions, spawnWith, recovered, notify2) {
|
|
61804
|
-
const { orphan, reason:
|
|
61875
|
+
const { orphan, reason: reason6, held } = recovered;
|
|
61805
61876
|
let id;
|
|
61806
61877
|
try {
|
|
61807
61878
|
id = spawnWith((sid) => orphanedSession(sid, recovered));
|
|
@@ -61812,24 +61883,24 @@ function resurfaceOrphanedWorktree(sessions, spawnWith, recovered, notify2) {
|
|
|
61812
61883
|
return;
|
|
61813
61884
|
}
|
|
61814
61885
|
daemonLog(
|
|
61815
|
-
`orphaned worktree ${orphan.path} resurfaced as stopped ${sessions.get(id)?.harness ?? "unknown-harness"} session ${id}: ${
|
|
61886
|
+
`orphaned worktree ${orphan.path} resurfaced as stopped ${sessions.get(id)?.harness ?? "unknown-harness"} session ${id}: ${reason6} (${held.summary})`
|
|
61816
61887
|
);
|
|
61817
61888
|
const session = sessions.get(id);
|
|
61818
61889
|
if (session) armStoppedSession(sessions, session, notify2);
|
|
61819
61890
|
notify2();
|
|
61820
61891
|
}
|
|
61821
61892
|
function orphanedSession(id, recovered) {
|
|
61822
|
-
const { orphan, reason:
|
|
61893
|
+
const { orphan, reason: reason6, held } = recovered;
|
|
61823
61894
|
return {
|
|
61824
61895
|
...sessionBase(id, "stopped"),
|
|
61825
|
-
name: `recovered ${
|
|
61896
|
+
name: `recovered ${basename37(orphan.path)}`,
|
|
61826
61897
|
subtitle: `${held.summary} in ${orphan.path}`,
|
|
61827
61898
|
commandType: "claude",
|
|
61828
61899
|
harness: orphan.harness ?? loadConfigFrom(orphan.clone).harness.engine,
|
|
61829
61900
|
pty: null,
|
|
61830
61901
|
cwd: orphan.path,
|
|
61831
61902
|
worktree: { path: orphan.path, clone: orphan.clone },
|
|
61832
|
-
undurable: { reason:
|
|
61903
|
+
undurable: { reason: reason6, removesTree: true },
|
|
61833
61904
|
scrollback: recoveryNotice(recovered)
|
|
61834
61905
|
};
|
|
61835
61906
|
}
|
|
@@ -61853,10 +61924,10 @@ async function recoverOrphan(sessions, spawnWith, orphan, notify2) {
|
|
|
61853
61924
|
const durability = await checkDurability(orphan.path);
|
|
61854
61925
|
if (durability.durable) {
|
|
61855
61926
|
const removal = await reapWorktree(orphan.path);
|
|
61856
|
-
if (!removal.removed && holdsNoCheckout(orphan.path) &&
|
|
61857
|
-
markLeftover(orphan.path, removal.reason);
|
|
61927
|
+
if (!removal.removed && holdsNoCheckout(orphan.path) && cleanLeftoversEnabled()) {
|
|
61928
|
+
markLeftover(orphan.path, removal.deferred ? removal.reason : void 0);
|
|
61858
61929
|
daemonLog(
|
|
61859
|
-
`worktree ${orphan.path} could not be reaped;
|
|
61930
|
+
`worktree ${orphan.path} could not be reaped; marked reaped so each daemon restart retries its removal${removal.deferred ? " once Docker is reachable" : ""}`
|
|
61860
61931
|
);
|
|
61861
61932
|
}
|
|
61862
61933
|
return;
|
|
@@ -61873,29 +61944,30 @@ async function recoverOrphan(sessions, spawnWith, orphan, notify2) {
|
|
|
61873
61944
|
// src/commands/sessions/daemon/worktree/recheckReapedWorktrees.ts
|
|
61874
61945
|
async function recheckReapedWorktrees(accounted) {
|
|
61875
61946
|
for (const record3 of readReapedWorktreeRegistry()) {
|
|
61876
|
-
if (
|
|
61877
|
-
if (underTempRoot(record3.path) || !holdsNoCheckout(record3.path))
|
|
61878
|
-
|
|
61879
|
-
|
|
61880
|
-
|
|
61947
|
+
if (accounted.has(record3.path)) continue;
|
|
61948
|
+
if (underTempRoot(record3.path) || !holdsNoCheckout(record3.path)) {
|
|
61949
|
+
if (record3.leftover) clearLeftover(record3.path);
|
|
61950
|
+
continue;
|
|
61951
|
+
}
|
|
61952
|
+
daemonLog(
|
|
61953
|
+
`worktree ${record3.path} reappeared after reaping with no .git; removing it`
|
|
61954
|
+
);
|
|
61955
|
+
await removeBindMountContainers(record3.path);
|
|
61956
|
+
const removal = await deleteTreeDirectly(
|
|
61957
|
+
record3.clone,
|
|
61958
|
+
record3.path,
|
|
61959
|
+
"it reappeared after its worktree was reaped, with no .git (e.g. recreated by dockerd as a bind-mount source)"
|
|
61960
|
+
);
|
|
61961
|
+
if (removal.removed) {
|
|
61962
|
+
if (record3.leftover) clearLeftover(record3.path);
|
|
61963
|
+
continue;
|
|
61964
|
+
}
|
|
61965
|
+
markLeftover(record3.path, removal.deferred ? removal.reason : void 0);
|
|
61881
61966
|
daemonLog(
|
|
61882
|
-
`worktree ${record3.path} reappeared
|
|
61967
|
+
`worktree ${record3.path} reappeared and could not be removed${removal.deferred ? " yet (waiting on Docker)" : ""}; retried on the next daemon restart: ${removal.reason}`
|
|
61883
61968
|
);
|
|
61884
61969
|
}
|
|
61885
61970
|
}
|
|
61886
|
-
async function clearReappearedTree(record3) {
|
|
61887
|
-
const contents = leftoverContents(record3.path);
|
|
61888
|
-
if (contents.holdsFiles) return reviewFirst(contents);
|
|
61889
|
-
const removal = await deleteTreeDirectly(
|
|
61890
|
-
record3.clone,
|
|
61891
|
-
record3.path,
|
|
61892
|
-
"it reappeared after its worktree was reaped, holding only empty directories (e.g. recreated by dockerd as a bind-mount source)"
|
|
61893
|
-
);
|
|
61894
|
-
return removal.removed ? null : removal.reason;
|
|
61895
|
-
}
|
|
61896
|
-
function reviewFirst(contents) {
|
|
61897
|
-
return `it reappeared after its worktree was reaped and holds files${contents.foreignOwned ? " (some not owned by you)" : ""} that assist will not delete unreviewed; check them before removing it`;
|
|
61898
|
-
}
|
|
61899
61971
|
|
|
61900
61972
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
61901
61973
|
function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
|
|
@@ -61904,6 +61976,7 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
|
|
|
61904
61976
|
}
|
|
61905
61977
|
async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
61906
61978
|
const accounted = accountedTrees(sessions);
|
|
61979
|
+
const attempted2 = /* @__PURE__ */ new Set();
|
|
61907
61980
|
const vanished = /* @__PURE__ */ new Map();
|
|
61908
61981
|
for (const { path: path128, clone, harness } of readWorktreeRegistry()) {
|
|
61909
61982
|
if (underTempRoot(path128)) {
|
|
@@ -61917,17 +61990,20 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
61917
61990
|
logVanishedTree(sessions, path128);
|
|
61918
61991
|
vanished.set(clone, [
|
|
61919
61992
|
...vanished.get(clone) ?? [],
|
|
61920
|
-
{ path: path128, branch:
|
|
61993
|
+
{ path: path128, branch: basename38(path128) }
|
|
61921
61994
|
]);
|
|
61922
61995
|
continue;
|
|
61923
61996
|
}
|
|
61924
61997
|
if (accounted.has(path128)) continue;
|
|
61998
|
+
attempted2.add(path128);
|
|
61925
61999
|
await recoverOrphan(sessions, spawnWith, { path: path128, clone, harness }, notify2);
|
|
61926
62000
|
}
|
|
61927
62001
|
for (const [clone, paths] of vanished)
|
|
61928
62002
|
await reclaimVanishedWorktrees(clone, paths);
|
|
61929
|
-
if (
|
|
61930
|
-
await recheckReapedWorktrees(
|
|
62003
|
+
if (cleanLeftoversEnabled())
|
|
62004
|
+
await recheckReapedWorktrees(
|
|
62005
|
+
/* @__PURE__ */ new Set([...accountedTrees(sessions), ...attempted2])
|
|
62006
|
+
);
|
|
61931
62007
|
}
|
|
61932
62008
|
|
|
61933
62009
|
// src/commands/sessions/daemon/startHeldInTree.ts
|
|
@@ -62097,9 +62173,9 @@ function shutdownSessions(sessions) {
|
|
|
62097
62173
|
session.pty?.kill();
|
|
62098
62174
|
} catch (error) {
|
|
62099
62175
|
failures++;
|
|
62100
|
-
const
|
|
62176
|
+
const reason6 = error instanceof Error ? error.message : String(error);
|
|
62101
62177
|
daemonLog(
|
|
62102
|
-
`shutting down: killing session ${session.name} (${session.id}) failed: ${
|
|
62178
|
+
`shutting down: killing session ${session.name} (${session.id}) failed: ${reason6}`
|
|
62103
62179
|
);
|
|
62104
62180
|
}
|
|
62105
62181
|
}
|
|
@@ -62115,9 +62191,9 @@ function recordInterruptions(sessions) {
|
|
|
62115
62191
|
try {
|
|
62116
62192
|
persistLiveSessions(sessions);
|
|
62117
62193
|
} catch (error) {
|
|
62118
|
-
const
|
|
62194
|
+
const reason6 = error instanceof Error ? error.message : String(error);
|
|
62119
62195
|
daemonLog(
|
|
62120
|
-
`shutting down: could not record the restart against the sessions (${
|
|
62196
|
+
`shutting down: could not record the restart against the sessions (${reason6}); they will resume without knowing why they stopped`
|
|
62121
62197
|
);
|
|
62122
62198
|
}
|
|
62123
62199
|
}
|
|
@@ -62361,8 +62437,8 @@ function failPendingCreators(state, message4) {
|
|
|
62361
62437
|
}
|
|
62362
62438
|
state.pendingCreators = [];
|
|
62363
62439
|
}
|
|
62364
|
-
function resetRelayState(state,
|
|
62365
|
-
failPendingCreators(state,
|
|
62440
|
+
function resetRelayState(state, reason6) {
|
|
62441
|
+
failPendingCreators(state, reason6);
|
|
62366
62442
|
for (const resolve36 of state.historyWaiters) resolve36([]);
|
|
62367
62443
|
state.historyWaiters = [];
|
|
62368
62444
|
state.sessions = [];
|
|
@@ -62482,11 +62558,11 @@ function armCreateTimeout(ctx, client, data, traceId) {
|
|
|
62482
62558
|
function forwardLinkCreate(ctx, client, data) {
|
|
62483
62559
|
const node = ctx.spec.name;
|
|
62484
62560
|
if (!ctx.greeted) {
|
|
62485
|
-
const
|
|
62486
|
-
daemonLog(`link ${node} ws: refusing ${data.type}: ${
|
|
62561
|
+
const reason6 = unavailableReason(ctx);
|
|
62562
|
+
daemonLog(`link ${node} ws: refusing ${data.type}: ${reason6}`);
|
|
62487
62563
|
sendTo(client, {
|
|
62488
62564
|
type: "error",
|
|
62489
|
-
message: `${node} unavailable: ${
|
|
62565
|
+
message: `${node} unavailable: ${reason6}`
|
|
62490
62566
|
});
|
|
62491
62567
|
return;
|
|
62492
62568
|
}
|
|
@@ -62543,14 +62619,14 @@ function acceptPeerHello(linkName, msg) {
|
|
|
62543
62619
|
return { kind: "accept", peer, protocol };
|
|
62544
62620
|
}
|
|
62545
62621
|
const mode = linkVersionCheck();
|
|
62546
|
-
const
|
|
62622
|
+
const reason6 = describeProtocolGap(linkName, msg);
|
|
62547
62623
|
if (mode !== "block") {
|
|
62548
62624
|
daemonLog(
|
|
62549
|
-
`link ${linkName} ws: ${
|
|
62625
|
+
`link ${linkName} ws: ${reason6}; proceeding (sessions.linkVersionCheck=${mode})`
|
|
62550
62626
|
);
|
|
62551
62627
|
return { kind: "accept", peer };
|
|
62552
62628
|
}
|
|
62553
|
-
return { kind: "block", reason:
|
|
62629
|
+
return { kind: "block", reason: reason6, peer };
|
|
62554
62630
|
}
|
|
62555
62631
|
|
|
62556
62632
|
// src/commands/sessions/daemon/logUnrecognisedType.ts
|
|
@@ -62816,9 +62892,9 @@ function onLinkLine(ctx, line) {
|
|
|
62816
62892
|
}
|
|
62817
62893
|
|
|
62818
62894
|
// src/commands/sessions/daemon/links/openLink.ts
|
|
62819
|
-
function onLinkClose(ctx, socket,
|
|
62895
|
+
function onLinkClose(ctx, socket, reason6) {
|
|
62820
62896
|
if (ctx.socket !== socket) return;
|
|
62821
|
-
daemonLog(`link ${ctx.spec.name} ws: closed (${
|
|
62897
|
+
daemonLog(`link ${ctx.spec.name} ws: closed (${reason6})`);
|
|
62822
62898
|
teardownLink(ctx);
|
|
62823
62899
|
scheduleReconnect2(ctx);
|
|
62824
62900
|
}
|
|
@@ -62835,7 +62911,7 @@ async function openLink(ctx) {
|
|
|
62835
62911
|
),
|
|
62836
62912
|
onClose: guardLinkCallback(
|
|
62837
62913
|
`link ${ctx.spec.name} ws: close handler`,
|
|
62838
|
-
(
|
|
62914
|
+
(reason6) => onLinkClose(ctx, socket, reason6)
|
|
62839
62915
|
)
|
|
62840
62916
|
});
|
|
62841
62917
|
if (ctx.disposed) return socket.close();
|
|
@@ -63044,8 +63120,8 @@ function replayScrollback(sessions, client) {
|
|
|
63044
63120
|
function joinableStream(sessions, targetId) {
|
|
63045
63121
|
const target = sessions.get(targetId);
|
|
63046
63122
|
if (!target) return { reason: "no such session" };
|
|
63047
|
-
const
|
|
63048
|
-
return
|
|
63123
|
+
const reason6 = joinRefusal(target);
|
|
63124
|
+
return reason6 ? { reason: reason6 } : { session: target };
|
|
63049
63125
|
}
|
|
63050
63126
|
|
|
63051
63127
|
// src/commands/sessions/daemon/worktree/spawnIntoStream.ts
|
|
@@ -63815,9 +63891,9 @@ function creator(isNew, spawn15) {
|
|
|
63815
63891
|
sendTo(client, { type: "created", sessionId: result, isNew, traceId });
|
|
63816
63892
|
};
|
|
63817
63893
|
const fail14 = (client, d, error) => {
|
|
63818
|
-
const
|
|
63819
|
-
daemonLog(`${d.type} failed: ${
|
|
63820
|
-
reply2(client, d, { error: `${d.type} failed: ${
|
|
63894
|
+
const reason6 = error instanceof Error ? error.message : String(error);
|
|
63895
|
+
daemonLog(`${d.type} failed: ${reason6}`);
|
|
63896
|
+
reply2(client, d, { error: `${d.type} failed: ${reason6}` });
|
|
63821
63897
|
};
|
|
63822
63898
|
return (client, m, d) => {
|
|
63823
63899
|
if (m.links.route(client, d)) return;
|
|
@@ -64028,13 +64104,13 @@ function routeOutputToLink(client, links2, data) {
|
|
|
64028
64104
|
const split = typeof sessionId2 === "string" ? splitNodeSessionId(sessionId2) : void 0;
|
|
64029
64105
|
if (!split) return data;
|
|
64030
64106
|
if (split.node === links2.localNode()) return { ...data, sessionId: split.id };
|
|
64031
|
-
const
|
|
64032
|
-
if (
|
|
64033
|
-
daemonLog(`output requested: id=${sessionId2} ${
|
|
64107
|
+
const reason6 = unavailable(links2, split.node);
|
|
64108
|
+
if (reason6) {
|
|
64109
|
+
daemonLog(`output requested: id=${sessionId2} ${reason6}`);
|
|
64034
64110
|
sendTo(client, {
|
|
64035
64111
|
type: "session-output",
|
|
64036
64112
|
sessionId: sessionId2,
|
|
64037
|
-
error: `Cannot read session ${sessionId2}: ${
|
|
64113
|
+
error: `Cannot read session ${sessionId2}: ${reason6}`
|
|
64038
64114
|
});
|
|
64039
64115
|
return void 0;
|
|
64040
64116
|
}
|
|
@@ -64281,8 +64357,8 @@ async function handleShutdown(client, manager) {
|
|
|
64281
64357
|
await manager.flushActiveMs();
|
|
64282
64358
|
manager.shutdown();
|
|
64283
64359
|
} catch (error) {
|
|
64284
|
-
const
|
|
64285
|
-
daemonLog(`shutdown teardown failed: ${
|
|
64360
|
+
const reason6 = error instanceof Error ? error.message : String(error);
|
|
64361
|
+
daemonLog(`shutdown teardown failed: ${reason6}; exiting anyway`);
|
|
64286
64362
|
}
|
|
64287
64363
|
sendTo(client, { type: "shutting-down" });
|
|
64288
64364
|
setImmediate(() => process.exit(0));
|
|
@@ -64623,12 +64699,12 @@ async function spawnTransferredRun(ctx, discard, { assistArgs, cwd, meta, snapsh
|
|
|
64623
64699
|
try {
|
|
64624
64700
|
await prepared;
|
|
64625
64701
|
} catch (error) {
|
|
64626
|
-
const
|
|
64702
|
+
const reason6 = error instanceof Error ? error.message : String(error);
|
|
64627
64703
|
daemonLog(
|
|
64628
|
-
`session ${id} transfer restore failed ${trace}: ${
|
|
64704
|
+
`session ${id} transfer restore failed ${trace}: ${reason6}; run not started, ${snapshot2.ref} left on origin`
|
|
64629
64705
|
);
|
|
64630
64706
|
discard(id);
|
|
64631
|
-
throw new Error(`restore failed: ${
|
|
64707
|
+
throw new Error(`restore failed: ${reason6}`);
|
|
64632
64708
|
}
|
|
64633
64709
|
daemonLog(`session ${id} transfer restored ${trace}; starting run`);
|
|
64634
64710
|
await confirmTransferredRun(ctx.sessions, id, trace);
|
|
@@ -64653,12 +64729,12 @@ function isPrCheckoutArgs(args) {
|
|
|
64653
64729
|
}
|
|
64654
64730
|
|
|
64655
64731
|
// src/commands/sessions/daemon/worktree/prCheckoutHolder.ts
|
|
64656
|
-
import { execFile as
|
|
64732
|
+
import { execFile as execFile17 } from "child_process";
|
|
64657
64733
|
import { existsSync as existsSync116 } from "fs";
|
|
64658
64734
|
function prHeadBranch2(number, cwd) {
|
|
64659
64735
|
const { headBranch } = prCliCommands(number, cwd);
|
|
64660
64736
|
return new Promise((resolve36) => {
|
|
64661
|
-
|
|
64737
|
+
execFile17(
|
|
64662
64738
|
headBranch.file,
|
|
64663
64739
|
headBranch.args,
|
|
64664
64740
|
{ cwd, encoding: "utf8", windowsHide: true },
|
|
@@ -64884,11 +64960,11 @@ function handleConnection(socket, manager) {
|
|
|
64884
64960
|
try {
|
|
64885
64961
|
dispatchMessage(client, manager, data);
|
|
64886
64962
|
} catch (error) {
|
|
64887
|
-
const
|
|
64888
|
-
daemonLog(`${data.type} failed: ${
|
|
64963
|
+
const reason6 = error instanceof Error ? error.message : String(error);
|
|
64964
|
+
daemonLog(`${data.type} failed: ${reason6}`);
|
|
64889
64965
|
sendTo(client, {
|
|
64890
64966
|
type: "error",
|
|
64891
|
-
message: `${data.type} failed: ${
|
|
64967
|
+
message: `${data.type} failed: ${reason6}`
|
|
64892
64968
|
});
|
|
64893
64969
|
}
|
|
64894
64970
|
});
|
|
@@ -64927,8 +65003,8 @@ function onListening(manager, checkAutoExit) {
|
|
|
64927
65003
|
try {
|
|
64928
65004
|
manager.shutdown();
|
|
64929
65005
|
} catch (error) {
|
|
64930
|
-
const
|
|
64931
|
-
daemonLog(`shutdown teardown failed: ${
|
|
65006
|
+
const reason6 = error instanceof Error ? error.message : String(error);
|
|
65007
|
+
daemonLog(`shutdown teardown failed: ${reason6}; exiting anyway`);
|
|
64932
65008
|
}
|
|
64933
65009
|
process.exit(0);
|
|
64934
65010
|
});
|
|
@@ -65098,6 +65174,18 @@ async function listNodes(options2) {
|
|
|
65098
65174
|
for (const link3 of report.links) console.log(formatLink(link3));
|
|
65099
65175
|
}
|
|
65100
65176
|
|
|
65177
|
+
// src/commands/sessions/daemon/worktree/listLeftovers.ts
|
|
65178
|
+
import { existsSync as existsSync117 } from "fs";
|
|
65179
|
+
function listLeftovers() {
|
|
65180
|
+
const leftovers = [];
|
|
65181
|
+
for (const { path: path128, leftover } of readReapedWorktreeRegistry()) {
|
|
65182
|
+
if (!leftover) continue;
|
|
65183
|
+
if (existsSync117(path128)) leftovers.push({ path: path128, reason: leftover });
|
|
65184
|
+
else clearLeftover(path128);
|
|
65185
|
+
}
|
|
65186
|
+
return leftovers;
|
|
65187
|
+
}
|
|
65188
|
+
|
|
65101
65189
|
// src/commands/sessions/nodes/findUnlinkedWindowsNode.ts
|
|
65102
65190
|
var WINDOWS_NODE_URL = "http://127.0.0.1:3101";
|
|
65103
65191
|
async function findUnlinkedWindowsNode(health2, platform = detectPlatform()) {
|
|
@@ -65138,33 +65226,18 @@ function printDiagnosis(diagnosis) {
|
|
|
65138
65226
|
}
|
|
65139
65227
|
}
|
|
65140
65228
|
|
|
65141
|
-
// src/commands/sessions/nodes/collectLeftovers.ts
|
|
65142
|
-
async function collectLeftovers(specs, fetchPeer = (url) => fetchPeerJson(url, "/api/leftovers")) {
|
|
65143
|
-
const peers = await Promise.all(
|
|
65144
|
-
specs.map((spec) => fetchPeer(spec.url).catch(() => void 0))
|
|
65145
|
-
);
|
|
65146
|
-
return [leftoverReport(), ...peers].filter(
|
|
65147
|
-
(r) => r !== void 0 && r.leftovers.length > 0
|
|
65148
|
-
);
|
|
65149
|
-
}
|
|
65150
|
-
|
|
65151
65229
|
// src/commands/sessions/nodes/printLeftovers.ts
|
|
65152
65230
|
import chalk300 from "chalk";
|
|
65153
|
-
function printLeftovers(
|
|
65154
|
-
|
|
65155
|
-
|
|
65156
|
-
|
|
65157
|
-
|
|
65158
|
-
|
|
65159
|
-
|
|
65160
|
-
|
|
65161
|
-
|
|
65162
|
-
${chalk300.dim(
|
|
65163
|
-
console.log(
|
|
65164
|
-
` Remove them on ${report.nodeName} with:
|
|
65165
|
-
${report.command}`
|
|
65166
|
-
);
|
|
65167
|
-
}
|
|
65231
|
+
function printLeftovers(leftovers) {
|
|
65232
|
+
if (leftovers.length === 0) return;
|
|
65233
|
+
console.log(
|
|
65234
|
+
chalk300.yellow(
|
|
65235
|
+
`${leftovers.length} reaped worktree path(s) waiting on Docker to be deleted; assist retries on each daemon restart`
|
|
65236
|
+
)
|
|
65237
|
+
);
|
|
65238
|
+
for (const { path: path128, reason: reason6 } of leftovers)
|
|
65239
|
+
console.log(` ${path128}
|
|
65240
|
+
${chalk300.dim(reason6)}`);
|
|
65168
65241
|
}
|
|
65169
65242
|
|
|
65170
65243
|
// src/commands/sessions/nodes/doctorNodes.ts
|
|
@@ -65176,7 +65249,7 @@ async function doctorNodes(name2, options2) {
|
|
|
65176
65249
|
const report = {
|
|
65177
65250
|
local: resolveNodeName(),
|
|
65178
65251
|
links: [],
|
|
65179
|
-
leftovers:
|
|
65252
|
+
leftovers: cleanLeftoversEnabled() ? listLeftovers() : []
|
|
65180
65253
|
};
|
|
65181
65254
|
for (const spec of specs) report.links.push(await diagnoseLink(spec, probes));
|
|
65182
65255
|
if (specs.length === 0)
|