@staff0rd/assist 0.924.0 → 0.926.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/claude/skills/review-ci/scripts/review.mjs +2 -2
- package/dist/commands/extension/extension/content.js +39 -39
- package/dist/commands/extension/extension/manifest.json +8 -2
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +914 -649
- 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.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -826,6 +826,7 @@ function stripLegacyConfigKeys(config) {
|
|
|
826
826
|
const stripped = { ...config };
|
|
827
827
|
if (stripped.repos) stripped.repos = stripRepos(stripped.repos);
|
|
828
828
|
delete stripped.backlog;
|
|
829
|
+
delete stripped.cliReadVerbs;
|
|
829
830
|
const news = stripped.news;
|
|
830
831
|
if (news && typeof news === "object" && "feeds" in news) {
|
|
831
832
|
const { feeds: _feeds, ...rest } = news;
|
|
@@ -1251,7 +1252,6 @@ var assistConfigShape = {
|
|
|
1251
1252
|
}).optional(),
|
|
1252
1253
|
run: z6.array(z6.union([runConfigSchema, runLinkSchema])).optional(),
|
|
1253
1254
|
transcript: transcriptConfigSchema.optional(),
|
|
1254
|
-
cliReadVerbs: z6.record(z6.string(), z6.array(z6.string())).optional(),
|
|
1255
1255
|
cliHook: z6.strictObject({
|
|
1256
1256
|
blockNpmRun: z6.boolean().default(true)
|
|
1257
1257
|
}).optional(),
|
|
@@ -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
|
}
|
|
@@ -5919,11 +6029,6 @@ var branchConfigHelp = [
|
|
|
5919
6029
|
|
|
5920
6030
|
// src/commands/cliHook/cliHookConfigHelp.ts
|
|
5921
6031
|
var cliHookConfigHelp = [
|
|
5922
|
-
{
|
|
5923
|
-
key: "cliReadVerbs",
|
|
5924
|
-
setter: 'assist config set cliReadVerbs.git "status"',
|
|
5925
|
-
note: "extra per-CLI verbs treated as read-only for auto-approval"
|
|
5926
|
-
},
|
|
5927
6032
|
{
|
|
5928
6033
|
key: "cliHook.blockNpmRun",
|
|
5929
6034
|
setter: "assist config set cliHook.blockNpmRun false",
|
|
@@ -6802,14 +6907,14 @@ function assertNoDuplicateRunNames(configs) {
|
|
|
6802
6907
|
}
|
|
6803
6908
|
|
|
6804
6909
|
// src/shared/findLinkedConfigPath.ts
|
|
6805
|
-
import { existsSync as
|
|
6806
|
-
import { join as
|
|
6910
|
+
import { existsSync as existsSync15 } from "fs";
|
|
6911
|
+
import { join as join20, resolve as resolve5 } from "path";
|
|
6807
6912
|
function findLinkedConfigPath(linkPath, fromDir) {
|
|
6808
6913
|
const resolved = resolve5(fromDir, linkPath);
|
|
6809
|
-
const claudePath =
|
|
6810
|
-
if (
|
|
6811
|
-
const rootPath =
|
|
6812
|
-
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;
|
|
6813
6918
|
throw new Error(`No assist.yml found in linked project: ${resolved}`);
|
|
6814
6919
|
}
|
|
6815
6920
|
|
|
@@ -6878,12 +6983,12 @@ function resolveLocalCwd(config, configDir, ctx) {
|
|
|
6878
6983
|
}
|
|
6879
6984
|
|
|
6880
6985
|
// src/shared/findRepoRoot.ts
|
|
6881
|
-
import { existsSync as
|
|
6986
|
+
import { existsSync as existsSync16 } from "fs";
|
|
6882
6987
|
import path8 from "path";
|
|
6883
6988
|
function findRepoRoot(dir) {
|
|
6884
6989
|
let current = dir;
|
|
6885
6990
|
while (current !== path8.dirname(current)) {
|
|
6886
|
-
if (
|
|
6991
|
+
if (existsSync16(path8.join(current, ".git"))) {
|
|
6887
6992
|
return current;
|
|
6888
6993
|
}
|
|
6889
6994
|
current = path8.dirname(current);
|
|
@@ -6918,18 +7023,18 @@ function handleServerRuns(req, res) {
|
|
|
6918
7023
|
import { execFile as execFile4 } from "child_process";
|
|
6919
7024
|
import { readFileSync as readFileSync7 } from "fs";
|
|
6920
7025
|
import { homedir as homedir10 } from "os";
|
|
6921
|
-
import { basename as basename7, join as
|
|
7026
|
+
import { basename as basename7, join as join22 } from "path";
|
|
6922
7027
|
import { promisify as promisify4 } from "util";
|
|
6923
7028
|
|
|
6924
7029
|
// src/commands/sessions/web/findSynthesisForBranch.ts
|
|
6925
|
-
import { existsSync as
|
|
6926
|
-
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";
|
|
6927
7032
|
function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
6928
|
-
const branchKeyPath =
|
|
7033
|
+
const branchKeyPath = join21(repoReviewsDir, `${branch2}-`);
|
|
6929
7034
|
const parent = dirname10(branchKeyPath);
|
|
6930
7035
|
const branchPrefix = basename6(branchKeyPath);
|
|
6931
|
-
if (!
|
|
6932
|
-
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);
|
|
6933
7038
|
return synthesisFiles[0]?.path ?? null;
|
|
6934
7039
|
}
|
|
6935
7040
|
|
|
@@ -6947,7 +7052,7 @@ async function resolveSynthesisPath(cwd) {
|
|
|
6947
7052
|
runGit2(cwd, ["rev-parse", "--show-toplevel"]),
|
|
6948
7053
|
runGit2(cwd, ["rev-parse", "--abbrev-ref", "HEAD"])
|
|
6949
7054
|
]);
|
|
6950
|
-
const repoReviewsDir =
|
|
7055
|
+
const repoReviewsDir = join22(
|
|
6951
7056
|
homedir10(),
|
|
6952
7057
|
".assist",
|
|
6953
7058
|
"reviews",
|
|
@@ -8362,7 +8467,7 @@ async function nextPickup(req, res) {
|
|
|
8362
8467
|
import path11 from "path";
|
|
8363
8468
|
|
|
8364
8469
|
// src/commands/rules/readScopedRules.ts
|
|
8365
|
-
import { existsSync as
|
|
8470
|
+
import { existsSync as existsSync19, readFileSync as readFileSync8 } from "fs";
|
|
8366
8471
|
import path10 from "path";
|
|
8367
8472
|
|
|
8368
8473
|
// src/commands/rules/rulesSectionRange.ts
|
|
@@ -8411,11 +8516,11 @@ function parseRulesSection(content) {
|
|
|
8411
8516
|
}
|
|
8412
8517
|
|
|
8413
8518
|
// src/commands/rules/scopeDirectory.ts
|
|
8414
|
-
import { existsSync as
|
|
8519
|
+
import { existsSync as existsSync18, statSync as statSync5 } from "fs";
|
|
8415
8520
|
import path9 from "path";
|
|
8416
8521
|
function scopeDirectory(target) {
|
|
8417
8522
|
const resolved = path9.resolve(target);
|
|
8418
|
-
return
|
|
8523
|
+
return existsSync18(resolved) && statSync5(resolved).isDirectory() ? resolved : path9.dirname(resolved);
|
|
8419
8524
|
}
|
|
8420
8525
|
|
|
8421
8526
|
// src/commands/rules/readScopedRules.ts
|
|
@@ -8426,7 +8531,7 @@ function scopedClaudeFiles(target) {
|
|
|
8426
8531
|
let current = startDir;
|
|
8427
8532
|
while (true) {
|
|
8428
8533
|
const candidate = path10.join(current, "CLAUDE.md");
|
|
8429
|
-
if (
|
|
8534
|
+
if (existsSync19(candidate)) files.push(candidate);
|
|
8430
8535
|
if (current === root2 || current === path10.dirname(current)) break;
|
|
8431
8536
|
current = path10.dirname(current);
|
|
8432
8537
|
}
|
|
@@ -9812,7 +9917,7 @@ async function revertDiffFile(req, res) {
|
|
|
9812
9917
|
|
|
9813
9918
|
// src/commands/run/runCommandToCompletion.ts
|
|
9814
9919
|
import { spawn as spawn2 } from "child_process";
|
|
9815
|
-
import { existsSync as
|
|
9920
|
+
import { existsSync as existsSync21 } from "fs";
|
|
9816
9921
|
|
|
9817
9922
|
// src/shared/expandEnv.ts
|
|
9818
9923
|
import { homedir as homedir11 } from "os";
|
|
@@ -9827,15 +9932,15 @@ function expandEnv(env) {
|
|
|
9827
9932
|
|
|
9828
9933
|
// src/commands/run/resolveCommand.ts
|
|
9829
9934
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
9830
|
-
import { existsSync as
|
|
9831
|
-
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";
|
|
9832
9937
|
function resolveCommand(command) {
|
|
9833
9938
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
9834
9939
|
try {
|
|
9835
9940
|
const gitPath = execFileSync3("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
9836
9941
|
const gitRoot = resolve10(dirname11(gitPath), "..");
|
|
9837
|
-
const gitBash =
|
|
9838
|
-
if (
|
|
9942
|
+
const gitBash = join23(gitRoot, "bin", "bash.exe");
|
|
9943
|
+
if (existsSync20(gitBash)) return gitBash;
|
|
9839
9944
|
} catch {
|
|
9840
9945
|
return command;
|
|
9841
9946
|
}
|
|
@@ -9845,7 +9950,7 @@ function resolveCommand(command) {
|
|
|
9845
9950
|
// src/commands/run/runCommandToCompletion.ts
|
|
9846
9951
|
function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
9847
9952
|
return new Promise((resolveResult) => {
|
|
9848
|
-
if (cwd && !
|
|
9953
|
+
if (cwd && !existsSync21(cwd)) {
|
|
9849
9954
|
resolveResult({
|
|
9850
9955
|
kind: "failed",
|
|
9851
9956
|
message: `Failed to execute command: cwd ${cwd} does not exist`
|
|
@@ -10972,7 +11077,7 @@ function changedPaths(from, cwd) {
|
|
|
10972
11077
|
}
|
|
10973
11078
|
|
|
10974
11079
|
// src/commands/watch/readBuiltVersion.ts
|
|
10975
|
-
import { join as
|
|
11080
|
+
import { join as join25 } from "path";
|
|
10976
11081
|
|
|
10977
11082
|
// src/shared/readPackageJson.ts
|
|
10978
11083
|
import * as fs6 from "fs";
|
|
@@ -11022,7 +11127,7 @@ function findPackageJsonWithVerifyScripts(startDir) {
|
|
|
11022
11127
|
function readBuiltVersion(cwd) {
|
|
11023
11128
|
try {
|
|
11024
11129
|
const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
11025
|
-
return readPackageJson(
|
|
11130
|
+
return readPackageJson(join25(root2, "package.json")).version ?? "unknown";
|
|
11026
11131
|
} catch {
|
|
11027
11132
|
return "unknown";
|
|
11028
11133
|
}
|
|
@@ -11075,7 +11180,7 @@ function stripAnsi(text17) {
|
|
|
11075
11180
|
// src/commands/sessions/daemon/worktree/watcherLogPath.ts
|
|
11076
11181
|
import { createHash } from "crypto";
|
|
11077
11182
|
import { homedir as homedir12 } from "os";
|
|
11078
|
-
import { basename as basename8, join as
|
|
11183
|
+
import { basename as basename8, join as join26 } from "path";
|
|
11079
11184
|
|
|
11080
11185
|
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
11081
11186
|
import { realpathSync } from "fs";
|
|
@@ -11092,8 +11197,8 @@ function canonicalTreePath(path108) {
|
|
|
11092
11197
|
function watcherLogPath(cwd) {
|
|
11093
11198
|
const clone = canonicalTreePath(cwd);
|
|
11094
11199
|
const key = createHash("sha1").update(clone).digest("hex").slice(0, 8);
|
|
11095
|
-
const dir = process.env.ASSIST_WATCHER_LOG_DIR ??
|
|
11096
|
-
return
|
|
11200
|
+
const dir = process.env.ASSIST_WATCHER_LOG_DIR ?? join26(homedir12(), ".assist", "watchers");
|
|
11201
|
+
return join26(dir, `${basename8(clone) || "root"}-${key}.log`);
|
|
11097
11202
|
}
|
|
11098
11203
|
|
|
11099
11204
|
// src/commands/sessions/web/updates/readUpdateHistory.ts
|
|
@@ -11208,7 +11313,7 @@ async function readRequestBuffer(req, limit) {
|
|
|
11208
11313
|
|
|
11209
11314
|
// src/commands/sessions/web/stageAttachment.ts
|
|
11210
11315
|
import { mkdir, mkdtemp, writeFile } from "fs/promises";
|
|
11211
|
-
import { extname as extname2, join as
|
|
11316
|
+
import { extname as extname2, join as join27 } from "path";
|
|
11212
11317
|
|
|
11213
11318
|
// src/commands/sessions/web/ghAttachableExtensions.ts
|
|
11214
11319
|
var ghAttachableExtensions = /* @__PURE__ */ new Set([
|
|
@@ -11240,9 +11345,9 @@ function safeBaseName(name) {
|
|
|
11240
11345
|
async function stageAttachment(name, contentType, body) {
|
|
11241
11346
|
const ext = pickExtension(name, contentType);
|
|
11242
11347
|
await mkdir(stagedAttachmentsDir, { recursive: true });
|
|
11243
|
-
const dir = await mkdtemp(
|
|
11348
|
+
const dir = await mkdtemp(join27(stagedAttachmentsDir, "upload-"));
|
|
11244
11349
|
const alt = safeBaseName(name);
|
|
11245
|
-
const filePath =
|
|
11350
|
+
const filePath = join27(dir, `${alt}.${ext}`);
|
|
11246
11351
|
await writeFile(filePath, body);
|
|
11247
11352
|
return { dir, filePath, alt };
|
|
11248
11353
|
}
|
|
@@ -11291,16 +11396,16 @@ import { readFile as readFile2, stat as stat3, writeFile as writeFile2 } from "f
|
|
|
11291
11396
|
|
|
11292
11397
|
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
11293
11398
|
import { execFile as execFile9 } from "child_process";
|
|
11294
|
-
import { existsSync as
|
|
11295
|
-
import { dirname as dirname14, join as
|
|
11399
|
+
import { existsSync as existsSync23 } from "fs";
|
|
11400
|
+
import { dirname as dirname14, join as join28 } from "path";
|
|
11296
11401
|
import { promisify as promisify10 } from "util";
|
|
11297
11402
|
var execFileAsync9 = promisify10(execFile9);
|
|
11298
11403
|
var TIMEOUT_MS = 15e3;
|
|
11299
11404
|
function findOxfmtScript(root2) {
|
|
11300
11405
|
let dir = root2;
|
|
11301
11406
|
for (; ; ) {
|
|
11302
|
-
const candidate =
|
|
11303
|
-
if (
|
|
11407
|
+
const candidate = join28(dir, "node_modules", "oxfmt", "bin", "oxfmt");
|
|
11408
|
+
if (existsSync23(candidate)) return candidate;
|
|
11304
11409
|
const parent = dirname14(dir);
|
|
11305
11410
|
if (parent === dir) return void 0;
|
|
11306
11411
|
dir = parent;
|
|
@@ -11372,10 +11477,10 @@ async function writeFileContent(req, res) {
|
|
|
11372
11477
|
// src/shared/createBundleHandler.ts
|
|
11373
11478
|
import { createHash as createHash2 } from "crypto";
|
|
11374
11479
|
import { readFileSync as readFileSync10, statSync as statSync6 } from "fs";
|
|
11375
|
-
import { dirname as dirname15, join as
|
|
11480
|
+
import { dirname as dirname15, join as join29 } from "path";
|
|
11376
11481
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
11377
11482
|
function createBundleHandler(importMetaUrl, bundlePath, contentType = "application/javascript") {
|
|
11378
|
-
const file =
|
|
11483
|
+
const file = join29(dirname15(fileURLToPath2(importMetaUrl)), bundlePath);
|
|
11379
11484
|
let cache7;
|
|
11380
11485
|
return (req, res) => {
|
|
11381
11486
|
const mtimeMs = statSync6(file).mtimeMs;
|
|
@@ -11802,9 +11907,9 @@ function originForCwd(cwd) {
|
|
|
11802
11907
|
}
|
|
11803
11908
|
|
|
11804
11909
|
// src/commands/sessions/daemon/repoDirExists.ts
|
|
11805
|
-
import { existsSync as
|
|
11910
|
+
import { existsSync as existsSync24 } from "fs";
|
|
11806
11911
|
function repoDirExists(cwd) {
|
|
11807
|
-
return
|
|
11912
|
+
return existsSync24(cwd);
|
|
11808
11913
|
}
|
|
11809
11914
|
|
|
11810
11915
|
// src/commands/sessions/daemon/worktree/git.ts
|
|
@@ -12306,17 +12411,17 @@ import * as path14 from "path";
|
|
|
12306
12411
|
import chalk20 from "chalk";
|
|
12307
12412
|
|
|
12308
12413
|
// src/commands/verify/addToKnipIgnoreBinaries.ts
|
|
12309
|
-
import { existsSync as
|
|
12310
|
-
import { join as
|
|
12414
|
+
import { existsSync as existsSync25, readFileSync as readFileSync12, writeFileSync as writeFileSync7 } from "fs";
|
|
12415
|
+
import { join as join30 } from "path";
|
|
12311
12416
|
import chalk19 from "chalk";
|
|
12312
12417
|
function loadKnipConfig(knipJsonPath) {
|
|
12313
|
-
if (
|
|
12418
|
+
if (existsSync25(knipJsonPath)) {
|
|
12314
12419
|
return JSON.parse(readFileSync12(knipJsonPath, "utf8"));
|
|
12315
12420
|
}
|
|
12316
12421
|
return { $schema: "https://unpkg.com/knip@5/schema.json" };
|
|
12317
12422
|
}
|
|
12318
12423
|
function addToKnipIgnoreBinaries(cwd, binary) {
|
|
12319
|
-
const knipJsonPath =
|
|
12424
|
+
const knipJsonPath = join30(cwd, "knip.json");
|
|
12320
12425
|
try {
|
|
12321
12426
|
const knipConfig = loadKnipConfig(knipJsonPath);
|
|
12322
12427
|
const ignoreBinaries = knipConfig.ignoreBinaries ?? [];
|
|
@@ -12363,7 +12468,7 @@ import * as path16 from "path";
|
|
|
12363
12468
|
import chalk25 from "chalk";
|
|
12364
12469
|
|
|
12365
12470
|
// src/commands/format/init.ts
|
|
12366
|
-
import { existsSync as
|
|
12471
|
+
import { existsSync as existsSync26, readFileSync as readFileSync13, writeFileSync as writeFileSync8 } from "fs";
|
|
12367
12472
|
import chalk23 from "chalk";
|
|
12368
12473
|
|
|
12369
12474
|
// src/shared/promptConfirm.ts
|
|
@@ -12425,7 +12530,7 @@ async function init() {
|
|
|
12425
12530
|
const newContent = `${JSON.stringify(oxfmtrc_template_default, null, " ")}
|
|
12426
12531
|
`;
|
|
12427
12532
|
const configPath = ".oxfmtrc.json";
|
|
12428
|
-
const oldContent =
|
|
12533
|
+
const oldContent = existsSync26(configPath) ? readFileSync13(configPath, "utf8") : "";
|
|
12429
12534
|
if (oldContent === newContent) {
|
|
12430
12535
|
console.log(".oxfmtrc.json already has the baseline formatter config");
|
|
12431
12536
|
return;
|
|
@@ -12448,15 +12553,15 @@ async function init() {
|
|
|
12448
12553
|
}
|
|
12449
12554
|
|
|
12450
12555
|
// src/commands/lint/init.ts
|
|
12451
|
-
import { existsSync as
|
|
12556
|
+
import { existsSync as existsSync29, readFileSync as readFileSync15, writeFileSync as writeFileSync10 } from "fs";
|
|
12452
12557
|
import chalk24 from "chalk";
|
|
12453
12558
|
|
|
12454
12559
|
// src/shared/removeEslint.ts
|
|
12455
12560
|
import { execSync as execSync7 } from "child_process";
|
|
12456
|
-
import { existsSync as
|
|
12561
|
+
import { existsSync as existsSync28, readFileSync as readFileSync14, writeFileSync as writeFileSync9 } from "fs";
|
|
12457
12562
|
|
|
12458
12563
|
// src/shared/removeEslint/removeEslintConfigFiles.ts
|
|
12459
|
-
import { existsSync as
|
|
12564
|
+
import { existsSync as existsSync27, unlinkSync as unlinkSync2 } from "fs";
|
|
12460
12565
|
var ESLINT_CONFIG_FILES = [
|
|
12461
12566
|
"eslint.config.js",
|
|
12462
12567
|
"eslint.config.mjs",
|
|
@@ -12472,7 +12577,7 @@ var ESLINT_CONFIG_FILES = [
|
|
|
12472
12577
|
function removeEslintConfigFiles() {
|
|
12473
12578
|
let removed = false;
|
|
12474
12579
|
for (const configFile of ESLINT_CONFIG_FILES) {
|
|
12475
|
-
if (
|
|
12580
|
+
if (existsSync27(configFile)) {
|
|
12476
12581
|
unlinkSync2(configFile);
|
|
12477
12582
|
console.log(`Removed ${configFile}`);
|
|
12478
12583
|
removed = true;
|
|
@@ -12494,7 +12599,7 @@ function removeEslint(options2 = {}) {
|
|
|
12494
12599
|
}
|
|
12495
12600
|
function removeEslintFromPackageJson(options2) {
|
|
12496
12601
|
const packageJsonPath = "package.json";
|
|
12497
|
-
if (!
|
|
12602
|
+
if (!existsSync28(packageJsonPath)) {
|
|
12498
12603
|
return false;
|
|
12499
12604
|
}
|
|
12500
12605
|
const packageJson = JSON.parse(readFileSync14(packageJsonPath, "utf8"));
|
|
@@ -12561,7 +12666,7 @@ async function writeOxlintConfig() {
|
|
|
12561
12666
|
const newContent = `${JSON.stringify(oxlintrc_template_default, null, " ")}
|
|
12562
12667
|
`;
|
|
12563
12668
|
const configPath = ".oxlintrc.json";
|
|
12564
|
-
const oldContent =
|
|
12669
|
+
const oldContent = existsSync29(configPath) ? readFileSync15(configPath, "utf8") : "";
|
|
12565
12670
|
if (oldContent === newContent) {
|
|
12566
12671
|
console.log(".oxlintrc.json already has the baseline linter config");
|
|
12567
12672
|
return;
|
|
@@ -13342,7 +13447,7 @@ async function newCli() {
|
|
|
13342
13447
|
|
|
13343
13448
|
// src/commands/new/registerNew/newProject.ts
|
|
13344
13449
|
import { execSync as execSync14 } from "child_process";
|
|
13345
|
-
import { existsSync as
|
|
13450
|
+
import { existsSync as existsSync34, readFileSync as readFileSync19, writeFileSync as writeFileSync17 } from "fs";
|
|
13346
13451
|
|
|
13347
13452
|
// src/commands/deploy/init.ts
|
|
13348
13453
|
import { execSync as execSync13 } from "child_process";
|
|
@@ -13350,14 +13455,14 @@ import chalk35 from "chalk";
|
|
|
13350
13455
|
import enquirer3 from "enquirer";
|
|
13351
13456
|
|
|
13352
13457
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
13353
|
-
import { existsSync as
|
|
13354
|
-
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";
|
|
13355
13460
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
13356
13461
|
import chalk34 from "chalk";
|
|
13357
13462
|
var WORKFLOW_PATH = ".github/workflows/build.yml";
|
|
13358
13463
|
var __dirname3 = dirname23(fileURLToPath3(import.meta.url));
|
|
13359
13464
|
function getExistingSiteId() {
|
|
13360
|
-
if (!
|
|
13465
|
+
if (!existsSync33(WORKFLOW_PATH)) {
|
|
13361
13466
|
return null;
|
|
13362
13467
|
}
|
|
13363
13468
|
const content = readFileSync18(WORKFLOW_PATH, "utf8");
|
|
@@ -13365,17 +13470,17 @@ function getExistingSiteId() {
|
|
|
13365
13470
|
return match ? match[1] : null;
|
|
13366
13471
|
}
|
|
13367
13472
|
function getTemplateContent(siteId) {
|
|
13368
|
-
const templatePath =
|
|
13473
|
+
const templatePath = join37(__dirname3, "commands/deploy/build.yml");
|
|
13369
13474
|
const template = readFileSync18(templatePath, "utf8");
|
|
13370
13475
|
return template.replace("{{NETLIFY_SITE_ID}}", siteId);
|
|
13371
13476
|
}
|
|
13372
13477
|
async function updateWorkflow(siteId) {
|
|
13373
13478
|
const newContent = getTemplateContent(siteId);
|
|
13374
13479
|
const workflowDir = ".github/workflows";
|
|
13375
|
-
if (!
|
|
13480
|
+
if (!existsSync33(workflowDir)) {
|
|
13376
13481
|
mkdirSync9(workflowDir, { recursive: true });
|
|
13377
13482
|
}
|
|
13378
|
-
if (
|
|
13483
|
+
if (existsSync33(WORKFLOW_PATH)) {
|
|
13379
13484
|
const oldContent = readFileSync18(WORKFLOW_PATH, "utf8");
|
|
13380
13485
|
if (oldContent === newContent) {
|
|
13381
13486
|
console.log(chalk34.green("build.yml is already up to date"));
|
|
@@ -13470,7 +13575,7 @@ async function newProject() {
|
|
|
13470
13575
|
}
|
|
13471
13576
|
function addViteBaseConfig() {
|
|
13472
13577
|
const viteConfigPath = "vite.config.ts";
|
|
13473
|
-
if (!
|
|
13578
|
+
if (!existsSync34(viteConfigPath)) {
|
|
13474
13579
|
console.log("No vite.config.ts found, skipping base config");
|
|
13475
13580
|
return;
|
|
13476
13581
|
}
|
|
@@ -13671,18 +13776,18 @@ function adviceContextFor(cwd) {
|
|
|
13671
13776
|
}
|
|
13672
13777
|
|
|
13673
13778
|
// src/commands/advise/loadAdviceFragments.ts
|
|
13674
|
-
import { readdirSync as
|
|
13675
|
-
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";
|
|
13676
13781
|
|
|
13677
13782
|
// src/commands/advise/adviceDir.ts
|
|
13678
|
-
import { existsSync as
|
|
13679
|
-
import { dirname as dirname24, join as
|
|
13783
|
+
import { existsSync as existsSync35 } from "fs";
|
|
13784
|
+
import { dirname as dirname24, join as join38 } from "path";
|
|
13680
13785
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
13681
13786
|
function adviceDir() {
|
|
13682
13787
|
let current = dirname24(fileURLToPath4(import.meta.url));
|
|
13683
13788
|
while (current !== dirname24(current)) {
|
|
13684
|
-
const candidate =
|
|
13685
|
-
if (
|
|
13789
|
+
const candidate = join38(current, "claude", "advice");
|
|
13790
|
+
if (existsSync35(candidate)) return candidate;
|
|
13686
13791
|
current = dirname24(current);
|
|
13687
13792
|
}
|
|
13688
13793
|
throw new Error("Could not locate the shipped claude/advice directory");
|
|
@@ -13711,10 +13816,10 @@ function parseAdviceFragment(name, content) {
|
|
|
13711
13816
|
|
|
13712
13817
|
// src/commands/advise/loadAdviceFragments.ts
|
|
13713
13818
|
function loadAdviceFragments(dir = adviceDir()) {
|
|
13714
|
-
return
|
|
13819
|
+
return readdirSync5(dir).filter((file) => file.endsWith(".md")).sort().map(
|
|
13715
13820
|
(file) => parseAdviceFragment(
|
|
13716
13821
|
basename10(file, ".md"),
|
|
13717
|
-
readFileSync20(
|
|
13822
|
+
readFileSync20(join39(dir, file), "utf8")
|
|
13718
13823
|
)
|
|
13719
13824
|
);
|
|
13720
13825
|
}
|
|
@@ -13748,13 +13853,13 @@ function renderAdviceBody(fragment, context) {
|
|
|
13748
13853
|
}
|
|
13749
13854
|
|
|
13750
13855
|
// src/commands/advise/adviceConditions.ts
|
|
13751
|
-
import { existsSync as
|
|
13752
|
-
import { join as
|
|
13856
|
+
import { existsSync as existsSync36 } from "fs";
|
|
13857
|
+
import { join as join40 } from "path";
|
|
13753
13858
|
function repoFile(file, label2) {
|
|
13754
13859
|
return {
|
|
13755
13860
|
whenMet: `the repo has ${label2}`,
|
|
13756
13861
|
whenUnmet: `the repo has no ${label2}`,
|
|
13757
|
-
matches: ({ rootDir }) =>
|
|
13862
|
+
matches: ({ rootDir }) => existsSync36(join40(rootDir, file))
|
|
13758
13863
|
};
|
|
13759
13864
|
}
|
|
13760
13865
|
var adviceConditions = {
|
|
@@ -13770,11 +13875,11 @@ var adviceConditions = {
|
|
|
13770
13875
|
},
|
|
13771
13876
|
typescript: repoFile("tsconfig.json", "a tsconfig.json"),
|
|
13772
13877
|
filenameConvention: repoFile(
|
|
13773
|
-
|
|
13878
|
+
join40("oxlint-rules", "filenameConvention.ts"),
|
|
13774
13879
|
"oxlint-rules/filenameConvention.ts"
|
|
13775
13880
|
),
|
|
13776
13881
|
claudeSettings: repoFile(
|
|
13777
|
-
|
|
13882
|
+
join40("claude", "settings.json"),
|
|
13778
13883
|
"claude/settings.json"
|
|
13779
13884
|
),
|
|
13780
13885
|
verify: {
|
|
@@ -13905,8 +14010,8 @@ function registerAdvise(program) {
|
|
|
13905
14010
|
}
|
|
13906
14011
|
|
|
13907
14012
|
// src/shared/internalCommand.ts
|
|
13908
|
-
function internalCommand(command,
|
|
13909
|
-
command.internalCalledBy =
|
|
14013
|
+
function internalCommand(command, calledBy3) {
|
|
14014
|
+
command.internalCalledBy = calledBy3;
|
|
13910
14015
|
return command;
|
|
13911
14016
|
}
|
|
13912
14017
|
|
|
@@ -14168,7 +14273,7 @@ function registerAsk(program) {
|
|
|
14168
14273
|
|
|
14169
14274
|
// src/commands/registerBackup.ts
|
|
14170
14275
|
import { mkdir as mkdir3, stat as stat4 } from "fs/promises";
|
|
14171
|
-
import { join as
|
|
14276
|
+
import { join as join42, resolve as resolve15 } from "path";
|
|
14172
14277
|
import chalk39 from "chalk";
|
|
14173
14278
|
|
|
14174
14279
|
// src/shared/db/recordBackup.ts
|
|
@@ -14182,7 +14287,7 @@ async function recordBackup(db, {
|
|
|
14182
14287
|
|
|
14183
14288
|
// src/commands/backup/scheduleBackup.ts
|
|
14184
14289
|
import { mkdir as mkdir2 } from "fs/promises";
|
|
14185
|
-
import { join as
|
|
14290
|
+
import { join as join41 } from "path";
|
|
14186
14291
|
import chalk37 from "chalk";
|
|
14187
14292
|
|
|
14188
14293
|
// src/commands/backup/readCrontab.ts
|
|
@@ -14324,7 +14429,7 @@ async function scheduleBackup({
|
|
|
14324
14429
|
const cronExpr = durationToCron(every);
|
|
14325
14430
|
const dir = expandTilde(loadConfig().backup.dir);
|
|
14326
14431
|
await mkdir2(dir, { recursive: true });
|
|
14327
|
-
const logPath2 =
|
|
14432
|
+
const logPath2 = join41(dir, "cron.log");
|
|
14328
14433
|
const cronLine = `${cronExpr} ${resolveAssistCommand()} backup >> ${logPath2} 2>&1`;
|
|
14329
14434
|
writeCrontab(upsertScheduleBlock(readCrontab(), every, cronLine));
|
|
14330
14435
|
console.error(
|
|
@@ -14503,7 +14608,7 @@ async function backup({ out }) {
|
|
|
14503
14608
|
await mkdir3(dir, { recursive: true });
|
|
14504
14609
|
const start2 = Date.now();
|
|
14505
14610
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
14506
|
-
const filePath = resolve15(
|
|
14611
|
+
const filePath = resolve15(join42(dir, `backup-${timestamp6}.dump`));
|
|
14507
14612
|
await exportBacklog(filePath);
|
|
14508
14613
|
const { size } = await stat4(filePath);
|
|
14509
14614
|
const durationMs = Date.now() - start2;
|
|
@@ -14635,11 +14740,11 @@ var agentCommands = {
|
|
|
14635
14740
|
rewind: "the review phase of a backlog run"
|
|
14636
14741
|
};
|
|
14637
14742
|
function markAgentCommands(cmd) {
|
|
14638
|
-
for (const [name,
|
|
14743
|
+
for (const [name, calledBy3] of Object.entries(agentCommands)) {
|
|
14639
14744
|
const command = cmd.commands.find((c) => c.name() === name);
|
|
14640
14745
|
if (!command) throw new Error(`No backlog command named ${name}`);
|
|
14641
14746
|
if (!command.internalCalledBy)
|
|
14642
|
-
internalCommand(command,
|
|
14747
|
+
internalCommand(command, calledBy3);
|
|
14643
14748
|
}
|
|
14644
14749
|
}
|
|
14645
14750
|
|
|
@@ -15029,7 +15134,7 @@ function registerAssociateJiraCommand(cmd) {
|
|
|
15029
15134
|
|
|
15030
15135
|
// src/commands/backlog/cloneRepo.ts
|
|
15031
15136
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
15032
|
-
import { existsSync as
|
|
15137
|
+
import { existsSync as existsSync38 } from "fs";
|
|
15033
15138
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
15034
15139
|
import chalk46 from "chalk";
|
|
15035
15140
|
|
|
@@ -15065,7 +15170,7 @@ async function cloneRepo(originRaw) {
|
|
|
15065
15170
|
if (!target) {
|
|
15066
15171
|
return fail2(`Could not derive a repository name from "${origin}".`);
|
|
15067
15172
|
}
|
|
15068
|
-
if (
|
|
15173
|
+
if (existsSync38(target)) {
|
|
15069
15174
|
return fail2(`Clone target already exists: ${target}`);
|
|
15070
15175
|
}
|
|
15071
15176
|
await mkdir4(baseDir, { recursive: true });
|
|
@@ -15482,7 +15587,7 @@ function ensureRemoteOrigin() {
|
|
|
15482
15587
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
15483
15588
|
import { mkdtempSync, readFileSync as readFileSync21, unlinkSync as unlinkSync3, writeFileSync as writeFileSync18 } from "fs";
|
|
15484
15589
|
import { tmpdir } from "os";
|
|
15485
|
-
import { join as
|
|
15590
|
+
import { join as join45 } from "path";
|
|
15486
15591
|
import enquirer4 from "enquirer";
|
|
15487
15592
|
async function promptType() {
|
|
15488
15593
|
const { type } = await enquirer4.prompt({
|
|
@@ -15522,8 +15627,8 @@ async function promptDescription() {
|
|
|
15522
15627
|
}
|
|
15523
15628
|
function openEditor() {
|
|
15524
15629
|
const editor = process.env.EDITOR || process.env.VISUAL || "vi";
|
|
15525
|
-
const dir = mkdtempSync(
|
|
15526
|
-
const filePath =
|
|
15630
|
+
const dir = mkdtempSync(join45(tmpdir(), "assist-"));
|
|
15631
|
+
const filePath = join45(dir, "description.md");
|
|
15527
15632
|
writeFileSync18(filePath, "");
|
|
15528
15633
|
const result = spawnSync5(editor, [filePath], { stdio: "inherit" });
|
|
15529
15634
|
if (result.status !== 0) {
|
|
@@ -16305,14 +16410,14 @@ function hasLocalChanges() {
|
|
|
16305
16410
|
|
|
16306
16411
|
// src/commands/backlog/acquireLock.ts
|
|
16307
16412
|
import {
|
|
16308
|
-
existsSync as
|
|
16413
|
+
existsSync as existsSync39,
|
|
16309
16414
|
mkdirSync as mkdirSync10,
|
|
16310
16415
|
readFileSync as readFileSync24,
|
|
16311
16416
|
unlinkSync as unlinkSync4,
|
|
16312
16417
|
writeFileSync as writeFileSync19
|
|
16313
16418
|
} from "fs";
|
|
16314
16419
|
import { homedir as homedir14 } from "os";
|
|
16315
|
-
import { join as
|
|
16420
|
+
import { join as join46 } from "path";
|
|
16316
16421
|
|
|
16317
16422
|
// src/commands/backlog/bootedAt.ts
|
|
16318
16423
|
import { uptime } from "os";
|
|
@@ -16348,10 +16453,10 @@ function isStaleLock(pid, timestamp6) {
|
|
|
16348
16453
|
|
|
16349
16454
|
// src/commands/backlog/acquireLock.ts
|
|
16350
16455
|
function getLocksDir() {
|
|
16351
|
-
return
|
|
16456
|
+
return join46(homedir14(), ".assist", "locks");
|
|
16352
16457
|
}
|
|
16353
16458
|
function getLockPath(itemId2) {
|
|
16354
|
-
return
|
|
16459
|
+
return join46(getLocksDir(), `lock-${itemId2}.json`);
|
|
16355
16460
|
}
|
|
16356
16461
|
function isProcessAlive(pid) {
|
|
16357
16462
|
try {
|
|
@@ -16363,7 +16468,7 @@ function isProcessAlive(pid) {
|
|
|
16363
16468
|
}
|
|
16364
16469
|
function foreignLockHolder(itemId2) {
|
|
16365
16470
|
const lockPath = getLockPath(itemId2);
|
|
16366
|
-
if (!
|
|
16471
|
+
if (!existsSync39(lockPath)) return null;
|
|
16367
16472
|
try {
|
|
16368
16473
|
const lock2 = JSON.parse(readFileSync24(lockPath, "utf8"));
|
|
16369
16474
|
if (typeof lock2.pid !== "number" || lock2.pid === process.pid) return null;
|
|
@@ -16836,14 +16941,14 @@ function reportDuplicateRun(itemId2, holder) {
|
|
|
16836
16941
|
}
|
|
16837
16942
|
|
|
16838
16943
|
// src/commands/backlog/consumePause.ts
|
|
16839
|
-
import { existsSync as
|
|
16944
|
+
import { existsSync as existsSync40, mkdirSync as mkdirSync12, unlinkSync as unlinkSync5, writeFileSync as writeFileSync21 } from "fs";
|
|
16840
16945
|
import { homedir as homedir15 } from "os";
|
|
16841
|
-
import { join as
|
|
16946
|
+
import { join as join47 } from "path";
|
|
16842
16947
|
function getControlsDir() {
|
|
16843
|
-
return
|
|
16948
|
+
return join47(homedir15(), ".assist", "controls");
|
|
16844
16949
|
}
|
|
16845
16950
|
function getPausePath(itemId2) {
|
|
16846
|
-
return
|
|
16951
|
+
return join47(getControlsDir(), `pause-${itemId2}.json`);
|
|
16847
16952
|
}
|
|
16848
16953
|
function requestPause(itemId2) {
|
|
16849
16954
|
mkdirSync12(getControlsDir(), { recursive: true });
|
|
@@ -16853,7 +16958,7 @@ function requestPause(itemId2) {
|
|
|
16853
16958
|
);
|
|
16854
16959
|
}
|
|
16855
16960
|
function isPausePending(itemId2) {
|
|
16856
|
-
return
|
|
16961
|
+
return existsSync40(getPausePath(itemId2));
|
|
16857
16962
|
}
|
|
16858
16963
|
function clearPause(itemId2) {
|
|
16859
16964
|
try {
|
|
@@ -16863,7 +16968,7 @@ function clearPause(itemId2) {
|
|
|
16863
16968
|
}
|
|
16864
16969
|
function consumePause(itemId2) {
|
|
16865
16970
|
const pausePath = getPausePath(itemId2);
|
|
16866
|
-
if (!
|
|
16971
|
+
if (!existsSync40(pausePath)) return false;
|
|
16867
16972
|
try {
|
|
16868
16973
|
unlinkSync5(pausePath);
|
|
16869
16974
|
} catch {
|
|
@@ -17094,13 +17199,13 @@ function spawnHarness(harness, prompt, options2 = {}) {
|
|
|
17094
17199
|
}
|
|
17095
17200
|
|
|
17096
17201
|
// src/commands/backlog/watchForMarker.ts
|
|
17097
|
-
import { existsSync as
|
|
17202
|
+
import { existsSync as existsSync42, unwatchFile, watchFile } from "fs";
|
|
17098
17203
|
|
|
17099
17204
|
// src/commands/backlog/readSignal.ts
|
|
17100
|
-
import { existsSync as
|
|
17205
|
+
import { existsSync as existsSync41, readFileSync as readFileSync25 } from "fs";
|
|
17101
17206
|
function readSignal() {
|
|
17102
17207
|
const path108 = getSignalPath();
|
|
17103
|
-
if (!path108 || !
|
|
17208
|
+
if (!path108 || !existsSync41(path108)) return void 0;
|
|
17104
17209
|
try {
|
|
17105
17210
|
return JSON.parse(readFileSync25(path108, "utf8"));
|
|
17106
17211
|
} catch {
|
|
@@ -17114,7 +17219,7 @@ function watchForMarker(child, options2) {
|
|
|
17114
17219
|
const statusPath = getSignalPath();
|
|
17115
17220
|
if (!statusPath) return { killedOnMarker: () => killed };
|
|
17116
17221
|
watchFile(statusPath, { interval: 1e3 }, () => {
|
|
17117
|
-
if (!
|
|
17222
|
+
if (!existsSync42(statusPath)) return;
|
|
17118
17223
|
const signal = readSignal();
|
|
17119
17224
|
if (!signal) return;
|
|
17120
17225
|
if (signal.event === "done" && !options2?.actOnDone) return;
|
|
@@ -17166,7 +17271,7 @@ function launchPhaseSession(item, phaseNumber, phase, phaseLabel2, claudeSession
|
|
|
17166
17271
|
}
|
|
17167
17272
|
|
|
17168
17273
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
17169
|
-
import { existsSync as
|
|
17274
|
+
import { existsSync as existsSync43, unlinkSync as unlinkSync6 } from "fs";
|
|
17170
17275
|
import chalk73 from "chalk";
|
|
17171
17276
|
|
|
17172
17277
|
// src/commands/backlog/handleIncompletePhase.ts
|
|
@@ -17188,7 +17293,7 @@ async function handleIncompletePhase() {
|
|
|
17188
17293
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
17189
17294
|
function cleanupSignal() {
|
|
17190
17295
|
const statusPath = getSignalPath();
|
|
17191
|
-
if (statusPath &&
|
|
17296
|
+
if (statusPath && existsSync43(statusPath)) {
|
|
17192
17297
|
unlinkSync6(statusPath);
|
|
17193
17298
|
}
|
|
17194
17299
|
}
|
|
@@ -17199,7 +17304,7 @@ async function isTerminalStatus(itemId2) {
|
|
|
17199
17304
|
}
|
|
17200
17305
|
async function resolvePhaseResult(phaseIndex, itemId2) {
|
|
17201
17306
|
const signalPath = getSignalPath();
|
|
17202
|
-
if (!signalPath || !
|
|
17307
|
+
if (!signalPath || !existsSync43(signalPath)) {
|
|
17203
17308
|
if (await isTerminalStatus(itemId2)) return { kind: "abort" };
|
|
17204
17309
|
const action = await handleIncompletePhase();
|
|
17205
17310
|
if (action === "abort") return { kind: "abort" };
|
|
@@ -17280,7 +17385,7 @@ async function persistPhaseSessionId(itemId2, phaseIdx, claudeSessionId) {
|
|
|
17280
17385
|
// src/shared/emitActivity.ts
|
|
17281
17386
|
import { mkdirSync as mkdirSync13, readFileSync as readFileSync26, rmSync as rmSync4, writeFileSync as writeFileSync22 } from "fs";
|
|
17282
17387
|
import { homedir as homedir16 } from "os";
|
|
17283
|
-
import { dirname as dirname26, join as
|
|
17388
|
+
import { dirname as dirname26, join as join48 } from "path";
|
|
17284
17389
|
import { z as z10 } from "zod";
|
|
17285
17390
|
var activitySchema = z10.object({
|
|
17286
17391
|
kind: z10.enum(["command", "backlog"]),
|
|
@@ -17296,7 +17401,7 @@ var activitySchema = z10.object({
|
|
|
17296
17401
|
startedAt: z10.number()
|
|
17297
17402
|
});
|
|
17298
17403
|
function activityPath(sessionId) {
|
|
17299
|
-
return
|
|
17404
|
+
return join48(homedir16(), ".assist", "activity", `activity-${sessionId}.json`);
|
|
17300
17405
|
}
|
|
17301
17406
|
function emitActivity(activity2) {
|
|
17302
17407
|
const sessionId = process.env.ASSIST_ACTIVITY_ID;
|
|
@@ -19240,6 +19345,7 @@ function registerBranch(program) {
|
|
|
19240
19345
|
).action(
|
|
19241
19346
|
(slug2, options2) => branch(slug2, options2)
|
|
19242
19347
|
);
|
|
19348
|
+
internalCommand(branchCommand, "/branch");
|
|
19243
19349
|
configHelp(
|
|
19244
19350
|
branchCommand,
|
|
19245
19351
|
branchConfigHelp,
|
|
@@ -19934,7 +20040,7 @@ function extractGraphqlQuery(args) {
|
|
|
19934
20040
|
}
|
|
19935
20041
|
|
|
19936
20042
|
// src/shared/loadCliReads.ts
|
|
19937
|
-
import { existsSync as
|
|
20043
|
+
import { existsSync as existsSync44, readFileSync as readFileSync28, writeFileSync as writeFileSync23 } from "fs";
|
|
19938
20044
|
import { dirname as dirname27, resolve as resolve16 } from "path";
|
|
19939
20045
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
19940
20046
|
var __filename3 = fileURLToPath5(import.meta.url);
|
|
@@ -19943,7 +20049,7 @@ function packageRoot() {
|
|
|
19943
20049
|
return __dirname4;
|
|
19944
20050
|
}
|
|
19945
20051
|
function readLines(path108) {
|
|
19946
|
-
if (!
|
|
20052
|
+
if (!existsSync44(path108)) return [];
|
|
19947
20053
|
return readFileSync28(path108, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
19948
20054
|
}
|
|
19949
20055
|
var cachedReads;
|
|
@@ -19990,14 +20096,14 @@ function findCliWrite(command) {
|
|
|
19990
20096
|
}
|
|
19991
20097
|
|
|
19992
20098
|
// src/shared/readSettingsPerms.ts
|
|
19993
|
-
import { existsSync as
|
|
20099
|
+
import { existsSync as existsSync45, readFileSync as readFileSync29 } from "fs";
|
|
19994
20100
|
import { homedir as homedir17 } from "os";
|
|
19995
|
-
import { join as
|
|
20101
|
+
import { join as join49 } from "path";
|
|
19996
20102
|
function readSettingsPerms(key) {
|
|
19997
20103
|
const paths = [
|
|
19998
|
-
|
|
19999
|
-
|
|
20000
|
-
|
|
20104
|
+
join49(homedir17(), ".claude", "settings.json"),
|
|
20105
|
+
join49(process.cwd(), ".claude", "settings.json"),
|
|
20106
|
+
join49(process.cwd(), ".claude", "settings.local.json")
|
|
20001
20107
|
];
|
|
20002
20108
|
const entries = [];
|
|
20003
20109
|
for (const p of paths) {
|
|
@@ -20006,7 +20112,7 @@ function readSettingsPerms(key) {
|
|
|
20006
20112
|
return entries;
|
|
20007
20113
|
}
|
|
20008
20114
|
function readPermissionArray(filePath, key) {
|
|
20009
|
-
if (!
|
|
20115
|
+
if (!existsSync45(filePath)) return [];
|
|
20010
20116
|
try {
|
|
20011
20117
|
const data = JSON.parse(readFileSync29(filePath, "utf8"));
|
|
20012
20118
|
const arr = data?.permissions?.[key];
|
|
@@ -20221,11 +20327,11 @@ function decideCommand(toolName, rawCommand) {
|
|
|
20221
20327
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
20222
20328
|
import { mkdirSync as mkdirSync14 } from "fs";
|
|
20223
20329
|
import { homedir as homedir18 } from "os";
|
|
20224
|
-
import { join as
|
|
20330
|
+
import { join as join50 } from "path";
|
|
20225
20331
|
import Database from "better-sqlite3";
|
|
20226
20332
|
var _db;
|
|
20227
20333
|
function getDbDir() {
|
|
20228
|
-
return
|
|
20334
|
+
return join50(homedir18(), ".assist");
|
|
20229
20335
|
}
|
|
20230
20336
|
function initSchema(db) {
|
|
20231
20337
|
db.exec(`
|
|
@@ -20244,7 +20350,7 @@ function openPromptsDb(dir) {
|
|
|
20244
20350
|
if (_db) return _db;
|
|
20245
20351
|
const dbDir = dir ?? getDbDir();
|
|
20246
20352
|
mkdirSync14(dbDir, { recursive: true });
|
|
20247
|
-
const db = new Database(
|
|
20353
|
+
const db = new Database(join50(dbDir, "assist.db"));
|
|
20248
20354
|
db.pragma("journal_mode = WAL");
|
|
20249
20355
|
initSchema(db);
|
|
20250
20356
|
_db = db;
|
|
@@ -20363,9 +20469,9 @@ ${reasons.join("\n")}`);
|
|
|
20363
20469
|
}
|
|
20364
20470
|
|
|
20365
20471
|
// src/commands/permitCliReads.ts
|
|
20366
|
-
import { existsSync as
|
|
20472
|
+
import { existsSync as existsSync46, mkdirSync as mkdirSync15, readFileSync as readFileSync30, writeFileSync as writeFileSync24 } from "fs";
|
|
20367
20473
|
import { homedir as homedir19 } from "os";
|
|
20368
|
-
import { join as
|
|
20474
|
+
import { join as join51 } from "path";
|
|
20369
20475
|
|
|
20370
20476
|
// src/commands/permitCliReads/assertCliExists.ts
|
|
20371
20477
|
function assertCliExists(cli) {
|
|
@@ -20628,15 +20734,15 @@ function updateSettings(cli, commands) {
|
|
|
20628
20734
|
// src/commands/permitCliReads.ts
|
|
20629
20735
|
function logPath(cli) {
|
|
20630
20736
|
const safeName = cli.replace(/\s+/g, "-");
|
|
20631
|
-
return
|
|
20737
|
+
return join51(homedir19(), ".assist", `cli-discover-${safeName}.log`);
|
|
20632
20738
|
}
|
|
20633
20739
|
function readCache(cli) {
|
|
20634
20740
|
const path108 = logPath(cli);
|
|
20635
|
-
if (!
|
|
20741
|
+
if (!existsSync46(path108)) return void 0;
|
|
20636
20742
|
return readFileSync30(path108, "utf8");
|
|
20637
20743
|
}
|
|
20638
20744
|
function writeCache(cli, output) {
|
|
20639
|
-
const dir =
|
|
20745
|
+
const dir = join51(homedir19(), ".assist");
|
|
20640
20746
|
mkdirSync15(dir, { recursive: true });
|
|
20641
20747
|
writeFileSync24(logPath(cli), output);
|
|
20642
20748
|
}
|
|
@@ -20753,6 +20859,7 @@ function registerCliHook(program) {
|
|
|
20753
20859
|
const cmd = program.command("cli-hook").description("PreToolUse hook for auto-approving read-only CLI commands").action(() => {
|
|
20754
20860
|
cliHook();
|
|
20755
20861
|
});
|
|
20862
|
+
internalCommand(cmd, "the PreToolUse hook on shell commands and reads");
|
|
20756
20863
|
configHelp(cmd, cliHookConfigHelp);
|
|
20757
20864
|
cmd.command("check <command>").description("Check whether a command would be auto-approved").option("--tool <tool>", "Tool name to check against", "Bash").action((command, options2) => {
|
|
20758
20865
|
cliHookCheck(command, options2.tool);
|
|
@@ -20767,7 +20874,7 @@ function registerCliHook(program) {
|
|
|
20767
20874
|
}
|
|
20768
20875
|
|
|
20769
20876
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
20770
|
-
import { existsSync as
|
|
20877
|
+
import { existsSync as existsSync48, readFileSync as readFileSync32, unlinkSync as unlinkSync8, writeFileSync as writeFileSync25 } from "fs";
|
|
20771
20878
|
import chalk114 from "chalk";
|
|
20772
20879
|
|
|
20773
20880
|
// src/shared/isHashCommentFile.ts
|
|
@@ -20801,28 +20908,28 @@ function isHashCommentFile(filePath) {
|
|
|
20801
20908
|
|
|
20802
20909
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
20803
20910
|
import { homedir as homedir20 } from "os";
|
|
20804
|
-
import { join as
|
|
20911
|
+
import { join as join52 } from "path";
|
|
20805
20912
|
function getRestrictedDir() {
|
|
20806
|
-
return
|
|
20913
|
+
return join52(homedir20(), ".assist", "restricted");
|
|
20807
20914
|
}
|
|
20808
20915
|
function getPinStatePath(pin2) {
|
|
20809
|
-
return
|
|
20916
|
+
return join52(getRestrictedDir(), `code-comment-${pin2}.json`);
|
|
20810
20917
|
}
|
|
20811
20918
|
|
|
20812
20919
|
// src/commands/codeComment/sweepRestrictedDir.ts
|
|
20813
|
-
import { readdirSync as
|
|
20814
|
-
import { join as
|
|
20920
|
+
import { readdirSync as readdirSync7, statSync as statSync7, unlinkSync as unlinkSync7 } from "fs";
|
|
20921
|
+
import { join as join53 } from "path";
|
|
20815
20922
|
var STALE_AFTER_MS = 30 * 60 * 1e3;
|
|
20816
20923
|
function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
20817
20924
|
let entries;
|
|
20818
20925
|
try {
|
|
20819
|
-
entries =
|
|
20926
|
+
entries = readdirSync7(dir);
|
|
20820
20927
|
} catch {
|
|
20821
20928
|
return;
|
|
20822
20929
|
}
|
|
20823
20930
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
20824
20931
|
for (const entry of entries) {
|
|
20825
|
-
const path108 =
|
|
20932
|
+
const path108 = join53(dir, entry);
|
|
20826
20933
|
try {
|
|
20827
20934
|
if (statSync7(path108).mtimeMs < cutoff) unlinkSync7(path108);
|
|
20828
20935
|
} catch {
|
|
@@ -20832,10 +20939,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
20832
20939
|
}
|
|
20833
20940
|
|
|
20834
20941
|
// src/commands/codeComment/readPinState.ts
|
|
20835
|
-
import { existsSync as
|
|
20942
|
+
import { existsSync as existsSync47, readFileSync as readFileSync31 } from "fs";
|
|
20836
20943
|
function readPinState(pin2) {
|
|
20837
20944
|
const path108 = getPinStatePath(pin2);
|
|
20838
|
-
if (!
|
|
20945
|
+
if (!existsSync47(path108)) return void 0;
|
|
20839
20946
|
try {
|
|
20840
20947
|
const state = JSON.parse(readFileSync31(path108, "utf8"));
|
|
20841
20948
|
if (state.pin !== pin2) return void 0;
|
|
@@ -20854,7 +20961,7 @@ function codeCommentConfirm(pin2) {
|
|
|
20854
20961
|
process.exitCode = 1;
|
|
20855
20962
|
return;
|
|
20856
20963
|
}
|
|
20857
|
-
if (!
|
|
20964
|
+
if (!existsSync48(state.file)) {
|
|
20858
20965
|
console.error(chalk114.red(`Target file no longer exists: ${state.file}`));
|
|
20859
20966
|
process.exitCode = 1;
|
|
20860
20967
|
return;
|
|
@@ -21030,17 +21137,26 @@ using the pin from that notification.`
|
|
|
21030
21137
|
}
|
|
21031
21138
|
|
|
21032
21139
|
// src/commands/registerCodeComment.ts
|
|
21140
|
+
var calledBy = "agents whose edit the comment gate blocked";
|
|
21033
21141
|
function registerCodeComment(parent) {
|
|
21034
21142
|
const codeComment = parent.command("code-comment").description(
|
|
21035
21143
|
"Escape hatch for the rare code comment that genuinely belongs"
|
|
21036
21144
|
);
|
|
21037
|
-
|
|
21038
|
-
"
|
|
21039
|
-
|
|
21040
|
-
"<
|
|
21041
|
-
|
|
21042
|
-
|
|
21043
|
-
|
|
21145
|
+
internalCommand(
|
|
21146
|
+
codeComment.command("set").description(
|
|
21147
|
+
"Validate a single-line comment and issue a pin to confirm its insertion"
|
|
21148
|
+
).argument("<file>", "File the comment belongs in").argument("<line>", "1-based line number to insert the comment at").argument(
|
|
21149
|
+
"<text>",
|
|
21150
|
+
"Single-line comment text (max 50 chars, no block comments)"
|
|
21151
|
+
).action(codeCommentSet),
|
|
21152
|
+
calledBy
|
|
21153
|
+
);
|
|
21154
|
+
internalCommand(
|
|
21155
|
+
codeComment.command("confirm").description(
|
|
21156
|
+
"Confirm a pin to insert its comment and clear the pin state"
|
|
21157
|
+
).argument("<pin>", "Pin issued by 'code-comment set'").action(codeCommentConfirm),
|
|
21158
|
+
calledBy
|
|
21159
|
+
);
|
|
21044
21160
|
}
|
|
21045
21161
|
|
|
21046
21162
|
// src/commands/codexHook/parseCodexHookInput.ts
|
|
@@ -21574,6 +21690,7 @@ function registerCommit(program) {
|
|
|
21574
21690
|
collectRef,
|
|
21575
21691
|
[]
|
|
21576
21692
|
).action(commit);
|
|
21693
|
+
internalCommand(commitCommand, "/commit");
|
|
21577
21694
|
configHelp(commitCommand, rootConfigHelp.commit);
|
|
21578
21695
|
}
|
|
21579
21696
|
|
|
@@ -22466,10 +22583,20 @@ function coerceCliConfigValue(key, raw) {
|
|
|
22466
22583
|
const leaf = describeConfigLeaves(assistConfigSchema).find(
|
|
22467
22584
|
(candidate) => candidate.key === key
|
|
22468
22585
|
);
|
|
22469
|
-
if (!leaf) return
|
|
22586
|
+
if (!leaf) return coerceIndexedValue(key, raw);
|
|
22470
22587
|
if (leaf.itemType) return coerceConfigValue(key, splitList(raw));
|
|
22471
22588
|
return coerceConfigValue(key, raw);
|
|
22472
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
|
+
}
|
|
22473
22600
|
function splitList(raw) {
|
|
22474
22601
|
return raw.split(",").map((item) => item.trim()).filter((item) => item !== "");
|
|
22475
22602
|
}
|
|
@@ -22643,14 +22770,14 @@ import { cp } from "fs/promises";
|
|
|
22643
22770
|
import chalk138 from "chalk";
|
|
22644
22771
|
|
|
22645
22772
|
// src/commands/extension/extensionDir.ts
|
|
22646
|
-
import { existsSync as
|
|
22647
|
-
import { dirname as dirname28, join as
|
|
22773
|
+
import { existsSync as existsSync49 } from "fs";
|
|
22774
|
+
import { dirname as dirname28, join as join54 } from "path";
|
|
22648
22775
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
22649
22776
|
var moduleDir = dirname28(fileURLToPath6(import.meta.url));
|
|
22650
22777
|
function extensionDir() {
|
|
22651
|
-
const bundled =
|
|
22652
|
-
if (
|
|
22653
|
-
return
|
|
22778
|
+
const bundled = join54(moduleDir, "commands", "extension", "extension");
|
|
22779
|
+
if (existsSync49(bundled)) return bundled;
|
|
22780
|
+
return join54(moduleDir, "..", "..", "..", "extension");
|
|
22654
22781
|
}
|
|
22655
22782
|
|
|
22656
22783
|
// src/commands/extension/extension.ts
|
|
@@ -22676,7 +22803,7 @@ async function extension() {
|
|
|
22676
22803
|
|
|
22677
22804
|
// src/commands/extension/printExtensionUrl.ts
|
|
22678
22805
|
import { readFile as readFile4 } from "fs/promises";
|
|
22679
|
-
import { join as
|
|
22806
|
+
import { join as join55 } from "path";
|
|
22680
22807
|
import chalk139 from "chalk";
|
|
22681
22808
|
|
|
22682
22809
|
// src/commands/extension/latestUpdate.ts
|
|
@@ -22693,7 +22820,7 @@ function latestUpdateLink(manifest, updates2) {
|
|
|
22693
22820
|
// src/commands/extension/printExtensionUrl.ts
|
|
22694
22821
|
async function printExtensionUrl() {
|
|
22695
22822
|
const manifest = await readFile4(
|
|
22696
|
-
|
|
22823
|
+
join55(extensionDir(), "manifest.json"),
|
|
22697
22824
|
"utf8"
|
|
22698
22825
|
);
|
|
22699
22826
|
const { update_url } = JSON.parse(manifest).browser_specific_settings.gecko;
|
|
@@ -22710,28 +22837,28 @@ async function printExtensionUrl() {
|
|
|
22710
22837
|
// src/commands/extension/signExtension.ts
|
|
22711
22838
|
import { rm as rm2 } from "fs/promises";
|
|
22712
22839
|
import { homedir as homedir21, tmpdir as tmpdir3 } from "os";
|
|
22713
|
-
import { join as
|
|
22840
|
+
import { join as join61 } from "path";
|
|
22714
22841
|
import chalk141 from "chalk";
|
|
22715
22842
|
|
|
22716
22843
|
// src/commands/extension/copySignedXpi.ts
|
|
22717
22844
|
import { copyFile } from "fs/promises";
|
|
22718
|
-
import { join as
|
|
22845
|
+
import { join as join56 } from "path";
|
|
22719
22846
|
var SIGNED_XPI_NAME = "assist-extension.xpi";
|
|
22720
22847
|
async function copySignedXpi(xpi, dir) {
|
|
22721
|
-
const fixed2 =
|
|
22848
|
+
const fixed2 = join56(dir, SIGNED_XPI_NAME);
|
|
22722
22849
|
if (fixed2 === xpi) return fixed2;
|
|
22723
22850
|
await copyFile(xpi, fixed2);
|
|
22724
22851
|
return fixed2;
|
|
22725
22852
|
}
|
|
22726
22853
|
|
|
22727
22854
|
// src/commands/extension/findSignedXpi.ts
|
|
22728
|
-
import { existsSync as
|
|
22855
|
+
import { existsSync as existsSync50 } from "fs";
|
|
22729
22856
|
import { readdir } from "fs/promises";
|
|
22730
|
-
import { join as
|
|
22857
|
+
import { join as join57 } from "path";
|
|
22731
22858
|
async function findSignedXpi(dir) {
|
|
22732
|
-
if (!
|
|
22859
|
+
if (!existsSync50(dir)) return null;
|
|
22733
22860
|
const name = (await readdir(dir)).find((entry) => entry.endsWith(".xpi"));
|
|
22734
|
-
return name ?
|
|
22861
|
+
return name ? join57(dir, name) : null;
|
|
22735
22862
|
}
|
|
22736
22863
|
|
|
22737
22864
|
// src/commands/extension/signedAddonInstallPath.ts
|
|
@@ -22753,11 +22880,11 @@ async function signedAddonInstallPath(xpi) {
|
|
|
22753
22880
|
}
|
|
22754
22881
|
|
|
22755
22882
|
// src/commands/extension/signPreflightProblem.ts
|
|
22756
|
-
import { existsSync as
|
|
22757
|
-
import { join as
|
|
22883
|
+
import { existsSync as existsSync51 } from "fs";
|
|
22884
|
+
import { join as join58 } from "path";
|
|
22758
22885
|
var KEY_URL = "https://addons.mozilla.org/en-US/developers/addon/api/key/";
|
|
22759
22886
|
function signPreflightProblem(source) {
|
|
22760
|
-
if (!
|
|
22887
|
+
if (!existsSync51(join58(source, "content.js")))
|
|
22761
22888
|
return {
|
|
22762
22889
|
message: `no content.js in ${source}`,
|
|
22763
22890
|
hint: "run npm run build to bundle the content script"
|
|
@@ -22772,7 +22899,7 @@ function signPreflightProblem(source) {
|
|
|
22772
22899
|
|
|
22773
22900
|
// src/commands/extension/stageExtension.ts
|
|
22774
22901
|
import { cp as cp3, mkdir as mkdir5, readFile as readFile5, rm, writeFile as writeFile4 } from "fs/promises";
|
|
22775
|
-
import { basename as basename14, join as
|
|
22902
|
+
import { basename as basename14, join as join59 } from "path";
|
|
22776
22903
|
|
|
22777
22904
|
// src/commands/extension/stampManifestVersion.ts
|
|
22778
22905
|
function stampManifestVersion(manifest, version2) {
|
|
@@ -22789,7 +22916,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
22789
22916
|
recursive: true,
|
|
22790
22917
|
filter: (path108) => basename14(path108) !== "updates.json"
|
|
22791
22918
|
});
|
|
22792
|
-
const manifest =
|
|
22919
|
+
const manifest = join59(staging, "manifest.json");
|
|
22793
22920
|
const stamped = stampManifestVersion(
|
|
22794
22921
|
await readFile5(manifest, "utf8"),
|
|
22795
22922
|
version2
|
|
@@ -22799,7 +22926,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
22799
22926
|
|
|
22800
22927
|
// src/commands/extension/writeUpdateManifest.ts
|
|
22801
22928
|
import { readFile as readFile6, writeFile as writeFile5 } from "fs/promises";
|
|
22802
|
-
import { join as
|
|
22929
|
+
import { join as join60 } from "path";
|
|
22803
22930
|
|
|
22804
22931
|
// src/commands/extension/buildUpdateManifest.ts
|
|
22805
22932
|
var RELEASE_DOWNLOAD_URL = "https://github.com/staff0rd/assist/releases/download";
|
|
@@ -22824,17 +22951,17 @@ function buildUpdateManifest(manifest, version2) {
|
|
|
22824
22951
|
// src/commands/extension/writeUpdateManifest.ts
|
|
22825
22952
|
async function writeUpdateManifest(source, dir, version2) {
|
|
22826
22953
|
await writeFile5(
|
|
22827
|
-
|
|
22954
|
+
join60(dir, "updates.json"),
|
|
22828
22955
|
buildUpdateManifest(
|
|
22829
|
-
await readFile6(
|
|
22956
|
+
await readFile6(join60(source, "manifest.json"), "utf8"),
|
|
22830
22957
|
version2
|
|
22831
22958
|
)
|
|
22832
22959
|
);
|
|
22833
22960
|
}
|
|
22834
22961
|
|
|
22835
22962
|
// src/commands/extension/signExtension.ts
|
|
22836
|
-
var ARTIFACTS_DIR =
|
|
22837
|
-
var STAGING_DIR =
|
|
22963
|
+
var ARTIFACTS_DIR = join61(homedir21(), ".assist", "extension");
|
|
22964
|
+
var STAGING_DIR = join61(tmpdir3(), "assist-extension");
|
|
22838
22965
|
async function signExtension() {
|
|
22839
22966
|
const source = extensionDir();
|
|
22840
22967
|
const problem = signPreflightProblem(source);
|
|
@@ -23022,19 +23149,19 @@ import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync27 } from "fs"
|
|
|
23022
23149
|
import chalk144 from "chalk";
|
|
23023
23150
|
|
|
23024
23151
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
23025
|
-
import { join as
|
|
23152
|
+
import { join as join62 } from "path";
|
|
23026
23153
|
function getMigrationPinPath(pin2) {
|
|
23027
|
-
return
|
|
23154
|
+
return join62(getRestrictedDir(), `db-migration-pin-${pin2}.json`);
|
|
23028
23155
|
}
|
|
23029
23156
|
function getMigrationApprovalPath(migrationId) {
|
|
23030
|
-
return
|
|
23157
|
+
return join62(getRestrictedDir(), `db-migration-approval-${migrationId}.json`);
|
|
23031
23158
|
}
|
|
23032
23159
|
|
|
23033
23160
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
23034
|
-
import { existsSync as
|
|
23161
|
+
import { existsSync as existsSync52, readFileSync as readFileSync33 } from "fs";
|
|
23035
23162
|
function readMigrationPinState(pin2) {
|
|
23036
23163
|
const path108 = getMigrationPinPath(pin2);
|
|
23037
|
-
if (!
|
|
23164
|
+
if (!existsSync52(path108)) return void 0;
|
|
23038
23165
|
try {
|
|
23039
23166
|
const state = JSON.parse(readFileSync33(path108, "utf8"));
|
|
23040
23167
|
if (state.pin !== pin2) return void 0;
|
|
@@ -23123,7 +23250,7 @@ function registerDbMigration(parent) {
|
|
|
23123
23250
|
}
|
|
23124
23251
|
|
|
23125
23252
|
// src/commands/deploy/redirect.ts
|
|
23126
|
-
import { existsSync as
|
|
23253
|
+
import { existsSync as existsSync53, readFileSync as readFileSync34, writeFileSync as writeFileSync29 } from "fs";
|
|
23127
23254
|
import chalk146 from "chalk";
|
|
23128
23255
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
23129
23256
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -23132,7 +23259,7 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
23132
23259
|
</script>`;
|
|
23133
23260
|
function redirect() {
|
|
23134
23261
|
const indexPath = "index.html";
|
|
23135
|
-
if (!
|
|
23262
|
+
if (!existsSync53(indexPath)) {
|
|
23136
23263
|
console.log(chalk146.yellow("No index.html found"));
|
|
23137
23264
|
return;
|
|
23138
23265
|
}
|
|
@@ -23165,10 +23292,10 @@ import { basename as basename16 } from "path";
|
|
|
23165
23292
|
|
|
23166
23293
|
// src/commands/devlog/loadBlogSkipDays.ts
|
|
23167
23294
|
import { homedir as homedir22 } from "os";
|
|
23168
|
-
import { join as
|
|
23169
|
-
var BLOG_REPO_ROOT =
|
|
23295
|
+
import { join as join63 } from "path";
|
|
23296
|
+
var BLOG_REPO_ROOT = join63(homedir22(), "git/blog");
|
|
23170
23297
|
function loadBlogSkipDays(repoName) {
|
|
23171
|
-
const config = loadRawYaml(
|
|
23298
|
+
const config = loadRawYaml(join63(BLOG_REPO_ROOT, "assist.yml"));
|
|
23172
23299
|
const devlog = config.devlog;
|
|
23173
23300
|
const skip3 = devlog?.skip;
|
|
23174
23301
|
return new Set(skip3?.[repoName]);
|
|
@@ -23179,15 +23306,15 @@ import { execSync as execSync31 } from "child_process";
|
|
|
23179
23306
|
import chalk147 from "chalk";
|
|
23180
23307
|
|
|
23181
23308
|
// src/shared/getRepoName.ts
|
|
23182
|
-
import { existsSync as
|
|
23183
|
-
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";
|
|
23184
23311
|
function getRepoName() {
|
|
23185
23312
|
const config = loadConfig();
|
|
23186
23313
|
if (config.devlog?.name) {
|
|
23187
23314
|
return config.devlog.name;
|
|
23188
23315
|
}
|
|
23189
|
-
const packageJsonPath =
|
|
23190
|
-
if (
|
|
23316
|
+
const packageJsonPath = join64(process.cwd(), "package.json");
|
|
23317
|
+
if (existsSync54(packageJsonPath)) {
|
|
23191
23318
|
try {
|
|
23192
23319
|
const content = readFileSync35(packageJsonPath, "utf8");
|
|
23193
23320
|
const pkg = JSON.parse(content);
|
|
@@ -23201,9 +23328,9 @@ function getRepoName() {
|
|
|
23201
23328
|
}
|
|
23202
23329
|
|
|
23203
23330
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
23204
|
-
import { readdirSync as
|
|
23205
|
-
import { join as
|
|
23206
|
-
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");
|
|
23207
23334
|
function extractFrontmatter(content) {
|
|
23208
23335
|
const fm = content.match(/^---\n([\s\S]*?)\n---/);
|
|
23209
23336
|
return fm?.[1] ?? null;
|
|
@@ -23229,9 +23356,9 @@ function parseFrontmatter(content, filename) {
|
|
|
23229
23356
|
}
|
|
23230
23357
|
function readDevlogFiles(callback) {
|
|
23231
23358
|
try {
|
|
23232
|
-
const files =
|
|
23359
|
+
const files = readdirSync8(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
23233
23360
|
for (const file of files) {
|
|
23234
|
-
const content = readFileSync36(
|
|
23361
|
+
const content = readFileSync36(join65(DEVLOG_DIR, file), "utf8");
|
|
23235
23362
|
const parsed = parseFrontmatter(content, file);
|
|
23236
23363
|
if (parsed) callback(parsed);
|
|
23237
23364
|
}
|
|
@@ -23619,11 +23746,11 @@ function repos(options2) {
|
|
|
23619
23746
|
|
|
23620
23747
|
// src/commands/devlog/skip.ts
|
|
23621
23748
|
import { writeFileSync as writeFileSync30 } from "fs";
|
|
23622
|
-
import { join as
|
|
23749
|
+
import { join as join66 } from "path";
|
|
23623
23750
|
import chalk152 from "chalk";
|
|
23624
23751
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
23625
23752
|
function getBlogConfigPath() {
|
|
23626
|
-
return
|
|
23753
|
+
return join66(BLOG_REPO_ROOT, "assist.yml");
|
|
23627
23754
|
}
|
|
23628
23755
|
function skip2(date) {
|
|
23629
23756
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
@@ -23684,20 +23811,20 @@ function registerDevlog(program) {
|
|
|
23684
23811
|
}
|
|
23685
23812
|
|
|
23686
23813
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
23687
|
-
import { closeSync as closeSync4, openSync as openSync5, readdirSync as
|
|
23688
|
-
import { join as
|
|
23814
|
+
import { closeSync as closeSync4, openSync as openSync5, readdirSync as readdirSync9 } from "fs";
|
|
23815
|
+
import { join as join67 } from "path";
|
|
23689
23816
|
import chalk154 from "chalk";
|
|
23690
23817
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
23691
23818
|
function isLockedDll(debugDir) {
|
|
23692
23819
|
let files;
|
|
23693
23820
|
try {
|
|
23694
|
-
files =
|
|
23821
|
+
files = readdirSync9(debugDir, { recursive: true });
|
|
23695
23822
|
} catch {
|
|
23696
23823
|
return null;
|
|
23697
23824
|
}
|
|
23698
23825
|
for (const file of files) {
|
|
23699
23826
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
23700
|
-
const dllPath =
|
|
23827
|
+
const dllPath = join67(debugDir, file);
|
|
23701
23828
|
try {
|
|
23702
23829
|
const fd = openSync5(dllPath, "r+");
|
|
23703
23830
|
closeSync4(fd);
|
|
@@ -23710,18 +23837,18 @@ function isLockedDll(debugDir) {
|
|
|
23710
23837
|
function findFirstLockedDll(dir) {
|
|
23711
23838
|
let entries;
|
|
23712
23839
|
try {
|
|
23713
|
-
entries =
|
|
23840
|
+
entries = readdirSync9(dir);
|
|
23714
23841
|
} catch {
|
|
23715
23842
|
return null;
|
|
23716
23843
|
}
|
|
23717
23844
|
if (entries.includes("bin")) {
|
|
23718
|
-
const locked = isLockedDll(
|
|
23845
|
+
const locked = isLockedDll(join67(dir, "bin", "Debug"));
|
|
23719
23846
|
if (locked) return locked;
|
|
23720
23847
|
}
|
|
23721
23848
|
for (const entry of entries) {
|
|
23722
23849
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
23723
23850
|
continue;
|
|
23724
|
-
const found = findFirstLockedDll(
|
|
23851
|
+
const found = findFirstLockedDll(join67(dir, entry));
|
|
23725
23852
|
if (found) return found;
|
|
23726
23853
|
}
|
|
23727
23854
|
return null;
|
|
@@ -23790,14 +23917,14 @@ function collectAllDeps(node) {
|
|
|
23790
23917
|
}
|
|
23791
23918
|
|
|
23792
23919
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
23793
|
-
import { readdirSync as
|
|
23920
|
+
import { readdirSync as readdirSync10, readFileSync as readFileSync38, statSync as statSync8 } from "fs";
|
|
23794
23921
|
import path36 from "path";
|
|
23795
23922
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
23796
23923
|
if (depth > maxDepth) return [];
|
|
23797
23924
|
const results = [];
|
|
23798
23925
|
let entries;
|
|
23799
23926
|
try {
|
|
23800
|
-
entries =
|
|
23927
|
+
entries = readdirSync10(dir);
|
|
23801
23928
|
} catch {
|
|
23802
23929
|
return results;
|
|
23803
23930
|
}
|
|
@@ -23889,12 +24016,12 @@ function printJson(tree, totalCount, solutions) {
|
|
|
23889
24016
|
}
|
|
23890
24017
|
|
|
23891
24018
|
// src/commands/dotnet/resolveCsproj.ts
|
|
23892
|
-
import { existsSync as
|
|
24019
|
+
import { existsSync as existsSync55 } from "fs";
|
|
23893
24020
|
import path37 from "path";
|
|
23894
24021
|
import chalk156 from "chalk";
|
|
23895
24022
|
function resolveCsproj(csprojPath) {
|
|
23896
24023
|
const resolved = path37.resolve(csprojPath);
|
|
23897
|
-
if (!
|
|
24024
|
+
if (!existsSync55(resolved)) {
|
|
23898
24025
|
console.error(chalk156.red(`File not found: ${resolved}`));
|
|
23899
24026
|
process.exit(1);
|
|
23900
24027
|
}
|
|
@@ -24062,17 +24189,17 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
24062
24189
|
}
|
|
24063
24190
|
|
|
24064
24191
|
// src/commands/dotnet/resolveSolution.ts
|
|
24065
|
-
import { existsSync as
|
|
24192
|
+
import { existsSync as existsSync56 } from "fs";
|
|
24066
24193
|
import path38 from "path";
|
|
24067
24194
|
import chalk160 from "chalk";
|
|
24068
24195
|
|
|
24069
24196
|
// src/commands/dotnet/findSolution.ts
|
|
24070
|
-
import { readdirSync as
|
|
24071
|
-
import { dirname as dirname29, join as
|
|
24197
|
+
import { readdirSync as readdirSync11 } from "fs";
|
|
24198
|
+
import { dirname as dirname29, join as join68 } from "path";
|
|
24072
24199
|
import chalk159 from "chalk";
|
|
24073
24200
|
function findSlnInDir(dir) {
|
|
24074
24201
|
try {
|
|
24075
|
-
return
|
|
24202
|
+
return readdirSync11(dir).filter((f) => f.endsWith(".sln")).map((f) => join68(dir, f));
|
|
24076
24203
|
} catch {
|
|
24077
24204
|
return [];
|
|
24078
24205
|
}
|
|
@@ -24103,7 +24230,7 @@ function findSolution() {
|
|
|
24103
24230
|
function resolveSolution(sln) {
|
|
24104
24231
|
if (sln) {
|
|
24105
24232
|
const resolved = path38.resolve(sln);
|
|
24106
|
-
if (!
|
|
24233
|
+
if (!existsSync56(resolved)) {
|
|
24107
24234
|
console.error(chalk160.red(`Solution file not found: ${resolved}`));
|
|
24108
24235
|
process.exit(1);
|
|
24109
24236
|
}
|
|
@@ -24143,7 +24270,7 @@ function parseInspectReport(json) {
|
|
|
24143
24270
|
|
|
24144
24271
|
// src/commands/dotnet/runInspectCode.ts
|
|
24145
24272
|
import { execSync as execSync35 } from "child_process";
|
|
24146
|
-
import { existsSync as
|
|
24273
|
+
import { existsSync as existsSync57, readFileSync as readFileSync39, unlinkSync as unlinkSync10 } from "fs";
|
|
24147
24274
|
import { tmpdir as tmpdir4 } from "os";
|
|
24148
24275
|
import path39 from "path";
|
|
24149
24276
|
import chalk161 from "chalk";
|
|
@@ -24174,7 +24301,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
24174
24301
|
console.error(chalk161.red("jb inspectcode failed"));
|
|
24175
24302
|
process.exit(1);
|
|
24176
24303
|
}
|
|
24177
|
-
if (!
|
|
24304
|
+
if (!existsSync57(reportPath)) {
|
|
24178
24305
|
console.error(chalk161.red("Report file not generated"));
|
|
24179
24306
|
process.exit(1);
|
|
24180
24307
|
}
|
|
@@ -24943,11 +25070,11 @@ function decideCommentGuard(input, existingContent) {
|
|
|
24943
25070
|
}
|
|
24944
25071
|
|
|
24945
25072
|
// src/commands/dbMigration/consumeMigrationApproval.ts
|
|
24946
|
-
import { existsSync as
|
|
25073
|
+
import { existsSync as existsSync58, unlinkSync as unlinkSync11 } from "fs";
|
|
24947
25074
|
function consumeMigrationApproval(migrationId) {
|
|
24948
25075
|
sweepRestrictedDir();
|
|
24949
25076
|
const path108 = getMigrationApprovalPath(migrationId);
|
|
24950
|
-
if (!
|
|
25077
|
+
if (!existsSync58(path108)) return false;
|
|
24951
25078
|
try {
|
|
24952
25079
|
unlinkSync11(path108);
|
|
24953
25080
|
return true;
|
|
@@ -25045,11 +25172,14 @@ async function editHook() {
|
|
|
25045
25172
|
|
|
25046
25173
|
// src/commands/registerEditHook.ts
|
|
25047
25174
|
function registerEditHook(program) {
|
|
25048
|
-
|
|
25049
|
-
"
|
|
25050
|
-
|
|
25051
|
-
|
|
25052
|
-
|
|
25175
|
+
internalCommand(
|
|
25176
|
+
program.command("edit-hook").description(
|
|
25177
|
+
"PreToolUse hook that blocks edits to the maintainability override marker and edits that introduce code comments"
|
|
25178
|
+
).action(() => {
|
|
25179
|
+
editHook();
|
|
25180
|
+
}),
|
|
25181
|
+
"the PreToolUse hook on file edits"
|
|
25182
|
+
);
|
|
25053
25183
|
}
|
|
25054
25184
|
|
|
25055
25185
|
// src/commands/github/aggregateCommitters.ts
|
|
@@ -25067,7 +25197,7 @@ function aggregateCommitters(authorLists) {
|
|
|
25067
25197
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
25068
25198
|
import { unlinkSync as unlinkSync12, writeFileSync as writeFileSync31 } from "fs";
|
|
25069
25199
|
import { tmpdir as tmpdir5 } from "os";
|
|
25070
|
-
import { join as
|
|
25200
|
+
import { join as join69 } from "path";
|
|
25071
25201
|
function buildArgs2(queryFile, vars) {
|
|
25072
25202
|
const args = ["api", "graphql", "-F", `query=@${queryFile}`];
|
|
25073
25203
|
for (const [key, value] of Object.entries(vars)) {
|
|
@@ -25077,7 +25207,7 @@ function buildArgs2(queryFile, vars) {
|
|
|
25077
25207
|
return args;
|
|
25078
25208
|
}
|
|
25079
25209
|
function runGhGraphql(mutation, vars) {
|
|
25080
|
-
const queryFile =
|
|
25210
|
+
const queryFile = join69(tmpdir5(), `gh-query-${Date.now()}.graphql`);
|
|
25081
25211
|
writeFileSync31(queryFile, mutation);
|
|
25082
25212
|
try {
|
|
25083
25213
|
const result = spawnSync6("gh", buildArgs2(queryFile, vars), {
|
|
@@ -25860,7 +25990,7 @@ async function commentIssue(numberArg, options2) {
|
|
|
25860
25990
|
|
|
25861
25991
|
// src/commands/github/issue/registerCommentIssue.ts
|
|
25862
25992
|
function registerCommentIssue(issueCommand) {
|
|
25863
|
-
issueCommand.command("comment <number>").description("Comment on a GitHub issue (body of - reads it from stdin)").option("--body <body>", "Comment body (- reads it from stdin)").option(
|
|
25993
|
+
const commentCommand = issueCommand.command("comment <number>").description("Comment on a GitHub issue (body of - reads it from stdin)").option("--body <body>", "Comment body (- reads it from stdin)").option(
|
|
25864
25994
|
"-R, --repo <owner/repo>",
|
|
25865
25995
|
"Target repository (defaults to the current repo)"
|
|
25866
25996
|
).addHelpText(
|
|
@@ -25874,6 +26004,7 @@ function registerCommentIssue(issueCommand) {
|
|
|
25874
26004
|
});
|
|
25875
26005
|
}
|
|
25876
26006
|
);
|
|
26007
|
+
internalCommand(commentCommand, "/github update");
|
|
25877
26008
|
}
|
|
25878
26009
|
|
|
25879
26010
|
// src/commands/prs/minGhAttachVersion.ts
|
|
@@ -26183,8 +26314,8 @@ var pinnedPr;
|
|
|
26183
26314
|
function getPinnedPr() {
|
|
26184
26315
|
return pinnedPr;
|
|
26185
26316
|
}
|
|
26186
|
-
function currentPrSelector(
|
|
26187
|
-
return pinnedPr === void 0 ?
|
|
26317
|
+
function currentPrSelector(currentBranch6) {
|
|
26318
|
+
return pinnedPr === void 0 ? currentBranch6() : String(pinnedPr);
|
|
26188
26319
|
}
|
|
26189
26320
|
|
|
26190
26321
|
// src/commands/prs/shared.ts
|
|
@@ -26464,7 +26595,7 @@ async function createIssue(options2) {
|
|
|
26464
26595
|
|
|
26465
26596
|
// src/commands/github/issue/registerCreateIssue.ts
|
|
26466
26597
|
function registerCreateIssue(issueCommand) {
|
|
26467
|
-
issueCommand.command("create").description("Create a GitHub issue").option("--title <title>", "Issue title").option("--body <body>", "Issue body").option(
|
|
26598
|
+
const createCommand = issueCommand.command("create").description("Create a GitHub issue").option("--title <title>", "Issue title").option("--body <body>", "Issue body").option(
|
|
26468
26599
|
"-R, --repo <owner/repo>",
|
|
26469
26600
|
"Target repository (defaults to the current repo)"
|
|
26470
26601
|
).option(
|
|
@@ -26497,6 +26628,7 @@ The reviewer may also drop or paste screenshots or video into the pane; on appro
|
|
|
26497
26628
|
A bare --parent number is read against --repo, or the current repo; a parent in another repository is allowed.
|
|
26498
26629
|
The project scope is needed for --project: gh auth refresh -h github.com -s project`
|
|
26499
26630
|
).action(createIssue);
|
|
26631
|
+
internalCommand(createCommand, "/github create");
|
|
26500
26632
|
}
|
|
26501
26633
|
|
|
26502
26634
|
// src/commands/sessions/shared/inWebSession.ts
|
|
@@ -26540,14 +26672,14 @@ function slugFromUrl(url) {
|
|
|
26540
26672
|
import { mkdirSync as mkdirSync18, writeFileSync as writeFileSync32 } from "fs";
|
|
26541
26673
|
|
|
26542
26674
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
26543
|
-
import { join as
|
|
26675
|
+
import { join as join70 } from "path";
|
|
26544
26676
|
function issueWorkingFile(slug2, number) {
|
|
26545
26677
|
const [owner = "unknown", repo = "unknown"] = slug2.split("/");
|
|
26546
|
-
const dir =
|
|
26678
|
+
const dir = join70(getStoreDir(), "github-issues", owner, repo);
|
|
26547
26679
|
return {
|
|
26548
26680
|
dir,
|
|
26549
|
-
bodyPath:
|
|
26550
|
-
metaPath:
|
|
26681
|
+
bodyPath: join70(dir, `${number}.md`),
|
|
26682
|
+
metaPath: join70(dir, `${number}.json`)
|
|
26551
26683
|
};
|
|
26552
26684
|
}
|
|
26553
26685
|
|
|
@@ -26582,10 +26714,10 @@ function fetchIssueToWorkingFile(number, repo) {
|
|
|
26582
26714
|
}
|
|
26583
26715
|
|
|
26584
26716
|
// src/commands/github/issue/resumeIssueBody.ts
|
|
26585
|
-
import { existsSync as
|
|
26717
|
+
import { existsSync as existsSync59, readFileSync as readFileSync40 } from "fs";
|
|
26586
26718
|
function resumeIssueBody(slug2, number, updatedAt) {
|
|
26587
26719
|
const { bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
26588
|
-
if (!
|
|
26720
|
+
if (!existsSync59(bodyPath) || !existsSync59(metaPath)) return void 0;
|
|
26589
26721
|
try {
|
|
26590
26722
|
const meta = JSON.parse(readFileSync40(metaPath, "utf8"));
|
|
26591
26723
|
if (meta.updatedAt !== updatedAt) return void 0;
|
|
@@ -26747,7 +26879,7 @@ async function editIssue(numberArg, options2) {
|
|
|
26747
26879
|
|
|
26748
26880
|
// src/commands/github/issue/registerEditIssue.ts
|
|
26749
26881
|
function registerEditIssue(issueCommand) {
|
|
26750
|
-
issueCommand.command("edit <number>").description("Edit an existing GitHub issue's body in the preview pane").option(
|
|
26882
|
+
const editCommand = issueCommand.command("edit <number>").description("Edit an existing GitHub issue's body in the preview pane").option(
|
|
26751
26883
|
"-R, --repo <owner/repo>",
|
|
26752
26884
|
"Target repository (defaults to the current repo)"
|
|
26753
26885
|
).option(
|
|
@@ -26766,6 +26898,7 @@ function registerEditIssue(issueCommand) {
|
|
|
26766
26898
|
"after",
|
|
26767
26899
|
"\nFetches the issue's current body and opens it in the assist web preview pane, where it can be reworked before it is pushed back.\nWhen you already know the body you want, pass it with --body (--body - reads stdin): the first preview then shows that proposal instead of the current body, replacing any working file.\nTo make a targeted change to the current body (strike items out, tick a box), run with --fetch first: it writes the current body to the working file and prints its path without opening a preview. Edit that file in place, then re-run without --fetch or --body so the first preview shows your revision. Never run without --fetch just to get the body.\nApproving pushes the pane's markdown to the issue; nothing is pushed if the issue moved on GitHub after it was fetched, or outside a web session.\nRejecting writes the pane's markdown to a working file and names it: revise that file in place and re-run to preview the revision, which keeps any collapses already applied. A re-run resumes from the working file while the issue has not moved on GitHub; --fresh discards it and re-fetches.\nOnly the body is touched \u2014 the title, labels, assignees and state are left alone.\n--parent sets the issue's parent instead of editing the body: nothing is previewed and no web session is needed. A bare number is read against --repo, or the current repo; a parent in another repository is allowed."
|
|
26768
26900
|
).action(editIssue);
|
|
26901
|
+
internalCommand(editCommand, "/github");
|
|
26769
26902
|
}
|
|
26770
26903
|
|
|
26771
26904
|
// src/commands/github/issue/editIssueComment.ts
|
|
@@ -26816,7 +26949,7 @@ function commentUrl(raw) {
|
|
|
26816
26949
|
|
|
26817
26950
|
// src/commands/github/issue/registerEditIssueComment.ts
|
|
26818
26951
|
function registerEditIssueComment(issueCommand) {
|
|
26819
|
-
issueCommand.command("edit-comment <comment-id>").description(
|
|
26952
|
+
const editCommentCommand = issueCommand.command("edit-comment <comment-id>").description(
|
|
26820
26953
|
"Replace the body of a posted GitHub issue comment (body of - reads it from stdin)"
|
|
26821
26954
|
).option("--body <body>", "Replacement comment body (- reads it from stdin)").option(
|
|
26822
26955
|
"-R, --repo <owner/repo>",
|
|
@@ -26832,6 +26965,7 @@ function registerEditIssueComment(issueCommand) {
|
|
|
26832
26965
|
});
|
|
26833
26966
|
}
|
|
26834
26967
|
);
|
|
26968
|
+
internalCommand(editCommentCommand, "agents revising an issue comment");
|
|
26835
26969
|
}
|
|
26836
26970
|
|
|
26837
26971
|
// src/commands/github/issue/toIssueProjectItem.ts
|
|
@@ -26951,7 +27085,7 @@ function startIssue(numberArg, options2) {
|
|
|
26951
27085
|
|
|
26952
27086
|
// src/commands/github/issue/registerStartIssue.ts
|
|
26953
27087
|
function registerStartIssue(issueCommand) {
|
|
26954
|
-
issueCommand.command("started <number>").description(
|
|
27088
|
+
const startedCommand = issueCommand.command("started <number>").description(
|
|
26955
27089
|
"Assign a GitHub issue to yourself and move its project boards to In Progress"
|
|
26956
27090
|
).option(
|
|
26957
27091
|
"-R, --repo <owner/repo>",
|
|
@@ -26960,6 +27094,7 @@ function registerStartIssue(issueCommand) {
|
|
|
26960
27094
|
"after",
|
|
26961
27095
|
"\nThe boards are discovered from the issue itself: every ProjectV2 item the issue sits on whose Status field offers an In Progress option (matched case-insensitively) is moved.\nThe assignment is applied first and is never blocked by the board work \u2014 an issue on no board, a Status field with no In Progress option, and a gh token without the project scope are each reported and exit 0.\nThe project scope is needed to read or move a board: gh auth refresh -h github.com -s project"
|
|
26962
27096
|
).action(startIssue);
|
|
27097
|
+
internalCommand(startedCommand, "/github started");
|
|
26963
27098
|
}
|
|
26964
27099
|
|
|
26965
27100
|
// src/commands/registerGithubIssue.ts
|
|
@@ -27177,8 +27312,7 @@ function registerRefineLaunch(program, resumeFlag) {
|
|
|
27177
27312
|
import { randomUUID as randomUUID11 } from "crypto";
|
|
27178
27313
|
|
|
27179
27314
|
// src/commands/review/checkoutPr.ts
|
|
27180
|
-
import { execFileSync as
|
|
27181
|
-
import chalk171 from "chalk";
|
|
27315
|
+
import { execFileSync as execFileSync19 } from "child_process";
|
|
27182
27316
|
|
|
27183
27317
|
// src/commands/review/clearStalePrBranch.ts
|
|
27184
27318
|
var tipSetFromRemote = /^branch: (Created from|Reset to)|^fetch\b|: Fast-forward$/;
|
|
@@ -27234,7 +27368,7 @@ function recentDaemonLogLines(includeRelayed = true) {
|
|
|
27234
27368
|
}
|
|
27235
27369
|
|
|
27236
27370
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
27237
|
-
import { existsSync as
|
|
27371
|
+
import { existsSync as existsSync60 } from "fs";
|
|
27238
27372
|
import { basename as basename19, dirname as dirname31 } from "path";
|
|
27239
27373
|
|
|
27240
27374
|
// src/commands/watch/fetchQuietly.ts
|
|
@@ -27254,11 +27388,11 @@ function fetchQuietly(cwd, intervalMs) {
|
|
|
27254
27388
|
}
|
|
27255
27389
|
|
|
27256
27390
|
// src/commands/sessions/daemon/worktree/nextWorktreePath.ts
|
|
27257
|
-
import { basename as basename18, join as
|
|
27391
|
+
import { basename as basename18, join as join71 } from "path";
|
|
27258
27392
|
function nextWorktreePath(clone, base, isTaken) {
|
|
27259
27393
|
const name = basename18(clone);
|
|
27260
27394
|
for (let n = 2; n < 1e3; n++) {
|
|
27261
|
-
const candidate =
|
|
27395
|
+
const candidate = join71(base, `${name}-${n}`);
|
|
27262
27396
|
if (!isTaken(candidate)) return candidate;
|
|
27263
27397
|
}
|
|
27264
27398
|
throw new Error(`no free worktree suffix for ${clone}`);
|
|
@@ -27281,7 +27415,7 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
27281
27415
|
const base = strategy.root ? expandTilde(strategy.root) : dirname31(clone);
|
|
27282
27416
|
const registered = new Set(listWorktreePaths(clone));
|
|
27283
27417
|
const branches = new Set(listLocalBranches(clone));
|
|
27284
|
-
const isTaken = (candidate) => registered.has(candidate) ||
|
|
27418
|
+
const isTaken = (candidate) => registered.has(candidate) || existsSync60(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename19(candidate));
|
|
27285
27419
|
const path108 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
27286
27420
|
const fetchError = fetchQuietly(clone, 0);
|
|
27287
27421
|
if (fetchError)
|
|
@@ -27510,20 +27644,20 @@ function persistedTreeRoots() {
|
|
|
27510
27644
|
}
|
|
27511
27645
|
|
|
27512
27646
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
27513
|
-
import { copyFileSync, existsSync as
|
|
27514
|
-
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";
|
|
27515
27649
|
|
|
27516
27650
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
27517
27651
|
import { resolve as resolve18 } from "path";
|
|
27518
27652
|
|
|
27519
27653
|
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
27520
|
-
import { existsSync as
|
|
27521
|
-
import { join as
|
|
27654
|
+
import { existsSync as existsSync61 } from "fs";
|
|
27655
|
+
import { join as join72 } from "path";
|
|
27522
27656
|
function detectInstallCommand(dir) {
|
|
27523
|
-
if (!
|
|
27524
|
-
if (
|
|
27525
|
-
if (
|
|
27526
|
-
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";
|
|
27527
27661
|
return "npm install";
|
|
27528
27662
|
}
|
|
27529
27663
|
|
|
@@ -27688,9 +27822,9 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
27688
27822
|
}
|
|
27689
27823
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
27690
27824
|
for (const rel of copy) {
|
|
27691
|
-
const src =
|
|
27692
|
-
if (!
|
|
27693
|
-
const dest =
|
|
27825
|
+
const src = join73(clone, rel);
|
|
27826
|
+
if (!existsSync62(src)) continue;
|
|
27827
|
+
const dest = join73(worktreePath, rel);
|
|
27694
27828
|
try {
|
|
27695
27829
|
mkdirSync19(dirname32(dest), { recursive: true });
|
|
27696
27830
|
copyFileSync(src, dest);
|
|
@@ -27727,16 +27861,71 @@ async function moveToPrCheckoutTree() {
|
|
|
27727
27861
|
if (alloc.created && alloc.clone) await seed(alloc.cwd, alloc.clone);
|
|
27728
27862
|
}
|
|
27729
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
|
+
|
|
27730
27917
|
// src/commands/review/prHeadBranch.ts
|
|
27731
27918
|
import { execFileSync as execFileSync17 } from "child_process";
|
|
27732
|
-
function prHeadBranch(
|
|
27919
|
+
function prHeadBranch({
|
|
27920
|
+
headBranch
|
|
27921
|
+
}) {
|
|
27733
27922
|
try {
|
|
27734
|
-
|
|
27735
|
-
|
|
27736
|
-
|
|
27737
|
-
|
|
27738
|
-
|
|
27739
|
-
|
|
27923
|
+
return headBranch.parse(
|
|
27924
|
+
execFileSync17(headBranch.file, headBranch.args, {
|
|
27925
|
+
encoding: "utf8",
|
|
27926
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
27927
|
+
})
|
|
27928
|
+
);
|
|
27740
27929
|
} catch {
|
|
27741
27930
|
return null;
|
|
27742
27931
|
}
|
|
@@ -27799,12 +27988,56 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
27799
27988
|
return path108 && path108 !== here ? path108 : null;
|
|
27800
27989
|
}
|
|
27801
27990
|
|
|
27802
|
-
// 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
|
+
}
|
|
27803
28031
|
function currentBranch4() {
|
|
27804
28032
|
return gitSyncOrNull(process.cwd(), ["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
27805
28033
|
}
|
|
28034
|
+
|
|
28035
|
+
// src/commands/review/checkoutPr.ts
|
|
28036
|
+
function currentBranch5() {
|
|
28037
|
+
return gitSyncOrNull(process.cwd(), ["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
28038
|
+
}
|
|
27806
28039
|
async function moveToExistingCheckout(number, headRef) {
|
|
27807
|
-
if (
|
|
28040
|
+
if (currentBranch5() === headRef) {
|
|
27808
28041
|
console.log(`Already on ${headRef} for PR #${number}; reviewing here.`);
|
|
27809
28042
|
return true;
|
|
27810
28043
|
}
|
|
@@ -27816,29 +28049,20 @@ async function moveToExistingCheckout(number, headRef) {
|
|
|
27816
28049
|
await reportCwdToDaemon(holder);
|
|
27817
28050
|
return true;
|
|
27818
28051
|
}
|
|
27819
|
-
function failCheckout(number, headRef, stale, from) {
|
|
27820
|
-
if (headRef && from && from !== headRef && currentBranch4() === headRef)
|
|
27821
|
-
gitSyncOrNull(process.cwd(), ["checkout", "--quiet", from]);
|
|
27822
|
-
if (headRef && stale === "local-work")
|
|
27823
|
-
console.error(
|
|
27824
|
-
chalk171.red(
|
|
27825
|
-
`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.`
|
|
27826
|
-
)
|
|
27827
|
-
);
|
|
27828
|
-
console.error(chalk171.red(`gh pr checkout ${number} failed; aborting.`));
|
|
27829
|
-
process.exit(1);
|
|
27830
|
-
}
|
|
27831
28052
|
async function checkoutPr(number) {
|
|
27832
|
-
const
|
|
28053
|
+
const commands = prCliCommands(number, process.cwd());
|
|
28054
|
+
const headRef = prHeadBranch(commands);
|
|
27833
28055
|
if (headRef && await moveToExistingCheckout(number, headRef)) return;
|
|
27834
28056
|
await moveToPrCheckoutTree();
|
|
27835
|
-
const branch2 =
|
|
28057
|
+
const branch2 = currentBranch5();
|
|
27836
28058
|
const from = branch2 === "HEAD" ? gitSyncOrNull(process.cwd(), ["rev-parse", "HEAD"]) : branch2;
|
|
27837
28059
|
const stale = headRef ? clearStalePrBranch(process.cwd(), headRef) : "absent";
|
|
27838
28060
|
try {
|
|
27839
|
-
|
|
28061
|
+
execFileSync19(commands.checkout.file, commands.checkout.args, {
|
|
28062
|
+
stdio: "inherit"
|
|
28063
|
+
});
|
|
27840
28064
|
} catch {
|
|
27841
|
-
failCheckout(number, headRef, stale, from);
|
|
28065
|
+
failCheckout(number, headRef, stale, from, commands.checkout);
|
|
27842
28066
|
}
|
|
27843
28067
|
}
|
|
27844
28068
|
|
|
@@ -28054,7 +28278,7 @@ function registerLitellm(program) {
|
|
|
28054
28278
|
}
|
|
28055
28279
|
|
|
28056
28280
|
// src/commands/mermaidExport.ts
|
|
28057
|
-
import { mkdirSync as mkdirSync20, readdirSync as
|
|
28281
|
+
import { mkdirSync as mkdirSync20, readdirSync as readdirSync12 } from "fs";
|
|
28058
28282
|
import { resolve as resolve20 } from "path";
|
|
28059
28283
|
import chalk176 from "chalk";
|
|
28060
28284
|
|
|
@@ -28136,7 +28360,7 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
28136
28360
|
process.exit(1);
|
|
28137
28361
|
}
|
|
28138
28362
|
}
|
|
28139
|
-
const files = file ? [file] :
|
|
28363
|
+
const files = file ? [file] : readdirSync12(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
28140
28364
|
if (files.length === 0) {
|
|
28141
28365
|
console.log(chalk176.gray("No markdown files found in current directory."));
|
|
28142
28366
|
return;
|
|
@@ -28297,10 +28521,10 @@ function applyIgnore(texts, ignore3) {
|
|
|
28297
28521
|
}
|
|
28298
28522
|
|
|
28299
28523
|
// src/commands/miro/readIgnoreList.ts
|
|
28300
|
-
import { existsSync as
|
|
28524
|
+
import { existsSync as existsSync63, readFileSync as readFileSync42 } from "fs";
|
|
28301
28525
|
import { parse as parse2 } from "yaml";
|
|
28302
28526
|
function readIgnoreList(file) {
|
|
28303
|
-
if (!
|
|
28527
|
+
if (!existsSync63(file))
|
|
28304
28528
|
throw new MiroExtractError(
|
|
28305
28529
|
`No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
|
|
28306
28530
|
);
|
|
@@ -28782,15 +29006,15 @@ function createNetcapHandler(options2) {
|
|
|
28782
29006
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
28783
29007
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
28784
29008
|
import { networkInterfaces } from "os";
|
|
28785
|
-
import { join as
|
|
29009
|
+
import { join as join75 } from "path";
|
|
28786
29010
|
import chalk179 from "chalk";
|
|
28787
29011
|
|
|
28788
29012
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
28789
|
-
import { dirname as dirname34, join as
|
|
29013
|
+
import { dirname as dirname34, join as join74 } from "path";
|
|
28790
29014
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
28791
29015
|
var moduleDir2 = dirname34(fileURLToPath7(import.meta.url));
|
|
28792
29016
|
function netcapExtensionDir() {
|
|
28793
|
-
return
|
|
29017
|
+
return join74(moduleDir2, "commands", "netcap", "netcap-extension");
|
|
28794
29018
|
}
|
|
28795
29019
|
|
|
28796
29020
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
@@ -28805,7 +29029,7 @@ function lanIPv4() {
|
|
|
28805
29029
|
return void 0;
|
|
28806
29030
|
}
|
|
28807
29031
|
async function configureBackground(dir, host, port, filter) {
|
|
28808
|
-
const file =
|
|
29032
|
+
const file = join75(dir, "background.js");
|
|
28809
29033
|
const source = await readFile7(file, "utf8");
|
|
28810
29034
|
await writeFile6(
|
|
28811
29035
|
file,
|
|
@@ -28845,20 +29069,20 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
28845
29069
|
}
|
|
28846
29070
|
|
|
28847
29071
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
28848
|
-
import { isAbsolute as isAbsolute5, join as
|
|
29072
|
+
import { isAbsolute as isAbsolute5, join as join77, resolve as resolve22 } from "path";
|
|
28849
29073
|
|
|
28850
29074
|
// src/commands/netcap/defaultCapturePath.ts
|
|
28851
29075
|
import { homedir as homedir23 } from "os";
|
|
28852
|
-
import { join as
|
|
29076
|
+
import { join as join76 } from "path";
|
|
28853
29077
|
function defaultCapturePath() {
|
|
28854
|
-
return
|
|
29078
|
+
return join76(homedir23(), ".assist", "netcap", "capture.jsonl");
|
|
28855
29079
|
}
|
|
28856
29080
|
|
|
28857
29081
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
28858
29082
|
function resolveNetcapOutPath(out) {
|
|
28859
29083
|
if (!out) return defaultCapturePath();
|
|
28860
29084
|
const dir = isAbsolute5(out) ? out : resolve22(process.cwd(), out);
|
|
28861
|
-
return
|
|
29085
|
+
return join77(dir, "capture.jsonl");
|
|
28862
29086
|
}
|
|
28863
29087
|
|
|
28864
29088
|
// src/commands/netcap/netcap.ts
|
|
@@ -28905,7 +29129,7 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
|
|
|
28905
29129
|
|
|
28906
29130
|
// src/commands/netcap/netcapExtract.ts
|
|
28907
29131
|
import { writeFileSync as writeFileSync35 } from "fs";
|
|
28908
|
-
import { join as
|
|
29132
|
+
import { join as join78 } from "path";
|
|
28909
29133
|
import chalk181 from "chalk";
|
|
28910
29134
|
|
|
28911
29135
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
@@ -29350,7 +29574,7 @@ function extractPostsFromCapture(captureFile) {
|
|
|
29350
29574
|
function netcapExtract(file) {
|
|
29351
29575
|
const captureFile = file ?? defaultCapturePath();
|
|
29352
29576
|
const posts = extractPostsFromCapture(captureFile);
|
|
29353
|
-
const outFile =
|
|
29577
|
+
const outFile = join78(captureFile, "..", "posts.json");
|
|
29354
29578
|
writeFileSync35(outFile, `${JSON.stringify(posts, null, 2)}
|
|
29355
29579
|
`);
|
|
29356
29580
|
console.log(
|
|
@@ -29531,7 +29755,10 @@ function prompts2() {
|
|
|
29531
29755
|
|
|
29532
29756
|
// src/commands/registerPrompts.ts
|
|
29533
29757
|
function registerPrompts(program) {
|
|
29534
|
-
|
|
29758
|
+
internalCommand(
|
|
29759
|
+
program.command("prompts").description("Show top denied tool calls by frequency").action(prompts2),
|
|
29760
|
+
"/prompts"
|
|
29761
|
+
);
|
|
29535
29762
|
}
|
|
29536
29763
|
|
|
29537
29764
|
// src/commands/prs/prs.ts
|
|
@@ -29738,21 +29965,11 @@ async function comment2(path108, line, body, options2 = {}) {
|
|
|
29738
29965
|
}
|
|
29739
29966
|
}
|
|
29740
29967
|
|
|
29741
|
-
// src/commands/prs/fixed.ts
|
|
29742
|
-
import { execSync as execSync40 } from "child_process";
|
|
29743
|
-
|
|
29744
|
-
// src/commands/prs/resolveCommentWithReply.ts
|
|
29745
|
-
import { execFileSync as execFileSync19 } from "child_process";
|
|
29746
|
-
|
|
29747
|
-
// src/commands/prs/loadCommentsCache.ts
|
|
29748
|
-
import { existsSync as existsSync63, readFileSync as readFileSync45, unlinkSync as unlinkSync13 } from "fs";
|
|
29749
|
-
import { parse as parse3 } from "yaml";
|
|
29750
|
-
|
|
29751
29968
|
// src/commands/prs/commentsCachePath.ts
|
|
29752
29969
|
import { homedir as homedir24 } from "os";
|
|
29753
|
-
import { join as
|
|
29970
|
+
import { join as join79 } from "path";
|
|
29754
29971
|
function commentsCachePath(org, repo, prNumber) {
|
|
29755
|
-
return
|
|
29972
|
+
return join79(
|
|
29756
29973
|
homedir24(),
|
|
29757
29974
|
".assist",
|
|
29758
29975
|
"pr-comments",
|
|
@@ -29762,121 +29979,6 @@ function commentsCachePath(org, repo, prNumber) {
|
|
|
29762
29979
|
);
|
|
29763
29980
|
}
|
|
29764
29981
|
|
|
29765
|
-
// src/commands/prs/loadCommentsCache.ts
|
|
29766
|
-
function loadCommentsCache(org, repo, prNumber) {
|
|
29767
|
-
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
29768
|
-
if (!existsSync63(cachePath)) {
|
|
29769
|
-
return null;
|
|
29770
|
-
}
|
|
29771
|
-
const content = readFileSync45(cachePath, "utf8");
|
|
29772
|
-
return parse3(content);
|
|
29773
|
-
}
|
|
29774
|
-
function deleteCommentsCache(org, repo, prNumber) {
|
|
29775
|
-
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
29776
|
-
if (existsSync63(cachePath)) {
|
|
29777
|
-
unlinkSync13(cachePath);
|
|
29778
|
-
console.log("No more unresolved line comments. Cache dropped.");
|
|
29779
|
-
}
|
|
29780
|
-
}
|
|
29781
|
-
|
|
29782
|
-
// src/commands/prs/replyToComment.ts
|
|
29783
|
-
import { spawnSync as spawnSync7 } from "child_process";
|
|
29784
|
-
function replyToComment(org, repo, prNumber, commentId, message3) {
|
|
29785
|
-
const result = spawnSync7(
|
|
29786
|
-
"gh",
|
|
29787
|
-
[
|
|
29788
|
-
"api",
|
|
29789
|
-
`repos/${org}/${repo}/pulls/${prNumber}/comments`,
|
|
29790
|
-
"-f",
|
|
29791
|
-
`body=${message3}`,
|
|
29792
|
-
"-F",
|
|
29793
|
-
`in_reply_to=${commentId}`
|
|
29794
|
-
],
|
|
29795
|
-
{ encoding: "utf8", windowsHide: true }
|
|
29796
|
-
);
|
|
29797
|
-
if (result.error) throw result.error;
|
|
29798
|
-
if (result.status !== 0) throw new Error(result.stderr || result.stdout);
|
|
29799
|
-
}
|
|
29800
|
-
|
|
29801
|
-
// src/commands/prs/resolveCommentWithReply.ts
|
|
29802
|
-
function resolveThread(threadId) {
|
|
29803
|
-
const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
|
|
29804
|
-
execFileSync19(
|
|
29805
|
-
"gh",
|
|
29806
|
-
["api", "graphql", "-f", `query=${mutation}`, "-f", `threadId=${threadId}`],
|
|
29807
|
-
{ stdio: ["inherit", "pipe", "inherit"] }
|
|
29808
|
-
);
|
|
29809
|
-
}
|
|
29810
|
-
function requireCache(org, repo, prNumber) {
|
|
29811
|
-
const cache7 = loadCommentsCache(org, repo, prNumber);
|
|
29812
|
-
if (!cache7) {
|
|
29813
|
-
console.error(
|
|
29814
|
-
`Error: No cached comments found for PR #${prNumber}. Run "assist prs list-comments" first.`
|
|
29815
|
-
);
|
|
29816
|
-
process.exit(1);
|
|
29817
|
-
}
|
|
29818
|
-
return cache7;
|
|
29819
|
-
}
|
|
29820
|
-
function findLineComment(comments3, commentId) {
|
|
29821
|
-
return comments3.find((c) => c.type === "line" && c.id === commentId);
|
|
29822
|
-
}
|
|
29823
|
-
function requireLineComment(cache7, commentId) {
|
|
29824
|
-
const comment3 = findLineComment(cache7.comments, commentId);
|
|
29825
|
-
if (!comment3 || comment3.type !== "line" || !comment3.threadId) {
|
|
29826
|
-
console.error(
|
|
29827
|
-
`Error: Comment #${commentId} not found or has no thread ID.`
|
|
29828
|
-
);
|
|
29829
|
-
process.exit(1);
|
|
29830
|
-
}
|
|
29831
|
-
return comment3;
|
|
29832
|
-
}
|
|
29833
|
-
function cleanupCacheIfDone(cache7, org, repo, prNumber, commentId) {
|
|
29834
|
-
const hasRemaining = cache7.comments.some(
|
|
29835
|
-
(c) => c.type === "line" && c.id !== commentId
|
|
29836
|
-
);
|
|
29837
|
-
if (!hasRemaining) deleteCommentsCache(org, repo, prNumber);
|
|
29838
|
-
}
|
|
29839
|
-
function resolveCommentWithReply(commentId, message3) {
|
|
29840
|
-
const prNumber = getCurrentPrNumber();
|
|
29841
|
-
const { org, repo } = getRepoInfo();
|
|
29842
|
-
const cache7 = requireCache(org, repo, prNumber);
|
|
29843
|
-
const comment3 = requireLineComment(cache7, commentId);
|
|
29844
|
-
replyToComment(org, repo, prNumber, commentId, message3);
|
|
29845
|
-
console.log("Reply posted successfully.");
|
|
29846
|
-
resolveThread(comment3.threadId);
|
|
29847
|
-
console.log("Thread resolved successfully.");
|
|
29848
|
-
cleanupCacheIfDone(cache7, org, repo, prNumber, commentId);
|
|
29849
|
-
}
|
|
29850
|
-
|
|
29851
|
-
// src/commands/prs/fixed.ts
|
|
29852
|
-
function verifySha(sha) {
|
|
29853
|
-
try {
|
|
29854
|
-
return execSync40(`git rev-parse --verify ${sha}`, {
|
|
29855
|
-
encoding: "utf8"
|
|
29856
|
-
}).trim();
|
|
29857
|
-
} catch {
|
|
29858
|
-
console.error(`Error: '${sha}' is not a valid commit in this repository.`);
|
|
29859
|
-
process.exit(1);
|
|
29860
|
-
}
|
|
29861
|
-
}
|
|
29862
|
-
function fixed(commentId, sha) {
|
|
29863
|
-
try {
|
|
29864
|
-
const fullSha = verifySha(sha);
|
|
29865
|
-
const { org, repo } = getRepoInfo();
|
|
29866
|
-
const repoUrl = `https://github.com/${org}/${repo}`;
|
|
29867
|
-
const message3 = `Fixed in [${fullSha}](${repoUrl}/commit/${fullSha})`;
|
|
29868
|
-
pushCommit(loadConfig().worktree?.trunk === true);
|
|
29869
|
-
resolveCommentWithReply(commentId, message3);
|
|
29870
|
-
} catch (error) {
|
|
29871
|
-
if (isGhNotInstalled(error)) {
|
|
29872
|
-
console.error("Error: GitHub CLI (gh) is not installed.");
|
|
29873
|
-
console.error("Install it from https://cli.github.com/");
|
|
29874
|
-
process.exit(1);
|
|
29875
|
-
}
|
|
29876
|
-
throw error;
|
|
29877
|
-
}
|
|
29878
|
-
}
|
|
29879
|
-
|
|
29880
29982
|
// src/commands/prs/fetchThreadIds.ts
|
|
29881
29983
|
import { execFileSync as execFileSync20 } from "child_process";
|
|
29882
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 } } } } } } }`;
|
|
@@ -29912,9 +30014,9 @@ function fetchThreadIds(org, repo, prNumber) {
|
|
|
29912
30014
|
}
|
|
29913
30015
|
|
|
29914
30016
|
// src/commands/prs/listComments/fetchReviewComments.ts
|
|
29915
|
-
import { execSync as
|
|
30017
|
+
import { execSync as execSync40 } from "child_process";
|
|
29916
30018
|
function fetchJson(endpoint) {
|
|
29917
|
-
const result =
|
|
30019
|
+
const result = execSync40(`gh api --paginate ${endpoint}`, {
|
|
29918
30020
|
encoding: "utf8"
|
|
29919
30021
|
});
|
|
29920
30022
|
if (!result.trim()) return [];
|
|
@@ -29960,20 +30062,39 @@ import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync36 } from "fs";
|
|
|
29960
30062
|
import { dirname as dirname36 } from "path";
|
|
29961
30063
|
import { stringify as stringify3 } from "yaml";
|
|
29962
30064
|
|
|
30065
|
+
// src/commands/prs/loadCommentsCache.ts
|
|
30066
|
+
import { existsSync as existsSync64, readFileSync as readFileSync45, unlinkSync as unlinkSync13 } from "fs";
|
|
30067
|
+
import { parse as parse3 } from "yaml";
|
|
30068
|
+
function loadCommentsCache(org, repo, prNumber) {
|
|
30069
|
+
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
30070
|
+
if (!existsSync64(cachePath)) {
|
|
30071
|
+
return null;
|
|
30072
|
+
}
|
|
30073
|
+
const content = readFileSync45(cachePath, "utf8");
|
|
30074
|
+
return parse3(content);
|
|
30075
|
+
}
|
|
30076
|
+
function deleteCommentsCache(org, repo, prNumber) {
|
|
30077
|
+
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
30078
|
+
if (existsSync64(cachePath)) {
|
|
30079
|
+
unlinkSync13(cachePath);
|
|
30080
|
+
console.log("No more unresolved line comments. Cache dropped.");
|
|
30081
|
+
}
|
|
30082
|
+
}
|
|
30083
|
+
|
|
29963
30084
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
29964
|
-
import { readdirSync as
|
|
29965
|
-
import { join as
|
|
30085
|
+
import { readdirSync as readdirSync13, unlinkSync as unlinkSync14 } from "fs";
|
|
30086
|
+
import { join as join80 } from "path";
|
|
29966
30087
|
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
29967
30088
|
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
29968
|
-
const dir =
|
|
30089
|
+
const dir = join80(cwd, ".assist");
|
|
29969
30090
|
let entries;
|
|
29970
30091
|
try {
|
|
29971
|
-
entries =
|
|
30092
|
+
entries = readdirSync13(dir);
|
|
29972
30093
|
} catch {
|
|
29973
30094
|
return;
|
|
29974
30095
|
}
|
|
29975
30096
|
for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
|
|
29976
|
-
unlinkSync14(
|
|
30097
|
+
unlinkSync14(join80(dir, entry));
|
|
29977
30098
|
}
|
|
29978
30099
|
}
|
|
29979
30100
|
|
|
@@ -30197,6 +30318,110 @@ function printComments2(result) {
|
|
|
30197
30318
|
}
|
|
30198
30319
|
}
|
|
30199
30320
|
|
|
30321
|
+
// src/commands/prs/fixed.ts
|
|
30322
|
+
import { execSync as execSync41 } from "child_process";
|
|
30323
|
+
|
|
30324
|
+
// src/commands/prs/resolveCommentWithReply.ts
|
|
30325
|
+
import { execFileSync as execFileSync21 } from "child_process";
|
|
30326
|
+
|
|
30327
|
+
// src/commands/prs/replyToComment.ts
|
|
30328
|
+
import { spawnSync as spawnSync7 } from "child_process";
|
|
30329
|
+
function replyToComment(org, repo, prNumber, commentId, message3) {
|
|
30330
|
+
const result = spawnSync7(
|
|
30331
|
+
"gh",
|
|
30332
|
+
[
|
|
30333
|
+
"api",
|
|
30334
|
+
`repos/${org}/${repo}/pulls/${prNumber}/comments`,
|
|
30335
|
+
"-f",
|
|
30336
|
+
`body=${message3}`,
|
|
30337
|
+
"-F",
|
|
30338
|
+
`in_reply_to=${commentId}`
|
|
30339
|
+
],
|
|
30340
|
+
{ encoding: "utf8", windowsHide: true }
|
|
30341
|
+
);
|
|
30342
|
+
if (result.error) throw result.error;
|
|
30343
|
+
if (result.status !== 0) throw new Error(result.stderr || result.stdout);
|
|
30344
|
+
}
|
|
30345
|
+
|
|
30346
|
+
// src/commands/prs/resolveCommentWithReply.ts
|
|
30347
|
+
function resolveThread(threadId) {
|
|
30348
|
+
const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
|
|
30349
|
+
execFileSync21(
|
|
30350
|
+
"gh",
|
|
30351
|
+
["api", "graphql", "-f", `query=${mutation}`, "-f", `threadId=${threadId}`],
|
|
30352
|
+
{ stdio: ["inherit", "pipe", "inherit"] }
|
|
30353
|
+
);
|
|
30354
|
+
}
|
|
30355
|
+
function requireCache(org, repo, prNumber) {
|
|
30356
|
+
const cache7 = loadCommentsCache(org, repo, prNumber);
|
|
30357
|
+
if (!cache7) {
|
|
30358
|
+
console.error(
|
|
30359
|
+
`Error: No cached comments found for PR #${prNumber}. Run "assist prs list-comments" first.`
|
|
30360
|
+
);
|
|
30361
|
+
process.exit(1);
|
|
30362
|
+
}
|
|
30363
|
+
return cache7;
|
|
30364
|
+
}
|
|
30365
|
+
function findLineComment(comments3, commentId) {
|
|
30366
|
+
return comments3.find((c) => c.type === "line" && c.id === commentId);
|
|
30367
|
+
}
|
|
30368
|
+
function requireLineComment(cache7, commentId) {
|
|
30369
|
+
const comment3 = findLineComment(cache7.comments, commentId);
|
|
30370
|
+
if (!comment3 || comment3.type !== "line" || !comment3.threadId) {
|
|
30371
|
+
console.error(
|
|
30372
|
+
`Error: Comment #${commentId} not found or has no thread ID.`
|
|
30373
|
+
);
|
|
30374
|
+
process.exit(1);
|
|
30375
|
+
}
|
|
30376
|
+
return comment3;
|
|
30377
|
+
}
|
|
30378
|
+
function cleanupCacheIfDone(cache7, org, repo, prNumber, commentId) {
|
|
30379
|
+
const hasRemaining = cache7.comments.some(
|
|
30380
|
+
(c) => c.type === "line" && c.id !== commentId
|
|
30381
|
+
);
|
|
30382
|
+
if (!hasRemaining) deleteCommentsCache(org, repo, prNumber);
|
|
30383
|
+
}
|
|
30384
|
+
function resolveCommentWithReply(commentId, message3) {
|
|
30385
|
+
const prNumber = getCurrentPrNumber();
|
|
30386
|
+
const { org, repo } = getRepoInfo();
|
|
30387
|
+
const cache7 = requireCache(org, repo, prNumber);
|
|
30388
|
+
const comment3 = requireLineComment(cache7, commentId);
|
|
30389
|
+
replyToComment(org, repo, prNumber, commentId, message3);
|
|
30390
|
+
console.log("Reply posted successfully.");
|
|
30391
|
+
resolveThread(comment3.threadId);
|
|
30392
|
+
console.log("Thread resolved successfully.");
|
|
30393
|
+
cleanupCacheIfDone(cache7, org, repo, prNumber, commentId);
|
|
30394
|
+
}
|
|
30395
|
+
|
|
30396
|
+
// src/commands/prs/fixed.ts
|
|
30397
|
+
function verifySha(sha) {
|
|
30398
|
+
try {
|
|
30399
|
+
return execSync41(`git rev-parse --verify ${sha}`, {
|
|
30400
|
+
encoding: "utf8"
|
|
30401
|
+
}).trim();
|
|
30402
|
+
} catch {
|
|
30403
|
+
console.error(`Error: '${sha}' is not a valid commit in this repository.`);
|
|
30404
|
+
process.exit(1);
|
|
30405
|
+
}
|
|
30406
|
+
}
|
|
30407
|
+
function fixed(commentId, sha) {
|
|
30408
|
+
try {
|
|
30409
|
+
const fullSha = verifySha(sha);
|
|
30410
|
+
const { org, repo } = getRepoInfo();
|
|
30411
|
+
const repoUrl = `https://github.com/${org}/${repo}`;
|
|
30412
|
+
const message3 = `Fixed in [${fullSha}](${repoUrl}/commit/${fullSha})`;
|
|
30413
|
+
pushCommit(loadConfig().worktree?.trunk === true);
|
|
30414
|
+
resolveCommentWithReply(commentId, message3);
|
|
30415
|
+
} catch (error) {
|
|
30416
|
+
if (isGhNotInstalled(error)) {
|
|
30417
|
+
console.error("Error: GitHub CLI (gh) is not installed.");
|
|
30418
|
+
console.error("Install it from https://cli.github.com/");
|
|
30419
|
+
process.exit(1);
|
|
30420
|
+
}
|
|
30421
|
+
throw error;
|
|
30422
|
+
}
|
|
30423
|
+
}
|
|
30424
|
+
|
|
30200
30425
|
// src/commands/prs/reply.ts
|
|
30201
30426
|
function validateBody2(body) {
|
|
30202
30427
|
const lowerBody = body.toLowerCase();
|
|
@@ -30273,39 +30498,60 @@ async function wontfix(commentId, reason4) {
|
|
|
30273
30498
|
}
|
|
30274
30499
|
}
|
|
30275
30500
|
|
|
30501
|
+
// src/commands/registerPrsThreadReplies.ts
|
|
30502
|
+
function registerPrsThreadReplies(prsCommand, calledBy3) {
|
|
30503
|
+
internalCommand(
|
|
30504
|
+
prsCommand.command("fixed <comment-id> <sha>").description("Reply with commit link and resolve thread").action((commentId, sha) => {
|
|
30505
|
+
fixed(Number.parseInt(commentId, 10), sha);
|
|
30506
|
+
}),
|
|
30507
|
+
calledBy3
|
|
30508
|
+
);
|
|
30509
|
+
internalCommand(
|
|
30510
|
+
prsCommand.command("wontfix <comment-id> <reason>").description(
|
|
30511
|
+
"Reply with reason and resolve thread (reason of - reads it from stdin)"
|
|
30512
|
+
).action(async (commentId, reason4) => {
|
|
30513
|
+
await wontfix(
|
|
30514
|
+
Number.parseInt(commentId, 10),
|
|
30515
|
+
await readBodyArgument(reason4)
|
|
30516
|
+
);
|
|
30517
|
+
}),
|
|
30518
|
+
calledBy3
|
|
30519
|
+
);
|
|
30520
|
+
internalCommand(
|
|
30521
|
+
prsCommand.command("reply <comment-id> <body>").description(
|
|
30522
|
+
"Reply to a comment thread without resolving it (body of - reads it from stdin)"
|
|
30523
|
+
).action(async (commentId, body) => {
|
|
30524
|
+
await reply(
|
|
30525
|
+
Number.parseInt(commentId, 10),
|
|
30526
|
+
await readBodyArgument(body)
|
|
30527
|
+
);
|
|
30528
|
+
}),
|
|
30529
|
+
calledBy3
|
|
30530
|
+
);
|
|
30531
|
+
}
|
|
30532
|
+
|
|
30276
30533
|
// src/commands/registerPrsComments.ts
|
|
30534
|
+
var reviewComments = "/review-pr-comments";
|
|
30277
30535
|
function registerPrsComments(prsCommand) {
|
|
30278
|
-
|
|
30279
|
-
|
|
30280
|
-
|
|
30281
|
-
|
|
30282
|
-
|
|
30283
|
-
|
|
30284
|
-
prsCommand
|
|
30285
|
-
|
|
30286
|
-
|
|
30287
|
-
|
|
30288
|
-
|
|
30289
|
-
await
|
|
30290
|
-
|
|
30291
|
-
|
|
30292
|
-
|
|
30293
|
-
|
|
30294
|
-
|
|
30295
|
-
|
|
30296
|
-
|
|
30297
|
-
await readBodyArgument(body)
|
|
30298
|
-
);
|
|
30299
|
-
});
|
|
30300
|
-
prsCommand.command("comment <path> <line> <body>").description(
|
|
30301
|
-
"Add a line comment to the pending review (body of - reads it from stdin)"
|
|
30302
|
-
).action(async (path108, line, body) => {
|
|
30303
|
-
await comment2(
|
|
30304
|
-
path108,
|
|
30305
|
-
Number.parseInt(line, 10),
|
|
30306
|
-
await readBodyArgument(body)
|
|
30307
|
-
);
|
|
30308
|
-
});
|
|
30536
|
+
internalCommand(
|
|
30537
|
+
prsCommand.command("list-comments").description("List all comments on the current branch's pull request").action(() => {
|
|
30538
|
+
listComments().then(printComments2);
|
|
30539
|
+
}),
|
|
30540
|
+
reviewComments
|
|
30541
|
+
);
|
|
30542
|
+
registerPrsThreadReplies(prsCommand, reviewComments);
|
|
30543
|
+
internalCommand(
|
|
30544
|
+
prsCommand.command("comment <path> <line> <body>").description(
|
|
30545
|
+
"Add a line comment to the pending review (body of - reads it from stdin)"
|
|
30546
|
+
).action(async (path108, line, body) => {
|
|
30547
|
+
await comment2(
|
|
30548
|
+
path108,
|
|
30549
|
+
Number.parseInt(line, 10),
|
|
30550
|
+
await readBodyArgument(body)
|
|
30551
|
+
);
|
|
30552
|
+
}),
|
|
30553
|
+
"/comment and /forward-comments"
|
|
30554
|
+
);
|
|
30309
30555
|
}
|
|
30310
30556
|
|
|
30311
30557
|
// src/commands/prs/applyEdit.ts
|
|
@@ -30672,7 +30918,7 @@ function collect5(value, previous) {
|
|
|
30672
30918
|
return previous.concat([value]);
|
|
30673
30919
|
}
|
|
30674
30920
|
function registerPrsEdit(prsCommand) {
|
|
30675
|
-
prsCommand.command("edit").description(
|
|
30921
|
+
const editCommand = prsCommand.command("edit").description(
|
|
30676
30922
|
"Update individual sections of the current branch's pull request"
|
|
30677
30923
|
).option("-t, --title <title>", "New title for the pull request").option("--what <what>", "Replace the ## What section").option("--why <why>", "Replace the ## Why section").option("--how <how>", "Replace the ## How section").option(
|
|
30678
30924
|
"--resolves <ref>",
|
|
@@ -30685,6 +30931,7 @@ function registerPrsEdit(prsCommand) {
|
|
|
30685
30931
|
collect5,
|
|
30686
30932
|
[]
|
|
30687
30933
|
).addHelpText("after", () => editHelpText()).action(edit);
|
|
30934
|
+
internalCommand(editCommand, "agents revising their pull request");
|
|
30688
30935
|
}
|
|
30689
30936
|
|
|
30690
30937
|
// src/commands/prs/buildValidatedBody.ts
|
|
@@ -30704,7 +30951,7 @@ function buildValidatedBody(options2, usage) {
|
|
|
30704
30951
|
}
|
|
30705
30952
|
|
|
30706
30953
|
// src/commands/prs/placePr.ts
|
|
30707
|
-
import { execFileSync as
|
|
30954
|
+
import { execFileSync as execFileSync22 } from "child_process";
|
|
30708
30955
|
|
|
30709
30956
|
// src/commands/prs/buildCreateArgs.ts
|
|
30710
30957
|
function buildCreateArgs(title, body, options2, attachments = []) {
|
|
@@ -30790,7 +31037,7 @@ function buildEditArgs(number, title, body, attachments = []) {
|
|
|
30790
31037
|
// src/commands/prs/placePr.ts
|
|
30791
31038
|
function hasUpstream2() {
|
|
30792
31039
|
try {
|
|
30793
|
-
|
|
31040
|
+
execFileSync22(
|
|
30794
31041
|
"git",
|
|
30795
31042
|
["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"],
|
|
30796
31043
|
{ stdio: "pipe" }
|
|
@@ -30802,7 +31049,7 @@ function hasUpstream2() {
|
|
|
30802
31049
|
}
|
|
30803
31050
|
function ensureBranchPushed() {
|
|
30804
31051
|
const args = hasUpstream2() ? ["push"] : ["push", "--set-upstream", "origin", "HEAD"];
|
|
30805
|
-
|
|
31052
|
+
execFileSync22("git", args, { stdio: "inherit" });
|
|
30806
31053
|
}
|
|
30807
31054
|
async function placePr(prNumber, title, body, options2, attachments = []) {
|
|
30808
31055
|
const args = prNumber !== null ? buildEditArgs(prNumber, title, body, attachments) : buildCreateArgs(title, body, options2, attachments);
|
|
@@ -30873,10 +31120,10 @@ function warn(reason4) {
|
|
|
30873
31120
|
}
|
|
30874
31121
|
|
|
30875
31122
|
// src/commands/prs/enableAutoMerge.ts
|
|
30876
|
-
import { execFileSync as
|
|
31123
|
+
import { execFileSync as execFileSync23 } from "child_process";
|
|
30877
31124
|
function enableAutoMerge() {
|
|
30878
31125
|
try {
|
|
30879
|
-
|
|
31126
|
+
execFileSync23(
|
|
30880
31127
|
"gh",
|
|
30881
31128
|
["pr", "merge", getCurrentBranch2(), "--auto", "--squash"],
|
|
30882
31129
|
{ stdio: "inherit" }
|
|
@@ -31113,6 +31360,7 @@ function registerPrsRaise(prsCommand) {
|
|
|
31113
31360
|
collect6,
|
|
31114
31361
|
[]
|
|
31115
31362
|
).option("-m, --milestone <name>", "Add the pull request to a milestone").addHelpText("after", () => raiseHelpText()).action(raise);
|
|
31363
|
+
internalCommand(raiseCommand, "/pr");
|
|
31116
31364
|
configHelp(raiseCommand, prsRaiseConfigHelp);
|
|
31117
31365
|
}
|
|
31118
31366
|
|
|
@@ -31130,10 +31378,10 @@ function prsSlackChannel() {
|
|
|
31130
31378
|
}
|
|
31131
31379
|
|
|
31132
31380
|
// src/commands/prs/status/fetchReviewThreads.ts
|
|
31133
|
-
import { execFileSync as
|
|
31381
|
+
import { execFileSync as execFileSync24 } from "child_process";
|
|
31134
31382
|
var THREAD_QUERY2 = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { isResolved } } } } }`;
|
|
31135
31383
|
function fetchReviewThreads(org, repo, prNumber) {
|
|
31136
|
-
const output =
|
|
31384
|
+
const output = execFileSync24(
|
|
31137
31385
|
"gh",
|
|
31138
31386
|
[
|
|
31139
31387
|
"api",
|
|
@@ -31440,12 +31688,18 @@ function prsStatus(repos2, options2) {
|
|
|
31440
31688
|
|
|
31441
31689
|
// src/commands/registerPrsStatus.ts
|
|
31442
31690
|
function registerPrsStatus(prsCommand) {
|
|
31443
|
-
|
|
31444
|
-
"
|
|
31445
|
-
|
|
31446
|
-
|
|
31447
|
-
"
|
|
31448
|
-
)
|
|
31691
|
+
internalCommand(
|
|
31692
|
+
prsCommand.command("status <repo...>").description(
|
|
31693
|
+
"Report every open pull request in each owner/repo, grouped by repo"
|
|
31694
|
+
).option("--json", "Output as JSON").action(prsStatus),
|
|
31695
|
+
"/prs-status"
|
|
31696
|
+
);
|
|
31697
|
+
internalCommand(
|
|
31698
|
+
prsCommand.command("slack-channel").description(
|
|
31699
|
+
"Print the Slack channel PRs are announced to (prs.slack, else slack.channel)"
|
|
31700
|
+
).action(prsSlackChannel),
|
|
31701
|
+
"/prs-slack"
|
|
31702
|
+
);
|
|
31449
31703
|
}
|
|
31450
31704
|
|
|
31451
31705
|
// src/commands/readTime/readTime.ts
|
|
@@ -32684,9 +32938,9 @@ async function notify() {
|
|
|
32684
32938
|
|
|
32685
32939
|
// src/commands/screenshot.ts
|
|
32686
32940
|
import { execSync as execSync49 } from "child_process";
|
|
32687
|
-
import { existsSync as
|
|
32941
|
+
import { existsSync as existsSync65, mkdirSync as mkdirSync23, unlinkSync as unlinkSync15, writeFileSync as writeFileSync37 } from "fs";
|
|
32688
32942
|
import { tmpdir as tmpdir6 } from "os";
|
|
32689
|
-
import { join as
|
|
32943
|
+
import { join as join81, resolve as resolve24 } from "path";
|
|
32690
32944
|
import chalk208 from "chalk";
|
|
32691
32945
|
|
|
32692
32946
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -32816,14 +33070,14 @@ Write-Output $OutputPath
|
|
|
32816
33070
|
|
|
32817
33071
|
// src/commands/screenshot.ts
|
|
32818
33072
|
function buildOutputPath(outputDir, processName) {
|
|
32819
|
-
if (!
|
|
33073
|
+
if (!existsSync65(outputDir)) {
|
|
32820
33074
|
mkdirSync23(outputDir, { recursive: true });
|
|
32821
33075
|
}
|
|
32822
33076
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
32823
33077
|
return resolve24(outputDir, `${processName}-${timestamp6}.png`);
|
|
32824
33078
|
}
|
|
32825
33079
|
function runPowerShellScript(processName, outputPath) {
|
|
32826
|
-
const scriptPath =
|
|
33080
|
+
const scriptPath = join81(tmpdir6(), `assist-screenshot-${Date.now()}.ps1`);
|
|
32827
33081
|
writeFileSync37(scriptPath, captureWindowPs1, "utf8");
|
|
32828
33082
|
try {
|
|
32829
33083
|
execSync49(
|
|
@@ -32938,9 +33192,9 @@ function buildLimitsSegment(rateLimits) {
|
|
|
32938
33192
|
|
|
32939
33193
|
// src/commands/readGitBranch.ts
|
|
32940
33194
|
import { readFileSync as readFileSync48, statSync as statSync10 } from "fs";
|
|
32941
|
-
import { isAbsolute as isAbsolute6, join as
|
|
33195
|
+
import { isAbsolute as isAbsolute6, join as join82, resolve as resolve25 } from "path";
|
|
32942
33196
|
function resolveGitDir(cwd) {
|
|
32943
|
-
const dotGit =
|
|
33197
|
+
const dotGit = join82(cwd, ".git");
|
|
32944
33198
|
let stat5;
|
|
32945
33199
|
try {
|
|
32946
33200
|
stat5 = statSync10(dotGit);
|
|
@@ -32970,7 +33224,7 @@ function readGitBranch(cwd) {
|
|
|
32970
33224
|
}
|
|
32971
33225
|
let head;
|
|
32972
33226
|
try {
|
|
32973
|
-
head = readFileSync48(
|
|
33227
|
+
head = readFileSync48(join82(gitDir, "HEAD"), "utf8");
|
|
32974
33228
|
} catch {
|
|
32975
33229
|
return null;
|
|
32976
33230
|
}
|
|
@@ -33106,6 +33360,7 @@ function registerNotify(program) {
|
|
|
33106
33360
|
const notifyCommand = program.command("notify").description(
|
|
33107
33361
|
"Show notification from Claude Code hook (reads JSON from stdin)"
|
|
33108
33362
|
).action(notify);
|
|
33363
|
+
internalCommand(notifyCommand, "the Notification hook");
|
|
33109
33364
|
configHelp(notifyCommand, rootConfigHelp.notify);
|
|
33110
33365
|
}
|
|
33111
33366
|
function registerScreenshot(program) {
|
|
@@ -33116,7 +33371,10 @@ function registerRootCommands(program) {
|
|
|
33116
33371
|
program.command("init").description("Initialize VS Code and verify configurations").action(init5);
|
|
33117
33372
|
registerLint(program);
|
|
33118
33373
|
registerVscode(program);
|
|
33119
|
-
|
|
33374
|
+
internalCommand(
|
|
33375
|
+
program.command("status-line").description("Format Claude Code status line from JSON stdin").action(statusLine),
|
|
33376
|
+
"Claude Code's status line"
|
|
33377
|
+
);
|
|
33120
33378
|
registerNotify(program);
|
|
33121
33379
|
program.command("update").description("Update assist to the latest version and sync commands").action(update2);
|
|
33122
33380
|
program.command("coverage").description("Print global statement coverage percentage").action(coverage);
|
|
@@ -35442,7 +35700,7 @@ function exitWith(message3) {
|
|
|
35442
35700
|
}
|
|
35443
35701
|
|
|
35444
35702
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
35445
|
-
import { execFileSync as
|
|
35703
|
+
import { execFileSync as execFileSync26 } from "child_process";
|
|
35446
35704
|
import chalk232 from "chalk";
|
|
35447
35705
|
|
|
35448
35706
|
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
@@ -35491,7 +35749,7 @@ function readGlobs(value) {
|
|
|
35491
35749
|
}
|
|
35492
35750
|
|
|
35493
35751
|
// src/commands/review/highLevel/summariseRepoTree.ts
|
|
35494
|
-
import { execFileSync as
|
|
35752
|
+
import { execFileSync as execFileSync25 } from "child_process";
|
|
35495
35753
|
import { dirname as dirname38, extname as extname6 } from "path";
|
|
35496
35754
|
var MAX_DIRECTORIES = 200;
|
|
35497
35755
|
var MAX_EXTENSIONS_PER_DIRECTORY = 6;
|
|
@@ -35507,7 +35765,7 @@ function summariseRepoTree(cwd = process.cwd()) {
|
|
|
35507
35765
|
}
|
|
35508
35766
|
function listTrackedFiles(cwd) {
|
|
35509
35767
|
try {
|
|
35510
|
-
return
|
|
35768
|
+
return execFileSync25("git", ["ls-files"], {
|
|
35511
35769
|
cwd,
|
|
35512
35770
|
encoding: "utf8",
|
|
35513
35771
|
maxBuffer: 64 * 1024 * 1024
|
|
@@ -35552,7 +35810,7 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
35552
35810
|
}
|
|
35553
35811
|
function askClaude(prompt, cwd) {
|
|
35554
35812
|
try {
|
|
35555
|
-
return
|
|
35813
|
+
return execFileSync26("claude", ["-p", "--model", "sonnet", prompt], {
|
|
35556
35814
|
cwd,
|
|
35557
35815
|
encoding: "utf8",
|
|
35558
35816
|
timeout: 12e4,
|
|
@@ -36146,11 +36404,11 @@ function evaluateHighLevelChecks(subject) {
|
|
|
36146
36404
|
}
|
|
36147
36405
|
|
|
36148
36406
|
// src/commands/review/highLevel/fetchFileAtSha.ts
|
|
36149
|
-
import { execFileSync as
|
|
36407
|
+
import { execFileSync as execFileSync27 } from "child_process";
|
|
36150
36408
|
function fetchFileAtSha(repo, sha, path108) {
|
|
36151
36409
|
const encodedPath = path108.split("/").map(encodeURIComponent).join("/");
|
|
36152
36410
|
try {
|
|
36153
|
-
return
|
|
36411
|
+
return execFileSync27(
|
|
36154
36412
|
"gh",
|
|
36155
36413
|
[
|
|
36156
36414
|
"api",
|
|
@@ -36172,7 +36430,7 @@ function fetchFileAtSha(repo, sha, path108) {
|
|
|
36172
36430
|
}
|
|
36173
36431
|
|
|
36174
36432
|
// src/commands/review/highLevel/fetchHighLevelFiles.ts
|
|
36175
|
-
import { execFileSync as
|
|
36433
|
+
import { execFileSync as execFileSync28 } from "child_process";
|
|
36176
36434
|
import { createHash as createHash4 } from "crypto";
|
|
36177
36435
|
var JQ = ".[] | {filename,status,additions,deletions,patch} | @json";
|
|
36178
36436
|
function toStatus(status2) {
|
|
@@ -36185,7 +36443,7 @@ function diffUrl(repo, prNumber, path108) {
|
|
|
36185
36443
|
return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
|
|
36186
36444
|
}
|
|
36187
36445
|
function fetchHighLevelFiles(prNumber, repo) {
|
|
36188
|
-
const out =
|
|
36446
|
+
const out = execFileSync28(
|
|
36189
36447
|
"gh",
|
|
36190
36448
|
["api", `repos/${repo}/pulls/${prNumber}/files`, "--paginate", "--jq", JQ],
|
|
36191
36449
|
{ encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }
|
|
@@ -36252,12 +36510,12 @@ function fetchHighLevelPr(prNumber, repo) {
|
|
|
36252
36510
|
}
|
|
36253
36511
|
|
|
36254
36512
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
36255
|
-
import { join as
|
|
36513
|
+
import { join as join83 } from "path";
|
|
36256
36514
|
function slug(value) {
|
|
36257
36515
|
return value.replace(/[^\w.-]+/g, "-");
|
|
36258
36516
|
}
|
|
36259
36517
|
function highLevelReviewPath(repo, headRef, headSha) {
|
|
36260
|
-
return
|
|
36518
|
+
return join83(
|
|
36261
36519
|
getStoreDir(),
|
|
36262
36520
|
"high-level-reviews",
|
|
36263
36521
|
slug(repo),
|
|
@@ -36274,9 +36532,9 @@ function highLevelDraftPath(repo, headRef, headSha) {
|
|
|
36274
36532
|
}
|
|
36275
36533
|
|
|
36276
36534
|
// src/commands/review/highLevel/readJsonFile.ts
|
|
36277
|
-
import { existsSync as
|
|
36535
|
+
import { existsSync as existsSync66, readFileSync as readFileSync49 } from "fs";
|
|
36278
36536
|
function readJsonFile(path108) {
|
|
36279
|
-
if (!
|
|
36537
|
+
if (!existsSync66(path108)) return void 0;
|
|
36280
36538
|
try {
|
|
36281
36539
|
return JSON.parse(readFileSync49(path108, "utf8"));
|
|
36282
36540
|
} catch {
|
|
@@ -36377,10 +36635,10 @@ function toItem2(check2, decision) {
|
|
|
36377
36635
|
};
|
|
36378
36636
|
}
|
|
36379
36637
|
function highLevelProgress(checks2, decision) {
|
|
36380
|
-
const
|
|
36638
|
+
const reviewComments2 = decision.reviewComments ?? [];
|
|
36381
36639
|
return {
|
|
36382
36640
|
items: checks2.map((check2) => toItem2(check2, decision)),
|
|
36383
|
-
...
|
|
36641
|
+
...reviewComments2.length > 0 ? { reviewComments: reviewComments2 } : {}
|
|
36384
36642
|
};
|
|
36385
36643
|
}
|
|
36386
36644
|
|
|
@@ -36518,13 +36776,13 @@ function formatItem(item) {
|
|
|
36518
36776
|
|
|
36519
36777
|
${item.comment}`;
|
|
36520
36778
|
}
|
|
36521
|
-
function formatHighLevelReviewBody(items2,
|
|
36779
|
+
function formatHighLevelReviewBody(items2, reviewComments2 = []) {
|
|
36522
36780
|
const sections = items2.map(formatItem).filter((section2) => section2 !== void 0);
|
|
36523
|
-
if (
|
|
36781
|
+
if (reviewComments2.length > 0)
|
|
36524
36782
|
sections.push(
|
|
36525
36783
|
`**Comments**
|
|
36526
36784
|
|
|
36527
|
-
${
|
|
36785
|
+
${reviewComments2.map(formatReviewComment).join("\n")}`
|
|
36528
36786
|
);
|
|
36529
36787
|
return sections.join("\n\n");
|
|
36530
36788
|
}
|
|
@@ -37416,7 +37674,7 @@ import { format as format2 } from "util";
|
|
|
37416
37674
|
|
|
37417
37675
|
// src/commands/review/createReviewLogSink.ts
|
|
37418
37676
|
import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync25 } from "fs";
|
|
37419
|
-
import { join as
|
|
37677
|
+
import { join as join84 } from "path";
|
|
37420
37678
|
var LOG_FILE = "review.log";
|
|
37421
37679
|
function createReviewLogSink() {
|
|
37422
37680
|
let logPath2;
|
|
@@ -37433,7 +37691,7 @@ function createReviewLogSink() {
|
|
|
37433
37691
|
},
|
|
37434
37692
|
attach(reviewDir) {
|
|
37435
37693
|
mkdirSync25(reviewDir, { recursive: true });
|
|
37436
|
-
logPath2 =
|
|
37694
|
+
logPath2 = join84(reviewDir, LOG_FILE);
|
|
37437
37695
|
const lines2 = [
|
|
37438
37696
|
"",
|
|
37439
37697
|
`=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
|
|
@@ -38132,7 +38390,7 @@ async function runClaudeReviewer(spec) {
|
|
|
38132
38390
|
}
|
|
38133
38391
|
|
|
38134
38392
|
// src/commands/review/runCodexReviewer.ts
|
|
38135
|
-
import { existsSync as
|
|
38393
|
+
import { existsSync as existsSync67, unlinkSync as unlinkSync16 } from "fs";
|
|
38136
38394
|
|
|
38137
38395
|
// src/commands/review/parseCodexUsage.ts
|
|
38138
38396
|
function parseCodexUsage(usage) {
|
|
@@ -38221,7 +38479,7 @@ async function runCodexReviewer(spec) {
|
|
|
38221
38479
|
...override.args.length > 0 ? { env: override.env } : {},
|
|
38222
38480
|
onLine
|
|
38223
38481
|
});
|
|
38224
|
-
if (result.exitCode !== 0 &&
|
|
38482
|
+
if (result.exitCode !== 0 && existsSync67(spec.outputPath)) {
|
|
38225
38483
|
unlinkSync16(spec.outputPath);
|
|
38226
38484
|
}
|
|
38227
38485
|
const finalised = finaliseReviewerRun(
|
|
@@ -38312,7 +38570,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
|
|
|
38312
38570
|
}
|
|
38313
38571
|
|
|
38314
38572
|
// src/commands/review/synthesiseAfterReviewers.ts
|
|
38315
|
-
import { existsSync as
|
|
38573
|
+
import { existsSync as existsSync68, unlinkSync as unlinkSync17 } from "fs";
|
|
38316
38574
|
|
|
38317
38575
|
// src/commands/review/synthesise.ts
|
|
38318
38576
|
import { readFileSync as readFileSync51 } from "fs";
|
|
@@ -38419,7 +38677,7 @@ async function synthesise(paths, options2) {
|
|
|
38419
38677
|
// src/commands/review/synthesiseAfterReviewers.ts
|
|
38420
38678
|
async function synthesiseAfterReviewers(input) {
|
|
38421
38679
|
const { paths, failures } = input;
|
|
38422
|
-
if (input.anyFresh &&
|
|
38680
|
+
if (input.anyFresh && existsSync68(paths.synthesisPath)) {
|
|
38423
38681
|
unlinkSync17(paths.synthesisPath);
|
|
38424
38682
|
}
|
|
38425
38683
|
const synthesisResult = await synthesise(paths, {
|
|
@@ -38648,9 +38906,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
38648
38906
|
|
|
38649
38907
|
// src/commands/review/buildReviewPaths.ts
|
|
38650
38908
|
import { homedir as homedir25 } from "os";
|
|
38651
|
-
import { basename as basename24, join as
|
|
38909
|
+
import { basename as basename24, join as join85 } from "path";
|
|
38652
38910
|
function buildReviewPaths(repoRoot2, key) {
|
|
38653
|
-
const reviewDir =
|
|
38911
|
+
const reviewDir = join85(
|
|
38654
38912
|
homedir25(),
|
|
38655
38913
|
".assist",
|
|
38656
38914
|
"reviews",
|
|
@@ -38659,10 +38917,10 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
38659
38917
|
);
|
|
38660
38918
|
return {
|
|
38661
38919
|
reviewDir,
|
|
38662
|
-
requestPath:
|
|
38663
|
-
claudePath:
|
|
38664
|
-
codexPath:
|
|
38665
|
-
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")
|
|
38666
38924
|
};
|
|
38667
38925
|
}
|
|
38668
38926
|
|
|
@@ -38700,10 +38958,10 @@ function fetchExistingComments() {
|
|
|
38700
38958
|
}
|
|
38701
38959
|
|
|
38702
38960
|
// src/commands/review/prepareReviewDir.ts
|
|
38703
|
-
import { existsSync as
|
|
38961
|
+
import { existsSync as existsSync69, mkdirSync as mkdirSync26, unlinkSync as unlinkSync18, writeFileSync as writeFileSync40 } from "fs";
|
|
38704
38962
|
function clearReviewFiles(paths) {
|
|
38705
38963
|
for (const path108 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
38706
|
-
if (
|
|
38964
|
+
if (existsSync69(path108)) unlinkSync18(path108);
|
|
38707
38965
|
}
|
|
38708
38966
|
}
|
|
38709
38967
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -39357,7 +39615,7 @@ function registerReview(program) {
|
|
|
39357
39615
|
}
|
|
39358
39616
|
|
|
39359
39617
|
// src/commands/rules/addRule.ts
|
|
39360
|
-
import { existsSync as
|
|
39618
|
+
import { existsSync as existsSync72, readFileSync as readFileSync56, writeFileSync as writeFileSync42 } from "fs";
|
|
39361
39619
|
import path87 from "path";
|
|
39362
39620
|
import chalk242 from "chalk";
|
|
39363
39621
|
|
|
@@ -39385,12 +39643,12 @@ function insertRuleBullet(content, rule) {
|
|
|
39385
39643
|
import { readFileSync as readFileSync53 } from "fs";
|
|
39386
39644
|
|
|
39387
39645
|
// src/commands/rules/findClaudeFiles.ts
|
|
39388
|
-
import { readdirSync as
|
|
39646
|
+
import { readdirSync as readdirSync14 } from "fs";
|
|
39389
39647
|
import path83 from "path";
|
|
39390
39648
|
var SKIP_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage"]);
|
|
39391
39649
|
function findClaudeFiles(dir) {
|
|
39392
39650
|
const results = [];
|
|
39393
|
-
for (const entry of
|
|
39651
|
+
for (const entry of readdirSync14(dir, { withFileTypes: true })) {
|
|
39394
39652
|
if (entry.isDirectory()) {
|
|
39395
39653
|
if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name))
|
|
39396
39654
|
continue;
|
|
@@ -39414,7 +39672,7 @@ function nextRuleCode(root2) {
|
|
|
39414
39672
|
}
|
|
39415
39673
|
|
|
39416
39674
|
// src/commands/rules/resolveRuleScope.ts
|
|
39417
|
-
import { existsSync as
|
|
39675
|
+
import { existsSync as existsSync70 } from "fs";
|
|
39418
39676
|
import path84 from "path";
|
|
39419
39677
|
function resolveRuleScope(target) {
|
|
39420
39678
|
const resolved = path84.resolve(target);
|
|
@@ -39424,7 +39682,7 @@ function resolveRuleScope(target) {
|
|
|
39424
39682
|
let current = startDir;
|
|
39425
39683
|
while (true) {
|
|
39426
39684
|
const candidate = path84.join(current, "CLAUDE.md");
|
|
39427
|
-
if (
|
|
39685
|
+
if (existsSync70(candidate)) return candidate;
|
|
39428
39686
|
if (current === root2 || current === path84.dirname(current)) break;
|
|
39429
39687
|
current = path84.dirname(current);
|
|
39430
39688
|
}
|
|
@@ -39432,7 +39690,7 @@ function resolveRuleScope(target) {
|
|
|
39432
39690
|
}
|
|
39433
39691
|
|
|
39434
39692
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
39435
|
-
import { existsSync as
|
|
39693
|
+
import { existsSync as existsSync71, readFileSync as readFileSync55, writeFileSync as writeFileSync41 } from "fs";
|
|
39436
39694
|
import path86 from "path";
|
|
39437
39695
|
|
|
39438
39696
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
@@ -39482,7 +39740,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
39482
39740
|
function updateScopedRulesIndex(root2) {
|
|
39483
39741
|
const directories = scopedRuleDirectories(root2);
|
|
39484
39742
|
const rootFile = path86.join(root2, "CLAUDE.md");
|
|
39485
|
-
const before =
|
|
39743
|
+
const before = existsSync71(rootFile) ? readFileSync55(rootFile, "utf8") : "";
|
|
39486
39744
|
const after = upsertScopedRulesPointer(before, directories);
|
|
39487
39745
|
if (after !== before) writeFileSync41(rootFile, after);
|
|
39488
39746
|
return directories;
|
|
@@ -39490,7 +39748,7 @@ function updateScopedRulesIndex(root2) {
|
|
|
39490
39748
|
|
|
39491
39749
|
// src/commands/rules/addRule.ts
|
|
39492
39750
|
function read2(file) {
|
|
39493
|
-
return
|
|
39751
|
+
return existsSync72(file) ? readFileSync56(file, "utf8") : "";
|
|
39494
39752
|
}
|
|
39495
39753
|
function addRule(text17, options2) {
|
|
39496
39754
|
const rule = text17.trim();
|
|
@@ -39573,20 +39831,26 @@ function registerRules(program) {
|
|
|
39573
39831
|
).option("--full", "Show each rule's full description as well as its title").action(
|
|
39574
39832
|
(target, options2) => listRules(target, options2)
|
|
39575
39833
|
);
|
|
39576
|
-
|
|
39577
|
-
"
|
|
39578
|
-
|
|
39579
|
-
|
|
39580
|
-
|
|
39581
|
-
|
|
39582
|
-
|
|
39583
|
-
|
|
39584
|
-
|
|
39585
|
-
|
|
39834
|
+
internalCommand(
|
|
39835
|
+
rulesCommand.command("add <text>").description(
|
|
39836
|
+
"Add a rule to the `## Rules` section of the scope's CLAUDE.md, allocating the next repo-wide code and creating the section when absent"
|
|
39837
|
+
).option(
|
|
39838
|
+
"--title <title>",
|
|
39839
|
+
"As few words as possible summarising the rule, shown in the rule picker in place of the description"
|
|
39840
|
+
).option(
|
|
39841
|
+
"--scope <path>",
|
|
39842
|
+
"File or directory whose nearest CLAUDE.md receives the rule, or a CLAUDE.md path to write to directly (default: cwd)"
|
|
39843
|
+
).action(
|
|
39844
|
+
(text17, options2) => addRule(text17, options2)
|
|
39845
|
+
),
|
|
39846
|
+
"/add-rule and /fix-rules"
|
|
39847
|
+
);
|
|
39848
|
+
internalCommand(
|
|
39849
|
+
rulesCommand.command("index").description(
|
|
39850
|
+
"Record the directories that carry their own `## Rules` in the repo root's CLAUDE.md, so scoped rules are discoverable from the root. Always repo-wide, resolved from the cwd"
|
|
39851
|
+
).action(() => indexRules()),
|
|
39852
|
+
"/fix-rules"
|
|
39586
39853
|
);
|
|
39587
|
-
rulesCommand.command("index").description(
|
|
39588
|
-
"Record the directories that carry their own `## Rules` in the repo root's CLAUDE.md, so scoped rules are discoverable from the root. Always repo-wide, resolved from the cwd"
|
|
39589
|
-
).action(() => indexRules());
|
|
39590
39854
|
}
|
|
39591
39855
|
|
|
39592
39856
|
// src/commands/seq/seqAuth.ts
|
|
@@ -40077,12 +40341,12 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
40077
40341
|
}
|
|
40078
40342
|
|
|
40079
40343
|
// src/commands/slack/slackWorkingFile.ts
|
|
40080
|
-
import { join as
|
|
40344
|
+
import { join as join86 } from "path";
|
|
40081
40345
|
function slackWorkingFile(channel, partIndex) {
|
|
40082
40346
|
const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
|
|
40083
|
-
const dir =
|
|
40347
|
+
const dir = join86(getStoreDir(), "slack");
|
|
40084
40348
|
const name = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
|
|
40085
|
-
return { dir, bodyPath:
|
|
40349
|
+
return { dir, bodyPath: join86(dir, `${name}.md`) };
|
|
40086
40350
|
}
|
|
40087
40351
|
|
|
40088
40352
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
@@ -40902,7 +41166,7 @@ function registerSync(program) {
|
|
|
40902
41166
|
}
|
|
40903
41167
|
|
|
40904
41168
|
// src/commands/transcript/clean.ts
|
|
40905
|
-
import { existsSync as
|
|
41169
|
+
import { existsSync as existsSync77 } from "fs";
|
|
40906
41170
|
|
|
40907
41171
|
// src/commands/transcript/convert/formatTimestamp.ts
|
|
40908
41172
|
function pad(value, width2) {
|
|
@@ -41180,7 +41444,7 @@ function clean(file, options2 = {}) {
|
|
|
41180
41444
|
);
|
|
41181
41445
|
process.exit(1);
|
|
41182
41446
|
}
|
|
41183
|
-
if (!
|
|
41447
|
+
if (!existsSync77(file)) {
|
|
41184
41448
|
console.error(`Error: VTT file not found: ${file}`);
|
|
41185
41449
|
process.exit(1);
|
|
41186
41450
|
}
|
|
@@ -41263,21 +41527,21 @@ async function configure() {
|
|
|
41263
41527
|
}
|
|
41264
41528
|
|
|
41265
41529
|
// src/commands/transcript/list.ts
|
|
41266
|
-
import { existsSync as
|
|
41267
|
-
import { join as
|
|
41530
|
+
import { existsSync as existsSync78, readdirSync as readdirSync21, statSync as statSync12 } from "fs";
|
|
41531
|
+
import { join as join98 } from "path";
|
|
41268
41532
|
function list4() {
|
|
41269
41533
|
const { vttDir } = getTranscriptConfig();
|
|
41270
|
-
if (!
|
|
41271
|
-
for (const entry of
|
|
41534
|
+
if (!existsSync78(vttDir)) return;
|
|
41535
|
+
for (const entry of readdirSync21(vttDir)) {
|
|
41272
41536
|
if (!entry.endsWith(".vtt")) continue;
|
|
41273
|
-
if (statSync12(
|
|
41537
|
+
if (statSync12(join98(vttDir, entry)).isDirectory()) continue;
|
|
41274
41538
|
console.log(entry);
|
|
41275
41539
|
}
|
|
41276
41540
|
}
|
|
41277
41541
|
|
|
41278
41542
|
// src/commands/transcript/move.ts
|
|
41279
|
-
import { existsSync as
|
|
41280
|
-
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";
|
|
41281
41545
|
|
|
41282
41546
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
41283
41547
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -41287,9 +41551,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
41287
41551
|
// src/commands/transcript/move.ts
|
|
41288
41552
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
41289
41553
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
41290
|
-
const processedDir =
|
|
41554
|
+
const processedDir = join99(vttDir, "processed");
|
|
41291
41555
|
mkdirSync34(processedDir, { recursive: true });
|
|
41292
|
-
renameSync4(sourcePath,
|
|
41556
|
+
renameSync4(sourcePath, join99(processedDir, filename));
|
|
41293
41557
|
}
|
|
41294
41558
|
function move(file, options2) {
|
|
41295
41559
|
const { date, client } = options2;
|
|
@@ -41299,25 +41563,25 @@ function move(file, options2) {
|
|
|
41299
41563
|
}
|
|
41300
41564
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
41301
41565
|
const filename = basename27(file);
|
|
41302
|
-
const sourcePath =
|
|
41303
|
-
if (!
|
|
41566
|
+
const sourcePath = join99(vttDir, filename);
|
|
41567
|
+
if (!existsSync79(sourcePath)) {
|
|
41304
41568
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
41305
41569
|
process.exit(1);
|
|
41306
41570
|
}
|
|
41307
41571
|
const base = basename27(filename, ".vtt").replace(/ Transcription$/, "");
|
|
41308
41572
|
const outputName = `${date} ${base}.md`;
|
|
41309
|
-
const formattedDir =
|
|
41573
|
+
const formattedDir = join99(transcriptsDir, client);
|
|
41310
41574
|
mkdirSync34(formattedDir, { recursive: true });
|
|
41311
|
-
const formattedPath =
|
|
41575
|
+
const formattedPath = join99(formattedDir, outputName);
|
|
41312
41576
|
writeFileSync49(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
41313
41577
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
41314
|
-
const summaryPath =
|
|
41578
|
+
const summaryPath = join99(summaryDir, client, outputName);
|
|
41315
41579
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
41316
41580
|
console.log(`Summary target: ${summaryPath}`);
|
|
41317
41581
|
}
|
|
41318
41582
|
|
|
41319
41583
|
// src/commands/transcript/merge.ts
|
|
41320
|
-
import { existsSync as
|
|
41584
|
+
import { existsSync as existsSync80, writeFileSync as writeFileSync50 } from "fs";
|
|
41321
41585
|
import { basename as basename28 } from "path";
|
|
41322
41586
|
|
|
41323
41587
|
// src/commands/transcript/failTranscript.ts
|
|
@@ -41461,7 +41725,7 @@ function widenAudience(passages) {
|
|
|
41461
41725
|
|
|
41462
41726
|
// src/commands/transcript/merge.ts
|
|
41463
41727
|
function readSource3(file) {
|
|
41464
|
-
if (!
|
|
41728
|
+
if (!existsSync80(file)) failTranscript(`VTT file not found: ${file}`);
|
|
41465
41729
|
const cues = readCleanedCues(file);
|
|
41466
41730
|
if (cues.length === 0) failTranscript(`no cues found in: ${file}`);
|
|
41467
41731
|
return { path: file, name: basename28(file), cues };
|
|
@@ -41928,7 +42192,7 @@ function configKeys2() {
|
|
|
41928
42192
|
}
|
|
41929
42193
|
|
|
41930
42194
|
// src/commands/verify/forbiddenStrings.ts
|
|
41931
|
-
import { existsSync as
|
|
42195
|
+
import { existsSync as existsSync81, readFileSync as readFileSync63 } from "fs";
|
|
41932
42196
|
|
|
41933
42197
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
41934
42198
|
import { minimatch as minimatch10 } from "minimatch";
|
|
@@ -41969,7 +42233,7 @@ function forbiddenStrings() {
|
|
|
41969
42233
|
const cache7 = /* @__PURE__ */ new Map();
|
|
41970
42234
|
const readJson = (file) => {
|
|
41971
42235
|
if (cache7.has(file)) return cache7.get(file);
|
|
41972
|
-
if (!
|
|
42236
|
+
if (!existsSync81(file)) {
|
|
41973
42237
|
console.log(`Forbidden-strings file not found: ${file}`);
|
|
41974
42238
|
process.exit(1);
|
|
41975
42239
|
}
|
|
@@ -42001,13 +42265,13 @@ Total: ${violations.length} forbidden string(s).`);
|
|
|
42001
42265
|
}
|
|
42002
42266
|
|
|
42003
42267
|
// src/commands/verify/hardcodedColors.ts
|
|
42004
|
-
import { execFileSync as
|
|
42268
|
+
import { execFileSync as execFileSync29 } from "child_process";
|
|
42005
42269
|
import { minimatch as minimatch11 } from "minimatch";
|
|
42006
42270
|
var pattern = "0x[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,6}";
|
|
42007
42271
|
function hardcodedColors() {
|
|
42008
42272
|
const ignoreGlobs = loadConfig().hardcodedColors?.ignore ?? [];
|
|
42009
42273
|
try {
|
|
42010
|
-
const output =
|
|
42274
|
+
const output = execFileSync29("grep", ["-rEnH", "-f", "-", "src/"], {
|
|
42011
42275
|
encoding: "utf8",
|
|
42012
42276
|
input: `${pattern}
|
|
42013
42277
|
`
|
|
@@ -42119,10 +42383,10 @@ function checkSequential(migrations3, files) {
|
|
|
42119
42383
|
}
|
|
42120
42384
|
|
|
42121
42385
|
// src/commands/verify/migrations/listMigrationFiles.ts
|
|
42122
|
-
import { readdirSync as
|
|
42386
|
+
import { readdirSync as readdirSync22 } from "fs";
|
|
42123
42387
|
var MIGRATION_FILE2 = /^migration\d+[A-Za-z0-9]*\.ts$/;
|
|
42124
42388
|
function listMigrationFiles(dir) {
|
|
42125
|
-
return
|
|
42389
|
+
return readdirSync22(dir).filter((file) => MIGRATION_FILE2.test(file));
|
|
42126
42390
|
}
|
|
42127
42391
|
|
|
42128
42392
|
// src/commands/verify/migrations/readBaselineMigrations.ts
|
|
@@ -42657,7 +42921,7 @@ function resolveParams(params, cliArgs) {
|
|
|
42657
42921
|
}
|
|
42658
42922
|
|
|
42659
42923
|
// src/commands/run/resolveRunCwd.ts
|
|
42660
|
-
import { existsSync as
|
|
42924
|
+
import { existsSync as existsSync82 } from "fs";
|
|
42661
42925
|
import { resolve as resolve27 } from "path";
|
|
42662
42926
|
var MissingRunCwdError = class extends Error {
|
|
42663
42927
|
constructor(runName, cwd) {
|
|
@@ -42670,7 +42934,7 @@ var MissingRunCwdError = class extends Error {
|
|
|
42670
42934
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
42671
42935
|
if (!config.cwd) return void 0;
|
|
42672
42936
|
const cwd = resolve27(baseDir, config.cwd);
|
|
42673
|
-
if (!
|
|
42937
|
+
if (!existsSync82(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
42674
42938
|
return cwd;
|
|
42675
42939
|
}
|
|
42676
42940
|
|
|
@@ -42790,10 +43054,10 @@ ${buildWatchReport(from)}`);
|
|
|
42790
43054
|
}
|
|
42791
43055
|
|
|
42792
43056
|
// src/commands/watch/consumeMarker.ts
|
|
42793
|
-
import { existsSync as
|
|
43057
|
+
import { existsSync as existsSync83, rmSync as rmSync10 } from "fs";
|
|
42794
43058
|
function consumeMarker(path108) {
|
|
42795
43059
|
try {
|
|
42796
|
-
if (!
|
|
43060
|
+
if (!existsSync83(path108)) return false;
|
|
42797
43061
|
rmSync10(path108);
|
|
42798
43062
|
return true;
|
|
42799
43063
|
} catch {
|
|
@@ -43226,18 +43490,18 @@ async function auth() {
|
|
|
43226
43490
|
}
|
|
43227
43491
|
|
|
43228
43492
|
// src/commands/roam/postRoamActivity.ts
|
|
43229
|
-
import { execFileSync as
|
|
43230
|
-
import { readdirSync as
|
|
43231
|
-
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";
|
|
43232
43496
|
function findPortFile(roamDir) {
|
|
43233
43497
|
let entries;
|
|
43234
43498
|
try {
|
|
43235
|
-
entries =
|
|
43499
|
+
entries = readdirSync23(roamDir);
|
|
43236
43500
|
} catch {
|
|
43237
43501
|
return void 0;
|
|
43238
43502
|
}
|
|
43239
43503
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
43240
|
-
const path108 =
|
|
43504
|
+
const path108 = join100(roamDir, name);
|
|
43241
43505
|
try {
|
|
43242
43506
|
return { path: path108, mtimeMs: statSync13(path108).mtimeMs };
|
|
43243
43507
|
} catch {
|
|
@@ -43254,7 +43518,7 @@ var PID_BY_APP = {
|
|
|
43254
43518
|
function postRoamActivity(app, event) {
|
|
43255
43519
|
const appData = process.env.APPDATA;
|
|
43256
43520
|
if (!appData) return;
|
|
43257
|
-
const portFile = findPortFile(
|
|
43521
|
+
const portFile = findPortFile(join100(appData, "Roam"));
|
|
43258
43522
|
if (!portFile) return;
|
|
43259
43523
|
let port;
|
|
43260
43524
|
try {
|
|
@@ -43265,7 +43529,7 @@ function postRoamActivity(app, event) {
|
|
|
43265
43529
|
const pid = PID_BY_APP[app] ?? 99999;
|
|
43266
43530
|
const url = `http://127.0.0.1:${port}/api/v1/activity/${app}/${event}?pid=${pid}`;
|
|
43267
43531
|
try {
|
|
43268
|
-
|
|
43532
|
+
execFileSync30("curl", ["-sf", "--max-time", "0.2", "-X", "POST", url], {
|
|
43269
43533
|
stdio: "ignore"
|
|
43270
43534
|
});
|
|
43271
43535
|
} catch {
|
|
@@ -43440,7 +43704,7 @@ function link2() {
|
|
|
43440
43704
|
|
|
43441
43705
|
// src/commands/run/add.ts
|
|
43442
43706
|
import { mkdirSync as mkdirSync35, writeFileSync as writeFileSync52 } from "fs";
|
|
43443
|
-
import { join as
|
|
43707
|
+
import { join as join101 } from "path";
|
|
43444
43708
|
|
|
43445
43709
|
// src/commands/run/editRepoRunList.ts
|
|
43446
43710
|
async function editRepoRunList(repoName, cwd, edit2) {
|
|
@@ -43611,7 +43875,7 @@ function saveProjectRunConfig(entry) {
|
|
|
43611
43875
|
saveConfig(config);
|
|
43612
43876
|
}
|
|
43613
43877
|
function createCommandFile(name) {
|
|
43614
|
-
const dir =
|
|
43878
|
+
const dir = join101(".claude", "commands");
|
|
43615
43879
|
mkdirSync35(dir, { recursive: true });
|
|
43616
43880
|
const content = `---
|
|
43617
43881
|
description: Run ${name}
|
|
@@ -43619,7 +43883,7 @@ description: Run ${name}
|
|
|
43619
43883
|
|
|
43620
43884
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
43621
43885
|
`;
|
|
43622
|
-
const filePath =
|
|
43886
|
+
const filePath = join101(dir, `${name}.md`);
|
|
43623
43887
|
writeFileSync52(filePath, content);
|
|
43624
43888
|
console.log(`Created command file: ${filePath}`);
|
|
43625
43889
|
}
|
|
@@ -43724,8 +43988,8 @@ function registerRunAdd(runCommand) {
|
|
|
43724
43988
|
}
|
|
43725
43989
|
|
|
43726
43990
|
// src/commands/run/remove.ts
|
|
43727
|
-
import { existsSync as
|
|
43728
|
-
import { join as
|
|
43991
|
+
import { existsSync as existsSync84, unlinkSync as unlinkSync19 } from "fs";
|
|
43992
|
+
import { join as join102 } from "path";
|
|
43729
43993
|
|
|
43730
43994
|
// src/commands/run/removeRepoRunConfig.ts
|
|
43731
43995
|
function isNamed(entry, name) {
|
|
@@ -43743,8 +44007,8 @@ function removeRepoRunConfig(name, repoName, cwd = process.cwd()) {
|
|
|
43743
44007
|
|
|
43744
44008
|
// src/commands/run/remove.ts
|
|
43745
44009
|
function deleteCommandFile(name) {
|
|
43746
|
-
const filePath =
|
|
43747
|
-
if (
|
|
44010
|
+
const filePath = join102(".claude", "commands", `${name}.md`);
|
|
44011
|
+
if (existsSync84(filePath)) {
|
|
43748
44012
|
unlinkSync19(filePath);
|
|
43749
44013
|
console.log(`Deleted command file: ${filePath}`);
|
|
43750
44014
|
}
|
|
@@ -43813,11 +44077,11 @@ function formatLink(link3) {
|
|
|
43813
44077
|
}
|
|
43814
44078
|
|
|
43815
44079
|
// src/commands/sessions/daemon/listDaemonPids.ts
|
|
43816
|
-
import { execFileSync as
|
|
44080
|
+
import { execFileSync as execFileSync31 } from "child_process";
|
|
43817
44081
|
function listDaemonPids() {
|
|
43818
44082
|
if (process.platform === "win32") return [];
|
|
43819
44083
|
try {
|
|
43820
|
-
const out =
|
|
44084
|
+
const out = execFileSync31("ps", ["-eo", "pid=,args="], {
|
|
43821
44085
|
encoding: "utf8"
|
|
43822
44086
|
});
|
|
43823
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));
|
|
@@ -44192,12 +44456,12 @@ function toSessionRunInfo({
|
|
|
44192
44456
|
}
|
|
44193
44457
|
|
|
44194
44458
|
// src/commands/sessions/daemon/worktree/joinRefusal.ts
|
|
44195
|
-
import { existsSync as
|
|
44459
|
+
import { existsSync as existsSync85 } from "fs";
|
|
44196
44460
|
function joinRefusal(session) {
|
|
44197
44461
|
if (session.commandType === "run") return "a server run has no agent stream";
|
|
44198
44462
|
if (session.closing === true) return "the session is closing";
|
|
44199
44463
|
if (!session.cwd) return "the session has no working directory";
|
|
44200
|
-
if (!
|
|
44464
|
+
if (!existsSync85(session.cwd))
|
|
44201
44465
|
return "the session's workspace no longer exists";
|
|
44202
44466
|
return void 0;
|
|
44203
44467
|
}
|
|
@@ -44278,8 +44542,8 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
|
|
|
44278
44542
|
}
|
|
44279
44543
|
|
|
44280
44544
|
// src/commands/sessions/daemon/findServerParents.ts
|
|
44281
|
-
import { existsSync as
|
|
44282
|
-
import { join as
|
|
44545
|
+
import { existsSync as existsSync86 } from "fs";
|
|
44546
|
+
import { join as join103, resolve as resolve29 } from "path";
|
|
44283
44547
|
function isLive(session) {
|
|
44284
44548
|
return !!session.pty && session.status !== "done" && session.status !== "error";
|
|
44285
44549
|
}
|
|
@@ -44288,7 +44552,7 @@ function isLiveAgent(session) {
|
|
|
44288
44552
|
}
|
|
44289
44553
|
function serverRunDirs(sessions, file) {
|
|
44290
44554
|
return new Set(
|
|
44291
|
-
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)))
|
|
44292
44556
|
);
|
|
44293
44557
|
}
|
|
44294
44558
|
function findServerParents(sessions, file) {
|
|
@@ -44904,11 +45168,11 @@ function sessionBase(id, status2) {
|
|
|
44904
45168
|
}
|
|
44905
45169
|
|
|
44906
45170
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
44907
|
-
import { existsSync as
|
|
45171
|
+
import { existsSync as existsSync89 } from "fs";
|
|
44908
45172
|
import * as pty from "node-pty";
|
|
44909
45173
|
|
|
44910
45174
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
44911
|
-
import { chmodSync, existsSync as
|
|
45175
|
+
import { chmodSync, existsSync as existsSync88, statSync as statSync14 } from "fs";
|
|
44912
45176
|
import { createRequire as createRequire3 } from "module";
|
|
44913
45177
|
import path105 from "path";
|
|
44914
45178
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -44923,7 +45187,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
44923
45187
|
`${process.platform}-${process.arch}`,
|
|
44924
45188
|
"spawn-helper"
|
|
44925
45189
|
);
|
|
44926
|
-
if (!
|
|
45190
|
+
if (!existsSync88(helper)) return;
|
|
44927
45191
|
const mode = statSync14(helper).mode;
|
|
44928
45192
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
44929
45193
|
}
|
|
@@ -44979,7 +45243,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
|
|
|
44979
45243
|
});
|
|
44980
45244
|
}
|
|
44981
45245
|
function refuseMissingCwd(cwd, sessionId) {
|
|
44982
|
-
if (!cwd ||
|
|
45246
|
+
if (!cwd || existsSync89(cwd)) return;
|
|
44983
45247
|
daemonLog(
|
|
44984
45248
|
`${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
|
|
44985
45249
|
);
|
|
@@ -45149,7 +45413,7 @@ function createRunSession(id, { runName, runArgs, cwd, meta }) {
|
|
|
45149
45413
|
}
|
|
45150
45414
|
|
|
45151
45415
|
// src/commands/sessions/daemon/autoUpdate/autoUpdateControl.ts
|
|
45152
|
-
import { existsSync as
|
|
45416
|
+
import { existsSync as existsSync90, rmSync as rmSync11, writeFileSync as writeFileSync54 } from "fs";
|
|
45153
45417
|
var paused;
|
|
45154
45418
|
var wake;
|
|
45155
45419
|
function persist2(value) {
|
|
@@ -45161,7 +45425,7 @@ function persist2(value) {
|
|
|
45161
45425
|
}
|
|
45162
45426
|
var autoUpdateControl = {
|
|
45163
45427
|
paused: () => {
|
|
45164
|
-
paused ??=
|
|
45428
|
+
paused ??= existsSync90(daemonPaths.autoUpdatePaused);
|
|
45165
45429
|
return paused;
|
|
45166
45430
|
},
|
|
45167
45431
|
setPaused: (value) => {
|
|
@@ -45358,7 +45622,7 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
45358
45622
|
}
|
|
45359
45623
|
|
|
45360
45624
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
45361
|
-
import { existsSync as
|
|
45625
|
+
import { existsSync as existsSync91 } from "fs";
|
|
45362
45626
|
var treeIsGone = { durable: true, gone: true };
|
|
45363
45627
|
function treeDurability(state) {
|
|
45364
45628
|
if (state.dirty) return { durable: false, reason: "uncommitted changes" };
|
|
@@ -45389,14 +45653,14 @@ function* durabilityProbes() {
|
|
|
45389
45653
|
});
|
|
45390
45654
|
}
|
|
45391
45655
|
async function checkDurability(cwd) {
|
|
45392
|
-
if (!
|
|
45656
|
+
if (!existsSync91(cwd)) return treeIsGone;
|
|
45393
45657
|
const probes = durabilityProbes();
|
|
45394
45658
|
let step3 = probes.next();
|
|
45395
45659
|
while (!step3.done) step3 = probes.next(await gitResult(cwd, step3.value));
|
|
45396
45660
|
return step3.value;
|
|
45397
45661
|
}
|
|
45398
45662
|
function checkDurabilitySync(cwd) {
|
|
45399
|
-
if (!
|
|
45663
|
+
if (!existsSync91(cwd)) return treeIsGone;
|
|
45400
45664
|
const probes = durabilityProbes();
|
|
45401
45665
|
let step3 = probes.next();
|
|
45402
45666
|
while (!step3.done) step3 = probes.next(gitSyncResult(cwd, step3.value));
|
|
@@ -45650,17 +45914,17 @@ function setStatus2(session, newStatus) {
|
|
|
45650
45914
|
}
|
|
45651
45915
|
|
|
45652
45916
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
45653
|
-
import { existsSync as
|
|
45917
|
+
import { existsSync as existsSync93 } from "fs";
|
|
45654
45918
|
import { basename as basename30 } from "path";
|
|
45655
45919
|
|
|
45656
45920
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
45657
|
-
import { existsSync as
|
|
45658
|
-
import { join as
|
|
45921
|
+
import { existsSync as existsSync92 } from "fs";
|
|
45922
|
+
import { join as join107 } from "path";
|
|
45659
45923
|
|
|
45660
45924
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
45661
45925
|
import { statSync as statSync15 } from "fs";
|
|
45662
45926
|
import { rm as rm3 } from "fs/promises";
|
|
45663
|
-
import { join as
|
|
45927
|
+
import { join as join106 } from "path";
|
|
45664
45928
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
45665
45929
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
45666
45930
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -45688,7 +45952,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
45688
45952
|
return { removed: true };
|
|
45689
45953
|
}
|
|
45690
45954
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
45691
|
-
return statSync15(
|
|
45955
|
+
return statSync15(join106(worktreePath, ".git"), {
|
|
45692
45956
|
throwIfNoEntry: false
|
|
45693
45957
|
})?.isDirectory() === true;
|
|
45694
45958
|
}
|
|
@@ -45724,7 +45988,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
45724
45988
|
);
|
|
45725
45989
|
}
|
|
45726
45990
|
function strandedReason(worktreePath, cause) {
|
|
45727
|
-
if (!
|
|
45991
|
+
if (!existsSync92(join107(worktreePath, ".git")))
|
|
45728
45992
|
return "its .git link is already gone";
|
|
45729
45993
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
45730
45994
|
return "git no longer recognises it as a working tree";
|
|
@@ -45776,7 +46040,7 @@ function reason3(error) {
|
|
|
45776
46040
|
|
|
45777
46041
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
45778
46042
|
async function reapWorktree(worktreePath, force = false) {
|
|
45779
|
-
if (!
|
|
46043
|
+
if (!existsSync93(worktreePath)) {
|
|
45780
46044
|
forgetWorktree(worktreePath);
|
|
45781
46045
|
daemonLog(
|
|
45782
46046
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -45801,7 +46065,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
45801
46065
|
}
|
|
45802
46066
|
function owningClone(worktreePath) {
|
|
45803
46067
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
45804
|
-
if (recorded &&
|
|
46068
|
+
if (recorded && existsSync93(recorded)) return recorded;
|
|
45805
46069
|
const detected = mainWorktree(worktreePath);
|
|
45806
46070
|
if (detected) return detected;
|
|
45807
46071
|
daemonLog(
|
|
@@ -45949,12 +46213,12 @@ function closeGateApplies(sessions, session) {
|
|
|
45949
46213
|
}
|
|
45950
46214
|
|
|
45951
46215
|
// src/commands/sessions/daemon/worktree/liveProcessesInTree.ts
|
|
45952
|
-
import { readdirSync as
|
|
46216
|
+
import { readdirSync as readdirSync25, readlinkSync } from "fs";
|
|
45953
46217
|
import { sep as sep4 } from "path";
|
|
45954
46218
|
function liveProcessesInTree(treePath, procRoot = "/proc") {
|
|
45955
46219
|
let entries;
|
|
45956
46220
|
try {
|
|
45957
|
-
entries =
|
|
46221
|
+
entries = readdirSync25(procRoot);
|
|
45958
46222
|
} catch {
|
|
45959
46223
|
return [];
|
|
45960
46224
|
}
|
|
@@ -46021,12 +46285,12 @@ async function closeBlockReason(sessionId, tree) {
|
|
|
46021
46285
|
}
|
|
46022
46286
|
|
|
46023
46287
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
46024
|
-
import { existsSync as
|
|
46288
|
+
import { existsSync as existsSync94, watch } from "fs";
|
|
46025
46289
|
var DEBOUNCE_MS = 500;
|
|
46026
46290
|
var POLL_MS3 = 3e4;
|
|
46027
46291
|
function watchGitState(cwd, onChange) {
|
|
46028
46292
|
const common = gitCommonDir(cwd);
|
|
46029
|
-
if (!common || !
|
|
46293
|
+
if (!common || !existsSync94(common)) return void 0;
|
|
46030
46294
|
const watchers = [
|
|
46031
46295
|
watchGitDir(common, onChange),
|
|
46032
46296
|
pollGitState(cwd, onChange)
|
|
@@ -46707,10 +46971,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
46707
46971
|
}
|
|
46708
46972
|
|
|
46709
46973
|
// src/commands/sessions/daemon/exitReason.ts
|
|
46710
|
-
import { existsSync as
|
|
46974
|
+
import { existsSync as existsSync95 } from "fs";
|
|
46711
46975
|
import { resolve as resolve30 } from "path";
|
|
46712
46976
|
function exitDetail(session) {
|
|
46713
|
-
if (session.cwd && !
|
|
46977
|
+
if (session.cwd && !existsSync95(session.cwd))
|
|
46714
46978
|
return `working directory ${session.cwd} no longer exists`;
|
|
46715
46979
|
return missingRunConfigCwd(session);
|
|
46716
46980
|
}
|
|
@@ -46724,7 +46988,7 @@ function missingRunConfigCwd(session) {
|
|
|
46724
46988
|
const config = resolveRunConfig(session.runName, dir);
|
|
46725
46989
|
if (!config?.cwd) return void 0;
|
|
46726
46990
|
const configured = resolve30(runConfigBaseDirFrom(dir), config.cwd);
|
|
46727
|
-
if (
|
|
46991
|
+
if (existsSync95(configured)) return void 0;
|
|
46728
46992
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
46729
46993
|
}
|
|
46730
46994
|
|
|
@@ -46772,7 +47036,7 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
|
|
|
46772
47036
|
}
|
|
46773
47037
|
|
|
46774
47038
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
46775
|
-
import { existsSync as
|
|
47039
|
+
import { existsSync as existsSync96, mkdirSync as mkdirSync37, watch as watch2 } from "fs";
|
|
46776
47040
|
import { dirname as dirname45 } from "path";
|
|
46777
47041
|
|
|
46778
47042
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
@@ -46858,7 +47122,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
46858
47122
|
if (timer) clearTimeout(timer);
|
|
46859
47123
|
timer = setTimeout(read3, DEBOUNCE_MS2);
|
|
46860
47124
|
});
|
|
46861
|
-
if (
|
|
47125
|
+
if (existsSync96(path108)) read3();
|
|
46862
47126
|
}
|
|
46863
47127
|
function refreshActivity(session) {
|
|
46864
47128
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -48098,7 +48362,7 @@ function releaseClient(client, clients, prPreview, verify) {
|
|
|
48098
48362
|
}
|
|
48099
48363
|
|
|
48100
48364
|
// src/commands/sessions/daemon/findPortHolderPid.ts
|
|
48101
|
-
import { execFileSync as
|
|
48365
|
+
import { execFileSync as execFileSync32 } from "child_process";
|
|
48102
48366
|
var PROBE_TIMEOUT_MS = 3e3;
|
|
48103
48367
|
function findPortHolderPid(port) {
|
|
48104
48368
|
try {
|
|
@@ -48108,7 +48372,7 @@ function findPortHolderPid(port) {
|
|
|
48108
48372
|
}
|
|
48109
48373
|
}
|
|
48110
48374
|
function probe(command, args) {
|
|
48111
|
-
return
|
|
48375
|
+
return execFileSync32(command, args, {
|
|
48112
48376
|
encoding: "utf8",
|
|
48113
48377
|
timeout: PROBE_TIMEOUT_MS,
|
|
48114
48378
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -48853,7 +49117,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
48853
49117
|
}
|
|
48854
49118
|
|
|
48855
49119
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
48856
|
-
import { existsSync as
|
|
49120
|
+
import { existsSync as existsSync98 } from "fs";
|
|
48857
49121
|
import { basename as basename32 } from "path";
|
|
48858
49122
|
|
|
48859
49123
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -48874,9 +49138,9 @@ function accountedTrees(sessions) {
|
|
|
48874
49138
|
}
|
|
48875
49139
|
|
|
48876
49140
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
48877
|
-
import { existsSync as
|
|
49141
|
+
import { existsSync as existsSync97 } from "fs";
|
|
48878
49142
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
48879
|
-
if (!
|
|
49143
|
+
if (!existsSync97(clone)) {
|
|
48880
49144
|
for (const { path: path108 } of paths) forgetWorktree(path108);
|
|
48881
49145
|
daemonLog(
|
|
48882
49146
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
@@ -49042,7 +49306,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
49042
49306
|
);
|
|
49043
49307
|
continue;
|
|
49044
49308
|
}
|
|
49045
|
-
if (!
|
|
49309
|
+
if (!existsSync98(path108)) {
|
|
49046
49310
|
logVanishedTree(sessions, path108);
|
|
49047
49311
|
vanished.set(clone, [
|
|
49048
49312
|
...vanished.get(clone) ?? [],
|
|
@@ -50079,7 +50343,7 @@ function spawnAssistInTree(ctx, assistArgs, cwd, meta, context) {
|
|
|
50079
50343
|
}
|
|
50080
50344
|
|
|
50081
50345
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
50082
|
-
import { existsSync as
|
|
50346
|
+
import { existsSync as existsSync101 } from "fs";
|
|
50083
50347
|
|
|
50084
50348
|
// src/commands/sessions/daemon/resumeSession.ts
|
|
50085
50349
|
function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
@@ -50110,11 +50374,11 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
|
50110
50374
|
}
|
|
50111
50375
|
|
|
50112
50376
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
50113
|
-
import { existsSync as
|
|
50377
|
+
import { existsSync as existsSync100 } from "fs";
|
|
50114
50378
|
|
|
50115
50379
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
50116
|
-
import { copyFileSync as copyFileSync4, existsSync as
|
|
50117
|
-
import { join as
|
|
50380
|
+
import { copyFileSync as copyFileSync4, existsSync as existsSync99, mkdirSync as mkdirSync39 } from "fs";
|
|
50381
|
+
import { join as join108 } from "path";
|
|
50118
50382
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
50119
50383
|
const dir = projectDirForCwd(toCwd);
|
|
50120
50384
|
if (dir === projectDirForCwd(fromCwd)) {
|
|
@@ -50123,8 +50387,8 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
50123
50387
|
);
|
|
50124
50388
|
return;
|
|
50125
50389
|
}
|
|
50126
|
-
const dest =
|
|
50127
|
-
if (
|
|
50390
|
+
const dest = join108(dir, `${claudeSessionId}.jsonl`);
|
|
50391
|
+
if (existsSync99(dest)) {
|
|
50128
50392
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
50129
50393
|
return;
|
|
50130
50394
|
}
|
|
@@ -50175,7 +50439,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
|
|
|
50175
50439
|
}
|
|
50176
50440
|
function cloneForReapedTree(missingCwd) {
|
|
50177
50441
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
50178
|
-
if (!clone || !
|
|
50442
|
+
if (!clone || !existsSync100(clone))
|
|
50179
50443
|
throw new Error(
|
|
50180
50444
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
50181
50445
|
);
|
|
@@ -50184,7 +50448,7 @@ function cloneForReapedTree(missingCwd) {
|
|
|
50184
50448
|
|
|
50185
50449
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
50186
50450
|
function resumeInTree(ctx, sessionId, cwd, name, harness) {
|
|
50187
|
-
if (!
|
|
50451
|
+
if (!existsSync101(cwd))
|
|
50188
50452
|
return resumeInReplacementTree(ctx, sessionId, cwd, name, harness);
|
|
50189
50453
|
const id = ctx.spawnWith(
|
|
50190
50454
|
(sid) => resumeSession(sid, sessionId, cwd, name, void 0, harness)
|
|
@@ -51182,25 +51446,26 @@ function isPrCheckoutArgs(args) {
|
|
|
51182
51446
|
|
|
51183
51447
|
// src/commands/sessions/daemon/worktree/prCheckoutHolder.ts
|
|
51184
51448
|
import { execFile as execFile14 } from "child_process";
|
|
51185
|
-
import { existsSync as
|
|
51449
|
+
import { existsSync as existsSync102 } from "fs";
|
|
51186
51450
|
function prHeadBranch2(number, cwd) {
|
|
51451
|
+
const { headBranch } = prCliCommands(number, cwd);
|
|
51187
51452
|
return new Promise((resolve31) => {
|
|
51188
51453
|
execFile14(
|
|
51189
|
-
|
|
51190
|
-
|
|
51454
|
+
headBranch.file,
|
|
51455
|
+
headBranch.args,
|
|
51191
51456
|
{ cwd, encoding: "utf8", windowsHide: true },
|
|
51192
|
-
(error, stdout) => resolve31(error ? null :
|
|
51457
|
+
(error, stdout) => resolve31(error ? null : headBranch.parse(stdout))
|
|
51193
51458
|
);
|
|
51194
51459
|
});
|
|
51195
51460
|
}
|
|
51196
51461
|
async function prCheckoutHolder(assistArgs, cwd) {
|
|
51197
51462
|
const number = prCheckoutNumber(assistArgs);
|
|
51198
|
-
if (!number || !cwd || !
|
|
51463
|
+
if (!number || !cwd || !existsSync102(cwd)) return void 0;
|
|
51199
51464
|
const headRef = await prHeadBranch2(number, cwd);
|
|
51200
51465
|
if (!headRef) return void 0;
|
|
51201
51466
|
const listing = await gitOrNull(cwd, ["worktree", "list", "--porcelain"]);
|
|
51202
51467
|
const holder = listing ? worktreeWithBranch(listing, headRef) : null;
|
|
51203
|
-
if (!holder || !
|
|
51468
|
+
if (!holder || !existsSync102(holder)) return void 0;
|
|
51204
51469
|
daemonLog(
|
|
51205
51470
|
`pr #${number} assist ${assistArgs[0]} launched in its checkout ${holder}: head branch ${headRef} is already checked out there, so no worktree is allocated`
|
|
51206
51471
|
);
|
|
@@ -51655,20 +51920,20 @@ async function nodeLogs(name, options2) {
|
|
|
51655
51920
|
}
|
|
51656
51921
|
|
|
51657
51922
|
// src/commands/sessions/nodes/registerDiagnoseCommands.ts
|
|
51658
|
-
function registerDiagnoseCommands(nodes,
|
|
51923
|
+
function registerDiagnoseCommands(nodes, calledBy3) {
|
|
51659
51924
|
internalCommand(
|
|
51660
51925
|
nodes.command("doctor [name]").description(
|
|
51661
51926
|
"Probe each hop of every link (or one) in order and stop at the first failure with a remediation"
|
|
51662
51927
|
).option("--json", "Output as JSON").action(
|
|
51663
51928
|
(name, _options, command) => doctorNodes(name, command.optsWithGlobals())
|
|
51664
51929
|
),
|
|
51665
|
-
|
|
51930
|
+
calledBy3
|
|
51666
51931
|
);
|
|
51667
51932
|
internalCommand(
|
|
51668
51933
|
nodes.command("logs <name>").description("Tail a linked node's daemon.log through its web server").option("-n, --lines <lines>", "Number of lines", "200").option("--json", "Output as JSON").action(
|
|
51669
51934
|
(name, _options, command) => nodeLogs(name, command.optsWithGlobals())
|
|
51670
51935
|
),
|
|
51671
|
-
|
|
51936
|
+
calledBy3
|
|
51672
51937
|
);
|
|
51673
51938
|
}
|
|
51674
51939
|
|
|
@@ -51946,18 +52211,18 @@ async function updateNode(name) {
|
|
|
51946
52211
|
}
|
|
51947
52212
|
|
|
51948
52213
|
// src/commands/sessions/nodes/registerPeerActionCommands.ts
|
|
51949
|
-
function registerPeerActionCommands(nodes,
|
|
52214
|
+
function registerPeerActionCommands(nodes, calledBy3) {
|
|
51950
52215
|
internalCommand(
|
|
51951
52216
|
nodes.command("restart <name>").description(
|
|
51952
52217
|
"Restart a linked node's daemon and/or web server, wait for its link to reconnect and print its version"
|
|
51953
52218
|
).option("--target <target>", "daemon, webserver or both", "both").action(restartNode),
|
|
51954
|
-
|
|
52219
|
+
calledBy3
|
|
51955
52220
|
);
|
|
51956
52221
|
internalCommand(
|
|
51957
52222
|
nodes.command("update <name>").description(
|
|
51958
52223
|
"Run assist update on a linked node, restart it, wait for its link to reconnect and print its version"
|
|
51959
52224
|
).action((name) => updateNode(name)),
|
|
51960
|
-
|
|
52225
|
+
calledBy3
|
|
51961
52226
|
);
|
|
51962
52227
|
}
|
|
51963
52228
|
|
|
@@ -51976,19 +52241,19 @@ async function unlinkNode(name) {
|
|
|
51976
52241
|
}
|
|
51977
52242
|
|
|
51978
52243
|
// src/commands/sessions/nodes/registerNodes.ts
|
|
51979
|
-
var
|
|
52244
|
+
var calledBy2 = "agents managing linked nodes";
|
|
51980
52245
|
function registerNodes(sessions) {
|
|
51981
52246
|
const cmd = internalCommand(
|
|
51982
52247
|
sessions.command("nodes").description("List this node and every linked node with its link state").option("--json", "Output as JSON").action(listNodes),
|
|
51983
|
-
|
|
52248
|
+
calledBy2
|
|
51984
52249
|
);
|
|
51985
|
-
internalCommand(registerLinkCommand(cmd),
|
|
52250
|
+
internalCommand(registerLinkCommand(cmd), calledBy2);
|
|
51986
52251
|
internalCommand(
|
|
51987
52252
|
cmd.command("unlink <name>").description("Remove a linked node").action(unlinkNode),
|
|
51988
|
-
|
|
52253
|
+
calledBy2
|
|
51989
52254
|
);
|
|
51990
|
-
registerDiagnoseCommands(cmd,
|
|
51991
|
-
registerPeerActionCommands(cmd,
|
|
52255
|
+
registerDiagnoseCommands(cmd, calledBy2);
|
|
52256
|
+
registerPeerActionCommands(cmd, calledBy2);
|
|
51992
52257
|
configHelp(cmd, nodesConfigHelp);
|
|
51993
52258
|
}
|
|
51994
52259
|
|