@staff0rd/assist 0.565.0 → 0.565.2
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 +313 -215
- 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.565.
|
|
9
|
+
version: "0.565.2",
|
|
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,26 +12535,44 @@ 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
|
|
|
12571
|
+
// src/commands/config/writesGlobalConfigFile.ts
|
|
12572
|
+
function writesGlobalConfigFile(scope) {
|
|
12573
|
+
return scope !== "project";
|
|
12574
|
+
}
|
|
12575
|
+
|
|
12503
12576
|
// src/commands/config/ConfigWriteScope.ts
|
|
12504
12577
|
function isConfigWriteScope(value) {
|
|
12505
12578
|
return value === "project" || value === "global" || value === "repo";
|
|
@@ -12530,8 +12603,17 @@ async function handleConfigWrite(req, res, apply) {
|
|
|
12530
12603
|
respondJson(res, 400, { error: parsed.error });
|
|
12531
12604
|
return;
|
|
12532
12605
|
}
|
|
12606
|
+
const target = globalConfigTargetFor(parsed.cwd);
|
|
12607
|
+
if (!target.ok && writesGlobalConfigFile(parsed.scope)) {
|
|
12608
|
+
respondJson(res, 400, { error: target.error, errors: [target.error] });
|
|
12609
|
+
return;
|
|
12610
|
+
}
|
|
12533
12611
|
try {
|
|
12534
|
-
const result = apply({
|
|
12612
|
+
const result = apply({
|
|
12613
|
+
...parsed,
|
|
12614
|
+
cwd: toGitCwd(parsed.cwd),
|
|
12615
|
+
globalConfigPath: target.ok ? target.path : void 0
|
|
12616
|
+
});
|
|
12535
12617
|
if (!result.ok) {
|
|
12536
12618
|
respondJson(res, 400, {
|
|
12537
12619
|
error: result.errors.join("\n"),
|
|
@@ -12552,14 +12634,20 @@ function setConfig(req, res) {
|
|
|
12552
12634
|
return handleConfigWrite(req, res, (request) => {
|
|
12553
12635
|
const coerced = coerceConfigValue(
|
|
12554
12636
|
request.key,
|
|
12555
|
-
restoreConfigWriteSecrets(
|
|
12637
|
+
restoreConfigWriteSecrets(
|
|
12638
|
+
request.key,
|
|
12639
|
+
request.value,
|
|
12640
|
+
request.cwd,
|
|
12641
|
+
request.globalConfigPath
|
|
12642
|
+
)
|
|
12556
12643
|
);
|
|
12557
12644
|
if (!coerced.ok) return { ok: false, errors: [coerced.error] };
|
|
12558
12645
|
return applyScopedConfigSet(
|
|
12559
12646
|
request.key,
|
|
12560
12647
|
coerced.value,
|
|
12561
12648
|
request.cwd,
|
|
12562
|
-
request.scope
|
|
12649
|
+
request.scope,
|
|
12650
|
+
request.globalConfigPath
|
|
12563
12651
|
);
|
|
12564
12652
|
});
|
|
12565
12653
|
}
|
|
@@ -12639,7 +12727,7 @@ function unsetNestedValue(obj, path80) {
|
|
|
12639
12727
|
}
|
|
12640
12728
|
|
|
12641
12729
|
// src/commands/config/applyConfigUnset.ts
|
|
12642
|
-
function applyConfigUnset(key, global, cwd = process.cwd()) {
|
|
12730
|
+
function applyConfigUnset(key, global, cwd = process.cwd(), globalConfigPath) {
|
|
12643
12731
|
if (!global && isGlobalOnlyConfigKey(key)) {
|
|
12644
12732
|
return {
|
|
12645
12733
|
ok: false,
|
|
@@ -12649,18 +12737,18 @@ function applyConfigUnset(key, global, cwd = process.cwd()) {
|
|
|
12649
12737
|
};
|
|
12650
12738
|
}
|
|
12651
12739
|
const target = global ? "global" : "project";
|
|
12652
|
-
const raw = global ? loadGlobalConfigRaw() : loadProjectConfig(cwd);
|
|
12740
|
+
const raw = global ? loadGlobalConfigRaw(globalConfigPath) : loadProjectConfig(cwd);
|
|
12653
12741
|
const { config, removed } = unsetNestedValue(raw, key);
|
|
12654
12742
|
if (!removed) return { ok: true, target, removed: false };
|
|
12655
12743
|
const validation = validateConfig(config, key);
|
|
12656
12744
|
if (!validation.ok) return validation;
|
|
12657
|
-
if (global) saveGlobalConfig(config);
|
|
12745
|
+
if (global) saveGlobalConfig(config, globalConfigPath);
|
|
12658
12746
|
else saveConfig(config, cwd);
|
|
12659
12747
|
return { ok: true, target, removed: true };
|
|
12660
12748
|
}
|
|
12661
12749
|
|
|
12662
12750
|
// src/commands/config/applyRepoConfigUnset.ts
|
|
12663
|
-
function applyRepoConfigUnset(key, repoName, cwd = process.cwd()) {
|
|
12751
|
+
function applyRepoConfigUnset(key, repoName, cwd = process.cwd(), globalConfigPath) {
|
|
12664
12752
|
if (isGlobalOnlyConfigKey(key)) {
|
|
12665
12753
|
return {
|
|
12666
12754
|
ok: false,
|
|
@@ -12671,7 +12759,8 @@ function applyRepoConfigUnset(key, repoName, cwd = process.cwd()) {
|
|
|
12671
12759
|
}
|
|
12672
12760
|
const { globalRaw, repos: repos2, label: label2, block } = resolveRepoConfigBlock(
|
|
12673
12761
|
repoName,
|
|
12674
|
-
cwd
|
|
12762
|
+
cwd,
|
|
12763
|
+
globalConfigPath
|
|
12675
12764
|
);
|
|
12676
12765
|
const { config: updatedBlock, removed } = unsetNestedValue(block, key);
|
|
12677
12766
|
if (!removed) return { ok: true, target: "repo", label: label2, removed: false };
|
|
@@ -12682,14 +12771,14 @@ function applyRepoConfigUnset(key, repoName, cwd = process.cwd()) {
|
|
|
12682
12771
|
const next3 = { ...globalRaw };
|
|
12683
12772
|
if (Object.keys(repos2).length === 0) delete next3.repos;
|
|
12684
12773
|
else next3.repos = repos2;
|
|
12685
|
-
saveGlobalConfig(next3);
|
|
12774
|
+
saveGlobalConfig(next3, globalConfigPath);
|
|
12686
12775
|
return { ok: true, target: "repo", label: label2, removed: true };
|
|
12687
12776
|
}
|
|
12688
12777
|
|
|
12689
12778
|
// src/commands/sessions/web/applyScopedConfigUnset.ts
|
|
12690
|
-
function applyScopedConfigUnset(key, cwd, scope) {
|
|
12779
|
+
function applyScopedConfigUnset(key, cwd, scope, globalConfigPath) {
|
|
12691
12780
|
if (scope === "repo") {
|
|
12692
|
-
const result2 = applyRepoConfigUnset(key, void 0, cwd);
|
|
12781
|
+
const result2 = applyRepoConfigUnset(key, void 0, cwd, globalConfigPath);
|
|
12693
12782
|
return result2.ok ? {
|
|
12694
12783
|
ok: true,
|
|
12695
12784
|
payload: {
|
|
@@ -12699,7 +12788,12 @@ function applyScopedConfigUnset(key, cwd, scope) {
|
|
|
12699
12788
|
}
|
|
12700
12789
|
} : result2;
|
|
12701
12790
|
}
|
|
12702
|
-
const result = applyConfigUnset(
|
|
12791
|
+
const result = applyConfigUnset(
|
|
12792
|
+
key,
|
|
12793
|
+
scope === "global",
|
|
12794
|
+
cwd,
|
|
12795
|
+
globalConfigPath
|
|
12796
|
+
);
|
|
12703
12797
|
return result.ok ? { ok: true, payload: { target: result.target, removed: result.removed } } : result;
|
|
12704
12798
|
}
|
|
12705
12799
|
|
|
@@ -12708,7 +12802,12 @@ function unsetConfig(req, res) {
|
|
|
12708
12802
|
return handleConfigWrite(req, res, (request) => {
|
|
12709
12803
|
if (!isKnownConfigKey(request.key))
|
|
12710
12804
|
return { ok: false, errors: [`Unknown config key "${request.key}"`] };
|
|
12711
|
-
return applyScopedConfigUnset(
|
|
12805
|
+
return applyScopedConfigUnset(
|
|
12806
|
+
request.key,
|
|
12807
|
+
request.cwd,
|
|
12808
|
+
request.scope,
|
|
12809
|
+
request.globalConfigPath
|
|
12810
|
+
);
|
|
12712
12811
|
});
|
|
12713
12812
|
}
|
|
12714
12813
|
|
|
@@ -12844,7 +12943,7 @@ import { readFile as readFile2, stat as stat3, writeFile as writeFile3 } from "f
|
|
|
12844
12943
|
|
|
12845
12944
|
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
12846
12945
|
import { execFile as execFile8 } from "child_process";
|
|
12847
|
-
import { existsSync as
|
|
12946
|
+
import { existsSync as existsSync32 } from "fs";
|
|
12848
12947
|
import { dirname as dirname22, join as join32 } from "path";
|
|
12849
12948
|
import { promisify as promisify8 } from "util";
|
|
12850
12949
|
var execFileAsync7 = promisify8(execFile8);
|
|
@@ -12853,7 +12952,7 @@ function findOxfmtScript(root) {
|
|
|
12853
12952
|
let dir = root;
|
|
12854
12953
|
for (; ; ) {
|
|
12855
12954
|
const candidate = join32(dir, "node_modules", "oxfmt", "bin", "oxfmt");
|
|
12856
|
-
if (
|
|
12955
|
+
if (existsSync32(candidate)) return candidate;
|
|
12857
12956
|
const parent = dirname22(dir);
|
|
12858
12957
|
if (parent === dir) return void 0;
|
|
12859
12958
|
dir = parent;
|
|
@@ -13726,7 +13825,7 @@ function registerAssociateJiraCommand(cmd) {
|
|
|
13726
13825
|
|
|
13727
13826
|
// src/commands/backlog/cloneRepo.ts
|
|
13728
13827
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
13729
|
-
import { existsSync as
|
|
13828
|
+
import { existsSync as existsSync34 } from "fs";
|
|
13730
13829
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
13731
13830
|
import chalk70 from "chalk";
|
|
13732
13831
|
|
|
@@ -13762,7 +13861,7 @@ async function cloneRepo(originRaw) {
|
|
|
13762
13861
|
if (!target) {
|
|
13763
13862
|
return fail2(`Could not derive a repository name from "${origin}".`);
|
|
13764
13863
|
}
|
|
13765
|
-
if (
|
|
13864
|
+
if (existsSync34(target)) {
|
|
13766
13865
|
return fail2(`Clone target already exists: ${target}`);
|
|
13767
13866
|
}
|
|
13768
13867
|
await mkdir3(baseDir, { recursive: true });
|
|
@@ -16732,7 +16831,7 @@ function extractGraphqlQuery(args) {
|
|
|
16732
16831
|
}
|
|
16733
16832
|
|
|
16734
16833
|
// src/shared/loadCliReads.ts
|
|
16735
|
-
import { existsSync as
|
|
16834
|
+
import { existsSync as existsSync35, readFileSync as readFileSync25, writeFileSync as writeFileSync22 } from "fs";
|
|
16736
16835
|
import { dirname as dirname23, resolve as resolve12 } from "path";
|
|
16737
16836
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
16738
16837
|
var __filename3 = fileURLToPath5(import.meta.url);
|
|
@@ -16741,7 +16840,7 @@ function packageRoot() {
|
|
|
16741
16840
|
return __dirname4;
|
|
16742
16841
|
}
|
|
16743
16842
|
function readLines(path80) {
|
|
16744
|
-
if (!
|
|
16843
|
+
if (!existsSync35(path80)) return [];
|
|
16745
16844
|
return readFileSync25(path80, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
16746
16845
|
}
|
|
16747
16846
|
var cachedReads;
|
|
@@ -16788,7 +16887,7 @@ function findCliWrite(command) {
|
|
|
16788
16887
|
}
|
|
16789
16888
|
|
|
16790
16889
|
// src/shared/readSettingsPerms.ts
|
|
16791
|
-
import { existsSync as
|
|
16890
|
+
import { existsSync as existsSync36, readFileSync as readFileSync26 } from "fs";
|
|
16792
16891
|
import { homedir as homedir15 } from "os";
|
|
16793
16892
|
import { join as join37 } from "path";
|
|
16794
16893
|
function readSettingsPerms(key) {
|
|
@@ -16804,7 +16903,7 @@ function readSettingsPerms(key) {
|
|
|
16804
16903
|
return entries;
|
|
16805
16904
|
}
|
|
16806
16905
|
function readPermissionArray(filePath, key) {
|
|
16807
|
-
if (!
|
|
16906
|
+
if (!existsSync36(filePath)) return [];
|
|
16808
16907
|
try {
|
|
16809
16908
|
const data = JSON.parse(readFileSync26(filePath, "utf8"));
|
|
16810
16909
|
const arr = data?.permissions?.[key];
|
|
@@ -17149,7 +17248,7 @@ ${reasons.join("\n")}`);
|
|
|
17149
17248
|
}
|
|
17150
17249
|
|
|
17151
17250
|
// src/commands/permitCliReads/index.ts
|
|
17152
|
-
import { existsSync as
|
|
17251
|
+
import { existsSync as existsSync37, mkdirSync as mkdirSync13, readFileSync as readFileSync27, writeFileSync as writeFileSync23 } from "fs";
|
|
17153
17252
|
import { homedir as homedir17 } from "os";
|
|
17154
17253
|
import { join as join39 } from "path";
|
|
17155
17254
|
|
|
@@ -17418,7 +17517,7 @@ function logPath(cli) {
|
|
|
17418
17517
|
}
|
|
17419
17518
|
function readCache(cli) {
|
|
17420
17519
|
const path80 = logPath(cli);
|
|
17421
|
-
if (!
|
|
17520
|
+
if (!existsSync37(path80)) return void 0;
|
|
17422
17521
|
return readFileSync27(path80, "utf8");
|
|
17423
17522
|
}
|
|
17424
17523
|
function writeCache(cli, output) {
|
|
@@ -17553,7 +17652,7 @@ function registerCliHook(program2) {
|
|
|
17553
17652
|
}
|
|
17554
17653
|
|
|
17555
17654
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
17556
|
-
import { existsSync as
|
|
17655
|
+
import { existsSync as existsSync39, readFileSync as readFileSync29, unlinkSync as unlinkSync8, writeFileSync as writeFileSync24 } from "fs";
|
|
17557
17656
|
import chalk122 from "chalk";
|
|
17558
17657
|
|
|
17559
17658
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
@@ -17589,10 +17688,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
17589
17688
|
}
|
|
17590
17689
|
|
|
17591
17690
|
// src/commands/codeComment/readPinState.ts
|
|
17592
|
-
import { existsSync as
|
|
17691
|
+
import { existsSync as existsSync38, readFileSync as readFileSync28 } from "fs";
|
|
17593
17692
|
function readPinState(pin) {
|
|
17594
17693
|
const path80 = getPinStatePath(pin);
|
|
17595
|
-
if (!
|
|
17694
|
+
if (!existsSync38(path80)) return void 0;
|
|
17596
17695
|
try {
|
|
17597
17696
|
const state = JSON.parse(readFileSync28(path80, "utf8"));
|
|
17598
17697
|
if (state.pin !== pin) return void 0;
|
|
@@ -17611,7 +17710,7 @@ function codeCommentConfirm(pin) {
|
|
|
17611
17710
|
process.exitCode = 1;
|
|
17612
17711
|
return;
|
|
17613
17712
|
}
|
|
17614
|
-
if (!
|
|
17713
|
+
if (!existsSync39(state.file)) {
|
|
17615
17714
|
console.error(chalk122.red(`Target file no longer exists: ${state.file}`));
|
|
17616
17715
|
process.exitCode = 1;
|
|
17617
17716
|
return;
|
|
@@ -18778,10 +18877,10 @@ function getMigrationApprovalPath(migrationId) {
|
|
|
18778
18877
|
}
|
|
18779
18878
|
|
|
18780
18879
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
18781
|
-
import { existsSync as
|
|
18880
|
+
import { existsSync as existsSync40, readFileSync as readFileSync30 } from "fs";
|
|
18782
18881
|
function readMigrationPinState(pin) {
|
|
18783
18882
|
const path80 = getMigrationPinPath(pin);
|
|
18784
|
-
if (!
|
|
18883
|
+
if (!existsSync40(path80)) return void 0;
|
|
18785
18884
|
try {
|
|
18786
18885
|
const state = JSON.parse(readFileSync30(path80, "utf8"));
|
|
18787
18886
|
if (state.pin !== pin) return void 0;
|
|
@@ -18870,7 +18969,7 @@ function registerDbMigration(parent) {
|
|
|
18870
18969
|
}
|
|
18871
18970
|
|
|
18872
18971
|
// src/commands/deploy/redirect.ts
|
|
18873
|
-
import { existsSync as
|
|
18972
|
+
import { existsSync as existsSync41, readFileSync as readFileSync31, writeFileSync as writeFileSync28 } from "fs";
|
|
18874
18973
|
import chalk142 from "chalk";
|
|
18875
18974
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
18876
18975
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -18879,7 +18978,7 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
18879
18978
|
</script>`;
|
|
18880
18979
|
function redirect() {
|
|
18881
18980
|
const indexPath = "index.html";
|
|
18882
|
-
if (!
|
|
18981
|
+
if (!existsSync41(indexPath)) {
|
|
18883
18982
|
console.log(chalk142.yellow("No index.html found"));
|
|
18884
18983
|
return;
|
|
18885
18984
|
}
|
|
@@ -18926,7 +19025,7 @@ import { execSync as execSync36 } from "child_process";
|
|
|
18926
19025
|
import chalk143 from "chalk";
|
|
18927
19026
|
|
|
18928
19027
|
// src/shared/getRepoName.ts
|
|
18929
|
-
import { existsSync as
|
|
19028
|
+
import { existsSync as existsSync42, readFileSync as readFileSync32 } from "fs";
|
|
18930
19029
|
import { basename as basename12, join as join44 } from "path";
|
|
18931
19030
|
function getRepoName() {
|
|
18932
19031
|
const config = loadConfig();
|
|
@@ -18934,7 +19033,7 @@ function getRepoName() {
|
|
|
18934
19033
|
return config.devlog.name;
|
|
18935
19034
|
}
|
|
18936
19035
|
const packageJsonPath = join44(process.cwd(), "package.json");
|
|
18937
|
-
if (
|
|
19036
|
+
if (existsSync42(packageJsonPath)) {
|
|
18938
19037
|
try {
|
|
18939
19038
|
const content = readFileSync32(packageJsonPath, "utf8");
|
|
18940
19039
|
const pkg = JSON.parse(content);
|
|
@@ -19636,12 +19735,12 @@ function printJson(tree, totalCount, solutions) {
|
|
|
19636
19735
|
}
|
|
19637
19736
|
|
|
19638
19737
|
// src/commands/dotnet/resolveCsproj.ts
|
|
19639
|
-
import { existsSync as
|
|
19738
|
+
import { existsSync as existsSync43 } from "fs";
|
|
19640
19739
|
import path39 from "path";
|
|
19641
19740
|
import chalk152 from "chalk";
|
|
19642
19741
|
function resolveCsproj(csprojPath) {
|
|
19643
19742
|
const resolved = path39.resolve(csprojPath);
|
|
19644
|
-
if (!
|
|
19743
|
+
if (!existsSync43(resolved)) {
|
|
19645
19744
|
console.error(chalk152.red(`File not found: ${resolved}`));
|
|
19646
19745
|
process.exit(1);
|
|
19647
19746
|
}
|
|
@@ -19809,7 +19908,7 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
19809
19908
|
}
|
|
19810
19909
|
|
|
19811
19910
|
// src/commands/dotnet/resolveSolution.ts
|
|
19812
|
-
import { existsSync as
|
|
19911
|
+
import { existsSync as existsSync44 } from "fs";
|
|
19813
19912
|
import path40 from "path";
|
|
19814
19913
|
import chalk156 from "chalk";
|
|
19815
19914
|
|
|
@@ -19850,7 +19949,7 @@ function findSolution() {
|
|
|
19850
19949
|
function resolveSolution(sln) {
|
|
19851
19950
|
if (sln) {
|
|
19852
19951
|
const resolved = path40.resolve(sln);
|
|
19853
|
-
if (!
|
|
19952
|
+
if (!existsSync44(resolved)) {
|
|
19854
19953
|
console.error(chalk156.red(`Solution file not found: ${resolved}`));
|
|
19855
19954
|
process.exit(1);
|
|
19856
19955
|
}
|
|
@@ -19890,7 +19989,7 @@ function parseInspectReport(json) {
|
|
|
19890
19989
|
|
|
19891
19990
|
// src/commands/dotnet/runInspectCode.ts
|
|
19892
19991
|
import { execSync as execSync40 } from "child_process";
|
|
19893
|
-
import { existsSync as
|
|
19992
|
+
import { existsSync as existsSync45, readFileSync as readFileSync36, unlinkSync as unlinkSync10 } from "fs";
|
|
19894
19993
|
import { tmpdir as tmpdir4 } from "os";
|
|
19895
19994
|
import path41 from "path";
|
|
19896
19995
|
import chalk157 from "chalk";
|
|
@@ -19921,7 +20020,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
19921
20020
|
console.error(chalk157.red("jb inspectcode failed"));
|
|
19922
20021
|
process.exit(1);
|
|
19923
20022
|
}
|
|
19924
|
-
if (!
|
|
20023
|
+
if (!existsSync45(reportPath)) {
|
|
19925
20024
|
console.error(chalk157.red("Report file not generated"));
|
|
19926
20025
|
process.exit(1);
|
|
19927
20026
|
}
|
|
@@ -20210,11 +20309,11 @@ function decideCommentGuard(input, existingContent) {
|
|
|
20210
20309
|
}
|
|
20211
20310
|
|
|
20212
20311
|
// src/commands/dbMigration/consumeMigrationApproval.ts
|
|
20213
|
-
import { existsSync as
|
|
20312
|
+
import { existsSync as existsSync46, unlinkSync as unlinkSync11 } from "fs";
|
|
20214
20313
|
function consumeMigrationApproval(migrationId) {
|
|
20215
20314
|
sweepRestrictedDir();
|
|
20216
20315
|
const path80 = getMigrationApprovalPath(migrationId);
|
|
20217
|
-
if (!
|
|
20316
|
+
if (!existsSync46(path80)) return false;
|
|
20218
20317
|
try {
|
|
20219
20318
|
unlinkSync11(path80);
|
|
20220
20319
|
return true;
|
|
@@ -20547,7 +20646,7 @@ async function countPendingHandovers(orm, origin) {
|
|
|
20547
20646
|
|
|
20548
20647
|
// src/commands/handover/migrateDiskHandovers.ts
|
|
20549
20648
|
import {
|
|
20550
|
-
existsSync as
|
|
20649
|
+
existsSync as existsSync47,
|
|
20551
20650
|
readdirSync as readdirSync10,
|
|
20552
20651
|
readFileSync as readFileSync37,
|
|
20553
20652
|
rmSync as rmSync3,
|
|
@@ -20602,7 +20701,7 @@ function summariseHandoverContent(content) {
|
|
|
20602
20701
|
|
|
20603
20702
|
// src/commands/handover/migrateDiskHandovers.ts
|
|
20604
20703
|
function collectMarkdown(dir) {
|
|
20605
|
-
if (!
|
|
20704
|
+
if (!existsSync47(dir)) return [];
|
|
20606
20705
|
const out = [];
|
|
20607
20706
|
for (const entry of readdirSync10(dir, { withFileTypes: true })) {
|
|
20608
20707
|
const full = join52(dir, entry.name);
|
|
@@ -20629,7 +20728,7 @@ async function migrateDiskHandovers(orm, origin, cwd = process.cwd()) {
|
|
|
20629
20728
|
migrated++;
|
|
20630
20729
|
}
|
|
20631
20730
|
const handoverPath = getHandoverPath(cwd);
|
|
20632
|
-
if (
|
|
20731
|
+
if (existsSync47(handoverPath)) {
|
|
20633
20732
|
await migrateFile(orm, origin, handoverPath, statSync8(handoverPath).mtime);
|
|
20634
20733
|
migrated++;
|
|
20635
20734
|
}
|
|
@@ -20986,7 +21085,7 @@ function canonicalTreePath(path80) {
|
|
|
20986
21085
|
}
|
|
20987
21086
|
|
|
20988
21087
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
20989
|
-
import { existsSync as
|
|
21088
|
+
import { existsSync as existsSync48 } from "fs";
|
|
20990
21089
|
import { basename as basename16, dirname as dirname25 } from "path";
|
|
20991
21090
|
|
|
20992
21091
|
// src/commands/sessions/daemon/worktree/planAllocation.ts
|
|
@@ -21033,7 +21132,7 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
21033
21132
|
const base = strategy.root ? expandTilde2(strategy.root) : dirname25(clone);
|
|
21034
21133
|
const registered = new Set(listWorktreePaths(clone));
|
|
21035
21134
|
const branches = new Set(listLocalBranches(clone));
|
|
21036
|
-
const isTaken = (candidate) => registered.has(candidate) ||
|
|
21135
|
+
const isTaken = (candidate) => registered.has(candidate) || existsSync48(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename16(candidate));
|
|
21037
21136
|
const path80 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
21038
21137
|
const start3 = worktreeStartPoint(clone, strategy.trunk);
|
|
21039
21138
|
gitSync(clone, [
|
|
@@ -21059,7 +21158,7 @@ function keptInTree(cwd, reason4) {
|
|
|
21059
21158
|
}
|
|
21060
21159
|
|
|
21061
21160
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
21062
|
-
import { existsSync as
|
|
21161
|
+
import { existsSync as existsSync49 } from "fs";
|
|
21063
21162
|
var treeIsGone = { durable: true, gone: true };
|
|
21064
21163
|
function treeDurability(state) {
|
|
21065
21164
|
if (state.dirty) return { durable: false, reason: "uncommitted changes" };
|
|
@@ -21090,14 +21189,14 @@ function* durabilityProbes() {
|
|
|
21090
21189
|
});
|
|
21091
21190
|
}
|
|
21092
21191
|
async function checkDurability(cwd) {
|
|
21093
|
-
if (!
|
|
21192
|
+
if (!existsSync49(cwd)) return treeIsGone;
|
|
21094
21193
|
const probes = durabilityProbes();
|
|
21095
21194
|
let step2 = probes.next();
|
|
21096
21195
|
while (!step2.done) step2 = probes.next(await gitResult(cwd, step2.value));
|
|
21097
21196
|
return step2.value;
|
|
21098
21197
|
}
|
|
21099
21198
|
function checkDurabilitySync(cwd) {
|
|
21100
|
-
if (!
|
|
21199
|
+
if (!existsSync49(cwd)) return treeIsGone;
|
|
21101
21200
|
const probes = durabilityProbes();
|
|
21102
21201
|
let step2 = probes.next();
|
|
21103
21202
|
while (!step2.done) step2 = probes.next(gitSyncResult(cwd, step2.value));
|
|
@@ -21336,20 +21435,20 @@ function persistedTreeRoots() {
|
|
|
21336
21435
|
}
|
|
21337
21436
|
|
|
21338
21437
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
21339
|
-
import { copyFileSync, existsSync as
|
|
21438
|
+
import { copyFileSync, existsSync as existsSync51, mkdirSync as mkdirSync16 } from "fs";
|
|
21340
21439
|
import { dirname as dirname26, join as join55 } from "path";
|
|
21341
21440
|
|
|
21342
21441
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
21343
21442
|
import { spawn as spawn5 } from "child_process";
|
|
21344
21443
|
|
|
21345
21444
|
// src/commands/sessions/daemon/worktree/resolveInstallCommand.ts
|
|
21346
|
-
import { existsSync as
|
|
21445
|
+
import { existsSync as existsSync50 } from "fs";
|
|
21347
21446
|
import { join as join54 } from "path";
|
|
21348
21447
|
function detectInstallCommand(repoRoot2) {
|
|
21349
|
-
if (!
|
|
21350
|
-
if (
|
|
21351
|
-
if (
|
|
21352
|
-
if (
|
|
21448
|
+
if (!existsSync50(join54(repoRoot2, "package.json"))) return null;
|
|
21449
|
+
if (existsSync50(join54(repoRoot2, "pnpm-lock.yaml"))) return "pnpm install";
|
|
21450
|
+
if (existsSync50(join54(repoRoot2, "yarn.lock"))) return "yarn install";
|
|
21451
|
+
if (existsSync50(join54(repoRoot2, "bun.lockb"))) return "bun install";
|
|
21353
21452
|
return "npm install";
|
|
21354
21453
|
}
|
|
21355
21454
|
function resolveInstallCommand(repoRoot2, install) {
|
|
@@ -21462,7 +21561,7 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
21462
21561
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
21463
21562
|
for (const rel of copy) {
|
|
21464
21563
|
const src = join55(clone, rel);
|
|
21465
|
-
if (!
|
|
21564
|
+
if (!existsSync51(src)) continue;
|
|
21466
21565
|
const dest = join55(worktreePath, rel);
|
|
21467
21566
|
try {
|
|
21468
21567
|
mkdirSync16(dirname26(dest), { recursive: true });
|
|
@@ -22977,7 +23076,7 @@ import { tmpdir as tmpdir6 } from "os";
|
|
|
22977
23076
|
import { join as join62 } from "path";
|
|
22978
23077
|
|
|
22979
23078
|
// src/commands/prs/loadCommentsCache.ts
|
|
22980
|
-
import { existsSync as
|
|
23079
|
+
import { existsSync as existsSync52, readFileSync as readFileSync40, unlinkSync as unlinkSync13 } from "fs";
|
|
22981
23080
|
import { parse as parse2 } from "yaml";
|
|
22982
23081
|
|
|
22983
23082
|
// src/commands/prs/commentsCachePath.ts
|
|
@@ -22997,7 +23096,7 @@ function commentsCachePath(org, repo, prNumber) {
|
|
|
22997
23096
|
// src/commands/prs/loadCommentsCache.ts
|
|
22998
23097
|
function loadCommentsCache(org, repo, prNumber) {
|
|
22999
23098
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
23000
|
-
if (!
|
|
23099
|
+
if (!existsSync52(cachePath)) {
|
|
23001
23100
|
return null;
|
|
23002
23101
|
}
|
|
23003
23102
|
const content = readFileSync40(cachePath, "utf8");
|
|
@@ -23005,7 +23104,7 @@ function loadCommentsCache(org, repo, prNumber) {
|
|
|
23005
23104
|
}
|
|
23006
23105
|
function deleteCommentsCache(org, repo, prNumber) {
|
|
23007
23106
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
23008
|
-
if (
|
|
23107
|
+
if (existsSync52(cachePath)) {
|
|
23009
23108
|
unlinkSync13(cachePath);
|
|
23010
23109
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
23011
23110
|
}
|
|
@@ -27134,10 +27233,10 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
27134
27233
|
}
|
|
27135
27234
|
|
|
27136
27235
|
// src/commands/review/prepareReviewDir.ts
|
|
27137
|
-
import { existsSync as
|
|
27236
|
+
import { existsSync as existsSync53, mkdirSync as mkdirSync19, unlinkSync as unlinkSync17, writeFileSync as writeFileSync36 } from "fs";
|
|
27138
27237
|
function clearReviewFiles(paths) {
|
|
27139
27238
|
for (const path80 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
27140
|
-
if (
|
|
27239
|
+
if (existsSync53(path80)) unlinkSync17(path80);
|
|
27141
27240
|
}
|
|
27142
27241
|
}
|
|
27143
27242
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -27364,7 +27463,7 @@ function printReviewerFailures(results) {
|
|
|
27364
27463
|
}
|
|
27365
27464
|
|
|
27366
27465
|
// src/commands/review/runAndSynthesise.ts
|
|
27367
|
-
import { existsSync as
|
|
27466
|
+
import { existsSync as existsSync55, unlinkSync as unlinkSync19 } from "fs";
|
|
27368
27467
|
|
|
27369
27468
|
// src/commands/review/buildReviewerStdin.ts
|
|
27370
27469
|
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.
|
|
@@ -27793,7 +27892,7 @@ function resolveClaude(args) {
|
|
|
27793
27892
|
}
|
|
27794
27893
|
|
|
27795
27894
|
// src/commands/review/runCodexReviewer.ts
|
|
27796
|
-
import { existsSync as
|
|
27895
|
+
import { existsSync as existsSync54, unlinkSync as unlinkSync18 } from "fs";
|
|
27797
27896
|
|
|
27798
27897
|
// src/commands/review/parseCodexEvent.ts
|
|
27799
27898
|
function isItemStarted(value) {
|
|
@@ -27845,7 +27944,7 @@ async function runCodexReviewer(spec) {
|
|
|
27845
27944
|
reportReviewerToolUse(spec.name, event, spinner);
|
|
27846
27945
|
}
|
|
27847
27946
|
});
|
|
27848
|
-
if (result.exitCode !== 0 &&
|
|
27947
|
+
if (result.exitCode !== 0 && existsSync54(spec.outputPath)) {
|
|
27849
27948
|
unlinkSync18(spec.outputPath);
|
|
27850
27949
|
}
|
|
27851
27950
|
return finaliseReviewerRun({ ...spec, command }, spinner, result);
|
|
@@ -28000,7 +28099,7 @@ async function runAndSynthesise(args) {
|
|
|
28000
28099
|
console.error("Both reviewers failed; skipping synthesis.");
|
|
28001
28100
|
return { ok: false, failures };
|
|
28002
28101
|
}
|
|
28003
|
-
if (anyFresh &&
|
|
28102
|
+
if (anyFresh && existsSync55(paths.synthesisPath)) {
|
|
28004
28103
|
unlinkSync19(paths.synthesisPath);
|
|
28005
28104
|
}
|
|
28006
28105
|
const synthesisResult = await synthesise(paths, { multi });
|
|
@@ -29299,11 +29398,11 @@ async function configure() {
|
|
|
29299
29398
|
}
|
|
29300
29399
|
|
|
29301
29400
|
// src/commands/transcript/list.ts
|
|
29302
|
-
import { existsSync as
|
|
29401
|
+
import { existsSync as existsSync60, readdirSync as readdirSync19, statSync as statSync10 } from "fs";
|
|
29303
29402
|
import { join as join76 } from "path";
|
|
29304
29403
|
function list4() {
|
|
29305
29404
|
const { vttDir } = getTranscriptConfig();
|
|
29306
|
-
if (!
|
|
29405
|
+
if (!existsSync60(vttDir)) return;
|
|
29307
29406
|
for (const entry of readdirSync19(vttDir)) {
|
|
29308
29407
|
if (!entry.endsWith(".vtt")) continue;
|
|
29309
29408
|
if (statSync10(join76(vttDir, entry)).isDirectory()) continue;
|
|
@@ -29313,7 +29412,7 @@ function list4() {
|
|
|
29313
29412
|
|
|
29314
29413
|
// src/commands/transcript/move.ts
|
|
29315
29414
|
import {
|
|
29316
|
-
existsSync as
|
|
29415
|
+
existsSync as existsSync61,
|
|
29317
29416
|
mkdirSync as mkdirSync25,
|
|
29318
29417
|
readFileSync as readFileSync47,
|
|
29319
29418
|
renameSync as renameSync2,
|
|
@@ -29545,7 +29644,7 @@ function move(file, options2) {
|
|
|
29545
29644
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
29546
29645
|
const filename = basename21(file);
|
|
29547
29646
|
const sourcePath = join77(vttDir, filename);
|
|
29548
|
-
if (!
|
|
29647
|
+
if (!existsSync61(sourcePath)) {
|
|
29549
29648
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
29550
29649
|
process.exit(1);
|
|
29551
29650
|
}
|
|
@@ -29674,9 +29773,9 @@ function devices() {
|
|
|
29674
29773
|
}
|
|
29675
29774
|
|
|
29676
29775
|
// src/commands/voice/logs.ts
|
|
29677
|
-
import { existsSync as
|
|
29776
|
+
import { existsSync as existsSync62, readFileSync as readFileSync48 } from "fs";
|
|
29678
29777
|
function logs(options2) {
|
|
29679
|
-
if (!
|
|
29778
|
+
if (!existsSync62(voicePaths.log)) {
|
|
29680
29779
|
console.log("No voice log file found");
|
|
29681
29780
|
return;
|
|
29682
29781
|
}
|
|
@@ -29708,7 +29807,7 @@ import { join as join81 } from "path";
|
|
|
29708
29807
|
|
|
29709
29808
|
// src/commands/voice/checkLockFile.ts
|
|
29710
29809
|
import { execSync as execSync58 } from "child_process";
|
|
29711
|
-
import { existsSync as
|
|
29810
|
+
import { existsSync as existsSync63, mkdirSync as mkdirSync26, readFileSync as readFileSync49, writeFileSync as writeFileSync42 } from "fs";
|
|
29712
29811
|
import { join as join80 } from "path";
|
|
29713
29812
|
function isProcessAlive2(pid) {
|
|
29714
29813
|
try {
|
|
@@ -29720,7 +29819,7 @@ function isProcessAlive2(pid) {
|
|
|
29720
29819
|
}
|
|
29721
29820
|
function checkLockFile() {
|
|
29722
29821
|
const lockFile = getLockFile();
|
|
29723
|
-
if (!
|
|
29822
|
+
if (!existsSync63(lockFile)) return;
|
|
29724
29823
|
try {
|
|
29725
29824
|
const lock2 = JSON.parse(readFileSync49(lockFile, "utf8"));
|
|
29726
29825
|
if (lock2.pid && isProcessAlive2(lock2.pid)) {
|
|
@@ -29733,7 +29832,7 @@ function checkLockFile() {
|
|
|
29733
29832
|
}
|
|
29734
29833
|
}
|
|
29735
29834
|
function bootstrapVenv() {
|
|
29736
|
-
if (
|
|
29835
|
+
if (existsSync63(getVenvPython())) return;
|
|
29737
29836
|
console.log("Setting up Python environment...");
|
|
29738
29837
|
const pythonDir = getPythonDir();
|
|
29739
29838
|
execSync58(
|
|
@@ -29824,7 +29923,7 @@ function start2(options2) {
|
|
|
29824
29923
|
}
|
|
29825
29924
|
|
|
29826
29925
|
// src/commands/voice/status.ts
|
|
29827
|
-
import { existsSync as
|
|
29926
|
+
import { existsSync as existsSync64, readFileSync as readFileSync50 } from "fs";
|
|
29828
29927
|
function isProcessAlive3(pid) {
|
|
29829
29928
|
try {
|
|
29830
29929
|
process.kill(pid, 0);
|
|
@@ -29834,12 +29933,12 @@ function isProcessAlive3(pid) {
|
|
|
29834
29933
|
}
|
|
29835
29934
|
}
|
|
29836
29935
|
function readRecentLogs(count8) {
|
|
29837
|
-
if (!
|
|
29936
|
+
if (!existsSync64(voicePaths.log)) return [];
|
|
29838
29937
|
const lines2 = readFileSync50(voicePaths.log, "utf8").trim().split("\n");
|
|
29839
29938
|
return lines2.slice(-count8);
|
|
29840
29939
|
}
|
|
29841
29940
|
function status2() {
|
|
29842
|
-
if (!
|
|
29941
|
+
if (!existsSync64(voicePaths.pid)) {
|
|
29843
29942
|
console.log("Voice daemon: not running (no PID file)");
|
|
29844
29943
|
return;
|
|
29845
29944
|
}
|
|
@@ -29862,9 +29961,9 @@ function status2() {
|
|
|
29862
29961
|
}
|
|
29863
29962
|
|
|
29864
29963
|
// src/commands/voice/stop.ts
|
|
29865
|
-
import { existsSync as
|
|
29964
|
+
import { existsSync as existsSync65, readFileSync as readFileSync51, unlinkSync as unlinkSync20 } from "fs";
|
|
29866
29965
|
function stop2() {
|
|
29867
|
-
if (!
|
|
29966
|
+
if (!existsSync65(voicePaths.pid)) {
|
|
29868
29967
|
console.log("Voice daemon is not running (no PID file)");
|
|
29869
29968
|
return;
|
|
29870
29969
|
}
|
|
@@ -29881,7 +29980,7 @@ function stop2() {
|
|
|
29881
29980
|
}
|
|
29882
29981
|
try {
|
|
29883
29982
|
const lockFile = getLockFile();
|
|
29884
|
-
if (
|
|
29983
|
+
if (existsSync65(lockFile)) unlinkSync20(lockFile);
|
|
29885
29984
|
} catch {
|
|
29886
29985
|
}
|
|
29887
29986
|
console.log("Voice daemon stopped");
|
|
@@ -30244,7 +30343,7 @@ function resolveParams(params, cliArgs) {
|
|
|
30244
30343
|
}
|
|
30245
30344
|
|
|
30246
30345
|
// src/commands/run/resolveRunCwd.ts
|
|
30247
|
-
import { existsSync as
|
|
30346
|
+
import { existsSync as existsSync66 } from "fs";
|
|
30248
30347
|
import { resolve as resolve18 } from "path";
|
|
30249
30348
|
var MissingRunCwdError = class extends Error {
|
|
30250
30349
|
constructor(runName, cwd) {
|
|
@@ -30257,17 +30356,17 @@ var MissingRunCwdError = class extends Error {
|
|
|
30257
30356
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
30258
30357
|
if (!config.cwd) return void 0;
|
|
30259
30358
|
const cwd = resolve18(baseDir, config.cwd);
|
|
30260
|
-
if (!
|
|
30359
|
+
if (!existsSync66(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
30261
30360
|
return cwd;
|
|
30262
30361
|
}
|
|
30263
30362
|
|
|
30264
30363
|
// src/commands/run/runCommandToCompletion.ts
|
|
30265
30364
|
import { spawn as spawn9 } from "child_process";
|
|
30266
|
-
import { existsSync as
|
|
30365
|
+
import { existsSync as existsSync68 } from "fs";
|
|
30267
30366
|
|
|
30268
30367
|
// src/commands/run/resolveCommand.ts
|
|
30269
30368
|
import { execFileSync as execFileSync11 } from "child_process";
|
|
30270
|
-
import { existsSync as
|
|
30369
|
+
import { existsSync as existsSync67 } from "fs";
|
|
30271
30370
|
import { dirname as dirname35, join as join84, resolve as resolve19 } from "path";
|
|
30272
30371
|
function resolveCommand2(command) {
|
|
30273
30372
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
@@ -30275,7 +30374,7 @@ function resolveCommand2(command) {
|
|
|
30275
30374
|
const gitPath = execFileSync11("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
30276
30375
|
const gitRoot = resolve19(dirname35(gitPath), "..");
|
|
30277
30376
|
const gitBash = join84(gitRoot, "bin", "bash.exe");
|
|
30278
|
-
if (
|
|
30377
|
+
if (existsSync67(gitBash)) return gitBash;
|
|
30279
30378
|
} catch {
|
|
30280
30379
|
return command;
|
|
30281
30380
|
}
|
|
@@ -30285,7 +30384,7 @@ function resolveCommand2(command) {
|
|
|
30285
30384
|
// src/commands/run/runCommandToCompletion.ts
|
|
30286
30385
|
function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
30287
30386
|
return new Promise((resolveResult) => {
|
|
30288
|
-
if (cwd && !
|
|
30387
|
+
if (cwd && !existsSync68(cwd)) {
|
|
30289
30388
|
resolveResult({
|
|
30290
30389
|
kind: "failed",
|
|
30291
30390
|
message: `Failed to execute command: cwd ${cwd} does not exist`
|
|
@@ -30954,7 +31053,7 @@ function link2() {
|
|
|
30954
31053
|
}
|
|
30955
31054
|
|
|
30956
31055
|
// src/commands/run/remove.ts
|
|
30957
|
-
import { existsSync as
|
|
31056
|
+
import { existsSync as existsSync69, unlinkSync as unlinkSync21 } from "fs";
|
|
30958
31057
|
import { join as join87 } from "path";
|
|
30959
31058
|
function findRemoveIndex() {
|
|
30960
31059
|
const idx = process.argv.indexOf("remove");
|
|
@@ -30971,7 +31070,7 @@ function parseRemoveName() {
|
|
|
30971
31070
|
}
|
|
30972
31071
|
function deleteCommandFile(name) {
|
|
30973
31072
|
const filePath = join87(".claude", "commands", `${name}.md`);
|
|
30974
|
-
if (
|
|
31073
|
+
if (existsSync69(filePath)) {
|
|
30975
31074
|
unlinkSync21(filePath);
|
|
30976
31075
|
console.log(`Deleted command file: ${filePath}`);
|
|
30977
31076
|
}
|
|
@@ -31016,7 +31115,7 @@ function registerRun(program2) {
|
|
|
31016
31115
|
|
|
31017
31116
|
// src/commands/screenshot/index.ts
|
|
31018
31117
|
import { execSync as execSync60 } from "child_process";
|
|
31019
|
-
import { existsSync as
|
|
31118
|
+
import { existsSync as existsSync70, mkdirSync as mkdirSync30, unlinkSync as unlinkSync22, writeFileSync as writeFileSync45 } from "fs";
|
|
31020
31119
|
import { tmpdir as tmpdir8 } from "os";
|
|
31021
31120
|
import { join as join88, resolve as resolve20 } from "path";
|
|
31022
31121
|
import chalk216 from "chalk";
|
|
@@ -31148,7 +31247,7 @@ Write-Output $OutputPath
|
|
|
31148
31247
|
|
|
31149
31248
|
// src/commands/screenshot/index.ts
|
|
31150
31249
|
function buildOutputPath(outputDir, processName) {
|
|
31151
|
-
if (!
|
|
31250
|
+
if (!existsSync70(outputDir)) {
|
|
31152
31251
|
mkdirSync30(outputDir, { recursive: true });
|
|
31153
31252
|
}
|
|
31154
31253
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
@@ -31483,12 +31582,12 @@ function toSessionRunInfo({
|
|
|
31483
31582
|
}
|
|
31484
31583
|
|
|
31485
31584
|
// src/commands/sessions/daemon/worktree/joinRefusal.ts
|
|
31486
|
-
import { existsSync as
|
|
31585
|
+
import { existsSync as existsSync71 } from "fs";
|
|
31487
31586
|
function joinRefusal(session) {
|
|
31488
31587
|
if (session.commandType === "run") return "a server run has no agent stream";
|
|
31489
31588
|
if (session.closing === true) return "the session is closing";
|
|
31490
31589
|
if (!session.cwd) return "the session has no working directory";
|
|
31491
|
-
if (!
|
|
31590
|
+
if (!existsSync71(session.cwd))
|
|
31492
31591
|
return "the session's workspace no longer exists";
|
|
31493
31592
|
return void 0;
|
|
31494
31593
|
}
|
|
@@ -31652,11 +31751,11 @@ function sessionBase(id, status3) {
|
|
|
31652
31751
|
}
|
|
31653
31752
|
|
|
31654
31753
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
31655
|
-
import { existsSync as
|
|
31754
|
+
import { existsSync as existsSync73 } from "fs";
|
|
31656
31755
|
import * as pty from "node-pty";
|
|
31657
31756
|
|
|
31658
31757
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
31659
|
-
import { chmodSync, existsSync as
|
|
31758
|
+
import { chmodSync, existsSync as existsSync72, statSync as statSync12 } from "fs";
|
|
31660
31759
|
import { createRequire as createRequire3 } from "module";
|
|
31661
31760
|
import path75 from "path";
|
|
31662
31761
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -31671,7 +31770,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
31671
31770
|
`${process.platform}-${process.arch}`,
|
|
31672
31771
|
"spawn-helper"
|
|
31673
31772
|
);
|
|
31674
|
-
if (!
|
|
31773
|
+
if (!existsSync72(helper)) return;
|
|
31675
31774
|
const mode = statSync12(helper).mode;
|
|
31676
31775
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
31677
31776
|
}
|
|
@@ -31707,7 +31806,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
|
|
|
31707
31806
|
});
|
|
31708
31807
|
}
|
|
31709
31808
|
function refuseMissingCwd(cwd, sessionId) {
|
|
31710
|
-
if (!cwd ||
|
|
31809
|
+
if (!cwd || existsSync73(cwd)) return;
|
|
31711
31810
|
daemonLog(
|
|
31712
31811
|
`${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
|
|
31713
31812
|
);
|
|
@@ -31881,11 +31980,11 @@ function setStatus2(session, newStatus) {
|
|
|
31881
31980
|
}
|
|
31882
31981
|
|
|
31883
31982
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
31884
|
-
import { existsSync as
|
|
31983
|
+
import { existsSync as existsSync75 } from "fs";
|
|
31885
31984
|
import { basename as basename22 } from "path";
|
|
31886
31985
|
|
|
31887
31986
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
31888
|
-
import { existsSync as
|
|
31987
|
+
import { existsSync as existsSync74 } from "fs";
|
|
31889
31988
|
import { join as join91 } from "path";
|
|
31890
31989
|
|
|
31891
31990
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
@@ -31955,7 +32054,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
31955
32054
|
);
|
|
31956
32055
|
}
|
|
31957
32056
|
function strandedReason(worktreePath, cause) {
|
|
31958
|
-
if (!
|
|
32057
|
+
if (!existsSync74(join91(worktreePath, ".git")))
|
|
31959
32058
|
return "its .git link is already gone";
|
|
31960
32059
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
31961
32060
|
return "git no longer recognises it as a working tree";
|
|
@@ -32007,7 +32106,7 @@ function reason3(error) {
|
|
|
32007
32106
|
|
|
32008
32107
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
32009
32108
|
async function reapWorktree(worktreePath, force = false) {
|
|
32010
|
-
if (!
|
|
32109
|
+
if (!existsSync75(worktreePath)) {
|
|
32011
32110
|
forgetWorktree(worktreePath);
|
|
32012
32111
|
daemonLog(
|
|
32013
32112
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -32032,7 +32131,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
32032
32131
|
}
|
|
32033
32132
|
function owningClone(worktreePath) {
|
|
32034
32133
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
32035
|
-
if (recorded &&
|
|
32134
|
+
if (recorded && existsSync75(recorded)) return recorded;
|
|
32036
32135
|
const detected = mainWorktree(worktreePath);
|
|
32037
32136
|
if (detected) return detected;
|
|
32038
32137
|
daemonLog(
|
|
@@ -32160,12 +32259,12 @@ function closeGateApplies(sessions, session) {
|
|
|
32160
32259
|
}
|
|
32161
32260
|
|
|
32162
32261
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
32163
|
-
import { existsSync as
|
|
32262
|
+
import { existsSync as existsSync76, watch } from "fs";
|
|
32164
32263
|
var DEBOUNCE_MS = 500;
|
|
32165
32264
|
var POLL_MS = 3e4;
|
|
32166
32265
|
function watchGitState(cwd, onChange) {
|
|
32167
32266
|
const common = gitCommonDir(cwd);
|
|
32168
|
-
if (!common || !
|
|
32267
|
+
if (!common || !existsSync76(common)) return void 0;
|
|
32169
32268
|
const watchers = [
|
|
32170
32269
|
watchGitDir(common, onChange),
|
|
32171
32270
|
pollGitState(cwd, onChange)
|
|
@@ -32621,10 +32720,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
32621
32720
|
}
|
|
32622
32721
|
|
|
32623
32722
|
// src/commands/sessions/daemon/exitReason.ts
|
|
32624
|
-
import { existsSync as
|
|
32723
|
+
import { existsSync as existsSync77 } from "fs";
|
|
32625
32724
|
import { resolve as resolve21 } from "path";
|
|
32626
32725
|
function exitDetail(session) {
|
|
32627
|
-
if (session.cwd && !
|
|
32726
|
+
if (session.cwd && !existsSync77(session.cwd))
|
|
32628
32727
|
return `working directory ${session.cwd} no longer exists`;
|
|
32629
32728
|
return missingRunConfigCwd(session);
|
|
32630
32729
|
}
|
|
@@ -32638,7 +32737,7 @@ function missingRunConfigCwd(session) {
|
|
|
32638
32737
|
const config = resolveRunConfig(session.runName, dir);
|
|
32639
32738
|
if (!config?.cwd) return void 0;
|
|
32640
32739
|
const configured = resolve21(runConfigBaseDirFrom(dir), config.cwd);
|
|
32641
|
-
if (
|
|
32740
|
+
if (existsSync77(configured)) return void 0;
|
|
32642
32741
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
32643
32742
|
}
|
|
32644
32743
|
|
|
@@ -32679,7 +32778,7 @@ function handleFailedResume(session, exitCode, onStatusChange) {
|
|
|
32679
32778
|
}
|
|
32680
32779
|
|
|
32681
32780
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
32682
|
-
import { existsSync as
|
|
32781
|
+
import { existsSync as existsSync78, mkdirSync as mkdirSync31, watch as watch2 } from "fs";
|
|
32683
32782
|
import { dirname as dirname37 } from "path";
|
|
32684
32783
|
|
|
32685
32784
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
@@ -32765,7 +32864,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
32765
32864
|
if (timer) clearTimeout(timer);
|
|
32766
32865
|
timer = setTimeout(read2, DEBOUNCE_MS2);
|
|
32767
32866
|
});
|
|
32768
|
-
if (
|
|
32867
|
+
if (existsSync78(path80)) read2();
|
|
32769
32868
|
}
|
|
32770
32869
|
function refreshActivity(session) {
|
|
32771
32870
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -34378,7 +34477,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
34378
34477
|
}
|
|
34379
34478
|
|
|
34380
34479
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
34381
|
-
import { existsSync as
|
|
34480
|
+
import { existsSync as existsSync81 } from "fs";
|
|
34382
34481
|
import { basename as basename24 } from "path";
|
|
34383
34482
|
|
|
34384
34483
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -34433,9 +34532,9 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
34433
34532
|
}
|
|
34434
34533
|
|
|
34435
34534
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
34436
|
-
import { existsSync as
|
|
34535
|
+
import { existsSync as existsSync80 } from "fs";
|
|
34437
34536
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
34438
|
-
if (!
|
|
34537
|
+
if (!existsSync80(clone)) {
|
|
34439
34538
|
for (const { path: path80 } of paths) forgetWorktree(path80);
|
|
34440
34539
|
daemonLog(
|
|
34441
34540
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
@@ -34601,7 +34700,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
34601
34700
|
);
|
|
34602
34701
|
continue;
|
|
34603
34702
|
}
|
|
34604
|
-
if (!
|
|
34703
|
+
if (!existsSync81(path80)) {
|
|
34605
34704
|
logVanishedTree(sessions, path80);
|
|
34606
34705
|
vanished.set(clone, [
|
|
34607
34706
|
...vanished.get(clone) ?? [],
|
|
@@ -35182,13 +35281,13 @@ async function defaultConnect() {
|
|
|
35182
35281
|
}
|
|
35183
35282
|
|
|
35184
35283
|
// src/commands/sessions/daemon/hasPersistedWindowsSessions.ts
|
|
35185
|
-
import { existsSync as
|
|
35186
|
-
import { posix } from "path";
|
|
35284
|
+
import { existsSync as existsSync82, readFileSync as readFileSync55 } from "fs";
|
|
35285
|
+
import { posix as posix3 } from "path";
|
|
35187
35286
|
function hasPersistedWindowsSessions() {
|
|
35188
35287
|
const sessionsFile = windowsSessionsFileFromWsl();
|
|
35189
35288
|
if (!sessionsFile) return false;
|
|
35190
35289
|
try {
|
|
35191
|
-
if (!
|
|
35290
|
+
if (!existsSync82(sessionsFile)) return false;
|
|
35192
35291
|
const data = JSON.parse(readFileSync55(sessionsFile, "utf8"));
|
|
35193
35292
|
return Array.isArray(data) && data.length > 0;
|
|
35194
35293
|
} catch (error) {
|
|
@@ -35200,10 +35299,9 @@ function hasPersistedWindowsSessions() {
|
|
|
35200
35299
|
}
|
|
35201
35300
|
}
|
|
35202
35301
|
function windowsSessionsFileFromWsl() {
|
|
35203
|
-
const
|
|
35204
|
-
if (!
|
|
35205
|
-
|
|
35206
|
-
return posix.join(winHome, ".assist", "sessions.json");
|
|
35302
|
+
const winHome = windowsHomeFromWsl();
|
|
35303
|
+
if (!winHome) return null;
|
|
35304
|
+
return posix3.join(winHome, ".assist", "sessions.json");
|
|
35207
35305
|
}
|
|
35208
35306
|
|
|
35209
35307
|
// src/commands/sessions/daemon/discoverWindowsSessions.ts
|
|
@@ -35794,7 +35892,7 @@ function addAgentToStream(ctx, targetId, prompt, harness) {
|
|
|
35794
35892
|
}
|
|
35795
35893
|
|
|
35796
35894
|
// src/commands/sessions/daemon/worktree/spawnInTree.ts
|
|
35797
|
-
import { existsSync as
|
|
35895
|
+
import { existsSync as existsSync85 } from "fs";
|
|
35798
35896
|
|
|
35799
35897
|
// src/commands/sessions/daemon/createAssistSession.ts
|
|
35800
35898
|
function createAssistSession(id, assistArgs, cwd, meta, holdPty) {
|
|
@@ -35849,10 +35947,10 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
|
35849
35947
|
}
|
|
35850
35948
|
|
|
35851
35949
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
35852
|
-
import { existsSync as
|
|
35950
|
+
import { existsSync as existsSync84 } from "fs";
|
|
35853
35951
|
|
|
35854
35952
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
35855
|
-
import { copyFileSync as copyFileSync7, existsSync as
|
|
35953
|
+
import { copyFileSync as copyFileSync7, existsSync as existsSync83, mkdirSync as mkdirSync33 } from "fs";
|
|
35856
35954
|
import { join as join93 } from "path";
|
|
35857
35955
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
35858
35956
|
const dir = projectDirForCwd(toCwd);
|
|
@@ -35863,7 +35961,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
35863
35961
|
return;
|
|
35864
35962
|
}
|
|
35865
35963
|
const dest = join93(dir, `${claudeSessionId}.jsonl`);
|
|
35866
|
-
if (
|
|
35964
|
+
if (existsSync83(dest)) {
|
|
35867
35965
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
35868
35966
|
return;
|
|
35869
35967
|
}
|
|
@@ -35914,7 +36012,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
|
|
|
35914
36012
|
}
|
|
35915
36013
|
function cloneForReapedTree(missingCwd) {
|
|
35916
36014
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
35917
|
-
if (!clone || !
|
|
36015
|
+
if (!clone || !existsSync84(clone))
|
|
35918
36016
|
throw new Error(
|
|
35919
36017
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
35920
36018
|
);
|
|
@@ -35948,7 +36046,7 @@ function spawnAssistInTree(ctx, assistArgs, cwd, meta, context) {
|
|
|
35948
36046
|
return id;
|
|
35949
36047
|
}
|
|
35950
36048
|
function resumeInTree(ctx, sessionId, cwd, name, harness) {
|
|
35951
|
-
if (!
|
|
36049
|
+
if (!existsSync85(cwd))
|
|
35952
36050
|
return resumeInReplacementTree(ctx, sessionId, cwd, name, harness);
|
|
35953
36051
|
const id = ctx.spawnWith(
|
|
35954
36052
|
(sid) => resumeSession(sid, sessionId, cwd, name, void 0, harness)
|
|
@@ -36361,9 +36459,9 @@ function safeParse2(line) {
|
|
|
36361
36459
|
}
|
|
36362
36460
|
|
|
36363
36461
|
// src/commands/sessions/daemon/repoDirExists.ts
|
|
36364
|
-
import { existsSync as
|
|
36462
|
+
import { existsSync as existsSync86 } from "fs";
|
|
36365
36463
|
function repoDirExists(cwd) {
|
|
36366
|
-
return
|
|
36464
|
+
return existsSync86(toGitCwd(cwd));
|
|
36367
36465
|
}
|
|
36368
36466
|
|
|
36369
36467
|
// src/commands/sessions/daemon/withRepoGroups.ts
|