@staff0rd/assist 0.564.0 → 0.565.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/sessions/web/bundle.js +62 -62
- package/dist/index.js +319 -219
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.565.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -676,8 +676,8 @@ function projectConfigPathFrom(cwd) {
|
|
|
676
676
|
const clone = linkedWorktree(cwd)?.clone;
|
|
677
677
|
return getConfigPathFrom(clone ?? cwd);
|
|
678
678
|
}
|
|
679
|
-
function loadConfigFrom(cwd) {
|
|
680
|
-
const globalRaw = loadRawYaml(
|
|
679
|
+
function loadConfigFrom(cwd, globalConfigPath = getGlobalConfigPath()) {
|
|
680
|
+
const globalRaw = loadRawYaml(globalConfigPath);
|
|
681
681
|
const projectRaw = loadRawYaml(projectConfigPathFrom(cwd));
|
|
682
682
|
const repoOverride = globalRaw.repos ? resolveRepoOverride(globalRaw, getCurrentOrigin(cwd)) : {};
|
|
683
683
|
const globalWithRepo = mergeRawConfigs(globalRaw, repoOverride);
|
|
@@ -698,11 +698,11 @@ function loadConfig() {
|
|
|
698
698
|
function loadProjectConfig(cwd = process.cwd()) {
|
|
699
699
|
return loadRawYaml(projectConfigPathFrom(cwd));
|
|
700
700
|
}
|
|
701
|
-
function loadGlobalConfigRaw() {
|
|
702
|
-
return loadRawYaml(
|
|
701
|
+
function loadGlobalConfigRaw(globalConfigPath = getGlobalConfigPath()) {
|
|
702
|
+
return loadRawYaml(globalConfigPath);
|
|
703
703
|
}
|
|
704
|
-
function saveGlobalConfig(config) {
|
|
705
|
-
writeFileSync(
|
|
704
|
+
function saveGlobalConfig(config, globalConfigPath = getGlobalConfigPath()) {
|
|
705
|
+
writeFileSync(globalConfigPath, stringifyYaml(config, { lineWidth: 0 }));
|
|
706
706
|
}
|
|
707
707
|
function saveConfig(config, cwd = process.cwd()) {
|
|
708
708
|
const configPath = projectConfigPathFrom(cwd);
|
|
@@ -10995,6 +10995,73 @@ async function getBackups(_req, res) {
|
|
|
10995
10995
|
respondJson(res, 200, await listBackups(await getDb()));
|
|
10996
10996
|
}
|
|
10997
10997
|
|
|
10998
|
+
// src/shared/globalConfigTargetFor.ts
|
|
10999
|
+
import { existsSync as existsSync30 } from "fs";
|
|
11000
|
+
import { posix as posix2 } from "path";
|
|
11001
|
+
|
|
11002
|
+
// src/shared/windowsHomeFromWsl.ts
|
|
11003
|
+
import { posix } from "path";
|
|
11004
|
+
function windowsHomeFromWsl() {
|
|
11005
|
+
const projectsRootUnderWinHome = loadConfig().sessions?.windowsProjectsRoot;
|
|
11006
|
+
if (!projectsRootUnderWinHome) return null;
|
|
11007
|
+
return posix.dirname(posix.dirname(projectsRootUnderWinHome));
|
|
11008
|
+
}
|
|
11009
|
+
|
|
11010
|
+
// src/shared/globalConfigTargetFor.ts
|
|
11011
|
+
function globalConfigTargetFor(cwd) {
|
|
11012
|
+
if (!shouldProxyToWindows(cwd))
|
|
11013
|
+
return { ok: true, path: getGlobalConfigPath() };
|
|
11014
|
+
const winHome = windowsHomeFromWsl();
|
|
11015
|
+
if (!winHome)
|
|
11016
|
+
return {
|
|
11017
|
+
ok: false,
|
|
11018
|
+
error: `${cwd} runs on the Windows host, whose ~/.assist.yml cannot be located because sessions.windowsProjectsRoot is unset. Set it with: assist config set sessions.windowsProjectsRoot /mnt/c/Users/<you>/.claude/projects`
|
|
11019
|
+
};
|
|
11020
|
+
if (!existsSync30(winHome))
|
|
11021
|
+
return {
|
|
11022
|
+
ok: false,
|
|
11023
|
+
error: `${cwd} runs on the Windows host, whose home ${winHome} is not reachable from here. Check that the Windows drive is mounted and sessions.windowsProjectsRoot points at it.`
|
|
11024
|
+
};
|
|
11025
|
+
return { ok: true, path: posix2.join(winHome, ".assist.yml") };
|
|
11026
|
+
}
|
|
11027
|
+
|
|
11028
|
+
// src/commands/config/globalConfigFileLabel.ts
|
|
11029
|
+
var WINDOWS_MOUNT_PREFIX = "/mnt/";
|
|
11030
|
+
function globalConfigFileLabel(path80) {
|
|
11031
|
+
if (path80 === getGlobalConfigPath()) return "~/.assist.yml";
|
|
11032
|
+
if (path80.startsWith(WINDOWS_MOUNT_PREFIX))
|
|
11033
|
+
return `${path80} on the Windows host`;
|
|
11034
|
+
return path80;
|
|
11035
|
+
}
|
|
11036
|
+
|
|
11037
|
+
// src/commands/config/readRawConfigLayers.ts
|
|
11038
|
+
function readRawConfigLayers(cwd, globalConfigPath = getGlobalConfigPath()) {
|
|
11039
|
+
const global = loadRawYaml(globalConfigPath);
|
|
11040
|
+
if (!global.repos)
|
|
11041
|
+
return {
|
|
11042
|
+
project: loadRawYaml(projectConfigPathFrom(cwd)),
|
|
11043
|
+
global,
|
|
11044
|
+
repoOverride: {}
|
|
11045
|
+
};
|
|
11046
|
+
const origin = getCurrentOrigin(cwd);
|
|
11047
|
+
return {
|
|
11048
|
+
project: loadRawYaml(projectConfigPathFrom(cwd)),
|
|
11049
|
+
global,
|
|
11050
|
+
repoOverride: resolveRepoOverride(global, origin),
|
|
11051
|
+
repoKey: matchRepoConfigKey(global, origin)
|
|
11052
|
+
};
|
|
11053
|
+
}
|
|
11054
|
+
|
|
11055
|
+
// src/commands/config/configEntryContext.ts
|
|
11056
|
+
function configEntryContext(cwd, globalConfigPath) {
|
|
11057
|
+
return {
|
|
11058
|
+
config: loadConfigFrom(cwd, globalConfigPath),
|
|
11059
|
+
layers: readRawConfigLayers(cwd, globalConfigPath),
|
|
11060
|
+
globalConfigFile: globalConfigFileLabel(globalConfigPath),
|
|
11061
|
+
schema: describeConfigNode(assistConfigSchema)
|
|
11062
|
+
};
|
|
11063
|
+
}
|
|
11064
|
+
|
|
10998
11065
|
// src/shared/configNodeFieldName.ts
|
|
10999
11066
|
function configNodeFieldName(node) {
|
|
11000
11067
|
const last = node.path.at(-1);
|
|
@@ -11067,13 +11134,6 @@ function redactConfigSecrets(value, node) {
|
|
|
11067
11134
|
return mapConfigSecrets(value, node, () => REDACTED_SECRET);
|
|
11068
11135
|
}
|
|
11069
11136
|
|
|
11070
|
-
// src/commands/config/configHelpForKey.ts
|
|
11071
|
-
var byKey;
|
|
11072
|
-
function configHelpForKey(key) {
|
|
11073
|
-
byKey ??= new Map(configHelpEntries.map((entry) => [entry.key, entry]));
|
|
11074
|
-
return byKey.get(key);
|
|
11075
|
-
}
|
|
11076
|
-
|
|
11077
11137
|
// src/commands/config/getNestedValue.ts
|
|
11078
11138
|
function isTraversable(value) {
|
|
11079
11139
|
return value !== null && value !== void 0 && typeof value === "object";
|
|
@@ -11102,41 +11162,6 @@ function configEntryLayers(key, layers, node) {
|
|
|
11102
11162
|
return entryLayers;
|
|
11103
11163
|
}
|
|
11104
11164
|
|
|
11105
|
-
// src/commands/config/isGlobalOnlyConfigKey.ts
|
|
11106
|
-
var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
11107
|
-
function isGlobalOnlyConfigKey(key) {
|
|
11108
|
-
return GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k));
|
|
11109
|
-
}
|
|
11110
|
-
|
|
11111
|
-
// src/commands/config/readRawConfigLayers.ts
|
|
11112
|
-
function readRawConfigLayers(cwd) {
|
|
11113
|
-
const global = loadRawYaml(getGlobalConfigPath());
|
|
11114
|
-
if (!global.repos)
|
|
11115
|
-
return {
|
|
11116
|
-
project: loadRawYaml(projectConfigPathFrom(cwd)),
|
|
11117
|
-
global,
|
|
11118
|
-
repoOverride: {}
|
|
11119
|
-
};
|
|
11120
|
-
const origin = getCurrentOrigin(cwd);
|
|
11121
|
-
return {
|
|
11122
|
-
project: loadRawYaml(projectConfigPathFrom(cwd)),
|
|
11123
|
-
global,
|
|
11124
|
-
repoOverride: resolveRepoOverride(global, origin),
|
|
11125
|
-
repoKey: matchRepoConfigKey(global, origin)
|
|
11126
|
-
};
|
|
11127
|
-
}
|
|
11128
|
-
|
|
11129
|
-
// src/commands/config/resolveConfigSources.ts
|
|
11130
|
-
function resolveConfigSources(key, layers) {
|
|
11131
|
-
const sources = [];
|
|
11132
|
-
if (getNestedValue(layers.project, key) !== void 0)
|
|
11133
|
-
sources.push("project");
|
|
11134
|
-
if (getNestedValue(layers.repoOverride, key) !== void 0)
|
|
11135
|
-
sources.push("repo");
|
|
11136
|
-
if (getNestedValue(layers.global, key) !== void 0) sources.push("global");
|
|
11137
|
-
return sources;
|
|
11138
|
-
}
|
|
11139
|
-
|
|
11140
11165
|
// src/shared/findConfigNode.ts
|
|
11141
11166
|
function objectField(node, segment) {
|
|
11142
11167
|
if (segment.kind !== "key") return void 0;
|
|
@@ -11217,38 +11242,68 @@ function configEntryNode(root, key) {
|
|
|
11217
11242
|
return path80 ? findConfigNode(root, path80) : void 0;
|
|
11218
11243
|
}
|
|
11219
11244
|
|
|
11245
|
+
// src/commands/config/configHelpForKey.ts
|
|
11246
|
+
var byKey;
|
|
11247
|
+
function configHelpForKey(key) {
|
|
11248
|
+
byKey ??= new Map(configHelpEntries.map((entry) => [entry.key, entry]));
|
|
11249
|
+
return byKey.get(key);
|
|
11250
|
+
}
|
|
11251
|
+
|
|
11252
|
+
// src/commands/config/isGlobalOnlyConfigKey.ts
|
|
11253
|
+
var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
11254
|
+
function isGlobalOnlyConfigKey(key) {
|
|
11255
|
+
return GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k));
|
|
11256
|
+
}
|
|
11257
|
+
|
|
11258
|
+
// src/commands/config/resolveConfigSources.ts
|
|
11259
|
+
function resolveConfigSources(key, layers) {
|
|
11260
|
+
const sources = [];
|
|
11261
|
+
if (getNestedValue(layers.project, key) !== void 0)
|
|
11262
|
+
sources.push("project");
|
|
11263
|
+
if (getNestedValue(layers.repoOverride, key) !== void 0)
|
|
11264
|
+
sources.push("repo");
|
|
11265
|
+
if (getNestedValue(layers.global, key) !== void 0) sources.push("global");
|
|
11266
|
+
return sources;
|
|
11267
|
+
}
|
|
11268
|
+
|
|
11269
|
+
// src/commands/config/configEntryFor.ts
|
|
11270
|
+
function configEntryFor(leaf, { config, layers, globalConfigFile, schema: schema2 }) {
|
|
11271
|
+
const sources = resolveConfigSources(leaf.key, layers);
|
|
11272
|
+
const node = configEntryNode(schema2, leaf.key);
|
|
11273
|
+
const help = configHelpForKey(leaf.key);
|
|
11274
|
+
return {
|
|
11275
|
+
...leaf,
|
|
11276
|
+
...help ? { note: help.note, setter: help.setter } : {},
|
|
11277
|
+
...leaf.defaultValue === void 0 ? {} : { defaultValue: redactConfigSecrets(leaf.defaultValue, node) },
|
|
11278
|
+
value: redactConfigSecrets(getNestedValue(config, leaf.key), node),
|
|
11279
|
+
source: sources[0] ?? "default",
|
|
11280
|
+
sources,
|
|
11281
|
+
layers: configEntryLayers(leaf.key, layers, node),
|
|
11282
|
+
...layers.repoKey ? { repoKey: layers.repoKey } : {},
|
|
11283
|
+
globalConfigFile,
|
|
11284
|
+
globalOnly: isGlobalOnlyConfigKey(leaf.key),
|
|
11285
|
+
node
|
|
11286
|
+
};
|
|
11287
|
+
}
|
|
11288
|
+
|
|
11220
11289
|
// src/commands/config/readConfigEntries.ts
|
|
11221
11290
|
var KEYS_STRIPPED_FROM_MERGED_CONFIG = /* @__PURE__ */ new Set(["repos"]);
|
|
11222
|
-
function readConfigEntries(cwd) {
|
|
11223
|
-
const
|
|
11224
|
-
|
|
11225
|
-
const schema2 = describeConfigNode(assistConfigSchema);
|
|
11226
|
-
return describeConfigLeaves(assistConfigSchema).filter((leaf) => !KEYS_STRIPPED_FROM_MERGED_CONFIG.has(leaf.key)).map((leaf) => {
|
|
11227
|
-
const sources = resolveConfigSources(leaf.key, layers);
|
|
11228
|
-
const source = sources[0] ?? "default";
|
|
11229
|
-
const node = configEntryNode(schema2, leaf.key);
|
|
11230
|
-
const help = configHelpForKey(leaf.key);
|
|
11231
|
-
return {
|
|
11232
|
-
...leaf,
|
|
11233
|
-
...help ? { note: help.note, setter: help.setter } : {},
|
|
11234
|
-
...leaf.defaultValue === void 0 ? {} : { defaultValue: redactConfigSecrets(leaf.defaultValue, node) },
|
|
11235
|
-
value: redactConfigSecrets(getNestedValue(config, leaf.key), node),
|
|
11236
|
-
source,
|
|
11237
|
-
sources,
|
|
11238
|
-
layers: configEntryLayers(leaf.key, layers, node),
|
|
11239
|
-
...layers.repoKey ? { repoKey: layers.repoKey } : {},
|
|
11240
|
-
globalOnly: isGlobalOnlyConfigKey(leaf.key),
|
|
11241
|
-
node
|
|
11242
|
-
};
|
|
11243
|
-
});
|
|
11291
|
+
function readConfigEntries(cwd, globalConfigPath = getGlobalConfigPath()) {
|
|
11292
|
+
const context = configEntryContext(cwd, globalConfigPath);
|
|
11293
|
+
return describeConfigLeaves(assistConfigSchema).filter((leaf) => !KEYS_STRIPPED_FROM_MERGED_CONFIG.has(leaf.key)).map((leaf) => configEntryFor(leaf, context));
|
|
11244
11294
|
}
|
|
11245
11295
|
|
|
11246
11296
|
// src/commands/sessions/web/getConfig.ts
|
|
11247
11297
|
function getConfig(req, res) {
|
|
11248
11298
|
const cwd = getCwdParam(req, res);
|
|
11249
11299
|
if (!cwd) return;
|
|
11300
|
+
const target = globalConfigTargetFor(cwd);
|
|
11301
|
+
if (!target.ok) {
|
|
11302
|
+
respondJson(res, 500, { error: target.error });
|
|
11303
|
+
return;
|
|
11304
|
+
}
|
|
11250
11305
|
try {
|
|
11251
|
-
respondJson(res, 200, readConfigEntries(toGitCwd(cwd)));
|
|
11306
|
+
respondJson(res, 200, readConfigEntries(toGitCwd(cwd), target.path));
|
|
11252
11307
|
} catch (error) {
|
|
11253
11308
|
respondJson(res, 500, {
|
|
11254
11309
|
error: error instanceof Error ? error.message : "Failed to read config"
|
|
@@ -11312,14 +11367,14 @@ import { basename as basename9, join as join30 } from "path";
|
|
|
11312
11367
|
import { promisify as promisify3 } from "util";
|
|
11313
11368
|
|
|
11314
11369
|
// src/commands/sessions/web/findSynthesisForBranch.ts
|
|
11315
|
-
import { existsSync as
|
|
11370
|
+
import { existsSync as existsSync31, readdirSync as readdirSync2, statSync as statSync4 } from "fs";
|
|
11316
11371
|
import { basename as basename8, dirname as dirname21, join as join29 } from "path";
|
|
11317
11372
|
function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
11318
11373
|
const branchKeyPath = join29(repoReviewsDir, `${branch2}-`);
|
|
11319
11374
|
const parent = dirname21(branchKeyPath);
|
|
11320
11375
|
const branchPrefix = basename8(branchKeyPath);
|
|
11321
|
-
if (!
|
|
11322
|
-
const synthesisFiles = readdirSync2(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join29(parent, name, "synthesis.md")).filter((path80) =>
|
|
11376
|
+
if (!existsSync31(parent)) return null;
|
|
11377
|
+
const synthesisFiles = readdirSync2(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join29(parent, name, "synthesis.md")).filter((path80) => existsSync31(path80)).map((path80) => ({ path: path80, mtime: statSync4(path80).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
|
|
11323
11378
|
return synthesisFiles[0]?.path ?? null;
|
|
11324
11379
|
}
|
|
11325
11380
|
|
|
@@ -12342,10 +12397,10 @@ function restoreConfigSecrets(value, stored, node) {
|
|
|
12342
12397
|
}
|
|
12343
12398
|
|
|
12344
12399
|
// src/commands/config/restoreConfigWriteSecrets.ts
|
|
12345
|
-
function restoreConfigWriteSecrets(key, value, cwd) {
|
|
12400
|
+
function restoreConfigWriteSecrets(key, value, cwd, globalConfigPath) {
|
|
12346
12401
|
const node = configKeyNode(key);
|
|
12347
12402
|
if (!node) return value;
|
|
12348
|
-
const stored = loadConfigFrom(cwd);
|
|
12403
|
+
const stored = loadConfigFrom(cwd, globalConfigPath);
|
|
12349
12404
|
return restoreConfigSecrets(value, getNestedValue(stored, key), node);
|
|
12350
12405
|
}
|
|
12351
12406
|
|
|
@@ -12413,7 +12468,7 @@ function formatIssue2(issue, key) {
|
|
|
12413
12468
|
}
|
|
12414
12469
|
|
|
12415
12470
|
// src/commands/config/applyConfigSet.ts
|
|
12416
|
-
function applyConfigSet(key, coerced, global, cwd = process.cwd()) {
|
|
12471
|
+
function applyConfigSet(key, coerced, global, cwd = process.cwd(), globalConfigPath) {
|
|
12417
12472
|
if (!global && isGlobalOnlyConfigKey(key)) {
|
|
12418
12473
|
return {
|
|
12419
12474
|
ok: false,
|
|
@@ -12422,12 +12477,12 @@ function applyConfigSet(key, coerced, global, cwd = process.cwd()) {
|
|
|
12422
12477
|
]
|
|
12423
12478
|
};
|
|
12424
12479
|
}
|
|
12425
|
-
const raw = global ? loadGlobalConfigRaw() : loadProjectConfig(cwd);
|
|
12480
|
+
const raw = global ? loadGlobalConfigRaw(globalConfigPath) : loadProjectConfig(cwd);
|
|
12426
12481
|
const updated = setNestedValue(raw, key, coerced);
|
|
12427
12482
|
const validation = validateConfig(updated, key);
|
|
12428
12483
|
if (!validation.ok) return validation;
|
|
12429
12484
|
if (global) {
|
|
12430
|
-
saveGlobalConfig(updated);
|
|
12485
|
+
saveGlobalConfig(updated, globalConfigPath);
|
|
12431
12486
|
return { ok: true, target: "global" };
|
|
12432
12487
|
}
|
|
12433
12488
|
saveConfig(updated, cwd);
|
|
@@ -12457,8 +12512,8 @@ function resolveNamedRepoWriteLabel(globalRaw, name) {
|
|
|
12457
12512
|
}
|
|
12458
12513
|
|
|
12459
12514
|
// src/commands/config/resolveRepoConfigBlock.ts
|
|
12460
|
-
function resolveRepoConfigBlock(repoName, cwd) {
|
|
12461
|
-
const globalRaw = loadGlobalConfigRaw();
|
|
12515
|
+
function resolveRepoConfigBlock(repoName, cwd, globalConfigPath) {
|
|
12516
|
+
const globalRaw = loadGlobalConfigRaw(globalConfigPath);
|
|
12462
12517
|
const label2 = repoName === void 0 ? resolveRepoWriteLabel(globalRaw, getCurrentOrigin(cwd)) : resolveNamedRepoWriteLabel(globalRaw, repoName);
|
|
12463
12518
|
const repos2 = isPlainObject3(globalRaw.repos) ? { ...globalRaw.repos } : {};
|
|
12464
12519
|
const block = isPlainObject3(repos2[label2]) ? repos2[label2] : {};
|
|
@@ -12469,7 +12524,7 @@ function isPlainObject3(value) {
|
|
|
12469
12524
|
}
|
|
12470
12525
|
|
|
12471
12526
|
// src/commands/config/applyRepoConfigSet.ts
|
|
12472
|
-
function applyRepoConfigSet(key, coerced, repoName, cwd = process.cwd()) {
|
|
12527
|
+
function applyRepoConfigSet(key, coerced, repoName, cwd = process.cwd(), globalConfigPath) {
|
|
12473
12528
|
if (isGlobalOnlyConfigKey(key)) {
|
|
12474
12529
|
return {
|
|
12475
12530
|
ok: false,
|
|
@@ -12480,23 +12535,36 @@ function applyRepoConfigSet(key, coerced, repoName, cwd = process.cwd()) {
|
|
|
12480
12535
|
}
|
|
12481
12536
|
const { globalRaw, repos: repos2, label: label2, block } = resolveRepoConfigBlock(
|
|
12482
12537
|
repoName,
|
|
12483
|
-
cwd
|
|
12538
|
+
cwd,
|
|
12539
|
+
globalConfigPath
|
|
12484
12540
|
);
|
|
12485
12541
|
const updatedBlock = setNestedValue(block, key, coerced);
|
|
12486
12542
|
const validation = validateConfig(updatedBlock, key, repoConfigSchema);
|
|
12487
12543
|
if (!validation.ok) return validation;
|
|
12488
12544
|
repos2[label2] = updatedBlock;
|
|
12489
|
-
saveGlobalConfig({ ...globalRaw, repos: repos2 });
|
|
12545
|
+
saveGlobalConfig({ ...globalRaw, repos: repos2 }, globalConfigPath);
|
|
12490
12546
|
return { ok: true, target: "repo", label: label2 };
|
|
12491
12547
|
}
|
|
12492
12548
|
|
|
12493
12549
|
// src/commands/sessions/web/applyScopedConfigSet.ts
|
|
12494
|
-
function applyScopedConfigSet(key, value, cwd, scope) {
|
|
12550
|
+
function applyScopedConfigSet(key, value, cwd, scope, globalConfigPath) {
|
|
12495
12551
|
if (scope === "repo") {
|
|
12496
|
-
const result2 = applyRepoConfigSet(
|
|
12552
|
+
const result2 = applyRepoConfigSet(
|
|
12553
|
+
key,
|
|
12554
|
+
value,
|
|
12555
|
+
void 0,
|
|
12556
|
+
cwd,
|
|
12557
|
+
globalConfigPath
|
|
12558
|
+
);
|
|
12497
12559
|
return result2.ok ? { ok: true, payload: { target: result2.target, repoKey: result2.label } } : result2;
|
|
12498
12560
|
}
|
|
12499
|
-
const result = applyConfigSet(
|
|
12561
|
+
const result = applyConfigSet(
|
|
12562
|
+
key,
|
|
12563
|
+
value,
|
|
12564
|
+
scope === "global",
|
|
12565
|
+
cwd,
|
|
12566
|
+
globalConfigPath
|
|
12567
|
+
);
|
|
12500
12568
|
return result.ok ? { ok: true, payload: { target: result.target } } : result;
|
|
12501
12569
|
}
|
|
12502
12570
|
|
|
@@ -12530,8 +12598,17 @@ async function handleConfigWrite(req, res, apply) {
|
|
|
12530
12598
|
respondJson(res, 400, { error: parsed.error });
|
|
12531
12599
|
return;
|
|
12532
12600
|
}
|
|
12601
|
+
const target = globalConfigTargetFor(parsed.cwd);
|
|
12602
|
+
if (!target.ok) {
|
|
12603
|
+
respondJson(res, 400, { error: target.error, errors: [target.error] });
|
|
12604
|
+
return;
|
|
12605
|
+
}
|
|
12533
12606
|
try {
|
|
12534
|
-
const result = apply({
|
|
12607
|
+
const result = apply({
|
|
12608
|
+
...parsed,
|
|
12609
|
+
cwd: toGitCwd(parsed.cwd),
|
|
12610
|
+
globalConfigPath: target.path
|
|
12611
|
+
});
|
|
12535
12612
|
if (!result.ok) {
|
|
12536
12613
|
respondJson(res, 400, {
|
|
12537
12614
|
error: result.errors.join("\n"),
|
|
@@ -12552,14 +12629,20 @@ function setConfig(req, res) {
|
|
|
12552
12629
|
return handleConfigWrite(req, res, (request) => {
|
|
12553
12630
|
const coerced = coerceConfigValue(
|
|
12554
12631
|
request.key,
|
|
12555
|
-
restoreConfigWriteSecrets(
|
|
12632
|
+
restoreConfigWriteSecrets(
|
|
12633
|
+
request.key,
|
|
12634
|
+
request.value,
|
|
12635
|
+
request.cwd,
|
|
12636
|
+
request.globalConfigPath
|
|
12637
|
+
)
|
|
12556
12638
|
);
|
|
12557
12639
|
if (!coerced.ok) return { ok: false, errors: [coerced.error] };
|
|
12558
12640
|
return applyScopedConfigSet(
|
|
12559
12641
|
request.key,
|
|
12560
12642
|
coerced.value,
|
|
12561
12643
|
request.cwd,
|
|
12562
|
-
request.scope
|
|
12644
|
+
request.scope,
|
|
12645
|
+
request.globalConfigPath
|
|
12563
12646
|
);
|
|
12564
12647
|
});
|
|
12565
12648
|
}
|
|
@@ -12639,7 +12722,7 @@ function unsetNestedValue(obj, path80) {
|
|
|
12639
12722
|
}
|
|
12640
12723
|
|
|
12641
12724
|
// src/commands/config/applyConfigUnset.ts
|
|
12642
|
-
function applyConfigUnset(key, global, cwd = process.cwd()) {
|
|
12725
|
+
function applyConfigUnset(key, global, cwd = process.cwd(), globalConfigPath) {
|
|
12643
12726
|
if (!global && isGlobalOnlyConfigKey(key)) {
|
|
12644
12727
|
return {
|
|
12645
12728
|
ok: false,
|
|
@@ -12649,18 +12732,18 @@ function applyConfigUnset(key, global, cwd = process.cwd()) {
|
|
|
12649
12732
|
};
|
|
12650
12733
|
}
|
|
12651
12734
|
const target = global ? "global" : "project";
|
|
12652
|
-
const raw = global ? loadGlobalConfigRaw() : loadProjectConfig(cwd);
|
|
12735
|
+
const raw = global ? loadGlobalConfigRaw(globalConfigPath) : loadProjectConfig(cwd);
|
|
12653
12736
|
const { config, removed } = unsetNestedValue(raw, key);
|
|
12654
12737
|
if (!removed) return { ok: true, target, removed: false };
|
|
12655
12738
|
const validation = validateConfig(config, key);
|
|
12656
12739
|
if (!validation.ok) return validation;
|
|
12657
|
-
if (global) saveGlobalConfig(config);
|
|
12740
|
+
if (global) saveGlobalConfig(config, globalConfigPath);
|
|
12658
12741
|
else saveConfig(config, cwd);
|
|
12659
12742
|
return { ok: true, target, removed: true };
|
|
12660
12743
|
}
|
|
12661
12744
|
|
|
12662
12745
|
// src/commands/config/applyRepoConfigUnset.ts
|
|
12663
|
-
function applyRepoConfigUnset(key, repoName, cwd = process.cwd()) {
|
|
12746
|
+
function applyRepoConfigUnset(key, repoName, cwd = process.cwd(), globalConfigPath) {
|
|
12664
12747
|
if (isGlobalOnlyConfigKey(key)) {
|
|
12665
12748
|
return {
|
|
12666
12749
|
ok: false,
|
|
@@ -12671,7 +12754,8 @@ function applyRepoConfigUnset(key, repoName, cwd = process.cwd()) {
|
|
|
12671
12754
|
}
|
|
12672
12755
|
const { globalRaw, repos: repos2, label: label2, block } = resolveRepoConfigBlock(
|
|
12673
12756
|
repoName,
|
|
12674
|
-
cwd
|
|
12757
|
+
cwd,
|
|
12758
|
+
globalConfigPath
|
|
12675
12759
|
);
|
|
12676
12760
|
const { config: updatedBlock, removed } = unsetNestedValue(block, key);
|
|
12677
12761
|
if (!removed) return { ok: true, target: "repo", label: label2, removed: false };
|
|
@@ -12682,14 +12766,14 @@ function applyRepoConfigUnset(key, repoName, cwd = process.cwd()) {
|
|
|
12682
12766
|
const next3 = { ...globalRaw };
|
|
12683
12767
|
if (Object.keys(repos2).length === 0) delete next3.repos;
|
|
12684
12768
|
else next3.repos = repos2;
|
|
12685
|
-
saveGlobalConfig(next3);
|
|
12769
|
+
saveGlobalConfig(next3, globalConfigPath);
|
|
12686
12770
|
return { ok: true, target: "repo", label: label2, removed: true };
|
|
12687
12771
|
}
|
|
12688
12772
|
|
|
12689
12773
|
// src/commands/sessions/web/applyScopedConfigUnset.ts
|
|
12690
|
-
function applyScopedConfigUnset(key, cwd, scope) {
|
|
12774
|
+
function applyScopedConfigUnset(key, cwd, scope, globalConfigPath) {
|
|
12691
12775
|
if (scope === "repo") {
|
|
12692
|
-
const result2 = applyRepoConfigUnset(key, void 0, cwd);
|
|
12776
|
+
const result2 = applyRepoConfigUnset(key, void 0, cwd, globalConfigPath);
|
|
12693
12777
|
return result2.ok ? {
|
|
12694
12778
|
ok: true,
|
|
12695
12779
|
payload: {
|
|
@@ -12699,7 +12783,12 @@ function applyScopedConfigUnset(key, cwd, scope) {
|
|
|
12699
12783
|
}
|
|
12700
12784
|
} : result2;
|
|
12701
12785
|
}
|
|
12702
|
-
const result = applyConfigUnset(
|
|
12786
|
+
const result = applyConfigUnset(
|
|
12787
|
+
key,
|
|
12788
|
+
scope === "global",
|
|
12789
|
+
cwd,
|
|
12790
|
+
globalConfigPath
|
|
12791
|
+
);
|
|
12703
12792
|
return result.ok ? { ok: true, payload: { target: result.target, removed: result.removed } } : result;
|
|
12704
12793
|
}
|
|
12705
12794
|
|
|
@@ -12708,7 +12797,12 @@ function unsetConfig(req, res) {
|
|
|
12708
12797
|
return handleConfigWrite(req, res, (request) => {
|
|
12709
12798
|
if (!isKnownConfigKey(request.key))
|
|
12710
12799
|
return { ok: false, errors: [`Unknown config key "${request.key}"`] };
|
|
12711
|
-
return applyScopedConfigUnset(
|
|
12800
|
+
return applyScopedConfigUnset(
|
|
12801
|
+
request.key,
|
|
12802
|
+
request.cwd,
|
|
12803
|
+
request.scope,
|
|
12804
|
+
request.globalConfigPath
|
|
12805
|
+
);
|
|
12712
12806
|
});
|
|
12713
12807
|
}
|
|
12714
12808
|
|
|
@@ -12844,7 +12938,7 @@ import { readFile as readFile2, stat as stat3, writeFile as writeFile3 } from "f
|
|
|
12844
12938
|
|
|
12845
12939
|
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
12846
12940
|
import { execFile as execFile8 } from "child_process";
|
|
12847
|
-
import { existsSync as
|
|
12941
|
+
import { existsSync as existsSync32 } from "fs";
|
|
12848
12942
|
import { dirname as dirname22, join as join32 } from "path";
|
|
12849
12943
|
import { promisify as promisify8 } from "util";
|
|
12850
12944
|
var execFileAsync7 = promisify8(execFile8);
|
|
@@ -12853,7 +12947,7 @@ function findOxfmtScript(root) {
|
|
|
12853
12947
|
let dir = root;
|
|
12854
12948
|
for (; ; ) {
|
|
12855
12949
|
const candidate = join32(dir, "node_modules", "oxfmt", "bin", "oxfmt");
|
|
12856
|
-
if (
|
|
12950
|
+
if (existsSync32(candidate)) return candidate;
|
|
12857
12951
|
const parent = dirname22(dir);
|
|
12858
12952
|
if (parent === dir) return void 0;
|
|
12859
12953
|
dir = parent;
|
|
@@ -13726,7 +13820,7 @@ function registerAssociateJiraCommand(cmd) {
|
|
|
13726
13820
|
|
|
13727
13821
|
// src/commands/backlog/cloneRepo.ts
|
|
13728
13822
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
13729
|
-
import { existsSync as
|
|
13823
|
+
import { existsSync as existsSync34 } from "fs";
|
|
13730
13824
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
13731
13825
|
import chalk70 from "chalk";
|
|
13732
13826
|
|
|
@@ -13762,7 +13856,7 @@ async function cloneRepo(originRaw) {
|
|
|
13762
13856
|
if (!target) {
|
|
13763
13857
|
return fail2(`Could not derive a repository name from "${origin}".`);
|
|
13764
13858
|
}
|
|
13765
|
-
if (
|
|
13859
|
+
if (existsSync34(target)) {
|
|
13766
13860
|
return fail2(`Clone target already exists: ${target}`);
|
|
13767
13861
|
}
|
|
13768
13862
|
await mkdir3(baseDir, { recursive: true });
|
|
@@ -13900,8 +13994,7 @@ async function reviewProposedComment(item, text18) {
|
|
|
13900
13994
|
title: `Comment on ${formatItemId(item.id)}: ${item.name}`,
|
|
13901
13995
|
body: text18,
|
|
13902
13996
|
prNumber: null,
|
|
13903
|
-
kind: "backlog-
|
|
13904
|
-
itemType: item.type
|
|
13997
|
+
kind: "backlog-comment"
|
|
13905
13998
|
});
|
|
13906
13999
|
}
|
|
13907
14000
|
|
|
@@ -16733,7 +16826,7 @@ function extractGraphqlQuery(args) {
|
|
|
16733
16826
|
}
|
|
16734
16827
|
|
|
16735
16828
|
// src/shared/loadCliReads.ts
|
|
16736
|
-
import { existsSync as
|
|
16829
|
+
import { existsSync as existsSync35, readFileSync as readFileSync25, writeFileSync as writeFileSync22 } from "fs";
|
|
16737
16830
|
import { dirname as dirname23, resolve as resolve12 } from "path";
|
|
16738
16831
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
16739
16832
|
var __filename3 = fileURLToPath5(import.meta.url);
|
|
@@ -16742,7 +16835,7 @@ function packageRoot() {
|
|
|
16742
16835
|
return __dirname4;
|
|
16743
16836
|
}
|
|
16744
16837
|
function readLines(path80) {
|
|
16745
|
-
if (!
|
|
16838
|
+
if (!existsSync35(path80)) return [];
|
|
16746
16839
|
return readFileSync25(path80, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
16747
16840
|
}
|
|
16748
16841
|
var cachedReads;
|
|
@@ -16789,7 +16882,7 @@ function findCliWrite(command) {
|
|
|
16789
16882
|
}
|
|
16790
16883
|
|
|
16791
16884
|
// src/shared/readSettingsPerms.ts
|
|
16792
|
-
import { existsSync as
|
|
16885
|
+
import { existsSync as existsSync36, readFileSync as readFileSync26 } from "fs";
|
|
16793
16886
|
import { homedir as homedir15 } from "os";
|
|
16794
16887
|
import { join as join37 } from "path";
|
|
16795
16888
|
function readSettingsPerms(key) {
|
|
@@ -16805,7 +16898,7 @@ function readSettingsPerms(key) {
|
|
|
16805
16898
|
return entries;
|
|
16806
16899
|
}
|
|
16807
16900
|
function readPermissionArray(filePath, key) {
|
|
16808
|
-
if (!
|
|
16901
|
+
if (!existsSync36(filePath)) return [];
|
|
16809
16902
|
try {
|
|
16810
16903
|
const data = JSON.parse(readFileSync26(filePath, "utf8"));
|
|
16811
16904
|
const arr = data?.permissions?.[key];
|
|
@@ -17150,7 +17243,7 @@ ${reasons.join("\n")}`);
|
|
|
17150
17243
|
}
|
|
17151
17244
|
|
|
17152
17245
|
// src/commands/permitCliReads/index.ts
|
|
17153
|
-
import { existsSync as
|
|
17246
|
+
import { existsSync as existsSync37, mkdirSync as mkdirSync13, readFileSync as readFileSync27, writeFileSync as writeFileSync23 } from "fs";
|
|
17154
17247
|
import { homedir as homedir17 } from "os";
|
|
17155
17248
|
import { join as join39 } from "path";
|
|
17156
17249
|
|
|
@@ -17419,7 +17512,7 @@ function logPath(cli) {
|
|
|
17419
17512
|
}
|
|
17420
17513
|
function readCache(cli) {
|
|
17421
17514
|
const path80 = logPath(cli);
|
|
17422
|
-
if (!
|
|
17515
|
+
if (!existsSync37(path80)) return void 0;
|
|
17423
17516
|
return readFileSync27(path80, "utf8");
|
|
17424
17517
|
}
|
|
17425
17518
|
function writeCache(cli, output) {
|
|
@@ -17554,7 +17647,7 @@ function registerCliHook(program2) {
|
|
|
17554
17647
|
}
|
|
17555
17648
|
|
|
17556
17649
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
17557
|
-
import { existsSync as
|
|
17650
|
+
import { existsSync as existsSync39, readFileSync as readFileSync29, unlinkSync as unlinkSync8, writeFileSync as writeFileSync24 } from "fs";
|
|
17558
17651
|
import chalk122 from "chalk";
|
|
17559
17652
|
|
|
17560
17653
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
@@ -17590,10 +17683,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
17590
17683
|
}
|
|
17591
17684
|
|
|
17592
17685
|
// src/commands/codeComment/readPinState.ts
|
|
17593
|
-
import { existsSync as
|
|
17686
|
+
import { existsSync as existsSync38, readFileSync as readFileSync28 } from "fs";
|
|
17594
17687
|
function readPinState(pin) {
|
|
17595
17688
|
const path80 = getPinStatePath(pin);
|
|
17596
|
-
if (!
|
|
17689
|
+
if (!existsSync38(path80)) return void 0;
|
|
17597
17690
|
try {
|
|
17598
17691
|
const state = JSON.parse(readFileSync28(path80, "utf8"));
|
|
17599
17692
|
if (state.pin !== pin) return void 0;
|
|
@@ -17612,7 +17705,7 @@ function codeCommentConfirm(pin) {
|
|
|
17612
17705
|
process.exitCode = 1;
|
|
17613
17706
|
return;
|
|
17614
17707
|
}
|
|
17615
|
-
if (!
|
|
17708
|
+
if (!existsSync39(state.file)) {
|
|
17616
17709
|
console.error(chalk122.red(`Target file no longer exists: ${state.file}`));
|
|
17617
17710
|
process.exitCode = 1;
|
|
17618
17711
|
return;
|
|
@@ -18779,10 +18872,10 @@ function getMigrationApprovalPath(migrationId) {
|
|
|
18779
18872
|
}
|
|
18780
18873
|
|
|
18781
18874
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
18782
|
-
import { existsSync as
|
|
18875
|
+
import { existsSync as existsSync40, readFileSync as readFileSync30 } from "fs";
|
|
18783
18876
|
function readMigrationPinState(pin) {
|
|
18784
18877
|
const path80 = getMigrationPinPath(pin);
|
|
18785
|
-
if (!
|
|
18878
|
+
if (!existsSync40(path80)) return void 0;
|
|
18786
18879
|
try {
|
|
18787
18880
|
const state = JSON.parse(readFileSync30(path80, "utf8"));
|
|
18788
18881
|
if (state.pin !== pin) return void 0;
|
|
@@ -18871,7 +18964,7 @@ function registerDbMigration(parent) {
|
|
|
18871
18964
|
}
|
|
18872
18965
|
|
|
18873
18966
|
// src/commands/deploy/redirect.ts
|
|
18874
|
-
import { existsSync as
|
|
18967
|
+
import { existsSync as existsSync41, readFileSync as readFileSync31, writeFileSync as writeFileSync28 } from "fs";
|
|
18875
18968
|
import chalk142 from "chalk";
|
|
18876
18969
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
18877
18970
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -18880,7 +18973,7 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
18880
18973
|
</script>`;
|
|
18881
18974
|
function redirect() {
|
|
18882
18975
|
const indexPath = "index.html";
|
|
18883
|
-
if (!
|
|
18976
|
+
if (!existsSync41(indexPath)) {
|
|
18884
18977
|
console.log(chalk142.yellow("No index.html found"));
|
|
18885
18978
|
return;
|
|
18886
18979
|
}
|
|
@@ -18927,7 +19020,7 @@ import { execSync as execSync36 } from "child_process";
|
|
|
18927
19020
|
import chalk143 from "chalk";
|
|
18928
19021
|
|
|
18929
19022
|
// src/shared/getRepoName.ts
|
|
18930
|
-
import { existsSync as
|
|
19023
|
+
import { existsSync as existsSync42, readFileSync as readFileSync32 } from "fs";
|
|
18931
19024
|
import { basename as basename12, join as join44 } from "path";
|
|
18932
19025
|
function getRepoName() {
|
|
18933
19026
|
const config = loadConfig();
|
|
@@ -18935,7 +19028,7 @@ function getRepoName() {
|
|
|
18935
19028
|
return config.devlog.name;
|
|
18936
19029
|
}
|
|
18937
19030
|
const packageJsonPath = join44(process.cwd(), "package.json");
|
|
18938
|
-
if (
|
|
19031
|
+
if (existsSync42(packageJsonPath)) {
|
|
18939
19032
|
try {
|
|
18940
19033
|
const content = readFileSync32(packageJsonPath, "utf8");
|
|
18941
19034
|
const pkg = JSON.parse(content);
|
|
@@ -19637,12 +19730,12 @@ function printJson(tree, totalCount, solutions) {
|
|
|
19637
19730
|
}
|
|
19638
19731
|
|
|
19639
19732
|
// src/commands/dotnet/resolveCsproj.ts
|
|
19640
|
-
import { existsSync as
|
|
19733
|
+
import { existsSync as existsSync43 } from "fs";
|
|
19641
19734
|
import path39 from "path";
|
|
19642
19735
|
import chalk152 from "chalk";
|
|
19643
19736
|
function resolveCsproj(csprojPath) {
|
|
19644
19737
|
const resolved = path39.resolve(csprojPath);
|
|
19645
|
-
if (!
|
|
19738
|
+
if (!existsSync43(resolved)) {
|
|
19646
19739
|
console.error(chalk152.red(`File not found: ${resolved}`));
|
|
19647
19740
|
process.exit(1);
|
|
19648
19741
|
}
|
|
@@ -19810,7 +19903,7 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
19810
19903
|
}
|
|
19811
19904
|
|
|
19812
19905
|
// src/commands/dotnet/resolveSolution.ts
|
|
19813
|
-
import { existsSync as
|
|
19906
|
+
import { existsSync as existsSync44 } from "fs";
|
|
19814
19907
|
import path40 from "path";
|
|
19815
19908
|
import chalk156 from "chalk";
|
|
19816
19909
|
|
|
@@ -19851,7 +19944,7 @@ function findSolution() {
|
|
|
19851
19944
|
function resolveSolution(sln) {
|
|
19852
19945
|
if (sln) {
|
|
19853
19946
|
const resolved = path40.resolve(sln);
|
|
19854
|
-
if (!
|
|
19947
|
+
if (!existsSync44(resolved)) {
|
|
19855
19948
|
console.error(chalk156.red(`Solution file not found: ${resolved}`));
|
|
19856
19949
|
process.exit(1);
|
|
19857
19950
|
}
|
|
@@ -19891,7 +19984,7 @@ function parseInspectReport(json) {
|
|
|
19891
19984
|
|
|
19892
19985
|
// src/commands/dotnet/runInspectCode.ts
|
|
19893
19986
|
import { execSync as execSync40 } from "child_process";
|
|
19894
|
-
import { existsSync as
|
|
19987
|
+
import { existsSync as existsSync45, readFileSync as readFileSync36, unlinkSync as unlinkSync10 } from "fs";
|
|
19895
19988
|
import { tmpdir as tmpdir4 } from "os";
|
|
19896
19989
|
import path41 from "path";
|
|
19897
19990
|
import chalk157 from "chalk";
|
|
@@ -19922,7 +20015,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
19922
20015
|
console.error(chalk157.red("jb inspectcode failed"));
|
|
19923
20016
|
process.exit(1);
|
|
19924
20017
|
}
|
|
19925
|
-
if (!
|
|
20018
|
+
if (!existsSync45(reportPath)) {
|
|
19926
20019
|
console.error(chalk157.red("Report file not generated"));
|
|
19927
20020
|
process.exit(1);
|
|
19928
20021
|
}
|
|
@@ -20211,11 +20304,11 @@ function decideCommentGuard(input, existingContent) {
|
|
|
20211
20304
|
}
|
|
20212
20305
|
|
|
20213
20306
|
// src/commands/dbMigration/consumeMigrationApproval.ts
|
|
20214
|
-
import { existsSync as
|
|
20307
|
+
import { existsSync as existsSync46, unlinkSync as unlinkSync11 } from "fs";
|
|
20215
20308
|
function consumeMigrationApproval(migrationId) {
|
|
20216
20309
|
sweepRestrictedDir();
|
|
20217
20310
|
const path80 = getMigrationApprovalPath(migrationId);
|
|
20218
|
-
if (!
|
|
20311
|
+
if (!existsSync46(path80)) return false;
|
|
20219
20312
|
try {
|
|
20220
20313
|
unlinkSync11(path80);
|
|
20221
20314
|
return true;
|
|
@@ -20548,7 +20641,7 @@ async function countPendingHandovers(orm, origin) {
|
|
|
20548
20641
|
|
|
20549
20642
|
// src/commands/handover/migrateDiskHandovers.ts
|
|
20550
20643
|
import {
|
|
20551
|
-
existsSync as
|
|
20644
|
+
existsSync as existsSync47,
|
|
20552
20645
|
readdirSync as readdirSync10,
|
|
20553
20646
|
readFileSync as readFileSync37,
|
|
20554
20647
|
rmSync as rmSync3,
|
|
@@ -20603,7 +20696,7 @@ function summariseHandoverContent(content) {
|
|
|
20603
20696
|
|
|
20604
20697
|
// src/commands/handover/migrateDiskHandovers.ts
|
|
20605
20698
|
function collectMarkdown(dir) {
|
|
20606
|
-
if (!
|
|
20699
|
+
if (!existsSync47(dir)) return [];
|
|
20607
20700
|
const out = [];
|
|
20608
20701
|
for (const entry of readdirSync10(dir, { withFileTypes: true })) {
|
|
20609
20702
|
const full = join52(dir, entry.name);
|
|
@@ -20630,7 +20723,7 @@ async function migrateDiskHandovers(orm, origin, cwd = process.cwd()) {
|
|
|
20630
20723
|
migrated++;
|
|
20631
20724
|
}
|
|
20632
20725
|
const handoverPath = getHandoverPath(cwd);
|
|
20633
|
-
if (
|
|
20726
|
+
if (existsSync47(handoverPath)) {
|
|
20634
20727
|
await migrateFile(orm, origin, handoverPath, statSync8(handoverPath).mtime);
|
|
20635
20728
|
migrated++;
|
|
20636
20729
|
}
|
|
@@ -20987,7 +21080,7 @@ function canonicalTreePath(path80) {
|
|
|
20987
21080
|
}
|
|
20988
21081
|
|
|
20989
21082
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
20990
|
-
import { existsSync as
|
|
21083
|
+
import { existsSync as existsSync48 } from "fs";
|
|
20991
21084
|
import { basename as basename16, dirname as dirname25 } from "path";
|
|
20992
21085
|
|
|
20993
21086
|
// src/commands/sessions/daemon/worktree/planAllocation.ts
|
|
@@ -21034,7 +21127,7 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
21034
21127
|
const base = strategy.root ? expandTilde2(strategy.root) : dirname25(clone);
|
|
21035
21128
|
const registered = new Set(listWorktreePaths(clone));
|
|
21036
21129
|
const branches = new Set(listLocalBranches(clone));
|
|
21037
|
-
const isTaken = (candidate) => registered.has(candidate) ||
|
|
21130
|
+
const isTaken = (candidate) => registered.has(candidate) || existsSync48(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename16(candidate));
|
|
21038
21131
|
const path80 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
21039
21132
|
const start3 = worktreeStartPoint(clone, strategy.trunk);
|
|
21040
21133
|
gitSync(clone, [
|
|
@@ -21060,7 +21153,7 @@ function keptInTree(cwd, reason4) {
|
|
|
21060
21153
|
}
|
|
21061
21154
|
|
|
21062
21155
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
21063
|
-
import { existsSync as
|
|
21156
|
+
import { existsSync as existsSync49 } from "fs";
|
|
21064
21157
|
var treeIsGone = { durable: true, gone: true };
|
|
21065
21158
|
function treeDurability(state) {
|
|
21066
21159
|
if (state.dirty) return { durable: false, reason: "uncommitted changes" };
|
|
@@ -21091,14 +21184,14 @@ function* durabilityProbes() {
|
|
|
21091
21184
|
});
|
|
21092
21185
|
}
|
|
21093
21186
|
async function checkDurability(cwd) {
|
|
21094
|
-
if (!
|
|
21187
|
+
if (!existsSync49(cwd)) return treeIsGone;
|
|
21095
21188
|
const probes = durabilityProbes();
|
|
21096
21189
|
let step2 = probes.next();
|
|
21097
21190
|
while (!step2.done) step2 = probes.next(await gitResult(cwd, step2.value));
|
|
21098
21191
|
return step2.value;
|
|
21099
21192
|
}
|
|
21100
21193
|
function checkDurabilitySync(cwd) {
|
|
21101
|
-
if (!
|
|
21194
|
+
if (!existsSync49(cwd)) return treeIsGone;
|
|
21102
21195
|
const probes = durabilityProbes();
|
|
21103
21196
|
let step2 = probes.next();
|
|
21104
21197
|
while (!step2.done) step2 = probes.next(gitSyncResult(cwd, step2.value));
|
|
@@ -21337,20 +21430,20 @@ function persistedTreeRoots() {
|
|
|
21337
21430
|
}
|
|
21338
21431
|
|
|
21339
21432
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
21340
|
-
import { copyFileSync, existsSync as
|
|
21433
|
+
import { copyFileSync, existsSync as existsSync51, mkdirSync as mkdirSync16 } from "fs";
|
|
21341
21434
|
import { dirname as dirname26, join as join55 } from "path";
|
|
21342
21435
|
|
|
21343
21436
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
21344
21437
|
import { spawn as spawn5 } from "child_process";
|
|
21345
21438
|
|
|
21346
21439
|
// src/commands/sessions/daemon/worktree/resolveInstallCommand.ts
|
|
21347
|
-
import { existsSync as
|
|
21440
|
+
import { existsSync as existsSync50 } from "fs";
|
|
21348
21441
|
import { join as join54 } from "path";
|
|
21349
21442
|
function detectInstallCommand(repoRoot2) {
|
|
21350
|
-
if (!
|
|
21351
|
-
if (
|
|
21352
|
-
if (
|
|
21353
|
-
if (
|
|
21443
|
+
if (!existsSync50(join54(repoRoot2, "package.json"))) return null;
|
|
21444
|
+
if (existsSync50(join54(repoRoot2, "pnpm-lock.yaml"))) return "pnpm install";
|
|
21445
|
+
if (existsSync50(join54(repoRoot2, "yarn.lock"))) return "yarn install";
|
|
21446
|
+
if (existsSync50(join54(repoRoot2, "bun.lockb"))) return "bun install";
|
|
21354
21447
|
return "npm install";
|
|
21355
21448
|
}
|
|
21356
21449
|
function resolveInstallCommand(repoRoot2, install) {
|
|
@@ -21463,7 +21556,7 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
21463
21556
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
21464
21557
|
for (const rel of copy) {
|
|
21465
21558
|
const src = join55(clone, rel);
|
|
21466
|
-
if (!
|
|
21559
|
+
if (!existsSync51(src)) continue;
|
|
21467
21560
|
const dest = join55(worktreePath, rel);
|
|
21468
21561
|
try {
|
|
21469
21562
|
mkdirSync16(dirname26(dest), { recursive: true });
|
|
@@ -22978,7 +23071,7 @@ import { tmpdir as tmpdir6 } from "os";
|
|
|
22978
23071
|
import { join as join62 } from "path";
|
|
22979
23072
|
|
|
22980
23073
|
// src/commands/prs/loadCommentsCache.ts
|
|
22981
|
-
import { existsSync as
|
|
23074
|
+
import { existsSync as existsSync52, readFileSync as readFileSync40, unlinkSync as unlinkSync13 } from "fs";
|
|
22982
23075
|
import { parse as parse2 } from "yaml";
|
|
22983
23076
|
|
|
22984
23077
|
// src/commands/prs/commentsCachePath.ts
|
|
@@ -22998,7 +23091,7 @@ function commentsCachePath(org, repo, prNumber) {
|
|
|
22998
23091
|
// src/commands/prs/loadCommentsCache.ts
|
|
22999
23092
|
function loadCommentsCache(org, repo, prNumber) {
|
|
23000
23093
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
23001
|
-
if (!
|
|
23094
|
+
if (!existsSync52(cachePath)) {
|
|
23002
23095
|
return null;
|
|
23003
23096
|
}
|
|
23004
23097
|
const content = readFileSync40(cachePath, "utf8");
|
|
@@ -23006,7 +23099,7 @@ function loadCommentsCache(org, repo, prNumber) {
|
|
|
23006
23099
|
}
|
|
23007
23100
|
function deleteCommentsCache(org, repo, prNumber) {
|
|
23008
23101
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
23009
|
-
if (
|
|
23102
|
+
if (existsSync52(cachePath)) {
|
|
23010
23103
|
unlinkSync13(cachePath);
|
|
23011
23104
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
23012
23105
|
}
|
|
@@ -27135,10 +27228,10 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
27135
27228
|
}
|
|
27136
27229
|
|
|
27137
27230
|
// src/commands/review/prepareReviewDir.ts
|
|
27138
|
-
import { existsSync as
|
|
27231
|
+
import { existsSync as existsSync53, mkdirSync as mkdirSync19, unlinkSync as unlinkSync17, writeFileSync as writeFileSync36 } from "fs";
|
|
27139
27232
|
function clearReviewFiles(paths) {
|
|
27140
27233
|
for (const path80 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
27141
|
-
if (
|
|
27234
|
+
if (existsSync53(path80)) unlinkSync17(path80);
|
|
27142
27235
|
}
|
|
27143
27236
|
}
|
|
27144
27237
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -27365,7 +27458,7 @@ function printReviewerFailures(results) {
|
|
|
27365
27458
|
}
|
|
27366
27459
|
|
|
27367
27460
|
// src/commands/review/runAndSynthesise.ts
|
|
27368
|
-
import { existsSync as
|
|
27461
|
+
import { existsSync as existsSync55, unlinkSync as unlinkSync19 } from "fs";
|
|
27369
27462
|
|
|
27370
27463
|
// src/commands/review/buildReviewerStdin.ts
|
|
27371
27464
|
var REVIEW_PROMPT = `You are acting as a reviewer for a proposed code change made by another engineer. The full review request \u2014 branch, base, changed files, and unified diff \u2014 is in the request file whose absolute path is given below.
|
|
@@ -27794,7 +27887,7 @@ function resolveClaude(args) {
|
|
|
27794
27887
|
}
|
|
27795
27888
|
|
|
27796
27889
|
// src/commands/review/runCodexReviewer.ts
|
|
27797
|
-
import { existsSync as
|
|
27890
|
+
import { existsSync as existsSync54, unlinkSync as unlinkSync18 } from "fs";
|
|
27798
27891
|
|
|
27799
27892
|
// src/commands/review/parseCodexEvent.ts
|
|
27800
27893
|
function isItemStarted(value) {
|
|
@@ -27846,7 +27939,7 @@ async function runCodexReviewer(spec) {
|
|
|
27846
27939
|
reportReviewerToolUse(spec.name, event, spinner);
|
|
27847
27940
|
}
|
|
27848
27941
|
});
|
|
27849
|
-
if (result.exitCode !== 0 &&
|
|
27942
|
+
if (result.exitCode !== 0 && existsSync54(spec.outputPath)) {
|
|
27850
27943
|
unlinkSync18(spec.outputPath);
|
|
27851
27944
|
}
|
|
27852
27945
|
return finaliseReviewerRun({ ...spec, command }, spinner, result);
|
|
@@ -28001,7 +28094,7 @@ async function runAndSynthesise(args) {
|
|
|
28001
28094
|
console.error("Both reviewers failed; skipping synthesis.");
|
|
28002
28095
|
return { ok: false, failures };
|
|
28003
28096
|
}
|
|
28004
|
-
if (anyFresh &&
|
|
28097
|
+
if (anyFresh && existsSync55(paths.synthesisPath)) {
|
|
28005
28098
|
unlinkSync19(paths.synthesisPath);
|
|
28006
28099
|
}
|
|
28007
28100
|
const synthesisResult = await synthesise(paths, { multi });
|
|
@@ -29300,11 +29393,11 @@ async function configure() {
|
|
|
29300
29393
|
}
|
|
29301
29394
|
|
|
29302
29395
|
// src/commands/transcript/list.ts
|
|
29303
|
-
import { existsSync as
|
|
29396
|
+
import { existsSync as existsSync60, readdirSync as readdirSync19, statSync as statSync10 } from "fs";
|
|
29304
29397
|
import { join as join76 } from "path";
|
|
29305
29398
|
function list4() {
|
|
29306
29399
|
const { vttDir } = getTranscriptConfig();
|
|
29307
|
-
if (!
|
|
29400
|
+
if (!existsSync60(vttDir)) return;
|
|
29308
29401
|
for (const entry of readdirSync19(vttDir)) {
|
|
29309
29402
|
if (!entry.endsWith(".vtt")) continue;
|
|
29310
29403
|
if (statSync10(join76(vttDir, entry)).isDirectory()) continue;
|
|
@@ -29314,7 +29407,7 @@ function list4() {
|
|
|
29314
29407
|
|
|
29315
29408
|
// src/commands/transcript/move.ts
|
|
29316
29409
|
import {
|
|
29317
|
-
existsSync as
|
|
29410
|
+
existsSync as existsSync61,
|
|
29318
29411
|
mkdirSync as mkdirSync25,
|
|
29319
29412
|
readFileSync as readFileSync47,
|
|
29320
29413
|
renameSync as renameSync2,
|
|
@@ -29546,7 +29639,7 @@ function move(file, options2) {
|
|
|
29546
29639
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
29547
29640
|
const filename = basename21(file);
|
|
29548
29641
|
const sourcePath = join77(vttDir, filename);
|
|
29549
|
-
if (!
|
|
29642
|
+
if (!existsSync61(sourcePath)) {
|
|
29550
29643
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
29551
29644
|
process.exit(1);
|
|
29552
29645
|
}
|
|
@@ -29675,9 +29768,9 @@ function devices() {
|
|
|
29675
29768
|
}
|
|
29676
29769
|
|
|
29677
29770
|
// src/commands/voice/logs.ts
|
|
29678
|
-
import { existsSync as
|
|
29771
|
+
import { existsSync as existsSync62, readFileSync as readFileSync48 } from "fs";
|
|
29679
29772
|
function logs(options2) {
|
|
29680
|
-
if (!
|
|
29773
|
+
if (!existsSync62(voicePaths.log)) {
|
|
29681
29774
|
console.log("No voice log file found");
|
|
29682
29775
|
return;
|
|
29683
29776
|
}
|
|
@@ -29709,7 +29802,7 @@ import { join as join81 } from "path";
|
|
|
29709
29802
|
|
|
29710
29803
|
// src/commands/voice/checkLockFile.ts
|
|
29711
29804
|
import { execSync as execSync58 } from "child_process";
|
|
29712
|
-
import { existsSync as
|
|
29805
|
+
import { existsSync as existsSync63, mkdirSync as mkdirSync26, readFileSync as readFileSync49, writeFileSync as writeFileSync42 } from "fs";
|
|
29713
29806
|
import { join as join80 } from "path";
|
|
29714
29807
|
function isProcessAlive2(pid) {
|
|
29715
29808
|
try {
|
|
@@ -29721,7 +29814,7 @@ function isProcessAlive2(pid) {
|
|
|
29721
29814
|
}
|
|
29722
29815
|
function checkLockFile() {
|
|
29723
29816
|
const lockFile = getLockFile();
|
|
29724
|
-
if (!
|
|
29817
|
+
if (!existsSync63(lockFile)) return;
|
|
29725
29818
|
try {
|
|
29726
29819
|
const lock2 = JSON.parse(readFileSync49(lockFile, "utf8"));
|
|
29727
29820
|
if (lock2.pid && isProcessAlive2(lock2.pid)) {
|
|
@@ -29734,7 +29827,7 @@ function checkLockFile() {
|
|
|
29734
29827
|
}
|
|
29735
29828
|
}
|
|
29736
29829
|
function bootstrapVenv() {
|
|
29737
|
-
if (
|
|
29830
|
+
if (existsSync63(getVenvPython())) return;
|
|
29738
29831
|
console.log("Setting up Python environment...");
|
|
29739
29832
|
const pythonDir = getPythonDir();
|
|
29740
29833
|
execSync58(
|
|
@@ -29825,7 +29918,7 @@ function start2(options2) {
|
|
|
29825
29918
|
}
|
|
29826
29919
|
|
|
29827
29920
|
// src/commands/voice/status.ts
|
|
29828
|
-
import { existsSync as
|
|
29921
|
+
import { existsSync as existsSync64, readFileSync as readFileSync50 } from "fs";
|
|
29829
29922
|
function isProcessAlive3(pid) {
|
|
29830
29923
|
try {
|
|
29831
29924
|
process.kill(pid, 0);
|
|
@@ -29835,12 +29928,12 @@ function isProcessAlive3(pid) {
|
|
|
29835
29928
|
}
|
|
29836
29929
|
}
|
|
29837
29930
|
function readRecentLogs(count8) {
|
|
29838
|
-
if (!
|
|
29931
|
+
if (!existsSync64(voicePaths.log)) return [];
|
|
29839
29932
|
const lines2 = readFileSync50(voicePaths.log, "utf8").trim().split("\n");
|
|
29840
29933
|
return lines2.slice(-count8);
|
|
29841
29934
|
}
|
|
29842
29935
|
function status2() {
|
|
29843
|
-
if (!
|
|
29936
|
+
if (!existsSync64(voicePaths.pid)) {
|
|
29844
29937
|
console.log("Voice daemon: not running (no PID file)");
|
|
29845
29938
|
return;
|
|
29846
29939
|
}
|
|
@@ -29863,9 +29956,9 @@ function status2() {
|
|
|
29863
29956
|
}
|
|
29864
29957
|
|
|
29865
29958
|
// src/commands/voice/stop.ts
|
|
29866
|
-
import { existsSync as
|
|
29959
|
+
import { existsSync as existsSync65, readFileSync as readFileSync51, unlinkSync as unlinkSync20 } from "fs";
|
|
29867
29960
|
function stop2() {
|
|
29868
|
-
if (!
|
|
29961
|
+
if (!existsSync65(voicePaths.pid)) {
|
|
29869
29962
|
console.log("Voice daemon is not running (no PID file)");
|
|
29870
29963
|
return;
|
|
29871
29964
|
}
|
|
@@ -29882,7 +29975,7 @@ function stop2() {
|
|
|
29882
29975
|
}
|
|
29883
29976
|
try {
|
|
29884
29977
|
const lockFile = getLockFile();
|
|
29885
|
-
if (
|
|
29978
|
+
if (existsSync65(lockFile)) unlinkSync20(lockFile);
|
|
29886
29979
|
} catch {
|
|
29887
29980
|
}
|
|
29888
29981
|
console.log("Voice daemon stopped");
|
|
@@ -30245,7 +30338,7 @@ function resolveParams(params, cliArgs) {
|
|
|
30245
30338
|
}
|
|
30246
30339
|
|
|
30247
30340
|
// src/commands/run/resolveRunCwd.ts
|
|
30248
|
-
import { existsSync as
|
|
30341
|
+
import { existsSync as existsSync66 } from "fs";
|
|
30249
30342
|
import { resolve as resolve18 } from "path";
|
|
30250
30343
|
var MissingRunCwdError = class extends Error {
|
|
30251
30344
|
constructor(runName, cwd) {
|
|
@@ -30258,17 +30351,17 @@ var MissingRunCwdError = class extends Error {
|
|
|
30258
30351
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
30259
30352
|
if (!config.cwd) return void 0;
|
|
30260
30353
|
const cwd = resolve18(baseDir, config.cwd);
|
|
30261
|
-
if (!
|
|
30354
|
+
if (!existsSync66(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
30262
30355
|
return cwd;
|
|
30263
30356
|
}
|
|
30264
30357
|
|
|
30265
30358
|
// src/commands/run/runCommandToCompletion.ts
|
|
30266
30359
|
import { spawn as spawn9 } from "child_process";
|
|
30267
|
-
import { existsSync as
|
|
30360
|
+
import { existsSync as existsSync68 } from "fs";
|
|
30268
30361
|
|
|
30269
30362
|
// src/commands/run/resolveCommand.ts
|
|
30270
30363
|
import { execFileSync as execFileSync11 } from "child_process";
|
|
30271
|
-
import { existsSync as
|
|
30364
|
+
import { existsSync as existsSync67 } from "fs";
|
|
30272
30365
|
import { dirname as dirname35, join as join84, resolve as resolve19 } from "path";
|
|
30273
30366
|
function resolveCommand2(command) {
|
|
30274
30367
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
@@ -30276,7 +30369,7 @@ function resolveCommand2(command) {
|
|
|
30276
30369
|
const gitPath = execFileSync11("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
30277
30370
|
const gitRoot = resolve19(dirname35(gitPath), "..");
|
|
30278
30371
|
const gitBash = join84(gitRoot, "bin", "bash.exe");
|
|
30279
|
-
if (
|
|
30372
|
+
if (existsSync67(gitBash)) return gitBash;
|
|
30280
30373
|
} catch {
|
|
30281
30374
|
return command;
|
|
30282
30375
|
}
|
|
@@ -30286,7 +30379,7 @@ function resolveCommand2(command) {
|
|
|
30286
30379
|
// src/commands/run/runCommandToCompletion.ts
|
|
30287
30380
|
function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
30288
30381
|
return new Promise((resolveResult) => {
|
|
30289
|
-
if (cwd && !
|
|
30382
|
+
if (cwd && !existsSync68(cwd)) {
|
|
30290
30383
|
resolveResult({
|
|
30291
30384
|
kind: "failed",
|
|
30292
30385
|
message: `Failed to execute command: cwd ${cwd} does not exist`
|
|
@@ -30955,7 +31048,7 @@ function link2() {
|
|
|
30955
31048
|
}
|
|
30956
31049
|
|
|
30957
31050
|
// src/commands/run/remove.ts
|
|
30958
|
-
import { existsSync as
|
|
31051
|
+
import { existsSync as existsSync69, unlinkSync as unlinkSync21 } from "fs";
|
|
30959
31052
|
import { join as join87 } from "path";
|
|
30960
31053
|
function findRemoveIndex() {
|
|
30961
31054
|
const idx = process.argv.indexOf("remove");
|
|
@@ -30972,7 +31065,7 @@ function parseRemoveName() {
|
|
|
30972
31065
|
}
|
|
30973
31066
|
function deleteCommandFile(name) {
|
|
30974
31067
|
const filePath = join87(".claude", "commands", `${name}.md`);
|
|
30975
|
-
if (
|
|
31068
|
+
if (existsSync69(filePath)) {
|
|
30976
31069
|
unlinkSync21(filePath);
|
|
30977
31070
|
console.log(`Deleted command file: ${filePath}`);
|
|
30978
31071
|
}
|
|
@@ -31017,7 +31110,7 @@ function registerRun(program2) {
|
|
|
31017
31110
|
|
|
31018
31111
|
// src/commands/screenshot/index.ts
|
|
31019
31112
|
import { execSync as execSync60 } from "child_process";
|
|
31020
|
-
import { existsSync as
|
|
31113
|
+
import { existsSync as existsSync70, mkdirSync as mkdirSync30, unlinkSync as unlinkSync22, writeFileSync as writeFileSync45 } from "fs";
|
|
31021
31114
|
import { tmpdir as tmpdir8 } from "os";
|
|
31022
31115
|
import { join as join88, resolve as resolve20 } from "path";
|
|
31023
31116
|
import chalk216 from "chalk";
|
|
@@ -31149,7 +31242,7 @@ Write-Output $OutputPath
|
|
|
31149
31242
|
|
|
31150
31243
|
// src/commands/screenshot/index.ts
|
|
31151
31244
|
function buildOutputPath(outputDir, processName) {
|
|
31152
|
-
if (!
|
|
31245
|
+
if (!existsSync70(outputDir)) {
|
|
31153
31246
|
mkdirSync30(outputDir, { recursive: true });
|
|
31154
31247
|
}
|
|
31155
31248
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
@@ -31484,12 +31577,12 @@ function toSessionRunInfo({
|
|
|
31484
31577
|
}
|
|
31485
31578
|
|
|
31486
31579
|
// src/commands/sessions/daemon/worktree/joinRefusal.ts
|
|
31487
|
-
import { existsSync as
|
|
31580
|
+
import { existsSync as existsSync71 } from "fs";
|
|
31488
31581
|
function joinRefusal(session) {
|
|
31489
31582
|
if (session.commandType === "run") return "a server run has no agent stream";
|
|
31490
31583
|
if (session.closing === true) return "the session is closing";
|
|
31491
31584
|
if (!session.cwd) return "the session has no working directory";
|
|
31492
|
-
if (!
|
|
31585
|
+
if (!existsSync71(session.cwd))
|
|
31493
31586
|
return "the session's workspace no longer exists";
|
|
31494
31587
|
return void 0;
|
|
31495
31588
|
}
|
|
@@ -31653,11 +31746,11 @@ function sessionBase(id, status3) {
|
|
|
31653
31746
|
}
|
|
31654
31747
|
|
|
31655
31748
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
31656
|
-
import { existsSync as
|
|
31749
|
+
import { existsSync as existsSync73 } from "fs";
|
|
31657
31750
|
import * as pty from "node-pty";
|
|
31658
31751
|
|
|
31659
31752
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
31660
|
-
import { chmodSync, existsSync as
|
|
31753
|
+
import { chmodSync, existsSync as existsSync72, statSync as statSync12 } from "fs";
|
|
31661
31754
|
import { createRequire as createRequire3 } from "module";
|
|
31662
31755
|
import path75 from "path";
|
|
31663
31756
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -31672,7 +31765,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
31672
31765
|
`${process.platform}-${process.arch}`,
|
|
31673
31766
|
"spawn-helper"
|
|
31674
31767
|
);
|
|
31675
|
-
if (!
|
|
31768
|
+
if (!existsSync72(helper)) return;
|
|
31676
31769
|
const mode = statSync12(helper).mode;
|
|
31677
31770
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
31678
31771
|
}
|
|
@@ -31708,7 +31801,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
|
|
|
31708
31801
|
});
|
|
31709
31802
|
}
|
|
31710
31803
|
function refuseMissingCwd(cwd, sessionId) {
|
|
31711
|
-
if (!cwd ||
|
|
31804
|
+
if (!cwd || existsSync73(cwd)) return;
|
|
31712
31805
|
daemonLog(
|
|
31713
31806
|
`${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
|
|
31714
31807
|
);
|
|
@@ -31882,11 +31975,11 @@ function setStatus2(session, newStatus) {
|
|
|
31882
31975
|
}
|
|
31883
31976
|
|
|
31884
31977
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
31885
|
-
import { existsSync as
|
|
31978
|
+
import { existsSync as existsSync75 } from "fs";
|
|
31886
31979
|
import { basename as basename22 } from "path";
|
|
31887
31980
|
|
|
31888
31981
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
31889
|
-
import { existsSync as
|
|
31982
|
+
import { existsSync as existsSync74 } from "fs";
|
|
31890
31983
|
import { join as join91 } from "path";
|
|
31891
31984
|
|
|
31892
31985
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
@@ -31956,7 +32049,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
31956
32049
|
);
|
|
31957
32050
|
}
|
|
31958
32051
|
function strandedReason(worktreePath, cause) {
|
|
31959
|
-
if (!
|
|
32052
|
+
if (!existsSync74(join91(worktreePath, ".git")))
|
|
31960
32053
|
return "its .git link is already gone";
|
|
31961
32054
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
31962
32055
|
return "git no longer recognises it as a working tree";
|
|
@@ -32008,7 +32101,7 @@ function reason3(error) {
|
|
|
32008
32101
|
|
|
32009
32102
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
32010
32103
|
async function reapWorktree(worktreePath, force = false) {
|
|
32011
|
-
if (!
|
|
32104
|
+
if (!existsSync75(worktreePath)) {
|
|
32012
32105
|
forgetWorktree(worktreePath);
|
|
32013
32106
|
daemonLog(
|
|
32014
32107
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -32033,7 +32126,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
32033
32126
|
}
|
|
32034
32127
|
function owningClone(worktreePath) {
|
|
32035
32128
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
32036
|
-
if (recorded &&
|
|
32129
|
+
if (recorded && existsSync75(recorded)) return recorded;
|
|
32037
32130
|
const detected = mainWorktree(worktreePath);
|
|
32038
32131
|
if (detected) return detected;
|
|
32039
32132
|
daemonLog(
|
|
@@ -32161,12 +32254,12 @@ function closeGateApplies(sessions, session) {
|
|
|
32161
32254
|
}
|
|
32162
32255
|
|
|
32163
32256
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
32164
|
-
import { existsSync as
|
|
32257
|
+
import { existsSync as existsSync76, watch } from "fs";
|
|
32165
32258
|
var DEBOUNCE_MS = 500;
|
|
32166
32259
|
var POLL_MS = 3e4;
|
|
32167
32260
|
function watchGitState(cwd, onChange) {
|
|
32168
32261
|
const common = gitCommonDir(cwd);
|
|
32169
|
-
if (!common || !
|
|
32262
|
+
if (!common || !existsSync76(common)) return void 0;
|
|
32170
32263
|
const watchers = [
|
|
32171
32264
|
watchGitDir(common, onChange),
|
|
32172
32265
|
pollGitState(cwd, onChange)
|
|
@@ -32409,6 +32502,14 @@ function decidePrPreview(sessions, waiters, notify2, d) {
|
|
|
32409
32502
|
notify2();
|
|
32410
32503
|
}
|
|
32411
32504
|
|
|
32505
|
+
// src/commands/sessions/daemon/previewTargetLabel.ts
|
|
32506
|
+
function previewTargetLabel(kind, itemType, prNumber, draft) {
|
|
32507
|
+
if (kind === "backlog-comment") return "backlog comment";
|
|
32508
|
+
if (kind === "backlog-item") return `backlog ${itemType}`;
|
|
32509
|
+
if (prNumber !== null) return `edit #${prNumber}`;
|
|
32510
|
+
return draft ? "create draft" : "create";
|
|
32511
|
+
}
|
|
32512
|
+
|
|
32412
32513
|
// src/commands/sessions/daemon/setPrPreview.ts
|
|
32413
32514
|
function setPrPreview(sessions, waiters, notify2, client, d) {
|
|
32414
32515
|
const id = d.sessionId;
|
|
@@ -32422,7 +32523,7 @@ function setPrPreview(sessions, waiters, notify2, client, d) {
|
|
|
32422
32523
|
return;
|
|
32423
32524
|
}
|
|
32424
32525
|
const prNumber = typeof d.prNumber === "number" ? d.prNumber : null;
|
|
32425
|
-
const kind = d.kind === "backlog-item"
|
|
32526
|
+
const kind = d.kind === "backlog-item" || d.kind === "backlog-comment" ? d.kind : "pr";
|
|
32426
32527
|
const itemType = d.itemType === "bug" ? "bug" : "story";
|
|
32427
32528
|
const draft = d.draft === true;
|
|
32428
32529
|
session.pendingPrPreview = {
|
|
@@ -32435,7 +32536,7 @@ function setPrPreview(sessions, waiters, notify2, client, d) {
|
|
|
32435
32536
|
draft: kind === "pr" && prNumber === null ? draft : void 0
|
|
32436
32537
|
};
|
|
32437
32538
|
waiters.set(id, client);
|
|
32438
|
-
const target = kind
|
|
32539
|
+
const target = previewTargetLabel(kind, itemType, prNumber, draft);
|
|
32439
32540
|
daemonLog(
|
|
32440
32541
|
`pr-preview set: id=${id} requestId=${d.requestId} kind=${kind} target=${target}`
|
|
32441
32542
|
);
|
|
@@ -32614,10 +32715,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
32614
32715
|
}
|
|
32615
32716
|
|
|
32616
32717
|
// src/commands/sessions/daemon/exitReason.ts
|
|
32617
|
-
import { existsSync as
|
|
32718
|
+
import { existsSync as existsSync77 } from "fs";
|
|
32618
32719
|
import { resolve as resolve21 } from "path";
|
|
32619
32720
|
function exitDetail(session) {
|
|
32620
|
-
if (session.cwd && !
|
|
32721
|
+
if (session.cwd && !existsSync77(session.cwd))
|
|
32621
32722
|
return `working directory ${session.cwd} no longer exists`;
|
|
32622
32723
|
return missingRunConfigCwd(session);
|
|
32623
32724
|
}
|
|
@@ -32631,7 +32732,7 @@ function missingRunConfigCwd(session) {
|
|
|
32631
32732
|
const config = resolveRunConfig(session.runName, dir);
|
|
32632
32733
|
if (!config?.cwd) return void 0;
|
|
32633
32734
|
const configured = resolve21(runConfigBaseDirFrom(dir), config.cwd);
|
|
32634
|
-
if (
|
|
32735
|
+
if (existsSync77(configured)) return void 0;
|
|
32635
32736
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
32636
32737
|
}
|
|
32637
32738
|
|
|
@@ -32672,7 +32773,7 @@ function handleFailedResume(session, exitCode, onStatusChange) {
|
|
|
32672
32773
|
}
|
|
32673
32774
|
|
|
32674
32775
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
32675
|
-
import { existsSync as
|
|
32776
|
+
import { existsSync as existsSync78, mkdirSync as mkdirSync31, watch as watch2 } from "fs";
|
|
32676
32777
|
import { dirname as dirname37 } from "path";
|
|
32677
32778
|
|
|
32678
32779
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
@@ -32758,7 +32859,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
32758
32859
|
if (timer) clearTimeout(timer);
|
|
32759
32860
|
timer = setTimeout(read2, DEBOUNCE_MS2);
|
|
32760
32861
|
});
|
|
32761
|
-
if (
|
|
32862
|
+
if (existsSync78(path80)) read2();
|
|
32762
32863
|
}
|
|
32763
32864
|
function refreshActivity(session) {
|
|
32764
32865
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -34371,7 +34472,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
34371
34472
|
}
|
|
34372
34473
|
|
|
34373
34474
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
34374
|
-
import { existsSync as
|
|
34475
|
+
import { existsSync as existsSync81 } from "fs";
|
|
34375
34476
|
import { basename as basename24 } from "path";
|
|
34376
34477
|
|
|
34377
34478
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -34426,9 +34527,9 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
34426
34527
|
}
|
|
34427
34528
|
|
|
34428
34529
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
34429
|
-
import { existsSync as
|
|
34530
|
+
import { existsSync as existsSync80 } from "fs";
|
|
34430
34531
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
34431
|
-
if (!
|
|
34532
|
+
if (!existsSync80(clone)) {
|
|
34432
34533
|
for (const { path: path80 } of paths) forgetWorktree(path80);
|
|
34433
34534
|
daemonLog(
|
|
34434
34535
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
@@ -34594,7 +34695,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
34594
34695
|
);
|
|
34595
34696
|
continue;
|
|
34596
34697
|
}
|
|
34597
|
-
if (!
|
|
34698
|
+
if (!existsSync81(path80)) {
|
|
34598
34699
|
logVanishedTree(sessions, path80);
|
|
34599
34700
|
vanished.set(clone, [
|
|
34600
34701
|
...vanished.get(clone) ?? [],
|
|
@@ -35175,13 +35276,13 @@ async function defaultConnect() {
|
|
|
35175
35276
|
}
|
|
35176
35277
|
|
|
35177
35278
|
// src/commands/sessions/daemon/hasPersistedWindowsSessions.ts
|
|
35178
|
-
import { existsSync as
|
|
35179
|
-
import { posix } from "path";
|
|
35279
|
+
import { existsSync as existsSync82, readFileSync as readFileSync55 } from "fs";
|
|
35280
|
+
import { posix as posix3 } from "path";
|
|
35180
35281
|
function hasPersistedWindowsSessions() {
|
|
35181
35282
|
const sessionsFile = windowsSessionsFileFromWsl();
|
|
35182
35283
|
if (!sessionsFile) return false;
|
|
35183
35284
|
try {
|
|
35184
|
-
if (!
|
|
35285
|
+
if (!existsSync82(sessionsFile)) return false;
|
|
35185
35286
|
const data = JSON.parse(readFileSync55(sessionsFile, "utf8"));
|
|
35186
35287
|
return Array.isArray(data) && data.length > 0;
|
|
35187
35288
|
} catch (error) {
|
|
@@ -35193,10 +35294,9 @@ function hasPersistedWindowsSessions() {
|
|
|
35193
35294
|
}
|
|
35194
35295
|
}
|
|
35195
35296
|
function windowsSessionsFileFromWsl() {
|
|
35196
|
-
const
|
|
35197
|
-
if (!
|
|
35198
|
-
|
|
35199
|
-
return posix.join(winHome, ".assist", "sessions.json");
|
|
35297
|
+
const winHome = windowsHomeFromWsl();
|
|
35298
|
+
if (!winHome) return null;
|
|
35299
|
+
return posix3.join(winHome, ".assist", "sessions.json");
|
|
35200
35300
|
}
|
|
35201
35301
|
|
|
35202
35302
|
// src/commands/sessions/daemon/discoverWindowsSessions.ts
|
|
@@ -35787,7 +35887,7 @@ function addAgentToStream(ctx, targetId, prompt, harness) {
|
|
|
35787
35887
|
}
|
|
35788
35888
|
|
|
35789
35889
|
// src/commands/sessions/daemon/worktree/spawnInTree.ts
|
|
35790
|
-
import { existsSync as
|
|
35890
|
+
import { existsSync as existsSync85 } from "fs";
|
|
35791
35891
|
|
|
35792
35892
|
// src/commands/sessions/daemon/createAssistSession.ts
|
|
35793
35893
|
function createAssistSession(id, assistArgs, cwd, meta, holdPty) {
|
|
@@ -35842,10 +35942,10 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
|
35842
35942
|
}
|
|
35843
35943
|
|
|
35844
35944
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
35845
|
-
import { existsSync as
|
|
35945
|
+
import { existsSync as existsSync84 } from "fs";
|
|
35846
35946
|
|
|
35847
35947
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
35848
|
-
import { copyFileSync as copyFileSync7, existsSync as
|
|
35948
|
+
import { copyFileSync as copyFileSync7, existsSync as existsSync83, mkdirSync as mkdirSync33 } from "fs";
|
|
35849
35949
|
import { join as join93 } from "path";
|
|
35850
35950
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
35851
35951
|
const dir = projectDirForCwd(toCwd);
|
|
@@ -35856,7 +35956,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
35856
35956
|
return;
|
|
35857
35957
|
}
|
|
35858
35958
|
const dest = join93(dir, `${claudeSessionId}.jsonl`);
|
|
35859
|
-
if (
|
|
35959
|
+
if (existsSync83(dest)) {
|
|
35860
35960
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
35861
35961
|
return;
|
|
35862
35962
|
}
|
|
@@ -35907,7 +36007,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
|
|
|
35907
36007
|
}
|
|
35908
36008
|
function cloneForReapedTree(missingCwd) {
|
|
35909
36009
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
35910
|
-
if (!clone || !
|
|
36010
|
+
if (!clone || !existsSync84(clone))
|
|
35911
36011
|
throw new Error(
|
|
35912
36012
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
35913
36013
|
);
|
|
@@ -35941,7 +36041,7 @@ function spawnAssistInTree(ctx, assistArgs, cwd, meta, context) {
|
|
|
35941
36041
|
return id;
|
|
35942
36042
|
}
|
|
35943
36043
|
function resumeInTree(ctx, sessionId, cwd, name, harness) {
|
|
35944
|
-
if (!
|
|
36044
|
+
if (!existsSync85(cwd))
|
|
35945
36045
|
return resumeInReplacementTree(ctx, sessionId, cwd, name, harness);
|
|
35946
36046
|
const id = ctx.spawnWith(
|
|
35947
36047
|
(sid) => resumeSession(sid, sessionId, cwd, name, void 0, harness)
|
|
@@ -36354,9 +36454,9 @@ function safeParse2(line) {
|
|
|
36354
36454
|
}
|
|
36355
36455
|
|
|
36356
36456
|
// src/commands/sessions/daemon/repoDirExists.ts
|
|
36357
|
-
import { existsSync as
|
|
36457
|
+
import { existsSync as existsSync86 } from "fs";
|
|
36358
36458
|
function repoDirExists(cwd) {
|
|
36359
|
-
return
|
|
36459
|
+
return existsSync86(toGitCwd(cwd));
|
|
36360
36460
|
}
|
|
36361
36461
|
|
|
36362
36462
|
// src/commands/sessions/daemon/withRepoGroups.ts
|