@staff0rd/assist 0.925.0 → 0.926.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/README.md +7 -1
- package/dist/commands/extension/extension/content.js +39 -39
- package/dist/commands/extension/extension/manifest.json +8 -2
- package/dist/commands/extension/extension/updates.json +2 -2
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +642 -432
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.926.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -5170,16 +5170,40 @@ async function launchFromGithub(req, res, plan2, launch) {
|
|
|
5170
5170
|
}
|
|
5171
5171
|
}
|
|
5172
5172
|
|
|
5173
|
-
// src/shared/
|
|
5174
|
-
|
|
5175
|
-
|
|
5173
|
+
// src/shared/azureDevops/decodeUrlPart.ts
|
|
5174
|
+
function decodeUrlPart(part) {
|
|
5175
|
+
try {
|
|
5176
|
+
return decodeURIComponent(part);
|
|
5177
|
+
} catch {
|
|
5178
|
+
return part;
|
|
5179
|
+
}
|
|
5180
|
+
}
|
|
5181
|
+
|
|
5182
|
+
// src/shared/azureDevops/parseAzureDevopsPrUrl.ts
|
|
5183
|
+
var DEV_PATH = /^\/([^/]+)\/([^/]+)\/_git\/([^/]+)\/pullrequest\/([1-9]\d*)(?=\/|$)/i;
|
|
5184
|
+
var VISUALSTUDIO_PATH = /^(?:\/DefaultCollection)?\/([^/]+)\/_git\/([^/]+)\/pullrequest\/([1-9]\d*)(?=\/|$)/i;
|
|
5185
|
+
var VISUALSTUDIO_HOST = /^([^.]+)\.visualstudio\.com$/;
|
|
5186
|
+
function matchPath(host, pathname) {
|
|
5187
|
+
if (host === "dev.azure.com") {
|
|
5188
|
+
const match2 = DEV_PATH.exec(pathname);
|
|
5189
|
+
return match2 && { path: match2[0], parts: match2.slice(1) };
|
|
5190
|
+
}
|
|
5191
|
+
const org = VISUALSTUDIO_HOST.exec(host)?.[1];
|
|
5192
|
+
const match = org ? VISUALSTUDIO_PATH.exec(pathname) : null;
|
|
5193
|
+
return match && org ? { path: match[0], parts: [org, ...match.slice(1)] } : null;
|
|
5194
|
+
}
|
|
5195
|
+
function parseAzureDevopsPrUrl(url) {
|
|
5176
5196
|
let parsed;
|
|
5177
5197
|
try {
|
|
5178
5198
|
parsed = new URL(url);
|
|
5179
5199
|
} catch {
|
|
5180
5200
|
return void 0;
|
|
5181
5201
|
}
|
|
5182
|
-
|
|
5202
|
+
if (parsed.protocol !== "https:") return void 0;
|
|
5203
|
+
const matched = matchPath(parsed.hostname.toLowerCase(), parsed.pathname);
|
|
5204
|
+
if (!matched) return void 0;
|
|
5205
|
+
const [org, project, repo, id] = matched.parts.map(decodeUrlPart);
|
|
5206
|
+
return { org, project, repo, id, url: `${parsed.origin}${matched.path}` };
|
|
5183
5207
|
}
|
|
5184
5208
|
|
|
5185
5209
|
// src/shared/prActions.ts
|
|
@@ -5195,6 +5219,85 @@ var prActions = [
|
|
|
5195
5219
|
{ label: "Fix conflicts (rebase)", args: ["fix-conflict", "--rebase"] }
|
|
5196
5220
|
];
|
|
5197
5221
|
|
|
5222
|
+
// src/shared/azureDevops/azureDevopsPrActions.ts
|
|
5223
|
+
var SUPPORTED = /* @__PURE__ */ new Set(["Checkout"]);
|
|
5224
|
+
var azureDevopsPrActions = prActions.filter(
|
|
5225
|
+
({ label: label2 }) => SUPPORTED.has(label2)
|
|
5226
|
+
);
|
|
5227
|
+
|
|
5228
|
+
// src/shared/azureDevops/isAllowedAzureDevopsPrArgs.ts
|
|
5229
|
+
function isAllowedAzureDevopsPrArgs(args) {
|
|
5230
|
+
if (!Array.isArray(args)) return false;
|
|
5231
|
+
return azureDevopsPrActions.some(
|
|
5232
|
+
(action) => action.args.length === args.length && action.args.every((arg, index2) => arg === args[index2])
|
|
5233
|
+
);
|
|
5234
|
+
}
|
|
5235
|
+
|
|
5236
|
+
// src/commands/sessions/web/fromGithub/findAzureDevopsClone.ts
|
|
5237
|
+
import { existsSync as existsSync13, readdirSync as readdirSync2 } from "fs";
|
|
5238
|
+
import { join as join18 } from "path";
|
|
5239
|
+
|
|
5240
|
+
// src/shared/azureDevops/parseAzureDevopsRemote.ts
|
|
5241
|
+
var HTTPS_DEV = /^https?:\/\/(?:[^@/]+@)?dev\.azure\.com\/([^/]+)\/([^/]+)\/_git\/([^/]+)$/i;
|
|
5242
|
+
var HTTPS_VISUALSTUDIO = /^https?:\/\/(?:[^@/]+@)?([^./@]+)\.visualstudio\.com\/(?:DefaultCollection\/)?([^/]+)\/_git\/([^/]+)$/i;
|
|
5243
|
+
var SSH = /^(?:ssh:\/\/)?[^@/]+@(?:ssh\.dev\.azure\.com|vs-ssh\.visualstudio\.com)(?::\d+)?[:/]v3\/([^/]+)\/([^/]+)\/([^/]+)$/i;
|
|
5244
|
+
function parseAzureDevopsRemote(raw) {
|
|
5245
|
+
const trimmed = raw.trim().replace(/\/+$/, "").replace(/\.git$/i, "");
|
|
5246
|
+
const match = HTTPS_DEV.exec(trimmed) ?? HTTPS_VISUALSTUDIO.exec(trimmed) ?? SSH.exec(trimmed);
|
|
5247
|
+
if (!match) return null;
|
|
5248
|
+
const [, org, project, repo] = match.map(decodeUrlPart);
|
|
5249
|
+
return { org, project, repo };
|
|
5250
|
+
}
|
|
5251
|
+
|
|
5252
|
+
// src/shared/azureDevops/sameAzureDevopsRepo.ts
|
|
5253
|
+
function sameAzureDevopsRepo(a, b) {
|
|
5254
|
+
return a.org.toLowerCase() === b.org.toLowerCase() && a.project.toLowerCase() === b.project.toLowerCase() && a.repo.toLowerCase() === b.repo.toLowerCase();
|
|
5255
|
+
}
|
|
5256
|
+
|
|
5257
|
+
// src/commands/sessions/web/fromGithub/findAzureDevopsClone.ts
|
|
5258
|
+
function clonesRepo(dir, repo) {
|
|
5259
|
+
if (!existsSync13(join18(dir, ".git"))) return false;
|
|
5260
|
+
const url = remoteUrl(dir).url;
|
|
5261
|
+
const remote = url ? parseAzureDevopsRemote(url) : null;
|
|
5262
|
+
return remote !== null && sameAzureDevopsRepo(remote, repo);
|
|
5263
|
+
}
|
|
5264
|
+
function findAzureDevopsClone(repo, baseDir) {
|
|
5265
|
+
if (!existsSync13(baseDir)) return void 0;
|
|
5266
|
+
const named = join18(baseDir, repo.repo);
|
|
5267
|
+
const others = readdirSync2(baseDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join18(baseDir, entry.name)).filter((dir) => dir !== named).sort();
|
|
5268
|
+
return [named, ...others].find((dir) => clonesRepo(dir, repo));
|
|
5269
|
+
}
|
|
5270
|
+
|
|
5271
|
+
// src/commands/sessions/web/fromGithub/planAzureDevopsReview.ts
|
|
5272
|
+
function planAzureDevopsReview(pr, args, baseDir) {
|
|
5273
|
+
if (!isAllowedAzureDevopsPrArgs(args))
|
|
5274
|
+
return {
|
|
5275
|
+
ok: false,
|
|
5276
|
+
status: 400,
|
|
5277
|
+
error: "Unsupported assist args for an Azure DevOps PR"
|
|
5278
|
+
};
|
|
5279
|
+
const cwd = findAzureDevopsClone(pr, baseDir);
|
|
5280
|
+
if (!cwd)
|
|
5281
|
+
return {
|
|
5282
|
+
ok: false,
|
|
5283
|
+
status: 404,
|
|
5284
|
+
error: `${pr.org}/${pr.project}/${pr.repo} is not cloned under ${baseDir}`
|
|
5285
|
+
};
|
|
5286
|
+
return { ok: true, cwd, assistArgs: [...args, pr.id] };
|
|
5287
|
+
}
|
|
5288
|
+
|
|
5289
|
+
// src/shared/githubPullNumber.ts
|
|
5290
|
+
var PULL_PATH = /^\/[^/]+\/[^/]+\/pull\/(\d+)(?:\/|$)/;
|
|
5291
|
+
function githubPullNumber(url) {
|
|
5292
|
+
let parsed;
|
|
5293
|
+
try {
|
|
5294
|
+
parsed = new URL(url);
|
|
5295
|
+
} catch {
|
|
5296
|
+
return void 0;
|
|
5297
|
+
}
|
|
5298
|
+
return PULL_PATH.exec(parsed.pathname)?.[1];
|
|
5299
|
+
}
|
|
5300
|
+
|
|
5198
5301
|
// src/shared/reviewButtonModes.ts
|
|
5199
5302
|
var reviewButtonModes = [
|
|
5200
5303
|
{ label: "Review", args: ["review"] },
|
|
@@ -5237,11 +5340,11 @@ function isAllowedPrArgs(args) {
|
|
|
5237
5340
|
}
|
|
5238
5341
|
|
|
5239
5342
|
// src/commands/sessions/web/fromGithub/findCloneByOrigin.ts
|
|
5240
|
-
import { existsSync as
|
|
5241
|
-
import { join as
|
|
5343
|
+
import { existsSync as existsSync14, readdirSync as readdirSync3 } from "fs";
|
|
5344
|
+
import { join as join19 } from "path";
|
|
5242
5345
|
function findCloneByOrigin(origin, baseDir) {
|
|
5243
|
-
if (!
|
|
5244
|
-
return
|
|
5346
|
+
if (!existsSync14(baseDir)) return void 0;
|
|
5347
|
+
return readdirSync3(baseDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join19(baseDir, entry.name)).filter((dir) => existsSync14(join19(dir, ".git"))).sort().find((dir) => getCurrentOrigin(dir) === origin);
|
|
5245
5348
|
}
|
|
5246
5349
|
|
|
5247
5350
|
// src/commands/sessions/web/fromGithub/parseGithubOrigin.ts
|
|
@@ -5293,12 +5396,19 @@ function planGithubReview(body, baseDir) {
|
|
|
5293
5396
|
return { ok: true, cwd: clone.cwd, assistArgs: [...args, prNumber] };
|
|
5294
5397
|
}
|
|
5295
5398
|
|
|
5399
|
+
// src/commands/sessions/web/fromGithub/planPrReview.ts
|
|
5400
|
+
function planPrReview(body, baseDir) {
|
|
5401
|
+
const { url, args } = body ?? {};
|
|
5402
|
+
const azurePr = typeof url === "string" && parseAzureDevopsPrUrl(url.trim());
|
|
5403
|
+
return azurePr ? planAzureDevopsReview(azurePr, args, baseDir) : planGithubReview(body, baseDir);
|
|
5404
|
+
}
|
|
5405
|
+
|
|
5296
5406
|
// src/commands/sessions/web/fromGithub/reviewFromGithub.ts
|
|
5297
5407
|
function reviewFromGithub(req, res) {
|
|
5298
5408
|
return launchFromGithub(
|
|
5299
5409
|
req,
|
|
5300
5410
|
res,
|
|
5301
|
-
|
|
5411
|
+
planPrReview,
|
|
5302
5412
|
(plan2) => requestAssistSession(plan2.assistArgs, plan2.cwd)
|
|
5303
5413
|
);
|
|
5304
5414
|
}
|
|
@@ -6797,14 +6907,14 @@ function assertNoDuplicateRunNames(configs) {
|
|
|
6797
6907
|
}
|
|
6798
6908
|
|
|
6799
6909
|
// src/shared/findLinkedConfigPath.ts
|
|
6800
|
-
import { existsSync as
|
|
6801
|
-
import { join as
|
|
6910
|
+
import { existsSync as existsSync15 } from "fs";
|
|
6911
|
+
import { join as join20, resolve as resolve5 } from "path";
|
|
6802
6912
|
function findLinkedConfigPath(linkPath, fromDir) {
|
|
6803
6913
|
const resolved = resolve5(fromDir, linkPath);
|
|
6804
|
-
const claudePath =
|
|
6805
|
-
if (
|
|
6806
|
-
const rootPath =
|
|
6807
|
-
if (
|
|
6914
|
+
const claudePath = join20(resolved, ".claude", "assist.yml");
|
|
6915
|
+
if (existsSync15(claudePath)) return claudePath;
|
|
6916
|
+
const rootPath = join20(resolved, "assist.yml");
|
|
6917
|
+
if (existsSync15(rootPath)) return rootPath;
|
|
6808
6918
|
throw new Error(`No assist.yml found in linked project: ${resolved}`);
|
|
6809
6919
|
}
|
|
6810
6920
|
|
|
@@ -6873,12 +6983,12 @@ function resolveLocalCwd(config, configDir, ctx) {
|
|
|
6873
6983
|
}
|
|
6874
6984
|
|
|
6875
6985
|
// src/shared/findRepoRoot.ts
|
|
6876
|
-
import { existsSync as
|
|
6986
|
+
import { existsSync as existsSync16 } from "fs";
|
|
6877
6987
|
import path8 from "path";
|
|
6878
6988
|
function findRepoRoot(dir) {
|
|
6879
6989
|
let current = dir;
|
|
6880
6990
|
while (current !== path8.dirname(current)) {
|
|
6881
|
-
if (
|
|
6991
|
+
if (existsSync16(path8.join(current, ".git"))) {
|
|
6882
6992
|
return current;
|
|
6883
6993
|
}
|
|
6884
6994
|
current = path8.dirname(current);
|
|
@@ -6913,18 +7023,18 @@ function handleServerRuns(req, res) {
|
|
|
6913
7023
|
import { execFile as execFile4 } from "child_process";
|
|
6914
7024
|
import { readFileSync as readFileSync7 } from "fs";
|
|
6915
7025
|
import { homedir as homedir10 } from "os";
|
|
6916
|
-
import { basename as basename7, join as
|
|
7026
|
+
import { basename as basename7, join as join22 } from "path";
|
|
6917
7027
|
import { promisify as promisify4 } from "util";
|
|
6918
7028
|
|
|
6919
7029
|
// src/commands/sessions/web/findSynthesisForBranch.ts
|
|
6920
|
-
import { existsSync as
|
|
6921
|
-
import { basename as basename6, dirname as dirname10, join as
|
|
7030
|
+
import { existsSync as existsSync17, readdirSync as readdirSync4, statSync as statSync4 } from "fs";
|
|
7031
|
+
import { basename as basename6, dirname as dirname10, join as join21 } from "path";
|
|
6922
7032
|
function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
6923
|
-
const branchKeyPath =
|
|
7033
|
+
const branchKeyPath = join21(repoReviewsDir, `${branch2}-`);
|
|
6924
7034
|
const parent = dirname10(branchKeyPath);
|
|
6925
7035
|
const branchPrefix = basename6(branchKeyPath);
|
|
6926
|
-
if (!
|
|
6927
|
-
const synthesisFiles =
|
|
7036
|
+
if (!existsSync17(parent)) return null;
|
|
7037
|
+
const synthesisFiles = readdirSync4(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join21(parent, name, "synthesis.md")).filter((path108) => existsSync17(path108)).map((path108) => ({ path: path108, mtime: statSync4(path108).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
|
|
6928
7038
|
return synthesisFiles[0]?.path ?? null;
|
|
6929
7039
|
}
|
|
6930
7040
|
|
|
@@ -6942,7 +7052,7 @@ async function resolveSynthesisPath(cwd) {
|
|
|
6942
7052
|
runGit2(cwd, ["rev-parse", "--show-toplevel"]),
|
|
6943
7053
|
runGit2(cwd, ["rev-parse", "--abbrev-ref", "HEAD"])
|
|
6944
7054
|
]);
|
|
6945
|
-
const repoReviewsDir =
|
|
7055
|
+
const repoReviewsDir = join22(
|
|
6946
7056
|
homedir10(),
|
|
6947
7057
|
".assist",
|
|
6948
7058
|
"reviews",
|
|
@@ -8357,7 +8467,7 @@ async function nextPickup(req, res) {
|
|
|
8357
8467
|
import path11 from "path";
|
|
8358
8468
|
|
|
8359
8469
|
// src/commands/rules/readScopedRules.ts
|
|
8360
|
-
import { existsSync as
|
|
8470
|
+
import { existsSync as existsSync19, readFileSync as readFileSync8 } from "fs";
|
|
8361
8471
|
import path10 from "path";
|
|
8362
8472
|
|
|
8363
8473
|
// src/commands/rules/rulesSectionRange.ts
|
|
@@ -8406,11 +8516,11 @@ function parseRulesSection(content) {
|
|
|
8406
8516
|
}
|
|
8407
8517
|
|
|
8408
8518
|
// src/commands/rules/scopeDirectory.ts
|
|
8409
|
-
import { existsSync as
|
|
8519
|
+
import { existsSync as existsSync18, statSync as statSync5 } from "fs";
|
|
8410
8520
|
import path9 from "path";
|
|
8411
8521
|
function scopeDirectory(target) {
|
|
8412
8522
|
const resolved = path9.resolve(target);
|
|
8413
|
-
return
|
|
8523
|
+
return existsSync18(resolved) && statSync5(resolved).isDirectory() ? resolved : path9.dirname(resolved);
|
|
8414
8524
|
}
|
|
8415
8525
|
|
|
8416
8526
|
// src/commands/rules/readScopedRules.ts
|
|
@@ -8421,7 +8531,7 @@ function scopedClaudeFiles(target) {
|
|
|
8421
8531
|
let current = startDir;
|
|
8422
8532
|
while (true) {
|
|
8423
8533
|
const candidate = path10.join(current, "CLAUDE.md");
|
|
8424
|
-
if (
|
|
8534
|
+
if (existsSync19(candidate)) files.push(candidate);
|
|
8425
8535
|
if (current === root2 || current === path10.dirname(current)) break;
|
|
8426
8536
|
current = path10.dirname(current);
|
|
8427
8537
|
}
|
|
@@ -9807,7 +9917,7 @@ async function revertDiffFile(req, res) {
|
|
|
9807
9917
|
|
|
9808
9918
|
// src/commands/run/runCommandToCompletion.ts
|
|
9809
9919
|
import { spawn as spawn2 } from "child_process";
|
|
9810
|
-
import { existsSync as
|
|
9920
|
+
import { existsSync as existsSync21 } from "fs";
|
|
9811
9921
|
|
|
9812
9922
|
// src/shared/expandEnv.ts
|
|
9813
9923
|
import { homedir as homedir11 } from "os";
|
|
@@ -9822,15 +9932,15 @@ function expandEnv(env) {
|
|
|
9822
9932
|
|
|
9823
9933
|
// src/commands/run/resolveCommand.ts
|
|
9824
9934
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
9825
|
-
import { existsSync as
|
|
9826
|
-
import { dirname as dirname11, join as
|
|
9935
|
+
import { existsSync as existsSync20 } from "fs";
|
|
9936
|
+
import { dirname as dirname11, join as join23, resolve as resolve10 } from "path";
|
|
9827
9937
|
function resolveCommand(command) {
|
|
9828
9938
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
9829
9939
|
try {
|
|
9830
9940
|
const gitPath = execFileSync3("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
9831
9941
|
const gitRoot = resolve10(dirname11(gitPath), "..");
|
|
9832
|
-
const gitBash =
|
|
9833
|
-
if (
|
|
9942
|
+
const gitBash = join23(gitRoot, "bin", "bash.exe");
|
|
9943
|
+
if (existsSync20(gitBash)) return gitBash;
|
|
9834
9944
|
} catch {
|
|
9835
9945
|
return command;
|
|
9836
9946
|
}
|
|
@@ -9840,7 +9950,7 @@ function resolveCommand(command) {
|
|
|
9840
9950
|
// src/commands/run/runCommandToCompletion.ts
|
|
9841
9951
|
function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
9842
9952
|
return new Promise((resolveResult) => {
|
|
9843
|
-
if (cwd && !
|
|
9953
|
+
if (cwd && !existsSync21(cwd)) {
|
|
9844
9954
|
resolveResult({
|
|
9845
9955
|
kind: "failed",
|
|
9846
9956
|
message: `Failed to execute command: cwd ${cwd} does not exist`
|
|
@@ -10967,7 +11077,7 @@ function changedPaths(from, cwd) {
|
|
|
10967
11077
|
}
|
|
10968
11078
|
|
|
10969
11079
|
// src/commands/watch/readBuiltVersion.ts
|
|
10970
|
-
import { join as
|
|
11080
|
+
import { join as join25 } from "path";
|
|
10971
11081
|
|
|
10972
11082
|
// src/shared/readPackageJson.ts
|
|
10973
11083
|
import * as fs6 from "fs";
|
|
@@ -11017,7 +11127,7 @@ function findPackageJsonWithVerifyScripts(startDir) {
|
|
|
11017
11127
|
function readBuiltVersion(cwd) {
|
|
11018
11128
|
try {
|
|
11019
11129
|
const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
11020
|
-
return readPackageJson(
|
|
11130
|
+
return readPackageJson(join25(root2, "package.json")).version ?? "unknown";
|
|
11021
11131
|
} catch {
|
|
11022
11132
|
return "unknown";
|
|
11023
11133
|
}
|
|
@@ -11070,7 +11180,7 @@ function stripAnsi(text17) {
|
|
|
11070
11180
|
// src/commands/sessions/daemon/worktree/watcherLogPath.ts
|
|
11071
11181
|
import { createHash } from "crypto";
|
|
11072
11182
|
import { homedir as homedir12 } from "os";
|
|
11073
|
-
import { basename as basename8, join as
|
|
11183
|
+
import { basename as basename8, join as join26 } from "path";
|
|
11074
11184
|
|
|
11075
11185
|
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
11076
11186
|
import { realpathSync } from "fs";
|
|
@@ -11087,8 +11197,8 @@ function canonicalTreePath(path108) {
|
|
|
11087
11197
|
function watcherLogPath(cwd) {
|
|
11088
11198
|
const clone = canonicalTreePath(cwd);
|
|
11089
11199
|
const key = createHash("sha1").update(clone).digest("hex").slice(0, 8);
|
|
11090
|
-
const dir = process.env.ASSIST_WATCHER_LOG_DIR ??
|
|
11091
|
-
return
|
|
11200
|
+
const dir = process.env.ASSIST_WATCHER_LOG_DIR ?? join26(homedir12(), ".assist", "watchers");
|
|
11201
|
+
return join26(dir, `${basename8(clone) || "root"}-${key}.log`);
|
|
11092
11202
|
}
|
|
11093
11203
|
|
|
11094
11204
|
// src/commands/sessions/web/updates/readUpdateHistory.ts
|
|
@@ -11203,7 +11313,7 @@ async function readRequestBuffer(req, limit) {
|
|
|
11203
11313
|
|
|
11204
11314
|
// src/commands/sessions/web/stageAttachment.ts
|
|
11205
11315
|
import { mkdir, mkdtemp, writeFile } from "fs/promises";
|
|
11206
|
-
import { extname as extname2, join as
|
|
11316
|
+
import { extname as extname2, join as join27 } from "path";
|
|
11207
11317
|
|
|
11208
11318
|
// src/commands/sessions/web/ghAttachableExtensions.ts
|
|
11209
11319
|
var ghAttachableExtensions = /* @__PURE__ */ new Set([
|
|
@@ -11235,9 +11345,9 @@ function safeBaseName(name) {
|
|
|
11235
11345
|
async function stageAttachment(name, contentType, body) {
|
|
11236
11346
|
const ext = pickExtension(name, contentType);
|
|
11237
11347
|
await mkdir(stagedAttachmentsDir, { recursive: true });
|
|
11238
|
-
const dir = await mkdtemp(
|
|
11348
|
+
const dir = await mkdtemp(join27(stagedAttachmentsDir, "upload-"));
|
|
11239
11349
|
const alt = safeBaseName(name);
|
|
11240
|
-
const filePath =
|
|
11350
|
+
const filePath = join27(dir, `${alt}.${ext}`);
|
|
11241
11351
|
await writeFile(filePath, body);
|
|
11242
11352
|
return { dir, filePath, alt };
|
|
11243
11353
|
}
|
|
@@ -11286,16 +11396,16 @@ import { readFile as readFile2, stat as stat3, writeFile as writeFile2 } from "f
|
|
|
11286
11396
|
|
|
11287
11397
|
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
11288
11398
|
import { execFile as execFile9 } from "child_process";
|
|
11289
|
-
import { existsSync as
|
|
11290
|
-
import { dirname as dirname14, join as
|
|
11399
|
+
import { existsSync as existsSync23 } from "fs";
|
|
11400
|
+
import { dirname as dirname14, join as join28 } from "path";
|
|
11291
11401
|
import { promisify as promisify10 } from "util";
|
|
11292
11402
|
var execFileAsync9 = promisify10(execFile9);
|
|
11293
11403
|
var TIMEOUT_MS = 15e3;
|
|
11294
11404
|
function findOxfmtScript(root2) {
|
|
11295
11405
|
let dir = root2;
|
|
11296
11406
|
for (; ; ) {
|
|
11297
|
-
const candidate =
|
|
11298
|
-
if (
|
|
11407
|
+
const candidate = join28(dir, "node_modules", "oxfmt", "bin", "oxfmt");
|
|
11408
|
+
if (existsSync23(candidate)) return candidate;
|
|
11299
11409
|
const parent = dirname14(dir);
|
|
11300
11410
|
if (parent === dir) return void 0;
|
|
11301
11411
|
dir = parent;
|
|
@@ -11367,10 +11477,10 @@ async function writeFileContent(req, res) {
|
|
|
11367
11477
|
// src/shared/createBundleHandler.ts
|
|
11368
11478
|
import { createHash as createHash2 } from "crypto";
|
|
11369
11479
|
import { readFileSync as readFileSync10, statSync as statSync6 } from "fs";
|
|
11370
|
-
import { dirname as dirname15, join as
|
|
11480
|
+
import { dirname as dirname15, join as join29 } from "path";
|
|
11371
11481
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
11372
11482
|
function createBundleHandler(importMetaUrl, bundlePath, contentType = "application/javascript") {
|
|
11373
|
-
const file =
|
|
11483
|
+
const file = join29(dirname15(fileURLToPath2(importMetaUrl)), bundlePath);
|
|
11374
11484
|
let cache7;
|
|
11375
11485
|
return (req, res) => {
|
|
11376
11486
|
const mtimeMs = statSync6(file).mtimeMs;
|
|
@@ -11797,9 +11907,9 @@ function originForCwd(cwd) {
|
|
|
11797
11907
|
}
|
|
11798
11908
|
|
|
11799
11909
|
// src/commands/sessions/daemon/repoDirExists.ts
|
|
11800
|
-
import { existsSync as
|
|
11910
|
+
import { existsSync as existsSync24 } from "fs";
|
|
11801
11911
|
function repoDirExists(cwd) {
|
|
11802
|
-
return
|
|
11912
|
+
return existsSync24(cwd);
|
|
11803
11913
|
}
|
|
11804
11914
|
|
|
11805
11915
|
// src/commands/sessions/daemon/worktree/git.ts
|
|
@@ -12301,17 +12411,17 @@ import * as path14 from "path";
|
|
|
12301
12411
|
import chalk20 from "chalk";
|
|
12302
12412
|
|
|
12303
12413
|
// src/commands/verify/addToKnipIgnoreBinaries.ts
|
|
12304
|
-
import { existsSync as
|
|
12305
|
-
import { join as
|
|
12414
|
+
import { existsSync as existsSync25, readFileSync as readFileSync12, writeFileSync as writeFileSync7 } from "fs";
|
|
12415
|
+
import { join as join30 } from "path";
|
|
12306
12416
|
import chalk19 from "chalk";
|
|
12307
12417
|
function loadKnipConfig(knipJsonPath) {
|
|
12308
|
-
if (
|
|
12418
|
+
if (existsSync25(knipJsonPath)) {
|
|
12309
12419
|
return JSON.parse(readFileSync12(knipJsonPath, "utf8"));
|
|
12310
12420
|
}
|
|
12311
12421
|
return { $schema: "https://unpkg.com/knip@5/schema.json" };
|
|
12312
12422
|
}
|
|
12313
12423
|
function addToKnipIgnoreBinaries(cwd, binary) {
|
|
12314
|
-
const knipJsonPath =
|
|
12424
|
+
const knipJsonPath = join30(cwd, "knip.json");
|
|
12315
12425
|
try {
|
|
12316
12426
|
const knipConfig = loadKnipConfig(knipJsonPath);
|
|
12317
12427
|
const ignoreBinaries = knipConfig.ignoreBinaries ?? [];
|
|
@@ -12358,7 +12468,7 @@ import * as path16 from "path";
|
|
|
12358
12468
|
import chalk25 from "chalk";
|
|
12359
12469
|
|
|
12360
12470
|
// src/commands/format/init.ts
|
|
12361
|
-
import { existsSync as
|
|
12471
|
+
import { existsSync as existsSync26, readFileSync as readFileSync13, writeFileSync as writeFileSync8 } from "fs";
|
|
12362
12472
|
import chalk23 from "chalk";
|
|
12363
12473
|
|
|
12364
12474
|
// src/shared/promptConfirm.ts
|
|
@@ -12420,7 +12530,7 @@ async function init() {
|
|
|
12420
12530
|
const newContent = `${JSON.stringify(oxfmtrc_template_default, null, " ")}
|
|
12421
12531
|
`;
|
|
12422
12532
|
const configPath = ".oxfmtrc.json";
|
|
12423
|
-
const oldContent =
|
|
12533
|
+
const oldContent = existsSync26(configPath) ? readFileSync13(configPath, "utf8") : "";
|
|
12424
12534
|
if (oldContent === newContent) {
|
|
12425
12535
|
console.log(".oxfmtrc.json already has the baseline formatter config");
|
|
12426
12536
|
return;
|
|
@@ -12443,15 +12553,15 @@ async function init() {
|
|
|
12443
12553
|
}
|
|
12444
12554
|
|
|
12445
12555
|
// src/commands/lint/init.ts
|
|
12446
|
-
import { existsSync as
|
|
12556
|
+
import { existsSync as existsSync29, readFileSync as readFileSync15, writeFileSync as writeFileSync10 } from "fs";
|
|
12447
12557
|
import chalk24 from "chalk";
|
|
12448
12558
|
|
|
12449
12559
|
// src/shared/removeEslint.ts
|
|
12450
12560
|
import { execSync as execSync7 } from "child_process";
|
|
12451
|
-
import { existsSync as
|
|
12561
|
+
import { existsSync as existsSync28, readFileSync as readFileSync14, writeFileSync as writeFileSync9 } from "fs";
|
|
12452
12562
|
|
|
12453
12563
|
// src/shared/removeEslint/removeEslintConfigFiles.ts
|
|
12454
|
-
import { existsSync as
|
|
12564
|
+
import { existsSync as existsSync27, unlinkSync as unlinkSync2 } from "fs";
|
|
12455
12565
|
var ESLINT_CONFIG_FILES = [
|
|
12456
12566
|
"eslint.config.js",
|
|
12457
12567
|
"eslint.config.mjs",
|
|
@@ -12467,7 +12577,7 @@ var ESLINT_CONFIG_FILES = [
|
|
|
12467
12577
|
function removeEslintConfigFiles() {
|
|
12468
12578
|
let removed = false;
|
|
12469
12579
|
for (const configFile of ESLINT_CONFIG_FILES) {
|
|
12470
|
-
if (
|
|
12580
|
+
if (existsSync27(configFile)) {
|
|
12471
12581
|
unlinkSync2(configFile);
|
|
12472
12582
|
console.log(`Removed ${configFile}`);
|
|
12473
12583
|
removed = true;
|
|
@@ -12489,7 +12599,7 @@ function removeEslint(options2 = {}) {
|
|
|
12489
12599
|
}
|
|
12490
12600
|
function removeEslintFromPackageJson(options2) {
|
|
12491
12601
|
const packageJsonPath = "package.json";
|
|
12492
|
-
if (!
|
|
12602
|
+
if (!existsSync28(packageJsonPath)) {
|
|
12493
12603
|
return false;
|
|
12494
12604
|
}
|
|
12495
12605
|
const packageJson = JSON.parse(readFileSync14(packageJsonPath, "utf8"));
|
|
@@ -12556,7 +12666,7 @@ async function writeOxlintConfig() {
|
|
|
12556
12666
|
const newContent = `${JSON.stringify(oxlintrc_template_default, null, " ")}
|
|
12557
12667
|
`;
|
|
12558
12668
|
const configPath = ".oxlintrc.json";
|
|
12559
|
-
const oldContent =
|
|
12669
|
+
const oldContent = existsSync29(configPath) ? readFileSync15(configPath, "utf8") : "";
|
|
12560
12670
|
if (oldContent === newContent) {
|
|
12561
12671
|
console.log(".oxlintrc.json already has the baseline linter config");
|
|
12562
12672
|
return;
|
|
@@ -13337,7 +13447,7 @@ async function newCli() {
|
|
|
13337
13447
|
|
|
13338
13448
|
// src/commands/new/registerNew/newProject.ts
|
|
13339
13449
|
import { execSync as execSync14 } from "child_process";
|
|
13340
|
-
import { existsSync as
|
|
13450
|
+
import { existsSync as existsSync34, readFileSync as readFileSync19, writeFileSync as writeFileSync17 } from "fs";
|
|
13341
13451
|
|
|
13342
13452
|
// src/commands/deploy/init.ts
|
|
13343
13453
|
import { execSync as execSync13 } from "child_process";
|
|
@@ -13345,14 +13455,14 @@ import chalk35 from "chalk";
|
|
|
13345
13455
|
import enquirer3 from "enquirer";
|
|
13346
13456
|
|
|
13347
13457
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
13348
|
-
import { existsSync as
|
|
13349
|
-
import { dirname as dirname23, join as
|
|
13458
|
+
import { existsSync as existsSync33, mkdirSync as mkdirSync9, readFileSync as readFileSync18, writeFileSync as writeFileSync16 } from "fs";
|
|
13459
|
+
import { dirname as dirname23, join as join37 } from "path";
|
|
13350
13460
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
13351
13461
|
import chalk34 from "chalk";
|
|
13352
13462
|
var WORKFLOW_PATH = ".github/workflows/build.yml";
|
|
13353
13463
|
var __dirname3 = dirname23(fileURLToPath3(import.meta.url));
|
|
13354
13464
|
function getExistingSiteId() {
|
|
13355
|
-
if (!
|
|
13465
|
+
if (!existsSync33(WORKFLOW_PATH)) {
|
|
13356
13466
|
return null;
|
|
13357
13467
|
}
|
|
13358
13468
|
const content = readFileSync18(WORKFLOW_PATH, "utf8");
|
|
@@ -13360,17 +13470,17 @@ function getExistingSiteId() {
|
|
|
13360
13470
|
return match ? match[1] : null;
|
|
13361
13471
|
}
|
|
13362
13472
|
function getTemplateContent(siteId) {
|
|
13363
|
-
const templatePath =
|
|
13473
|
+
const templatePath = join37(__dirname3, "commands/deploy/build.yml");
|
|
13364
13474
|
const template = readFileSync18(templatePath, "utf8");
|
|
13365
13475
|
return template.replace("{{NETLIFY_SITE_ID}}", siteId);
|
|
13366
13476
|
}
|
|
13367
13477
|
async function updateWorkflow(siteId) {
|
|
13368
13478
|
const newContent = getTemplateContent(siteId);
|
|
13369
13479
|
const workflowDir = ".github/workflows";
|
|
13370
|
-
if (!
|
|
13480
|
+
if (!existsSync33(workflowDir)) {
|
|
13371
13481
|
mkdirSync9(workflowDir, { recursive: true });
|
|
13372
13482
|
}
|
|
13373
|
-
if (
|
|
13483
|
+
if (existsSync33(WORKFLOW_PATH)) {
|
|
13374
13484
|
const oldContent = readFileSync18(WORKFLOW_PATH, "utf8");
|
|
13375
13485
|
if (oldContent === newContent) {
|
|
13376
13486
|
console.log(chalk34.green("build.yml is already up to date"));
|
|
@@ -13465,7 +13575,7 @@ async function newProject() {
|
|
|
13465
13575
|
}
|
|
13466
13576
|
function addViteBaseConfig() {
|
|
13467
13577
|
const viteConfigPath = "vite.config.ts";
|
|
13468
|
-
if (!
|
|
13578
|
+
if (!existsSync34(viteConfigPath)) {
|
|
13469
13579
|
console.log("No vite.config.ts found, skipping base config");
|
|
13470
13580
|
return;
|
|
13471
13581
|
}
|
|
@@ -13666,18 +13776,18 @@ function adviceContextFor(cwd) {
|
|
|
13666
13776
|
}
|
|
13667
13777
|
|
|
13668
13778
|
// src/commands/advise/loadAdviceFragments.ts
|
|
13669
|
-
import { readdirSync as
|
|
13670
|
-
import { basename as basename10, join as
|
|
13779
|
+
import { readdirSync as readdirSync5, readFileSync as readFileSync20 } from "fs";
|
|
13780
|
+
import { basename as basename10, join as join39 } from "path";
|
|
13671
13781
|
|
|
13672
13782
|
// src/commands/advise/adviceDir.ts
|
|
13673
|
-
import { existsSync as
|
|
13674
|
-
import { dirname as dirname24, join as
|
|
13783
|
+
import { existsSync as existsSync35 } from "fs";
|
|
13784
|
+
import { dirname as dirname24, join as join38 } from "path";
|
|
13675
13785
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
13676
13786
|
function adviceDir() {
|
|
13677
13787
|
let current = dirname24(fileURLToPath4(import.meta.url));
|
|
13678
13788
|
while (current !== dirname24(current)) {
|
|
13679
|
-
const candidate =
|
|
13680
|
-
if (
|
|
13789
|
+
const candidate = join38(current, "claude", "advice");
|
|
13790
|
+
if (existsSync35(candidate)) return candidate;
|
|
13681
13791
|
current = dirname24(current);
|
|
13682
13792
|
}
|
|
13683
13793
|
throw new Error("Could not locate the shipped claude/advice directory");
|
|
@@ -13706,10 +13816,10 @@ function parseAdviceFragment(name, content) {
|
|
|
13706
13816
|
|
|
13707
13817
|
// src/commands/advise/loadAdviceFragments.ts
|
|
13708
13818
|
function loadAdviceFragments(dir = adviceDir()) {
|
|
13709
|
-
return
|
|
13819
|
+
return readdirSync5(dir).filter((file) => file.endsWith(".md")).sort().map(
|
|
13710
13820
|
(file) => parseAdviceFragment(
|
|
13711
13821
|
basename10(file, ".md"),
|
|
13712
|
-
readFileSync20(
|
|
13822
|
+
readFileSync20(join39(dir, file), "utf8")
|
|
13713
13823
|
)
|
|
13714
13824
|
);
|
|
13715
13825
|
}
|
|
@@ -13743,13 +13853,13 @@ function renderAdviceBody(fragment, context) {
|
|
|
13743
13853
|
}
|
|
13744
13854
|
|
|
13745
13855
|
// src/commands/advise/adviceConditions.ts
|
|
13746
|
-
import { existsSync as
|
|
13747
|
-
import { join as
|
|
13856
|
+
import { existsSync as existsSync36 } from "fs";
|
|
13857
|
+
import { join as join40 } from "path";
|
|
13748
13858
|
function repoFile(file, label2) {
|
|
13749
13859
|
return {
|
|
13750
13860
|
whenMet: `the repo has ${label2}`,
|
|
13751
13861
|
whenUnmet: `the repo has no ${label2}`,
|
|
13752
|
-
matches: ({ rootDir }) =>
|
|
13862
|
+
matches: ({ rootDir }) => existsSync36(join40(rootDir, file))
|
|
13753
13863
|
};
|
|
13754
13864
|
}
|
|
13755
13865
|
var adviceConditions = {
|
|
@@ -13765,11 +13875,11 @@ var adviceConditions = {
|
|
|
13765
13875
|
},
|
|
13766
13876
|
typescript: repoFile("tsconfig.json", "a tsconfig.json"),
|
|
13767
13877
|
filenameConvention: repoFile(
|
|
13768
|
-
|
|
13878
|
+
join40("oxlint-rules", "filenameConvention.ts"),
|
|
13769
13879
|
"oxlint-rules/filenameConvention.ts"
|
|
13770
13880
|
),
|
|
13771
13881
|
claudeSettings: repoFile(
|
|
13772
|
-
|
|
13882
|
+
join40("claude", "settings.json"),
|
|
13773
13883
|
"claude/settings.json"
|
|
13774
13884
|
),
|
|
13775
13885
|
verify: {
|
|
@@ -14163,7 +14273,7 @@ function registerAsk(program) {
|
|
|
14163
14273
|
|
|
14164
14274
|
// src/commands/registerBackup.ts
|
|
14165
14275
|
import { mkdir as mkdir3, stat as stat4 } from "fs/promises";
|
|
14166
|
-
import { join as
|
|
14276
|
+
import { join as join42, resolve as resolve15 } from "path";
|
|
14167
14277
|
import chalk39 from "chalk";
|
|
14168
14278
|
|
|
14169
14279
|
// src/shared/db/recordBackup.ts
|
|
@@ -14177,7 +14287,7 @@ async function recordBackup(db, {
|
|
|
14177
14287
|
|
|
14178
14288
|
// src/commands/backup/scheduleBackup.ts
|
|
14179
14289
|
import { mkdir as mkdir2 } from "fs/promises";
|
|
14180
|
-
import { join as
|
|
14290
|
+
import { join as join41 } from "path";
|
|
14181
14291
|
import chalk37 from "chalk";
|
|
14182
14292
|
|
|
14183
14293
|
// src/commands/backup/readCrontab.ts
|
|
@@ -14319,7 +14429,7 @@ async function scheduleBackup({
|
|
|
14319
14429
|
const cronExpr = durationToCron(every);
|
|
14320
14430
|
const dir = expandTilde(loadConfig().backup.dir);
|
|
14321
14431
|
await mkdir2(dir, { recursive: true });
|
|
14322
|
-
const logPath2 =
|
|
14432
|
+
const logPath2 = join41(dir, "cron.log");
|
|
14323
14433
|
const cronLine = `${cronExpr} ${resolveAssistCommand()} backup >> ${logPath2} 2>&1`;
|
|
14324
14434
|
writeCrontab(upsertScheduleBlock(readCrontab(), every, cronLine));
|
|
14325
14435
|
console.error(
|
|
@@ -14498,7 +14608,7 @@ async function backup({ out }) {
|
|
|
14498
14608
|
await mkdir3(dir, { recursive: true });
|
|
14499
14609
|
const start2 = Date.now();
|
|
14500
14610
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
14501
|
-
const filePath = resolve15(
|
|
14611
|
+
const filePath = resolve15(join42(dir, `backup-${timestamp6}.dump`));
|
|
14502
14612
|
await exportBacklog(filePath);
|
|
14503
14613
|
const { size } = await stat4(filePath);
|
|
14504
14614
|
const durationMs = Date.now() - start2;
|
|
@@ -15024,7 +15134,7 @@ function registerAssociateJiraCommand(cmd) {
|
|
|
15024
15134
|
|
|
15025
15135
|
// src/commands/backlog/cloneRepo.ts
|
|
15026
15136
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
15027
|
-
import { existsSync as
|
|
15137
|
+
import { existsSync as existsSync38 } from "fs";
|
|
15028
15138
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
15029
15139
|
import chalk46 from "chalk";
|
|
15030
15140
|
|
|
@@ -15060,7 +15170,7 @@ async function cloneRepo(originRaw) {
|
|
|
15060
15170
|
if (!target) {
|
|
15061
15171
|
return fail2(`Could not derive a repository name from "${origin}".`);
|
|
15062
15172
|
}
|
|
15063
|
-
if (
|
|
15173
|
+
if (existsSync38(target)) {
|
|
15064
15174
|
return fail2(`Clone target already exists: ${target}`);
|
|
15065
15175
|
}
|
|
15066
15176
|
await mkdir4(baseDir, { recursive: true });
|
|
@@ -15477,7 +15587,7 @@ function ensureRemoteOrigin() {
|
|
|
15477
15587
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
15478
15588
|
import { mkdtempSync, readFileSync as readFileSync21, unlinkSync as unlinkSync3, writeFileSync as writeFileSync18 } from "fs";
|
|
15479
15589
|
import { tmpdir } from "os";
|
|
15480
|
-
import { join as
|
|
15590
|
+
import { join as join45 } from "path";
|
|
15481
15591
|
import enquirer4 from "enquirer";
|
|
15482
15592
|
async function promptType() {
|
|
15483
15593
|
const { type } = await enquirer4.prompt({
|
|
@@ -15517,8 +15627,8 @@ async function promptDescription() {
|
|
|
15517
15627
|
}
|
|
15518
15628
|
function openEditor() {
|
|
15519
15629
|
const editor = process.env.EDITOR || process.env.VISUAL || "vi";
|
|
15520
|
-
const dir = mkdtempSync(
|
|
15521
|
-
const filePath =
|
|
15630
|
+
const dir = mkdtempSync(join45(tmpdir(), "assist-"));
|
|
15631
|
+
const filePath = join45(dir, "description.md");
|
|
15522
15632
|
writeFileSync18(filePath, "");
|
|
15523
15633
|
const result = spawnSync5(editor, [filePath], { stdio: "inherit" });
|
|
15524
15634
|
if (result.status !== 0) {
|
|
@@ -16300,14 +16410,14 @@ function hasLocalChanges() {
|
|
|
16300
16410
|
|
|
16301
16411
|
// src/commands/backlog/acquireLock.ts
|
|
16302
16412
|
import {
|
|
16303
|
-
existsSync as
|
|
16413
|
+
existsSync as existsSync39,
|
|
16304
16414
|
mkdirSync as mkdirSync10,
|
|
16305
16415
|
readFileSync as readFileSync24,
|
|
16306
16416
|
unlinkSync as unlinkSync4,
|
|
16307
16417
|
writeFileSync as writeFileSync19
|
|
16308
16418
|
} from "fs";
|
|
16309
16419
|
import { homedir as homedir14 } from "os";
|
|
16310
|
-
import { join as
|
|
16420
|
+
import { join as join46 } from "path";
|
|
16311
16421
|
|
|
16312
16422
|
// src/commands/backlog/bootedAt.ts
|
|
16313
16423
|
import { uptime } from "os";
|
|
@@ -16343,10 +16453,10 @@ function isStaleLock(pid, timestamp6) {
|
|
|
16343
16453
|
|
|
16344
16454
|
// src/commands/backlog/acquireLock.ts
|
|
16345
16455
|
function getLocksDir() {
|
|
16346
|
-
return
|
|
16456
|
+
return join46(homedir14(), ".assist", "locks");
|
|
16347
16457
|
}
|
|
16348
16458
|
function getLockPath(itemId2) {
|
|
16349
|
-
return
|
|
16459
|
+
return join46(getLocksDir(), `lock-${itemId2}.json`);
|
|
16350
16460
|
}
|
|
16351
16461
|
function isProcessAlive(pid) {
|
|
16352
16462
|
try {
|
|
@@ -16358,7 +16468,7 @@ function isProcessAlive(pid) {
|
|
|
16358
16468
|
}
|
|
16359
16469
|
function foreignLockHolder(itemId2) {
|
|
16360
16470
|
const lockPath = getLockPath(itemId2);
|
|
16361
|
-
if (!
|
|
16471
|
+
if (!existsSync39(lockPath)) return null;
|
|
16362
16472
|
try {
|
|
16363
16473
|
const lock2 = JSON.parse(readFileSync24(lockPath, "utf8"));
|
|
16364
16474
|
if (typeof lock2.pid !== "number" || lock2.pid === process.pid) return null;
|
|
@@ -16831,14 +16941,14 @@ function reportDuplicateRun(itemId2, holder) {
|
|
|
16831
16941
|
}
|
|
16832
16942
|
|
|
16833
16943
|
// src/commands/backlog/consumePause.ts
|
|
16834
|
-
import { existsSync as
|
|
16944
|
+
import { existsSync as existsSync40, mkdirSync as mkdirSync12, unlinkSync as unlinkSync5, writeFileSync as writeFileSync21 } from "fs";
|
|
16835
16945
|
import { homedir as homedir15 } from "os";
|
|
16836
|
-
import { join as
|
|
16946
|
+
import { join as join47 } from "path";
|
|
16837
16947
|
function getControlsDir() {
|
|
16838
|
-
return
|
|
16948
|
+
return join47(homedir15(), ".assist", "controls");
|
|
16839
16949
|
}
|
|
16840
16950
|
function getPausePath(itemId2) {
|
|
16841
|
-
return
|
|
16951
|
+
return join47(getControlsDir(), `pause-${itemId2}.json`);
|
|
16842
16952
|
}
|
|
16843
16953
|
function requestPause(itemId2) {
|
|
16844
16954
|
mkdirSync12(getControlsDir(), { recursive: true });
|
|
@@ -16848,7 +16958,7 @@ function requestPause(itemId2) {
|
|
|
16848
16958
|
);
|
|
16849
16959
|
}
|
|
16850
16960
|
function isPausePending(itemId2) {
|
|
16851
|
-
return
|
|
16961
|
+
return existsSync40(getPausePath(itemId2));
|
|
16852
16962
|
}
|
|
16853
16963
|
function clearPause(itemId2) {
|
|
16854
16964
|
try {
|
|
@@ -16858,7 +16968,7 @@ function clearPause(itemId2) {
|
|
|
16858
16968
|
}
|
|
16859
16969
|
function consumePause(itemId2) {
|
|
16860
16970
|
const pausePath = getPausePath(itemId2);
|
|
16861
|
-
if (!
|
|
16971
|
+
if (!existsSync40(pausePath)) return false;
|
|
16862
16972
|
try {
|
|
16863
16973
|
unlinkSync5(pausePath);
|
|
16864
16974
|
} catch {
|
|
@@ -17089,13 +17199,13 @@ function spawnHarness(harness, prompt, options2 = {}) {
|
|
|
17089
17199
|
}
|
|
17090
17200
|
|
|
17091
17201
|
// src/commands/backlog/watchForMarker.ts
|
|
17092
|
-
import { existsSync as
|
|
17202
|
+
import { existsSync as existsSync42, unwatchFile, watchFile } from "fs";
|
|
17093
17203
|
|
|
17094
17204
|
// src/commands/backlog/readSignal.ts
|
|
17095
|
-
import { existsSync as
|
|
17205
|
+
import { existsSync as existsSync41, readFileSync as readFileSync25 } from "fs";
|
|
17096
17206
|
function readSignal() {
|
|
17097
17207
|
const path108 = getSignalPath();
|
|
17098
|
-
if (!path108 || !
|
|
17208
|
+
if (!path108 || !existsSync41(path108)) return void 0;
|
|
17099
17209
|
try {
|
|
17100
17210
|
return JSON.parse(readFileSync25(path108, "utf8"));
|
|
17101
17211
|
} catch {
|
|
@@ -17109,7 +17219,7 @@ function watchForMarker(child, options2) {
|
|
|
17109
17219
|
const statusPath = getSignalPath();
|
|
17110
17220
|
if (!statusPath) return { killedOnMarker: () => killed };
|
|
17111
17221
|
watchFile(statusPath, { interval: 1e3 }, () => {
|
|
17112
|
-
if (!
|
|
17222
|
+
if (!existsSync42(statusPath)) return;
|
|
17113
17223
|
const signal = readSignal();
|
|
17114
17224
|
if (!signal) return;
|
|
17115
17225
|
if (signal.event === "done" && !options2?.actOnDone) return;
|
|
@@ -17161,7 +17271,7 @@ function launchPhaseSession(item, phaseNumber, phase, phaseLabel2, claudeSession
|
|
|
17161
17271
|
}
|
|
17162
17272
|
|
|
17163
17273
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
17164
|
-
import { existsSync as
|
|
17274
|
+
import { existsSync as existsSync43, unlinkSync as unlinkSync6 } from "fs";
|
|
17165
17275
|
import chalk73 from "chalk";
|
|
17166
17276
|
|
|
17167
17277
|
// src/commands/backlog/handleIncompletePhase.ts
|
|
@@ -17183,7 +17293,7 @@ async function handleIncompletePhase() {
|
|
|
17183
17293
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
17184
17294
|
function cleanupSignal() {
|
|
17185
17295
|
const statusPath = getSignalPath();
|
|
17186
|
-
if (statusPath &&
|
|
17296
|
+
if (statusPath && existsSync43(statusPath)) {
|
|
17187
17297
|
unlinkSync6(statusPath);
|
|
17188
17298
|
}
|
|
17189
17299
|
}
|
|
@@ -17194,7 +17304,7 @@ async function isTerminalStatus(itemId2) {
|
|
|
17194
17304
|
}
|
|
17195
17305
|
async function resolvePhaseResult(phaseIndex, itemId2) {
|
|
17196
17306
|
const signalPath = getSignalPath();
|
|
17197
|
-
if (!signalPath || !
|
|
17307
|
+
if (!signalPath || !existsSync43(signalPath)) {
|
|
17198
17308
|
if (await isTerminalStatus(itemId2)) return { kind: "abort" };
|
|
17199
17309
|
const action = await handleIncompletePhase();
|
|
17200
17310
|
if (action === "abort") return { kind: "abort" };
|
|
@@ -17275,7 +17385,7 @@ async function persistPhaseSessionId(itemId2, phaseIdx, claudeSessionId) {
|
|
|
17275
17385
|
// src/shared/emitActivity.ts
|
|
17276
17386
|
import { mkdirSync as mkdirSync13, readFileSync as readFileSync26, rmSync as rmSync4, writeFileSync as writeFileSync22 } from "fs";
|
|
17277
17387
|
import { homedir as homedir16 } from "os";
|
|
17278
|
-
import { dirname as dirname26, join as
|
|
17388
|
+
import { dirname as dirname26, join as join48 } from "path";
|
|
17279
17389
|
import { z as z10 } from "zod";
|
|
17280
17390
|
var activitySchema = z10.object({
|
|
17281
17391
|
kind: z10.enum(["command", "backlog"]),
|
|
@@ -17291,7 +17401,7 @@ var activitySchema = z10.object({
|
|
|
17291
17401
|
startedAt: z10.number()
|
|
17292
17402
|
});
|
|
17293
17403
|
function activityPath(sessionId) {
|
|
17294
|
-
return
|
|
17404
|
+
return join48(homedir16(), ".assist", "activity", `activity-${sessionId}.json`);
|
|
17295
17405
|
}
|
|
17296
17406
|
function emitActivity(activity2) {
|
|
17297
17407
|
const sessionId = process.env.ASSIST_ACTIVITY_ID;
|
|
@@ -19930,7 +20040,7 @@ function extractGraphqlQuery(args) {
|
|
|
19930
20040
|
}
|
|
19931
20041
|
|
|
19932
20042
|
// src/shared/loadCliReads.ts
|
|
19933
|
-
import { existsSync as
|
|
20043
|
+
import { existsSync as existsSync44, readFileSync as readFileSync28, writeFileSync as writeFileSync23 } from "fs";
|
|
19934
20044
|
import { dirname as dirname27, resolve as resolve16 } from "path";
|
|
19935
20045
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
19936
20046
|
var __filename3 = fileURLToPath5(import.meta.url);
|
|
@@ -19939,7 +20049,7 @@ function packageRoot() {
|
|
|
19939
20049
|
return __dirname4;
|
|
19940
20050
|
}
|
|
19941
20051
|
function readLines(path108) {
|
|
19942
|
-
if (!
|
|
20052
|
+
if (!existsSync44(path108)) return [];
|
|
19943
20053
|
return readFileSync28(path108, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
19944
20054
|
}
|
|
19945
20055
|
var cachedReads;
|
|
@@ -19986,14 +20096,14 @@ function findCliWrite(command) {
|
|
|
19986
20096
|
}
|
|
19987
20097
|
|
|
19988
20098
|
// src/shared/readSettingsPerms.ts
|
|
19989
|
-
import { existsSync as
|
|
20099
|
+
import { existsSync as existsSync45, readFileSync as readFileSync29 } from "fs";
|
|
19990
20100
|
import { homedir as homedir17 } from "os";
|
|
19991
|
-
import { join as
|
|
20101
|
+
import { join as join49 } from "path";
|
|
19992
20102
|
function readSettingsPerms(key) {
|
|
19993
20103
|
const paths = [
|
|
19994
|
-
|
|
19995
|
-
|
|
19996
|
-
|
|
20104
|
+
join49(homedir17(), ".claude", "settings.json"),
|
|
20105
|
+
join49(process.cwd(), ".claude", "settings.json"),
|
|
20106
|
+
join49(process.cwd(), ".claude", "settings.local.json")
|
|
19997
20107
|
];
|
|
19998
20108
|
const entries = [];
|
|
19999
20109
|
for (const p of paths) {
|
|
@@ -20002,7 +20112,7 @@ function readSettingsPerms(key) {
|
|
|
20002
20112
|
return entries;
|
|
20003
20113
|
}
|
|
20004
20114
|
function readPermissionArray(filePath, key) {
|
|
20005
|
-
if (!
|
|
20115
|
+
if (!existsSync45(filePath)) return [];
|
|
20006
20116
|
try {
|
|
20007
20117
|
const data = JSON.parse(readFileSync29(filePath, "utf8"));
|
|
20008
20118
|
const arr = data?.permissions?.[key];
|
|
@@ -20217,11 +20327,11 @@ function decideCommand(toolName, rawCommand) {
|
|
|
20217
20327
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
20218
20328
|
import { mkdirSync as mkdirSync14 } from "fs";
|
|
20219
20329
|
import { homedir as homedir18 } from "os";
|
|
20220
|
-
import { join as
|
|
20330
|
+
import { join as join50 } from "path";
|
|
20221
20331
|
import Database from "better-sqlite3";
|
|
20222
20332
|
var _db;
|
|
20223
20333
|
function getDbDir() {
|
|
20224
|
-
return
|
|
20334
|
+
return join50(homedir18(), ".assist");
|
|
20225
20335
|
}
|
|
20226
20336
|
function initSchema(db) {
|
|
20227
20337
|
db.exec(`
|
|
@@ -20240,7 +20350,7 @@ function openPromptsDb(dir) {
|
|
|
20240
20350
|
if (_db) return _db;
|
|
20241
20351
|
const dbDir = dir ?? getDbDir();
|
|
20242
20352
|
mkdirSync14(dbDir, { recursive: true });
|
|
20243
|
-
const db = new Database(
|
|
20353
|
+
const db = new Database(join50(dbDir, "assist.db"));
|
|
20244
20354
|
db.pragma("journal_mode = WAL");
|
|
20245
20355
|
initSchema(db);
|
|
20246
20356
|
_db = db;
|
|
@@ -20359,9 +20469,9 @@ ${reasons.join("\n")}`);
|
|
|
20359
20469
|
}
|
|
20360
20470
|
|
|
20361
20471
|
// src/commands/permitCliReads.ts
|
|
20362
|
-
import { existsSync as
|
|
20472
|
+
import { existsSync as existsSync46, mkdirSync as mkdirSync15, readFileSync as readFileSync30, writeFileSync as writeFileSync24 } from "fs";
|
|
20363
20473
|
import { homedir as homedir19 } from "os";
|
|
20364
|
-
import { join as
|
|
20474
|
+
import { join as join51 } from "path";
|
|
20365
20475
|
|
|
20366
20476
|
// src/commands/permitCliReads/assertCliExists.ts
|
|
20367
20477
|
function assertCliExists(cli) {
|
|
@@ -20624,15 +20734,15 @@ function updateSettings(cli, commands) {
|
|
|
20624
20734
|
// src/commands/permitCliReads.ts
|
|
20625
20735
|
function logPath(cli) {
|
|
20626
20736
|
const safeName = cli.replace(/\s+/g, "-");
|
|
20627
|
-
return
|
|
20737
|
+
return join51(homedir19(), ".assist", `cli-discover-${safeName}.log`);
|
|
20628
20738
|
}
|
|
20629
20739
|
function readCache(cli) {
|
|
20630
20740
|
const path108 = logPath(cli);
|
|
20631
|
-
if (!
|
|
20741
|
+
if (!existsSync46(path108)) return void 0;
|
|
20632
20742
|
return readFileSync30(path108, "utf8");
|
|
20633
20743
|
}
|
|
20634
20744
|
function writeCache(cli, output) {
|
|
20635
|
-
const dir =
|
|
20745
|
+
const dir = join51(homedir19(), ".assist");
|
|
20636
20746
|
mkdirSync15(dir, { recursive: true });
|
|
20637
20747
|
writeFileSync24(logPath(cli), output);
|
|
20638
20748
|
}
|
|
@@ -20764,7 +20874,7 @@ function registerCliHook(program) {
|
|
|
20764
20874
|
}
|
|
20765
20875
|
|
|
20766
20876
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
20767
|
-
import { existsSync as
|
|
20877
|
+
import { existsSync as existsSync48, readFileSync as readFileSync32, unlinkSync as unlinkSync8, writeFileSync as writeFileSync25 } from "fs";
|
|
20768
20878
|
import chalk114 from "chalk";
|
|
20769
20879
|
|
|
20770
20880
|
// src/shared/isHashCommentFile.ts
|
|
@@ -20798,28 +20908,28 @@ function isHashCommentFile(filePath) {
|
|
|
20798
20908
|
|
|
20799
20909
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
20800
20910
|
import { homedir as homedir20 } from "os";
|
|
20801
|
-
import { join as
|
|
20911
|
+
import { join as join52 } from "path";
|
|
20802
20912
|
function getRestrictedDir() {
|
|
20803
|
-
return
|
|
20913
|
+
return join52(homedir20(), ".assist", "restricted");
|
|
20804
20914
|
}
|
|
20805
20915
|
function getPinStatePath(pin2) {
|
|
20806
|
-
return
|
|
20916
|
+
return join52(getRestrictedDir(), `code-comment-${pin2}.json`);
|
|
20807
20917
|
}
|
|
20808
20918
|
|
|
20809
20919
|
// src/commands/codeComment/sweepRestrictedDir.ts
|
|
20810
|
-
import { readdirSync as
|
|
20811
|
-
import { join as
|
|
20920
|
+
import { readdirSync as readdirSync7, statSync as statSync7, unlinkSync as unlinkSync7 } from "fs";
|
|
20921
|
+
import { join as join53 } from "path";
|
|
20812
20922
|
var STALE_AFTER_MS = 30 * 60 * 1e3;
|
|
20813
20923
|
function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
20814
20924
|
let entries;
|
|
20815
20925
|
try {
|
|
20816
|
-
entries =
|
|
20926
|
+
entries = readdirSync7(dir);
|
|
20817
20927
|
} catch {
|
|
20818
20928
|
return;
|
|
20819
20929
|
}
|
|
20820
20930
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
20821
20931
|
for (const entry of entries) {
|
|
20822
|
-
const path108 =
|
|
20932
|
+
const path108 = join53(dir, entry);
|
|
20823
20933
|
try {
|
|
20824
20934
|
if (statSync7(path108).mtimeMs < cutoff) unlinkSync7(path108);
|
|
20825
20935
|
} catch {
|
|
@@ -20829,10 +20939,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
20829
20939
|
}
|
|
20830
20940
|
|
|
20831
20941
|
// src/commands/codeComment/readPinState.ts
|
|
20832
|
-
import { existsSync as
|
|
20942
|
+
import { existsSync as existsSync47, readFileSync as readFileSync31 } from "fs";
|
|
20833
20943
|
function readPinState(pin2) {
|
|
20834
20944
|
const path108 = getPinStatePath(pin2);
|
|
20835
|
-
if (!
|
|
20945
|
+
if (!existsSync47(path108)) return void 0;
|
|
20836
20946
|
try {
|
|
20837
20947
|
const state = JSON.parse(readFileSync31(path108, "utf8"));
|
|
20838
20948
|
if (state.pin !== pin2) return void 0;
|
|
@@ -20851,7 +20961,7 @@ function codeCommentConfirm(pin2) {
|
|
|
20851
20961
|
process.exitCode = 1;
|
|
20852
20962
|
return;
|
|
20853
20963
|
}
|
|
20854
|
-
if (!
|
|
20964
|
+
if (!existsSync48(state.file)) {
|
|
20855
20965
|
console.error(chalk114.red(`Target file no longer exists: ${state.file}`));
|
|
20856
20966
|
process.exitCode = 1;
|
|
20857
20967
|
return;
|
|
@@ -22473,10 +22583,20 @@ function coerceCliConfigValue(key, raw) {
|
|
|
22473
22583
|
const leaf = describeConfigLeaves(assistConfigSchema).find(
|
|
22474
22584
|
(candidate) => candidate.key === key
|
|
22475
22585
|
);
|
|
22476
|
-
if (!leaf) return
|
|
22586
|
+
if (!leaf) return coerceIndexedValue(key, raw);
|
|
22477
22587
|
if (leaf.itemType) return coerceConfigValue(key, splitList(raw));
|
|
22478
22588
|
return coerceConfigValue(key, raw);
|
|
22479
22589
|
}
|
|
22590
|
+
function coerceIndexedValue(key, raw) {
|
|
22591
|
+
const node = configKeyNode(key.replace(/\.(\d+)(?=\.|$)/g, "[$1]"));
|
|
22592
|
+
if (node?.kind !== "scalar")
|
|
22593
|
+
return { ok: true, value: coerceWithoutSchemaLeaf(raw) };
|
|
22594
|
+
return coerceUnion(
|
|
22595
|
+
key,
|
|
22596
|
+
raw,
|
|
22597
|
+
node.type === "union" ? node.unionTypes ?? [] : [node.type]
|
|
22598
|
+
);
|
|
22599
|
+
}
|
|
22480
22600
|
function splitList(raw) {
|
|
22481
22601
|
return raw.split(",").map((item) => item.trim()).filter((item) => item !== "");
|
|
22482
22602
|
}
|
|
@@ -22650,14 +22770,14 @@ import { cp } from "fs/promises";
|
|
|
22650
22770
|
import chalk138 from "chalk";
|
|
22651
22771
|
|
|
22652
22772
|
// src/commands/extension/extensionDir.ts
|
|
22653
|
-
import { existsSync as
|
|
22654
|
-
import { dirname as dirname28, join as
|
|
22773
|
+
import { existsSync as existsSync49 } from "fs";
|
|
22774
|
+
import { dirname as dirname28, join as join54 } from "path";
|
|
22655
22775
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
22656
22776
|
var moduleDir = dirname28(fileURLToPath6(import.meta.url));
|
|
22657
22777
|
function extensionDir() {
|
|
22658
|
-
const bundled =
|
|
22659
|
-
if (
|
|
22660
|
-
return
|
|
22778
|
+
const bundled = join54(moduleDir, "commands", "extension", "extension");
|
|
22779
|
+
if (existsSync49(bundled)) return bundled;
|
|
22780
|
+
return join54(moduleDir, "..", "..", "..", "extension");
|
|
22661
22781
|
}
|
|
22662
22782
|
|
|
22663
22783
|
// src/commands/extension/extension.ts
|
|
@@ -22683,7 +22803,7 @@ async function extension() {
|
|
|
22683
22803
|
|
|
22684
22804
|
// src/commands/extension/printExtensionUrl.ts
|
|
22685
22805
|
import { readFile as readFile4 } from "fs/promises";
|
|
22686
|
-
import { join as
|
|
22806
|
+
import { join as join55 } from "path";
|
|
22687
22807
|
import chalk139 from "chalk";
|
|
22688
22808
|
|
|
22689
22809
|
// src/commands/extension/latestUpdate.ts
|
|
@@ -22700,7 +22820,7 @@ function latestUpdateLink(manifest, updates2) {
|
|
|
22700
22820
|
// src/commands/extension/printExtensionUrl.ts
|
|
22701
22821
|
async function printExtensionUrl() {
|
|
22702
22822
|
const manifest = await readFile4(
|
|
22703
|
-
|
|
22823
|
+
join55(extensionDir(), "manifest.json"),
|
|
22704
22824
|
"utf8"
|
|
22705
22825
|
);
|
|
22706
22826
|
const { update_url } = JSON.parse(manifest).browser_specific_settings.gecko;
|
|
@@ -22717,28 +22837,28 @@ async function printExtensionUrl() {
|
|
|
22717
22837
|
// src/commands/extension/signExtension.ts
|
|
22718
22838
|
import { rm as rm2 } from "fs/promises";
|
|
22719
22839
|
import { homedir as homedir21, tmpdir as tmpdir3 } from "os";
|
|
22720
|
-
import { join as
|
|
22840
|
+
import { join as join61 } from "path";
|
|
22721
22841
|
import chalk141 from "chalk";
|
|
22722
22842
|
|
|
22723
22843
|
// src/commands/extension/copySignedXpi.ts
|
|
22724
22844
|
import { copyFile } from "fs/promises";
|
|
22725
|
-
import { join as
|
|
22845
|
+
import { join as join56 } from "path";
|
|
22726
22846
|
var SIGNED_XPI_NAME = "assist-extension.xpi";
|
|
22727
22847
|
async function copySignedXpi(xpi, dir) {
|
|
22728
|
-
const fixed2 =
|
|
22848
|
+
const fixed2 = join56(dir, SIGNED_XPI_NAME);
|
|
22729
22849
|
if (fixed2 === xpi) return fixed2;
|
|
22730
22850
|
await copyFile(xpi, fixed2);
|
|
22731
22851
|
return fixed2;
|
|
22732
22852
|
}
|
|
22733
22853
|
|
|
22734
22854
|
// src/commands/extension/findSignedXpi.ts
|
|
22735
|
-
import { existsSync as
|
|
22855
|
+
import { existsSync as existsSync50 } from "fs";
|
|
22736
22856
|
import { readdir } from "fs/promises";
|
|
22737
|
-
import { join as
|
|
22857
|
+
import { join as join57 } from "path";
|
|
22738
22858
|
async function findSignedXpi(dir) {
|
|
22739
|
-
if (!
|
|
22859
|
+
if (!existsSync50(dir)) return null;
|
|
22740
22860
|
const name = (await readdir(dir)).find((entry) => entry.endsWith(".xpi"));
|
|
22741
|
-
return name ?
|
|
22861
|
+
return name ? join57(dir, name) : null;
|
|
22742
22862
|
}
|
|
22743
22863
|
|
|
22744
22864
|
// src/commands/extension/signedAddonInstallPath.ts
|
|
@@ -22760,11 +22880,11 @@ async function signedAddonInstallPath(xpi) {
|
|
|
22760
22880
|
}
|
|
22761
22881
|
|
|
22762
22882
|
// src/commands/extension/signPreflightProblem.ts
|
|
22763
|
-
import { existsSync as
|
|
22764
|
-
import { join as
|
|
22883
|
+
import { existsSync as existsSync51 } from "fs";
|
|
22884
|
+
import { join as join58 } from "path";
|
|
22765
22885
|
var KEY_URL = "https://addons.mozilla.org/en-US/developers/addon/api/key/";
|
|
22766
22886
|
function signPreflightProblem(source) {
|
|
22767
|
-
if (!
|
|
22887
|
+
if (!existsSync51(join58(source, "content.js")))
|
|
22768
22888
|
return {
|
|
22769
22889
|
message: `no content.js in ${source}`,
|
|
22770
22890
|
hint: "run npm run build to bundle the content script"
|
|
@@ -22779,7 +22899,7 @@ function signPreflightProblem(source) {
|
|
|
22779
22899
|
|
|
22780
22900
|
// src/commands/extension/stageExtension.ts
|
|
22781
22901
|
import { cp as cp3, mkdir as mkdir5, readFile as readFile5, rm, writeFile as writeFile4 } from "fs/promises";
|
|
22782
|
-
import { basename as basename14, join as
|
|
22902
|
+
import { basename as basename14, join as join59 } from "path";
|
|
22783
22903
|
|
|
22784
22904
|
// src/commands/extension/stampManifestVersion.ts
|
|
22785
22905
|
function stampManifestVersion(manifest, version2) {
|
|
@@ -22796,7 +22916,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
22796
22916
|
recursive: true,
|
|
22797
22917
|
filter: (path108) => basename14(path108) !== "updates.json"
|
|
22798
22918
|
});
|
|
22799
|
-
const manifest =
|
|
22919
|
+
const manifest = join59(staging, "manifest.json");
|
|
22800
22920
|
const stamped = stampManifestVersion(
|
|
22801
22921
|
await readFile5(manifest, "utf8"),
|
|
22802
22922
|
version2
|
|
@@ -22806,7 +22926,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
22806
22926
|
|
|
22807
22927
|
// src/commands/extension/writeUpdateManifest.ts
|
|
22808
22928
|
import { readFile as readFile6, writeFile as writeFile5 } from "fs/promises";
|
|
22809
|
-
import { join as
|
|
22929
|
+
import { join as join60 } from "path";
|
|
22810
22930
|
|
|
22811
22931
|
// src/commands/extension/buildUpdateManifest.ts
|
|
22812
22932
|
var RELEASE_DOWNLOAD_URL = "https://github.com/staff0rd/assist/releases/download";
|
|
@@ -22831,17 +22951,17 @@ function buildUpdateManifest(manifest, version2) {
|
|
|
22831
22951
|
// src/commands/extension/writeUpdateManifest.ts
|
|
22832
22952
|
async function writeUpdateManifest(source, dir, version2) {
|
|
22833
22953
|
await writeFile5(
|
|
22834
|
-
|
|
22954
|
+
join60(dir, "updates.json"),
|
|
22835
22955
|
buildUpdateManifest(
|
|
22836
|
-
await readFile6(
|
|
22956
|
+
await readFile6(join60(source, "manifest.json"), "utf8"),
|
|
22837
22957
|
version2
|
|
22838
22958
|
)
|
|
22839
22959
|
);
|
|
22840
22960
|
}
|
|
22841
22961
|
|
|
22842
22962
|
// src/commands/extension/signExtension.ts
|
|
22843
|
-
var ARTIFACTS_DIR =
|
|
22844
|
-
var STAGING_DIR =
|
|
22963
|
+
var ARTIFACTS_DIR = join61(homedir21(), ".assist", "extension");
|
|
22964
|
+
var STAGING_DIR = join61(tmpdir3(), "assist-extension");
|
|
22845
22965
|
async function signExtension() {
|
|
22846
22966
|
const source = extensionDir();
|
|
22847
22967
|
const problem = signPreflightProblem(source);
|
|
@@ -23029,19 +23149,19 @@ import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync27 } from "fs"
|
|
|
23029
23149
|
import chalk144 from "chalk";
|
|
23030
23150
|
|
|
23031
23151
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
23032
|
-
import { join as
|
|
23152
|
+
import { join as join62 } from "path";
|
|
23033
23153
|
function getMigrationPinPath(pin2) {
|
|
23034
|
-
return
|
|
23154
|
+
return join62(getRestrictedDir(), `db-migration-pin-${pin2}.json`);
|
|
23035
23155
|
}
|
|
23036
23156
|
function getMigrationApprovalPath(migrationId) {
|
|
23037
|
-
return
|
|
23157
|
+
return join62(getRestrictedDir(), `db-migration-approval-${migrationId}.json`);
|
|
23038
23158
|
}
|
|
23039
23159
|
|
|
23040
23160
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
23041
|
-
import { existsSync as
|
|
23161
|
+
import { existsSync as existsSync52, readFileSync as readFileSync33 } from "fs";
|
|
23042
23162
|
function readMigrationPinState(pin2) {
|
|
23043
23163
|
const path108 = getMigrationPinPath(pin2);
|
|
23044
|
-
if (!
|
|
23164
|
+
if (!existsSync52(path108)) return void 0;
|
|
23045
23165
|
try {
|
|
23046
23166
|
const state = JSON.parse(readFileSync33(path108, "utf8"));
|
|
23047
23167
|
if (state.pin !== pin2) return void 0;
|
|
@@ -23130,7 +23250,7 @@ function registerDbMigration(parent) {
|
|
|
23130
23250
|
}
|
|
23131
23251
|
|
|
23132
23252
|
// src/commands/deploy/redirect.ts
|
|
23133
|
-
import { existsSync as
|
|
23253
|
+
import { existsSync as existsSync53, readFileSync as readFileSync34, writeFileSync as writeFileSync29 } from "fs";
|
|
23134
23254
|
import chalk146 from "chalk";
|
|
23135
23255
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
23136
23256
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -23139,7 +23259,7 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
23139
23259
|
</script>`;
|
|
23140
23260
|
function redirect() {
|
|
23141
23261
|
const indexPath = "index.html";
|
|
23142
|
-
if (!
|
|
23262
|
+
if (!existsSync53(indexPath)) {
|
|
23143
23263
|
console.log(chalk146.yellow("No index.html found"));
|
|
23144
23264
|
return;
|
|
23145
23265
|
}
|
|
@@ -23172,10 +23292,10 @@ import { basename as basename16 } from "path";
|
|
|
23172
23292
|
|
|
23173
23293
|
// src/commands/devlog/loadBlogSkipDays.ts
|
|
23174
23294
|
import { homedir as homedir22 } from "os";
|
|
23175
|
-
import { join as
|
|
23176
|
-
var BLOG_REPO_ROOT =
|
|
23295
|
+
import { join as join63 } from "path";
|
|
23296
|
+
var BLOG_REPO_ROOT = join63(homedir22(), "git/blog");
|
|
23177
23297
|
function loadBlogSkipDays(repoName) {
|
|
23178
|
-
const config = loadRawYaml(
|
|
23298
|
+
const config = loadRawYaml(join63(BLOG_REPO_ROOT, "assist.yml"));
|
|
23179
23299
|
const devlog = config.devlog;
|
|
23180
23300
|
const skip3 = devlog?.skip;
|
|
23181
23301
|
return new Set(skip3?.[repoName]);
|
|
@@ -23186,15 +23306,15 @@ import { execSync as execSync31 } from "child_process";
|
|
|
23186
23306
|
import chalk147 from "chalk";
|
|
23187
23307
|
|
|
23188
23308
|
// src/shared/getRepoName.ts
|
|
23189
|
-
import { existsSync as
|
|
23190
|
-
import { basename as basename15, join as
|
|
23309
|
+
import { existsSync as existsSync54, readFileSync as readFileSync35 } from "fs";
|
|
23310
|
+
import { basename as basename15, join as join64 } from "path";
|
|
23191
23311
|
function getRepoName() {
|
|
23192
23312
|
const config = loadConfig();
|
|
23193
23313
|
if (config.devlog?.name) {
|
|
23194
23314
|
return config.devlog.name;
|
|
23195
23315
|
}
|
|
23196
|
-
const packageJsonPath =
|
|
23197
|
-
if (
|
|
23316
|
+
const packageJsonPath = join64(process.cwd(), "package.json");
|
|
23317
|
+
if (existsSync54(packageJsonPath)) {
|
|
23198
23318
|
try {
|
|
23199
23319
|
const content = readFileSync35(packageJsonPath, "utf8");
|
|
23200
23320
|
const pkg = JSON.parse(content);
|
|
@@ -23208,9 +23328,9 @@ function getRepoName() {
|
|
|
23208
23328
|
}
|
|
23209
23329
|
|
|
23210
23330
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
23211
|
-
import { readdirSync as
|
|
23212
|
-
import { join as
|
|
23213
|
-
var DEVLOG_DIR =
|
|
23331
|
+
import { readdirSync as readdirSync8, readFileSync as readFileSync36 } from "fs";
|
|
23332
|
+
import { join as join65 } from "path";
|
|
23333
|
+
var DEVLOG_DIR = join65(BLOG_REPO_ROOT, "src/content/devlog");
|
|
23214
23334
|
function extractFrontmatter(content) {
|
|
23215
23335
|
const fm = content.match(/^---\n([\s\S]*?)\n---/);
|
|
23216
23336
|
return fm?.[1] ?? null;
|
|
@@ -23236,9 +23356,9 @@ function parseFrontmatter(content, filename) {
|
|
|
23236
23356
|
}
|
|
23237
23357
|
function readDevlogFiles(callback) {
|
|
23238
23358
|
try {
|
|
23239
|
-
const files =
|
|
23359
|
+
const files = readdirSync8(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
23240
23360
|
for (const file of files) {
|
|
23241
|
-
const content = readFileSync36(
|
|
23361
|
+
const content = readFileSync36(join65(DEVLOG_DIR, file), "utf8");
|
|
23242
23362
|
const parsed = parseFrontmatter(content, file);
|
|
23243
23363
|
if (parsed) callback(parsed);
|
|
23244
23364
|
}
|
|
@@ -23626,11 +23746,11 @@ function repos(options2) {
|
|
|
23626
23746
|
|
|
23627
23747
|
// src/commands/devlog/skip.ts
|
|
23628
23748
|
import { writeFileSync as writeFileSync30 } from "fs";
|
|
23629
|
-
import { join as
|
|
23749
|
+
import { join as join66 } from "path";
|
|
23630
23750
|
import chalk152 from "chalk";
|
|
23631
23751
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
23632
23752
|
function getBlogConfigPath() {
|
|
23633
|
-
return
|
|
23753
|
+
return join66(BLOG_REPO_ROOT, "assist.yml");
|
|
23634
23754
|
}
|
|
23635
23755
|
function skip2(date) {
|
|
23636
23756
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
@@ -23691,20 +23811,20 @@ function registerDevlog(program) {
|
|
|
23691
23811
|
}
|
|
23692
23812
|
|
|
23693
23813
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
23694
|
-
import { closeSync as closeSync4, openSync as openSync5, readdirSync as
|
|
23695
|
-
import { join as
|
|
23814
|
+
import { closeSync as closeSync4, openSync as openSync5, readdirSync as readdirSync9 } from "fs";
|
|
23815
|
+
import { join as join67 } from "path";
|
|
23696
23816
|
import chalk154 from "chalk";
|
|
23697
23817
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
23698
23818
|
function isLockedDll(debugDir) {
|
|
23699
23819
|
let files;
|
|
23700
23820
|
try {
|
|
23701
|
-
files =
|
|
23821
|
+
files = readdirSync9(debugDir, { recursive: true });
|
|
23702
23822
|
} catch {
|
|
23703
23823
|
return null;
|
|
23704
23824
|
}
|
|
23705
23825
|
for (const file of files) {
|
|
23706
23826
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
23707
|
-
const dllPath =
|
|
23827
|
+
const dllPath = join67(debugDir, file);
|
|
23708
23828
|
try {
|
|
23709
23829
|
const fd = openSync5(dllPath, "r+");
|
|
23710
23830
|
closeSync4(fd);
|
|
@@ -23717,18 +23837,18 @@ function isLockedDll(debugDir) {
|
|
|
23717
23837
|
function findFirstLockedDll(dir) {
|
|
23718
23838
|
let entries;
|
|
23719
23839
|
try {
|
|
23720
|
-
entries =
|
|
23840
|
+
entries = readdirSync9(dir);
|
|
23721
23841
|
} catch {
|
|
23722
23842
|
return null;
|
|
23723
23843
|
}
|
|
23724
23844
|
if (entries.includes("bin")) {
|
|
23725
|
-
const locked = isLockedDll(
|
|
23845
|
+
const locked = isLockedDll(join67(dir, "bin", "Debug"));
|
|
23726
23846
|
if (locked) return locked;
|
|
23727
23847
|
}
|
|
23728
23848
|
for (const entry of entries) {
|
|
23729
23849
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
23730
23850
|
continue;
|
|
23731
|
-
const found = findFirstLockedDll(
|
|
23851
|
+
const found = findFirstLockedDll(join67(dir, entry));
|
|
23732
23852
|
if (found) return found;
|
|
23733
23853
|
}
|
|
23734
23854
|
return null;
|
|
@@ -23797,14 +23917,14 @@ function collectAllDeps(node) {
|
|
|
23797
23917
|
}
|
|
23798
23918
|
|
|
23799
23919
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
23800
|
-
import { readdirSync as
|
|
23920
|
+
import { readdirSync as readdirSync10, readFileSync as readFileSync38, statSync as statSync8 } from "fs";
|
|
23801
23921
|
import path36 from "path";
|
|
23802
23922
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
23803
23923
|
if (depth > maxDepth) return [];
|
|
23804
23924
|
const results = [];
|
|
23805
23925
|
let entries;
|
|
23806
23926
|
try {
|
|
23807
|
-
entries =
|
|
23927
|
+
entries = readdirSync10(dir);
|
|
23808
23928
|
} catch {
|
|
23809
23929
|
return results;
|
|
23810
23930
|
}
|
|
@@ -23896,12 +24016,12 @@ function printJson(tree, totalCount, solutions) {
|
|
|
23896
24016
|
}
|
|
23897
24017
|
|
|
23898
24018
|
// src/commands/dotnet/resolveCsproj.ts
|
|
23899
|
-
import { existsSync as
|
|
24019
|
+
import { existsSync as existsSync55 } from "fs";
|
|
23900
24020
|
import path37 from "path";
|
|
23901
24021
|
import chalk156 from "chalk";
|
|
23902
24022
|
function resolveCsproj(csprojPath) {
|
|
23903
24023
|
const resolved = path37.resolve(csprojPath);
|
|
23904
|
-
if (!
|
|
24024
|
+
if (!existsSync55(resolved)) {
|
|
23905
24025
|
console.error(chalk156.red(`File not found: ${resolved}`));
|
|
23906
24026
|
process.exit(1);
|
|
23907
24027
|
}
|
|
@@ -24069,17 +24189,17 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
24069
24189
|
}
|
|
24070
24190
|
|
|
24071
24191
|
// src/commands/dotnet/resolveSolution.ts
|
|
24072
|
-
import { existsSync as
|
|
24192
|
+
import { existsSync as existsSync56 } from "fs";
|
|
24073
24193
|
import path38 from "path";
|
|
24074
24194
|
import chalk160 from "chalk";
|
|
24075
24195
|
|
|
24076
24196
|
// src/commands/dotnet/findSolution.ts
|
|
24077
|
-
import { readdirSync as
|
|
24078
|
-
import { dirname as dirname29, join as
|
|
24197
|
+
import { readdirSync as readdirSync11 } from "fs";
|
|
24198
|
+
import { dirname as dirname29, join as join68 } from "path";
|
|
24079
24199
|
import chalk159 from "chalk";
|
|
24080
24200
|
function findSlnInDir(dir) {
|
|
24081
24201
|
try {
|
|
24082
|
-
return
|
|
24202
|
+
return readdirSync11(dir).filter((f) => f.endsWith(".sln")).map((f) => join68(dir, f));
|
|
24083
24203
|
} catch {
|
|
24084
24204
|
return [];
|
|
24085
24205
|
}
|
|
@@ -24110,7 +24230,7 @@ function findSolution() {
|
|
|
24110
24230
|
function resolveSolution(sln) {
|
|
24111
24231
|
if (sln) {
|
|
24112
24232
|
const resolved = path38.resolve(sln);
|
|
24113
|
-
if (!
|
|
24233
|
+
if (!existsSync56(resolved)) {
|
|
24114
24234
|
console.error(chalk160.red(`Solution file not found: ${resolved}`));
|
|
24115
24235
|
process.exit(1);
|
|
24116
24236
|
}
|
|
@@ -24150,7 +24270,7 @@ function parseInspectReport(json) {
|
|
|
24150
24270
|
|
|
24151
24271
|
// src/commands/dotnet/runInspectCode.ts
|
|
24152
24272
|
import { execSync as execSync35 } from "child_process";
|
|
24153
|
-
import { existsSync as
|
|
24273
|
+
import { existsSync as existsSync57, readFileSync as readFileSync39, unlinkSync as unlinkSync10 } from "fs";
|
|
24154
24274
|
import { tmpdir as tmpdir4 } from "os";
|
|
24155
24275
|
import path39 from "path";
|
|
24156
24276
|
import chalk161 from "chalk";
|
|
@@ -24181,7 +24301,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
24181
24301
|
console.error(chalk161.red("jb inspectcode failed"));
|
|
24182
24302
|
process.exit(1);
|
|
24183
24303
|
}
|
|
24184
|
-
if (!
|
|
24304
|
+
if (!existsSync57(reportPath)) {
|
|
24185
24305
|
console.error(chalk161.red("Report file not generated"));
|
|
24186
24306
|
process.exit(1);
|
|
24187
24307
|
}
|
|
@@ -24950,11 +25070,11 @@ function decideCommentGuard(input, existingContent) {
|
|
|
24950
25070
|
}
|
|
24951
25071
|
|
|
24952
25072
|
// src/commands/dbMigration/consumeMigrationApproval.ts
|
|
24953
|
-
import { existsSync as
|
|
25073
|
+
import { existsSync as existsSync58, unlinkSync as unlinkSync11 } from "fs";
|
|
24954
25074
|
function consumeMigrationApproval(migrationId) {
|
|
24955
25075
|
sweepRestrictedDir();
|
|
24956
25076
|
const path108 = getMigrationApprovalPath(migrationId);
|
|
24957
|
-
if (!
|
|
25077
|
+
if (!existsSync58(path108)) return false;
|
|
24958
25078
|
try {
|
|
24959
25079
|
unlinkSync11(path108);
|
|
24960
25080
|
return true;
|
|
@@ -25077,7 +25197,7 @@ function aggregateCommitters(authorLists) {
|
|
|
25077
25197
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
25078
25198
|
import { unlinkSync as unlinkSync12, writeFileSync as writeFileSync31 } from "fs";
|
|
25079
25199
|
import { tmpdir as tmpdir5 } from "os";
|
|
25080
|
-
import { join as
|
|
25200
|
+
import { join as join69 } from "path";
|
|
25081
25201
|
function buildArgs2(queryFile, vars) {
|
|
25082
25202
|
const args = ["api", "graphql", "-F", `query=@${queryFile}`];
|
|
25083
25203
|
for (const [key, value] of Object.entries(vars)) {
|
|
@@ -25087,7 +25207,7 @@ function buildArgs2(queryFile, vars) {
|
|
|
25087
25207
|
return args;
|
|
25088
25208
|
}
|
|
25089
25209
|
function runGhGraphql(mutation, vars) {
|
|
25090
|
-
const queryFile =
|
|
25210
|
+
const queryFile = join69(tmpdir5(), `gh-query-${Date.now()}.graphql`);
|
|
25091
25211
|
writeFileSync31(queryFile, mutation);
|
|
25092
25212
|
try {
|
|
25093
25213
|
const result = spawnSync6("gh", buildArgs2(queryFile, vars), {
|
|
@@ -26194,8 +26314,8 @@ var pinnedPr;
|
|
|
26194
26314
|
function getPinnedPr() {
|
|
26195
26315
|
return pinnedPr;
|
|
26196
26316
|
}
|
|
26197
|
-
function currentPrSelector(
|
|
26198
|
-
return pinnedPr === void 0 ?
|
|
26317
|
+
function currentPrSelector(currentBranch6) {
|
|
26318
|
+
return pinnedPr === void 0 ? currentBranch6() : String(pinnedPr);
|
|
26199
26319
|
}
|
|
26200
26320
|
|
|
26201
26321
|
// src/commands/prs/shared.ts
|
|
@@ -26552,14 +26672,14 @@ function slugFromUrl(url) {
|
|
|
26552
26672
|
import { mkdirSync as mkdirSync18, writeFileSync as writeFileSync32 } from "fs";
|
|
26553
26673
|
|
|
26554
26674
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
26555
|
-
import { join as
|
|
26675
|
+
import { join as join70 } from "path";
|
|
26556
26676
|
function issueWorkingFile(slug2, number) {
|
|
26557
26677
|
const [owner = "unknown", repo = "unknown"] = slug2.split("/");
|
|
26558
|
-
const dir =
|
|
26678
|
+
const dir = join70(getStoreDir(), "github-issues", owner, repo);
|
|
26559
26679
|
return {
|
|
26560
26680
|
dir,
|
|
26561
|
-
bodyPath:
|
|
26562
|
-
metaPath:
|
|
26681
|
+
bodyPath: join70(dir, `${number}.md`),
|
|
26682
|
+
metaPath: join70(dir, `${number}.json`)
|
|
26563
26683
|
};
|
|
26564
26684
|
}
|
|
26565
26685
|
|
|
@@ -26594,10 +26714,10 @@ function fetchIssueToWorkingFile(number, repo) {
|
|
|
26594
26714
|
}
|
|
26595
26715
|
|
|
26596
26716
|
// src/commands/github/issue/resumeIssueBody.ts
|
|
26597
|
-
import { existsSync as
|
|
26717
|
+
import { existsSync as existsSync59, readFileSync as readFileSync40 } from "fs";
|
|
26598
26718
|
function resumeIssueBody(slug2, number, updatedAt) {
|
|
26599
26719
|
const { bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
26600
|
-
if (!
|
|
26720
|
+
if (!existsSync59(bodyPath) || !existsSync59(metaPath)) return void 0;
|
|
26601
26721
|
try {
|
|
26602
26722
|
const meta = JSON.parse(readFileSync40(metaPath, "utf8"));
|
|
26603
26723
|
if (meta.updatedAt !== updatedAt) return void 0;
|
|
@@ -27192,8 +27312,7 @@ function registerRefineLaunch(program, resumeFlag) {
|
|
|
27192
27312
|
import { randomUUID as randomUUID11 } from "crypto";
|
|
27193
27313
|
|
|
27194
27314
|
// src/commands/review/checkoutPr.ts
|
|
27195
|
-
import { execFileSync as
|
|
27196
|
-
import chalk171 from "chalk";
|
|
27315
|
+
import { execFileSync as execFileSync19 } from "child_process";
|
|
27197
27316
|
|
|
27198
27317
|
// src/commands/review/clearStalePrBranch.ts
|
|
27199
27318
|
var tipSetFromRemote = /^branch: (Created from|Reset to)|^fetch\b|: Fast-forward$/;
|
|
@@ -27249,7 +27368,7 @@ function recentDaemonLogLines(includeRelayed = true) {
|
|
|
27249
27368
|
}
|
|
27250
27369
|
|
|
27251
27370
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
27252
|
-
import { existsSync as
|
|
27371
|
+
import { existsSync as existsSync60 } from "fs";
|
|
27253
27372
|
import { basename as basename19, dirname as dirname31 } from "path";
|
|
27254
27373
|
|
|
27255
27374
|
// src/commands/watch/fetchQuietly.ts
|
|
@@ -27269,11 +27388,11 @@ function fetchQuietly(cwd, intervalMs) {
|
|
|
27269
27388
|
}
|
|
27270
27389
|
|
|
27271
27390
|
// src/commands/sessions/daemon/worktree/nextWorktreePath.ts
|
|
27272
|
-
import { basename as basename18, join as
|
|
27391
|
+
import { basename as basename18, join as join71 } from "path";
|
|
27273
27392
|
function nextWorktreePath(clone, base, isTaken) {
|
|
27274
27393
|
const name = basename18(clone);
|
|
27275
27394
|
for (let n = 2; n < 1e3; n++) {
|
|
27276
|
-
const candidate =
|
|
27395
|
+
const candidate = join71(base, `${name}-${n}`);
|
|
27277
27396
|
if (!isTaken(candidate)) return candidate;
|
|
27278
27397
|
}
|
|
27279
27398
|
throw new Error(`no free worktree suffix for ${clone}`);
|
|
@@ -27296,7 +27415,7 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
27296
27415
|
const base = strategy.root ? expandTilde(strategy.root) : dirname31(clone);
|
|
27297
27416
|
const registered = new Set(listWorktreePaths(clone));
|
|
27298
27417
|
const branches = new Set(listLocalBranches(clone));
|
|
27299
|
-
const isTaken = (candidate) => registered.has(candidate) ||
|
|
27418
|
+
const isTaken = (candidate) => registered.has(candidate) || existsSync60(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename19(candidate));
|
|
27300
27419
|
const path108 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
27301
27420
|
const fetchError = fetchQuietly(clone, 0);
|
|
27302
27421
|
if (fetchError)
|
|
@@ -27525,20 +27644,20 @@ function persistedTreeRoots() {
|
|
|
27525
27644
|
}
|
|
27526
27645
|
|
|
27527
27646
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
27528
|
-
import { copyFileSync, existsSync as
|
|
27529
|
-
import { dirname as dirname32, join as
|
|
27647
|
+
import { copyFileSync, existsSync as existsSync62, mkdirSync as mkdirSync19 } from "fs";
|
|
27648
|
+
import { dirname as dirname32, join as join73 } from "path";
|
|
27530
27649
|
|
|
27531
27650
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
27532
27651
|
import { resolve as resolve18 } from "path";
|
|
27533
27652
|
|
|
27534
27653
|
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
27535
|
-
import { existsSync as
|
|
27536
|
-
import { join as
|
|
27654
|
+
import { existsSync as existsSync61 } from "fs";
|
|
27655
|
+
import { join as join72 } from "path";
|
|
27537
27656
|
function detectInstallCommand(dir) {
|
|
27538
|
-
if (!
|
|
27539
|
-
if (
|
|
27540
|
-
if (
|
|
27541
|
-
if (
|
|
27657
|
+
if (!existsSync61(join72(dir, "package.json"))) return null;
|
|
27658
|
+
if (existsSync61(join72(dir, "pnpm-lock.yaml"))) return "pnpm install";
|
|
27659
|
+
if (existsSync61(join72(dir, "yarn.lock"))) return "yarn install";
|
|
27660
|
+
if (existsSync61(join72(dir, "bun.lockb"))) return "bun install";
|
|
27542
27661
|
return "npm install";
|
|
27543
27662
|
}
|
|
27544
27663
|
|
|
@@ -27703,9 +27822,9 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
27703
27822
|
}
|
|
27704
27823
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
27705
27824
|
for (const rel of copy) {
|
|
27706
|
-
const src =
|
|
27707
|
-
if (!
|
|
27708
|
-
const dest =
|
|
27825
|
+
const src = join73(clone, rel);
|
|
27826
|
+
if (!existsSync62(src)) continue;
|
|
27827
|
+
const dest = join73(worktreePath, rel);
|
|
27709
27828
|
try {
|
|
27710
27829
|
mkdirSync19(dirname32(dest), { recursive: true });
|
|
27711
27830
|
copyFileSync(src, dest);
|
|
@@ -27742,16 +27861,71 @@ async function moveToPrCheckoutTree() {
|
|
|
27742
27861
|
if (alloc.created && alloc.clone) await seed(alloc.cwd, alloc.clone);
|
|
27743
27862
|
}
|
|
27744
27863
|
|
|
27864
|
+
// src/commands/review/azureDevopsRemote.ts
|
|
27865
|
+
function azureDevopsRemote(cwd) {
|
|
27866
|
+
const url = remoteUrl(cwd).url;
|
|
27867
|
+
return url ? parseAzureDevopsRemote(url) : null;
|
|
27868
|
+
}
|
|
27869
|
+
|
|
27870
|
+
// src/commands/review/prCliCommands.ts
|
|
27871
|
+
var HEADS = "refs/heads/";
|
|
27872
|
+
function branchFromRef(stdout) {
|
|
27873
|
+
const ref = stdout.trim();
|
|
27874
|
+
return (ref.startsWith(HEADS) ? ref.slice(HEADS.length) : ref) || null;
|
|
27875
|
+
}
|
|
27876
|
+
function prCliCommands(number, cwd) {
|
|
27877
|
+
const azure = azureDevopsRemote(cwd);
|
|
27878
|
+
if (!azure)
|
|
27879
|
+
return {
|
|
27880
|
+
headBranch: {
|
|
27881
|
+
file: "gh",
|
|
27882
|
+
args: [
|
|
27883
|
+
"pr",
|
|
27884
|
+
"view",
|
|
27885
|
+
number,
|
|
27886
|
+
"--json",
|
|
27887
|
+
"headRefName",
|
|
27888
|
+
"-q",
|
|
27889
|
+
".headRefName"
|
|
27890
|
+
],
|
|
27891
|
+
parse: (stdout) => stdout.trim() || null
|
|
27892
|
+
},
|
|
27893
|
+
checkout: { file: "gh", args: ["pr", "checkout", number] }
|
|
27894
|
+
};
|
|
27895
|
+
return {
|
|
27896
|
+
headBranch: {
|
|
27897
|
+
file: "az",
|
|
27898
|
+
args: [
|
|
27899
|
+
"repos",
|
|
27900
|
+
"pr",
|
|
27901
|
+
"show",
|
|
27902
|
+
"--id",
|
|
27903
|
+
number,
|
|
27904
|
+
"--org",
|
|
27905
|
+
`https://dev.azure.com/${azure.org}`,
|
|
27906
|
+
"--query",
|
|
27907
|
+
"sourceRefName",
|
|
27908
|
+
"-o",
|
|
27909
|
+
"tsv"
|
|
27910
|
+
],
|
|
27911
|
+
parse: branchFromRef
|
|
27912
|
+
},
|
|
27913
|
+
checkout: { file: "az", args: ["repos", "pr", "checkout", "--id", number] }
|
|
27914
|
+
};
|
|
27915
|
+
}
|
|
27916
|
+
|
|
27745
27917
|
// src/commands/review/prHeadBranch.ts
|
|
27746
27918
|
import { execFileSync as execFileSync17 } from "child_process";
|
|
27747
|
-
function prHeadBranch(
|
|
27919
|
+
function prHeadBranch({
|
|
27920
|
+
headBranch
|
|
27921
|
+
}) {
|
|
27748
27922
|
try {
|
|
27749
|
-
|
|
27750
|
-
|
|
27751
|
-
|
|
27752
|
-
|
|
27753
|
-
|
|
27754
|
-
|
|
27923
|
+
return headBranch.parse(
|
|
27924
|
+
execFileSync17(headBranch.file, headBranch.args, {
|
|
27925
|
+
encoding: "utf8",
|
|
27926
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
27927
|
+
})
|
|
27928
|
+
);
|
|
27755
27929
|
} catch {
|
|
27756
27930
|
return null;
|
|
27757
27931
|
}
|
|
@@ -27814,12 +27988,56 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
27814
27988
|
return path108 && path108 !== here ? path108 : null;
|
|
27815
27989
|
}
|
|
27816
27990
|
|
|
27817
|
-
// src/commands/review/
|
|
27991
|
+
// src/commands/review/failCheckout.ts
|
|
27992
|
+
import chalk171 from "chalk";
|
|
27993
|
+
|
|
27994
|
+
// src/commands/review/azCliProblem.ts
|
|
27995
|
+
import { execFileSync as execFileSync18 } from "child_process";
|
|
27996
|
+
function runAz(args) {
|
|
27997
|
+
try {
|
|
27998
|
+
execFileSync18("az", args, { stdio: "ignore" });
|
|
27999
|
+
return "ok";
|
|
28000
|
+
} catch (error) {
|
|
28001
|
+
return error.code === "ENOENT" ? "missing" : "failed";
|
|
28002
|
+
}
|
|
28003
|
+
}
|
|
28004
|
+
function azCliProblem() {
|
|
28005
|
+
if (runAz(["version"]) === "missing")
|
|
28006
|
+
return "Azure CLI (az) not found; install it (https://aka.ms/azure-cli) and run az login.";
|
|
28007
|
+
if (runAz(["extension", "show", "--name", "azure-devops"]) !== "ok")
|
|
28008
|
+
return "The azure-devops az extension is not installed; run az extension add --name azure-devops.";
|
|
28009
|
+
if (runAz(["account", "show"]) !== "ok")
|
|
28010
|
+
return "az is not logged in; run az login.";
|
|
28011
|
+
return null;
|
|
28012
|
+
}
|
|
28013
|
+
|
|
28014
|
+
// src/commands/review/failCheckout.ts
|
|
28015
|
+
function failCheckout(number, headRef, stale, from, checkout) {
|
|
28016
|
+
if (headRef && from && from !== headRef && currentBranch4() === headRef)
|
|
28017
|
+
gitSyncOrNull(process.cwd(), ["checkout", "--quiet", from]);
|
|
28018
|
+
if (headRef && stale === "local-work")
|
|
28019
|
+
console.error(
|
|
28020
|
+
chalk171.red(
|
|
28021
|
+
`Local branch ${headRef} has commits that are not on the remote and cannot fast-forward to PR #${number}'s head; push or reset ${headRef}, then retry.`
|
|
28022
|
+
)
|
|
28023
|
+
);
|
|
28024
|
+
const problem = checkout.file === "az" ? azCliProblem() : null;
|
|
28025
|
+
if (problem) console.error(chalk171.red(problem));
|
|
28026
|
+
console.error(
|
|
28027
|
+
chalk171.red(`${checkout.file} ${checkout.args.join(" ")} failed; aborting.`)
|
|
28028
|
+
);
|
|
28029
|
+
process.exit(1);
|
|
28030
|
+
}
|
|
27818
28031
|
function currentBranch4() {
|
|
27819
28032
|
return gitSyncOrNull(process.cwd(), ["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
27820
28033
|
}
|
|
28034
|
+
|
|
28035
|
+
// src/commands/review/checkoutPr.ts
|
|
28036
|
+
function currentBranch5() {
|
|
28037
|
+
return gitSyncOrNull(process.cwd(), ["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
28038
|
+
}
|
|
27821
28039
|
async function moveToExistingCheckout(number, headRef) {
|
|
27822
|
-
if (
|
|
28040
|
+
if (currentBranch5() === headRef) {
|
|
27823
28041
|
console.log(`Already on ${headRef} for PR #${number}; reviewing here.`);
|
|
27824
28042
|
return true;
|
|
27825
28043
|
}
|
|
@@ -27831,29 +28049,20 @@ async function moveToExistingCheckout(number, headRef) {
|
|
|
27831
28049
|
await reportCwdToDaemon(holder);
|
|
27832
28050
|
return true;
|
|
27833
28051
|
}
|
|
27834
|
-
function failCheckout(number, headRef, stale, from) {
|
|
27835
|
-
if (headRef && from && from !== headRef && currentBranch4() === headRef)
|
|
27836
|
-
gitSyncOrNull(process.cwd(), ["checkout", "--quiet", from]);
|
|
27837
|
-
if (headRef && stale === "local-work")
|
|
27838
|
-
console.error(
|
|
27839
|
-
chalk171.red(
|
|
27840
|
-
`Local branch ${headRef} has commits that are not on the remote and cannot fast-forward to PR #${number}'s head; push or reset ${headRef}, then retry.`
|
|
27841
|
-
)
|
|
27842
|
-
);
|
|
27843
|
-
console.error(chalk171.red(`gh pr checkout ${number} failed; aborting.`));
|
|
27844
|
-
process.exit(1);
|
|
27845
|
-
}
|
|
27846
28052
|
async function checkoutPr(number) {
|
|
27847
|
-
const
|
|
28053
|
+
const commands = prCliCommands(number, process.cwd());
|
|
28054
|
+
const headRef = prHeadBranch(commands);
|
|
27848
28055
|
if (headRef && await moveToExistingCheckout(number, headRef)) return;
|
|
27849
28056
|
await moveToPrCheckoutTree();
|
|
27850
|
-
const branch2 =
|
|
28057
|
+
const branch2 = currentBranch5();
|
|
27851
28058
|
const from = branch2 === "HEAD" ? gitSyncOrNull(process.cwd(), ["rev-parse", "HEAD"]) : branch2;
|
|
27852
28059
|
const stale = headRef ? clearStalePrBranch(process.cwd(), headRef) : "absent";
|
|
27853
28060
|
try {
|
|
27854
|
-
|
|
28061
|
+
execFileSync19(commands.checkout.file, commands.checkout.args, {
|
|
28062
|
+
stdio: "inherit"
|
|
28063
|
+
});
|
|
27855
28064
|
} catch {
|
|
27856
|
-
failCheckout(number, headRef, stale, from);
|
|
28065
|
+
failCheckout(number, headRef, stale, from, commands.checkout);
|
|
27857
28066
|
}
|
|
27858
28067
|
}
|
|
27859
28068
|
|
|
@@ -28069,7 +28278,7 @@ function registerLitellm(program) {
|
|
|
28069
28278
|
}
|
|
28070
28279
|
|
|
28071
28280
|
// src/commands/mermaidExport.ts
|
|
28072
|
-
import { mkdirSync as mkdirSync20, readdirSync as
|
|
28281
|
+
import { mkdirSync as mkdirSync20, readdirSync as readdirSync12 } from "fs";
|
|
28073
28282
|
import { resolve as resolve20 } from "path";
|
|
28074
28283
|
import chalk176 from "chalk";
|
|
28075
28284
|
|
|
@@ -28151,7 +28360,7 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
28151
28360
|
process.exit(1);
|
|
28152
28361
|
}
|
|
28153
28362
|
}
|
|
28154
|
-
const files = file ? [file] :
|
|
28363
|
+
const files = file ? [file] : readdirSync12(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
28155
28364
|
if (files.length === 0) {
|
|
28156
28365
|
console.log(chalk176.gray("No markdown files found in current directory."));
|
|
28157
28366
|
return;
|
|
@@ -28312,10 +28521,10 @@ function applyIgnore(texts, ignore3) {
|
|
|
28312
28521
|
}
|
|
28313
28522
|
|
|
28314
28523
|
// src/commands/miro/readIgnoreList.ts
|
|
28315
|
-
import { existsSync as
|
|
28524
|
+
import { existsSync as existsSync63, readFileSync as readFileSync42 } from "fs";
|
|
28316
28525
|
import { parse as parse2 } from "yaml";
|
|
28317
28526
|
function readIgnoreList(file) {
|
|
28318
|
-
if (!
|
|
28527
|
+
if (!existsSync63(file))
|
|
28319
28528
|
throw new MiroExtractError(
|
|
28320
28529
|
`No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
|
|
28321
28530
|
);
|
|
@@ -28797,15 +29006,15 @@ function createNetcapHandler(options2) {
|
|
|
28797
29006
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
28798
29007
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
28799
29008
|
import { networkInterfaces } from "os";
|
|
28800
|
-
import { join as
|
|
29009
|
+
import { join as join75 } from "path";
|
|
28801
29010
|
import chalk179 from "chalk";
|
|
28802
29011
|
|
|
28803
29012
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
28804
|
-
import { dirname as dirname34, join as
|
|
29013
|
+
import { dirname as dirname34, join as join74 } from "path";
|
|
28805
29014
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
28806
29015
|
var moduleDir2 = dirname34(fileURLToPath7(import.meta.url));
|
|
28807
29016
|
function netcapExtensionDir() {
|
|
28808
|
-
return
|
|
29017
|
+
return join74(moduleDir2, "commands", "netcap", "netcap-extension");
|
|
28809
29018
|
}
|
|
28810
29019
|
|
|
28811
29020
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
@@ -28820,7 +29029,7 @@ function lanIPv4() {
|
|
|
28820
29029
|
return void 0;
|
|
28821
29030
|
}
|
|
28822
29031
|
async function configureBackground(dir, host, port, filter) {
|
|
28823
|
-
const file =
|
|
29032
|
+
const file = join75(dir, "background.js");
|
|
28824
29033
|
const source = await readFile7(file, "utf8");
|
|
28825
29034
|
await writeFile6(
|
|
28826
29035
|
file,
|
|
@@ -28860,20 +29069,20 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
28860
29069
|
}
|
|
28861
29070
|
|
|
28862
29071
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
28863
|
-
import { isAbsolute as isAbsolute5, join as
|
|
29072
|
+
import { isAbsolute as isAbsolute5, join as join77, resolve as resolve22 } from "path";
|
|
28864
29073
|
|
|
28865
29074
|
// src/commands/netcap/defaultCapturePath.ts
|
|
28866
29075
|
import { homedir as homedir23 } from "os";
|
|
28867
|
-
import { join as
|
|
29076
|
+
import { join as join76 } from "path";
|
|
28868
29077
|
function defaultCapturePath() {
|
|
28869
|
-
return
|
|
29078
|
+
return join76(homedir23(), ".assist", "netcap", "capture.jsonl");
|
|
28870
29079
|
}
|
|
28871
29080
|
|
|
28872
29081
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
28873
29082
|
function resolveNetcapOutPath(out) {
|
|
28874
29083
|
if (!out) return defaultCapturePath();
|
|
28875
29084
|
const dir = isAbsolute5(out) ? out : resolve22(process.cwd(), out);
|
|
28876
|
-
return
|
|
29085
|
+
return join77(dir, "capture.jsonl");
|
|
28877
29086
|
}
|
|
28878
29087
|
|
|
28879
29088
|
// src/commands/netcap/netcap.ts
|
|
@@ -28920,7 +29129,7 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
|
|
|
28920
29129
|
|
|
28921
29130
|
// src/commands/netcap/netcapExtract.ts
|
|
28922
29131
|
import { writeFileSync as writeFileSync35 } from "fs";
|
|
28923
|
-
import { join as
|
|
29132
|
+
import { join as join78 } from "path";
|
|
28924
29133
|
import chalk181 from "chalk";
|
|
28925
29134
|
|
|
28926
29135
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
@@ -29365,7 +29574,7 @@ function extractPostsFromCapture(captureFile) {
|
|
|
29365
29574
|
function netcapExtract(file) {
|
|
29366
29575
|
const captureFile = file ?? defaultCapturePath();
|
|
29367
29576
|
const posts = extractPostsFromCapture(captureFile);
|
|
29368
|
-
const outFile =
|
|
29577
|
+
const outFile = join78(captureFile, "..", "posts.json");
|
|
29369
29578
|
writeFileSync35(outFile, `${JSON.stringify(posts, null, 2)}
|
|
29370
29579
|
`);
|
|
29371
29580
|
console.log(
|
|
@@ -29758,9 +29967,9 @@ async function comment2(path108, line, body, options2 = {}) {
|
|
|
29758
29967
|
|
|
29759
29968
|
// src/commands/prs/commentsCachePath.ts
|
|
29760
29969
|
import { homedir as homedir24 } from "os";
|
|
29761
|
-
import { join as
|
|
29970
|
+
import { join as join79 } from "path";
|
|
29762
29971
|
function commentsCachePath(org, repo, prNumber) {
|
|
29763
|
-
return
|
|
29972
|
+
return join79(
|
|
29764
29973
|
homedir24(),
|
|
29765
29974
|
".assist",
|
|
29766
29975
|
"pr-comments",
|
|
@@ -29771,10 +29980,10 @@ function commentsCachePath(org, repo, prNumber) {
|
|
|
29771
29980
|
}
|
|
29772
29981
|
|
|
29773
29982
|
// src/commands/prs/fetchThreadIds.ts
|
|
29774
|
-
import { execFileSync as
|
|
29983
|
+
import { execFileSync as execFileSync20 } from "child_process";
|
|
29775
29984
|
var THREAD_QUERY = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { id isResolved comments(first: 100) { nodes { databaseId } } } } } } }`;
|
|
29776
29985
|
function fetchThreadIds(org, repo, prNumber) {
|
|
29777
|
-
const result =
|
|
29986
|
+
const result = execFileSync20(
|
|
29778
29987
|
"gh",
|
|
29779
29988
|
[
|
|
29780
29989
|
"api",
|
|
@@ -29854,11 +30063,11 @@ import { dirname as dirname36 } from "path";
|
|
|
29854
30063
|
import { stringify as stringify3 } from "yaml";
|
|
29855
30064
|
|
|
29856
30065
|
// src/commands/prs/loadCommentsCache.ts
|
|
29857
|
-
import { existsSync as
|
|
30066
|
+
import { existsSync as existsSync64, readFileSync as readFileSync45, unlinkSync as unlinkSync13 } from "fs";
|
|
29858
30067
|
import { parse as parse3 } from "yaml";
|
|
29859
30068
|
function loadCommentsCache(org, repo, prNumber) {
|
|
29860
30069
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
29861
|
-
if (!
|
|
30070
|
+
if (!existsSync64(cachePath)) {
|
|
29862
30071
|
return null;
|
|
29863
30072
|
}
|
|
29864
30073
|
const content = readFileSync45(cachePath, "utf8");
|
|
@@ -29866,26 +30075,26 @@ function loadCommentsCache(org, repo, prNumber) {
|
|
|
29866
30075
|
}
|
|
29867
30076
|
function deleteCommentsCache(org, repo, prNumber) {
|
|
29868
30077
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
29869
|
-
if (
|
|
30078
|
+
if (existsSync64(cachePath)) {
|
|
29870
30079
|
unlinkSync13(cachePath);
|
|
29871
30080
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
29872
30081
|
}
|
|
29873
30082
|
}
|
|
29874
30083
|
|
|
29875
30084
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
29876
|
-
import { readdirSync as
|
|
29877
|
-
import { join as
|
|
30085
|
+
import { readdirSync as readdirSync13, unlinkSync as unlinkSync14 } from "fs";
|
|
30086
|
+
import { join as join80 } from "path";
|
|
29878
30087
|
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
29879
30088
|
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
29880
|
-
const dir =
|
|
30089
|
+
const dir = join80(cwd, ".assist");
|
|
29881
30090
|
let entries;
|
|
29882
30091
|
try {
|
|
29883
|
-
entries =
|
|
30092
|
+
entries = readdirSync13(dir);
|
|
29884
30093
|
} catch {
|
|
29885
30094
|
return;
|
|
29886
30095
|
}
|
|
29887
30096
|
for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
|
|
29888
|
-
unlinkSync14(
|
|
30097
|
+
unlinkSync14(join80(dir, entry));
|
|
29889
30098
|
}
|
|
29890
30099
|
}
|
|
29891
30100
|
|
|
@@ -30113,7 +30322,7 @@ function printComments2(result) {
|
|
|
30113
30322
|
import { execSync as execSync41 } from "child_process";
|
|
30114
30323
|
|
|
30115
30324
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
30116
|
-
import { execFileSync as
|
|
30325
|
+
import { execFileSync as execFileSync21 } from "child_process";
|
|
30117
30326
|
|
|
30118
30327
|
// src/commands/prs/replyToComment.ts
|
|
30119
30328
|
import { spawnSync as spawnSync7 } from "child_process";
|
|
@@ -30137,7 +30346,7 @@ function replyToComment(org, repo, prNumber, commentId, message3) {
|
|
|
30137
30346
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
30138
30347
|
function resolveThread(threadId) {
|
|
30139
30348
|
const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
|
|
30140
|
-
|
|
30349
|
+
execFileSync21(
|
|
30141
30350
|
"gh",
|
|
30142
30351
|
["api", "graphql", "-f", `query=${mutation}`, "-f", `threadId=${threadId}`],
|
|
30143
30352
|
{ stdio: ["inherit", "pipe", "inherit"] }
|
|
@@ -30742,7 +30951,7 @@ function buildValidatedBody(options2, usage) {
|
|
|
30742
30951
|
}
|
|
30743
30952
|
|
|
30744
30953
|
// src/commands/prs/placePr.ts
|
|
30745
|
-
import { execFileSync as
|
|
30954
|
+
import { execFileSync as execFileSync22 } from "child_process";
|
|
30746
30955
|
|
|
30747
30956
|
// src/commands/prs/buildCreateArgs.ts
|
|
30748
30957
|
function buildCreateArgs(title, body, options2, attachments = []) {
|
|
@@ -30828,7 +31037,7 @@ function buildEditArgs(number, title, body, attachments = []) {
|
|
|
30828
31037
|
// src/commands/prs/placePr.ts
|
|
30829
31038
|
function hasUpstream2() {
|
|
30830
31039
|
try {
|
|
30831
|
-
|
|
31040
|
+
execFileSync22(
|
|
30832
31041
|
"git",
|
|
30833
31042
|
["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"],
|
|
30834
31043
|
{ stdio: "pipe" }
|
|
@@ -30840,7 +31049,7 @@ function hasUpstream2() {
|
|
|
30840
31049
|
}
|
|
30841
31050
|
function ensureBranchPushed() {
|
|
30842
31051
|
const args = hasUpstream2() ? ["push"] : ["push", "--set-upstream", "origin", "HEAD"];
|
|
30843
|
-
|
|
31052
|
+
execFileSync22("git", args, { stdio: "inherit" });
|
|
30844
31053
|
}
|
|
30845
31054
|
async function placePr(prNumber, title, body, options2, attachments = []) {
|
|
30846
31055
|
const args = prNumber !== null ? buildEditArgs(prNumber, title, body, attachments) : buildCreateArgs(title, body, options2, attachments);
|
|
@@ -30911,10 +31120,10 @@ function warn(reason4) {
|
|
|
30911
31120
|
}
|
|
30912
31121
|
|
|
30913
31122
|
// src/commands/prs/enableAutoMerge.ts
|
|
30914
|
-
import { execFileSync as
|
|
31123
|
+
import { execFileSync as execFileSync23 } from "child_process";
|
|
30915
31124
|
function enableAutoMerge() {
|
|
30916
31125
|
try {
|
|
30917
|
-
|
|
31126
|
+
execFileSync23(
|
|
30918
31127
|
"gh",
|
|
30919
31128
|
["pr", "merge", getCurrentBranch2(), "--auto", "--squash"],
|
|
30920
31129
|
{ stdio: "inherit" }
|
|
@@ -31169,10 +31378,10 @@ function prsSlackChannel() {
|
|
|
31169
31378
|
}
|
|
31170
31379
|
|
|
31171
31380
|
// src/commands/prs/status/fetchReviewThreads.ts
|
|
31172
|
-
import { execFileSync as
|
|
31381
|
+
import { execFileSync as execFileSync24 } from "child_process";
|
|
31173
31382
|
var THREAD_QUERY2 = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { isResolved } } } } }`;
|
|
31174
31383
|
function fetchReviewThreads(org, repo, prNumber) {
|
|
31175
|
-
const output =
|
|
31384
|
+
const output = execFileSync24(
|
|
31176
31385
|
"gh",
|
|
31177
31386
|
[
|
|
31178
31387
|
"api",
|
|
@@ -32729,9 +32938,9 @@ async function notify() {
|
|
|
32729
32938
|
|
|
32730
32939
|
// src/commands/screenshot.ts
|
|
32731
32940
|
import { execSync as execSync49 } from "child_process";
|
|
32732
|
-
import { existsSync as
|
|
32941
|
+
import { existsSync as existsSync65, mkdirSync as mkdirSync23, unlinkSync as unlinkSync15, writeFileSync as writeFileSync37 } from "fs";
|
|
32733
32942
|
import { tmpdir as tmpdir6 } from "os";
|
|
32734
|
-
import { join as
|
|
32943
|
+
import { join as join81, resolve as resolve24 } from "path";
|
|
32735
32944
|
import chalk208 from "chalk";
|
|
32736
32945
|
|
|
32737
32946
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -32861,14 +33070,14 @@ Write-Output $OutputPath
|
|
|
32861
33070
|
|
|
32862
33071
|
// src/commands/screenshot.ts
|
|
32863
33072
|
function buildOutputPath(outputDir, processName) {
|
|
32864
|
-
if (!
|
|
33073
|
+
if (!existsSync65(outputDir)) {
|
|
32865
33074
|
mkdirSync23(outputDir, { recursive: true });
|
|
32866
33075
|
}
|
|
32867
33076
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
32868
33077
|
return resolve24(outputDir, `${processName}-${timestamp6}.png`);
|
|
32869
33078
|
}
|
|
32870
33079
|
function runPowerShellScript(processName, outputPath) {
|
|
32871
|
-
const scriptPath =
|
|
33080
|
+
const scriptPath = join81(tmpdir6(), `assist-screenshot-${Date.now()}.ps1`);
|
|
32872
33081
|
writeFileSync37(scriptPath, captureWindowPs1, "utf8");
|
|
32873
33082
|
try {
|
|
32874
33083
|
execSync49(
|
|
@@ -32983,9 +33192,9 @@ function buildLimitsSegment(rateLimits) {
|
|
|
32983
33192
|
|
|
32984
33193
|
// src/commands/readGitBranch.ts
|
|
32985
33194
|
import { readFileSync as readFileSync48, statSync as statSync10 } from "fs";
|
|
32986
|
-
import { isAbsolute as isAbsolute6, join as
|
|
33195
|
+
import { isAbsolute as isAbsolute6, join as join82, resolve as resolve25 } from "path";
|
|
32987
33196
|
function resolveGitDir(cwd) {
|
|
32988
|
-
const dotGit =
|
|
33197
|
+
const dotGit = join82(cwd, ".git");
|
|
32989
33198
|
let stat5;
|
|
32990
33199
|
try {
|
|
32991
33200
|
stat5 = statSync10(dotGit);
|
|
@@ -33015,7 +33224,7 @@ function readGitBranch(cwd) {
|
|
|
33015
33224
|
}
|
|
33016
33225
|
let head;
|
|
33017
33226
|
try {
|
|
33018
|
-
head = readFileSync48(
|
|
33227
|
+
head = readFileSync48(join82(gitDir, "HEAD"), "utf8");
|
|
33019
33228
|
} catch {
|
|
33020
33229
|
return null;
|
|
33021
33230
|
}
|
|
@@ -35491,7 +35700,7 @@ function exitWith(message3) {
|
|
|
35491
35700
|
}
|
|
35492
35701
|
|
|
35493
35702
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
35494
|
-
import { execFileSync as
|
|
35703
|
+
import { execFileSync as execFileSync26 } from "child_process";
|
|
35495
35704
|
import chalk232 from "chalk";
|
|
35496
35705
|
|
|
35497
35706
|
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
@@ -35540,7 +35749,7 @@ function readGlobs(value) {
|
|
|
35540
35749
|
}
|
|
35541
35750
|
|
|
35542
35751
|
// src/commands/review/highLevel/summariseRepoTree.ts
|
|
35543
|
-
import { execFileSync as
|
|
35752
|
+
import { execFileSync as execFileSync25 } from "child_process";
|
|
35544
35753
|
import { dirname as dirname38, extname as extname6 } from "path";
|
|
35545
35754
|
var MAX_DIRECTORIES = 200;
|
|
35546
35755
|
var MAX_EXTENSIONS_PER_DIRECTORY = 6;
|
|
@@ -35556,7 +35765,7 @@ function summariseRepoTree(cwd = process.cwd()) {
|
|
|
35556
35765
|
}
|
|
35557
35766
|
function listTrackedFiles(cwd) {
|
|
35558
35767
|
try {
|
|
35559
|
-
return
|
|
35768
|
+
return execFileSync25("git", ["ls-files"], {
|
|
35560
35769
|
cwd,
|
|
35561
35770
|
encoding: "utf8",
|
|
35562
35771
|
maxBuffer: 64 * 1024 * 1024
|
|
@@ -35601,7 +35810,7 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
35601
35810
|
}
|
|
35602
35811
|
function askClaude(prompt, cwd) {
|
|
35603
35812
|
try {
|
|
35604
|
-
return
|
|
35813
|
+
return execFileSync26("claude", ["-p", "--model", "sonnet", prompt], {
|
|
35605
35814
|
cwd,
|
|
35606
35815
|
encoding: "utf8",
|
|
35607
35816
|
timeout: 12e4,
|
|
@@ -36195,11 +36404,11 @@ function evaluateHighLevelChecks(subject) {
|
|
|
36195
36404
|
}
|
|
36196
36405
|
|
|
36197
36406
|
// src/commands/review/highLevel/fetchFileAtSha.ts
|
|
36198
|
-
import { execFileSync as
|
|
36407
|
+
import { execFileSync as execFileSync27 } from "child_process";
|
|
36199
36408
|
function fetchFileAtSha(repo, sha, path108) {
|
|
36200
36409
|
const encodedPath = path108.split("/").map(encodeURIComponent).join("/");
|
|
36201
36410
|
try {
|
|
36202
|
-
return
|
|
36411
|
+
return execFileSync27(
|
|
36203
36412
|
"gh",
|
|
36204
36413
|
[
|
|
36205
36414
|
"api",
|
|
@@ -36221,7 +36430,7 @@ function fetchFileAtSha(repo, sha, path108) {
|
|
|
36221
36430
|
}
|
|
36222
36431
|
|
|
36223
36432
|
// src/commands/review/highLevel/fetchHighLevelFiles.ts
|
|
36224
|
-
import { execFileSync as
|
|
36433
|
+
import { execFileSync as execFileSync28 } from "child_process";
|
|
36225
36434
|
import { createHash as createHash4 } from "crypto";
|
|
36226
36435
|
var JQ = ".[] | {filename,status,additions,deletions,patch} | @json";
|
|
36227
36436
|
function toStatus(status2) {
|
|
@@ -36234,7 +36443,7 @@ function diffUrl(repo, prNumber, path108) {
|
|
|
36234
36443
|
return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
|
|
36235
36444
|
}
|
|
36236
36445
|
function fetchHighLevelFiles(prNumber, repo) {
|
|
36237
|
-
const out =
|
|
36446
|
+
const out = execFileSync28(
|
|
36238
36447
|
"gh",
|
|
36239
36448
|
["api", `repos/${repo}/pulls/${prNumber}/files`, "--paginate", "--jq", JQ],
|
|
36240
36449
|
{ encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }
|
|
@@ -36301,12 +36510,12 @@ function fetchHighLevelPr(prNumber, repo) {
|
|
|
36301
36510
|
}
|
|
36302
36511
|
|
|
36303
36512
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
36304
|
-
import { join as
|
|
36513
|
+
import { join as join83 } from "path";
|
|
36305
36514
|
function slug(value) {
|
|
36306
36515
|
return value.replace(/[^\w.-]+/g, "-");
|
|
36307
36516
|
}
|
|
36308
36517
|
function highLevelReviewPath(repo, headRef, headSha) {
|
|
36309
|
-
return
|
|
36518
|
+
return join83(
|
|
36310
36519
|
getStoreDir(),
|
|
36311
36520
|
"high-level-reviews",
|
|
36312
36521
|
slug(repo),
|
|
@@ -36323,9 +36532,9 @@ function highLevelDraftPath(repo, headRef, headSha) {
|
|
|
36323
36532
|
}
|
|
36324
36533
|
|
|
36325
36534
|
// src/commands/review/highLevel/readJsonFile.ts
|
|
36326
|
-
import { existsSync as
|
|
36535
|
+
import { existsSync as existsSync66, readFileSync as readFileSync49 } from "fs";
|
|
36327
36536
|
function readJsonFile(path108) {
|
|
36328
|
-
if (!
|
|
36537
|
+
if (!existsSync66(path108)) return void 0;
|
|
36329
36538
|
try {
|
|
36330
36539
|
return JSON.parse(readFileSync49(path108, "utf8"));
|
|
36331
36540
|
} catch {
|
|
@@ -37465,7 +37674,7 @@ import { format as format2 } from "util";
|
|
|
37465
37674
|
|
|
37466
37675
|
// src/commands/review/createReviewLogSink.ts
|
|
37467
37676
|
import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync25 } from "fs";
|
|
37468
|
-
import { join as
|
|
37677
|
+
import { join as join84 } from "path";
|
|
37469
37678
|
var LOG_FILE = "review.log";
|
|
37470
37679
|
function createReviewLogSink() {
|
|
37471
37680
|
let logPath2;
|
|
@@ -37482,7 +37691,7 @@ function createReviewLogSink() {
|
|
|
37482
37691
|
},
|
|
37483
37692
|
attach(reviewDir) {
|
|
37484
37693
|
mkdirSync25(reviewDir, { recursive: true });
|
|
37485
|
-
logPath2 =
|
|
37694
|
+
logPath2 = join84(reviewDir, LOG_FILE);
|
|
37486
37695
|
const lines2 = [
|
|
37487
37696
|
"",
|
|
37488
37697
|
`=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
|
|
@@ -38181,7 +38390,7 @@ async function runClaudeReviewer(spec) {
|
|
|
38181
38390
|
}
|
|
38182
38391
|
|
|
38183
38392
|
// src/commands/review/runCodexReviewer.ts
|
|
38184
|
-
import { existsSync as
|
|
38393
|
+
import { existsSync as existsSync67, unlinkSync as unlinkSync16 } from "fs";
|
|
38185
38394
|
|
|
38186
38395
|
// src/commands/review/parseCodexUsage.ts
|
|
38187
38396
|
function parseCodexUsage(usage) {
|
|
@@ -38270,7 +38479,7 @@ async function runCodexReviewer(spec) {
|
|
|
38270
38479
|
...override.args.length > 0 ? { env: override.env } : {},
|
|
38271
38480
|
onLine
|
|
38272
38481
|
});
|
|
38273
|
-
if (result.exitCode !== 0 &&
|
|
38482
|
+
if (result.exitCode !== 0 && existsSync67(spec.outputPath)) {
|
|
38274
38483
|
unlinkSync16(spec.outputPath);
|
|
38275
38484
|
}
|
|
38276
38485
|
const finalised = finaliseReviewerRun(
|
|
@@ -38361,7 +38570,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
|
|
|
38361
38570
|
}
|
|
38362
38571
|
|
|
38363
38572
|
// src/commands/review/synthesiseAfterReviewers.ts
|
|
38364
|
-
import { existsSync as
|
|
38573
|
+
import { existsSync as existsSync68, unlinkSync as unlinkSync17 } from "fs";
|
|
38365
38574
|
|
|
38366
38575
|
// src/commands/review/synthesise.ts
|
|
38367
38576
|
import { readFileSync as readFileSync51 } from "fs";
|
|
@@ -38468,7 +38677,7 @@ async function synthesise(paths, options2) {
|
|
|
38468
38677
|
// src/commands/review/synthesiseAfterReviewers.ts
|
|
38469
38678
|
async function synthesiseAfterReviewers(input) {
|
|
38470
38679
|
const { paths, failures } = input;
|
|
38471
|
-
if (input.anyFresh &&
|
|
38680
|
+
if (input.anyFresh && existsSync68(paths.synthesisPath)) {
|
|
38472
38681
|
unlinkSync17(paths.synthesisPath);
|
|
38473
38682
|
}
|
|
38474
38683
|
const synthesisResult = await synthesise(paths, {
|
|
@@ -38697,9 +38906,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
38697
38906
|
|
|
38698
38907
|
// src/commands/review/buildReviewPaths.ts
|
|
38699
38908
|
import { homedir as homedir25 } from "os";
|
|
38700
|
-
import { basename as basename24, join as
|
|
38909
|
+
import { basename as basename24, join as join85 } from "path";
|
|
38701
38910
|
function buildReviewPaths(repoRoot2, key) {
|
|
38702
|
-
const reviewDir =
|
|
38911
|
+
const reviewDir = join85(
|
|
38703
38912
|
homedir25(),
|
|
38704
38913
|
".assist",
|
|
38705
38914
|
"reviews",
|
|
@@ -38708,10 +38917,10 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
38708
38917
|
);
|
|
38709
38918
|
return {
|
|
38710
38919
|
reviewDir,
|
|
38711
|
-
requestPath:
|
|
38712
|
-
claudePath:
|
|
38713
|
-
codexPath:
|
|
38714
|
-
synthesisPath:
|
|
38920
|
+
requestPath: join85(reviewDir, "request.md"),
|
|
38921
|
+
claudePath: join85(reviewDir, "claude.md"),
|
|
38922
|
+
codexPath: join85(reviewDir, "codex.md"),
|
|
38923
|
+
synthesisPath: join85(reviewDir, "synthesis.md")
|
|
38715
38924
|
};
|
|
38716
38925
|
}
|
|
38717
38926
|
|
|
@@ -38749,10 +38958,10 @@ function fetchExistingComments() {
|
|
|
38749
38958
|
}
|
|
38750
38959
|
|
|
38751
38960
|
// src/commands/review/prepareReviewDir.ts
|
|
38752
|
-
import { existsSync as
|
|
38961
|
+
import { existsSync as existsSync69, mkdirSync as mkdirSync26, unlinkSync as unlinkSync18, writeFileSync as writeFileSync40 } from "fs";
|
|
38753
38962
|
function clearReviewFiles(paths) {
|
|
38754
38963
|
for (const path108 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
38755
|
-
if (
|
|
38964
|
+
if (existsSync69(path108)) unlinkSync18(path108);
|
|
38756
38965
|
}
|
|
38757
38966
|
}
|
|
38758
38967
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -39406,7 +39615,7 @@ function registerReview(program) {
|
|
|
39406
39615
|
}
|
|
39407
39616
|
|
|
39408
39617
|
// src/commands/rules/addRule.ts
|
|
39409
|
-
import { existsSync as
|
|
39618
|
+
import { existsSync as existsSync72, readFileSync as readFileSync56, writeFileSync as writeFileSync42 } from "fs";
|
|
39410
39619
|
import path87 from "path";
|
|
39411
39620
|
import chalk242 from "chalk";
|
|
39412
39621
|
|
|
@@ -39434,12 +39643,12 @@ function insertRuleBullet(content, rule) {
|
|
|
39434
39643
|
import { readFileSync as readFileSync53 } from "fs";
|
|
39435
39644
|
|
|
39436
39645
|
// src/commands/rules/findClaudeFiles.ts
|
|
39437
|
-
import { readdirSync as
|
|
39646
|
+
import { readdirSync as readdirSync14 } from "fs";
|
|
39438
39647
|
import path83 from "path";
|
|
39439
39648
|
var SKIP_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage"]);
|
|
39440
39649
|
function findClaudeFiles(dir) {
|
|
39441
39650
|
const results = [];
|
|
39442
|
-
for (const entry of
|
|
39651
|
+
for (const entry of readdirSync14(dir, { withFileTypes: true })) {
|
|
39443
39652
|
if (entry.isDirectory()) {
|
|
39444
39653
|
if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name))
|
|
39445
39654
|
continue;
|
|
@@ -39463,7 +39672,7 @@ function nextRuleCode(root2) {
|
|
|
39463
39672
|
}
|
|
39464
39673
|
|
|
39465
39674
|
// src/commands/rules/resolveRuleScope.ts
|
|
39466
|
-
import { existsSync as
|
|
39675
|
+
import { existsSync as existsSync70 } from "fs";
|
|
39467
39676
|
import path84 from "path";
|
|
39468
39677
|
function resolveRuleScope(target) {
|
|
39469
39678
|
const resolved = path84.resolve(target);
|
|
@@ -39473,7 +39682,7 @@ function resolveRuleScope(target) {
|
|
|
39473
39682
|
let current = startDir;
|
|
39474
39683
|
while (true) {
|
|
39475
39684
|
const candidate = path84.join(current, "CLAUDE.md");
|
|
39476
|
-
if (
|
|
39685
|
+
if (existsSync70(candidate)) return candidate;
|
|
39477
39686
|
if (current === root2 || current === path84.dirname(current)) break;
|
|
39478
39687
|
current = path84.dirname(current);
|
|
39479
39688
|
}
|
|
@@ -39481,7 +39690,7 @@ function resolveRuleScope(target) {
|
|
|
39481
39690
|
}
|
|
39482
39691
|
|
|
39483
39692
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
39484
|
-
import { existsSync as
|
|
39693
|
+
import { existsSync as existsSync71, readFileSync as readFileSync55, writeFileSync as writeFileSync41 } from "fs";
|
|
39485
39694
|
import path86 from "path";
|
|
39486
39695
|
|
|
39487
39696
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
@@ -39531,7 +39740,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
39531
39740
|
function updateScopedRulesIndex(root2) {
|
|
39532
39741
|
const directories = scopedRuleDirectories(root2);
|
|
39533
39742
|
const rootFile = path86.join(root2, "CLAUDE.md");
|
|
39534
|
-
const before =
|
|
39743
|
+
const before = existsSync71(rootFile) ? readFileSync55(rootFile, "utf8") : "";
|
|
39535
39744
|
const after = upsertScopedRulesPointer(before, directories);
|
|
39536
39745
|
if (after !== before) writeFileSync41(rootFile, after);
|
|
39537
39746
|
return directories;
|
|
@@ -39539,7 +39748,7 @@ function updateScopedRulesIndex(root2) {
|
|
|
39539
39748
|
|
|
39540
39749
|
// src/commands/rules/addRule.ts
|
|
39541
39750
|
function read2(file) {
|
|
39542
|
-
return
|
|
39751
|
+
return existsSync72(file) ? readFileSync56(file, "utf8") : "";
|
|
39543
39752
|
}
|
|
39544
39753
|
function addRule(text17, options2) {
|
|
39545
39754
|
const rule = text17.trim();
|
|
@@ -40132,12 +40341,12 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
40132
40341
|
}
|
|
40133
40342
|
|
|
40134
40343
|
// src/commands/slack/slackWorkingFile.ts
|
|
40135
|
-
import { join as
|
|
40344
|
+
import { join as join86 } from "path";
|
|
40136
40345
|
function slackWorkingFile(channel, partIndex) {
|
|
40137
40346
|
const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
|
|
40138
|
-
const dir =
|
|
40347
|
+
const dir = join86(getStoreDir(), "slack");
|
|
40139
40348
|
const name = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
|
|
40140
|
-
return { dir, bodyPath:
|
|
40349
|
+
return { dir, bodyPath: join86(dir, `${name}.md`) };
|
|
40141
40350
|
}
|
|
40142
40351
|
|
|
40143
40352
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
@@ -40957,7 +41166,7 @@ function registerSync(program) {
|
|
|
40957
41166
|
}
|
|
40958
41167
|
|
|
40959
41168
|
// src/commands/transcript/clean.ts
|
|
40960
|
-
import { existsSync as
|
|
41169
|
+
import { existsSync as existsSync77 } from "fs";
|
|
40961
41170
|
|
|
40962
41171
|
// src/commands/transcript/convert/formatTimestamp.ts
|
|
40963
41172
|
function pad(value, width2) {
|
|
@@ -41235,7 +41444,7 @@ function clean(file, options2 = {}) {
|
|
|
41235
41444
|
);
|
|
41236
41445
|
process.exit(1);
|
|
41237
41446
|
}
|
|
41238
|
-
if (!
|
|
41447
|
+
if (!existsSync77(file)) {
|
|
41239
41448
|
console.error(`Error: VTT file not found: ${file}`);
|
|
41240
41449
|
process.exit(1);
|
|
41241
41450
|
}
|
|
@@ -41318,21 +41527,21 @@ async function configure() {
|
|
|
41318
41527
|
}
|
|
41319
41528
|
|
|
41320
41529
|
// src/commands/transcript/list.ts
|
|
41321
|
-
import { existsSync as
|
|
41322
|
-
import { join as
|
|
41530
|
+
import { existsSync as existsSync78, readdirSync as readdirSync21, statSync as statSync12 } from "fs";
|
|
41531
|
+
import { join as join98 } from "path";
|
|
41323
41532
|
function list4() {
|
|
41324
41533
|
const { vttDir } = getTranscriptConfig();
|
|
41325
|
-
if (!
|
|
41326
|
-
for (const entry of
|
|
41534
|
+
if (!existsSync78(vttDir)) return;
|
|
41535
|
+
for (const entry of readdirSync21(vttDir)) {
|
|
41327
41536
|
if (!entry.endsWith(".vtt")) continue;
|
|
41328
|
-
if (statSync12(
|
|
41537
|
+
if (statSync12(join98(vttDir, entry)).isDirectory()) continue;
|
|
41329
41538
|
console.log(entry);
|
|
41330
41539
|
}
|
|
41331
41540
|
}
|
|
41332
41541
|
|
|
41333
41542
|
// src/commands/transcript/move.ts
|
|
41334
|
-
import { existsSync as
|
|
41335
|
-
import { basename as basename27, join as
|
|
41543
|
+
import { existsSync as existsSync79, mkdirSync as mkdirSync34, renameSync as renameSync4, writeFileSync as writeFileSync49 } from "fs";
|
|
41544
|
+
import { basename as basename27, join as join99 } from "path";
|
|
41336
41545
|
|
|
41337
41546
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
41338
41547
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -41342,9 +41551,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
41342
41551
|
// src/commands/transcript/move.ts
|
|
41343
41552
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
41344
41553
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
41345
|
-
const processedDir =
|
|
41554
|
+
const processedDir = join99(vttDir, "processed");
|
|
41346
41555
|
mkdirSync34(processedDir, { recursive: true });
|
|
41347
|
-
renameSync4(sourcePath,
|
|
41556
|
+
renameSync4(sourcePath, join99(processedDir, filename));
|
|
41348
41557
|
}
|
|
41349
41558
|
function move(file, options2) {
|
|
41350
41559
|
const { date, client } = options2;
|
|
@@ -41354,25 +41563,25 @@ function move(file, options2) {
|
|
|
41354
41563
|
}
|
|
41355
41564
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
41356
41565
|
const filename = basename27(file);
|
|
41357
|
-
const sourcePath =
|
|
41358
|
-
if (!
|
|
41566
|
+
const sourcePath = join99(vttDir, filename);
|
|
41567
|
+
if (!existsSync79(sourcePath)) {
|
|
41359
41568
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
41360
41569
|
process.exit(1);
|
|
41361
41570
|
}
|
|
41362
41571
|
const base = basename27(filename, ".vtt").replace(/ Transcription$/, "");
|
|
41363
41572
|
const outputName = `${date} ${base}.md`;
|
|
41364
|
-
const formattedDir =
|
|
41573
|
+
const formattedDir = join99(transcriptsDir, client);
|
|
41365
41574
|
mkdirSync34(formattedDir, { recursive: true });
|
|
41366
|
-
const formattedPath =
|
|
41575
|
+
const formattedPath = join99(formattedDir, outputName);
|
|
41367
41576
|
writeFileSync49(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
41368
41577
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
41369
|
-
const summaryPath =
|
|
41578
|
+
const summaryPath = join99(summaryDir, client, outputName);
|
|
41370
41579
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
41371
41580
|
console.log(`Summary target: ${summaryPath}`);
|
|
41372
41581
|
}
|
|
41373
41582
|
|
|
41374
41583
|
// src/commands/transcript/merge.ts
|
|
41375
|
-
import { existsSync as
|
|
41584
|
+
import { existsSync as existsSync80, writeFileSync as writeFileSync50 } from "fs";
|
|
41376
41585
|
import { basename as basename28 } from "path";
|
|
41377
41586
|
|
|
41378
41587
|
// src/commands/transcript/failTranscript.ts
|
|
@@ -41516,7 +41725,7 @@ function widenAudience(passages) {
|
|
|
41516
41725
|
|
|
41517
41726
|
// src/commands/transcript/merge.ts
|
|
41518
41727
|
function readSource3(file) {
|
|
41519
|
-
if (!
|
|
41728
|
+
if (!existsSync80(file)) failTranscript(`VTT file not found: ${file}`);
|
|
41520
41729
|
const cues = readCleanedCues(file);
|
|
41521
41730
|
if (cues.length === 0) failTranscript(`no cues found in: ${file}`);
|
|
41522
41731
|
return { path: file, name: basename28(file), cues };
|
|
@@ -41983,7 +42192,7 @@ function configKeys2() {
|
|
|
41983
42192
|
}
|
|
41984
42193
|
|
|
41985
42194
|
// src/commands/verify/forbiddenStrings.ts
|
|
41986
|
-
import { existsSync as
|
|
42195
|
+
import { existsSync as existsSync81, readFileSync as readFileSync63 } from "fs";
|
|
41987
42196
|
|
|
41988
42197
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
41989
42198
|
import { minimatch as minimatch10 } from "minimatch";
|
|
@@ -42024,7 +42233,7 @@ function forbiddenStrings() {
|
|
|
42024
42233
|
const cache7 = /* @__PURE__ */ new Map();
|
|
42025
42234
|
const readJson = (file) => {
|
|
42026
42235
|
if (cache7.has(file)) return cache7.get(file);
|
|
42027
|
-
if (!
|
|
42236
|
+
if (!existsSync81(file)) {
|
|
42028
42237
|
console.log(`Forbidden-strings file not found: ${file}`);
|
|
42029
42238
|
process.exit(1);
|
|
42030
42239
|
}
|
|
@@ -42056,13 +42265,13 @@ Total: ${violations.length} forbidden string(s).`);
|
|
|
42056
42265
|
}
|
|
42057
42266
|
|
|
42058
42267
|
// src/commands/verify/hardcodedColors.ts
|
|
42059
|
-
import { execFileSync as
|
|
42268
|
+
import { execFileSync as execFileSync29 } from "child_process";
|
|
42060
42269
|
import { minimatch as minimatch11 } from "minimatch";
|
|
42061
42270
|
var pattern = "0x[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,6}";
|
|
42062
42271
|
function hardcodedColors() {
|
|
42063
42272
|
const ignoreGlobs = loadConfig().hardcodedColors?.ignore ?? [];
|
|
42064
42273
|
try {
|
|
42065
|
-
const output =
|
|
42274
|
+
const output = execFileSync29("grep", ["-rEnH", "-f", "-", "src/"], {
|
|
42066
42275
|
encoding: "utf8",
|
|
42067
42276
|
input: `${pattern}
|
|
42068
42277
|
`
|
|
@@ -42174,10 +42383,10 @@ function checkSequential(migrations3, files) {
|
|
|
42174
42383
|
}
|
|
42175
42384
|
|
|
42176
42385
|
// src/commands/verify/migrations/listMigrationFiles.ts
|
|
42177
|
-
import { readdirSync as
|
|
42386
|
+
import { readdirSync as readdirSync22 } from "fs";
|
|
42178
42387
|
var MIGRATION_FILE2 = /^migration\d+[A-Za-z0-9]*\.ts$/;
|
|
42179
42388
|
function listMigrationFiles(dir) {
|
|
42180
|
-
return
|
|
42389
|
+
return readdirSync22(dir).filter((file) => MIGRATION_FILE2.test(file));
|
|
42181
42390
|
}
|
|
42182
42391
|
|
|
42183
42392
|
// src/commands/verify/migrations/readBaselineMigrations.ts
|
|
@@ -42712,7 +42921,7 @@ function resolveParams(params, cliArgs) {
|
|
|
42712
42921
|
}
|
|
42713
42922
|
|
|
42714
42923
|
// src/commands/run/resolveRunCwd.ts
|
|
42715
|
-
import { existsSync as
|
|
42924
|
+
import { existsSync as existsSync82 } from "fs";
|
|
42716
42925
|
import { resolve as resolve27 } from "path";
|
|
42717
42926
|
var MissingRunCwdError = class extends Error {
|
|
42718
42927
|
constructor(runName, cwd) {
|
|
@@ -42725,7 +42934,7 @@ var MissingRunCwdError = class extends Error {
|
|
|
42725
42934
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
42726
42935
|
if (!config.cwd) return void 0;
|
|
42727
42936
|
const cwd = resolve27(baseDir, config.cwd);
|
|
42728
|
-
if (!
|
|
42937
|
+
if (!existsSync82(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
42729
42938
|
return cwd;
|
|
42730
42939
|
}
|
|
42731
42940
|
|
|
@@ -42845,10 +43054,10 @@ ${buildWatchReport(from)}`);
|
|
|
42845
43054
|
}
|
|
42846
43055
|
|
|
42847
43056
|
// src/commands/watch/consumeMarker.ts
|
|
42848
|
-
import { existsSync as
|
|
43057
|
+
import { existsSync as existsSync83, rmSync as rmSync10 } from "fs";
|
|
42849
43058
|
function consumeMarker(path108) {
|
|
42850
43059
|
try {
|
|
42851
|
-
if (!
|
|
43060
|
+
if (!existsSync83(path108)) return false;
|
|
42852
43061
|
rmSync10(path108);
|
|
42853
43062
|
return true;
|
|
42854
43063
|
} catch {
|
|
@@ -43281,18 +43490,18 @@ async function auth() {
|
|
|
43281
43490
|
}
|
|
43282
43491
|
|
|
43283
43492
|
// src/commands/roam/postRoamActivity.ts
|
|
43284
|
-
import { execFileSync as
|
|
43285
|
-
import { readdirSync as
|
|
43286
|
-
import { join as
|
|
43493
|
+
import { execFileSync as execFileSync30 } from "child_process";
|
|
43494
|
+
import { readdirSync as readdirSync23, readFileSync as readFileSync65, statSync as statSync13 } from "fs";
|
|
43495
|
+
import { join as join100 } from "path";
|
|
43287
43496
|
function findPortFile(roamDir) {
|
|
43288
43497
|
let entries;
|
|
43289
43498
|
try {
|
|
43290
|
-
entries =
|
|
43499
|
+
entries = readdirSync23(roamDir);
|
|
43291
43500
|
} catch {
|
|
43292
43501
|
return void 0;
|
|
43293
43502
|
}
|
|
43294
43503
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
43295
|
-
const path108 =
|
|
43504
|
+
const path108 = join100(roamDir, name);
|
|
43296
43505
|
try {
|
|
43297
43506
|
return { path: path108, mtimeMs: statSync13(path108).mtimeMs };
|
|
43298
43507
|
} catch {
|
|
@@ -43309,7 +43518,7 @@ var PID_BY_APP = {
|
|
|
43309
43518
|
function postRoamActivity(app, event) {
|
|
43310
43519
|
const appData = process.env.APPDATA;
|
|
43311
43520
|
if (!appData) return;
|
|
43312
|
-
const portFile = findPortFile(
|
|
43521
|
+
const portFile = findPortFile(join100(appData, "Roam"));
|
|
43313
43522
|
if (!portFile) return;
|
|
43314
43523
|
let port;
|
|
43315
43524
|
try {
|
|
@@ -43320,7 +43529,7 @@ function postRoamActivity(app, event) {
|
|
|
43320
43529
|
const pid = PID_BY_APP[app] ?? 99999;
|
|
43321
43530
|
const url = `http://127.0.0.1:${port}/api/v1/activity/${app}/${event}?pid=${pid}`;
|
|
43322
43531
|
try {
|
|
43323
|
-
|
|
43532
|
+
execFileSync30("curl", ["-sf", "--max-time", "0.2", "-X", "POST", url], {
|
|
43324
43533
|
stdio: "ignore"
|
|
43325
43534
|
});
|
|
43326
43535
|
} catch {
|
|
@@ -43495,7 +43704,7 @@ function link2() {
|
|
|
43495
43704
|
|
|
43496
43705
|
// src/commands/run/add.ts
|
|
43497
43706
|
import { mkdirSync as mkdirSync35, writeFileSync as writeFileSync52 } from "fs";
|
|
43498
|
-
import { join as
|
|
43707
|
+
import { join as join101 } from "path";
|
|
43499
43708
|
|
|
43500
43709
|
// src/commands/run/editRepoRunList.ts
|
|
43501
43710
|
async function editRepoRunList(repoName, cwd, edit2) {
|
|
@@ -43666,7 +43875,7 @@ function saveProjectRunConfig(entry) {
|
|
|
43666
43875
|
saveConfig(config);
|
|
43667
43876
|
}
|
|
43668
43877
|
function createCommandFile(name) {
|
|
43669
|
-
const dir =
|
|
43878
|
+
const dir = join101(".claude", "commands");
|
|
43670
43879
|
mkdirSync35(dir, { recursive: true });
|
|
43671
43880
|
const content = `---
|
|
43672
43881
|
description: Run ${name}
|
|
@@ -43674,7 +43883,7 @@ description: Run ${name}
|
|
|
43674
43883
|
|
|
43675
43884
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
43676
43885
|
`;
|
|
43677
|
-
const filePath =
|
|
43886
|
+
const filePath = join101(dir, `${name}.md`);
|
|
43678
43887
|
writeFileSync52(filePath, content);
|
|
43679
43888
|
console.log(`Created command file: ${filePath}`);
|
|
43680
43889
|
}
|
|
@@ -43779,8 +43988,8 @@ function registerRunAdd(runCommand) {
|
|
|
43779
43988
|
}
|
|
43780
43989
|
|
|
43781
43990
|
// src/commands/run/remove.ts
|
|
43782
|
-
import { existsSync as
|
|
43783
|
-
import { join as
|
|
43991
|
+
import { existsSync as existsSync84, unlinkSync as unlinkSync19 } from "fs";
|
|
43992
|
+
import { join as join102 } from "path";
|
|
43784
43993
|
|
|
43785
43994
|
// src/commands/run/removeRepoRunConfig.ts
|
|
43786
43995
|
function isNamed(entry, name) {
|
|
@@ -43798,8 +44007,8 @@ function removeRepoRunConfig(name, repoName, cwd = process.cwd()) {
|
|
|
43798
44007
|
|
|
43799
44008
|
// src/commands/run/remove.ts
|
|
43800
44009
|
function deleteCommandFile(name) {
|
|
43801
|
-
const filePath =
|
|
43802
|
-
if (
|
|
44010
|
+
const filePath = join102(".claude", "commands", `${name}.md`);
|
|
44011
|
+
if (existsSync84(filePath)) {
|
|
43803
44012
|
unlinkSync19(filePath);
|
|
43804
44013
|
console.log(`Deleted command file: ${filePath}`);
|
|
43805
44014
|
}
|
|
@@ -43868,11 +44077,11 @@ function formatLink(link3) {
|
|
|
43868
44077
|
}
|
|
43869
44078
|
|
|
43870
44079
|
// src/commands/sessions/daemon/listDaemonPids.ts
|
|
43871
|
-
import { execFileSync as
|
|
44080
|
+
import { execFileSync as execFileSync31 } from "child_process";
|
|
43872
44081
|
function listDaemonPids() {
|
|
43873
44082
|
if (process.platform === "win32") return [];
|
|
43874
44083
|
try {
|
|
43875
|
-
const out =
|
|
44084
|
+
const out = execFileSync31("ps", ["-eo", "pid=,args="], {
|
|
43876
44085
|
encoding: "utf8"
|
|
43877
44086
|
});
|
|
43878
44087
|
return out.split("\n").filter((line) => line.includes("assist") && / daemon run\b/.test(line)).map((line) => Number.parseInt(line.trim(), 10)).filter((pid) => Number.isInteger(pid));
|
|
@@ -44247,12 +44456,12 @@ function toSessionRunInfo({
|
|
|
44247
44456
|
}
|
|
44248
44457
|
|
|
44249
44458
|
// src/commands/sessions/daemon/worktree/joinRefusal.ts
|
|
44250
|
-
import { existsSync as
|
|
44459
|
+
import { existsSync as existsSync85 } from "fs";
|
|
44251
44460
|
function joinRefusal(session) {
|
|
44252
44461
|
if (session.commandType === "run") return "a server run has no agent stream";
|
|
44253
44462
|
if (session.closing === true) return "the session is closing";
|
|
44254
44463
|
if (!session.cwd) return "the session has no working directory";
|
|
44255
|
-
if (!
|
|
44464
|
+
if (!existsSync85(session.cwd))
|
|
44256
44465
|
return "the session's workspace no longer exists";
|
|
44257
44466
|
return void 0;
|
|
44258
44467
|
}
|
|
@@ -44333,8 +44542,8 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
|
|
|
44333
44542
|
}
|
|
44334
44543
|
|
|
44335
44544
|
// src/commands/sessions/daemon/findServerParents.ts
|
|
44336
|
-
import { existsSync as
|
|
44337
|
-
import { join as
|
|
44545
|
+
import { existsSync as existsSync86 } from "fs";
|
|
44546
|
+
import { join as join103, resolve as resolve29 } from "path";
|
|
44338
44547
|
function isLive(session) {
|
|
44339
44548
|
return !!session.pty && session.status !== "done" && session.status !== "error";
|
|
44340
44549
|
}
|
|
@@ -44343,7 +44552,7 @@ function isLiveAgent(session) {
|
|
|
44343
44552
|
}
|
|
44344
44553
|
function serverRunDirs(sessions, file) {
|
|
44345
44554
|
return new Set(
|
|
44346
|
-
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve29(s.cwd)).filter((dir) =>
|
|
44555
|
+
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve29(s.cwd)).filter((dir) => existsSync86(join103(dir, file)))
|
|
44347
44556
|
);
|
|
44348
44557
|
}
|
|
44349
44558
|
function findServerParents(sessions, file) {
|
|
@@ -44959,11 +45168,11 @@ function sessionBase(id, status2) {
|
|
|
44959
45168
|
}
|
|
44960
45169
|
|
|
44961
45170
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
44962
|
-
import { existsSync as
|
|
45171
|
+
import { existsSync as existsSync89 } from "fs";
|
|
44963
45172
|
import * as pty from "node-pty";
|
|
44964
45173
|
|
|
44965
45174
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
44966
|
-
import { chmodSync, existsSync as
|
|
45175
|
+
import { chmodSync, existsSync as existsSync88, statSync as statSync14 } from "fs";
|
|
44967
45176
|
import { createRequire as createRequire3 } from "module";
|
|
44968
45177
|
import path105 from "path";
|
|
44969
45178
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -44978,7 +45187,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
44978
45187
|
`${process.platform}-${process.arch}`,
|
|
44979
45188
|
"spawn-helper"
|
|
44980
45189
|
);
|
|
44981
|
-
if (!
|
|
45190
|
+
if (!existsSync88(helper)) return;
|
|
44982
45191
|
const mode = statSync14(helper).mode;
|
|
44983
45192
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
44984
45193
|
}
|
|
@@ -45034,7 +45243,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
|
|
|
45034
45243
|
});
|
|
45035
45244
|
}
|
|
45036
45245
|
function refuseMissingCwd(cwd, sessionId) {
|
|
45037
|
-
if (!cwd ||
|
|
45246
|
+
if (!cwd || existsSync89(cwd)) return;
|
|
45038
45247
|
daemonLog(
|
|
45039
45248
|
`${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
|
|
45040
45249
|
);
|
|
@@ -45204,7 +45413,7 @@ function createRunSession(id, { runName, runArgs, cwd, meta }) {
|
|
|
45204
45413
|
}
|
|
45205
45414
|
|
|
45206
45415
|
// src/commands/sessions/daemon/autoUpdate/autoUpdateControl.ts
|
|
45207
|
-
import { existsSync as
|
|
45416
|
+
import { existsSync as existsSync90, rmSync as rmSync11, writeFileSync as writeFileSync54 } from "fs";
|
|
45208
45417
|
var paused;
|
|
45209
45418
|
var wake;
|
|
45210
45419
|
function persist2(value) {
|
|
@@ -45216,7 +45425,7 @@ function persist2(value) {
|
|
|
45216
45425
|
}
|
|
45217
45426
|
var autoUpdateControl = {
|
|
45218
45427
|
paused: () => {
|
|
45219
|
-
paused ??=
|
|
45428
|
+
paused ??= existsSync90(daemonPaths.autoUpdatePaused);
|
|
45220
45429
|
return paused;
|
|
45221
45430
|
},
|
|
45222
45431
|
setPaused: (value) => {
|
|
@@ -45413,7 +45622,7 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
45413
45622
|
}
|
|
45414
45623
|
|
|
45415
45624
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
45416
|
-
import { existsSync as
|
|
45625
|
+
import { existsSync as existsSync91 } from "fs";
|
|
45417
45626
|
var treeIsGone = { durable: true, gone: true };
|
|
45418
45627
|
function treeDurability(state) {
|
|
45419
45628
|
if (state.dirty) return { durable: false, reason: "uncommitted changes" };
|
|
@@ -45444,14 +45653,14 @@ function* durabilityProbes() {
|
|
|
45444
45653
|
});
|
|
45445
45654
|
}
|
|
45446
45655
|
async function checkDurability(cwd) {
|
|
45447
|
-
if (!
|
|
45656
|
+
if (!existsSync91(cwd)) return treeIsGone;
|
|
45448
45657
|
const probes = durabilityProbes();
|
|
45449
45658
|
let step3 = probes.next();
|
|
45450
45659
|
while (!step3.done) step3 = probes.next(await gitResult(cwd, step3.value));
|
|
45451
45660
|
return step3.value;
|
|
45452
45661
|
}
|
|
45453
45662
|
function checkDurabilitySync(cwd) {
|
|
45454
|
-
if (!
|
|
45663
|
+
if (!existsSync91(cwd)) return treeIsGone;
|
|
45455
45664
|
const probes = durabilityProbes();
|
|
45456
45665
|
let step3 = probes.next();
|
|
45457
45666
|
while (!step3.done) step3 = probes.next(gitSyncResult(cwd, step3.value));
|
|
@@ -45705,17 +45914,17 @@ function setStatus2(session, newStatus) {
|
|
|
45705
45914
|
}
|
|
45706
45915
|
|
|
45707
45916
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
45708
|
-
import { existsSync as
|
|
45917
|
+
import { existsSync as existsSync93 } from "fs";
|
|
45709
45918
|
import { basename as basename30 } from "path";
|
|
45710
45919
|
|
|
45711
45920
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
45712
|
-
import { existsSync as
|
|
45713
|
-
import { join as
|
|
45921
|
+
import { existsSync as existsSync92 } from "fs";
|
|
45922
|
+
import { join as join107 } from "path";
|
|
45714
45923
|
|
|
45715
45924
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
45716
45925
|
import { statSync as statSync15 } from "fs";
|
|
45717
45926
|
import { rm as rm3 } from "fs/promises";
|
|
45718
|
-
import { join as
|
|
45927
|
+
import { join as join106 } from "path";
|
|
45719
45928
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
45720
45929
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
45721
45930
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -45743,7 +45952,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
45743
45952
|
return { removed: true };
|
|
45744
45953
|
}
|
|
45745
45954
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
45746
|
-
return statSync15(
|
|
45955
|
+
return statSync15(join106(worktreePath, ".git"), {
|
|
45747
45956
|
throwIfNoEntry: false
|
|
45748
45957
|
})?.isDirectory() === true;
|
|
45749
45958
|
}
|
|
@@ -45779,7 +45988,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
45779
45988
|
);
|
|
45780
45989
|
}
|
|
45781
45990
|
function strandedReason(worktreePath, cause) {
|
|
45782
|
-
if (!
|
|
45991
|
+
if (!existsSync92(join107(worktreePath, ".git")))
|
|
45783
45992
|
return "its .git link is already gone";
|
|
45784
45993
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
45785
45994
|
return "git no longer recognises it as a working tree";
|
|
@@ -45831,7 +46040,7 @@ function reason3(error) {
|
|
|
45831
46040
|
|
|
45832
46041
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
45833
46042
|
async function reapWorktree(worktreePath, force = false) {
|
|
45834
|
-
if (!
|
|
46043
|
+
if (!existsSync93(worktreePath)) {
|
|
45835
46044
|
forgetWorktree(worktreePath);
|
|
45836
46045
|
daemonLog(
|
|
45837
46046
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -45856,7 +46065,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
45856
46065
|
}
|
|
45857
46066
|
function owningClone(worktreePath) {
|
|
45858
46067
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
45859
|
-
if (recorded &&
|
|
46068
|
+
if (recorded && existsSync93(recorded)) return recorded;
|
|
45860
46069
|
const detected = mainWorktree(worktreePath);
|
|
45861
46070
|
if (detected) return detected;
|
|
45862
46071
|
daemonLog(
|
|
@@ -46004,12 +46213,12 @@ function closeGateApplies(sessions, session) {
|
|
|
46004
46213
|
}
|
|
46005
46214
|
|
|
46006
46215
|
// src/commands/sessions/daemon/worktree/liveProcessesInTree.ts
|
|
46007
|
-
import { readdirSync as
|
|
46216
|
+
import { readdirSync as readdirSync25, readlinkSync } from "fs";
|
|
46008
46217
|
import { sep as sep4 } from "path";
|
|
46009
46218
|
function liveProcessesInTree(treePath, procRoot = "/proc") {
|
|
46010
46219
|
let entries;
|
|
46011
46220
|
try {
|
|
46012
|
-
entries =
|
|
46221
|
+
entries = readdirSync25(procRoot);
|
|
46013
46222
|
} catch {
|
|
46014
46223
|
return [];
|
|
46015
46224
|
}
|
|
@@ -46076,12 +46285,12 @@ async function closeBlockReason(sessionId, tree) {
|
|
|
46076
46285
|
}
|
|
46077
46286
|
|
|
46078
46287
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
46079
|
-
import { existsSync as
|
|
46288
|
+
import { existsSync as existsSync94, watch } from "fs";
|
|
46080
46289
|
var DEBOUNCE_MS = 500;
|
|
46081
46290
|
var POLL_MS3 = 3e4;
|
|
46082
46291
|
function watchGitState(cwd, onChange) {
|
|
46083
46292
|
const common = gitCommonDir(cwd);
|
|
46084
|
-
if (!common || !
|
|
46293
|
+
if (!common || !existsSync94(common)) return void 0;
|
|
46085
46294
|
const watchers = [
|
|
46086
46295
|
watchGitDir(common, onChange),
|
|
46087
46296
|
pollGitState(cwd, onChange)
|
|
@@ -46762,10 +46971,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
46762
46971
|
}
|
|
46763
46972
|
|
|
46764
46973
|
// src/commands/sessions/daemon/exitReason.ts
|
|
46765
|
-
import { existsSync as
|
|
46974
|
+
import { existsSync as existsSync95 } from "fs";
|
|
46766
46975
|
import { resolve as resolve30 } from "path";
|
|
46767
46976
|
function exitDetail(session) {
|
|
46768
|
-
if (session.cwd && !
|
|
46977
|
+
if (session.cwd && !existsSync95(session.cwd))
|
|
46769
46978
|
return `working directory ${session.cwd} no longer exists`;
|
|
46770
46979
|
return missingRunConfigCwd(session);
|
|
46771
46980
|
}
|
|
@@ -46779,7 +46988,7 @@ function missingRunConfigCwd(session) {
|
|
|
46779
46988
|
const config = resolveRunConfig(session.runName, dir);
|
|
46780
46989
|
if (!config?.cwd) return void 0;
|
|
46781
46990
|
const configured = resolve30(runConfigBaseDirFrom(dir), config.cwd);
|
|
46782
|
-
if (
|
|
46991
|
+
if (existsSync95(configured)) return void 0;
|
|
46783
46992
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
46784
46993
|
}
|
|
46785
46994
|
|
|
@@ -46827,7 +47036,7 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
|
|
|
46827
47036
|
}
|
|
46828
47037
|
|
|
46829
47038
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
46830
|
-
import { existsSync as
|
|
47039
|
+
import { existsSync as existsSync96, mkdirSync as mkdirSync37, watch as watch2 } from "fs";
|
|
46831
47040
|
import { dirname as dirname45 } from "path";
|
|
46832
47041
|
|
|
46833
47042
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
@@ -46913,7 +47122,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
46913
47122
|
if (timer) clearTimeout(timer);
|
|
46914
47123
|
timer = setTimeout(read3, DEBOUNCE_MS2);
|
|
46915
47124
|
});
|
|
46916
|
-
if (
|
|
47125
|
+
if (existsSync96(path108)) read3();
|
|
46917
47126
|
}
|
|
46918
47127
|
function refreshActivity(session) {
|
|
46919
47128
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -48153,7 +48362,7 @@ function releaseClient(client, clients, prPreview, verify) {
|
|
|
48153
48362
|
}
|
|
48154
48363
|
|
|
48155
48364
|
// src/commands/sessions/daemon/findPortHolderPid.ts
|
|
48156
|
-
import { execFileSync as
|
|
48365
|
+
import { execFileSync as execFileSync32 } from "child_process";
|
|
48157
48366
|
var PROBE_TIMEOUT_MS = 3e3;
|
|
48158
48367
|
function findPortHolderPid(port) {
|
|
48159
48368
|
try {
|
|
@@ -48163,7 +48372,7 @@ function findPortHolderPid(port) {
|
|
|
48163
48372
|
}
|
|
48164
48373
|
}
|
|
48165
48374
|
function probe(command, args) {
|
|
48166
|
-
return
|
|
48375
|
+
return execFileSync32(command, args, {
|
|
48167
48376
|
encoding: "utf8",
|
|
48168
48377
|
timeout: PROBE_TIMEOUT_MS,
|
|
48169
48378
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -48908,7 +49117,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
48908
49117
|
}
|
|
48909
49118
|
|
|
48910
49119
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
48911
|
-
import { existsSync as
|
|
49120
|
+
import { existsSync as existsSync98 } from "fs";
|
|
48912
49121
|
import { basename as basename32 } from "path";
|
|
48913
49122
|
|
|
48914
49123
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -48929,9 +49138,9 @@ function accountedTrees(sessions) {
|
|
|
48929
49138
|
}
|
|
48930
49139
|
|
|
48931
49140
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
48932
|
-
import { existsSync as
|
|
49141
|
+
import { existsSync as existsSync97 } from "fs";
|
|
48933
49142
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
48934
|
-
if (!
|
|
49143
|
+
if (!existsSync97(clone)) {
|
|
48935
49144
|
for (const { path: path108 } of paths) forgetWorktree(path108);
|
|
48936
49145
|
daemonLog(
|
|
48937
49146
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
@@ -49097,7 +49306,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
49097
49306
|
);
|
|
49098
49307
|
continue;
|
|
49099
49308
|
}
|
|
49100
|
-
if (!
|
|
49309
|
+
if (!existsSync98(path108)) {
|
|
49101
49310
|
logVanishedTree(sessions, path108);
|
|
49102
49311
|
vanished.set(clone, [
|
|
49103
49312
|
...vanished.get(clone) ?? [],
|
|
@@ -50134,7 +50343,7 @@ function spawnAssistInTree(ctx, assistArgs, cwd, meta, context) {
|
|
|
50134
50343
|
}
|
|
50135
50344
|
|
|
50136
50345
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
50137
|
-
import { existsSync as
|
|
50346
|
+
import { existsSync as existsSync101 } from "fs";
|
|
50138
50347
|
|
|
50139
50348
|
// src/commands/sessions/daemon/resumeSession.ts
|
|
50140
50349
|
function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
@@ -50165,11 +50374,11 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
|
50165
50374
|
}
|
|
50166
50375
|
|
|
50167
50376
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
50168
|
-
import { existsSync as
|
|
50377
|
+
import { existsSync as existsSync100 } from "fs";
|
|
50169
50378
|
|
|
50170
50379
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
50171
|
-
import { copyFileSync as copyFileSync4, existsSync as
|
|
50172
|
-
import { join as
|
|
50380
|
+
import { copyFileSync as copyFileSync4, existsSync as existsSync99, mkdirSync as mkdirSync39 } from "fs";
|
|
50381
|
+
import { join as join108 } from "path";
|
|
50173
50382
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
50174
50383
|
const dir = projectDirForCwd(toCwd);
|
|
50175
50384
|
if (dir === projectDirForCwd(fromCwd)) {
|
|
@@ -50178,8 +50387,8 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
50178
50387
|
);
|
|
50179
50388
|
return;
|
|
50180
50389
|
}
|
|
50181
|
-
const dest =
|
|
50182
|
-
if (
|
|
50390
|
+
const dest = join108(dir, `${claudeSessionId}.jsonl`);
|
|
50391
|
+
if (existsSync99(dest)) {
|
|
50183
50392
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
50184
50393
|
return;
|
|
50185
50394
|
}
|
|
@@ -50230,7 +50439,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
|
|
|
50230
50439
|
}
|
|
50231
50440
|
function cloneForReapedTree(missingCwd) {
|
|
50232
50441
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
50233
|
-
if (!clone || !
|
|
50442
|
+
if (!clone || !existsSync100(clone))
|
|
50234
50443
|
throw new Error(
|
|
50235
50444
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
50236
50445
|
);
|
|
@@ -50239,7 +50448,7 @@ function cloneForReapedTree(missingCwd) {
|
|
|
50239
50448
|
|
|
50240
50449
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
50241
50450
|
function resumeInTree(ctx, sessionId, cwd, name, harness) {
|
|
50242
|
-
if (!
|
|
50451
|
+
if (!existsSync101(cwd))
|
|
50243
50452
|
return resumeInReplacementTree(ctx, sessionId, cwd, name, harness);
|
|
50244
50453
|
const id = ctx.spawnWith(
|
|
50245
50454
|
(sid) => resumeSession(sid, sessionId, cwd, name, void 0, harness)
|
|
@@ -51237,25 +51446,26 @@ function isPrCheckoutArgs(args) {
|
|
|
51237
51446
|
|
|
51238
51447
|
// src/commands/sessions/daemon/worktree/prCheckoutHolder.ts
|
|
51239
51448
|
import { execFile as execFile14 } from "child_process";
|
|
51240
|
-
import { existsSync as
|
|
51449
|
+
import { existsSync as existsSync102 } from "fs";
|
|
51241
51450
|
function prHeadBranch2(number, cwd) {
|
|
51451
|
+
const { headBranch } = prCliCommands(number, cwd);
|
|
51242
51452
|
return new Promise((resolve31) => {
|
|
51243
51453
|
execFile14(
|
|
51244
|
-
|
|
51245
|
-
|
|
51454
|
+
headBranch.file,
|
|
51455
|
+
headBranch.args,
|
|
51246
51456
|
{ cwd, encoding: "utf8", windowsHide: true },
|
|
51247
|
-
(error, stdout) => resolve31(error ? null :
|
|
51457
|
+
(error, stdout) => resolve31(error ? null : headBranch.parse(stdout))
|
|
51248
51458
|
);
|
|
51249
51459
|
});
|
|
51250
51460
|
}
|
|
51251
51461
|
async function prCheckoutHolder(assistArgs, cwd) {
|
|
51252
51462
|
const number = prCheckoutNumber(assistArgs);
|
|
51253
|
-
if (!number || !cwd || !
|
|
51463
|
+
if (!number || !cwd || !existsSync102(cwd)) return void 0;
|
|
51254
51464
|
const headRef = await prHeadBranch2(number, cwd);
|
|
51255
51465
|
if (!headRef) return void 0;
|
|
51256
51466
|
const listing = await gitOrNull(cwd, ["worktree", "list", "--porcelain"]);
|
|
51257
51467
|
const holder = listing ? worktreeWithBranch(listing, headRef) : null;
|
|
51258
|
-
if (!holder || !
|
|
51468
|
+
if (!holder || !existsSync102(holder)) return void 0;
|
|
51259
51469
|
daemonLog(
|
|
51260
51470
|
`pr #${number} assist ${assistArgs[0]} launched in its checkout ${holder}: head branch ${headRef} is already checked out there, so no worktree is allocated`
|
|
51261
51471
|
);
|