@staff0rd/assist 0.1059.0 → 0.1059.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 +2 -2
- package/dist/index.js +498 -427
- 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.1059.
|
|
9
|
+
version: "0.1059.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -12979,6 +12979,12 @@ function unsetConfig(req, res) {
|
|
|
12979
12979
|
});
|
|
12980
12980
|
}
|
|
12981
12981
|
|
|
12982
|
+
// src/commands/watch/isBuildPending.ts
|
|
12983
|
+
import { existsSync as existsSync24 } from "fs";
|
|
12984
|
+
|
|
12985
|
+
// src/commands/watch/gitMarkerPath.ts
|
|
12986
|
+
import { resolve as resolve11 } from "path";
|
|
12987
|
+
|
|
12982
12988
|
// src/commands/watch/resolveUpstream.ts
|
|
12983
12989
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
12984
12990
|
function runGit3(args, cwd) {
|
|
@@ -13020,9 +13026,26 @@ function resolveUpstream(cwd) {
|
|
|
13020
13026
|
}
|
|
13021
13027
|
}
|
|
13022
13028
|
|
|
13023
|
-
// src/commands/watch/
|
|
13024
|
-
function
|
|
13025
|
-
return
|
|
13029
|
+
// src/commands/watch/gitMarkerPath.ts
|
|
13030
|
+
function gitMarkerPath(name, cwd) {
|
|
13031
|
+
return resolve11(
|
|
13032
|
+
cwd ?? process.cwd(),
|
|
13033
|
+
runGit3(["rev-parse", "--git-path", name], cwd)
|
|
13034
|
+
);
|
|
13035
|
+
}
|
|
13036
|
+
|
|
13037
|
+
// src/commands/watch/buildPendingPath.ts
|
|
13038
|
+
function buildPendingPath(cwd) {
|
|
13039
|
+
return gitMarkerPath("assist-watch-build-pending", cwd);
|
|
13040
|
+
}
|
|
13041
|
+
|
|
13042
|
+
// src/commands/watch/isBuildPending.ts
|
|
13043
|
+
function isBuildPending(cwd) {
|
|
13044
|
+
try {
|
|
13045
|
+
return existsSync24(buildPendingPath(cwd));
|
|
13046
|
+
} catch {
|
|
13047
|
+
return false;
|
|
13048
|
+
}
|
|
13026
13049
|
}
|
|
13027
13050
|
|
|
13028
13051
|
// src/commands/watch/readBuiltVersion.ts
|
|
@@ -13102,13 +13125,13 @@ import { readFile as readFile2 } from "fs/promises";
|
|
|
13102
13125
|
import { join as join30 } from "path";
|
|
13103
13126
|
|
|
13104
13127
|
// src/commands/extension/extensionDir.ts
|
|
13105
|
-
import { existsSync as
|
|
13128
|
+
import { existsSync as existsSync26 } from "fs";
|
|
13106
13129
|
import { dirname as dirname14, join as join29 } from "path";
|
|
13107
13130
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
13108
13131
|
var moduleDir = dirname14(fileURLToPath2(import.meta.url));
|
|
13109
13132
|
function extensionDir() {
|
|
13110
13133
|
const bundled = join29(moduleDir, "commands", "extension", "extension");
|
|
13111
|
-
if (
|
|
13134
|
+
if (existsSync26(bundled)) return bundled;
|
|
13112
13135
|
return join29(moduleDir, "..", "..", "..", "extension");
|
|
13113
13136
|
}
|
|
13114
13137
|
|
|
@@ -13173,6 +13196,7 @@ function targetsSince(commit2, target, changedSince2) {
|
|
|
13173
13196
|
return commit2 !== void 0 && restartTargets(changedSince2(commit2)).includes(target);
|
|
13174
13197
|
}
|
|
13175
13198
|
function pendingRestarts(input) {
|
|
13199
|
+
if (input.buildPending) return [];
|
|
13176
13200
|
const { daemonVersion, built, changedSince: changedSince2 } = input;
|
|
13177
13201
|
const daemon = daemonVersion !== void 0 && (built !== "unknown" && daemonVersion !== built || targetsSince(input.daemonStartCommit, "daemon", changedSince2));
|
|
13178
13202
|
const web3 = targetsSince(input.webStartCommit, "webserver", changedSince2);
|
|
@@ -13198,12 +13222,12 @@ import { basename as basename10, join as join31 } from "path";
|
|
|
13198
13222
|
|
|
13199
13223
|
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
13200
13224
|
import { realpathSync } from "fs";
|
|
13201
|
-
import { resolve as
|
|
13225
|
+
import { resolve as resolve12 } from "path";
|
|
13202
13226
|
function canonicalTreePath(path109) {
|
|
13203
13227
|
try {
|
|
13204
13228
|
return realpathSync(path109);
|
|
13205
13229
|
} catch {
|
|
13206
|
-
return
|
|
13230
|
+
return resolve12(path109);
|
|
13207
13231
|
}
|
|
13208
13232
|
}
|
|
13209
13233
|
|
|
@@ -13239,7 +13263,12 @@ var webStartCommit = {
|
|
|
13239
13263
|
value: () => captured
|
|
13240
13264
|
};
|
|
13241
13265
|
|
|
13242
|
-
// src/commands/
|
|
13266
|
+
// src/commands/watch/changedPaths.ts
|
|
13267
|
+
function changedPaths(from, cwd) {
|
|
13268
|
+
return runGit3(["diff", "--name-only", `${from}..HEAD`], cwd).split("\n").filter((line) => line.length > 0);
|
|
13269
|
+
}
|
|
13270
|
+
|
|
13271
|
+
// src/commands/sessions/web/updates/changedSince.ts
|
|
13243
13272
|
function changedSince(installDir) {
|
|
13244
13273
|
return (commit2) => {
|
|
13245
13274
|
try {
|
|
@@ -13249,6 +13278,8 @@ function changedSince(installDir) {
|
|
|
13249
13278
|
}
|
|
13250
13279
|
};
|
|
13251
13280
|
}
|
|
13281
|
+
|
|
13282
|
+
// src/commands/sessions/web/updates/updates.ts
|
|
13252
13283
|
async function updates(_req, res) {
|
|
13253
13284
|
const installDir = getInstallDir();
|
|
13254
13285
|
const reply2 = await requestDaemonReply(
|
|
@@ -13256,16 +13287,19 @@ async function updates(_req, res) {
|
|
|
13256
13287
|
"auto-update"
|
|
13257
13288
|
);
|
|
13258
13289
|
const built = readBuiltVersion(installDir);
|
|
13290
|
+
const buildPending = isBuildPending(installDir);
|
|
13259
13291
|
const status2 = {
|
|
13260
13292
|
nodeName: resolveNodeName(),
|
|
13261
13293
|
installDir,
|
|
13262
13294
|
running: reply2?.version ?? ASSIST_VERSION,
|
|
13263
13295
|
built,
|
|
13296
|
+
buildPending,
|
|
13264
13297
|
restart: pendingRestarts({
|
|
13265
13298
|
daemonVersion: reply2?.version,
|
|
13266
13299
|
daemonStartCommit: reply2?.startCommit,
|
|
13267
13300
|
webStartCommit: webStartCommit.value(),
|
|
13268
13301
|
built,
|
|
13302
|
+
buildPending,
|
|
13269
13303
|
changedSince: changedSince(installDir)
|
|
13270
13304
|
}),
|
|
13271
13305
|
daemonReachable: reply2 !== void 0,
|
|
@@ -13414,7 +13448,7 @@ import { readFile as readFile3, stat as stat3, writeFile as writeFile2 } from "f
|
|
|
13414
13448
|
|
|
13415
13449
|
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
13416
13450
|
import { execFile as execFile9 } from "child_process";
|
|
13417
|
-
import { existsSync as
|
|
13451
|
+
import { existsSync as existsSync27 } from "fs";
|
|
13418
13452
|
import { dirname as dirname15, join as join33 } from "path";
|
|
13419
13453
|
import { promisify as promisify10 } from "util";
|
|
13420
13454
|
var execFileAsync9 = promisify10(execFile9);
|
|
@@ -13423,7 +13457,7 @@ function findOxfmtScript(root2) {
|
|
|
13423
13457
|
let dir = root2;
|
|
13424
13458
|
for (; ; ) {
|
|
13425
13459
|
const candidate = join33(dir, "node_modules", "oxfmt", "bin", "oxfmt");
|
|
13426
|
-
if (
|
|
13460
|
+
if (existsSync27(candidate)) return candidate;
|
|
13427
13461
|
const parent = dirname15(dir);
|
|
13428
13462
|
if (parent === dir) return void 0;
|
|
13429
13463
|
dir = parent;
|
|
@@ -13940,9 +13974,9 @@ function originForCwd(cwd) {
|
|
|
13940
13974
|
}
|
|
13941
13975
|
|
|
13942
13976
|
// src/commands/sessions/daemon/repoDirExists.ts
|
|
13943
|
-
import { existsSync as
|
|
13977
|
+
import { existsSync as existsSync28 } from "fs";
|
|
13944
13978
|
function repoDirExists(cwd) {
|
|
13945
|
-
return
|
|
13979
|
+
return existsSync28(cwd);
|
|
13946
13980
|
}
|
|
13947
13981
|
|
|
13948
13982
|
// src/commands/sessions/daemon/worktree/git.ts
|
|
@@ -14139,7 +14173,7 @@ async function web(options2) {
|
|
|
14139
14173
|
|
|
14140
14174
|
// src/commands/new/registerNew/newCli.ts
|
|
14141
14175
|
import { execSync as execSync12 } from "child_process";
|
|
14142
|
-
import { basename as basename11, resolve as
|
|
14176
|
+
import { basename as basename11, resolve as resolve15 } from "path";
|
|
14143
14177
|
|
|
14144
14178
|
// src/commands/verify/init.ts
|
|
14145
14179
|
import chalk30 from "chalk";
|
|
@@ -14445,11 +14479,11 @@ import * as path16 from "path";
|
|
|
14445
14479
|
import chalk21 from "chalk";
|
|
14446
14480
|
|
|
14447
14481
|
// src/commands/verify/addToKnipIgnoreBinaries.ts
|
|
14448
|
-
import { existsSync as
|
|
14482
|
+
import { existsSync as existsSync29, readFileSync as readFileSync12, writeFileSync as writeFileSync7 } from "fs";
|
|
14449
14483
|
import { join as join35 } from "path";
|
|
14450
14484
|
import chalk20 from "chalk";
|
|
14451
14485
|
function loadKnipConfig(knipJsonPath) {
|
|
14452
|
-
if (
|
|
14486
|
+
if (existsSync29(knipJsonPath)) {
|
|
14453
14487
|
return JSON.parse(readFileSync12(knipJsonPath, "utf8"));
|
|
14454
14488
|
}
|
|
14455
14489
|
return { $schema: "https://unpkg.com/knip@5/schema.json" };
|
|
@@ -14502,7 +14536,7 @@ import * as path18 from "path";
|
|
|
14502
14536
|
import chalk26 from "chalk";
|
|
14503
14537
|
|
|
14504
14538
|
// src/commands/format/init.ts
|
|
14505
|
-
import { existsSync as
|
|
14539
|
+
import { existsSync as existsSync30, readFileSync as readFileSync13, writeFileSync as writeFileSync8 } from "fs";
|
|
14506
14540
|
import chalk24 from "chalk";
|
|
14507
14541
|
|
|
14508
14542
|
// src/shared/promptConfirm.ts
|
|
@@ -14564,7 +14598,7 @@ async function init() {
|
|
|
14564
14598
|
const newContent = `${JSON.stringify(oxfmtrc_template_default, null, " ")}
|
|
14565
14599
|
`;
|
|
14566
14600
|
const configPath = ".oxfmtrc.json";
|
|
14567
|
-
const oldContent =
|
|
14601
|
+
const oldContent = existsSync30(configPath) ? readFileSync13(configPath, "utf8") : "";
|
|
14568
14602
|
if (oldContent === newContent) {
|
|
14569
14603
|
console.log(".oxfmtrc.json already has the baseline formatter config");
|
|
14570
14604
|
return;
|
|
@@ -14587,15 +14621,15 @@ async function init() {
|
|
|
14587
14621
|
}
|
|
14588
14622
|
|
|
14589
14623
|
// src/commands/lint/init.ts
|
|
14590
|
-
import { existsSync as
|
|
14624
|
+
import { existsSync as existsSync33, readFileSync as readFileSync15, writeFileSync as writeFileSync10 } from "fs";
|
|
14591
14625
|
import chalk25 from "chalk";
|
|
14592
14626
|
|
|
14593
14627
|
// src/shared/removeEslint.ts
|
|
14594
14628
|
import { execSync as execSync7 } from "child_process";
|
|
14595
|
-
import { existsSync as
|
|
14629
|
+
import { existsSync as existsSync32, readFileSync as readFileSync14, writeFileSync as writeFileSync9 } from "fs";
|
|
14596
14630
|
|
|
14597
14631
|
// src/shared/removeEslint/removeEslintConfigFiles.ts
|
|
14598
|
-
import { existsSync as
|
|
14632
|
+
import { existsSync as existsSync31, unlinkSync as unlinkSync2 } from "fs";
|
|
14599
14633
|
var ESLINT_CONFIG_FILES = [
|
|
14600
14634
|
"eslint.config.js",
|
|
14601
14635
|
"eslint.config.mjs",
|
|
@@ -14611,7 +14645,7 @@ var ESLINT_CONFIG_FILES = [
|
|
|
14611
14645
|
function removeEslintConfigFiles() {
|
|
14612
14646
|
let removed = false;
|
|
14613
14647
|
for (const configFile of ESLINT_CONFIG_FILES) {
|
|
14614
|
-
if (
|
|
14648
|
+
if (existsSync31(configFile)) {
|
|
14615
14649
|
unlinkSync2(configFile);
|
|
14616
14650
|
console.log(`Removed ${configFile}`);
|
|
14617
14651
|
removed = true;
|
|
@@ -14633,7 +14667,7 @@ function removeEslint(options2 = {}) {
|
|
|
14633
14667
|
}
|
|
14634
14668
|
function removeEslintFromPackageJson(options2) {
|
|
14635
14669
|
const packageJsonPath = "package.json";
|
|
14636
|
-
if (!
|
|
14670
|
+
if (!existsSync32(packageJsonPath)) {
|
|
14637
14671
|
return false;
|
|
14638
14672
|
}
|
|
14639
14673
|
const packageJson = JSON.parse(readFileSync14(packageJsonPath, "utf8"));
|
|
@@ -14700,7 +14734,7 @@ async function writeOxlintConfig() {
|
|
|
14700
14734
|
const newContent = `${JSON.stringify(oxlintrc_template_default, null, " ")}
|
|
14701
14735
|
`;
|
|
14702
14736
|
const configPath = ".oxlintrc.json";
|
|
14703
|
-
const oldContent =
|
|
14737
|
+
const oldContent = existsSync33(configPath) ? readFileSync15(configPath, "utf8") : "";
|
|
14704
14738
|
if (oldContent === newContent) {
|
|
14705
14739
|
console.log(".oxlintrc.json already has the baseline linter config");
|
|
14706
14740
|
return;
|
|
@@ -15466,7 +15500,7 @@ program.parse();
|
|
|
15466
15500
|
|
|
15467
15501
|
// src/commands/new/registerNew/newCli.ts
|
|
15468
15502
|
async function newCli() {
|
|
15469
|
-
const name = basename11(
|
|
15503
|
+
const name = basename11(resolve15("."));
|
|
15470
15504
|
initGit();
|
|
15471
15505
|
initPackageJson(name);
|
|
15472
15506
|
console.log("Installing dependencies...");
|
|
@@ -15481,7 +15515,7 @@ async function newCli() {
|
|
|
15481
15515
|
|
|
15482
15516
|
// src/commands/new/registerNew/newProject.ts
|
|
15483
15517
|
import { execSync as execSync14 } from "child_process";
|
|
15484
|
-
import { existsSync as
|
|
15518
|
+
import { existsSync as existsSync38, readFileSync as readFileSync19, writeFileSync as writeFileSync17 } from "fs";
|
|
15485
15519
|
|
|
15486
15520
|
// src/commands/deploy/init.ts
|
|
15487
15521
|
import { execSync as execSync13 } from "child_process";
|
|
@@ -15489,14 +15523,14 @@ import chalk36 from "chalk";
|
|
|
15489
15523
|
import enquirer3 from "enquirer";
|
|
15490
15524
|
|
|
15491
15525
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
15492
|
-
import { existsSync as
|
|
15526
|
+
import { existsSync as existsSync37, mkdirSync as mkdirSync9, readFileSync as readFileSync18, writeFileSync as writeFileSync16 } from "fs";
|
|
15493
15527
|
import { dirname as dirname24, join as join42 } from "path";
|
|
15494
15528
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
15495
15529
|
import chalk35 from "chalk";
|
|
15496
15530
|
var WORKFLOW_PATH = ".github/workflows/build.yml";
|
|
15497
15531
|
var __dirname3 = dirname24(fileURLToPath4(import.meta.url));
|
|
15498
15532
|
function getExistingSiteId() {
|
|
15499
|
-
if (!
|
|
15533
|
+
if (!existsSync37(WORKFLOW_PATH)) {
|
|
15500
15534
|
return null;
|
|
15501
15535
|
}
|
|
15502
15536
|
const content = readFileSync18(WORKFLOW_PATH, "utf8");
|
|
@@ -15511,10 +15545,10 @@ function getTemplateContent(siteId) {
|
|
|
15511
15545
|
async function updateWorkflow(siteId) {
|
|
15512
15546
|
const newContent = getTemplateContent(siteId);
|
|
15513
15547
|
const workflowDir = ".github/workflows";
|
|
15514
|
-
if (!
|
|
15548
|
+
if (!existsSync37(workflowDir)) {
|
|
15515
15549
|
mkdirSync9(workflowDir, { recursive: true });
|
|
15516
15550
|
}
|
|
15517
|
-
if (
|
|
15551
|
+
if (existsSync37(WORKFLOW_PATH)) {
|
|
15518
15552
|
const oldContent = readFileSync18(WORKFLOW_PATH, "utf8");
|
|
15519
15553
|
if (oldContent === newContent) {
|
|
15520
15554
|
console.log(chalk35.green("build.yml is already up to date"));
|
|
@@ -15609,7 +15643,7 @@ async function newProject() {
|
|
|
15609
15643
|
}
|
|
15610
15644
|
function addViteBaseConfig() {
|
|
15611
15645
|
const viteConfigPath = "vite.config.ts";
|
|
15612
|
-
if (!
|
|
15646
|
+
if (!existsSync38(viteConfigPath)) {
|
|
15613
15647
|
console.log("No vite.config.ts found, skipping base config");
|
|
15614
15648
|
return;
|
|
15615
15649
|
}
|
|
@@ -15815,14 +15849,14 @@ import { readdirSync as readdirSync7, readFileSync as readFileSync20 } from "fs"
|
|
|
15815
15849
|
import { basename as basename12, join as join44 } from "path";
|
|
15816
15850
|
|
|
15817
15851
|
// src/commands/advise/adviceDir.ts
|
|
15818
|
-
import { existsSync as
|
|
15852
|
+
import { existsSync as existsSync39 } from "fs";
|
|
15819
15853
|
import { dirname as dirname25, join as join43 } from "path";
|
|
15820
15854
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
15821
15855
|
function adviceDir() {
|
|
15822
15856
|
let current = dirname25(fileURLToPath5(import.meta.url));
|
|
15823
15857
|
while (current !== dirname25(current)) {
|
|
15824
15858
|
const candidate = join43(current, "claude", "advice");
|
|
15825
|
-
if (
|
|
15859
|
+
if (existsSync39(candidate)) return candidate;
|
|
15826
15860
|
current = dirname25(current);
|
|
15827
15861
|
}
|
|
15828
15862
|
throw new Error("Could not locate the shipped claude/advice directory");
|
|
@@ -15888,13 +15922,13 @@ function renderAdviceBody(fragment, context) {
|
|
|
15888
15922
|
}
|
|
15889
15923
|
|
|
15890
15924
|
// src/commands/advise/adviceConditions.ts
|
|
15891
|
-
import { existsSync as
|
|
15925
|
+
import { existsSync as existsSync40 } from "fs";
|
|
15892
15926
|
import { join as join45 } from "path";
|
|
15893
15927
|
function repoFile(file, label) {
|
|
15894
15928
|
return {
|
|
15895
15929
|
whenMet: `the repo has ${label}`,
|
|
15896
15930
|
whenUnmet: `the repo has no ${label}`,
|
|
15897
|
-
matches: ({ rootDir }) =>
|
|
15931
|
+
matches: ({ rootDir }) => existsSync40(join45(rootDir, file))
|
|
15898
15932
|
};
|
|
15899
15933
|
}
|
|
15900
15934
|
var adviceConditions = {
|
|
@@ -16804,7 +16838,7 @@ function registerAskQuestion(program) {
|
|
|
16804
16838
|
|
|
16805
16839
|
// src/commands/registerBackup.ts
|
|
16806
16840
|
import { mkdir as mkdir3, stat as stat4 } from "fs/promises";
|
|
16807
|
-
import { join as join47, resolve as
|
|
16841
|
+
import { join as join47, resolve as resolve16 } from "path";
|
|
16808
16842
|
import chalk41 from "chalk";
|
|
16809
16843
|
|
|
16810
16844
|
// src/shared/db/recordBackup.ts
|
|
@@ -17139,7 +17173,7 @@ async function backup({ out }) {
|
|
|
17139
17173
|
await mkdir3(dir, { recursive: true });
|
|
17140
17174
|
const start2 = Date.now();
|
|
17141
17175
|
const timestamp9 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
17142
|
-
const filePath =
|
|
17176
|
+
const filePath = resolve16(join47(dir, `backup-${timestamp9}.dump`));
|
|
17143
17177
|
await exportBacklog(filePath);
|
|
17144
17178
|
const { size } = await stat4(filePath);
|
|
17145
17179
|
const durationMs = Date.now() - start2;
|
|
@@ -17650,7 +17684,7 @@ function registerAssociateJiraCommand(cmd) {
|
|
|
17650
17684
|
|
|
17651
17685
|
// src/commands/backlog/cloneRepo.ts
|
|
17652
17686
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
17653
|
-
import { existsSync as
|
|
17687
|
+
import { existsSync as existsSync42 } from "fs";
|
|
17654
17688
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
17655
17689
|
import chalk48 from "chalk";
|
|
17656
17690
|
|
|
@@ -17686,7 +17720,7 @@ async function cloneRepo(originRaw) {
|
|
|
17686
17720
|
if (!target) {
|
|
17687
17721
|
return fail3(`Could not derive a repository name from "${origin}".`);
|
|
17688
17722
|
}
|
|
17689
|
-
if (
|
|
17723
|
+
if (existsSync42(target)) {
|
|
17690
17724
|
return fail3(`Clone target already exists: ${target}`);
|
|
17691
17725
|
}
|
|
17692
17726
|
await mkdir4(baseDir, { recursive: true });
|
|
@@ -18914,8 +18948,8 @@ import chalk69 from "chalk";
|
|
|
18914
18948
|
|
|
18915
18949
|
// src/shared/waitForIndexUnlocked.ts
|
|
18916
18950
|
import { execSync as execSync18 } from "child_process";
|
|
18917
|
-
import { existsSync as
|
|
18918
|
-
import { resolve as
|
|
18951
|
+
import { existsSync as existsSync43 } from "fs";
|
|
18952
|
+
import { resolve as resolve17 } from "path";
|
|
18919
18953
|
var POLL_MS2 = 200;
|
|
18920
18954
|
function indexLockPath() {
|
|
18921
18955
|
try {
|
|
@@ -18923,7 +18957,7 @@ function indexLockPath() {
|
|
|
18923
18957
|
encoding: "utf8",
|
|
18924
18958
|
stdio: ["ignore", "pipe", "ignore"]
|
|
18925
18959
|
}).trim();
|
|
18926
|
-
return rel ?
|
|
18960
|
+
return rel ? resolve17(rel) : void 0;
|
|
18927
18961
|
} catch {
|
|
18928
18962
|
return void 0;
|
|
18929
18963
|
}
|
|
@@ -18935,7 +18969,7 @@ function waitForIndexUnlocked(timeoutMs) {
|
|
|
18935
18969
|
const lock2 = indexLockPath();
|
|
18936
18970
|
if (!lock2) return true;
|
|
18937
18971
|
const deadline = Date.now() + timeoutMs;
|
|
18938
|
-
while (
|
|
18972
|
+
while (existsSync43(lock2)) {
|
|
18939
18973
|
if (Date.now() >= deadline) return false;
|
|
18940
18974
|
sleepSync(POLL_MS2);
|
|
18941
18975
|
}
|
|
@@ -19051,7 +19085,7 @@ function hasLocalChanges() {
|
|
|
19051
19085
|
|
|
19052
19086
|
// src/commands/backlog/acquireLock.ts
|
|
19053
19087
|
import {
|
|
19054
|
-
existsSync as
|
|
19088
|
+
existsSync as existsSync44,
|
|
19055
19089
|
mkdirSync as mkdirSync11,
|
|
19056
19090
|
readFileSync as readFileSync25,
|
|
19057
19091
|
unlinkSync as unlinkSync4,
|
|
@@ -19109,7 +19143,7 @@ function isProcessAlive(pid) {
|
|
|
19109
19143
|
}
|
|
19110
19144
|
function foreignLockHolder(itemId2) {
|
|
19111
19145
|
const lockPath = getLockPath(itemId2);
|
|
19112
|
-
if (!
|
|
19146
|
+
if (!existsSync44(lockPath)) return null;
|
|
19113
19147
|
try {
|
|
19114
19148
|
const lock2 = JSON.parse(readFileSync25(lockPath, "utf8"));
|
|
19115
19149
|
if (typeof lock2.pid !== "number" || lock2.pid === process.pid) return null;
|
|
@@ -19594,7 +19628,7 @@ async function resumeDoneConversation({ item, resumeSessionId }, spawnOptions) {
|
|
|
19594
19628
|
}
|
|
19595
19629
|
|
|
19596
19630
|
// src/commands/backlog/consumePause.ts
|
|
19597
|
-
import { existsSync as
|
|
19631
|
+
import { existsSync as existsSync45, mkdirSync as mkdirSync13, unlinkSync as unlinkSync5, writeFileSync as writeFileSync22 } from "fs";
|
|
19598
19632
|
import { homedir as homedir16 } from "os";
|
|
19599
19633
|
import { join as join52 } from "path";
|
|
19600
19634
|
function getControlsDir() {
|
|
@@ -19611,7 +19645,7 @@ function requestPause(itemId2) {
|
|
|
19611
19645
|
);
|
|
19612
19646
|
}
|
|
19613
19647
|
function isPausePending(itemId2) {
|
|
19614
|
-
return
|
|
19648
|
+
return existsSync45(getPausePath(itemId2));
|
|
19615
19649
|
}
|
|
19616
19650
|
function clearPause(itemId2) {
|
|
19617
19651
|
try {
|
|
@@ -19621,7 +19655,7 @@ function clearPause(itemId2) {
|
|
|
19621
19655
|
}
|
|
19622
19656
|
function consumePause(itemId2) {
|
|
19623
19657
|
const pausePath = getPausePath(itemId2);
|
|
19624
|
-
if (!
|
|
19658
|
+
if (!existsSync45(pausePath)) return false;
|
|
19625
19659
|
try {
|
|
19626
19660
|
unlinkSync5(pausePath);
|
|
19627
19661
|
} catch {
|
|
@@ -19873,13 +19907,13 @@ function spawnHarness(harness, prompt, options2 = {}) {
|
|
|
19873
19907
|
}
|
|
19874
19908
|
|
|
19875
19909
|
// src/commands/backlog/watchForMarker.ts
|
|
19876
|
-
import { existsSync as
|
|
19910
|
+
import { existsSync as existsSync47, unwatchFile, watchFile } from "fs";
|
|
19877
19911
|
|
|
19878
19912
|
// src/commands/backlog/readSignal.ts
|
|
19879
|
-
import { existsSync as
|
|
19913
|
+
import { existsSync as existsSync46, readFileSync as readFileSync26 } from "fs";
|
|
19880
19914
|
function readSignal() {
|
|
19881
19915
|
const path109 = getSignalPath();
|
|
19882
|
-
if (!path109 || !
|
|
19916
|
+
if (!path109 || !existsSync46(path109)) return void 0;
|
|
19883
19917
|
try {
|
|
19884
19918
|
return JSON.parse(readFileSync26(path109, "utf8"));
|
|
19885
19919
|
} catch {
|
|
@@ -19893,7 +19927,7 @@ function watchForMarker(child, options2) {
|
|
|
19893
19927
|
const statusPath = getSignalPath();
|
|
19894
19928
|
if (!statusPath) return { killedOnMarker: () => killed };
|
|
19895
19929
|
watchFile(statusPath, { interval: 1e3 }, () => {
|
|
19896
|
-
if (!
|
|
19930
|
+
if (!existsSync47(statusPath)) return;
|
|
19897
19931
|
const signal = readSignal();
|
|
19898
19932
|
if (!signal) return;
|
|
19899
19933
|
if (signal.event === "done" && !options2?.actOnDone) return;
|
|
@@ -19945,7 +19979,7 @@ function launchPhaseSession(item, phaseNumber, phase, phaseLabel2, claudeSession
|
|
|
19945
19979
|
}
|
|
19946
19980
|
|
|
19947
19981
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
19948
|
-
import { existsSync as
|
|
19982
|
+
import { existsSync as existsSync48, unlinkSync as unlinkSync6 } from "fs";
|
|
19949
19983
|
import chalk77 from "chalk";
|
|
19950
19984
|
|
|
19951
19985
|
// src/commands/backlog/handleIncompletePhase.ts
|
|
@@ -19967,7 +20001,7 @@ async function handleIncompletePhase() {
|
|
|
19967
20001
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
19968
20002
|
function cleanupSignal() {
|
|
19969
20003
|
const statusPath = getSignalPath();
|
|
19970
|
-
if (statusPath &&
|
|
20004
|
+
if (statusPath && existsSync48(statusPath)) {
|
|
19971
20005
|
unlinkSync6(statusPath);
|
|
19972
20006
|
}
|
|
19973
20007
|
}
|
|
@@ -19978,7 +20012,7 @@ async function isTerminalStatus(itemId2) {
|
|
|
19978
20012
|
}
|
|
19979
20013
|
async function resolvePhaseResult(phaseIndex, itemId2) {
|
|
19980
20014
|
const signalPath = getSignalPath();
|
|
19981
|
-
if (!signalPath || !
|
|
20015
|
+
if (!signalPath || !existsSync48(signalPath)) {
|
|
19982
20016
|
if (await isTerminalStatus(itemId2)) return { kind: "abort" };
|
|
19983
20017
|
const action = await handleIncompletePhase();
|
|
19984
20018
|
if (action === "abort") return { kind: "abort" };
|
|
@@ -22608,7 +22642,7 @@ function findTruncatedReadDenyRaw(rawCommand) {
|
|
|
22608
22642
|
}
|
|
22609
22643
|
|
|
22610
22644
|
// src/shared/isApprovedRead.ts
|
|
22611
|
-
import { resolve as
|
|
22645
|
+
import { resolve as resolve19, sep as sep2 } from "path";
|
|
22612
22646
|
|
|
22613
22647
|
// src/shared/appliesFixStructure.ts
|
|
22614
22648
|
var APPLY_RE = /^assist\s+github\s+issue\s+fix-structure\b.*\s--apply\b/;
|
|
@@ -22704,8 +22738,8 @@ function extractGraphqlQuery(args) {
|
|
|
22704
22738
|
}
|
|
22705
22739
|
|
|
22706
22740
|
// src/shared/loadCliReads.ts
|
|
22707
|
-
import { existsSync as
|
|
22708
|
-
import { dirname as dirname29, resolve as
|
|
22741
|
+
import { existsSync as existsSync49, readFileSync as readFileSync29, writeFileSync as writeFileSync24 } from "fs";
|
|
22742
|
+
import { dirname as dirname29, resolve as resolve18 } from "path";
|
|
22709
22743
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
22710
22744
|
var __filename3 = fileURLToPath6(import.meta.url);
|
|
22711
22745
|
var __dirname4 = dirname29(__filename3);
|
|
@@ -22713,20 +22747,20 @@ function packageRoot() {
|
|
|
22713
22747
|
return __dirname4;
|
|
22714
22748
|
}
|
|
22715
22749
|
function readLines(path109) {
|
|
22716
|
-
if (!
|
|
22750
|
+
if (!existsSync49(path109)) return [];
|
|
22717
22751
|
return readFileSync29(path109, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
22718
22752
|
}
|
|
22719
22753
|
var cachedReads;
|
|
22720
22754
|
var cachedWrites;
|
|
22721
22755
|
function getCliReadsLines() {
|
|
22722
22756
|
if (!cachedReads) {
|
|
22723
|
-
cachedReads = readLines(
|
|
22757
|
+
cachedReads = readLines(resolve18(packageRoot(), "allowed.cli-reads"));
|
|
22724
22758
|
}
|
|
22725
22759
|
return cachedReads;
|
|
22726
22760
|
}
|
|
22727
22761
|
function getCliWritesLines() {
|
|
22728
22762
|
if (!cachedWrites) {
|
|
22729
|
-
cachedWrites = readLines(
|
|
22763
|
+
cachedWrites = readLines(resolve18(packageRoot(), "allowed.cli-writes"));
|
|
22730
22764
|
}
|
|
22731
22765
|
return cachedWrites;
|
|
22732
22766
|
}
|
|
@@ -22735,7 +22769,7 @@ function loadCliReads() {
|
|
|
22735
22769
|
}
|
|
22736
22770
|
function saveCliReads(commands) {
|
|
22737
22771
|
writeFileSync24(
|
|
22738
|
-
|
|
22772
|
+
resolve18(packageRoot(), "allowed.cli-reads"),
|
|
22739
22773
|
`${commands.join("\n")}
|
|
22740
22774
|
`
|
|
22741
22775
|
);
|
|
@@ -22760,7 +22794,7 @@ function findCliWrite(command) {
|
|
|
22760
22794
|
}
|
|
22761
22795
|
|
|
22762
22796
|
// src/shared/readSettingsPerms.ts
|
|
22763
|
-
import { existsSync as
|
|
22797
|
+
import { existsSync as existsSync50, readFileSync as readFileSync30 } from "fs";
|
|
22764
22798
|
import { homedir as homedir18 } from "os";
|
|
22765
22799
|
import { join as join54 } from "path";
|
|
22766
22800
|
function readSettingsPerms(key) {
|
|
@@ -22776,7 +22810,7 @@ function readSettingsPerms(key) {
|
|
|
22776
22810
|
return entries;
|
|
22777
22811
|
}
|
|
22778
22812
|
function readPermissionArray(filePath, key) {
|
|
22779
|
-
if (!
|
|
22813
|
+
if (!existsSync50(filePath)) return [];
|
|
22780
22814
|
try {
|
|
22781
22815
|
const data = JSON.parse(readFileSync30(filePath, "utf8"));
|
|
22782
22816
|
const arr = data?.permissions?.[key];
|
|
@@ -22873,19 +22907,19 @@ function isCdToCwd(command) {
|
|
|
22873
22907
|
const parts = command.split(/\s+/);
|
|
22874
22908
|
if (parts[0] !== "cd" || parts.length > 2) return false;
|
|
22875
22909
|
if (parts.length === 1) return false;
|
|
22876
|
-
const resolved =
|
|
22877
|
-
return resolved ===
|
|
22910
|
+
const resolved = resolve19(normalizeMsysPath(parts[1]));
|
|
22911
|
+
return resolved === resolve19(process.cwd());
|
|
22878
22912
|
}
|
|
22879
22913
|
function isCdToReadAllowedDir(command) {
|
|
22880
22914
|
const parts = command.split(/\s+/);
|
|
22881
22915
|
if (parts[0] !== "cd" || parts.length !== 2) return void 0;
|
|
22882
|
-
const target =
|
|
22916
|
+
const target = resolve19(normalizeMsysPath(parts[1]));
|
|
22883
22917
|
for (const entry of readSettingsPerms("allow")) {
|
|
22884
22918
|
const m = entry.match(READ_RE);
|
|
22885
22919
|
if (!m) continue;
|
|
22886
22920
|
const base = globBaseDir(m[1]);
|
|
22887
22921
|
if (!base) continue;
|
|
22888
|
-
const resolved =
|
|
22922
|
+
const resolved = resolve19(normalizeMsysPath(base));
|
|
22889
22923
|
if (target === resolved || target.startsWith(resolved + sep2)) {
|
|
22890
22924
|
return `cd to Read-allowed directory: ${entry}`;
|
|
22891
22925
|
}
|
|
@@ -23009,7 +23043,7 @@ ${questionsJson}`
|
|
|
23009
23043
|
}
|
|
23010
23044
|
|
|
23011
23045
|
// src/commands/backlog/isDocsPath.ts
|
|
23012
|
-
import { relative as relative6, resolve as
|
|
23046
|
+
import { relative as relative6, resolve as resolve20 } from "path";
|
|
23013
23047
|
var LOCKED_DOCS_DIRS = ["docs/src/content/docs/", "docs/public/screenshots/"];
|
|
23014
23048
|
var DOCS_LOCK_REASON = `Docs pages and screenshots (${LOCKED_DOCS_DIRS.join(", ")}) are locked during development: they are updated by the Refresh docs backlog item after stories ship, not during development. Leave them untouched and carry on with the phase. If this phase genuinely needs to change docs (e.g. the item is about the docs site itself), first confirm that with the user, then run \`assist docs unlock\` and wait for the user to confirm the PIN with \`assist docs confirm <pin>\` before retrying. The unlock applies to the current phase only.`;
|
|
23015
23049
|
var SEP = String.raw`[/\\]`;
|
|
@@ -23025,7 +23059,7 @@ function isLockedDocsRelativePath(rel) {
|
|
|
23025
23059
|
return LOCKED_DOCS_DIRS.some((dir) => normalized.startsWith(dir));
|
|
23026
23060
|
}
|
|
23027
23061
|
function isDocsPath(filePath, root2 = getProjectRoot()) {
|
|
23028
|
-
return isLockedDocsRelativePath(relative6(root2,
|
|
23062
|
+
return isLockedDocsRelativePath(relative6(root2, resolve20(root2, filePath)));
|
|
23029
23063
|
}
|
|
23030
23064
|
function mentionsDocsPath(command, root2 = getProjectRoot()) {
|
|
23031
23065
|
if (RELATIVE_DOCS.test(command)) return true;
|
|
@@ -23049,7 +23083,7 @@ function findDocsPathDeny(toolName, rawCommand, root2) {
|
|
|
23049
23083
|
|
|
23050
23084
|
// src/commands/schema/isSchemaPath.ts
|
|
23051
23085
|
import { readFileSync as readFileSync31 } from "fs";
|
|
23052
|
-
import { relative as relative7, resolve as
|
|
23086
|
+
import { relative as relative7, resolve as resolve21 } from "path";
|
|
23053
23087
|
var SCHEMA_LOCK_REASON = "Database schema files (src/shared/db/migrations/migrationNNNN*.ts, src/shared/db/migrations.ts, src/shared/db/schema.ts and any src/shared/db/*.ts that defines a pgTable) are locked: a schema change needs the user's sign-off (see src/shared/db/CLAUDE.md). Confirm the schema change with the user first, then run `assist schema unlock` to request a PIN and wait for the user to confirm it with `assist schema confirm <pin>` before retrying. In a backlog item session the unlock lasts for the current phase; otherwise it lasts for this Claude session.";
|
|
23054
23088
|
var FIXED_SCHEMA_PATH = /^src\/shared\/db\/(?:migrations\/migration\d{4}[^/]*\.ts|migrations\.ts|schema\.ts)$/;
|
|
23055
23089
|
var DB_MODULE = /^src\/shared\/db\/[^/]+\.ts$/;
|
|
@@ -23064,13 +23098,13 @@ function isSchemaRelativePath(rel, root2, incomingContents2 = []) {
|
|
|
23064
23098
|
const normalized = rel.replace(/\\/g, "/");
|
|
23065
23099
|
if (FIXED_SCHEMA_PATH.test(normalized)) return true;
|
|
23066
23100
|
if (!DB_MODULE.test(normalized)) return false;
|
|
23067
|
-
return [...incomingContents2, readOrEmpty2(
|
|
23101
|
+
return [...incomingContents2, readOrEmpty2(resolve21(root2, normalized))].some(
|
|
23068
23102
|
(text20) => text20.includes("pgTable")
|
|
23069
23103
|
);
|
|
23070
23104
|
}
|
|
23071
23105
|
function isSchemaPath(filePath, incomingContents2 = [], root2 = getProjectRoot()) {
|
|
23072
23106
|
return isSchemaRelativePath(
|
|
23073
|
-
relative7(root2,
|
|
23107
|
+
relative7(root2, resolve21(root2, filePath)),
|
|
23074
23108
|
root2,
|
|
23075
23109
|
incomingContents2
|
|
23076
23110
|
);
|
|
@@ -23211,7 +23245,7 @@ function tryParseInput(raw) {
|
|
|
23211
23245
|
}
|
|
23212
23246
|
|
|
23213
23247
|
// src/commands/schema/isSchemaLocked.ts
|
|
23214
|
-
import { existsSync as
|
|
23248
|
+
import { existsSync as existsSync51 } from "fs";
|
|
23215
23249
|
|
|
23216
23250
|
// src/commands/schema/getSchemaSessionApprovalPath.ts
|
|
23217
23251
|
import { join as join57 } from "path";
|
|
@@ -23241,7 +23275,7 @@ function hasSessionApproval() {
|
|
|
23241
23275
|
const claudeSessionId = process.env.CLAUDE_CODE_SESSION_ID;
|
|
23242
23276
|
if (!claudeSessionId) return false;
|
|
23243
23277
|
const path109 = getSchemaSessionApprovalPath(claudeSessionId);
|
|
23244
|
-
return path109 !== void 0 &&
|
|
23278
|
+
return path109 !== void 0 && existsSync51(path109);
|
|
23245
23279
|
}
|
|
23246
23280
|
async function isSchemaLocked() {
|
|
23247
23281
|
if (!process.env.CLAUDECODE) return false;
|
|
@@ -23330,7 +23364,7 @@ ${reasons.join("\n")}`);
|
|
|
23330
23364
|
}
|
|
23331
23365
|
|
|
23332
23366
|
// src/commands/permitCliReads.ts
|
|
23333
|
-
import { existsSync as
|
|
23367
|
+
import { existsSync as existsSync52, mkdirSync as mkdirSync16, readFileSync as readFileSync32, writeFileSync as writeFileSync25 } from "fs";
|
|
23334
23368
|
import { homedir as homedir21 } from "os";
|
|
23335
23369
|
import { join as join58 } from "path";
|
|
23336
23370
|
|
|
@@ -23599,7 +23633,7 @@ function logPath(cli) {
|
|
|
23599
23633
|
}
|
|
23600
23634
|
function readCache(cli) {
|
|
23601
23635
|
const path109 = logPath(cli);
|
|
23602
|
-
if (!
|
|
23636
|
+
if (!existsSync52(path109)) return void 0;
|
|
23603
23637
|
return readFileSync32(path109, "utf8");
|
|
23604
23638
|
}
|
|
23605
23639
|
function writeCache(cli, output) {
|
|
@@ -23735,7 +23769,7 @@ function registerCliHook(program) {
|
|
|
23735
23769
|
}
|
|
23736
23770
|
|
|
23737
23771
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
23738
|
-
import { existsSync as
|
|
23772
|
+
import { existsSync as existsSync54, readFileSync as readFileSync34, unlinkSync as unlinkSync8, writeFileSync as writeFileSync26 } from "fs";
|
|
23739
23773
|
import chalk120 from "chalk";
|
|
23740
23774
|
|
|
23741
23775
|
// src/shared/isHashCommentFile.ts
|
|
@@ -23790,10 +23824,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
23790
23824
|
}
|
|
23791
23825
|
|
|
23792
23826
|
// src/commands/codeComment/readPinState.ts
|
|
23793
|
-
import { existsSync as
|
|
23827
|
+
import { existsSync as existsSync53, readFileSync as readFileSync33 } from "fs";
|
|
23794
23828
|
function readPinState(pin2) {
|
|
23795
23829
|
const path109 = getPinStatePath(pin2);
|
|
23796
|
-
if (!
|
|
23830
|
+
if (!existsSync53(path109)) return void 0;
|
|
23797
23831
|
try {
|
|
23798
23832
|
const state = JSON.parse(readFileSync33(path109, "utf8"));
|
|
23799
23833
|
if (state.pin !== pin2) return void 0;
|
|
@@ -23812,7 +23846,7 @@ function codeCommentConfirm(pin2) {
|
|
|
23812
23846
|
process.exitCode = 1;
|
|
23813
23847
|
return;
|
|
23814
23848
|
}
|
|
23815
|
-
if (!
|
|
23849
|
+
if (!existsSync54(state.file)) {
|
|
23816
23850
|
console.error(chalk120.red(`Target file no longer exists: ${state.file}`));
|
|
23817
23851
|
process.exitCode = 1;
|
|
23818
23852
|
return;
|
|
@@ -26273,11 +26307,11 @@ async function copySignedXpi(xpi, dir) {
|
|
|
26273
26307
|
}
|
|
26274
26308
|
|
|
26275
26309
|
// src/commands/extension/findSignedXpi.ts
|
|
26276
|
-
import { existsSync as
|
|
26310
|
+
import { existsSync as existsSync55 } from "fs";
|
|
26277
26311
|
import { readdir } from "fs/promises";
|
|
26278
26312
|
import { join as join62 } from "path";
|
|
26279
26313
|
async function findSignedXpi(dir) {
|
|
26280
|
-
if (!
|
|
26314
|
+
if (!existsSync55(dir)) return null;
|
|
26281
26315
|
const name = (await readdir(dir)).find((entry) => entry.endsWith(".xpi"));
|
|
26282
26316
|
return name ? join62(dir, name) : null;
|
|
26283
26317
|
}
|
|
@@ -26301,11 +26335,11 @@ async function signedAddonInstallPath(xpi) {
|
|
|
26301
26335
|
}
|
|
26302
26336
|
|
|
26303
26337
|
// src/commands/extension/signPreflightProblem.ts
|
|
26304
|
-
import { existsSync as
|
|
26338
|
+
import { existsSync as existsSync56 } from "fs";
|
|
26305
26339
|
import { join as join63 } from "path";
|
|
26306
26340
|
var KEY_URL = "https://addons.mozilla.org/en-US/developers/addon/api/key/";
|
|
26307
26341
|
function signPreflightProblem(source) {
|
|
26308
|
-
if (!
|
|
26342
|
+
if (!existsSync56(join63(source, "content.js")))
|
|
26309
26343
|
return {
|
|
26310
26344
|
message: `no content.js in ${source}`,
|
|
26311
26345
|
hint: "run npm run build to bundle the content script"
|
|
@@ -26566,7 +26600,7 @@ function registerDb(program) {
|
|
|
26566
26600
|
}
|
|
26567
26601
|
|
|
26568
26602
|
// src/commands/deploy/redirect.ts
|
|
26569
|
-
import { existsSync as
|
|
26603
|
+
import { existsSync as existsSync57, readFileSync as readFileSync36, writeFileSync as writeFileSync29 } from "fs";
|
|
26570
26604
|
import chalk157 from "chalk";
|
|
26571
26605
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
26572
26606
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -26575,7 +26609,7 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
26575
26609
|
</script>`;
|
|
26576
26610
|
function redirect() {
|
|
26577
26611
|
const indexPath = "index.html";
|
|
26578
|
-
if (!
|
|
26612
|
+
if (!existsSync57(indexPath)) {
|
|
26579
26613
|
console.log(chalk157.yellow("No index.html found"));
|
|
26580
26614
|
return;
|
|
26581
26615
|
}
|
|
@@ -26781,7 +26815,7 @@ function findTargetWeek(weeks, { lastWeek, skip: skip3, today }) {
|
|
|
26781
26815
|
import chalk160 from "chalk";
|
|
26782
26816
|
|
|
26783
26817
|
// src/shared/getRepoName.ts
|
|
26784
|
-
import { existsSync as
|
|
26818
|
+
import { existsSync as existsSync58, readFileSync as readFileSync38 } from "fs";
|
|
26785
26819
|
import { basename as basename17, join as join68 } from "path";
|
|
26786
26820
|
function getRepoName() {
|
|
26787
26821
|
const config = loadConfig();
|
|
@@ -26789,7 +26823,7 @@ function getRepoName() {
|
|
|
26789
26823
|
return config.devlog.name;
|
|
26790
26824
|
}
|
|
26791
26825
|
const packageJsonPath = join68(process.cwd(), "package.json");
|
|
26792
|
-
if (
|
|
26826
|
+
if (existsSync58(packageJsonPath)) {
|
|
26793
26827
|
try {
|
|
26794
26828
|
const content = readFileSync38(packageJsonPath, "utf8");
|
|
26795
26829
|
const pkg = JSON.parse(content);
|
|
@@ -27323,13 +27357,13 @@ function getDocsUnlockPinPath(pin2) {
|
|
|
27323
27357
|
}
|
|
27324
27358
|
|
|
27325
27359
|
// src/commands/docs/readDocsUnlockPinState.ts
|
|
27326
|
-
import { existsSync as
|
|
27360
|
+
import { existsSync as existsSync59, readFileSync as readFileSync39 } from "fs";
|
|
27327
27361
|
function isPositiveInteger(value) {
|
|
27328
27362
|
return Number.isInteger(value) && value > 0;
|
|
27329
27363
|
}
|
|
27330
27364
|
function readDocsUnlockPinState(pin2) {
|
|
27331
27365
|
const path109 = getDocsUnlockPinPath(pin2);
|
|
27332
|
-
if (!
|
|
27366
|
+
if (!existsSync59(path109)) return void 0;
|
|
27333
27367
|
try {
|
|
27334
27368
|
const state = JSON.parse(readFileSync39(path109, "utf8"));
|
|
27335
27369
|
if (state.pin !== pin2) return void 0;
|
|
@@ -27473,7 +27507,7 @@ function getSchemaUnlockPinPath(pin2) {
|
|
|
27473
27507
|
}
|
|
27474
27508
|
|
|
27475
27509
|
// src/commands/schema/readSchemaUnlockPinState.ts
|
|
27476
|
-
import { existsSync as
|
|
27510
|
+
import { existsSync as existsSync60, readFileSync as readFileSync40 } from "fs";
|
|
27477
27511
|
function isPositiveInteger2(value) {
|
|
27478
27512
|
return Number.isInteger(value) && value > 0;
|
|
27479
27513
|
}
|
|
@@ -27487,7 +27521,7 @@ function toState(raw) {
|
|
|
27487
27521
|
}
|
|
27488
27522
|
function readSchemaUnlockPinState(pin2) {
|
|
27489
27523
|
const path109 = getSchemaUnlockPinPath(pin2);
|
|
27490
|
-
if (!
|
|
27524
|
+
if (!existsSync60(path109)) return void 0;
|
|
27491
27525
|
try {
|
|
27492
27526
|
const raw = JSON.parse(readFileSync40(path109, "utf8"));
|
|
27493
27527
|
if (raw.pin !== pin2) return void 0;
|
|
@@ -27816,12 +27850,12 @@ function printJson(tree, totalCount, solutions) {
|
|
|
27816
27850
|
}
|
|
27817
27851
|
|
|
27818
27852
|
// src/commands/dotnet/resolveCsproj.ts
|
|
27819
|
-
import { existsSync as
|
|
27853
|
+
import { existsSync as existsSync61 } from "fs";
|
|
27820
27854
|
import path38 from "path";
|
|
27821
27855
|
import chalk174 from "chalk";
|
|
27822
27856
|
function resolveCsproj(csprojPath) {
|
|
27823
27857
|
const resolved = path38.resolve(csprojPath);
|
|
27824
|
-
if (!
|
|
27858
|
+
if (!existsSync61(resolved)) {
|
|
27825
27859
|
console.error(chalk174.red(`File not found: ${resolved}`));
|
|
27826
27860
|
process.exit(1);
|
|
27827
27861
|
}
|
|
@@ -27989,7 +28023,7 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
27989
28023
|
}
|
|
27990
28024
|
|
|
27991
28025
|
// src/commands/dotnet/resolveSolution.ts
|
|
27992
|
-
import { existsSync as
|
|
28026
|
+
import { existsSync as existsSync62 } from "fs";
|
|
27993
28027
|
import path39 from "path";
|
|
27994
28028
|
import chalk178 from "chalk";
|
|
27995
28029
|
|
|
@@ -28030,7 +28064,7 @@ function findSolution() {
|
|
|
28030
28064
|
function resolveSolution(sln) {
|
|
28031
28065
|
if (sln) {
|
|
28032
28066
|
const resolved = path39.resolve(sln);
|
|
28033
|
-
if (!
|
|
28067
|
+
if (!existsSync62(resolved)) {
|
|
28034
28068
|
console.error(chalk178.red(`Solution file not found: ${resolved}`));
|
|
28035
28069
|
process.exit(1);
|
|
28036
28070
|
}
|
|
@@ -28070,7 +28104,7 @@ function parseInspectReport(json) {
|
|
|
28070
28104
|
|
|
28071
28105
|
// src/commands/dotnet/runInspectCode.ts
|
|
28072
28106
|
import { execSync as execSync40 } from "child_process";
|
|
28073
|
-
import { existsSync as
|
|
28107
|
+
import { existsSync as existsSync63, readFileSync as readFileSync43, unlinkSync as unlinkSync12 } from "fs";
|
|
28074
28108
|
import { tmpdir as tmpdir4 } from "os";
|
|
28075
28109
|
import path40 from "path";
|
|
28076
28110
|
import chalk179 from "chalk";
|
|
@@ -28101,7 +28135,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
28101
28135
|
console.error(chalk179.red("jb inspectcode failed"));
|
|
28102
28136
|
process.exit(1);
|
|
28103
28137
|
}
|
|
28104
|
-
if (!
|
|
28138
|
+
if (!existsSync63(reportPath)) {
|
|
28105
28139
|
console.error(chalk179.red("Report file not generated"));
|
|
28106
28140
|
process.exit(1);
|
|
28107
28141
|
}
|
|
@@ -30490,10 +30524,10 @@ function fetchIssueToWorkingFile(number, repo) {
|
|
|
30490
30524
|
}
|
|
30491
30525
|
|
|
30492
30526
|
// src/commands/github/issue/resumeIssueBody.ts
|
|
30493
|
-
import { existsSync as
|
|
30527
|
+
import { existsSync as existsSync64, readFileSync as readFileSync44 } from "fs";
|
|
30494
30528
|
function resumeIssueBody(slug2, number, updatedAt) {
|
|
30495
30529
|
const { bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
30496
|
-
if (!
|
|
30530
|
+
if (!existsSync64(bodyPath) || !existsSync64(metaPath)) return void 0;
|
|
30497
30531
|
try {
|
|
30498
30532
|
const meta = JSON.parse(readFileSync44(metaPath, "utf8"));
|
|
30499
30533
|
if (meta.updatedAt !== updatedAt) return void 0;
|
|
@@ -31360,7 +31394,7 @@ function recentDaemonLogLines(includeRelayed = true) {
|
|
|
31360
31394
|
}
|
|
31361
31395
|
|
|
31362
31396
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
31363
|
-
import { existsSync as
|
|
31397
|
+
import { existsSync as existsSync65 } from "fs";
|
|
31364
31398
|
import { basename as basename20, dirname as dirname34 } from "path";
|
|
31365
31399
|
|
|
31366
31400
|
// src/commands/sessions/daemon/worktree/nextWorktreePath.ts
|
|
@@ -31392,7 +31426,7 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
31392
31426
|
const base = strategy.root ? expandTilde(strategy.root) : dirname34(clone);
|
|
31393
31427
|
const registered = new Set(listWorktreePaths(clone));
|
|
31394
31428
|
const branches = new Set(listLocalBranches(clone));
|
|
31395
|
-
const isTaken = (candidate) => registered.has(candidate) ||
|
|
31429
|
+
const isTaken = (candidate) => registered.has(candidate) || existsSync65(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename20(candidate));
|
|
31396
31430
|
const path109 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
31397
31431
|
const ready = addWorktree(clone, path109, strategy.trunk);
|
|
31398
31432
|
ready.catch(() => {
|
|
@@ -31630,21 +31664,21 @@ function persistedTreeRoots() {
|
|
|
31630
31664
|
}
|
|
31631
31665
|
|
|
31632
31666
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
31633
|
-
import { copyFileSync, existsSync as
|
|
31667
|
+
import { copyFileSync, existsSync as existsSync67, mkdirSync as mkdirSync23 } from "fs";
|
|
31634
31668
|
import { dirname as dirname35, join as join79 } from "path";
|
|
31635
31669
|
|
|
31636
31670
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
31637
|
-
import { resolve as
|
|
31671
|
+
import { resolve as resolve22 } from "path";
|
|
31638
31672
|
|
|
31639
31673
|
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
31640
|
-
import { existsSync as
|
|
31674
|
+
import { existsSync as existsSync66 } from "fs";
|
|
31641
31675
|
import { join as join78 } from "path";
|
|
31642
31676
|
function detectInstallCommand(dir) {
|
|
31643
|
-
if (!
|
|
31644
|
-
if (
|
|
31645
|
-
if (
|
|
31646
|
-
if (
|
|
31647
|
-
if (
|
|
31677
|
+
if (!existsSync66(join78(dir, "package.json"))) return null;
|
|
31678
|
+
if (existsSync66(join78(dir, "pnpm-lock.yaml"))) return "pnpm install";
|
|
31679
|
+
if (existsSync66(join78(dir, "yarn.lock"))) return "yarn install";
|
|
31680
|
+
if (existsSync66(join78(dir, "bun.lockb"))) return "bun install";
|
|
31681
|
+
if (existsSync66(join78(dir, "package-lock.json"))) return "npm ci";
|
|
31648
31682
|
return "npm install";
|
|
31649
31683
|
}
|
|
31650
31684
|
|
|
@@ -31775,7 +31809,7 @@ function installPaths(worktreePath, paths, onSeeded, onInstalling) {
|
|
|
31775
31809
|
onSeeded();
|
|
31776
31810
|
return;
|
|
31777
31811
|
}
|
|
31778
|
-
const dir =
|
|
31812
|
+
const dir = resolve22(worktreePath, rel);
|
|
31779
31813
|
const command = detectInstallCommand(dir);
|
|
31780
31814
|
if (!command) {
|
|
31781
31815
|
daemonLog(
|
|
@@ -31810,7 +31844,7 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
31810
31844
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
31811
31845
|
for (const rel of copy) {
|
|
31812
31846
|
const src = join79(clone, rel);
|
|
31813
|
-
if (!
|
|
31847
|
+
if (!existsSync67(src)) continue;
|
|
31814
31848
|
const dest = join79(worktreePath, rel);
|
|
31815
31849
|
try {
|
|
31816
31850
|
mkdirSync23(dirname35(dest), { recursive: true });
|
|
@@ -32281,12 +32315,12 @@ function registerLitellm(program) {
|
|
|
32281
32315
|
|
|
32282
32316
|
// src/commands/mermaidExport.ts
|
|
32283
32317
|
import { mkdirSync as mkdirSync24, readdirSync as readdirSync15 } from "fs";
|
|
32284
|
-
import { resolve as
|
|
32318
|
+
import { resolve as resolve24 } from "path";
|
|
32285
32319
|
import chalk196 from "chalk";
|
|
32286
32320
|
|
|
32287
32321
|
// src/commands/mermaid/exportFile.ts
|
|
32288
32322
|
import { readFileSync as readFileSync45, writeFileSync as writeFileSync35 } from "fs";
|
|
32289
|
-
import { basename as basename21, extname as extname4, resolve as
|
|
32323
|
+
import { basename as basename21, extname as extname4, resolve as resolve23 } from "path";
|
|
32290
32324
|
import chalk195 from "chalk";
|
|
32291
32325
|
|
|
32292
32326
|
// src/commands/mermaid/renderBlock.ts
|
|
@@ -32334,7 +32368,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
32334
32368
|
for (const [i, source] of blocks.entries()) {
|
|
32335
32369
|
const idx = i + 1;
|
|
32336
32370
|
if (onlyIndex !== void 0 && idx !== onlyIndex) continue;
|
|
32337
|
-
const outPath =
|
|
32371
|
+
const outPath = resolve23(outDir, `${stem}-${idx}.svg`);
|
|
32338
32372
|
const svg = await renderBlock(krokiUrl, source);
|
|
32339
32373
|
writeFileSync35(outPath, svg, "utf8");
|
|
32340
32374
|
console.log(chalk195.green(` \u2192 ${outPath}`));
|
|
@@ -32348,7 +32382,7 @@ function extractMermaidBlocks(markdown) {
|
|
|
32348
32382
|
// src/commands/mermaidExport.ts
|
|
32349
32383
|
async function mermaidExport(file, options2 = {}) {
|
|
32350
32384
|
const { mermaid } = loadConfig();
|
|
32351
|
-
const outDir =
|
|
32385
|
+
const outDir = resolve24(process.cwd(), options2.out ?? ".");
|
|
32352
32386
|
mkdirSync24(outDir, { recursive: true });
|
|
32353
32387
|
if (options2.index !== void 0) {
|
|
32354
32388
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
@@ -32476,17 +32510,17 @@ function emitExtract(out, header, texts) {
|
|
|
32476
32510
|
}
|
|
32477
32511
|
|
|
32478
32512
|
// src/commands/miro/resolveExtractPath.ts
|
|
32479
|
-
import { isAbsolute as isAbsolute4, relative as relative8, resolve as
|
|
32513
|
+
import { isAbsolute as isAbsolute4, relative as relative8, resolve as resolve25 } from "path";
|
|
32480
32514
|
function extractRoot(cwd) {
|
|
32481
32515
|
return findConfigUp(cwd)?.rootDir ?? cwd;
|
|
32482
32516
|
}
|
|
32483
32517
|
function resolveExtractPath(value, cwd) {
|
|
32484
32518
|
if (value === void 0) return void 0;
|
|
32485
|
-
return isAbsolute4(value) ? value :
|
|
32519
|
+
return isAbsolute4(value) ? value : resolve25(extractRoot(cwd), value);
|
|
32486
32520
|
}
|
|
32487
32521
|
function storedExtractPath(value, cwd) {
|
|
32488
32522
|
if (value === void 0) return void 0;
|
|
32489
|
-
const absolute2 =
|
|
32523
|
+
const absolute2 = resolve25(cwd, value);
|
|
32490
32524
|
const within2 = relative8(extractRoot(cwd), absolute2);
|
|
32491
32525
|
return within2.startsWith("..") ? absolute2 : within2;
|
|
32492
32526
|
}
|
|
@@ -32523,10 +32557,10 @@ function applyIgnore(texts, ignore3) {
|
|
|
32523
32557
|
}
|
|
32524
32558
|
|
|
32525
32559
|
// src/commands/miro/readIgnoreList.ts
|
|
32526
|
-
import { existsSync as
|
|
32560
|
+
import { existsSync as existsSync68, readFileSync as readFileSync46 } from "fs";
|
|
32527
32561
|
import { parse as parse2 } from "yaml";
|
|
32528
32562
|
function readIgnoreList(file) {
|
|
32529
|
-
if (!
|
|
32563
|
+
if (!existsSync68(file))
|
|
32530
32564
|
throw new MiroExtractError(
|
|
32531
32565
|
`No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
|
|
32532
32566
|
);
|
|
@@ -33074,7 +33108,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
33074
33108
|
}
|
|
33075
33109
|
|
|
33076
33110
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
33077
|
-
import { isAbsolute as isAbsolute5, join as join83, resolve as
|
|
33111
|
+
import { isAbsolute as isAbsolute5, join as join83, resolve as resolve26 } from "path";
|
|
33078
33112
|
|
|
33079
33113
|
// src/commands/netcap/defaultCapturePath.ts
|
|
33080
33114
|
import { homedir as homedir24 } from "os";
|
|
@@ -33086,7 +33120,7 @@ function defaultCapturePath() {
|
|
|
33086
33120
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
33087
33121
|
function resolveNetcapOutPath(out) {
|
|
33088
33122
|
if (!out) return defaultCapturePath();
|
|
33089
|
-
const dir = isAbsolute5(out) ? out :
|
|
33123
|
+
const dir = isAbsolute5(out) ? out : resolve26(process.cwd(), out);
|
|
33090
33124
|
return join83(dir, "capture.jsonl");
|
|
33091
33125
|
}
|
|
33092
33126
|
|
|
@@ -33993,11 +34027,11 @@ import { dirname as dirname39 } from "path";
|
|
|
33993
34027
|
import { stringify as stringify3 } from "yaml";
|
|
33994
34028
|
|
|
33995
34029
|
// src/commands/prs/loadCommentsCache.ts
|
|
33996
|
-
import { existsSync as
|
|
34030
|
+
import { existsSync as existsSync69, readFileSync as readFileSync49, unlinkSync as unlinkSync14 } from "fs";
|
|
33997
34031
|
import { parse as parse3 } from "yaml";
|
|
33998
34032
|
function loadCommentsCache(org, repo, prNumber) {
|
|
33999
34033
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
34000
|
-
if (!
|
|
34034
|
+
if (!existsSync69(cachePath)) {
|
|
34001
34035
|
return null;
|
|
34002
34036
|
}
|
|
34003
34037
|
const content = readFileSync49(cachePath, "utf8");
|
|
@@ -34005,7 +34039,7 @@ function loadCommentsCache(org, repo, prNumber) {
|
|
|
34005
34039
|
}
|
|
34006
34040
|
function deleteCommentsCache(org, repo, prNumber) {
|
|
34007
34041
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
34008
|
-
if (
|
|
34042
|
+
if (existsSync69(cachePath)) {
|
|
34009
34043
|
unlinkSync14(cachePath);
|
|
34010
34044
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
34011
34045
|
}
|
|
@@ -34925,7 +34959,7 @@ ${resolves}` : baseWhy);
|
|
|
34925
34959
|
|
|
34926
34960
|
// src/commands/prs/parseScreenshotSpec.ts
|
|
34927
34961
|
import { statSync as statSync10 } from "fs";
|
|
34928
|
-
import { basename as basename22, extname as extname5, resolve as
|
|
34962
|
+
import { basename as basename22, extname as extname5, resolve as resolve27 } from "path";
|
|
34929
34963
|
function splitOnce(value, separator) {
|
|
34930
34964
|
const index3 = value.indexOf(separator);
|
|
34931
34965
|
if (index3 === -1) return null;
|
|
@@ -34941,7 +34975,7 @@ function isFile2(path109) {
|
|
|
34941
34975
|
function parseScreenshotSpec(spec) {
|
|
34942
34976
|
const [label, rawPath] = splitOnce(spec, "=") ?? ["", spec];
|
|
34943
34977
|
const [group, caption] = splitOnce(label, "/") ?? ["", label];
|
|
34944
|
-
const path109 =
|
|
34978
|
+
const path109 = resolve27(rawPath.trim());
|
|
34945
34979
|
const ext = extname5(path109).replace(/^\./, "").toLowerCase();
|
|
34946
34980
|
if (!isFile2(path109))
|
|
34947
34981
|
throw new Error(`--screenshot '${spec}': file not found: ${path109}`);
|
|
@@ -37306,9 +37340,9 @@ async function notify() {
|
|
|
37306
37340
|
|
|
37307
37341
|
// src/commands/screenshot.ts
|
|
37308
37342
|
import { execSync as execSync54 } from "child_process";
|
|
37309
|
-
import { existsSync as
|
|
37343
|
+
import { existsSync as existsSync70, mkdirSync as mkdirSync27, unlinkSync as unlinkSync16, writeFileSync as writeFileSync40 } from "fs";
|
|
37310
37344
|
import { tmpdir as tmpdir7 } from "os";
|
|
37311
|
-
import { join as join88, resolve as
|
|
37345
|
+
import { join as join88, resolve as resolve28 } from "path";
|
|
37312
37346
|
import chalk228 from "chalk";
|
|
37313
37347
|
|
|
37314
37348
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -37438,11 +37472,11 @@ Write-Output $OutputPath
|
|
|
37438
37472
|
|
|
37439
37473
|
// src/commands/screenshot.ts
|
|
37440
37474
|
function buildOutputPath(outputDir, processName) {
|
|
37441
|
-
if (!
|
|
37475
|
+
if (!existsSync70(outputDir)) {
|
|
37442
37476
|
mkdirSync27(outputDir, { recursive: true });
|
|
37443
37477
|
}
|
|
37444
37478
|
const timestamp9 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
37445
|
-
return
|
|
37479
|
+
return resolve28(outputDir, `${processName}-${timestamp9}.png`);
|
|
37446
37480
|
}
|
|
37447
37481
|
function runPowerShellScript(processName, outputPath) {
|
|
37448
37482
|
const scriptPath = join88(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
|
|
@@ -37458,7 +37492,7 @@ function runPowerShellScript(processName, outputPath) {
|
|
|
37458
37492
|
}
|
|
37459
37493
|
function screenshot(processName) {
|
|
37460
37494
|
const config = loadConfig();
|
|
37461
|
-
const outputDir =
|
|
37495
|
+
const outputDir = resolve28(config.screenshot.outputDir);
|
|
37462
37496
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
37463
37497
|
console.log(chalk228.gray(`Capturing window for process "${processName}" ...`));
|
|
37464
37498
|
try {
|
|
@@ -37547,7 +37581,7 @@ function buildLimitsSegment(rateLimits) {
|
|
|
37547
37581
|
|
|
37548
37582
|
// src/commands/readGitBranch.ts
|
|
37549
37583
|
import { readFileSync as readFileSync52, statSync as statSync11 } from "fs";
|
|
37550
|
-
import { isAbsolute as isAbsolute6, join as join89, resolve as
|
|
37584
|
+
import { isAbsolute as isAbsolute6, join as join89, resolve as resolve29 } from "path";
|
|
37551
37585
|
function resolveGitDir(cwd) {
|
|
37552
37586
|
const dotGit = join89(cwd, ".git");
|
|
37553
37587
|
let stat5;
|
|
@@ -37570,7 +37604,7 @@ function resolveGitDir(cwd) {
|
|
|
37570
37604
|
return null;
|
|
37571
37605
|
}
|
|
37572
37606
|
const gitDir = match[1].trim();
|
|
37573
|
-
return isAbsolute6(gitDir) ? gitDir :
|
|
37607
|
+
return isAbsolute6(gitDir) ? gitDir : resolve29(cwd, gitDir);
|
|
37574
37608
|
}
|
|
37575
37609
|
function readGitBranch(cwd) {
|
|
37576
37610
|
const gitDir = resolveGitDir(cwd);
|
|
@@ -40816,9 +40850,9 @@ function listHighLevelHunks(files) {
|
|
|
40816
40850
|
}
|
|
40817
40851
|
|
|
40818
40852
|
// src/commands/review/highLevel/readJsonFile.ts
|
|
40819
|
-
import { existsSync as
|
|
40853
|
+
import { existsSync as existsSync71, readFileSync as readFileSync53 } from "fs";
|
|
40820
40854
|
function readJsonFile(path109) {
|
|
40821
|
-
if (!
|
|
40855
|
+
if (!existsSync71(path109)) return void 0;
|
|
40822
40856
|
try {
|
|
40823
40857
|
return JSON.parse(readFileSync53(path109, "utf8"));
|
|
40824
40858
|
} catch {
|
|
@@ -42995,7 +43029,7 @@ async function runClaudeReviewer(spec) {
|
|
|
42995
43029
|
}
|
|
42996
43030
|
|
|
42997
43031
|
// src/commands/review/runCodexReviewer.ts
|
|
42998
|
-
import { existsSync as
|
|
43032
|
+
import { existsSync as existsSync72, unlinkSync as unlinkSync17 } from "fs";
|
|
42999
43033
|
|
|
43000
43034
|
// src/commands/review/parseCodexUsage.ts
|
|
43001
43035
|
function parseCodexUsage(usage) {
|
|
@@ -43084,7 +43118,7 @@ async function runCodexReviewer(spec) {
|
|
|
43084
43118
|
...override.args.length > 0 ? { env: override.env } : {},
|
|
43085
43119
|
onLine
|
|
43086
43120
|
});
|
|
43087
|
-
if (result.exitCode !== 0 &&
|
|
43121
|
+
if (result.exitCode !== 0 && existsSync72(spec.outputPath)) {
|
|
43088
43122
|
unlinkSync17(spec.outputPath);
|
|
43089
43123
|
}
|
|
43090
43124
|
const finalised = finaliseReviewerRun(
|
|
@@ -43178,7 +43212,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
|
|
|
43178
43212
|
}
|
|
43179
43213
|
|
|
43180
43214
|
// src/commands/review/synthesiseAfterReviewers.ts
|
|
43181
|
-
import { existsSync as
|
|
43215
|
+
import { existsSync as existsSync73, unlinkSync as unlinkSync18 } from "fs";
|
|
43182
43216
|
|
|
43183
43217
|
// src/commands/review/synthesise.ts
|
|
43184
43218
|
import { readFileSync as readFileSync56 } from "fs";
|
|
@@ -43285,7 +43319,7 @@ async function synthesise(paths, options2) {
|
|
|
43285
43319
|
// src/commands/review/synthesiseAfterReviewers.ts
|
|
43286
43320
|
async function synthesiseAfterReviewers(input) {
|
|
43287
43321
|
const { paths, failures } = input;
|
|
43288
|
-
if (input.anyFresh &&
|
|
43322
|
+
if (input.anyFresh && existsSync73(paths.synthesisPath)) {
|
|
43289
43323
|
unlinkSync18(paths.synthesisPath);
|
|
43290
43324
|
}
|
|
43291
43325
|
const synthesisResult = await synthesise(paths, {
|
|
@@ -43569,10 +43603,10 @@ function fetchExistingComments() {
|
|
|
43569
43603
|
}
|
|
43570
43604
|
|
|
43571
43605
|
// src/commands/review/prepareReviewDir.ts
|
|
43572
|
-
import { existsSync as
|
|
43606
|
+
import { existsSync as existsSync74, mkdirSync as mkdirSync30, unlinkSync as unlinkSync19, writeFileSync as writeFileSync43 } from "fs";
|
|
43573
43607
|
function clearReviewFiles(paths) {
|
|
43574
43608
|
for (const path109 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
43575
|
-
if (
|
|
43609
|
+
if (existsSync74(path109)) unlinkSync19(path109);
|
|
43576
43610
|
}
|
|
43577
43611
|
}
|
|
43578
43612
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -44241,7 +44275,7 @@ import path88 from "path";
|
|
|
44241
44275
|
import chalk263 from "chalk";
|
|
44242
44276
|
|
|
44243
44277
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
44244
|
-
import { existsSync as
|
|
44278
|
+
import { existsSync as existsSync75, readFileSync as readFileSync59, writeFileSync as writeFileSync44 } from "fs";
|
|
44245
44279
|
import path87 from "path";
|
|
44246
44280
|
|
|
44247
44281
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
@@ -44311,7 +44345,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
44311
44345
|
function updateScopedRulesIndex(root2) {
|
|
44312
44346
|
const directories = scopedRuleDirectories(root2);
|
|
44313
44347
|
const rootFile = path87.join(root2, "CLAUDE.md");
|
|
44314
|
-
const before =
|
|
44348
|
+
const before = existsSync75(rootFile) ? readFileSync59(rootFile, "utf8") : "";
|
|
44315
44349
|
const after = upsertScopedRulesPointer(before, directories);
|
|
44316
44350
|
if (after !== before) writeFileSync44(rootFile, after);
|
|
44317
44351
|
return directories;
|
|
@@ -44364,7 +44398,7 @@ function listRules(target, options2 = {}) {
|
|
|
44364
44398
|
}
|
|
44365
44399
|
|
|
44366
44400
|
// src/commands/rules/addRule.ts
|
|
44367
|
-
import { existsSync as
|
|
44401
|
+
import { existsSync as existsSync77, readFileSync as readFileSync61, writeFileSync as writeFileSync45 } from "fs";
|
|
44368
44402
|
import path91 from "path";
|
|
44369
44403
|
import chalk265 from "chalk";
|
|
44370
44404
|
|
|
@@ -44401,7 +44435,7 @@ function nextRuleCode(root2) {
|
|
|
44401
44435
|
}
|
|
44402
44436
|
|
|
44403
44437
|
// src/commands/rules/resolveRuleScope.ts
|
|
44404
|
-
import { existsSync as
|
|
44438
|
+
import { existsSync as existsSync76 } from "fs";
|
|
44405
44439
|
import path90 from "path";
|
|
44406
44440
|
function resolveRuleScope(target) {
|
|
44407
44441
|
const resolved = path90.resolve(target);
|
|
@@ -44411,7 +44445,7 @@ function resolveRuleScope(target) {
|
|
|
44411
44445
|
let current = startDir;
|
|
44412
44446
|
while (true) {
|
|
44413
44447
|
const candidate = path90.join(current, "CLAUDE.md");
|
|
44414
|
-
if (
|
|
44448
|
+
if (existsSync76(candidate)) return candidate;
|
|
44415
44449
|
if (current === root2 || current === path90.dirname(current)) break;
|
|
44416
44450
|
current = path90.dirname(current);
|
|
44417
44451
|
}
|
|
@@ -44420,7 +44454,7 @@ function resolveRuleScope(target) {
|
|
|
44420
44454
|
|
|
44421
44455
|
// src/commands/rules/addRule.ts
|
|
44422
44456
|
function read2(file) {
|
|
44423
|
-
return
|
|
44457
|
+
return existsSync77(file) ? readFileSync61(file, "utf8") : "";
|
|
44424
44458
|
}
|
|
44425
44459
|
function addRule(text20, options2) {
|
|
44426
44460
|
const rule = text20.trim();
|
|
@@ -45959,7 +45993,7 @@ function registerSync(program) {
|
|
|
45959
45993
|
}
|
|
45960
45994
|
|
|
45961
45995
|
// src/commands/transcript/clean.ts
|
|
45962
|
-
import { existsSync as
|
|
45996
|
+
import { existsSync as existsSync82 } from "fs";
|
|
45963
45997
|
|
|
45964
45998
|
// src/commands/transcript/convert/formatTimestamp.ts
|
|
45965
45999
|
function pad2(value, width2) {
|
|
@@ -46237,7 +46271,7 @@ function clean(file, options2 = {}) {
|
|
|
46237
46271
|
);
|
|
46238
46272
|
process.exit(1);
|
|
46239
46273
|
}
|
|
46240
|
-
if (!
|
|
46274
|
+
if (!existsSync82(file)) {
|
|
46241
46275
|
console.error(`Error: VTT file not found: ${file}`);
|
|
46242
46276
|
process.exit(1);
|
|
46243
46277
|
}
|
|
@@ -46320,11 +46354,11 @@ async function configure() {
|
|
|
46320
46354
|
}
|
|
46321
46355
|
|
|
46322
46356
|
// src/commands/transcript/list.ts
|
|
46323
|
-
import { existsSync as
|
|
46357
|
+
import { existsSync as existsSync83, readdirSync as readdirSync24, statSync as statSync13 } from "fs";
|
|
46324
46358
|
import { join as join105 } from "path";
|
|
46325
46359
|
function list5() {
|
|
46326
46360
|
const { vttDir } = getTranscriptConfig();
|
|
46327
|
-
if (!
|
|
46361
|
+
if (!existsSync83(vttDir)) return;
|
|
46328
46362
|
for (const entry of readdirSync24(vttDir)) {
|
|
46329
46363
|
if (!entry.endsWith(".vtt")) continue;
|
|
46330
46364
|
if (statSync13(join105(vttDir, entry)).isDirectory()) continue;
|
|
@@ -46333,7 +46367,7 @@ function list5() {
|
|
|
46333
46367
|
}
|
|
46334
46368
|
|
|
46335
46369
|
// src/commands/transcript/move.ts
|
|
46336
|
-
import { existsSync as
|
|
46370
|
+
import { existsSync as existsSync84, mkdirSync as mkdirSync38, renameSync as renameSync5, writeFileSync as writeFileSync52 } from "fs";
|
|
46337
46371
|
import { basename as basename29, join as join106 } from "path";
|
|
46338
46372
|
|
|
46339
46373
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
@@ -46357,7 +46391,7 @@ function move(file, options2) {
|
|
|
46357
46391
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
46358
46392
|
const filename = basename29(file);
|
|
46359
46393
|
const sourcePath = join106(vttDir, filename);
|
|
46360
|
-
if (!
|
|
46394
|
+
if (!existsSync84(sourcePath)) {
|
|
46361
46395
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
46362
46396
|
process.exit(1);
|
|
46363
46397
|
}
|
|
@@ -46374,7 +46408,7 @@ function move(file, options2) {
|
|
|
46374
46408
|
}
|
|
46375
46409
|
|
|
46376
46410
|
// src/commands/transcript/merge.ts
|
|
46377
|
-
import { existsSync as
|
|
46411
|
+
import { existsSync as existsSync85, writeFileSync as writeFileSync53 } from "fs";
|
|
46378
46412
|
import { basename as basename30 } from "path";
|
|
46379
46413
|
|
|
46380
46414
|
// src/commands/transcript/failTranscript.ts
|
|
@@ -46518,7 +46552,7 @@ function widenAudience(passages) {
|
|
|
46518
46552
|
|
|
46519
46553
|
// src/commands/transcript/merge.ts
|
|
46520
46554
|
function readSource3(file) {
|
|
46521
|
-
if (!
|
|
46555
|
+
if (!existsSync85(file)) failTranscript(`VTT file not found: ${file}`);
|
|
46522
46556
|
const cues = readCleanedCues(file);
|
|
46523
46557
|
if (cues.length === 0) failTranscript(`no cues found in: ${file}`);
|
|
46524
46558
|
return { path: file, name: basename30(file), cues };
|
|
@@ -46991,7 +47025,7 @@ function configKeys2() {
|
|
|
46991
47025
|
}
|
|
46992
47026
|
|
|
46993
47027
|
// src/commands/verify/forbiddenStrings.ts
|
|
46994
|
-
import { existsSync as
|
|
47028
|
+
import { existsSync as existsSync86, readFileSync as readFileSync69 } from "fs";
|
|
46995
47029
|
|
|
46996
47030
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
46997
47031
|
import { minimatch as minimatch10 } from "minimatch";
|
|
@@ -47032,7 +47066,7 @@ function forbiddenStrings() {
|
|
|
47032
47066
|
const cache7 = /* @__PURE__ */ new Map();
|
|
47033
47067
|
const readJson = (file) => {
|
|
47034
47068
|
if (cache7.has(file)) return cache7.get(file);
|
|
47035
|
-
if (!
|
|
47069
|
+
if (!existsSync86(file)) {
|
|
47036
47070
|
console.log(`Forbidden-strings file not found: ${file}`);
|
|
47037
47071
|
process.exit(1);
|
|
47038
47072
|
}
|
|
@@ -47448,6 +47482,231 @@ function emitWatchState(watchState) {
|
|
|
47448
47482
|
emitActivity({ kind: "command", name: "watch", watchState });
|
|
47449
47483
|
}
|
|
47450
47484
|
|
|
47485
|
+
// src/commands/watch/clearBuildPending.ts
|
|
47486
|
+
import { rmSync as rmSync11 } from "fs";
|
|
47487
|
+
function clearBuildPending() {
|
|
47488
|
+
try {
|
|
47489
|
+
rmSync11(buildPendingPath(), { force: true });
|
|
47490
|
+
} catch {
|
|
47491
|
+
}
|
|
47492
|
+
}
|
|
47493
|
+
|
|
47494
|
+
// src/commands/watch/isSyncPending.ts
|
|
47495
|
+
import { existsSync as existsSync87 } from "fs";
|
|
47496
|
+
|
|
47497
|
+
// src/commands/watch/syncPendingPath.ts
|
|
47498
|
+
function syncPendingPath(cwd) {
|
|
47499
|
+
return gitMarkerPath("assist-watch-sync-pending", cwd);
|
|
47500
|
+
}
|
|
47501
|
+
|
|
47502
|
+
// src/commands/watch/isSyncPending.ts
|
|
47503
|
+
function isSyncPending() {
|
|
47504
|
+
try {
|
|
47505
|
+
return existsSync87(syncPendingPath());
|
|
47506
|
+
} catch {
|
|
47507
|
+
return false;
|
|
47508
|
+
}
|
|
47509
|
+
}
|
|
47510
|
+
|
|
47511
|
+
// src/commands/watch/reportSyncOrExit.ts
|
|
47512
|
+
import { rmSync as rmSync12 } from "fs";
|
|
47513
|
+
|
|
47514
|
+
// src/commands/watch/toBuildOutcome.ts
|
|
47515
|
+
function toBuildOutcome(result) {
|
|
47516
|
+
if (result.kind === "failed")
|
|
47517
|
+
return { kind: "failed", exitCode: 1, output: result.message };
|
|
47518
|
+
if (result.exitCode !== 0)
|
|
47519
|
+
return { kind: "failed", exitCode: result.exitCode, output: result.output };
|
|
47520
|
+
return { kind: "built" };
|
|
47521
|
+
}
|
|
47522
|
+
|
|
47523
|
+
// src/commands/watch/runPostBuildSync.ts
|
|
47524
|
+
async function runPostBuildSync() {
|
|
47525
|
+
return toBuildOutcome(
|
|
47526
|
+
await runCommandToCompletion(
|
|
47527
|
+
process.execPath,
|
|
47528
|
+
[process.argv[1], "sync", "--yes"],
|
|
47529
|
+
void 0,
|
|
47530
|
+
void 0,
|
|
47531
|
+
true
|
|
47532
|
+
)
|
|
47533
|
+
);
|
|
47534
|
+
}
|
|
47535
|
+
|
|
47536
|
+
// src/commands/watch/reportSyncOrExit.ts
|
|
47537
|
+
function clearPendingMarker() {
|
|
47538
|
+
try {
|
|
47539
|
+
rmSync12(syncPendingPath(), { force: true });
|
|
47540
|
+
} catch {
|
|
47541
|
+
}
|
|
47542
|
+
}
|
|
47543
|
+
async function reportSyncOrExit() {
|
|
47544
|
+
const outcome = await runPostBuildSync();
|
|
47545
|
+
if (outcome.kind === "built") {
|
|
47546
|
+
clearPendingMarker();
|
|
47547
|
+
console.log("synced ~/.claude");
|
|
47548
|
+
return;
|
|
47549
|
+
}
|
|
47550
|
+
if (outcome.output.length > 0)
|
|
47551
|
+
process.stdout.write(
|
|
47552
|
+
outcome.output.endsWith("\n") ? outcome.output : `${outcome.output}
|
|
47553
|
+
`
|
|
47554
|
+
);
|
|
47555
|
+
console.error(
|
|
47556
|
+
`sync failed with exit code ${outcome.exitCode}; a later lap will retry it`
|
|
47557
|
+
);
|
|
47558
|
+
process.exit(4);
|
|
47559
|
+
}
|
|
47560
|
+
|
|
47561
|
+
// src/commands/run/findRunConfig.ts
|
|
47562
|
+
function exitNoRunConfigs() {
|
|
47563
|
+
console.error("No run configurations found in assist.yml");
|
|
47564
|
+
process.exit(1);
|
|
47565
|
+
}
|
|
47566
|
+
function exitWithConfigNotFound(name, configs) {
|
|
47567
|
+
console.error(`No run configuration found with name: ${name}`);
|
|
47568
|
+
console.error("Available configurations:");
|
|
47569
|
+
for (const r of configs) {
|
|
47570
|
+
console.error(` - ${r.name}`);
|
|
47571
|
+
}
|
|
47572
|
+
process.exit(1);
|
|
47573
|
+
}
|
|
47574
|
+
function exitWithAmbiguousConfig(name, matches) {
|
|
47575
|
+
console.error(`Ambiguous run configuration: ${name}`);
|
|
47576
|
+
console.error("Did you mean:");
|
|
47577
|
+
for (const r of matches) {
|
|
47578
|
+
console.error(` - ${r.name}`);
|
|
47579
|
+
}
|
|
47580
|
+
process.exit(1);
|
|
47581
|
+
}
|
|
47582
|
+
function requireRunConfigs() {
|
|
47583
|
+
const { run: run4 } = loadConfig();
|
|
47584
|
+
const configs = resolveRunConfigs(run4, runConfigBaseDir());
|
|
47585
|
+
if (configs.length === 0) return exitNoRunConfigs();
|
|
47586
|
+
return configs;
|
|
47587
|
+
}
|
|
47588
|
+
function lookupRunConfig(name) {
|
|
47589
|
+
const configs = requireRunConfigs();
|
|
47590
|
+
const exact = configs.find((r) => r.name === name);
|
|
47591
|
+
if (exact) return { kind: "match", config: exact };
|
|
47592
|
+
const suffixMatches = configs.filter((r) => r.name.endsWith(`:${name}`));
|
|
47593
|
+
if (suffixMatches.length === 1)
|
|
47594
|
+
return { kind: "match", config: suffixMatches[0] };
|
|
47595
|
+
if (suffixMatches.length > 1)
|
|
47596
|
+
return { kind: "ambiguous", matches: suffixMatches };
|
|
47597
|
+
return { kind: "not-found" };
|
|
47598
|
+
}
|
|
47599
|
+
function findRunConfig(name) {
|
|
47600
|
+
const result = lookupRunConfig(name);
|
|
47601
|
+
if (result.kind === "match") return result.config;
|
|
47602
|
+
if (result.kind === "ambiguous")
|
|
47603
|
+
return exitWithAmbiguousConfig(name, result.matches);
|
|
47604
|
+
return exitWithConfigNotFound(name, requireRunConfigs());
|
|
47605
|
+
}
|
|
47606
|
+
|
|
47607
|
+
// src/commands/run/resolveParams.ts
|
|
47608
|
+
function resolveParams(params, cliArgs) {
|
|
47609
|
+
if (!params || params.length === 0) return cliArgs;
|
|
47610
|
+
const resolved = [];
|
|
47611
|
+
const missing = [];
|
|
47612
|
+
for (let i = 0; i < params.length; i++) {
|
|
47613
|
+
const param = params[i];
|
|
47614
|
+
const value = cliArgs[i] ?? param.default;
|
|
47615
|
+
if (value !== void 0) {
|
|
47616
|
+
resolved.push(value);
|
|
47617
|
+
} else if (param.required) {
|
|
47618
|
+
missing.push(param.name);
|
|
47619
|
+
}
|
|
47620
|
+
}
|
|
47621
|
+
if (missing.length > 0) {
|
|
47622
|
+
const s = missing.length > 1 ? "s" : "";
|
|
47623
|
+
const names = missing.map((n) => `"${n}"`).join(", ");
|
|
47624
|
+
console.error(`Missing required param${s}: ${names}`);
|
|
47625
|
+
process.exit(1);
|
|
47626
|
+
}
|
|
47627
|
+
resolved.push(...cliArgs.slice(params.length));
|
|
47628
|
+
return resolved;
|
|
47629
|
+
}
|
|
47630
|
+
|
|
47631
|
+
// src/commands/run/resolveRunCwd.ts
|
|
47632
|
+
import { existsSync as existsSync88 } from "fs";
|
|
47633
|
+
import { resolve as resolve31 } from "path";
|
|
47634
|
+
var MissingRunCwdError = class extends Error {
|
|
47635
|
+
constructor(runName, cwd) {
|
|
47636
|
+
super(`run config "${runName}": cwd ${cwd} does not exist`);
|
|
47637
|
+
this.runName = runName;
|
|
47638
|
+
this.cwd = cwd;
|
|
47639
|
+
this.name = "MissingRunCwdError";
|
|
47640
|
+
}
|
|
47641
|
+
};
|
|
47642
|
+
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
47643
|
+
if (!config.cwd) return void 0;
|
|
47644
|
+
const cwd = resolve31(baseDir, config.cwd);
|
|
47645
|
+
if (!existsSync88(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
47646
|
+
return cwd;
|
|
47647
|
+
}
|
|
47648
|
+
|
|
47649
|
+
// src/commands/run/runPreCommands.ts
|
|
47650
|
+
import { execSync as execSync66 } from "child_process";
|
|
47651
|
+
function writeCapturedOutput(error) {
|
|
47652
|
+
for (const stream of ["stdout", "stderr"]) {
|
|
47653
|
+
const output = error[stream];
|
|
47654
|
+
if (output) process.stdout.write(output);
|
|
47655
|
+
}
|
|
47656
|
+
}
|
|
47657
|
+
function runPreCommands(pre, cwd, quiet) {
|
|
47658
|
+
for (const cmd of pre) {
|
|
47659
|
+
try {
|
|
47660
|
+
execSync66(cmd, { stdio: quiet ? "pipe" : "inherit", cwd });
|
|
47661
|
+
} catch (error) {
|
|
47662
|
+
if (quiet && error && typeof error === "object")
|
|
47663
|
+
writeCapturedOutput(error);
|
|
47664
|
+
const code = error && typeof error === "object" && "status" in error ? error.status : 1;
|
|
47665
|
+
process.exit(code);
|
|
47666
|
+
}
|
|
47667
|
+
}
|
|
47668
|
+
}
|
|
47669
|
+
|
|
47670
|
+
// src/commands/watch/runWatchBuild.ts
|
|
47671
|
+
async function runWatchBuild(entry) {
|
|
47672
|
+
const config = findRunConfig(entry);
|
|
47673
|
+
let cwd;
|
|
47674
|
+
try {
|
|
47675
|
+
cwd = resolveRunCwd(config);
|
|
47676
|
+
} catch (error) {
|
|
47677
|
+
if (!(error instanceof MissingRunCwdError)) throw error;
|
|
47678
|
+
return { kind: "failed", exitCode: 1, output: error.message };
|
|
47679
|
+
}
|
|
47680
|
+
if (config.pre) runPreCommands(config.pre, cwd, true);
|
|
47681
|
+
return toBuildOutcome(
|
|
47682
|
+
await runCommandToCompletion(
|
|
47683
|
+
config.command,
|
|
47684
|
+
[...config.args ?? [], ...resolveParams(config.params, [])],
|
|
47685
|
+
config.env,
|
|
47686
|
+
cwd,
|
|
47687
|
+
true
|
|
47688
|
+
)
|
|
47689
|
+
);
|
|
47690
|
+
}
|
|
47691
|
+
|
|
47692
|
+
// src/commands/watch/finishPendingBuild.ts
|
|
47693
|
+
async function finishPendingBuild(entry) {
|
|
47694
|
+
if (!isBuildPending()) return;
|
|
47695
|
+
console.log("an earlier lap pulled but did not finish building; rebuilding");
|
|
47696
|
+
emitWatchState("updating");
|
|
47697
|
+
const outcome = await runWatchBuild(entry);
|
|
47698
|
+
if (outcome.kind !== "built") {
|
|
47699
|
+
if (outcome.output.length > 0) process.stdout.write(outcome.output);
|
|
47700
|
+
console.error(
|
|
47701
|
+
`build "${entry}" failed with exit code ${outcome.exitCode}; the next pull retries it`
|
|
47702
|
+
);
|
|
47703
|
+
return;
|
|
47704
|
+
}
|
|
47705
|
+
clearBuildPending();
|
|
47706
|
+
console.log(`built with "${entry}"`);
|
|
47707
|
+
if (isSyncPending()) await reportSyncOrExit();
|
|
47708
|
+
}
|
|
47709
|
+
|
|
47451
47710
|
// src/commands/watch/parseWatchDurations.ts
|
|
47452
47711
|
function parseOrExit(value) {
|
|
47453
47712
|
try {
|
|
@@ -47578,39 +47837,25 @@ ${result.reason}`
|
|
|
47578
47837
|
};
|
|
47579
47838
|
}
|
|
47580
47839
|
|
|
47581
|
-
// src/commands/watch/
|
|
47582
|
-
import {
|
|
47583
|
-
|
|
47584
|
-
// src/commands/watch/gitMarkerPath.ts
|
|
47585
|
-
import { resolve as resolve30 } from "path";
|
|
47586
|
-
function gitMarkerPath(name, cwd) {
|
|
47587
|
-
return resolve30(
|
|
47588
|
-
cwd ?? process.cwd(),
|
|
47589
|
-
runGit3(["rev-parse", "--git-path", name], cwd)
|
|
47590
|
-
);
|
|
47591
|
-
}
|
|
47592
|
-
|
|
47593
|
-
// src/commands/watch/syncPendingPath.ts
|
|
47594
|
-
function syncPendingPath(cwd) {
|
|
47595
|
-
return gitMarkerPath("assist-watch-sync-pending", cwd);
|
|
47596
|
-
}
|
|
47597
|
-
|
|
47598
|
-
// src/commands/watch/markSyncPending.ts
|
|
47599
|
-
function pendingFromEarlierLap() {
|
|
47840
|
+
// src/commands/watch/markBuildPending.ts
|
|
47841
|
+
import { writeFileSync as writeFileSync54 } from "fs";
|
|
47842
|
+
function markBuildPending() {
|
|
47600
47843
|
try {
|
|
47601
|
-
|
|
47844
|
+
writeFileSync54(buildPendingPath(), "");
|
|
47602
47845
|
} catch {
|
|
47603
|
-
return false;
|
|
47604
47846
|
}
|
|
47605
47847
|
}
|
|
47848
|
+
|
|
47849
|
+
// src/commands/watch/markSyncPending.ts
|
|
47850
|
+
import { writeFileSync as writeFileSync55 } from "fs";
|
|
47606
47851
|
function writePendingMarker() {
|
|
47607
47852
|
try {
|
|
47608
|
-
|
|
47853
|
+
writeFileSync55(syncPendingPath(), "");
|
|
47609
47854
|
} catch {
|
|
47610
47855
|
}
|
|
47611
47856
|
}
|
|
47612
47857
|
function markSyncPending(from) {
|
|
47613
|
-
const owed =
|
|
47858
|
+
const owed = isSyncPending();
|
|
47614
47859
|
if (syncAdvice(changedPaths(from)).length > 0) {
|
|
47615
47860
|
writePendingMarker();
|
|
47616
47861
|
return true;
|
|
@@ -47690,146 +47935,6 @@ function pullFastForward(cwd) {
|
|
|
47690
47935
|
return mergeBehindBranch(cwd);
|
|
47691
47936
|
}
|
|
47692
47937
|
|
|
47693
|
-
// src/commands/run/findRunConfig.ts
|
|
47694
|
-
function exitNoRunConfigs() {
|
|
47695
|
-
console.error("No run configurations found in assist.yml");
|
|
47696
|
-
process.exit(1);
|
|
47697
|
-
}
|
|
47698
|
-
function exitWithConfigNotFound(name, configs) {
|
|
47699
|
-
console.error(`No run configuration found with name: ${name}`);
|
|
47700
|
-
console.error("Available configurations:");
|
|
47701
|
-
for (const r of configs) {
|
|
47702
|
-
console.error(` - ${r.name}`);
|
|
47703
|
-
}
|
|
47704
|
-
process.exit(1);
|
|
47705
|
-
}
|
|
47706
|
-
function exitWithAmbiguousConfig(name, matches) {
|
|
47707
|
-
console.error(`Ambiguous run configuration: ${name}`);
|
|
47708
|
-
console.error("Did you mean:");
|
|
47709
|
-
for (const r of matches) {
|
|
47710
|
-
console.error(` - ${r.name}`);
|
|
47711
|
-
}
|
|
47712
|
-
process.exit(1);
|
|
47713
|
-
}
|
|
47714
|
-
function requireRunConfigs() {
|
|
47715
|
-
const { run: run4 } = loadConfig();
|
|
47716
|
-
const configs = resolveRunConfigs(run4, runConfigBaseDir());
|
|
47717
|
-
if (configs.length === 0) return exitNoRunConfigs();
|
|
47718
|
-
return configs;
|
|
47719
|
-
}
|
|
47720
|
-
function lookupRunConfig(name) {
|
|
47721
|
-
const configs = requireRunConfigs();
|
|
47722
|
-
const exact = configs.find((r) => r.name === name);
|
|
47723
|
-
if (exact) return { kind: "match", config: exact };
|
|
47724
|
-
const suffixMatches = configs.filter((r) => r.name.endsWith(`:${name}`));
|
|
47725
|
-
if (suffixMatches.length === 1)
|
|
47726
|
-
return { kind: "match", config: suffixMatches[0] };
|
|
47727
|
-
if (suffixMatches.length > 1)
|
|
47728
|
-
return { kind: "ambiguous", matches: suffixMatches };
|
|
47729
|
-
return { kind: "not-found" };
|
|
47730
|
-
}
|
|
47731
|
-
function findRunConfig(name) {
|
|
47732
|
-
const result = lookupRunConfig(name);
|
|
47733
|
-
if (result.kind === "match") return result.config;
|
|
47734
|
-
if (result.kind === "ambiguous")
|
|
47735
|
-
return exitWithAmbiguousConfig(name, result.matches);
|
|
47736
|
-
return exitWithConfigNotFound(name, requireRunConfigs());
|
|
47737
|
-
}
|
|
47738
|
-
|
|
47739
|
-
// src/commands/run/resolveParams.ts
|
|
47740
|
-
function resolveParams(params, cliArgs) {
|
|
47741
|
-
if (!params || params.length === 0) return cliArgs;
|
|
47742
|
-
const resolved = [];
|
|
47743
|
-
const missing = [];
|
|
47744
|
-
for (let i = 0; i < params.length; i++) {
|
|
47745
|
-
const param = params[i];
|
|
47746
|
-
const value = cliArgs[i] ?? param.default;
|
|
47747
|
-
if (value !== void 0) {
|
|
47748
|
-
resolved.push(value);
|
|
47749
|
-
} else if (param.required) {
|
|
47750
|
-
missing.push(param.name);
|
|
47751
|
-
}
|
|
47752
|
-
}
|
|
47753
|
-
if (missing.length > 0) {
|
|
47754
|
-
const s = missing.length > 1 ? "s" : "";
|
|
47755
|
-
const names = missing.map((n) => `"${n}"`).join(", ");
|
|
47756
|
-
console.error(`Missing required param${s}: ${names}`);
|
|
47757
|
-
process.exit(1);
|
|
47758
|
-
}
|
|
47759
|
-
resolved.push(...cliArgs.slice(params.length));
|
|
47760
|
-
return resolved;
|
|
47761
|
-
}
|
|
47762
|
-
|
|
47763
|
-
// src/commands/run/resolveRunCwd.ts
|
|
47764
|
-
import { existsSync as existsSync87 } from "fs";
|
|
47765
|
-
import { resolve as resolve31 } from "path";
|
|
47766
|
-
var MissingRunCwdError = class extends Error {
|
|
47767
|
-
constructor(runName, cwd) {
|
|
47768
|
-
super(`run config "${runName}": cwd ${cwd} does not exist`);
|
|
47769
|
-
this.runName = runName;
|
|
47770
|
-
this.cwd = cwd;
|
|
47771
|
-
this.name = "MissingRunCwdError";
|
|
47772
|
-
}
|
|
47773
|
-
};
|
|
47774
|
-
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
47775
|
-
if (!config.cwd) return void 0;
|
|
47776
|
-
const cwd = resolve31(baseDir, config.cwd);
|
|
47777
|
-
if (!existsSync87(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
47778
|
-
return cwd;
|
|
47779
|
-
}
|
|
47780
|
-
|
|
47781
|
-
// src/commands/run/runPreCommands.ts
|
|
47782
|
-
import { execSync as execSync66 } from "child_process";
|
|
47783
|
-
function writeCapturedOutput(error) {
|
|
47784
|
-
for (const stream of ["stdout", "stderr"]) {
|
|
47785
|
-
const output = error[stream];
|
|
47786
|
-
if (output) process.stdout.write(output);
|
|
47787
|
-
}
|
|
47788
|
-
}
|
|
47789
|
-
function runPreCommands(pre, cwd, quiet) {
|
|
47790
|
-
for (const cmd of pre) {
|
|
47791
|
-
try {
|
|
47792
|
-
execSync66(cmd, { stdio: quiet ? "pipe" : "inherit", cwd });
|
|
47793
|
-
} catch (error) {
|
|
47794
|
-
if (quiet && error && typeof error === "object")
|
|
47795
|
-
writeCapturedOutput(error);
|
|
47796
|
-
const code = error && typeof error === "object" && "status" in error ? error.status : 1;
|
|
47797
|
-
process.exit(code);
|
|
47798
|
-
}
|
|
47799
|
-
}
|
|
47800
|
-
}
|
|
47801
|
-
|
|
47802
|
-
// src/commands/watch/toBuildOutcome.ts
|
|
47803
|
-
function toBuildOutcome(result) {
|
|
47804
|
-
if (result.kind === "failed")
|
|
47805
|
-
return { kind: "failed", exitCode: 1, output: result.message };
|
|
47806
|
-
if (result.exitCode !== 0)
|
|
47807
|
-
return { kind: "failed", exitCode: result.exitCode, output: result.output };
|
|
47808
|
-
return { kind: "built" };
|
|
47809
|
-
}
|
|
47810
|
-
|
|
47811
|
-
// src/commands/watch/runWatchBuild.ts
|
|
47812
|
-
async function runWatchBuild(entry) {
|
|
47813
|
-
const config = findRunConfig(entry);
|
|
47814
|
-
let cwd;
|
|
47815
|
-
try {
|
|
47816
|
-
cwd = resolveRunCwd(config);
|
|
47817
|
-
} catch (error) {
|
|
47818
|
-
if (!(error instanceof MissingRunCwdError)) throw error;
|
|
47819
|
-
return { kind: "failed", exitCode: 1, output: error.message };
|
|
47820
|
-
}
|
|
47821
|
-
if (config.pre) runPreCommands(config.pre, cwd, true);
|
|
47822
|
-
return toBuildOutcome(
|
|
47823
|
-
await runCommandToCompletion(
|
|
47824
|
-
config.command,
|
|
47825
|
-
[...config.args ?? [], ...resolveParams(config.params, [])],
|
|
47826
|
-
config.env,
|
|
47827
|
-
cwd,
|
|
47828
|
-
true
|
|
47829
|
-
)
|
|
47830
|
-
);
|
|
47831
|
-
}
|
|
47832
|
-
|
|
47833
47938
|
// src/commands/watch/reportBuildOrExit.ts
|
|
47834
47939
|
async function reportBuildOrExit(entry) {
|
|
47835
47940
|
const outcome = await runWatchBuild(entry);
|
|
@@ -47848,49 +47953,13 @@ function reportOutcome({ exitCode, message: message3 }) {
|
|
|
47848
47953
|
else console.error(message3);
|
|
47849
47954
|
}
|
|
47850
47955
|
|
|
47851
|
-
// src/commands/watch/
|
|
47852
|
-
|
|
47853
|
-
|
|
47854
|
-
|
|
47855
|
-
async function runPostBuildSync() {
|
|
47856
|
-
return toBuildOutcome(
|
|
47857
|
-
await runCommandToCompletion(
|
|
47858
|
-
process.execPath,
|
|
47859
|
-
[process.argv[1], "sync", "--yes"],
|
|
47860
|
-
void 0,
|
|
47861
|
-
void 0,
|
|
47862
|
-
true
|
|
47863
|
-
)
|
|
47864
|
-
);
|
|
47865
|
-
}
|
|
47866
|
-
|
|
47867
|
-
// src/commands/watch/reportSyncOrExit.ts
|
|
47868
|
-
function clearPendingMarker() {
|
|
47869
|
-
try {
|
|
47870
|
-
rmSync11(syncPendingPath(), { force: true });
|
|
47871
|
-
} catch {
|
|
47872
|
-
}
|
|
47873
|
-
}
|
|
47874
|
-
async function reportSyncOrExit() {
|
|
47875
|
-
const outcome = await runPostBuildSync();
|
|
47876
|
-
if (outcome.kind === "built") {
|
|
47877
|
-
clearPendingMarker();
|
|
47878
|
-
console.log("synced ~/.claude");
|
|
47879
|
-
return;
|
|
47880
|
-
}
|
|
47881
|
-
if (outcome.output.length > 0)
|
|
47882
|
-
process.stdout.write(
|
|
47883
|
-
outcome.output.endsWith("\n") ? outcome.output : `${outcome.output}
|
|
47884
|
-
`
|
|
47885
|
-
);
|
|
47886
|
-
console.error(
|
|
47887
|
-
`sync failed with exit code ${outcome.exitCode}; a later lap will retry it`
|
|
47888
|
-
);
|
|
47889
|
-
process.exit(4);
|
|
47956
|
+
// src/commands/watch/watchBuildEntry.ts
|
|
47957
|
+
var DEFAULT_BUILD_ENTRY = "auto-build";
|
|
47958
|
+
function watchBuildEntry(build2) {
|
|
47959
|
+
return typeof build2 === "string" ? build2 : DEFAULT_BUILD_ENTRY;
|
|
47890
47960
|
}
|
|
47891
47961
|
|
|
47892
47962
|
// src/commands/watch/pullAndBuild.ts
|
|
47893
|
-
var DEFAULT_BUILD_ENTRY = "auto-build";
|
|
47894
47963
|
async function pullAndBuild(from, build2) {
|
|
47895
47964
|
emitWatchState("updating");
|
|
47896
47965
|
const pullResult = pullFastForward();
|
|
@@ -47898,24 +47967,24 @@ async function pullAndBuild(from, build2) {
|
|
|
47898
47967
|
reportOutcome(pullReport);
|
|
47899
47968
|
if (pullResult.kind !== "fast-forwarded")
|
|
47900
47969
|
return process.exit(pullReport.exitCode);
|
|
47970
|
+
if (build2) markBuildPending();
|
|
47901
47971
|
console.log(`
|
|
47902
47972
|
${buildWatchReport(from)}`);
|
|
47903
47973
|
if (build2) {
|
|
47904
47974
|
const syncNeeded = markSyncPending(from);
|
|
47905
|
-
await reportBuildOrExit(
|
|
47906
|
-
|
|
47907
|
-
);
|
|
47975
|
+
await reportBuildOrExit(watchBuildEntry(build2));
|
|
47976
|
+
clearBuildPending();
|
|
47908
47977
|
if (syncNeeded) await reportSyncOrExit();
|
|
47909
47978
|
}
|
|
47910
47979
|
process.exit(0);
|
|
47911
47980
|
}
|
|
47912
47981
|
|
|
47913
47982
|
// src/commands/watch/consumeMarker.ts
|
|
47914
|
-
import { existsSync as
|
|
47983
|
+
import { existsSync as existsSync89, rmSync as rmSync13 } from "fs";
|
|
47915
47984
|
function consumeMarker(path109) {
|
|
47916
47985
|
try {
|
|
47917
|
-
if (!
|
|
47918
|
-
|
|
47986
|
+
if (!existsSync89(path109)) return false;
|
|
47987
|
+
rmSync13(path109);
|
|
47919
47988
|
return true;
|
|
47920
47989
|
} catch {
|
|
47921
47990
|
return false;
|
|
@@ -48056,6 +48125,8 @@ async function watchWait(options2) {
|
|
|
48056
48125
|
options2.interval,
|
|
48057
48126
|
options2.timeout
|
|
48058
48127
|
);
|
|
48128
|
+
if (options2.pull && options2.build)
|
|
48129
|
+
await finishPendingBuild(watchBuildEntry(options2.build));
|
|
48059
48130
|
const outcome = await waitForUpstream({
|
|
48060
48131
|
intervalMs,
|
|
48061
48132
|
timeoutMs,
|
|
@@ -48099,10 +48170,10 @@ function registerWatchWait(watchCommand) {
|
|
|
48099
48170
|
}
|
|
48100
48171
|
|
|
48101
48172
|
// src/commands/watch/simulateDivergence.ts
|
|
48102
|
-
import { writeFileSync as
|
|
48173
|
+
import { writeFileSync as writeFileSync56 } from "fs";
|
|
48103
48174
|
function simulateDivergence() {
|
|
48104
48175
|
try {
|
|
48105
|
-
|
|
48176
|
+
writeFileSync56(simulatedDivergencePath(), "");
|
|
48106
48177
|
console.log(
|
|
48107
48178
|
`the next assist watch wait poll in ${runGit3(["rev-parse", "--show-toplevel"])} will exit 3 as a simulated divergence`
|
|
48108
48179
|
);
|
|
@@ -48406,7 +48477,7 @@ function link2() {
|
|
|
48406
48477
|
}
|
|
48407
48478
|
|
|
48408
48479
|
// src/commands/run/add.ts
|
|
48409
|
-
import { mkdirSync as mkdirSync39, writeFileSync as
|
|
48480
|
+
import { mkdirSync as mkdirSync39, writeFileSync as writeFileSync57 } from "fs";
|
|
48410
48481
|
import { dirname as dirname46 } from "path";
|
|
48411
48482
|
|
|
48412
48483
|
// src/commands/run/editRepoRunList.ts
|
|
@@ -48594,7 +48665,7 @@ description: Run ${name}
|
|
|
48594
48665
|
|
|
48595
48666
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
48596
48667
|
`;
|
|
48597
|
-
|
|
48668
|
+
writeFileSync57(filePath, content);
|
|
48598
48669
|
console.log(`Created command file: ${filePath}`);
|
|
48599
48670
|
}
|
|
48600
48671
|
async function add4() {
|
|
@@ -48698,7 +48769,7 @@ function registerRunAdd(runCommand) {
|
|
|
48698
48769
|
}
|
|
48699
48770
|
|
|
48700
48771
|
// src/commands/run/remove.ts
|
|
48701
|
-
import { existsSync as
|
|
48772
|
+
import { existsSync as existsSync90, readdirSync as readdirSync27, rmdirSync, unlinkSync as unlinkSync20 } from "fs";
|
|
48702
48773
|
import { dirname as dirname47, join as join109 } from "path";
|
|
48703
48774
|
|
|
48704
48775
|
// src/commands/run/removeRepoRunConfig.ts
|
|
@@ -48719,7 +48790,7 @@ function removeRepoRunConfig(name, repoName, cwd = process.cwd()) {
|
|
|
48719
48790
|
function removeEmptyNamespaceDirs(filePath) {
|
|
48720
48791
|
const root2 = join109(".claude", "commands");
|
|
48721
48792
|
for (let dir = dirname47(filePath); dir !== root2; dir = dirname47(dir)) {
|
|
48722
|
-
if (!
|
|
48793
|
+
if (!existsSync90(dir) || readdirSync27(dir).length > 0) return;
|
|
48723
48794
|
rmdirSync(dir);
|
|
48724
48795
|
}
|
|
48725
48796
|
}
|
|
@@ -48727,7 +48798,7 @@ function deleteCommandFile(name) {
|
|
|
48727
48798
|
const filePath = runCommandFilePath(name);
|
|
48728
48799
|
const legacyPath = join109(".claude", "commands", `${name}.md`);
|
|
48729
48800
|
for (const path109 of /* @__PURE__ */ new Set([filePath, legacyPath])) {
|
|
48730
|
-
if (
|
|
48801
|
+
if (existsSync90(path109)) {
|
|
48731
48802
|
unlinkSync20(path109);
|
|
48732
48803
|
console.log(`Deleted command file: ${path109}`);
|
|
48733
48804
|
}
|
|
@@ -49450,12 +49521,12 @@ function toSessionViewInfo({
|
|
|
49450
49521
|
}
|
|
49451
49522
|
|
|
49452
49523
|
// src/commands/sessions/daemon/worktree/joinRefusal.ts
|
|
49453
|
-
import { existsSync as
|
|
49524
|
+
import { existsSync as existsSync91 } from "fs";
|
|
49454
49525
|
function joinRefusal(session) {
|
|
49455
49526
|
if (session.commandType === "run") return "a server run has no agent stream";
|
|
49456
49527
|
if (session.closing === true) return "the session is closing";
|
|
49457
49528
|
if (!session.cwd) return "the session has no working directory";
|
|
49458
|
-
if (!
|
|
49529
|
+
if (!existsSync91(session.cwd))
|
|
49459
49530
|
return "the session's workspace no longer exists";
|
|
49460
49531
|
return void 0;
|
|
49461
49532
|
}
|
|
@@ -49531,7 +49602,7 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
|
|
|
49531
49602
|
}
|
|
49532
49603
|
|
|
49533
49604
|
// src/commands/sessions/daemon/findServerParents.ts
|
|
49534
|
-
import { existsSync as
|
|
49605
|
+
import { existsSync as existsSync92 } from "fs";
|
|
49535
49606
|
import { join as join110, resolve as resolve32 } from "path";
|
|
49536
49607
|
function isLive(session) {
|
|
49537
49608
|
return !!session.pty && session.status !== "done" && session.status !== "error";
|
|
@@ -49541,7 +49612,7 @@ function isLiveAgent(session) {
|
|
|
49541
49612
|
}
|
|
49542
49613
|
function serverRunDirs(sessions, file) {
|
|
49543
49614
|
return new Set(
|
|
49544
|
-
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve32(s.cwd)).filter((dir) =>
|
|
49615
|
+
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve32(s.cwd)).filter((dir) => existsSync92(join110(dir, file)))
|
|
49545
49616
|
);
|
|
49546
49617
|
}
|
|
49547
49618
|
function findServerParents(sessions, file) {
|
|
@@ -49695,7 +49766,7 @@ function sendResizeSnapshot(s, send) {
|
|
|
49695
49766
|
}
|
|
49696
49767
|
|
|
49697
49768
|
// src/commands/sessions/daemon/viewerSize.ts
|
|
49698
|
-
import { readFileSync as readFileSync73, writeFileSync as
|
|
49769
|
+
import { readFileSync as readFileSync73, writeFileSync as writeFileSync58 } from "fs";
|
|
49699
49770
|
var DEFAULT_SIZE = { cols: 120, rows: 30 };
|
|
49700
49771
|
var remembered;
|
|
49701
49772
|
function rememberViewerSize(cols, rows) {
|
|
@@ -49703,7 +49774,7 @@ function rememberViewerSize(cols, rows) {
|
|
|
49703
49774
|
if (remembered?.cols === cols && remembered.rows === rows) return;
|
|
49704
49775
|
remembered = { cols, rows };
|
|
49705
49776
|
try {
|
|
49706
|
-
|
|
49777
|
+
writeFileSync58(daemonPaths.viewerSize, JSON.stringify(remembered));
|
|
49707
49778
|
} catch (error) {
|
|
49708
49779
|
daemonLog(
|
|
49709
49780
|
`viewer size ${cols}x${rows} not saved: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -50210,11 +50281,11 @@ function sessionBase(id, status2) {
|
|
|
50210
50281
|
}
|
|
50211
50282
|
|
|
50212
50283
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
50213
|
-
import { existsSync as
|
|
50284
|
+
import { existsSync as existsSync94 } from "fs";
|
|
50214
50285
|
import * as pty from "node-pty";
|
|
50215
50286
|
|
|
50216
50287
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
50217
|
-
import { chmodSync, existsSync as
|
|
50288
|
+
import { chmodSync, existsSync as existsSync93, statSync as statSync15 } from "fs";
|
|
50218
50289
|
import { createRequire as createRequire3 } from "module";
|
|
50219
50290
|
import path106 from "path";
|
|
50220
50291
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -50229,7 +50300,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
50229
50300
|
`${process.platform}-${process.arch}`,
|
|
50230
50301
|
"spawn-helper"
|
|
50231
50302
|
);
|
|
50232
|
-
if (!
|
|
50303
|
+
if (!existsSync93(helper)) return;
|
|
50233
50304
|
const mode = statSync15(helper).mode;
|
|
50234
50305
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
50235
50306
|
}
|
|
@@ -50285,7 +50356,7 @@ function spawnPty(args, cwd, sessionId2, extraEnv) {
|
|
|
50285
50356
|
});
|
|
50286
50357
|
}
|
|
50287
50358
|
function refuseMissingCwd(cwd, sessionId2) {
|
|
50288
|
-
if (!cwd ||
|
|
50359
|
+
if (!cwd || existsSync94(cwd)) return;
|
|
50289
50360
|
daemonLog(
|
|
50290
50361
|
`${sessionId2 ? `session ${sessionId2}` : "pty"} not spawned: working directory ${cwd} no longer exists`
|
|
50291
50362
|
);
|
|
@@ -50455,20 +50526,20 @@ function createRunSession(id, { runName, runArgs, cwd, meta }) {
|
|
|
50455
50526
|
}
|
|
50456
50527
|
|
|
50457
50528
|
// src/commands/sessions/daemon/autoUpdate/autoUpdateControl.ts
|
|
50458
|
-
import { existsSync as
|
|
50529
|
+
import { existsSync as existsSync95, rmSync as rmSync14, writeFileSync as writeFileSync59 } from "fs";
|
|
50459
50530
|
var paused;
|
|
50460
50531
|
var wake;
|
|
50461
50532
|
var holdReleased = false;
|
|
50462
50533
|
function persist2(value) {
|
|
50463
50534
|
try {
|
|
50464
|
-
if (value)
|
|
50465
|
-
else
|
|
50535
|
+
if (value) writeFileSync59(daemonPaths.autoUpdatePaused, "");
|
|
50536
|
+
else rmSync14(daemonPaths.autoUpdatePaused, { force: true });
|
|
50466
50537
|
} catch {
|
|
50467
50538
|
}
|
|
50468
50539
|
}
|
|
50469
50540
|
var autoUpdateControl = {
|
|
50470
50541
|
paused: () => {
|
|
50471
|
-
paused ??=
|
|
50542
|
+
paused ??= existsSync95(daemonPaths.autoUpdatePaused);
|
|
50472
50543
|
return paused;
|
|
50473
50544
|
},
|
|
50474
50545
|
setPaused: (value) => {
|
|
@@ -50602,7 +50673,7 @@ async function runAutoUpdateLoop(deps2, maxLaps = Number.POSITIVE_INFINITY) {
|
|
|
50602
50673
|
}
|
|
50603
50674
|
|
|
50604
50675
|
// src/commands/sessions/daemon/autoUpdate/trimWatcherLog.ts
|
|
50605
|
-
import { readFileSync as readFileSync75, writeFileSync as
|
|
50676
|
+
import { readFileSync as readFileSync75, writeFileSync as writeFileSync60 } from "fs";
|
|
50606
50677
|
var KEEP_TAIL = 256 * 1024;
|
|
50607
50678
|
var MAX_LOG_SIZE = 4 * 1024 * 1024;
|
|
50608
50679
|
function trimWatcherLog(cwd) {
|
|
@@ -50614,7 +50685,7 @@ function trimWatcherLog(cwd) {
|
|
|
50614
50685
|
return;
|
|
50615
50686
|
}
|
|
50616
50687
|
if (log2.length <= MAX_LOG_SIZE) return;
|
|
50617
|
-
|
|
50688
|
+
writeFileSync60(path109, log2.slice(-KEEP_TAIL));
|
|
50618
50689
|
daemonLog(`auto-update: log ${path109} trimmed to its last ${KEEP_TAIL} chars`);
|
|
50619
50690
|
}
|
|
50620
50691
|
|
|
@@ -50697,7 +50768,7 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
50697
50768
|
}
|
|
50698
50769
|
|
|
50699
50770
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
50700
|
-
import { existsSync as
|
|
50771
|
+
import { existsSync as existsSync96 } from "fs";
|
|
50701
50772
|
var treeIsGone = { durable: true, gone: true };
|
|
50702
50773
|
function treeDurability(state) {
|
|
50703
50774
|
if (state.dirty) return { durable: false, reason: "uncommitted changes" };
|
|
@@ -50728,14 +50799,14 @@ function* durabilityProbes() {
|
|
|
50728
50799
|
});
|
|
50729
50800
|
}
|
|
50730
50801
|
async function checkDurability(cwd) {
|
|
50731
|
-
if (!
|
|
50802
|
+
if (!existsSync96(cwd)) return treeIsGone;
|
|
50732
50803
|
const probes = durabilityProbes();
|
|
50733
50804
|
let step3 = probes.next();
|
|
50734
50805
|
while (!step3.done) step3 = probes.next(await gitResult(cwd, step3.value));
|
|
50735
50806
|
return step3.value;
|
|
50736
50807
|
}
|
|
50737
50808
|
function checkDurabilitySync(cwd) {
|
|
50738
|
-
if (!
|
|
50809
|
+
if (!existsSync96(cwd)) return treeIsGone;
|
|
50739
50810
|
const probes = durabilityProbes();
|
|
50740
50811
|
let step3 = probes.next();
|
|
50741
50812
|
while (!step3.done) step3 = probes.next(gitSyncResult(cwd, step3.value));
|
|
@@ -50884,12 +50955,12 @@ function noteAutoUpdate(installDir, text20) {
|
|
|
50884
50955
|
|
|
50885
50956
|
// src/commands/sessions/daemon/autoUpdate/runUpdateLap.ts
|
|
50886
50957
|
import { spawn as spawn12 } from "child_process";
|
|
50887
|
-
import { rmSync as
|
|
50958
|
+
import { rmSync as rmSync15 } from "fs";
|
|
50888
50959
|
function clearLapSignals(cwd) {
|
|
50889
50960
|
const control = watchControlPaths(cwd);
|
|
50890
50961
|
if (!control) return;
|
|
50891
50962
|
for (const path109 of [control.check, control.stop])
|
|
50892
|
-
|
|
50963
|
+
rmSync15(path109, { force: true });
|
|
50893
50964
|
}
|
|
50894
50965
|
function runUpdateLap(cwd, onOutput) {
|
|
50895
50966
|
clearLapSignals(cwd);
|
|
@@ -51019,11 +51090,11 @@ function setStatus2(session, newStatus) {
|
|
|
51019
51090
|
}
|
|
51020
51091
|
|
|
51021
51092
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
51022
|
-
import { existsSync as
|
|
51093
|
+
import { existsSync as existsSync98 } from "fs";
|
|
51023
51094
|
import { basename as basename32 } from "path";
|
|
51024
51095
|
|
|
51025
51096
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
51026
|
-
import { existsSync as
|
|
51097
|
+
import { existsSync as existsSync97 } from "fs";
|
|
51027
51098
|
import { join as join113 } from "path";
|
|
51028
51099
|
|
|
51029
51100
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
@@ -51093,7 +51164,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
51093
51164
|
);
|
|
51094
51165
|
}
|
|
51095
51166
|
function strandedReason(worktreePath, cause) {
|
|
51096
|
-
if (!
|
|
51167
|
+
if (!existsSync97(join113(worktreePath, ".git")))
|
|
51097
51168
|
return "its .git link is already gone";
|
|
51098
51169
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
51099
51170
|
return "git no longer recognises it as a working tree";
|
|
@@ -51145,7 +51216,7 @@ function reason3(error) {
|
|
|
51145
51216
|
|
|
51146
51217
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
51147
51218
|
async function reapWorktree(worktreePath, force = false) {
|
|
51148
|
-
if (!
|
|
51219
|
+
if (!existsSync98(worktreePath)) {
|
|
51149
51220
|
forgetWorktree(worktreePath);
|
|
51150
51221
|
daemonLog(
|
|
51151
51222
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -51170,7 +51241,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
51170
51241
|
}
|
|
51171
51242
|
function owningClone(worktreePath) {
|
|
51172
51243
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
51173
|
-
if (recorded &&
|
|
51244
|
+
if (recorded && existsSync98(recorded)) return recorded;
|
|
51174
51245
|
const detected = mainWorktree(worktreePath);
|
|
51175
51246
|
if (detected) return detected;
|
|
51176
51247
|
daemonLog(
|
|
@@ -51457,12 +51528,12 @@ async function closeBlockReason(sessionId2, tree) {
|
|
|
51457
51528
|
}
|
|
51458
51529
|
|
|
51459
51530
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
51460
|
-
import { existsSync as
|
|
51531
|
+
import { existsSync as existsSync99, watch } from "fs";
|
|
51461
51532
|
var DEBOUNCE_MS = 500;
|
|
51462
51533
|
var POLL_MS5 = 3e4;
|
|
51463
51534
|
function watchGitState(cwd, onChange) {
|
|
51464
51535
|
const common = gitCommonDir(cwd);
|
|
51465
|
-
if (!common || !
|
|
51536
|
+
if (!common || !existsSync99(common)) return void 0;
|
|
51466
51537
|
const watchers = [
|
|
51467
51538
|
watchGitDir(common, onChange),
|
|
51468
51539
|
pollGitState(cwd, onChange)
|
|
@@ -52185,10 +52256,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
52185
52256
|
}
|
|
52186
52257
|
|
|
52187
52258
|
// src/commands/sessions/daemon/exitReason.ts
|
|
52188
|
-
import { existsSync as
|
|
52259
|
+
import { existsSync as existsSync100 } from "fs";
|
|
52189
52260
|
import { resolve as resolve33 } from "path";
|
|
52190
52261
|
function exitDetail(session) {
|
|
52191
|
-
if (session.cwd && !
|
|
52262
|
+
if (session.cwd && !existsSync100(session.cwd))
|
|
52192
52263
|
return `working directory ${session.cwd} no longer exists`;
|
|
52193
52264
|
return missingRunConfigCwd(session);
|
|
52194
52265
|
}
|
|
@@ -52202,7 +52273,7 @@ function missingRunConfigCwd(session) {
|
|
|
52202
52273
|
const config = resolveRunConfig(session.runName, dir);
|
|
52203
52274
|
if (!config?.cwd) return void 0;
|
|
52204
52275
|
const configured = resolve33(runConfigBaseDirFrom(dir), config.cwd);
|
|
52205
|
-
if (
|
|
52276
|
+
if (existsSync100(configured)) return void 0;
|
|
52206
52277
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
52207
52278
|
}
|
|
52208
52279
|
|
|
@@ -52250,7 +52321,7 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
|
|
|
52250
52321
|
}
|
|
52251
52322
|
|
|
52252
52323
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
52253
|
-
import { existsSync as
|
|
52324
|
+
import { existsSync as existsSync101, mkdirSync as mkdirSync41, watch as watch2 } from "fs";
|
|
52254
52325
|
import { dirname as dirname50 } from "path";
|
|
52255
52326
|
|
|
52256
52327
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
@@ -52335,7 +52406,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
52335
52406
|
if (timer) clearTimeout(timer);
|
|
52336
52407
|
timer = setTimeout(read3, DEBOUNCE_MS2);
|
|
52337
52408
|
});
|
|
52338
|
-
if (
|
|
52409
|
+
if (existsSync101(path109)) read3();
|
|
52339
52410
|
}
|
|
52340
52411
|
function refreshActivity(session) {
|
|
52341
52412
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -54613,7 +54684,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
54613
54684
|
}
|
|
54614
54685
|
|
|
54615
54686
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
54616
|
-
import { existsSync as
|
|
54687
|
+
import { existsSync as existsSync103 } from "fs";
|
|
54617
54688
|
import { basename as basename35 } from "path";
|
|
54618
54689
|
|
|
54619
54690
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -54634,9 +54705,9 @@ function accountedTrees(sessions) {
|
|
|
54634
54705
|
}
|
|
54635
54706
|
|
|
54636
54707
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
54637
|
-
import { existsSync as
|
|
54708
|
+
import { existsSync as existsSync102 } from "fs";
|
|
54638
54709
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
54639
|
-
if (!
|
|
54710
|
+
if (!existsSync102(clone)) {
|
|
54640
54711
|
for (const { path: path109 } of paths) forgetWorktree(path109);
|
|
54641
54712
|
daemonLog(
|
|
54642
54713
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
@@ -54802,7 +54873,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
54802
54873
|
);
|
|
54803
54874
|
continue;
|
|
54804
54875
|
}
|
|
54805
|
-
if (!
|
|
54876
|
+
if (!existsSync103(path109)) {
|
|
54806
54877
|
logVanishedTree(sessions, path109);
|
|
54807
54878
|
vanished.set(clone, [
|
|
54808
54879
|
...vanished.get(clone) ?? [],
|
|
@@ -56002,7 +56073,7 @@ function spawnAssistInTree(ctx, assistArgs, cwd, meta, context) {
|
|
|
56002
56073
|
}
|
|
56003
56074
|
|
|
56004
56075
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
56005
|
-
import { existsSync as
|
|
56076
|
+
import { existsSync as existsSync106 } from "fs";
|
|
56006
56077
|
|
|
56007
56078
|
// src/commands/sessions/daemon/resumeSession.ts
|
|
56008
56079
|
function resumeSession(id, sessionId2, cwd, name, holdPty, harness) {
|
|
@@ -56033,10 +56104,10 @@ function resumeSession(id, sessionId2, cwd, name, holdPty, harness) {
|
|
|
56033
56104
|
}
|
|
56034
56105
|
|
|
56035
56106
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
56036
|
-
import { existsSync as
|
|
56107
|
+
import { existsSync as existsSync105 } from "fs";
|
|
56037
56108
|
|
|
56038
56109
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
56039
|
-
import { copyFileSync as copyFileSync4, existsSync as
|
|
56110
|
+
import { copyFileSync as copyFileSync4, existsSync as existsSync104, mkdirSync as mkdirSync43 } from "fs";
|
|
56040
56111
|
import { join as join114 } from "path";
|
|
56041
56112
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
56042
56113
|
const dir = projectDirForCwd(toCwd);
|
|
@@ -56047,7 +56118,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
56047
56118
|
return;
|
|
56048
56119
|
}
|
|
56049
56120
|
const dest = join114(dir, `${claudeSessionId}.jsonl`);
|
|
56050
|
-
if (
|
|
56121
|
+
if (existsSync104(dest)) {
|
|
56051
56122
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
56052
56123
|
return;
|
|
56053
56124
|
}
|
|
@@ -56098,7 +56169,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
|
|
|
56098
56169
|
}
|
|
56099
56170
|
function cloneForReapedTree(missingCwd) {
|
|
56100
56171
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
56101
|
-
if (!clone || !
|
|
56172
|
+
if (!clone || !existsSync105(clone))
|
|
56102
56173
|
throw new Error(
|
|
56103
56174
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
56104
56175
|
);
|
|
@@ -56107,7 +56178,7 @@ function cloneForReapedTree(missingCwd) {
|
|
|
56107
56178
|
|
|
56108
56179
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
56109
56180
|
function resumeInTree(ctx, sessionId2, cwd, name, harness) {
|
|
56110
|
-
if (!
|
|
56181
|
+
if (!existsSync106(cwd))
|
|
56111
56182
|
return resumeInReplacementTree(ctx, sessionId2, cwd, name, harness);
|
|
56112
56183
|
const id = ctx.spawnWith(
|
|
56113
56184
|
(sid) => resumeSession(sid, sessionId2, cwd, name, void 0, harness)
|
|
@@ -56364,10 +56435,10 @@ function autoUpdateReply() {
|
|
|
56364
56435
|
}
|
|
56365
56436
|
|
|
56366
56437
|
// src/commands/sessions/daemon/autoUpdate/applyAutoUpdateAction.ts
|
|
56367
|
-
import { rmSync as
|
|
56438
|
+
import { rmSync as rmSync16, writeFileSync as writeFileSync61 } from "fs";
|
|
56368
56439
|
function signalLap(installDir, marker2) {
|
|
56369
56440
|
const control = watchControlPaths(installDir);
|
|
56370
|
-
if (control)
|
|
56441
|
+
if (control) writeFileSync61(control[marker2], "");
|
|
56371
56442
|
}
|
|
56372
56443
|
function applyAutoUpdateAction(action) {
|
|
56373
56444
|
const installDir = getInstallDir();
|
|
@@ -56375,7 +56446,7 @@ function applyAutoUpdateAction(action) {
|
|
|
56375
56446
|
if (action === "resume") {
|
|
56376
56447
|
if (!autoUpdateControl.paused()) return void 0;
|
|
56377
56448
|
const control = watchControlPaths(installDir);
|
|
56378
|
-
if (control)
|
|
56449
|
+
if (control) rmSync16(control.stop, { force: true });
|
|
56379
56450
|
autoUpdateControl.setPaused(false);
|
|
56380
56451
|
noteAutoUpdate(installDir, "resumed from Updates");
|
|
56381
56452
|
return void 0;
|
|
@@ -57376,7 +57447,7 @@ function isPrCheckoutArgs(args) {
|
|
|
57376
57447
|
|
|
57377
57448
|
// src/commands/sessions/daemon/worktree/prCheckoutHolder.ts
|
|
57378
57449
|
import { execFile as execFile14 } from "child_process";
|
|
57379
|
-
import { existsSync as
|
|
57450
|
+
import { existsSync as existsSync107 } from "fs";
|
|
57380
57451
|
function prHeadBranch2(number, cwd) {
|
|
57381
57452
|
const { headBranch } = prCliCommands(number, cwd);
|
|
57382
57453
|
return new Promise((resolve34) => {
|
|
@@ -57390,12 +57461,12 @@ function prHeadBranch2(number, cwd) {
|
|
|
57390
57461
|
}
|
|
57391
57462
|
async function prCheckoutHolder(assistArgs, cwd) {
|
|
57392
57463
|
const number = prCheckoutNumber(assistArgs);
|
|
57393
|
-
if (!number || !cwd || !
|
|
57464
|
+
if (!number || !cwd || !existsSync107(cwd)) return void 0;
|
|
57394
57465
|
const headRef = await prHeadBranch2(number, cwd);
|
|
57395
57466
|
if (!headRef) return void 0;
|
|
57396
57467
|
const listing = await gitOrNull(cwd, ["worktree", "list", "--porcelain"]);
|
|
57397
57468
|
const holder = listing ? worktreeWithBranch(listing, headRef) : null;
|
|
57398
|
-
if (!holder || !
|
|
57469
|
+
if (!holder || !existsSync107(holder)) return void 0;
|
|
57399
57470
|
daemonLog(
|
|
57400
57471
|
`pr #${number} assist ${assistArgs[0]} launched in its checkout ${holder}: head branch ${headRef} is already checked out there, so no worktree is allocated`
|
|
57401
57472
|
);
|
|
@@ -57612,7 +57683,7 @@ function handleConnection(socket, manager) {
|
|
|
57612
57683
|
}
|
|
57613
57684
|
|
|
57614
57685
|
// src/commands/sessions/daemon/onListening.ts
|
|
57615
|
-
import { unlinkSync as unlinkSync21, writeFileSync as
|
|
57686
|
+
import { unlinkSync as unlinkSync21, writeFileSync as writeFileSync62 } from "fs";
|
|
57616
57687
|
|
|
57617
57688
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
57618
57689
|
import { readFileSync as readFileSync77 } from "fs";
|
|
@@ -57634,7 +57705,7 @@ function ownsPidFile() {
|
|
|
57634
57705
|
|
|
57635
57706
|
// src/commands/sessions/daemon/onListening.ts
|
|
57636
57707
|
function onListening(manager, checkAutoExit) {
|
|
57637
|
-
|
|
57708
|
+
writeFileSync62(daemonPaths.pid, String(process.pid));
|
|
57638
57709
|
startPidFileWatchdog(() => {
|
|
57639
57710
|
daemonLog("lost daemon.pid ownership; shutting down sessions and exiting");
|
|
57640
57711
|
void manager.flushActiveMs().finally(() => {
|