@staff0rd/assist 0.1133.2 → 0.1134.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 +541 -538
- package/dist/index.js +1190 -611
- 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.1134.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
|
];
|
|
@@ -976,7 +978,8 @@ var assistConfigShape = {
|
|
|
976
978
|
newSessionMode: z6.enum(["draft", "bug", "prompt", "design"]).default("draft"),
|
|
977
979
|
hotkeys: hotkeysSchema.optional(),
|
|
978
980
|
askQuestion: z6.boolean().default(true),
|
|
979
|
-
askQuestionAutoSubmit: z6.boolean().default(false)
|
|
981
|
+
askQuestionAutoSubmit: z6.boolean().default(false),
|
|
982
|
+
reportLeftovers: z6.boolean().default(true)
|
|
980
983
|
}).optional(),
|
|
981
984
|
database: z6.strictObject({
|
|
982
985
|
url: secretConfigValue(z6.string()).optional()
|
|
@@ -3989,9 +3992,9 @@ import { eq as eq7 } from "drizzle-orm";
|
|
|
3989
3992
|
|
|
3990
3993
|
// src/commands/backlog/searchItemIds.ts
|
|
3991
3994
|
import { and as and3, asc as asc5, eq as eq9, ilike, or, sql as sql16 } from "drizzle-orm";
|
|
3992
|
-
async function searchItemIds(orm,
|
|
3993
|
-
const pattern2 = `%${
|
|
3994
|
-
const numberPattern = `%${
|
|
3995
|
+
async function searchItemIds(orm, query2, origin) {
|
|
3996
|
+
const pattern2 = `%${query2}%`;
|
|
3997
|
+
const numberPattern = `%${query2.replace(/^#/, "")}%`;
|
|
3995
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(
|
|
3996
3999
|
and3(
|
|
3997
4000
|
origin ? eq9(items.origin, origin) : void 0,
|
|
@@ -4252,10 +4255,10 @@ async function loadBacklog(allRepos = false) {
|
|
|
4252
4255
|
const { orm } = await getReady();
|
|
4253
4256
|
return loadAllItems(orm, allRepos ? void 0 : getOrigin());
|
|
4254
4257
|
}
|
|
4255
|
-
async function searchBacklog(
|
|
4258
|
+
async function searchBacklog(query2) {
|
|
4256
4259
|
const { orm } = await getReady();
|
|
4257
4260
|
const origin = getOrigin();
|
|
4258
|
-
const ids = await searchItemIds(orm,
|
|
4261
|
+
const ids = await searchItemIds(orm, query2, origin);
|
|
4259
4262
|
const allItems = await loadAllItems(orm, origin);
|
|
4260
4263
|
return allItems.filter((item) => ids.includes(item.id));
|
|
4261
4264
|
}
|
|
@@ -4640,10 +4643,10 @@ async function loadBacklogSummaries(allRepos = false) {
|
|
|
4640
4643
|
const { orm } = await getReady();
|
|
4641
4644
|
return loadItemSummaries(orm, allRepos ? void 0 : getOrigin());
|
|
4642
4645
|
}
|
|
4643
|
-
async function searchBacklogSummaries(
|
|
4646
|
+
async function searchBacklogSummaries(query2) {
|
|
4644
4647
|
const { orm } = await getReady();
|
|
4645
4648
|
const origin = getOrigin();
|
|
4646
|
-
const ids = await searchItemIds(orm,
|
|
4649
|
+
const ids = await searchItemIds(orm, query2, origin);
|
|
4647
4650
|
const summaries = await loadItemSummaries(orm, origin);
|
|
4648
4651
|
return summaries.filter((item) => ids.includes(item.id));
|
|
4649
4652
|
}
|
|
@@ -4953,8 +4956,8 @@ function getConversationParam(req) {
|
|
|
4953
4956
|
import { execFile as execFile3 } from "child_process";
|
|
4954
4957
|
import { promisify as promisify3 } from "util";
|
|
4955
4958
|
var execFileAsync3 = promisify3(execFile3);
|
|
4956
|
-
async function execGit(cwd, args,
|
|
4957
|
-
const { maxBuffer, allowFailure } =
|
|
4959
|
+
async function execGit(cwd, args, opts2 = {}) {
|
|
4960
|
+
const { maxBuffer, allowFailure } = opts2;
|
|
4958
4961
|
const unquoted = [
|
|
4959
4962
|
"--no-optional-locks",
|
|
4960
4963
|
"-c",
|
|
@@ -5128,11 +5131,13 @@ async function commitPaths(cwd, sha) {
|
|
|
5128
5131
|
// src/shared/harnessAdapters/harnessLabel.ts
|
|
5129
5132
|
var HARNESS_LABELS = {
|
|
5130
5133
|
claude: "Claude",
|
|
5134
|
+
"claude-sdk": "Claude (SDK)",
|
|
5131
5135
|
codex: "Codex",
|
|
5132
5136
|
pi: "pi"
|
|
5133
5137
|
};
|
|
5134
5138
|
var HARNESS_PRODUCT_LABELS = {
|
|
5135
5139
|
claude: "Claude Code",
|
|
5140
|
+
"claude-sdk": "Claude Code",
|
|
5136
5141
|
codex: "Codex",
|
|
5137
5142
|
pi: "pi"
|
|
5138
5143
|
};
|
|
@@ -5310,6 +5315,24 @@ function shellEscape(s) {
|
|
|
5310
5315
|
return `'${s.replace(/'/g, String.raw`'\''`)}'`;
|
|
5311
5316
|
}
|
|
5312
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
|
+
|
|
5313
5336
|
// src/commands/sessions/daemon/viewerSize.ts
|
|
5314
5337
|
import { readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "fs";
|
|
5315
5338
|
var DEFAULT_SIZE = { cols: 120, rows: 30 };
|
|
@@ -5355,24 +5378,11 @@ function spawnPty(args, cwd, sessionId2, extraEnv) {
|
|
|
5355
5378
|
refuseMissingCwd(cwd, sessionId2);
|
|
5356
5379
|
ensureSpawnHelperExecutable();
|
|
5357
5380
|
const command = resolvePtyCommand(args);
|
|
5358
|
-
const {
|
|
5359
|
-
CLAUDE_CODE_CHILD_SESSION: _childSession,
|
|
5360
|
-
CLAUDECODE: _claudeCode,
|
|
5361
|
-
...parentEnv
|
|
5362
|
-
} = process.env;
|
|
5363
5381
|
return pty.spawn(command.file, command.args, {
|
|
5364
5382
|
name: "xterm-256color",
|
|
5365
5383
|
...viewerSize(),
|
|
5366
5384
|
cwd: cwd ?? process.cwd(),
|
|
5367
|
-
env:
|
|
5368
|
-
...parentEnv,
|
|
5369
|
-
ASSIST_SESSION: "1",
|
|
5370
|
-
...sessionId2 && {
|
|
5371
|
-
ASSIST_SESSION_ID: sessionId2,
|
|
5372
|
-
ASSIST_ACTIVITY_ID: sessionId2
|
|
5373
|
-
},
|
|
5374
|
-
...extraEnv
|
|
5375
|
-
}
|
|
5385
|
+
env: sessionChildEnv(process.env, sessionId2, extraEnv)
|
|
5376
5386
|
});
|
|
5377
5387
|
}
|
|
5378
5388
|
function refuseMissingCwd(cwd, sessionId2) {
|
|
@@ -5384,20 +5394,20 @@ function refuseMissingCwd(cwd, sessionId2) {
|
|
|
5384
5394
|
}
|
|
5385
5395
|
|
|
5386
5396
|
// src/commands/sessions/daemon/spawnClaude.ts
|
|
5387
|
-
function spawnClaude(
|
|
5388
|
-
return spawnPty(buildArgs(
|
|
5397
|
+
function spawnClaude(opts2 = {}) {
|
|
5398
|
+
return spawnPty(buildArgs(opts2), opts2.cwd, opts2.sessionId);
|
|
5389
5399
|
}
|
|
5390
|
-
function buildArgs(
|
|
5400
|
+
function buildArgs(opts2) {
|
|
5391
5401
|
const base = ["claude", "--settings", ensureHooksSettings()];
|
|
5392
|
-
if (
|
|
5393
|
-
base.push("--append-system-prompt-file",
|
|
5394
|
-
if (
|
|
5395
|
-
if (
|
|
5396
|
-
if (
|
|
5397
|
-
return
|
|
5398
|
-
}
|
|
5399
|
-
if (
|
|
5400
|
-
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];
|
|
5401
5411
|
return base;
|
|
5402
5412
|
}
|
|
5403
5413
|
|
|
@@ -5999,7 +6009,7 @@ function awaitsQuestionAnswer(entries2) {
|
|
|
5999
6009
|
|
|
6000
6010
|
// src/commands/sessions/shared/deriveTranscriptStatus.ts
|
|
6001
6011
|
var TURN_END_STOP_REASONS = /* @__PURE__ */ new Set(["end_turn", "stop_sequence"]);
|
|
6002
|
-
function deriveTranscriptStatus(entries2,
|
|
6012
|
+
function deriveTranscriptStatus(entries2, opts2 = {}) {
|
|
6003
6013
|
const events = normalizeTranscriptEvents(entries2);
|
|
6004
6014
|
const lastIdx = lastDecisiveIndex(events);
|
|
6005
6015
|
if (lastIdx === -1) return null;
|
|
@@ -6009,7 +6019,7 @@ function deriveTranscriptStatus(entries2, opts = {}) {
|
|
|
6009
6019
|
if (ev.kind === "toolResult" || ev.kind === "taskNotification") return null;
|
|
6010
6020
|
if (ev.stopReason != null && TURN_END_STOP_REASONS.has(ev.stopReason))
|
|
6011
6021
|
return "waiting";
|
|
6012
|
-
if (
|
|
6022
|
+
if (opts2.permissionActive) return "waiting";
|
|
6013
6023
|
if (hasPendingAskUserQuestion(events, lastIdx)) return "waiting";
|
|
6014
6024
|
return "running";
|
|
6015
6025
|
}
|
|
@@ -6316,17 +6326,17 @@ import * as path8 from "path";
|
|
|
6316
6326
|
import { execSync as execSync4 } from "child_process";
|
|
6317
6327
|
function checkCliAvailable(cli) {
|
|
6318
6328
|
const binary = cli.split(/\s+/)[0];
|
|
6319
|
-
const
|
|
6329
|
+
const opts2 = {
|
|
6320
6330
|
encoding: "utf8",
|
|
6321
6331
|
stdio: ["ignore", "pipe", "pipe"],
|
|
6322
6332
|
windowsHide: true
|
|
6323
6333
|
};
|
|
6324
6334
|
try {
|
|
6325
|
-
execSync4(`command -v ${binary}`,
|
|
6335
|
+
execSync4(`command -v ${binary}`, opts2);
|
|
6326
6336
|
return true;
|
|
6327
6337
|
} catch {
|
|
6328
6338
|
try {
|
|
6329
|
-
execSync4(`where ${binary}`,
|
|
6339
|
+
execSync4(`where ${binary}`, opts2);
|
|
6330
6340
|
return true;
|
|
6331
6341
|
} catch {
|
|
6332
6342
|
return false;
|
|
@@ -6335,18 +6345,20 @@ function checkCliAvailable(cli) {
|
|
|
6335
6345
|
}
|
|
6336
6346
|
|
|
6337
6347
|
// src/shared/harnesses.ts
|
|
6348
|
+
var claudeHarness = {
|
|
6349
|
+
kind: "claude",
|
|
6350
|
+
command: "claude",
|
|
6351
|
+
homeDir: path8.join(os3.homedir(), ".claude"),
|
|
6352
|
+
sync: {
|
|
6353
|
+
commandDest: (name2) => path8.join("skills", name2, "SKILL.md"),
|
|
6354
|
+
designPromptDest: "design-system-prompt.md",
|
|
6355
|
+
designSkillDest: (name2) => path8.join("skills", `${name2}.md`),
|
|
6356
|
+
nativeDesignSkills: false
|
|
6357
|
+
}
|
|
6358
|
+
};
|
|
6338
6359
|
var harnesses = {
|
|
6339
|
-
claude:
|
|
6340
|
-
|
|
6341
|
-
command: "claude",
|
|
6342
|
-
homeDir: path8.join(os3.homedir(), ".claude"),
|
|
6343
|
-
sync: {
|
|
6344
|
-
commandDest: (name2) => path8.join("skills", name2, "SKILL.md"),
|
|
6345
|
-
designPromptDest: "design-system-prompt.md",
|
|
6346
|
-
designSkillDest: (name2) => path8.join("skills", `${name2}.md`),
|
|
6347
|
-
nativeDesignSkills: false
|
|
6348
|
-
}
|
|
6349
|
-
},
|
|
6360
|
+
claude: claudeHarness,
|
|
6361
|
+
"claude-sdk": { ...claudeHarness, kind: "claude-sdk" },
|
|
6350
6362
|
codex: {
|
|
6351
6363
|
kind: "codex",
|
|
6352
6364
|
command: "codex",
|
|
@@ -6684,8 +6696,8 @@ function formatToolSummary(input) {
|
|
|
6684
6696
|
if (command) return truncate(command);
|
|
6685
6697
|
const url = getString(record3, "url");
|
|
6686
6698
|
if (url) return url;
|
|
6687
|
-
const
|
|
6688
|
-
if (
|
|
6699
|
+
const query2 = getString(record3, "query");
|
|
6700
|
+
if (query2) return truncate(query2);
|
|
6689
6701
|
const description = getString(record3, "description");
|
|
6690
6702
|
if (description) return truncate(description);
|
|
6691
6703
|
return "";
|
|
@@ -7077,32 +7089,58 @@ function detectHarness(kind) {
|
|
|
7077
7089
|
}
|
|
7078
7090
|
|
|
7079
7091
|
// src/shared/harnessAdapters/harnessCapabilityDeclarations.ts
|
|
7092
|
+
var claude = {
|
|
7093
|
+
"skills.native": supported,
|
|
7094
|
+
"launch.terminal": supported,
|
|
7095
|
+
"conversation.resume": supported,
|
|
7096
|
+
"conversation.relocate": supported,
|
|
7097
|
+
"conversation.id": supported,
|
|
7098
|
+
"conversation.preassignId": supported,
|
|
7099
|
+
"systemPrompt.append": supported,
|
|
7100
|
+
"tasks.notifyOnExit": supported,
|
|
7101
|
+
"artifacts.publish": supported,
|
|
7102
|
+
"transcript.read": supported,
|
|
7103
|
+
"oneShot.text": supported,
|
|
7104
|
+
"oneShot.structured": supported,
|
|
7105
|
+
"usage.rateLimits": supported,
|
|
7106
|
+
"tools.restrict": supported,
|
|
7107
|
+
"connector.gmail.read": supported,
|
|
7108
|
+
"connector.slack.read": supported,
|
|
7109
|
+
"intercept.command": supported,
|
|
7110
|
+
"intercept.fileRead": supported,
|
|
7111
|
+
"intercept.fileWrite": supported,
|
|
7112
|
+
"intercept.editDiff": supported,
|
|
7113
|
+
"intercept.question": supported,
|
|
7114
|
+
"slashCommands.suggest": supported
|
|
7115
|
+
};
|
|
7080
7116
|
var harnessCapabilityDeclarations = {
|
|
7081
|
-
claude
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
"
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
"
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
"
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
"
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
|
|
7117
|
+
claude,
|
|
7118
|
+
"claude-sdk": {
|
|
7119
|
+
...claude,
|
|
7120
|
+
"launch.terminal": unsupported(
|
|
7121
|
+
"Claude (SDK) sessions have no terminal, and these workflows start an assist command that opens the Claude CLI's terminal UI",
|
|
7122
|
+
"run the workflow with Claude",
|
|
7123
|
+
"a1560"
|
|
7124
|
+
),
|
|
7125
|
+
"conversation.resume": unsupported(
|
|
7126
|
+
"Claude (SDK) sessions do not resume their conversation yet",
|
|
7127
|
+
"a daemon restart starts a fresh conversation; pick Claude to keep the conversation across restarts",
|
|
7128
|
+
"a1560"
|
|
7129
|
+
),
|
|
7130
|
+
"conversation.relocate": unsupported(
|
|
7131
|
+
"Claude (SDK) sessions do not resume their conversation yet, so it cannot continue in a replacement worktree",
|
|
7132
|
+
"start a fresh session in the replacement worktree; pick Claude to keep the conversation",
|
|
7133
|
+
"a1560"
|
|
7134
|
+
),
|
|
7135
|
+
"usage.rateLimits": unsupported(
|
|
7136
|
+
"assist does not yet record usage and rate-limit events from Claude (SDK) sessions",
|
|
7137
|
+
"Claude (SDK) usage is not shown in the status bar; terminal Claude usage still is",
|
|
7138
|
+
"a1560"
|
|
7139
|
+
)
|
|
7103
7140
|
},
|
|
7104
7141
|
codex: {
|
|
7105
7142
|
"skills.native": supported,
|
|
7143
|
+
"launch.terminal": supported,
|
|
7106
7144
|
"conversation.resume": supported,
|
|
7107
7145
|
"conversation.relocate": supported,
|
|
7108
7146
|
"conversation.id": supported,
|
|
@@ -7161,6 +7199,7 @@ var harnessCapabilityDeclarations = {
|
|
|
7161
7199
|
},
|
|
7162
7200
|
pi: {
|
|
7163
7201
|
"skills.native": supported,
|
|
7202
|
+
"launch.terminal": supported,
|
|
7164
7203
|
"conversation.resume": unsupported(
|
|
7165
7204
|
"pi sessions cannot be resumed yet",
|
|
7166
7205
|
"restart starts a fresh pi conversation; pick Claude or Codex to keep the conversation across restarts",
|
|
@@ -7307,6 +7346,348 @@ var claudeAdapter = {
|
|
|
7307
7346
|
activityIdentity: (conversationId) => ({ claudeSessionId: conversationId })
|
|
7308
7347
|
};
|
|
7309
7348
|
|
|
7349
|
+
// src/commands/sessions/daemon/spawnClaudeSdk.ts
|
|
7350
|
+
import { query } from "@anthropic-ai/claude-agent-sdk";
|
|
7351
|
+
|
|
7352
|
+
// src/commands/sessions/daemon/resolveClaudeExecutable.ts
|
|
7353
|
+
import { execFileSync as execFileSync2 } from "child_process";
|
|
7354
|
+
var opts = {
|
|
7355
|
+
encoding: "utf8",
|
|
7356
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
7357
|
+
windowsHide: true
|
|
7358
|
+
};
|
|
7359
|
+
function resolveClaudeExecutable() {
|
|
7360
|
+
const found = process.platform === "win32" ? execFileSync2("where", ["claude"], opts) : execFileSync2(
|
|
7361
|
+
process.env.SHELL ?? "bash",
|
|
7362
|
+
["-l", "-c", "command -v claude"],
|
|
7363
|
+
opts
|
|
7364
|
+
);
|
|
7365
|
+
const lines = found.split(/\r?\n/).map((line) => line.trim()).filter((line) => /^(\/|[A-Za-z]:\\)/.test(line));
|
|
7366
|
+
const path128 = lines.find((line) => line.endsWith(".exe")) ?? lines.at(-1);
|
|
7367
|
+
if (!path128) throw new Error("claude is not on PATH");
|
|
7368
|
+
return path128;
|
|
7369
|
+
}
|
|
7370
|
+
|
|
7371
|
+
// src/commands/sessions/daemon/sdk/createSdkInput.ts
|
|
7372
|
+
function userMessage(text18) {
|
|
7373
|
+
return {
|
|
7374
|
+
type: "user",
|
|
7375
|
+
message: { role: "user", content: text18 },
|
|
7376
|
+
parent_tool_use_id: null
|
|
7377
|
+
};
|
|
7378
|
+
}
|
|
7379
|
+
function createSdkInput() {
|
|
7380
|
+
const queue = [];
|
|
7381
|
+
let wake2;
|
|
7382
|
+
let closed = false;
|
|
7383
|
+
const notify2 = () => {
|
|
7384
|
+
wake2?.();
|
|
7385
|
+
wake2 = void 0;
|
|
7386
|
+
};
|
|
7387
|
+
async function* messages2() {
|
|
7388
|
+
while (true) {
|
|
7389
|
+
const next3 = queue.shift();
|
|
7390
|
+
if (next3) {
|
|
7391
|
+
yield next3;
|
|
7392
|
+
continue;
|
|
7393
|
+
}
|
|
7394
|
+
if (closed) return;
|
|
7395
|
+
await new Promise((resolve36) => {
|
|
7396
|
+
wake2 = resolve36;
|
|
7397
|
+
});
|
|
7398
|
+
}
|
|
7399
|
+
}
|
|
7400
|
+
return {
|
|
7401
|
+
messages: messages2(),
|
|
7402
|
+
push: (text18) => {
|
|
7403
|
+
queue.push(userMessage(text18));
|
|
7404
|
+
notify2();
|
|
7405
|
+
},
|
|
7406
|
+
close: () => {
|
|
7407
|
+
closed = true;
|
|
7408
|
+
notify2();
|
|
7409
|
+
}
|
|
7410
|
+
};
|
|
7411
|
+
}
|
|
7412
|
+
|
|
7413
|
+
// src/commands/sessions/daemon/sdk/killSdkChild.ts
|
|
7414
|
+
function killSdkChild(child2) {
|
|
7415
|
+
if (!child2?.pid || child2.exitCode !== null) return;
|
|
7416
|
+
try {
|
|
7417
|
+
if (process.platform === "win32") child2.kill();
|
|
7418
|
+
else process.kill(-child2.pid, "SIGTERM");
|
|
7419
|
+
} catch {
|
|
7420
|
+
child2.kill();
|
|
7421
|
+
}
|
|
7422
|
+
}
|
|
7423
|
+
|
|
7424
|
+
// src/commands/sessions/daemon/sdk/sdkTerminalStub.ts
|
|
7425
|
+
var noopDisposable = { dispose: () => {
|
|
7426
|
+
} };
|
|
7427
|
+
function sdkTerminalStub(label) {
|
|
7428
|
+
const skip3 = (path128) => () => daemonLog(`${label} ${path128} skipped: Claude (SDK) session has no terminal`);
|
|
7429
|
+
return {
|
|
7430
|
+
cols: 0,
|
|
7431
|
+
rows: 0,
|
|
7432
|
+
write: skip3("input"),
|
|
7433
|
+
resize: skip3("resize"),
|
|
7434
|
+
onData: () => noopDisposable
|
|
7435
|
+
};
|
|
7436
|
+
}
|
|
7437
|
+
|
|
7438
|
+
// src/commands/sessions/daemon/sdk/createSdkSessionProcess.ts
|
|
7439
|
+
function createSdkSessionProcess(sessionId2, abort2) {
|
|
7440
|
+
const label = `session ${sessionId2 ?? "?"}`;
|
|
7441
|
+
const eventListeners = [];
|
|
7442
|
+
const exitListeners = [];
|
|
7443
|
+
let child2;
|
|
7444
|
+
let exited = false;
|
|
7445
|
+
const sessionProcess = {
|
|
7446
|
+
get pid() {
|
|
7447
|
+
return child2?.pid ?? 0;
|
|
7448
|
+
},
|
|
7449
|
+
...sdkTerminalStub(label),
|
|
7450
|
+
kill: () => {
|
|
7451
|
+
daemonLog(
|
|
7452
|
+
`${label} sdk query ended by kill (child pid ${child2?.pid ?? "none"})`
|
|
7453
|
+
);
|
|
7454
|
+
abort2.abort();
|
|
7455
|
+
killSdkChild(child2);
|
|
7456
|
+
},
|
|
7457
|
+
onExit: (listener) => {
|
|
7458
|
+
exitListeners.push(listener);
|
|
7459
|
+
return noopDisposable;
|
|
7460
|
+
},
|
|
7461
|
+
sdk: { onEvent: (listener) => eventListeners.push(listener) }
|
|
7462
|
+
};
|
|
7463
|
+
return {
|
|
7464
|
+
process: sessionProcess,
|
|
7465
|
+
emit: (event) => {
|
|
7466
|
+
for (const listener of eventListeners) listener(event);
|
|
7467
|
+
},
|
|
7468
|
+
exit: (exitCode) => {
|
|
7469
|
+
if (exited) return;
|
|
7470
|
+
exited = true;
|
|
7471
|
+
killSdkChild(child2);
|
|
7472
|
+
for (const listener of exitListeners) listener({ exitCode });
|
|
7473
|
+
},
|
|
7474
|
+
attach: (spawned) => {
|
|
7475
|
+
child2 = spawned;
|
|
7476
|
+
},
|
|
7477
|
+
aborted: () => abort2.signal.aborted
|
|
7478
|
+
};
|
|
7479
|
+
}
|
|
7480
|
+
|
|
7481
|
+
// src/commands/sessions/daemon/sdk/createSdkTurnTracker.ts
|
|
7482
|
+
function createSdkTurnTracker(label, control) {
|
|
7483
|
+
let status2;
|
|
7484
|
+
let activity2 = null;
|
|
7485
|
+
const setActivity = (next3) => {
|
|
7486
|
+
if (next3 === activity2) return;
|
|
7487
|
+
activity2 = next3;
|
|
7488
|
+
control.emit({ kind: "activity", text: next3 });
|
|
7489
|
+
};
|
|
7490
|
+
const setStatus3 = (next3) => {
|
|
7491
|
+
if (next3 === "waiting") setActivity(null);
|
|
7492
|
+
if (next3 === status2) return;
|
|
7493
|
+
status2 = next3;
|
|
7494
|
+
daemonLog(`${label} sdk status: ${next3}`);
|
|
7495
|
+
control.emit({ kind: "status", status: next3 });
|
|
7496
|
+
};
|
|
7497
|
+
return { setActivity, setStatus: setStatus3 };
|
|
7498
|
+
}
|
|
7499
|
+
|
|
7500
|
+
// src/commands/sessions/daemon/sdk/logSdkMessage.ts
|
|
7501
|
+
function logSdkMessage(label, message4) {
|
|
7502
|
+
if (message4.type === "system" && message4.subtype === "init")
|
|
7503
|
+
daemonLog(
|
|
7504
|
+
`${label} sdk init: claude session ${message4.session_id} model ${message4.model} permission mode ${message4.permissionMode}`
|
|
7505
|
+
);
|
|
7506
|
+
if (message4.type === "result")
|
|
7507
|
+
daemonLog(`${label} sdk turn ended: ${message4.subtype}`);
|
|
7508
|
+
}
|
|
7509
|
+
|
|
7510
|
+
// src/commands/sessions/daemon/sdk/sdkActivityText.ts
|
|
7511
|
+
var TARGET_KEYS = [
|
|
7512
|
+
"command",
|
|
7513
|
+
"file_path",
|
|
7514
|
+
"notebook_path",
|
|
7515
|
+
"path",
|
|
7516
|
+
"pattern",
|
|
7517
|
+
"url",
|
|
7518
|
+
"query",
|
|
7519
|
+
"description",
|
|
7520
|
+
"skill"
|
|
7521
|
+
];
|
|
7522
|
+
var MAX_TARGET = 80;
|
|
7523
|
+
function toolTarget2(input) {
|
|
7524
|
+
if (!input || typeof input !== "object") return "";
|
|
7525
|
+
const record3 = input;
|
|
7526
|
+
const key = TARGET_KEYS.find((k) => typeof record3[k] === "string");
|
|
7527
|
+
if (!key) return "";
|
|
7528
|
+
const line = record3[key].split("\n")[0].trim();
|
|
7529
|
+
return line.length > MAX_TARGET ? `${line.slice(0, MAX_TARGET - 1)}\u2026` : line;
|
|
7530
|
+
}
|
|
7531
|
+
function sdkActivityText(content) {
|
|
7532
|
+
const tool = [...content].reverse().find((block) => block.type === "tool_use");
|
|
7533
|
+
if (!tool?.name) return "Working";
|
|
7534
|
+
const target = toolTarget2(tool.input);
|
|
7535
|
+
return `Working \xB7 ${tool.name}${target ? ` ${target}` : ""}`;
|
|
7536
|
+
}
|
|
7537
|
+
|
|
7538
|
+
// src/commands/sessions/daemon/sdk/sdkTurnStatus.ts
|
|
7539
|
+
function sdkTurnStatus(message4) {
|
|
7540
|
+
if (message4.type === "assistant" && message4.parent_tool_use_id === null)
|
|
7541
|
+
return "running";
|
|
7542
|
+
if (message4.type === "result") return "waiting";
|
|
7543
|
+
if (message4.type === "system" && message4.subtype === "session_state_changed")
|
|
7544
|
+
return message4.state === "running" ? "running" : "waiting";
|
|
7545
|
+
return void 0;
|
|
7546
|
+
}
|
|
7547
|
+
|
|
7548
|
+
// src/commands/sessions/daemon/sdk/runSdkQuery.ts
|
|
7549
|
+
async function runSdkQuery(messages2, sessionId2, control) {
|
|
7550
|
+
const label = `session ${sessionId2 ?? "?"}`;
|
|
7551
|
+
const turn = createSdkTurnTracker(label, control);
|
|
7552
|
+
try {
|
|
7553
|
+
for await (const message4 of messages2) {
|
|
7554
|
+
logSdkMessage(label, message4);
|
|
7555
|
+
const status2 = sdkTurnStatus(message4);
|
|
7556
|
+
if (status2) turn.setStatus(status2);
|
|
7557
|
+
if (message4.type === "assistant" && message4.parent_tool_use_id === null)
|
|
7558
|
+
turn.setActivity(sdkActivityText(message4.message.content));
|
|
7559
|
+
}
|
|
7560
|
+
daemonLog(`${label} sdk query finished`);
|
|
7561
|
+
control.exit(0);
|
|
7562
|
+
} catch (error) {
|
|
7563
|
+
if (control.aborted()) {
|
|
7564
|
+
daemonLog(`${label} sdk query stopped after kill`);
|
|
7565
|
+
control.exit(0);
|
|
7566
|
+
return;
|
|
7567
|
+
}
|
|
7568
|
+
daemonLog(
|
|
7569
|
+
`${label} sdk query failed: ${error instanceof Error ? error.message : String(error)}`
|
|
7570
|
+
);
|
|
7571
|
+
control.exit(1);
|
|
7572
|
+
}
|
|
7573
|
+
}
|
|
7574
|
+
|
|
7575
|
+
// src/commands/sessions/daemon/sdk/sdkQueryOptions.ts
|
|
7576
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
7577
|
+
|
|
7578
|
+
// src/commands/sessions/daemon/sdk/spawnSdkChild.ts
|
|
7579
|
+
import { spawn as spawn6 } from "child_process";
|
|
7580
|
+
var MAX_STDERR_LINE = 300;
|
|
7581
|
+
function spawnSdkChild(options2, sessionId2, attach) {
|
|
7582
|
+
const label = `session ${sessionId2 ?? "?"}`;
|
|
7583
|
+
const child2 = spawn6(options2.command, options2.args, {
|
|
7584
|
+
cwd: options2.cwd,
|
|
7585
|
+
env: sessionChildEnv(options2.env, sessionId2),
|
|
7586
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
7587
|
+
signal: options2.signal,
|
|
7588
|
+
/* why: its own process group, so a kill also reaches the shell commands
|
|
7589
|
+
* claude runs for its tools, as killPtyTree does for terminal sessions. */
|
|
7590
|
+
detached: process.platform !== "win32",
|
|
7591
|
+
windowsHide: true
|
|
7592
|
+
});
|
|
7593
|
+
daemonLog(
|
|
7594
|
+
`${label} sdk child spawned: pid ${child2.pid ?? "none"} ${options2.command}`
|
|
7595
|
+
);
|
|
7596
|
+
child2.stderr.setEncoding("utf8");
|
|
7597
|
+
child2.stderr.on("data", (chunk2) => {
|
|
7598
|
+
for (const line of chunk2.split("\n")) {
|
|
7599
|
+
const trimmed = line.trim();
|
|
7600
|
+
if (trimmed)
|
|
7601
|
+
daemonLog(`${label} sdk stderr: ${trimmed.slice(0, MAX_STDERR_LINE)}`);
|
|
7602
|
+
}
|
|
7603
|
+
});
|
|
7604
|
+
child2.on(
|
|
7605
|
+
"exit",
|
|
7606
|
+
(code, signal) => daemonLog(`${label} sdk child exited: code ${code} signal ${signal}`)
|
|
7607
|
+
);
|
|
7608
|
+
attach(child2);
|
|
7609
|
+
return child2;
|
|
7610
|
+
}
|
|
7611
|
+
|
|
7612
|
+
// src/commands/sessions/daemon/sdk/sdkQueryOptions.ts
|
|
7613
|
+
function sdkQueryOptions(opts2, executable, abort2, control) {
|
|
7614
|
+
const append = opts2.appendSystemPromptFile ? readFileSync8(opts2.appendSystemPromptFile, "utf8") : void 0;
|
|
7615
|
+
return {
|
|
7616
|
+
cwd: opts2.cwd,
|
|
7617
|
+
sessionId: opts2.claudeSessionId,
|
|
7618
|
+
permissionMode: "auto",
|
|
7619
|
+
settings: ensureHooksSettings(),
|
|
7620
|
+
pathToClaudeCodeExecutable: executable,
|
|
7621
|
+
spawnClaudeCodeProcess: (options2) => spawnSdkChild(options2, opts2.sessionId, control.attach),
|
|
7622
|
+
abortController: abort2,
|
|
7623
|
+
model: opts2.model,
|
|
7624
|
+
systemPrompt: { type: "preset", preset: "claude_code", append }
|
|
7625
|
+
};
|
|
7626
|
+
}
|
|
7627
|
+
|
|
7628
|
+
// src/commands/sessions/daemon/spawnClaudeSdk.ts
|
|
7629
|
+
function spawnClaudeSdk(opts2) {
|
|
7630
|
+
refuseMissingCwd(opts2.cwd, opts2.sessionId);
|
|
7631
|
+
const abort2 = new AbortController();
|
|
7632
|
+
const control = createSdkSessionProcess(opts2.sessionId, abort2);
|
|
7633
|
+
const input = createSdkInput();
|
|
7634
|
+
if (opts2.prompt) input.push(opts2.prompt);
|
|
7635
|
+
abort2.signal.addEventListener("abort", input.close);
|
|
7636
|
+
void startQuery(opts2, abort2, control, input.messages);
|
|
7637
|
+
return control.process;
|
|
7638
|
+
}
|
|
7639
|
+
async function startQuery(opts2, abort2, control, prompt) {
|
|
7640
|
+
const label = `session ${opts2.sessionId ?? "?"}`;
|
|
7641
|
+
try {
|
|
7642
|
+
const executable = resolveClaudeExecutable();
|
|
7643
|
+
daemonLog(
|
|
7644
|
+
`${label} sdk query starting: claude ${executable}, claude session ${opts2.claudeSessionId ?? "unassigned"}, permission mode auto, cwd ${opts2.cwd ?? process.cwd()}`
|
|
7645
|
+
);
|
|
7646
|
+
const messages2 = query({
|
|
7647
|
+
prompt,
|
|
7648
|
+
options: sdkQueryOptions(opts2, executable, abort2, control)
|
|
7649
|
+
});
|
|
7650
|
+
await runSdkQuery(messages2, opts2.sessionId, control);
|
|
7651
|
+
} catch (error) {
|
|
7652
|
+
daemonLog(
|
|
7653
|
+
`${label} sdk query not started: ${error instanceof Error ? error.message : String(error)}`
|
|
7654
|
+
);
|
|
7655
|
+
control.exit(1);
|
|
7656
|
+
}
|
|
7657
|
+
}
|
|
7658
|
+
|
|
7659
|
+
// src/shared/harnessAdapters/claudeSdkAdapter.ts
|
|
7660
|
+
var claudeSdkAdapter = {
|
|
7661
|
+
...claudeAdapter,
|
|
7662
|
+
kind: "claude-sdk",
|
|
7663
|
+
label: harnessLabel("claude-sdk"),
|
|
7664
|
+
capabilities: {
|
|
7665
|
+
...harnessCapabilityDeclarations["claude-sdk"],
|
|
7666
|
+
"connector.gmail.read": () => claudeConnectorProbe("Gmail"),
|
|
7667
|
+
"connector.slack.read": () => claudeConnectorProbe("Slack")
|
|
7668
|
+
},
|
|
7669
|
+
detect: () => detectHarness("claude-sdk"),
|
|
7670
|
+
interactive: ({
|
|
7671
|
+
sessionId: sessionId2,
|
|
7672
|
+
conversationId,
|
|
7673
|
+
prompt,
|
|
7674
|
+
cwd,
|
|
7675
|
+
appendSystemPromptFile,
|
|
7676
|
+
model
|
|
7677
|
+
}) => spawnClaudeSdk({
|
|
7678
|
+
prompt,
|
|
7679
|
+
cwd,
|
|
7680
|
+
sessionId: sessionId2,
|
|
7681
|
+
claudeSessionId: conversationId,
|
|
7682
|
+
appendSystemPromptFile,
|
|
7683
|
+
model
|
|
7684
|
+
}),
|
|
7685
|
+
activityIdentity: (conversationId) => ({
|
|
7686
|
+
harness: "claude-sdk",
|
|
7687
|
+
claudeSessionId: conversationId
|
|
7688
|
+
})
|
|
7689
|
+
};
|
|
7690
|
+
|
|
7310
7691
|
// src/commands/litellm/buildCodexProviderArgs.ts
|
|
7311
7692
|
var API_KEY_ENV = "ASSIST_LITELLM_API_KEY";
|
|
7312
7693
|
function buildCodexProviderArgs(responsesBaseUrl, apiKey, model) {
|
|
@@ -7478,12 +7859,12 @@ function codexDeveloperInstructionsArgs(file) {
|
|
|
7478
7859
|
}
|
|
7479
7860
|
|
|
7480
7861
|
// src/shared/trustCodexProject.ts
|
|
7481
|
-
import { execFileSync as
|
|
7862
|
+
import { execFileSync as execFileSync3 } from "child_process";
|
|
7482
7863
|
import * as fs7 from "fs";
|
|
7483
7864
|
import * as path10 from "path";
|
|
7484
7865
|
function repoRoot(cwd) {
|
|
7485
7866
|
try {
|
|
7486
|
-
const commonDir =
|
|
7867
|
+
const commonDir = execFileSync3(
|
|
7487
7868
|
"git",
|
|
7488
7869
|
["rev-parse", "--path-format=absolute", "--git-common-dir"],
|
|
7489
7870
|
{ cwd, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }
|
|
@@ -7512,15 +7893,15 @@ ${entry}` : entry);
|
|
|
7512
7893
|
}
|
|
7513
7894
|
|
|
7514
7895
|
// src/commands/sessions/daemon/spawnCodex.ts
|
|
7515
|
-
function spawnCodex(
|
|
7516
|
-
const trusted = trustCodexProject(
|
|
7896
|
+
function spawnCodex(opts2 = {}) {
|
|
7897
|
+
const trusted = trustCodexProject(opts2.cwd);
|
|
7517
7898
|
if (trusted) daemonLog(`codex: trusted ${trusted} in config.toml`);
|
|
7518
7899
|
const untrusted = prepareCodexHookTrust();
|
|
7519
7900
|
if (untrusted) daemonLog(`codex: ${untrusted}`);
|
|
7520
|
-
const override =
|
|
7901
|
+
const override = opts2.model ? { args: ["-m", opts2.model], env: {} } : buildHarnessCodexArgs();
|
|
7521
7902
|
const sessionEnv = codexSessionEnvArgs({
|
|
7522
7903
|
ASSIST_SESSION: "1",
|
|
7523
|
-
ASSIST_SESSION_ID:
|
|
7904
|
+
ASSIST_SESSION_ID: opts2.sessionId,
|
|
7524
7905
|
ASSIST_BACKLOG_ITEM_ID: process.env.ASSIST_BACKLOG_ITEM_ID
|
|
7525
7906
|
});
|
|
7526
7907
|
return spawnPty(
|
|
@@ -7530,17 +7911,17 @@ function spawnCodex(opts = {}) {
|
|
|
7530
7911
|
...override.args,
|
|
7531
7912
|
...sessionEnv,
|
|
7532
7913
|
...codexSandboxNetworkArgs,
|
|
7533
|
-
...codexDeveloperInstructionsArgs(
|
|
7534
|
-
...codexArgs(
|
|
7914
|
+
...codexDeveloperInstructionsArgs(opts2.appendSystemPromptFile),
|
|
7915
|
+
...codexArgs(opts2)
|
|
7535
7916
|
],
|
|
7536
|
-
|
|
7537
|
-
|
|
7917
|
+
opts2.cwd,
|
|
7918
|
+
opts2.sessionId,
|
|
7538
7919
|
override.env
|
|
7539
7920
|
);
|
|
7540
7921
|
}
|
|
7541
|
-
function codexArgs(
|
|
7542
|
-
const prompt =
|
|
7543
|
-
if (
|
|
7922
|
+
function codexArgs(opts2) {
|
|
7923
|
+
const prompt = opts2.prompt ? [opts2.prompt] : [];
|
|
7924
|
+
if (opts2.resumeSessionId) return ["resume", opts2.resumeSessionId, ...prompt];
|
|
7544
7925
|
return prompt;
|
|
7545
7926
|
}
|
|
7546
7927
|
|
|
@@ -8273,7 +8654,7 @@ function codexHookProbe() {
|
|
|
8273
8654
|
}
|
|
8274
8655
|
|
|
8275
8656
|
// src/shared/readCodexRulePerms.ts
|
|
8276
|
-
import { existsSync as existsSync19, readdirSync as readdirSync5, readFileSync as
|
|
8657
|
+
import { existsSync as existsSync19, readdirSync as readdirSync5, readFileSync as readFileSync13 } from "fs";
|
|
8277
8658
|
import { join as join25 } from "path";
|
|
8278
8659
|
|
|
8279
8660
|
// src/shared/readPatternList.ts
|
|
@@ -8366,7 +8747,7 @@ function readCodexRulePerms(key) {
|
|
|
8366
8747
|
];
|
|
8367
8748
|
return dirs.flatMap(ruleFiles).flatMap((file) => {
|
|
8368
8749
|
try {
|
|
8369
|
-
return parseCodexRules(
|
|
8750
|
+
return parseCodexRules(readFileSync13(file, "utf8"))[key];
|
|
8370
8751
|
} catch {
|
|
8371
8752
|
return [];
|
|
8372
8753
|
}
|
|
@@ -8717,11 +9098,11 @@ var codexAdapter = {
|
|
|
8717
9098
|
var piTerminalArgs = ["--tui-mode", "regular"];
|
|
8718
9099
|
|
|
8719
9100
|
// src/commands/sessions/daemon/spawnPi.ts
|
|
8720
|
-
function spawnPi(
|
|
9101
|
+
function spawnPi(opts2 = {}) {
|
|
8721
9102
|
const args = ["pi", ...piTerminalArgs];
|
|
8722
|
-
if (
|
|
8723
|
-
if (
|
|
8724
|
-
return spawnPty(args,
|
|
9103
|
+
if (opts2.model) args.push("--model", opts2.model);
|
|
9104
|
+
if (opts2.prompt) args.push(opts2.prompt);
|
|
9105
|
+
return spawnPty(args, opts2.cwd, opts2.sessionId, { ASSIST_HARNESS: "pi" });
|
|
8725
9106
|
}
|
|
8726
9107
|
|
|
8727
9108
|
// src/shared/spawnPi.ts
|
|
@@ -8854,6 +9235,7 @@ var piAdapter = {
|
|
|
8854
9235
|
// src/shared/harnessAdapters/harnessAdapter.ts
|
|
8855
9236
|
var adapters = {
|
|
8856
9237
|
claude: claudeAdapter,
|
|
9238
|
+
"claude-sdk": claudeSdkAdapter,
|
|
8857
9239
|
codex: codexAdapter,
|
|
8858
9240
|
pi: piAdapter
|
|
8859
9241
|
};
|
|
@@ -9471,12 +9853,12 @@ var editEnforcement = [
|
|
|
9471
9853
|
var fixConflictFeature = {
|
|
9472
9854
|
id: "fixConflict",
|
|
9473
9855
|
label: "Fix conflicts",
|
|
9474
|
-
requires: ["skills.native", ...editEnforcement]
|
|
9856
|
+
requires: ["skills.native", "launch.terminal", ...editEnforcement]
|
|
9475
9857
|
};
|
|
9476
9858
|
var reviewPrCommentsFeature = {
|
|
9477
9859
|
id: "reviewPrComments",
|
|
9478
9860
|
label: "Address comments",
|
|
9479
|
-
requires: ["skills.native", ...editEnforcement]
|
|
9861
|
+
requires: ["skills.native", "launch.terminal", ...editEnforcement]
|
|
9480
9862
|
};
|
|
9481
9863
|
var addressCommentsChainFeature = {
|
|
9482
9864
|
id: "addressCommentsChain",
|
|
@@ -9625,27 +10007,32 @@ var reviewSynthesisFeature = {
|
|
|
9625
10007
|
var reviewRefineFeature = {
|
|
9626
10008
|
id: "reviewRefine",
|
|
9627
10009
|
label: "Review & refine",
|
|
9628
|
-
requires: [...editEnforcement]
|
|
10010
|
+
requires: ["launch.terminal", ...editEnforcement]
|
|
9629
10011
|
};
|
|
9630
10012
|
var reviewApplyFeature = {
|
|
9631
10013
|
id: "reviewApply",
|
|
9632
10014
|
label: "Review & apply",
|
|
9633
|
-
requires: [...editEnforcement]
|
|
10015
|
+
requires: ["launch.terminal", ...editEnforcement]
|
|
9634
10016
|
};
|
|
9635
10017
|
var reviewBacklogFeature = {
|
|
9636
10018
|
id: "reviewBacklog",
|
|
9637
10019
|
label: "Review & backlog",
|
|
9638
|
-
requires: ["skills.native", ...editEnforcement]
|
|
10020
|
+
requires: ["skills.native", "launch.terminal", ...editEnforcement]
|
|
9639
10021
|
};
|
|
9640
10022
|
var reviewCheckoutFeature = {
|
|
9641
10023
|
id: "reviewCheckout",
|
|
9642
10024
|
label: "PR checkout session",
|
|
9643
|
-
requires: [...editEnforcement]
|
|
10025
|
+
requires: ["launch.terminal", ...editEnforcement]
|
|
9644
10026
|
};
|
|
9645
10027
|
var highLevelReviewFeature = {
|
|
9646
10028
|
id: "highLevelReview",
|
|
9647
10029
|
label: "High-level review",
|
|
9648
|
-
requires: [
|
|
10030
|
+
requires: [
|
|
10031
|
+
"skills.native",
|
|
10032
|
+
"launch.terminal",
|
|
10033
|
+
"tasks.notifyOnExit",
|
|
10034
|
+
...editEnforcement
|
|
10035
|
+
]
|
|
9649
10036
|
};
|
|
9650
10037
|
var highLevelGlobsFeature = {
|
|
9651
10038
|
id: "highLevelGlobs",
|
|
@@ -10986,6 +11373,11 @@ var sessionsConfigHelp = [
|
|
|
10986
11373
|
setter: "assist config set sessions.maxLive 24 --node",
|
|
10987
11374
|
note: "ceiling on concurrent live sessions one daemon holds; spawning past it is refused, and restore respawns at most this many persisted sessions (default: 24)"
|
|
10988
11375
|
},
|
|
11376
|
+
{
|
|
11377
|
+
key: "sessions.reportLeftovers",
|
|
11378
|
+
setter: "assist config set sessions.reportLeftovers false --node",
|
|
11379
|
+
note: "default on: on daemon restart, recheck reaped worktree paths that reappeared (e.g. root-owned Docker bind-mount stubs) and list any leftover assist cannot delete in one notice with a combined removal command. Set false to skip both"
|
|
11380
|
+
},
|
|
10989
11381
|
{
|
|
10990
11382
|
key: "sessions.newSessionMode",
|
|
10991
11383
|
setter: "assist config set sessions.newSessionMode bug --node",
|
|
@@ -11548,7 +11940,7 @@ function handleServerRuns(req, res) {
|
|
|
11548
11940
|
|
|
11549
11941
|
// src/commands/sessions/web/getReviewSynthesis.ts
|
|
11550
11942
|
import { execFile as execFile6 } from "child_process";
|
|
11551
|
-
import { readFileSync as
|
|
11943
|
+
import { readFileSync as readFileSync14 } from "fs";
|
|
11552
11944
|
import { homedir as homedir10 } from "os";
|
|
11553
11945
|
import { basename as basename10, join as join32 } from "path";
|
|
11554
11946
|
import { promisify as promisify6 } from "util";
|
|
@@ -11596,7 +11988,7 @@ async function getReviewSynthesis(req, res) {
|
|
|
11596
11988
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
11597
11989
|
return;
|
|
11598
11990
|
}
|
|
11599
|
-
respondJson(res, 200, { synthesis:
|
|
11991
|
+
respondJson(res, 200, { synthesis: readFileSync14(path128, "utf8") });
|
|
11600
11992
|
} catch {
|
|
11601
11993
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
11602
11994
|
}
|
|
@@ -11920,14 +12312,14 @@ async function deleteItemComment(res, itemId2, commentId) {
|
|
|
11920
12312
|
|
|
11921
12313
|
// src/commands/backlog/appendComment.ts
|
|
11922
12314
|
import { sql as sql17 } from "drizzle-orm";
|
|
11923
|
-
async function appendComment(orm, itemId2, text18,
|
|
12315
|
+
async function appendComment(orm, itemId2, text18, opts2 = {}) {
|
|
11924
12316
|
await orm.insert(comments).values({
|
|
11925
12317
|
itemId: itemId2,
|
|
11926
12318
|
idx: sql17`(SELECT COALESCE(MAX(${comments.idx}) + 1, 0) FROM ${comments} WHERE ${comments.itemId} = ${itemId2})`,
|
|
11927
12319
|
text: text18,
|
|
11928
|
-
phase:
|
|
12320
|
+
phase: opts2.phase ?? null,
|
|
11929
12321
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11930
|
-
type:
|
|
12322
|
+
type: opts2.type ?? "comment"
|
|
11931
12323
|
});
|
|
11932
12324
|
}
|
|
11933
12325
|
|
|
@@ -12023,22 +12415,22 @@ var transcriptFeatures = [
|
|
|
12023
12415
|
var refineFeature = {
|
|
12024
12416
|
id: "refine",
|
|
12025
12417
|
label: "Refine",
|
|
12026
|
-
requires: ["skills.native", ...editEnforcement]
|
|
12418
|
+
requires: ["skills.native", "launch.terminal", ...editEnforcement]
|
|
12027
12419
|
};
|
|
12028
12420
|
var draftFeature = {
|
|
12029
12421
|
id: "draft",
|
|
12030
12422
|
label: "Draft",
|
|
12031
|
-
requires: ["skills.native", ...editEnforcement]
|
|
12423
|
+
requires: ["skills.native", "launch.terminal", ...editEnforcement]
|
|
12032
12424
|
};
|
|
12033
12425
|
var bugFeature = {
|
|
12034
12426
|
id: "bug",
|
|
12035
12427
|
label: "Bug filing",
|
|
12036
|
-
requires: ["skills.native", ...editEnforcement]
|
|
12428
|
+
requires: ["skills.native", "launch.terminal", ...editEnforcement]
|
|
12037
12429
|
};
|
|
12038
12430
|
var buildFeature = {
|
|
12039
12431
|
id: "build",
|
|
12040
12432
|
label: "Build",
|
|
12041
|
-
requires: [...editEnforcement]
|
|
12433
|
+
requires: ["launch.terminal", ...editEnforcement]
|
|
12042
12434
|
};
|
|
12043
12435
|
var sessionFeature = {
|
|
12044
12436
|
id: "session",
|
|
@@ -12058,7 +12450,7 @@ var conversationRecoveryFeature = {
|
|
|
12058
12450
|
var divergenceEscalationFeature = {
|
|
12059
12451
|
id: "divergenceEscalation",
|
|
12060
12452
|
label: "Divergence escalation",
|
|
12061
|
-
requires: [...editEnforcement]
|
|
12453
|
+
requires: ["launch.terminal", ...editEnforcement]
|
|
12062
12454
|
};
|
|
12063
12455
|
var previewQuestionsFeature = {
|
|
12064
12456
|
id: "previewQuestions",
|
|
@@ -12457,7 +12849,7 @@ import chalk10 from "chalk";
|
|
|
12457
12849
|
import {
|
|
12458
12850
|
existsSync as existsSync26,
|
|
12459
12851
|
mkdirSync as mkdirSync8,
|
|
12460
|
-
readFileSync as
|
|
12852
|
+
readFileSync as readFileSync15,
|
|
12461
12853
|
rmSync as rmSync3,
|
|
12462
12854
|
writeFileSync as writeFileSync7
|
|
12463
12855
|
} from "fs";
|
|
@@ -12477,7 +12869,7 @@ function readSignalOwner(itemId2) {
|
|
|
12477
12869
|
const path128 = getOwnerPath(itemId2);
|
|
12478
12870
|
if (!existsSync26(path128)) return void 0;
|
|
12479
12871
|
try {
|
|
12480
|
-
const parsed = JSON.parse(
|
|
12872
|
+
const parsed = JSON.parse(readFileSync15(path128, "utf8"));
|
|
12481
12873
|
return parsed.sessionId;
|
|
12482
12874
|
} catch {
|
|
12483
12875
|
return void 0;
|
|
@@ -13096,9 +13488,9 @@ function queryNodes() {
|
|
|
13096
13488
|
}
|
|
13097
13489
|
|
|
13098
13490
|
// src/commands/watch/resolveUpstream.ts
|
|
13099
|
-
import { execFileSync as
|
|
13491
|
+
import { execFileSync as execFileSync4 } from "child_process";
|
|
13100
13492
|
function runGit3(args, cwd) {
|
|
13101
|
-
return
|
|
13493
|
+
return execFileSync4("git", args, {
|
|
13102
13494
|
encoding: "utf8",
|
|
13103
13495
|
stdio: ["pipe", "pipe", "pipe"],
|
|
13104
13496
|
cwd,
|
|
@@ -13174,8 +13566,8 @@ async function health(_req, res) {
|
|
|
13174
13566
|
function getCwdAndQuery(req, res) {
|
|
13175
13567
|
const cwd = getCwdParam(req, res);
|
|
13176
13568
|
if (!cwd) return null;
|
|
13177
|
-
const
|
|
13178
|
-
return { cwd, query };
|
|
13569
|
+
const query2 = new URL(req.url ?? "/", "http://localhost").searchParams.get("q") ?? "";
|
|
13570
|
+
return { cwd, query: query2 };
|
|
13179
13571
|
}
|
|
13180
13572
|
|
|
13181
13573
|
// src/commands/sessions/web/historySearch.ts
|
|
@@ -13348,11 +13740,11 @@ var linkStateCache = {
|
|
|
13348
13740
|
|
|
13349
13741
|
// src/commands/sessions/web/linkStatus/fetchLinkStateChunks.ts
|
|
13350
13742
|
var CHUNK_SIZE = 100;
|
|
13351
|
-
async function fetchLinkStateChunks(refs,
|
|
13743
|
+
async function fetchLinkStateChunks(refs, query2) {
|
|
13352
13744
|
const resolved = /* @__PURE__ */ new Map();
|
|
13353
13745
|
for (let start2 = 0; start2 < refs.length; start2 += CHUNK_SIZE) {
|
|
13354
13746
|
const chunk2 = refs.slice(start2, start2 + CHUNK_SIZE);
|
|
13355
|
-
const states2 = await
|
|
13747
|
+
const states2 = await query2(chunk2).catch(() => void 0);
|
|
13356
13748
|
if (!states2) continue;
|
|
13357
13749
|
chunk2.forEach((ref, i) => {
|
|
13358
13750
|
const key = linkRefKey(ref);
|
|
@@ -13432,9 +13824,9 @@ async function queryLinkStates(refs) {
|
|
|
13432
13824
|
|
|
13433
13825
|
// src/commands/sessions/web/linkStatus/resolveLinkStates.ts
|
|
13434
13826
|
var inFlight2 = /* @__PURE__ */ new Map();
|
|
13435
|
-
function startFetch(refs,
|
|
13827
|
+
function startFetch(refs, query2) {
|
|
13436
13828
|
if (refs.length === 0) return;
|
|
13437
|
-
const batch = fetchLinkStateChunks(refs,
|
|
13829
|
+
const batch = fetchLinkStateChunks(refs, query2);
|
|
13438
13830
|
for (const ref of refs) {
|
|
13439
13831
|
const key = linkRefKey(ref);
|
|
13440
13832
|
const pending = batch.then((resolved) => resolved.get(key) ?? null);
|
|
@@ -13444,12 +13836,12 @@ function startFetch(refs, query) {
|
|
|
13444
13836
|
});
|
|
13445
13837
|
}
|
|
13446
13838
|
}
|
|
13447
|
-
async function resolveLinkStates(refs,
|
|
13839
|
+
async function resolveLinkStates(refs, query2 = queryLinkStates) {
|
|
13448
13840
|
const unique = new Map(refs.map((ref) => [linkRefKey(ref), ref]));
|
|
13449
13841
|
const toFetch = [...unique].filter(
|
|
13450
13842
|
([key]) => linkStateCache.get(key) === void 0 && !inFlight2.has(key)
|
|
13451
13843
|
).map(([, ref]) => ref);
|
|
13452
|
-
startFetch(toFetch,
|
|
13844
|
+
startFetch(toFetch, query2);
|
|
13453
13845
|
const states2 = {};
|
|
13454
13846
|
await Promise.all(
|
|
13455
13847
|
[...unique.keys()].map(async (key) => {
|
|
@@ -13486,12 +13878,12 @@ function isBoundary(text18, index3) {
|
|
|
13486
13878
|
if (!/[A-Za-z0-9]/.test(previous)) return true;
|
|
13487
13879
|
return /[a-z0-9]/.test(previous) && /[A-Z]/.test(text18[index3] ?? "");
|
|
13488
13880
|
}
|
|
13489
|
-
function subsequenceScore(text18,
|
|
13881
|
+
function subsequenceScore(text18, query2) {
|
|
13490
13882
|
const lower = text18.toLowerCase();
|
|
13491
13883
|
let score = 0;
|
|
13492
13884
|
let cursor = 0;
|
|
13493
13885
|
let previous = -1;
|
|
13494
|
-
for (const char of
|
|
13886
|
+
for (const char of query2) {
|
|
13495
13887
|
const at2 = lower.indexOf(char, cursor);
|
|
13496
13888
|
if (at2 === -1) return null;
|
|
13497
13889
|
if (at2 === previous + 1) score += CONSECUTIVE_BONUS;
|
|
@@ -13503,20 +13895,20 @@ function subsequenceScore(text18, query) {
|
|
|
13503
13895
|
}
|
|
13504
13896
|
return score - Math.min(text18.length, MAX_LENGTH_PENALTY);
|
|
13505
13897
|
}
|
|
13506
|
-
function scoreFilePath(path128,
|
|
13507
|
-
const needle =
|
|
13898
|
+
function scoreFilePath(path128, query2) {
|
|
13899
|
+
const needle = query2.trim().toLowerCase();
|
|
13508
13900
|
if (!needle) return 0;
|
|
13509
|
-
const
|
|
13510
|
-
const inBasename = subsequenceScore(
|
|
13901
|
+
const basename38 = path128.slice(path128.lastIndexOf("/") + 1);
|
|
13902
|
+
const inBasename = subsequenceScore(basename38, needle);
|
|
13511
13903
|
if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
|
|
13512
13904
|
return subsequenceScore(path128, needle);
|
|
13513
13905
|
}
|
|
13514
13906
|
|
|
13515
13907
|
// src/commands/sessions/web/rankFilePaths.ts
|
|
13516
|
-
function rankFilePaths(paths,
|
|
13908
|
+
function rankFilePaths(paths, query2, limit) {
|
|
13517
13909
|
const scored = [];
|
|
13518
13910
|
for (const path128 of paths) {
|
|
13519
|
-
const score = scoreFilePath(path128,
|
|
13911
|
+
const score = scoreFilePath(path128, query2);
|
|
13520
13912
|
if (score !== null) scored.push({ path: path128, score });
|
|
13521
13913
|
}
|
|
13522
13914
|
scored.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path));
|
|
@@ -13543,10 +13935,10 @@ async function repoFiles(cwd) {
|
|
|
13543
13935
|
async function listFiles(req, res) {
|
|
13544
13936
|
const params = getCwdAndQuery(req, res);
|
|
13545
13937
|
if (!params) return;
|
|
13546
|
-
const { cwd, query } = params;
|
|
13938
|
+
const { cwd, query: query2 } = params;
|
|
13547
13939
|
try {
|
|
13548
13940
|
const files = await repoFiles(cwd);
|
|
13549
|
-
respondJson(res, 200, { files: rankFilePaths(files,
|
|
13941
|
+
respondJson(res, 200, { files: rankFilePaths(files, query2, MAX_RESULTS) });
|
|
13550
13942
|
} catch {
|
|
13551
13943
|
respondJson(res, 500, { error: "Failed to list files" });
|
|
13552
13944
|
}
|
|
@@ -14278,10 +14670,10 @@ function assertProjectScope() {
|
|
|
14278
14670
|
}
|
|
14279
14671
|
|
|
14280
14672
|
// src/shared/runGhOrThrow.ts
|
|
14281
|
-
import { execFileSync as
|
|
14673
|
+
import { execFileSync as execFileSync5 } from "child_process";
|
|
14282
14674
|
function runGhOrThrow(args, fallbackMessage, input) {
|
|
14283
14675
|
try {
|
|
14284
|
-
|
|
14676
|
+
execFileSync5("gh", args, {
|
|
14285
14677
|
stdio: [input === void 0 ? "ignore" : "pipe", "ignore", "pipe"],
|
|
14286
14678
|
encoding: "utf8",
|
|
14287
14679
|
...input === void 0 ? {} : { input }
|
|
@@ -14323,11 +14715,11 @@ function throwOnGraphqlErrors(stdout) {
|
|
|
14323
14715
|
}
|
|
14324
14716
|
|
|
14325
14717
|
// src/shared/runGhGraphqlJson.ts
|
|
14326
|
-
function runGhGraphqlJson(
|
|
14718
|
+
function runGhGraphqlJson(query2, vars = {}) {
|
|
14327
14719
|
const result = spawnSync4("gh", ["api", "graphql", "--input", "-"], {
|
|
14328
14720
|
encoding: "utf8",
|
|
14329
14721
|
windowsHide: true,
|
|
14330
|
-
input: JSON.stringify({ query, variables: vars }),
|
|
14722
|
+
input: JSON.stringify({ query: query2, variables: vars }),
|
|
14331
14723
|
maxBuffer: 64 * 1024 * 1024
|
|
14332
14724
|
});
|
|
14333
14725
|
if (result.status !== 0) throw new Error(result.stderr || result.stdout);
|
|
@@ -14460,7 +14852,7 @@ async function nextPickup(req, res) {
|
|
|
14460
14852
|
import path22 from "path";
|
|
14461
14853
|
|
|
14462
14854
|
// src/commands/rules/readScopedRules.ts
|
|
14463
|
-
import { existsSync as existsSync28, readFileSync as
|
|
14855
|
+
import { existsSync as existsSync28, readFileSync as readFileSync16 } from "fs";
|
|
14464
14856
|
import path21 from "path";
|
|
14465
14857
|
|
|
14466
14858
|
// src/commands/rules/rulesSectionRange.ts
|
|
@@ -14532,7 +14924,7 @@ function scopedClaudeFiles(target) {
|
|
|
14532
14924
|
}
|
|
14533
14925
|
function readScopedRules(target) {
|
|
14534
14926
|
return scopedClaudeFiles(target).flatMap(
|
|
14535
|
-
(source) => parseRulesSection(
|
|
14927
|
+
(source) => parseRulesSection(readFileSync16(source, "utf8")).map((rule) => ({
|
|
14536
14928
|
...rule,
|
|
14537
14929
|
source
|
|
14538
14930
|
}))
|
|
@@ -14665,7 +15057,7 @@ function avgContextPerCycle(db) {
|
|
|
14665
15057
|
// src/shared/db/listUsagePeaks.ts
|
|
14666
15058
|
async function listUsagePeaks(db, options2) {
|
|
14667
15059
|
const avgContext = avgContextPerCycle(db);
|
|
14668
|
-
const
|
|
15060
|
+
const query2 = db.select({
|
|
14669
15061
|
...getTableColumns(usagePeaks),
|
|
14670
15062
|
avgContextPct: avgContext.avgContextPct,
|
|
14671
15063
|
phaseCount: avgContext.phaseCount
|
|
@@ -14682,14 +15074,15 @@ async function listUsagePeaks(db, options2) {
|
|
|
14682
15074
|
desc4(usagePeaks.segment)
|
|
14683
15075
|
);
|
|
14684
15076
|
if (options2?.limit !== void 0) {
|
|
14685
|
-
return
|
|
15077
|
+
return query2.limit(options2.limit).offset(options2.offset ?? 0);
|
|
14686
15078
|
}
|
|
14687
|
-
return
|
|
15079
|
+
return query2;
|
|
14688
15080
|
}
|
|
14689
15081
|
|
|
14690
15082
|
// src/shared/harnessAdapters/harnessUsageAccounts.ts
|
|
14691
15083
|
var harnessUsageAccounts = {
|
|
14692
15084
|
claude: {},
|
|
15085
|
+
"claude-sdk": {},
|
|
14693
15086
|
codex: { windowPrefix: "codex" },
|
|
14694
15087
|
pi: { windowPrefix: "pi" }
|
|
14695
15088
|
};
|
|
@@ -14857,7 +15250,7 @@ async function listItemUsageSummaries(db, options2) {
|
|
|
14857
15250
|
const totals = phaseUsageTotals(db);
|
|
14858
15251
|
const planned = planPhaseCounts(db);
|
|
14859
15252
|
const lastPhase = lastPhaseActivity(db);
|
|
14860
|
-
const
|
|
15253
|
+
const query2 = db.select({
|
|
14861
15254
|
id: items.id,
|
|
14862
15255
|
origin: items.origin,
|
|
14863
15256
|
type: items.type,
|
|
@@ -14873,7 +15266,7 @@ async function listItemUsageSummaries(db, options2) {
|
|
|
14873
15266
|
}).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(
|
|
14874
15267
|
...itemUsageOrderBy({ totals, planned, lastPhase }, options2?.sort)
|
|
14875
15268
|
);
|
|
14876
|
-
const rows = options2?.limit === void 0 ? await
|
|
15269
|
+
const rows = options2?.limit === void 0 ? await query2 : await query2.limit(options2.limit).offset(options2.offset ?? 0);
|
|
14877
15270
|
return rows.map(toItemUsageSummary);
|
|
14878
15271
|
}
|
|
14879
15272
|
|
|
@@ -15951,7 +16344,7 @@ async function revertDiffFile(req, res) {
|
|
|
15951
16344
|
}
|
|
15952
16345
|
|
|
15953
16346
|
// src/commands/run/runCommandToCompletion.ts
|
|
15954
|
-
import { spawn as
|
|
16347
|
+
import { spawn as spawn7 } from "child_process";
|
|
15955
16348
|
import { existsSync as existsSync30 } from "fs";
|
|
15956
16349
|
|
|
15957
16350
|
// src/shared/expandEnv.ts
|
|
@@ -15966,13 +16359,13 @@ function expandEnv(env) {
|
|
|
15966
16359
|
}
|
|
15967
16360
|
|
|
15968
16361
|
// src/commands/run/resolveCommand.ts
|
|
15969
|
-
import { execFileSync as
|
|
16362
|
+
import { execFileSync as execFileSync6 } from "child_process";
|
|
15970
16363
|
import { existsSync as existsSync29 } from "fs";
|
|
15971
16364
|
import { dirname as dirname14, join as join35, resolve as resolve10 } from "path";
|
|
15972
16365
|
function resolveCommand(command) {
|
|
15973
16366
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
15974
16367
|
try {
|
|
15975
|
-
const gitPath =
|
|
16368
|
+
const gitPath = execFileSync6("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
15976
16369
|
const gitRoot = resolve10(dirname14(gitPath), "..");
|
|
15977
16370
|
const gitBash = join35(gitRoot, "bin", "bash.exe");
|
|
15978
16371
|
if (existsSync29(gitBash)) return gitBash;
|
|
@@ -15992,7 +16385,7 @@ function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
|
15992
16385
|
});
|
|
15993
16386
|
return;
|
|
15994
16387
|
}
|
|
15995
|
-
const child2 =
|
|
16388
|
+
const child2 = spawn7(resolveCommand(command), args, {
|
|
15996
16389
|
stdio: quiet ? "pipe" : "inherit",
|
|
15997
16390
|
env: env ? { ...process.env, ...expandEnv(env) } : void 0,
|
|
15998
16391
|
cwd
|
|
@@ -16928,8 +17321,8 @@ async function ascRequest(fetchFn, token, method, path128, body) {
|
|
|
16928
17321
|
function createAscClient(token, fetchFn = fetch) {
|
|
16929
17322
|
return {
|
|
16930
17323
|
get: (path128, params) => {
|
|
16931
|
-
const
|
|
16932
|
-
return ascRequest(fetchFn, token, "GET", `${path128}${
|
|
17324
|
+
const query2 = params ? `?${new URLSearchParams(params)}` : "";
|
|
17325
|
+
return ascRequest(fetchFn, token, "GET", `${path128}${query2}`);
|
|
16933
17326
|
},
|
|
16934
17327
|
post: (path128, body) => ascRequest(fetchFn, token, "POST", path128, body)
|
|
16935
17328
|
};
|
|
@@ -18101,12 +18494,12 @@ function readBuiltVersion(cwd) {
|
|
|
18101
18494
|
}
|
|
18102
18495
|
|
|
18103
18496
|
// src/commands/watch/readDistVersion.ts
|
|
18104
|
-
import { readFileSync as
|
|
18497
|
+
import { readFileSync as readFileSync18 } from "fs";
|
|
18105
18498
|
import { join as join40 } from "path";
|
|
18106
18499
|
function readDistVersion(cwd) {
|
|
18107
18500
|
try {
|
|
18108
18501
|
const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
18109
|
-
return
|
|
18502
|
+
return readFileSync18(join40(root2, "dist", "built-version"), "utf8").trim();
|
|
18110
18503
|
} catch {
|
|
18111
18504
|
return void 0;
|
|
18112
18505
|
}
|
|
@@ -18531,7 +18924,7 @@ async function writeFileContent(req, res) {
|
|
|
18531
18924
|
|
|
18532
18925
|
// src/shared/createBundleHandler.ts
|
|
18533
18926
|
import { createHash as createHash2 } from "crypto";
|
|
18534
|
-
import { readFileSync as
|
|
18927
|
+
import { readFileSync as readFileSync19, statSync as statSync10 } from "fs";
|
|
18535
18928
|
import { dirname as dirname19, join as join44 } from "path";
|
|
18536
18929
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
18537
18930
|
function createBundleHandler(importMetaUrl, bundlePath, contentType = "application/javascript") {
|
|
@@ -18540,7 +18933,7 @@ function createBundleHandler(importMetaUrl, bundlePath, contentType = "applicati
|
|
|
18540
18933
|
return (req, res) => {
|
|
18541
18934
|
const mtimeMs = statSync10(file).mtimeMs;
|
|
18542
18935
|
if (cache7?.mtimeMs !== mtimeMs) {
|
|
18543
|
-
const body =
|
|
18936
|
+
const body = readFileSync19(file);
|
|
18544
18937
|
const etag = `"${createHash2("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
18545
18938
|
cache7 = { body, etag, mtimeMs };
|
|
18546
18939
|
}
|
|
@@ -18563,7 +18956,7 @@ function createBundleHandler(importMetaUrl, bundlePath, contentType = "applicati
|
|
|
18563
18956
|
|
|
18564
18957
|
// src/commands/sessions/web/createCssHandler.ts
|
|
18565
18958
|
import { createHash as createHash3 } from "crypto";
|
|
18566
|
-
import { readFileSync as
|
|
18959
|
+
import { readFileSync as readFileSync20 } from "fs";
|
|
18567
18960
|
import { createRequire as createRequire2 } from "module";
|
|
18568
18961
|
var require3 = createRequire2(import.meta.url);
|
|
18569
18962
|
function createCssHandler(packageEntry) {
|
|
@@ -18571,7 +18964,7 @@ function createCssHandler(packageEntry) {
|
|
|
18571
18964
|
return (req, res) => {
|
|
18572
18965
|
if (!cache7) {
|
|
18573
18966
|
const resolved = require3.resolve(packageEntry);
|
|
18574
|
-
const body =
|
|
18967
|
+
const body = readFileSync20(resolved, "utf8");
|
|
18575
18968
|
const etag = `"${createHash3("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
18576
18969
|
cache7 = { body, etag };
|
|
18577
18970
|
}
|
|
@@ -18978,12 +19371,12 @@ function scheduleReconnect() {
|
|
|
18978
19371
|
}
|
|
18979
19372
|
|
|
18980
19373
|
// src/commands/sessions/web/updates/autoRestart/autoRestartAttempts.ts
|
|
18981
|
-
import { mkdirSync as mkdirSync11, readFileSync as
|
|
19374
|
+
import { mkdirSync as mkdirSync11, readFileSync as readFileSync21, writeFileSync as writeFileSync10 } from "fs";
|
|
18982
19375
|
import { dirname as dirname20, join as join45 } from "path";
|
|
18983
19376
|
var defaultPath = join45(daemonPaths.dir, "auto-restart-attempts.json");
|
|
18984
19377
|
function read(path128) {
|
|
18985
19378
|
try {
|
|
18986
|
-
return JSON.parse(
|
|
19379
|
+
return JSON.parse(readFileSync21(path128, "utf8"));
|
|
18987
19380
|
} catch {
|
|
18988
19381
|
return {};
|
|
18989
19382
|
}
|
|
@@ -19209,7 +19602,7 @@ function repoDirExists(cwd) {
|
|
|
19209
19602
|
}
|
|
19210
19603
|
|
|
19211
19604
|
// src/commands/sessions/daemon/worktree/git.ts
|
|
19212
|
-
import { execFile as execFile14, execFileSync as
|
|
19605
|
+
import { execFile as execFile14, execFileSync as execFileSync7 } from "child_process";
|
|
19213
19606
|
function isWindowsPath(cwd) {
|
|
19214
19607
|
return /^[A-Za-z]:[\\/]/.test(cwd);
|
|
19215
19608
|
}
|
|
@@ -19264,7 +19657,7 @@ function gitSyncResult(cwd, args) {
|
|
|
19264
19657
|
}
|
|
19265
19658
|
function gitSync(cwd, args) {
|
|
19266
19659
|
const { file, argv, options: options2 } = gitInvocation(cwd, args);
|
|
19267
|
-
return
|
|
19660
|
+
return execFileSync7(file, argv, {
|
|
19268
19661
|
...options2,
|
|
19269
19662
|
stdio: ["pipe", "pipe", "pipe"]
|
|
19270
19663
|
}).toString();
|
|
@@ -19335,6 +19728,21 @@ function forgetWorktree(path128) {
|
|
|
19335
19728
|
data[path128] = { ...record3, reaped: true };
|
|
19336
19729
|
saveJson(REGISTRY_FILE, data);
|
|
19337
19730
|
}
|
|
19731
|
+
function markLeftover(path128, reason4) {
|
|
19732
|
+
const data = loadJson(REGISTRY_FILE);
|
|
19733
|
+
const record3 = data[path128];
|
|
19734
|
+
if (!record3) return;
|
|
19735
|
+
data[path128] = { ...record3, reaped: true, leftover: reason4 };
|
|
19736
|
+
saveJson(REGISTRY_FILE, data);
|
|
19737
|
+
}
|
|
19738
|
+
function clearLeftover(path128) {
|
|
19739
|
+
const data = loadJson(REGISTRY_FILE);
|
|
19740
|
+
const record3 = data[path128];
|
|
19741
|
+
if (!record3?.leftover) return;
|
|
19742
|
+
const { leftover: _leftover, ...rest } = record3;
|
|
19743
|
+
data[path128] = rest;
|
|
19744
|
+
saveJson(REGISTRY_FILE, data);
|
|
19745
|
+
}
|
|
19338
19746
|
|
|
19339
19747
|
// src/commands/sessions/daemon/repoGroupForCwd.ts
|
|
19340
19748
|
var cache6 = /* @__PURE__ */ new Map();
|
|
@@ -19708,12 +20116,12 @@ import * as path27 from "path";
|
|
|
19708
20116
|
import chalk22 from "chalk";
|
|
19709
20117
|
|
|
19710
20118
|
// src/commands/verify/addToKnipIgnoreBinaries.ts
|
|
19711
|
-
import { existsSync as existsSync36, readFileSync as
|
|
20119
|
+
import { existsSync as existsSync36, readFileSync as readFileSync22, writeFileSync as writeFileSync12 } from "fs";
|
|
19712
20120
|
import { join as join46 } from "path";
|
|
19713
20121
|
import chalk21 from "chalk";
|
|
19714
20122
|
function loadKnipConfig(knipJsonPath) {
|
|
19715
20123
|
if (existsSync36(knipJsonPath)) {
|
|
19716
|
-
return JSON.parse(
|
|
20124
|
+
return JSON.parse(readFileSync22(knipJsonPath, "utf8"));
|
|
19717
20125
|
}
|
|
19718
20126
|
return { $schema: "https://unpkg.com/knip@5/schema.json" };
|
|
19719
20127
|
}
|
|
@@ -19765,7 +20173,7 @@ import * as path29 from "path";
|
|
|
19765
20173
|
import chalk27 from "chalk";
|
|
19766
20174
|
|
|
19767
20175
|
// src/commands/format/init.ts
|
|
19768
|
-
import { existsSync as existsSync37, readFileSync as
|
|
20176
|
+
import { existsSync as existsSync37, readFileSync as readFileSync23, writeFileSync as writeFileSync13 } from "fs";
|
|
19769
20177
|
import chalk25 from "chalk";
|
|
19770
20178
|
|
|
19771
20179
|
// src/utils/printDiff.ts
|
|
@@ -19808,7 +20216,7 @@ async function init() {
|
|
|
19808
20216
|
const newContent = `${JSON.stringify(oxfmtrc_template_default, null, " ")}
|
|
19809
20217
|
`;
|
|
19810
20218
|
const configPath = ".oxfmtrc.json";
|
|
19811
|
-
const oldContent = existsSync37(configPath) ?
|
|
20219
|
+
const oldContent = existsSync37(configPath) ? readFileSync23(configPath, "utf8") : "";
|
|
19812
20220
|
if (oldContent === newContent) {
|
|
19813
20221
|
console.log(".oxfmtrc.json already has the baseline formatter config");
|
|
19814
20222
|
return;
|
|
@@ -19831,12 +20239,12 @@ async function init() {
|
|
|
19831
20239
|
}
|
|
19832
20240
|
|
|
19833
20241
|
// src/commands/lint/init.ts
|
|
19834
|
-
import { existsSync as existsSync40, readFileSync as
|
|
20242
|
+
import { existsSync as existsSync40, readFileSync as readFileSync25, writeFileSync as writeFileSync15 } from "fs";
|
|
19835
20243
|
import chalk26 from "chalk";
|
|
19836
20244
|
|
|
19837
20245
|
// src/shared/removeEslint.ts
|
|
19838
20246
|
import { execSync as execSync7 } from "child_process";
|
|
19839
|
-
import { existsSync as existsSync39, readFileSync as
|
|
20247
|
+
import { existsSync as existsSync39, readFileSync as readFileSync24, writeFileSync as writeFileSync14 } from "fs";
|
|
19840
20248
|
|
|
19841
20249
|
// src/shared/removeEslint/removeEslintConfigFiles.ts
|
|
19842
20250
|
import { existsSync as existsSync38, unlinkSync as unlinkSync3 } from "fs";
|
|
@@ -19880,7 +20288,7 @@ function removeEslintFromPackageJson(options2) {
|
|
|
19880
20288
|
if (!existsSync39(packageJsonPath)) {
|
|
19881
20289
|
return false;
|
|
19882
20290
|
}
|
|
19883
|
-
const packageJson = JSON.parse(
|
|
20291
|
+
const packageJson = JSON.parse(readFileSync24(packageJsonPath, "utf8"));
|
|
19884
20292
|
let modified = false;
|
|
19885
20293
|
modified = removeEslintDeps(packageJson.dependencies) || modified;
|
|
19886
20294
|
modified = removeEslintDeps(packageJson.devDependencies) || modified;
|
|
@@ -19944,7 +20352,7 @@ async function writeOxlintConfig() {
|
|
|
19944
20352
|
const newContent = `${JSON.stringify(oxlintrc_template_default, null, " ")}
|
|
19945
20353
|
`;
|
|
19946
20354
|
const configPath = ".oxlintrc.json";
|
|
19947
|
-
const oldContent = existsSync40(configPath) ?
|
|
20355
|
+
const oldContent = existsSync40(configPath) ? readFileSync25(configPath, "utf8") : "";
|
|
19948
20356
|
if (oldContent === newContent) {
|
|
19949
20357
|
console.log(".oxlintrc.json already has the baseline linter config");
|
|
19950
20358
|
return;
|
|
@@ -20066,7 +20474,7 @@ async function init3(options2 = {}) {
|
|
|
20066
20474
|
const setup = detectExistingSetup(pkg);
|
|
20067
20475
|
const selected = await promptForScripts(getAvailableOptions(setup));
|
|
20068
20476
|
if (!selected) return;
|
|
20069
|
-
const writer = options2.packageJson ? (name2, cmd,
|
|
20477
|
+
const writer = options2.packageJson ? (name2, cmd, opts2) => setupVerifyScript(packageJsonPath, name2, cmd, opts2) : setupVerifyRunEntry;
|
|
20070
20478
|
const handlers = getSetupHandlers(
|
|
20071
20479
|
setup.hasVite,
|
|
20072
20480
|
setup.hasTypescript,
|
|
@@ -20523,7 +20931,7 @@ function resolveEntries() {
|
|
|
20523
20931
|
}
|
|
20524
20932
|
|
|
20525
20933
|
// src/commands/verify/run/spawnCommand.ts
|
|
20526
|
-
import { spawn as
|
|
20934
|
+
import { spawn as spawn8 } from "child_process";
|
|
20527
20935
|
|
|
20528
20936
|
// src/lib/isAgentHarness.ts
|
|
20529
20937
|
function isAgentHarness() {
|
|
@@ -20540,7 +20948,7 @@ function shouldSuppress(quiet) {
|
|
|
20540
20948
|
return !!quiet || isAgentHarness();
|
|
20541
20949
|
}
|
|
20542
20950
|
function spawnCommand(fullCommand, cwd, env, quiet) {
|
|
20543
|
-
return
|
|
20951
|
+
return spawn8(fullCommand, [], {
|
|
20544
20952
|
stdio: shouldSuppress(quiet) ? "pipe" : "inherit",
|
|
20545
20953
|
shell: true,
|
|
20546
20954
|
cwd: cwd ?? process.cwd(),
|
|
@@ -20732,7 +21140,7 @@ async function newCli() {
|
|
|
20732
21140
|
|
|
20733
21141
|
// src/commands/new/registerNew/newProject.ts
|
|
20734
21142
|
import { execSync as execSync14 } from "child_process";
|
|
20735
|
-
import { existsSync as existsSync45, readFileSync as
|
|
21143
|
+
import { existsSync as existsSync45, readFileSync as readFileSync29, writeFileSync as writeFileSync22 } from "fs";
|
|
20736
21144
|
|
|
20737
21145
|
// src/commands/deploy/init.ts
|
|
20738
21146
|
import { execSync as execSync13 } from "child_process";
|
|
@@ -20740,7 +21148,7 @@ import chalk37 from "chalk";
|
|
|
20740
21148
|
import enquirer3 from "enquirer";
|
|
20741
21149
|
|
|
20742
21150
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
20743
|
-
import { existsSync as existsSync44, mkdirSync as mkdirSync14, readFileSync as
|
|
21151
|
+
import { existsSync as existsSync44, mkdirSync as mkdirSync14, readFileSync as readFileSync28, writeFileSync as writeFileSync21 } from "fs";
|
|
20744
21152
|
import { dirname as dirname28, join as join53 } from "path";
|
|
20745
21153
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
20746
21154
|
import chalk36 from "chalk";
|
|
@@ -20750,13 +21158,13 @@ function getExistingSiteId() {
|
|
|
20750
21158
|
if (!existsSync44(WORKFLOW_PATH)) {
|
|
20751
21159
|
return null;
|
|
20752
21160
|
}
|
|
20753
|
-
const content =
|
|
21161
|
+
const content = readFileSync28(WORKFLOW_PATH, "utf8");
|
|
20754
21162
|
const match = content.match(/-s\s+([a-f0-9-]{36})/);
|
|
20755
21163
|
return match ? match[1] : null;
|
|
20756
21164
|
}
|
|
20757
21165
|
function getTemplateContent(siteId) {
|
|
20758
21166
|
const templatePath = join53(__dirname3, "commands/deploy/build.yml");
|
|
20759
|
-
const template =
|
|
21167
|
+
const template = readFileSync28(templatePath, "utf8");
|
|
20760
21168
|
return template.replace("{{NETLIFY_SITE_ID}}", siteId);
|
|
20761
21169
|
}
|
|
20762
21170
|
async function updateWorkflow(siteId) {
|
|
@@ -20766,7 +21174,7 @@ async function updateWorkflow(siteId) {
|
|
|
20766
21174
|
mkdirSync14(workflowDir, { recursive: true });
|
|
20767
21175
|
}
|
|
20768
21176
|
if (existsSync44(WORKFLOW_PATH)) {
|
|
20769
|
-
const oldContent =
|
|
21177
|
+
const oldContent = readFileSync28(WORKFLOW_PATH, "utf8");
|
|
20770
21178
|
if (oldContent === newContent) {
|
|
20771
21179
|
console.log(chalk36.green("build.yml is already up to date"));
|
|
20772
21180
|
return;
|
|
@@ -20864,7 +21272,7 @@ function addViteBaseConfig() {
|
|
|
20864
21272
|
console.log("No vite.config.ts found, skipping base config");
|
|
20865
21273
|
return;
|
|
20866
21274
|
}
|
|
20867
|
-
const content =
|
|
21275
|
+
const content = readFileSync29(viteConfigPath, "utf8");
|
|
20868
21276
|
if (content.includes("base:")) {
|
|
20869
21277
|
console.log("vite.config.ts already has base config");
|
|
20870
21278
|
return;
|
|
@@ -20942,13 +21350,13 @@ function renderLineChart({
|
|
|
20942
21350
|
}
|
|
20943
21351
|
|
|
20944
21352
|
// src/commands/activity/fetchCommitsPerDay.ts
|
|
20945
|
-
import { execFileSync as
|
|
21353
|
+
import { execFileSync as execFileSync8 } from "child_process";
|
|
20946
21354
|
function fetchContributions(from, to) {
|
|
20947
|
-
const
|
|
21355
|
+
const query2 = `{ viewer { contributionsCollection(from: "${from}T00:00:00Z", to: "${to}T23:59:59Z") { contributionCalendar { weeks { contributionDays { date contributionCount } } } } } }`;
|
|
20948
21356
|
const jq = ".data.viewer.contributionsCollection.contributionCalendar.weeks[].contributionDays[]";
|
|
20949
|
-
const raw =
|
|
21357
|
+
const raw = execFileSync8(
|
|
20950
21358
|
"gh",
|
|
20951
|
-
["api", "graphql", "-f", `query=${
|
|
21359
|
+
["api", "graphql", "-f", `query=${query2}`, "--jq", jq],
|
|
20952
21360
|
{ encoding: "utf8" }
|
|
20953
21361
|
).trim();
|
|
20954
21362
|
if (!raw) return [];
|
|
@@ -21063,7 +21471,7 @@ function adviceContextFor(cwd, env = process.env) {
|
|
|
21063
21471
|
}
|
|
21064
21472
|
|
|
21065
21473
|
// src/commands/advise/loadAdviceFragments.ts
|
|
21066
|
-
import { readdirSync as readdirSync10, readFileSync as
|
|
21474
|
+
import { readdirSync as readdirSync10, readFileSync as readFileSync30 } from "fs";
|
|
21067
21475
|
import { basename as basename15, join as join55 } from "path";
|
|
21068
21476
|
|
|
21069
21477
|
// src/commands/advise/adviceDir.ts
|
|
@@ -21106,7 +21514,7 @@ function loadAdviceFragments(dir = adviceDir()) {
|
|
|
21106
21514
|
return readdirSync10(dir).filter((file) => file.endsWith(".md")).sort().map(
|
|
21107
21515
|
(file) => parseAdviceFragment(
|
|
21108
21516
|
basename15(file, ".md"),
|
|
21109
|
-
|
|
21517
|
+
readFileSync30(join55(dir, file), "utf8")
|
|
21110
21518
|
)
|
|
21111
21519
|
);
|
|
21112
21520
|
}
|
|
@@ -21807,7 +22215,7 @@ async function resolveCheckBump(check2) {
|
|
|
21807
22215
|
}
|
|
21808
22216
|
|
|
21809
22217
|
// src/commands/backlog/readJsonPayload.ts
|
|
21810
|
-
import { readFileSync as
|
|
22218
|
+
import { readFileSync as readFileSync31 } from "fs";
|
|
21811
22219
|
import chalk39 from "chalk";
|
|
21812
22220
|
function fail(message4) {
|
|
21813
22221
|
console.error(chalk39.red(message4));
|
|
@@ -21819,7 +22227,7 @@ function describe2(error) {
|
|
|
21819
22227
|
async function readSource(source) {
|
|
21820
22228
|
try {
|
|
21821
22229
|
if (source === "-") return (await readStdinBuffer()).toString("utf8");
|
|
21822
|
-
return
|
|
22230
|
+
return readFileSync31(source, "utf8");
|
|
21823
22231
|
} catch (error) {
|
|
21824
22232
|
return fail(
|
|
21825
22233
|
`Cannot read the payload from ${source === "-" ? "stdin" : source}: ${describe2(error)}`
|
|
@@ -23349,7 +23757,7 @@ function ensureRemoteOrigin() {
|
|
|
23349
23757
|
|
|
23350
23758
|
// src/commands/backlog/add/shared.ts
|
|
23351
23759
|
import { spawnSync as spawnSync7 } from "child_process";
|
|
23352
|
-
import { mkdtempSync, readFileSync as
|
|
23760
|
+
import { mkdtempSync, readFileSync as readFileSync32, unlinkSync as unlinkSync4, writeFileSync as writeFileSync23 } from "fs";
|
|
23353
23761
|
import { tmpdir as tmpdir2 } from "os";
|
|
23354
23762
|
import { join as join59 } from "path";
|
|
23355
23763
|
import enquirer4 from "enquirer";
|
|
@@ -23399,7 +23807,7 @@ function openEditor() {
|
|
|
23399
23807
|
unlinkSync4(filePath);
|
|
23400
23808
|
return void 0;
|
|
23401
23809
|
}
|
|
23402
|
-
const content =
|
|
23810
|
+
const content = readFileSync32(filePath, "utf8").trim();
|
|
23403
23811
|
unlinkSync4(filePath);
|
|
23404
23812
|
return content || void 0;
|
|
23405
23813
|
}
|
|
@@ -23834,11 +24242,11 @@ function startProposedRun(id, startOn, cwd = process.cwd()) {
|
|
|
23834
24242
|
import { randomUUID as randomUUID10 } from "crypto";
|
|
23835
24243
|
|
|
23836
24244
|
// src/commands/backlog/propose/mutateLedger.ts
|
|
23837
|
-
import { mkdirSync as mkdirSync15, readFileSync as
|
|
24245
|
+
import { mkdirSync as mkdirSync15, readFileSync as readFileSync33, renameSync as renameSync4, writeFileSync as writeFileSync24 } from "fs";
|
|
23838
24246
|
import { dirname as dirname30 } from "path";
|
|
23839
24247
|
function readLedger(path128) {
|
|
23840
24248
|
try {
|
|
23841
|
-
const parsed = JSON.parse(
|
|
24249
|
+
const parsed = JSON.parse(readFileSync33(path128, "utf8"));
|
|
23842
24250
|
return { open: parsed.open ?? [], created: parsed.created };
|
|
23843
24251
|
} catch {
|
|
23844
24252
|
return { open: [] };
|
|
@@ -24059,8 +24467,8 @@ async function createsCycle(orm, linkType, fromNum, toNum) {
|
|
|
24059
24467
|
);
|
|
24060
24468
|
return true;
|
|
24061
24469
|
}
|
|
24062
|
-
async function link(fromId, toId,
|
|
24063
|
-
const linkType = parseLinkType(
|
|
24470
|
+
async function link(fromId, toId, opts2) {
|
|
24471
|
+
const linkType = parseLinkType(opts2.type);
|
|
24064
24472
|
if (!linkType) return;
|
|
24065
24473
|
const fromNum = parseItemId(fromId);
|
|
24066
24474
|
const toNum = parseItemId(toId);
|
|
@@ -24375,7 +24783,7 @@ function hasLocalChanges() {
|
|
|
24375
24783
|
import {
|
|
24376
24784
|
existsSync as existsSync50,
|
|
24377
24785
|
mkdirSync as mkdirSync16,
|
|
24378
|
-
readFileSync as
|
|
24786
|
+
readFileSync as readFileSync35,
|
|
24379
24787
|
unlinkSync as unlinkSync5,
|
|
24380
24788
|
writeFileSync as writeFileSync25
|
|
24381
24789
|
} from "fs";
|
|
@@ -24389,11 +24797,11 @@ function bootedAt() {
|
|
|
24389
24797
|
}
|
|
24390
24798
|
|
|
24391
24799
|
// src/commands/backlog/processStartedAt.ts
|
|
24392
|
-
import { readFileSync as
|
|
24800
|
+
import { readFileSync as readFileSync34 } from "fs";
|
|
24393
24801
|
var clockTicksPerSecond = 100;
|
|
24394
24802
|
function processStartedAt(pid) {
|
|
24395
24803
|
try {
|
|
24396
|
-
const stat5 =
|
|
24804
|
+
const stat5 = readFileSync34(`/proc/${pid}/stat`, "utf8");
|
|
24397
24805
|
const fields = stat5.slice(stat5.lastIndexOf(")") + 2).split(" ");
|
|
24398
24806
|
const ticks = Number(fields[19]);
|
|
24399
24807
|
if (!Number.isFinite(ticks)) return void 0;
|
|
@@ -24433,7 +24841,7 @@ function foreignLockHolder(itemId2) {
|
|
|
24433
24841
|
const lockPath = getLockPath(itemId2);
|
|
24434
24842
|
if (!existsSync50(lockPath)) return null;
|
|
24435
24843
|
try {
|
|
24436
|
-
const lock2 = JSON.parse(
|
|
24844
|
+
const lock2 = JSON.parse(readFileSync35(lockPath, "utf8"));
|
|
24437
24845
|
if (typeof lock2.pid !== "number" || lock2.pid === process.pid) return null;
|
|
24438
24846
|
if (!isProcessAlive(lock2.pid)) return null;
|
|
24439
24847
|
if (isStaleLock(lock2.pid, lock2.timestamp)) return null;
|
|
@@ -25003,21 +25411,21 @@ function describeError(error) {
|
|
|
25003
25411
|
|
|
25004
25412
|
// src/commands/sessions/setSessionStatus.ts
|
|
25005
25413
|
var RELIABLE_ATTEMPTS = 3;
|
|
25006
|
-
async function setSessionStatus(status2,
|
|
25414
|
+
async function setSessionStatus(status2, opts2 = {}) {
|
|
25007
25415
|
const sessionId2 = process.env.ASSIST_SESSION_ID;
|
|
25008
|
-
logHookFired(status2, sessionId2,
|
|
25416
|
+
logHookFired(status2, sessionId2, opts2.source);
|
|
25009
25417
|
if (!sessionId2) return;
|
|
25010
25418
|
const payload = buildPayload(
|
|
25011
25419
|
sessionId2,
|
|
25012
25420
|
status2,
|
|
25013
|
-
|
|
25014
|
-
|
|
25421
|
+
opts2.source,
|
|
25422
|
+
opts2.readsClaudeHookInput === false ? void 0 : await readHookClaudeSessionId()
|
|
25015
25423
|
);
|
|
25016
25424
|
await deliverSetStatus(
|
|
25017
25425
|
sessionId2,
|
|
25018
25426
|
status2,
|
|
25019
25427
|
payload,
|
|
25020
|
-
|
|
25428
|
+
opts2.ack ? RELIABLE_ATTEMPTS : 1
|
|
25021
25429
|
);
|
|
25022
25430
|
}
|
|
25023
25431
|
function buildPayload(sessionId2, status2, source, claudeSessionId) {
|
|
@@ -25041,12 +25449,12 @@ function logHookFired(status2, sessionId2, source) {
|
|
|
25041
25449
|
import { existsSync as existsSync53, unwatchFile, watchFile } from "fs";
|
|
25042
25450
|
|
|
25043
25451
|
// src/commands/backlog/readSignal.ts
|
|
25044
|
-
import { existsSync as existsSync52, readFileSync as
|
|
25452
|
+
import { existsSync as existsSync52, readFileSync as readFileSync36 } from "fs";
|
|
25045
25453
|
function readSignal() {
|
|
25046
25454
|
const path128 = getSignalPath();
|
|
25047
25455
|
if (!path128 || !existsSync52(path128)) return void 0;
|
|
25048
25456
|
try {
|
|
25049
|
-
return JSON.parse(
|
|
25457
|
+
return JSON.parse(readFileSync36(path128, "utf8"));
|
|
25050
25458
|
} catch {
|
|
25051
25459
|
return void 0;
|
|
25052
25460
|
}
|
|
@@ -25233,13 +25641,13 @@ async function persistPhaseSessionId(itemId2, phaseIdx, claudeSessionId) {
|
|
|
25233
25641
|
}
|
|
25234
25642
|
|
|
25235
25643
|
// src/shared/emitActivity.ts
|
|
25236
|
-
import { mkdirSync as mkdirSync18, readFileSync as
|
|
25644
|
+
import { mkdirSync as mkdirSync18, readFileSync as readFileSync37, rmSync as rmSync4, writeFileSync as writeFileSync27 } from "fs";
|
|
25237
25645
|
import { homedir as homedir18 } from "os";
|
|
25238
25646
|
import { dirname as dirname31, join as join63 } from "path";
|
|
25239
25647
|
import { z as z19 } from "zod";
|
|
25240
25648
|
var activitySchema = z19.object({
|
|
25241
25649
|
kind: z19.enum(["command", "backlog"]),
|
|
25242
|
-
harness: z19.enum(
|
|
25650
|
+
harness: z19.enum(harnessKinds).optional(),
|
|
25243
25651
|
name: z19.string().optional(),
|
|
25244
25652
|
itemId: z19.number().optional(),
|
|
25245
25653
|
itemName: z19.string().optional(),
|
|
@@ -25264,7 +25672,7 @@ function emitActivity(activity2) {
|
|
|
25264
25672
|
}
|
|
25265
25673
|
function readActivity(path128) {
|
|
25266
25674
|
try {
|
|
25267
|
-
return JSON.parse(
|
|
25675
|
+
return JSON.parse(readFileSync37(path128, "utf8"));
|
|
25268
25676
|
} catch {
|
|
25269
25677
|
return void 0;
|
|
25270
25678
|
}
|
|
@@ -25618,7 +26026,7 @@ async function next(options2, startId) {
|
|
|
25618
26026
|
// src/commands/backlog/registerNextCommand.ts
|
|
25619
26027
|
function registerNextCommand(cmd) {
|
|
25620
26028
|
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(
|
|
25621
|
-
(id,
|
|
26029
|
+
(id, opts2) => next({ allowEdits: opts2.write !== false, once: opts2.once }, id)
|
|
25622
26030
|
);
|
|
25623
26031
|
}
|
|
25624
26032
|
|
|
@@ -25929,9 +26337,9 @@ function registerRefineCommand(cmd) {
|
|
|
25929
26337
|
"--harness <kind>",
|
|
25930
26338
|
"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"
|
|
25931
26339
|
).action(
|
|
25932
|
-
(id,
|
|
25933
|
-
once:
|
|
25934
|
-
harness: resolveHarness2(
|
|
26340
|
+
(id, opts2) => refine(id, {
|
|
26341
|
+
once: opts2.once,
|
|
26342
|
+
harness: resolveHarness2(opts2.harness)
|
|
25935
26343
|
})
|
|
25936
26344
|
);
|
|
25937
26345
|
}
|
|
@@ -25972,12 +26380,12 @@ function registerRefreshDocsCommand(cmd) {
|
|
|
25972
26380
|
|
|
25973
26381
|
// src/commands/backlog/rewindPhase.ts
|
|
25974
26382
|
import chalk93 from "chalk";
|
|
25975
|
-
async function rewindPhase(id, phase,
|
|
26383
|
+
async function rewindPhase(id, phase, opts2) {
|
|
25976
26384
|
const phaseNumber = Number.parseInt(phase, 10);
|
|
25977
26385
|
const found = await findOneItem(id);
|
|
25978
26386
|
if (!found) return;
|
|
25979
26387
|
const { orm, item } = found;
|
|
25980
|
-
const result = await rewindItemToPhase(orm, item, phaseNumber,
|
|
26388
|
+
const result = await rewindItemToPhase(orm, item, phaseNumber, opts2.reason);
|
|
25981
26389
|
if (!result.ok) {
|
|
25982
26390
|
console.log(chalk93.red(result.error));
|
|
25983
26391
|
process.exitCode = 1;
|
|
@@ -26015,14 +26423,14 @@ function registerRunCommand(cmd) {
|
|
|
26015
26423
|
"--resume-session <id>",
|
|
26016
26424
|
"Resume an interrupted Claude session for the current phase (used by the sessions daemon on restart)"
|
|
26017
26425
|
).action(
|
|
26018
|
-
async (id,
|
|
26019
|
-
if (!
|
|
26020
|
-
const harness = resolveHarness2(
|
|
26426
|
+
async (id, opts2) => {
|
|
26427
|
+
if (!opts2.resumeSession) await pullIfConfigured();
|
|
26428
|
+
const harness = resolveHarness2(opts2.harness, "run");
|
|
26021
26429
|
await run3(id, {
|
|
26022
|
-
allowEdits:
|
|
26430
|
+
allowEdits: opts2.write !== false,
|
|
26023
26431
|
harness,
|
|
26024
|
-
model: resolveModel(
|
|
26025
|
-
resumeSessionId:
|
|
26432
|
+
model: resolveModel(opts2.model, "run", harness),
|
|
26433
|
+
resumeSessionId: opts2.resumeSession
|
|
26026
26434
|
});
|
|
26027
26435
|
}
|
|
26028
26436
|
);
|
|
@@ -26031,15 +26439,15 @@ function registerRunCommand(cmd) {
|
|
|
26031
26439
|
|
|
26032
26440
|
// src/commands/backlog/search.ts
|
|
26033
26441
|
import chalk94 from "chalk";
|
|
26034
|
-
async function search(
|
|
26035
|
-
const items3 = await searchBacklog(
|
|
26442
|
+
async function search(query2) {
|
|
26443
|
+
const items3 = await searchBacklog(query2);
|
|
26036
26444
|
if (items3.length === 0) {
|
|
26037
|
-
console.log(chalk94.dim(`No items matching "${
|
|
26445
|
+
console.log(chalk94.dim(`No items matching "${query2}".`));
|
|
26038
26446
|
return;
|
|
26039
26447
|
}
|
|
26040
26448
|
console.log(
|
|
26041
26449
|
chalk94.dim(
|
|
26042
|
-
`${items3.length} item${items3.length === 1 ? "" : "s"} matching "${
|
|
26450
|
+
`${items3.length} item${items3.length === 1 ? "" : "s"} matching "${query2}":
|
|
26043
26451
|
`
|
|
26044
26452
|
)
|
|
26045
26453
|
);
|
|
@@ -27645,7 +28053,7 @@ function stripEnvPrefix(parts2) {
|
|
|
27645
28053
|
}
|
|
27646
28054
|
|
|
27647
28055
|
// src/commands/cliHook/isGhGraphqlIssueMutation.ts
|
|
27648
|
-
import { readFileSync as
|
|
28056
|
+
import { readFileSync as readFileSync38 } from "fs";
|
|
27649
28057
|
var ISSUE_MUTATION = /\bmutation\b[\s\S]*(?:issue|comment|review|label|assign|reaction|milestone)/i;
|
|
27650
28058
|
var FILE_REFERENCE = /(?:=@|--input[\s=]+)["']?([^\s"';&|)]+)/g;
|
|
27651
28059
|
function isGhGraphqlIssueMutation(command) {
|
|
@@ -27657,7 +28065,7 @@ function isGhGraphqlIssueMutation(command) {
|
|
|
27657
28065
|
}
|
|
27658
28066
|
function readOrEmpty(path128) {
|
|
27659
28067
|
try {
|
|
27660
|
-
return
|
|
28068
|
+
return readFileSync38(path128, "utf8");
|
|
27661
28069
|
} catch {
|
|
27662
28070
|
return "";
|
|
27663
28071
|
}
|
|
@@ -28012,7 +28420,7 @@ function extractGraphqlQuery(args) {
|
|
|
28012
28420
|
}
|
|
28013
28421
|
|
|
28014
28422
|
// src/shared/loadCliReads.ts
|
|
28015
|
-
import { existsSync as existsSync55, readFileSync as
|
|
28423
|
+
import { existsSync as existsSync55, readFileSync as readFileSync39, writeFileSync as writeFileSync28 } from "fs";
|
|
28016
28424
|
import { dirname as dirname32, resolve as resolve18 } from "path";
|
|
28017
28425
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
28018
28426
|
var __filename3 = fileURLToPath6(import.meta.url);
|
|
@@ -28022,7 +28430,7 @@ function packageRoot() {
|
|
|
28022
28430
|
}
|
|
28023
28431
|
function readLines(path128) {
|
|
28024
28432
|
if (!existsSync55(path128)) return [];
|
|
28025
|
-
return
|
|
28433
|
+
return readFileSync39(path128, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
28026
28434
|
}
|
|
28027
28435
|
var cachedReads;
|
|
28028
28436
|
var cachedWrites;
|
|
@@ -28068,7 +28476,7 @@ function findCliWrite(command) {
|
|
|
28068
28476
|
}
|
|
28069
28477
|
|
|
28070
28478
|
// src/shared/readSettingsPerms.ts
|
|
28071
|
-
import { existsSync as existsSync56, readFileSync as
|
|
28479
|
+
import { existsSync as existsSync56, readFileSync as readFileSync40 } from "fs";
|
|
28072
28480
|
import { homedir as homedir19 } from "os";
|
|
28073
28481
|
import { join as join64 } from "path";
|
|
28074
28482
|
function readSettingsPerms(key) {
|
|
@@ -28089,7 +28497,7 @@ function readSettingsPerms(key) {
|
|
|
28089
28497
|
function readPermissionArray(filePath, key) {
|
|
28090
28498
|
if (!existsSync56(filePath)) return [];
|
|
28091
28499
|
try {
|
|
28092
|
-
const data = JSON.parse(
|
|
28500
|
+
const data = JSON.parse(readFileSync40(filePath, "utf8"));
|
|
28093
28501
|
const arr = data?.permissions?.[key];
|
|
28094
28502
|
return Array.isArray(arr) ? arr.filter((e) => typeof e === "string") : [];
|
|
28095
28503
|
} catch {
|
|
@@ -28359,14 +28767,14 @@ function findDocsPathDeny(toolName, rawCommand, root2) {
|
|
|
28359
28767
|
}
|
|
28360
28768
|
|
|
28361
28769
|
// src/commands/schema/isSchemaPath.ts
|
|
28362
|
-
import { readFileSync as
|
|
28770
|
+
import { readFileSync as readFileSync41 } from "fs";
|
|
28363
28771
|
import { relative as relative8, resolve as resolve21 } from "path";
|
|
28364
28772
|
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.";
|
|
28365
28773
|
var FIXED_SCHEMA_PATH = /^src\/shared\/db\/(?:migrations\/migration\d{4}[^/]*\.ts|migrations\.ts|schema\.ts)$/;
|
|
28366
28774
|
var DB_MODULE = /^src\/shared\/db\/[^/]+\.ts$/;
|
|
28367
28775
|
function readOrEmpty2(path128) {
|
|
28368
28776
|
try {
|
|
28369
|
-
return
|
|
28777
|
+
return readFileSync41(path128, "utf8");
|
|
28370
28778
|
} catch {
|
|
28371
28779
|
return "";
|
|
28372
28780
|
}
|
|
@@ -28441,7 +28849,7 @@ async function decideDocsGuard({
|
|
|
28441
28849
|
}
|
|
28442
28850
|
|
|
28443
28851
|
// src/commands/schema/isSchemaLocked.ts
|
|
28444
|
-
import { existsSync as existsSync57, readFileSync as
|
|
28852
|
+
import { existsSync as existsSync57, readFileSync as readFileSync42 } from "fs";
|
|
28445
28853
|
|
|
28446
28854
|
// src/commands/schema/getSchemaSessionApprovalPath.ts
|
|
28447
28855
|
import { join as join66 } from "path";
|
|
@@ -28473,7 +28881,7 @@ function getSchemaSessionApprovalPath(scope) {
|
|
|
28473
28881
|
function approvalMatches(path128, identity) {
|
|
28474
28882
|
try {
|
|
28475
28883
|
const approval = JSON.parse(
|
|
28476
|
-
|
|
28884
|
+
readFileSync42(path128, "utf8")
|
|
28477
28885
|
);
|
|
28478
28886
|
const conversation = approval.conversationId ?? approval.claudeSessionId;
|
|
28479
28887
|
if (approval.harness !== void 0 && approval.harness !== identity.harness)
|
|
@@ -28688,7 +29096,7 @@ ${reasons.join("\n")}`);
|
|
|
28688
29096
|
}
|
|
28689
29097
|
|
|
28690
29098
|
// src/commands/permitCliReads.ts
|
|
28691
|
-
import { existsSync as existsSync58, mkdirSync as mkdirSync20, readFileSync as
|
|
29099
|
+
import { existsSync as existsSync58, mkdirSync as mkdirSync20, readFileSync as readFileSync43, writeFileSync as writeFileSync29 } from "fs";
|
|
28692
29100
|
import { homedir as homedir22 } from "os";
|
|
28693
29101
|
import { join as join68 } from "path";
|
|
28694
29102
|
|
|
@@ -28958,7 +29366,7 @@ function logPath(cli) {
|
|
|
28958
29366
|
function readCache(cli) {
|
|
28959
29367
|
const path128 = logPath(cli);
|
|
28960
29368
|
if (!existsSync58(path128)) return void 0;
|
|
28961
|
-
return
|
|
29369
|
+
return readFileSync43(path128, "utf8");
|
|
28962
29370
|
}
|
|
28963
29371
|
function writeCache(cli, output) {
|
|
28964
29372
|
const dir = join68(homedir22(), ".assist");
|
|
@@ -29093,7 +29501,7 @@ function registerCliHook(program) {
|
|
|
29093
29501
|
}
|
|
29094
29502
|
|
|
29095
29503
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
29096
|
-
import { existsSync as existsSync60, readFileSync as
|
|
29504
|
+
import { existsSync as existsSync60, readFileSync as readFileSync45, unlinkSync as unlinkSync9, writeFileSync as writeFileSync30 } from "fs";
|
|
29097
29505
|
import chalk125 from "chalk";
|
|
29098
29506
|
|
|
29099
29507
|
// src/shared/isHashCommentFile.ts
|
|
@@ -29148,12 +29556,12 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
29148
29556
|
}
|
|
29149
29557
|
|
|
29150
29558
|
// src/commands/codeComment/readPinState.ts
|
|
29151
|
-
import { existsSync as existsSync59, readFileSync as
|
|
29559
|
+
import { existsSync as existsSync59, readFileSync as readFileSync44 } from "fs";
|
|
29152
29560
|
function readPinState(pin2) {
|
|
29153
29561
|
const path128 = getPinStatePath(pin2);
|
|
29154
29562
|
if (!existsSync59(path128)) return void 0;
|
|
29155
29563
|
try {
|
|
29156
|
-
const state = JSON.parse(
|
|
29564
|
+
const state = JSON.parse(readFileSync44(path128, "utf8"));
|
|
29157
29565
|
if (state.pin !== pin2) return void 0;
|
|
29158
29566
|
return state;
|
|
29159
29567
|
} catch {
|
|
@@ -29175,7 +29583,7 @@ function codeCommentConfirm(pin2) {
|
|
|
29175
29583
|
process.exitCode = 1;
|
|
29176
29584
|
return;
|
|
29177
29585
|
}
|
|
29178
|
-
const original =
|
|
29586
|
+
const original = readFileSync45(state.file, "utf8");
|
|
29179
29587
|
const lines = original.split("\n");
|
|
29180
29588
|
const index3 = state.line - 1;
|
|
29181
29589
|
if (index3 > lines.length) {
|
|
@@ -29239,7 +29647,7 @@ import { randomUUID as randomUUID14 } from "crypto";
|
|
|
29239
29647
|
import notifier from "node-notifier";
|
|
29240
29648
|
|
|
29241
29649
|
// src/commands/notify/showNotification/showWindowsNotificationFromWsl.ts
|
|
29242
|
-
import { spawn as
|
|
29650
|
+
import { spawn as spawn9 } from "child_process";
|
|
29243
29651
|
import fs26 from "fs";
|
|
29244
29652
|
import { createRequire as createRequire3 } from "module";
|
|
29245
29653
|
import path40 from "path";
|
|
@@ -29259,7 +29667,7 @@ function showWindowsNotificationFromWsl(options2) {
|
|
|
29259
29667
|
if (sound) {
|
|
29260
29668
|
args.push("-s", "ms-winsoundevent:Notification.Default");
|
|
29261
29669
|
}
|
|
29262
|
-
const child2 =
|
|
29670
|
+
const child2 = spawn9(snoreToastPath, args, {
|
|
29263
29671
|
detached: true,
|
|
29264
29672
|
stdio: "ignore"
|
|
29265
29673
|
});
|
|
@@ -29559,7 +29967,7 @@ async function listCodexHooks(server, cwd) {
|
|
|
29559
29967
|
}
|
|
29560
29968
|
|
|
29561
29969
|
// src/commands/sync/openCodexAppServer.ts
|
|
29562
|
-
import { spawn as
|
|
29970
|
+
import { spawn as spawn10 } from "child_process";
|
|
29563
29971
|
import { createInterface as createInterface6 } from "readline";
|
|
29564
29972
|
|
|
29565
29973
|
// src/commands/sync/createCodexRpcClient.ts
|
|
@@ -29632,7 +30040,7 @@ function watchCodexAppServer(child2, fail14) {
|
|
|
29632
30040
|
// src/commands/sync/openCodexAppServer.ts
|
|
29633
30041
|
var TIMEOUT_MS3 = 2e4;
|
|
29634
30042
|
async function openCodexAppServer(homeDir) {
|
|
29635
|
-
const child2 =
|
|
30043
|
+
const child2 = spawn10(harnesses.codex.command, ["app-server"], {
|
|
29636
30044
|
env: { ...process.env, CODEX_HOME: homeDir },
|
|
29637
30045
|
stdio: ["pipe", "pipe", "pipe"]
|
|
29638
30046
|
});
|
|
@@ -31574,8 +31982,8 @@ function registerConfig(program) {
|
|
|
31574
31982
|
import chalk153 from "chalk";
|
|
31575
31983
|
|
|
31576
31984
|
// src/commands/browser/formatInspectMatches.ts
|
|
31577
|
-
function formatInspectMatches({ matches, total: total2 },
|
|
31578
|
-
if (total2 === 0) return [`no elements match ${
|
|
31985
|
+
function formatInspectMatches({ matches, total: total2 }, query2) {
|
|
31986
|
+
if (total2 === 0) return [`no elements match ${query2}`];
|
|
31579
31987
|
const lines = matches.flatMap((match, index3) => [
|
|
31580
31988
|
`[${index3 + 1}/${total2}] ${match.width}\xD7${match.height} ${JSON.stringify(match.text)}`,
|
|
31581
31989
|
...match.chain.map((step3) => ` ${step3}`)
|
|
@@ -31644,18 +32052,18 @@ async function browserInspect(selector, options2) {
|
|
|
31644
32052
|
);
|
|
31645
32053
|
process.exit(1);
|
|
31646
32054
|
}
|
|
31647
|
-
const
|
|
32055
|
+
const query2 = options2.text ? { text: options2.text } : { selector };
|
|
31648
32056
|
const result = await requestTab(options2.server, {
|
|
31649
32057
|
op: "inspect",
|
|
31650
32058
|
url: options2.url,
|
|
31651
|
-
...
|
|
32059
|
+
...query2
|
|
31652
32060
|
});
|
|
31653
32061
|
const label = options2.text ? `text ${JSON.stringify(options2.text)}` : `selector ${selector}`;
|
|
31654
32062
|
for (const line of formatInspectMatches(result, label)) console.log(line);
|
|
31655
32063
|
}
|
|
31656
32064
|
|
|
31657
32065
|
// src/commands/browser/browserRun.ts
|
|
31658
|
-
import { readFileSync as
|
|
32066
|
+
import { readFileSync as readFileSync47 } from "fs";
|
|
31659
32067
|
import chalk154 from "chalk";
|
|
31660
32068
|
|
|
31661
32069
|
// src/commands/browser/formatRunOutcome.ts
|
|
@@ -31675,7 +32083,7 @@ function formatRunOutcome(run5) {
|
|
|
31675
32083
|
async function browserRun(options2) {
|
|
31676
32084
|
let code;
|
|
31677
32085
|
try {
|
|
31678
|
-
code =
|
|
32086
|
+
code = readFileSync47(options2.file, "utf8");
|
|
31679
32087
|
} catch (error) {
|
|
31680
32088
|
console.error(
|
|
31681
32089
|
chalk154.red(
|
|
@@ -32226,7 +32634,7 @@ function registerDb(program) {
|
|
|
32226
32634
|
}
|
|
32227
32635
|
|
|
32228
32636
|
// src/commands/deploy/redirect.ts
|
|
32229
|
-
import { existsSync as existsSync64, readFileSync as
|
|
32637
|
+
import { existsSync as existsSync64, readFileSync as readFileSync48, writeFileSync as writeFileSync33 } from "fs";
|
|
32230
32638
|
import chalk162 from "chalk";
|
|
32231
32639
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
32232
32640
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -32239,7 +32647,7 @@ function redirect() {
|
|
|
32239
32647
|
console.log(chalk162.yellow("No index.html found"));
|
|
32240
32648
|
return;
|
|
32241
32649
|
}
|
|
32242
|
-
const content =
|
|
32650
|
+
const content = readFileSync48(indexPath, "utf8");
|
|
32243
32651
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
32244
32652
|
console.log(chalk162.dim("Trailing slash script already present"));
|
|
32245
32653
|
return;
|
|
@@ -32330,7 +32738,7 @@ function printWeekHeader(week, state) {
|
|
|
32330
32738
|
}
|
|
32331
32739
|
|
|
32332
32740
|
// src/commands/devlog/loadDevEntry.ts
|
|
32333
|
-
import { readFileSync as
|
|
32741
|
+
import { readFileSync as readFileSync49 } from "fs";
|
|
32334
32742
|
import { parse as parseYaml3 } from "yaml";
|
|
32335
32743
|
|
|
32336
32744
|
// src/commands/devlog/devEntryPath.ts
|
|
@@ -32345,7 +32753,7 @@ function asString(value) {
|
|
|
32345
32753
|
}
|
|
32346
32754
|
function readFrontmatter(path128) {
|
|
32347
32755
|
try {
|
|
32348
|
-
const match =
|
|
32756
|
+
const match = readFileSync49(path128, "utf8").match(/^---\n([\s\S]*?)\n---/);
|
|
32349
32757
|
return match ? parseYaml3(match[1]) ?? {} : null;
|
|
32350
32758
|
} catch {
|
|
32351
32759
|
return null;
|
|
@@ -32383,7 +32791,7 @@ function resolveDevDir() {
|
|
|
32383
32791
|
}
|
|
32384
32792
|
|
|
32385
32793
|
// src/commands/devlog/next/fetchCommitsAfter.ts
|
|
32386
|
-
import { execFileSync as
|
|
32794
|
+
import { execFileSync as execFileSync9 } from "child_process";
|
|
32387
32795
|
var RECORD_SEPARATOR = "";
|
|
32388
32796
|
function parseRecord(record3) {
|
|
32389
32797
|
const [header, ...fileLines] = record3.trim().split("\n");
|
|
@@ -32413,7 +32821,7 @@ function parseNameOnlyLog(output, ignore3, afterDate) {
|
|
|
32413
32821
|
}
|
|
32414
32822
|
function fetchCommitsAfter(ignore3, afterDate) {
|
|
32415
32823
|
const range = afterDate ? [`--since=${afterDate}T00:00:00`] : [];
|
|
32416
|
-
const output =
|
|
32824
|
+
const output = execFileSync9(
|
|
32417
32825
|
"git",
|
|
32418
32826
|
[
|
|
32419
32827
|
"log",
|
|
@@ -32448,7 +32856,7 @@ function findTargetWeek(weeks, { lastWeek, skip: skip3, today }) {
|
|
|
32448
32856
|
import chalk165 from "chalk";
|
|
32449
32857
|
|
|
32450
32858
|
// src/shared/getRepoName.ts
|
|
32451
|
-
import { existsSync as existsSync65, readFileSync as
|
|
32859
|
+
import { existsSync as existsSync65, readFileSync as readFileSync50 } from "fs";
|
|
32452
32860
|
import { basename as basename19, join as join80 } from "path";
|
|
32453
32861
|
function getRepoName() {
|
|
32454
32862
|
const config = loadConfig();
|
|
@@ -32458,7 +32866,7 @@ function getRepoName() {
|
|
|
32458
32866
|
const packageJsonPath = join80(process.cwd(), "package.json");
|
|
32459
32867
|
if (existsSync65(packageJsonPath)) {
|
|
32460
32868
|
try {
|
|
32461
|
-
const content =
|
|
32869
|
+
const content = readFileSync50(packageJsonPath, "utf8");
|
|
32462
32870
|
const pkg = JSON.parse(content);
|
|
32463
32871
|
if (pkg.name) {
|
|
32464
32872
|
return pkg.name;
|
|
@@ -32555,7 +32963,7 @@ function loadDevWeeks(repoName, devDir) {
|
|
|
32555
32963
|
import chalk168 from "chalk";
|
|
32556
32964
|
|
|
32557
32965
|
// src/commands/devlog/resolveVersionSource.ts
|
|
32558
|
-
import { execFileSync as
|
|
32966
|
+
import { execFileSync as execFileSync10 } from "child_process";
|
|
32559
32967
|
|
|
32560
32968
|
// src/commands/devlog/sortedSemverVersions.ts
|
|
32561
32969
|
import semver2 from "semver";
|
|
@@ -32608,7 +33016,7 @@ function stripToMinor(version2) {
|
|
|
32608
33016
|
|
|
32609
33017
|
// src/commands/devlog/resolveVersionSource.ts
|
|
32610
33018
|
function gitTags(...args) {
|
|
32611
|
-
return
|
|
33019
|
+
return execFileSync10("git", ["tag", "--list", ...args], { encoding: "utf8" }).split("\n").map((t) => t.trim()).filter(Boolean);
|
|
32612
33020
|
}
|
|
32613
33021
|
function resolveVersionSource() {
|
|
32614
33022
|
const headVersion = getVersionAtCommit("HEAD");
|
|
@@ -32628,9 +33036,9 @@ function resolveVersionSource() {
|
|
|
32628
33036
|
}
|
|
32629
33037
|
|
|
32630
33038
|
// src/commands/devlog/next/repoHasTags.ts
|
|
32631
|
-
import { execFileSync as
|
|
33039
|
+
import { execFileSync as execFileSync11 } from "child_process";
|
|
32632
33040
|
function repoHasTags() {
|
|
32633
|
-
const output =
|
|
33041
|
+
const output = execFileSync11("git", ["tag", "--list"], { encoding: "utf8" });
|
|
32634
33042
|
return output.trim().length > 0;
|
|
32635
33043
|
}
|
|
32636
33044
|
|
|
@@ -32729,7 +33137,7 @@ function next2(options2) {
|
|
|
32729
33137
|
}
|
|
32730
33138
|
|
|
32731
33139
|
// src/commands/devlog/posted/posted.ts
|
|
32732
|
-
import { readFileSync as
|
|
33140
|
+
import { readFileSync as readFileSync51, writeFileSync as writeFileSync34 } from "fs";
|
|
32733
33141
|
import chalk169 from "chalk";
|
|
32734
33142
|
|
|
32735
33143
|
// src/commands/devlog/posted/setFrontmatterSlack.ts
|
|
@@ -32751,7 +33159,7 @@ function fail7(message4) {
|
|
|
32751
33159
|
}
|
|
32752
33160
|
function readEntry(path128) {
|
|
32753
33161
|
try {
|
|
32754
|
-
return
|
|
33162
|
+
return readFileSync51(path128, "utf8");
|
|
32755
33163
|
} catch {
|
|
32756
33164
|
fail7(`No dev entry at ${path128}`);
|
|
32757
33165
|
}
|
|
@@ -32823,12 +33231,12 @@ import { mkdirSync as mkdirSync24, writeFileSync as writeFileSync36 } from "fs";
|
|
|
32823
33231
|
import { mkdirSync as mkdirSync23, writeFileSync as writeFileSync35 } from "fs";
|
|
32824
33232
|
|
|
32825
33233
|
// src/commands/slack/readSlackParts.ts
|
|
32826
|
-
import { readFileSync as
|
|
33234
|
+
import { readFileSync as readFileSync52 } from "fs";
|
|
32827
33235
|
function readSlackParts(files) {
|
|
32828
33236
|
return files.map((file) => {
|
|
32829
33237
|
let contents;
|
|
32830
33238
|
try {
|
|
32831
|
-
contents =
|
|
33239
|
+
contents = readFileSync52(file, "utf8");
|
|
32832
33240
|
} catch {
|
|
32833
33241
|
console.error(`Error: Part file not found: ${file}`);
|
|
32834
33242
|
process.exit(1);
|
|
@@ -32959,13 +33367,13 @@ function devlogSlackChannel() {
|
|
|
32959
33367
|
}
|
|
32960
33368
|
|
|
32961
33369
|
// src/commands/devlog/slack/readDevEntryFile.ts
|
|
32962
|
-
import { readFileSync as
|
|
33370
|
+
import { readFileSync as readFileSync53 } from "fs";
|
|
32963
33371
|
import { parse as parseYaml4 } from "yaml";
|
|
32964
33372
|
var FRONTMATTER2 = /^---\n([\s\S]*?)\n---\n?([\s\S]*)$/;
|
|
32965
33373
|
function readDevEntryFile(path128) {
|
|
32966
33374
|
let contents;
|
|
32967
33375
|
try {
|
|
32968
|
-
contents =
|
|
33376
|
+
contents = readFileSync53(path128, "utf8");
|
|
32969
33377
|
} catch {
|
|
32970
33378
|
return null;
|
|
32971
33379
|
}
|
|
@@ -33419,7 +33827,7 @@ function getDocsUnlockPinPath(pin2) {
|
|
|
33419
33827
|
}
|
|
33420
33828
|
|
|
33421
33829
|
// src/commands/docs/readDocsUnlockPinState.ts
|
|
33422
|
-
import { existsSync as existsSync66, readFileSync as
|
|
33830
|
+
import { existsSync as existsSync66, readFileSync as readFileSync54 } from "fs";
|
|
33423
33831
|
function isPositiveInteger(value) {
|
|
33424
33832
|
return Number.isInteger(value) && value > 0;
|
|
33425
33833
|
}
|
|
@@ -33427,7 +33835,7 @@ function readDocsUnlockPinState(pin2) {
|
|
|
33427
33835
|
const path128 = getDocsUnlockPinPath(pin2);
|
|
33428
33836
|
if (!existsSync66(path128)) return void 0;
|
|
33429
33837
|
try {
|
|
33430
|
-
const state = JSON.parse(
|
|
33838
|
+
const state = JSON.parse(readFileSync54(path128, "utf8"));
|
|
33431
33839
|
if (state.pin !== pin2) return void 0;
|
|
33432
33840
|
if (!isPositiveInteger(state.itemId)) return void 0;
|
|
33433
33841
|
if (!isPositiveInteger(state.phase)) return void 0;
|
|
@@ -33609,7 +34017,7 @@ function getSchemaUnlockPinPath(pin2) {
|
|
|
33609
34017
|
}
|
|
33610
34018
|
|
|
33611
34019
|
// src/commands/schema/readSchemaUnlockPinState.ts
|
|
33612
|
-
import { existsSync as existsSync67, readFileSync as
|
|
34020
|
+
import { existsSync as existsSync67, readFileSync as readFileSync55 } from "fs";
|
|
33613
34021
|
function isPositiveInteger2(value) {
|
|
33614
34022
|
return Number.isInteger(value) && value > 0;
|
|
33615
34023
|
}
|
|
@@ -33636,7 +34044,7 @@ function readSchemaUnlockPinState(pin2) {
|
|
|
33636
34044
|
const path128 = getSchemaUnlockPinPath(pin2);
|
|
33637
34045
|
if (!existsSync67(path128)) return void 0;
|
|
33638
34046
|
try {
|
|
33639
|
-
const raw = JSON.parse(
|
|
34047
|
+
const raw = JSON.parse(readFileSync55(path128, "utf8"));
|
|
33640
34048
|
if (raw.pin !== pin2) return void 0;
|
|
33641
34049
|
return toState(raw);
|
|
33642
34050
|
} catch {
|
|
@@ -33823,11 +34231,11 @@ async function checkBuildLocksCommand() {
|
|
|
33823
34231
|
}
|
|
33824
34232
|
|
|
33825
34233
|
// src/commands/dotnet/buildTree.ts
|
|
33826
|
-
import { readFileSync as
|
|
34234
|
+
import { readFileSync as readFileSync56 } from "fs";
|
|
33827
34235
|
import path48 from "path";
|
|
33828
34236
|
var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
|
|
33829
34237
|
function getProjectRefs(csprojPath) {
|
|
33830
|
-
const content =
|
|
34238
|
+
const content = readFileSync56(csprojPath, "utf8");
|
|
33831
34239
|
const refs = [];
|
|
33832
34240
|
for (const match of content.matchAll(PROJECT_REF_RE)) {
|
|
33833
34241
|
refs.push(match[1].replace(/\\/g, "/"));
|
|
@@ -33844,7 +34252,7 @@ function buildTree(csprojPath, repoRoot3, visited = /* @__PURE__ */ new Set()) {
|
|
|
33844
34252
|
for (const ref of getProjectRefs(abs)) {
|
|
33845
34253
|
const childAbs = path48.resolve(dir, ref);
|
|
33846
34254
|
try {
|
|
33847
|
-
|
|
34255
|
+
readFileSync56(childAbs);
|
|
33848
34256
|
node.children.push(buildTree(childAbs, repoRoot3, visited));
|
|
33849
34257
|
} catch {
|
|
33850
34258
|
node.children.push({
|
|
@@ -33869,7 +34277,7 @@ function collectAllDeps(node) {
|
|
|
33869
34277
|
}
|
|
33870
34278
|
|
|
33871
34279
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
33872
|
-
import { readdirSync as readdirSync15, readFileSync as
|
|
34280
|
+
import { readdirSync as readdirSync15, readFileSync as readFileSync57, statSync as statSync12 } from "fs";
|
|
33873
34281
|
import path49 from "path";
|
|
33874
34282
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
33875
34283
|
if (depth > maxDepth) return [];
|
|
@@ -33904,7 +34312,7 @@ function findContainingSolutions(csprojPath, repoRoot3) {
|
|
|
33904
34312
|
const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
|
|
33905
34313
|
for (const sln of slnFiles) {
|
|
33906
34314
|
try {
|
|
33907
|
-
const content =
|
|
34315
|
+
const content = readFileSync57(sln, "utf8");
|
|
33908
34316
|
if (pattern2.test(content)) {
|
|
33909
34317
|
matches.push(path49.relative(repoRoot3, sln));
|
|
33910
34318
|
}
|
|
@@ -34222,7 +34630,7 @@ function parseInspectReport(json) {
|
|
|
34222
34630
|
|
|
34223
34631
|
// src/commands/dotnet/runInspectCode.ts
|
|
34224
34632
|
import { execSync as execSync40 } from "child_process";
|
|
34225
|
-
import { existsSync as existsSync70, readFileSync as
|
|
34633
|
+
import { existsSync as existsSync70, readFileSync as readFileSync58, unlinkSync as unlinkSync13 } from "fs";
|
|
34226
34634
|
import { tmpdir as tmpdir5 } from "os";
|
|
34227
34635
|
import path52 from "path";
|
|
34228
34636
|
import chalk189 from "chalk";
|
|
@@ -34257,7 +34665,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
34257
34665
|
console.error(chalk189.red("Report file not generated"));
|
|
34258
34666
|
process.exit(1);
|
|
34259
34667
|
}
|
|
34260
|
-
const xml =
|
|
34668
|
+
const xml = readFileSync58(reportPath, "utf8");
|
|
34261
34669
|
unlinkSync13(reportPath);
|
|
34262
34670
|
return xml;
|
|
34263
34671
|
}
|
|
@@ -35907,7 +36315,7 @@ Anything nested below the leaf level fails the run before a single write, naming
|
|
|
35907
36315
|
}
|
|
35908
36316
|
|
|
35909
36317
|
// src/commands/github/issue/commentIssue.ts
|
|
35910
|
-
import { execFileSync as
|
|
36318
|
+
import { execFileSync as execFileSync12 } from "child_process";
|
|
35911
36319
|
|
|
35912
36320
|
// src/shared/validateProposedContent.ts
|
|
35913
36321
|
var URL_PATTERN3 = /https?:\/\/[^\s<>()[\]"'`]+/gi;
|
|
@@ -35974,7 +36382,7 @@ async function commentIssue(numberArg, options2) {
|
|
|
35974
36382
|
const args = ["issue", "comment", String(number), "--body", body];
|
|
35975
36383
|
if (options2.repo) args.push("--repo", options2.repo);
|
|
35976
36384
|
try {
|
|
35977
|
-
|
|
36385
|
+
execFileSync12("gh", args, { stdio: "inherit" });
|
|
35978
36386
|
} catch {
|
|
35979
36387
|
process.exit(1);
|
|
35980
36388
|
}
|
|
@@ -36303,12 +36711,12 @@ function resolveIssueMilestone(target, wanted) {
|
|
|
36303
36711
|
import { execSync as execSync42 } from "child_process";
|
|
36304
36712
|
|
|
36305
36713
|
// src/commands/prs/currentPrSelector.ts
|
|
36306
|
-
import { execFileSync as
|
|
36714
|
+
import { execFileSync as execFileSync13 } from "child_process";
|
|
36307
36715
|
var PULL_REF = /^refs\/pull\/(\d+)\/head$/;
|
|
36308
36716
|
var HEAD_REF = /^refs\/heads\/(.+)$/;
|
|
36309
36717
|
function gitOrNull3(args) {
|
|
36310
36718
|
try {
|
|
36311
|
-
return
|
|
36719
|
+
return execFileSync13("git", args, {
|
|
36312
36720
|
encoding: "utf8",
|
|
36313
36721
|
stdio: ["pipe", "pipe", "pipe"],
|
|
36314
36722
|
windowsHide: true
|
|
@@ -36508,7 +36916,7 @@ function attachArgs(attachments) {
|
|
|
36508
36916
|
}
|
|
36509
36917
|
|
|
36510
36918
|
// src/commands/prs/runGhWithAttachments.ts
|
|
36511
|
-
import { execFileSync as
|
|
36919
|
+
import { execFileSync as execFileSync14 } from "child_process";
|
|
36512
36920
|
import { basename as basename20 } from "path";
|
|
36513
36921
|
|
|
36514
36922
|
// src/shared/removeStagedAttachments.ts
|
|
@@ -36536,7 +36944,7 @@ function reportPartialFailure(attachments, stderr) {
|
|
|
36536
36944
|
function runGhWithAttachments(args, attachments) {
|
|
36537
36945
|
const attaching = attachments.length > 0;
|
|
36538
36946
|
try {
|
|
36539
|
-
const stdout =
|
|
36947
|
+
const stdout = execFileSync14("gh", args, {
|
|
36540
36948
|
encoding: "utf8",
|
|
36541
36949
|
stdio: ["inherit", "pipe", attaching ? "pipe" : "inherit"]
|
|
36542
36950
|
});
|
|
@@ -36647,7 +37055,7 @@ The project scope is needed for --project: gh auth refresh -h github.com -s proj
|
|
|
36647
37055
|
}
|
|
36648
37056
|
|
|
36649
37057
|
// src/commands/github/issue/fetchIssue.ts
|
|
36650
|
-
import { execFileSync as
|
|
37058
|
+
import { execFileSync as execFileSync15 } from "child_process";
|
|
36651
37059
|
function fetchIssue2(number, repo) {
|
|
36652
37060
|
const args = [
|
|
36653
37061
|
"issue",
|
|
@@ -36659,7 +37067,7 @@ function fetchIssue2(number, repo) {
|
|
|
36659
37067
|
if (repo) args.push("--repo", repo);
|
|
36660
37068
|
let raw;
|
|
36661
37069
|
try {
|
|
36662
|
-
raw =
|
|
37070
|
+
raw = execFileSync15("gh", args, { encoding: "utf8" });
|
|
36663
37071
|
} catch {
|
|
36664
37072
|
console.error(`Could not fetch issue #${number} with gh issue view`);
|
|
36665
37073
|
process.exit(1);
|
|
@@ -36724,14 +37132,14 @@ function fetchIssueToWorkingFile(number, repo) {
|
|
|
36724
37132
|
}
|
|
36725
37133
|
|
|
36726
37134
|
// src/commands/github/issue/resumeIssueBody.ts
|
|
36727
|
-
import { existsSync as existsSync71, readFileSync as
|
|
37135
|
+
import { existsSync as existsSync71, readFileSync as readFileSync59 } from "fs";
|
|
36728
37136
|
function resumeIssueBody(slug2, number, updatedAt) {
|
|
36729
37137
|
const { bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
36730
37138
|
if (!existsSync71(bodyPath) || !existsSync71(metaPath)) return void 0;
|
|
36731
37139
|
try {
|
|
36732
|
-
const meta = JSON.parse(
|
|
37140
|
+
const meta = JSON.parse(readFileSync59(metaPath, "utf8"));
|
|
36733
37141
|
if (meta.updatedAt !== updatedAt) return void 0;
|
|
36734
|
-
return
|
|
37142
|
+
return readFileSync59(bodyPath, "utf8");
|
|
36735
37143
|
} catch {
|
|
36736
37144
|
return void 0;
|
|
36737
37145
|
}
|
|
@@ -36769,12 +37177,12 @@ function prepareIssueEdit(number, repo, fresh, proposed) {
|
|
|
36769
37177
|
}
|
|
36770
37178
|
|
|
36771
37179
|
// src/commands/github/issue/pushIssueBody.ts
|
|
36772
|
-
import { execFileSync as
|
|
37180
|
+
import { execFileSync as execFileSync16 } from "child_process";
|
|
36773
37181
|
function pushIssueBody(number, repo, bodyPath) {
|
|
36774
37182
|
const args = ["issue", "edit", String(number), "--body-file", bodyPath];
|
|
36775
37183
|
if (repo) args.push("--repo", repo);
|
|
36776
37184
|
try {
|
|
36777
|
-
|
|
37185
|
+
execFileSync16("gh", args, { stdio: "inherit" });
|
|
36778
37186
|
} catch {
|
|
36779
37187
|
process.exit(1);
|
|
36780
37188
|
}
|
|
@@ -36853,12 +37261,12 @@ function setIssueParent(number, repo, parentArg) {
|
|
|
36853
37261
|
}
|
|
36854
37262
|
|
|
36855
37263
|
// src/commands/github/issue/viewIssue.ts
|
|
36856
|
-
import { execFileSync as
|
|
37264
|
+
import { execFileSync as execFileSync17 } from "child_process";
|
|
36857
37265
|
function viewIssue(number, repo) {
|
|
36858
37266
|
const args = ["issue", "view", String(number)];
|
|
36859
37267
|
if (repo) args.push("--repo", repo);
|
|
36860
37268
|
try {
|
|
36861
|
-
|
|
37269
|
+
execFileSync17("gh", args, { stdio: "inherit" });
|
|
36862
37270
|
} catch {
|
|
36863
37271
|
process.exit(1);
|
|
36864
37272
|
}
|
|
@@ -36912,7 +37320,7 @@ function registerEditIssue(issueCommand) {
|
|
|
36912
37320
|
}
|
|
36913
37321
|
|
|
36914
37322
|
// src/commands/github/issue/editIssueComment.ts
|
|
36915
|
-
import { execFileSync as
|
|
37323
|
+
import { execFileSync as execFileSync18 } from "child_process";
|
|
36916
37324
|
var USAGE5 = "Usage: assist github issue edit-comment <comment-id> --body <body> [-R <owner>/<repo>]";
|
|
36917
37325
|
async function editIssueComment(commentIdArg, options2) {
|
|
36918
37326
|
const commentId = Number.parseInt(commentIdArg, 10);
|
|
@@ -36939,7 +37347,7 @@ async function editIssueComment(commentIdArg, options2) {
|
|
|
36939
37347
|
];
|
|
36940
37348
|
let raw;
|
|
36941
37349
|
try {
|
|
36942
|
-
raw =
|
|
37350
|
+
raw = execFileSync18("gh", args, {
|
|
36943
37351
|
input: JSON.stringify({ body }),
|
|
36944
37352
|
encoding: "utf8"
|
|
36945
37353
|
});
|
|
@@ -37821,11 +38229,11 @@ function registerJira(program) {
|
|
|
37821
38229
|
|
|
37822
38230
|
// src/commands/backlog/registerRefineLaunch.ts
|
|
37823
38231
|
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";
|
|
37824
|
-
function runRefine(id,
|
|
38232
|
+
function runRefine(id, opts2) {
|
|
37825
38233
|
return refine(id, {
|
|
37826
|
-
once:
|
|
37827
|
-
resumeSessionId:
|
|
37828
|
-
harness: resolveHarness2(
|
|
38234
|
+
once: opts2.once,
|
|
38235
|
+
resumeSessionId: opts2.resumeSession,
|
|
38236
|
+
harness: resolveHarness2(opts2.harness)
|
|
37829
38237
|
});
|
|
37830
38238
|
}
|
|
37831
38239
|
function registerRefineLaunch(program, resumeFlag) {
|
|
@@ -37839,7 +38247,7 @@ function registerRefineLaunch(program, resumeFlag) {
|
|
|
37839
38247
|
import chalk202 from "chalk";
|
|
37840
38248
|
|
|
37841
38249
|
// src/commands/review/checkoutPr.ts
|
|
37842
|
-
import { execFileSync as
|
|
38250
|
+
import { execFileSync as execFileSync21 } from "child_process";
|
|
37843
38251
|
|
|
37844
38252
|
// src/commands/review/clearStalePrBranch.ts
|
|
37845
38253
|
var tipSetFromRemote = /^branch: (Created from|Reset to)|^fetch\b|: Fast-forward$/;
|
|
@@ -38017,7 +38425,7 @@ var persistedSessionSchema = z23.object({
|
|
|
38017
38425
|
generatedTitle: z23.string().optional(),
|
|
38018
38426
|
subtitle: z23.string().optional(),
|
|
38019
38427
|
commandType: z23.enum(["claude", "run", "assist"]),
|
|
38020
|
-
harness: z23.enum(
|
|
38428
|
+
harness: z23.enum(harnessKinds).optional(),
|
|
38021
38429
|
status: z23.enum(["running", "waiting", "done", "error", "stopped"]).optional(),
|
|
38022
38430
|
error: z23.string().optional(),
|
|
38023
38431
|
cwd: z23.string(),
|
|
@@ -38121,7 +38529,7 @@ function savePersistedSessions(sessions) {
|
|
|
38121
38529
|
}
|
|
38122
38530
|
function persistLiveSessions(sessions) {
|
|
38123
38531
|
const live = [...sessions.values()].filter(
|
|
38124
|
-
(s) => (s.pty || s.status === "stopped" || s.status === "error" || s.awaitingSeed && s.pendingStart) && s.status !== "done"
|
|
38532
|
+
(s) => (s.pty || s.status === "stopped" || s.status === "error" || s.awaitingSeed && s.pendingStart) && s.status !== "done" && !s.leftoverNotice
|
|
38125
38533
|
);
|
|
38126
38534
|
savePersistedSessions(live.map(toPersistedSession));
|
|
38127
38535
|
logPersist(live);
|
|
@@ -38189,7 +38597,7 @@ function detectInstallCommand(dir) {
|
|
|
38189
38597
|
}
|
|
38190
38598
|
|
|
38191
38599
|
// src/commands/sessions/daemon/worktree/spawnInstall.ts
|
|
38192
|
-
import { spawn as
|
|
38600
|
+
import { spawn as spawn11 } from "child_process";
|
|
38193
38601
|
|
|
38194
38602
|
// src/commands/sessions/daemon/worktree/installInvocation.ts
|
|
38195
38603
|
function installInvocation(worktreePath, command) {
|
|
@@ -38264,7 +38672,7 @@ function killTree(pid) {
|
|
|
38264
38672
|
var STDERR_TAIL = 2e3;
|
|
38265
38673
|
function spawnInstall(worktreePath, cwd, command, where, onDone) {
|
|
38266
38674
|
daemonLog(`worktree ${worktreePath} installing deps${where}: ${command}`);
|
|
38267
|
-
const child2 =
|
|
38675
|
+
const child2 = spawn11(...installInvocation(cwd, command));
|
|
38268
38676
|
trackInstall(worktreePath, child2);
|
|
38269
38677
|
let stderr = "";
|
|
38270
38678
|
child2.stderr?.on("data", (chunk2) => {
|
|
@@ -38470,13 +38878,13 @@ function prCliCommands(number, cwd) {
|
|
|
38470
38878
|
}
|
|
38471
38879
|
|
|
38472
38880
|
// src/commands/review/prHeadBranch.ts
|
|
38473
|
-
import { execFileSync as
|
|
38881
|
+
import { execFileSync as execFileSync19 } from "child_process";
|
|
38474
38882
|
function prHeadBranch({
|
|
38475
38883
|
headBranch
|
|
38476
38884
|
}) {
|
|
38477
38885
|
try {
|
|
38478
38886
|
return headBranch.parse(
|
|
38479
|
-
|
|
38887
|
+
execFileSync19(headBranch.file, headBranch.args, {
|
|
38480
38888
|
encoding: "utf8",
|
|
38481
38889
|
stdio: ["ignore", "pipe", "pipe"]
|
|
38482
38890
|
})
|
|
@@ -38547,7 +38955,7 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
38547
38955
|
import chalk201 from "chalk";
|
|
38548
38956
|
|
|
38549
38957
|
// src/commands/review/azCliProblem.ts
|
|
38550
|
-
import { execFileSync as
|
|
38958
|
+
import { execFileSync as execFileSync20 } from "child_process";
|
|
38551
38959
|
|
|
38552
38960
|
// src/commands/review/azFailureProblem.ts
|
|
38553
38961
|
var azProblems = {
|
|
@@ -38575,7 +38983,7 @@ function azFailureProblem(error) {
|
|
|
38575
38983
|
// src/commands/review/azCliProblem.ts
|
|
38576
38984
|
function runAz(args) {
|
|
38577
38985
|
try {
|
|
38578
|
-
|
|
38986
|
+
execFileSync20("az", args, { stdio: "ignore" });
|
|
38579
38987
|
return "ok";
|
|
38580
38988
|
} catch (error) {
|
|
38581
38989
|
return error.code === "ENOENT" ? "missing" : "failed";
|
|
@@ -38638,7 +39046,7 @@ async function checkoutPr(number) {
|
|
|
38638
39046
|
const from = branch2 === "HEAD" ? gitSyncOrNull(process.cwd(), ["rev-parse", "HEAD"]) : branch2;
|
|
38639
39047
|
const stale = headRef ? clearStalePrBranch(process.cwd(), headRef) : "absent";
|
|
38640
39048
|
try {
|
|
38641
|
-
|
|
39049
|
+
execFileSync21(commands.checkout.file, commands.checkout.args, {
|
|
38642
39050
|
stdio: "inherit"
|
|
38643
39051
|
});
|
|
38644
39052
|
} catch {
|
|
@@ -38744,11 +39152,11 @@ function registerReviewPrComments(program, resumeFlag) {
|
|
|
38744
39152
|
"--harness <kind>",
|
|
38745
39153
|
"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"
|
|
38746
39154
|
).action(
|
|
38747
|
-
(number,
|
|
38748
|
-
announce:
|
|
38749
|
-
auto:
|
|
38750
|
-
resumeSessionId:
|
|
38751
|
-
harness: resolveHarness2(
|
|
39155
|
+
(number, opts2) => reviewPrComments(number, {
|
|
39156
|
+
announce: opts2.announce,
|
|
39157
|
+
auto: opts2.auto,
|
|
39158
|
+
resumeSessionId: opts2.resumeSession,
|
|
39159
|
+
harness: resolveHarness2(opts2.harness)
|
|
38752
39160
|
})
|
|
38753
39161
|
);
|
|
38754
39162
|
configHelp(command, harnessConfigHelp);
|
|
@@ -38763,14 +39171,14 @@ function registerDescriptionLaunch(program, name2, slashCommand, description, fe
|
|
|
38763
39171
|
).description(description).option("--once", "Exit when the initial task completes").option("--resume-session <id>", resumeFlag).option("--harness <kind>", harnessFlag(feature)).option(
|
|
38764
39172
|
"--model <model>",
|
|
38765
39173
|
`Model to launch the harness with; defaults to harness.defaults.${name2}.model while the ${name2} type's harness is used`
|
|
38766
|
-
).option("--no-model", "Launch with the harness's own default model").action((text18,
|
|
38767
|
-
const harness = resolveHarness2(
|
|
39174
|
+
).option("--no-model", "Launch with the harness's own default model").action((text18, opts2) => {
|
|
39175
|
+
const harness = resolveHarness2(opts2.harness, name2);
|
|
38768
39176
|
return launchMode(slashCommand, {
|
|
38769
|
-
once:
|
|
39177
|
+
once: opts2.once,
|
|
38770
39178
|
description: text18,
|
|
38771
|
-
resumeSessionId:
|
|
39179
|
+
resumeSessionId: opts2.resumeSession,
|
|
38772
39180
|
harness,
|
|
38773
|
-
model: resolveModel(
|
|
39181
|
+
model: resolveModel(opts2.model, name2, harness),
|
|
38774
39182
|
feature
|
|
38775
39183
|
});
|
|
38776
39184
|
});
|
|
@@ -38782,7 +39190,7 @@ function registerDescriptionLaunch(program, name2, slashCommand, description, fe
|
|
|
38782
39190
|
var RESUME_SESSION_FLAG = "Resume an interrupted harness session by its conversation id (used by the sessions daemon on restart)";
|
|
38783
39191
|
function registerNext(program) {
|
|
38784
39192
|
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(
|
|
38785
|
-
(id,
|
|
39193
|
+
(id, opts2) => next({ allowEdits: true, once: opts2.once }, id)
|
|
38786
39194
|
);
|
|
38787
39195
|
}
|
|
38788
39196
|
function registerLaunch(program) {
|
|
@@ -38887,7 +39295,7 @@ import { resolve as resolve24 } from "path";
|
|
|
38887
39295
|
import chalk207 from "chalk";
|
|
38888
39296
|
|
|
38889
39297
|
// src/commands/mermaid/exportFile.ts
|
|
38890
|
-
import { readFileSync as
|
|
39298
|
+
import { readFileSync as readFileSync60, writeFileSync as writeFileSync43 } from "fs";
|
|
38891
39299
|
import { basename as basename23, extname as extname4, resolve as resolve23 } from "path";
|
|
38892
39300
|
import chalk206 from "chalk";
|
|
38893
39301
|
|
|
@@ -38913,7 +39321,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
38913
39321
|
|
|
38914
39322
|
// src/commands/mermaid/exportFile.ts
|
|
38915
39323
|
async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
38916
|
-
const content =
|
|
39324
|
+
const content = readFileSync60(file, "utf8");
|
|
38917
39325
|
const blocks = extractMermaidBlocks(content);
|
|
38918
39326
|
const stem = basename23(file, extname4(file));
|
|
38919
39327
|
if (onlyIndex !== void 0) {
|
|
@@ -39125,14 +39533,14 @@ function applyIgnore(texts, ignore3) {
|
|
|
39125
39533
|
}
|
|
39126
39534
|
|
|
39127
39535
|
// src/commands/miro/readIgnoreList.ts
|
|
39128
|
-
import { existsSync as existsSync75, readFileSync as
|
|
39536
|
+
import { existsSync as existsSync75, readFileSync as readFileSync61 } from "fs";
|
|
39129
39537
|
import { parse as parse2 } from "yaml";
|
|
39130
39538
|
function readIgnoreList(file) {
|
|
39131
39539
|
if (!existsSync75(file))
|
|
39132
39540
|
throw new MiroExtractError(
|
|
39133
39541
|
`No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
|
|
39134
39542
|
);
|
|
39135
|
-
const parsed = parse2(
|
|
39543
|
+
const parsed = parse2(readFileSync61(file, "utf8"));
|
|
39136
39544
|
if (parsed === null || parsed === void 0) return [];
|
|
39137
39545
|
if (!Array.isArray(parsed) || parsed.some((entry) => typeof entry !== "string"))
|
|
39138
39546
|
throw new MiroExtractError(
|
|
@@ -39312,7 +39720,7 @@ async function pickAnchors(sessionId2, items3) {
|
|
|
39312
39720
|
}
|
|
39313
39721
|
|
|
39314
39722
|
// src/commands/miro/readMiroItems.ts
|
|
39315
|
-
import { readFileSync as
|
|
39723
|
+
import { readFileSync as readFileSync62 } from "fs";
|
|
39316
39724
|
function tryParse(text18) {
|
|
39317
39725
|
try {
|
|
39318
39726
|
return JSON.parse(text18);
|
|
@@ -39341,7 +39749,7 @@ function parsePages(raw, file) {
|
|
|
39341
39749
|
return Array.isArray(parsed) ? parsed.map(toPage) : [toPage(parsed)];
|
|
39342
39750
|
}
|
|
39343
39751
|
function readMiroItems(file) {
|
|
39344
|
-
const items3 = parsePages(
|
|
39752
|
+
const items3 = parsePages(readFileSync62(file, "utf8"), file).flatMap(
|
|
39345
39753
|
(page) => page.data ?? []
|
|
39346
39754
|
);
|
|
39347
39755
|
if (items3.length === 0)
|
|
@@ -39740,7 +40148,7 @@ import { join as join96 } from "path";
|
|
|
39740
40148
|
import chalk212 from "chalk";
|
|
39741
40149
|
|
|
39742
40150
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
39743
|
-
import { readFileSync as
|
|
40151
|
+
import { readFileSync as readFileSync63 } from "fs";
|
|
39744
40152
|
|
|
39745
40153
|
// src/commands/netcap/parseRscRows.ts
|
|
39746
40154
|
var isRscRef = (v) => typeof v === "string" && /^\$[0-9a-fL@]/.test(v);
|
|
@@ -40136,7 +40544,7 @@ function extractVoyagerPosts(body) {
|
|
|
40136
40544
|
|
|
40137
40545
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
40138
40546
|
function captureEntries(captureFile) {
|
|
40139
|
-
const lines =
|
|
40547
|
+
const lines = readFileSync63(captureFile, "utf8").split("\n").filter(Boolean);
|
|
40140
40548
|
const entries2 = [];
|
|
40141
40549
|
for (const line of lines) {
|
|
40142
40550
|
let entry;
|
|
@@ -40595,14 +41003,14 @@ import { dirname as dirname44 } from "path";
|
|
|
40595
41003
|
import { stringify as stringify3 } from "yaml";
|
|
40596
41004
|
|
|
40597
41005
|
// src/commands/prs/loadCommentsCache.ts
|
|
40598
|
-
import { existsSync as existsSync76, readFileSync as
|
|
41006
|
+
import { existsSync as existsSync76, readFileSync as readFileSync64, unlinkSync as unlinkSync15 } from "fs";
|
|
40599
41007
|
import { parse as parse3 } from "yaml";
|
|
40600
41008
|
function loadCommentsCache(org, repo, prNumber) {
|
|
40601
41009
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
40602
41010
|
if (!existsSync76(cachePath)) {
|
|
40603
41011
|
return null;
|
|
40604
41012
|
}
|
|
40605
|
-
const content =
|
|
41013
|
+
const content = readFileSync64(cachePath, "utf8");
|
|
40606
41014
|
return parse3(content);
|
|
40607
41015
|
}
|
|
40608
41016
|
function deleteCommentsCache(org, repo, prNumber) {
|
|
@@ -40692,9 +41100,9 @@ var azureDevopsThreadRequests = {
|
|
|
40692
41100
|
};
|
|
40693
41101
|
|
|
40694
41102
|
// src/commands/prs/azureDevops/currentAzureDevopsPr.ts
|
|
40695
|
-
import { execFileSync as
|
|
41103
|
+
import { execFileSync as execFileSync22 } from "child_process";
|
|
40696
41104
|
function findPrForBranch(repo, branch2) {
|
|
40697
|
-
const stdout =
|
|
41105
|
+
const stdout = execFileSync22(
|
|
40698
41106
|
"az",
|
|
40699
41107
|
[
|
|
40700
41108
|
"repos",
|
|
@@ -40741,7 +41149,7 @@ function failAzureDevops(error) {
|
|
|
40741
41149
|
}
|
|
40742
41150
|
|
|
40743
41151
|
// src/commands/prs/azureDevops/invokeAzDevops.ts
|
|
40744
|
-
import { execFileSync as
|
|
41152
|
+
import { execFileSync as execFileSync23 } from "child_process";
|
|
40745
41153
|
import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as writeFileSync47 } from "fs";
|
|
40746
41154
|
import { tmpdir as tmpdir7 } from "os";
|
|
40747
41155
|
import { join as join99 } from "path";
|
|
@@ -40770,7 +41178,7 @@ function azDevopsInvokeArgs(request, inFile) {
|
|
|
40770
41178
|
];
|
|
40771
41179
|
}
|
|
40772
41180
|
function runAz2(args) {
|
|
40773
|
-
const stdout =
|
|
41181
|
+
const stdout = execFileSync23("az", args, {
|
|
40774
41182
|
encoding: "utf8",
|
|
40775
41183
|
stdio: ["ignore", "pipe", "pipe"],
|
|
40776
41184
|
windowsHide: true
|
|
@@ -40837,10 +41245,10 @@ function listAzureDevopsComments(repo) {
|
|
|
40837
41245
|
}
|
|
40838
41246
|
|
|
40839
41247
|
// src/commands/prs/fetchThreadIds.ts
|
|
40840
|
-
import { execFileSync as
|
|
41248
|
+
import { execFileSync as execFileSync24 } from "child_process";
|
|
40841
41249
|
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 } } } } } } }`;
|
|
40842
41250
|
function fetchThreadIds(org, repo, prNumber) {
|
|
40843
|
-
const result =
|
|
41251
|
+
const result = execFileSync24(
|
|
40844
41252
|
"gh",
|
|
40845
41253
|
[
|
|
40846
41254
|
"api",
|
|
@@ -41121,7 +41529,7 @@ function printComments2(result) {
|
|
|
41121
41529
|
import { execSync as execSync46 } from "child_process";
|
|
41122
41530
|
|
|
41123
41531
|
// src/commands/prs/threadTarget.ts
|
|
41124
|
-
import { execFileSync as
|
|
41532
|
+
import { execFileSync as execFileSync25 } from "child_process";
|
|
41125
41533
|
|
|
41126
41534
|
// src/commands/prs/azureDevops/azureDevopsThreadActions.ts
|
|
41127
41535
|
function attempt(run5) {
|
|
@@ -41169,7 +41577,7 @@ function replyToComment(org, repo, prNumber, commentId, message4) {
|
|
|
41169
41577
|
// src/commands/prs/threadTarget.ts
|
|
41170
41578
|
function resolveThread(threadId) {
|
|
41171
41579
|
const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
|
|
41172
|
-
|
|
41580
|
+
execFileSync25(
|
|
41173
41581
|
"gh",
|
|
41174
41582
|
["api", "graphql", "-f", `query=${mutation}`, "-f", `threadId=${threadId}`],
|
|
41175
41583
|
{ stdio: ["inherit", "pipe", "inherit"] }
|
|
@@ -41811,7 +42219,7 @@ function buildValidatedBody(options2, usage) {
|
|
|
41811
42219
|
}
|
|
41812
42220
|
|
|
41813
42221
|
// src/commands/prs/placePr.ts
|
|
41814
|
-
import { execFileSync as
|
|
42222
|
+
import { execFileSync as execFileSync26 } from "child_process";
|
|
41815
42223
|
|
|
41816
42224
|
// src/commands/prs/buildCreateArgs.ts
|
|
41817
42225
|
function buildCreateArgs(title, body, options2, attachments = []) {
|
|
@@ -41897,7 +42305,7 @@ function buildEditArgs(number, title, body, attachments = []) {
|
|
|
41897
42305
|
// src/commands/prs/placePr.ts
|
|
41898
42306
|
function hasUpstream2() {
|
|
41899
42307
|
try {
|
|
41900
|
-
|
|
42308
|
+
execFileSync26(
|
|
41901
42309
|
"git",
|
|
41902
42310
|
["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"],
|
|
41903
42311
|
{ stdio: "pipe" }
|
|
@@ -41909,7 +42317,7 @@ function hasUpstream2() {
|
|
|
41909
42317
|
}
|
|
41910
42318
|
function ensureBranchPushed() {
|
|
41911
42319
|
const args = hasUpstream2() ? ["push"] : ["push", "--set-upstream", "origin", "HEAD"];
|
|
41912
|
-
|
|
42320
|
+
execFileSync26("git", args, { stdio: "inherit" });
|
|
41913
42321
|
}
|
|
41914
42322
|
async function placePr(prNumber, title, body, options2, attachments = []) {
|
|
41915
42323
|
const args = prNumber !== null ? buildEditArgs(prNumber, title, body, attachments) : buildCreateArgs(title, body, options2, attachments);
|
|
@@ -41980,10 +42388,10 @@ function warn(reason4) {
|
|
|
41980
42388
|
}
|
|
41981
42389
|
|
|
41982
42390
|
// src/commands/prs/enableAutoMerge.ts
|
|
41983
|
-
import { execFileSync as
|
|
42391
|
+
import { execFileSync as execFileSync27 } from "child_process";
|
|
41984
42392
|
function enableAutoMerge() {
|
|
41985
42393
|
try {
|
|
41986
|
-
|
|
42394
|
+
execFileSync27(
|
|
41987
42395
|
"gh",
|
|
41988
42396
|
["pr", "merge", getCurrentBranch2(), "--auto", "--squash"],
|
|
41989
42397
|
{ stdio: "inherit" }
|
|
@@ -42243,10 +42651,10 @@ function prsSlackChannel() {
|
|
|
42243
42651
|
}
|
|
42244
42652
|
|
|
42245
42653
|
// src/commands/prs/status/fetchReviewThreads.ts
|
|
42246
|
-
import { execFileSync as
|
|
42654
|
+
import { execFileSync as execFileSync28 } from "child_process";
|
|
42247
42655
|
var THREAD_QUERY2 = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { isResolved } } } } }`;
|
|
42248
42656
|
function fetchReviewThreads(org, repo, prNumber) {
|
|
42249
|
-
const output =
|
|
42657
|
+
const output = execFileSync28(
|
|
42250
42658
|
"gh",
|
|
42251
42659
|
[
|
|
42252
42660
|
"api",
|
|
@@ -42568,7 +42976,7 @@ function registerPrsStatus(prsCommand) {
|
|
|
42568
42976
|
}
|
|
42569
42977
|
|
|
42570
42978
|
// src/commands/readTime/readTime.ts
|
|
42571
|
-
import { readFileSync as
|
|
42979
|
+
import { readFileSync as readFileSync65 } from "fs";
|
|
42572
42980
|
|
|
42573
42981
|
// src/commands/readTime/countReadingWords.ts
|
|
42574
42982
|
var FENCE_PATTERN = /^\s*(```|~~~)/;
|
|
@@ -42729,7 +43137,7 @@ async function loadBody(target) {
|
|
|
42729
43137
|
}
|
|
42730
43138
|
function readDraftFile(path128) {
|
|
42731
43139
|
try {
|
|
42732
|
-
return
|
|
43140
|
+
return readFileSync65(path128, "utf8");
|
|
42733
43141
|
} catch {
|
|
42734
43142
|
console.error(`Error: Could not read \`${path128}\`.`);
|
|
42735
43143
|
console.error(
|
|
@@ -43102,33 +43510,33 @@ import chalk232 from "chalk";
|
|
|
43102
43510
|
import chalk231 from "chalk";
|
|
43103
43511
|
|
|
43104
43512
|
// src/commands/ravendb/buildQueryPath.ts
|
|
43105
|
-
function buildQueryPath(
|
|
43106
|
-
const db = encodeURIComponent(
|
|
43513
|
+
function buildQueryPath(opts2) {
|
|
43514
|
+
const db = encodeURIComponent(opts2.db);
|
|
43107
43515
|
let path128;
|
|
43108
|
-
if (
|
|
43109
|
-
path128 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(
|
|
43516
|
+
if (opts2.collection) {
|
|
43517
|
+
path128 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts2.collection)}?start=${opts2.start}&pageSize=${opts2.pageSize}&sort=${encodeURIComponent(opts2.sort)}`;
|
|
43110
43518
|
} else {
|
|
43111
|
-
path128 = `/databases/${db}/queries?start=${
|
|
43519
|
+
path128 = `/databases/${db}/queries?start=${opts2.start}&pageSize=${opts2.pageSize}`;
|
|
43112
43520
|
}
|
|
43113
|
-
if (
|
|
43114
|
-
path128 += `&query=${encodeURIComponent(
|
|
43521
|
+
if (opts2.query) {
|
|
43522
|
+
path128 += `&query=${encodeURIComponent(opts2.query)}`;
|
|
43115
43523
|
}
|
|
43116
43524
|
return path128;
|
|
43117
43525
|
}
|
|
43118
43526
|
|
|
43119
43527
|
// src/commands/ravendb/fetchAllPages.ts
|
|
43120
|
-
async function fetchAllPages(connection,
|
|
43528
|
+
async function fetchAllPages(connection, opts2) {
|
|
43121
43529
|
const allResults = [];
|
|
43122
43530
|
let start2 = 0;
|
|
43123
43531
|
while (true) {
|
|
43124
|
-
const effectivePageSize =
|
|
43532
|
+
const effectivePageSize = opts2.limit !== void 0 ? Math.min(opts2.pageSize, opts2.limit - allResults.length) : opts2.pageSize;
|
|
43125
43533
|
const path128 = buildQueryPath({
|
|
43126
43534
|
db: connection.database,
|
|
43127
|
-
collection:
|
|
43535
|
+
collection: opts2.collection,
|
|
43128
43536
|
start: start2,
|
|
43129
43537
|
pageSize: effectivePageSize,
|
|
43130
|
-
sort:
|
|
43131
|
-
query:
|
|
43538
|
+
sort: opts2.sort,
|
|
43539
|
+
query: opts2.query
|
|
43132
43540
|
});
|
|
43133
43541
|
const data = await ravenFetch(connection, path128);
|
|
43134
43542
|
const results = data.Results ?? [];
|
|
@@ -43140,7 +43548,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
43140
43548
|
`\r${chalk231.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
43141
43549
|
);
|
|
43142
43550
|
if (start2 >= totalResults) break;
|
|
43143
|
-
if (
|
|
43551
|
+
if (opts2.limit !== void 0 && allResults.length >= opts2.limit) break;
|
|
43144
43552
|
}
|
|
43145
43553
|
if (allResults.length > 0) {
|
|
43146
43554
|
process.stderr.write("\n");
|
|
@@ -43236,10 +43644,10 @@ function checkStreamGraph(streams) {
|
|
|
43236
43644
|
}
|
|
43237
43645
|
|
|
43238
43646
|
// src/commands/releases/readStreamsInput.ts
|
|
43239
|
-
import { readFileSync as
|
|
43647
|
+
import { readFileSync as readFileSync66 } from "fs";
|
|
43240
43648
|
import { parse as parse4 } from "yaml";
|
|
43241
43649
|
function readSource2(source) {
|
|
43242
|
-
return
|
|
43650
|
+
return readFileSync66(source === "-" ? 0 : source, "utf8");
|
|
43243
43651
|
}
|
|
43244
43652
|
function readStreamsInput(source) {
|
|
43245
43653
|
let parsed;
|
|
@@ -44150,7 +44558,7 @@ function buildLimitsSegment(rateLimits) {
|
|
|
44150
44558
|
}
|
|
44151
44559
|
|
|
44152
44560
|
// src/commands/readGitBranch.ts
|
|
44153
|
-
import { readFileSync as
|
|
44561
|
+
import { readFileSync as readFileSync67, statSync as statSync14 } from "fs";
|
|
44154
44562
|
import { isAbsolute as isAbsolute7, join as join101, resolve as resolve29 } from "path";
|
|
44155
44563
|
function resolveGitDir(cwd) {
|
|
44156
44564
|
const dotGit = join101(cwd, ".git");
|
|
@@ -44165,7 +44573,7 @@ function resolveGitDir(cwd) {
|
|
|
44165
44573
|
}
|
|
44166
44574
|
let contents;
|
|
44167
44575
|
try {
|
|
44168
|
-
contents =
|
|
44576
|
+
contents = readFileSync67(dotGit, "utf8");
|
|
44169
44577
|
} catch {
|
|
44170
44578
|
return null;
|
|
44171
44579
|
}
|
|
@@ -44183,7 +44591,7 @@ function readGitBranch(cwd) {
|
|
|
44183
44591
|
}
|
|
44184
44592
|
let head;
|
|
44185
44593
|
try {
|
|
44186
|
-
head =
|
|
44594
|
+
head = readFileSync67(join101(gitDir, "HEAD"), "utf8");
|
|
44187
44595
|
} catch {
|
|
44188
44596
|
return null;
|
|
44189
44597
|
}
|
|
@@ -44220,6 +44628,7 @@ import chalk241 from "chalk";
|
|
|
44220
44628
|
// src/shared/harnessAdapters/contextLevel.ts
|
|
44221
44629
|
var THRESHOLDS = {
|
|
44222
44630
|
claude: { red: 30, yellow: 20 },
|
|
44631
|
+
"claude-sdk": { red: 30, yellow: 20 },
|
|
44223
44632
|
codex: { red: 75, yellow: 50 },
|
|
44224
44633
|
pi: { red: 30, yellow: 20 }
|
|
44225
44634
|
};
|
|
@@ -44360,7 +44769,7 @@ function registerRootCommands(program) {
|
|
|
44360
44769
|
}
|
|
44361
44770
|
|
|
44362
44771
|
// src/commands/refactor/check.ts
|
|
44363
|
-
import { spawn as
|
|
44772
|
+
import { spawn as spawn12 } from "child_process";
|
|
44364
44773
|
import * as path62 from "path";
|
|
44365
44774
|
|
|
44366
44775
|
// src/commands/refactor/logViolations.ts
|
|
@@ -44508,7 +44917,7 @@ function getViolations(pattern2, options2 = {}, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
44508
44917
|
// src/commands/refactor/check.ts
|
|
44509
44918
|
function runScript(script, cwd) {
|
|
44510
44919
|
return new Promise((resolve36) => {
|
|
44511
|
-
const child2 =
|
|
44920
|
+
const child2 = spawn12("npm", ["run", script], {
|
|
44512
44921
|
stdio: "pipe",
|
|
44513
44922
|
shell: true,
|
|
44514
44923
|
cwd
|
|
@@ -46728,7 +47137,7 @@ function readGlobs(value) {
|
|
|
46728
47137
|
}
|
|
46729
47138
|
|
|
46730
47139
|
// src/commands/review/highLevel/summariseRepoTree.ts
|
|
46731
|
-
import { execFileSync as
|
|
47140
|
+
import { execFileSync as execFileSync29 } from "child_process";
|
|
46732
47141
|
import { dirname as dirname46, extname as extname6 } from "path";
|
|
46733
47142
|
var MAX_DIRECTORIES = 200;
|
|
46734
47143
|
var MAX_EXTENSIONS_PER_DIRECTORY = 6;
|
|
@@ -46744,7 +47153,7 @@ function summariseRepoTree(cwd = process.cwd()) {
|
|
|
46744
47153
|
}
|
|
46745
47154
|
function listTrackedFiles(cwd) {
|
|
46746
47155
|
try {
|
|
46747
|
-
return
|
|
47156
|
+
return execFileSync29("git", ["ls-files"], {
|
|
46748
47157
|
cwd,
|
|
46749
47158
|
encoding: "utf8",
|
|
46750
47159
|
maxBuffer: 64 * 1024 * 1024
|
|
@@ -47217,7 +47626,7 @@ function evaluateHighLevelChecks(subject) {
|
|
|
47217
47626
|
}
|
|
47218
47627
|
|
|
47219
47628
|
// src/commands/review/highLevel/fetchHighLevelFiles.ts
|
|
47220
|
-
import { execFileSync as
|
|
47629
|
+
import { execFileSync as execFileSync30 } from "child_process";
|
|
47221
47630
|
import { createHash as createHash4 } from "crypto";
|
|
47222
47631
|
var JQ = ".[] | {filename,status,additions,deletions,patch} | @json";
|
|
47223
47632
|
function toStatus(status2) {
|
|
@@ -47230,7 +47639,7 @@ function diffUrl(repo, prNumber, path128) {
|
|
|
47230
47639
|
return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
|
|
47231
47640
|
}
|
|
47232
47641
|
function fetchHighLevelFiles(prNumber, repo) {
|
|
47233
|
-
const out =
|
|
47642
|
+
const out = execFileSync30(
|
|
47234
47643
|
"gh",
|
|
47235
47644
|
["api", `repos/${repo}/pulls/${prNumber}/files`, "--paginate", "--jq", JQ],
|
|
47236
47645
|
{ encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }
|
|
@@ -47297,7 +47706,7 @@ function fetchHighLevelPr(prNumber, repo) {
|
|
|
47297
47706
|
}
|
|
47298
47707
|
|
|
47299
47708
|
// src/commands/review/highLevel/gatherHighLevelSlices.ts
|
|
47300
|
-
import { readFileSync as
|
|
47709
|
+
import { readFileSync as readFileSync69 } from "fs";
|
|
47301
47710
|
|
|
47302
47711
|
// src/commands/review/highLevel/formatSlicingRequest.ts
|
|
47303
47712
|
var RULES = [
|
|
@@ -47415,11 +47824,11 @@ function listHighLevelHunks(files) {
|
|
|
47415
47824
|
}
|
|
47416
47825
|
|
|
47417
47826
|
// src/commands/review/highLevel/readJsonFile.ts
|
|
47418
|
-
import { existsSync as existsSync78, readFileSync as
|
|
47827
|
+
import { existsSync as existsSync78, readFileSync as readFileSync68 } from "fs";
|
|
47419
47828
|
function readJsonFile(path128) {
|
|
47420
47829
|
if (!existsSync78(path128)) return void 0;
|
|
47421
47830
|
try {
|
|
47422
|
-
return JSON.parse(
|
|
47831
|
+
return JSON.parse(readFileSync68(path128, "utf8"));
|
|
47423
47832
|
} catch {
|
|
47424
47833
|
return void 0;
|
|
47425
47834
|
}
|
|
@@ -47510,7 +47919,7 @@ function writeJsonFile(path128, data) {
|
|
|
47510
47919
|
// src/commands/review/highLevel/gatherHighLevelSlices.ts
|
|
47511
47920
|
function readSlicesFile(file) {
|
|
47512
47921
|
try {
|
|
47513
|
-
return JSON.parse(
|
|
47922
|
+
return JSON.parse(readFileSync69(file, "utf8"));
|
|
47514
47923
|
} catch (error) {
|
|
47515
47924
|
throw new Error(
|
|
47516
47925
|
`could not read slices from ${file}: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -47753,11 +48162,11 @@ function collectHighLevelTests(files, testPaths, readSource4) {
|
|
|
47753
48162
|
}
|
|
47754
48163
|
|
|
47755
48164
|
// src/commands/review/highLevel/fetchFileAtSha.ts
|
|
47756
|
-
import { execFileSync as
|
|
48165
|
+
import { execFileSync as execFileSync31 } from "child_process";
|
|
47757
48166
|
function fetchFileAtSha(repo, sha, path128) {
|
|
47758
48167
|
const encodedPath = path128.split("/").map(encodeURIComponent).join("/");
|
|
47759
48168
|
try {
|
|
47760
|
-
return
|
|
48169
|
+
return execFileSync31(
|
|
47761
48170
|
"gh",
|
|
47762
48171
|
[
|
|
47763
48172
|
"api",
|
|
@@ -48885,7 +49294,7 @@ async function runReviewers(reviewers, context) {
|
|
|
48885
49294
|
import { existsSync as existsSync79, unlinkSync as unlinkSync18 } from "fs";
|
|
48886
49295
|
|
|
48887
49296
|
// src/commands/review/synthesise.ts
|
|
48888
|
-
import { readFileSync as
|
|
49297
|
+
import { readFileSync as readFileSync70 } from "fs";
|
|
48889
49298
|
|
|
48890
49299
|
// src/commands/review/carriedUnanchoredFindings.ts
|
|
48891
49300
|
function carriedUnanchoredFindings(unanchored) {
|
|
@@ -49087,7 +49496,7 @@ Files:
|
|
|
49087
49496
|
|
|
49088
49497
|
// src/commands/review/synthesise.ts
|
|
49089
49498
|
function printSummary2(synthesisPath) {
|
|
49090
|
-
const markdown =
|
|
49499
|
+
const markdown = readFileSync70(synthesisPath, "utf8");
|
|
49091
49500
|
console.log("");
|
|
49092
49501
|
console.log(buildReviewSummary(markdown));
|
|
49093
49502
|
console.log("");
|
|
@@ -49637,7 +50046,7 @@ function postSynthesisSession(modes) {
|
|
|
49637
50046
|
}
|
|
49638
50047
|
|
|
49639
50048
|
// src/commands/review/postReviewToPr.ts
|
|
49640
|
-
import { readFileSync as
|
|
50049
|
+
import { readFileSync as readFileSync71 } from "fs";
|
|
49641
50050
|
|
|
49642
50051
|
// src/commands/review/chainAddressComments.ts
|
|
49643
50052
|
function chainAddressComments(prNumber, announce, harness) {
|
|
@@ -49992,7 +50401,7 @@ async function confirmPost(prNumber, work, options2) {
|
|
|
49992
50401
|
return promptConfirm(`Post ${work} to PR #${prNumber}?`, false);
|
|
49993
50402
|
}
|
|
49994
50403
|
async function postFindingsToPr(prInfo, synthesisPath, options2) {
|
|
49995
|
-
const markdown =
|
|
50404
|
+
const markdown = readFileSync71(synthesisPath, "utf8");
|
|
49996
50405
|
const { inDiff, unanchored } = selectPostableFindings(markdown, prInfo);
|
|
49997
50406
|
const carried = carriedUnanchoredFindings(unanchored);
|
|
49998
50407
|
if (inDiff.length === 0 && carried.length === 0) return NOTHING_POSTED;
|
|
@@ -50291,11 +50700,11 @@ import path101 from "path";
|
|
|
50291
50700
|
import chalk276 from "chalk";
|
|
50292
50701
|
|
|
50293
50702
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
50294
|
-
import { existsSync as existsSync81, readFileSync as
|
|
50703
|
+
import { existsSync as existsSync81, readFileSync as readFileSync73, writeFileSync as writeFileSync51 } from "fs";
|
|
50295
50704
|
import path100 from "path";
|
|
50296
50705
|
|
|
50297
50706
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
50298
|
-
import { readFileSync as
|
|
50707
|
+
import { readFileSync as readFileSync72 } from "fs";
|
|
50299
50708
|
import path99 from "path";
|
|
50300
50709
|
|
|
50301
50710
|
// src/commands/rules/findClaudeFiles.ts
|
|
@@ -50319,7 +50728,7 @@ function findClaudeFiles(dir) {
|
|
|
50319
50728
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
50320
50729
|
function scopedRuleDirectories(root2) {
|
|
50321
50730
|
return findClaudeFiles(root2).filter(
|
|
50322
|
-
(file) => path99.dirname(file) !== root2 && parseRulesSection(
|
|
50731
|
+
(file) => path99.dirname(file) !== root2 && parseRulesSection(readFileSync72(file, "utf8")).length > 0
|
|
50323
50732
|
).map(
|
|
50324
50733
|
(file) => `${path99.relative(root2, path99.dirname(file)).split(path99.sep).join("/")}/`
|
|
50325
50734
|
).sort();
|
|
@@ -50361,7 +50770,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
50361
50770
|
function updateScopedRulesIndex(root2) {
|
|
50362
50771
|
const directories = scopedRuleDirectories(root2);
|
|
50363
50772
|
const rootFile = path100.join(root2, "CLAUDE.md");
|
|
50364
|
-
const before = existsSync81(rootFile) ?
|
|
50773
|
+
const before = existsSync81(rootFile) ? readFileSync73(rootFile, "utf8") : "";
|
|
50365
50774
|
const after = upsertScopedRulesPointer(before, directories);
|
|
50366
50775
|
if (after !== before) writeFileSync51(rootFile, after);
|
|
50367
50776
|
return directories;
|
|
@@ -50414,7 +50823,7 @@ function listRules(target, options2 = {}) {
|
|
|
50414
50823
|
}
|
|
50415
50824
|
|
|
50416
50825
|
// src/commands/rules/addRule.ts
|
|
50417
|
-
import { existsSync as existsSync83, readFileSync as
|
|
50826
|
+
import { existsSync as existsSync83, readFileSync as readFileSync75, writeFileSync as writeFileSync52 } from "fs";
|
|
50418
50827
|
import path104 from "path";
|
|
50419
50828
|
import chalk278 from "chalk";
|
|
50420
50829
|
|
|
@@ -50439,11 +50848,11 @@ function insertRuleBullet(content, rule) {
|
|
|
50439
50848
|
}
|
|
50440
50849
|
|
|
50441
50850
|
// src/commands/rules/nextRuleCode.ts
|
|
50442
|
-
import { readFileSync as
|
|
50851
|
+
import { readFileSync as readFileSync74 } from "fs";
|
|
50443
50852
|
var CODE_PREFIX = "R";
|
|
50444
50853
|
function nextRuleCode(root2) {
|
|
50445
50854
|
const numbers = findClaudeFiles(root2).flatMap(
|
|
50446
|
-
(file) => parseRulesSection(
|
|
50855
|
+
(file) => parseRulesSection(readFileSync74(file, "utf8")).map(
|
|
50447
50856
|
(rule) => Number(/(\d+)\s*$/.exec(rule.code)?.[1] ?? 0)
|
|
50448
50857
|
)
|
|
50449
50858
|
);
|
|
@@ -50470,7 +50879,7 @@ function resolveRuleScope(target) {
|
|
|
50470
50879
|
|
|
50471
50880
|
// src/commands/rules/addRule.ts
|
|
50472
50881
|
function read3(file) {
|
|
50473
|
-
return existsSync83(file) ?
|
|
50882
|
+
return existsSync83(file) ? readFileSync75(file, "utf8") : "";
|
|
50474
50883
|
}
|
|
50475
50884
|
function addRule(text18, options2) {
|
|
50476
50885
|
const rule = text18.trim();
|
|
@@ -51338,8 +51747,8 @@ function isMutation(sql33) {
|
|
|
51338
51747
|
}
|
|
51339
51748
|
|
|
51340
51749
|
// src/commands/sql/sqlMutate.ts
|
|
51341
|
-
async function sqlMutate(
|
|
51342
|
-
if (!isMutation(
|
|
51750
|
+
async function sqlMutate(query2, connectionName) {
|
|
51751
|
+
if (!isMutation(query2)) {
|
|
51343
51752
|
console.error(
|
|
51344
51753
|
chalk292.red(
|
|
51345
51754
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
@@ -51350,7 +51759,7 @@ async function sqlMutate(query, connectionName) {
|
|
|
51350
51759
|
const conn = resolveConnection3(connectionName);
|
|
51351
51760
|
const pool = await sqlConnect(conn);
|
|
51352
51761
|
try {
|
|
51353
|
-
const result = await pool.request().query(
|
|
51762
|
+
const result = await pool.request().query(query2);
|
|
51354
51763
|
console.log(chalk292.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
51355
51764
|
} finally {
|
|
51356
51765
|
await pool.close();
|
|
@@ -51359,8 +51768,8 @@ async function sqlMutate(query, connectionName) {
|
|
|
51359
51768
|
|
|
51360
51769
|
// src/commands/sql/sqlQuery.ts
|
|
51361
51770
|
import chalk293 from "chalk";
|
|
51362
|
-
async function sqlQuery(
|
|
51363
|
-
if (isMutation(
|
|
51771
|
+
async function sqlQuery(query2, connectionName) {
|
|
51772
|
+
if (isMutation(query2)) {
|
|
51364
51773
|
console.error(
|
|
51365
51774
|
chalk293.red(
|
|
51366
51775
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
@@ -51371,7 +51780,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
51371
51780
|
const conn = resolveConnection3(connectionName);
|
|
51372
51781
|
const pool = await sqlConnect(conn);
|
|
51373
51782
|
try {
|
|
51374
|
-
const result = await pool.request().query(
|
|
51783
|
+
const result = await pool.request().query(query2);
|
|
51375
51784
|
const rows = result.recordset ?? [];
|
|
51376
51785
|
if (result.recordset) {
|
|
51377
51786
|
printTable(rows);
|
|
@@ -51421,12 +51830,12 @@ function registerSql(program) {
|
|
|
51421
51830
|
auth.command("remove <name>").description("Remove a configured connection").action((name2) => sqlAuth.remove(name2));
|
|
51422
51831
|
cmd.command("set-connection <name>").description("Set the default SQL connection").action((name2) => sqlSetConnection(name2));
|
|
51423
51832
|
cmd.command("query <sql> [connection]").description("Execute a read-only SQL query (rejects mutating statements)").action(
|
|
51424
|
-
(
|
|
51833
|
+
(query2, connection) => sqlQuery(query2, connection)
|
|
51425
51834
|
);
|
|
51426
51835
|
cmd.command("mutate <sql> [connection]").description(
|
|
51427
51836
|
"Execute a mutating SQL statement (rejects non-mutating statements)"
|
|
51428
51837
|
).action(
|
|
51429
|
-
(
|
|
51838
|
+
(query2, connection) => sqlMutate(query2, connection)
|
|
51430
51839
|
);
|
|
51431
51840
|
cmd.command("tables [connection]").description("List tables in the connected database").action((connection) => sqlTables(connection));
|
|
51432
51841
|
cmd.command("columns <table> [connection]").description(
|
|
@@ -51839,16 +52248,16 @@ var retiredSyncNames = {
|
|
|
51839
52248
|
|
|
51840
52249
|
// src/commands/sync/retiredOwnedPaths.ts
|
|
51841
52250
|
function retiredOwnedPaths() {
|
|
51842
|
-
const { claude, codex, pi } = harnesses;
|
|
52251
|
+
const { claude: claude2, codex, pi } = harnesses;
|
|
51843
52252
|
const paths = retiredSyncNames.commands.flatMap((name2) => [
|
|
51844
|
-
path115.join(
|
|
51845
|
-
path115.join(
|
|
52253
|
+
path115.join(claude2.homeDir, "commands", `${name2}.md`),
|
|
52254
|
+
path115.join(claude2.homeDir, claude2.sync.commandDest(name2)),
|
|
51846
52255
|
path115.join(codex.homeDir, codex.sync.commandDest(name2)),
|
|
51847
52256
|
path115.join(pi.homeDir, pi.sync.commandDest(name2))
|
|
51848
52257
|
]);
|
|
51849
52258
|
for (const name2 of retiredSyncNames.skillDirs)
|
|
51850
52259
|
paths.push(
|
|
51851
|
-
path115.join(
|
|
52260
|
+
path115.join(claude2.homeDir, "skills", name2),
|
|
51852
52261
|
path115.join(codex.homeDir, "skills", name2)
|
|
51853
52262
|
);
|
|
51854
52263
|
return paths.filter((file) => fs62.existsSync(file));
|
|
@@ -52507,9 +52916,9 @@ function formatVttPassages(passages, notes = [], { sourceMarks = true } = {}) {
|
|
|
52507
52916
|
}
|
|
52508
52917
|
|
|
52509
52918
|
// src/commands/transcript/convert/readCleanedCues.ts
|
|
52510
|
-
import { readFileSync as
|
|
52919
|
+
import { readFileSync as readFileSync84 } from "fs";
|
|
52511
52920
|
function readCleanedCues(inputPath) {
|
|
52512
|
-
return deduplicateCues(parseVtt(
|
|
52921
|
+
return deduplicateCues(parseVtt(readFileSync84(inputPath, "utf8")));
|
|
52513
52922
|
}
|
|
52514
52923
|
|
|
52515
52924
|
// src/commands/transcript/clean.ts
|
|
@@ -53288,7 +53697,7 @@ function configKeys2() {
|
|
|
53288
53697
|
}
|
|
53289
53698
|
|
|
53290
53699
|
// src/commands/verify/forbiddenStrings.ts
|
|
53291
|
-
import { existsSync as existsSync96, readFileSync as
|
|
53700
|
+
import { existsSync as existsSync96, readFileSync as readFileSync85 } from "fs";
|
|
53292
53701
|
|
|
53293
53702
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
53294
53703
|
import { minimatch as minimatch10 } from "minimatch";
|
|
@@ -53335,7 +53744,7 @@ function forbiddenStrings() {
|
|
|
53335
53744
|
}
|
|
53336
53745
|
let parsed;
|
|
53337
53746
|
try {
|
|
53338
|
-
parsed = JSON.parse(
|
|
53747
|
+
parsed = JSON.parse(readFileSync85(file, "utf8"));
|
|
53339
53748
|
} catch (error) {
|
|
53340
53749
|
console.log(`Could not parse ${file}: ${error.message}`);
|
|
53341
53750
|
process.exit(1);
|
|
@@ -53361,13 +53770,13 @@ Total: ${violations.length} forbidden string(s).`);
|
|
|
53361
53770
|
}
|
|
53362
53771
|
|
|
53363
53772
|
// src/commands/verify/hardcodedColors.ts
|
|
53364
|
-
import { execFileSync as
|
|
53773
|
+
import { execFileSync as execFileSync32 } from "child_process";
|
|
53365
53774
|
import { minimatch as minimatch11 } from "minimatch";
|
|
53366
53775
|
var pattern = "0x[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,6}";
|
|
53367
53776
|
function hardcodedColors() {
|
|
53368
53777
|
const ignoreGlobs = loadConfig().hardcodedColors?.ignore ?? [];
|
|
53369
53778
|
try {
|
|
53370
|
-
const output =
|
|
53779
|
+
const output = execFileSync32("grep", ["-rEnH", "-f", "-", "src/"], {
|
|
53371
53780
|
encoding: "utf8",
|
|
53372
53781
|
input: `${pattern}
|
|
53373
53782
|
`
|
|
@@ -53452,7 +53861,7 @@ async function harnessFollowUps() {
|
|
|
53452
53861
|
}
|
|
53453
53862
|
|
|
53454
53863
|
// src/commands/verify/migrations.ts
|
|
53455
|
-
import { readFileSync as
|
|
53864
|
+
import { readFileSync as readFileSync86 } from "fs";
|
|
53456
53865
|
import path126 from "path";
|
|
53457
53866
|
|
|
53458
53867
|
// src/commands/verify/migrations/checkAppendOnly.ts
|
|
@@ -53617,7 +54026,7 @@ function migrations2() {
|
|
|
53617
54026
|
if (ref) {
|
|
53618
54027
|
const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
|
|
53619
54028
|
const current2 = new Map(
|
|
53620
|
-
files.map((file) => [file,
|
|
54029
|
+
files.map((file) => [file, readFileSync86(path126.join(dir, file), "utf8")])
|
|
53621
54030
|
);
|
|
53622
54031
|
for (const finding of checkAppendOnly(baseline, current2)) {
|
|
53623
54032
|
problems.push(
|
|
@@ -54323,11 +54732,11 @@ function consumeSimulatedDivergence(cwd) {
|
|
|
54323
54732
|
}
|
|
54324
54733
|
|
|
54325
54734
|
// src/commands/watch/fetchQuietly.ts
|
|
54326
|
-
import { execFileSync as
|
|
54735
|
+
import { execFileSync as execFileSync33 } from "child_process";
|
|
54327
54736
|
var MIN_FETCH_TIMEOUT_MS = 6e4;
|
|
54328
54737
|
function fetchQuietly(cwd, intervalMs) {
|
|
54329
54738
|
try {
|
|
54330
|
-
|
|
54739
|
+
execFileSync33("git", ["fetch", "--quiet"], {
|
|
54331
54740
|
stdio: ["pipe", "pipe", "pipe"],
|
|
54332
54741
|
cwd,
|
|
54333
54742
|
timeout: Math.max(intervalMs, MIN_FETCH_TIMEOUT_MS)
|
|
@@ -54523,11 +54932,11 @@ function decideLap(end, interrupted) {
|
|
|
54523
54932
|
}
|
|
54524
54933
|
|
|
54525
54934
|
// src/commands/watch/runWatchLap.ts
|
|
54526
|
-
import { spawn as
|
|
54935
|
+
import { spawn as spawn13 } from "child_process";
|
|
54527
54936
|
var WATCH_LAP_ARGS = ["watch", "wait", "--pull", "--build"];
|
|
54528
54937
|
function runWatchLap() {
|
|
54529
54938
|
return new Promise((resolve36, reject) => {
|
|
54530
|
-
const assistFromPath =
|
|
54939
|
+
const assistFromPath = spawn13("assist", WATCH_LAP_ARGS, {
|
|
54531
54940
|
stdio: "inherit",
|
|
54532
54941
|
shell: process.platform === "win32"
|
|
54533
54942
|
});
|
|
@@ -54596,8 +55005,8 @@ function registerWatch(program) {
|
|
|
54596
55005
|
}
|
|
54597
55006
|
|
|
54598
55007
|
// src/commands/roam/postRoamActivity.ts
|
|
54599
|
-
import { execFileSync as
|
|
54600
|
-
import { readdirSync as readdirSync27, readFileSync as
|
|
55008
|
+
import { execFileSync as execFileSync34 } from "child_process";
|
|
55009
|
+
import { readdirSync as readdirSync27, readFileSync as readFileSync87, statSync as statSync18 } from "fs";
|
|
54601
55010
|
import { join as join123 } from "path";
|
|
54602
55011
|
function findPortFile(roamDir) {
|
|
54603
55012
|
let entries2;
|
|
@@ -54628,14 +55037,14 @@ function postRoamActivity(app, event) {
|
|
|
54628
55037
|
if (!portFile) return;
|
|
54629
55038
|
let port;
|
|
54630
55039
|
try {
|
|
54631
|
-
port =
|
|
55040
|
+
port = readFileSync87(portFile, "utf8").trim();
|
|
54632
55041
|
} catch {
|
|
54633
55042
|
return;
|
|
54634
55043
|
}
|
|
54635
55044
|
const pid = PID_BY_APP[app] ?? 99999;
|
|
54636
55045
|
const url = `http://127.0.0.1:${port}/api/v1/activity/${app}/${event}?pid=${pid}`;
|
|
54637
55046
|
try {
|
|
54638
|
-
|
|
55047
|
+
execFileSync34("curl", ["-sf", "--max-time", "0.2", "-X", "POST", url], {
|
|
54639
55048
|
stdio: "ignore"
|
|
54640
55049
|
});
|
|
54641
55050
|
} catch {
|
|
@@ -55193,7 +55602,7 @@ async function remove2(name2, options2 = {}) {
|
|
|
55193
55602
|
|
|
55194
55603
|
// src/commands/run/registerRunSubcommands.ts
|
|
55195
55604
|
function registerRunSubcommands(runCommand) {
|
|
55196
|
-
runCommand.command("list").description("List configured run commands").option("-v, --verbose", "Show full command details").action((
|
|
55605
|
+
runCommand.command("list").description("List configured run commands").option("-v, --verbose", "Show full command details").action((opts2) => listRunConfigs(!!opts2.verbose));
|
|
55197
55606
|
registerRunAdd(runCommand);
|
|
55198
55607
|
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());
|
|
55199
55608
|
runCommand.command("remove").description(
|
|
@@ -55201,7 +55610,7 @@ function registerRunSubcommands(runCommand) {
|
|
|
55201
55610
|
).argument("<name>", "Name of the run configuration to remove").option(
|
|
55202
55611
|
"--repo [name]",
|
|
55203
55612
|
"Remove from a repo's override in the shared db instead of assist.yml (defaults to the current repo)"
|
|
55204
|
-
).action((name2,
|
|
55613
|
+
).action((name2, opts2) => remove2(name2, opts2));
|
|
55205
55614
|
}
|
|
55206
55615
|
|
|
55207
55616
|
// src/commands/run/registerRun.ts
|
|
@@ -55231,11 +55640,11 @@ function formatLink(link3) {
|
|
|
55231
55640
|
}
|
|
55232
55641
|
|
|
55233
55642
|
// src/commands/sessions/daemon/listDaemonPids.ts
|
|
55234
|
-
import { execFileSync as
|
|
55643
|
+
import { execFileSync as execFileSync35 } from "child_process";
|
|
55235
55644
|
function listDaemonPids() {
|
|
55236
55645
|
if (process.platform === "win32") return [];
|
|
55237
55646
|
try {
|
|
55238
|
-
const out =
|
|
55647
|
+
const out = execFileSync35("ps", ["-eo", "pid=,args="], {
|
|
55239
55648
|
encoding: "utf8"
|
|
55240
55649
|
});
|
|
55241
55650
|
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));
|
|
@@ -55281,11 +55690,11 @@ function applyLine(result, pending, line) {
|
|
|
55281
55690
|
}
|
|
55282
55691
|
|
|
55283
55692
|
// src/commands/sessions/daemon/readDaemonPidFile.ts
|
|
55284
|
-
import { readFileSync as
|
|
55693
|
+
import { readFileSync as readFileSync88 } from "fs";
|
|
55285
55694
|
function readDaemonPidFile() {
|
|
55286
55695
|
try {
|
|
55287
55696
|
const pid = Number.parseInt(
|
|
55288
|
-
|
|
55697
|
+
readFileSync88(daemonPaths.pid, "utf8").trim(),
|
|
55289
55698
|
10
|
|
55290
55699
|
);
|
|
55291
55700
|
return Number.isInteger(pid) ? pid : void 0;
|
|
@@ -55765,6 +56174,13 @@ async function refreshRepoConfigCacheOnStart() {
|
|
|
55765
56174
|
}
|
|
55766
56175
|
}
|
|
55767
56176
|
|
|
56177
|
+
// src/commands/sessions/daemon/liveSessionCount.ts
|
|
56178
|
+
function liveSessionCount(sessions) {
|
|
56179
|
+
let count10 = 0;
|
|
56180
|
+
for (const session of sessions.values()) if (!session.leftoverNotice) count10++;
|
|
56181
|
+
return count10;
|
|
56182
|
+
}
|
|
56183
|
+
|
|
55768
56184
|
// src/commands/sessions/daemon/loadActiveSelection.ts
|
|
55769
56185
|
import { z as z26 } from "zod";
|
|
55770
56186
|
var ACTIVE_FILE = "active.json";
|
|
@@ -55884,9 +56300,13 @@ function toSessionViewInfo({
|
|
|
55884
56300
|
rows,
|
|
55885
56301
|
activeViewer,
|
|
55886
56302
|
activeViewerNode,
|
|
55887
|
-
transfer
|
|
56303
|
+
transfer,
|
|
56304
|
+
pty: pty2,
|
|
56305
|
+
sdkActivity
|
|
55888
56306
|
}) {
|
|
55889
56307
|
return {
|
|
56308
|
+
sdk: pty2?.sdk ? true : void 0,
|
|
56309
|
+
sdkActivity,
|
|
55890
56310
|
transfer,
|
|
55891
56311
|
lastUserMessage,
|
|
55892
56312
|
lastAssistantMessage,
|
|
@@ -56110,6 +56530,20 @@ function releaseViewer(sessions, viewerId) {
|
|
|
56110
56530
|
return released;
|
|
56111
56531
|
}
|
|
56112
56532
|
|
|
56533
|
+
// src/commands/sessions/daemon/isSdkSession.ts
|
|
56534
|
+
function isSdkSession(session) {
|
|
56535
|
+
return Boolean(session.pty?.sdk);
|
|
56536
|
+
}
|
|
56537
|
+
|
|
56538
|
+
// src/commands/sessions/daemon/skipsTerminalPath.ts
|
|
56539
|
+
function skipsTerminalPath(session, path128) {
|
|
56540
|
+
if (!isSdkSession(session)) return false;
|
|
56541
|
+
daemonLog(
|
|
56542
|
+
`session ${session.id} ${path128} skipped: Claude (SDK) session has no terminal`
|
|
56543
|
+
);
|
|
56544
|
+
return true;
|
|
56545
|
+
}
|
|
56546
|
+
|
|
56113
56547
|
// src/commands/sessions/daemon/claimViewer.ts
|
|
56114
56548
|
function claimViewer(session, { viewerId, viewerNode, onClaim }, via) {
|
|
56115
56549
|
if (!viewerId || session.activeViewer === viewerId) return;
|
|
@@ -56169,7 +56603,8 @@ function sendResizeSnapshot(s, send2) {
|
|
|
56169
56603
|
// src/commands/sessions/daemon/resizeSession.ts
|
|
56170
56604
|
function resizeSession(sessions, id, cols, rows, viewer = {}) {
|
|
56171
56605
|
const s = sessions.get(id);
|
|
56172
|
-
if (!s || isInactiveViewer(s, viewer))
|
|
56606
|
+
if (!s || isInactiveViewer(s, viewer) || skipsTerminalPath(s, "resize"))
|
|
56607
|
+
return;
|
|
56173
56608
|
claimViewer(s, viewer, "resize");
|
|
56174
56609
|
if (s.status === "done" || !s.pty) return;
|
|
56175
56610
|
const unchanged = s.cols === cols && s.rows === rows;
|
|
@@ -56271,6 +56706,16 @@ var ViewerConnections = class {
|
|
|
56271
56706
|
}
|
|
56272
56707
|
};
|
|
56273
56708
|
|
|
56709
|
+
// src/commands/sessions/daemon/dropsInactiveViewerResponse.ts
|
|
56710
|
+
function dropsInactiveViewerResponse(s, response, viewer) {
|
|
56711
|
+
if (!response || !s.activeViewer || viewer.viewerId === s.activeViewer)
|
|
56712
|
+
return false;
|
|
56713
|
+
daemonLog(
|
|
56714
|
+
`session ${s.id} dropped terminal response from inactive viewer ${viewer.viewerId ?? "unknown"} on ${viewer.viewerNode ?? "unknown node"}`
|
|
56715
|
+
);
|
|
56716
|
+
return true;
|
|
56717
|
+
}
|
|
56718
|
+
|
|
56274
56719
|
// src/commands/sessions/daemon/isTerminalResponse.ts
|
|
56275
56720
|
var ESC4 = String.raw`\x1b`;
|
|
56276
56721
|
var ST = String.raw`(?:\x07|${ESC4}\\)`;
|
|
@@ -56344,13 +56789,9 @@ function watchPromptSubmit(session, data, onStatusChange) {
|
|
|
56344
56789
|
function writeToSession(sessions, id, data, onStatusChange, viewer = {}) {
|
|
56345
56790
|
const s = sessions.get(id);
|
|
56346
56791
|
if (!s || s.status === "done") return;
|
|
56792
|
+
if (skipsTerminalPath(s, "input")) return;
|
|
56347
56793
|
const response = isTerminalResponse(data);
|
|
56348
|
-
if (
|
|
56349
|
-
daemonLog(
|
|
56350
|
-
`session ${id} dropped terminal response from inactive viewer ${viewer.viewerId ?? "unknown"} on ${viewer.viewerNode ?? "unknown node"}`
|
|
56351
|
-
);
|
|
56352
|
-
return;
|
|
56353
|
-
}
|
|
56794
|
+
if (dropsInactiveViewerResponse(s, response, viewer)) return;
|
|
56354
56795
|
s.pty?.write(data);
|
|
56355
56796
|
watchPromptSubmit(s, data, onStatusChange);
|
|
56356
56797
|
if (!response) claimViewer(s, viewer, "input");
|
|
@@ -56794,14 +57235,14 @@ async function runAutoUpdateLoop(deps2, maxLaps = Number.POSITIVE_INFINITY) {
|
|
|
56794
57235
|
}
|
|
56795
57236
|
|
|
56796
57237
|
// src/commands/sessions/daemon/autoUpdate/trimWatcherLog.ts
|
|
56797
|
-
import { readFileSync as
|
|
57238
|
+
import { readFileSync as readFileSync89, writeFileSync as writeFileSync63 } from "fs";
|
|
56798
57239
|
var KEEP_TAIL = 256 * 1024;
|
|
56799
57240
|
var MAX_LOG_SIZE = 4 * 1024 * 1024;
|
|
56800
57241
|
function trimWatcherLog(cwd) {
|
|
56801
57242
|
const path128 = watcherLogPath(cwd);
|
|
56802
57243
|
let log2;
|
|
56803
57244
|
try {
|
|
56804
|
-
log2 =
|
|
57245
|
+
log2 = readFileSync89(path128, "utf8");
|
|
56805
57246
|
} catch {
|
|
56806
57247
|
return;
|
|
56807
57248
|
}
|
|
@@ -57195,7 +57636,7 @@ function noteAutoUpdate(installDir, text18) {
|
|
|
57195
57636
|
}
|
|
57196
57637
|
|
|
57197
57638
|
// src/commands/sessions/daemon/autoUpdate/runUpdateLap.ts
|
|
57198
|
-
import { spawn as
|
|
57639
|
+
import { spawn as spawn14 } from "child_process";
|
|
57199
57640
|
import { rmSync as rmSync17 } from "fs";
|
|
57200
57641
|
function clearLapSignals(cwd) {
|
|
57201
57642
|
const control = watchControlPaths(cwd);
|
|
@@ -57207,7 +57648,7 @@ function runUpdateLap(cwd, onOutput) {
|
|
|
57207
57648
|
clearLapSignals(cwd);
|
|
57208
57649
|
return new Promise((resolve36, reject) => {
|
|
57209
57650
|
const { ASSIST_ACTIVITY_ID: _activity, ...env } = process.env;
|
|
57210
|
-
const child2 =
|
|
57651
|
+
const child2 = spawn14(
|
|
57211
57652
|
process.execPath,
|
|
57212
57653
|
[process.argv[1], ...WATCH_LAP_ARGS],
|
|
57213
57654
|
{
|
|
@@ -57558,7 +57999,7 @@ function releaseUndeletableLeftover(session, reason4, notify2) {
|
|
|
57558
57999
|
|
|
57559
58000
|
// src/commands/sessions/daemon/killPtyTree.ts
|
|
57560
58001
|
function killPtyTree(pty2) {
|
|
57561
|
-
if (process.platform === "win32") {
|
|
58002
|
+
if (pty2.sdk || process.platform === "win32") {
|
|
57562
58003
|
try {
|
|
57563
58004
|
pty2.kill();
|
|
57564
58005
|
} catch {
|
|
@@ -57661,10 +58102,10 @@ import { readdirSync as readdirSync29, readlinkSync } from "fs";
|
|
|
57661
58102
|
import { sep as sep6 } from "path";
|
|
57662
58103
|
|
|
57663
58104
|
// src/commands/sessions/daemon/worktree/readProc.ts
|
|
57664
|
-
import { readFileSync as
|
|
58105
|
+
import { readFileSync as readFileSync90 } from "fs";
|
|
57665
58106
|
function readProc(procRoot, pid, file) {
|
|
57666
58107
|
try {
|
|
57667
|
-
return
|
|
58108
|
+
return readFileSync90(`${procRoot}/${pid}/${file}`, "utf8");
|
|
57668
58109
|
} catch {
|
|
57669
58110
|
return void 0;
|
|
57670
58111
|
}
|
|
@@ -58921,9 +59362,31 @@ function handlePtyExit(session, exitCode, onStatusChange) {
|
|
|
58921
59362
|
onStatusChange(session, "done", exitCode);
|
|
58922
59363
|
}
|
|
58923
59364
|
|
|
59365
|
+
// src/commands/sessions/daemon/wireSdkEvents.ts
|
|
59366
|
+
function wireSdkEvents(session, onStatusChange, notify2) {
|
|
59367
|
+
session.pty?.sdk?.onEvent((event) => {
|
|
59368
|
+
if (session.status === "done" || session.status === "stopped") return;
|
|
59369
|
+
if (event.kind === "activity") {
|
|
59370
|
+
session.sdkActivity = event.text ?? void 0;
|
|
59371
|
+
daemonLog(
|
|
59372
|
+
`session ${session.id} sdk activity: ${event.text ?? "cleared"}`
|
|
59373
|
+
);
|
|
59374
|
+
notify2?.();
|
|
59375
|
+
return;
|
|
59376
|
+
}
|
|
59377
|
+
if (event.status === session.status) return;
|
|
59378
|
+
daemonLog(
|
|
59379
|
+
`session ${session.id} status from sdk: ${session.status} -> ${event.status}`
|
|
59380
|
+
);
|
|
59381
|
+
session.permissionActive = false;
|
|
59382
|
+
onStatusChange(session, event.status);
|
|
59383
|
+
});
|
|
59384
|
+
}
|
|
59385
|
+
|
|
58924
59386
|
// src/commands/sessions/daemon/wirePtyEvents.ts
|
|
58925
|
-
function wirePtyEvents(session, clients, onStatusChange) {
|
|
59387
|
+
function wirePtyEvents(session, clients, onStatusChange, notify2) {
|
|
58926
59388
|
if (!session.pty) return;
|
|
59389
|
+
wireSdkEvents(session, onStatusChange, notify2);
|
|
58927
59390
|
session.pty.onData((data) => emitSessionOutput(session, clients, data));
|
|
58928
59391
|
session.pty.onExit(({ exitCode }) => {
|
|
58929
59392
|
handlePtyExit(session, exitCode, onStatusChange);
|
|
@@ -58932,6 +59395,7 @@ function wirePtyEvents(session, clients, onStatusChange) {
|
|
|
58932
59395
|
}
|
|
58933
59396
|
function reportSilentFailure(session, clients) {
|
|
58934
59397
|
if (session.status !== "error" || !session.error) return;
|
|
59398
|
+
if (isSdkSession(session)) return;
|
|
58935
59399
|
if (session.scrollback.length > 0) return;
|
|
58936
59400
|
emitSessionOutput(
|
|
58937
59401
|
session,
|
|
@@ -59196,7 +59660,7 @@ function wireSessionWatchers(session, notify2, onStatusChange) {
|
|
|
59196
59660
|
function registerSpawnedSession(session, sessions, clients, onStatusChange, notify2, context) {
|
|
59197
59661
|
if (context?.launchedFrom) session.launchedFrom = context.launchedFrom;
|
|
59198
59662
|
sessions.set(session.id, session);
|
|
59199
|
-
wirePtyEvents(session, clients, onStatusChange);
|
|
59663
|
+
wirePtyEvents(session, clients, onStatusChange, notify2);
|
|
59200
59664
|
notify2();
|
|
59201
59665
|
wireSessionWatchers(session, notify2, onStatusChange);
|
|
59202
59666
|
logSpawnedSession(session);
|
|
@@ -59246,7 +59710,9 @@ function makeSessionSpawner(sessions, clients, counter, onStatusChange, notify2)
|
|
|
59246
59710
|
context
|
|
59247
59711
|
);
|
|
59248
59712
|
return {
|
|
59249
|
-
spawn: register(
|
|
59713
|
+
spawn: register(
|
|
59714
|
+
() => sessionLimits.nextId(liveSessionCount(sessions), counter)
|
|
59715
|
+
),
|
|
59250
59716
|
recoveryCard: register(() => sessionLimits.recoveryCardId(counter))
|
|
59251
59717
|
};
|
|
59252
59718
|
}
|
|
@@ -60077,7 +60543,7 @@ function releaseClient(client, clients, prPreview, verify) {
|
|
|
60077
60543
|
}
|
|
60078
60544
|
|
|
60079
60545
|
// src/commands/sessions/daemon/findPortHolderPid.ts
|
|
60080
|
-
import { execFileSync as
|
|
60546
|
+
import { execFileSync as execFileSync36 } from "child_process";
|
|
60081
60547
|
var PROBE_TIMEOUT_MS = 3e3;
|
|
60082
60548
|
function findPortHolderPid(port) {
|
|
60083
60549
|
try {
|
|
@@ -60087,7 +60553,7 @@ function findPortHolderPid(port) {
|
|
|
60087
60553
|
}
|
|
60088
60554
|
}
|
|
60089
60555
|
function probe2(command, args) {
|
|
60090
|
-
return
|
|
60556
|
+
return execFileSync36(command, args, {
|
|
60091
60557
|
encoding: "utf8",
|
|
60092
60558
|
timeout: PROBE_TIMEOUT_MS,
|
|
60093
60559
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -60158,7 +60624,7 @@ function startHeldSession(session, sessions, clients, onStatusChange, notify2, t
|
|
|
60158
60624
|
session.pty?.resize(session.cols, session.rows);
|
|
60159
60625
|
} catch {
|
|
60160
60626
|
}
|
|
60161
|
-
wirePtyEvents(session, clients, onStatusChange);
|
|
60627
|
+
wirePtyEvents(session, clients, onStatusChange, notify2);
|
|
60162
60628
|
daemonLog(
|
|
60163
60629
|
`session ${session.id} started once ${trigger ?? `worktree ${session.worktree?.path ?? session.cwd} finished seeding`}`
|
|
60164
60630
|
);
|
|
@@ -60606,8 +61072,8 @@ function serverRunMeta(runName, cwd) {
|
|
|
60606
61072
|
}
|
|
60607
61073
|
|
|
60608
61074
|
// src/commands/sessions/daemon/spawnRun.ts
|
|
60609
|
-
function spawnRun(
|
|
60610
|
-
return spawnPty(["assist", "run",
|
|
61075
|
+
function spawnRun(opts2) {
|
|
61076
|
+
return spawnPty(["assist", "run", opts2.name, ...opts2.args ?? []], opts2.cwd);
|
|
60611
61077
|
}
|
|
60612
61078
|
|
|
60613
61079
|
// src/commands/sessions/daemon/restoreServerRun.ts
|
|
@@ -60808,8 +61274,8 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
60808
61274
|
}
|
|
60809
61275
|
|
|
60810
61276
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
60811
|
-
import { existsSync as
|
|
60812
|
-
import { basename as
|
|
61277
|
+
import { existsSync as existsSync113 } from "fs";
|
|
61278
|
+
import { basename as basename37 } from "path";
|
|
60813
61279
|
|
|
60814
61280
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
60815
61281
|
function accountedTrees(sessions) {
|
|
@@ -60881,103 +61347,6 @@ function logVanishedTree(sessions, path128) {
|
|
|
60881
61347
|
);
|
|
60882
61348
|
}
|
|
60883
61349
|
|
|
60884
|
-
// src/commands/sessions/daemon/worktree/leftoverContents.ts
|
|
60885
|
-
import { lstatSync, readdirSync as readdirSync30 } from "fs";
|
|
60886
|
-
import { join as join131 } from "path";
|
|
60887
|
-
function leftoverContents(path128) {
|
|
60888
|
-
const contents = { holdsFiles: false, foreignOwned: false };
|
|
60889
|
-
walk2(path128, contents, process.getuid?.());
|
|
60890
|
-
return contents;
|
|
60891
|
-
}
|
|
60892
|
-
function walk2(path128, contents, uid) {
|
|
60893
|
-
const stat5 = lstatSync(path128, { throwIfNoEntry: false });
|
|
60894
|
-
if (!stat5) return;
|
|
60895
|
-
if (uid !== void 0 && stat5.uid !== uid) contents.foreignOwned = true;
|
|
60896
|
-
if (!stat5.isDirectory()) {
|
|
60897
|
-
contents.holdsFiles = true;
|
|
60898
|
-
return;
|
|
60899
|
-
}
|
|
60900
|
-
let entries2;
|
|
60901
|
-
try {
|
|
60902
|
-
entries2 = readdirSync30(path128);
|
|
60903
|
-
} catch {
|
|
60904
|
-
contents.foreignOwned = true;
|
|
60905
|
-
contents.holdsFiles = true;
|
|
60906
|
-
return;
|
|
60907
|
-
}
|
|
60908
|
-
for (const entry of entries2) walk2(join131(path128, entry), contents, uid);
|
|
60909
|
-
}
|
|
60910
|
-
|
|
60911
|
-
// src/commands/sessions/daemon/worktree/surfaceUndeletableLeftover.ts
|
|
60912
|
-
import { basename as basename36 } from "path";
|
|
60913
|
-
|
|
60914
|
-
// src/commands/sessions/daemon/worktree/leftoverSurfacingEnabled.ts
|
|
60915
|
-
var leftoverSurfacingEnabled = false;
|
|
60916
|
-
|
|
60917
|
-
// src/commands/sessions/daemon/worktree/surfaceUndeletableLeftover.ts
|
|
60918
|
-
function surfaceUndeletableLeftover(spawnWith, leftover, notify2) {
|
|
60919
|
-
if (!leftoverSurfacingEnabled) return;
|
|
60920
|
-
forgetWorktree(leftover.path);
|
|
60921
|
-
try {
|
|
60922
|
-
const id = spawnWith((sid) => leftoverSession(sid, leftover));
|
|
60923
|
-
daemonLog(
|
|
60924
|
-
`worktree ${leftover.path} could not be deleted; surfaced as error card ${id} until it is removed by hand: ${leftover.reason}`
|
|
60925
|
-
);
|
|
60926
|
-
} catch (error) {
|
|
60927
|
-
daemonLog(
|
|
60928
|
-
`worktree ${leftover.path} could not be deleted and no card was available to surface it: ${error instanceof Error ? error.message : String(error)}`
|
|
60929
|
-
);
|
|
60930
|
-
return;
|
|
60931
|
-
}
|
|
60932
|
-
notify2();
|
|
60933
|
-
}
|
|
60934
|
-
function leftoverSession(id, leftover) {
|
|
60935
|
-
const message4 = `Leftover workspace ${leftover.path} could not be deleted: ${leftover.reason}`;
|
|
60936
|
-
return {
|
|
60937
|
-
...sessionBase(id, "error"),
|
|
60938
|
-
name: `leftover ${basename36(leftover.path)}`,
|
|
60939
|
-
subtitle: message4,
|
|
60940
|
-
commandType: "claude",
|
|
60941
|
-
harness: leftover.harness ?? loadConfigFrom(leftover.clone).harness.engine,
|
|
60942
|
-
pty: null,
|
|
60943
|
-
cwd: leftover.path,
|
|
60944
|
-
error: message4,
|
|
60945
|
-
scrollback: [
|
|
60946
|
-
`\r
|
|
60947
|
-
\x1B[31m${message4}\x1B[0m\r
|
|
60948
|
-
`,
|
|
60949
|
-
"\r\nIts worktree is gone, but the directory is still on disk. Remove it with the command above,\r\n",
|
|
60950
|
-
"then dismiss this card. If it is still there on the next daemon restart, this card returns.\r\n"
|
|
60951
|
-
].join("")
|
|
60952
|
-
};
|
|
60953
|
-
}
|
|
60954
|
-
|
|
60955
|
-
// src/commands/sessions/daemon/worktree/recheckReapedWorktrees.ts
|
|
60956
|
-
async function recheckReapedWorktrees(accounted, spawnWith, notify2) {
|
|
60957
|
-
if (!leftoverSurfacingEnabled) return;
|
|
60958
|
-
for (const record3 of readReapedWorktreeRegistry()) {
|
|
60959
|
-
if (accounted.has(record3.path) || underTempRoot(record3.path)) continue;
|
|
60960
|
-
if (!holdsNoCheckout(record3.path)) continue;
|
|
60961
|
-
const reason4 = await clearReappearedTree(record3);
|
|
60962
|
-
if (reason4)
|
|
60963
|
-
surfaceUndeletableLeftover(spawnWith, { ...record3, reason: reason4 }, notify2);
|
|
60964
|
-
}
|
|
60965
|
-
}
|
|
60966
|
-
async function clearReappearedTree(record3) {
|
|
60967
|
-
const contents = leftoverContents(record3.path);
|
|
60968
|
-
if (contents.holdsFiles) return reviewFirst(record3.path, contents);
|
|
60969
|
-
const removal = await deleteTreeDirectly(
|
|
60970
|
-
record3.clone,
|
|
60971
|
-
record3.path,
|
|
60972
|
-
"it reappeared after its worktree was reaped, holding only empty directories (e.g. recreated by dockerd as a bind-mount source)"
|
|
60973
|
-
);
|
|
60974
|
-
return removal.removed ? null : removal.reason;
|
|
60975
|
-
}
|
|
60976
|
-
function reviewFirst(path128, contents) {
|
|
60977
|
-
const command = `${contents.foreignOwned ? "sudo " : ""}rm -rf ${path128}`;
|
|
60978
|
-
return `it reappeared after its worktree was reaped and holds files assist will not delete unreviewed; check them, then remove it with \`${command}\``;
|
|
60979
|
-
}
|
|
60980
|
-
|
|
60981
61350
|
// src/commands/sessions/daemon/worktree/describeHeldWork.ts
|
|
60982
61351
|
var MAX_ITEMS = 20;
|
|
60983
61352
|
async function describeHeldWork(path128, reason4) {
|
|
@@ -61014,7 +61383,7 @@ function capped2(lines) {
|
|
|
61014
61383
|
}
|
|
61015
61384
|
|
|
61016
61385
|
// src/commands/sessions/daemon/worktree/resurfaceOrphanedWorktree.ts
|
|
61017
|
-
import { basename as
|
|
61386
|
+
import { basename as basename36 } from "path";
|
|
61018
61387
|
function resurfaceOrphanedWorktree(sessions, spawnWith, recovered, notify2) {
|
|
61019
61388
|
const { orphan, reason: reason4, held } = recovered;
|
|
61020
61389
|
let id;
|
|
@@ -61037,7 +61406,7 @@ function orphanedSession(id, recovered) {
|
|
|
61037
61406
|
const { orphan, reason: reason4, held } = recovered;
|
|
61038
61407
|
return {
|
|
61039
61408
|
...sessionBase(id, "stopped"),
|
|
61040
|
-
name: `recovered ${
|
|
61409
|
+
name: `recovered ${basename36(orphan.path)}`,
|
|
61041
61410
|
subtitle: `${held.summary} in ${orphan.path}`,
|
|
61042
61411
|
commandType: "claude",
|
|
61043
61412
|
harness: orphan.harness ?? loadConfigFrom(orphan.clone).harness.engine,
|
|
@@ -61062,19 +61431,21 @@ function recoveryNotice({ orphan, held }) {
|
|
|
61062
61431
|
].join("");
|
|
61063
61432
|
}
|
|
61064
61433
|
|
|
61434
|
+
// src/commands/sessions/daemon/worktree/reportLeftoversEnabled.ts
|
|
61435
|
+
function reportLeftoversEnabled() {
|
|
61436
|
+
return loadConfig().sessions?.reportLeftovers ?? true;
|
|
61437
|
+
}
|
|
61438
|
+
|
|
61065
61439
|
// src/commands/sessions/daemon/worktree/recoverOrphan.ts
|
|
61066
61440
|
async function recoverOrphan(sessions, spawnWith, orphan, notify2) {
|
|
61067
61441
|
daemonLog(`worktree ${orphan.path} orphaned across restart; reconciling`);
|
|
61068
61442
|
const durability = await checkDurability(orphan.path);
|
|
61069
61443
|
if (durability.durable) {
|
|
61070
61444
|
const removal = await reapWorktree(orphan.path);
|
|
61071
|
-
if (
|
|
61072
|
-
|
|
61073
|
-
|
|
61074
|
-
|
|
61075
|
-
notify2
|
|
61076
|
-
);
|
|
61077
|
-
return;
|
|
61445
|
+
if (removal.removed || !holdsNoCheckout(orphan.path) || !reportLeftoversEnabled())
|
|
61446
|
+
return void 0;
|
|
61447
|
+
markLeftover(orphan.path, removal.reason);
|
|
61448
|
+
return { path: orphan.path, reason: removal.reason };
|
|
61078
61449
|
}
|
|
61079
61450
|
const held = await describeHeldWork(orphan.path, durability.reason);
|
|
61080
61451
|
resurfaceOrphanedWorktree(
|
|
@@ -61083,6 +61454,158 @@ async function recoverOrphan(sessions, spawnWith, orphan, notify2) {
|
|
|
61083
61454
|
{ orphan, reason: durability.reason, held },
|
|
61084
61455
|
notify2
|
|
61085
61456
|
);
|
|
61457
|
+
return void 0;
|
|
61458
|
+
}
|
|
61459
|
+
|
|
61460
|
+
// src/commands/sessions/daemon/worktree/recheckReapedWorktrees.ts
|
|
61461
|
+
import { existsSync as existsSync112 } from "fs";
|
|
61462
|
+
|
|
61463
|
+
// src/commands/sessions/daemon/worktree/leftoverContents.ts
|
|
61464
|
+
import { lstatSync, readdirSync as readdirSync30 } from "fs";
|
|
61465
|
+
import { join as join131 } from "path";
|
|
61466
|
+
function leftoverContents(path128) {
|
|
61467
|
+
const contents = { holdsFiles: false, foreignOwned: false };
|
|
61468
|
+
walk2(path128, contents, process.getuid?.());
|
|
61469
|
+
return contents;
|
|
61470
|
+
}
|
|
61471
|
+
function walk2(path128, contents, uid) {
|
|
61472
|
+
const stat5 = lstatSync(path128, { throwIfNoEntry: false });
|
|
61473
|
+
if (!stat5) return;
|
|
61474
|
+
if (uid !== void 0 && stat5.uid !== uid) contents.foreignOwned = true;
|
|
61475
|
+
if (!stat5.isDirectory()) {
|
|
61476
|
+
contents.holdsFiles = true;
|
|
61477
|
+
return;
|
|
61478
|
+
}
|
|
61479
|
+
let entries2;
|
|
61480
|
+
try {
|
|
61481
|
+
entries2 = readdirSync30(path128);
|
|
61482
|
+
} catch {
|
|
61483
|
+
contents.foreignOwned = true;
|
|
61484
|
+
contents.holdsFiles = true;
|
|
61485
|
+
return;
|
|
61486
|
+
}
|
|
61487
|
+
for (const entry of entries2) walk2(join131(path128, entry), contents, uid);
|
|
61488
|
+
}
|
|
61489
|
+
|
|
61490
|
+
// src/commands/sessions/daemon/worktree/recheckReapedWorktrees.ts
|
|
61491
|
+
async function recheckReapedWorktrees(accounted) {
|
|
61492
|
+
const leftovers = [];
|
|
61493
|
+
for (const record3 of readReapedWorktreeRegistry()) {
|
|
61494
|
+
if (accounted.has(record3.path) || underTempRoot(record3.path)) continue;
|
|
61495
|
+
if (record3.leftover) {
|
|
61496
|
+
if (existsSync112(record3.path))
|
|
61497
|
+
leftovers.push({ path: record3.path, reason: record3.leftover });
|
|
61498
|
+
else clearLeftover(record3.path);
|
|
61499
|
+
continue;
|
|
61500
|
+
}
|
|
61501
|
+
if (!holdsNoCheckout(record3.path)) continue;
|
|
61502
|
+
const reason4 = await clearReappearedTree(record3);
|
|
61503
|
+
if (!reason4) continue;
|
|
61504
|
+
markLeftover(record3.path, reason4);
|
|
61505
|
+
leftovers.push({ path: record3.path, reason: reason4 });
|
|
61506
|
+
}
|
|
61507
|
+
return leftovers;
|
|
61508
|
+
}
|
|
61509
|
+
async function clearReappearedTree(record3) {
|
|
61510
|
+
const contents = leftoverContents(record3.path);
|
|
61511
|
+
if (contents.holdsFiles) return reviewFirst(record3.path, contents);
|
|
61512
|
+
const removal = await deleteTreeDirectly(
|
|
61513
|
+
record3.clone,
|
|
61514
|
+
record3.path,
|
|
61515
|
+
"it reappeared after its worktree was reaped, holding only empty directories (e.g. recreated by dockerd as a bind-mount source)"
|
|
61516
|
+
);
|
|
61517
|
+
return removal.removed ? null : removal.reason;
|
|
61518
|
+
}
|
|
61519
|
+
function reviewFirst(path128, contents) {
|
|
61520
|
+
const command = `${contents.foreignOwned ? "sudo " : ""}rm -rf ${path128}`;
|
|
61521
|
+
return `it reappeared after its worktree was reaped and holds files assist will not delete unreviewed; check them, then remove it with \`${command}\``;
|
|
61522
|
+
}
|
|
61523
|
+
|
|
61524
|
+
// src/commands/sessions/daemon/worktree/reportLeftovers.ts
|
|
61525
|
+
import { homedir as homedir31 } from "os";
|
|
61526
|
+
|
|
61527
|
+
// src/commands/sessions/daemon/worktree/noticeContent.ts
|
|
61528
|
+
function noticeContent(leftovers) {
|
|
61529
|
+
const command = removalCommand(leftovers);
|
|
61530
|
+
const count10 = `${leftovers.length} leftover workspace${leftovers.length === 1 ? "" : "s"}`;
|
|
61531
|
+
const message4 = `${count10} could not be deleted; remove ${leftovers.length === 1 ? "it" : "them"} with: ${command}`;
|
|
61532
|
+
return {
|
|
61533
|
+
name: "leftover workspaces",
|
|
61534
|
+
subtitle: message4,
|
|
61535
|
+
error: message4,
|
|
61536
|
+
scrollback: [
|
|
61537
|
+
`\r
|
|
61538
|
+
\x1B[31m${count10} could not be deleted:\x1B[0m\r
|
|
61539
|
+
`,
|
|
61540
|
+
...leftovers.map((l) => `\r
|
|
61541
|
+
${l.path}\r
|
|
61542
|
+
${l.reason}\r
|
|
61543
|
+
`),
|
|
61544
|
+
`\r
|
|
61545
|
+
Remove ${leftovers.length === 1 ? "it" : "them all"} with:\r
|
|
61546
|
+
\r
|
|
61547
|
+
${command}\r
|
|
61548
|
+
`,
|
|
61549
|
+
"\r\nThis notice is rebuilt on each daemon restart and disappears once every path is gone.\r\n"
|
|
61550
|
+
].join("")
|
|
61551
|
+
};
|
|
61552
|
+
}
|
|
61553
|
+
function removalCommand(leftovers) {
|
|
61554
|
+
const sudo = leftovers.some((l) => leftoverContents(l.path).foreignOwned);
|
|
61555
|
+
return `${sudo ? "sudo " : ""}rm -rf ${leftovers.map((l) => shellQuote2(l.path)).join(" ")}`;
|
|
61556
|
+
}
|
|
61557
|
+
function shellQuote2(path128) {
|
|
61558
|
+
return /^[\w@%+=:,./-]+$/.test(path128) ? path128 : `'${path128.replaceAll("'", `'\\''`)}'`;
|
|
61559
|
+
}
|
|
61560
|
+
|
|
61561
|
+
// src/commands/sessions/daemon/worktree/reportLeftovers.ts
|
|
61562
|
+
function reportLeftovers(sessions, spawnNotice, leftovers, notify2) {
|
|
61563
|
+
const existing = [...sessions.values()].find((s) => s.leftoverNotice);
|
|
61564
|
+
if (leftovers.length === 0) {
|
|
61565
|
+
if (!existing) return;
|
|
61566
|
+
sessions.delete(existing.id);
|
|
61567
|
+
daemonLog(
|
|
61568
|
+
`leftover notice ${existing.id} dropped: every listed leftover is gone`
|
|
61569
|
+
);
|
|
61570
|
+
notify2();
|
|
61571
|
+
return;
|
|
61572
|
+
}
|
|
61573
|
+
const content = noticeContent(leftovers);
|
|
61574
|
+
if (existing) {
|
|
61575
|
+
Object.assign(existing, content);
|
|
61576
|
+
daemonLog(
|
|
61577
|
+
`leftover notice ${existing.id} updated: ${leftovers.length} leftover(s)`
|
|
61578
|
+
);
|
|
61579
|
+
notify2();
|
|
61580
|
+
return;
|
|
61581
|
+
}
|
|
61582
|
+
try {
|
|
61583
|
+
const id = spawnNotice((sid) => ({
|
|
61584
|
+
...sessionBase(sid, "error"),
|
|
61585
|
+
...content,
|
|
61586
|
+
commandType: "assist",
|
|
61587
|
+
pty: null,
|
|
61588
|
+
cwd: homedir31(),
|
|
61589
|
+
leftoverNotice: true
|
|
61590
|
+
}));
|
|
61591
|
+
daemonLog(`leftover notice ${id} created: ${leftovers.length} leftover(s)`);
|
|
61592
|
+
} catch (error) {
|
|
61593
|
+
daemonLog(
|
|
61594
|
+
`leftover notice could not be created for ${leftovers.length} leftover(s): ${error instanceof Error ? error.message : String(error)}`
|
|
61595
|
+
);
|
|
61596
|
+
}
|
|
61597
|
+
}
|
|
61598
|
+
|
|
61599
|
+
// src/commands/sessions/daemon/worktree/reportReconciledLeftovers.ts
|
|
61600
|
+
async function reportReconciledLeftovers(sessions, spawnWith, orphanLeftovers, notify2) {
|
|
61601
|
+
if (!reportLeftoversEnabled()) return;
|
|
61602
|
+
const reappeared = await recheckReapedWorktrees(accountedTrees(sessions));
|
|
61603
|
+
reportLeftovers(
|
|
61604
|
+
sessions,
|
|
61605
|
+
spawnWith,
|
|
61606
|
+
[...orphanLeftovers, ...reappeared],
|
|
61607
|
+
notify2
|
|
61608
|
+
);
|
|
61086
61609
|
}
|
|
61087
61610
|
|
|
61088
61611
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
@@ -61093,6 +61616,7 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
|
|
|
61093
61616
|
async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
61094
61617
|
const accounted = accountedTrees(sessions);
|
|
61095
61618
|
const vanished = /* @__PURE__ */ new Map();
|
|
61619
|
+
const leftovers = [];
|
|
61096
61620
|
for (const { path: path128, clone, harness } of readWorktreeRegistry()) {
|
|
61097
61621
|
if (underTempRoot(path128)) {
|
|
61098
61622
|
forgetWorktree(path128);
|
|
@@ -61101,20 +61625,26 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
61101
61625
|
);
|
|
61102
61626
|
continue;
|
|
61103
61627
|
}
|
|
61104
|
-
if (!
|
|
61628
|
+
if (!existsSync113(path128)) {
|
|
61105
61629
|
logVanishedTree(sessions, path128);
|
|
61106
61630
|
vanished.set(clone, [
|
|
61107
61631
|
...vanished.get(clone) ?? [],
|
|
61108
|
-
{ path: path128, branch:
|
|
61632
|
+
{ path: path128, branch: basename37(path128) }
|
|
61109
61633
|
]);
|
|
61110
61634
|
continue;
|
|
61111
61635
|
}
|
|
61112
61636
|
if (accounted.has(path128)) continue;
|
|
61113
|
-
await recoverOrphan(
|
|
61637
|
+
const leftover = await recoverOrphan(
|
|
61638
|
+
sessions,
|
|
61639
|
+
spawnWith,
|
|
61640
|
+
{ path: path128, clone, harness },
|
|
61641
|
+
notify2
|
|
61642
|
+
);
|
|
61643
|
+
if (leftover) leftovers.push(leftover);
|
|
61114
61644
|
}
|
|
61115
61645
|
for (const [clone, paths] of vanished)
|
|
61116
61646
|
await reclaimVanishedWorktrees(clone, paths);
|
|
61117
|
-
await
|
|
61647
|
+
await reportReconciledLeftovers(sessions, spawnWith, leftovers, notify2);
|
|
61118
61648
|
}
|
|
61119
61649
|
|
|
61120
61650
|
// src/commands/sessions/daemon/startHeldInTree.ts
|
|
@@ -61168,10 +61698,10 @@ function restoreAllSessions(spawner, deps2) {
|
|
|
61168
61698
|
|
|
61169
61699
|
// src/commands/sessions/daemon/retrySession.ts
|
|
61170
61700
|
function retrySession(session, clients, onStatusChange) {
|
|
61171
|
-
const
|
|
61172
|
-
if (!
|
|
61701
|
+
const spawn15 = respawnThunk(session);
|
|
61702
|
+
if (!spawn15) return false;
|
|
61173
61703
|
const respawn = () => {
|
|
61174
|
-
respawnSession(session,
|
|
61704
|
+
respawnSession(session, spawn15, "running", clients, onStatusChange);
|
|
61175
61705
|
daemonLog(`session ${session.id} retried: ${session.name}`);
|
|
61176
61706
|
};
|
|
61177
61707
|
const pty2 = session.pty;
|
|
@@ -61825,6 +62355,14 @@ function relayToCreator(label) {
|
|
|
61825
62355
|
};
|
|
61826
62356
|
}
|
|
61827
62357
|
|
|
62358
|
+
// src/commands/sessions/daemon/links/relayWithNodeSessionId.ts
|
|
62359
|
+
function relayWithNodeSessionId(state, msg) {
|
|
62360
|
+
broadcastToViewers(state, {
|
|
62361
|
+
...msg,
|
|
62362
|
+
sessionId: toNodeSessionId(state.node, msg.sessionId)
|
|
62363
|
+
});
|
|
62364
|
+
}
|
|
62365
|
+
|
|
61828
62366
|
// src/commands/sessions/daemon/links/relayLinkMessage.ts
|
|
61829
62367
|
var nsId = (state, msg) => toNodeSessionId(state.node, msg.sessionId);
|
|
61830
62368
|
var relayOutput = (state, msg) => {
|
|
@@ -61849,7 +62387,7 @@ var relayHistory = (state, msg) => {
|
|
|
61849
62387
|
var relays = {
|
|
61850
62388
|
sessions: relayLinkSessions,
|
|
61851
62389
|
output: relayOutput,
|
|
61852
|
-
clear:
|
|
62390
|
+
clear: relayWithNodeSessionId,
|
|
61853
62391
|
created: relayToCreator("created session"),
|
|
61854
62392
|
error: relayToCreator("peer error:"),
|
|
61855
62393
|
notice: (state, msg) => broadcastToViewers(state, msg),
|
|
@@ -61862,7 +62400,8 @@ var relays = {
|
|
|
61862
62400
|
...msg,
|
|
61863
62401
|
sessionId: typeof msg.sessionId === "string" ? nsId(state, msg) : void 0
|
|
61864
62402
|
}),
|
|
61865
|
-
"user-messages":
|
|
62403
|
+
"user-messages": relayWithNodeSessionId,
|
|
62404
|
+
"session-transcript": relayWithNodeSessionId,
|
|
61866
62405
|
limits: (state, msg) => state.onLimits(
|
|
61867
62406
|
msg.harness,
|
|
61868
62407
|
msg.rateLimits
|
|
@@ -62208,6 +62747,7 @@ var NodeLinks = class {
|
|
|
62208
62747
|
// src/commands/sessions/daemon/replayScrollback.ts
|
|
62209
62748
|
function replayScrollback(sessions, client) {
|
|
62210
62749
|
for (const s of sessions.values()) {
|
|
62750
|
+
if (skipsTerminalPath(s, "scrollback replay")) continue;
|
|
62211
62751
|
if (s.scrollback)
|
|
62212
62752
|
sendTo(client, {
|
|
62213
62753
|
type: "output",
|
|
@@ -62380,7 +62920,7 @@ function spawnAssistInTree(ctx, assistArgs, cwd, meta, context) {
|
|
|
62380
62920
|
}
|
|
62381
62921
|
|
|
62382
62922
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
62383
|
-
import { existsSync as
|
|
62923
|
+
import { existsSync as existsSync115 } from "fs";
|
|
62384
62924
|
|
|
62385
62925
|
// src/commands/sessions/daemon/resumeSession.ts
|
|
62386
62926
|
function resumeSession(id, sessionId2, cwd, name2, holdPty, harness) {
|
|
@@ -62410,7 +62950,7 @@ function resumeSession(id, sessionId2, cwd, name2, holdPty, harness) {
|
|
|
62410
62950
|
}
|
|
62411
62951
|
|
|
62412
62952
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
62413
|
-
import { existsSync as
|
|
62953
|
+
import { existsSync as existsSync114 } from "fs";
|
|
62414
62954
|
function resumeInReplacementTree(ctx, conversationId, missingCwd, name2, harness) {
|
|
62415
62955
|
const adapter = harnessAdapter(harness);
|
|
62416
62956
|
const blocker = launchBlocker(adapter, conversationRecoveryFeature);
|
|
@@ -62445,7 +62985,7 @@ function resumeInReplacementTree(ctx, conversationId, missingCwd, name2, harness
|
|
|
62445
62985
|
}
|
|
62446
62986
|
function cloneForReapedTree(missingCwd) {
|
|
62447
62987
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
62448
|
-
if (!clone || !
|
|
62988
|
+
if (!clone || !existsSync114(clone))
|
|
62449
62989
|
throw new Error(
|
|
62450
62990
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
62451
62991
|
);
|
|
@@ -62454,7 +62994,7 @@ function cloneForReapedTree(missingCwd) {
|
|
|
62454
62994
|
|
|
62455
62995
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
62456
62996
|
function resumeInTree(ctx, sessionId2, cwd, name2, harness) {
|
|
62457
|
-
if (!
|
|
62997
|
+
if (!existsSync115(cwd))
|
|
62458
62998
|
return resumeInReplacementTree(ctx, sessionId2, cwd, name2, harness);
|
|
62459
62999
|
const blocker = launchBlocker(
|
|
62460
63000
|
harnessAdapter(harness),
|
|
@@ -62525,7 +63065,7 @@ var SessionManager = class {
|
|
|
62525
63065
|
releaseClient(client, this.clients, this.prPreview, this.verify);
|
|
62526
63066
|
this.onIdleChange?.(this.isIdle());
|
|
62527
63067
|
}
|
|
62528
|
-
isIdle = () => this.sessions
|
|
63068
|
+
isIdle = () => liveSessionCount(this.sessions) === 0 && this.clients.size === 0;
|
|
62529
63069
|
shutdown() {
|
|
62530
63070
|
this.shuttingDown = true;
|
|
62531
63071
|
shutdownSessions(this.sessions);
|
|
@@ -62873,12 +63413,12 @@ function transcriptLineTexts(line, harness) {
|
|
|
62873
63413
|
function escapeRegExp3(text18) {
|
|
62874
63414
|
return text18.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
|
|
62875
63415
|
}
|
|
62876
|
-
function encodesVerbatimInJson(
|
|
62877
|
-
return JSON.stringify(
|
|
63416
|
+
function encodesVerbatimInJson(query2) {
|
|
63417
|
+
return JSON.stringify(query2) === `"${query2}"`;
|
|
62878
63418
|
}
|
|
62879
|
-
function rawLinePrefilter(
|
|
62880
|
-
if (!encodesVerbatimInJson(
|
|
62881
|
-
const lower =
|
|
63419
|
+
function rawLinePrefilter(query2) {
|
|
63420
|
+
if (!encodesVerbatimInJson(query2)) return () => true;
|
|
63421
|
+
const lower = query2.toLowerCase();
|
|
62882
63422
|
return (line) => line.toLowerCase().includes(lower);
|
|
62883
63423
|
}
|
|
62884
63424
|
function matchTexts(texts, pattern2) {
|
|
@@ -62888,12 +63428,12 @@ function matchTexts(texts, pattern2) {
|
|
|
62888
63428
|
}
|
|
62889
63429
|
return null;
|
|
62890
63430
|
}
|
|
62891
|
-
function queryPattern(
|
|
62892
|
-
return new RegExp(escapeRegExp3(
|
|
63431
|
+
function queryPattern(query2) {
|
|
63432
|
+
return new RegExp(escapeRegExp3(query2), "i");
|
|
62893
63433
|
}
|
|
62894
|
-
async function findTranscriptMatch(filePath, harness,
|
|
62895
|
-
const pattern2 = queryPattern(
|
|
62896
|
-
const mayMatch = rawLinePrefilter(
|
|
63434
|
+
async function findTranscriptMatch(filePath, harness, query2) {
|
|
63435
|
+
const pattern2 = queryPattern(query2);
|
|
63436
|
+
const mayMatch = rawLinePrefilter(query2);
|
|
62897
63437
|
const stream = fs72.createReadStream(filePath, { encoding: "utf8" });
|
|
62898
63438
|
const reader = readline5.createInterface({
|
|
62899
63439
|
input: stream,
|
|
@@ -62913,8 +63453,8 @@ async function findTranscriptMatch(filePath, harness, query) {
|
|
|
62913
63453
|
stream.destroy();
|
|
62914
63454
|
}
|
|
62915
63455
|
}
|
|
62916
|
-
function findTitleMatch(title,
|
|
62917
|
-
return title ? matchTexts([title], queryPattern(
|
|
63456
|
+
function findTitleMatch(title, query2) {
|
|
63457
|
+
return title ? matchTexts([title], queryPattern(query2)) : null;
|
|
62918
63458
|
}
|
|
62919
63459
|
|
|
62920
63460
|
// src/commands/sessions/daemon/historySearch/searchHistory.ts
|
|
@@ -62928,21 +63468,21 @@ function inRepo(cwd) {
|
|
|
62928
63468
|
return key === selectedKey || (group?.clone || session.cwd) === cwd;
|
|
62929
63469
|
};
|
|
62930
63470
|
}
|
|
62931
|
-
async function matchBatch(batch,
|
|
63471
|
+
async function matchBatch(batch, query2) {
|
|
62932
63472
|
const matches = await Promise.all(
|
|
62933
63473
|
batch.map(async ({ session, filePath }) => {
|
|
62934
|
-
const snippet = findTitleMatch(session.title,
|
|
63474
|
+
const snippet = findTitleMatch(session.title, query2) ?? await findTranscriptMatch(filePath, session.harness, query2);
|
|
62935
63475
|
return snippet ? { ...session, snippet } : null;
|
|
62936
63476
|
})
|
|
62937
63477
|
);
|
|
62938
63478
|
return matches.filter((hit) => hit !== null);
|
|
62939
63479
|
}
|
|
62940
|
-
async function searchHistory(cwd,
|
|
63480
|
+
async function searchHistory(cwd, query2) {
|
|
62941
63481
|
const candidates = (await discoverHistoryEntries()).filter(inRepo(cwd));
|
|
62942
63482
|
const hits = [];
|
|
62943
63483
|
for (let i = 0; i < candidates.length && hits.length < MAX_RESULTS2; i += BATCH_SIZE2)
|
|
62944
63484
|
hits.push(
|
|
62945
|
-
...await matchBatch(candidates.slice(i, i + BATCH_SIZE2),
|
|
63485
|
+
...await matchBatch(candidates.slice(i, i + BATCH_SIZE2), query2)
|
|
62946
63486
|
);
|
|
62947
63487
|
return withRepoGroups(hits.slice(0, MAX_RESULTS2));
|
|
62948
63488
|
}
|
|
@@ -62950,12 +63490,12 @@ async function searchHistory(cwd, query) {
|
|
|
62950
63490
|
// src/commands/sessions/daemon/historySearch/handleSearchHistory.ts
|
|
62951
63491
|
async function handleSearchHistory(client, data) {
|
|
62952
63492
|
const cwd = typeof data.cwd === "string" ? data.cwd : "";
|
|
62953
|
-
const
|
|
63493
|
+
const query2 = typeof data.query === "string" ? data.query.trim() : "";
|
|
62954
63494
|
const started2 = Date.now();
|
|
62955
63495
|
try {
|
|
62956
|
-
const sessions = cwd &&
|
|
63496
|
+
const sessions = cwd && query2 ? await searchHistory(cwd, query2) : [];
|
|
62957
63497
|
daemonLog(
|
|
62958
|
-
`history search cwd=${cwd} chars=${
|
|
63498
|
+
`history search cwd=${cwd} chars=${query2.length}: ${sessions.length} match(es) in ${Date.now() - started2}ms`
|
|
62959
63499
|
);
|
|
62960
63500
|
sendTo(client, { type: "history-search", sessions });
|
|
62961
63501
|
} catch (error) {
|
|
@@ -62966,7 +63506,7 @@ async function handleSearchHistory(client, data) {
|
|
|
62966
63506
|
}
|
|
62967
63507
|
|
|
62968
63508
|
// src/commands/sessions/daemon/creator.ts
|
|
62969
|
-
function creator(isNew,
|
|
63509
|
+
function creator(isNew, spawn15) {
|
|
62970
63510
|
const reply2 = (client, d, result) => {
|
|
62971
63511
|
const traceId = typeof d.traceId === "string" ? d.traceId : void 0;
|
|
62972
63512
|
if (typeof result !== "string") {
|
|
@@ -62984,7 +63524,7 @@ function creator(isNew, spawn14) {
|
|
|
62984
63524
|
if (m.links.route(client, d)) return;
|
|
62985
63525
|
let result;
|
|
62986
63526
|
try {
|
|
62987
|
-
result =
|
|
63527
|
+
result = spawn15(m, d);
|
|
62988
63528
|
} catch (error) {
|
|
62989
63529
|
fail14(client, d, error);
|
|
62990
63530
|
return;
|
|
@@ -63249,10 +63789,21 @@ var handleOutputRequest = (client, m, request) => {
|
|
|
63249
63789
|
}
|
|
63250
63790
|
const { sessionId: sessionId2, exited } = target;
|
|
63251
63791
|
let scrollback;
|
|
63792
|
+
let sdk = false;
|
|
63252
63793
|
m.update((sessions) => {
|
|
63253
|
-
|
|
63794
|
+
const session = sessions.get(sessionId2);
|
|
63795
|
+
sdk = session ? isSdkSession(session) : false;
|
|
63796
|
+
scrollback = session?.scrollback;
|
|
63254
63797
|
return false;
|
|
63255
63798
|
});
|
|
63799
|
+
if (sdk) {
|
|
63800
|
+
const error = `Session ${sessionId2} is a Claude (SDK) session with no terminal output`;
|
|
63801
|
+
daemonLog(
|
|
63802
|
+
`output requested: id=${sessionId2} skipped (Claude SDK session, no terminal)`
|
|
63803
|
+
);
|
|
63804
|
+
sendTo(client, { type: "session-output", sessionId: sessionId2, error, requestId });
|
|
63805
|
+
return;
|
|
63806
|
+
}
|
|
63256
63807
|
daemonLog(
|
|
63257
63808
|
`output requested: id=${sessionId2}${exited ? ` (exited: ${exited})` : ""} ${scrollback === void 0 ? "unknown session" : `${scrollback.length} chars`}`
|
|
63258
63809
|
);
|
|
@@ -63358,6 +63909,41 @@ async function parseTranscript(conversationId) {
|
|
|
63358
63909
|
}
|
|
63359
63910
|
}
|
|
63360
63911
|
|
|
63912
|
+
// src/commands/sessions/daemon/findSession.ts
|
|
63913
|
+
function findSession(manager, id) {
|
|
63914
|
+
let found;
|
|
63915
|
+
manager.update((sessions) => {
|
|
63916
|
+
found = sessions.get(id);
|
|
63917
|
+
return false;
|
|
63918
|
+
});
|
|
63919
|
+
return found;
|
|
63920
|
+
}
|
|
63921
|
+
|
|
63922
|
+
// src/commands/sessions/daemon/handleFetchSessionTranscript.ts
|
|
63923
|
+
import { readFile as readFile9 } from "fs/promises";
|
|
63924
|
+
async function readMessages(session) {
|
|
63925
|
+
const reader = conversationOf(session)?.reader;
|
|
63926
|
+
const filePath = reader ? await resolveTranscriptPath(session) : null;
|
|
63927
|
+
if (!reader || !filePath) return [];
|
|
63928
|
+
try {
|
|
63929
|
+
return transcriptMessages(
|
|
63930
|
+
reader,
|
|
63931
|
+
(await readFile9(filePath, "utf8")).split("\n")
|
|
63932
|
+
);
|
|
63933
|
+
} catch {
|
|
63934
|
+
return [];
|
|
63935
|
+
}
|
|
63936
|
+
}
|
|
63937
|
+
async function handleFetchSessionTranscript(client, manager, data) {
|
|
63938
|
+
const sessionId2 = data.sessionId;
|
|
63939
|
+
const session = findSession(manager, sessionId2);
|
|
63940
|
+
const messages2 = session ? await readMessages(session) : [];
|
|
63941
|
+
daemonLog(
|
|
63942
|
+
`session ${sessionId2} live transcript: ${session ? `${messages2.length} messages` : "unknown session"}`
|
|
63943
|
+
);
|
|
63944
|
+
sendTo(client, { type: "session-transcript", sessionId: sessionId2, messages: messages2 });
|
|
63945
|
+
}
|
|
63946
|
+
|
|
63361
63947
|
// src/commands/sessions/shared/userMessageTexts.ts
|
|
63362
63948
|
var MAX_LENGTH3 = 2048;
|
|
63363
63949
|
function userMessageTexts(events, maxLength = MAX_LENGTH3) {
|
|
@@ -63367,14 +63953,6 @@ function userMessageTexts(events, maxLength = MAX_LENGTH3) {
|
|
|
63367
63953
|
}
|
|
63368
63954
|
|
|
63369
63955
|
// src/commands/sessions/daemon/handleFetchUserMessages.ts
|
|
63370
|
-
function findSession(manager, id) {
|
|
63371
|
-
let found;
|
|
63372
|
-
manager.update((sessions) => {
|
|
63373
|
-
found = sessions.get(id);
|
|
63374
|
-
return false;
|
|
63375
|
-
});
|
|
63376
|
-
return found;
|
|
63377
|
-
}
|
|
63378
63956
|
async function handleFetchUserMessages(client, manager, data) {
|
|
63379
63957
|
const sessionId2 = data.sessionId;
|
|
63380
63958
|
const session = findSession(manager, sessionId2);
|
|
@@ -63414,6 +63992,7 @@ var lifecycleHandlers = {
|
|
|
63414
63992
|
history: handleHistory,
|
|
63415
63993
|
"fetch-transcript": handleFetchTranscript,
|
|
63416
63994
|
"fetch-user-messages": routed(handleFetchUserMessages),
|
|
63995
|
+
"fetch-session-transcript": routed(handleFetchSessionTranscript),
|
|
63417
63996
|
shutdown: handleShutdown
|
|
63418
63997
|
};
|
|
63419
63998
|
|
|
@@ -63501,7 +64080,7 @@ var handleSnapshotRequest = (client, m, d) => {
|
|
|
63501
64080
|
let data;
|
|
63502
64081
|
m.update((sessions) => {
|
|
63503
64082
|
const s = sessions.get(sessionId2);
|
|
63504
|
-
if (s) data = sessionSnapshot(s);
|
|
64083
|
+
if (s && !skipsTerminalPath(s, "snapshot")) data = sessionSnapshot(s);
|
|
63505
64084
|
return false;
|
|
63506
64085
|
});
|
|
63507
64086
|
daemonLog(
|
|
@@ -63771,7 +64350,7 @@ function isPrCheckoutArgs(args) {
|
|
|
63771
64350
|
|
|
63772
64351
|
// src/commands/sessions/daemon/worktree/prCheckoutHolder.ts
|
|
63773
64352
|
import { execFile as execFile16 } from "child_process";
|
|
63774
|
-
import { existsSync as
|
|
64353
|
+
import { existsSync as existsSync116 } from "fs";
|
|
63775
64354
|
function prHeadBranch2(number, cwd) {
|
|
63776
64355
|
const { headBranch } = prCliCommands(number, cwd);
|
|
63777
64356
|
return new Promise((resolve36) => {
|
|
@@ -63785,12 +64364,12 @@ function prHeadBranch2(number, cwd) {
|
|
|
63785
64364
|
}
|
|
63786
64365
|
async function prCheckoutHolder(assistArgs, cwd) {
|
|
63787
64366
|
const number = prCheckoutNumber(assistArgs);
|
|
63788
|
-
if (!number || !cwd || !
|
|
64367
|
+
if (!number || !cwd || !existsSync116(cwd)) return void 0;
|
|
63789
64368
|
const headRef = await prHeadBranch2(number, cwd);
|
|
63790
64369
|
if (!headRef) return void 0;
|
|
63791
64370
|
const listing = await gitOrNull(cwd, ["worktree", "list", "--porcelain"]);
|
|
63792
64371
|
const holder = listing ? worktreeWithBranch(listing, headRef) : null;
|
|
63793
|
-
if (!holder || !
|
|
64372
|
+
if (!holder || !existsSync116(holder)) return void 0;
|
|
63794
64373
|
daemonLog(
|
|
63795
64374
|
`pr #${number} assist ${assistArgs[0]} launched in its checkout ${holder}: head branch ${headRef} is already checked out there, so no worktree is allocated`
|
|
63796
64375
|
);
|
|
@@ -63821,14 +64400,14 @@ function spawnAssistCreate(m, d) {
|
|
|
63821
64400
|
},
|
|
63822
64401
|
spawnContextFrom(d)
|
|
63823
64402
|
);
|
|
63824
|
-
const
|
|
64403
|
+
const spawn15 = (holder) => m.spawnAssist(
|
|
63825
64404
|
assistArgs,
|
|
63826
64405
|
holder ?? cwd,
|
|
63827
64406
|
{ ...meta, inPlace: inPlace || holder !== void 0 },
|
|
63828
64407
|
spawnContextFrom(d)
|
|
63829
64408
|
);
|
|
63830
|
-
if (inPlace || !isPrCheckoutArgs(assistArgs)) return
|
|
63831
|
-
return prCheckoutHolder(assistArgs, cwd).then(
|
|
64409
|
+
if (inPlace || !isPrCheckoutArgs(assistArgs)) return spawn15();
|
|
64410
|
+
return prCheckoutHolder(assistArgs, cwd).then(spawn15);
|
|
63832
64411
|
}
|
|
63833
64412
|
|
|
63834
64413
|
// src/commands/sessions/daemon/sessionBlocker.ts
|
|
@@ -64017,7 +64596,7 @@ function handleConnection(socket, manager) {
|
|
|
64017
64596
|
import { unlinkSync as unlinkSync21, writeFileSync as writeFileSync65 } from "fs";
|
|
64018
64597
|
|
|
64019
64598
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
64020
|
-
import { readFileSync as
|
|
64599
|
+
import { readFileSync as readFileSync91 } from "fs";
|
|
64021
64600
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
64022
64601
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
64023
64602
|
const timer = setInterval(() => {
|
|
@@ -64028,7 +64607,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
64028
64607
|
}
|
|
64029
64608
|
function ownsPidFile() {
|
|
64030
64609
|
try {
|
|
64031
|
-
return
|
|
64610
|
+
return readFileSync91(daemonPaths.pid, "utf8").trim() === String(process.pid);
|
|
64032
64611
|
} catch {
|
|
64033
64612
|
return false;
|
|
64034
64613
|
}
|
|
@@ -64400,15 +64979,15 @@ function registerLinkCommand(nodes) {
|
|
|
64400
64979
|
// src/commands/sessions/nodes/awaitLinkReturn.ts
|
|
64401
64980
|
var POLL_MS8 = 1e3;
|
|
64402
64981
|
var wait = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
64403
|
-
async function linkStatus2(name2,
|
|
64404
|
-
return (await
|
|
64982
|
+
async function linkStatus2(name2, query2 = queryNodes) {
|
|
64983
|
+
return (await query2())?.links.find((l) => l.name === name2);
|
|
64405
64984
|
}
|
|
64406
64985
|
async function awaitLinkReturn(name2, options2, deps2 = {}) {
|
|
64407
|
-
const { query = queryNodes, sleep: sleep2 = wait, now = Date.now } = deps2;
|
|
64986
|
+
const { query: query2 = queryNodes, sleep: sleep2 = wait, now = Date.now } = deps2;
|
|
64408
64987
|
const deadline = now() + options2.timeoutMs;
|
|
64409
64988
|
let sawDown = options2.sawDown;
|
|
64410
64989
|
while (now() < deadline) {
|
|
64411
|
-
const link3 = await linkStatus2(name2,
|
|
64990
|
+
const link3 = await linkStatus2(name2, query2);
|
|
64412
64991
|
if (link3?.state !== "connected") sawDown = true;
|
|
64413
64992
|
else if (sawDown) return link3;
|
|
64414
64993
|
await sleep2(POLL_MS8);
|