@staff0rd/assist 0.1133.3 → 0.1135.0
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/background.js +2 -2
- package/dist/commands/extension/extension/content.js +1 -1
- package/dist/commands/extension/extension/updates.json +2 -2
- package/dist/commands/sessions/web/bundle.js +547 -544
- package/dist/index.js +1157 -487
- package/package.json +2 -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.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -55,6 +55,7 @@ var package_default = {
|
|
|
55
55
|
url: "https://github.com/staff0rd/assist"
|
|
56
56
|
},
|
|
57
57
|
dependencies: {
|
|
58
|
+
"@anthropic-ai/claude-agent-sdk": "^0.3.322",
|
|
58
59
|
"@capacitor/app": "^8.1.2",
|
|
59
60
|
"@xterm/addon-fit": "^0.11.0",
|
|
60
61
|
"@xterm/addon-serialize": "^0.14.0",
|
|
@@ -556,6 +557,7 @@ var durationSchema = z.string().superRefine((value, ctx) => {
|
|
|
556
557
|
// src/shared/harnessKinds.ts
|
|
557
558
|
var harnessKinds = [
|
|
558
559
|
"claude",
|
|
560
|
+
"claude-sdk",
|
|
559
561
|
"codex",
|
|
560
562
|
"pi"
|
|
561
563
|
];
|
|
@@ -3990,9 +3992,9 @@ import { eq as eq7 } from "drizzle-orm";
|
|
|
3990
3992
|
|
|
3991
3993
|
// src/commands/backlog/searchItemIds.ts
|
|
3992
3994
|
import { and as and3, asc as asc5, eq as eq9, ilike, or, sql as sql16 } from "drizzle-orm";
|
|
3993
|
-
async function searchItemIds(orm,
|
|
3994
|
-
const pattern2 = `%${
|
|
3995
|
-
const numberPattern = `%${
|
|
3995
|
+
async function searchItemIds(orm, query2, origin) {
|
|
3996
|
+
const pattern2 = `%${query2}%`;
|
|
3997
|
+
const numberPattern = `%${query2.replace(/^#/, "")}%`;
|
|
3996
3998
|
const rows = await orm.selectDistinct({ id: items.id }).from(items).leftJoin(comments, eq9(comments.itemId, items.id)).leftJoin(planPhases, eq9(planPhases.itemId, items.id)).where(
|
|
3997
3999
|
and3(
|
|
3998
4000
|
origin ? eq9(items.origin, origin) : void 0,
|
|
@@ -4253,10 +4255,10 @@ async function loadBacklog(allRepos = false) {
|
|
|
4253
4255
|
const { orm } = await getReady();
|
|
4254
4256
|
return loadAllItems(orm, allRepos ? void 0 : getOrigin());
|
|
4255
4257
|
}
|
|
4256
|
-
async function searchBacklog(
|
|
4258
|
+
async function searchBacklog(query2) {
|
|
4257
4259
|
const { orm } = await getReady();
|
|
4258
4260
|
const origin = getOrigin();
|
|
4259
|
-
const ids = await searchItemIds(orm,
|
|
4261
|
+
const ids = await searchItemIds(orm, query2, origin);
|
|
4260
4262
|
const allItems = await loadAllItems(orm, origin);
|
|
4261
4263
|
return allItems.filter((item) => ids.includes(item.id));
|
|
4262
4264
|
}
|
|
@@ -4641,10 +4643,10 @@ async function loadBacklogSummaries(allRepos = false) {
|
|
|
4641
4643
|
const { orm } = await getReady();
|
|
4642
4644
|
return loadItemSummaries(orm, allRepos ? void 0 : getOrigin());
|
|
4643
4645
|
}
|
|
4644
|
-
async function searchBacklogSummaries(
|
|
4646
|
+
async function searchBacklogSummaries(query2) {
|
|
4645
4647
|
const { orm } = await getReady();
|
|
4646
4648
|
const origin = getOrigin();
|
|
4647
|
-
const ids = await searchItemIds(orm,
|
|
4649
|
+
const ids = await searchItemIds(orm, query2, origin);
|
|
4648
4650
|
const summaries = await loadItemSummaries(orm, origin);
|
|
4649
4651
|
return summaries.filter((item) => ids.includes(item.id));
|
|
4650
4652
|
}
|
|
@@ -4954,8 +4956,8 @@ function getConversationParam(req) {
|
|
|
4954
4956
|
import { execFile as execFile3 } from "child_process";
|
|
4955
4957
|
import { promisify as promisify3 } from "util";
|
|
4956
4958
|
var execFileAsync3 = promisify3(execFile3);
|
|
4957
|
-
async function execGit(cwd, args,
|
|
4958
|
-
const { maxBuffer, allowFailure } =
|
|
4959
|
+
async function execGit(cwd, args, opts2 = {}) {
|
|
4960
|
+
const { maxBuffer, allowFailure } = opts2;
|
|
4959
4961
|
const unquoted = [
|
|
4960
4962
|
"--no-optional-locks",
|
|
4961
4963
|
"-c",
|
|
@@ -5129,11 +5131,13 @@ async function commitPaths(cwd, sha) {
|
|
|
5129
5131
|
// src/shared/harnessAdapters/harnessLabel.ts
|
|
5130
5132
|
var HARNESS_LABELS = {
|
|
5131
5133
|
claude: "Claude",
|
|
5134
|
+
"claude-sdk": "Claude (SDK)",
|
|
5132
5135
|
codex: "Codex",
|
|
5133
5136
|
pi: "pi"
|
|
5134
5137
|
};
|
|
5135
5138
|
var HARNESS_PRODUCT_LABELS = {
|
|
5136
5139
|
claude: "Claude Code",
|
|
5140
|
+
"claude-sdk": "Claude Code",
|
|
5137
5141
|
codex: "Codex",
|
|
5138
5142
|
pi: "pi"
|
|
5139
5143
|
};
|
|
@@ -5311,6 +5315,24 @@ function shellEscape(s) {
|
|
|
5311
5315
|
return `'${s.replace(/'/g, String.raw`'\''`)}'`;
|
|
5312
5316
|
}
|
|
5313
5317
|
|
|
5318
|
+
// src/commands/sessions/daemon/sessionChildEnv.ts
|
|
5319
|
+
function sessionChildEnv(base, sessionId2, extraEnv) {
|
|
5320
|
+
const {
|
|
5321
|
+
CLAUDE_CODE_CHILD_SESSION: _childSession,
|
|
5322
|
+
CLAUDECODE: _claudeCode,
|
|
5323
|
+
...parentEnv
|
|
5324
|
+
} = base;
|
|
5325
|
+
return {
|
|
5326
|
+
...parentEnv,
|
|
5327
|
+
ASSIST_SESSION: "1",
|
|
5328
|
+
...sessionId2 && {
|
|
5329
|
+
ASSIST_SESSION_ID: sessionId2,
|
|
5330
|
+
ASSIST_ACTIVITY_ID: sessionId2
|
|
5331
|
+
},
|
|
5332
|
+
...extraEnv
|
|
5333
|
+
};
|
|
5334
|
+
}
|
|
5335
|
+
|
|
5314
5336
|
// src/commands/sessions/daemon/viewerSize.ts
|
|
5315
5337
|
import { readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "fs";
|
|
5316
5338
|
var DEFAULT_SIZE = { cols: 120, rows: 30 };
|
|
@@ -5356,24 +5378,11 @@ function spawnPty(args, cwd, sessionId2, extraEnv) {
|
|
|
5356
5378
|
refuseMissingCwd(cwd, sessionId2);
|
|
5357
5379
|
ensureSpawnHelperExecutable();
|
|
5358
5380
|
const command = resolvePtyCommand(args);
|
|
5359
|
-
const {
|
|
5360
|
-
CLAUDE_CODE_CHILD_SESSION: _childSession,
|
|
5361
|
-
CLAUDECODE: _claudeCode,
|
|
5362
|
-
...parentEnv
|
|
5363
|
-
} = process.env;
|
|
5364
5381
|
return pty.spawn(command.file, command.args, {
|
|
5365
5382
|
name: "xterm-256color",
|
|
5366
5383
|
...viewerSize(),
|
|
5367
5384
|
cwd: cwd ?? process.cwd(),
|
|
5368
|
-
env:
|
|
5369
|
-
...parentEnv,
|
|
5370
|
-
ASSIST_SESSION: "1",
|
|
5371
|
-
...sessionId2 && {
|
|
5372
|
-
ASSIST_SESSION_ID: sessionId2,
|
|
5373
|
-
ASSIST_ACTIVITY_ID: sessionId2
|
|
5374
|
-
},
|
|
5375
|
-
...extraEnv
|
|
5376
|
-
}
|
|
5385
|
+
env: sessionChildEnv(process.env, sessionId2, extraEnv)
|
|
5377
5386
|
});
|
|
5378
5387
|
}
|
|
5379
5388
|
function refuseMissingCwd(cwd, sessionId2) {
|
|
@@ -5385,20 +5394,20 @@ function refuseMissingCwd(cwd, sessionId2) {
|
|
|
5385
5394
|
}
|
|
5386
5395
|
|
|
5387
5396
|
// src/commands/sessions/daemon/spawnClaude.ts
|
|
5388
|
-
function spawnClaude(
|
|
5389
|
-
return spawnPty(buildArgs(
|
|
5397
|
+
function spawnClaude(opts2 = {}) {
|
|
5398
|
+
return spawnPty(buildArgs(opts2), opts2.cwd, opts2.sessionId);
|
|
5390
5399
|
}
|
|
5391
|
-
function buildArgs(
|
|
5400
|
+
function buildArgs(opts2) {
|
|
5392
5401
|
const base = ["claude", "--settings", ensureHooksSettings()];
|
|
5393
|
-
if (
|
|
5394
|
-
base.push("--append-system-prompt-file",
|
|
5395
|
-
if (
|
|
5396
|
-
if (
|
|
5397
|
-
if (
|
|
5398
|
-
return
|
|
5399
|
-
}
|
|
5400
|
-
if (
|
|
5401
|
-
if (
|
|
5402
|
+
if (opts2.appendSystemPromptFile)
|
|
5403
|
+
base.push("--append-system-prompt-file", opts2.appendSystemPromptFile);
|
|
5404
|
+
if (opts2.auto) base.push("--permission-mode", "auto");
|
|
5405
|
+
if (opts2.model) base.push("--model", opts2.model);
|
|
5406
|
+
if (opts2.resumeSessionId) {
|
|
5407
|
+
return opts2.prompt ? [...base, "--resume", opts2.resumeSessionId, opts2.prompt] : [...base, "--resume", opts2.resumeSessionId];
|
|
5408
|
+
}
|
|
5409
|
+
if (opts2.claudeSessionId) base.push("--session-id", opts2.claudeSessionId);
|
|
5410
|
+
if (opts2.prompt) return [...base, opts2.prompt];
|
|
5402
5411
|
return base;
|
|
5403
5412
|
}
|
|
5404
5413
|
|
|
@@ -6000,7 +6009,7 @@ function awaitsQuestionAnswer(entries2) {
|
|
|
6000
6009
|
|
|
6001
6010
|
// src/commands/sessions/shared/deriveTranscriptStatus.ts
|
|
6002
6011
|
var TURN_END_STOP_REASONS = /* @__PURE__ */ new Set(["end_turn", "stop_sequence"]);
|
|
6003
|
-
function deriveTranscriptStatus(entries2,
|
|
6012
|
+
function deriveTranscriptStatus(entries2, opts2 = {}) {
|
|
6004
6013
|
const events = normalizeTranscriptEvents(entries2);
|
|
6005
6014
|
const lastIdx = lastDecisiveIndex(events);
|
|
6006
6015
|
if (lastIdx === -1) return null;
|
|
@@ -6010,7 +6019,7 @@ function deriveTranscriptStatus(entries2, opts = {}) {
|
|
|
6010
6019
|
if (ev.kind === "toolResult" || ev.kind === "taskNotification") return null;
|
|
6011
6020
|
if (ev.stopReason != null && TURN_END_STOP_REASONS.has(ev.stopReason))
|
|
6012
6021
|
return "waiting";
|
|
6013
|
-
if (
|
|
6022
|
+
if (opts2.permissionActive) return "waiting";
|
|
6014
6023
|
if (hasPendingAskUserQuestion(events, lastIdx)) return "waiting";
|
|
6015
6024
|
return "running";
|
|
6016
6025
|
}
|
|
@@ -6197,6 +6206,8 @@ function userEvents(entry, at2) {
|
|
|
6197
6206
|
const events = [];
|
|
6198
6207
|
const text18 = renderUserPrompt(entry, Number.POSITIVE_INFINITY);
|
|
6199
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 });
|
|
6200
6211
|
for (const block of claudeContentBlocksOf(contentOf(entry))) {
|
|
6201
6212
|
if (block.type !== "tool_result" || block.is_error) continue;
|
|
6202
6213
|
const body = resultText(block.content).trim();
|
|
@@ -6317,17 +6328,17 @@ import * as path8 from "path";
|
|
|
6317
6328
|
import { execSync as execSync4 } from "child_process";
|
|
6318
6329
|
function checkCliAvailable(cli) {
|
|
6319
6330
|
const binary = cli.split(/\s+/)[0];
|
|
6320
|
-
const
|
|
6331
|
+
const opts2 = {
|
|
6321
6332
|
encoding: "utf8",
|
|
6322
6333
|
stdio: ["ignore", "pipe", "pipe"],
|
|
6323
6334
|
windowsHide: true
|
|
6324
6335
|
};
|
|
6325
6336
|
try {
|
|
6326
|
-
execSync4(`command -v ${binary}`,
|
|
6337
|
+
execSync4(`command -v ${binary}`, opts2);
|
|
6327
6338
|
return true;
|
|
6328
6339
|
} catch {
|
|
6329
6340
|
try {
|
|
6330
|
-
execSync4(`where ${binary}`,
|
|
6341
|
+
execSync4(`where ${binary}`, opts2);
|
|
6331
6342
|
return true;
|
|
6332
6343
|
} catch {
|
|
6333
6344
|
return false;
|
|
@@ -6336,18 +6347,20 @@ function checkCliAvailable(cli) {
|
|
|
6336
6347
|
}
|
|
6337
6348
|
|
|
6338
6349
|
// src/shared/harnesses.ts
|
|
6350
|
+
var claudeHarness = {
|
|
6351
|
+
kind: "claude",
|
|
6352
|
+
command: "claude",
|
|
6353
|
+
homeDir: path8.join(os3.homedir(), ".claude"),
|
|
6354
|
+
sync: {
|
|
6355
|
+
commandDest: (name2) => path8.join("skills", name2, "SKILL.md"),
|
|
6356
|
+
designPromptDest: "design-system-prompt.md",
|
|
6357
|
+
designSkillDest: (name2) => path8.join("skills", `${name2}.md`),
|
|
6358
|
+
nativeDesignSkills: false
|
|
6359
|
+
}
|
|
6360
|
+
};
|
|
6339
6361
|
var harnesses = {
|
|
6340
|
-
claude:
|
|
6341
|
-
|
|
6342
|
-
command: "claude",
|
|
6343
|
-
homeDir: path8.join(os3.homedir(), ".claude"),
|
|
6344
|
-
sync: {
|
|
6345
|
-
commandDest: (name2) => path8.join("skills", name2, "SKILL.md"),
|
|
6346
|
-
designPromptDest: "design-system-prompt.md",
|
|
6347
|
-
designSkillDest: (name2) => path8.join("skills", `${name2}.md`),
|
|
6348
|
-
nativeDesignSkills: false
|
|
6349
|
-
}
|
|
6350
|
-
},
|
|
6362
|
+
claude: claudeHarness,
|
|
6363
|
+
"claude-sdk": { ...claudeHarness, kind: "claude-sdk" },
|
|
6351
6364
|
codex: {
|
|
6352
6365
|
kind: "codex",
|
|
6353
6366
|
command: "codex",
|
|
@@ -6685,8 +6698,8 @@ function formatToolSummary(input) {
|
|
|
6685
6698
|
if (command) return truncate(command);
|
|
6686
6699
|
const url = getString(record3, "url");
|
|
6687
6700
|
if (url) return url;
|
|
6688
|
-
const
|
|
6689
|
-
if (
|
|
6701
|
+
const query2 = getString(record3, "query");
|
|
6702
|
+
if (query2) return truncate(query2);
|
|
6690
6703
|
const description = getString(record3, "description");
|
|
6691
6704
|
if (description) return truncate(description);
|
|
6692
6705
|
return "";
|
|
@@ -7078,32 +7091,58 @@ function detectHarness(kind) {
|
|
|
7078
7091
|
}
|
|
7079
7092
|
|
|
7080
7093
|
// src/shared/harnessAdapters/harnessCapabilityDeclarations.ts
|
|
7094
|
+
var claude = {
|
|
7095
|
+
"skills.native": supported,
|
|
7096
|
+
"launch.terminal": supported,
|
|
7097
|
+
"conversation.resume": supported,
|
|
7098
|
+
"conversation.relocate": supported,
|
|
7099
|
+
"conversation.id": supported,
|
|
7100
|
+
"conversation.preassignId": supported,
|
|
7101
|
+
"systemPrompt.append": supported,
|
|
7102
|
+
"tasks.notifyOnExit": supported,
|
|
7103
|
+
"artifacts.publish": supported,
|
|
7104
|
+
"transcript.read": supported,
|
|
7105
|
+
"oneShot.text": supported,
|
|
7106
|
+
"oneShot.structured": supported,
|
|
7107
|
+
"usage.rateLimits": supported,
|
|
7108
|
+
"tools.restrict": supported,
|
|
7109
|
+
"connector.gmail.read": supported,
|
|
7110
|
+
"connector.slack.read": supported,
|
|
7111
|
+
"intercept.command": supported,
|
|
7112
|
+
"intercept.fileRead": supported,
|
|
7113
|
+
"intercept.fileWrite": supported,
|
|
7114
|
+
"intercept.editDiff": supported,
|
|
7115
|
+
"intercept.question": supported,
|
|
7116
|
+
"slashCommands.suggest": supported
|
|
7117
|
+
};
|
|
7081
7118
|
var harnessCapabilityDeclarations = {
|
|
7082
|
-
claude
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
"
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
"
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
"
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
"
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7119
|
+
claude,
|
|
7120
|
+
"claude-sdk": {
|
|
7121
|
+
...claude,
|
|
7122
|
+
"launch.terminal": unsupported(
|
|
7123
|
+
"Claude (SDK) sessions have no terminal, and these workflows start an assist command that opens the Claude CLI's terminal UI",
|
|
7124
|
+
"run the workflow with Claude",
|
|
7125
|
+
"a1560"
|
|
7126
|
+
),
|
|
7127
|
+
"conversation.resume": unsupported(
|
|
7128
|
+
"Claude (SDK) sessions do not resume their conversation yet",
|
|
7129
|
+
"a daemon restart starts a fresh conversation; pick Claude to keep the conversation across restarts",
|
|
7130
|
+
"a1560"
|
|
7131
|
+
),
|
|
7132
|
+
"conversation.relocate": unsupported(
|
|
7133
|
+
"Claude (SDK) sessions do not resume their conversation yet, so it cannot continue in a replacement worktree",
|
|
7134
|
+
"start a fresh session in the replacement worktree; pick Claude to keep the conversation",
|
|
7135
|
+
"a1560"
|
|
7136
|
+
),
|
|
7137
|
+
"usage.rateLimits": unsupported(
|
|
7138
|
+
"assist does not yet record usage and rate-limit events from Claude (SDK) sessions",
|
|
7139
|
+
"Claude (SDK) usage is not shown in the status bar; terminal Claude usage still is",
|
|
7140
|
+
"a1560"
|
|
7141
|
+
)
|
|
7104
7142
|
},
|
|
7105
7143
|
codex: {
|
|
7106
7144
|
"skills.native": supported,
|
|
7145
|
+
"launch.terminal": supported,
|
|
7107
7146
|
"conversation.resume": supported,
|
|
7108
7147
|
"conversation.relocate": supported,
|
|
7109
7148
|
"conversation.id": supported,
|
|
@@ -7162,6 +7201,7 @@ var harnessCapabilityDeclarations = {
|
|
|
7162
7201
|
},
|
|
7163
7202
|
pi: {
|
|
7164
7203
|
"skills.native": supported,
|
|
7204
|
+
"launch.terminal": supported,
|
|
7165
7205
|
"conversation.resume": unsupported(
|
|
7166
7206
|
"pi sessions cannot be resumed yet",
|
|
7167
7207
|
"restart starts a fresh pi conversation; pick Claude or Codex to keep the conversation across restarts",
|
|
@@ -7308,6 +7348,479 @@ var claudeAdapter = {
|
|
|
7308
7348
|
activityIdentity: (conversationId) => ({ claudeSessionId: conversationId })
|
|
7309
7349
|
};
|
|
7310
7350
|
|
|
7351
|
+
// src/commands/sessions/daemon/sdk/createSdkInput.ts
|
|
7352
|
+
function userMessage(text18) {
|
|
7353
|
+
return {
|
|
7354
|
+
type: "user",
|
|
7355
|
+
message: { role: "user", content: text18 },
|
|
7356
|
+
parent_tool_use_id: null
|
|
7357
|
+
};
|
|
7358
|
+
}
|
|
7359
|
+
function createSdkInput() {
|
|
7360
|
+
const queue = [];
|
|
7361
|
+
let wake2;
|
|
7362
|
+
let closed = false;
|
|
7363
|
+
const notify2 = () => {
|
|
7364
|
+
wake2?.();
|
|
7365
|
+
wake2 = void 0;
|
|
7366
|
+
};
|
|
7367
|
+
async function* messages2() {
|
|
7368
|
+
while (true) {
|
|
7369
|
+
const next3 = queue.shift();
|
|
7370
|
+
if (next3) {
|
|
7371
|
+
yield next3;
|
|
7372
|
+
continue;
|
|
7373
|
+
}
|
|
7374
|
+
if (closed) return;
|
|
7375
|
+
await new Promise((resolve36) => {
|
|
7376
|
+
wake2 = resolve36;
|
|
7377
|
+
});
|
|
7378
|
+
}
|
|
7379
|
+
}
|
|
7380
|
+
return {
|
|
7381
|
+
messages: messages2(),
|
|
7382
|
+
push: (text18) => {
|
|
7383
|
+
queue.push(userMessage(text18));
|
|
7384
|
+
notify2();
|
|
7385
|
+
},
|
|
7386
|
+
close: () => {
|
|
7387
|
+
closed = true;
|
|
7388
|
+
notify2();
|
|
7389
|
+
}
|
|
7390
|
+
};
|
|
7391
|
+
}
|
|
7392
|
+
|
|
7393
|
+
// src/commands/sessions/daemon/sdk/killSdkChild.ts
|
|
7394
|
+
function killSdkChild(child2) {
|
|
7395
|
+
if (!child2?.pid || child2.exitCode !== null) return;
|
|
7396
|
+
try {
|
|
7397
|
+
if (process.platform === "win32") child2.kill();
|
|
7398
|
+
else process.kill(-child2.pid, "SIGTERM");
|
|
7399
|
+
} catch {
|
|
7400
|
+
child2.kill();
|
|
7401
|
+
}
|
|
7402
|
+
}
|
|
7403
|
+
|
|
7404
|
+
// src/commands/sessions/daemon/sdk/sdkTerminalStub.ts
|
|
7405
|
+
var noopDisposable = { dispose: () => {
|
|
7406
|
+
} };
|
|
7407
|
+
function sdkTerminalStub(label) {
|
|
7408
|
+
const skip3 = (path128) => () => daemonLog(`${label} ${path128} skipped: Claude (SDK) session has no terminal`);
|
|
7409
|
+
return {
|
|
7410
|
+
cols: 0,
|
|
7411
|
+
rows: 0,
|
|
7412
|
+
write: skip3("input"),
|
|
7413
|
+
resize: skip3("resize"),
|
|
7414
|
+
onData: () => noopDisposable
|
|
7415
|
+
};
|
|
7416
|
+
}
|
|
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
|
+
|
|
7439
|
+
// src/commands/sessions/daemon/sdk/createSdkSessionProcess.ts
|
|
7440
|
+
function createSdkSessionProcess(sessionId2, abort2) {
|
|
7441
|
+
const label = `session ${sessionId2 ?? "?"}`;
|
|
7442
|
+
const sdk = sdkSessionHandle(label);
|
|
7443
|
+
const exitListeners = [];
|
|
7444
|
+
let child2;
|
|
7445
|
+
let exited = false;
|
|
7446
|
+
const sessionProcess = {
|
|
7447
|
+
get pid() {
|
|
7448
|
+
return child2?.pid ?? 0;
|
|
7449
|
+
},
|
|
7450
|
+
...sdkTerminalStub(label),
|
|
7451
|
+
kill: () => {
|
|
7452
|
+
daemonLog(
|
|
7453
|
+
`${label} sdk query ended by kill (child pid ${child2?.pid ?? "none"})`
|
|
7454
|
+
);
|
|
7455
|
+
abort2.abort();
|
|
7456
|
+
killSdkChild(child2);
|
|
7457
|
+
},
|
|
7458
|
+
onExit: (listener) => {
|
|
7459
|
+
exitListeners.push(listener);
|
|
7460
|
+
return noopDisposable;
|
|
7461
|
+
},
|
|
7462
|
+
sdk: sdk.handle
|
|
7463
|
+
};
|
|
7464
|
+
return {
|
|
7465
|
+
process: sessionProcess,
|
|
7466
|
+
emit: sdk.emit,
|
|
7467
|
+
exit: (exitCode) => {
|
|
7468
|
+
if (exited) return;
|
|
7469
|
+
exited = true;
|
|
7470
|
+
killSdkChild(child2);
|
|
7471
|
+
for (const listener of exitListeners) listener({ exitCode });
|
|
7472
|
+
},
|
|
7473
|
+
attach: (spawned) => {
|
|
7474
|
+
child2 = spawned;
|
|
7475
|
+
},
|
|
7476
|
+
aborted: () => abort2.signal.aborted,
|
|
7477
|
+
bind: sdk.bind
|
|
7478
|
+
};
|
|
7479
|
+
}
|
|
7480
|
+
|
|
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) {
|
|
7546
|
+
let status2;
|
|
7547
|
+
let activity2 = null;
|
|
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
|
+
}
|
|
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
|
+
);
|
|
7572
|
+
const setStatus3 = (next3) => {
|
|
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)
|
|
7596
|
+
};
|
|
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;
|
|
7619
|
+
}
|
|
7620
|
+
|
|
7621
|
+
// src/commands/sessions/daemon/sdk/logSdkMessage.ts
|
|
7622
|
+
function logSdkMessage(label, message4) {
|
|
7623
|
+
if (message4.type === "system" && message4.subtype === "init")
|
|
7624
|
+
daemonLog(
|
|
7625
|
+
`${label} sdk init: claude session ${message4.session_id} model ${message4.model} permission mode ${message4.permissionMode}`
|
|
7626
|
+
);
|
|
7627
|
+
if (message4.type === "result")
|
|
7628
|
+
daemonLog(`${label} sdk turn ended: ${message4.subtype}`);
|
|
7629
|
+
}
|
|
7630
|
+
|
|
7631
|
+
// src/commands/sessions/daemon/sdk/sdkActivityText.ts
|
|
7632
|
+
var TARGET_KEYS = [
|
|
7633
|
+
"command",
|
|
7634
|
+
"file_path",
|
|
7635
|
+
"notebook_path",
|
|
7636
|
+
"path",
|
|
7637
|
+
"pattern",
|
|
7638
|
+
"url",
|
|
7639
|
+
"query",
|
|
7640
|
+
"description",
|
|
7641
|
+
"skill"
|
|
7642
|
+
];
|
|
7643
|
+
var MAX_TARGET = 80;
|
|
7644
|
+
function toolTarget2(input) {
|
|
7645
|
+
if (!input || typeof input !== "object") return "";
|
|
7646
|
+
const record3 = input;
|
|
7647
|
+
const key = TARGET_KEYS.find((k) => typeof record3[k] === "string");
|
|
7648
|
+
if (!key) return "";
|
|
7649
|
+
const line = record3[key].split("\n")[0].trim();
|
|
7650
|
+
return line.length > MAX_TARGET ? `${line.slice(0, MAX_TARGET - 1)}\u2026` : line;
|
|
7651
|
+
}
|
|
7652
|
+
function sdkActivityText(content) {
|
|
7653
|
+
const tool = [...content].reverse().find((block) => block.type === "tool_use");
|
|
7654
|
+
if (!tool?.name) return "Working";
|
|
7655
|
+
const target = toolTarget2(tool.input);
|
|
7656
|
+
return `Working \xB7 ${tool.name}${target ? ` ${target}` : ""}`;
|
|
7657
|
+
}
|
|
7658
|
+
|
|
7659
|
+
// src/commands/sessions/daemon/sdk/sdkTurnStatus.ts
|
|
7660
|
+
function sdkTurnStatus(message4) {
|
|
7661
|
+
if (message4.type === "assistant" && message4.parent_tool_use_id === null)
|
|
7662
|
+
return "running";
|
|
7663
|
+
if (message4.type === "result") return "waiting";
|
|
7664
|
+
if (message4.type === "system" && message4.subtype === "session_state_changed")
|
|
7665
|
+
return message4.state === "running" ? "running" : "waiting";
|
|
7666
|
+
return void 0;
|
|
7667
|
+
}
|
|
7668
|
+
|
|
7669
|
+
// src/commands/sessions/daemon/sdk/runSdkQuery.ts
|
|
7670
|
+
async function runSdkQuery(messages2, sessionId2, control, turn) {
|
|
7671
|
+
const label = `session ${sessionId2 ?? "?"}`;
|
|
7672
|
+
try {
|
|
7673
|
+
for await (const message4 of messages2) {
|
|
7674
|
+
logSdkMessage(label, message4);
|
|
7675
|
+
const status2 = sdkTurnStatus(message4);
|
|
7676
|
+
if (status2) turn.setStatus(status2);
|
|
7677
|
+
if (message4.type === "assistant" && message4.parent_tool_use_id === null)
|
|
7678
|
+
turn.setActivity(sdkActivityText(message4.message.content));
|
|
7679
|
+
}
|
|
7680
|
+
daemonLog(`${label} sdk query finished`);
|
|
7681
|
+
control.exit(0);
|
|
7682
|
+
} catch (error) {
|
|
7683
|
+
if (control.aborted()) {
|
|
7684
|
+
daemonLog(`${label} sdk query stopped after kill`);
|
|
7685
|
+
control.exit(0);
|
|
7686
|
+
return;
|
|
7687
|
+
}
|
|
7688
|
+
daemonLog(
|
|
7689
|
+
`${label} sdk query failed: ${error instanceof Error ? error.message : String(error)}`
|
|
7690
|
+
);
|
|
7691
|
+
control.exit(1);
|
|
7692
|
+
}
|
|
7693
|
+
}
|
|
7694
|
+
|
|
7695
|
+
// src/commands/sessions/daemon/sdk/sdkQueryOptions.ts
|
|
7696
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
7697
|
+
|
|
7698
|
+
// src/commands/sessions/daemon/sdk/spawnSdkChild.ts
|
|
7699
|
+
import { spawn as spawn6 } from "child_process";
|
|
7700
|
+
var MAX_STDERR_LINE = 300;
|
|
7701
|
+
function spawnSdkChild(options2, sessionId2, attach) {
|
|
7702
|
+
const label = `session ${sessionId2 ?? "?"}`;
|
|
7703
|
+
const child2 = spawn6(options2.command, options2.args, {
|
|
7704
|
+
cwd: options2.cwd,
|
|
7705
|
+
env: sessionChildEnv(options2.env, sessionId2),
|
|
7706
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
7707
|
+
signal: options2.signal,
|
|
7708
|
+
/* why: its own process group, so a kill also reaches the shell commands
|
|
7709
|
+
* claude runs for its tools, as killPtyTree does for terminal sessions. */
|
|
7710
|
+
detached: process.platform !== "win32",
|
|
7711
|
+
windowsHide: true
|
|
7712
|
+
});
|
|
7713
|
+
daemonLog(
|
|
7714
|
+
`${label} sdk child spawned: pid ${child2.pid ?? "none"} ${options2.command}`
|
|
7715
|
+
);
|
|
7716
|
+
child2.stderr.setEncoding("utf8");
|
|
7717
|
+
child2.stderr.on("data", (chunk2) => {
|
|
7718
|
+
for (const line of chunk2.split("\n")) {
|
|
7719
|
+
const trimmed = line.trim();
|
|
7720
|
+
if (trimmed)
|
|
7721
|
+
daemonLog(`${label} sdk stderr: ${trimmed.slice(0, MAX_STDERR_LINE)}`);
|
|
7722
|
+
}
|
|
7723
|
+
});
|
|
7724
|
+
child2.on(
|
|
7725
|
+
"exit",
|
|
7726
|
+
(code, signal) => daemonLog(`${label} sdk child exited: code ${code} signal ${signal}`)
|
|
7727
|
+
);
|
|
7728
|
+
attach(child2);
|
|
7729
|
+
return child2;
|
|
7730
|
+
}
|
|
7731
|
+
|
|
7732
|
+
// src/commands/sessions/daemon/sdk/sdkQueryOptions.ts
|
|
7733
|
+
function sdkQueryOptions(opts2, executable, abort2, control) {
|
|
7734
|
+
const append = opts2.appendSystemPromptFile ? readFileSync8(opts2.appendSystemPromptFile, "utf8") : void 0;
|
|
7735
|
+
return {
|
|
7736
|
+
cwd: opts2.cwd,
|
|
7737
|
+
sessionId: opts2.claudeSessionId,
|
|
7738
|
+
permissionMode: "auto",
|
|
7739
|
+
settings: ensureHooksSettings(),
|
|
7740
|
+
pathToClaudeCodeExecutable: executable,
|
|
7741
|
+
spawnClaudeCodeProcess: (options2) => spawnSdkChild(options2, opts2.sessionId, control.attach),
|
|
7742
|
+
abortController: abort2,
|
|
7743
|
+
model: opts2.model,
|
|
7744
|
+
systemPrompt: { type: "preset", preset: "claude_code", append }
|
|
7745
|
+
};
|
|
7746
|
+
}
|
|
7747
|
+
|
|
7748
|
+
// src/commands/sessions/daemon/sdk/startSdkQuery.ts
|
|
7749
|
+
async function startSdkQuery(opts2, abort2, control, turn, prompt) {
|
|
7750
|
+
const label = `session ${opts2.sessionId ?? "?"}`;
|
|
7751
|
+
try {
|
|
7752
|
+
const executable = resolveClaudeExecutable();
|
|
7753
|
+
daemonLog(
|
|
7754
|
+
`${label} sdk query starting: claude ${executable}, claude session ${opts2.claudeSessionId ?? "unassigned"}, permission mode auto, cwd ${opts2.cwd ?? process.cwd()}`
|
|
7755
|
+
);
|
|
7756
|
+
const messages2 = query({
|
|
7757
|
+
prompt,
|
|
7758
|
+
options: sdkQueryOptions(opts2, executable, abort2, control)
|
|
7759
|
+
});
|
|
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);
|
|
7767
|
+
} catch (error) {
|
|
7768
|
+
daemonLog(
|
|
7769
|
+
`${label} sdk query not started: ${error instanceof Error ? error.message : String(error)}`
|
|
7770
|
+
);
|
|
7771
|
+
control.exit(1);
|
|
7772
|
+
}
|
|
7773
|
+
}
|
|
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
|
+
|
|
7792
|
+
// src/shared/harnessAdapters/claudeSdkAdapter.ts
|
|
7793
|
+
var claudeSdkAdapter = {
|
|
7794
|
+
...claudeAdapter,
|
|
7795
|
+
kind: "claude-sdk",
|
|
7796
|
+
label: harnessLabel("claude-sdk"),
|
|
7797
|
+
capabilities: {
|
|
7798
|
+
...harnessCapabilityDeclarations["claude-sdk"],
|
|
7799
|
+
"connector.gmail.read": () => claudeConnectorProbe("Gmail"),
|
|
7800
|
+
"connector.slack.read": () => claudeConnectorProbe("Slack")
|
|
7801
|
+
},
|
|
7802
|
+
detect: () => detectHarness("claude-sdk"),
|
|
7803
|
+
interactive: ({
|
|
7804
|
+
sessionId: sessionId2,
|
|
7805
|
+
conversationId,
|
|
7806
|
+
prompt,
|
|
7807
|
+
cwd,
|
|
7808
|
+
appendSystemPromptFile,
|
|
7809
|
+
model
|
|
7810
|
+
}) => spawnClaudeSdk({
|
|
7811
|
+
prompt,
|
|
7812
|
+
cwd,
|
|
7813
|
+
sessionId: sessionId2,
|
|
7814
|
+
claudeSessionId: conversationId,
|
|
7815
|
+
appendSystemPromptFile,
|
|
7816
|
+
model
|
|
7817
|
+
}),
|
|
7818
|
+
activityIdentity: (conversationId) => ({
|
|
7819
|
+
harness: "claude-sdk",
|
|
7820
|
+
claudeSessionId: conversationId
|
|
7821
|
+
})
|
|
7822
|
+
};
|
|
7823
|
+
|
|
7311
7824
|
// src/commands/litellm/buildCodexProviderArgs.ts
|
|
7312
7825
|
var API_KEY_ENV = "ASSIST_LITELLM_API_KEY";
|
|
7313
7826
|
function buildCodexProviderArgs(responsesBaseUrl, apiKey, model) {
|
|
@@ -7479,12 +7992,12 @@ function codexDeveloperInstructionsArgs(file) {
|
|
|
7479
7992
|
}
|
|
7480
7993
|
|
|
7481
7994
|
// src/shared/trustCodexProject.ts
|
|
7482
|
-
import { execFileSync as
|
|
7995
|
+
import { execFileSync as execFileSync3 } from "child_process";
|
|
7483
7996
|
import * as fs7 from "fs";
|
|
7484
7997
|
import * as path10 from "path";
|
|
7485
7998
|
function repoRoot(cwd) {
|
|
7486
7999
|
try {
|
|
7487
|
-
const commonDir =
|
|
8000
|
+
const commonDir = execFileSync3(
|
|
7488
8001
|
"git",
|
|
7489
8002
|
["rev-parse", "--path-format=absolute", "--git-common-dir"],
|
|
7490
8003
|
{ cwd, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }
|
|
@@ -7513,15 +8026,15 @@ ${entry}` : entry);
|
|
|
7513
8026
|
}
|
|
7514
8027
|
|
|
7515
8028
|
// src/commands/sessions/daemon/spawnCodex.ts
|
|
7516
|
-
function spawnCodex(
|
|
7517
|
-
const trusted = trustCodexProject(
|
|
8029
|
+
function spawnCodex(opts2 = {}) {
|
|
8030
|
+
const trusted = trustCodexProject(opts2.cwd);
|
|
7518
8031
|
if (trusted) daemonLog(`codex: trusted ${trusted} in config.toml`);
|
|
7519
8032
|
const untrusted = prepareCodexHookTrust();
|
|
7520
8033
|
if (untrusted) daemonLog(`codex: ${untrusted}`);
|
|
7521
|
-
const override =
|
|
8034
|
+
const override = opts2.model ? { args: ["-m", opts2.model], env: {} } : buildHarnessCodexArgs();
|
|
7522
8035
|
const sessionEnv = codexSessionEnvArgs({
|
|
7523
8036
|
ASSIST_SESSION: "1",
|
|
7524
|
-
ASSIST_SESSION_ID:
|
|
8037
|
+
ASSIST_SESSION_ID: opts2.sessionId,
|
|
7525
8038
|
ASSIST_BACKLOG_ITEM_ID: process.env.ASSIST_BACKLOG_ITEM_ID
|
|
7526
8039
|
});
|
|
7527
8040
|
return spawnPty(
|
|
@@ -7531,17 +8044,17 @@ function spawnCodex(opts = {}) {
|
|
|
7531
8044
|
...override.args,
|
|
7532
8045
|
...sessionEnv,
|
|
7533
8046
|
...codexSandboxNetworkArgs,
|
|
7534
|
-
...codexDeveloperInstructionsArgs(
|
|
7535
|
-
...codexArgs(
|
|
8047
|
+
...codexDeveloperInstructionsArgs(opts2.appendSystemPromptFile),
|
|
8048
|
+
...codexArgs(opts2)
|
|
7536
8049
|
],
|
|
7537
|
-
|
|
7538
|
-
|
|
8050
|
+
opts2.cwd,
|
|
8051
|
+
opts2.sessionId,
|
|
7539
8052
|
override.env
|
|
7540
8053
|
);
|
|
7541
8054
|
}
|
|
7542
|
-
function codexArgs(
|
|
7543
|
-
const prompt =
|
|
7544
|
-
if (
|
|
8055
|
+
function codexArgs(opts2) {
|
|
8056
|
+
const prompt = opts2.prompt ? [opts2.prompt] : [];
|
|
8057
|
+
if (opts2.resumeSessionId) return ["resume", opts2.resumeSessionId, ...prompt];
|
|
7545
8058
|
return prompt;
|
|
7546
8059
|
}
|
|
7547
8060
|
|
|
@@ -8274,7 +8787,7 @@ function codexHookProbe() {
|
|
|
8274
8787
|
}
|
|
8275
8788
|
|
|
8276
8789
|
// src/shared/readCodexRulePerms.ts
|
|
8277
|
-
import { existsSync as existsSync19, readdirSync as readdirSync5, readFileSync as
|
|
8790
|
+
import { existsSync as existsSync19, readdirSync as readdirSync5, readFileSync as readFileSync13 } from "fs";
|
|
8278
8791
|
import { join as join25 } from "path";
|
|
8279
8792
|
|
|
8280
8793
|
// src/shared/readPatternList.ts
|
|
@@ -8367,7 +8880,7 @@ function readCodexRulePerms(key) {
|
|
|
8367
8880
|
];
|
|
8368
8881
|
return dirs.flatMap(ruleFiles).flatMap((file) => {
|
|
8369
8882
|
try {
|
|
8370
|
-
return parseCodexRules(
|
|
8883
|
+
return parseCodexRules(readFileSync13(file, "utf8"))[key];
|
|
8371
8884
|
} catch {
|
|
8372
8885
|
return [];
|
|
8373
8886
|
}
|
|
@@ -8718,11 +9231,11 @@ var codexAdapter = {
|
|
|
8718
9231
|
var piTerminalArgs = ["--tui-mode", "regular"];
|
|
8719
9232
|
|
|
8720
9233
|
// src/commands/sessions/daemon/spawnPi.ts
|
|
8721
|
-
function spawnPi(
|
|
9234
|
+
function spawnPi(opts2 = {}) {
|
|
8722
9235
|
const args = ["pi", ...piTerminalArgs];
|
|
8723
|
-
if (
|
|
8724
|
-
if (
|
|
8725
|
-
return spawnPty(args,
|
|
9236
|
+
if (opts2.model) args.push("--model", opts2.model);
|
|
9237
|
+
if (opts2.prompt) args.push(opts2.prompt);
|
|
9238
|
+
return spawnPty(args, opts2.cwd, opts2.sessionId, { ASSIST_HARNESS: "pi" });
|
|
8726
9239
|
}
|
|
8727
9240
|
|
|
8728
9241
|
// src/shared/spawnPi.ts
|
|
@@ -8855,6 +9368,7 @@ var piAdapter = {
|
|
|
8855
9368
|
// src/shared/harnessAdapters/harnessAdapter.ts
|
|
8856
9369
|
var adapters = {
|
|
8857
9370
|
claude: claudeAdapter,
|
|
9371
|
+
"claude-sdk": claudeSdkAdapter,
|
|
8858
9372
|
codex: codexAdapter,
|
|
8859
9373
|
pi: piAdapter
|
|
8860
9374
|
};
|
|
@@ -9472,12 +9986,12 @@ var editEnforcement = [
|
|
|
9472
9986
|
var fixConflictFeature = {
|
|
9473
9987
|
id: "fixConflict",
|
|
9474
9988
|
label: "Fix conflicts",
|
|
9475
|
-
requires: ["skills.native", ...editEnforcement]
|
|
9989
|
+
requires: ["skills.native", "launch.terminal", ...editEnforcement]
|
|
9476
9990
|
};
|
|
9477
9991
|
var reviewPrCommentsFeature = {
|
|
9478
9992
|
id: "reviewPrComments",
|
|
9479
9993
|
label: "Address comments",
|
|
9480
|
-
requires: ["skills.native", ...editEnforcement]
|
|
9994
|
+
requires: ["skills.native", "launch.terminal", ...editEnforcement]
|
|
9481
9995
|
};
|
|
9482
9996
|
var addressCommentsChainFeature = {
|
|
9483
9997
|
id: "addressCommentsChain",
|
|
@@ -9626,27 +10140,32 @@ var reviewSynthesisFeature = {
|
|
|
9626
10140
|
var reviewRefineFeature = {
|
|
9627
10141
|
id: "reviewRefine",
|
|
9628
10142
|
label: "Review & refine",
|
|
9629
|
-
requires: [...editEnforcement]
|
|
10143
|
+
requires: ["launch.terminal", ...editEnforcement]
|
|
9630
10144
|
};
|
|
9631
10145
|
var reviewApplyFeature = {
|
|
9632
10146
|
id: "reviewApply",
|
|
9633
10147
|
label: "Review & apply",
|
|
9634
|
-
requires: [...editEnforcement]
|
|
10148
|
+
requires: ["launch.terminal", ...editEnforcement]
|
|
9635
10149
|
};
|
|
9636
10150
|
var reviewBacklogFeature = {
|
|
9637
10151
|
id: "reviewBacklog",
|
|
9638
10152
|
label: "Review & backlog",
|
|
9639
|
-
requires: ["skills.native", ...editEnforcement]
|
|
10153
|
+
requires: ["skills.native", "launch.terminal", ...editEnforcement]
|
|
9640
10154
|
};
|
|
9641
10155
|
var reviewCheckoutFeature = {
|
|
9642
10156
|
id: "reviewCheckout",
|
|
9643
10157
|
label: "PR checkout session",
|
|
9644
|
-
requires: [...editEnforcement]
|
|
10158
|
+
requires: ["launch.terminal", ...editEnforcement]
|
|
9645
10159
|
};
|
|
9646
10160
|
var highLevelReviewFeature = {
|
|
9647
10161
|
id: "highLevelReview",
|
|
9648
10162
|
label: "High-level review",
|
|
9649
|
-
requires: [
|
|
10163
|
+
requires: [
|
|
10164
|
+
"skills.native",
|
|
10165
|
+
"launch.terminal",
|
|
10166
|
+
"tasks.notifyOnExit",
|
|
10167
|
+
...editEnforcement
|
|
10168
|
+
]
|
|
9650
10169
|
};
|
|
9651
10170
|
var highLevelGlobsFeature = {
|
|
9652
10171
|
id: "highLevelGlobs",
|
|
@@ -11554,7 +12073,7 @@ function handleServerRuns(req, res) {
|
|
|
11554
12073
|
|
|
11555
12074
|
// src/commands/sessions/web/getReviewSynthesis.ts
|
|
11556
12075
|
import { execFile as execFile6 } from "child_process";
|
|
11557
|
-
import { readFileSync as
|
|
12076
|
+
import { readFileSync as readFileSync14 } from "fs";
|
|
11558
12077
|
import { homedir as homedir10 } from "os";
|
|
11559
12078
|
import { basename as basename10, join as join32 } from "path";
|
|
11560
12079
|
import { promisify as promisify6 } from "util";
|
|
@@ -11602,7 +12121,7 @@ async function getReviewSynthesis(req, res) {
|
|
|
11602
12121
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
11603
12122
|
return;
|
|
11604
12123
|
}
|
|
11605
|
-
respondJson(res, 200, { synthesis:
|
|
12124
|
+
respondJson(res, 200, { synthesis: readFileSync14(path128, "utf8") });
|
|
11606
12125
|
} catch {
|
|
11607
12126
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
11608
12127
|
}
|
|
@@ -11926,14 +12445,14 @@ async function deleteItemComment(res, itemId2, commentId) {
|
|
|
11926
12445
|
|
|
11927
12446
|
// src/commands/backlog/appendComment.ts
|
|
11928
12447
|
import { sql as sql17 } from "drizzle-orm";
|
|
11929
|
-
async function appendComment(orm, itemId2, text18,
|
|
12448
|
+
async function appendComment(orm, itemId2, text18, opts2 = {}) {
|
|
11930
12449
|
await orm.insert(comments).values({
|
|
11931
12450
|
itemId: itemId2,
|
|
11932
12451
|
idx: sql17`(SELECT COALESCE(MAX(${comments.idx}) + 1, 0) FROM ${comments} WHERE ${comments.itemId} = ${itemId2})`,
|
|
11933
12452
|
text: text18,
|
|
11934
|
-
phase:
|
|
12453
|
+
phase: opts2.phase ?? null,
|
|
11935
12454
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11936
|
-
type:
|
|
12455
|
+
type: opts2.type ?? "comment"
|
|
11937
12456
|
});
|
|
11938
12457
|
}
|
|
11939
12458
|
|
|
@@ -12029,22 +12548,22 @@ var transcriptFeatures = [
|
|
|
12029
12548
|
var refineFeature = {
|
|
12030
12549
|
id: "refine",
|
|
12031
12550
|
label: "Refine",
|
|
12032
|
-
requires: ["skills.native", ...editEnforcement]
|
|
12551
|
+
requires: ["skills.native", "launch.terminal", ...editEnforcement]
|
|
12033
12552
|
};
|
|
12034
12553
|
var draftFeature = {
|
|
12035
12554
|
id: "draft",
|
|
12036
12555
|
label: "Draft",
|
|
12037
|
-
requires: ["skills.native", ...editEnforcement]
|
|
12556
|
+
requires: ["skills.native", "launch.terminal", ...editEnforcement]
|
|
12038
12557
|
};
|
|
12039
12558
|
var bugFeature = {
|
|
12040
12559
|
id: "bug",
|
|
12041
12560
|
label: "Bug filing",
|
|
12042
|
-
requires: ["skills.native", ...editEnforcement]
|
|
12561
|
+
requires: ["skills.native", "launch.terminal", ...editEnforcement]
|
|
12043
12562
|
};
|
|
12044
12563
|
var buildFeature = {
|
|
12045
12564
|
id: "build",
|
|
12046
12565
|
label: "Build",
|
|
12047
|
-
requires: [...editEnforcement]
|
|
12566
|
+
requires: ["launch.terminal", ...editEnforcement]
|
|
12048
12567
|
};
|
|
12049
12568
|
var sessionFeature = {
|
|
12050
12569
|
id: "session",
|
|
@@ -12064,7 +12583,7 @@ var conversationRecoveryFeature = {
|
|
|
12064
12583
|
var divergenceEscalationFeature = {
|
|
12065
12584
|
id: "divergenceEscalation",
|
|
12066
12585
|
label: "Divergence escalation",
|
|
12067
|
-
requires: [...editEnforcement]
|
|
12586
|
+
requires: ["launch.terminal", ...editEnforcement]
|
|
12068
12587
|
};
|
|
12069
12588
|
var previewQuestionsFeature = {
|
|
12070
12589
|
id: "previewQuestions",
|
|
@@ -12463,7 +12982,7 @@ import chalk10 from "chalk";
|
|
|
12463
12982
|
import {
|
|
12464
12983
|
existsSync as existsSync26,
|
|
12465
12984
|
mkdirSync as mkdirSync8,
|
|
12466
|
-
readFileSync as
|
|
12985
|
+
readFileSync as readFileSync15,
|
|
12467
12986
|
rmSync as rmSync3,
|
|
12468
12987
|
writeFileSync as writeFileSync7
|
|
12469
12988
|
} from "fs";
|
|
@@ -12483,7 +13002,7 @@ function readSignalOwner(itemId2) {
|
|
|
12483
13002
|
const path128 = getOwnerPath(itemId2);
|
|
12484
13003
|
if (!existsSync26(path128)) return void 0;
|
|
12485
13004
|
try {
|
|
12486
|
-
const parsed = JSON.parse(
|
|
13005
|
+
const parsed = JSON.parse(readFileSync15(path128, "utf8"));
|
|
12487
13006
|
return parsed.sessionId;
|
|
12488
13007
|
} catch {
|
|
12489
13008
|
return void 0;
|
|
@@ -13102,9 +13621,9 @@ function queryNodes() {
|
|
|
13102
13621
|
}
|
|
13103
13622
|
|
|
13104
13623
|
// src/commands/watch/resolveUpstream.ts
|
|
13105
|
-
import { execFileSync as
|
|
13624
|
+
import { execFileSync as execFileSync4 } from "child_process";
|
|
13106
13625
|
function runGit3(args, cwd) {
|
|
13107
|
-
return
|
|
13626
|
+
return execFileSync4("git", args, {
|
|
13108
13627
|
encoding: "utf8",
|
|
13109
13628
|
stdio: ["pipe", "pipe", "pipe"],
|
|
13110
13629
|
cwd,
|
|
@@ -13180,8 +13699,8 @@ async function health(_req, res) {
|
|
|
13180
13699
|
function getCwdAndQuery(req, res) {
|
|
13181
13700
|
const cwd = getCwdParam(req, res);
|
|
13182
13701
|
if (!cwd) return null;
|
|
13183
|
-
const
|
|
13184
|
-
return { cwd, query };
|
|
13702
|
+
const query2 = new URL(req.url ?? "/", "http://localhost").searchParams.get("q") ?? "";
|
|
13703
|
+
return { cwd, query: query2 };
|
|
13185
13704
|
}
|
|
13186
13705
|
|
|
13187
13706
|
// src/commands/sessions/web/historySearch.ts
|
|
@@ -13354,11 +13873,11 @@ var linkStateCache = {
|
|
|
13354
13873
|
|
|
13355
13874
|
// src/commands/sessions/web/linkStatus/fetchLinkStateChunks.ts
|
|
13356
13875
|
var CHUNK_SIZE = 100;
|
|
13357
|
-
async function fetchLinkStateChunks(refs,
|
|
13876
|
+
async function fetchLinkStateChunks(refs, query2) {
|
|
13358
13877
|
const resolved = /* @__PURE__ */ new Map();
|
|
13359
13878
|
for (let start2 = 0; start2 < refs.length; start2 += CHUNK_SIZE) {
|
|
13360
13879
|
const chunk2 = refs.slice(start2, start2 + CHUNK_SIZE);
|
|
13361
|
-
const states2 = await
|
|
13880
|
+
const states2 = await query2(chunk2).catch(() => void 0);
|
|
13362
13881
|
if (!states2) continue;
|
|
13363
13882
|
chunk2.forEach((ref, i) => {
|
|
13364
13883
|
const key = linkRefKey(ref);
|
|
@@ -13438,9 +13957,9 @@ async function queryLinkStates(refs) {
|
|
|
13438
13957
|
|
|
13439
13958
|
// src/commands/sessions/web/linkStatus/resolveLinkStates.ts
|
|
13440
13959
|
var inFlight2 = /* @__PURE__ */ new Map();
|
|
13441
|
-
function startFetch(refs,
|
|
13960
|
+
function startFetch(refs, query2) {
|
|
13442
13961
|
if (refs.length === 0) return;
|
|
13443
|
-
const batch = fetchLinkStateChunks(refs,
|
|
13962
|
+
const batch = fetchLinkStateChunks(refs, query2);
|
|
13444
13963
|
for (const ref of refs) {
|
|
13445
13964
|
const key = linkRefKey(ref);
|
|
13446
13965
|
const pending = batch.then((resolved) => resolved.get(key) ?? null);
|
|
@@ -13450,12 +13969,12 @@ function startFetch(refs, query) {
|
|
|
13450
13969
|
});
|
|
13451
13970
|
}
|
|
13452
13971
|
}
|
|
13453
|
-
async function resolveLinkStates(refs,
|
|
13972
|
+
async function resolveLinkStates(refs, query2 = queryLinkStates) {
|
|
13454
13973
|
const unique = new Map(refs.map((ref) => [linkRefKey(ref), ref]));
|
|
13455
13974
|
const toFetch = [...unique].filter(
|
|
13456
13975
|
([key]) => linkStateCache.get(key) === void 0 && !inFlight2.has(key)
|
|
13457
13976
|
).map(([, ref]) => ref);
|
|
13458
|
-
startFetch(toFetch,
|
|
13977
|
+
startFetch(toFetch, query2);
|
|
13459
13978
|
const states2 = {};
|
|
13460
13979
|
await Promise.all(
|
|
13461
13980
|
[...unique.keys()].map(async (key) => {
|
|
@@ -13492,12 +14011,12 @@ function isBoundary(text18, index3) {
|
|
|
13492
14011
|
if (!/[A-Za-z0-9]/.test(previous)) return true;
|
|
13493
14012
|
return /[a-z0-9]/.test(previous) && /[A-Z]/.test(text18[index3] ?? "");
|
|
13494
14013
|
}
|
|
13495
|
-
function subsequenceScore(text18,
|
|
14014
|
+
function subsequenceScore(text18, query2) {
|
|
13496
14015
|
const lower = text18.toLowerCase();
|
|
13497
14016
|
let score = 0;
|
|
13498
14017
|
let cursor = 0;
|
|
13499
14018
|
let previous = -1;
|
|
13500
|
-
for (const char of
|
|
14019
|
+
for (const char of query2) {
|
|
13501
14020
|
const at2 = lower.indexOf(char, cursor);
|
|
13502
14021
|
if (at2 === -1) return null;
|
|
13503
14022
|
if (at2 === previous + 1) score += CONSECUTIVE_BONUS;
|
|
@@ -13509,8 +14028,8 @@ function subsequenceScore(text18, query) {
|
|
|
13509
14028
|
}
|
|
13510
14029
|
return score - Math.min(text18.length, MAX_LENGTH_PENALTY);
|
|
13511
14030
|
}
|
|
13512
|
-
function scoreFilePath(path128,
|
|
13513
|
-
const needle =
|
|
14031
|
+
function scoreFilePath(path128, query2) {
|
|
14032
|
+
const needle = query2.trim().toLowerCase();
|
|
13514
14033
|
if (!needle) return 0;
|
|
13515
14034
|
const basename38 = path128.slice(path128.lastIndexOf("/") + 1);
|
|
13516
14035
|
const inBasename = subsequenceScore(basename38, needle);
|
|
@@ -13519,10 +14038,10 @@ function scoreFilePath(path128, query) {
|
|
|
13519
14038
|
}
|
|
13520
14039
|
|
|
13521
14040
|
// src/commands/sessions/web/rankFilePaths.ts
|
|
13522
|
-
function rankFilePaths(paths,
|
|
14041
|
+
function rankFilePaths(paths, query2, limit) {
|
|
13523
14042
|
const scored = [];
|
|
13524
14043
|
for (const path128 of paths) {
|
|
13525
|
-
const score = scoreFilePath(path128,
|
|
14044
|
+
const score = scoreFilePath(path128, query2);
|
|
13526
14045
|
if (score !== null) scored.push({ path: path128, score });
|
|
13527
14046
|
}
|
|
13528
14047
|
scored.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path));
|
|
@@ -13549,10 +14068,10 @@ async function repoFiles(cwd) {
|
|
|
13549
14068
|
async function listFiles(req, res) {
|
|
13550
14069
|
const params = getCwdAndQuery(req, res);
|
|
13551
14070
|
if (!params) return;
|
|
13552
|
-
const { cwd, query } = params;
|
|
14071
|
+
const { cwd, query: query2 } = params;
|
|
13553
14072
|
try {
|
|
13554
14073
|
const files = await repoFiles(cwd);
|
|
13555
|
-
respondJson(res, 200, { files: rankFilePaths(files,
|
|
14074
|
+
respondJson(res, 200, { files: rankFilePaths(files, query2, MAX_RESULTS) });
|
|
13556
14075
|
} catch {
|
|
13557
14076
|
respondJson(res, 500, { error: "Failed to list files" });
|
|
13558
14077
|
}
|
|
@@ -14284,10 +14803,10 @@ function assertProjectScope() {
|
|
|
14284
14803
|
}
|
|
14285
14804
|
|
|
14286
14805
|
// src/shared/runGhOrThrow.ts
|
|
14287
|
-
import { execFileSync as
|
|
14806
|
+
import { execFileSync as execFileSync5 } from "child_process";
|
|
14288
14807
|
function runGhOrThrow(args, fallbackMessage, input) {
|
|
14289
14808
|
try {
|
|
14290
|
-
|
|
14809
|
+
execFileSync5("gh", args, {
|
|
14291
14810
|
stdio: [input === void 0 ? "ignore" : "pipe", "ignore", "pipe"],
|
|
14292
14811
|
encoding: "utf8",
|
|
14293
14812
|
...input === void 0 ? {} : { input }
|
|
@@ -14329,11 +14848,11 @@ function throwOnGraphqlErrors(stdout) {
|
|
|
14329
14848
|
}
|
|
14330
14849
|
|
|
14331
14850
|
// src/shared/runGhGraphqlJson.ts
|
|
14332
|
-
function runGhGraphqlJson(
|
|
14851
|
+
function runGhGraphqlJson(query2, vars = {}) {
|
|
14333
14852
|
const result = spawnSync4("gh", ["api", "graphql", "--input", "-"], {
|
|
14334
14853
|
encoding: "utf8",
|
|
14335
14854
|
windowsHide: true,
|
|
14336
|
-
input: JSON.stringify({ query, variables: vars }),
|
|
14855
|
+
input: JSON.stringify({ query: query2, variables: vars }),
|
|
14337
14856
|
maxBuffer: 64 * 1024 * 1024
|
|
14338
14857
|
});
|
|
14339
14858
|
if (result.status !== 0) throw new Error(result.stderr || result.stdout);
|
|
@@ -14466,7 +14985,7 @@ async function nextPickup(req, res) {
|
|
|
14466
14985
|
import path22 from "path";
|
|
14467
14986
|
|
|
14468
14987
|
// src/commands/rules/readScopedRules.ts
|
|
14469
|
-
import { existsSync as existsSync28, readFileSync as
|
|
14988
|
+
import { existsSync as existsSync28, readFileSync as readFileSync16 } from "fs";
|
|
14470
14989
|
import path21 from "path";
|
|
14471
14990
|
|
|
14472
14991
|
// src/commands/rules/rulesSectionRange.ts
|
|
@@ -14538,7 +15057,7 @@ function scopedClaudeFiles(target) {
|
|
|
14538
15057
|
}
|
|
14539
15058
|
function readScopedRules(target) {
|
|
14540
15059
|
return scopedClaudeFiles(target).flatMap(
|
|
14541
|
-
(source) => parseRulesSection(
|
|
15060
|
+
(source) => parseRulesSection(readFileSync16(source, "utf8")).map((rule) => ({
|
|
14542
15061
|
...rule,
|
|
14543
15062
|
source
|
|
14544
15063
|
}))
|
|
@@ -14671,7 +15190,7 @@ function avgContextPerCycle(db) {
|
|
|
14671
15190
|
// src/shared/db/listUsagePeaks.ts
|
|
14672
15191
|
async function listUsagePeaks(db, options2) {
|
|
14673
15192
|
const avgContext = avgContextPerCycle(db);
|
|
14674
|
-
const
|
|
15193
|
+
const query2 = db.select({
|
|
14675
15194
|
...getTableColumns(usagePeaks),
|
|
14676
15195
|
avgContextPct: avgContext.avgContextPct,
|
|
14677
15196
|
phaseCount: avgContext.phaseCount
|
|
@@ -14688,14 +15207,15 @@ async function listUsagePeaks(db, options2) {
|
|
|
14688
15207
|
desc4(usagePeaks.segment)
|
|
14689
15208
|
);
|
|
14690
15209
|
if (options2?.limit !== void 0) {
|
|
14691
|
-
return
|
|
15210
|
+
return query2.limit(options2.limit).offset(options2.offset ?? 0);
|
|
14692
15211
|
}
|
|
14693
|
-
return
|
|
15212
|
+
return query2;
|
|
14694
15213
|
}
|
|
14695
15214
|
|
|
14696
15215
|
// src/shared/harnessAdapters/harnessUsageAccounts.ts
|
|
14697
15216
|
var harnessUsageAccounts = {
|
|
14698
15217
|
claude: {},
|
|
15218
|
+
"claude-sdk": {},
|
|
14699
15219
|
codex: { windowPrefix: "codex" },
|
|
14700
15220
|
pi: { windowPrefix: "pi" }
|
|
14701
15221
|
};
|
|
@@ -14863,7 +15383,7 @@ async function listItemUsageSummaries(db, options2) {
|
|
|
14863
15383
|
const totals = phaseUsageTotals(db);
|
|
14864
15384
|
const planned = planPhaseCounts(db);
|
|
14865
15385
|
const lastPhase = lastPhaseActivity(db);
|
|
14866
|
-
const
|
|
15386
|
+
const query2 = db.select({
|
|
14867
15387
|
id: items.id,
|
|
14868
15388
|
origin: items.origin,
|
|
14869
15389
|
type: items.type,
|
|
@@ -14879,7 +15399,7 @@ async function listItemUsageSummaries(db, options2) {
|
|
|
14879
15399
|
}).from(items).innerJoin(totals, eq27(totals.itemId, items.id)).leftJoin(planned, eq27(planned.itemId, items.id)).leftJoin(lastPhase, eq27(lastPhase.itemId, items.id)).where(itemUsageWhere(options2)).orderBy(
|
|
14880
15400
|
...itemUsageOrderBy({ totals, planned, lastPhase }, options2?.sort)
|
|
14881
15401
|
);
|
|
14882
|
-
const rows = options2?.limit === void 0 ? await
|
|
15402
|
+
const rows = options2?.limit === void 0 ? await query2 : await query2.limit(options2.limit).offset(options2.offset ?? 0);
|
|
14883
15403
|
return rows.map(toItemUsageSummary);
|
|
14884
15404
|
}
|
|
14885
15405
|
|
|
@@ -15957,7 +16477,7 @@ async function revertDiffFile(req, res) {
|
|
|
15957
16477
|
}
|
|
15958
16478
|
|
|
15959
16479
|
// src/commands/run/runCommandToCompletion.ts
|
|
15960
|
-
import { spawn as
|
|
16480
|
+
import { spawn as spawn7 } from "child_process";
|
|
15961
16481
|
import { existsSync as existsSync30 } from "fs";
|
|
15962
16482
|
|
|
15963
16483
|
// src/shared/expandEnv.ts
|
|
@@ -15972,13 +16492,13 @@ function expandEnv(env) {
|
|
|
15972
16492
|
}
|
|
15973
16493
|
|
|
15974
16494
|
// src/commands/run/resolveCommand.ts
|
|
15975
|
-
import { execFileSync as
|
|
16495
|
+
import { execFileSync as execFileSync6 } from "child_process";
|
|
15976
16496
|
import { existsSync as existsSync29 } from "fs";
|
|
15977
16497
|
import { dirname as dirname14, join as join35, resolve as resolve10 } from "path";
|
|
15978
16498
|
function resolveCommand(command) {
|
|
15979
16499
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
15980
16500
|
try {
|
|
15981
|
-
const gitPath =
|
|
16501
|
+
const gitPath = execFileSync6("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
15982
16502
|
const gitRoot = resolve10(dirname14(gitPath), "..");
|
|
15983
16503
|
const gitBash = join35(gitRoot, "bin", "bash.exe");
|
|
15984
16504
|
if (existsSync29(gitBash)) return gitBash;
|
|
@@ -15998,7 +16518,7 @@ function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
|
15998
16518
|
});
|
|
15999
16519
|
return;
|
|
16000
16520
|
}
|
|
16001
|
-
const child2 =
|
|
16521
|
+
const child2 = spawn7(resolveCommand(command), args, {
|
|
16002
16522
|
stdio: quiet ? "pipe" : "inherit",
|
|
16003
16523
|
env: env ? { ...process.env, ...expandEnv(env) } : void 0,
|
|
16004
16524
|
cwd
|
|
@@ -16934,8 +17454,8 @@ async function ascRequest(fetchFn, token, method, path128, body) {
|
|
|
16934
17454
|
function createAscClient(token, fetchFn = fetch) {
|
|
16935
17455
|
return {
|
|
16936
17456
|
get: (path128, params) => {
|
|
16937
|
-
const
|
|
16938
|
-
return ascRequest(fetchFn, token, "GET", `${path128}${
|
|
17457
|
+
const query2 = params ? `?${new URLSearchParams(params)}` : "";
|
|
17458
|
+
return ascRequest(fetchFn, token, "GET", `${path128}${query2}`);
|
|
16939
17459
|
},
|
|
16940
17460
|
post: (path128, body) => ascRequest(fetchFn, token, "POST", path128, body)
|
|
16941
17461
|
};
|
|
@@ -18107,12 +18627,12 @@ function readBuiltVersion(cwd) {
|
|
|
18107
18627
|
}
|
|
18108
18628
|
|
|
18109
18629
|
// src/commands/watch/readDistVersion.ts
|
|
18110
|
-
import { readFileSync as
|
|
18630
|
+
import { readFileSync as readFileSync18 } from "fs";
|
|
18111
18631
|
import { join as join40 } from "path";
|
|
18112
18632
|
function readDistVersion(cwd) {
|
|
18113
18633
|
try {
|
|
18114
18634
|
const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
18115
|
-
return
|
|
18635
|
+
return readFileSync18(join40(root2, "dist", "built-version"), "utf8").trim();
|
|
18116
18636
|
} catch {
|
|
18117
18637
|
return void 0;
|
|
18118
18638
|
}
|
|
@@ -18537,7 +19057,7 @@ async function writeFileContent(req, res) {
|
|
|
18537
19057
|
|
|
18538
19058
|
// src/shared/createBundleHandler.ts
|
|
18539
19059
|
import { createHash as createHash2 } from "crypto";
|
|
18540
|
-
import { readFileSync as
|
|
19060
|
+
import { readFileSync as readFileSync19, statSync as statSync10 } from "fs";
|
|
18541
19061
|
import { dirname as dirname19, join as join44 } from "path";
|
|
18542
19062
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
18543
19063
|
function createBundleHandler(importMetaUrl, bundlePath, contentType = "application/javascript") {
|
|
@@ -18546,7 +19066,7 @@ function createBundleHandler(importMetaUrl, bundlePath, contentType = "applicati
|
|
|
18546
19066
|
return (req, res) => {
|
|
18547
19067
|
const mtimeMs = statSync10(file).mtimeMs;
|
|
18548
19068
|
if (cache7?.mtimeMs !== mtimeMs) {
|
|
18549
|
-
const body =
|
|
19069
|
+
const body = readFileSync19(file);
|
|
18550
19070
|
const etag = `"${createHash2("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
18551
19071
|
cache7 = { body, etag, mtimeMs };
|
|
18552
19072
|
}
|
|
@@ -18569,7 +19089,7 @@ function createBundleHandler(importMetaUrl, bundlePath, contentType = "applicati
|
|
|
18569
19089
|
|
|
18570
19090
|
// src/commands/sessions/web/createCssHandler.ts
|
|
18571
19091
|
import { createHash as createHash3 } from "crypto";
|
|
18572
|
-
import { readFileSync as
|
|
19092
|
+
import { readFileSync as readFileSync20 } from "fs";
|
|
18573
19093
|
import { createRequire as createRequire2 } from "module";
|
|
18574
19094
|
var require3 = createRequire2(import.meta.url);
|
|
18575
19095
|
function createCssHandler(packageEntry) {
|
|
@@ -18577,7 +19097,7 @@ function createCssHandler(packageEntry) {
|
|
|
18577
19097
|
return (req, res) => {
|
|
18578
19098
|
if (!cache7) {
|
|
18579
19099
|
const resolved = require3.resolve(packageEntry);
|
|
18580
|
-
const body =
|
|
19100
|
+
const body = readFileSync20(resolved, "utf8");
|
|
18581
19101
|
const etag = `"${createHash3("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
18582
19102
|
cache7 = { body, etag };
|
|
18583
19103
|
}
|
|
@@ -18984,12 +19504,12 @@ function scheduleReconnect() {
|
|
|
18984
19504
|
}
|
|
18985
19505
|
|
|
18986
19506
|
// src/commands/sessions/web/updates/autoRestart/autoRestartAttempts.ts
|
|
18987
|
-
import { mkdirSync as mkdirSync11, readFileSync as
|
|
19507
|
+
import { mkdirSync as mkdirSync11, readFileSync as readFileSync21, writeFileSync as writeFileSync10 } from "fs";
|
|
18988
19508
|
import { dirname as dirname20, join as join45 } from "path";
|
|
18989
19509
|
var defaultPath = join45(daemonPaths.dir, "auto-restart-attempts.json");
|
|
18990
19510
|
function read(path128) {
|
|
18991
19511
|
try {
|
|
18992
|
-
return JSON.parse(
|
|
19512
|
+
return JSON.parse(readFileSync21(path128, "utf8"));
|
|
18993
19513
|
} catch {
|
|
18994
19514
|
return {};
|
|
18995
19515
|
}
|
|
@@ -19215,7 +19735,7 @@ function repoDirExists(cwd) {
|
|
|
19215
19735
|
}
|
|
19216
19736
|
|
|
19217
19737
|
// src/commands/sessions/daemon/worktree/git.ts
|
|
19218
|
-
import { execFile as execFile14, execFileSync as
|
|
19738
|
+
import { execFile as execFile14, execFileSync as execFileSync7 } from "child_process";
|
|
19219
19739
|
function isWindowsPath(cwd) {
|
|
19220
19740
|
return /^[A-Za-z]:[\\/]/.test(cwd);
|
|
19221
19741
|
}
|
|
@@ -19270,7 +19790,7 @@ function gitSyncResult(cwd, args) {
|
|
|
19270
19790
|
}
|
|
19271
19791
|
function gitSync(cwd, args) {
|
|
19272
19792
|
const { file, argv, options: options2 } = gitInvocation(cwd, args);
|
|
19273
|
-
return
|
|
19793
|
+
return execFileSync7(file, argv, {
|
|
19274
19794
|
...options2,
|
|
19275
19795
|
stdio: ["pipe", "pipe", "pipe"]
|
|
19276
19796
|
}).toString();
|
|
@@ -19729,12 +20249,12 @@ import * as path27 from "path";
|
|
|
19729
20249
|
import chalk22 from "chalk";
|
|
19730
20250
|
|
|
19731
20251
|
// src/commands/verify/addToKnipIgnoreBinaries.ts
|
|
19732
|
-
import { existsSync as existsSync36, readFileSync as
|
|
20252
|
+
import { existsSync as existsSync36, readFileSync as readFileSync22, writeFileSync as writeFileSync12 } from "fs";
|
|
19733
20253
|
import { join as join46 } from "path";
|
|
19734
20254
|
import chalk21 from "chalk";
|
|
19735
20255
|
function loadKnipConfig(knipJsonPath) {
|
|
19736
20256
|
if (existsSync36(knipJsonPath)) {
|
|
19737
|
-
return JSON.parse(
|
|
20257
|
+
return JSON.parse(readFileSync22(knipJsonPath, "utf8"));
|
|
19738
20258
|
}
|
|
19739
20259
|
return { $schema: "https://unpkg.com/knip@5/schema.json" };
|
|
19740
20260
|
}
|
|
@@ -19786,7 +20306,7 @@ import * as path29 from "path";
|
|
|
19786
20306
|
import chalk27 from "chalk";
|
|
19787
20307
|
|
|
19788
20308
|
// src/commands/format/init.ts
|
|
19789
|
-
import { existsSync as existsSync37, readFileSync as
|
|
20309
|
+
import { existsSync as existsSync37, readFileSync as readFileSync23, writeFileSync as writeFileSync13 } from "fs";
|
|
19790
20310
|
import chalk25 from "chalk";
|
|
19791
20311
|
|
|
19792
20312
|
// src/utils/printDiff.ts
|
|
@@ -19829,7 +20349,7 @@ async function init() {
|
|
|
19829
20349
|
const newContent = `${JSON.stringify(oxfmtrc_template_default, null, " ")}
|
|
19830
20350
|
`;
|
|
19831
20351
|
const configPath = ".oxfmtrc.json";
|
|
19832
|
-
const oldContent = existsSync37(configPath) ?
|
|
20352
|
+
const oldContent = existsSync37(configPath) ? readFileSync23(configPath, "utf8") : "";
|
|
19833
20353
|
if (oldContent === newContent) {
|
|
19834
20354
|
console.log(".oxfmtrc.json already has the baseline formatter config");
|
|
19835
20355
|
return;
|
|
@@ -19852,12 +20372,12 @@ async function init() {
|
|
|
19852
20372
|
}
|
|
19853
20373
|
|
|
19854
20374
|
// src/commands/lint/init.ts
|
|
19855
|
-
import { existsSync as existsSync40, readFileSync as
|
|
20375
|
+
import { existsSync as existsSync40, readFileSync as readFileSync25, writeFileSync as writeFileSync15 } from "fs";
|
|
19856
20376
|
import chalk26 from "chalk";
|
|
19857
20377
|
|
|
19858
20378
|
// src/shared/removeEslint.ts
|
|
19859
20379
|
import { execSync as execSync7 } from "child_process";
|
|
19860
|
-
import { existsSync as existsSync39, readFileSync as
|
|
20380
|
+
import { existsSync as existsSync39, readFileSync as readFileSync24, writeFileSync as writeFileSync14 } from "fs";
|
|
19861
20381
|
|
|
19862
20382
|
// src/shared/removeEslint/removeEslintConfigFiles.ts
|
|
19863
20383
|
import { existsSync as existsSync38, unlinkSync as unlinkSync3 } from "fs";
|
|
@@ -19901,7 +20421,7 @@ function removeEslintFromPackageJson(options2) {
|
|
|
19901
20421
|
if (!existsSync39(packageJsonPath)) {
|
|
19902
20422
|
return false;
|
|
19903
20423
|
}
|
|
19904
|
-
const packageJson = JSON.parse(
|
|
20424
|
+
const packageJson = JSON.parse(readFileSync24(packageJsonPath, "utf8"));
|
|
19905
20425
|
let modified = false;
|
|
19906
20426
|
modified = removeEslintDeps(packageJson.dependencies) || modified;
|
|
19907
20427
|
modified = removeEslintDeps(packageJson.devDependencies) || modified;
|
|
@@ -19965,7 +20485,7 @@ async function writeOxlintConfig() {
|
|
|
19965
20485
|
const newContent = `${JSON.stringify(oxlintrc_template_default, null, " ")}
|
|
19966
20486
|
`;
|
|
19967
20487
|
const configPath = ".oxlintrc.json";
|
|
19968
|
-
const oldContent = existsSync40(configPath) ?
|
|
20488
|
+
const oldContent = existsSync40(configPath) ? readFileSync25(configPath, "utf8") : "";
|
|
19969
20489
|
if (oldContent === newContent) {
|
|
19970
20490
|
console.log(".oxlintrc.json already has the baseline linter config");
|
|
19971
20491
|
return;
|
|
@@ -20087,7 +20607,7 @@ async function init3(options2 = {}) {
|
|
|
20087
20607
|
const setup = detectExistingSetup(pkg);
|
|
20088
20608
|
const selected = await promptForScripts(getAvailableOptions(setup));
|
|
20089
20609
|
if (!selected) return;
|
|
20090
|
-
const writer = options2.packageJson ? (name2, cmd,
|
|
20610
|
+
const writer = options2.packageJson ? (name2, cmd, opts2) => setupVerifyScript(packageJsonPath, name2, cmd, opts2) : setupVerifyRunEntry;
|
|
20091
20611
|
const handlers = getSetupHandlers(
|
|
20092
20612
|
setup.hasVite,
|
|
20093
20613
|
setup.hasTypescript,
|
|
@@ -20544,7 +21064,7 @@ function resolveEntries() {
|
|
|
20544
21064
|
}
|
|
20545
21065
|
|
|
20546
21066
|
// src/commands/verify/run/spawnCommand.ts
|
|
20547
|
-
import { spawn as
|
|
21067
|
+
import { spawn as spawn8 } from "child_process";
|
|
20548
21068
|
|
|
20549
21069
|
// src/lib/isAgentHarness.ts
|
|
20550
21070
|
function isAgentHarness() {
|
|
@@ -20561,7 +21081,7 @@ function shouldSuppress(quiet) {
|
|
|
20561
21081
|
return !!quiet || isAgentHarness();
|
|
20562
21082
|
}
|
|
20563
21083
|
function spawnCommand(fullCommand, cwd, env, quiet) {
|
|
20564
|
-
return
|
|
21084
|
+
return spawn8(fullCommand, [], {
|
|
20565
21085
|
stdio: shouldSuppress(quiet) ? "pipe" : "inherit",
|
|
20566
21086
|
shell: true,
|
|
20567
21087
|
cwd: cwd ?? process.cwd(),
|
|
@@ -20753,7 +21273,7 @@ async function newCli() {
|
|
|
20753
21273
|
|
|
20754
21274
|
// src/commands/new/registerNew/newProject.ts
|
|
20755
21275
|
import { execSync as execSync14 } from "child_process";
|
|
20756
|
-
import { existsSync as existsSync45, readFileSync as
|
|
21276
|
+
import { existsSync as existsSync45, readFileSync as readFileSync29, writeFileSync as writeFileSync22 } from "fs";
|
|
20757
21277
|
|
|
20758
21278
|
// src/commands/deploy/init.ts
|
|
20759
21279
|
import { execSync as execSync13 } from "child_process";
|
|
@@ -20761,7 +21281,7 @@ import chalk37 from "chalk";
|
|
|
20761
21281
|
import enquirer3 from "enquirer";
|
|
20762
21282
|
|
|
20763
21283
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
20764
|
-
import { existsSync as existsSync44, mkdirSync as mkdirSync14, readFileSync as
|
|
21284
|
+
import { existsSync as existsSync44, mkdirSync as mkdirSync14, readFileSync as readFileSync28, writeFileSync as writeFileSync21 } from "fs";
|
|
20765
21285
|
import { dirname as dirname28, join as join53 } from "path";
|
|
20766
21286
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
20767
21287
|
import chalk36 from "chalk";
|
|
@@ -20771,13 +21291,13 @@ function getExistingSiteId() {
|
|
|
20771
21291
|
if (!existsSync44(WORKFLOW_PATH)) {
|
|
20772
21292
|
return null;
|
|
20773
21293
|
}
|
|
20774
|
-
const content =
|
|
21294
|
+
const content = readFileSync28(WORKFLOW_PATH, "utf8");
|
|
20775
21295
|
const match = content.match(/-s\s+([a-f0-9-]{36})/);
|
|
20776
21296
|
return match ? match[1] : null;
|
|
20777
21297
|
}
|
|
20778
21298
|
function getTemplateContent(siteId) {
|
|
20779
21299
|
const templatePath = join53(__dirname3, "commands/deploy/build.yml");
|
|
20780
|
-
const template =
|
|
21300
|
+
const template = readFileSync28(templatePath, "utf8");
|
|
20781
21301
|
return template.replace("{{NETLIFY_SITE_ID}}", siteId);
|
|
20782
21302
|
}
|
|
20783
21303
|
async function updateWorkflow(siteId) {
|
|
@@ -20787,7 +21307,7 @@ async function updateWorkflow(siteId) {
|
|
|
20787
21307
|
mkdirSync14(workflowDir, { recursive: true });
|
|
20788
21308
|
}
|
|
20789
21309
|
if (existsSync44(WORKFLOW_PATH)) {
|
|
20790
|
-
const oldContent =
|
|
21310
|
+
const oldContent = readFileSync28(WORKFLOW_PATH, "utf8");
|
|
20791
21311
|
if (oldContent === newContent) {
|
|
20792
21312
|
console.log(chalk36.green("build.yml is already up to date"));
|
|
20793
21313
|
return;
|
|
@@ -20885,7 +21405,7 @@ function addViteBaseConfig() {
|
|
|
20885
21405
|
console.log("No vite.config.ts found, skipping base config");
|
|
20886
21406
|
return;
|
|
20887
21407
|
}
|
|
20888
|
-
const content =
|
|
21408
|
+
const content = readFileSync29(viteConfigPath, "utf8");
|
|
20889
21409
|
if (content.includes("base:")) {
|
|
20890
21410
|
console.log("vite.config.ts already has base config");
|
|
20891
21411
|
return;
|
|
@@ -20963,13 +21483,13 @@ function renderLineChart({
|
|
|
20963
21483
|
}
|
|
20964
21484
|
|
|
20965
21485
|
// src/commands/activity/fetchCommitsPerDay.ts
|
|
20966
|
-
import { execFileSync as
|
|
21486
|
+
import { execFileSync as execFileSync8 } from "child_process";
|
|
20967
21487
|
function fetchContributions(from, to) {
|
|
20968
|
-
const
|
|
21488
|
+
const query2 = `{ viewer { contributionsCollection(from: "${from}T00:00:00Z", to: "${to}T23:59:59Z") { contributionCalendar { weeks { contributionDays { date contributionCount } } } } } }`;
|
|
20969
21489
|
const jq = ".data.viewer.contributionsCollection.contributionCalendar.weeks[].contributionDays[]";
|
|
20970
|
-
const raw =
|
|
21490
|
+
const raw = execFileSync8(
|
|
20971
21491
|
"gh",
|
|
20972
|
-
["api", "graphql", "-f", `query=${
|
|
21492
|
+
["api", "graphql", "-f", `query=${query2}`, "--jq", jq],
|
|
20973
21493
|
{ encoding: "utf8" }
|
|
20974
21494
|
).trim();
|
|
20975
21495
|
if (!raw) return [];
|
|
@@ -21084,7 +21604,7 @@ function adviceContextFor(cwd, env = process.env) {
|
|
|
21084
21604
|
}
|
|
21085
21605
|
|
|
21086
21606
|
// src/commands/advise/loadAdviceFragments.ts
|
|
21087
|
-
import { readdirSync as readdirSync10, readFileSync as
|
|
21607
|
+
import { readdirSync as readdirSync10, readFileSync as readFileSync30 } from "fs";
|
|
21088
21608
|
import { basename as basename15, join as join55 } from "path";
|
|
21089
21609
|
|
|
21090
21610
|
// src/commands/advise/adviceDir.ts
|
|
@@ -21127,7 +21647,7 @@ function loadAdviceFragments(dir = adviceDir()) {
|
|
|
21127
21647
|
return readdirSync10(dir).filter((file) => file.endsWith(".md")).sort().map(
|
|
21128
21648
|
(file) => parseAdviceFragment(
|
|
21129
21649
|
basename15(file, ".md"),
|
|
21130
|
-
|
|
21650
|
+
readFileSync30(join55(dir, file), "utf8")
|
|
21131
21651
|
)
|
|
21132
21652
|
);
|
|
21133
21653
|
}
|
|
@@ -21828,7 +22348,7 @@ async function resolveCheckBump(check2) {
|
|
|
21828
22348
|
}
|
|
21829
22349
|
|
|
21830
22350
|
// src/commands/backlog/readJsonPayload.ts
|
|
21831
|
-
import { readFileSync as
|
|
22351
|
+
import { readFileSync as readFileSync31 } from "fs";
|
|
21832
22352
|
import chalk39 from "chalk";
|
|
21833
22353
|
function fail(message4) {
|
|
21834
22354
|
console.error(chalk39.red(message4));
|
|
@@ -21840,7 +22360,7 @@ function describe2(error) {
|
|
|
21840
22360
|
async function readSource(source) {
|
|
21841
22361
|
try {
|
|
21842
22362
|
if (source === "-") return (await readStdinBuffer()).toString("utf8");
|
|
21843
|
-
return
|
|
22363
|
+
return readFileSync31(source, "utf8");
|
|
21844
22364
|
} catch (error) {
|
|
21845
22365
|
return fail(
|
|
21846
22366
|
`Cannot read the payload from ${source === "-" ? "stdin" : source}: ${describe2(error)}`
|
|
@@ -22674,6 +23194,7 @@ function transcriptMessages(reader, lines) {
|
|
|
22674
23194
|
return [{ role: event.role, text: event.text }];
|
|
22675
23195
|
if (event.kind === "tool")
|
|
22676
23196
|
return [{ role: "tool", tool: event.tool, target: event.target }];
|
|
23197
|
+
if (event.kind === "interrupt") return [{ role: "interrupt" }];
|
|
22677
23198
|
return [];
|
|
22678
23199
|
});
|
|
22679
23200
|
}
|
|
@@ -23370,7 +23891,7 @@ function ensureRemoteOrigin() {
|
|
|
23370
23891
|
|
|
23371
23892
|
// src/commands/backlog/add/shared.ts
|
|
23372
23893
|
import { spawnSync as spawnSync7 } from "child_process";
|
|
23373
|
-
import { mkdtempSync, readFileSync as
|
|
23894
|
+
import { mkdtempSync, readFileSync as readFileSync32, unlinkSync as unlinkSync4, writeFileSync as writeFileSync23 } from "fs";
|
|
23374
23895
|
import { tmpdir as tmpdir2 } from "os";
|
|
23375
23896
|
import { join as join59 } from "path";
|
|
23376
23897
|
import enquirer4 from "enquirer";
|
|
@@ -23420,7 +23941,7 @@ function openEditor() {
|
|
|
23420
23941
|
unlinkSync4(filePath);
|
|
23421
23942
|
return void 0;
|
|
23422
23943
|
}
|
|
23423
|
-
const content =
|
|
23944
|
+
const content = readFileSync32(filePath, "utf8").trim();
|
|
23424
23945
|
unlinkSync4(filePath);
|
|
23425
23946
|
return content || void 0;
|
|
23426
23947
|
}
|
|
@@ -23855,11 +24376,11 @@ function startProposedRun(id, startOn, cwd = process.cwd()) {
|
|
|
23855
24376
|
import { randomUUID as randomUUID10 } from "crypto";
|
|
23856
24377
|
|
|
23857
24378
|
// src/commands/backlog/propose/mutateLedger.ts
|
|
23858
|
-
import { mkdirSync as mkdirSync15, readFileSync as
|
|
24379
|
+
import { mkdirSync as mkdirSync15, readFileSync as readFileSync33, renameSync as renameSync4, writeFileSync as writeFileSync24 } from "fs";
|
|
23859
24380
|
import { dirname as dirname30 } from "path";
|
|
23860
24381
|
function readLedger(path128) {
|
|
23861
24382
|
try {
|
|
23862
|
-
const parsed = JSON.parse(
|
|
24383
|
+
const parsed = JSON.parse(readFileSync33(path128, "utf8"));
|
|
23863
24384
|
return { open: parsed.open ?? [], created: parsed.created };
|
|
23864
24385
|
} catch {
|
|
23865
24386
|
return { open: [] };
|
|
@@ -24080,8 +24601,8 @@ async function createsCycle(orm, linkType, fromNum, toNum) {
|
|
|
24080
24601
|
);
|
|
24081
24602
|
return true;
|
|
24082
24603
|
}
|
|
24083
|
-
async function link(fromId, toId,
|
|
24084
|
-
const linkType = parseLinkType(
|
|
24604
|
+
async function link(fromId, toId, opts2) {
|
|
24605
|
+
const linkType = parseLinkType(opts2.type);
|
|
24085
24606
|
if (!linkType) return;
|
|
24086
24607
|
const fromNum = parseItemId(fromId);
|
|
24087
24608
|
const toNum = parseItemId(toId);
|
|
@@ -24396,7 +24917,7 @@ function hasLocalChanges() {
|
|
|
24396
24917
|
import {
|
|
24397
24918
|
existsSync as existsSync50,
|
|
24398
24919
|
mkdirSync as mkdirSync16,
|
|
24399
|
-
readFileSync as
|
|
24920
|
+
readFileSync as readFileSync35,
|
|
24400
24921
|
unlinkSync as unlinkSync5,
|
|
24401
24922
|
writeFileSync as writeFileSync25
|
|
24402
24923
|
} from "fs";
|
|
@@ -24410,11 +24931,11 @@ function bootedAt() {
|
|
|
24410
24931
|
}
|
|
24411
24932
|
|
|
24412
24933
|
// src/commands/backlog/processStartedAt.ts
|
|
24413
|
-
import { readFileSync as
|
|
24934
|
+
import { readFileSync as readFileSync34 } from "fs";
|
|
24414
24935
|
var clockTicksPerSecond = 100;
|
|
24415
24936
|
function processStartedAt(pid) {
|
|
24416
24937
|
try {
|
|
24417
|
-
const stat5 =
|
|
24938
|
+
const stat5 = readFileSync34(`/proc/${pid}/stat`, "utf8");
|
|
24418
24939
|
const fields = stat5.slice(stat5.lastIndexOf(")") + 2).split(" ");
|
|
24419
24940
|
const ticks = Number(fields[19]);
|
|
24420
24941
|
if (!Number.isFinite(ticks)) return void 0;
|
|
@@ -24454,7 +24975,7 @@ function foreignLockHolder(itemId2) {
|
|
|
24454
24975
|
const lockPath = getLockPath(itemId2);
|
|
24455
24976
|
if (!existsSync50(lockPath)) return null;
|
|
24456
24977
|
try {
|
|
24457
|
-
const lock2 = JSON.parse(
|
|
24978
|
+
const lock2 = JSON.parse(readFileSync35(lockPath, "utf8"));
|
|
24458
24979
|
if (typeof lock2.pid !== "number" || lock2.pid === process.pid) return null;
|
|
24459
24980
|
if (!isProcessAlive(lock2.pid)) return null;
|
|
24460
24981
|
if (isStaleLock(lock2.pid, lock2.timestamp)) return null;
|
|
@@ -25024,21 +25545,21 @@ function describeError(error) {
|
|
|
25024
25545
|
|
|
25025
25546
|
// src/commands/sessions/setSessionStatus.ts
|
|
25026
25547
|
var RELIABLE_ATTEMPTS = 3;
|
|
25027
|
-
async function setSessionStatus(status2,
|
|
25548
|
+
async function setSessionStatus(status2, opts2 = {}) {
|
|
25028
25549
|
const sessionId2 = process.env.ASSIST_SESSION_ID;
|
|
25029
|
-
logHookFired(status2, sessionId2,
|
|
25550
|
+
logHookFired(status2, sessionId2, opts2.source);
|
|
25030
25551
|
if (!sessionId2) return;
|
|
25031
25552
|
const payload = buildPayload(
|
|
25032
25553
|
sessionId2,
|
|
25033
25554
|
status2,
|
|
25034
|
-
|
|
25035
|
-
|
|
25555
|
+
opts2.source,
|
|
25556
|
+
opts2.readsClaudeHookInput === false ? void 0 : await readHookClaudeSessionId()
|
|
25036
25557
|
);
|
|
25037
25558
|
await deliverSetStatus(
|
|
25038
25559
|
sessionId2,
|
|
25039
25560
|
status2,
|
|
25040
25561
|
payload,
|
|
25041
|
-
|
|
25562
|
+
opts2.ack ? RELIABLE_ATTEMPTS : 1
|
|
25042
25563
|
);
|
|
25043
25564
|
}
|
|
25044
25565
|
function buildPayload(sessionId2, status2, source, claudeSessionId) {
|
|
@@ -25062,12 +25583,12 @@ function logHookFired(status2, sessionId2, source) {
|
|
|
25062
25583
|
import { existsSync as existsSync53, unwatchFile, watchFile } from "fs";
|
|
25063
25584
|
|
|
25064
25585
|
// src/commands/backlog/readSignal.ts
|
|
25065
|
-
import { existsSync as existsSync52, readFileSync as
|
|
25586
|
+
import { existsSync as existsSync52, readFileSync as readFileSync36 } from "fs";
|
|
25066
25587
|
function readSignal() {
|
|
25067
25588
|
const path128 = getSignalPath();
|
|
25068
25589
|
if (!path128 || !existsSync52(path128)) return void 0;
|
|
25069
25590
|
try {
|
|
25070
|
-
return JSON.parse(
|
|
25591
|
+
return JSON.parse(readFileSync36(path128, "utf8"));
|
|
25071
25592
|
} catch {
|
|
25072
25593
|
return void 0;
|
|
25073
25594
|
}
|
|
@@ -25254,13 +25775,13 @@ async function persistPhaseSessionId(itemId2, phaseIdx, claudeSessionId) {
|
|
|
25254
25775
|
}
|
|
25255
25776
|
|
|
25256
25777
|
// src/shared/emitActivity.ts
|
|
25257
|
-
import { mkdirSync as mkdirSync18, readFileSync as
|
|
25778
|
+
import { mkdirSync as mkdirSync18, readFileSync as readFileSync37, rmSync as rmSync4, writeFileSync as writeFileSync27 } from "fs";
|
|
25258
25779
|
import { homedir as homedir18 } from "os";
|
|
25259
25780
|
import { dirname as dirname31, join as join63 } from "path";
|
|
25260
25781
|
import { z as z19 } from "zod";
|
|
25261
25782
|
var activitySchema = z19.object({
|
|
25262
25783
|
kind: z19.enum(["command", "backlog"]),
|
|
25263
|
-
harness: z19.enum(
|
|
25784
|
+
harness: z19.enum(harnessKinds).optional(),
|
|
25264
25785
|
name: z19.string().optional(),
|
|
25265
25786
|
itemId: z19.number().optional(),
|
|
25266
25787
|
itemName: z19.string().optional(),
|
|
@@ -25285,7 +25806,7 @@ function emitActivity(activity2) {
|
|
|
25285
25806
|
}
|
|
25286
25807
|
function readActivity(path128) {
|
|
25287
25808
|
try {
|
|
25288
|
-
return JSON.parse(
|
|
25809
|
+
return JSON.parse(readFileSync37(path128, "utf8"));
|
|
25289
25810
|
} catch {
|
|
25290
25811
|
return void 0;
|
|
25291
25812
|
}
|
|
@@ -25639,7 +26160,7 @@ async function next(options2, startId) {
|
|
|
25639
26160
|
// src/commands/backlog/registerNextCommand.ts
|
|
25640
26161
|
function registerNextCommand(cmd) {
|
|
25641
26162
|
cmd.command("next").argument("[id]", "Backlog item ID to run first").description("Pick and run the next backlog item, or open /draft if none").option("-w, --write", "Run Claude with auto permission mode (default)").option("--no-write", "Run Claude without auto permission mode").option("--once", "Exit after the first completed item run").action(
|
|
25642
|
-
(id,
|
|
26163
|
+
(id, opts2) => next({ allowEdits: opts2.write !== false, once: opts2.once }, id)
|
|
25643
26164
|
);
|
|
25644
26165
|
}
|
|
25645
26166
|
|
|
@@ -25950,9 +26471,9 @@ function registerRefineCommand(cmd) {
|
|
|
25950
26471
|
"--harness <kind>",
|
|
25951
26472
|
"Coding harness to launch (claude|codex|pi); defaults to the configured harness.engine. Exits with the reasons, without launching, when Refine is unavailable on it"
|
|
25952
26473
|
).action(
|
|
25953
|
-
(id,
|
|
25954
|
-
once:
|
|
25955
|
-
harness: resolveHarness2(
|
|
26474
|
+
(id, opts2) => refine(id, {
|
|
26475
|
+
once: opts2.once,
|
|
26476
|
+
harness: resolveHarness2(opts2.harness)
|
|
25956
26477
|
})
|
|
25957
26478
|
);
|
|
25958
26479
|
}
|
|
@@ -25993,12 +26514,12 @@ function registerRefreshDocsCommand(cmd) {
|
|
|
25993
26514
|
|
|
25994
26515
|
// src/commands/backlog/rewindPhase.ts
|
|
25995
26516
|
import chalk93 from "chalk";
|
|
25996
|
-
async function rewindPhase(id, phase,
|
|
26517
|
+
async function rewindPhase(id, phase, opts2) {
|
|
25997
26518
|
const phaseNumber = Number.parseInt(phase, 10);
|
|
25998
26519
|
const found = await findOneItem(id);
|
|
25999
26520
|
if (!found) return;
|
|
26000
26521
|
const { orm, item } = found;
|
|
26001
|
-
const result = await rewindItemToPhase(orm, item, phaseNumber,
|
|
26522
|
+
const result = await rewindItemToPhase(orm, item, phaseNumber, opts2.reason);
|
|
26002
26523
|
if (!result.ok) {
|
|
26003
26524
|
console.log(chalk93.red(result.error));
|
|
26004
26525
|
process.exitCode = 1;
|
|
@@ -26036,14 +26557,14 @@ function registerRunCommand(cmd) {
|
|
|
26036
26557
|
"--resume-session <id>",
|
|
26037
26558
|
"Resume an interrupted Claude session for the current phase (used by the sessions daemon on restart)"
|
|
26038
26559
|
).action(
|
|
26039
|
-
async (id,
|
|
26040
|
-
if (!
|
|
26041
|
-
const harness = resolveHarness2(
|
|
26560
|
+
async (id, opts2) => {
|
|
26561
|
+
if (!opts2.resumeSession) await pullIfConfigured();
|
|
26562
|
+
const harness = resolveHarness2(opts2.harness, "run");
|
|
26042
26563
|
await run3(id, {
|
|
26043
|
-
allowEdits:
|
|
26564
|
+
allowEdits: opts2.write !== false,
|
|
26044
26565
|
harness,
|
|
26045
|
-
model: resolveModel(
|
|
26046
|
-
resumeSessionId:
|
|
26566
|
+
model: resolveModel(opts2.model, "run", harness),
|
|
26567
|
+
resumeSessionId: opts2.resumeSession
|
|
26047
26568
|
});
|
|
26048
26569
|
}
|
|
26049
26570
|
);
|
|
@@ -26052,15 +26573,15 @@ function registerRunCommand(cmd) {
|
|
|
26052
26573
|
|
|
26053
26574
|
// src/commands/backlog/search.ts
|
|
26054
26575
|
import chalk94 from "chalk";
|
|
26055
|
-
async function search(
|
|
26056
|
-
const items3 = await searchBacklog(
|
|
26576
|
+
async function search(query2) {
|
|
26577
|
+
const items3 = await searchBacklog(query2);
|
|
26057
26578
|
if (items3.length === 0) {
|
|
26058
|
-
console.log(chalk94.dim(`No items matching "${
|
|
26579
|
+
console.log(chalk94.dim(`No items matching "${query2}".`));
|
|
26059
26580
|
return;
|
|
26060
26581
|
}
|
|
26061
26582
|
console.log(
|
|
26062
26583
|
chalk94.dim(
|
|
26063
|
-
`${items3.length} item${items3.length === 1 ? "" : "s"} matching "${
|
|
26584
|
+
`${items3.length} item${items3.length === 1 ? "" : "s"} matching "${query2}":
|
|
26064
26585
|
`
|
|
26065
26586
|
)
|
|
26066
26587
|
);
|
|
@@ -27666,7 +28187,7 @@ function stripEnvPrefix(parts2) {
|
|
|
27666
28187
|
}
|
|
27667
28188
|
|
|
27668
28189
|
// src/commands/cliHook/isGhGraphqlIssueMutation.ts
|
|
27669
|
-
import { readFileSync as
|
|
28190
|
+
import { readFileSync as readFileSync38 } from "fs";
|
|
27670
28191
|
var ISSUE_MUTATION = /\bmutation\b[\s\S]*(?:issue|comment|review|label|assign|reaction|milestone)/i;
|
|
27671
28192
|
var FILE_REFERENCE = /(?:=@|--input[\s=]+)["']?([^\s"';&|)]+)/g;
|
|
27672
28193
|
function isGhGraphqlIssueMutation(command) {
|
|
@@ -27678,7 +28199,7 @@ function isGhGraphqlIssueMutation(command) {
|
|
|
27678
28199
|
}
|
|
27679
28200
|
function readOrEmpty(path128) {
|
|
27680
28201
|
try {
|
|
27681
|
-
return
|
|
28202
|
+
return readFileSync38(path128, "utf8");
|
|
27682
28203
|
} catch {
|
|
27683
28204
|
return "";
|
|
27684
28205
|
}
|
|
@@ -28033,7 +28554,7 @@ function extractGraphqlQuery(args) {
|
|
|
28033
28554
|
}
|
|
28034
28555
|
|
|
28035
28556
|
// src/shared/loadCliReads.ts
|
|
28036
|
-
import { existsSync as existsSync55, readFileSync as
|
|
28557
|
+
import { existsSync as existsSync55, readFileSync as readFileSync39, writeFileSync as writeFileSync28 } from "fs";
|
|
28037
28558
|
import { dirname as dirname32, resolve as resolve18 } from "path";
|
|
28038
28559
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
28039
28560
|
var __filename3 = fileURLToPath6(import.meta.url);
|
|
@@ -28043,7 +28564,7 @@ function packageRoot() {
|
|
|
28043
28564
|
}
|
|
28044
28565
|
function readLines(path128) {
|
|
28045
28566
|
if (!existsSync55(path128)) return [];
|
|
28046
|
-
return
|
|
28567
|
+
return readFileSync39(path128, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
28047
28568
|
}
|
|
28048
28569
|
var cachedReads;
|
|
28049
28570
|
var cachedWrites;
|
|
@@ -28089,7 +28610,7 @@ function findCliWrite(command) {
|
|
|
28089
28610
|
}
|
|
28090
28611
|
|
|
28091
28612
|
// src/shared/readSettingsPerms.ts
|
|
28092
|
-
import { existsSync as existsSync56, readFileSync as
|
|
28613
|
+
import { existsSync as existsSync56, readFileSync as readFileSync40 } from "fs";
|
|
28093
28614
|
import { homedir as homedir19 } from "os";
|
|
28094
28615
|
import { join as join64 } from "path";
|
|
28095
28616
|
function readSettingsPerms(key) {
|
|
@@ -28110,7 +28631,7 @@ function readSettingsPerms(key) {
|
|
|
28110
28631
|
function readPermissionArray(filePath, key) {
|
|
28111
28632
|
if (!existsSync56(filePath)) return [];
|
|
28112
28633
|
try {
|
|
28113
|
-
const data = JSON.parse(
|
|
28634
|
+
const data = JSON.parse(readFileSync40(filePath, "utf8"));
|
|
28114
28635
|
const arr = data?.permissions?.[key];
|
|
28115
28636
|
return Array.isArray(arr) ? arr.filter((e) => typeof e === "string") : [];
|
|
28116
28637
|
} catch {
|
|
@@ -28380,14 +28901,14 @@ function findDocsPathDeny(toolName, rawCommand, root2) {
|
|
|
28380
28901
|
}
|
|
28381
28902
|
|
|
28382
28903
|
// src/commands/schema/isSchemaPath.ts
|
|
28383
|
-
import { readFileSync as
|
|
28904
|
+
import { readFileSync as readFileSync41 } from "fs";
|
|
28384
28905
|
import { relative as relative8, resolve as resolve21 } from "path";
|
|
28385
28906
|
var SCHEMA_LOCK_REASON = "Database schema files (src/shared/db/migrations/migrationNNNN*.ts, src/shared/db/migrations.ts, src/shared/db/schema.ts and any src/shared/db/*.ts that defines a pgTable) are locked: a schema change needs the user's sign-off (see src/shared/db/CLAUDE.md). Confirm the schema change with the user first, then run `assist schema unlock` to request a PIN and wait for the user to confirm it with `assist schema confirm <pin>` before retrying. In a backlog item session the unlock lasts for the current phase on this harness; otherwise it lasts for this conversation only.";
|
|
28386
28907
|
var FIXED_SCHEMA_PATH = /^src\/shared\/db\/(?:migrations\/migration\d{4}[^/]*\.ts|migrations\.ts|schema\.ts)$/;
|
|
28387
28908
|
var DB_MODULE = /^src\/shared\/db\/[^/]+\.ts$/;
|
|
28388
28909
|
function readOrEmpty2(path128) {
|
|
28389
28910
|
try {
|
|
28390
|
-
return
|
|
28911
|
+
return readFileSync41(path128, "utf8");
|
|
28391
28912
|
} catch {
|
|
28392
28913
|
return "";
|
|
28393
28914
|
}
|
|
@@ -28462,7 +28983,7 @@ async function decideDocsGuard({
|
|
|
28462
28983
|
}
|
|
28463
28984
|
|
|
28464
28985
|
// src/commands/schema/isSchemaLocked.ts
|
|
28465
|
-
import { existsSync as existsSync57, readFileSync as
|
|
28986
|
+
import { existsSync as existsSync57, readFileSync as readFileSync42 } from "fs";
|
|
28466
28987
|
|
|
28467
28988
|
// src/commands/schema/getSchemaSessionApprovalPath.ts
|
|
28468
28989
|
import { join as join66 } from "path";
|
|
@@ -28494,7 +29015,7 @@ function getSchemaSessionApprovalPath(scope) {
|
|
|
28494
29015
|
function approvalMatches(path128, identity) {
|
|
28495
29016
|
try {
|
|
28496
29017
|
const approval = JSON.parse(
|
|
28497
|
-
|
|
29018
|
+
readFileSync42(path128, "utf8")
|
|
28498
29019
|
);
|
|
28499
29020
|
const conversation = approval.conversationId ?? approval.claudeSessionId;
|
|
28500
29021
|
if (approval.harness !== void 0 && approval.harness !== identity.harness)
|
|
@@ -28709,7 +29230,7 @@ ${reasons.join("\n")}`);
|
|
|
28709
29230
|
}
|
|
28710
29231
|
|
|
28711
29232
|
// src/commands/permitCliReads.ts
|
|
28712
|
-
import { existsSync as existsSync58, mkdirSync as mkdirSync20, readFileSync as
|
|
29233
|
+
import { existsSync as existsSync58, mkdirSync as mkdirSync20, readFileSync as readFileSync43, writeFileSync as writeFileSync29 } from "fs";
|
|
28713
29234
|
import { homedir as homedir22 } from "os";
|
|
28714
29235
|
import { join as join68 } from "path";
|
|
28715
29236
|
|
|
@@ -28979,7 +29500,7 @@ function logPath(cli) {
|
|
|
28979
29500
|
function readCache(cli) {
|
|
28980
29501
|
const path128 = logPath(cli);
|
|
28981
29502
|
if (!existsSync58(path128)) return void 0;
|
|
28982
|
-
return
|
|
29503
|
+
return readFileSync43(path128, "utf8");
|
|
28983
29504
|
}
|
|
28984
29505
|
function writeCache(cli, output) {
|
|
28985
29506
|
const dir = join68(homedir22(), ".assist");
|
|
@@ -29114,7 +29635,7 @@ function registerCliHook(program) {
|
|
|
29114
29635
|
}
|
|
29115
29636
|
|
|
29116
29637
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
29117
|
-
import { existsSync as existsSync60, readFileSync as
|
|
29638
|
+
import { existsSync as existsSync60, readFileSync as readFileSync45, unlinkSync as unlinkSync9, writeFileSync as writeFileSync30 } from "fs";
|
|
29118
29639
|
import chalk125 from "chalk";
|
|
29119
29640
|
|
|
29120
29641
|
// src/shared/isHashCommentFile.ts
|
|
@@ -29169,12 +29690,12 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
29169
29690
|
}
|
|
29170
29691
|
|
|
29171
29692
|
// src/commands/codeComment/readPinState.ts
|
|
29172
|
-
import { existsSync as existsSync59, readFileSync as
|
|
29693
|
+
import { existsSync as existsSync59, readFileSync as readFileSync44 } from "fs";
|
|
29173
29694
|
function readPinState(pin2) {
|
|
29174
29695
|
const path128 = getPinStatePath(pin2);
|
|
29175
29696
|
if (!existsSync59(path128)) return void 0;
|
|
29176
29697
|
try {
|
|
29177
|
-
const state = JSON.parse(
|
|
29698
|
+
const state = JSON.parse(readFileSync44(path128, "utf8"));
|
|
29178
29699
|
if (state.pin !== pin2) return void 0;
|
|
29179
29700
|
return state;
|
|
29180
29701
|
} catch {
|
|
@@ -29196,7 +29717,7 @@ function codeCommentConfirm(pin2) {
|
|
|
29196
29717
|
process.exitCode = 1;
|
|
29197
29718
|
return;
|
|
29198
29719
|
}
|
|
29199
|
-
const original =
|
|
29720
|
+
const original = readFileSync45(state.file, "utf8");
|
|
29200
29721
|
const lines = original.split("\n");
|
|
29201
29722
|
const index3 = state.line - 1;
|
|
29202
29723
|
if (index3 > lines.length) {
|
|
@@ -29260,7 +29781,7 @@ import { randomUUID as randomUUID14 } from "crypto";
|
|
|
29260
29781
|
import notifier from "node-notifier";
|
|
29261
29782
|
|
|
29262
29783
|
// src/commands/notify/showNotification/showWindowsNotificationFromWsl.ts
|
|
29263
|
-
import { spawn as
|
|
29784
|
+
import { spawn as spawn9 } from "child_process";
|
|
29264
29785
|
import fs26 from "fs";
|
|
29265
29786
|
import { createRequire as createRequire3 } from "module";
|
|
29266
29787
|
import path40 from "path";
|
|
@@ -29280,7 +29801,7 @@ function showWindowsNotificationFromWsl(options2) {
|
|
|
29280
29801
|
if (sound) {
|
|
29281
29802
|
args.push("-s", "ms-winsoundevent:Notification.Default");
|
|
29282
29803
|
}
|
|
29283
|
-
const child2 =
|
|
29804
|
+
const child2 = spawn9(snoreToastPath, args, {
|
|
29284
29805
|
detached: true,
|
|
29285
29806
|
stdio: "ignore"
|
|
29286
29807
|
});
|
|
@@ -29580,7 +30101,7 @@ async function listCodexHooks(server, cwd) {
|
|
|
29580
30101
|
}
|
|
29581
30102
|
|
|
29582
30103
|
// src/commands/sync/openCodexAppServer.ts
|
|
29583
|
-
import { spawn as
|
|
30104
|
+
import { spawn as spawn10 } from "child_process";
|
|
29584
30105
|
import { createInterface as createInterface6 } from "readline";
|
|
29585
30106
|
|
|
29586
30107
|
// src/commands/sync/createCodexRpcClient.ts
|
|
@@ -29653,7 +30174,7 @@ function watchCodexAppServer(child2, fail14) {
|
|
|
29653
30174
|
// src/commands/sync/openCodexAppServer.ts
|
|
29654
30175
|
var TIMEOUT_MS3 = 2e4;
|
|
29655
30176
|
async function openCodexAppServer(homeDir) {
|
|
29656
|
-
const child2 =
|
|
30177
|
+
const child2 = spawn10(harnesses.codex.command, ["app-server"], {
|
|
29657
30178
|
env: { ...process.env, CODEX_HOME: homeDir },
|
|
29658
30179
|
stdio: ["pipe", "pipe", "pipe"]
|
|
29659
30180
|
});
|
|
@@ -31595,8 +32116,8 @@ function registerConfig(program) {
|
|
|
31595
32116
|
import chalk153 from "chalk";
|
|
31596
32117
|
|
|
31597
32118
|
// src/commands/browser/formatInspectMatches.ts
|
|
31598
|
-
function formatInspectMatches({ matches, total: total2 },
|
|
31599
|
-
if (total2 === 0) return [`no elements match ${
|
|
32119
|
+
function formatInspectMatches({ matches, total: total2 }, query2) {
|
|
32120
|
+
if (total2 === 0) return [`no elements match ${query2}`];
|
|
31600
32121
|
const lines = matches.flatMap((match, index3) => [
|
|
31601
32122
|
`[${index3 + 1}/${total2}] ${match.width}\xD7${match.height} ${JSON.stringify(match.text)}`,
|
|
31602
32123
|
...match.chain.map((step3) => ` ${step3}`)
|
|
@@ -31665,18 +32186,18 @@ async function browserInspect(selector, options2) {
|
|
|
31665
32186
|
);
|
|
31666
32187
|
process.exit(1);
|
|
31667
32188
|
}
|
|
31668
|
-
const
|
|
32189
|
+
const query2 = options2.text ? { text: options2.text } : { selector };
|
|
31669
32190
|
const result = await requestTab(options2.server, {
|
|
31670
32191
|
op: "inspect",
|
|
31671
32192
|
url: options2.url,
|
|
31672
|
-
...
|
|
32193
|
+
...query2
|
|
31673
32194
|
});
|
|
31674
32195
|
const label = options2.text ? `text ${JSON.stringify(options2.text)}` : `selector ${selector}`;
|
|
31675
32196
|
for (const line of formatInspectMatches(result, label)) console.log(line);
|
|
31676
32197
|
}
|
|
31677
32198
|
|
|
31678
32199
|
// src/commands/browser/browserRun.ts
|
|
31679
|
-
import { readFileSync as
|
|
32200
|
+
import { readFileSync as readFileSync47 } from "fs";
|
|
31680
32201
|
import chalk154 from "chalk";
|
|
31681
32202
|
|
|
31682
32203
|
// src/commands/browser/formatRunOutcome.ts
|
|
@@ -31696,7 +32217,7 @@ function formatRunOutcome(run5) {
|
|
|
31696
32217
|
async function browserRun(options2) {
|
|
31697
32218
|
let code;
|
|
31698
32219
|
try {
|
|
31699
|
-
code =
|
|
32220
|
+
code = readFileSync47(options2.file, "utf8");
|
|
31700
32221
|
} catch (error) {
|
|
31701
32222
|
console.error(
|
|
31702
32223
|
chalk154.red(
|
|
@@ -32247,7 +32768,7 @@ function registerDb(program) {
|
|
|
32247
32768
|
}
|
|
32248
32769
|
|
|
32249
32770
|
// src/commands/deploy/redirect.ts
|
|
32250
|
-
import { existsSync as existsSync64, readFileSync as
|
|
32771
|
+
import { existsSync as existsSync64, readFileSync as readFileSync48, writeFileSync as writeFileSync33 } from "fs";
|
|
32251
32772
|
import chalk162 from "chalk";
|
|
32252
32773
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
32253
32774
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -32260,7 +32781,7 @@ function redirect() {
|
|
|
32260
32781
|
console.log(chalk162.yellow("No index.html found"));
|
|
32261
32782
|
return;
|
|
32262
32783
|
}
|
|
32263
|
-
const content =
|
|
32784
|
+
const content = readFileSync48(indexPath, "utf8");
|
|
32264
32785
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
32265
32786
|
console.log(chalk162.dim("Trailing slash script already present"));
|
|
32266
32787
|
return;
|
|
@@ -32351,7 +32872,7 @@ function printWeekHeader(week, state) {
|
|
|
32351
32872
|
}
|
|
32352
32873
|
|
|
32353
32874
|
// src/commands/devlog/loadDevEntry.ts
|
|
32354
|
-
import { readFileSync as
|
|
32875
|
+
import { readFileSync as readFileSync49 } from "fs";
|
|
32355
32876
|
import { parse as parseYaml3 } from "yaml";
|
|
32356
32877
|
|
|
32357
32878
|
// src/commands/devlog/devEntryPath.ts
|
|
@@ -32366,7 +32887,7 @@ function asString(value) {
|
|
|
32366
32887
|
}
|
|
32367
32888
|
function readFrontmatter(path128) {
|
|
32368
32889
|
try {
|
|
32369
|
-
const match =
|
|
32890
|
+
const match = readFileSync49(path128, "utf8").match(/^---\n([\s\S]*?)\n---/);
|
|
32370
32891
|
return match ? parseYaml3(match[1]) ?? {} : null;
|
|
32371
32892
|
} catch {
|
|
32372
32893
|
return null;
|
|
@@ -32404,7 +32925,7 @@ function resolveDevDir() {
|
|
|
32404
32925
|
}
|
|
32405
32926
|
|
|
32406
32927
|
// src/commands/devlog/next/fetchCommitsAfter.ts
|
|
32407
|
-
import { execFileSync as
|
|
32928
|
+
import { execFileSync as execFileSync9 } from "child_process";
|
|
32408
32929
|
var RECORD_SEPARATOR = "";
|
|
32409
32930
|
function parseRecord(record3) {
|
|
32410
32931
|
const [header, ...fileLines] = record3.trim().split("\n");
|
|
@@ -32434,7 +32955,7 @@ function parseNameOnlyLog(output, ignore3, afterDate) {
|
|
|
32434
32955
|
}
|
|
32435
32956
|
function fetchCommitsAfter(ignore3, afterDate) {
|
|
32436
32957
|
const range = afterDate ? [`--since=${afterDate}T00:00:00`] : [];
|
|
32437
|
-
const output =
|
|
32958
|
+
const output = execFileSync9(
|
|
32438
32959
|
"git",
|
|
32439
32960
|
[
|
|
32440
32961
|
"log",
|
|
@@ -32469,7 +32990,7 @@ function findTargetWeek(weeks, { lastWeek, skip: skip3, today }) {
|
|
|
32469
32990
|
import chalk165 from "chalk";
|
|
32470
32991
|
|
|
32471
32992
|
// src/shared/getRepoName.ts
|
|
32472
|
-
import { existsSync as existsSync65, readFileSync as
|
|
32993
|
+
import { existsSync as existsSync65, readFileSync as readFileSync50 } from "fs";
|
|
32473
32994
|
import { basename as basename19, join as join80 } from "path";
|
|
32474
32995
|
function getRepoName() {
|
|
32475
32996
|
const config = loadConfig();
|
|
@@ -32479,7 +33000,7 @@ function getRepoName() {
|
|
|
32479
33000
|
const packageJsonPath = join80(process.cwd(), "package.json");
|
|
32480
33001
|
if (existsSync65(packageJsonPath)) {
|
|
32481
33002
|
try {
|
|
32482
|
-
const content =
|
|
33003
|
+
const content = readFileSync50(packageJsonPath, "utf8");
|
|
32483
33004
|
const pkg = JSON.parse(content);
|
|
32484
33005
|
if (pkg.name) {
|
|
32485
33006
|
return pkg.name;
|
|
@@ -32576,7 +33097,7 @@ function loadDevWeeks(repoName, devDir) {
|
|
|
32576
33097
|
import chalk168 from "chalk";
|
|
32577
33098
|
|
|
32578
33099
|
// src/commands/devlog/resolveVersionSource.ts
|
|
32579
|
-
import { execFileSync as
|
|
33100
|
+
import { execFileSync as execFileSync10 } from "child_process";
|
|
32580
33101
|
|
|
32581
33102
|
// src/commands/devlog/sortedSemverVersions.ts
|
|
32582
33103
|
import semver2 from "semver";
|
|
@@ -32629,7 +33150,7 @@ function stripToMinor(version2) {
|
|
|
32629
33150
|
|
|
32630
33151
|
// src/commands/devlog/resolveVersionSource.ts
|
|
32631
33152
|
function gitTags(...args) {
|
|
32632
|
-
return
|
|
33153
|
+
return execFileSync10("git", ["tag", "--list", ...args], { encoding: "utf8" }).split("\n").map((t) => t.trim()).filter(Boolean);
|
|
32633
33154
|
}
|
|
32634
33155
|
function resolveVersionSource() {
|
|
32635
33156
|
const headVersion = getVersionAtCommit("HEAD");
|
|
@@ -32649,9 +33170,9 @@ function resolveVersionSource() {
|
|
|
32649
33170
|
}
|
|
32650
33171
|
|
|
32651
33172
|
// src/commands/devlog/next/repoHasTags.ts
|
|
32652
|
-
import { execFileSync as
|
|
33173
|
+
import { execFileSync as execFileSync11 } from "child_process";
|
|
32653
33174
|
function repoHasTags() {
|
|
32654
|
-
const output =
|
|
33175
|
+
const output = execFileSync11("git", ["tag", "--list"], { encoding: "utf8" });
|
|
32655
33176
|
return output.trim().length > 0;
|
|
32656
33177
|
}
|
|
32657
33178
|
|
|
@@ -32750,7 +33271,7 @@ function next2(options2) {
|
|
|
32750
33271
|
}
|
|
32751
33272
|
|
|
32752
33273
|
// src/commands/devlog/posted/posted.ts
|
|
32753
|
-
import { readFileSync as
|
|
33274
|
+
import { readFileSync as readFileSync51, writeFileSync as writeFileSync34 } from "fs";
|
|
32754
33275
|
import chalk169 from "chalk";
|
|
32755
33276
|
|
|
32756
33277
|
// src/commands/devlog/posted/setFrontmatterSlack.ts
|
|
@@ -32772,7 +33293,7 @@ function fail7(message4) {
|
|
|
32772
33293
|
}
|
|
32773
33294
|
function readEntry(path128) {
|
|
32774
33295
|
try {
|
|
32775
|
-
return
|
|
33296
|
+
return readFileSync51(path128, "utf8");
|
|
32776
33297
|
} catch {
|
|
32777
33298
|
fail7(`No dev entry at ${path128}`);
|
|
32778
33299
|
}
|
|
@@ -32844,12 +33365,12 @@ import { mkdirSync as mkdirSync24, writeFileSync as writeFileSync36 } from "fs";
|
|
|
32844
33365
|
import { mkdirSync as mkdirSync23, writeFileSync as writeFileSync35 } from "fs";
|
|
32845
33366
|
|
|
32846
33367
|
// src/commands/slack/readSlackParts.ts
|
|
32847
|
-
import { readFileSync as
|
|
33368
|
+
import { readFileSync as readFileSync52 } from "fs";
|
|
32848
33369
|
function readSlackParts(files) {
|
|
32849
33370
|
return files.map((file) => {
|
|
32850
33371
|
let contents;
|
|
32851
33372
|
try {
|
|
32852
|
-
contents =
|
|
33373
|
+
contents = readFileSync52(file, "utf8");
|
|
32853
33374
|
} catch {
|
|
32854
33375
|
console.error(`Error: Part file not found: ${file}`);
|
|
32855
33376
|
process.exit(1);
|
|
@@ -32980,13 +33501,13 @@ function devlogSlackChannel() {
|
|
|
32980
33501
|
}
|
|
32981
33502
|
|
|
32982
33503
|
// src/commands/devlog/slack/readDevEntryFile.ts
|
|
32983
|
-
import { readFileSync as
|
|
33504
|
+
import { readFileSync as readFileSync53 } from "fs";
|
|
32984
33505
|
import { parse as parseYaml4 } from "yaml";
|
|
32985
33506
|
var FRONTMATTER2 = /^---\n([\s\S]*?)\n---\n?([\s\S]*)$/;
|
|
32986
33507
|
function readDevEntryFile(path128) {
|
|
32987
33508
|
let contents;
|
|
32988
33509
|
try {
|
|
32989
|
-
contents =
|
|
33510
|
+
contents = readFileSync53(path128, "utf8");
|
|
32990
33511
|
} catch {
|
|
32991
33512
|
return null;
|
|
32992
33513
|
}
|
|
@@ -33440,7 +33961,7 @@ function getDocsUnlockPinPath(pin2) {
|
|
|
33440
33961
|
}
|
|
33441
33962
|
|
|
33442
33963
|
// src/commands/docs/readDocsUnlockPinState.ts
|
|
33443
|
-
import { existsSync as existsSync66, readFileSync as
|
|
33964
|
+
import { existsSync as existsSync66, readFileSync as readFileSync54 } from "fs";
|
|
33444
33965
|
function isPositiveInteger(value) {
|
|
33445
33966
|
return Number.isInteger(value) && value > 0;
|
|
33446
33967
|
}
|
|
@@ -33448,7 +33969,7 @@ function readDocsUnlockPinState(pin2) {
|
|
|
33448
33969
|
const path128 = getDocsUnlockPinPath(pin2);
|
|
33449
33970
|
if (!existsSync66(path128)) return void 0;
|
|
33450
33971
|
try {
|
|
33451
|
-
const state = JSON.parse(
|
|
33972
|
+
const state = JSON.parse(readFileSync54(path128, "utf8"));
|
|
33452
33973
|
if (state.pin !== pin2) return void 0;
|
|
33453
33974
|
if (!isPositiveInteger(state.itemId)) return void 0;
|
|
33454
33975
|
if (!isPositiveInteger(state.phase)) return void 0;
|
|
@@ -33630,7 +34151,7 @@ function getSchemaUnlockPinPath(pin2) {
|
|
|
33630
34151
|
}
|
|
33631
34152
|
|
|
33632
34153
|
// src/commands/schema/readSchemaUnlockPinState.ts
|
|
33633
|
-
import { existsSync as existsSync67, readFileSync as
|
|
34154
|
+
import { existsSync as existsSync67, readFileSync as readFileSync55 } from "fs";
|
|
33634
34155
|
function isPositiveInteger2(value) {
|
|
33635
34156
|
return Number.isInteger(value) && value > 0;
|
|
33636
34157
|
}
|
|
@@ -33657,7 +34178,7 @@ function readSchemaUnlockPinState(pin2) {
|
|
|
33657
34178
|
const path128 = getSchemaUnlockPinPath(pin2);
|
|
33658
34179
|
if (!existsSync67(path128)) return void 0;
|
|
33659
34180
|
try {
|
|
33660
|
-
const raw = JSON.parse(
|
|
34181
|
+
const raw = JSON.parse(readFileSync55(path128, "utf8"));
|
|
33661
34182
|
if (raw.pin !== pin2) return void 0;
|
|
33662
34183
|
return toState(raw);
|
|
33663
34184
|
} catch {
|
|
@@ -33844,11 +34365,11 @@ async function checkBuildLocksCommand() {
|
|
|
33844
34365
|
}
|
|
33845
34366
|
|
|
33846
34367
|
// src/commands/dotnet/buildTree.ts
|
|
33847
|
-
import { readFileSync as
|
|
34368
|
+
import { readFileSync as readFileSync56 } from "fs";
|
|
33848
34369
|
import path48 from "path";
|
|
33849
34370
|
var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
|
|
33850
34371
|
function getProjectRefs(csprojPath) {
|
|
33851
|
-
const content =
|
|
34372
|
+
const content = readFileSync56(csprojPath, "utf8");
|
|
33852
34373
|
const refs = [];
|
|
33853
34374
|
for (const match of content.matchAll(PROJECT_REF_RE)) {
|
|
33854
34375
|
refs.push(match[1].replace(/\\/g, "/"));
|
|
@@ -33865,7 +34386,7 @@ function buildTree(csprojPath, repoRoot3, visited = /* @__PURE__ */ new Set()) {
|
|
|
33865
34386
|
for (const ref of getProjectRefs(abs)) {
|
|
33866
34387
|
const childAbs = path48.resolve(dir, ref);
|
|
33867
34388
|
try {
|
|
33868
|
-
|
|
34389
|
+
readFileSync56(childAbs);
|
|
33869
34390
|
node.children.push(buildTree(childAbs, repoRoot3, visited));
|
|
33870
34391
|
} catch {
|
|
33871
34392
|
node.children.push({
|
|
@@ -33890,7 +34411,7 @@ function collectAllDeps(node) {
|
|
|
33890
34411
|
}
|
|
33891
34412
|
|
|
33892
34413
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
33893
|
-
import { readdirSync as readdirSync15, readFileSync as
|
|
34414
|
+
import { readdirSync as readdirSync15, readFileSync as readFileSync57, statSync as statSync12 } from "fs";
|
|
33894
34415
|
import path49 from "path";
|
|
33895
34416
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
33896
34417
|
if (depth > maxDepth) return [];
|
|
@@ -33925,7 +34446,7 @@ function findContainingSolutions(csprojPath, repoRoot3) {
|
|
|
33925
34446
|
const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
|
|
33926
34447
|
for (const sln of slnFiles) {
|
|
33927
34448
|
try {
|
|
33928
|
-
const content =
|
|
34449
|
+
const content = readFileSync57(sln, "utf8");
|
|
33929
34450
|
if (pattern2.test(content)) {
|
|
33930
34451
|
matches.push(path49.relative(repoRoot3, sln));
|
|
33931
34452
|
}
|
|
@@ -34243,7 +34764,7 @@ function parseInspectReport(json) {
|
|
|
34243
34764
|
|
|
34244
34765
|
// src/commands/dotnet/runInspectCode.ts
|
|
34245
34766
|
import { execSync as execSync40 } from "child_process";
|
|
34246
|
-
import { existsSync as existsSync70, readFileSync as
|
|
34767
|
+
import { existsSync as existsSync70, readFileSync as readFileSync58, unlinkSync as unlinkSync13 } from "fs";
|
|
34247
34768
|
import { tmpdir as tmpdir5 } from "os";
|
|
34248
34769
|
import path52 from "path";
|
|
34249
34770
|
import chalk189 from "chalk";
|
|
@@ -34278,7 +34799,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
34278
34799
|
console.error(chalk189.red("Report file not generated"));
|
|
34279
34800
|
process.exit(1);
|
|
34280
34801
|
}
|
|
34281
|
-
const xml =
|
|
34802
|
+
const xml = readFileSync58(reportPath, "utf8");
|
|
34282
34803
|
unlinkSync13(reportPath);
|
|
34283
34804
|
return xml;
|
|
34284
34805
|
}
|
|
@@ -35928,7 +36449,7 @@ Anything nested below the leaf level fails the run before a single write, naming
|
|
|
35928
36449
|
}
|
|
35929
36450
|
|
|
35930
36451
|
// src/commands/github/issue/commentIssue.ts
|
|
35931
|
-
import { execFileSync as
|
|
36452
|
+
import { execFileSync as execFileSync12 } from "child_process";
|
|
35932
36453
|
|
|
35933
36454
|
// src/shared/validateProposedContent.ts
|
|
35934
36455
|
var URL_PATTERN3 = /https?:\/\/[^\s<>()[\]"'`]+/gi;
|
|
@@ -35995,7 +36516,7 @@ async function commentIssue(numberArg, options2) {
|
|
|
35995
36516
|
const args = ["issue", "comment", String(number), "--body", body];
|
|
35996
36517
|
if (options2.repo) args.push("--repo", options2.repo);
|
|
35997
36518
|
try {
|
|
35998
|
-
|
|
36519
|
+
execFileSync12("gh", args, { stdio: "inherit" });
|
|
35999
36520
|
} catch {
|
|
36000
36521
|
process.exit(1);
|
|
36001
36522
|
}
|
|
@@ -36324,12 +36845,12 @@ function resolveIssueMilestone(target, wanted) {
|
|
|
36324
36845
|
import { execSync as execSync42 } from "child_process";
|
|
36325
36846
|
|
|
36326
36847
|
// src/commands/prs/currentPrSelector.ts
|
|
36327
|
-
import { execFileSync as
|
|
36848
|
+
import { execFileSync as execFileSync13 } from "child_process";
|
|
36328
36849
|
var PULL_REF = /^refs\/pull\/(\d+)\/head$/;
|
|
36329
36850
|
var HEAD_REF = /^refs\/heads\/(.+)$/;
|
|
36330
36851
|
function gitOrNull3(args) {
|
|
36331
36852
|
try {
|
|
36332
|
-
return
|
|
36853
|
+
return execFileSync13("git", args, {
|
|
36333
36854
|
encoding: "utf8",
|
|
36334
36855
|
stdio: ["pipe", "pipe", "pipe"],
|
|
36335
36856
|
windowsHide: true
|
|
@@ -36529,7 +37050,7 @@ function attachArgs(attachments) {
|
|
|
36529
37050
|
}
|
|
36530
37051
|
|
|
36531
37052
|
// src/commands/prs/runGhWithAttachments.ts
|
|
36532
|
-
import { execFileSync as
|
|
37053
|
+
import { execFileSync as execFileSync14 } from "child_process";
|
|
36533
37054
|
import { basename as basename20 } from "path";
|
|
36534
37055
|
|
|
36535
37056
|
// src/shared/removeStagedAttachments.ts
|
|
@@ -36557,7 +37078,7 @@ function reportPartialFailure(attachments, stderr) {
|
|
|
36557
37078
|
function runGhWithAttachments(args, attachments) {
|
|
36558
37079
|
const attaching = attachments.length > 0;
|
|
36559
37080
|
try {
|
|
36560
|
-
const stdout =
|
|
37081
|
+
const stdout = execFileSync14("gh", args, {
|
|
36561
37082
|
encoding: "utf8",
|
|
36562
37083
|
stdio: ["inherit", "pipe", attaching ? "pipe" : "inherit"]
|
|
36563
37084
|
});
|
|
@@ -36668,7 +37189,7 @@ The project scope is needed for --project: gh auth refresh -h github.com -s proj
|
|
|
36668
37189
|
}
|
|
36669
37190
|
|
|
36670
37191
|
// src/commands/github/issue/fetchIssue.ts
|
|
36671
|
-
import { execFileSync as
|
|
37192
|
+
import { execFileSync as execFileSync15 } from "child_process";
|
|
36672
37193
|
function fetchIssue2(number, repo) {
|
|
36673
37194
|
const args = [
|
|
36674
37195
|
"issue",
|
|
@@ -36680,7 +37201,7 @@ function fetchIssue2(number, repo) {
|
|
|
36680
37201
|
if (repo) args.push("--repo", repo);
|
|
36681
37202
|
let raw;
|
|
36682
37203
|
try {
|
|
36683
|
-
raw =
|
|
37204
|
+
raw = execFileSync15("gh", args, { encoding: "utf8" });
|
|
36684
37205
|
} catch {
|
|
36685
37206
|
console.error(`Could not fetch issue #${number} with gh issue view`);
|
|
36686
37207
|
process.exit(1);
|
|
@@ -36745,14 +37266,14 @@ function fetchIssueToWorkingFile(number, repo) {
|
|
|
36745
37266
|
}
|
|
36746
37267
|
|
|
36747
37268
|
// src/commands/github/issue/resumeIssueBody.ts
|
|
36748
|
-
import { existsSync as existsSync71, readFileSync as
|
|
37269
|
+
import { existsSync as existsSync71, readFileSync as readFileSync59 } from "fs";
|
|
36749
37270
|
function resumeIssueBody(slug2, number, updatedAt) {
|
|
36750
37271
|
const { bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
36751
37272
|
if (!existsSync71(bodyPath) || !existsSync71(metaPath)) return void 0;
|
|
36752
37273
|
try {
|
|
36753
|
-
const meta = JSON.parse(
|
|
37274
|
+
const meta = JSON.parse(readFileSync59(metaPath, "utf8"));
|
|
36754
37275
|
if (meta.updatedAt !== updatedAt) return void 0;
|
|
36755
|
-
return
|
|
37276
|
+
return readFileSync59(bodyPath, "utf8");
|
|
36756
37277
|
} catch {
|
|
36757
37278
|
return void 0;
|
|
36758
37279
|
}
|
|
@@ -36790,12 +37311,12 @@ function prepareIssueEdit(number, repo, fresh, proposed) {
|
|
|
36790
37311
|
}
|
|
36791
37312
|
|
|
36792
37313
|
// src/commands/github/issue/pushIssueBody.ts
|
|
36793
|
-
import { execFileSync as
|
|
37314
|
+
import { execFileSync as execFileSync16 } from "child_process";
|
|
36794
37315
|
function pushIssueBody(number, repo, bodyPath) {
|
|
36795
37316
|
const args = ["issue", "edit", String(number), "--body-file", bodyPath];
|
|
36796
37317
|
if (repo) args.push("--repo", repo);
|
|
36797
37318
|
try {
|
|
36798
|
-
|
|
37319
|
+
execFileSync16("gh", args, { stdio: "inherit" });
|
|
36799
37320
|
} catch {
|
|
36800
37321
|
process.exit(1);
|
|
36801
37322
|
}
|
|
@@ -36874,12 +37395,12 @@ function setIssueParent(number, repo, parentArg) {
|
|
|
36874
37395
|
}
|
|
36875
37396
|
|
|
36876
37397
|
// src/commands/github/issue/viewIssue.ts
|
|
36877
|
-
import { execFileSync as
|
|
37398
|
+
import { execFileSync as execFileSync17 } from "child_process";
|
|
36878
37399
|
function viewIssue(number, repo) {
|
|
36879
37400
|
const args = ["issue", "view", String(number)];
|
|
36880
37401
|
if (repo) args.push("--repo", repo);
|
|
36881
37402
|
try {
|
|
36882
|
-
|
|
37403
|
+
execFileSync17("gh", args, { stdio: "inherit" });
|
|
36883
37404
|
} catch {
|
|
36884
37405
|
process.exit(1);
|
|
36885
37406
|
}
|
|
@@ -36933,7 +37454,7 @@ function registerEditIssue(issueCommand) {
|
|
|
36933
37454
|
}
|
|
36934
37455
|
|
|
36935
37456
|
// src/commands/github/issue/editIssueComment.ts
|
|
36936
|
-
import { execFileSync as
|
|
37457
|
+
import { execFileSync as execFileSync18 } from "child_process";
|
|
36937
37458
|
var USAGE5 = "Usage: assist github issue edit-comment <comment-id> --body <body> [-R <owner>/<repo>]";
|
|
36938
37459
|
async function editIssueComment(commentIdArg, options2) {
|
|
36939
37460
|
const commentId = Number.parseInt(commentIdArg, 10);
|
|
@@ -36960,7 +37481,7 @@ async function editIssueComment(commentIdArg, options2) {
|
|
|
36960
37481
|
];
|
|
36961
37482
|
let raw;
|
|
36962
37483
|
try {
|
|
36963
|
-
raw =
|
|
37484
|
+
raw = execFileSync18("gh", args, {
|
|
36964
37485
|
input: JSON.stringify({ body }),
|
|
36965
37486
|
encoding: "utf8"
|
|
36966
37487
|
});
|
|
@@ -37842,11 +38363,11 @@ function registerJira(program) {
|
|
|
37842
38363
|
|
|
37843
38364
|
// src/commands/backlog/registerRefineLaunch.ts
|
|
37844
38365
|
var HARNESS_FLAG = "Coding harness to launch (claude|codex|pi); defaults to the configured harness.engine. Exits with the reasons, without launching, when Refine is unavailable on it";
|
|
37845
|
-
function runRefine(id,
|
|
38366
|
+
function runRefine(id, opts2) {
|
|
37846
38367
|
return refine(id, {
|
|
37847
|
-
once:
|
|
37848
|
-
resumeSessionId:
|
|
37849
|
-
harness: resolveHarness2(
|
|
38368
|
+
once: opts2.once,
|
|
38369
|
+
resumeSessionId: opts2.resumeSession,
|
|
38370
|
+
harness: resolveHarness2(opts2.harness)
|
|
37850
38371
|
});
|
|
37851
38372
|
}
|
|
37852
38373
|
function registerRefineLaunch(program, resumeFlag) {
|
|
@@ -37860,7 +38381,7 @@ function registerRefineLaunch(program, resumeFlag) {
|
|
|
37860
38381
|
import chalk202 from "chalk";
|
|
37861
38382
|
|
|
37862
38383
|
// src/commands/review/checkoutPr.ts
|
|
37863
|
-
import { execFileSync as
|
|
38384
|
+
import { execFileSync as execFileSync21 } from "child_process";
|
|
37864
38385
|
|
|
37865
38386
|
// src/commands/review/clearStalePrBranch.ts
|
|
37866
38387
|
var tipSetFromRemote = /^branch: (Created from|Reset to)|^fetch\b|: Fast-forward$/;
|
|
@@ -38038,7 +38559,7 @@ var persistedSessionSchema = z23.object({
|
|
|
38038
38559
|
generatedTitle: z23.string().optional(),
|
|
38039
38560
|
subtitle: z23.string().optional(),
|
|
38040
38561
|
commandType: z23.enum(["claude", "run", "assist"]),
|
|
38041
|
-
harness: z23.enum(
|
|
38562
|
+
harness: z23.enum(harnessKinds).optional(),
|
|
38042
38563
|
status: z23.enum(["running", "waiting", "done", "error", "stopped"]).optional(),
|
|
38043
38564
|
error: z23.string().optional(),
|
|
38044
38565
|
cwd: z23.string(),
|
|
@@ -38210,7 +38731,7 @@ function detectInstallCommand(dir) {
|
|
|
38210
38731
|
}
|
|
38211
38732
|
|
|
38212
38733
|
// src/commands/sessions/daemon/worktree/spawnInstall.ts
|
|
38213
|
-
import { spawn as
|
|
38734
|
+
import { spawn as spawn11 } from "child_process";
|
|
38214
38735
|
|
|
38215
38736
|
// src/commands/sessions/daemon/worktree/installInvocation.ts
|
|
38216
38737
|
function installInvocation(worktreePath, command) {
|
|
@@ -38285,7 +38806,7 @@ function killTree(pid) {
|
|
|
38285
38806
|
var STDERR_TAIL = 2e3;
|
|
38286
38807
|
function spawnInstall(worktreePath, cwd, command, where, onDone) {
|
|
38287
38808
|
daemonLog(`worktree ${worktreePath} installing deps${where}: ${command}`);
|
|
38288
|
-
const child2 =
|
|
38809
|
+
const child2 = spawn11(...installInvocation(cwd, command));
|
|
38289
38810
|
trackInstall(worktreePath, child2);
|
|
38290
38811
|
let stderr = "";
|
|
38291
38812
|
child2.stderr?.on("data", (chunk2) => {
|
|
@@ -38491,13 +39012,13 @@ function prCliCommands(number, cwd) {
|
|
|
38491
39012
|
}
|
|
38492
39013
|
|
|
38493
39014
|
// src/commands/review/prHeadBranch.ts
|
|
38494
|
-
import { execFileSync as
|
|
39015
|
+
import { execFileSync as execFileSync19 } from "child_process";
|
|
38495
39016
|
function prHeadBranch({
|
|
38496
39017
|
headBranch
|
|
38497
39018
|
}) {
|
|
38498
39019
|
try {
|
|
38499
39020
|
return headBranch.parse(
|
|
38500
|
-
|
|
39021
|
+
execFileSync19(headBranch.file, headBranch.args, {
|
|
38501
39022
|
encoding: "utf8",
|
|
38502
39023
|
stdio: ["ignore", "pipe", "pipe"]
|
|
38503
39024
|
})
|
|
@@ -38568,7 +39089,7 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
38568
39089
|
import chalk201 from "chalk";
|
|
38569
39090
|
|
|
38570
39091
|
// src/commands/review/azCliProblem.ts
|
|
38571
|
-
import { execFileSync as
|
|
39092
|
+
import { execFileSync as execFileSync20 } from "child_process";
|
|
38572
39093
|
|
|
38573
39094
|
// src/commands/review/azFailureProblem.ts
|
|
38574
39095
|
var azProblems = {
|
|
@@ -38596,7 +39117,7 @@ function azFailureProblem(error) {
|
|
|
38596
39117
|
// src/commands/review/azCliProblem.ts
|
|
38597
39118
|
function runAz(args) {
|
|
38598
39119
|
try {
|
|
38599
|
-
|
|
39120
|
+
execFileSync20("az", args, { stdio: "ignore" });
|
|
38600
39121
|
return "ok";
|
|
38601
39122
|
} catch (error) {
|
|
38602
39123
|
return error.code === "ENOENT" ? "missing" : "failed";
|
|
@@ -38659,7 +39180,7 @@ async function checkoutPr(number) {
|
|
|
38659
39180
|
const from = branch2 === "HEAD" ? gitSyncOrNull(process.cwd(), ["rev-parse", "HEAD"]) : branch2;
|
|
38660
39181
|
const stale = headRef ? clearStalePrBranch(process.cwd(), headRef) : "absent";
|
|
38661
39182
|
try {
|
|
38662
|
-
|
|
39183
|
+
execFileSync21(commands.checkout.file, commands.checkout.args, {
|
|
38663
39184
|
stdio: "inherit"
|
|
38664
39185
|
});
|
|
38665
39186
|
} catch {
|
|
@@ -38765,11 +39286,11 @@ function registerReviewPrComments(program, resumeFlag) {
|
|
|
38765
39286
|
"--harness <kind>",
|
|
38766
39287
|
"Coding harness to launch (claude|codex|pi); defaults to the configured harness.engine. Exits with the reasons, before checking the PR out, when Address comments is unavailable on it"
|
|
38767
39288
|
).action(
|
|
38768
|
-
(number,
|
|
38769
|
-
announce:
|
|
38770
|
-
auto:
|
|
38771
|
-
resumeSessionId:
|
|
38772
|
-
harness: resolveHarness2(
|
|
39289
|
+
(number, opts2) => reviewPrComments(number, {
|
|
39290
|
+
announce: opts2.announce,
|
|
39291
|
+
auto: opts2.auto,
|
|
39292
|
+
resumeSessionId: opts2.resumeSession,
|
|
39293
|
+
harness: resolveHarness2(opts2.harness)
|
|
38773
39294
|
})
|
|
38774
39295
|
);
|
|
38775
39296
|
configHelp(command, harnessConfigHelp);
|
|
@@ -38784,14 +39305,14 @@ function registerDescriptionLaunch(program, name2, slashCommand, description, fe
|
|
|
38784
39305
|
).description(description).option("--once", "Exit when the initial task completes").option("--resume-session <id>", resumeFlag).option("--harness <kind>", harnessFlag(feature)).option(
|
|
38785
39306
|
"--model <model>",
|
|
38786
39307
|
`Model to launch the harness with; defaults to harness.defaults.${name2}.model while the ${name2} type's harness is used`
|
|
38787
|
-
).option("--no-model", "Launch with the harness's own default model").action((text18,
|
|
38788
|
-
const harness = resolveHarness2(
|
|
39308
|
+
).option("--no-model", "Launch with the harness's own default model").action((text18, opts2) => {
|
|
39309
|
+
const harness = resolveHarness2(opts2.harness, name2);
|
|
38789
39310
|
return launchMode(slashCommand, {
|
|
38790
|
-
once:
|
|
39311
|
+
once: opts2.once,
|
|
38791
39312
|
description: text18,
|
|
38792
|
-
resumeSessionId:
|
|
39313
|
+
resumeSessionId: opts2.resumeSession,
|
|
38793
39314
|
harness,
|
|
38794
|
-
model: resolveModel(
|
|
39315
|
+
model: resolveModel(opts2.model, name2, harness),
|
|
38795
39316
|
feature
|
|
38796
39317
|
});
|
|
38797
39318
|
});
|
|
@@ -38803,7 +39324,7 @@ function registerDescriptionLaunch(program, name2, slashCommand, description, fe
|
|
|
38803
39324
|
var RESUME_SESSION_FLAG = "Resume an interrupted harness session by its conversation id (used by the sessions daemon on restart)";
|
|
38804
39325
|
function registerNext(program) {
|
|
38805
39326
|
program.command("next").argument("[id]", "Backlog item ID to run first").description("Alias for backlog next").option("--once", "Exit after the first completed item run").action(
|
|
38806
|
-
(id,
|
|
39327
|
+
(id, opts2) => next({ allowEdits: true, once: opts2.once }, id)
|
|
38807
39328
|
);
|
|
38808
39329
|
}
|
|
38809
39330
|
function registerLaunch(program) {
|
|
@@ -38908,7 +39429,7 @@ import { resolve as resolve24 } from "path";
|
|
|
38908
39429
|
import chalk207 from "chalk";
|
|
38909
39430
|
|
|
38910
39431
|
// src/commands/mermaid/exportFile.ts
|
|
38911
|
-
import { readFileSync as
|
|
39432
|
+
import { readFileSync as readFileSync60, writeFileSync as writeFileSync43 } from "fs";
|
|
38912
39433
|
import { basename as basename23, extname as extname4, resolve as resolve23 } from "path";
|
|
38913
39434
|
import chalk206 from "chalk";
|
|
38914
39435
|
|
|
@@ -38934,7 +39455,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
38934
39455
|
|
|
38935
39456
|
// src/commands/mermaid/exportFile.ts
|
|
38936
39457
|
async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
38937
|
-
const content =
|
|
39458
|
+
const content = readFileSync60(file, "utf8");
|
|
38938
39459
|
const blocks = extractMermaidBlocks(content);
|
|
38939
39460
|
const stem = basename23(file, extname4(file));
|
|
38940
39461
|
if (onlyIndex !== void 0) {
|
|
@@ -39146,14 +39667,14 @@ function applyIgnore(texts, ignore3) {
|
|
|
39146
39667
|
}
|
|
39147
39668
|
|
|
39148
39669
|
// src/commands/miro/readIgnoreList.ts
|
|
39149
|
-
import { existsSync as existsSync75, readFileSync as
|
|
39670
|
+
import { existsSync as existsSync75, readFileSync as readFileSync61 } from "fs";
|
|
39150
39671
|
import { parse as parse2 } from "yaml";
|
|
39151
39672
|
function readIgnoreList(file) {
|
|
39152
39673
|
if (!existsSync75(file))
|
|
39153
39674
|
throw new MiroExtractError(
|
|
39154
39675
|
`No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
|
|
39155
39676
|
);
|
|
39156
|
-
const parsed = parse2(
|
|
39677
|
+
const parsed = parse2(readFileSync61(file, "utf8"));
|
|
39157
39678
|
if (parsed === null || parsed === void 0) return [];
|
|
39158
39679
|
if (!Array.isArray(parsed) || parsed.some((entry) => typeof entry !== "string"))
|
|
39159
39680
|
throw new MiroExtractError(
|
|
@@ -39333,7 +39854,7 @@ async function pickAnchors(sessionId2, items3) {
|
|
|
39333
39854
|
}
|
|
39334
39855
|
|
|
39335
39856
|
// src/commands/miro/readMiroItems.ts
|
|
39336
|
-
import { readFileSync as
|
|
39857
|
+
import { readFileSync as readFileSync62 } from "fs";
|
|
39337
39858
|
function tryParse(text18) {
|
|
39338
39859
|
try {
|
|
39339
39860
|
return JSON.parse(text18);
|
|
@@ -39362,7 +39883,7 @@ function parsePages(raw, file) {
|
|
|
39362
39883
|
return Array.isArray(parsed) ? parsed.map(toPage) : [toPage(parsed)];
|
|
39363
39884
|
}
|
|
39364
39885
|
function readMiroItems(file) {
|
|
39365
|
-
const items3 = parsePages(
|
|
39886
|
+
const items3 = parsePages(readFileSync62(file, "utf8"), file).flatMap(
|
|
39366
39887
|
(page) => page.data ?? []
|
|
39367
39888
|
);
|
|
39368
39889
|
if (items3.length === 0)
|
|
@@ -39761,7 +40282,7 @@ import { join as join96 } from "path";
|
|
|
39761
40282
|
import chalk212 from "chalk";
|
|
39762
40283
|
|
|
39763
40284
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
39764
|
-
import { readFileSync as
|
|
40285
|
+
import { readFileSync as readFileSync63 } from "fs";
|
|
39765
40286
|
|
|
39766
40287
|
// src/commands/netcap/parseRscRows.ts
|
|
39767
40288
|
var isRscRef = (v) => typeof v === "string" && /^\$[0-9a-fL@]/.test(v);
|
|
@@ -40157,7 +40678,7 @@ function extractVoyagerPosts(body) {
|
|
|
40157
40678
|
|
|
40158
40679
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
40159
40680
|
function captureEntries(captureFile) {
|
|
40160
|
-
const lines =
|
|
40681
|
+
const lines = readFileSync63(captureFile, "utf8").split("\n").filter(Boolean);
|
|
40161
40682
|
const entries2 = [];
|
|
40162
40683
|
for (const line of lines) {
|
|
40163
40684
|
let entry;
|
|
@@ -40616,14 +41137,14 @@ import { dirname as dirname44 } from "path";
|
|
|
40616
41137
|
import { stringify as stringify3 } from "yaml";
|
|
40617
41138
|
|
|
40618
41139
|
// src/commands/prs/loadCommentsCache.ts
|
|
40619
|
-
import { existsSync as existsSync76, readFileSync as
|
|
41140
|
+
import { existsSync as existsSync76, readFileSync as readFileSync64, unlinkSync as unlinkSync15 } from "fs";
|
|
40620
41141
|
import { parse as parse3 } from "yaml";
|
|
40621
41142
|
function loadCommentsCache(org, repo, prNumber) {
|
|
40622
41143
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
40623
41144
|
if (!existsSync76(cachePath)) {
|
|
40624
41145
|
return null;
|
|
40625
41146
|
}
|
|
40626
|
-
const content =
|
|
41147
|
+
const content = readFileSync64(cachePath, "utf8");
|
|
40627
41148
|
return parse3(content);
|
|
40628
41149
|
}
|
|
40629
41150
|
function deleteCommentsCache(org, repo, prNumber) {
|
|
@@ -40713,9 +41234,9 @@ var azureDevopsThreadRequests = {
|
|
|
40713
41234
|
};
|
|
40714
41235
|
|
|
40715
41236
|
// src/commands/prs/azureDevops/currentAzureDevopsPr.ts
|
|
40716
|
-
import { execFileSync as
|
|
41237
|
+
import { execFileSync as execFileSync22 } from "child_process";
|
|
40717
41238
|
function findPrForBranch(repo, branch2) {
|
|
40718
|
-
const stdout =
|
|
41239
|
+
const stdout = execFileSync22(
|
|
40719
41240
|
"az",
|
|
40720
41241
|
[
|
|
40721
41242
|
"repos",
|
|
@@ -40762,7 +41283,7 @@ function failAzureDevops(error) {
|
|
|
40762
41283
|
}
|
|
40763
41284
|
|
|
40764
41285
|
// src/commands/prs/azureDevops/invokeAzDevops.ts
|
|
40765
|
-
import { execFileSync as
|
|
41286
|
+
import { execFileSync as execFileSync23 } from "child_process";
|
|
40766
41287
|
import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as writeFileSync47 } from "fs";
|
|
40767
41288
|
import { tmpdir as tmpdir7 } from "os";
|
|
40768
41289
|
import { join as join99 } from "path";
|
|
@@ -40791,7 +41312,7 @@ function azDevopsInvokeArgs(request, inFile) {
|
|
|
40791
41312
|
];
|
|
40792
41313
|
}
|
|
40793
41314
|
function runAz2(args) {
|
|
40794
|
-
const stdout =
|
|
41315
|
+
const stdout = execFileSync23("az", args, {
|
|
40795
41316
|
encoding: "utf8",
|
|
40796
41317
|
stdio: ["ignore", "pipe", "pipe"],
|
|
40797
41318
|
windowsHide: true
|
|
@@ -40858,10 +41379,10 @@ function listAzureDevopsComments(repo) {
|
|
|
40858
41379
|
}
|
|
40859
41380
|
|
|
40860
41381
|
// src/commands/prs/fetchThreadIds.ts
|
|
40861
|
-
import { execFileSync as
|
|
41382
|
+
import { execFileSync as execFileSync24 } from "child_process";
|
|
40862
41383
|
var THREAD_QUERY = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { id isResolved comments(first: 100) { nodes { databaseId } } } } } } }`;
|
|
40863
41384
|
function fetchThreadIds(org, repo, prNumber) {
|
|
40864
|
-
const result =
|
|
41385
|
+
const result = execFileSync24(
|
|
40865
41386
|
"gh",
|
|
40866
41387
|
[
|
|
40867
41388
|
"api",
|
|
@@ -41142,7 +41663,7 @@ function printComments2(result) {
|
|
|
41142
41663
|
import { execSync as execSync46 } from "child_process";
|
|
41143
41664
|
|
|
41144
41665
|
// src/commands/prs/threadTarget.ts
|
|
41145
|
-
import { execFileSync as
|
|
41666
|
+
import { execFileSync as execFileSync25 } from "child_process";
|
|
41146
41667
|
|
|
41147
41668
|
// src/commands/prs/azureDevops/azureDevopsThreadActions.ts
|
|
41148
41669
|
function attempt(run5) {
|
|
@@ -41190,7 +41711,7 @@ function replyToComment(org, repo, prNumber, commentId, message4) {
|
|
|
41190
41711
|
// src/commands/prs/threadTarget.ts
|
|
41191
41712
|
function resolveThread(threadId) {
|
|
41192
41713
|
const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
|
|
41193
|
-
|
|
41714
|
+
execFileSync25(
|
|
41194
41715
|
"gh",
|
|
41195
41716
|
["api", "graphql", "-f", `query=${mutation}`, "-f", `threadId=${threadId}`],
|
|
41196
41717
|
{ stdio: ["inherit", "pipe", "inherit"] }
|
|
@@ -41832,7 +42353,7 @@ function buildValidatedBody(options2, usage) {
|
|
|
41832
42353
|
}
|
|
41833
42354
|
|
|
41834
42355
|
// src/commands/prs/placePr.ts
|
|
41835
|
-
import { execFileSync as
|
|
42356
|
+
import { execFileSync as execFileSync26 } from "child_process";
|
|
41836
42357
|
|
|
41837
42358
|
// src/commands/prs/buildCreateArgs.ts
|
|
41838
42359
|
function buildCreateArgs(title, body, options2, attachments = []) {
|
|
@@ -41918,7 +42439,7 @@ function buildEditArgs(number, title, body, attachments = []) {
|
|
|
41918
42439
|
// src/commands/prs/placePr.ts
|
|
41919
42440
|
function hasUpstream2() {
|
|
41920
42441
|
try {
|
|
41921
|
-
|
|
42442
|
+
execFileSync26(
|
|
41922
42443
|
"git",
|
|
41923
42444
|
["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"],
|
|
41924
42445
|
{ stdio: "pipe" }
|
|
@@ -41930,7 +42451,7 @@ function hasUpstream2() {
|
|
|
41930
42451
|
}
|
|
41931
42452
|
function ensureBranchPushed() {
|
|
41932
42453
|
const args = hasUpstream2() ? ["push"] : ["push", "--set-upstream", "origin", "HEAD"];
|
|
41933
|
-
|
|
42454
|
+
execFileSync26("git", args, { stdio: "inherit" });
|
|
41934
42455
|
}
|
|
41935
42456
|
async function placePr(prNumber, title, body, options2, attachments = []) {
|
|
41936
42457
|
const args = prNumber !== null ? buildEditArgs(prNumber, title, body, attachments) : buildCreateArgs(title, body, options2, attachments);
|
|
@@ -42001,10 +42522,10 @@ function warn(reason4) {
|
|
|
42001
42522
|
}
|
|
42002
42523
|
|
|
42003
42524
|
// src/commands/prs/enableAutoMerge.ts
|
|
42004
|
-
import { execFileSync as
|
|
42525
|
+
import { execFileSync as execFileSync27 } from "child_process";
|
|
42005
42526
|
function enableAutoMerge() {
|
|
42006
42527
|
try {
|
|
42007
|
-
|
|
42528
|
+
execFileSync27(
|
|
42008
42529
|
"gh",
|
|
42009
42530
|
["pr", "merge", getCurrentBranch2(), "--auto", "--squash"],
|
|
42010
42531
|
{ stdio: "inherit" }
|
|
@@ -42264,10 +42785,10 @@ function prsSlackChannel() {
|
|
|
42264
42785
|
}
|
|
42265
42786
|
|
|
42266
42787
|
// src/commands/prs/status/fetchReviewThreads.ts
|
|
42267
|
-
import { execFileSync as
|
|
42788
|
+
import { execFileSync as execFileSync28 } from "child_process";
|
|
42268
42789
|
var THREAD_QUERY2 = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { isResolved } } } } }`;
|
|
42269
42790
|
function fetchReviewThreads(org, repo, prNumber) {
|
|
42270
|
-
const output =
|
|
42791
|
+
const output = execFileSync28(
|
|
42271
42792
|
"gh",
|
|
42272
42793
|
[
|
|
42273
42794
|
"api",
|
|
@@ -42589,7 +43110,7 @@ function registerPrsStatus(prsCommand) {
|
|
|
42589
43110
|
}
|
|
42590
43111
|
|
|
42591
43112
|
// src/commands/readTime/readTime.ts
|
|
42592
|
-
import { readFileSync as
|
|
43113
|
+
import { readFileSync as readFileSync65 } from "fs";
|
|
42593
43114
|
|
|
42594
43115
|
// src/commands/readTime/countReadingWords.ts
|
|
42595
43116
|
var FENCE_PATTERN = /^\s*(```|~~~)/;
|
|
@@ -42750,7 +43271,7 @@ async function loadBody(target) {
|
|
|
42750
43271
|
}
|
|
42751
43272
|
function readDraftFile(path128) {
|
|
42752
43273
|
try {
|
|
42753
|
-
return
|
|
43274
|
+
return readFileSync65(path128, "utf8");
|
|
42754
43275
|
} catch {
|
|
42755
43276
|
console.error(`Error: Could not read \`${path128}\`.`);
|
|
42756
43277
|
console.error(
|
|
@@ -43123,33 +43644,33 @@ import chalk232 from "chalk";
|
|
|
43123
43644
|
import chalk231 from "chalk";
|
|
43124
43645
|
|
|
43125
43646
|
// src/commands/ravendb/buildQueryPath.ts
|
|
43126
|
-
function buildQueryPath(
|
|
43127
|
-
const db = encodeURIComponent(
|
|
43647
|
+
function buildQueryPath(opts2) {
|
|
43648
|
+
const db = encodeURIComponent(opts2.db);
|
|
43128
43649
|
let path128;
|
|
43129
|
-
if (
|
|
43130
|
-
path128 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(
|
|
43650
|
+
if (opts2.collection) {
|
|
43651
|
+
path128 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts2.collection)}?start=${opts2.start}&pageSize=${opts2.pageSize}&sort=${encodeURIComponent(opts2.sort)}`;
|
|
43131
43652
|
} else {
|
|
43132
|
-
path128 = `/databases/${db}/queries?start=${
|
|
43653
|
+
path128 = `/databases/${db}/queries?start=${opts2.start}&pageSize=${opts2.pageSize}`;
|
|
43133
43654
|
}
|
|
43134
|
-
if (
|
|
43135
|
-
path128 += `&query=${encodeURIComponent(
|
|
43655
|
+
if (opts2.query) {
|
|
43656
|
+
path128 += `&query=${encodeURIComponent(opts2.query)}`;
|
|
43136
43657
|
}
|
|
43137
43658
|
return path128;
|
|
43138
43659
|
}
|
|
43139
43660
|
|
|
43140
43661
|
// src/commands/ravendb/fetchAllPages.ts
|
|
43141
|
-
async function fetchAllPages(connection,
|
|
43662
|
+
async function fetchAllPages(connection, opts2) {
|
|
43142
43663
|
const allResults = [];
|
|
43143
43664
|
let start2 = 0;
|
|
43144
43665
|
while (true) {
|
|
43145
|
-
const effectivePageSize =
|
|
43666
|
+
const effectivePageSize = opts2.limit !== void 0 ? Math.min(opts2.pageSize, opts2.limit - allResults.length) : opts2.pageSize;
|
|
43146
43667
|
const path128 = buildQueryPath({
|
|
43147
43668
|
db: connection.database,
|
|
43148
|
-
collection:
|
|
43669
|
+
collection: opts2.collection,
|
|
43149
43670
|
start: start2,
|
|
43150
43671
|
pageSize: effectivePageSize,
|
|
43151
|
-
sort:
|
|
43152
|
-
query:
|
|
43672
|
+
sort: opts2.sort,
|
|
43673
|
+
query: opts2.query
|
|
43153
43674
|
});
|
|
43154
43675
|
const data = await ravenFetch(connection, path128);
|
|
43155
43676
|
const results = data.Results ?? [];
|
|
@@ -43161,7 +43682,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
43161
43682
|
`\r${chalk231.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
43162
43683
|
);
|
|
43163
43684
|
if (start2 >= totalResults) break;
|
|
43164
|
-
if (
|
|
43685
|
+
if (opts2.limit !== void 0 && allResults.length >= opts2.limit) break;
|
|
43165
43686
|
}
|
|
43166
43687
|
if (allResults.length > 0) {
|
|
43167
43688
|
process.stderr.write("\n");
|
|
@@ -43257,10 +43778,10 @@ function checkStreamGraph(streams) {
|
|
|
43257
43778
|
}
|
|
43258
43779
|
|
|
43259
43780
|
// src/commands/releases/readStreamsInput.ts
|
|
43260
|
-
import { readFileSync as
|
|
43781
|
+
import { readFileSync as readFileSync66 } from "fs";
|
|
43261
43782
|
import { parse as parse4 } from "yaml";
|
|
43262
43783
|
function readSource2(source) {
|
|
43263
|
-
return
|
|
43784
|
+
return readFileSync66(source === "-" ? 0 : source, "utf8");
|
|
43264
43785
|
}
|
|
43265
43786
|
function readStreamsInput(source) {
|
|
43266
43787
|
let parsed;
|
|
@@ -44171,7 +44692,7 @@ function buildLimitsSegment(rateLimits) {
|
|
|
44171
44692
|
}
|
|
44172
44693
|
|
|
44173
44694
|
// src/commands/readGitBranch.ts
|
|
44174
|
-
import { readFileSync as
|
|
44695
|
+
import { readFileSync as readFileSync67, statSync as statSync14 } from "fs";
|
|
44175
44696
|
import { isAbsolute as isAbsolute7, join as join101, resolve as resolve29 } from "path";
|
|
44176
44697
|
function resolveGitDir(cwd) {
|
|
44177
44698
|
const dotGit = join101(cwd, ".git");
|
|
@@ -44186,7 +44707,7 @@ function resolveGitDir(cwd) {
|
|
|
44186
44707
|
}
|
|
44187
44708
|
let contents;
|
|
44188
44709
|
try {
|
|
44189
|
-
contents =
|
|
44710
|
+
contents = readFileSync67(dotGit, "utf8");
|
|
44190
44711
|
} catch {
|
|
44191
44712
|
return null;
|
|
44192
44713
|
}
|
|
@@ -44204,7 +44725,7 @@ function readGitBranch(cwd) {
|
|
|
44204
44725
|
}
|
|
44205
44726
|
let head;
|
|
44206
44727
|
try {
|
|
44207
|
-
head =
|
|
44728
|
+
head = readFileSync67(join101(gitDir, "HEAD"), "utf8");
|
|
44208
44729
|
} catch {
|
|
44209
44730
|
return null;
|
|
44210
44731
|
}
|
|
@@ -44241,6 +44762,7 @@ import chalk241 from "chalk";
|
|
|
44241
44762
|
// src/shared/harnessAdapters/contextLevel.ts
|
|
44242
44763
|
var THRESHOLDS = {
|
|
44243
44764
|
claude: { red: 30, yellow: 20 },
|
|
44765
|
+
"claude-sdk": { red: 30, yellow: 20 },
|
|
44244
44766
|
codex: { red: 75, yellow: 50 },
|
|
44245
44767
|
pi: { red: 30, yellow: 20 }
|
|
44246
44768
|
};
|
|
@@ -44381,7 +44903,7 @@ function registerRootCommands(program) {
|
|
|
44381
44903
|
}
|
|
44382
44904
|
|
|
44383
44905
|
// src/commands/refactor/check.ts
|
|
44384
|
-
import { spawn as
|
|
44906
|
+
import { spawn as spawn12 } from "child_process";
|
|
44385
44907
|
import * as path62 from "path";
|
|
44386
44908
|
|
|
44387
44909
|
// src/commands/refactor/logViolations.ts
|
|
@@ -44529,7 +45051,7 @@ function getViolations(pattern2, options2 = {}, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
44529
45051
|
// src/commands/refactor/check.ts
|
|
44530
45052
|
function runScript(script, cwd) {
|
|
44531
45053
|
return new Promise((resolve36) => {
|
|
44532
|
-
const child2 =
|
|
45054
|
+
const child2 = spawn12("npm", ["run", script], {
|
|
44533
45055
|
stdio: "pipe",
|
|
44534
45056
|
shell: true,
|
|
44535
45057
|
cwd
|
|
@@ -46749,7 +47271,7 @@ function readGlobs(value) {
|
|
|
46749
47271
|
}
|
|
46750
47272
|
|
|
46751
47273
|
// src/commands/review/highLevel/summariseRepoTree.ts
|
|
46752
|
-
import { execFileSync as
|
|
47274
|
+
import { execFileSync as execFileSync29 } from "child_process";
|
|
46753
47275
|
import { dirname as dirname46, extname as extname6 } from "path";
|
|
46754
47276
|
var MAX_DIRECTORIES = 200;
|
|
46755
47277
|
var MAX_EXTENSIONS_PER_DIRECTORY = 6;
|
|
@@ -46765,7 +47287,7 @@ function summariseRepoTree(cwd = process.cwd()) {
|
|
|
46765
47287
|
}
|
|
46766
47288
|
function listTrackedFiles(cwd) {
|
|
46767
47289
|
try {
|
|
46768
|
-
return
|
|
47290
|
+
return execFileSync29("git", ["ls-files"], {
|
|
46769
47291
|
cwd,
|
|
46770
47292
|
encoding: "utf8",
|
|
46771
47293
|
maxBuffer: 64 * 1024 * 1024
|
|
@@ -47238,7 +47760,7 @@ function evaluateHighLevelChecks(subject) {
|
|
|
47238
47760
|
}
|
|
47239
47761
|
|
|
47240
47762
|
// src/commands/review/highLevel/fetchHighLevelFiles.ts
|
|
47241
|
-
import { execFileSync as
|
|
47763
|
+
import { execFileSync as execFileSync30 } from "child_process";
|
|
47242
47764
|
import { createHash as createHash4 } from "crypto";
|
|
47243
47765
|
var JQ = ".[] | {filename,status,additions,deletions,patch} | @json";
|
|
47244
47766
|
function toStatus(status2) {
|
|
@@ -47251,7 +47773,7 @@ function diffUrl(repo, prNumber, path128) {
|
|
|
47251
47773
|
return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
|
|
47252
47774
|
}
|
|
47253
47775
|
function fetchHighLevelFiles(prNumber, repo) {
|
|
47254
|
-
const out =
|
|
47776
|
+
const out = execFileSync30(
|
|
47255
47777
|
"gh",
|
|
47256
47778
|
["api", `repos/${repo}/pulls/${prNumber}/files`, "--paginate", "--jq", JQ],
|
|
47257
47779
|
{ encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }
|
|
@@ -47318,7 +47840,7 @@ function fetchHighLevelPr(prNumber, repo) {
|
|
|
47318
47840
|
}
|
|
47319
47841
|
|
|
47320
47842
|
// src/commands/review/highLevel/gatherHighLevelSlices.ts
|
|
47321
|
-
import { readFileSync as
|
|
47843
|
+
import { readFileSync as readFileSync69 } from "fs";
|
|
47322
47844
|
|
|
47323
47845
|
// src/commands/review/highLevel/formatSlicingRequest.ts
|
|
47324
47846
|
var RULES = [
|
|
@@ -47436,11 +47958,11 @@ function listHighLevelHunks(files) {
|
|
|
47436
47958
|
}
|
|
47437
47959
|
|
|
47438
47960
|
// src/commands/review/highLevel/readJsonFile.ts
|
|
47439
|
-
import { existsSync as existsSync78, readFileSync as
|
|
47961
|
+
import { existsSync as existsSync78, readFileSync as readFileSync68 } from "fs";
|
|
47440
47962
|
function readJsonFile(path128) {
|
|
47441
47963
|
if (!existsSync78(path128)) return void 0;
|
|
47442
47964
|
try {
|
|
47443
|
-
return JSON.parse(
|
|
47965
|
+
return JSON.parse(readFileSync68(path128, "utf8"));
|
|
47444
47966
|
} catch {
|
|
47445
47967
|
return void 0;
|
|
47446
47968
|
}
|
|
@@ -47531,7 +48053,7 @@ function writeJsonFile(path128, data) {
|
|
|
47531
48053
|
// src/commands/review/highLevel/gatherHighLevelSlices.ts
|
|
47532
48054
|
function readSlicesFile(file) {
|
|
47533
48055
|
try {
|
|
47534
|
-
return JSON.parse(
|
|
48056
|
+
return JSON.parse(readFileSync69(file, "utf8"));
|
|
47535
48057
|
} catch (error) {
|
|
47536
48058
|
throw new Error(
|
|
47537
48059
|
`could not read slices from ${file}: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -47774,11 +48296,11 @@ function collectHighLevelTests(files, testPaths, readSource4) {
|
|
|
47774
48296
|
}
|
|
47775
48297
|
|
|
47776
48298
|
// src/commands/review/highLevel/fetchFileAtSha.ts
|
|
47777
|
-
import { execFileSync as
|
|
48299
|
+
import { execFileSync as execFileSync31 } from "child_process";
|
|
47778
48300
|
function fetchFileAtSha(repo, sha, path128) {
|
|
47779
48301
|
const encodedPath = path128.split("/").map(encodeURIComponent).join("/");
|
|
47780
48302
|
try {
|
|
47781
|
-
return
|
|
48303
|
+
return execFileSync31(
|
|
47782
48304
|
"gh",
|
|
47783
48305
|
[
|
|
47784
48306
|
"api",
|
|
@@ -48906,7 +49428,7 @@ async function runReviewers(reviewers, context) {
|
|
|
48906
49428
|
import { existsSync as existsSync79, unlinkSync as unlinkSync18 } from "fs";
|
|
48907
49429
|
|
|
48908
49430
|
// src/commands/review/synthesise.ts
|
|
48909
|
-
import { readFileSync as
|
|
49431
|
+
import { readFileSync as readFileSync70 } from "fs";
|
|
48910
49432
|
|
|
48911
49433
|
// src/commands/review/carriedUnanchoredFindings.ts
|
|
48912
49434
|
function carriedUnanchoredFindings(unanchored) {
|
|
@@ -49108,7 +49630,7 @@ Files:
|
|
|
49108
49630
|
|
|
49109
49631
|
// src/commands/review/synthesise.ts
|
|
49110
49632
|
function printSummary2(synthesisPath) {
|
|
49111
|
-
const markdown =
|
|
49633
|
+
const markdown = readFileSync70(synthesisPath, "utf8");
|
|
49112
49634
|
console.log("");
|
|
49113
49635
|
console.log(buildReviewSummary(markdown));
|
|
49114
49636
|
console.log("");
|
|
@@ -49658,7 +50180,7 @@ function postSynthesisSession(modes) {
|
|
|
49658
50180
|
}
|
|
49659
50181
|
|
|
49660
50182
|
// src/commands/review/postReviewToPr.ts
|
|
49661
|
-
import { readFileSync as
|
|
50183
|
+
import { readFileSync as readFileSync71 } from "fs";
|
|
49662
50184
|
|
|
49663
50185
|
// src/commands/review/chainAddressComments.ts
|
|
49664
50186
|
function chainAddressComments(prNumber, announce, harness) {
|
|
@@ -50013,7 +50535,7 @@ async function confirmPost(prNumber, work, options2) {
|
|
|
50013
50535
|
return promptConfirm(`Post ${work} to PR #${prNumber}?`, false);
|
|
50014
50536
|
}
|
|
50015
50537
|
async function postFindingsToPr(prInfo, synthesisPath, options2) {
|
|
50016
|
-
const markdown =
|
|
50538
|
+
const markdown = readFileSync71(synthesisPath, "utf8");
|
|
50017
50539
|
const { inDiff, unanchored } = selectPostableFindings(markdown, prInfo);
|
|
50018
50540
|
const carried = carriedUnanchoredFindings(unanchored);
|
|
50019
50541
|
if (inDiff.length === 0 && carried.length === 0) return NOTHING_POSTED;
|
|
@@ -50312,11 +50834,11 @@ import path101 from "path";
|
|
|
50312
50834
|
import chalk276 from "chalk";
|
|
50313
50835
|
|
|
50314
50836
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
50315
|
-
import { existsSync as existsSync81, readFileSync as
|
|
50837
|
+
import { existsSync as existsSync81, readFileSync as readFileSync73, writeFileSync as writeFileSync51 } from "fs";
|
|
50316
50838
|
import path100 from "path";
|
|
50317
50839
|
|
|
50318
50840
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
50319
|
-
import { readFileSync as
|
|
50841
|
+
import { readFileSync as readFileSync72 } from "fs";
|
|
50320
50842
|
import path99 from "path";
|
|
50321
50843
|
|
|
50322
50844
|
// src/commands/rules/findClaudeFiles.ts
|
|
@@ -50340,7 +50862,7 @@ function findClaudeFiles(dir) {
|
|
|
50340
50862
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
50341
50863
|
function scopedRuleDirectories(root2) {
|
|
50342
50864
|
return findClaudeFiles(root2).filter(
|
|
50343
|
-
(file) => path99.dirname(file) !== root2 && parseRulesSection(
|
|
50865
|
+
(file) => path99.dirname(file) !== root2 && parseRulesSection(readFileSync72(file, "utf8")).length > 0
|
|
50344
50866
|
).map(
|
|
50345
50867
|
(file) => `${path99.relative(root2, path99.dirname(file)).split(path99.sep).join("/")}/`
|
|
50346
50868
|
).sort();
|
|
@@ -50382,7 +50904,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
50382
50904
|
function updateScopedRulesIndex(root2) {
|
|
50383
50905
|
const directories = scopedRuleDirectories(root2);
|
|
50384
50906
|
const rootFile = path100.join(root2, "CLAUDE.md");
|
|
50385
|
-
const before = existsSync81(rootFile) ?
|
|
50907
|
+
const before = existsSync81(rootFile) ? readFileSync73(rootFile, "utf8") : "";
|
|
50386
50908
|
const after = upsertScopedRulesPointer(before, directories);
|
|
50387
50909
|
if (after !== before) writeFileSync51(rootFile, after);
|
|
50388
50910
|
return directories;
|
|
@@ -50435,7 +50957,7 @@ function listRules(target, options2 = {}) {
|
|
|
50435
50957
|
}
|
|
50436
50958
|
|
|
50437
50959
|
// src/commands/rules/addRule.ts
|
|
50438
|
-
import { existsSync as existsSync83, readFileSync as
|
|
50960
|
+
import { existsSync as existsSync83, readFileSync as readFileSync75, writeFileSync as writeFileSync52 } from "fs";
|
|
50439
50961
|
import path104 from "path";
|
|
50440
50962
|
import chalk278 from "chalk";
|
|
50441
50963
|
|
|
@@ -50460,11 +50982,11 @@ function insertRuleBullet(content, rule) {
|
|
|
50460
50982
|
}
|
|
50461
50983
|
|
|
50462
50984
|
// src/commands/rules/nextRuleCode.ts
|
|
50463
|
-
import { readFileSync as
|
|
50985
|
+
import { readFileSync as readFileSync74 } from "fs";
|
|
50464
50986
|
var CODE_PREFIX = "R";
|
|
50465
50987
|
function nextRuleCode(root2) {
|
|
50466
50988
|
const numbers = findClaudeFiles(root2).flatMap(
|
|
50467
|
-
(file) => parseRulesSection(
|
|
50989
|
+
(file) => parseRulesSection(readFileSync74(file, "utf8")).map(
|
|
50468
50990
|
(rule) => Number(/(\d+)\s*$/.exec(rule.code)?.[1] ?? 0)
|
|
50469
50991
|
)
|
|
50470
50992
|
);
|
|
@@ -50491,7 +51013,7 @@ function resolveRuleScope(target) {
|
|
|
50491
51013
|
|
|
50492
51014
|
// src/commands/rules/addRule.ts
|
|
50493
51015
|
function read3(file) {
|
|
50494
|
-
return existsSync83(file) ?
|
|
51016
|
+
return existsSync83(file) ? readFileSync75(file, "utf8") : "";
|
|
50495
51017
|
}
|
|
50496
51018
|
function addRule(text18, options2) {
|
|
50497
51019
|
const rule = text18.trim();
|
|
@@ -51359,8 +51881,8 @@ function isMutation(sql33) {
|
|
|
51359
51881
|
}
|
|
51360
51882
|
|
|
51361
51883
|
// src/commands/sql/sqlMutate.ts
|
|
51362
|
-
async function sqlMutate(
|
|
51363
|
-
if (!isMutation(
|
|
51884
|
+
async function sqlMutate(query2, connectionName) {
|
|
51885
|
+
if (!isMutation(query2)) {
|
|
51364
51886
|
console.error(
|
|
51365
51887
|
chalk292.red(
|
|
51366
51888
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
@@ -51371,7 +51893,7 @@ async function sqlMutate(query, connectionName) {
|
|
|
51371
51893
|
const conn = resolveConnection3(connectionName);
|
|
51372
51894
|
const pool = await sqlConnect(conn);
|
|
51373
51895
|
try {
|
|
51374
|
-
const result = await pool.request().query(
|
|
51896
|
+
const result = await pool.request().query(query2);
|
|
51375
51897
|
console.log(chalk292.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
51376
51898
|
} finally {
|
|
51377
51899
|
await pool.close();
|
|
@@ -51380,8 +51902,8 @@ async function sqlMutate(query, connectionName) {
|
|
|
51380
51902
|
|
|
51381
51903
|
// src/commands/sql/sqlQuery.ts
|
|
51382
51904
|
import chalk293 from "chalk";
|
|
51383
|
-
async function sqlQuery(
|
|
51384
|
-
if (isMutation(
|
|
51905
|
+
async function sqlQuery(query2, connectionName) {
|
|
51906
|
+
if (isMutation(query2)) {
|
|
51385
51907
|
console.error(
|
|
51386
51908
|
chalk293.red(
|
|
51387
51909
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
@@ -51392,7 +51914,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
51392
51914
|
const conn = resolveConnection3(connectionName);
|
|
51393
51915
|
const pool = await sqlConnect(conn);
|
|
51394
51916
|
try {
|
|
51395
|
-
const result = await pool.request().query(
|
|
51917
|
+
const result = await pool.request().query(query2);
|
|
51396
51918
|
const rows = result.recordset ?? [];
|
|
51397
51919
|
if (result.recordset) {
|
|
51398
51920
|
printTable(rows);
|
|
@@ -51442,12 +51964,12 @@ function registerSql(program) {
|
|
|
51442
51964
|
auth.command("remove <name>").description("Remove a configured connection").action((name2) => sqlAuth.remove(name2));
|
|
51443
51965
|
cmd.command("set-connection <name>").description("Set the default SQL connection").action((name2) => sqlSetConnection(name2));
|
|
51444
51966
|
cmd.command("query <sql> [connection]").description("Execute a read-only SQL query (rejects mutating statements)").action(
|
|
51445
|
-
(
|
|
51967
|
+
(query2, connection) => sqlQuery(query2, connection)
|
|
51446
51968
|
);
|
|
51447
51969
|
cmd.command("mutate <sql> [connection]").description(
|
|
51448
51970
|
"Execute a mutating SQL statement (rejects non-mutating statements)"
|
|
51449
51971
|
).action(
|
|
51450
|
-
(
|
|
51972
|
+
(query2, connection) => sqlMutate(query2, connection)
|
|
51451
51973
|
);
|
|
51452
51974
|
cmd.command("tables [connection]").description("List tables in the connected database").action((connection) => sqlTables(connection));
|
|
51453
51975
|
cmd.command("columns <table> [connection]").description(
|
|
@@ -51860,16 +52382,16 @@ var retiredSyncNames = {
|
|
|
51860
52382
|
|
|
51861
52383
|
// src/commands/sync/retiredOwnedPaths.ts
|
|
51862
52384
|
function retiredOwnedPaths() {
|
|
51863
|
-
const { claude, codex, pi } = harnesses;
|
|
52385
|
+
const { claude: claude2, codex, pi } = harnesses;
|
|
51864
52386
|
const paths = retiredSyncNames.commands.flatMap((name2) => [
|
|
51865
|
-
path115.join(
|
|
51866
|
-
path115.join(
|
|
52387
|
+
path115.join(claude2.homeDir, "commands", `${name2}.md`),
|
|
52388
|
+
path115.join(claude2.homeDir, claude2.sync.commandDest(name2)),
|
|
51867
52389
|
path115.join(codex.homeDir, codex.sync.commandDest(name2)),
|
|
51868
52390
|
path115.join(pi.homeDir, pi.sync.commandDest(name2))
|
|
51869
52391
|
]);
|
|
51870
52392
|
for (const name2 of retiredSyncNames.skillDirs)
|
|
51871
52393
|
paths.push(
|
|
51872
|
-
path115.join(
|
|
52394
|
+
path115.join(claude2.homeDir, "skills", name2),
|
|
51873
52395
|
path115.join(codex.homeDir, "skills", name2)
|
|
51874
52396
|
);
|
|
51875
52397
|
return paths.filter((file) => fs62.existsSync(file));
|
|
@@ -52528,9 +53050,9 @@ function formatVttPassages(passages, notes = [], { sourceMarks = true } = {}) {
|
|
|
52528
53050
|
}
|
|
52529
53051
|
|
|
52530
53052
|
// src/commands/transcript/convert/readCleanedCues.ts
|
|
52531
|
-
import { readFileSync as
|
|
53053
|
+
import { readFileSync as readFileSync84 } from "fs";
|
|
52532
53054
|
function readCleanedCues(inputPath) {
|
|
52533
|
-
return deduplicateCues(parseVtt(
|
|
53055
|
+
return deduplicateCues(parseVtt(readFileSync84(inputPath, "utf8")));
|
|
52534
53056
|
}
|
|
52535
53057
|
|
|
52536
53058
|
// src/commands/transcript/clean.ts
|
|
@@ -53309,7 +53831,7 @@ function configKeys2() {
|
|
|
53309
53831
|
}
|
|
53310
53832
|
|
|
53311
53833
|
// src/commands/verify/forbiddenStrings.ts
|
|
53312
|
-
import { existsSync as existsSync96, readFileSync as
|
|
53834
|
+
import { existsSync as existsSync96, readFileSync as readFileSync85 } from "fs";
|
|
53313
53835
|
|
|
53314
53836
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
53315
53837
|
import { minimatch as minimatch10 } from "minimatch";
|
|
@@ -53356,7 +53878,7 @@ function forbiddenStrings() {
|
|
|
53356
53878
|
}
|
|
53357
53879
|
let parsed;
|
|
53358
53880
|
try {
|
|
53359
|
-
parsed = JSON.parse(
|
|
53881
|
+
parsed = JSON.parse(readFileSync85(file, "utf8"));
|
|
53360
53882
|
} catch (error) {
|
|
53361
53883
|
console.log(`Could not parse ${file}: ${error.message}`);
|
|
53362
53884
|
process.exit(1);
|
|
@@ -53382,13 +53904,13 @@ Total: ${violations.length} forbidden string(s).`);
|
|
|
53382
53904
|
}
|
|
53383
53905
|
|
|
53384
53906
|
// src/commands/verify/hardcodedColors.ts
|
|
53385
|
-
import { execFileSync as
|
|
53907
|
+
import { execFileSync as execFileSync32 } from "child_process";
|
|
53386
53908
|
import { minimatch as minimatch11 } from "minimatch";
|
|
53387
53909
|
var pattern = "0x[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,6}";
|
|
53388
53910
|
function hardcodedColors() {
|
|
53389
53911
|
const ignoreGlobs = loadConfig().hardcodedColors?.ignore ?? [];
|
|
53390
53912
|
try {
|
|
53391
|
-
const output =
|
|
53913
|
+
const output = execFileSync32("grep", ["-rEnH", "-f", "-", "src/"], {
|
|
53392
53914
|
encoding: "utf8",
|
|
53393
53915
|
input: `${pattern}
|
|
53394
53916
|
`
|
|
@@ -53473,7 +53995,7 @@ async function harnessFollowUps() {
|
|
|
53473
53995
|
}
|
|
53474
53996
|
|
|
53475
53997
|
// src/commands/verify/migrations.ts
|
|
53476
|
-
import { readFileSync as
|
|
53998
|
+
import { readFileSync as readFileSync86 } from "fs";
|
|
53477
53999
|
import path126 from "path";
|
|
53478
54000
|
|
|
53479
54001
|
// src/commands/verify/migrations/checkAppendOnly.ts
|
|
@@ -53638,7 +54160,7 @@ function migrations2() {
|
|
|
53638
54160
|
if (ref) {
|
|
53639
54161
|
const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
|
|
53640
54162
|
const current2 = new Map(
|
|
53641
|
-
files.map((file) => [file,
|
|
54163
|
+
files.map((file) => [file, readFileSync86(path126.join(dir, file), "utf8")])
|
|
53642
54164
|
);
|
|
53643
54165
|
for (const finding of checkAppendOnly(baseline, current2)) {
|
|
53644
54166
|
problems.push(
|
|
@@ -54344,11 +54866,11 @@ function consumeSimulatedDivergence(cwd) {
|
|
|
54344
54866
|
}
|
|
54345
54867
|
|
|
54346
54868
|
// src/commands/watch/fetchQuietly.ts
|
|
54347
|
-
import { execFileSync as
|
|
54869
|
+
import { execFileSync as execFileSync33 } from "child_process";
|
|
54348
54870
|
var MIN_FETCH_TIMEOUT_MS = 6e4;
|
|
54349
54871
|
function fetchQuietly(cwd, intervalMs) {
|
|
54350
54872
|
try {
|
|
54351
|
-
|
|
54873
|
+
execFileSync33("git", ["fetch", "--quiet"], {
|
|
54352
54874
|
stdio: ["pipe", "pipe", "pipe"],
|
|
54353
54875
|
cwd,
|
|
54354
54876
|
timeout: Math.max(intervalMs, MIN_FETCH_TIMEOUT_MS)
|
|
@@ -54544,11 +55066,11 @@ function decideLap(end, interrupted) {
|
|
|
54544
55066
|
}
|
|
54545
55067
|
|
|
54546
55068
|
// src/commands/watch/runWatchLap.ts
|
|
54547
|
-
import { spawn as
|
|
55069
|
+
import { spawn as spawn13 } from "child_process";
|
|
54548
55070
|
var WATCH_LAP_ARGS = ["watch", "wait", "--pull", "--build"];
|
|
54549
55071
|
function runWatchLap() {
|
|
54550
55072
|
return new Promise((resolve36, reject) => {
|
|
54551
|
-
const assistFromPath =
|
|
55073
|
+
const assistFromPath = spawn13("assist", WATCH_LAP_ARGS, {
|
|
54552
55074
|
stdio: "inherit",
|
|
54553
55075
|
shell: process.platform === "win32"
|
|
54554
55076
|
});
|
|
@@ -54617,8 +55139,8 @@ function registerWatch(program) {
|
|
|
54617
55139
|
}
|
|
54618
55140
|
|
|
54619
55141
|
// src/commands/roam/postRoamActivity.ts
|
|
54620
|
-
import { execFileSync as
|
|
54621
|
-
import { readdirSync as readdirSync27, readFileSync as
|
|
55142
|
+
import { execFileSync as execFileSync34 } from "child_process";
|
|
55143
|
+
import { readdirSync as readdirSync27, readFileSync as readFileSync87, statSync as statSync18 } from "fs";
|
|
54622
55144
|
import { join as join123 } from "path";
|
|
54623
55145
|
function findPortFile(roamDir) {
|
|
54624
55146
|
let entries2;
|
|
@@ -54649,14 +55171,14 @@ function postRoamActivity(app, event) {
|
|
|
54649
55171
|
if (!portFile) return;
|
|
54650
55172
|
let port;
|
|
54651
55173
|
try {
|
|
54652
|
-
port =
|
|
55174
|
+
port = readFileSync87(portFile, "utf8").trim();
|
|
54653
55175
|
} catch {
|
|
54654
55176
|
return;
|
|
54655
55177
|
}
|
|
54656
55178
|
const pid = PID_BY_APP[app] ?? 99999;
|
|
54657
55179
|
const url = `http://127.0.0.1:${port}/api/v1/activity/${app}/${event}?pid=${pid}`;
|
|
54658
55180
|
try {
|
|
54659
|
-
|
|
55181
|
+
execFileSync34("curl", ["-sf", "--max-time", "0.2", "-X", "POST", url], {
|
|
54660
55182
|
stdio: "ignore"
|
|
54661
55183
|
});
|
|
54662
55184
|
} catch {
|
|
@@ -55214,7 +55736,7 @@ async function remove2(name2, options2 = {}) {
|
|
|
55214
55736
|
|
|
55215
55737
|
// src/commands/run/registerRunSubcommands.ts
|
|
55216
55738
|
function registerRunSubcommands(runCommand) {
|
|
55217
|
-
runCommand.command("list").description("List configured run commands").option("-v, --verbose", "Show full command details").action((
|
|
55739
|
+
runCommand.command("list").description("List configured run commands").option("-v, --verbose", "Show full command details").action((opts2) => listRunConfigs(!!opts2.verbose));
|
|
55218
55740
|
registerRunAdd(runCommand);
|
|
55219
55741
|
runCommand.command("link").description("Link run configurations from another project's assist.yml").argument("<path>", "Relative path to the linked project").requiredOption("--prefix <prefix>", "Namespace prefix for linked commands").allowUnknownOption().action(() => link2());
|
|
55220
55742
|
runCommand.command("remove").description(
|
|
@@ -55222,7 +55744,7 @@ function registerRunSubcommands(runCommand) {
|
|
|
55222
55744
|
).argument("<name>", "Name of the run configuration to remove").option(
|
|
55223
55745
|
"--repo [name]",
|
|
55224
55746
|
"Remove from a repo's override in the shared db instead of assist.yml (defaults to the current repo)"
|
|
55225
|
-
).action((name2,
|
|
55747
|
+
).action((name2, opts2) => remove2(name2, opts2));
|
|
55226
55748
|
}
|
|
55227
55749
|
|
|
55228
55750
|
// src/commands/run/registerRun.ts
|
|
@@ -55252,11 +55774,11 @@ function formatLink(link3) {
|
|
|
55252
55774
|
}
|
|
55253
55775
|
|
|
55254
55776
|
// src/commands/sessions/daemon/listDaemonPids.ts
|
|
55255
|
-
import { execFileSync as
|
|
55777
|
+
import { execFileSync as execFileSync35 } from "child_process";
|
|
55256
55778
|
function listDaemonPids() {
|
|
55257
55779
|
if (process.platform === "win32") return [];
|
|
55258
55780
|
try {
|
|
55259
|
-
const out =
|
|
55781
|
+
const out = execFileSync35("ps", ["-eo", "pid=,args="], {
|
|
55260
55782
|
encoding: "utf8"
|
|
55261
55783
|
});
|
|
55262
55784
|
return out.split("\n").filter((line) => line.includes("assist") && / daemon run\b/.test(line)).map((line) => Number.parseInt(line.trim(), 10)).filter((pid) => Number.isInteger(pid));
|
|
@@ -55302,11 +55824,11 @@ function applyLine(result, pending, line) {
|
|
|
55302
55824
|
}
|
|
55303
55825
|
|
|
55304
55826
|
// src/commands/sessions/daemon/readDaemonPidFile.ts
|
|
55305
|
-
import { readFileSync as
|
|
55827
|
+
import { readFileSync as readFileSync88 } from "fs";
|
|
55306
55828
|
function readDaemonPidFile() {
|
|
55307
55829
|
try {
|
|
55308
55830
|
const pid = Number.parseInt(
|
|
55309
|
-
|
|
55831
|
+
readFileSync88(daemonPaths.pid, "utf8").trim(),
|
|
55310
55832
|
10
|
|
55311
55833
|
);
|
|
55312
55834
|
return Number.isInteger(pid) ? pid : void 0;
|
|
@@ -55912,9 +56434,17 @@ function toSessionViewInfo({
|
|
|
55912
56434
|
rows,
|
|
55913
56435
|
activeViewer,
|
|
55914
56436
|
activeViewerNode,
|
|
55915
|
-
transfer
|
|
56437
|
+
transfer,
|
|
56438
|
+
pty: pty2,
|
|
56439
|
+
sdkActivity,
|
|
56440
|
+
sdkQueued,
|
|
56441
|
+
sdkInterrupting
|
|
55916
56442
|
}) {
|
|
55917
56443
|
return {
|
|
56444
|
+
sdk: pty2?.sdk ? true : void 0,
|
|
56445
|
+
sdkActivity,
|
|
56446
|
+
sdkQueued,
|
|
56447
|
+
sdkInterrupting,
|
|
55918
56448
|
transfer,
|
|
55919
56449
|
lastUserMessage,
|
|
55920
56450
|
lastAssistantMessage,
|
|
@@ -56138,6 +56668,20 @@ function releaseViewer(sessions, viewerId) {
|
|
|
56138
56668
|
return released;
|
|
56139
56669
|
}
|
|
56140
56670
|
|
|
56671
|
+
// src/commands/sessions/daemon/isSdkSession.ts
|
|
56672
|
+
function isSdkSession(session) {
|
|
56673
|
+
return Boolean(session.pty?.sdk);
|
|
56674
|
+
}
|
|
56675
|
+
|
|
56676
|
+
// src/commands/sessions/daemon/skipsTerminalPath.ts
|
|
56677
|
+
function skipsTerminalPath(session, path128) {
|
|
56678
|
+
if (!isSdkSession(session)) return false;
|
|
56679
|
+
daemonLog(
|
|
56680
|
+
`session ${session.id} ${path128} skipped: Claude (SDK) session has no terminal`
|
|
56681
|
+
);
|
|
56682
|
+
return true;
|
|
56683
|
+
}
|
|
56684
|
+
|
|
56141
56685
|
// src/commands/sessions/daemon/claimViewer.ts
|
|
56142
56686
|
function claimViewer(session, { viewerId, viewerNode, onClaim }, via) {
|
|
56143
56687
|
if (!viewerId || session.activeViewer === viewerId) return;
|
|
@@ -56197,7 +56741,8 @@ function sendResizeSnapshot(s, send2) {
|
|
|
56197
56741
|
// src/commands/sessions/daemon/resizeSession.ts
|
|
56198
56742
|
function resizeSession(sessions, id, cols, rows, viewer = {}) {
|
|
56199
56743
|
const s = sessions.get(id);
|
|
56200
|
-
if (!s || isInactiveViewer(s, viewer))
|
|
56744
|
+
if (!s || isInactiveViewer(s, viewer) || skipsTerminalPath(s, "resize"))
|
|
56745
|
+
return;
|
|
56201
56746
|
claimViewer(s, viewer, "resize");
|
|
56202
56747
|
if (s.status === "done" || !s.pty) return;
|
|
56203
56748
|
const unchanged = s.cols === cols && s.rows === rows;
|
|
@@ -56227,6 +56772,11 @@ var SUBMIT = "\r";
|
|
|
56227
56772
|
function bracketedPaste(text18) {
|
|
56228
56773
|
return `${PASTE_START}${text18.replace(/\r?\n/g, SUBMIT)}${PASTE_END}`;
|
|
56229
56774
|
}
|
|
56775
|
+
function unwrapBracketedPaste(data) {
|
|
56776
|
+
if (!data.startsWith(PASTE_START) || !data.endsWith(PASTE_END))
|
|
56777
|
+
return void 0;
|
|
56778
|
+
return data.slice(PASTE_START.length, data.length - PASTE_END.length).replaceAll(SUBMIT, "\n");
|
|
56779
|
+
}
|
|
56230
56780
|
|
|
56231
56781
|
// src/commands/sessions/shared/pasteAndSubmit.ts
|
|
56232
56782
|
var SUBMIT_DELAY_MS = 150;
|
|
@@ -56299,6 +56849,16 @@ var ViewerConnections = class {
|
|
|
56299
56849
|
}
|
|
56300
56850
|
};
|
|
56301
56851
|
|
|
56852
|
+
// src/commands/sessions/daemon/dropsInactiveViewerResponse.ts
|
|
56853
|
+
function dropsInactiveViewerResponse(s, response, viewer) {
|
|
56854
|
+
if (!response || !s.activeViewer || viewer.viewerId === s.activeViewer)
|
|
56855
|
+
return false;
|
|
56856
|
+
daemonLog(
|
|
56857
|
+
`session ${s.id} dropped terminal response from inactive viewer ${viewer.viewerId ?? "unknown"} on ${viewer.viewerNode ?? "unknown node"}`
|
|
56858
|
+
);
|
|
56859
|
+
return true;
|
|
56860
|
+
}
|
|
56861
|
+
|
|
56302
56862
|
// src/commands/sessions/daemon/isTerminalResponse.ts
|
|
56303
56863
|
var ESC4 = String.raw`\x1b`;
|
|
56304
56864
|
var ST = String.raw`(?:\x07|${ESC4}\\)`;
|
|
@@ -56368,17 +56928,28 @@ function watchPromptSubmit(session, data, onStatusChange) {
|
|
|
56368
56928
|
watchSubmitOutcome(session, onStatusChange);
|
|
56369
56929
|
}
|
|
56370
56930
|
|
|
56931
|
+
// src/commands/sessions/daemon/writeToSdkSession.ts
|
|
56932
|
+
function writeToSdkSession(session, data) {
|
|
56933
|
+
const text18 = unwrapBracketedPaste(data);
|
|
56934
|
+
if (text18 !== void 0) {
|
|
56935
|
+
daemonLog(`session ${session.id} sdk message received from input`);
|
|
56936
|
+
session.pty?.sdk?.send(text18);
|
|
56937
|
+
return;
|
|
56938
|
+
}
|
|
56939
|
+
if (data === SUBMIT) {
|
|
56940
|
+
daemonLog(`session ${session.id} sdk submit ignored: paste already sent`);
|
|
56941
|
+
return;
|
|
56942
|
+
}
|
|
56943
|
+
skipsTerminalPath(session, "input");
|
|
56944
|
+
}
|
|
56945
|
+
|
|
56371
56946
|
// src/commands/sessions/daemon/writeToSession.ts
|
|
56372
56947
|
function writeToSession(sessions, id, data, onStatusChange, viewer = {}) {
|
|
56373
56948
|
const s = sessions.get(id);
|
|
56374
56949
|
if (!s || s.status === "done") return;
|
|
56950
|
+
if (isSdkSession(s)) return writeToSdkSession(s, data);
|
|
56375
56951
|
const response = isTerminalResponse(data);
|
|
56376
|
-
if (
|
|
56377
|
-
daemonLog(
|
|
56378
|
-
`session ${id} dropped terminal response from inactive viewer ${viewer.viewerId ?? "unknown"} on ${viewer.viewerNode ?? "unknown node"}`
|
|
56379
|
-
);
|
|
56380
|
-
return;
|
|
56381
|
-
}
|
|
56952
|
+
if (dropsInactiveViewerResponse(s, response, viewer)) return;
|
|
56382
56953
|
s.pty?.write(data);
|
|
56383
56954
|
watchPromptSubmit(s, data, onStatusChange);
|
|
56384
56955
|
if (!response) claimViewer(s, viewer, "input");
|
|
@@ -56822,14 +57393,14 @@ async function runAutoUpdateLoop(deps2, maxLaps = Number.POSITIVE_INFINITY) {
|
|
|
56822
57393
|
}
|
|
56823
57394
|
|
|
56824
57395
|
// src/commands/sessions/daemon/autoUpdate/trimWatcherLog.ts
|
|
56825
|
-
import { readFileSync as
|
|
57396
|
+
import { readFileSync as readFileSync89, writeFileSync as writeFileSync63 } from "fs";
|
|
56826
57397
|
var KEEP_TAIL = 256 * 1024;
|
|
56827
57398
|
var MAX_LOG_SIZE = 4 * 1024 * 1024;
|
|
56828
57399
|
function trimWatcherLog(cwd) {
|
|
56829
57400
|
const path128 = watcherLogPath(cwd);
|
|
56830
57401
|
let log2;
|
|
56831
57402
|
try {
|
|
56832
|
-
log2 =
|
|
57403
|
+
log2 = readFileSync89(path128, "utf8");
|
|
56833
57404
|
} catch {
|
|
56834
57405
|
return;
|
|
56835
57406
|
}
|
|
@@ -57223,7 +57794,7 @@ function noteAutoUpdate(installDir, text18) {
|
|
|
57223
57794
|
}
|
|
57224
57795
|
|
|
57225
57796
|
// src/commands/sessions/daemon/autoUpdate/runUpdateLap.ts
|
|
57226
|
-
import { spawn as
|
|
57797
|
+
import { spawn as spawn14 } from "child_process";
|
|
57227
57798
|
import { rmSync as rmSync17 } from "fs";
|
|
57228
57799
|
function clearLapSignals(cwd) {
|
|
57229
57800
|
const control = watchControlPaths(cwd);
|
|
@@ -57235,7 +57806,7 @@ function runUpdateLap(cwd, onOutput) {
|
|
|
57235
57806
|
clearLapSignals(cwd);
|
|
57236
57807
|
return new Promise((resolve36, reject) => {
|
|
57237
57808
|
const { ASSIST_ACTIVITY_ID: _activity, ...env } = process.env;
|
|
57238
|
-
const child2 =
|
|
57809
|
+
const child2 = spawn14(
|
|
57239
57810
|
process.execPath,
|
|
57240
57811
|
[process.argv[1], ...WATCH_LAP_ARGS],
|
|
57241
57812
|
{
|
|
@@ -57586,7 +58157,7 @@ function releaseUndeletableLeftover(session, reason4, notify2) {
|
|
|
57586
58157
|
|
|
57587
58158
|
// src/commands/sessions/daemon/killPtyTree.ts
|
|
57588
58159
|
function killPtyTree(pty2) {
|
|
57589
|
-
if (process.platform === "win32") {
|
|
58160
|
+
if (pty2.sdk || process.platform === "win32") {
|
|
57590
58161
|
try {
|
|
57591
58162
|
pty2.kill();
|
|
57592
58163
|
} catch {
|
|
@@ -57689,10 +58260,10 @@ import { readdirSync as readdirSync29, readlinkSync } from "fs";
|
|
|
57689
58260
|
import { sep as sep6 } from "path";
|
|
57690
58261
|
|
|
57691
58262
|
// src/commands/sessions/daemon/worktree/readProc.ts
|
|
57692
|
-
import { readFileSync as
|
|
58263
|
+
import { readFileSync as readFileSync90 } from "fs";
|
|
57693
58264
|
function readProc(procRoot, pid, file) {
|
|
57694
58265
|
try {
|
|
57695
|
-
return
|
|
58266
|
+
return readFileSync90(`${procRoot}/${pid}/${file}`, "utf8");
|
|
57696
58267
|
} catch {
|
|
57697
58268
|
return void 0;
|
|
57698
58269
|
}
|
|
@@ -58949,9 +59520,42 @@ function handlePtyExit(session, exitCode, onStatusChange) {
|
|
|
58949
59520
|
onStatusChange(session, "done", exitCode);
|
|
58950
59521
|
}
|
|
58951
59522
|
|
|
59523
|
+
// src/commands/sessions/daemon/wireSdkEvents.ts
|
|
59524
|
+
function applyViewEvent(session, event) {
|
|
59525
|
+
if (event.kind === "activity") {
|
|
59526
|
+
session.sdkActivity = event.text ?? void 0;
|
|
59527
|
+
daemonLog(`session ${session.id} sdk activity: ${event.text ?? "cleared"}`);
|
|
59528
|
+
} else if (event.kind === "queued") {
|
|
59529
|
+
session.sdkQueued = event.texts.length ? event.texts : void 0;
|
|
59530
|
+
daemonLog(`session ${session.id} sdk queued: ${event.texts.length}`);
|
|
59531
|
+
} else {
|
|
59532
|
+
session.sdkInterrupting = event.pending || void 0;
|
|
59533
|
+
daemonLog(
|
|
59534
|
+
`session ${session.id} sdk interrupt ${event.pending ? "pending" : "landed"}`
|
|
59535
|
+
);
|
|
59536
|
+
}
|
|
59537
|
+
}
|
|
59538
|
+
function wireSdkEvents(session, onStatusChange, notify2) {
|
|
59539
|
+
session.pty?.sdk?.onEvent((event) => {
|
|
59540
|
+
if (session.status === "done" || session.status === "stopped") return;
|
|
59541
|
+
if (event.kind !== "status") {
|
|
59542
|
+
applyViewEvent(session, event);
|
|
59543
|
+
notify2?.();
|
|
59544
|
+
return;
|
|
59545
|
+
}
|
|
59546
|
+
if (event.status === session.status) return;
|
|
59547
|
+
daemonLog(
|
|
59548
|
+
`session ${session.id} status from sdk: ${session.status} -> ${event.status}`
|
|
59549
|
+
);
|
|
59550
|
+
session.permissionActive = false;
|
|
59551
|
+
onStatusChange(session, event.status);
|
|
59552
|
+
});
|
|
59553
|
+
}
|
|
59554
|
+
|
|
58952
59555
|
// src/commands/sessions/daemon/wirePtyEvents.ts
|
|
58953
|
-
function wirePtyEvents(session, clients, onStatusChange) {
|
|
59556
|
+
function wirePtyEvents(session, clients, onStatusChange, notify2) {
|
|
58954
59557
|
if (!session.pty) return;
|
|
59558
|
+
wireSdkEvents(session, onStatusChange, notify2);
|
|
58955
59559
|
session.pty.onData((data) => emitSessionOutput(session, clients, data));
|
|
58956
59560
|
session.pty.onExit(({ exitCode }) => {
|
|
58957
59561
|
handlePtyExit(session, exitCode, onStatusChange);
|
|
@@ -58960,6 +59564,7 @@ function wirePtyEvents(session, clients, onStatusChange) {
|
|
|
58960
59564
|
}
|
|
58961
59565
|
function reportSilentFailure(session, clients) {
|
|
58962
59566
|
if (session.status !== "error" || !session.error) return;
|
|
59567
|
+
if (isSdkSession(session)) return;
|
|
58963
59568
|
if (session.scrollback.length > 0) return;
|
|
58964
59569
|
emitSessionOutput(
|
|
58965
59570
|
session,
|
|
@@ -59103,7 +59708,7 @@ function isOpeningReference(text18) {
|
|
|
59103
59708
|
return !args || isBareReferencePrompt(args);
|
|
59104
59709
|
}
|
|
59105
59710
|
function eventText(event) {
|
|
59106
|
-
return
|
|
59711
|
+
return "text" in event ? event.text.trim() : "";
|
|
59107
59712
|
}
|
|
59108
59713
|
function contextAfterReference(events) {
|
|
59109
59714
|
const parts2 = [];
|
|
@@ -59224,7 +59829,7 @@ function wireSessionWatchers(session, notify2, onStatusChange) {
|
|
|
59224
59829
|
function registerSpawnedSession(session, sessions, clients, onStatusChange, notify2, context) {
|
|
59225
59830
|
if (context?.launchedFrom) session.launchedFrom = context.launchedFrom;
|
|
59226
59831
|
sessions.set(session.id, session);
|
|
59227
|
-
wirePtyEvents(session, clients, onStatusChange);
|
|
59832
|
+
wirePtyEvents(session, clients, onStatusChange, notify2);
|
|
59228
59833
|
notify2();
|
|
59229
59834
|
wireSessionWatchers(session, notify2, onStatusChange);
|
|
59230
59835
|
logSpawnedSession(session);
|
|
@@ -60107,7 +60712,7 @@ function releaseClient(client, clients, prPreview, verify) {
|
|
|
60107
60712
|
}
|
|
60108
60713
|
|
|
60109
60714
|
// src/commands/sessions/daemon/findPortHolderPid.ts
|
|
60110
|
-
import { execFileSync as
|
|
60715
|
+
import { execFileSync as execFileSync36 } from "child_process";
|
|
60111
60716
|
var PROBE_TIMEOUT_MS = 3e3;
|
|
60112
60717
|
function findPortHolderPid(port) {
|
|
60113
60718
|
try {
|
|
@@ -60117,7 +60722,7 @@ function findPortHolderPid(port) {
|
|
|
60117
60722
|
}
|
|
60118
60723
|
}
|
|
60119
60724
|
function probe2(command, args) {
|
|
60120
|
-
return
|
|
60725
|
+
return execFileSync36(command, args, {
|
|
60121
60726
|
encoding: "utf8",
|
|
60122
60727
|
timeout: PROBE_TIMEOUT_MS,
|
|
60123
60728
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -60188,7 +60793,7 @@ function startHeldSession(session, sessions, clients, onStatusChange, notify2, t
|
|
|
60188
60793
|
session.pty?.resize(session.cols, session.rows);
|
|
60189
60794
|
} catch {
|
|
60190
60795
|
}
|
|
60191
|
-
wirePtyEvents(session, clients, onStatusChange);
|
|
60796
|
+
wirePtyEvents(session, clients, onStatusChange, notify2);
|
|
60192
60797
|
daemonLog(
|
|
60193
60798
|
`session ${session.id} started once ${trigger ?? `worktree ${session.worktree?.path ?? session.cwd} finished seeding`}`
|
|
60194
60799
|
);
|
|
@@ -60636,8 +61241,8 @@ function serverRunMeta(runName, cwd) {
|
|
|
60636
61241
|
}
|
|
60637
61242
|
|
|
60638
61243
|
// src/commands/sessions/daemon/spawnRun.ts
|
|
60639
|
-
function spawnRun(
|
|
60640
|
-
return spawnPty(["assist", "run",
|
|
61244
|
+
function spawnRun(opts2) {
|
|
61245
|
+
return spawnPty(["assist", "run", opts2.name, ...opts2.args ?? []], opts2.cwd);
|
|
60641
61246
|
}
|
|
60642
61247
|
|
|
60643
61248
|
// src/commands/sessions/daemon/restoreServerRun.ts
|
|
@@ -61262,10 +61867,10 @@ function restoreAllSessions(spawner, deps2) {
|
|
|
61262
61867
|
|
|
61263
61868
|
// src/commands/sessions/daemon/retrySession.ts
|
|
61264
61869
|
function retrySession(session, clients, onStatusChange) {
|
|
61265
|
-
const
|
|
61266
|
-
if (!
|
|
61870
|
+
const spawn15 = respawnThunk(session);
|
|
61871
|
+
if (!spawn15) return false;
|
|
61267
61872
|
const respawn = () => {
|
|
61268
|
-
respawnSession(session,
|
|
61873
|
+
respawnSession(session, spawn15, "running", clients, onStatusChange);
|
|
61269
61874
|
daemonLog(`session ${session.id} retried: ${session.name}`);
|
|
61270
61875
|
};
|
|
61271
61876
|
const pty2 = session.pty;
|
|
@@ -61919,6 +62524,14 @@ function relayToCreator(label) {
|
|
|
61919
62524
|
};
|
|
61920
62525
|
}
|
|
61921
62526
|
|
|
62527
|
+
// src/commands/sessions/daemon/links/relayWithNodeSessionId.ts
|
|
62528
|
+
function relayWithNodeSessionId(state, msg) {
|
|
62529
|
+
broadcastToViewers(state, {
|
|
62530
|
+
...msg,
|
|
62531
|
+
sessionId: toNodeSessionId(state.node, msg.sessionId)
|
|
62532
|
+
});
|
|
62533
|
+
}
|
|
62534
|
+
|
|
61922
62535
|
// src/commands/sessions/daemon/links/relayLinkMessage.ts
|
|
61923
62536
|
var nsId = (state, msg) => toNodeSessionId(state.node, msg.sessionId);
|
|
61924
62537
|
var relayOutput = (state, msg) => {
|
|
@@ -61943,7 +62556,7 @@ var relayHistory = (state, msg) => {
|
|
|
61943
62556
|
var relays = {
|
|
61944
62557
|
sessions: relayLinkSessions,
|
|
61945
62558
|
output: relayOutput,
|
|
61946
|
-
clear:
|
|
62559
|
+
clear: relayWithNodeSessionId,
|
|
61947
62560
|
created: relayToCreator("created session"),
|
|
61948
62561
|
error: relayToCreator("peer error:"),
|
|
61949
62562
|
notice: (state, msg) => broadcastToViewers(state, msg),
|
|
@@ -61956,7 +62569,8 @@ var relays = {
|
|
|
61956
62569
|
...msg,
|
|
61957
62570
|
sessionId: typeof msg.sessionId === "string" ? nsId(state, msg) : void 0
|
|
61958
62571
|
}),
|
|
61959
|
-
"user-messages":
|
|
62572
|
+
"user-messages": relayWithNodeSessionId,
|
|
62573
|
+
"session-transcript": relayWithNodeSessionId,
|
|
61960
62574
|
limits: (state, msg) => state.onLimits(
|
|
61961
62575
|
msg.harness,
|
|
61962
62576
|
msg.rateLimits
|
|
@@ -62302,6 +62916,7 @@ var NodeLinks = class {
|
|
|
62302
62916
|
// src/commands/sessions/daemon/replayScrollback.ts
|
|
62303
62917
|
function replayScrollback(sessions, client) {
|
|
62304
62918
|
for (const s of sessions.values()) {
|
|
62919
|
+
if (skipsTerminalPath(s, "scrollback replay")) continue;
|
|
62305
62920
|
if (s.scrollback)
|
|
62306
62921
|
sendTo(client, {
|
|
62307
62922
|
type: "output",
|
|
@@ -62920,6 +63535,21 @@ var handleHelloRequest = (client, m, d) => {
|
|
|
62920
63535
|
m.replayLocal(client);
|
|
62921
63536
|
};
|
|
62922
63537
|
|
|
63538
|
+
// src/commands/sessions/daemon/handleInterrupt.ts
|
|
63539
|
+
var handleInterrupt = routed((_client, m, d) => {
|
|
63540
|
+
const id = String(d.sessionId);
|
|
63541
|
+
const session = m.session(id);
|
|
63542
|
+
const sdk = session?.pty?.sdk;
|
|
63543
|
+
if (!sdk) {
|
|
63544
|
+
daemonLog(
|
|
63545
|
+
`interrupt ignored: session ${id} ${session ? "is not a Claude (SDK) session" : "was not found"}`
|
|
63546
|
+
);
|
|
63547
|
+
return;
|
|
63548
|
+
}
|
|
63549
|
+
daemonLog(`interrupt received: session ${id}`);
|
|
63550
|
+
sdk.interrupt();
|
|
63551
|
+
});
|
|
63552
|
+
|
|
62923
63553
|
// src/commands/sessions/daemon/handleWebLog.ts
|
|
62924
63554
|
var handleWebLog = (client, _m, d) => {
|
|
62925
63555
|
daemonLog(`web: ${String(d.message)}`);
|
|
@@ -62967,12 +63597,12 @@ function transcriptLineTexts(line, harness) {
|
|
|
62967
63597
|
function escapeRegExp3(text18) {
|
|
62968
63598
|
return text18.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
|
|
62969
63599
|
}
|
|
62970
|
-
function encodesVerbatimInJson(
|
|
62971
|
-
return JSON.stringify(
|
|
63600
|
+
function encodesVerbatimInJson(query2) {
|
|
63601
|
+
return JSON.stringify(query2) === `"${query2}"`;
|
|
62972
63602
|
}
|
|
62973
|
-
function rawLinePrefilter(
|
|
62974
|
-
if (!encodesVerbatimInJson(
|
|
62975
|
-
const lower =
|
|
63603
|
+
function rawLinePrefilter(query2) {
|
|
63604
|
+
if (!encodesVerbatimInJson(query2)) return () => true;
|
|
63605
|
+
const lower = query2.toLowerCase();
|
|
62976
63606
|
return (line) => line.toLowerCase().includes(lower);
|
|
62977
63607
|
}
|
|
62978
63608
|
function matchTexts(texts, pattern2) {
|
|
@@ -62982,12 +63612,12 @@ function matchTexts(texts, pattern2) {
|
|
|
62982
63612
|
}
|
|
62983
63613
|
return null;
|
|
62984
63614
|
}
|
|
62985
|
-
function queryPattern(
|
|
62986
|
-
return new RegExp(escapeRegExp3(
|
|
63615
|
+
function queryPattern(query2) {
|
|
63616
|
+
return new RegExp(escapeRegExp3(query2), "i");
|
|
62987
63617
|
}
|
|
62988
|
-
async function findTranscriptMatch(filePath, harness,
|
|
62989
|
-
const pattern2 = queryPattern(
|
|
62990
|
-
const mayMatch = rawLinePrefilter(
|
|
63618
|
+
async function findTranscriptMatch(filePath, harness, query2) {
|
|
63619
|
+
const pattern2 = queryPattern(query2);
|
|
63620
|
+
const mayMatch = rawLinePrefilter(query2);
|
|
62991
63621
|
const stream = fs72.createReadStream(filePath, { encoding: "utf8" });
|
|
62992
63622
|
const reader = readline5.createInterface({
|
|
62993
63623
|
input: stream,
|
|
@@ -63007,8 +63637,8 @@ async function findTranscriptMatch(filePath, harness, query) {
|
|
|
63007
63637
|
stream.destroy();
|
|
63008
63638
|
}
|
|
63009
63639
|
}
|
|
63010
|
-
function findTitleMatch(title,
|
|
63011
|
-
return title ? matchTexts([title], queryPattern(
|
|
63640
|
+
function findTitleMatch(title, query2) {
|
|
63641
|
+
return title ? matchTexts([title], queryPattern(query2)) : null;
|
|
63012
63642
|
}
|
|
63013
63643
|
|
|
63014
63644
|
// src/commands/sessions/daemon/historySearch/searchHistory.ts
|
|
@@ -63022,21 +63652,21 @@ function inRepo(cwd) {
|
|
|
63022
63652
|
return key === selectedKey || (group?.clone || session.cwd) === cwd;
|
|
63023
63653
|
};
|
|
63024
63654
|
}
|
|
63025
|
-
async function matchBatch(batch,
|
|
63655
|
+
async function matchBatch(batch, query2) {
|
|
63026
63656
|
const matches = await Promise.all(
|
|
63027
63657
|
batch.map(async ({ session, filePath }) => {
|
|
63028
|
-
const snippet = findTitleMatch(session.title,
|
|
63658
|
+
const snippet = findTitleMatch(session.title, query2) ?? await findTranscriptMatch(filePath, session.harness, query2);
|
|
63029
63659
|
return snippet ? { ...session, snippet } : null;
|
|
63030
63660
|
})
|
|
63031
63661
|
);
|
|
63032
63662
|
return matches.filter((hit) => hit !== null);
|
|
63033
63663
|
}
|
|
63034
|
-
async function searchHistory(cwd,
|
|
63664
|
+
async function searchHistory(cwd, query2) {
|
|
63035
63665
|
const candidates = (await discoverHistoryEntries()).filter(inRepo(cwd));
|
|
63036
63666
|
const hits = [];
|
|
63037
63667
|
for (let i = 0; i < candidates.length && hits.length < MAX_RESULTS2; i += BATCH_SIZE2)
|
|
63038
63668
|
hits.push(
|
|
63039
|
-
...await matchBatch(candidates.slice(i, i + BATCH_SIZE2),
|
|
63669
|
+
...await matchBatch(candidates.slice(i, i + BATCH_SIZE2), query2)
|
|
63040
63670
|
);
|
|
63041
63671
|
return withRepoGroups(hits.slice(0, MAX_RESULTS2));
|
|
63042
63672
|
}
|
|
@@ -63044,12 +63674,12 @@ async function searchHistory(cwd, query) {
|
|
|
63044
63674
|
// src/commands/sessions/daemon/historySearch/handleSearchHistory.ts
|
|
63045
63675
|
async function handleSearchHistory(client, data) {
|
|
63046
63676
|
const cwd = typeof data.cwd === "string" ? data.cwd : "";
|
|
63047
|
-
const
|
|
63677
|
+
const query2 = typeof data.query === "string" ? data.query.trim() : "";
|
|
63048
63678
|
const started2 = Date.now();
|
|
63049
63679
|
try {
|
|
63050
|
-
const sessions = cwd &&
|
|
63680
|
+
const sessions = cwd && query2 ? await searchHistory(cwd, query2) : [];
|
|
63051
63681
|
daemonLog(
|
|
63052
|
-
`history search cwd=${cwd} chars=${
|
|
63682
|
+
`history search cwd=${cwd} chars=${query2.length}: ${sessions.length} match(es) in ${Date.now() - started2}ms`
|
|
63053
63683
|
);
|
|
63054
63684
|
sendTo(client, { type: "history-search", sessions });
|
|
63055
63685
|
} catch (error) {
|
|
@@ -63060,7 +63690,7 @@ async function handleSearchHistory(client, data) {
|
|
|
63060
63690
|
}
|
|
63061
63691
|
|
|
63062
63692
|
// src/commands/sessions/daemon/creator.ts
|
|
63063
|
-
function creator(isNew,
|
|
63693
|
+
function creator(isNew, spawn15) {
|
|
63064
63694
|
const reply2 = (client, d, result) => {
|
|
63065
63695
|
const traceId = typeof d.traceId === "string" ? d.traceId : void 0;
|
|
63066
63696
|
if (typeof result !== "string") {
|
|
@@ -63078,7 +63708,7 @@ function creator(isNew, spawn14) {
|
|
|
63078
63708
|
if (m.links.route(client, d)) return;
|
|
63079
63709
|
let result;
|
|
63080
63710
|
try {
|
|
63081
|
-
result =
|
|
63711
|
+
result = spawn15(m, d);
|
|
63082
63712
|
} catch (error) {
|
|
63083
63713
|
fail14(client, d, error);
|
|
63084
63714
|
return;
|
|
@@ -63343,10 +63973,21 @@ var handleOutputRequest = (client, m, request) => {
|
|
|
63343
63973
|
}
|
|
63344
63974
|
const { sessionId: sessionId2, exited } = target;
|
|
63345
63975
|
let scrollback;
|
|
63976
|
+
let sdk = false;
|
|
63346
63977
|
m.update((sessions) => {
|
|
63347
|
-
|
|
63978
|
+
const session = sessions.get(sessionId2);
|
|
63979
|
+
sdk = session ? isSdkSession(session) : false;
|
|
63980
|
+
scrollback = session?.scrollback;
|
|
63348
63981
|
return false;
|
|
63349
63982
|
});
|
|
63983
|
+
if (sdk) {
|
|
63984
|
+
const error = `Session ${sessionId2} is a Claude (SDK) session with no terminal output`;
|
|
63985
|
+
daemonLog(
|
|
63986
|
+
`output requested: id=${sessionId2} skipped (Claude SDK session, no terminal)`
|
|
63987
|
+
);
|
|
63988
|
+
sendTo(client, { type: "session-output", sessionId: sessionId2, error, requestId });
|
|
63989
|
+
return;
|
|
63990
|
+
}
|
|
63350
63991
|
daemonLog(
|
|
63351
63992
|
`output requested: id=${sessionId2}${exited ? ` (exited: ${exited})` : ""} ${scrollback === void 0 ? "unknown session" : `${scrollback.length} chars`}`
|
|
63352
63993
|
);
|
|
@@ -63452,6 +64093,41 @@ async function parseTranscript(conversationId) {
|
|
|
63452
64093
|
}
|
|
63453
64094
|
}
|
|
63454
64095
|
|
|
64096
|
+
// src/commands/sessions/daemon/findSession.ts
|
|
64097
|
+
function findSession(manager, id) {
|
|
64098
|
+
let found;
|
|
64099
|
+
manager.update((sessions) => {
|
|
64100
|
+
found = sessions.get(id);
|
|
64101
|
+
return false;
|
|
64102
|
+
});
|
|
64103
|
+
return found;
|
|
64104
|
+
}
|
|
64105
|
+
|
|
64106
|
+
// src/commands/sessions/daemon/handleFetchSessionTranscript.ts
|
|
64107
|
+
import { readFile as readFile9 } from "fs/promises";
|
|
64108
|
+
async function readMessages(session) {
|
|
64109
|
+
const reader = conversationOf(session)?.reader;
|
|
64110
|
+
const filePath = reader ? await resolveTranscriptPath(session) : null;
|
|
64111
|
+
if (!reader || !filePath) return [];
|
|
64112
|
+
try {
|
|
64113
|
+
return transcriptMessages(
|
|
64114
|
+
reader,
|
|
64115
|
+
(await readFile9(filePath, "utf8")).split("\n")
|
|
64116
|
+
);
|
|
64117
|
+
} catch {
|
|
64118
|
+
return [];
|
|
64119
|
+
}
|
|
64120
|
+
}
|
|
64121
|
+
async function handleFetchSessionTranscript(client, manager, data) {
|
|
64122
|
+
const sessionId2 = data.sessionId;
|
|
64123
|
+
const session = findSession(manager, sessionId2);
|
|
64124
|
+
const messages2 = session ? await readMessages(session) : [];
|
|
64125
|
+
daemonLog(
|
|
64126
|
+
`session ${sessionId2} live transcript: ${session ? `${messages2.length} messages` : "unknown session"}`
|
|
64127
|
+
);
|
|
64128
|
+
sendTo(client, { type: "session-transcript", sessionId: sessionId2, messages: messages2 });
|
|
64129
|
+
}
|
|
64130
|
+
|
|
63455
64131
|
// src/commands/sessions/shared/userMessageTexts.ts
|
|
63456
64132
|
var MAX_LENGTH3 = 2048;
|
|
63457
64133
|
function userMessageTexts(events, maxLength = MAX_LENGTH3) {
|
|
@@ -63461,14 +64137,6 @@ function userMessageTexts(events, maxLength = MAX_LENGTH3) {
|
|
|
63461
64137
|
}
|
|
63462
64138
|
|
|
63463
64139
|
// src/commands/sessions/daemon/handleFetchUserMessages.ts
|
|
63464
|
-
function findSession(manager, id) {
|
|
63465
|
-
let found;
|
|
63466
|
-
manager.update((sessions) => {
|
|
63467
|
-
found = sessions.get(id);
|
|
63468
|
-
return false;
|
|
63469
|
-
});
|
|
63470
|
-
return found;
|
|
63471
|
-
}
|
|
63472
64140
|
async function handleFetchUserMessages(client, manager, data) {
|
|
63473
64141
|
const sessionId2 = data.sessionId;
|
|
63474
64142
|
const session = findSession(manager, sessionId2);
|
|
@@ -63508,6 +64176,7 @@ var lifecycleHandlers = {
|
|
|
63508
64176
|
history: handleHistory,
|
|
63509
64177
|
"fetch-transcript": handleFetchTranscript,
|
|
63510
64178
|
"fetch-user-messages": routed(handleFetchUserMessages),
|
|
64179
|
+
"fetch-session-transcript": routed(handleFetchSessionTranscript),
|
|
63511
64180
|
shutdown: handleShutdown
|
|
63512
64181
|
};
|
|
63513
64182
|
|
|
@@ -63595,7 +64264,7 @@ var handleSnapshotRequest = (client, m, d) => {
|
|
|
63595
64264
|
let data;
|
|
63596
64265
|
m.update((sessions) => {
|
|
63597
64266
|
const s = sessions.get(sessionId2);
|
|
63598
|
-
if (s) data = sessionSnapshot(s);
|
|
64267
|
+
if (s && !skipsTerminalPath(s, "snapshot")) data = sessionSnapshot(s);
|
|
63599
64268
|
return false;
|
|
63600
64269
|
});
|
|
63601
64270
|
daemonLog(
|
|
@@ -63915,14 +64584,14 @@ function spawnAssistCreate(m, d) {
|
|
|
63915
64584
|
},
|
|
63916
64585
|
spawnContextFrom(d)
|
|
63917
64586
|
);
|
|
63918
|
-
const
|
|
64587
|
+
const spawn15 = (holder) => m.spawnAssist(
|
|
63919
64588
|
assistArgs,
|
|
63920
64589
|
holder ?? cwd,
|
|
63921
64590
|
{ ...meta, inPlace: inPlace || holder !== void 0 },
|
|
63922
64591
|
spawnContextFrom(d)
|
|
63923
64592
|
);
|
|
63924
|
-
if (inPlace || !isPrCheckoutArgs(assistArgs)) return
|
|
63925
|
-
return prCheckoutHolder(assistArgs, cwd).then(
|
|
64593
|
+
if (inPlace || !isPrCheckoutArgs(assistArgs)) return spawn15();
|
|
64594
|
+
return prCheckoutHolder(assistArgs, cwd).then(spawn15);
|
|
63926
64595
|
}
|
|
63927
64596
|
|
|
63928
64597
|
// src/commands/sessions/daemon/sessionBlocker.ts
|
|
@@ -64040,6 +64709,7 @@ var messageHandlers = {
|
|
|
64040
64709
|
dismiss: handleDismiss,
|
|
64041
64710
|
discard: routed((_client, m, d) => m.discardSession(d.sessionId)),
|
|
64042
64711
|
stop: routed((_client, m, d) => m.stopSession(d.sessionId)),
|
|
64712
|
+
interrupt: handleInterrupt,
|
|
64043
64713
|
transfer: handleTransfer,
|
|
64044
64714
|
"cancel-transfer": handleCancelTransfer,
|
|
64045
64715
|
...sessionSettingHandlers,
|
|
@@ -64111,7 +64781,7 @@ function handleConnection(socket, manager) {
|
|
|
64111
64781
|
import { unlinkSync as unlinkSync21, writeFileSync as writeFileSync65 } from "fs";
|
|
64112
64782
|
|
|
64113
64783
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
64114
|
-
import { readFileSync as
|
|
64784
|
+
import { readFileSync as readFileSync91 } from "fs";
|
|
64115
64785
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
64116
64786
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
64117
64787
|
const timer = setInterval(() => {
|
|
@@ -64122,7 +64792,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
64122
64792
|
}
|
|
64123
64793
|
function ownsPidFile() {
|
|
64124
64794
|
try {
|
|
64125
|
-
return
|
|
64795
|
+
return readFileSync91(daemonPaths.pid, "utf8").trim() === String(process.pid);
|
|
64126
64796
|
} catch {
|
|
64127
64797
|
return false;
|
|
64128
64798
|
}
|
|
@@ -64494,15 +65164,15 @@ function registerLinkCommand(nodes) {
|
|
|
64494
65164
|
// src/commands/sessions/nodes/awaitLinkReturn.ts
|
|
64495
65165
|
var POLL_MS8 = 1e3;
|
|
64496
65166
|
var wait = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
64497
|
-
async function linkStatus2(name2,
|
|
64498
|
-
return (await
|
|
65167
|
+
async function linkStatus2(name2, query2 = queryNodes) {
|
|
65168
|
+
return (await query2())?.links.find((l) => l.name === name2);
|
|
64499
65169
|
}
|
|
64500
65170
|
async function awaitLinkReturn(name2, options2, deps2 = {}) {
|
|
64501
|
-
const { query = queryNodes, sleep: sleep2 = wait, now = Date.now } = deps2;
|
|
65171
|
+
const { query: query2 = queryNodes, sleep: sleep2 = wait, now = Date.now } = deps2;
|
|
64502
65172
|
const deadline = now() + options2.timeoutMs;
|
|
64503
65173
|
let sawDown = options2.sawDown;
|
|
64504
65174
|
while (now() < deadline) {
|
|
64505
|
-
const link3 = await linkStatus2(name2,
|
|
65175
|
+
const link3 = await linkStatus2(name2, query2);
|
|
64506
65176
|
if (link3?.state !== "connected") sawDown = true;
|
|
64507
65177
|
else if (sawDown) return link3;
|
|
64508
65178
|
await sleep2(POLL_MS8);
|