@staff0rd/assist 0.1134.0 → 0.1135.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/extension/extension/updates.json +2 -2
- package/dist/commands/sessions/web/bundle.js +474 -474
- package/dist/index.js +588 -381
- 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.
|
|
9
|
+
version: "0.1135.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -6206,6 +6206,8 @@ function userEvents(entry, at2) {
|
|
|
6206
6206
|
const events = [];
|
|
6207
6207
|
const text18 = renderUserPrompt(entry, Number.POSITIVE_INFINITY);
|
|
6208
6208
|
if (text18) events.push({ kind: "message", role: "user", text: text18, at: at2 });
|
|
6209
|
+
else if (normalizeUser(entry).kind === "interrupt")
|
|
6210
|
+
events.push({ kind: "interrupt", at: at2 });
|
|
6209
6211
|
for (const block of claudeContentBlocksOf(contentOf(entry))) {
|
|
6210
6212
|
if (block.type !== "tool_result" || block.is_error) continue;
|
|
6211
6213
|
const body = resultText(block.content).trim();
|
|
@@ -7346,28 +7348,6 @@ var claudeAdapter = {
|
|
|
7346
7348
|
activityIdentity: (conversationId) => ({ claudeSessionId: conversationId })
|
|
7347
7349
|
};
|
|
7348
7350
|
|
|
7349
|
-
// src/commands/sessions/daemon/spawnClaudeSdk.ts
|
|
7350
|
-
import { query } from "@anthropic-ai/claude-agent-sdk";
|
|
7351
|
-
|
|
7352
|
-
// src/commands/sessions/daemon/resolveClaudeExecutable.ts
|
|
7353
|
-
import { execFileSync as execFileSync2 } from "child_process";
|
|
7354
|
-
var opts = {
|
|
7355
|
-
encoding: "utf8",
|
|
7356
|
-
stdio: ["ignore", "pipe", "ignore"],
|
|
7357
|
-
windowsHide: true
|
|
7358
|
-
};
|
|
7359
|
-
function resolveClaudeExecutable() {
|
|
7360
|
-
const found = process.platform === "win32" ? execFileSync2("where", ["claude"], opts) : execFileSync2(
|
|
7361
|
-
process.env.SHELL ?? "bash",
|
|
7362
|
-
["-l", "-c", "command -v claude"],
|
|
7363
|
-
opts
|
|
7364
|
-
);
|
|
7365
|
-
const lines = found.split(/\r?\n/).map((line) => line.trim()).filter((line) => /^(\/|[A-Za-z]:\\)/.test(line));
|
|
7366
|
-
const path128 = lines.find((line) => line.endsWith(".exe")) ?? lines.at(-1);
|
|
7367
|
-
if (!path128) throw new Error("claude is not on PATH");
|
|
7368
|
-
return path128;
|
|
7369
|
-
}
|
|
7370
|
-
|
|
7371
7351
|
// src/commands/sessions/daemon/sdk/createSdkInput.ts
|
|
7372
7352
|
function userMessage(text18) {
|
|
7373
7353
|
return {
|
|
@@ -7435,10 +7415,31 @@ function sdkTerminalStub(label) {
|
|
|
7435
7415
|
};
|
|
7436
7416
|
}
|
|
7437
7417
|
|
|
7418
|
+
// src/commands/sessions/daemon/sdk/sdkSessionHandle.ts
|
|
7419
|
+
function sdkSessionHandle(label) {
|
|
7420
|
+
const listeners = [];
|
|
7421
|
+
let turn;
|
|
7422
|
+
const unbound = (action) => daemonLog(`${label} sdk ${action} dropped: query not started`);
|
|
7423
|
+
const handle = {
|
|
7424
|
+
onEvent: (listener) => listeners.push(listener),
|
|
7425
|
+
send: (text18) => turn ? turn.send(text18) : unbound("message"),
|
|
7426
|
+
interrupt: () => turn ? turn.interrupt() : unbound("interrupt")
|
|
7427
|
+
};
|
|
7428
|
+
return {
|
|
7429
|
+
handle,
|
|
7430
|
+
emit: (event) => {
|
|
7431
|
+
for (const listener of listeners) listener(event);
|
|
7432
|
+
},
|
|
7433
|
+
bind: (controls) => {
|
|
7434
|
+
turn = controls;
|
|
7435
|
+
}
|
|
7436
|
+
};
|
|
7437
|
+
}
|
|
7438
|
+
|
|
7438
7439
|
// src/commands/sessions/daemon/sdk/createSdkSessionProcess.ts
|
|
7439
7440
|
function createSdkSessionProcess(sessionId2, abort2) {
|
|
7440
7441
|
const label = `session ${sessionId2 ?? "?"}`;
|
|
7441
|
-
const
|
|
7442
|
+
const sdk = sdkSessionHandle(label);
|
|
7442
7443
|
const exitListeners = [];
|
|
7443
7444
|
let child2;
|
|
7444
7445
|
let exited = false;
|
|
@@ -7458,13 +7459,11 @@ function createSdkSessionProcess(sessionId2, abort2) {
|
|
|
7458
7459
|
exitListeners.push(listener);
|
|
7459
7460
|
return noopDisposable;
|
|
7460
7461
|
},
|
|
7461
|
-
sdk:
|
|
7462
|
+
sdk: sdk.handle
|
|
7462
7463
|
};
|
|
7463
7464
|
return {
|
|
7464
7465
|
process: sessionProcess,
|
|
7465
|
-
emit:
|
|
7466
|
-
for (const listener of eventListeners) listener(event);
|
|
7467
|
-
},
|
|
7466
|
+
emit: sdk.emit,
|
|
7468
7467
|
exit: (exitCode) => {
|
|
7469
7468
|
if (exited) return;
|
|
7470
7469
|
exited = true;
|
|
@@ -7474,27 +7473,149 @@ function createSdkSessionProcess(sessionId2, abort2) {
|
|
|
7474
7473
|
attach: (spawned) => {
|
|
7475
7474
|
child2 = spawned;
|
|
7476
7475
|
},
|
|
7477
|
-
aborted: () => abort2.signal.aborted
|
|
7476
|
+
aborted: () => abort2.signal.aborted,
|
|
7477
|
+
bind: sdk.bind
|
|
7478
7478
|
};
|
|
7479
7479
|
}
|
|
7480
7480
|
|
|
7481
|
-
// src/commands/sessions/daemon/sdk/
|
|
7482
|
-
function
|
|
7481
|
+
// src/commands/sessions/daemon/sdk/createSdkInterrupt.ts
|
|
7482
|
+
function createSdkInterrupt(label, setInterrupting) {
|
|
7483
|
+
let interrupting = false;
|
|
7484
|
+
const set = (pending) => {
|
|
7485
|
+
if (pending === interrupting) return;
|
|
7486
|
+
interrupting = pending;
|
|
7487
|
+
setInterrupting(pending);
|
|
7488
|
+
};
|
|
7489
|
+
return {
|
|
7490
|
+
clear: () => set(false),
|
|
7491
|
+
request: (busy, request) => {
|
|
7492
|
+
if (!busy || interrupting) {
|
|
7493
|
+
daemonLog(
|
|
7494
|
+
`${label} sdk interrupt ignored: ${interrupting ? "already interrupting" : "no turn running"}`
|
|
7495
|
+
);
|
|
7496
|
+
return;
|
|
7497
|
+
}
|
|
7498
|
+
daemonLog(`${label} sdk interrupt requested`);
|
|
7499
|
+
set(true);
|
|
7500
|
+
request().then(
|
|
7501
|
+
() => daemonLog(`${label} sdk interrupt accepted`),
|
|
7502
|
+
(error) => {
|
|
7503
|
+
daemonLog(
|
|
7504
|
+
`${label} sdk interrupt failed: ${error instanceof Error ? error.message : String(error)}`
|
|
7505
|
+
);
|
|
7506
|
+
set(false);
|
|
7507
|
+
}
|
|
7508
|
+
);
|
|
7509
|
+
}
|
|
7510
|
+
};
|
|
7511
|
+
}
|
|
7512
|
+
|
|
7513
|
+
// src/commands/sessions/daemon/sdk/createSdkMessageQueue.ts
|
|
7514
|
+
var MAX_LOGGED = 200;
|
|
7515
|
+
function quoteForLog(text18) {
|
|
7516
|
+
return JSON.stringify(
|
|
7517
|
+
text18.length > MAX_LOGGED ? `${text18.slice(0, MAX_LOGGED)}\u2026` : text18
|
|
7518
|
+
);
|
|
7519
|
+
}
|
|
7520
|
+
function createSdkMessageQueue(label, control, push2) {
|
|
7521
|
+
let queued = [];
|
|
7522
|
+
const publish = (next3) => {
|
|
7523
|
+
queued = next3;
|
|
7524
|
+
control.emit({ kind: "queued", texts: next3 });
|
|
7525
|
+
};
|
|
7526
|
+
return {
|
|
7527
|
+
add: (text18) => {
|
|
7528
|
+
publish([...queued, text18]);
|
|
7529
|
+
daemonLog(
|
|
7530
|
+
`${label} sdk message queued behind running turn (${queued.length} queued): ${quoteForLog(text18)}`
|
|
7531
|
+
);
|
|
7532
|
+
},
|
|
7533
|
+
flush: () => {
|
|
7534
|
+
if (!queued.length) return false;
|
|
7535
|
+
daemonLog(`${label} sdk sending ${queued.length} queued message(s)`);
|
|
7536
|
+
const text18 = queued.join("\n\n");
|
|
7537
|
+
publish([]);
|
|
7538
|
+
push2(text18);
|
|
7539
|
+
return true;
|
|
7540
|
+
}
|
|
7541
|
+
};
|
|
7542
|
+
}
|
|
7543
|
+
|
|
7544
|
+
// src/commands/sessions/daemon/sdk/createSdkTurnEmitter.ts
|
|
7545
|
+
function createSdkTurnEmitter(label, control) {
|
|
7483
7546
|
let status2;
|
|
7484
7547
|
let activity2 = null;
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7548
|
+
return {
|
|
7549
|
+
activity: (next3) => {
|
|
7550
|
+
if (next3 === activity2) return;
|
|
7551
|
+
activity2 = next3;
|
|
7552
|
+
control.emit({ kind: "activity", text: next3 });
|
|
7553
|
+
},
|
|
7554
|
+
status: (next3) => {
|
|
7555
|
+
if (next3 === status2) return;
|
|
7556
|
+
status2 = next3;
|
|
7557
|
+
daemonLog(`${label} sdk status: ${next3}`);
|
|
7558
|
+
control.emit({ kind: "status", status: next3 });
|
|
7559
|
+
}
|
|
7489
7560
|
};
|
|
7561
|
+
}
|
|
7562
|
+
|
|
7563
|
+
// src/commands/sessions/daemon/sdk/createSdkTurnTracker.ts
|
|
7564
|
+
function createSdkTurnTracker(label, control, push2) {
|
|
7565
|
+
let busy = false;
|
|
7566
|
+
const emit3 = createSdkTurnEmitter(label, control);
|
|
7567
|
+
const queue = createSdkMessageQueue(label, control, push2);
|
|
7568
|
+
const interrupt = createSdkInterrupt(
|
|
7569
|
+
label,
|
|
7570
|
+
(pending) => control.emit({ kind: "interrupting", pending })
|
|
7571
|
+
);
|
|
7490
7572
|
const setStatus3 = (next3) => {
|
|
7491
|
-
|
|
7492
|
-
if (next3 ===
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
|
|
7573
|
+
busy = next3 === "running";
|
|
7574
|
+
if (next3 === "waiting") {
|
|
7575
|
+
emit3.activity(null);
|
|
7576
|
+
interrupt.clear();
|
|
7577
|
+
busy = queue.flush();
|
|
7578
|
+
if (busy) return;
|
|
7579
|
+
}
|
|
7580
|
+
emit3.status(next3);
|
|
7581
|
+
};
|
|
7582
|
+
return {
|
|
7583
|
+
setActivity: emit3.activity,
|
|
7584
|
+
setStatus: setStatus3,
|
|
7585
|
+
start: (prompt) => {
|
|
7586
|
+
busy = true;
|
|
7587
|
+
push2(prompt);
|
|
7588
|
+
},
|
|
7589
|
+
send: (text18) => {
|
|
7590
|
+
if (busy) return queue.add(text18);
|
|
7591
|
+
daemonLog(`${label} sdk message sent: ${quoteForLog(text18)}`);
|
|
7592
|
+
push2(text18);
|
|
7593
|
+
setStatus3("running");
|
|
7594
|
+
},
|
|
7595
|
+
interrupt: (request) => interrupt.request(busy, request)
|
|
7496
7596
|
};
|
|
7497
|
-
|
|
7597
|
+
}
|
|
7598
|
+
|
|
7599
|
+
// src/commands/sessions/daemon/sdk/startSdkQuery.ts
|
|
7600
|
+
import { query } from "@anthropic-ai/claude-agent-sdk";
|
|
7601
|
+
|
|
7602
|
+
// src/commands/sessions/daemon/resolveClaudeExecutable.ts
|
|
7603
|
+
import { execFileSync as execFileSync2 } from "child_process";
|
|
7604
|
+
var opts = {
|
|
7605
|
+
encoding: "utf8",
|
|
7606
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
7607
|
+
windowsHide: true
|
|
7608
|
+
};
|
|
7609
|
+
function resolveClaudeExecutable() {
|
|
7610
|
+
const found = process.platform === "win32" ? execFileSync2("where", ["claude"], opts) : execFileSync2(
|
|
7611
|
+
process.env.SHELL ?? "bash",
|
|
7612
|
+
["-l", "-c", "command -v claude"],
|
|
7613
|
+
opts
|
|
7614
|
+
);
|
|
7615
|
+
const lines = found.split(/\r?\n/).map((line) => line.trim()).filter((line) => /^(\/|[A-Za-z]:\\)/.test(line));
|
|
7616
|
+
const path128 = lines.find((line) => line.endsWith(".exe")) ?? lines.at(-1);
|
|
7617
|
+
if (!path128) throw new Error("claude is not on PATH");
|
|
7618
|
+
return path128;
|
|
7498
7619
|
}
|
|
7499
7620
|
|
|
7500
7621
|
// src/commands/sessions/daemon/sdk/logSdkMessage.ts
|
|
@@ -7546,9 +7667,8 @@ function sdkTurnStatus(message4) {
|
|
|
7546
7667
|
}
|
|
7547
7668
|
|
|
7548
7669
|
// src/commands/sessions/daemon/sdk/runSdkQuery.ts
|
|
7549
|
-
async function runSdkQuery(messages2, sessionId2, control) {
|
|
7670
|
+
async function runSdkQuery(messages2, sessionId2, control, turn) {
|
|
7550
7671
|
const label = `session ${sessionId2 ?? "?"}`;
|
|
7551
|
-
const turn = createSdkTurnTracker(label, control);
|
|
7552
7672
|
try {
|
|
7553
7673
|
for await (const message4 of messages2) {
|
|
7554
7674
|
logSdkMessage(label, message4);
|
|
@@ -7625,18 +7745,8 @@ function sdkQueryOptions(opts2, executable, abort2, control) {
|
|
|
7625
7745
|
};
|
|
7626
7746
|
}
|
|
7627
7747
|
|
|
7628
|
-
// src/commands/sessions/daemon/
|
|
7629
|
-
function
|
|
7630
|
-
refuseMissingCwd(opts2.cwd, opts2.sessionId);
|
|
7631
|
-
const abort2 = new AbortController();
|
|
7632
|
-
const control = createSdkSessionProcess(opts2.sessionId, abort2);
|
|
7633
|
-
const input = createSdkInput();
|
|
7634
|
-
if (opts2.prompt) input.push(opts2.prompt);
|
|
7635
|
-
abort2.signal.addEventListener("abort", input.close);
|
|
7636
|
-
void startQuery(opts2, abort2, control, input.messages);
|
|
7637
|
-
return control.process;
|
|
7638
|
-
}
|
|
7639
|
-
async function startQuery(opts2, abort2, control, prompt) {
|
|
7748
|
+
// src/commands/sessions/daemon/sdk/startSdkQuery.ts
|
|
7749
|
+
async function startSdkQuery(opts2, abort2, control, turn, prompt) {
|
|
7640
7750
|
const label = `session ${opts2.sessionId ?? "?"}`;
|
|
7641
7751
|
try {
|
|
7642
7752
|
const executable = resolveClaudeExecutable();
|
|
@@ -7647,7 +7757,13 @@ async function startQuery(opts2, abort2, control, prompt) {
|
|
|
7647
7757
|
prompt,
|
|
7648
7758
|
options: sdkQueryOptions(opts2, executable, abort2, control)
|
|
7649
7759
|
});
|
|
7650
|
-
|
|
7760
|
+
control.bind({
|
|
7761
|
+
send: turn.send,
|
|
7762
|
+
interrupt: () => turn.interrupt(async () => {
|
|
7763
|
+
await messages2.interrupt();
|
|
7764
|
+
})
|
|
7765
|
+
});
|
|
7766
|
+
await runSdkQuery(messages2, opts2.sessionId, control, turn);
|
|
7651
7767
|
} catch (error) {
|
|
7652
7768
|
daemonLog(
|
|
7653
7769
|
`${label} sdk query not started: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -7656,6 +7772,23 @@ async function startQuery(opts2, abort2, control, prompt) {
|
|
|
7656
7772
|
}
|
|
7657
7773
|
}
|
|
7658
7774
|
|
|
7775
|
+
// src/commands/sessions/daemon/spawnClaudeSdk.ts
|
|
7776
|
+
function spawnClaudeSdk(opts2) {
|
|
7777
|
+
refuseMissingCwd(opts2.cwd, opts2.sessionId);
|
|
7778
|
+
const abort2 = new AbortController();
|
|
7779
|
+
const control = createSdkSessionProcess(opts2.sessionId, abort2);
|
|
7780
|
+
const input = createSdkInput();
|
|
7781
|
+
const turn = createSdkTurnTracker(
|
|
7782
|
+
`session ${opts2.sessionId ?? "?"}`,
|
|
7783
|
+
control,
|
|
7784
|
+
input.push
|
|
7785
|
+
);
|
|
7786
|
+
if (opts2.prompt) turn.start(opts2.prompt);
|
|
7787
|
+
abort2.signal.addEventListener("abort", input.close);
|
|
7788
|
+
void startSdkQuery(opts2, abort2, control, turn, input.messages);
|
|
7789
|
+
return control.process;
|
|
7790
|
+
}
|
|
7791
|
+
|
|
7659
7792
|
// src/shared/harnessAdapters/claudeSdkAdapter.ts
|
|
7660
7793
|
var claudeSdkAdapter = {
|
|
7661
7794
|
...claudeAdapter,
|
|
@@ -7741,11 +7874,20 @@ function buildHarnessCodexArgs() {
|
|
|
7741
7874
|
// src/shared/codexIsolatedHookArgs.ts
|
|
7742
7875
|
var codexIsolatedHookArgs = ["--no-daemon"];
|
|
7743
7876
|
|
|
7744
|
-
// src/shared/
|
|
7745
|
-
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7877
|
+
// src/shared/codexSandboxArgs.ts
|
|
7878
|
+
import { mkdirSync as mkdirSync5 } from "fs";
|
|
7879
|
+
import { homedir as homedir10 } from "os";
|
|
7880
|
+
import { join as join19 } from "path";
|
|
7881
|
+
function codexSandboxArgs() {
|
|
7882
|
+
const assistHome = join19(homedir10(), ".assist");
|
|
7883
|
+
mkdirSync5(assistHome, { recursive: true });
|
|
7884
|
+
return [
|
|
7885
|
+
"-c",
|
|
7886
|
+
"sandbox_workspace_write.network_access=true",
|
|
7887
|
+
"--add-dir",
|
|
7888
|
+
assistHome
|
|
7889
|
+
];
|
|
7890
|
+
}
|
|
7749
7891
|
|
|
7750
7892
|
// src/shared/prepareCodexHookTrust.ts
|
|
7751
7893
|
import { spawnSync } from "child_process";
|
|
@@ -7910,7 +8052,7 @@ function spawnCodex(opts2 = {}) {
|
|
|
7910
8052
|
...codexIsolatedHookArgs,
|
|
7911
8053
|
...override.args,
|
|
7912
8054
|
...sessionEnv,
|
|
7913
|
-
...
|
|
8055
|
+
...codexSandboxArgs(),
|
|
7914
8056
|
...codexDeveloperInstructionsArgs(opts2.appendSystemPromptFile),
|
|
7915
8057
|
...codexArgs(opts2)
|
|
7916
8058
|
],
|
|
@@ -8655,7 +8797,7 @@ function codexHookProbe() {
|
|
|
8655
8797
|
|
|
8656
8798
|
// src/shared/readCodexRulePerms.ts
|
|
8657
8799
|
import { existsSync as existsSync19, readdirSync as readdirSync5, readFileSync as readFileSync13 } from "fs";
|
|
8658
|
-
import { join as
|
|
8800
|
+
import { join as join26 } from "path";
|
|
8659
8801
|
|
|
8660
8802
|
// src/shared/readPatternList.ts
|
|
8661
8803
|
function readString(text18, start2) {
|
|
@@ -8735,15 +8877,15 @@ function parseCodexRules(text18) {
|
|
|
8735
8877
|
function ruleFiles(dir) {
|
|
8736
8878
|
if (!existsSync19(dir)) return [];
|
|
8737
8879
|
try {
|
|
8738
|
-
return readdirSync5(dir).filter((name2) => name2.endsWith(".rules")).sort().map((name2) =>
|
|
8880
|
+
return readdirSync5(dir).filter((name2) => name2.endsWith(".rules")).sort().map((name2) => join26(dir, name2));
|
|
8739
8881
|
} catch {
|
|
8740
8882
|
return [];
|
|
8741
8883
|
}
|
|
8742
8884
|
}
|
|
8743
8885
|
function readCodexRulePerms(key) {
|
|
8744
8886
|
const dirs = [
|
|
8745
|
-
|
|
8746
|
-
|
|
8887
|
+
join26(harnesses.codex.homeDir, "rules"),
|
|
8888
|
+
join26(process.cwd(), ".codex", "rules")
|
|
8747
8889
|
];
|
|
8748
8890
|
return dirs.flatMap(ruleFiles).flatMap((file) => {
|
|
8749
8891
|
try {
|
|
@@ -8777,7 +8919,7 @@ function spawnCodex2(prompt, options2 = {}) {
|
|
|
8777
8919
|
...codexIsolatedHookArgs,
|
|
8778
8920
|
...override.args,
|
|
8779
8921
|
...codexSessionEnvArgs(process.env),
|
|
8780
|
-
...
|
|
8922
|
+
...codexSandboxArgs(),
|
|
8781
8923
|
"-C",
|
|
8782
8924
|
cwd,
|
|
8783
8925
|
"--sandbox",
|
|
@@ -9524,12 +9666,12 @@ async function diffScopes(req, res) {
|
|
|
9524
9666
|
}
|
|
9525
9667
|
|
|
9526
9668
|
// src/commands/sessions/daemon/recordPromptJournal.ts
|
|
9527
|
-
import { appendFileSync as appendFileSync2, mkdirSync as
|
|
9669
|
+
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync8 } from "fs";
|
|
9528
9670
|
import { dirname as dirname9 } from "path";
|
|
9529
9671
|
function recordPromptJournal(entry) {
|
|
9530
9672
|
const line = JSON.stringify({ at: (/* @__PURE__ */ new Date()).toISOString(), ...entry });
|
|
9531
9673
|
try {
|
|
9532
|
-
|
|
9674
|
+
mkdirSync8(dirname9(daemonPaths.promptJournal), { recursive: true });
|
|
9533
9675
|
appendFileSync2(daemonPaths.promptJournal, `${line}
|
|
9534
9676
|
`);
|
|
9535
9677
|
} catch {
|
|
@@ -9748,10 +9890,10 @@ import { basename as basename7 } from "path";
|
|
|
9748
9890
|
|
|
9749
9891
|
// src/commands/sessions/web/fromGithub/listClones.ts
|
|
9750
9892
|
import { existsSync as existsSync22, readdirSync as readdirSync7 } from "fs";
|
|
9751
|
-
import { join as
|
|
9893
|
+
import { join as join29 } from "path";
|
|
9752
9894
|
function listClones(baseDir) {
|
|
9753
9895
|
if (!existsSync22(baseDir)) return [];
|
|
9754
|
-
return readdirSync7(baseDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) =>
|
|
9896
|
+
return readdirSync7(baseDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join29(baseDir, entry.name)).filter((dir) => existsSync22(join29(dir, ".git"))).sort();
|
|
9755
9897
|
}
|
|
9756
9898
|
|
|
9757
9899
|
// src/commands/sessions/web/fromGithub/getClones.ts
|
|
@@ -9930,7 +10072,7 @@ function azureDevopsRepoUrl({ org, project, repo }) {
|
|
|
9930
10072
|
|
|
9931
10073
|
// src/commands/sessions/web/fromGithub/findAzureDevopsClone.ts
|
|
9932
10074
|
import { existsSync as existsSync23, readdirSync as readdirSync8 } from "fs";
|
|
9933
|
-
import { join as
|
|
10075
|
+
import { join as join30 } from "path";
|
|
9934
10076
|
|
|
9935
10077
|
// src/shared/azureDevops/parseAzureDevopsRemote.ts
|
|
9936
10078
|
var HTTPS_DEV = /^https?:\/\/(?:[^@/]+@)?dev\.azure\.com\/([^/]+)\/([^/]+)\/_git\/([^/]+)$/i;
|
|
@@ -9951,15 +10093,15 @@ function sameAzureDevopsRepo(a, b) {
|
|
|
9951
10093
|
|
|
9952
10094
|
// src/commands/sessions/web/fromGithub/findAzureDevopsClone.ts
|
|
9953
10095
|
function clonesRepo(dir, repo) {
|
|
9954
|
-
if (!existsSync23(
|
|
10096
|
+
if (!existsSync23(join30(dir, ".git"))) return false;
|
|
9955
10097
|
const url = remoteUrl(dir).url;
|
|
9956
10098
|
const remote = url ? parseAzureDevopsRemote(url) : null;
|
|
9957
10099
|
return remote !== null && sameAzureDevopsRepo(remote, repo);
|
|
9958
10100
|
}
|
|
9959
10101
|
function findAzureDevopsClone(repo, baseDir) {
|
|
9960
10102
|
if (!existsSync23(baseDir)) return void 0;
|
|
9961
|
-
const named =
|
|
9962
|
-
const others = readdirSync8(baseDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) =>
|
|
10103
|
+
const named = join30(baseDir, repo.repo);
|
|
10104
|
+
const others = readdirSync8(baseDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join30(baseDir, entry.name)).filter((dir) => dir !== named).sort();
|
|
9963
10105
|
return [named, ...others].find((dir) => clonesRepo(dir, repo));
|
|
9964
10106
|
}
|
|
9965
10107
|
|
|
@@ -11846,12 +11988,12 @@ function assertNoDuplicateRunNames(configs) {
|
|
|
11846
11988
|
|
|
11847
11989
|
// src/shared/findLinkedConfigPath.ts
|
|
11848
11990
|
import { existsSync as existsSync24 } from "fs";
|
|
11849
|
-
import { join as
|
|
11991
|
+
import { join as join31, resolve as resolve5 } from "path";
|
|
11850
11992
|
function findLinkedConfigPath(linkPath, fromDir) {
|
|
11851
11993
|
const resolved = resolve5(fromDir, linkPath);
|
|
11852
|
-
const claudePath =
|
|
11994
|
+
const claudePath = join31(resolved, ".claude", "assist.yml");
|
|
11853
11995
|
if (existsSync24(claudePath)) return claudePath;
|
|
11854
|
-
const rootPath =
|
|
11996
|
+
const rootPath = join31(resolved, "assist.yml");
|
|
11855
11997
|
if (existsSync24(rootPath)) return rootPath;
|
|
11856
11998
|
throw new Error(`No assist.yml found in linked project: ${resolved}`);
|
|
11857
11999
|
}
|
|
@@ -11941,19 +12083,19 @@ function handleServerRuns(req, res) {
|
|
|
11941
12083
|
// src/commands/sessions/web/getReviewSynthesis.ts
|
|
11942
12084
|
import { execFile as execFile6 } from "child_process";
|
|
11943
12085
|
import { readFileSync as readFileSync14 } from "fs";
|
|
11944
|
-
import { homedir as
|
|
11945
|
-
import { basename as basename10, join as
|
|
12086
|
+
import { homedir as homedir11 } from "os";
|
|
12087
|
+
import { basename as basename10, join as join33 } from "path";
|
|
11946
12088
|
import { promisify as promisify6 } from "util";
|
|
11947
12089
|
|
|
11948
12090
|
// src/commands/sessions/web/findSynthesisForBranch.ts
|
|
11949
12091
|
import { existsSync as existsSync25, readdirSync as readdirSync9, statSync as statSync8 } from "fs";
|
|
11950
|
-
import { basename as basename9, dirname as dirname11, join as
|
|
12092
|
+
import { basename as basename9, dirname as dirname11, join as join32 } from "path";
|
|
11951
12093
|
function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
11952
|
-
const branchKeyPath =
|
|
12094
|
+
const branchKeyPath = join32(repoReviewsDir, `${branch2}-`);
|
|
11953
12095
|
const parent = dirname11(branchKeyPath);
|
|
11954
12096
|
const branchPrefix = basename9(branchKeyPath);
|
|
11955
12097
|
if (!existsSync25(parent)) return null;
|
|
11956
|
-
const synthesisFiles = readdirSync9(parent).filter((name2) => name2.startsWith(branchPrefix)).map((name2) =>
|
|
12098
|
+
const synthesisFiles = readdirSync9(parent).filter((name2) => name2.startsWith(branchPrefix)).map((name2) => join32(parent, name2, "synthesis.md")).filter((path128) => existsSync25(path128)).map((path128) => ({ path: path128, mtime: statSync8(path128).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
|
|
11957
12099
|
return synthesisFiles[0]?.path ?? null;
|
|
11958
12100
|
}
|
|
11959
12101
|
|
|
@@ -11971,8 +12113,8 @@ async function resolveSynthesisPath(cwd) {
|
|
|
11971
12113
|
runGit2(cwd, ["rev-parse", "--show-toplevel"]),
|
|
11972
12114
|
runGit2(cwd, ["rev-parse", "--abbrev-ref", "HEAD"])
|
|
11973
12115
|
]);
|
|
11974
|
-
const repoReviewsDir =
|
|
11975
|
-
|
|
12116
|
+
const repoReviewsDir = join33(
|
|
12117
|
+
homedir11(),
|
|
11976
12118
|
".assist",
|
|
11977
12119
|
"reviews",
|
|
11978
12120
|
basename10(repoRoot3)
|
|
@@ -12840,29 +12982,29 @@ function resolveRewindPlan(item) {
|
|
|
12840
12982
|
}
|
|
12841
12983
|
|
|
12842
12984
|
// src/commands/backlog/writeSignal.ts
|
|
12843
|
-
import { mkdirSync as
|
|
12844
|
-
import { homedir as
|
|
12845
|
-
import { dirname as dirname13, join as
|
|
12985
|
+
import { mkdirSync as mkdirSync10, writeFileSync as writeFileSync8 } from "fs";
|
|
12986
|
+
import { homedir as homedir13 } from "os";
|
|
12987
|
+
import { dirname as dirname13, join as join35 } from "path";
|
|
12846
12988
|
import chalk10 from "chalk";
|
|
12847
12989
|
|
|
12848
12990
|
// src/commands/backlog/recordSignalOwner.ts
|
|
12849
12991
|
import {
|
|
12850
12992
|
existsSync as existsSync26,
|
|
12851
|
-
mkdirSync as
|
|
12993
|
+
mkdirSync as mkdirSync9,
|
|
12852
12994
|
readFileSync as readFileSync15,
|
|
12853
12995
|
rmSync as rmSync3,
|
|
12854
12996
|
writeFileSync as writeFileSync7
|
|
12855
12997
|
} from "fs";
|
|
12856
|
-
import { homedir as
|
|
12857
|
-
import { dirname as dirname12, join as
|
|
12998
|
+
import { homedir as homedir12 } from "os";
|
|
12999
|
+
import { dirname as dirname12, join as join34 } from "path";
|
|
12858
13000
|
function getOwnerPath(itemId2) {
|
|
12859
|
-
return
|
|
13001
|
+
return join34(homedir12(), ".assist", "signals", `owner-${itemId2}.json`);
|
|
12860
13002
|
}
|
|
12861
13003
|
function recordSignalOwner(itemId2) {
|
|
12862
13004
|
const sessionId2 = process.env.ASSIST_SESSION_ID;
|
|
12863
13005
|
if (!sessionId2) return;
|
|
12864
13006
|
const path128 = getOwnerPath(itemId2);
|
|
12865
|
-
|
|
13007
|
+
mkdirSync9(dirname12(path128), { recursive: true });
|
|
12866
13008
|
writeFileSync7(path128, JSON.stringify({ sessionId: sessionId2 }));
|
|
12867
13009
|
}
|
|
12868
13010
|
function readSignalOwner(itemId2) {
|
|
@@ -12886,7 +13028,7 @@ function clearSignalOwner(itemId2) {
|
|
|
12886
13028
|
// src/commands/backlog/writeSignal.ts
|
|
12887
13029
|
function getSignalPath(sessionId2 = process.env.ASSIST_SESSION_ID) {
|
|
12888
13030
|
if (!sessionId2) return void 0;
|
|
12889
|
-
return
|
|
13031
|
+
return join35(homedir13(), ".assist", "signals", `signal-${sessionId2}.json`);
|
|
12890
13032
|
}
|
|
12891
13033
|
function resolveSignalTarget(event, data) {
|
|
12892
13034
|
const caller = process.env.ASSIST_SESSION_ID;
|
|
@@ -12918,7 +13060,7 @@ function writeSignal(event, data) {
|
|
|
12918
13060
|
const path128 = getSignalPath(target);
|
|
12919
13061
|
if (!path128) return;
|
|
12920
13062
|
const signal = { event, sessionId: target, ...data };
|
|
12921
|
-
|
|
13063
|
+
mkdirSync10(dirname13(path128), { recursive: true });
|
|
12922
13064
|
writeFileSync8(path128, JSON.stringify(signal));
|
|
12923
13065
|
}
|
|
12924
13066
|
|
|
@@ -16348,9 +16490,9 @@ import { spawn as spawn7 } from "child_process";
|
|
|
16348
16490
|
import { existsSync as existsSync30 } from "fs";
|
|
16349
16491
|
|
|
16350
16492
|
// src/shared/expandEnv.ts
|
|
16351
|
-
import { homedir as
|
|
16493
|
+
import { homedir as homedir14 } from "os";
|
|
16352
16494
|
function expandTilde2(value) {
|
|
16353
|
-
return value.startsWith("~/") ?
|
|
16495
|
+
return value.startsWith("~/") ? homedir14() + value.slice(1) : value;
|
|
16354
16496
|
}
|
|
16355
16497
|
function expandEnv(env) {
|
|
16356
16498
|
return Object.fromEntries(
|
|
@@ -16361,13 +16503,13 @@ function expandEnv(env) {
|
|
|
16361
16503
|
// src/commands/run/resolveCommand.ts
|
|
16362
16504
|
import { execFileSync as execFileSync6 } from "child_process";
|
|
16363
16505
|
import { existsSync as existsSync29 } from "fs";
|
|
16364
|
-
import { dirname as dirname14, join as
|
|
16506
|
+
import { dirname as dirname14, join as join36, resolve as resolve10 } from "path";
|
|
16365
16507
|
function resolveCommand(command) {
|
|
16366
16508
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
16367
16509
|
try {
|
|
16368
16510
|
const gitPath = execFileSync6("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
16369
16511
|
const gitRoot = resolve10(dirname14(gitPath), "..");
|
|
16370
|
-
const gitBash =
|
|
16512
|
+
const gitBash = join36(gitRoot, "bin", "bash.exe");
|
|
16371
16513
|
if (existsSync29(gitBash)) return gitBash;
|
|
16372
16514
|
} catch {
|
|
16373
16515
|
return command;
|
|
@@ -17863,11 +18005,11 @@ async function readUserConfig(orm) {
|
|
|
17863
18005
|
}
|
|
17864
18006
|
|
|
17865
18007
|
// src/shared/writeRepoConfigCache.ts
|
|
17866
|
-
import { mkdirSync as
|
|
18008
|
+
import { mkdirSync as mkdirSync11, renameSync as renameSync3, writeFileSync as writeFileSync9 } from "fs";
|
|
17867
18009
|
import { dirname as dirname15 } from "path";
|
|
17868
18010
|
function writeRepoConfigCache(repos2, user = {}) {
|
|
17869
18011
|
const path128 = repoConfigCachePath();
|
|
17870
|
-
|
|
18012
|
+
mkdirSync11(dirname15(path128), { recursive: true });
|
|
17871
18013
|
const cache7 = {
|
|
17872
18014
|
refreshedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
17873
18015
|
repos: repos2,
|
|
@@ -18371,17 +18513,17 @@ var autoRestartWait = {
|
|
|
18371
18513
|
|
|
18372
18514
|
// src/commands/extension/fetchLatestSignedExtension.ts
|
|
18373
18515
|
import { readFile as readFile2 } from "fs/promises";
|
|
18374
|
-
import { join as
|
|
18516
|
+
import { join as join38 } from "path";
|
|
18375
18517
|
|
|
18376
18518
|
// src/commands/extension/extensionDir.ts
|
|
18377
18519
|
import { existsSync as existsSync31 } from "fs";
|
|
18378
|
-
import { dirname as dirname16, join as
|
|
18520
|
+
import { dirname as dirname16, join as join37 } from "path";
|
|
18379
18521
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
18380
18522
|
var moduleDir = dirname16(fileURLToPath2(import.meta.url));
|
|
18381
18523
|
function extensionDir() {
|
|
18382
|
-
const bundled =
|
|
18524
|
+
const bundled = join37(moduleDir, "commands", "extension", "extension");
|
|
18383
18525
|
if (existsSync31(bundled)) return bundled;
|
|
18384
|
-
return
|
|
18526
|
+
return join37(moduleDir, "..", "..", "..", "extension");
|
|
18385
18527
|
}
|
|
18386
18528
|
|
|
18387
18529
|
// src/commands/extension/latestUpdate.ts
|
|
@@ -18393,7 +18535,7 @@ function latestUpdate(manifest, updates2) {
|
|
|
18393
18535
|
// src/commands/extension/fetchLatestSignedExtension.ts
|
|
18394
18536
|
async function fetchLatestSignedExtension() {
|
|
18395
18537
|
const manifest = await readFile2(
|
|
18396
|
-
|
|
18538
|
+
join38(extensionDir(), "manifest.json"),
|
|
18397
18539
|
"utf8"
|
|
18398
18540
|
);
|
|
18399
18541
|
const updateUrl = JSON.parse(manifest).browser_specific_settings.gecko.update_url;
|
|
@@ -18437,7 +18579,7 @@ function buildPendingPath(cwd) {
|
|
|
18437
18579
|
}
|
|
18438
18580
|
|
|
18439
18581
|
// src/commands/watch/readBuiltVersion.ts
|
|
18440
|
-
import { join as
|
|
18582
|
+
import { join as join40 } from "path";
|
|
18441
18583
|
|
|
18442
18584
|
// src/shared/readPackageJson.ts
|
|
18443
18585
|
import * as fs18 from "fs";
|
|
@@ -18487,7 +18629,7 @@ function findPackageJsonWithVerifyScripts(startDir) {
|
|
|
18487
18629
|
function readBuiltVersion(cwd) {
|
|
18488
18630
|
try {
|
|
18489
18631
|
const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
18490
|
-
return readPackageJson(
|
|
18632
|
+
return readPackageJson(join40(root2, "package.json")).version ?? "unknown";
|
|
18491
18633
|
} catch {
|
|
18492
18634
|
return "unknown";
|
|
18493
18635
|
}
|
|
@@ -18495,11 +18637,11 @@ function readBuiltVersion(cwd) {
|
|
|
18495
18637
|
|
|
18496
18638
|
// src/commands/watch/readDistVersion.ts
|
|
18497
18639
|
import { readFileSync as readFileSync18 } from "fs";
|
|
18498
|
-
import { join as
|
|
18640
|
+
import { join as join41 } from "path";
|
|
18499
18641
|
function readDistVersion(cwd) {
|
|
18500
18642
|
try {
|
|
18501
18643
|
const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
18502
|
-
return readFileSync18(
|
|
18644
|
+
return readFileSync18(join41(root2, "dist", "built-version"), "utf8").trim();
|
|
18503
18645
|
} catch {
|
|
18504
18646
|
return void 0;
|
|
18505
18647
|
}
|
|
@@ -18609,8 +18751,8 @@ function stripAnsi(text18) {
|
|
|
18609
18751
|
|
|
18610
18752
|
// src/commands/sessions/daemon/worktree/watcherLogPath.ts
|
|
18611
18753
|
import { createHash } from "crypto";
|
|
18612
|
-
import { homedir as
|
|
18613
|
-
import { basename as basename13, join as
|
|
18754
|
+
import { homedir as homedir15 } from "os";
|
|
18755
|
+
import { basename as basename13, join as join42 } from "path";
|
|
18614
18756
|
|
|
18615
18757
|
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
18616
18758
|
import { realpathSync as realpathSync2 } from "fs";
|
|
@@ -18627,8 +18769,8 @@ function canonicalTreePath(path128) {
|
|
|
18627
18769
|
function watcherLogPath(cwd) {
|
|
18628
18770
|
const clone = canonicalTreePath(cwd);
|
|
18629
18771
|
const key = createHash("sha1").update(clone).digest("hex").slice(0, 8);
|
|
18630
|
-
const dir = process.env.ASSIST_WATCHER_LOG_DIR ??
|
|
18631
|
-
return
|
|
18772
|
+
const dir = process.env.ASSIST_WATCHER_LOG_DIR ?? join42(homedir15(), ".assist", "watchers");
|
|
18773
|
+
return join42(dir, `${basename13(clone) || "root"}-${key}.log`);
|
|
18632
18774
|
}
|
|
18633
18775
|
|
|
18634
18776
|
// src/commands/sessions/web/updates/readUpdateHistory.ts
|
|
@@ -18761,7 +18903,7 @@ async function readRequestBuffer(req, limit) {
|
|
|
18761
18903
|
|
|
18762
18904
|
// src/commands/sessions/web/stageAttachment.ts
|
|
18763
18905
|
import { mkdir, mkdtemp, writeFile } from "fs/promises";
|
|
18764
|
-
import { extname as extname2, join as
|
|
18906
|
+
import { extname as extname2, join as join43 } from "path";
|
|
18765
18907
|
|
|
18766
18908
|
// src/commands/sessions/web/ghAttachableExtensions.ts
|
|
18767
18909
|
var ghAttachableExtensions = /* @__PURE__ */ new Set([
|
|
@@ -18793,9 +18935,9 @@ function safeBaseName(name2) {
|
|
|
18793
18935
|
async function stageAttachment(name2, contentType, body) {
|
|
18794
18936
|
const ext = pickExtension(name2, contentType);
|
|
18795
18937
|
await mkdir(stagedAttachmentsDir, { recursive: true });
|
|
18796
|
-
const dir = await mkdtemp(
|
|
18938
|
+
const dir = await mkdtemp(join43(stagedAttachmentsDir, "upload-"));
|
|
18797
18939
|
const alt = safeBaseName(name2);
|
|
18798
|
-
const filePath =
|
|
18940
|
+
const filePath = join43(dir, `${alt}.${ext}`);
|
|
18799
18941
|
await writeFile(filePath, body);
|
|
18800
18942
|
return { dir, filePath, alt };
|
|
18801
18943
|
}
|
|
@@ -18845,14 +18987,14 @@ import { readFile as readFile3, stat as stat3, writeFile as writeFile2 } from "f
|
|
|
18845
18987
|
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
18846
18988
|
import { execFile as execFile13 } from "child_process";
|
|
18847
18989
|
import { existsSync as existsSync34 } from "fs";
|
|
18848
|
-
import { dirname as dirname18, join as
|
|
18990
|
+
import { dirname as dirname18, join as join44 } from "path";
|
|
18849
18991
|
import { promisify as promisify13 } from "util";
|
|
18850
18992
|
var execFileAsync11 = promisify13(execFile13);
|
|
18851
18993
|
var TIMEOUT_MS2 = 15e3;
|
|
18852
18994
|
function findOxfmtScript(root2) {
|
|
18853
18995
|
let dir = root2;
|
|
18854
18996
|
for (; ; ) {
|
|
18855
|
-
const candidate =
|
|
18997
|
+
const candidate = join44(dir, "node_modules", "oxfmt", "bin", "oxfmt");
|
|
18856
18998
|
if (existsSync34(candidate)) return candidate;
|
|
18857
18999
|
const parent = dirname18(dir);
|
|
18858
19000
|
if (parent === dir) return void 0;
|
|
@@ -18925,10 +19067,10 @@ async function writeFileContent(req, res) {
|
|
|
18925
19067
|
// src/shared/createBundleHandler.ts
|
|
18926
19068
|
import { createHash as createHash2 } from "crypto";
|
|
18927
19069
|
import { readFileSync as readFileSync19, statSync as statSync10 } from "fs";
|
|
18928
|
-
import { dirname as dirname19, join as
|
|
19070
|
+
import { dirname as dirname19, join as join45 } from "path";
|
|
18929
19071
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
18930
19072
|
function createBundleHandler(importMetaUrl, bundlePath, contentType = "application/javascript") {
|
|
18931
|
-
const file =
|
|
19073
|
+
const file = join45(dirname19(fileURLToPath3(importMetaUrl)), bundlePath);
|
|
18932
19074
|
let cache7;
|
|
18933
19075
|
return (req, res) => {
|
|
18934
19076
|
const mtimeMs = statSync10(file).mtimeMs;
|
|
@@ -19371,9 +19513,9 @@ function scheduleReconnect() {
|
|
|
19371
19513
|
}
|
|
19372
19514
|
|
|
19373
19515
|
// src/commands/sessions/web/updates/autoRestart/autoRestartAttempts.ts
|
|
19374
|
-
import { mkdirSync as
|
|
19375
|
-
import { dirname as dirname20, join as
|
|
19376
|
-
var defaultPath =
|
|
19516
|
+
import { mkdirSync as mkdirSync12, readFileSync as readFileSync21, writeFileSync as writeFileSync10 } from "fs";
|
|
19517
|
+
import { dirname as dirname20, join as join46 } from "path";
|
|
19518
|
+
var defaultPath = join46(daemonPaths.dir, "auto-restart-attempts.json");
|
|
19377
19519
|
function read(path128) {
|
|
19378
19520
|
try {
|
|
19379
19521
|
return JSON.parse(readFileSync21(path128, "utf8"));
|
|
@@ -19386,7 +19528,7 @@ function autoRestartAttempts(port, path128 = defaultPath) {
|
|
|
19386
19528
|
return {
|
|
19387
19529
|
get: () => read(path128)[key],
|
|
19388
19530
|
set: (built) => {
|
|
19389
|
-
|
|
19531
|
+
mkdirSync12(dirname20(path128), { recursive: true });
|
|
19390
19532
|
writeFileSync10(
|
|
19391
19533
|
path128,
|
|
19392
19534
|
`${JSON.stringify({ ...read(path128), [key]: built }, null, 2)}
|
|
@@ -20117,7 +20259,7 @@ import chalk22 from "chalk";
|
|
|
20117
20259
|
|
|
20118
20260
|
// src/commands/verify/addToKnipIgnoreBinaries.ts
|
|
20119
20261
|
import { existsSync as existsSync36, readFileSync as readFileSync22, writeFileSync as writeFileSync12 } from "fs";
|
|
20120
|
-
import { join as
|
|
20262
|
+
import { join as join47 } from "path";
|
|
20121
20263
|
import chalk21 from "chalk";
|
|
20122
20264
|
function loadKnipConfig(knipJsonPath) {
|
|
20123
20265
|
if (existsSync36(knipJsonPath)) {
|
|
@@ -20126,7 +20268,7 @@ function loadKnipConfig(knipJsonPath) {
|
|
|
20126
20268
|
return { $schema: "https://unpkg.com/knip@5/schema.json" };
|
|
20127
20269
|
}
|
|
20128
20270
|
function addToKnipIgnoreBinaries(cwd, binary) {
|
|
20129
|
-
const knipJsonPath =
|
|
20271
|
+
const knipJsonPath = join47(cwd, "knip.json");
|
|
20130
20272
|
try {
|
|
20131
20273
|
const knipConfig = loadKnipConfig(knipJsonPath);
|
|
20132
20274
|
const ignoreBinaries = knipConfig.ignoreBinaries ?? [];
|
|
@@ -21070,7 +21212,7 @@ function initPackageJson(name2) {
|
|
|
21070
21212
|
}
|
|
21071
21213
|
|
|
21072
21214
|
// src/commands/new/registerNew/newCli/writeCliTemplate.ts
|
|
21073
|
-
import { mkdirSync as
|
|
21215
|
+
import { mkdirSync as mkdirSync14, writeFileSync as writeFileSync20 } from "fs";
|
|
21074
21216
|
function writeCliTemplate(name2) {
|
|
21075
21217
|
console.log("Writing tsconfig.json...");
|
|
21076
21218
|
writeFileSync20(
|
|
@@ -21111,7 +21253,7 @@ export default defineConfig({
|
|
|
21111
21253
|
`
|
|
21112
21254
|
);
|
|
21113
21255
|
console.log("Writing src/index.ts...");
|
|
21114
|
-
|
|
21256
|
+
mkdirSync14("src", { recursive: true });
|
|
21115
21257
|
writeFileSync20(
|
|
21116
21258
|
"src/index.ts",
|
|
21117
21259
|
`#!/usr/bin/env node
|
|
@@ -21148,8 +21290,8 @@ import chalk37 from "chalk";
|
|
|
21148
21290
|
import enquirer3 from "enquirer";
|
|
21149
21291
|
|
|
21150
21292
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
21151
|
-
import { existsSync as existsSync44, mkdirSync as
|
|
21152
|
-
import { dirname as dirname28, join as
|
|
21293
|
+
import { existsSync as existsSync44, mkdirSync as mkdirSync15, readFileSync as readFileSync28, writeFileSync as writeFileSync21 } from "fs";
|
|
21294
|
+
import { dirname as dirname28, join as join54 } from "path";
|
|
21153
21295
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
21154
21296
|
import chalk36 from "chalk";
|
|
21155
21297
|
var WORKFLOW_PATH = ".github/workflows/build.yml";
|
|
@@ -21163,7 +21305,7 @@ function getExistingSiteId() {
|
|
|
21163
21305
|
return match ? match[1] : null;
|
|
21164
21306
|
}
|
|
21165
21307
|
function getTemplateContent(siteId) {
|
|
21166
|
-
const templatePath =
|
|
21308
|
+
const templatePath = join54(__dirname3, "commands/deploy/build.yml");
|
|
21167
21309
|
const template = readFileSync28(templatePath, "utf8");
|
|
21168
21310
|
return template.replace("{{NETLIFY_SITE_ID}}", siteId);
|
|
21169
21311
|
}
|
|
@@ -21171,7 +21313,7 @@ async function updateWorkflow(siteId) {
|
|
|
21171
21313
|
const newContent = getTemplateContent(siteId);
|
|
21172
21314
|
const workflowDir = ".github/workflows";
|
|
21173
21315
|
if (!existsSync44(workflowDir)) {
|
|
21174
|
-
|
|
21316
|
+
mkdirSync15(workflowDir, { recursive: true });
|
|
21175
21317
|
}
|
|
21176
21318
|
if (existsSync44(WORKFLOW_PATH)) {
|
|
21177
21319
|
const oldContent = readFileSync28(WORKFLOW_PATH, "utf8");
|
|
@@ -21472,16 +21614,16 @@ function adviceContextFor(cwd, env = process.env) {
|
|
|
21472
21614
|
|
|
21473
21615
|
// src/commands/advise/loadAdviceFragments.ts
|
|
21474
21616
|
import { readdirSync as readdirSync10, readFileSync as readFileSync30 } from "fs";
|
|
21475
|
-
import { basename as basename15, join as
|
|
21617
|
+
import { basename as basename15, join as join56 } from "path";
|
|
21476
21618
|
|
|
21477
21619
|
// src/commands/advise/adviceDir.ts
|
|
21478
21620
|
import { existsSync as existsSync46 } from "fs";
|
|
21479
|
-
import { dirname as dirname29, join as
|
|
21621
|
+
import { dirname as dirname29, join as join55 } from "path";
|
|
21480
21622
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
21481
21623
|
function adviceDir() {
|
|
21482
21624
|
let current2 = dirname29(fileURLToPath5(import.meta.url));
|
|
21483
21625
|
while (current2 !== dirname29(current2)) {
|
|
21484
|
-
const candidate =
|
|
21626
|
+
const candidate = join55(current2, "agent", "advice");
|
|
21485
21627
|
if (existsSync46(candidate)) return candidate;
|
|
21486
21628
|
current2 = dirname29(current2);
|
|
21487
21629
|
}
|
|
@@ -21514,7 +21656,7 @@ function loadAdviceFragments(dir = adviceDir()) {
|
|
|
21514
21656
|
return readdirSync10(dir).filter((file) => file.endsWith(".md")).sort().map(
|
|
21515
21657
|
(file) => parseAdviceFragment(
|
|
21516
21658
|
basename15(file, ".md"),
|
|
21517
|
-
readFileSync30(
|
|
21659
|
+
readFileSync30(join56(dir, file), "utf8")
|
|
21518
21660
|
)
|
|
21519
21661
|
);
|
|
21520
21662
|
}
|
|
@@ -21549,12 +21691,12 @@ function renderAdviceBody(fragment, context) {
|
|
|
21549
21691
|
|
|
21550
21692
|
// src/commands/advise/adviceConditions.ts
|
|
21551
21693
|
import { existsSync as existsSync47 } from "fs";
|
|
21552
|
-
import { join as
|
|
21694
|
+
import { join as join57 } from "path";
|
|
21553
21695
|
function repoFile(file, label) {
|
|
21554
21696
|
return {
|
|
21555
21697
|
whenMet: `the repo has ${label}`,
|
|
21556
21698
|
whenUnmet: `the repo has no ${label}`,
|
|
21557
|
-
matches: ({ rootDir }) => existsSync47(
|
|
21699
|
+
matches: ({ rootDir }) => existsSync47(join57(rootDir, file))
|
|
21558
21700
|
};
|
|
21559
21701
|
}
|
|
21560
21702
|
var adviceConditions = {
|
|
@@ -21580,11 +21722,11 @@ var adviceConditions = {
|
|
|
21580
21722
|
},
|
|
21581
21723
|
typescript: repoFile("tsconfig.json", "a tsconfig.json"),
|
|
21582
21724
|
filenameConvention: repoFile(
|
|
21583
|
-
|
|
21725
|
+
join57("oxlint-rules", "filenameConvention.ts"),
|
|
21584
21726
|
"oxlint-rules/filenameConvention.ts"
|
|
21585
21727
|
),
|
|
21586
21728
|
claudeSettings: repoFile(
|
|
21587
|
-
|
|
21729
|
+
join57("claude", "settings.json"),
|
|
21588
21730
|
"claude/settings.json"
|
|
21589
21731
|
),
|
|
21590
21732
|
verify: {
|
|
@@ -21750,6 +21892,17 @@ async function readBodyArgument(value) {
|
|
|
21750
21892
|
return body;
|
|
21751
21893
|
}
|
|
21752
21894
|
|
|
21895
|
+
// src/commands/sessions/shared/exitNoPreview.ts
|
|
21896
|
+
function exitNoPreview(error) {
|
|
21897
|
+
console.error(
|
|
21898
|
+
`Error: ${error instanceof Error ? error.message : String(error)}`
|
|
21899
|
+
);
|
|
21900
|
+
console.error(
|
|
21901
|
+
"No preview is open \u2014 nothing is awaiting approval in the preview pane. Do not tell the user to look for one; report this failure instead."
|
|
21902
|
+
);
|
|
21903
|
+
process.exit(1);
|
|
21904
|
+
}
|
|
21905
|
+
|
|
21753
21906
|
// src/commands/sessions/shared/formatPreviewComments.ts
|
|
21754
21907
|
function formatPreviewComments(comments3) {
|
|
21755
21908
|
return comments3.map((c, i) => {
|
|
@@ -21941,10 +22094,7 @@ async function awaitPreviewApproval(subject, request, options2 = {}) {
|
|
|
21941
22094
|
try {
|
|
21942
22095
|
outcome = await requestPreviewDecision(request);
|
|
21943
22096
|
} catch (error) {
|
|
21944
|
-
|
|
21945
|
-
`Error: ${error instanceof Error ? error.message : String(error)}`
|
|
21946
|
-
);
|
|
21947
|
-
process.exit(1);
|
|
22097
|
+
exitNoPreview(error);
|
|
21948
22098
|
}
|
|
21949
22099
|
if (outcome === "superseded") {
|
|
21950
22100
|
console.log(
|
|
@@ -22514,7 +22664,7 @@ function registerAskQuestion(program) {
|
|
|
22514
22664
|
|
|
22515
22665
|
// src/commands/registerBackup.ts
|
|
22516
22666
|
import { mkdir as mkdir3, stat as stat4 } from "fs/promises";
|
|
22517
|
-
import { join as
|
|
22667
|
+
import { join as join59, resolve as resolve16 } from "path";
|
|
22518
22668
|
import chalk42 from "chalk";
|
|
22519
22669
|
|
|
22520
22670
|
// src/shared/db/recordBackup.ts
|
|
@@ -22528,7 +22678,7 @@ async function recordBackup(db, {
|
|
|
22528
22678
|
|
|
22529
22679
|
// src/commands/backup/scheduleBackup.ts
|
|
22530
22680
|
import { mkdir as mkdir2 } from "fs/promises";
|
|
22531
|
-
import { join as
|
|
22681
|
+
import { join as join58 } from "path";
|
|
22532
22682
|
import chalk40 from "chalk";
|
|
22533
22683
|
|
|
22534
22684
|
// src/commands/backup/readCrontab.ts
|
|
@@ -22670,7 +22820,7 @@ async function scheduleBackup({
|
|
|
22670
22820
|
const cronExpr = durationToCron(every);
|
|
22671
22821
|
const dir = expandTilde(loadConfig().backup.dir);
|
|
22672
22822
|
await mkdir2(dir, { recursive: true });
|
|
22673
|
-
const logPath2 =
|
|
22823
|
+
const logPath2 = join58(dir, "cron.log");
|
|
22674
22824
|
const cronLine = `${cronExpr} ${resolveAssistCommand()} backup >> ${logPath2} 2>&1`;
|
|
22675
22825
|
writeCrontab(upsertScheduleBlock(readCrontab(), every, cronLine));
|
|
22676
22826
|
console.error(
|
|
@@ -22849,7 +22999,7 @@ async function backup({ out }) {
|
|
|
22849
22999
|
await mkdir3(dir, { recursive: true });
|
|
22850
23000
|
const start2 = Date.now();
|
|
22851
23001
|
const timestamp9 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
22852
|
-
const filePath = resolve16(
|
|
23002
|
+
const filePath = resolve16(join59(dir, `backup-${timestamp9}.dump`));
|
|
22853
23003
|
await exportBacklog(filePath);
|
|
22854
23004
|
const { size } = await stat4(filePath);
|
|
22855
23005
|
const durationMs = Date.now() - start2;
|
|
@@ -23061,6 +23211,7 @@ function transcriptMessages(reader, lines) {
|
|
|
23061
23211
|
return [{ role: event.role, text: event.text }];
|
|
23062
23212
|
if (event.kind === "tool")
|
|
23063
23213
|
return [{ role: "tool", tool: event.tool, target: event.target }];
|
|
23214
|
+
if (event.kind === "interrupt") return [{ role: "interrupt" }];
|
|
23064
23215
|
return [];
|
|
23065
23216
|
});
|
|
23066
23217
|
}
|
|
@@ -23759,7 +23910,7 @@ function ensureRemoteOrigin() {
|
|
|
23759
23910
|
import { spawnSync as spawnSync7 } from "child_process";
|
|
23760
23911
|
import { mkdtempSync, readFileSync as readFileSync32, unlinkSync as unlinkSync4, writeFileSync as writeFileSync23 } from "fs";
|
|
23761
23912
|
import { tmpdir as tmpdir2 } from "os";
|
|
23762
|
-
import { join as
|
|
23913
|
+
import { join as join60 } from "path";
|
|
23763
23914
|
import enquirer4 from "enquirer";
|
|
23764
23915
|
async function promptType() {
|
|
23765
23916
|
const { type } = await enquirer4.prompt({
|
|
@@ -23799,8 +23950,8 @@ async function promptDescription() {
|
|
|
23799
23950
|
}
|
|
23800
23951
|
function openEditor() {
|
|
23801
23952
|
const editor = process.env.EDITOR || process.env.VISUAL || "vi";
|
|
23802
|
-
const dir = mkdtempSync(
|
|
23803
|
-
const filePath =
|
|
23953
|
+
const dir = mkdtempSync(join60(tmpdir2(), "assist-"));
|
|
23954
|
+
const filePath = join60(dir, "description.md");
|
|
23804
23955
|
writeFileSync23(filePath, "");
|
|
23805
23956
|
const result = spawnSync7(editor, [filePath], { stdio: "inherit" });
|
|
23806
23957
|
if (result.status !== 0) {
|
|
@@ -24242,7 +24393,7 @@ function startProposedRun(id, startOn, cwd = process.cwd()) {
|
|
|
24242
24393
|
import { randomUUID as randomUUID10 } from "crypto";
|
|
24243
24394
|
|
|
24244
24395
|
// src/commands/backlog/propose/mutateLedger.ts
|
|
24245
|
-
import { mkdirSync as
|
|
24396
|
+
import { mkdirSync as mkdirSync16, readFileSync as readFileSync33, renameSync as renameSync4, writeFileSync as writeFileSync24 } from "fs";
|
|
24246
24397
|
import { dirname as dirname30 } from "path";
|
|
24247
24398
|
function readLedger(path128) {
|
|
24248
24399
|
try {
|
|
@@ -24255,7 +24406,7 @@ function readLedger(path128) {
|
|
|
24255
24406
|
function mutateLedger(path128, mutate) {
|
|
24256
24407
|
const ledger = readLedger(path128);
|
|
24257
24408
|
mutate(ledger);
|
|
24258
|
-
|
|
24409
|
+
mkdirSync16(dirname30(path128), { recursive: true });
|
|
24259
24410
|
const tmp = `${path128}.${process.pid}.tmp`;
|
|
24260
24411
|
writeFileSync24(tmp, JSON.stringify(ledger));
|
|
24261
24412
|
renameSync4(tmp, path128);
|
|
@@ -24285,10 +24436,10 @@ async function findPredecessor(path128, token, startedAt) {
|
|
|
24285
24436
|
}
|
|
24286
24437
|
|
|
24287
24438
|
// src/commands/backlog/propose/proposalLedgerPath.ts
|
|
24288
|
-
import { homedir as
|
|
24289
|
-
import { join as
|
|
24439
|
+
import { homedir as homedir16 } from "os";
|
|
24440
|
+
import { join as join61 } from "path";
|
|
24290
24441
|
function proposalLedgerPath(sessionId2) {
|
|
24291
|
-
return
|
|
24442
|
+
return join61(homedir16(), ".assist", "proposals", `session-${sessionId2}.json`);
|
|
24292
24443
|
}
|
|
24293
24444
|
|
|
24294
24445
|
// src/commands/backlog/propose/trackProposal.ts
|
|
@@ -24337,7 +24488,12 @@ async function propose(options2) {
|
|
|
24337
24488
|
return;
|
|
24338
24489
|
}
|
|
24339
24490
|
const item = await readProposedItem(options2.json);
|
|
24340
|
-
|
|
24491
|
+
let tracker;
|
|
24492
|
+
try {
|
|
24493
|
+
tracker = sessionId2 ? trackProposal(sessionId2) : void 0;
|
|
24494
|
+
} catch (error) {
|
|
24495
|
+
exitNoPreview(error);
|
|
24496
|
+
}
|
|
24341
24497
|
try {
|
|
24342
24498
|
const approval = await reviewProposal(
|
|
24343
24499
|
item,
|
|
@@ -24782,13 +24938,13 @@ function hasLocalChanges() {
|
|
|
24782
24938
|
// src/commands/backlog/acquireLock.ts
|
|
24783
24939
|
import {
|
|
24784
24940
|
existsSync as existsSync50,
|
|
24785
|
-
mkdirSync as
|
|
24941
|
+
mkdirSync as mkdirSync17,
|
|
24786
24942
|
readFileSync as readFileSync35,
|
|
24787
24943
|
unlinkSync as unlinkSync5,
|
|
24788
24944
|
writeFileSync as writeFileSync25
|
|
24789
24945
|
} from "fs";
|
|
24790
|
-
import { homedir as
|
|
24791
|
-
import { join as
|
|
24946
|
+
import { homedir as homedir17 } from "os";
|
|
24947
|
+
import { join as join62 } from "path";
|
|
24792
24948
|
|
|
24793
24949
|
// src/commands/backlog/bootedAt.ts
|
|
24794
24950
|
import { uptime } from "os";
|
|
@@ -24824,10 +24980,10 @@ function isStaleLock(pid, timestamp9) {
|
|
|
24824
24980
|
|
|
24825
24981
|
// src/commands/backlog/acquireLock.ts
|
|
24826
24982
|
function getLocksDir() {
|
|
24827
|
-
return
|
|
24983
|
+
return join62(homedir17(), ".assist", "locks");
|
|
24828
24984
|
}
|
|
24829
24985
|
function getLockPath(itemId2) {
|
|
24830
|
-
return
|
|
24986
|
+
return join62(getLocksDir(), `lock-${itemId2}.json`);
|
|
24831
24987
|
}
|
|
24832
24988
|
function isProcessAlive(pid) {
|
|
24833
24989
|
try {
|
|
@@ -24854,7 +25010,7 @@ function isLockedByOther(itemId2) {
|
|
|
24854
25010
|
return foreignLockHolder(itemId2) !== null;
|
|
24855
25011
|
}
|
|
24856
25012
|
function acquireLock(itemId2) {
|
|
24857
|
-
|
|
25013
|
+
mkdirSync17(getLocksDir(), { recursive: true });
|
|
24858
25014
|
writeFileSync25(
|
|
24859
25015
|
getLockPath(itemId2),
|
|
24860
25016
|
JSON.stringify({ pid: process.pid, timestamp: (/* @__PURE__ */ new Date()).toISOString() })
|
|
@@ -25298,17 +25454,17 @@ async function resumeDoneConversation({ item, resumeSessionId }, spawnOptions) {
|
|
|
25298
25454
|
}
|
|
25299
25455
|
|
|
25300
25456
|
// src/commands/backlog/consumePause.ts
|
|
25301
|
-
import { existsSync as existsSync51, mkdirSync as
|
|
25302
|
-
import { homedir as
|
|
25303
|
-
import { join as
|
|
25457
|
+
import { existsSync as existsSync51, mkdirSync as mkdirSync18, unlinkSync as unlinkSync6, writeFileSync as writeFileSync26 } from "fs";
|
|
25458
|
+
import { homedir as homedir18 } from "os";
|
|
25459
|
+
import { join as join63 } from "path";
|
|
25304
25460
|
function getControlsDir() {
|
|
25305
|
-
return
|
|
25461
|
+
return join63(homedir18(), ".assist", "controls");
|
|
25306
25462
|
}
|
|
25307
25463
|
function getPausePath(itemId2) {
|
|
25308
|
-
return
|
|
25464
|
+
return join63(getControlsDir(), `pause-${itemId2}.json`);
|
|
25309
25465
|
}
|
|
25310
25466
|
function requestPause(itemId2) {
|
|
25311
|
-
|
|
25467
|
+
mkdirSync18(getControlsDir(), { recursive: true });
|
|
25312
25468
|
writeFileSync26(
|
|
25313
25469
|
getPausePath(itemId2),
|
|
25314
25470
|
JSON.stringify({ timestamp: (/* @__PURE__ */ new Date()).toISOString() })
|
|
@@ -25641,9 +25797,9 @@ async function persistPhaseSessionId(itemId2, phaseIdx, claudeSessionId) {
|
|
|
25641
25797
|
}
|
|
25642
25798
|
|
|
25643
25799
|
// src/shared/emitActivity.ts
|
|
25644
|
-
import { mkdirSync as
|
|
25645
|
-
import { homedir as
|
|
25646
|
-
import { dirname as dirname31, join as
|
|
25800
|
+
import { mkdirSync as mkdirSync19, readFileSync as readFileSync37, rmSync as rmSync4, writeFileSync as writeFileSync27 } from "fs";
|
|
25801
|
+
import { homedir as homedir19 } from "os";
|
|
25802
|
+
import { dirname as dirname31, join as join64 } from "path";
|
|
25647
25803
|
import { z as z19 } from "zod";
|
|
25648
25804
|
var activitySchema = z19.object({
|
|
25649
25805
|
kind: z19.enum(["command", "backlog"]),
|
|
@@ -25661,13 +25817,13 @@ var activitySchema = z19.object({
|
|
|
25661
25817
|
startedAt: z19.number()
|
|
25662
25818
|
});
|
|
25663
25819
|
function activityPath(sessionId2) {
|
|
25664
|
-
return
|
|
25820
|
+
return join64(homedir19(), ".assist", "activity", `activity-${sessionId2}.json`);
|
|
25665
25821
|
}
|
|
25666
25822
|
function emitActivity(activity2) {
|
|
25667
25823
|
const sessionId2 = process.env.ASSIST_ACTIVITY_ID;
|
|
25668
25824
|
if (!sessionId2) return;
|
|
25669
25825
|
const path128 = activityPath(sessionId2);
|
|
25670
|
-
|
|
25826
|
+
mkdirSync19(dirname31(path128), { recursive: true });
|
|
25671
25827
|
writeFileSync27(path128, JSON.stringify({ ...activity2, startedAt: Date.now() }));
|
|
25672
25828
|
}
|
|
25673
25829
|
function readActivity(path128) {
|
|
@@ -25683,12 +25839,12 @@ function reconcileActivity(sessionId2, activity2) {
|
|
|
25683
25839
|
return;
|
|
25684
25840
|
}
|
|
25685
25841
|
const path128 = activityPath(sessionId2);
|
|
25686
|
-
|
|
25842
|
+
mkdirSync19(dirname31(path128), { recursive: true });
|
|
25687
25843
|
writeFileSync27(path128, JSON.stringify(activity2));
|
|
25688
25844
|
}
|
|
25689
25845
|
function writeActivityIfAbsent(sessionId2, activity2) {
|
|
25690
25846
|
const path128 = activityPath(sessionId2);
|
|
25691
|
-
|
|
25847
|
+
mkdirSync19(dirname31(path128), { recursive: true });
|
|
25692
25848
|
try {
|
|
25693
25849
|
writeFileSync27(path128, JSON.stringify(activity2), { flag: "wx" });
|
|
25694
25850
|
return true;
|
|
@@ -28477,13 +28633,13 @@ function findCliWrite(command) {
|
|
|
28477
28633
|
|
|
28478
28634
|
// src/shared/readSettingsPerms.ts
|
|
28479
28635
|
import { existsSync as existsSync56, readFileSync as readFileSync40 } from "fs";
|
|
28480
|
-
import { homedir as
|
|
28481
|
-
import { join as
|
|
28636
|
+
import { homedir as homedir20 } from "os";
|
|
28637
|
+
import { join as join65 } from "path";
|
|
28482
28638
|
function readSettingsPerms(key) {
|
|
28483
28639
|
const paths = [
|
|
28484
|
-
|
|
28485
|
-
|
|
28486
|
-
|
|
28640
|
+
join65(homedir20(), ".claude", "settings.json"),
|
|
28641
|
+
join65(process.cwd(), ".claude", "settings.json"),
|
|
28642
|
+
join65(process.cwd(), ".claude", "settings.local.json")
|
|
28487
28643
|
];
|
|
28488
28644
|
const entries2 = [];
|
|
28489
28645
|
for (const p of paths) {
|
|
@@ -28852,29 +29008,29 @@ async function decideDocsGuard({
|
|
|
28852
29008
|
import { existsSync as existsSync57, readFileSync as readFileSync42 } from "fs";
|
|
28853
29009
|
|
|
28854
29010
|
// src/commands/schema/getSchemaSessionApprovalPath.ts
|
|
28855
|
-
import { join as
|
|
29011
|
+
import { join as join67 } from "path";
|
|
28856
29012
|
|
|
28857
29013
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
28858
|
-
import { homedir as
|
|
28859
|
-
import { join as
|
|
29014
|
+
import { homedir as homedir21 } from "os";
|
|
29015
|
+
import { join as join66 } from "path";
|
|
28860
29016
|
function getRestrictedDir() {
|
|
28861
|
-
return
|
|
29017
|
+
return join66(homedir21(), ".assist", "restricted");
|
|
28862
29018
|
}
|
|
28863
29019
|
function getPinStatePath(pin2) {
|
|
28864
|
-
return
|
|
29020
|
+
return join66(getRestrictedDir(), `code-comment-${pin2}.json`);
|
|
28865
29021
|
}
|
|
28866
29022
|
|
|
28867
29023
|
// src/commands/schema/getSchemaSessionApprovalPath.ts
|
|
28868
29024
|
var SESSION_ID = /^[\w-]+$/;
|
|
28869
29025
|
function getSchemaSessionApprovalDir() {
|
|
28870
|
-
return
|
|
29026
|
+
return join67(getRestrictedDir(), "schema-sessions");
|
|
28871
29027
|
}
|
|
28872
29028
|
function getSchemaSessionApprovalPath(scope) {
|
|
28873
29029
|
const { harness, conversationId } = scope;
|
|
28874
29030
|
if (!SESSION_ID.test(conversationId) || !SESSION_ID.test(harness))
|
|
28875
29031
|
return void 0;
|
|
28876
29032
|
const name2 = harness === legacyDefaultHarness ? conversationId : `${harness}-${conversationId}`;
|
|
28877
|
-
return
|
|
29033
|
+
return join67(getSchemaSessionApprovalDir(), `${name2}.json`);
|
|
28878
29034
|
}
|
|
28879
29035
|
|
|
28880
29036
|
// src/commands/schema/isSchemaLocked.ts
|
|
@@ -28967,13 +29123,13 @@ async function decideToolOperations(operations2, identity) {
|
|
|
28967
29123
|
import { basename as basename17 } from "path";
|
|
28968
29124
|
|
|
28969
29125
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
28970
|
-
import { mkdirSync as
|
|
28971
|
-
import { homedir as
|
|
28972
|
-
import { join as
|
|
29126
|
+
import { mkdirSync as mkdirSync20 } from "fs";
|
|
29127
|
+
import { homedir as homedir22 } from "os";
|
|
29128
|
+
import { join as join68 } from "path";
|
|
28973
29129
|
import Database from "better-sqlite3";
|
|
28974
29130
|
var _db;
|
|
28975
29131
|
function getDbDir() {
|
|
28976
|
-
return
|
|
29132
|
+
return join68(homedir22(), ".assist");
|
|
28977
29133
|
}
|
|
28978
29134
|
function initSchema(db) {
|
|
28979
29135
|
db.exec(`
|
|
@@ -28991,8 +29147,8 @@ function initSchema(db) {
|
|
|
28991
29147
|
function openPromptsDb(dir) {
|
|
28992
29148
|
if (_db) return _db;
|
|
28993
29149
|
const dbDir = dir ?? getDbDir();
|
|
28994
|
-
|
|
28995
|
-
const db = new Database(
|
|
29150
|
+
mkdirSync20(dbDir, { recursive: true });
|
|
29151
|
+
const db = new Database(join68(dbDir, "assist.db"));
|
|
28996
29152
|
db.pragma("journal_mode = WAL");
|
|
28997
29153
|
initSchema(db);
|
|
28998
29154
|
_db = db;
|
|
@@ -29096,9 +29252,9 @@ ${reasons.join("\n")}`);
|
|
|
29096
29252
|
}
|
|
29097
29253
|
|
|
29098
29254
|
// src/commands/permitCliReads.ts
|
|
29099
|
-
import { existsSync as existsSync58, mkdirSync as
|
|
29100
|
-
import { homedir as
|
|
29101
|
-
import { join as
|
|
29255
|
+
import { existsSync as existsSync58, mkdirSync as mkdirSync21, readFileSync as readFileSync43, writeFileSync as writeFileSync29 } from "fs";
|
|
29256
|
+
import { homedir as homedir23 } from "os";
|
|
29257
|
+
import { join as join69 } from "path";
|
|
29102
29258
|
|
|
29103
29259
|
// src/commands/permitCliReads/assertCliExists.ts
|
|
29104
29260
|
function assertCliExists(cli) {
|
|
@@ -29361,7 +29517,7 @@ function updateSettings(cli, commands) {
|
|
|
29361
29517
|
// src/commands/permitCliReads.ts
|
|
29362
29518
|
function logPath(cli) {
|
|
29363
29519
|
const safeName = cli.replace(/\s+/g, "-");
|
|
29364
|
-
return
|
|
29520
|
+
return join69(homedir23(), ".assist", `cli-discover-${safeName}.log`);
|
|
29365
29521
|
}
|
|
29366
29522
|
function readCache(cli) {
|
|
29367
29523
|
const path128 = logPath(cli);
|
|
@@ -29369,8 +29525,8 @@ function readCache(cli) {
|
|
|
29369
29525
|
return readFileSync43(path128, "utf8");
|
|
29370
29526
|
}
|
|
29371
29527
|
function writeCache(cli, output) {
|
|
29372
|
-
const dir =
|
|
29373
|
-
|
|
29528
|
+
const dir = join69(homedir23(), ".assist");
|
|
29529
|
+
mkdirSync21(dir, { recursive: true });
|
|
29374
29530
|
writeFileSync29(logPath(cli), output);
|
|
29375
29531
|
}
|
|
29376
29532
|
async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
@@ -29535,7 +29691,7 @@ function isHashCommentFile(filePath) {
|
|
|
29535
29691
|
|
|
29536
29692
|
// src/commands/codeComment/sweepRestrictedDir.ts
|
|
29537
29693
|
import { readdirSync as readdirSync11, statSync as statSync11, unlinkSync as unlinkSync8 } from "fs";
|
|
29538
|
-
import { join as
|
|
29694
|
+
import { join as join70 } from "path";
|
|
29539
29695
|
var STALE_AFTER_MS = 30 * 60 * 1e3;
|
|
29540
29696
|
function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
29541
29697
|
let entries2;
|
|
@@ -29546,7 +29702,7 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
29546
29702
|
}
|
|
29547
29703
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
29548
29704
|
for (const entry of entries2) {
|
|
29549
|
-
const path128 =
|
|
29705
|
+
const path128 = join70(dir, entry);
|
|
29550
29706
|
try {
|
|
29551
29707
|
if (statSync11(path128).mtimeMs < cutoff) unlinkSync8(path128);
|
|
29552
29708
|
} catch {
|
|
@@ -29637,7 +29793,7 @@ function validateCommentText(raw, isHash = false) {
|
|
|
29637
29793
|
}
|
|
29638
29794
|
|
|
29639
29795
|
// src/commands/codeComment/issuePin.ts
|
|
29640
|
-
import { mkdirSync as
|
|
29796
|
+
import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync31 } from "fs";
|
|
29641
29797
|
import { randomInt } from "crypto";
|
|
29642
29798
|
|
|
29643
29799
|
// src/commands/notify/deliverPinNotification.ts
|
|
@@ -29722,7 +29878,7 @@ async function deliverPinNotification(notification) {
|
|
|
29722
29878
|
// src/commands/codeComment/issuePin.ts
|
|
29723
29879
|
function issuePin(file, lineNumber, text18) {
|
|
29724
29880
|
const pin2 = generatePin();
|
|
29725
|
-
|
|
29881
|
+
mkdirSync22(getRestrictedDir(), { recursive: true });
|
|
29726
29882
|
sweepRestrictedDir();
|
|
29727
29883
|
writeFileSync31(
|
|
29728
29884
|
getPinStatePath(pin2),
|
|
@@ -32108,16 +32264,16 @@ async function browserRun(options2) {
|
|
|
32108
32264
|
}
|
|
32109
32265
|
|
|
32110
32266
|
// src/commands/browser/browserSnapshot.ts
|
|
32111
|
-
import { mkdirSync as
|
|
32267
|
+
import { mkdirSync as mkdirSync23, writeFileSync as writeFileSync32 } from "fs";
|
|
32112
32268
|
import { dirname as dirname35 } from "path";
|
|
32113
32269
|
|
|
32114
32270
|
// src/commands/browser/snapshotPath.ts
|
|
32115
|
-
import { homedir as
|
|
32116
|
-
import { join as
|
|
32271
|
+
import { homedir as homedir24 } from "os";
|
|
32272
|
+
import { join as join73 } from "path";
|
|
32117
32273
|
function snapshotPath(tabUrl, now) {
|
|
32118
32274
|
const host = new URL(tabUrl).host.replace(/[^\w.-]/g, "-");
|
|
32119
32275
|
const timestamp9 = now.toISOString().replace(/[:.]/g, "-");
|
|
32120
|
-
return
|
|
32276
|
+
return join73(homedir24(), ".assist", "browser", `${host}-${timestamp9}.html`);
|
|
32121
32277
|
}
|
|
32122
32278
|
|
|
32123
32279
|
// src/commands/browser/browserSnapshot.ts
|
|
@@ -32127,7 +32283,7 @@ async function browserSnapshot(options2) {
|
|
|
32127
32283
|
url: options2.url
|
|
32128
32284
|
});
|
|
32129
32285
|
const path128 = snapshotPath(result.tabUrl, /* @__PURE__ */ new Date());
|
|
32130
|
-
|
|
32286
|
+
mkdirSync23(dirname35(path128), { recursive: true });
|
|
32131
32287
|
writeFileSync32(path128, result.html);
|
|
32132
32288
|
console.log(`snapshot: ${path128}`);
|
|
32133
32289
|
}
|
|
@@ -32323,16 +32479,16 @@ async function printExtensionUrl() {
|
|
|
32323
32479
|
|
|
32324
32480
|
// src/commands/extension/signExtension.ts
|
|
32325
32481
|
import { rm as rm2 } from "fs/promises";
|
|
32326
|
-
import { homedir as
|
|
32327
|
-
import { join as
|
|
32482
|
+
import { homedir as homedir25, tmpdir as tmpdir4 } from "os";
|
|
32483
|
+
import { join as join79 } from "path";
|
|
32328
32484
|
import chalk159 from "chalk";
|
|
32329
32485
|
|
|
32330
32486
|
// src/commands/extension/copySignedXpi.ts
|
|
32331
32487
|
import { copyFile } from "fs/promises";
|
|
32332
|
-
import { join as
|
|
32488
|
+
import { join as join74 } from "path";
|
|
32333
32489
|
var SIGNED_XPI_NAME = "assist-extension.xpi";
|
|
32334
32490
|
async function copySignedXpi(xpi, dir) {
|
|
32335
|
-
const fixed2 =
|
|
32491
|
+
const fixed2 = join74(dir, SIGNED_XPI_NAME);
|
|
32336
32492
|
if (fixed2 === xpi) return fixed2;
|
|
32337
32493
|
await copyFile(xpi, fixed2);
|
|
32338
32494
|
return fixed2;
|
|
@@ -32341,11 +32497,11 @@ async function copySignedXpi(xpi, dir) {
|
|
|
32341
32497
|
// src/commands/extension/findSignedXpi.ts
|
|
32342
32498
|
import { existsSync as existsSync62 } from "fs";
|
|
32343
32499
|
import { readdir } from "fs/promises";
|
|
32344
|
-
import { join as
|
|
32500
|
+
import { join as join75 } from "path";
|
|
32345
32501
|
async function findSignedXpi(dir) {
|
|
32346
32502
|
if (!existsSync62(dir)) return null;
|
|
32347
32503
|
const name2 = (await readdir(dir)).find((entry) => entry.endsWith(".xpi"));
|
|
32348
|
-
return name2 ?
|
|
32504
|
+
return name2 ? join75(dir, name2) : null;
|
|
32349
32505
|
}
|
|
32350
32506
|
|
|
32351
32507
|
// src/commands/extension/signedAddonInstallPath.ts
|
|
@@ -32368,10 +32524,10 @@ async function signedAddonInstallPath(xpi) {
|
|
|
32368
32524
|
|
|
32369
32525
|
// src/commands/extension/signPreflightProblem.ts
|
|
32370
32526
|
import { existsSync as existsSync63 } from "fs";
|
|
32371
|
-
import { join as
|
|
32527
|
+
import { join as join76 } from "path";
|
|
32372
32528
|
var KEY_URL = "https://addons.mozilla.org/en-US/developers/addon/api/key/";
|
|
32373
32529
|
function signPreflightProblem(source) {
|
|
32374
|
-
if (!existsSync63(
|
|
32530
|
+
if (!existsSync63(join76(source, "content.js")))
|
|
32375
32531
|
return {
|
|
32376
32532
|
message: `no content.js in ${source}`,
|
|
32377
32533
|
hint: "run npm run build to bundle the content script"
|
|
@@ -32386,7 +32542,7 @@ function signPreflightProblem(source) {
|
|
|
32386
32542
|
|
|
32387
32543
|
// src/commands/extension/stageExtension.ts
|
|
32388
32544
|
import { cp as cp3, mkdir as mkdir5, readFile as readFile5, rm, writeFile as writeFile4 } from "fs/promises";
|
|
32389
|
-
import { basename as basename18, join as
|
|
32545
|
+
import { basename as basename18, join as join77 } from "path";
|
|
32390
32546
|
|
|
32391
32547
|
// src/commands/extension/stampManifestVersion.ts
|
|
32392
32548
|
function stampManifestVersion(manifest, version2) {
|
|
@@ -32403,7 +32559,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
32403
32559
|
recursive: true,
|
|
32404
32560
|
filter: (path128) => basename18(path128) !== "updates.json"
|
|
32405
32561
|
});
|
|
32406
|
-
const manifest =
|
|
32562
|
+
const manifest = join77(staging, "manifest.json");
|
|
32407
32563
|
const stamped = stampManifestVersion(
|
|
32408
32564
|
await readFile5(manifest, "utf8"),
|
|
32409
32565
|
version2
|
|
@@ -32413,7 +32569,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
32413
32569
|
|
|
32414
32570
|
// src/commands/extension/writeUpdateManifest.ts
|
|
32415
32571
|
import { readFile as readFile6, writeFile as writeFile5 } from "fs/promises";
|
|
32416
|
-
import { join as
|
|
32572
|
+
import { join as join78 } from "path";
|
|
32417
32573
|
|
|
32418
32574
|
// src/commands/extension/buildUpdateManifest.ts
|
|
32419
32575
|
var RELEASE_DOWNLOAD_URL = "https://github.com/staff0rd/assist/releases/download";
|
|
@@ -32438,17 +32594,17 @@ function buildUpdateManifest(manifest, version2) {
|
|
|
32438
32594
|
// src/commands/extension/writeUpdateManifest.ts
|
|
32439
32595
|
async function writeUpdateManifest(source, dir, version2) {
|
|
32440
32596
|
await writeFile5(
|
|
32441
|
-
|
|
32597
|
+
join78(dir, "updates.json"),
|
|
32442
32598
|
buildUpdateManifest(
|
|
32443
|
-
await readFile6(
|
|
32599
|
+
await readFile6(join78(source, "manifest.json"), "utf8"),
|
|
32444
32600
|
version2
|
|
32445
32601
|
)
|
|
32446
32602
|
);
|
|
32447
32603
|
}
|
|
32448
32604
|
|
|
32449
32605
|
// src/commands/extension/signExtension.ts
|
|
32450
|
-
var ARTIFACTS_DIR =
|
|
32451
|
-
var STAGING_DIR =
|
|
32606
|
+
var ARTIFACTS_DIR = join79(homedir25(), ".assist", "extension");
|
|
32607
|
+
var STAGING_DIR = join79(tmpdir4(), "assist-extension");
|
|
32452
32608
|
async function signExtension() {
|
|
32453
32609
|
const source = extensionDir();
|
|
32454
32610
|
const problem = signPreflightProblem(source);
|
|
@@ -32742,9 +32898,9 @@ import { readFileSync as readFileSync49 } from "fs";
|
|
|
32742
32898
|
import { parse as parseYaml3 } from "yaml";
|
|
32743
32899
|
|
|
32744
32900
|
// src/commands/devlog/devEntryPath.ts
|
|
32745
|
-
import { join as
|
|
32901
|
+
import { join as join80 } from "path";
|
|
32746
32902
|
function devEntryPath(repoName, week, devDir) {
|
|
32747
|
-
return
|
|
32903
|
+
return join80(devDir, repoName, `${week.toLowerCase()}.md`);
|
|
32748
32904
|
}
|
|
32749
32905
|
|
|
32750
32906
|
// src/commands/devlog/loadDevEntry.ts
|
|
@@ -32857,13 +33013,13 @@ import chalk165 from "chalk";
|
|
|
32857
33013
|
|
|
32858
33014
|
// src/shared/getRepoName.ts
|
|
32859
33015
|
import { existsSync as existsSync65, readFileSync as readFileSync50 } from "fs";
|
|
32860
|
-
import { basename as basename19, join as
|
|
33016
|
+
import { basename as basename19, join as join81 } from "path";
|
|
32861
33017
|
function getRepoName() {
|
|
32862
33018
|
const config = loadConfig();
|
|
32863
33019
|
if (config.devlog?.name) {
|
|
32864
33020
|
return config.devlog.name;
|
|
32865
33021
|
}
|
|
32866
|
-
const packageJsonPath =
|
|
33022
|
+
const packageJsonPath = join81(process.cwd(), "package.json");
|
|
32867
33023
|
if (existsSync65(packageJsonPath)) {
|
|
32868
33024
|
try {
|
|
32869
33025
|
const content = readFileSync50(packageJsonPath, "utf8");
|
|
@@ -32942,7 +33098,7 @@ function list2(options2) {
|
|
|
32942
33098
|
|
|
32943
33099
|
// src/commands/devlog/loadDevWeeks.ts
|
|
32944
33100
|
import { readdirSync as readdirSync12 } from "fs";
|
|
32945
|
-
import { join as
|
|
33101
|
+
import { join as join82 } from "path";
|
|
32946
33102
|
var DEV_FILENAME_PATTERN = /^(\d{4})-w(\d{2})\.md$/;
|
|
32947
33103
|
function parseDevWeekFilename(filename) {
|
|
32948
33104
|
const match = filename.match(DEV_FILENAME_PATTERN);
|
|
@@ -32956,7 +33112,7 @@ function readFilenames(dir) {
|
|
|
32956
33112
|
}
|
|
32957
33113
|
}
|
|
32958
33114
|
function loadDevWeeks(repoName, devDir) {
|
|
32959
|
-
return readFilenames(
|
|
33115
|
+
return readFilenames(join82(devDir, repoName)).map(parseDevWeekFilename).filter((week) => week !== null).sort();
|
|
32960
33116
|
}
|
|
32961
33117
|
|
|
32962
33118
|
// src/commands/devlog/next/displayNextEntry.ts
|
|
@@ -33221,14 +33377,14 @@ async function skip2(week, cwd = process.cwd()) {
|
|
|
33221
33377
|
}
|
|
33222
33378
|
|
|
33223
33379
|
// src/commands/devlog/slack/slack.ts
|
|
33224
|
-
import { mkdirSync as
|
|
33380
|
+
import { mkdirSync as mkdirSync26, writeFileSync as writeFileSync37 } from "fs";
|
|
33225
33381
|
import chalk171 from "chalk";
|
|
33226
33382
|
|
|
33227
33383
|
// src/commands/slack/postSlackMessage.ts
|
|
33228
|
-
import { mkdirSync as
|
|
33384
|
+
import { mkdirSync as mkdirSync25, writeFileSync as writeFileSync36 } from "fs";
|
|
33229
33385
|
|
|
33230
33386
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
33231
|
-
import { mkdirSync as
|
|
33387
|
+
import { mkdirSync as mkdirSync24, writeFileSync as writeFileSync35 } from "fs";
|
|
33232
33388
|
|
|
33233
33389
|
// src/commands/slack/readSlackParts.ts
|
|
33234
33390
|
import { readFileSync as readFileSync52 } from "fs";
|
|
@@ -33274,12 +33430,12 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
33274
33430
|
}
|
|
33275
33431
|
|
|
33276
33432
|
// src/commands/slack/slackWorkingFile.ts
|
|
33277
|
-
import { join as
|
|
33433
|
+
import { join as join83 } from "path";
|
|
33278
33434
|
function slackWorkingFile(channel, partIndex) {
|
|
33279
33435
|
const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
|
|
33280
|
-
const dir =
|
|
33436
|
+
const dir = join83(getStoreDir(), "slack");
|
|
33281
33437
|
const name2 = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
|
|
33282
|
-
return { dir, bodyPath:
|
|
33438
|
+
return { dir, bodyPath: join83(dir, `${name2}.md`) };
|
|
33283
33439
|
}
|
|
33284
33440
|
|
|
33285
33441
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
@@ -33291,7 +33447,7 @@ async function previewSlackThreadParts({
|
|
|
33291
33447
|
}) {
|
|
33292
33448
|
const bodies = readSlackParts(partFiles);
|
|
33293
33449
|
const { dir } = slackWorkingFile(channel);
|
|
33294
|
-
|
|
33450
|
+
mkdirSync24(dir, { recursive: true });
|
|
33295
33451
|
const paths = bodies.map((body, index3) => {
|
|
33296
33452
|
const { bodyPath } = slackWorkingFile(channel, index3 + 1);
|
|
33297
33453
|
writeFileSync35(bodyPath, `${body}
|
|
@@ -33345,7 +33501,7 @@ async function postSlackMessage(channelArg, options2) {
|
|
|
33345
33501
|
process.exit(1);
|
|
33346
33502
|
}
|
|
33347
33503
|
const { dir, bodyPath } = slackWorkingFile(channel);
|
|
33348
|
-
|
|
33504
|
+
mkdirSync25(dir, { recursive: true });
|
|
33349
33505
|
writeFileSync36(bodyPath, `${body}
|
|
33350
33506
|
`);
|
|
33351
33507
|
await reviewProposedSlackMessage({ channel, threadTs }, body, bodyPath);
|
|
@@ -33485,7 +33641,7 @@ function fail8(message4) {
|
|
|
33485
33641
|
process.exit(1);
|
|
33486
33642
|
}
|
|
33487
33643
|
function writeParts(channel, parts2) {
|
|
33488
|
-
|
|
33644
|
+
mkdirSync26(slackWorkingFile(channel).dir, { recursive: true });
|
|
33489
33645
|
return parts2.map((part, index3) => {
|
|
33490
33646
|
const { bodyPath } = slackWorkingFile(channel, index3 + 1);
|
|
33491
33647
|
writeFileSync37(bodyPath, `${part}
|
|
@@ -33529,7 +33685,7 @@ async function slack2(week) {
|
|
|
33529
33685
|
}
|
|
33530
33686
|
|
|
33531
33687
|
// src/commands/devlog/write.ts
|
|
33532
|
-
import { mkdirSync as
|
|
33688
|
+
import { mkdirSync as mkdirSync27, writeFileSync as writeFileSync38 } from "fs";
|
|
33533
33689
|
import { dirname as dirname36 } from "path";
|
|
33534
33690
|
import chalk172 from "chalk";
|
|
33535
33691
|
|
|
@@ -33624,7 +33780,7 @@ async function write() {
|
|
|
33624
33780
|
const devDir = resolveDevDir();
|
|
33625
33781
|
const repoName = getRepoName();
|
|
33626
33782
|
const path128 = devEntryPath(repoName, result.data.week, devDir);
|
|
33627
|
-
|
|
33783
|
+
mkdirSync27(dirname36(path128), { recursive: true });
|
|
33628
33784
|
writeFileSync38(path128, formatDevEntry(repoName, result.data));
|
|
33629
33785
|
console.log(chalk172.green(`Wrote ${path128}`));
|
|
33630
33786
|
}
|
|
@@ -33821,9 +33977,9 @@ async function findPhaseUnlockItem(itemId2, phase) {
|
|
|
33821
33977
|
}
|
|
33822
33978
|
|
|
33823
33979
|
// src/commands/docs/getDocsUnlockPinPath.ts
|
|
33824
|
-
import { join as
|
|
33980
|
+
import { join as join84 } from "path";
|
|
33825
33981
|
function getDocsUnlockPinPath(pin2) {
|
|
33826
|
-
return
|
|
33982
|
+
return join84(getRestrictedDir(), `docs-unlock-pin-${pin2}.json`);
|
|
33827
33983
|
}
|
|
33828
33984
|
|
|
33829
33985
|
// src/commands/docs/readDocsUnlockPinState.ts
|
|
@@ -33879,7 +34035,7 @@ import chalk177 from "chalk";
|
|
|
33879
34035
|
|
|
33880
34036
|
// src/commands/notify/issueUnlockPin.ts
|
|
33881
34037
|
import { randomInt as randomInt2 } from "crypto";
|
|
33882
|
-
import { mkdirSync as
|
|
34038
|
+
import { mkdirSync as mkdirSync28, unlinkSync as unlinkSync11, writeFileSync as writeFileSync39 } from "fs";
|
|
33883
34039
|
async function issueUnlockPin({
|
|
33884
34040
|
area,
|
|
33885
34041
|
label,
|
|
@@ -33887,7 +34043,7 @@ async function issueUnlockPin({
|
|
|
33887
34043
|
state
|
|
33888
34044
|
}) {
|
|
33889
34045
|
const pin2 = randomInt2(0, 1e3).toString().padStart(3, "0");
|
|
33890
|
-
|
|
34046
|
+
mkdirSync28(getRestrictedDir(), { recursive: true });
|
|
33891
34047
|
sweepRestrictedDir();
|
|
33892
34048
|
const path128 = pinPath(pin2);
|
|
33893
34049
|
writeFileSync39(path128, JSON.stringify({ ...state, pin: pin2 }));
|
|
@@ -33966,7 +34122,7 @@ import { unlinkSync as unlinkSync12 } from "fs";
|
|
|
33966
34122
|
import chalk179 from "chalk";
|
|
33967
34123
|
|
|
33968
34124
|
// src/commands/schema/approveSchemaUnlock.ts
|
|
33969
|
-
import { mkdirSync as
|
|
34125
|
+
import { mkdirSync as mkdirSync29, writeFileSync as writeFileSync40 } from "fs";
|
|
33970
34126
|
import chalk178 from "chalk";
|
|
33971
34127
|
|
|
33972
34128
|
// src/commands/schema/schemaHarnessLabel.ts
|
|
@@ -33997,7 +34153,7 @@ function approveSession({ harness, conversationId }) {
|
|
|
33997
34153
|
const scope = { harness, conversationId };
|
|
33998
34154
|
const path128 = getSchemaSessionApprovalPath(scope);
|
|
33999
34155
|
if (!path128) return;
|
|
34000
|
-
|
|
34156
|
+
mkdirSync29(getSchemaSessionApprovalDir(), { recursive: true });
|
|
34001
34157
|
writeFileSync40(path128, JSON.stringify(scope));
|
|
34002
34158
|
console.log(
|
|
34003
34159
|
chalk178.green(
|
|
@@ -34011,9 +34167,9 @@ async function approveSchemaUnlock(state) {
|
|
|
34011
34167
|
}
|
|
34012
34168
|
|
|
34013
34169
|
// src/commands/schema/getSchemaUnlockPinPath.ts
|
|
34014
|
-
import { join as
|
|
34170
|
+
import { join as join85 } from "path";
|
|
34015
34171
|
function getSchemaUnlockPinPath(pin2) {
|
|
34016
|
-
return
|
|
34172
|
+
return join85(getRestrictedDir(), `schema-unlock-pin-${pin2}.json`);
|
|
34017
34173
|
}
|
|
34018
34174
|
|
|
34019
34175
|
// src/commands/schema/readSchemaUnlockPinState.ts
|
|
@@ -34172,7 +34328,7 @@ function registerSchema(parent) {
|
|
|
34172
34328
|
|
|
34173
34329
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
34174
34330
|
import { closeSync as closeSync6, openSync as openSync7, readdirSync as readdirSync14 } from "fs";
|
|
34175
|
-
import { join as
|
|
34331
|
+
import { join as join86 } from "path";
|
|
34176
34332
|
import chalk182 from "chalk";
|
|
34177
34333
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
34178
34334
|
function isLockedDll(debugDir) {
|
|
@@ -34184,7 +34340,7 @@ function isLockedDll(debugDir) {
|
|
|
34184
34340
|
}
|
|
34185
34341
|
for (const file of files) {
|
|
34186
34342
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
34187
|
-
const dllPath =
|
|
34343
|
+
const dllPath = join86(debugDir, file);
|
|
34188
34344
|
try {
|
|
34189
34345
|
const fd = openSync7(dllPath, "r+");
|
|
34190
34346
|
closeSync6(fd);
|
|
@@ -34202,13 +34358,13 @@ function findFirstLockedDll(dir) {
|
|
|
34202
34358
|
return null;
|
|
34203
34359
|
}
|
|
34204
34360
|
if (entries2.includes("bin")) {
|
|
34205
|
-
const locked = isLockedDll(
|
|
34361
|
+
const locked = isLockedDll(join86(dir, "bin", "Debug"));
|
|
34206
34362
|
if (locked) return locked;
|
|
34207
34363
|
}
|
|
34208
34364
|
for (const entry of entries2) {
|
|
34209
34365
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
34210
34366
|
continue;
|
|
34211
|
-
const found = findFirstLockedDll(
|
|
34367
|
+
const found = findFirstLockedDll(join86(dir, entry));
|
|
34212
34368
|
if (found) return found;
|
|
34213
34369
|
}
|
|
34214
34370
|
return null;
|
|
@@ -34555,11 +34711,11 @@ import chalk188 from "chalk";
|
|
|
34555
34711
|
|
|
34556
34712
|
// src/commands/dotnet/findSolution.ts
|
|
34557
34713
|
import { readdirSync as readdirSync16 } from "fs";
|
|
34558
|
-
import { dirname as dirname37, join as
|
|
34714
|
+
import { dirname as dirname37, join as join87 } from "path";
|
|
34559
34715
|
import chalk187 from "chalk";
|
|
34560
34716
|
function findSlnInDir(dir) {
|
|
34561
34717
|
try {
|
|
34562
|
-
return readdirSync16(dir).filter((f) => f.endsWith(".sln")).map((f) =>
|
|
34718
|
+
return readdirSync16(dir).filter((f) => f.endsWith(".sln")).map((f) => join87(dir, f));
|
|
34563
34719
|
} catch {
|
|
34564
34720
|
return [];
|
|
34565
34721
|
}
|
|
@@ -35601,7 +35757,7 @@ function aggregateCommitters(authorLists) {
|
|
|
35601
35757
|
import { spawnSync as spawnSync8 } from "child_process";
|
|
35602
35758
|
import { unlinkSync as unlinkSync14, writeFileSync as writeFileSync41 } from "fs";
|
|
35603
35759
|
import { tmpdir as tmpdir6 } from "os";
|
|
35604
|
-
import { join as
|
|
35760
|
+
import { join as join88 } from "path";
|
|
35605
35761
|
function buildArgs3(queryFile, vars) {
|
|
35606
35762
|
const args = ["api", "graphql", "-F", `query=@${queryFile}`];
|
|
35607
35763
|
for (const [key, value] of Object.entries(vars)) {
|
|
@@ -35611,7 +35767,7 @@ function buildArgs3(queryFile, vars) {
|
|
|
35611
35767
|
return args;
|
|
35612
35768
|
}
|
|
35613
35769
|
function runGhGraphql(mutation, vars) {
|
|
35614
|
-
const queryFile =
|
|
35770
|
+
const queryFile = join88(tmpdir6(), `gh-query-${Date.now()}.graphql`);
|
|
35615
35771
|
writeFileSync41(queryFile, mutation);
|
|
35616
35772
|
try {
|
|
35617
35773
|
const result = spawnSync8("gh", buildArgs3(queryFile, vars), {
|
|
@@ -37087,24 +37243,24 @@ function slugFromUrl(url) {
|
|
|
37087
37243
|
}
|
|
37088
37244
|
|
|
37089
37245
|
// src/commands/github/issue/writeIssueWorkingFile.ts
|
|
37090
|
-
import { mkdirSync as
|
|
37246
|
+
import { mkdirSync as mkdirSync30, writeFileSync as writeFileSync42 } from "fs";
|
|
37091
37247
|
|
|
37092
37248
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
37093
|
-
import { join as
|
|
37249
|
+
import { join as join89 } from "path";
|
|
37094
37250
|
function issueWorkingFile(slug2, number) {
|
|
37095
37251
|
const [owner = "unknown", repo = "unknown"] = slug2.split("/");
|
|
37096
|
-
const dir =
|
|
37252
|
+
const dir = join89(getStoreDir(), "github-issues", owner, repo);
|
|
37097
37253
|
return {
|
|
37098
37254
|
dir,
|
|
37099
|
-
bodyPath:
|
|
37100
|
-
metaPath:
|
|
37255
|
+
bodyPath: join89(dir, `${number}.md`),
|
|
37256
|
+
metaPath: join89(dir, `${number}.json`)
|
|
37101
37257
|
};
|
|
37102
37258
|
}
|
|
37103
37259
|
|
|
37104
37260
|
// src/commands/github/issue/writeIssueWorkingFile.ts
|
|
37105
37261
|
function writeIssueWorkingFile(slug2, number, target, updatedAt, body) {
|
|
37106
37262
|
const { dir, bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
37107
|
-
|
|
37263
|
+
mkdirSync30(dir, { recursive: true });
|
|
37108
37264
|
writeFileSync42(bodyPath, body);
|
|
37109
37265
|
writeFileSync42(
|
|
37110
37266
|
metaPath,
|
|
@@ -38284,11 +38440,11 @@ import { existsSync as existsSync72 } from "fs";
|
|
|
38284
38440
|
import { basename as basename22, dirname as dirname39 } from "path";
|
|
38285
38441
|
|
|
38286
38442
|
// src/commands/sessions/daemon/worktree/nextWorktreePath.ts
|
|
38287
|
-
import { basename as basename21, join as
|
|
38443
|
+
import { basename as basename21, join as join90 } from "path";
|
|
38288
38444
|
function nextWorktreePath(clone, base, isTaken) {
|
|
38289
38445
|
const name2 = basename21(clone);
|
|
38290
38446
|
for (let n = 2; n < 1e3; n++) {
|
|
38291
|
-
const candidate =
|
|
38447
|
+
const candidate = join90(base, `${name2}-${n}`);
|
|
38292
38448
|
if (!isTaken(candidate)) return candidate;
|
|
38293
38449
|
}
|
|
38294
38450
|
throw new Error(`no free worktree suffix for ${clone}`);
|
|
@@ -38554,8 +38710,8 @@ function persistedTreeRoots() {
|
|
|
38554
38710
|
}
|
|
38555
38711
|
|
|
38556
38712
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
38557
|
-
import { copyFileSync as copyFileSync3, existsSync as existsSync74, mkdirSync as
|
|
38558
|
-
import { dirname as dirname40, join as
|
|
38713
|
+
import { copyFileSync as copyFileSync3, existsSync as existsSync74, mkdirSync as mkdirSync31 } from "fs";
|
|
38714
|
+
import { dirname as dirname40, join as join92 } from "path";
|
|
38559
38715
|
|
|
38560
38716
|
// src/commands/sessions/daemon/worktree/installPaths.ts
|
|
38561
38717
|
import { resolve as resolve22 } from "path";
|
|
@@ -38586,13 +38742,13 @@ function pendingPathAction(enclosing, states2, paths, stopped) {
|
|
|
38586
38742
|
|
|
38587
38743
|
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
38588
38744
|
import { existsSync as existsSync73 } from "fs";
|
|
38589
|
-
import { join as
|
|
38745
|
+
import { join as join91 } from "path";
|
|
38590
38746
|
function detectInstallCommand(dir) {
|
|
38591
|
-
if (!existsSync73(
|
|
38592
|
-
if (existsSync73(
|
|
38593
|
-
if (existsSync73(
|
|
38594
|
-
if (existsSync73(
|
|
38595
|
-
if (existsSync73(
|
|
38747
|
+
if (!existsSync73(join91(dir, "package.json"))) return null;
|
|
38748
|
+
if (existsSync73(join91(dir, "pnpm-lock.yaml"))) return "pnpm install";
|
|
38749
|
+
if (existsSync73(join91(dir, "yarn.lock"))) return "yarn install";
|
|
38750
|
+
if (existsSync73(join91(dir, "bun.lockb"))) return "bun install";
|
|
38751
|
+
if (existsSync73(join91(dir, "package-lock.json"))) return "npm ci";
|
|
38596
38752
|
return "npm install";
|
|
38597
38753
|
}
|
|
38598
38754
|
|
|
@@ -38784,11 +38940,11 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
38784
38940
|
}
|
|
38785
38941
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
38786
38942
|
for (const rel of copy) {
|
|
38787
|
-
const src =
|
|
38943
|
+
const src = join92(clone, rel);
|
|
38788
38944
|
if (!existsSync74(src)) continue;
|
|
38789
|
-
const dest =
|
|
38945
|
+
const dest = join92(worktreePath, rel);
|
|
38790
38946
|
try {
|
|
38791
|
-
|
|
38947
|
+
mkdirSync31(dirname40(dest), { recursive: true });
|
|
38792
38948
|
copyFileSync3(src, dest);
|
|
38793
38949
|
daemonLog(`worktree ${worktreePath} seeded ${rel}`);
|
|
38794
38950
|
} catch (error) {
|
|
@@ -39290,7 +39446,7 @@ function registerLitellm(program) {
|
|
|
39290
39446
|
}
|
|
39291
39447
|
|
|
39292
39448
|
// src/commands/mermaidExport.ts
|
|
39293
|
-
import { mkdirSync as
|
|
39449
|
+
import { mkdirSync as mkdirSync32, readdirSync as readdirSync17 } from "fs";
|
|
39294
39450
|
import { resolve as resolve24 } from "path";
|
|
39295
39451
|
import chalk207 from "chalk";
|
|
39296
39452
|
|
|
@@ -39359,7 +39515,7 @@ function extractMermaidBlocks(markdown) {
|
|
|
39359
39515
|
async function mermaidExport(file, options2 = {}) {
|
|
39360
39516
|
const { mermaid } = loadConfig();
|
|
39361
39517
|
const outDir = resolve24(process.cwd(), options2.out ?? ".");
|
|
39362
|
-
|
|
39518
|
+
mkdirSync32(outDir, { recursive: true });
|
|
39363
39519
|
if (options2.index !== void 0) {
|
|
39364
39520
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
39365
39521
|
console.error(
|
|
@@ -39454,7 +39610,7 @@ function boardSource(raw, anchorId, options2) {
|
|
|
39454
39610
|
import { stringify as stringify2 } from "yaml";
|
|
39455
39611
|
|
|
39456
39612
|
// src/commands/miro/writeExtract.ts
|
|
39457
|
-
import { mkdirSync as
|
|
39613
|
+
import { mkdirSync as mkdirSync33, writeFileSync as writeFileSync44 } from "fs";
|
|
39458
39614
|
import { dirname as dirname41 } from "path";
|
|
39459
39615
|
import { stringify } from "yaml";
|
|
39460
39616
|
function headerLines(header) {
|
|
@@ -39468,7 +39624,7 @@ function headerLines(header) {
|
|
|
39468
39624
|
];
|
|
39469
39625
|
}
|
|
39470
39626
|
function writeExtract(file, header, texts) {
|
|
39471
|
-
|
|
39627
|
+
mkdirSync33(dirname41(file), { recursive: true });
|
|
39472
39628
|
writeFileSync44(file, `${headerLines(header).join("\n")}
|
|
39473
39629
|
${stringify(texts)}`);
|
|
39474
39630
|
}
|
|
@@ -40021,15 +40177,15 @@ function createNetcapHandler(options2) {
|
|
|
40021
40177
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
40022
40178
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
40023
40179
|
import { networkInterfaces } from "os";
|
|
40024
|
-
import { join as
|
|
40180
|
+
import { join as join94 } from "path";
|
|
40025
40181
|
import chalk210 from "chalk";
|
|
40026
40182
|
|
|
40027
40183
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
40028
|
-
import { dirname as dirname42, join as
|
|
40184
|
+
import { dirname as dirname42, join as join93 } from "path";
|
|
40029
40185
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
40030
40186
|
var moduleDir2 = dirname42(fileURLToPath8(import.meta.url));
|
|
40031
40187
|
function netcapExtensionDir() {
|
|
40032
|
-
return
|
|
40188
|
+
return join93(moduleDir2, "commands", "netcap", "netcap-extension");
|
|
40033
40189
|
}
|
|
40034
40190
|
|
|
40035
40191
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
@@ -40044,7 +40200,7 @@ function lanIPv4() {
|
|
|
40044
40200
|
return void 0;
|
|
40045
40201
|
}
|
|
40046
40202
|
async function configureBackground(dir, host, port, filter) {
|
|
40047
|
-
const file =
|
|
40203
|
+
const file = join94(dir, "background.js");
|
|
40048
40204
|
const source = await readFile7(file, "utf8");
|
|
40049
40205
|
await writeFile6(
|
|
40050
40206
|
file,
|
|
@@ -40084,20 +40240,20 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
40084
40240
|
}
|
|
40085
40241
|
|
|
40086
40242
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
40087
|
-
import { isAbsolute as isAbsolute6, join as
|
|
40243
|
+
import { isAbsolute as isAbsolute6, join as join96, resolve as resolve26 } from "path";
|
|
40088
40244
|
|
|
40089
40245
|
// src/commands/netcap/defaultCapturePath.ts
|
|
40090
|
-
import { homedir as
|
|
40091
|
-
import { join as
|
|
40246
|
+
import { homedir as homedir26 } from "os";
|
|
40247
|
+
import { join as join95 } from "path";
|
|
40092
40248
|
function defaultCapturePath() {
|
|
40093
|
-
return
|
|
40249
|
+
return join95(homedir26(), ".assist", "netcap", "capture.jsonl");
|
|
40094
40250
|
}
|
|
40095
40251
|
|
|
40096
40252
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
40097
40253
|
function resolveNetcapOutPath(out) {
|
|
40098
40254
|
if (!out) return defaultCapturePath();
|
|
40099
40255
|
const dir = isAbsolute6(out) ? out : resolve26(process.cwd(), out);
|
|
40100
|
-
return
|
|
40256
|
+
return join96(dir, "capture.jsonl");
|
|
40101
40257
|
}
|
|
40102
40258
|
|
|
40103
40259
|
// src/commands/netcap/netcap.ts
|
|
@@ -40144,7 +40300,7 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
|
|
|
40144
40300
|
|
|
40145
40301
|
// src/commands/netcap/netcapExtract.ts
|
|
40146
40302
|
import { writeFileSync as writeFileSync45 } from "fs";
|
|
40147
|
-
import { join as
|
|
40303
|
+
import { join as join97 } from "path";
|
|
40148
40304
|
import chalk212 from "chalk";
|
|
40149
40305
|
|
|
40150
40306
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
@@ -40589,7 +40745,7 @@ function extractPostsFromCapture(captureFile) {
|
|
|
40589
40745
|
function netcapExtract(file) {
|
|
40590
40746
|
const captureFile = file ?? defaultCapturePath();
|
|
40591
40747
|
const posts = extractPostsFromCapture(captureFile);
|
|
40592
|
-
const outFile =
|
|
40748
|
+
const outFile = join97(captureFile, "..", "posts.json");
|
|
40593
40749
|
writeFileSync45(outFile, `${JSON.stringify(posts, null, 2)}
|
|
40594
40750
|
`);
|
|
40595
40751
|
console.log(
|
|
@@ -40984,11 +41140,11 @@ async function comment2(path128, line, body, options2 = {}) {
|
|
|
40984
41140
|
}
|
|
40985
41141
|
|
|
40986
41142
|
// src/commands/prs/commentsCachePath.ts
|
|
40987
|
-
import { homedir as
|
|
40988
|
-
import { join as
|
|
41143
|
+
import { homedir as homedir27 } from "os";
|
|
41144
|
+
import { join as join98 } from "path";
|
|
40989
41145
|
function commentsCachePath(org, repo, prNumber) {
|
|
40990
|
-
return
|
|
40991
|
-
|
|
41146
|
+
return join98(
|
|
41147
|
+
homedir27(),
|
|
40992
41148
|
".assist",
|
|
40993
41149
|
"pr-comments",
|
|
40994
41150
|
org,
|
|
@@ -40998,7 +41154,7 @@ function commentsCachePath(org, repo, prNumber) {
|
|
|
40998
41154
|
}
|
|
40999
41155
|
|
|
41000
41156
|
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
41001
|
-
import { mkdirSync as
|
|
41157
|
+
import { mkdirSync as mkdirSync34, writeFileSync as writeFileSync46 } from "fs";
|
|
41002
41158
|
import { dirname as dirname44 } from "path";
|
|
41003
41159
|
import { stringify as stringify3 } from "yaml";
|
|
41004
41160
|
|
|
@@ -41023,10 +41179,10 @@ function deleteCommentsCache(org, repo, prNumber) {
|
|
|
41023
41179
|
|
|
41024
41180
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
41025
41181
|
import { readdirSync as readdirSync18, unlinkSync as unlinkSync16 } from "fs";
|
|
41026
|
-
import { join as
|
|
41182
|
+
import { join as join99 } from "path";
|
|
41027
41183
|
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
41028
41184
|
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
41029
|
-
const dir =
|
|
41185
|
+
const dir = join99(cwd, ".assist");
|
|
41030
41186
|
let entries2;
|
|
41031
41187
|
try {
|
|
41032
41188
|
entries2 = readdirSync18(dir);
|
|
@@ -41034,14 +41190,14 @@ function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
|
41034
41190
|
return;
|
|
41035
41191
|
}
|
|
41036
41192
|
for (const entry of entries2.filter((e) => STALE_PATTERN.test(e))) {
|
|
41037
|
-
unlinkSync16(
|
|
41193
|
+
unlinkSync16(join99(dir, entry));
|
|
41038
41194
|
}
|
|
41039
41195
|
}
|
|
41040
41196
|
|
|
41041
41197
|
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
41042
41198
|
function writeCommentsCache(org, repo, prNumber, comments3) {
|
|
41043
41199
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
41044
|
-
|
|
41200
|
+
mkdirSync34(dirname44(cachePath), { recursive: true });
|
|
41045
41201
|
const cacheData = {
|
|
41046
41202
|
prNumber,
|
|
41047
41203
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -41152,7 +41308,7 @@ function failAzureDevops(error) {
|
|
|
41152
41308
|
import { execFileSync as execFileSync23 } from "child_process";
|
|
41153
41309
|
import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as writeFileSync47 } from "fs";
|
|
41154
41310
|
import { tmpdir as tmpdir7 } from "os";
|
|
41155
|
-
import { join as
|
|
41311
|
+
import { join as join100 } from "path";
|
|
41156
41312
|
function azDevopsInvokeArgs(request, inFile) {
|
|
41157
41313
|
return [
|
|
41158
41314
|
"devops",
|
|
@@ -41187,8 +41343,8 @@ function runAz2(args) {
|
|
|
41187
41343
|
}
|
|
41188
41344
|
function invokeAzDevops(request) {
|
|
41189
41345
|
if (request.body === void 0) return runAz2(azDevopsInvokeArgs(request));
|
|
41190
|
-
const dir = mkdtempSync2(
|
|
41191
|
-
const inFile =
|
|
41346
|
+
const dir = mkdtempSync2(join100(tmpdir7(), "assist-az-"));
|
|
41347
|
+
const inFile = join100(dir, "body.json");
|
|
41192
41348
|
try {
|
|
41193
41349
|
writeFileSync47(inFile, JSON.stringify(request.body));
|
|
41194
41350
|
return runAz2(azDevopsInvokeArgs(request, inFile));
|
|
@@ -44318,9 +44474,9 @@ async function notify() {
|
|
|
44318
44474
|
|
|
44319
44475
|
// src/commands/screenshot.ts
|
|
44320
44476
|
import { execSync as execSync54 } from "child_process";
|
|
44321
|
-
import { existsSync as existsSync77, mkdirSync as
|
|
44477
|
+
import { existsSync as existsSync77, mkdirSync as mkdirSync35, unlinkSync as unlinkSync17, writeFileSync as writeFileSync48 } from "fs";
|
|
44322
44478
|
import { tmpdir as tmpdir8 } from "os";
|
|
44323
|
-
import { join as
|
|
44479
|
+
import { join as join101, resolve as resolve28 } from "path";
|
|
44324
44480
|
import chalk239 from "chalk";
|
|
44325
44481
|
|
|
44326
44482
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -44451,13 +44607,13 @@ Write-Output $OutputPath
|
|
|
44451
44607
|
// src/commands/screenshot.ts
|
|
44452
44608
|
function buildOutputPath(outputDir, processName) {
|
|
44453
44609
|
if (!existsSync77(outputDir)) {
|
|
44454
|
-
|
|
44610
|
+
mkdirSync35(outputDir, { recursive: true });
|
|
44455
44611
|
}
|
|
44456
44612
|
const timestamp9 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
44457
44613
|
return resolve28(outputDir, `${processName}-${timestamp9}.png`);
|
|
44458
44614
|
}
|
|
44459
44615
|
function runPowerShellScript(processName, outputPath) {
|
|
44460
|
-
const scriptPath =
|
|
44616
|
+
const scriptPath = join101(tmpdir8(), `assist-screenshot-${Date.now()}.ps1`);
|
|
44461
44617
|
writeFileSync48(scriptPath, captureWindowPs1, "utf8");
|
|
44462
44618
|
try {
|
|
44463
44619
|
execSync54(
|
|
@@ -44559,9 +44715,9 @@ function buildLimitsSegment(rateLimits) {
|
|
|
44559
44715
|
|
|
44560
44716
|
// src/commands/readGitBranch.ts
|
|
44561
44717
|
import { readFileSync as readFileSync67, statSync as statSync14 } from "fs";
|
|
44562
|
-
import { isAbsolute as isAbsolute7, join as
|
|
44718
|
+
import { isAbsolute as isAbsolute7, join as join102, resolve as resolve29 } from "path";
|
|
44563
44719
|
function resolveGitDir(cwd) {
|
|
44564
|
-
const dotGit =
|
|
44720
|
+
const dotGit = join102(cwd, ".git");
|
|
44565
44721
|
let stat5;
|
|
44566
44722
|
try {
|
|
44567
44723
|
stat5 = statSync14(dotGit);
|
|
@@ -44591,7 +44747,7 @@ function readGitBranch(cwd) {
|
|
|
44591
44747
|
}
|
|
44592
44748
|
let head;
|
|
44593
44749
|
try {
|
|
44594
|
-
head = readFileSync67(
|
|
44750
|
+
head = readFileSync67(join102(gitDir, "HEAD"), "utf8");
|
|
44595
44751
|
} catch {
|
|
44596
44752
|
return null;
|
|
44597
44753
|
}
|
|
@@ -47767,12 +47923,12 @@ function formatSlicingRequest(hunks) {
|
|
|
47767
47923
|
}
|
|
47768
47924
|
|
|
47769
47925
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
47770
|
-
import { join as
|
|
47926
|
+
import { join as join103 } from "path";
|
|
47771
47927
|
function slug(value) {
|
|
47772
47928
|
return value.replace(/[^\w.-]+/g, "-");
|
|
47773
47929
|
}
|
|
47774
47930
|
function highLevelReviewPath(repo, headRef, headSha) {
|
|
47775
|
-
return
|
|
47931
|
+
return join103(
|
|
47776
47932
|
getStoreDir(),
|
|
47777
47933
|
"high-level-reviews",
|
|
47778
47934
|
slug(repo),
|
|
@@ -47907,10 +48063,10 @@ function resolveHighLevelSlices(raw, hunks) {
|
|
|
47907
48063
|
}
|
|
47908
48064
|
|
|
47909
48065
|
// src/commands/review/highLevel/writeJsonFile.ts
|
|
47910
|
-
import { mkdirSync as
|
|
48066
|
+
import { mkdirSync as mkdirSync36, writeFileSync as writeFileSync49 } from "fs";
|
|
47911
48067
|
import { dirname as dirname47 } from "path";
|
|
47912
48068
|
function writeJsonFile(path128, data) {
|
|
47913
|
-
|
|
48069
|
+
mkdirSync36(dirname47(path128), { recursive: true });
|
|
47914
48070
|
writeFileSync49(path128, `${JSON.stringify(data, null, 2)}
|
|
47915
48071
|
`);
|
|
47916
48072
|
return path128;
|
|
@@ -48934,8 +49090,8 @@ function renderEntry(entry, frame) {
|
|
|
48934
49090
|
import { format } from "util";
|
|
48935
49091
|
|
|
48936
49092
|
// src/commands/review/createReviewLogSink.ts
|
|
48937
|
-
import { appendFileSync as appendFileSync3, mkdirSync as
|
|
48938
|
-
import { join as
|
|
49093
|
+
import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync37 } from "fs";
|
|
49094
|
+
import { join as join104 } from "path";
|
|
48939
49095
|
var LOG_FILE = "review.log";
|
|
48940
49096
|
function createReviewLogSink() {
|
|
48941
49097
|
let logPath2;
|
|
@@ -48951,8 +49107,8 @@ function createReviewLogSink() {
|
|
|
48951
49107
|
`);
|
|
48952
49108
|
},
|
|
48953
49109
|
attach(reviewDir) {
|
|
48954
|
-
|
|
48955
|
-
logPath2 =
|
|
49110
|
+
mkdirSync37(reviewDir, { recursive: true });
|
|
49111
|
+
logPath2 = join104(reviewDir, LOG_FILE);
|
|
48956
49112
|
const lines = [
|
|
48957
49113
|
"",
|
|
48958
49114
|
`=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
|
|
@@ -49738,11 +49894,11 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
49738
49894
|
}
|
|
49739
49895
|
|
|
49740
49896
|
// src/commands/review/buildReviewPaths.ts
|
|
49741
|
-
import { homedir as
|
|
49742
|
-
import { basename as basename27, join as
|
|
49897
|
+
import { homedir as homedir28 } from "os";
|
|
49898
|
+
import { basename as basename27, join as join105 } from "path";
|
|
49743
49899
|
function buildReviewPaths(repoRoot3, key) {
|
|
49744
|
-
const reviewDir =
|
|
49745
|
-
|
|
49900
|
+
const reviewDir = join105(
|
|
49901
|
+
homedir28(),
|
|
49746
49902
|
".assist",
|
|
49747
49903
|
"reviews",
|
|
49748
49904
|
basename27(repoRoot3),
|
|
@@ -49750,10 +49906,10 @@ function buildReviewPaths(repoRoot3, key) {
|
|
|
49750
49906
|
);
|
|
49751
49907
|
return {
|
|
49752
49908
|
reviewDir,
|
|
49753
|
-
requestPath:
|
|
49754
|
-
claudePath:
|
|
49755
|
-
codexPath:
|
|
49756
|
-
synthesisPath:
|
|
49909
|
+
requestPath: join105(reviewDir, "request.md"),
|
|
49910
|
+
claudePath: join105(reviewDir, "claude.md"),
|
|
49911
|
+
codexPath: join105(reviewDir, "codex.md"),
|
|
49912
|
+
synthesisPath: join105(reviewDir, "synthesis.md")
|
|
49757
49913
|
};
|
|
49758
49914
|
}
|
|
49759
49915
|
|
|
@@ -49791,14 +49947,14 @@ function fetchExistingComments() {
|
|
|
49791
49947
|
}
|
|
49792
49948
|
|
|
49793
49949
|
// src/commands/review/prepareReviewDir.ts
|
|
49794
|
-
import { existsSync as existsSync80, mkdirSync as
|
|
49950
|
+
import { existsSync as existsSync80, mkdirSync as mkdirSync38, unlinkSync as unlinkSync19, writeFileSync as writeFileSync50 } from "fs";
|
|
49795
49951
|
function clearReviewFiles(paths) {
|
|
49796
49952
|
for (const path128 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
49797
49953
|
if (existsSync80(path128)) unlinkSync19(path128);
|
|
49798
49954
|
}
|
|
49799
49955
|
}
|
|
49800
49956
|
function prepareReviewDir(paths, requestBody, force) {
|
|
49801
|
-
|
|
49957
|
+
mkdirSync38(paths.reviewDir, { recursive: true });
|
|
49802
49958
|
if (force) clearReviewFiles(paths);
|
|
49803
49959
|
writeFileSync50(paths.requestPath, requestBody);
|
|
49804
49960
|
}
|
|
@@ -51400,7 +51556,7 @@ function parseReply(line) {
|
|
|
51400
51556
|
}
|
|
51401
51557
|
|
|
51402
51558
|
// src/commands/show/refuseSessionFiles.ts
|
|
51403
|
-
import { homedir as
|
|
51559
|
+
import { homedir as homedir29 } from "os";
|
|
51404
51560
|
|
|
51405
51561
|
// src/commands/show/findShownSessionFiles.ts
|
|
51406
51562
|
var NOT_AFTER = String.raw`(?![\w\-/]|\.\w)`;
|
|
@@ -51460,7 +51616,7 @@ async function refuseSessionFiles(body) {
|
|
|
51460
51616
|
harness
|
|
51461
51617
|
});
|
|
51462
51618
|
const shown = findShownSessionFiles(body, sessionWrittenPaths(events), {
|
|
51463
|
-
home:
|
|
51619
|
+
home: homedir29(),
|
|
51464
51620
|
cwd: process.cwd()
|
|
51465
51621
|
});
|
|
51466
51622
|
if (shown.length === 0) return;
|
|
@@ -53028,20 +53184,20 @@ async function configure() {
|
|
|
53028
53184
|
|
|
53029
53185
|
// src/commands/transcript/list.ts
|
|
53030
53186
|
import { existsSync as existsSync93, readdirSync as readdirSync25, statSync as statSync17 } from "fs";
|
|
53031
|
-
import { join as
|
|
53187
|
+
import { join as join122 } from "path";
|
|
53032
53188
|
function list5() {
|
|
53033
53189
|
const { vttDir } = getTranscriptConfig();
|
|
53034
53190
|
if (!existsSync93(vttDir)) return;
|
|
53035
53191
|
for (const entry of readdirSync25(vttDir)) {
|
|
53036
53192
|
if (!entry.endsWith(".vtt")) continue;
|
|
53037
|
-
if (statSync17(
|
|
53193
|
+
if (statSync17(join122(vttDir, entry)).isDirectory()) continue;
|
|
53038
53194
|
console.log(entry);
|
|
53039
53195
|
}
|
|
53040
53196
|
}
|
|
53041
53197
|
|
|
53042
53198
|
// src/commands/transcript/move.ts
|
|
53043
|
-
import { existsSync as existsSync94, mkdirSync as
|
|
53044
|
-
import { basename as basename31, join as
|
|
53199
|
+
import { existsSync as existsSync94, mkdirSync as mkdirSync41, renameSync as renameSync5, writeFileSync as writeFileSync56 } from "fs";
|
|
53200
|
+
import { basename as basename31, join as join123 } from "path";
|
|
53045
53201
|
|
|
53046
53202
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
53047
53203
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -53051,9 +53207,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
53051
53207
|
// src/commands/transcript/move.ts
|
|
53052
53208
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
53053
53209
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
53054
|
-
const processedDir =
|
|
53055
|
-
|
|
53056
|
-
renameSync5(sourcePath,
|
|
53210
|
+
const processedDir = join123(vttDir, "processed");
|
|
53211
|
+
mkdirSync41(processedDir, { recursive: true });
|
|
53212
|
+
renameSync5(sourcePath, join123(processedDir, filename));
|
|
53057
53213
|
}
|
|
53058
53214
|
function move(file, options2) {
|
|
53059
53215
|
const { date, client } = options2;
|
|
@@ -53063,19 +53219,19 @@ function move(file, options2) {
|
|
|
53063
53219
|
}
|
|
53064
53220
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
53065
53221
|
const filename = basename31(file);
|
|
53066
|
-
const sourcePath =
|
|
53222
|
+
const sourcePath = join123(vttDir, filename);
|
|
53067
53223
|
if (!existsSync94(sourcePath)) {
|
|
53068
53224
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
53069
53225
|
process.exit(1);
|
|
53070
53226
|
}
|
|
53071
53227
|
const base = basename31(filename, ".vtt").replace(/ Transcription$/, "");
|
|
53072
53228
|
const outputName = `${date} ${base}.md`;
|
|
53073
|
-
const formattedDir =
|
|
53074
|
-
|
|
53075
|
-
const formattedPath =
|
|
53229
|
+
const formattedDir = join123(transcriptsDir, client);
|
|
53230
|
+
mkdirSync41(formattedDir, { recursive: true });
|
|
53231
|
+
const formattedPath = join123(formattedDir, outputName);
|
|
53076
53232
|
writeFileSync56(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
53077
53233
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
53078
|
-
const summaryPath =
|
|
53234
|
+
const summaryPath = join123(summaryDir, client, outputName);
|
|
53079
53235
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
53080
53236
|
console.log(`Summary target: ${summaryPath}`);
|
|
53081
53237
|
}
|
|
@@ -55007,7 +55163,7 @@ function registerWatch(program) {
|
|
|
55007
55163
|
// src/commands/roam/postRoamActivity.ts
|
|
55008
55164
|
import { execFileSync as execFileSync34 } from "child_process";
|
|
55009
55165
|
import { readdirSync as readdirSync27, readFileSync as readFileSync87, statSync as statSync18 } from "fs";
|
|
55010
|
-
import { join as
|
|
55166
|
+
import { join as join124 } from "path";
|
|
55011
55167
|
function findPortFile(roamDir) {
|
|
55012
55168
|
let entries2;
|
|
55013
55169
|
try {
|
|
@@ -55016,7 +55172,7 @@ function findPortFile(roamDir) {
|
|
|
55016
55172
|
return void 0;
|
|
55017
55173
|
}
|
|
55018
55174
|
const candidates = entries2.filter((name2) => /^roam-local-api(-[^.]+)?\.port$/.test(name2)).map((name2) => {
|
|
55019
|
-
const path128 =
|
|
55175
|
+
const path128 = join124(roamDir, name2);
|
|
55020
55176
|
try {
|
|
55021
55177
|
return { path: path128, mtimeMs: statSync18(path128).mtimeMs };
|
|
55022
55178
|
} catch {
|
|
@@ -55033,7 +55189,7 @@ var PID_BY_APP = {
|
|
|
55033
55189
|
function postRoamActivity(app, event) {
|
|
55034
55190
|
const appData = process.env.APPDATA;
|
|
55035
55191
|
if (!appData) return;
|
|
55036
|
-
const portFile = findPortFile(
|
|
55192
|
+
const portFile = findPortFile(join124(appData, "Roam"));
|
|
55037
55193
|
if (!portFile) return;
|
|
55038
55194
|
let port;
|
|
55039
55195
|
try {
|
|
@@ -55216,7 +55372,7 @@ function link2() {
|
|
|
55216
55372
|
}
|
|
55217
55373
|
|
|
55218
55374
|
// src/commands/run/add.ts
|
|
55219
|
-
import { mkdirSync as
|
|
55375
|
+
import { mkdirSync as mkdirSync42, writeFileSync as writeFileSync61 } from "fs";
|
|
55220
55376
|
import { dirname as dirname51 } from "path";
|
|
55221
55377
|
|
|
55222
55378
|
// src/commands/run/editRepoRunList.ts
|
|
@@ -55392,11 +55548,11 @@ function requireParsedArgs() {
|
|
|
55392
55548
|
}
|
|
55393
55549
|
|
|
55394
55550
|
// src/commands/run/runCommandFilePath.ts
|
|
55395
|
-
import { join as
|
|
55551
|
+
import { join as join125 } from "path";
|
|
55396
55552
|
function runCommandFilePath(name2) {
|
|
55397
55553
|
const segments = name2.split(":");
|
|
55398
55554
|
const file = `${segments.pop()}.md`;
|
|
55399
|
-
return
|
|
55555
|
+
return join125(".claude", "commands", ...segments, file);
|
|
55400
55556
|
}
|
|
55401
55557
|
|
|
55402
55558
|
// src/commands/run/add.ts
|
|
@@ -55413,7 +55569,7 @@ function saveProjectRunConfig(entry) {
|
|
|
55413
55569
|
}
|
|
55414
55570
|
function createCommandFile(name2) {
|
|
55415
55571
|
const filePath = runCommandFilePath(name2);
|
|
55416
|
-
|
|
55572
|
+
mkdirSync42(dirname51(filePath), { recursive: true });
|
|
55417
55573
|
const content = `---
|
|
55418
55574
|
description: Run ${name2}
|
|
55419
55575
|
---
|
|
@@ -55541,7 +55697,7 @@ function registerRunAdd(runCommand) {
|
|
|
55541
55697
|
|
|
55542
55698
|
// src/commands/run/remove.ts
|
|
55543
55699
|
import { existsSync as existsSync100, readdirSync as readdirSync28, rmdirSync, unlinkSync as unlinkSync20 } from "fs";
|
|
55544
|
-
import { dirname as dirname52, join as
|
|
55700
|
+
import { dirname as dirname52, join as join126 } from "path";
|
|
55545
55701
|
|
|
55546
55702
|
// src/commands/run/removeRepoRunConfig.ts
|
|
55547
55703
|
function isNamed(entry, name2) {
|
|
@@ -55559,7 +55715,7 @@ function removeRepoRunConfig(name2, repoName, cwd = process.cwd()) {
|
|
|
55559
55715
|
|
|
55560
55716
|
// src/commands/run/remove.ts
|
|
55561
55717
|
function removeEmptyNamespaceDirs(filePath) {
|
|
55562
|
-
const root2 =
|
|
55718
|
+
const root2 = join126(".claude", "commands");
|
|
55563
55719
|
for (let dir = dirname52(filePath); dir !== root2; dir = dirname52(dir)) {
|
|
55564
55720
|
if (!existsSync100(dir) || readdirSync28(dir).length > 0) return;
|
|
55565
55721
|
rmdirSync(dir);
|
|
@@ -55567,7 +55723,7 @@ function removeEmptyNamespaceDirs(filePath) {
|
|
|
55567
55723
|
}
|
|
55568
55724
|
function deleteCommandFile(name2) {
|
|
55569
55725
|
const filePath = runCommandFilePath(name2);
|
|
55570
|
-
const legacyPath =
|
|
55726
|
+
const legacyPath = join126(".claude", "commands", `${name2}.md`);
|
|
55571
55727
|
for (const path128 of /* @__PURE__ */ new Set([filePath, legacyPath])) {
|
|
55572
55728
|
if (existsSync100(path128)) {
|
|
55573
55729
|
unlinkSync20(path128);
|
|
@@ -55851,7 +56007,7 @@ function requestDrain(socket, lines) {
|
|
|
55851
56007
|
}
|
|
55852
56008
|
|
|
55853
56009
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
55854
|
-
import { mkdirSync as
|
|
56010
|
+
import { mkdirSync as mkdirSync46 } from "fs";
|
|
55855
56011
|
|
|
55856
56012
|
// src/commands/sessions/daemon/broadcast.ts
|
|
55857
56013
|
function sendTo(client, msg) {
|
|
@@ -56302,11 +56458,15 @@ function toSessionViewInfo({
|
|
|
56302
56458
|
activeViewerNode,
|
|
56303
56459
|
transfer,
|
|
56304
56460
|
pty: pty2,
|
|
56305
|
-
sdkActivity
|
|
56461
|
+
sdkActivity,
|
|
56462
|
+
sdkQueued,
|
|
56463
|
+
sdkInterrupting
|
|
56306
56464
|
}) {
|
|
56307
56465
|
return {
|
|
56308
56466
|
sdk: pty2?.sdk ? true : void 0,
|
|
56309
56467
|
sdkActivity,
|
|
56468
|
+
sdkQueued,
|
|
56469
|
+
sdkInterrupting,
|
|
56310
56470
|
transfer,
|
|
56311
56471
|
lastUserMessage,
|
|
56312
56472
|
lastAssistantMessage,
|
|
@@ -56414,7 +56574,7 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
|
|
|
56414
56574
|
|
|
56415
56575
|
// src/commands/sessions/daemon/findServerParents.ts
|
|
56416
56576
|
import { existsSync as existsSync102 } from "fs";
|
|
56417
|
-
import { join as
|
|
56577
|
+
import { join as join127, resolve as resolve33 } from "path";
|
|
56418
56578
|
function isLive(session) {
|
|
56419
56579
|
return !!session.pty && session.status !== "done" && session.status !== "error";
|
|
56420
56580
|
}
|
|
@@ -56423,7 +56583,7 @@ function isLiveAgent(session) {
|
|
|
56423
56583
|
}
|
|
56424
56584
|
function serverRunDirs(sessions, file) {
|
|
56425
56585
|
return new Set(
|
|
56426
|
-
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve33(s.cwd)).filter((dir) => existsSync102(
|
|
56586
|
+
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve33(s.cwd)).filter((dir) => existsSync102(join127(dir, file)))
|
|
56427
56587
|
);
|
|
56428
56588
|
}
|
|
56429
56589
|
function findServerParents(sessions, file) {
|
|
@@ -56634,6 +56794,11 @@ var SUBMIT = "\r";
|
|
|
56634
56794
|
function bracketedPaste(text18) {
|
|
56635
56795
|
return `${PASTE_START}${text18.replace(/\r?\n/g, SUBMIT)}${PASTE_END}`;
|
|
56636
56796
|
}
|
|
56797
|
+
function unwrapBracketedPaste(data) {
|
|
56798
|
+
if (!data.startsWith(PASTE_START) || !data.endsWith(PASTE_END))
|
|
56799
|
+
return void 0;
|
|
56800
|
+
return data.slice(PASTE_START.length, data.length - PASTE_END.length).replaceAll(SUBMIT, "\n");
|
|
56801
|
+
}
|
|
56637
56802
|
|
|
56638
56803
|
// src/commands/sessions/shared/pasteAndSubmit.ts
|
|
56639
56804
|
var SUBMIT_DELAY_MS = 150;
|
|
@@ -56785,11 +56950,26 @@ function watchPromptSubmit(session, data, onStatusChange) {
|
|
|
56785
56950
|
watchSubmitOutcome(session, onStatusChange);
|
|
56786
56951
|
}
|
|
56787
56952
|
|
|
56953
|
+
// src/commands/sessions/daemon/writeToSdkSession.ts
|
|
56954
|
+
function writeToSdkSession(session, data) {
|
|
56955
|
+
const text18 = unwrapBracketedPaste(data);
|
|
56956
|
+
if (text18 !== void 0) {
|
|
56957
|
+
daemonLog(`session ${session.id} sdk message received from input`);
|
|
56958
|
+
session.pty?.sdk?.send(text18);
|
|
56959
|
+
return;
|
|
56960
|
+
}
|
|
56961
|
+
if (data === SUBMIT) {
|
|
56962
|
+
daemonLog(`session ${session.id} sdk submit ignored: paste already sent`);
|
|
56963
|
+
return;
|
|
56964
|
+
}
|
|
56965
|
+
skipsTerminalPath(session, "input");
|
|
56966
|
+
}
|
|
56967
|
+
|
|
56788
56968
|
// src/commands/sessions/daemon/writeToSession.ts
|
|
56789
56969
|
function writeToSession(sessions, id, data, onStatusChange, viewer = {}) {
|
|
56790
56970
|
const s = sessions.get(id);
|
|
56791
56971
|
if (!s || s.status === "done") return;
|
|
56792
|
-
if (
|
|
56972
|
+
if (isSdkSession(s)) return writeToSdkSession(s, data);
|
|
56793
56973
|
const response = isTerminalResponse(data);
|
|
56794
56974
|
if (dropsInactiveViewerResponse(s, response, viewer)) return;
|
|
56795
56975
|
s.pty?.write(data);
|
|
@@ -57252,12 +57432,12 @@ function trimWatcherLog(cwd) {
|
|
|
57252
57432
|
}
|
|
57253
57433
|
|
|
57254
57434
|
// src/commands/sessions/daemon/worktree/appendWatcherLog.ts
|
|
57255
|
-
import { appendFileSync as appendFileSync4, mkdirSync as
|
|
57435
|
+
import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync43 } from "fs";
|
|
57256
57436
|
import { dirname as dirname53 } from "path";
|
|
57257
57437
|
function appendWatcherLog(cwd, data) {
|
|
57258
57438
|
try {
|
|
57259
57439
|
const path128 = watcherLogPath(cwd);
|
|
57260
|
-
|
|
57440
|
+
mkdirSync43(dirname53(path128), { recursive: true });
|
|
57261
57441
|
appendFileSync4(path128, data);
|
|
57262
57442
|
} catch {
|
|
57263
57443
|
}
|
|
@@ -57432,9 +57612,9 @@ import { existsSync as existsSync105 } from "fs";
|
|
|
57432
57612
|
|
|
57433
57613
|
// src/commands/sessions/daemon/worktree/holdsNoCheckout.ts
|
|
57434
57614
|
import { existsSync as existsSync104 } from "fs";
|
|
57435
|
-
import { join as
|
|
57615
|
+
import { join as join129 } from "path";
|
|
57436
57616
|
function holdsNoCheckout(path128) {
|
|
57437
|
-
return existsSync104(path128) && !existsSync104(
|
|
57617
|
+
return existsSync104(path128) && !existsSync104(join129(path128, ".git"));
|
|
57438
57618
|
}
|
|
57439
57619
|
|
|
57440
57620
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
@@ -57777,12 +57957,12 @@ import { basename as basename34 } from "path";
|
|
|
57777
57957
|
|
|
57778
57958
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
57779
57959
|
import { existsSync as existsSync106 } from "fs";
|
|
57780
|
-
import { join as
|
|
57960
|
+
import { join as join131 } from "path";
|
|
57781
57961
|
|
|
57782
57962
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
57783
57963
|
import { statSync as statSync19 } from "fs";
|
|
57784
57964
|
import { rm as rm3 } from "fs/promises";
|
|
57785
|
-
import { join as
|
|
57965
|
+
import { join as join130 } from "path";
|
|
57786
57966
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
57787
57967
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
57788
57968
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -57811,7 +57991,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
57811
57991
|
return { removed: true };
|
|
57812
57992
|
}
|
|
57813
57993
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
57814
|
-
return statSync19(
|
|
57994
|
+
return statSync19(join130(worktreePath, ".git"), {
|
|
57815
57995
|
throwIfNoEntry: false
|
|
57816
57996
|
})?.isDirectory() === true;
|
|
57817
57997
|
}
|
|
@@ -57852,7 +58032,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
57852
58032
|
);
|
|
57853
58033
|
}
|
|
57854
58034
|
function strandedReason(worktreePath, cause) {
|
|
57855
|
-
if (!existsSync106(
|
|
58035
|
+
if (!existsSync106(join131(worktreePath, ".git")))
|
|
57856
58036
|
return "its .git link is already gone";
|
|
57857
58037
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
57858
58038
|
return "git no longer recognises it as a working tree";
|
|
@@ -59096,7 +59276,7 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
|
|
|
59096
59276
|
}
|
|
59097
59277
|
|
|
59098
59278
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
59099
|
-
import { existsSync as existsSync110, mkdirSync as
|
|
59279
|
+
import { existsSync as existsSync110, mkdirSync as mkdirSync44, watch as watch2 } from "fs";
|
|
59100
59280
|
import { dirname as dirname55 } from "path";
|
|
59101
59281
|
|
|
59102
59282
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
@@ -59283,7 +59463,7 @@ function watchActivity(session, notify2, onConversation) {
|
|
|
59283
59463
|
const path128 = activityPath(session.id);
|
|
59284
59464
|
const dir = dirname55(path128);
|
|
59285
59465
|
try {
|
|
59286
|
-
|
|
59466
|
+
mkdirSync44(dir, { recursive: true });
|
|
59287
59467
|
} catch {
|
|
59288
59468
|
return;
|
|
59289
59469
|
}
|
|
@@ -59363,14 +59543,25 @@ function handlePtyExit(session, exitCode, onStatusChange) {
|
|
|
59363
59543
|
}
|
|
59364
59544
|
|
|
59365
59545
|
// src/commands/sessions/daemon/wireSdkEvents.ts
|
|
59546
|
+
function applyViewEvent(session, event) {
|
|
59547
|
+
if (event.kind === "activity") {
|
|
59548
|
+
session.sdkActivity = event.text ?? void 0;
|
|
59549
|
+
daemonLog(`session ${session.id} sdk activity: ${event.text ?? "cleared"}`);
|
|
59550
|
+
} else if (event.kind === "queued") {
|
|
59551
|
+
session.sdkQueued = event.texts.length ? event.texts : void 0;
|
|
59552
|
+
daemonLog(`session ${session.id} sdk queued: ${event.texts.length}`);
|
|
59553
|
+
} else {
|
|
59554
|
+
session.sdkInterrupting = event.pending || void 0;
|
|
59555
|
+
daemonLog(
|
|
59556
|
+
`session ${session.id} sdk interrupt ${event.pending ? "pending" : "landed"}`
|
|
59557
|
+
);
|
|
59558
|
+
}
|
|
59559
|
+
}
|
|
59366
59560
|
function wireSdkEvents(session, onStatusChange, notify2) {
|
|
59367
59561
|
session.pty?.sdk?.onEvent((event) => {
|
|
59368
59562
|
if (session.status === "done" || session.status === "stopped") return;
|
|
59369
|
-
if (event.kind
|
|
59370
|
-
session
|
|
59371
|
-
daemonLog(
|
|
59372
|
-
`session ${session.id} sdk activity: ${event.text ?? "cleared"}`
|
|
59373
|
-
);
|
|
59563
|
+
if (event.kind !== "status") {
|
|
59564
|
+
applyViewEvent(session, event);
|
|
59374
59565
|
notify2?.();
|
|
59375
59566
|
return;
|
|
59376
59567
|
}
|
|
@@ -59410,10 +59601,10 @@ function reportSilentFailure(session, clients) {
|
|
|
59410
59601
|
import { watch as watch3 } from "fs";
|
|
59411
59602
|
|
|
59412
59603
|
// src/commands/sessions/daemon/ensureProjectDirExists.ts
|
|
59413
|
-
import { mkdirSync as
|
|
59604
|
+
import { mkdirSync as mkdirSync45 } from "fs";
|
|
59414
59605
|
function ensureProjectDirExists(dir, sessionId2) {
|
|
59415
59606
|
try {
|
|
59416
|
-
|
|
59607
|
+
mkdirSync45(dir, { recursive: true });
|
|
59417
59608
|
return true;
|
|
59418
59609
|
} catch (error) {
|
|
59419
59610
|
daemonLog(
|
|
@@ -59539,7 +59730,7 @@ function isOpeningReference(text18) {
|
|
|
59539
59730
|
return !args || isBareReferencePrompt(args);
|
|
59540
59731
|
}
|
|
59541
59732
|
function eventText(event) {
|
|
59542
|
-
return
|
|
59733
|
+
return "text" in event ? event.text.trim() : "";
|
|
59543
59734
|
}
|
|
59544
59735
|
function contextAfterReference(events) {
|
|
59545
59736
|
const parts2 = [];
|
|
@@ -61462,7 +61653,7 @@ import { existsSync as existsSync112 } from "fs";
|
|
|
61462
61653
|
|
|
61463
61654
|
// src/commands/sessions/daemon/worktree/leftoverContents.ts
|
|
61464
61655
|
import { lstatSync, readdirSync as readdirSync30 } from "fs";
|
|
61465
|
-
import { join as
|
|
61656
|
+
import { join as join132 } from "path";
|
|
61466
61657
|
function leftoverContents(path128) {
|
|
61467
61658
|
const contents = { holdsFiles: false, foreignOwned: false };
|
|
61468
61659
|
walk2(path128, contents, process.getuid?.());
|
|
@@ -61484,7 +61675,7 @@ function walk2(path128, contents, uid) {
|
|
|
61484
61675
|
contents.holdsFiles = true;
|
|
61485
61676
|
return;
|
|
61486
61677
|
}
|
|
61487
|
-
for (const entry of entries2) walk2(
|
|
61678
|
+
for (const entry of entries2) walk2(join132(path128, entry), contents, uid);
|
|
61488
61679
|
}
|
|
61489
61680
|
|
|
61490
61681
|
// src/commands/sessions/daemon/worktree/recheckReapedWorktrees.ts
|
|
@@ -61522,7 +61713,7 @@ function reviewFirst(path128, contents) {
|
|
|
61522
61713
|
}
|
|
61523
61714
|
|
|
61524
61715
|
// src/commands/sessions/daemon/worktree/reportLeftovers.ts
|
|
61525
|
-
import { homedir as
|
|
61716
|
+
import { homedir as homedir32 } from "os";
|
|
61526
61717
|
|
|
61527
61718
|
// src/commands/sessions/daemon/worktree/noticeContent.ts
|
|
61528
61719
|
function noticeContent(leftovers) {
|
|
@@ -61585,7 +61776,7 @@ function reportLeftovers(sessions, spawnNotice, leftovers, notify2) {
|
|
|
61585
61776
|
...content,
|
|
61586
61777
|
commandType: "assist",
|
|
61587
61778
|
pty: null,
|
|
61588
|
-
cwd:
|
|
61779
|
+
cwd: homedir32(),
|
|
61589
61780
|
leftoverNotice: true
|
|
61590
61781
|
}));
|
|
61591
61782
|
daemonLog(`leftover notice ${id} created: ${leftovers.length} leftover(s)`);
|
|
@@ -63366,6 +63557,21 @@ var handleHelloRequest = (client, m, d) => {
|
|
|
63366
63557
|
m.replayLocal(client);
|
|
63367
63558
|
};
|
|
63368
63559
|
|
|
63560
|
+
// src/commands/sessions/daemon/handleInterrupt.ts
|
|
63561
|
+
var handleInterrupt = routed((_client, m, d) => {
|
|
63562
|
+
const id = String(d.sessionId);
|
|
63563
|
+
const session = m.session(id);
|
|
63564
|
+
const sdk = session?.pty?.sdk;
|
|
63565
|
+
if (!sdk) {
|
|
63566
|
+
daemonLog(
|
|
63567
|
+
`interrupt ignored: session ${id} ${session ? "is not a Claude (SDK) session" : "was not found"}`
|
|
63568
|
+
);
|
|
63569
|
+
return;
|
|
63570
|
+
}
|
|
63571
|
+
daemonLog(`interrupt received: session ${id}`);
|
|
63572
|
+
sdk.interrupt();
|
|
63573
|
+
});
|
|
63574
|
+
|
|
63369
63575
|
// src/commands/sessions/daemon/handleWebLog.ts
|
|
63370
63576
|
var handleWebLog = (client, _m, d) => {
|
|
63371
63577
|
daemonLog(`web: ${String(d.message)}`);
|
|
@@ -64525,6 +64731,7 @@ var messageHandlers = {
|
|
|
64525
64731
|
dismiss: handleDismiss,
|
|
64526
64732
|
discard: routed((_client, m, d) => m.discardSession(d.sessionId)),
|
|
64527
64733
|
stop: routed((_client, m, d) => m.stopSession(d.sessionId)),
|
|
64734
|
+
interrupt: handleInterrupt,
|
|
64528
64735
|
transfer: handleTransfer,
|
|
64529
64736
|
"cancel-transfer": handleCancelTransfer,
|
|
64530
64737
|
...sessionSettingHandlers,
|
|
@@ -64704,7 +64911,7 @@ async function recoverFromAddrInUse(server, manager, checkAutoExit) {
|
|
|
64704
64911
|
|
|
64705
64912
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
64706
64913
|
async function runDaemon() {
|
|
64707
|
-
|
|
64914
|
+
mkdirSync46(daemonPaths.dir, { recursive: true });
|
|
64708
64915
|
daemonLog(
|
|
64709
64916
|
`starting (reason: ${process.env.ASSIST_DAEMON_SPAWN_REASON ?? "manual"})`
|
|
64710
64917
|
);
|