@staff0rd/assist 0.942.0 → 0.944.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/dist/commands/extension/extension/background.js +1 -1
- package/dist/commands/extension/extension/content.js +34 -34
- package/dist/commands/extension/extension/docs.js +18 -18
- package/dist/commands/extension/extension/manifest.json +3 -1
- package/dist/commands/sessions/web/bundle.js +396 -396
- package/dist/index.js +132 -73
- 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.944.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -5317,6 +5317,26 @@ async function fileContent(req, res) {
|
|
|
5317
5317
|
}
|
|
5318
5318
|
}
|
|
5319
5319
|
|
|
5320
|
+
// src/commands/sessions/web/fromGithub/getClones.ts
|
|
5321
|
+
import { basename as basename6 } from "path";
|
|
5322
|
+
|
|
5323
|
+
// src/commands/sessions/web/fromGithub/listClones.ts
|
|
5324
|
+
import { existsSync as existsSync14, readdirSync as readdirSync2 } from "fs";
|
|
5325
|
+
import { join as join18 } from "path";
|
|
5326
|
+
function listClones(baseDir) {
|
|
5327
|
+
if (!existsSync14(baseDir)) return [];
|
|
5328
|
+
return readdirSync2(baseDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join18(baseDir, entry.name)).filter((dir) => existsSync14(join18(dir, ".git"))).sort();
|
|
5329
|
+
}
|
|
5330
|
+
|
|
5331
|
+
// src/commands/sessions/web/fromGithub/getClones.ts
|
|
5332
|
+
function getClones(req, res) {
|
|
5333
|
+
allowExtensionOrigin(req, res);
|
|
5334
|
+
const baseDir = expandTilde(loadConfig().clone.baseDir);
|
|
5335
|
+
respondJson(res, 200, {
|
|
5336
|
+
clones: listClones(baseDir).map((dir) => basename6(dir))
|
|
5337
|
+
});
|
|
5338
|
+
}
|
|
5339
|
+
|
|
5320
5340
|
// src/commands/sessions/daemon/readSocketLines.ts
|
|
5321
5341
|
function readSocketLines(socket, onLine) {
|
|
5322
5342
|
let buffer = "";
|
|
@@ -5492,8 +5512,8 @@ function azureDevopsRepoUrl({ org, project, repo }) {
|
|
|
5492
5512
|
}
|
|
5493
5513
|
|
|
5494
5514
|
// src/commands/sessions/web/fromGithub/findAzureDevopsClone.ts
|
|
5495
|
-
import { existsSync as
|
|
5496
|
-
import { join as
|
|
5515
|
+
import { existsSync as existsSync15, readdirSync as readdirSync3 } from "fs";
|
|
5516
|
+
import { join as join19 } from "path";
|
|
5497
5517
|
|
|
5498
5518
|
// src/shared/azureDevops/parseAzureDevopsRemote.ts
|
|
5499
5519
|
var HTTPS_DEV = /^https?:\/\/(?:[^@/]+@)?dev\.azure\.com\/([^/]+)\/([^/]+)\/_git\/([^/]+)$/i;
|
|
@@ -5514,15 +5534,15 @@ function sameAzureDevopsRepo(a, b) {
|
|
|
5514
5534
|
|
|
5515
5535
|
// src/commands/sessions/web/fromGithub/findAzureDevopsClone.ts
|
|
5516
5536
|
function clonesRepo(dir, repo) {
|
|
5517
|
-
if (!
|
|
5537
|
+
if (!existsSync15(join19(dir, ".git"))) return false;
|
|
5518
5538
|
const url = remoteUrl(dir).url;
|
|
5519
5539
|
const remote = url ? parseAzureDevopsRemote(url) : null;
|
|
5520
5540
|
return remote !== null && sameAzureDevopsRepo(remote, repo);
|
|
5521
5541
|
}
|
|
5522
5542
|
function findAzureDevopsClone(repo, baseDir) {
|
|
5523
|
-
if (!
|
|
5524
|
-
const named =
|
|
5525
|
-
const others =
|
|
5543
|
+
if (!existsSync15(baseDir)) return void 0;
|
|
5544
|
+
const named = join19(baseDir, repo.repo);
|
|
5545
|
+
const others = readdirSync3(baseDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join19(baseDir, entry.name)).filter((dir) => dir !== named).sort();
|
|
5526
5546
|
return [named, ...others].find((dir) => clonesRepo(dir, repo));
|
|
5527
5547
|
}
|
|
5528
5548
|
|
|
@@ -5598,11 +5618,8 @@ function isAllowedPrArgs(args) {
|
|
|
5598
5618
|
}
|
|
5599
5619
|
|
|
5600
5620
|
// src/commands/sessions/web/fromGithub/findCloneByOrigin.ts
|
|
5601
|
-
import { existsSync as existsSync15, readdirSync as readdirSync3 } from "fs";
|
|
5602
|
-
import { join as join19 } from "path";
|
|
5603
5621
|
function findCloneByOrigin(origin, baseDir) {
|
|
5604
|
-
|
|
5605
|
-
return readdirSync3(baseDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join19(baseDir, entry.name)).filter((dir) => existsSync15(join19(dir, ".git"))).sort().find((dir) => getCurrentOrigin(dir) === origin);
|
|
5622
|
+
return listClones(baseDir).find((dir) => getCurrentOrigin(dir) === origin);
|
|
5606
5623
|
}
|
|
5607
5624
|
|
|
5608
5625
|
// src/commands/sessions/web/fromGithub/parseGithubOrigin.ts
|
|
@@ -5699,6 +5716,22 @@ function requestClaudeSession(prompt, cwd, options2) {
|
|
|
5699
5716
|
});
|
|
5700
5717
|
}
|
|
5701
5718
|
|
|
5719
|
+
// src/commands/sessions/web/fromGithub/launchPlannedSession.ts
|
|
5720
|
+
function launchPlannedSession(plan2) {
|
|
5721
|
+
return plan2.mode ? requestAssistSession(
|
|
5722
|
+
[...githubAssistModes[plan2.mode], plan2.prompt],
|
|
5723
|
+
plan2.cwd
|
|
5724
|
+
) : requestClaudeSession(plan2.prompt, plan2.cwd);
|
|
5725
|
+
}
|
|
5726
|
+
|
|
5727
|
+
// src/commands/sessions/web/fromGithub/linkPrompt.ts
|
|
5728
|
+
function linkPrompt(url, instructions) {
|
|
5729
|
+
const extra = typeof instructions === "string" ? instructions.trim() : "";
|
|
5730
|
+
return extra ? `${url}
|
|
5731
|
+
|
|
5732
|
+
${extra}` : url;
|
|
5733
|
+
}
|
|
5734
|
+
|
|
5702
5735
|
// src/commands/sessions/web/fromGithub/planGithubSession.ts
|
|
5703
5736
|
function planGithubSession(body, baseDir, redirects) {
|
|
5704
5737
|
const { url, instructions, mode } = body ?? {};
|
|
@@ -5706,10 +5739,7 @@ function planGithubSession(body, baseDir, redirects) {
|
|
|
5706
5739
|
return { ok: false, status: 400, error: `Unknown mode: ${mode}` };
|
|
5707
5740
|
const clone = resolveGithubClone(url, baseDir, redirects);
|
|
5708
5741
|
if (!clone.ok) return clone;
|
|
5709
|
-
const
|
|
5710
|
-
const prompt = extra ? `${clone.url}
|
|
5711
|
-
|
|
5712
|
-
${extra}` : clone.url;
|
|
5742
|
+
const prompt = linkPrompt(clone.url, instructions);
|
|
5713
5743
|
return { ok: true, cwd: clone.cwd, prompt, ...mode && { mode } };
|
|
5714
5744
|
}
|
|
5715
5745
|
|
|
@@ -5719,10 +5749,7 @@ function sessionFromGithub(req, res) {
|
|
|
5719
5749
|
req,
|
|
5720
5750
|
res,
|
|
5721
5751
|
(body, baseDir) => planGithubSession(body, baseDir, loadConfig().extension?.redirects),
|
|
5722
|
-
(plan2) => plan2
|
|
5723
|
-
[...githubAssistModes[plan2.mode], plan2.prompt],
|
|
5724
|
-
plan2.cwd
|
|
5725
|
-
) : requestClaudeSession(plan2.prompt, plan2.cwd)
|
|
5752
|
+
(plan2) => launchPlannedSession(plan2)
|
|
5726
5753
|
);
|
|
5727
5754
|
}
|
|
5728
5755
|
|
|
@@ -5733,6 +5760,35 @@ function sessionFromGithubPreflight(req, res) {
|
|
|
5733
5760
|
res.end();
|
|
5734
5761
|
}
|
|
5735
5762
|
|
|
5763
|
+
// src/commands/sessions/web/fromGithub/planLinkSession.ts
|
|
5764
|
+
import { basename as basename7 } from "path";
|
|
5765
|
+
function isHttpUrl(url) {
|
|
5766
|
+
return URL.canParse(url) && /^https?:$/.test(new URL(url).protocol);
|
|
5767
|
+
}
|
|
5768
|
+
function planLinkSession(body, baseDir) {
|
|
5769
|
+
const { url, repo, instructions, mode } = body ?? {};
|
|
5770
|
+
if (mode !== void 0 && !isGithubAssistMode(mode))
|
|
5771
|
+
return { ok: false, status: 400, error: `Unknown mode: ${mode}` };
|
|
5772
|
+
if (typeof url !== "string" || !isHttpUrl(url.trim()))
|
|
5773
|
+
return { ok: false, status: 400, error: "Missing or invalid url" };
|
|
5774
|
+
if (typeof repo !== "string" || !repo.trim())
|
|
5775
|
+
return { ok: false, status: 400, error: "No repo picked" };
|
|
5776
|
+
const cwd = listClones(baseDir).find((dir) => basename7(dir) === repo.trim());
|
|
5777
|
+
if (!cwd)
|
|
5778
|
+
return {
|
|
5779
|
+
ok: false,
|
|
5780
|
+
status: 404,
|
|
5781
|
+
error: `${repo} is not cloned under ${baseDir}`
|
|
5782
|
+
};
|
|
5783
|
+
const prompt = linkPrompt(url.trim(), instructions);
|
|
5784
|
+
return { ok: true, cwd, prompt, ...mode && { mode } };
|
|
5785
|
+
}
|
|
5786
|
+
|
|
5787
|
+
// src/commands/sessions/web/fromGithub/sessionFromLink.ts
|
|
5788
|
+
function sessionFromLink(req, res) {
|
|
5789
|
+
return launchFromGithub(req, res, planLinkSession, launchPlannedSession);
|
|
5790
|
+
}
|
|
5791
|
+
|
|
5736
5792
|
// src/commands/sessions/web/getBackupStatus.ts
|
|
5737
5793
|
function getBackupStatus(_req, res) {
|
|
5738
5794
|
const staleAfterMs = parseDuration(loadConfig().backup.staleAfter);
|
|
@@ -7250,16 +7306,16 @@ function handleServerRuns(req, res) {
|
|
|
7250
7306
|
import { execFile as execFile4 } from "child_process";
|
|
7251
7307
|
import { readFileSync as readFileSync7 } from "fs";
|
|
7252
7308
|
import { homedir as homedir10 } from "os";
|
|
7253
|
-
import { basename as
|
|
7309
|
+
import { basename as basename9, join as join22 } from "path";
|
|
7254
7310
|
import { promisify as promisify4 } from "util";
|
|
7255
7311
|
|
|
7256
7312
|
// src/commands/sessions/web/findSynthesisForBranch.ts
|
|
7257
7313
|
import { existsSync as existsSync17, readdirSync as readdirSync4, statSync as statSync4 } from "fs";
|
|
7258
|
-
import { basename as
|
|
7314
|
+
import { basename as basename8, dirname as dirname10, join as join21 } from "path";
|
|
7259
7315
|
function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
7260
7316
|
const branchKeyPath = join21(repoReviewsDir, `${branch2}-`);
|
|
7261
7317
|
const parent = dirname10(branchKeyPath);
|
|
7262
|
-
const branchPrefix =
|
|
7318
|
+
const branchPrefix = basename8(branchKeyPath);
|
|
7263
7319
|
if (!existsSync17(parent)) return null;
|
|
7264
7320
|
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);
|
|
7265
7321
|
return synthesisFiles[0]?.path ?? null;
|
|
@@ -7283,7 +7339,7 @@ async function resolveSynthesisPath(cwd) {
|
|
|
7283
7339
|
homedir10(),
|
|
7284
7340
|
".assist",
|
|
7285
7341
|
"reviews",
|
|
7286
|
-
|
|
7342
|
+
basename9(repoRoot2)
|
|
7287
7343
|
);
|
|
7288
7344
|
return findSynthesisForBranch(repoReviewsDir, branch2);
|
|
7289
7345
|
}
|
|
@@ -7740,8 +7796,8 @@ function subsequenceScore(text17, query) {
|
|
|
7740
7796
|
function scoreFilePath(path108, query) {
|
|
7741
7797
|
const needle = query.trim().toLowerCase();
|
|
7742
7798
|
if (!needle) return 0;
|
|
7743
|
-
const
|
|
7744
|
-
const inBasename = subsequenceScore(
|
|
7799
|
+
const basename36 = path108.slice(path108.lastIndexOf("/") + 1);
|
|
7800
|
+
const inBasename = subsequenceScore(basename36, needle);
|
|
7745
7801
|
if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
|
|
7746
7802
|
return subsequenceScore(path108, needle);
|
|
7747
7803
|
}
|
|
@@ -11407,7 +11463,7 @@ function stripAnsi(text17) {
|
|
|
11407
11463
|
// src/commands/sessions/daemon/worktree/watcherLogPath.ts
|
|
11408
11464
|
import { createHash } from "crypto";
|
|
11409
11465
|
import { homedir as homedir12 } from "os";
|
|
11410
|
-
import { basename as
|
|
11466
|
+
import { basename as basename10, join as join26 } from "path";
|
|
11411
11467
|
|
|
11412
11468
|
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
11413
11469
|
import { realpathSync } from "fs";
|
|
@@ -11425,7 +11481,7 @@ function watcherLogPath(cwd) {
|
|
|
11425
11481
|
const clone = canonicalTreePath(cwd);
|
|
11426
11482
|
const key = createHash("sha1").update(clone).digest("hex").slice(0, 8);
|
|
11427
11483
|
const dir = process.env.ASSIST_WATCHER_LOG_DIR ?? join26(homedir12(), ".assist", "watchers");
|
|
11428
|
-
return join26(dir, `${
|
|
11484
|
+
return join26(dir, `${basename10(clone) || "root"}-${key}.log`);
|
|
11429
11485
|
}
|
|
11430
11486
|
|
|
11431
11487
|
// src/commands/sessions/web/updates/readUpdateHistory.ts
|
|
@@ -11805,6 +11861,9 @@ var routes2 = {
|
|
|
11805
11861
|
"GET /api/repo-location": getRepoLocation,
|
|
11806
11862
|
"POST /api/sessions/from-github": sessionFromGithub,
|
|
11807
11863
|
"OPTIONS /api/sessions/from-github": sessionFromGithubPreflight,
|
|
11864
|
+
"POST /api/sessions/from-link": sessionFromLink,
|
|
11865
|
+
"OPTIONS /api/sessions/from-link": sessionFromGithubPreflight,
|
|
11866
|
+
"GET /api/clones": getClones,
|
|
11808
11867
|
"POST /api/sessions/review-from-github": reviewFromGithub,
|
|
11809
11868
|
"OPTIONS /api/sessions/review-from-github": sessionFromGithubPreflight,
|
|
11810
11869
|
"POST /api/sessions/docs-feedback": docsFeedback,
|
|
@@ -12333,7 +12392,7 @@ async function web(options2) {
|
|
|
12333
12392
|
|
|
12334
12393
|
// src/commands/new/registerNew/newCli.ts
|
|
12335
12394
|
import { execSync as execSync12 } from "child_process";
|
|
12336
|
-
import { basename as
|
|
12395
|
+
import { basename as basename11, resolve as resolve14 } from "path";
|
|
12337
12396
|
|
|
12338
12397
|
// src/commands/verify/init.ts
|
|
12339
12398
|
import chalk29 from "chalk";
|
|
@@ -13660,7 +13719,7 @@ program.parse();
|
|
|
13660
13719
|
|
|
13661
13720
|
// src/commands/new/registerNew/newCli.ts
|
|
13662
13721
|
async function newCli() {
|
|
13663
|
-
const name =
|
|
13722
|
+
const name = basename11(resolve14("."));
|
|
13664
13723
|
initGit();
|
|
13665
13724
|
initPackageJson(name);
|
|
13666
13725
|
console.log("Installing dependencies...");
|
|
@@ -14005,7 +14064,7 @@ function adviceContextFor(cwd) {
|
|
|
14005
14064
|
|
|
14006
14065
|
// src/commands/advise/loadAdviceFragments.ts
|
|
14007
14066
|
import { readdirSync as readdirSync5, readFileSync as readFileSync20 } from "fs";
|
|
14008
|
-
import { basename as
|
|
14067
|
+
import { basename as basename12, join as join39 } from "path";
|
|
14009
14068
|
|
|
14010
14069
|
// src/commands/advise/adviceDir.ts
|
|
14011
14070
|
import { existsSync as existsSync35 } from "fs";
|
|
@@ -14046,7 +14105,7 @@ function parseAdviceFragment(name, content) {
|
|
|
14046
14105
|
function loadAdviceFragments(dir = adviceDir()) {
|
|
14047
14106
|
return readdirSync5(dir).filter((file) => file.endsWith(".md")).sort().map(
|
|
14048
14107
|
(file) => parseAdviceFragment(
|
|
14049
|
-
|
|
14108
|
+
basename12(file, ".md"),
|
|
14050
14109
|
readFileSync20(join39(dir, file), "utf8")
|
|
14051
14110
|
)
|
|
14052
14111
|
);
|
|
@@ -16850,7 +16909,7 @@ function buildArgs(prompt, options2) {
|
|
|
16850
16909
|
|
|
16851
16910
|
// src/commands/backlog/ensureStoryBranch.ts
|
|
16852
16911
|
import { execSync as execSync22 } from "child_process";
|
|
16853
|
-
import { basename as
|
|
16912
|
+
import { basename as basename13 } from "path";
|
|
16854
16913
|
|
|
16855
16914
|
// src/commands/branch/createBranch.ts
|
|
16856
16915
|
import { execSync as execSync21 } from "child_process";
|
|
@@ -17050,7 +17109,7 @@ function worktreeBranchInPlay() {
|
|
|
17050
17109
|
const tree = linkedWorktree(process.cwd());
|
|
17051
17110
|
if (!tree) return null;
|
|
17052
17111
|
const head = currentBranch2();
|
|
17053
|
-
return head ===
|
|
17112
|
+
return head === basename13(tree.root) ? head : null;
|
|
17054
17113
|
}
|
|
17055
17114
|
function currentBranch2() {
|
|
17056
17115
|
try {
|
|
@@ -19589,7 +19648,7 @@ function registerBranch(program) {
|
|
|
19589
19648
|
}
|
|
19590
19649
|
|
|
19591
19650
|
// src/commands/cliHook.ts
|
|
19592
|
-
import { basename as
|
|
19651
|
+
import { basename as basename15 } from "path";
|
|
19593
19652
|
|
|
19594
19653
|
// src/shared/splitCompound.ts
|
|
19595
19654
|
import { parse } from "shell-quote";
|
|
@@ -20552,7 +20611,7 @@ async function cliHook() {
|
|
|
20552
20611
|
logDeniedToolCall({
|
|
20553
20612
|
tool: input.toolName,
|
|
20554
20613
|
command: input.command,
|
|
20555
|
-
repo:
|
|
20614
|
+
repo: basename15(process.cwd()),
|
|
20556
20615
|
sessionId: process.env.CLAUDE_SESSION_ID,
|
|
20557
20616
|
denyReason: decision.permissionDecisionReason
|
|
20558
20617
|
});
|
|
@@ -23186,7 +23245,7 @@ function signPreflightProblem(source) {
|
|
|
23186
23245
|
|
|
23187
23246
|
// src/commands/extension/stageExtension.ts
|
|
23188
23247
|
import { cp as cp3, mkdir as mkdir5, readFile as readFile5, rm, writeFile as writeFile4 } from "fs/promises";
|
|
23189
|
-
import { basename as
|
|
23248
|
+
import { basename as basename16, join as join60 } from "path";
|
|
23190
23249
|
|
|
23191
23250
|
// src/commands/extension/stampManifestVersion.ts
|
|
23192
23251
|
function stampManifestVersion(manifest, version2) {
|
|
@@ -23201,7 +23260,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
23201
23260
|
await mkdir5(staging, { recursive: true });
|
|
23202
23261
|
await cp3(source, staging, {
|
|
23203
23262
|
recursive: true,
|
|
23204
|
-
filter: (path108) =>
|
|
23263
|
+
filter: (path108) => basename16(path108) !== "updates.json"
|
|
23205
23264
|
});
|
|
23206
23265
|
const manifest = join60(staging, "manifest.json");
|
|
23207
23266
|
const stamped = stampManifestVersion(
|
|
@@ -23582,7 +23641,7 @@ function registerDeploy(program) {
|
|
|
23582
23641
|
|
|
23583
23642
|
// src/commands/devlog/list.ts
|
|
23584
23643
|
import { execFileSync as execFileSync7 } from "child_process";
|
|
23585
|
-
import { basename as
|
|
23644
|
+
import { basename as basename18 } from "path";
|
|
23586
23645
|
|
|
23587
23646
|
// src/commands/devlog/loadBlogSkipDays.ts
|
|
23588
23647
|
import { homedir as homedir23 } from "os";
|
|
@@ -23601,7 +23660,7 @@ import chalk149 from "chalk";
|
|
|
23601
23660
|
|
|
23602
23661
|
// src/shared/getRepoName.ts
|
|
23603
23662
|
import { existsSync as existsSync54, readFileSync as readFileSync35 } from "fs";
|
|
23604
|
-
import { basename as
|
|
23663
|
+
import { basename as basename17, join as join65 } from "path";
|
|
23605
23664
|
function getRepoName() {
|
|
23606
23665
|
const config = loadConfig();
|
|
23607
23666
|
if (config.devlog?.name) {
|
|
@@ -23618,7 +23677,7 @@ function getRepoName() {
|
|
|
23618
23677
|
} catch {
|
|
23619
23678
|
}
|
|
23620
23679
|
}
|
|
23621
|
-
return
|
|
23680
|
+
return basename17(process.cwd());
|
|
23622
23681
|
}
|
|
23623
23682
|
|
|
23624
23683
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
@@ -23754,7 +23813,7 @@ function list2(options2) {
|
|
|
23754
23813
|
const config = loadConfig();
|
|
23755
23814
|
const days = options2.days ?? 30;
|
|
23756
23815
|
const ignore3 = options2.ignore ?? config.devlog?.ignore ?? [];
|
|
23757
|
-
const repoName =
|
|
23816
|
+
const repoName = basename18(process.cwd());
|
|
23758
23817
|
const skipDays = loadBlogSkipDays(repoName);
|
|
23759
23818
|
const devlogEntries = loadDevlogEntries(repoName);
|
|
23760
23819
|
const args = ["log"];
|
|
@@ -26788,7 +26847,7 @@ function attachArgs(attachments) {
|
|
|
26788
26847
|
|
|
26789
26848
|
// src/commands/prs/runGhWithAttachments.ts
|
|
26790
26849
|
import { execFileSync as execFileSync11 } from "child_process";
|
|
26791
|
-
import { basename as
|
|
26850
|
+
import { basename as basename19 } from "path";
|
|
26792
26851
|
|
|
26793
26852
|
// src/shared/removeStagedAttachments.ts
|
|
26794
26853
|
import { rmSync as rmSync5 } from "fs";
|
|
@@ -26805,7 +26864,7 @@ function removeStagedAttachments(attachments) {
|
|
|
26805
26864
|
var PLACED_URL = /https:\/\/\S+\/(pull|issues)\/\d+/;
|
|
26806
26865
|
function reportPartialFailure(attachments, stderr) {
|
|
26807
26866
|
const failed3 = attachments.filter(
|
|
26808
|
-
({ path: path108 }) => stderr.includes(path108) || stderr.includes(
|
|
26867
|
+
({ path: path108 }) => stderr.includes(path108) || stderr.includes(basename19(path108))
|
|
26809
26868
|
);
|
|
26810
26869
|
const named = failed3.length > 0 ? failed3 : attachments;
|
|
26811
26870
|
console.error(
|
|
@@ -27663,12 +27722,12 @@ function recentDaemonLogLines(includeRelayed = true) {
|
|
|
27663
27722
|
|
|
27664
27723
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
27665
27724
|
import { existsSync as existsSync60 } from "fs";
|
|
27666
|
-
import { basename as
|
|
27725
|
+
import { basename as basename21, dirname as dirname32 } from "path";
|
|
27667
27726
|
|
|
27668
27727
|
// src/commands/sessions/daemon/worktree/nextWorktreePath.ts
|
|
27669
|
-
import { basename as
|
|
27728
|
+
import { basename as basename20, join as join72 } from "path";
|
|
27670
27729
|
function nextWorktreePath(clone, base, isTaken) {
|
|
27671
|
-
const name =
|
|
27730
|
+
const name = basename20(clone);
|
|
27672
27731
|
for (let n = 2; n < 1e3; n++) {
|
|
27673
27732
|
const candidate = join72(base, `${name}-${n}`);
|
|
27674
27733
|
if (!isTaken(candidate)) return candidate;
|
|
@@ -27694,7 +27753,7 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
27694
27753
|
const base = strategy.root ? expandTilde(strategy.root) : dirname32(clone);
|
|
27695
27754
|
const registered = new Set(listWorktreePaths(clone));
|
|
27696
27755
|
const branches = new Set(listLocalBranches(clone));
|
|
27697
|
-
const isTaken = (candidate) => registered.has(candidate) || existsSync60(candidate) || boundTreeRoots2.has(candidate) || branches.has(
|
|
27756
|
+
const isTaken = (candidate) => registered.has(candidate) || existsSync60(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename21(candidate));
|
|
27698
27757
|
const path108 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
27699
27758
|
const ready = addWorktree(clone, path108, strategy.trunk);
|
|
27700
27759
|
ready.catch(() => {
|
|
@@ -27717,13 +27776,13 @@ async function addWorktree(clone, path108, trunk) {
|
|
|
27717
27776
|
"add",
|
|
27718
27777
|
start2.track ? "--track" : "--no-track",
|
|
27719
27778
|
"-b",
|
|
27720
|
-
|
|
27779
|
+
basename21(path108),
|
|
27721
27780
|
path108,
|
|
27722
27781
|
start2.ref
|
|
27723
27782
|
]);
|
|
27724
27783
|
recordWorktree(path108, clone, getCachedOrigin(clone));
|
|
27725
27784
|
daemonLog(
|
|
27726
|
-
start2.track ? `worktree allocated ${path108} (branch ${
|
|
27785
|
+
start2.track ? `worktree allocated ${path108} (branch ${basename21(path108)} tracking ${start2.ref}) for clone ${clone}` : `worktree allocated ${path108} (branch ${basename21(path108)} off ${start2.ref}, no mainline tracking) for clone ${clone}`
|
|
27727
27786
|
);
|
|
27728
27787
|
}
|
|
27729
27788
|
|
|
@@ -28599,7 +28658,7 @@ import chalk178 from "chalk";
|
|
|
28599
28658
|
|
|
28600
28659
|
// src/commands/mermaid/exportFile.ts
|
|
28601
28660
|
import { readFileSync as readFileSync41, writeFileSync as writeFileSync34 } from "fs";
|
|
28602
|
-
import { basename as
|
|
28661
|
+
import { basename as basename22, extname as extname4, resolve as resolve19 } from "path";
|
|
28603
28662
|
import chalk177 from "chalk";
|
|
28604
28663
|
|
|
28605
28664
|
// src/commands/mermaid/renderBlock.ts
|
|
@@ -28626,7 +28685,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
28626
28685
|
async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
28627
28686
|
const content = readFileSync41(file, "utf8");
|
|
28628
28687
|
const blocks = extractMermaidBlocks(content);
|
|
28629
|
-
const stem =
|
|
28688
|
+
const stem = basename22(file, extname4(file));
|
|
28630
28689
|
if (onlyIndex !== void 0) {
|
|
28631
28690
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
28632
28691
|
console.error(
|
|
@@ -31235,7 +31294,7 @@ ${resolves}` : baseWhy);
|
|
|
31235
31294
|
|
|
31236
31295
|
// src/commands/prs/parseScreenshotSpec.ts
|
|
31237
31296
|
import { statSync as statSync9 } from "fs";
|
|
31238
|
-
import { basename as
|
|
31297
|
+
import { basename as basename23, extname as extname5, resolve as resolve23 } from "path";
|
|
31239
31298
|
function splitOnce(value, separator) {
|
|
31240
31299
|
const index2 = value.indexOf(separator);
|
|
31241
31300
|
if (index2 === -1) return null;
|
|
@@ -31259,7 +31318,7 @@ function parseScreenshotSpec(spec) {
|
|
|
31259
31318
|
throw new Error(
|
|
31260
31319
|
`--screenshot '${spec}': gh cannot attach .${ext || "(none)"} files (supported: ${[...ghAttachableExtensions].join(", ")}).`
|
|
31261
31320
|
);
|
|
31262
|
-
const alt = caption.trim() ||
|
|
31321
|
+
const alt = caption.trim() || basename23(path108, extname5(path108));
|
|
31263
31322
|
return group.trim() ? { path: path108, alt, group: group.trim() } : { path: path108, alt };
|
|
31264
31323
|
}
|
|
31265
31324
|
|
|
@@ -31278,12 +31337,12 @@ import { randomUUID as randomUUID16 } from "crypto";
|
|
|
31278
31337
|
|
|
31279
31338
|
// src/commands/prs/stageScreenshots.ts
|
|
31280
31339
|
import { readFile as readFile8 } from "fs/promises";
|
|
31281
|
-
import { basename as
|
|
31340
|
+
import { basename as basename24 } from "path";
|
|
31282
31341
|
function stageScreenshots(screenshots = []) {
|
|
31283
31342
|
return Promise.all(
|
|
31284
31343
|
screenshots.map(async (screenshot2) => {
|
|
31285
31344
|
const { filePath } = await stageAttachment(
|
|
31286
|
-
|
|
31345
|
+
basename24(screenshot2.path),
|
|
31287
31346
|
attachmentContentType(screenshot2.path),
|
|
31288
31347
|
await readFile8(screenshot2.path)
|
|
31289
31348
|
);
|
|
@@ -36485,7 +36544,7 @@ function groupFilesByDirectory(files) {
|
|
|
36485
36544
|
}
|
|
36486
36545
|
|
|
36487
36546
|
// src/commands/review/highLevel/buildHighLevelTree.ts
|
|
36488
|
-
function
|
|
36547
|
+
function basename25(path108) {
|
|
36489
36548
|
return path108.slice(path108.lastIndexOf("/") + 1);
|
|
36490
36549
|
}
|
|
36491
36550
|
function sum(nodes, key) {
|
|
@@ -36501,7 +36560,7 @@ function nodesOf(at2, prefix2) {
|
|
|
36501
36560
|
const files = at2.files.map(
|
|
36502
36561
|
(file) => ({
|
|
36503
36562
|
kind: "file",
|
|
36504
|
-
name:
|
|
36563
|
+
name: basename25(file.path),
|
|
36505
36564
|
...file
|
|
36506
36565
|
})
|
|
36507
36566
|
);
|
|
@@ -39523,13 +39582,13 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
39523
39582
|
|
|
39524
39583
|
// src/commands/review/buildReviewPaths.ts
|
|
39525
39584
|
import { homedir as homedir26 } from "os";
|
|
39526
|
-
import { basename as
|
|
39585
|
+
import { basename as basename26, join as join87 } from "path";
|
|
39527
39586
|
function buildReviewPaths(repoRoot2, key) {
|
|
39528
39587
|
const reviewDir = join87(
|
|
39529
39588
|
homedir26(),
|
|
39530
39589
|
".assist",
|
|
39531
39590
|
"reviews",
|
|
39532
|
-
|
|
39591
|
+
basename26(repoRoot2),
|
|
39533
39592
|
key
|
|
39534
39593
|
);
|
|
39535
39594
|
return {
|
|
@@ -42201,7 +42260,7 @@ function list4() {
|
|
|
42201
42260
|
|
|
42202
42261
|
// src/commands/transcript/move.ts
|
|
42203
42262
|
import { existsSync as existsSync79, mkdirSync as mkdirSync35, renameSync as renameSync4, writeFileSync as writeFileSync51 } from "fs";
|
|
42204
|
-
import { basename as
|
|
42263
|
+
import { basename as basename29, join as join101 } from "path";
|
|
42205
42264
|
|
|
42206
42265
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
42207
42266
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -42222,13 +42281,13 @@ function move(file, options2) {
|
|
|
42222
42281
|
process.exit(1);
|
|
42223
42282
|
}
|
|
42224
42283
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
42225
|
-
const filename =
|
|
42284
|
+
const filename = basename29(file);
|
|
42226
42285
|
const sourcePath = join101(vttDir, filename);
|
|
42227
42286
|
if (!existsSync79(sourcePath)) {
|
|
42228
42287
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
42229
42288
|
process.exit(1);
|
|
42230
42289
|
}
|
|
42231
|
-
const base =
|
|
42290
|
+
const base = basename29(filename, ".vtt").replace(/ Transcription$/, "");
|
|
42232
42291
|
const outputName = `${date} ${base}.md`;
|
|
42233
42292
|
const formattedDir = join101(transcriptsDir, client);
|
|
42234
42293
|
mkdirSync35(formattedDir, { recursive: true });
|
|
@@ -42242,7 +42301,7 @@ function move(file, options2) {
|
|
|
42242
42301
|
|
|
42243
42302
|
// src/commands/transcript/merge.ts
|
|
42244
42303
|
import { existsSync as existsSync80, writeFileSync as writeFileSync52 } from "fs";
|
|
42245
|
-
import { basename as
|
|
42304
|
+
import { basename as basename30 } from "path";
|
|
42246
42305
|
|
|
42247
42306
|
// src/commands/transcript/failTranscript.ts
|
|
42248
42307
|
function failTranscript(message3) {
|
|
@@ -42388,7 +42447,7 @@ function readSource3(file) {
|
|
|
42388
42447
|
if (!existsSync80(file)) failTranscript(`VTT file not found: ${file}`);
|
|
42389
42448
|
const cues = readCleanedCues(file);
|
|
42390
42449
|
if (cues.length === 0) failTranscript(`no cues found in: ${file}`);
|
|
42391
|
-
return { path: file, name:
|
|
42450
|
+
return { path: file, name: basename30(file), cues };
|
|
42392
42451
|
}
|
|
42393
42452
|
function wholePassages(sources) {
|
|
42394
42453
|
return sources.map((source) => ({
|
|
@@ -43057,7 +43116,7 @@ function listMigrationFiles(dir) {
|
|
|
43057
43116
|
|
|
43058
43117
|
// src/commands/verify/migrations/readBaselineMigrations.ts
|
|
43059
43118
|
import { execSync as execSync58 } from "child_process";
|
|
43060
|
-
import { basename as
|
|
43119
|
+
import { basename as basename31 } from "path";
|
|
43061
43120
|
var MIGRATION_FILE3 = /^migration\d+[A-Za-z0-9]*\.ts$/;
|
|
43062
43121
|
function readBaselineMigrations(repoRelativeDir, ref) {
|
|
43063
43122
|
const baseline = /* @__PURE__ */ new Map();
|
|
@@ -43070,7 +43129,7 @@ function readBaselineMigrations(repoRelativeDir, ref) {
|
|
|
43070
43129
|
} catch {
|
|
43071
43130
|
return baseline;
|
|
43072
43131
|
}
|
|
43073
|
-
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path108) => MIGRATION_FILE3.test(
|
|
43132
|
+
const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path108) => MIGRATION_FILE3.test(basename31(path108)));
|
|
43074
43133
|
for (const path108 of paths) {
|
|
43075
43134
|
try {
|
|
43076
43135
|
const content = execSync58(`git show "${ref}:${path108}"`, {
|
|
@@ -43078,7 +43137,7 @@ function readBaselineMigrations(repoRelativeDir, ref) {
|
|
|
43078
43137
|
maxBuffer: 16 * 1024 * 1024,
|
|
43079
43138
|
stdio: ["pipe", "pipe", "pipe"]
|
|
43080
43139
|
});
|
|
43081
|
-
baseline.set(
|
|
43140
|
+
baseline.set(basename31(path108), content);
|
|
43082
43141
|
} catch {
|
|
43083
43142
|
}
|
|
43084
43143
|
}
|
|
@@ -46452,7 +46511,7 @@ function setStatus2(session, newStatus) {
|
|
|
46452
46511
|
|
|
46453
46512
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
46454
46513
|
import { existsSync as existsSync93 } from "fs";
|
|
46455
|
-
import { basename as
|
|
46514
|
+
import { basename as basename32 } from "path";
|
|
46456
46515
|
|
|
46457
46516
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
46458
46517
|
import { existsSync as existsSync92 } from "fs";
|
|
@@ -46595,7 +46654,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
46595
46654
|
const clone = owningClone(worktreePath);
|
|
46596
46655
|
const removal = await removeTree(clone, worktreePath, force);
|
|
46597
46656
|
if (!removal.removed) return removal;
|
|
46598
|
-
await deleteWorktreeBranch(clone,
|
|
46657
|
+
await deleteWorktreeBranch(clone, basename32(worktreePath));
|
|
46599
46658
|
forgetWorktree(worktreePath);
|
|
46600
46659
|
daemonLog(`worktree ${worktreePath} reaped${force ? " (forced)" : ""}`);
|
|
46601
46660
|
return removal;
|
|
@@ -49649,7 +49708,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
49649
49708
|
|
|
49650
49709
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
49651
49710
|
import { existsSync as existsSync98 } from "fs";
|
|
49652
|
-
import { basename as
|
|
49711
|
+
import { basename as basename34 } from "path";
|
|
49653
49712
|
|
|
49654
49713
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
49655
49714
|
function accountedTrees(sessions) {
|
|
@@ -49757,7 +49816,7 @@ function capped2(lines2) {
|
|
|
49757
49816
|
}
|
|
49758
49817
|
|
|
49759
49818
|
// src/commands/sessions/daemon/worktree/resurfaceOrphanedWorktree.ts
|
|
49760
|
-
import { basename as
|
|
49819
|
+
import { basename as basename33 } from "path";
|
|
49761
49820
|
function resurfaceOrphanedWorktree(sessions, spawnWith, recovered, notify2) {
|
|
49762
49821
|
const { orphan, reason: reason4, held } = recovered;
|
|
49763
49822
|
let id;
|
|
@@ -49780,7 +49839,7 @@ function orphanedSession(id, recovered) {
|
|
|
49780
49839
|
const { orphan, reason: reason4, held } = recovered;
|
|
49781
49840
|
return {
|
|
49782
49841
|
...sessionBase(id, "stopped"),
|
|
49783
|
-
name: `recovered ${
|
|
49842
|
+
name: `recovered ${basename33(orphan.path)}`,
|
|
49784
49843
|
subtitle: `${held.summary} in ${orphan.path}`,
|
|
49785
49844
|
commandType: "claude",
|
|
49786
49845
|
pty: null,
|
|
@@ -49841,7 +49900,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
49841
49900
|
logVanishedTree(sessions, path108);
|
|
49842
49901
|
vanished.set(clone, [
|
|
49843
49902
|
...vanished.get(clone) ?? [],
|
|
49844
|
-
{ path: path108, branch:
|
|
49903
|
+
{ path: path108, branch: basename34(path108) }
|
|
49845
49904
|
]);
|
|
49846
49905
|
continue;
|
|
49847
49906
|
}
|