@staff0rd/assist 0.1051.2 → 0.1052.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/claude/commands/review-high-level.md +1 -1
- package/dist/commands/sessions/web/bundle.js +446 -446
- package/dist/index.js +503 -431
- 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.1052.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -4171,6 +4171,24 @@ async function postDocsRefresh(req, res) {
|
|
|
4171
4171
|
respondJson(res, 200, await requestDocsRefresh(orm, getOrigin()));
|
|
4172
4172
|
}
|
|
4173
4173
|
|
|
4174
|
+
// src/commands/backlog/web/listNoteRepos.ts
|
|
4175
|
+
import { existsSync as existsSync12, readdirSync as readdirSync2, statSync as statSync4 } from "fs";
|
|
4176
|
+
import { join as join12 } from "path";
|
|
4177
|
+
function hasGitDirectory(dir) {
|
|
4178
|
+
const gitPath = join12(dir, ".git");
|
|
4179
|
+
return existsSync12(gitPath) && statSync4(gitPath).isDirectory();
|
|
4180
|
+
}
|
|
4181
|
+
function listNoteRepos(baseDir) {
|
|
4182
|
+
if (!existsSync12(baseDir)) return [];
|
|
4183
|
+
return readdirSync2(baseDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => ({ name: entry.name, cwd: join12(baseDir, entry.name) })).filter((repo) => hasGitDirectory(repo.cwd)).sort((a, b) => a.name.localeCompare(b.name));
|
|
4184
|
+
}
|
|
4185
|
+
|
|
4186
|
+
// src/commands/backlog/web/getNoteRepos.ts
|
|
4187
|
+
function getNoteRepos(_req, res) {
|
|
4188
|
+
const baseDir = expandTilde(loadConfig().clone.baseDir);
|
|
4189
|
+
respondJson(res, 200, { repos: listNoteRepos(baseDir) });
|
|
4190
|
+
}
|
|
4191
|
+
|
|
4174
4192
|
// src/commands/backlog/web/getRepoLocation.ts
|
|
4175
4193
|
function getRepoLocation(req, res) {
|
|
4176
4194
|
const origin = new URL(req.url ?? "/", "http://localhost").searchParams.get(
|
|
@@ -5242,11 +5260,11 @@ async function fileContent(req, res) {
|
|
|
5242
5260
|
import { basename as basename3 } from "path";
|
|
5243
5261
|
|
|
5244
5262
|
// src/commands/sessions/web/fromGithub/listClones.ts
|
|
5245
|
-
import { existsSync as
|
|
5246
|
-
import { join as
|
|
5263
|
+
import { existsSync as existsSync14, readdirSync as readdirSync4 } from "fs";
|
|
5264
|
+
import { join as join15 } from "path";
|
|
5247
5265
|
function listClones(baseDir) {
|
|
5248
|
-
if (!
|
|
5249
|
-
return
|
|
5266
|
+
if (!existsSync14(baseDir)) return [];
|
|
5267
|
+
return readdirSync4(baseDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join15(baseDir, entry.name)).filter((dir) => existsSync14(join15(dir, ".git"))).sort();
|
|
5250
5268
|
}
|
|
5251
5269
|
|
|
5252
5270
|
// src/commands/sessions/web/fromGithub/getClones.ts
|
|
@@ -5428,8 +5446,8 @@ function azureDevopsRepoUrl({ org, project, repo }) {
|
|
|
5428
5446
|
}
|
|
5429
5447
|
|
|
5430
5448
|
// src/commands/sessions/web/fromGithub/findAzureDevopsClone.ts
|
|
5431
|
-
import { existsSync as
|
|
5432
|
-
import { join as
|
|
5449
|
+
import { existsSync as existsSync15, readdirSync as readdirSync5 } from "fs";
|
|
5450
|
+
import { join as join16 } from "path";
|
|
5433
5451
|
|
|
5434
5452
|
// src/shared/azureDevops/parseAzureDevopsRemote.ts
|
|
5435
5453
|
var HTTPS_DEV = /^https?:\/\/(?:[^@/]+@)?dev\.azure\.com\/([^/]+)\/([^/]+)\/_git\/([^/]+)$/i;
|
|
@@ -5450,15 +5468,15 @@ function sameAzureDevopsRepo(a, b) {
|
|
|
5450
5468
|
|
|
5451
5469
|
// src/commands/sessions/web/fromGithub/findAzureDevopsClone.ts
|
|
5452
5470
|
function clonesRepo(dir, repo) {
|
|
5453
|
-
if (!
|
|
5471
|
+
if (!existsSync15(join16(dir, ".git"))) return false;
|
|
5454
5472
|
const url = remoteUrl(dir).url;
|
|
5455
5473
|
const remote = url ? parseAzureDevopsRemote(url) : null;
|
|
5456
5474
|
return remote !== null && sameAzureDevopsRepo(remote, repo);
|
|
5457
5475
|
}
|
|
5458
5476
|
function findAzureDevopsClone(repo, baseDir) {
|
|
5459
|
-
if (!
|
|
5460
|
-
const named =
|
|
5461
|
-
const others =
|
|
5477
|
+
if (!existsSync15(baseDir)) return void 0;
|
|
5478
|
+
const named = join16(baseDir, repo.repo);
|
|
5479
|
+
const others = readdirSync5(baseDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join16(baseDir, entry.name)).filter((dir) => dir !== named).sort();
|
|
5462
5480
|
return [named, ...others].find((dir) => clonesRepo(dir, repo));
|
|
5463
5481
|
}
|
|
5464
5482
|
|
|
@@ -7176,14 +7194,14 @@ function assertNoDuplicateRunNames(configs) {
|
|
|
7176
7194
|
}
|
|
7177
7195
|
|
|
7178
7196
|
// src/shared/findLinkedConfigPath.ts
|
|
7179
|
-
import { existsSync as
|
|
7180
|
-
import { join as
|
|
7197
|
+
import { existsSync as existsSync16 } from "fs";
|
|
7198
|
+
import { join as join17, resolve as resolve5 } from "path";
|
|
7181
7199
|
function findLinkedConfigPath(linkPath, fromDir) {
|
|
7182
7200
|
const resolved = resolve5(fromDir, linkPath);
|
|
7183
|
-
const claudePath =
|
|
7184
|
-
if (
|
|
7185
|
-
const rootPath =
|
|
7186
|
-
if (
|
|
7201
|
+
const claudePath = join17(resolved, ".claude", "assist.yml");
|
|
7202
|
+
if (existsSync16(claudePath)) return claudePath;
|
|
7203
|
+
const rootPath = join17(resolved, "assist.yml");
|
|
7204
|
+
if (existsSync16(rootPath)) return rootPath;
|
|
7187
7205
|
throw new Error(`No assist.yml found in linked project: ${resolved}`);
|
|
7188
7206
|
}
|
|
7189
7207
|
|
|
@@ -7273,18 +7291,18 @@ function handleServerRuns(req, res) {
|
|
|
7273
7291
|
import { execFile as execFile4 } from "child_process";
|
|
7274
7292
|
import { readFileSync as readFileSync6 } from "fs";
|
|
7275
7293
|
import { homedir as homedir7 } from "os";
|
|
7276
|
-
import { basename as basename6, join as
|
|
7294
|
+
import { basename as basename6, join as join19 } from "path";
|
|
7277
7295
|
import { promisify as promisify4 } from "util";
|
|
7278
7296
|
|
|
7279
7297
|
// src/commands/sessions/web/findSynthesisForBranch.ts
|
|
7280
|
-
import { existsSync as
|
|
7281
|
-
import { basename as basename5, dirname as dirname7, join as
|
|
7298
|
+
import { existsSync as existsSync17, readdirSync as readdirSync6, statSync as statSync5 } from "fs";
|
|
7299
|
+
import { basename as basename5, dirname as dirname7, join as join18 } from "path";
|
|
7282
7300
|
function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
7283
|
-
const branchKeyPath =
|
|
7301
|
+
const branchKeyPath = join18(repoReviewsDir, `${branch2}-`);
|
|
7284
7302
|
const parent = dirname7(branchKeyPath);
|
|
7285
7303
|
const branchPrefix = basename5(branchKeyPath);
|
|
7286
|
-
if (!
|
|
7287
|
-
const synthesisFiles =
|
|
7304
|
+
if (!existsSync17(parent)) return null;
|
|
7305
|
+
const synthesisFiles = readdirSync6(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join18(parent, name, "synthesis.md")).filter((path109) => existsSync17(path109)).map((path109) => ({ path: path109, mtime: statSync5(path109).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
|
|
7288
7306
|
return synthesisFiles[0]?.path ?? null;
|
|
7289
7307
|
}
|
|
7290
7308
|
|
|
@@ -7302,7 +7320,7 @@ async function resolveSynthesisPath(cwd) {
|
|
|
7302
7320
|
runGit2(cwd, ["rev-parse", "--show-toplevel"]),
|
|
7303
7321
|
runGit2(cwd, ["rev-parse", "--abbrev-ref", "HEAD"])
|
|
7304
7322
|
]);
|
|
7305
|
-
const repoReviewsDir =
|
|
7323
|
+
const repoReviewsDir = join19(
|
|
7306
7324
|
homedir7(),
|
|
7307
7325
|
".assist",
|
|
7308
7326
|
"reviews",
|
|
@@ -7903,21 +7921,21 @@ function resolveRewindPlan(item) {
|
|
|
7903
7921
|
// src/commands/backlog/writeSignal.ts
|
|
7904
7922
|
import { mkdirSync as mkdirSync5, writeFileSync as writeFileSync4 } from "fs";
|
|
7905
7923
|
import { homedir as homedir9 } from "os";
|
|
7906
|
-
import { dirname as dirname9, join as
|
|
7924
|
+
import { dirname as dirname9, join as join21 } from "path";
|
|
7907
7925
|
import chalk10 from "chalk";
|
|
7908
7926
|
|
|
7909
7927
|
// src/commands/backlog/recordSignalOwner.ts
|
|
7910
7928
|
import {
|
|
7911
|
-
existsSync as
|
|
7929
|
+
existsSync as existsSync18,
|
|
7912
7930
|
mkdirSync as mkdirSync4,
|
|
7913
7931
|
readFileSync as readFileSync7,
|
|
7914
7932
|
rmSync as rmSync3,
|
|
7915
7933
|
writeFileSync as writeFileSync3
|
|
7916
7934
|
} from "fs";
|
|
7917
7935
|
import { homedir as homedir8 } from "os";
|
|
7918
|
-
import { dirname as dirname8, join as
|
|
7936
|
+
import { dirname as dirname8, join as join20 } from "path";
|
|
7919
7937
|
function getOwnerPath(itemId2) {
|
|
7920
|
-
return
|
|
7938
|
+
return join20(homedir8(), ".assist", "signals", `owner-${itemId2}.json`);
|
|
7921
7939
|
}
|
|
7922
7940
|
function recordSignalOwner(itemId2) {
|
|
7923
7941
|
const sessionId2 = process.env.ASSIST_SESSION_ID;
|
|
@@ -7928,7 +7946,7 @@ function recordSignalOwner(itemId2) {
|
|
|
7928
7946
|
}
|
|
7929
7947
|
function readSignalOwner(itemId2) {
|
|
7930
7948
|
const path109 = getOwnerPath(itemId2);
|
|
7931
|
-
if (!
|
|
7949
|
+
if (!existsSync18(path109)) return void 0;
|
|
7932
7950
|
try {
|
|
7933
7951
|
const parsed = JSON.parse(readFileSync7(path109, "utf8"));
|
|
7934
7952
|
return parsed.sessionId;
|
|
@@ -7947,7 +7965,7 @@ function clearSignalOwner(itemId2) {
|
|
|
7947
7965
|
// src/commands/backlog/writeSignal.ts
|
|
7948
7966
|
function getSignalPath(sessionId2 = process.env.ASSIST_SESSION_ID) {
|
|
7949
7967
|
if (!sessionId2) return void 0;
|
|
7950
|
-
return
|
|
7968
|
+
return join21(homedir9(), ".assist", "signals", `signal-${sessionId2}.json`);
|
|
7951
7969
|
}
|
|
7952
7970
|
function resolveSignalTarget(event, data) {
|
|
7953
7971
|
const caller = process.env.ASSIST_SESSION_ID;
|
|
@@ -8046,7 +8064,7 @@ import * as fs3 from "fs";
|
|
|
8046
8064
|
import * as path6 from "path";
|
|
8047
8065
|
|
|
8048
8066
|
// src/commands/sessions/shared/codex/codexSessionsDir.ts
|
|
8049
|
-
import { existsSync as
|
|
8067
|
+
import { existsSync as existsSync19 } from "fs";
|
|
8050
8068
|
import * as path5 from "path";
|
|
8051
8069
|
|
|
8052
8070
|
// src/shared/harnesses.ts
|
|
@@ -8111,7 +8129,7 @@ function codexSessionsDir() {
|
|
|
8111
8129
|
return path5.join(harnesses.codex.homeDir, "sessions");
|
|
8112
8130
|
}
|
|
8113
8131
|
function hasCodexSessions() {
|
|
8114
|
-
return
|
|
8132
|
+
return existsSync19(codexSessionsDir());
|
|
8115
8133
|
}
|
|
8116
8134
|
|
|
8117
8135
|
// src/commands/sessions/shared/codex/discoverCodexRolloutPaths.ts
|
|
@@ -9947,7 +9965,7 @@ async function nextPickup(req, res) {
|
|
|
9947
9965
|
import path13 from "path";
|
|
9948
9966
|
|
|
9949
9967
|
// src/commands/rules/readScopedRules.ts
|
|
9950
|
-
import { existsSync as
|
|
9968
|
+
import { existsSync as existsSync21, readFileSync as readFileSync8 } from "fs";
|
|
9951
9969
|
import path12 from "path";
|
|
9952
9970
|
|
|
9953
9971
|
// src/commands/rules/rulesSectionRange.ts
|
|
@@ -9996,11 +10014,11 @@ function parseRulesSection(content) {
|
|
|
9996
10014
|
}
|
|
9997
10015
|
|
|
9998
10016
|
// src/commands/rules/scopeDirectory.ts
|
|
9999
|
-
import { existsSync as
|
|
10017
|
+
import { existsSync as existsSync20, statSync as statSync6 } from "fs";
|
|
10000
10018
|
import path11 from "path";
|
|
10001
10019
|
function scopeDirectory(target) {
|
|
10002
10020
|
const resolved = path11.resolve(target);
|
|
10003
|
-
return
|
|
10021
|
+
return existsSync20(resolved) && statSync6(resolved).isDirectory() ? resolved : path11.dirname(resolved);
|
|
10004
10022
|
}
|
|
10005
10023
|
|
|
10006
10024
|
// src/commands/rules/readScopedRules.ts
|
|
@@ -10011,7 +10029,7 @@ function scopedClaudeFiles(target) {
|
|
|
10011
10029
|
let current = startDir;
|
|
10012
10030
|
while (true) {
|
|
10013
10031
|
const candidate = path12.join(current, "CLAUDE.md");
|
|
10014
|
-
if (
|
|
10032
|
+
if (existsSync21(candidate)) files.push(candidate);
|
|
10015
10033
|
if (current === root2 || current === path12.dirname(current)) break;
|
|
10016
10034
|
current = path12.dirname(current);
|
|
10017
10035
|
}
|
|
@@ -11691,7 +11709,7 @@ async function revertDiffFile(req, res) {
|
|
|
11691
11709
|
|
|
11692
11710
|
// src/commands/run/runCommandToCompletion.ts
|
|
11693
11711
|
import { spawn as spawn3 } from "child_process";
|
|
11694
|
-
import { existsSync as
|
|
11712
|
+
import { existsSync as existsSync23 } from "fs";
|
|
11695
11713
|
|
|
11696
11714
|
// src/shared/expandEnv.ts
|
|
11697
11715
|
import { homedir as homedir12 } from "os";
|
|
@@ -11706,15 +11724,15 @@ function expandEnv(env) {
|
|
|
11706
11724
|
|
|
11707
11725
|
// src/commands/run/resolveCommand.ts
|
|
11708
11726
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
11709
|
-
import { existsSync as
|
|
11710
|
-
import { dirname as dirname11, join as
|
|
11727
|
+
import { existsSync as existsSync22 } from "fs";
|
|
11728
|
+
import { dirname as dirname11, join as join26, resolve as resolve10 } from "path";
|
|
11711
11729
|
function resolveCommand(command) {
|
|
11712
11730
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
11713
11731
|
try {
|
|
11714
11732
|
const gitPath = execFileSync3("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
11715
11733
|
const gitRoot = resolve10(dirname11(gitPath), "..");
|
|
11716
|
-
const gitBash =
|
|
11717
|
-
if (
|
|
11734
|
+
const gitBash = join26(gitRoot, "bin", "bash.exe");
|
|
11735
|
+
if (existsSync22(gitBash)) return gitBash;
|
|
11718
11736
|
} catch {
|
|
11719
11737
|
return command;
|
|
11720
11738
|
}
|
|
@@ -11724,7 +11742,7 @@ function resolveCommand(command) {
|
|
|
11724
11742
|
// src/commands/run/runCommandToCompletion.ts
|
|
11725
11743
|
function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
11726
11744
|
return new Promise((resolveResult) => {
|
|
11727
|
-
if (cwd && !
|
|
11745
|
+
if (cwd && !existsSync23(cwd)) {
|
|
11728
11746
|
resolveResult({
|
|
11729
11747
|
kind: "failed",
|
|
11730
11748
|
message: `Failed to execute command: cwd ${cwd} does not exist`
|
|
@@ -12941,7 +12959,7 @@ function changedPaths(from, cwd) {
|
|
|
12941
12959
|
}
|
|
12942
12960
|
|
|
12943
12961
|
// src/commands/watch/readBuiltVersion.ts
|
|
12944
|
-
import { join as
|
|
12962
|
+
import { join as join28 } from "path";
|
|
12945
12963
|
|
|
12946
12964
|
// src/shared/readPackageJson.ts
|
|
12947
12965
|
import * as fs8 from "fs";
|
|
@@ -12991,7 +13009,7 @@ function findPackageJsonWithVerifyScripts(startDir) {
|
|
|
12991
13009
|
function readBuiltVersion(cwd) {
|
|
12992
13010
|
try {
|
|
12993
13011
|
const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
12994
|
-
return readPackageJson(
|
|
13012
|
+
return readPackageJson(join28(root2, "package.json")).version ?? "unknown";
|
|
12995
13013
|
} catch {
|
|
12996
13014
|
return "unknown";
|
|
12997
13015
|
}
|
|
@@ -13014,17 +13032,17 @@ function extensionUpdateStatus(connected, latest2) {
|
|
|
13014
13032
|
|
|
13015
13033
|
// src/commands/extension/fetchLatestSignedExtension.ts
|
|
13016
13034
|
import { readFile as readFile2 } from "fs/promises";
|
|
13017
|
-
import { join as
|
|
13035
|
+
import { join as join30 } from "path";
|
|
13018
13036
|
|
|
13019
13037
|
// src/commands/extension/extensionDir.ts
|
|
13020
|
-
import { existsSync as
|
|
13021
|
-
import { dirname as dirname14, join as
|
|
13038
|
+
import { existsSync as existsSync25 } from "fs";
|
|
13039
|
+
import { dirname as dirname14, join as join29 } from "path";
|
|
13022
13040
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
13023
13041
|
var moduleDir = dirname14(fileURLToPath2(import.meta.url));
|
|
13024
13042
|
function extensionDir() {
|
|
13025
|
-
const bundled =
|
|
13026
|
-
if (
|
|
13027
|
-
return
|
|
13043
|
+
const bundled = join29(moduleDir, "commands", "extension", "extension");
|
|
13044
|
+
if (existsSync25(bundled)) return bundled;
|
|
13045
|
+
return join29(moduleDir, "..", "..", "..", "extension");
|
|
13028
13046
|
}
|
|
13029
13047
|
|
|
13030
13048
|
// src/commands/extension/latestUpdate.ts
|
|
@@ -13036,7 +13054,7 @@ function latestUpdate(manifest, updates2) {
|
|
|
13036
13054
|
// src/commands/extension/fetchLatestSignedExtension.ts
|
|
13037
13055
|
async function fetchLatestSignedExtension() {
|
|
13038
13056
|
const manifest = await readFile2(
|
|
13039
|
-
|
|
13057
|
+
join30(extensionDir(), "manifest.json"),
|
|
13040
13058
|
"utf8"
|
|
13041
13059
|
);
|
|
13042
13060
|
const updateUrl = JSON.parse(manifest).browser_specific_settings.gecko.update_url;
|
|
@@ -13109,7 +13127,7 @@ function stripAnsi(text20) {
|
|
|
13109
13127
|
// src/commands/sessions/daemon/worktree/watcherLogPath.ts
|
|
13110
13128
|
import { createHash } from "crypto";
|
|
13111
13129
|
import { homedir as homedir13 } from "os";
|
|
13112
|
-
import { basename as basename10, join as
|
|
13130
|
+
import { basename as basename10, join as join31 } from "path";
|
|
13113
13131
|
|
|
13114
13132
|
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
13115
13133
|
import { realpathSync } from "fs";
|
|
@@ -13126,8 +13144,8 @@ function canonicalTreePath(path109) {
|
|
|
13126
13144
|
function watcherLogPath(cwd) {
|
|
13127
13145
|
const clone = canonicalTreePath(cwd);
|
|
13128
13146
|
const key = createHash("sha1").update(clone).digest("hex").slice(0, 8);
|
|
13129
|
-
const dir = process.env.ASSIST_WATCHER_LOG_DIR ??
|
|
13130
|
-
return
|
|
13147
|
+
const dir = process.env.ASSIST_WATCHER_LOG_DIR ?? join31(homedir13(), ".assist", "watchers");
|
|
13148
|
+
return join31(dir, `${basename10(clone) || "root"}-${key}.log`);
|
|
13131
13149
|
}
|
|
13132
13150
|
|
|
13133
13151
|
// src/commands/sessions/web/updates/readUpdateHistory.ts
|
|
@@ -13246,7 +13264,7 @@ async function readRequestBuffer(req, limit) {
|
|
|
13246
13264
|
|
|
13247
13265
|
// src/commands/sessions/web/stageAttachment.ts
|
|
13248
13266
|
import { mkdir, mkdtemp, writeFile } from "fs/promises";
|
|
13249
|
-
import { extname as extname2, join as
|
|
13267
|
+
import { extname as extname2, join as join32 } from "path";
|
|
13250
13268
|
|
|
13251
13269
|
// src/commands/sessions/web/ghAttachableExtensions.ts
|
|
13252
13270
|
var ghAttachableExtensions = /* @__PURE__ */ new Set([
|
|
@@ -13278,9 +13296,9 @@ function safeBaseName(name) {
|
|
|
13278
13296
|
async function stageAttachment(name, contentType, body) {
|
|
13279
13297
|
const ext = pickExtension(name, contentType);
|
|
13280
13298
|
await mkdir(stagedAttachmentsDir, { recursive: true });
|
|
13281
|
-
const dir = await mkdtemp(
|
|
13299
|
+
const dir = await mkdtemp(join32(stagedAttachmentsDir, "upload-"));
|
|
13282
13300
|
const alt = safeBaseName(name);
|
|
13283
|
-
const filePath =
|
|
13301
|
+
const filePath = join32(dir, `${alt}.${ext}`);
|
|
13284
13302
|
await writeFile(filePath, body);
|
|
13285
13303
|
return { dir, filePath, alt };
|
|
13286
13304
|
}
|
|
@@ -13329,16 +13347,16 @@ import { readFile as readFile3, stat as stat3, writeFile as writeFile2 } from "f
|
|
|
13329
13347
|
|
|
13330
13348
|
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
13331
13349
|
import { execFile as execFile9 } from "child_process";
|
|
13332
|
-
import { existsSync as
|
|
13333
|
-
import { dirname as dirname15, join as
|
|
13350
|
+
import { existsSync as existsSync26 } from "fs";
|
|
13351
|
+
import { dirname as dirname15, join as join33 } from "path";
|
|
13334
13352
|
import { promisify as promisify10 } from "util";
|
|
13335
13353
|
var execFileAsync9 = promisify10(execFile9);
|
|
13336
13354
|
var TIMEOUT_MS = 15e3;
|
|
13337
13355
|
function findOxfmtScript(root2) {
|
|
13338
13356
|
let dir = root2;
|
|
13339
13357
|
for (; ; ) {
|
|
13340
|
-
const candidate =
|
|
13341
|
-
if (
|
|
13358
|
+
const candidate = join33(dir, "node_modules", "oxfmt", "bin", "oxfmt");
|
|
13359
|
+
if (existsSync26(candidate)) return candidate;
|
|
13342
13360
|
const parent = dirname15(dir);
|
|
13343
13361
|
if (parent === dir) return void 0;
|
|
13344
13362
|
dir = parent;
|
|
@@ -13409,14 +13427,14 @@ async function writeFileContent(req, res) {
|
|
|
13409
13427
|
|
|
13410
13428
|
// src/shared/createBundleHandler.ts
|
|
13411
13429
|
import { createHash as createHash2 } from "crypto";
|
|
13412
|
-
import { readFileSync as readFileSync10, statSync as
|
|
13413
|
-
import { dirname as dirname16, join as
|
|
13430
|
+
import { readFileSync as readFileSync10, statSync as statSync7 } from "fs";
|
|
13431
|
+
import { dirname as dirname16, join as join34 } from "path";
|
|
13414
13432
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
13415
13433
|
function createBundleHandler(importMetaUrl, bundlePath, contentType = "application/javascript") {
|
|
13416
|
-
const file =
|
|
13434
|
+
const file = join34(dirname16(fileURLToPath3(importMetaUrl)), bundlePath);
|
|
13417
13435
|
let cache7;
|
|
13418
13436
|
return (req, res) => {
|
|
13419
|
-
const mtimeMs =
|
|
13437
|
+
const mtimeMs = statSync7(file).mtimeMs;
|
|
13420
13438
|
if (cache7?.mtimeMs !== mtimeMs) {
|
|
13421
13439
|
const body = readFileSync10(file);
|
|
13422
13440
|
const etag = `"${createHash2("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
@@ -13509,6 +13527,7 @@ var routes2 = {
|
|
|
13509
13527
|
"GET /api/daemon-log": daemonLogTail,
|
|
13510
13528
|
"GET /api/items": listItems,
|
|
13511
13529
|
"POST /api/items": postItem,
|
|
13530
|
+
"GET /api/note-repos": getNoteRepos,
|
|
13512
13531
|
"GET /api/backlog/summary": getBacklogSummary,
|
|
13513
13532
|
"GET /api/backlog/docs-refresh": getDocsRefresh,
|
|
13514
13533
|
"POST /api/backlog/docs-refresh": postDocsRefresh,
|
|
@@ -13853,9 +13872,9 @@ function originForCwd(cwd) {
|
|
|
13853
13872
|
}
|
|
13854
13873
|
|
|
13855
13874
|
// src/commands/sessions/daemon/repoDirExists.ts
|
|
13856
|
-
import { existsSync as
|
|
13875
|
+
import { existsSync as existsSync27 } from "fs";
|
|
13857
13876
|
function repoDirExists(cwd) {
|
|
13858
|
-
return
|
|
13877
|
+
return existsSync27(cwd);
|
|
13859
13878
|
}
|
|
13860
13879
|
|
|
13861
13880
|
// src/commands/sessions/daemon/worktree/git.ts
|
|
@@ -14358,17 +14377,17 @@ import * as path16 from "path";
|
|
|
14358
14377
|
import chalk21 from "chalk";
|
|
14359
14378
|
|
|
14360
14379
|
// src/commands/verify/addToKnipIgnoreBinaries.ts
|
|
14361
|
-
import { existsSync as
|
|
14362
|
-
import { join as
|
|
14380
|
+
import { existsSync as existsSync28, readFileSync as readFileSync12, writeFileSync as writeFileSync7 } from "fs";
|
|
14381
|
+
import { join as join35 } from "path";
|
|
14363
14382
|
import chalk20 from "chalk";
|
|
14364
14383
|
function loadKnipConfig(knipJsonPath) {
|
|
14365
|
-
if (
|
|
14384
|
+
if (existsSync28(knipJsonPath)) {
|
|
14366
14385
|
return JSON.parse(readFileSync12(knipJsonPath, "utf8"));
|
|
14367
14386
|
}
|
|
14368
14387
|
return { $schema: "https://unpkg.com/knip@5/schema.json" };
|
|
14369
14388
|
}
|
|
14370
14389
|
function addToKnipIgnoreBinaries(cwd, binary) {
|
|
14371
|
-
const knipJsonPath =
|
|
14390
|
+
const knipJsonPath = join35(cwd, "knip.json");
|
|
14372
14391
|
try {
|
|
14373
14392
|
const knipConfig = loadKnipConfig(knipJsonPath);
|
|
14374
14393
|
const ignoreBinaries = knipConfig.ignoreBinaries ?? [];
|
|
@@ -14415,7 +14434,7 @@ import * as path18 from "path";
|
|
|
14415
14434
|
import chalk26 from "chalk";
|
|
14416
14435
|
|
|
14417
14436
|
// src/commands/format/init.ts
|
|
14418
|
-
import { existsSync as
|
|
14437
|
+
import { existsSync as existsSync29, readFileSync as readFileSync13, writeFileSync as writeFileSync8 } from "fs";
|
|
14419
14438
|
import chalk24 from "chalk";
|
|
14420
14439
|
|
|
14421
14440
|
// src/shared/promptConfirm.ts
|
|
@@ -14477,7 +14496,7 @@ async function init() {
|
|
|
14477
14496
|
const newContent = `${JSON.stringify(oxfmtrc_template_default, null, " ")}
|
|
14478
14497
|
`;
|
|
14479
14498
|
const configPath = ".oxfmtrc.json";
|
|
14480
|
-
const oldContent =
|
|
14499
|
+
const oldContent = existsSync29(configPath) ? readFileSync13(configPath, "utf8") : "";
|
|
14481
14500
|
if (oldContent === newContent) {
|
|
14482
14501
|
console.log(".oxfmtrc.json already has the baseline formatter config");
|
|
14483
14502
|
return;
|
|
@@ -14500,15 +14519,15 @@ async function init() {
|
|
|
14500
14519
|
}
|
|
14501
14520
|
|
|
14502
14521
|
// src/commands/lint/init.ts
|
|
14503
|
-
import { existsSync as
|
|
14522
|
+
import { existsSync as existsSync32, readFileSync as readFileSync15, writeFileSync as writeFileSync10 } from "fs";
|
|
14504
14523
|
import chalk25 from "chalk";
|
|
14505
14524
|
|
|
14506
14525
|
// src/shared/removeEslint.ts
|
|
14507
14526
|
import { execSync as execSync7 } from "child_process";
|
|
14508
|
-
import { existsSync as
|
|
14527
|
+
import { existsSync as existsSync31, readFileSync as readFileSync14, writeFileSync as writeFileSync9 } from "fs";
|
|
14509
14528
|
|
|
14510
14529
|
// src/shared/removeEslint/removeEslintConfigFiles.ts
|
|
14511
|
-
import { existsSync as
|
|
14530
|
+
import { existsSync as existsSync30, unlinkSync as unlinkSync2 } from "fs";
|
|
14512
14531
|
var ESLINT_CONFIG_FILES = [
|
|
14513
14532
|
"eslint.config.js",
|
|
14514
14533
|
"eslint.config.mjs",
|
|
@@ -14524,7 +14543,7 @@ var ESLINT_CONFIG_FILES = [
|
|
|
14524
14543
|
function removeEslintConfigFiles() {
|
|
14525
14544
|
let removed = false;
|
|
14526
14545
|
for (const configFile of ESLINT_CONFIG_FILES) {
|
|
14527
|
-
if (
|
|
14546
|
+
if (existsSync30(configFile)) {
|
|
14528
14547
|
unlinkSync2(configFile);
|
|
14529
14548
|
console.log(`Removed ${configFile}`);
|
|
14530
14549
|
removed = true;
|
|
@@ -14546,7 +14565,7 @@ function removeEslint(options2 = {}) {
|
|
|
14546
14565
|
}
|
|
14547
14566
|
function removeEslintFromPackageJson(options2) {
|
|
14548
14567
|
const packageJsonPath = "package.json";
|
|
14549
|
-
if (!
|
|
14568
|
+
if (!existsSync31(packageJsonPath)) {
|
|
14550
14569
|
return false;
|
|
14551
14570
|
}
|
|
14552
14571
|
const packageJson = JSON.parse(readFileSync14(packageJsonPath, "utf8"));
|
|
@@ -14613,7 +14632,7 @@ async function writeOxlintConfig() {
|
|
|
14613
14632
|
const newContent = `${JSON.stringify(oxlintrc_template_default, null, " ")}
|
|
14614
14633
|
`;
|
|
14615
14634
|
const configPath = ".oxlintrc.json";
|
|
14616
|
-
const oldContent =
|
|
14635
|
+
const oldContent = existsSync32(configPath) ? readFileSync15(configPath, "utf8") : "";
|
|
14617
14636
|
if (oldContent === newContent) {
|
|
14618
14637
|
console.log(".oxlintrc.json already has the baseline linter config");
|
|
14619
14638
|
return;
|
|
@@ -15394,7 +15413,7 @@ async function newCli() {
|
|
|
15394
15413
|
|
|
15395
15414
|
// src/commands/new/registerNew/newProject.ts
|
|
15396
15415
|
import { execSync as execSync14 } from "child_process";
|
|
15397
|
-
import { existsSync as
|
|
15416
|
+
import { existsSync as existsSync37, readFileSync as readFileSync19, writeFileSync as writeFileSync17 } from "fs";
|
|
15398
15417
|
|
|
15399
15418
|
// src/commands/deploy/init.ts
|
|
15400
15419
|
import { execSync as execSync13 } from "child_process";
|
|
@@ -15402,14 +15421,14 @@ import chalk36 from "chalk";
|
|
|
15402
15421
|
import enquirer3 from "enquirer";
|
|
15403
15422
|
|
|
15404
15423
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
15405
|
-
import { existsSync as
|
|
15406
|
-
import { dirname as dirname24, join as
|
|
15424
|
+
import { existsSync as existsSync36, mkdirSync as mkdirSync9, readFileSync as readFileSync18, writeFileSync as writeFileSync16 } from "fs";
|
|
15425
|
+
import { dirname as dirname24, join as join42 } from "path";
|
|
15407
15426
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
15408
15427
|
import chalk35 from "chalk";
|
|
15409
15428
|
var WORKFLOW_PATH = ".github/workflows/build.yml";
|
|
15410
15429
|
var __dirname3 = dirname24(fileURLToPath4(import.meta.url));
|
|
15411
15430
|
function getExistingSiteId() {
|
|
15412
|
-
if (!
|
|
15431
|
+
if (!existsSync36(WORKFLOW_PATH)) {
|
|
15413
15432
|
return null;
|
|
15414
15433
|
}
|
|
15415
15434
|
const content = readFileSync18(WORKFLOW_PATH, "utf8");
|
|
@@ -15417,17 +15436,17 @@ function getExistingSiteId() {
|
|
|
15417
15436
|
return match ? match[1] : null;
|
|
15418
15437
|
}
|
|
15419
15438
|
function getTemplateContent(siteId) {
|
|
15420
|
-
const templatePath =
|
|
15439
|
+
const templatePath = join42(__dirname3, "commands/deploy/build.yml");
|
|
15421
15440
|
const template = readFileSync18(templatePath, "utf8");
|
|
15422
15441
|
return template.replace("{{NETLIFY_SITE_ID}}", siteId);
|
|
15423
15442
|
}
|
|
15424
15443
|
async function updateWorkflow(siteId) {
|
|
15425
15444
|
const newContent = getTemplateContent(siteId);
|
|
15426
15445
|
const workflowDir = ".github/workflows";
|
|
15427
|
-
if (!
|
|
15446
|
+
if (!existsSync36(workflowDir)) {
|
|
15428
15447
|
mkdirSync9(workflowDir, { recursive: true });
|
|
15429
15448
|
}
|
|
15430
|
-
if (
|
|
15449
|
+
if (existsSync36(WORKFLOW_PATH)) {
|
|
15431
15450
|
const oldContent = readFileSync18(WORKFLOW_PATH, "utf8");
|
|
15432
15451
|
if (oldContent === newContent) {
|
|
15433
15452
|
console.log(chalk35.green("build.yml is already up to date"));
|
|
@@ -15522,7 +15541,7 @@ async function newProject() {
|
|
|
15522
15541
|
}
|
|
15523
15542
|
function addViteBaseConfig() {
|
|
15524
15543
|
const viteConfigPath = "vite.config.ts";
|
|
15525
|
-
if (!
|
|
15544
|
+
if (!existsSync37(viteConfigPath)) {
|
|
15526
15545
|
console.log("No vite.config.ts found, skipping base config");
|
|
15527
15546
|
return;
|
|
15528
15547
|
}
|
|
@@ -15724,18 +15743,18 @@ function adviceContextFor(cwd, env = process.env) {
|
|
|
15724
15743
|
}
|
|
15725
15744
|
|
|
15726
15745
|
// src/commands/advise/loadAdviceFragments.ts
|
|
15727
|
-
import { readdirSync as
|
|
15728
|
-
import { basename as basename12, join as
|
|
15746
|
+
import { readdirSync as readdirSync7, readFileSync as readFileSync20 } from "fs";
|
|
15747
|
+
import { basename as basename12, join as join44 } from "path";
|
|
15729
15748
|
|
|
15730
15749
|
// src/commands/advise/adviceDir.ts
|
|
15731
|
-
import { existsSync as
|
|
15732
|
-
import { dirname as dirname25, join as
|
|
15750
|
+
import { existsSync as existsSync38 } from "fs";
|
|
15751
|
+
import { dirname as dirname25, join as join43 } from "path";
|
|
15733
15752
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
15734
15753
|
function adviceDir() {
|
|
15735
15754
|
let current = dirname25(fileURLToPath5(import.meta.url));
|
|
15736
15755
|
while (current !== dirname25(current)) {
|
|
15737
|
-
const candidate =
|
|
15738
|
-
if (
|
|
15756
|
+
const candidate = join43(current, "claude", "advice");
|
|
15757
|
+
if (existsSync38(candidate)) return candidate;
|
|
15739
15758
|
current = dirname25(current);
|
|
15740
15759
|
}
|
|
15741
15760
|
throw new Error("Could not locate the shipped claude/advice directory");
|
|
@@ -15764,10 +15783,10 @@ function parseAdviceFragment(name, content) {
|
|
|
15764
15783
|
|
|
15765
15784
|
// src/commands/advise/loadAdviceFragments.ts
|
|
15766
15785
|
function loadAdviceFragments(dir = adviceDir()) {
|
|
15767
|
-
return
|
|
15786
|
+
return readdirSync7(dir).filter((file) => file.endsWith(".md")).sort().map(
|
|
15768
15787
|
(file) => parseAdviceFragment(
|
|
15769
15788
|
basename12(file, ".md"),
|
|
15770
|
-
readFileSync20(
|
|
15789
|
+
readFileSync20(join44(dir, file), "utf8")
|
|
15771
15790
|
)
|
|
15772
15791
|
);
|
|
15773
15792
|
}
|
|
@@ -15801,13 +15820,13 @@ function renderAdviceBody(fragment, context) {
|
|
|
15801
15820
|
}
|
|
15802
15821
|
|
|
15803
15822
|
// src/commands/advise/adviceConditions.ts
|
|
15804
|
-
import { existsSync as
|
|
15805
|
-
import { join as
|
|
15823
|
+
import { existsSync as existsSync39 } from "fs";
|
|
15824
|
+
import { join as join45 } from "path";
|
|
15806
15825
|
function repoFile(file, label) {
|
|
15807
15826
|
return {
|
|
15808
15827
|
whenMet: `the repo has ${label}`,
|
|
15809
15828
|
whenUnmet: `the repo has no ${label}`,
|
|
15810
|
-
matches: ({ rootDir }) =>
|
|
15829
|
+
matches: ({ rootDir }) => existsSync39(join45(rootDir, file))
|
|
15811
15830
|
};
|
|
15812
15831
|
}
|
|
15813
15832
|
var adviceConditions = {
|
|
@@ -15833,11 +15852,11 @@ var adviceConditions = {
|
|
|
15833
15852
|
},
|
|
15834
15853
|
typescript: repoFile("tsconfig.json", "a tsconfig.json"),
|
|
15835
15854
|
filenameConvention: repoFile(
|
|
15836
|
-
|
|
15855
|
+
join45("oxlint-rules", "filenameConvention.ts"),
|
|
15837
15856
|
"oxlint-rules/filenameConvention.ts"
|
|
15838
15857
|
),
|
|
15839
15858
|
claudeSettings: repoFile(
|
|
15840
|
-
|
|
15859
|
+
join45("claude", "settings.json"),
|
|
15841
15860
|
"claude/settings.json"
|
|
15842
15861
|
),
|
|
15843
15862
|
verify: {
|
|
@@ -16717,7 +16736,7 @@ function registerAskQuestion(program) {
|
|
|
16717
16736
|
|
|
16718
16737
|
// src/commands/registerBackup.ts
|
|
16719
16738
|
import { mkdir as mkdir3, stat as stat4 } from "fs/promises";
|
|
16720
|
-
import { join as
|
|
16739
|
+
import { join as join47, resolve as resolve15 } from "path";
|
|
16721
16740
|
import chalk41 from "chalk";
|
|
16722
16741
|
|
|
16723
16742
|
// src/shared/db/recordBackup.ts
|
|
@@ -16731,7 +16750,7 @@ async function recordBackup(db, {
|
|
|
16731
16750
|
|
|
16732
16751
|
// src/commands/backup/scheduleBackup.ts
|
|
16733
16752
|
import { mkdir as mkdir2 } from "fs/promises";
|
|
16734
|
-
import { join as
|
|
16753
|
+
import { join as join46 } from "path";
|
|
16735
16754
|
import chalk39 from "chalk";
|
|
16736
16755
|
|
|
16737
16756
|
// src/commands/backup/readCrontab.ts
|
|
@@ -16873,7 +16892,7 @@ async function scheduleBackup({
|
|
|
16873
16892
|
const cronExpr = durationToCron(every);
|
|
16874
16893
|
const dir = expandTilde(loadConfig().backup.dir);
|
|
16875
16894
|
await mkdir2(dir, { recursive: true });
|
|
16876
|
-
const logPath2 =
|
|
16895
|
+
const logPath2 = join46(dir, "cron.log");
|
|
16877
16896
|
const cronLine = `${cronExpr} ${resolveAssistCommand()} backup >> ${logPath2} 2>&1`;
|
|
16878
16897
|
writeCrontab(upsertScheduleBlock(readCrontab(), every, cronLine));
|
|
16879
16898
|
console.error(
|
|
@@ -17052,7 +17071,7 @@ async function backup({ out }) {
|
|
|
17052
17071
|
await mkdir3(dir, { recursive: true });
|
|
17053
17072
|
const start2 = Date.now();
|
|
17054
17073
|
const timestamp9 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
17055
|
-
const filePath = resolve15(
|
|
17074
|
+
const filePath = resolve15(join47(dir, `backup-${timestamp9}.dump`));
|
|
17056
17075
|
await exportBacklog(filePath);
|
|
17057
17076
|
const { size } = await stat4(filePath);
|
|
17058
17077
|
const durationMs = Date.now() - start2;
|
|
@@ -17563,7 +17582,7 @@ function registerAssociateJiraCommand(cmd) {
|
|
|
17563
17582
|
|
|
17564
17583
|
// src/commands/backlog/cloneRepo.ts
|
|
17565
17584
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
17566
|
-
import { existsSync as
|
|
17585
|
+
import { existsSync as existsSync41 } from "fs";
|
|
17567
17586
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
17568
17587
|
import chalk48 from "chalk";
|
|
17569
17588
|
|
|
@@ -17599,7 +17618,7 @@ async function cloneRepo(originRaw) {
|
|
|
17599
17618
|
if (!target) {
|
|
17600
17619
|
return fail3(`Could not derive a repository name from "${origin}".`);
|
|
17601
17620
|
}
|
|
17602
|
-
if (
|
|
17621
|
+
if (existsSync41(target)) {
|
|
17603
17622
|
return fail3(`Clone target already exists: ${target}`);
|
|
17604
17623
|
}
|
|
17605
17624
|
await mkdir4(baseDir, { recursive: true });
|
|
@@ -17950,7 +17969,7 @@ function ensureRemoteOrigin() {
|
|
|
17950
17969
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
17951
17970
|
import { mkdtempSync, readFileSync as readFileSync22, unlinkSync as unlinkSync3, writeFileSync as writeFileSync18 } from "fs";
|
|
17952
17971
|
import { tmpdir } from "os";
|
|
17953
|
-
import { join as
|
|
17972
|
+
import { join as join49 } from "path";
|
|
17954
17973
|
import enquirer4 from "enquirer";
|
|
17955
17974
|
async function promptType() {
|
|
17956
17975
|
const { type } = await enquirer4.prompt({
|
|
@@ -17990,8 +18009,8 @@ async function promptDescription() {
|
|
|
17990
18009
|
}
|
|
17991
18010
|
function openEditor() {
|
|
17992
18011
|
const editor = process.env.EDITOR || process.env.VISUAL || "vi";
|
|
17993
|
-
const dir = mkdtempSync(
|
|
17994
|
-
const filePath =
|
|
18012
|
+
const dir = mkdtempSync(join49(tmpdir(), "assist-"));
|
|
18013
|
+
const filePath = join49(dir, "description.md");
|
|
17995
18014
|
writeFileSync18(filePath, "");
|
|
17996
18015
|
const result = spawnSync5(editor, [filePath], { stdio: "inherit" });
|
|
17997
18016
|
if (result.status !== 0) {
|
|
@@ -18469,9 +18488,9 @@ async function findPredecessor(path109, token, startedAt) {
|
|
|
18469
18488
|
|
|
18470
18489
|
// src/commands/backlog/propose/proposalLedgerPath.ts
|
|
18471
18490
|
import { homedir as homedir14 } from "os";
|
|
18472
|
-
import { join as
|
|
18491
|
+
import { join as join50 } from "path";
|
|
18473
18492
|
function proposalLedgerPath(sessionId2) {
|
|
18474
|
-
return
|
|
18493
|
+
return join50(homedir14(), ".assist", "proposals", `session-${sessionId2}.json`);
|
|
18475
18494
|
}
|
|
18476
18495
|
|
|
18477
18496
|
// src/commands/backlog/propose/trackProposal.ts
|
|
@@ -18827,7 +18846,7 @@ import chalk69 from "chalk";
|
|
|
18827
18846
|
|
|
18828
18847
|
// src/shared/waitForIndexUnlocked.ts
|
|
18829
18848
|
import { execSync as execSync18 } from "child_process";
|
|
18830
|
-
import { existsSync as
|
|
18849
|
+
import { existsSync as existsSync42 } from "fs";
|
|
18831
18850
|
import { resolve as resolve16 } from "path";
|
|
18832
18851
|
var POLL_MS2 = 200;
|
|
18833
18852
|
function indexLockPath() {
|
|
@@ -18848,7 +18867,7 @@ function waitForIndexUnlocked(timeoutMs) {
|
|
|
18848
18867
|
const lock2 = indexLockPath();
|
|
18849
18868
|
if (!lock2) return true;
|
|
18850
18869
|
const deadline = Date.now() + timeoutMs;
|
|
18851
|
-
while (
|
|
18870
|
+
while (existsSync42(lock2)) {
|
|
18852
18871
|
if (Date.now() >= deadline) return false;
|
|
18853
18872
|
sleepSync(POLL_MS2);
|
|
18854
18873
|
}
|
|
@@ -18964,14 +18983,14 @@ function hasLocalChanges() {
|
|
|
18964
18983
|
|
|
18965
18984
|
// src/commands/backlog/acquireLock.ts
|
|
18966
18985
|
import {
|
|
18967
|
-
existsSync as
|
|
18986
|
+
existsSync as existsSync43,
|
|
18968
18987
|
mkdirSync as mkdirSync11,
|
|
18969
18988
|
readFileSync as readFileSync25,
|
|
18970
18989
|
unlinkSync as unlinkSync4,
|
|
18971
18990
|
writeFileSync as writeFileSync20
|
|
18972
18991
|
} from "fs";
|
|
18973
18992
|
import { homedir as homedir15 } from "os";
|
|
18974
|
-
import { join as
|
|
18993
|
+
import { join as join51 } from "path";
|
|
18975
18994
|
|
|
18976
18995
|
// src/commands/backlog/bootedAt.ts
|
|
18977
18996
|
import { uptime } from "os";
|
|
@@ -19007,10 +19026,10 @@ function isStaleLock(pid, timestamp9) {
|
|
|
19007
19026
|
|
|
19008
19027
|
// src/commands/backlog/acquireLock.ts
|
|
19009
19028
|
function getLocksDir() {
|
|
19010
|
-
return
|
|
19029
|
+
return join51(homedir15(), ".assist", "locks");
|
|
19011
19030
|
}
|
|
19012
19031
|
function getLockPath(itemId2) {
|
|
19013
|
-
return
|
|
19032
|
+
return join51(getLocksDir(), `lock-${itemId2}.json`);
|
|
19014
19033
|
}
|
|
19015
19034
|
function isProcessAlive(pid) {
|
|
19016
19035
|
try {
|
|
@@ -19022,7 +19041,7 @@ function isProcessAlive(pid) {
|
|
|
19022
19041
|
}
|
|
19023
19042
|
function foreignLockHolder(itemId2) {
|
|
19024
19043
|
const lockPath = getLockPath(itemId2);
|
|
19025
|
-
if (!
|
|
19044
|
+
if (!existsSync43(lockPath)) return null;
|
|
19026
19045
|
try {
|
|
19027
19046
|
const lock2 = JSON.parse(readFileSync25(lockPath, "utf8"));
|
|
19028
19047
|
if (typeof lock2.pid !== "number" || lock2.pid === process.pid) return null;
|
|
@@ -19507,14 +19526,14 @@ async function resumeDoneConversation({ item, resumeSessionId }, spawnOptions) {
|
|
|
19507
19526
|
}
|
|
19508
19527
|
|
|
19509
19528
|
// src/commands/backlog/consumePause.ts
|
|
19510
|
-
import { existsSync as
|
|
19529
|
+
import { existsSync as existsSync44, mkdirSync as mkdirSync13, unlinkSync as unlinkSync5, writeFileSync as writeFileSync22 } from "fs";
|
|
19511
19530
|
import { homedir as homedir16 } from "os";
|
|
19512
|
-
import { join as
|
|
19531
|
+
import { join as join52 } from "path";
|
|
19513
19532
|
function getControlsDir() {
|
|
19514
|
-
return
|
|
19533
|
+
return join52(homedir16(), ".assist", "controls");
|
|
19515
19534
|
}
|
|
19516
19535
|
function getPausePath(itemId2) {
|
|
19517
|
-
return
|
|
19536
|
+
return join52(getControlsDir(), `pause-${itemId2}.json`);
|
|
19518
19537
|
}
|
|
19519
19538
|
function requestPause(itemId2) {
|
|
19520
19539
|
mkdirSync13(getControlsDir(), { recursive: true });
|
|
@@ -19524,7 +19543,7 @@ function requestPause(itemId2) {
|
|
|
19524
19543
|
);
|
|
19525
19544
|
}
|
|
19526
19545
|
function isPausePending(itemId2) {
|
|
19527
|
-
return
|
|
19546
|
+
return existsSync44(getPausePath(itemId2));
|
|
19528
19547
|
}
|
|
19529
19548
|
function clearPause(itemId2) {
|
|
19530
19549
|
try {
|
|
@@ -19534,7 +19553,7 @@ function clearPause(itemId2) {
|
|
|
19534
19553
|
}
|
|
19535
19554
|
function consumePause(itemId2) {
|
|
19536
19555
|
const pausePath = getPausePath(itemId2);
|
|
19537
|
-
if (!
|
|
19556
|
+
if (!existsSync44(pausePath)) return false;
|
|
19538
19557
|
try {
|
|
19539
19558
|
unlinkSync5(pausePath);
|
|
19540
19559
|
} catch {
|
|
@@ -19786,13 +19805,13 @@ function spawnHarness(harness, prompt, options2 = {}) {
|
|
|
19786
19805
|
}
|
|
19787
19806
|
|
|
19788
19807
|
// src/commands/backlog/watchForMarker.ts
|
|
19789
|
-
import { existsSync as
|
|
19808
|
+
import { existsSync as existsSync46, unwatchFile, watchFile } from "fs";
|
|
19790
19809
|
|
|
19791
19810
|
// src/commands/backlog/readSignal.ts
|
|
19792
|
-
import { existsSync as
|
|
19811
|
+
import { existsSync as existsSync45, readFileSync as readFileSync26 } from "fs";
|
|
19793
19812
|
function readSignal() {
|
|
19794
19813
|
const path109 = getSignalPath();
|
|
19795
|
-
if (!path109 || !
|
|
19814
|
+
if (!path109 || !existsSync45(path109)) return void 0;
|
|
19796
19815
|
try {
|
|
19797
19816
|
return JSON.parse(readFileSync26(path109, "utf8"));
|
|
19798
19817
|
} catch {
|
|
@@ -19806,7 +19825,7 @@ function watchForMarker(child, options2) {
|
|
|
19806
19825
|
const statusPath = getSignalPath();
|
|
19807
19826
|
if (!statusPath) return { killedOnMarker: () => killed };
|
|
19808
19827
|
watchFile(statusPath, { interval: 1e3 }, () => {
|
|
19809
|
-
if (!
|
|
19828
|
+
if (!existsSync46(statusPath)) return;
|
|
19810
19829
|
const signal = readSignal();
|
|
19811
19830
|
if (!signal) return;
|
|
19812
19831
|
if (signal.event === "done" && !options2?.actOnDone) return;
|
|
@@ -19858,7 +19877,7 @@ function launchPhaseSession(item, phaseNumber, phase, phaseLabel2, claudeSession
|
|
|
19858
19877
|
}
|
|
19859
19878
|
|
|
19860
19879
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
19861
|
-
import { existsSync as
|
|
19880
|
+
import { existsSync as existsSync47, unlinkSync as unlinkSync6 } from "fs";
|
|
19862
19881
|
import chalk77 from "chalk";
|
|
19863
19882
|
|
|
19864
19883
|
// src/commands/backlog/handleIncompletePhase.ts
|
|
@@ -19880,7 +19899,7 @@ async function handleIncompletePhase() {
|
|
|
19880
19899
|
// src/commands/backlog/resolvePhaseResult.ts
|
|
19881
19900
|
function cleanupSignal() {
|
|
19882
19901
|
const statusPath = getSignalPath();
|
|
19883
|
-
if (statusPath &&
|
|
19902
|
+
if (statusPath && existsSync47(statusPath)) {
|
|
19884
19903
|
unlinkSync6(statusPath);
|
|
19885
19904
|
}
|
|
19886
19905
|
}
|
|
@@ -19891,7 +19910,7 @@ async function isTerminalStatus(itemId2) {
|
|
|
19891
19910
|
}
|
|
19892
19911
|
async function resolvePhaseResult(phaseIndex, itemId2) {
|
|
19893
19912
|
const signalPath = getSignalPath();
|
|
19894
|
-
if (!signalPath || !
|
|
19913
|
+
if (!signalPath || !existsSync47(signalPath)) {
|
|
19895
19914
|
if (await isTerminalStatus(itemId2)) return { kind: "abort" };
|
|
19896
19915
|
const action = await handleIncompletePhase();
|
|
19897
19916
|
if (action === "abort") return { kind: "abort" };
|
|
@@ -19972,7 +19991,7 @@ async function persistPhaseSessionId(itemId2, phaseIdx, claudeSessionId) {
|
|
|
19972
19991
|
// src/shared/emitActivity.ts
|
|
19973
19992
|
import { mkdirSync as mkdirSync14, readFileSync as readFileSync27, rmSync as rmSync4, writeFileSync as writeFileSync23 } from "fs";
|
|
19974
19993
|
import { homedir as homedir17 } from "os";
|
|
19975
|
-
import { dirname as dirname28, join as
|
|
19994
|
+
import { dirname as dirname28, join as join53 } from "path";
|
|
19976
19995
|
import { z as z16 } from "zod";
|
|
19977
19996
|
var activitySchema = z16.object({
|
|
19978
19997
|
kind: z16.enum(["command", "backlog"]),
|
|
@@ -19989,7 +20008,7 @@ var activitySchema = z16.object({
|
|
|
19989
20008
|
startedAt: z16.number()
|
|
19990
20009
|
});
|
|
19991
20010
|
function activityPath(sessionId2) {
|
|
19992
|
-
return
|
|
20011
|
+
return join53(homedir17(), ".assist", "activity", `activity-${sessionId2}.json`);
|
|
19993
20012
|
}
|
|
19994
20013
|
function emitActivity(activity2) {
|
|
19995
20014
|
const sessionId2 = process.env.ASSIST_ACTIVITY_ID;
|
|
@@ -22617,7 +22636,7 @@ function extractGraphqlQuery(args) {
|
|
|
22617
22636
|
}
|
|
22618
22637
|
|
|
22619
22638
|
// src/shared/loadCliReads.ts
|
|
22620
|
-
import { existsSync as
|
|
22639
|
+
import { existsSync as existsSync48, readFileSync as readFileSync29, writeFileSync as writeFileSync24 } from "fs";
|
|
22621
22640
|
import { dirname as dirname29, resolve as resolve17 } from "path";
|
|
22622
22641
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
22623
22642
|
var __filename3 = fileURLToPath6(import.meta.url);
|
|
@@ -22626,7 +22645,7 @@ function packageRoot() {
|
|
|
22626
22645
|
return __dirname4;
|
|
22627
22646
|
}
|
|
22628
22647
|
function readLines(path109) {
|
|
22629
|
-
if (!
|
|
22648
|
+
if (!existsSync48(path109)) return [];
|
|
22630
22649
|
return readFileSync29(path109, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
22631
22650
|
}
|
|
22632
22651
|
var cachedReads;
|
|
@@ -22673,14 +22692,14 @@ function findCliWrite(command) {
|
|
|
22673
22692
|
}
|
|
22674
22693
|
|
|
22675
22694
|
// src/shared/readSettingsPerms.ts
|
|
22676
|
-
import { existsSync as
|
|
22695
|
+
import { existsSync as existsSync49, readFileSync as readFileSync30 } from "fs";
|
|
22677
22696
|
import { homedir as homedir18 } from "os";
|
|
22678
|
-
import { join as
|
|
22697
|
+
import { join as join54 } from "path";
|
|
22679
22698
|
function readSettingsPerms(key) {
|
|
22680
22699
|
const paths = [
|
|
22681
|
-
|
|
22682
|
-
|
|
22683
|
-
|
|
22700
|
+
join54(homedir18(), ".claude", "settings.json"),
|
|
22701
|
+
join54(process.cwd(), ".claude", "settings.json"),
|
|
22702
|
+
join54(process.cwd(), ".claude", "settings.local.json")
|
|
22684
22703
|
];
|
|
22685
22704
|
const entries = [];
|
|
22686
22705
|
for (const p of paths) {
|
|
@@ -22689,7 +22708,7 @@ function readSettingsPerms(key) {
|
|
|
22689
22708
|
return entries;
|
|
22690
22709
|
}
|
|
22691
22710
|
function readPermissionArray(filePath, key) {
|
|
22692
|
-
if (!
|
|
22711
|
+
if (!existsSync49(filePath)) return [];
|
|
22693
22712
|
try {
|
|
22694
22713
|
const data = JSON.parse(readFileSync30(filePath, "utf8"));
|
|
22695
22714
|
const arr = data?.permissions?.[key];
|
|
@@ -23037,11 +23056,11 @@ function findSchemaPathDeny(toolName, rawCommand, root2 = getProjectRoot()) {
|
|
|
23037
23056
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
23038
23057
|
import { mkdirSync as mkdirSync15 } from "fs";
|
|
23039
23058
|
import { homedir as homedir19 } from "os";
|
|
23040
|
-
import { join as
|
|
23059
|
+
import { join as join55 } from "path";
|
|
23041
23060
|
import Database from "better-sqlite3";
|
|
23042
23061
|
var _db;
|
|
23043
23062
|
function getDbDir() {
|
|
23044
|
-
return
|
|
23063
|
+
return join55(homedir19(), ".assist");
|
|
23045
23064
|
}
|
|
23046
23065
|
function initSchema(db) {
|
|
23047
23066
|
db.exec(`
|
|
@@ -23060,7 +23079,7 @@ function openPromptsDb(dir) {
|
|
|
23060
23079
|
if (_db) return _db;
|
|
23061
23080
|
const dbDir = dir ?? getDbDir();
|
|
23062
23081
|
mkdirSync15(dbDir, { recursive: true });
|
|
23063
|
-
const db = new Database(
|
|
23082
|
+
const db = new Database(join55(dbDir, "assist.db"));
|
|
23064
23083
|
db.pragma("journal_mode = WAL");
|
|
23065
23084
|
initSchema(db);
|
|
23066
23085
|
_db = db;
|
|
@@ -23124,29 +23143,29 @@ function tryParseInput(raw) {
|
|
|
23124
23143
|
}
|
|
23125
23144
|
|
|
23126
23145
|
// src/commands/schema/isSchemaLocked.ts
|
|
23127
|
-
import { existsSync as
|
|
23146
|
+
import { existsSync as existsSync50 } from "fs";
|
|
23128
23147
|
|
|
23129
23148
|
// src/commands/schema/getSchemaSessionApprovalPath.ts
|
|
23130
|
-
import { join as
|
|
23149
|
+
import { join as join57 } from "path";
|
|
23131
23150
|
|
|
23132
23151
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
23133
23152
|
import { homedir as homedir20 } from "os";
|
|
23134
|
-
import { join as
|
|
23153
|
+
import { join as join56 } from "path";
|
|
23135
23154
|
function getRestrictedDir() {
|
|
23136
|
-
return
|
|
23155
|
+
return join56(homedir20(), ".assist", "restricted");
|
|
23137
23156
|
}
|
|
23138
23157
|
function getPinStatePath(pin2) {
|
|
23139
|
-
return
|
|
23158
|
+
return join56(getRestrictedDir(), `code-comment-${pin2}.json`);
|
|
23140
23159
|
}
|
|
23141
23160
|
|
|
23142
23161
|
// src/commands/schema/getSchemaSessionApprovalPath.ts
|
|
23143
23162
|
var SESSION_ID = /^[\w-]+$/;
|
|
23144
23163
|
function getSchemaSessionApprovalDir() {
|
|
23145
|
-
return
|
|
23164
|
+
return join57(getRestrictedDir(), "schema-sessions");
|
|
23146
23165
|
}
|
|
23147
23166
|
function getSchemaSessionApprovalPath(claudeSessionId) {
|
|
23148
23167
|
if (!SESSION_ID.test(claudeSessionId)) return void 0;
|
|
23149
|
-
return
|
|
23168
|
+
return join57(getSchemaSessionApprovalDir(), `${claudeSessionId}.json`);
|
|
23150
23169
|
}
|
|
23151
23170
|
|
|
23152
23171
|
// src/commands/schema/isSchemaLocked.ts
|
|
@@ -23154,7 +23173,7 @@ function hasSessionApproval() {
|
|
|
23154
23173
|
const claudeSessionId = process.env.CLAUDE_CODE_SESSION_ID;
|
|
23155
23174
|
if (!claudeSessionId) return false;
|
|
23156
23175
|
const path109 = getSchemaSessionApprovalPath(claudeSessionId);
|
|
23157
|
-
return path109 !== void 0 &&
|
|
23176
|
+
return path109 !== void 0 && existsSync50(path109);
|
|
23158
23177
|
}
|
|
23159
23178
|
async function isSchemaLocked() {
|
|
23160
23179
|
if (!process.env.CLAUDECODE) return false;
|
|
@@ -23243,9 +23262,9 @@ ${reasons.join("\n")}`);
|
|
|
23243
23262
|
}
|
|
23244
23263
|
|
|
23245
23264
|
// src/commands/permitCliReads.ts
|
|
23246
|
-
import { existsSync as
|
|
23265
|
+
import { existsSync as existsSync51, mkdirSync as mkdirSync16, readFileSync as readFileSync32, writeFileSync as writeFileSync25 } from "fs";
|
|
23247
23266
|
import { homedir as homedir21 } from "os";
|
|
23248
|
-
import { join as
|
|
23267
|
+
import { join as join58 } from "path";
|
|
23249
23268
|
|
|
23250
23269
|
// src/commands/permitCliReads/assertCliExists.ts
|
|
23251
23270
|
function assertCliExists(cli) {
|
|
@@ -23508,15 +23527,15 @@ function updateSettings(cli, commands) {
|
|
|
23508
23527
|
// src/commands/permitCliReads.ts
|
|
23509
23528
|
function logPath(cli) {
|
|
23510
23529
|
const safeName = cli.replace(/\s+/g, "-");
|
|
23511
|
-
return
|
|
23530
|
+
return join58(homedir21(), ".assist", `cli-discover-${safeName}.log`);
|
|
23512
23531
|
}
|
|
23513
23532
|
function readCache(cli) {
|
|
23514
23533
|
const path109 = logPath(cli);
|
|
23515
|
-
if (!
|
|
23534
|
+
if (!existsSync51(path109)) return void 0;
|
|
23516
23535
|
return readFileSync32(path109, "utf8");
|
|
23517
23536
|
}
|
|
23518
23537
|
function writeCache(cli, output) {
|
|
23519
|
-
const dir =
|
|
23538
|
+
const dir = join58(homedir21(), ".assist");
|
|
23520
23539
|
mkdirSync16(dir, { recursive: true });
|
|
23521
23540
|
writeFileSync25(logPath(cli), output);
|
|
23522
23541
|
}
|
|
@@ -23648,7 +23667,7 @@ function registerCliHook(program) {
|
|
|
23648
23667
|
}
|
|
23649
23668
|
|
|
23650
23669
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
23651
|
-
import { existsSync as
|
|
23670
|
+
import { existsSync as existsSync53, readFileSync as readFileSync34, unlinkSync as unlinkSync8, writeFileSync as writeFileSync26 } from "fs";
|
|
23652
23671
|
import chalk120 from "chalk";
|
|
23653
23672
|
|
|
23654
23673
|
// src/shared/isHashCommentFile.ts
|
|
@@ -23681,21 +23700,21 @@ function isHashCommentFile(filePath) {
|
|
|
23681
23700
|
}
|
|
23682
23701
|
|
|
23683
23702
|
// src/commands/codeComment/sweepRestrictedDir.ts
|
|
23684
|
-
import { readdirSync as
|
|
23685
|
-
import { join as
|
|
23703
|
+
import { readdirSync as readdirSync9, statSync as statSync8, unlinkSync as unlinkSync7 } from "fs";
|
|
23704
|
+
import { join as join59 } from "path";
|
|
23686
23705
|
var STALE_AFTER_MS = 30 * 60 * 1e3;
|
|
23687
23706
|
function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
23688
23707
|
let entries;
|
|
23689
23708
|
try {
|
|
23690
|
-
entries =
|
|
23709
|
+
entries = readdirSync9(dir);
|
|
23691
23710
|
} catch {
|
|
23692
23711
|
return;
|
|
23693
23712
|
}
|
|
23694
23713
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
23695
23714
|
for (const entry of entries) {
|
|
23696
|
-
const path109 =
|
|
23715
|
+
const path109 = join59(dir, entry);
|
|
23697
23716
|
try {
|
|
23698
|
-
if (
|
|
23717
|
+
if (statSync8(path109).mtimeMs < cutoff) unlinkSync7(path109);
|
|
23699
23718
|
} catch {
|
|
23700
23719
|
continue;
|
|
23701
23720
|
}
|
|
@@ -23703,10 +23722,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
23703
23722
|
}
|
|
23704
23723
|
|
|
23705
23724
|
// src/commands/codeComment/readPinState.ts
|
|
23706
|
-
import { existsSync as
|
|
23725
|
+
import { existsSync as existsSync52, readFileSync as readFileSync33 } from "fs";
|
|
23707
23726
|
function readPinState(pin2) {
|
|
23708
23727
|
const path109 = getPinStatePath(pin2);
|
|
23709
|
-
if (!
|
|
23728
|
+
if (!existsSync52(path109)) return void 0;
|
|
23710
23729
|
try {
|
|
23711
23730
|
const state = JSON.parse(readFileSync33(path109, "utf8"));
|
|
23712
23731
|
if (state.pin !== pin2) return void 0;
|
|
@@ -23725,7 +23744,7 @@ function codeCommentConfirm(pin2) {
|
|
|
23725
23744
|
process.exitCode = 1;
|
|
23726
23745
|
return;
|
|
23727
23746
|
}
|
|
23728
|
-
if (!
|
|
23747
|
+
if (!existsSync53(state.file)) {
|
|
23729
23748
|
console.error(chalk120.red(`Target file no longer exists: ${state.file}`));
|
|
23730
23749
|
process.exitCode = 1;
|
|
23731
23750
|
return;
|
|
@@ -25960,11 +25979,11 @@ import { dirname as dirname30 } from "path";
|
|
|
25960
25979
|
|
|
25961
25980
|
// src/commands/browser/snapshotPath.ts
|
|
25962
25981
|
import { homedir as homedir22 } from "os";
|
|
25963
|
-
import { join as
|
|
25982
|
+
import { join as join60 } from "path";
|
|
25964
25983
|
function snapshotPath(tabUrl, now) {
|
|
25965
25984
|
const host = new URL(tabUrl).host.replace(/[^\w.-]/g, "-");
|
|
25966
25985
|
const timestamp9 = now.toISOString().replace(/[:.]/g, "-");
|
|
25967
|
-
return
|
|
25986
|
+
return join60(homedir22(), ".assist", "browser", `${host}-${timestamp9}.html`);
|
|
25968
25987
|
}
|
|
25969
25988
|
|
|
25970
25989
|
// src/commands/browser/browserSnapshot.ts
|
|
@@ -26171,28 +26190,28 @@ async function printExtensionUrl() {
|
|
|
26171
26190
|
// src/commands/extension/signExtension.ts
|
|
26172
26191
|
import { rm as rm2 } from "fs/promises";
|
|
26173
26192
|
import { homedir as homedir23, tmpdir as tmpdir3 } from "os";
|
|
26174
|
-
import { join as
|
|
26193
|
+
import { join as join66 } from "path";
|
|
26175
26194
|
import chalk154 from "chalk";
|
|
26176
26195
|
|
|
26177
26196
|
// src/commands/extension/copySignedXpi.ts
|
|
26178
26197
|
import { copyFile } from "fs/promises";
|
|
26179
|
-
import { join as
|
|
26198
|
+
import { join as join61 } from "path";
|
|
26180
26199
|
var SIGNED_XPI_NAME = "assist-extension.xpi";
|
|
26181
26200
|
async function copySignedXpi(xpi, dir) {
|
|
26182
|
-
const fixed2 =
|
|
26201
|
+
const fixed2 = join61(dir, SIGNED_XPI_NAME);
|
|
26183
26202
|
if (fixed2 === xpi) return fixed2;
|
|
26184
26203
|
await copyFile(xpi, fixed2);
|
|
26185
26204
|
return fixed2;
|
|
26186
26205
|
}
|
|
26187
26206
|
|
|
26188
26207
|
// src/commands/extension/findSignedXpi.ts
|
|
26189
|
-
import { existsSync as
|
|
26208
|
+
import { existsSync as existsSync54 } from "fs";
|
|
26190
26209
|
import { readdir } from "fs/promises";
|
|
26191
|
-
import { join as
|
|
26210
|
+
import { join as join62 } from "path";
|
|
26192
26211
|
async function findSignedXpi(dir) {
|
|
26193
|
-
if (!
|
|
26212
|
+
if (!existsSync54(dir)) return null;
|
|
26194
26213
|
const name = (await readdir(dir)).find((entry) => entry.endsWith(".xpi"));
|
|
26195
|
-
return name ?
|
|
26214
|
+
return name ? join62(dir, name) : null;
|
|
26196
26215
|
}
|
|
26197
26216
|
|
|
26198
26217
|
// src/commands/extension/signedAddonInstallPath.ts
|
|
@@ -26214,11 +26233,11 @@ async function signedAddonInstallPath(xpi) {
|
|
|
26214
26233
|
}
|
|
26215
26234
|
|
|
26216
26235
|
// src/commands/extension/signPreflightProblem.ts
|
|
26217
|
-
import { existsSync as
|
|
26218
|
-
import { join as
|
|
26236
|
+
import { existsSync as existsSync55 } from "fs";
|
|
26237
|
+
import { join as join63 } from "path";
|
|
26219
26238
|
var KEY_URL = "https://addons.mozilla.org/en-US/developers/addon/api/key/";
|
|
26220
26239
|
function signPreflightProblem(source) {
|
|
26221
|
-
if (!
|
|
26240
|
+
if (!existsSync55(join63(source, "content.js")))
|
|
26222
26241
|
return {
|
|
26223
26242
|
message: `no content.js in ${source}`,
|
|
26224
26243
|
hint: "run npm run build to bundle the content script"
|
|
@@ -26233,7 +26252,7 @@ function signPreflightProblem(source) {
|
|
|
26233
26252
|
|
|
26234
26253
|
// src/commands/extension/stageExtension.ts
|
|
26235
26254
|
import { cp as cp3, mkdir as mkdir5, readFile as readFile5, rm, writeFile as writeFile4 } from "fs/promises";
|
|
26236
|
-
import { basename as basename16, join as
|
|
26255
|
+
import { basename as basename16, join as join64 } from "path";
|
|
26237
26256
|
|
|
26238
26257
|
// src/commands/extension/stampManifestVersion.ts
|
|
26239
26258
|
function stampManifestVersion(manifest, version2) {
|
|
@@ -26250,7 +26269,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
26250
26269
|
recursive: true,
|
|
26251
26270
|
filter: (path109) => basename16(path109) !== "updates.json"
|
|
26252
26271
|
});
|
|
26253
|
-
const manifest =
|
|
26272
|
+
const manifest = join64(staging, "manifest.json");
|
|
26254
26273
|
const stamped = stampManifestVersion(
|
|
26255
26274
|
await readFile5(manifest, "utf8"),
|
|
26256
26275
|
version2
|
|
@@ -26260,7 +26279,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
26260
26279
|
|
|
26261
26280
|
// src/commands/extension/writeUpdateManifest.ts
|
|
26262
26281
|
import { readFile as readFile6, writeFile as writeFile5 } from "fs/promises";
|
|
26263
|
-
import { join as
|
|
26282
|
+
import { join as join65 } from "path";
|
|
26264
26283
|
|
|
26265
26284
|
// src/commands/extension/buildUpdateManifest.ts
|
|
26266
26285
|
var RELEASE_DOWNLOAD_URL = "https://github.com/staff0rd/assist/releases/download";
|
|
@@ -26285,17 +26304,17 @@ function buildUpdateManifest(manifest, version2) {
|
|
|
26285
26304
|
// src/commands/extension/writeUpdateManifest.ts
|
|
26286
26305
|
async function writeUpdateManifest(source, dir, version2) {
|
|
26287
26306
|
await writeFile5(
|
|
26288
|
-
|
|
26307
|
+
join65(dir, "updates.json"),
|
|
26289
26308
|
buildUpdateManifest(
|
|
26290
|
-
await readFile6(
|
|
26309
|
+
await readFile6(join65(source, "manifest.json"), "utf8"),
|
|
26291
26310
|
version2
|
|
26292
26311
|
)
|
|
26293
26312
|
);
|
|
26294
26313
|
}
|
|
26295
26314
|
|
|
26296
26315
|
// src/commands/extension/signExtension.ts
|
|
26297
|
-
var ARTIFACTS_DIR =
|
|
26298
|
-
var STAGING_DIR =
|
|
26316
|
+
var ARTIFACTS_DIR = join66(homedir23(), ".assist", "extension");
|
|
26317
|
+
var STAGING_DIR = join66(tmpdir3(), "assist-extension");
|
|
26299
26318
|
async function signExtension() {
|
|
26300
26319
|
const source = extensionDir();
|
|
26301
26320
|
const problem = signPreflightProblem(source);
|
|
@@ -26479,7 +26498,7 @@ function registerDb(program) {
|
|
|
26479
26498
|
}
|
|
26480
26499
|
|
|
26481
26500
|
// src/commands/deploy/redirect.ts
|
|
26482
|
-
import { existsSync as
|
|
26501
|
+
import { existsSync as existsSync56, readFileSync as readFileSync36, writeFileSync as writeFileSync29 } from "fs";
|
|
26483
26502
|
import chalk157 from "chalk";
|
|
26484
26503
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
26485
26504
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -26488,7 +26507,7 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
26488
26507
|
</script>`;
|
|
26489
26508
|
function redirect() {
|
|
26490
26509
|
const indexPath = "index.html";
|
|
26491
|
-
if (!
|
|
26510
|
+
if (!existsSync56(indexPath)) {
|
|
26492
26511
|
console.log(chalk157.yellow("No index.html found"));
|
|
26493
26512
|
return;
|
|
26494
26513
|
}
|
|
@@ -26584,10 +26603,10 @@ function printWeekHeader(week, state) {
|
|
|
26584
26603
|
|
|
26585
26604
|
// src/commands/devlog/loadBlogSkipWeeks.ts
|
|
26586
26605
|
import { homedir as homedir24 } from "os";
|
|
26587
|
-
import { join as
|
|
26588
|
-
var BLOG_REPO_ROOT =
|
|
26606
|
+
import { join as join67 } from "path";
|
|
26607
|
+
var BLOG_REPO_ROOT = join67(homedir24(), "git/blog");
|
|
26589
26608
|
function loadBlogSkipWeeks(repoName) {
|
|
26590
|
-
const config = loadRawYaml(
|
|
26609
|
+
const config = loadRawYaml(join67(BLOG_REPO_ROOT, "assist.yml"));
|
|
26591
26610
|
const devlog = config.devlog;
|
|
26592
26611
|
const skip3 = devlog?.skip;
|
|
26593
26612
|
return new Set(skip3?.[repoName]);
|
|
@@ -26595,13 +26614,13 @@ function loadBlogSkipWeeks(repoName) {
|
|
|
26595
26614
|
|
|
26596
26615
|
// src/commands/devlog/loadDevEntry.ts
|
|
26597
26616
|
import { readFileSync as readFileSync37 } from "fs";
|
|
26598
|
-
import { join as
|
|
26617
|
+
import { join as join69 } from "path";
|
|
26599
26618
|
import { parse as parseYaml3 } from "yaml";
|
|
26600
26619
|
|
|
26601
26620
|
// src/commands/devlog/loadDevWeeks.ts
|
|
26602
|
-
import { readdirSync as
|
|
26603
|
-
import { join as
|
|
26604
|
-
var DEV_DIR =
|
|
26621
|
+
import { readdirSync as readdirSync10 } from "fs";
|
|
26622
|
+
import { join as join68 } from "path";
|
|
26623
|
+
var DEV_DIR = join68(BLOG_REPO_ROOT, "src/content/dev");
|
|
26605
26624
|
var DEV_FILENAME_PATTERN = /^(\d{4})-w(\d{2})\.md$/;
|
|
26606
26625
|
function parseDevWeekFilename(filename) {
|
|
26607
26626
|
const match = filename.match(DEV_FILENAME_PATTERN);
|
|
@@ -26609,13 +26628,13 @@ function parseDevWeekFilename(filename) {
|
|
|
26609
26628
|
}
|
|
26610
26629
|
function readFilenames(dir) {
|
|
26611
26630
|
try {
|
|
26612
|
-
return
|
|
26631
|
+
return readdirSync10(dir);
|
|
26613
26632
|
} catch {
|
|
26614
26633
|
return [];
|
|
26615
26634
|
}
|
|
26616
26635
|
}
|
|
26617
26636
|
function loadDevWeeks(repoName, devDir = DEV_DIR) {
|
|
26618
|
-
return readFilenames(
|
|
26637
|
+
return readFilenames(join68(devDir, repoName)).map(parseDevWeekFilename).filter((week) => week !== null).sort();
|
|
26619
26638
|
}
|
|
26620
26639
|
|
|
26621
26640
|
// src/commands/devlog/loadDevEntry.ts
|
|
@@ -26631,7 +26650,7 @@ function readFrontmatter(path109) {
|
|
|
26631
26650
|
}
|
|
26632
26651
|
}
|
|
26633
26652
|
function loadDevEntry(repoName, week, devDir = DEV_DIR) {
|
|
26634
|
-
const path109 =
|
|
26653
|
+
const path109 = join69(devDir, repoName, `${week.toLowerCase()}.md`);
|
|
26635
26654
|
const frontmatter2 = readFrontmatter(path109);
|
|
26636
26655
|
if (!frontmatter2) return null;
|
|
26637
26656
|
const versions = frontmatter2.versions;
|
|
@@ -26715,15 +26734,15 @@ function findTargetWeek(weeks, { lastWeek, skip: skip3, today }) {
|
|
|
26715
26734
|
import chalk159 from "chalk";
|
|
26716
26735
|
|
|
26717
26736
|
// src/shared/getRepoName.ts
|
|
26718
|
-
import { existsSync as
|
|
26719
|
-
import { basename as basename17, join as
|
|
26737
|
+
import { existsSync as existsSync57, readFileSync as readFileSync38 } from "fs";
|
|
26738
|
+
import { basename as basename17, join as join70 } from "path";
|
|
26720
26739
|
function getRepoName() {
|
|
26721
26740
|
const config = loadConfig();
|
|
26722
26741
|
if (config.devlog?.name) {
|
|
26723
26742
|
return config.devlog.name;
|
|
26724
26743
|
}
|
|
26725
|
-
const packageJsonPath =
|
|
26726
|
-
if (
|
|
26744
|
+
const packageJsonPath = join70(process.cwd(), "package.json");
|
|
26745
|
+
if (existsSync57(packageJsonPath)) {
|
|
26727
26746
|
try {
|
|
26728
26747
|
const content = readFileSync38(packageJsonPath, "utf8");
|
|
26729
26748
|
const pkg = JSON.parse(content);
|
|
@@ -26914,11 +26933,11 @@ function next2(options2) {
|
|
|
26914
26933
|
|
|
26915
26934
|
// src/commands/devlog/skip.ts
|
|
26916
26935
|
import { writeFileSync as writeFileSync30 } from "fs";
|
|
26917
|
-
import { join as
|
|
26936
|
+
import { join as join71 } from "path";
|
|
26918
26937
|
import chalk162 from "chalk";
|
|
26919
26938
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
26920
26939
|
function getBlogConfigPath() {
|
|
26921
|
-
return
|
|
26940
|
+
return join71(BLOG_REPO_ROOT, "assist.yml");
|
|
26922
26941
|
}
|
|
26923
26942
|
function skip2(week) {
|
|
26924
26943
|
if (!isValidWeek(week)) {
|
|
@@ -26948,7 +26967,7 @@ function skip2(week) {
|
|
|
26948
26967
|
|
|
26949
26968
|
// src/commands/devlog/write.ts
|
|
26950
26969
|
import { mkdirSync as mkdirSync19, writeFileSync as writeFileSync31 } from "fs";
|
|
26951
|
-
import { dirname as dirname31, join as
|
|
26970
|
+
import { dirname as dirname31, join as join72 } from "path";
|
|
26952
26971
|
import chalk163 from "chalk";
|
|
26953
26972
|
|
|
26954
26973
|
// src/commands/devlog/write/devEntryInputSchema.ts
|
|
@@ -27040,7 +27059,7 @@ async function write() {
|
|
|
27040
27059
|
process.exit(1);
|
|
27041
27060
|
}
|
|
27042
27061
|
const repoName = getRepoName();
|
|
27043
|
-
const path109 =
|
|
27062
|
+
const path109 = join72(DEV_DIR, repoName, `${result.data.week.toLowerCase()}.md`);
|
|
27044
27063
|
mkdirSync19(dirname31(path109), { recursive: true });
|
|
27045
27064
|
writeFileSync31(path109, formatDevEntry(repoName, result.data));
|
|
27046
27065
|
console.log(chalk163.green(`Wrote ${path109}`));
|
|
@@ -27064,10 +27083,10 @@ function registerDevlogEntryCommands(devlogCommand) {
|
|
|
27064
27083
|
import { execSync as execSync38 } from "child_process";
|
|
27065
27084
|
|
|
27066
27085
|
// src/commands/devlog/loadAllDevLatestWeeks.ts
|
|
27067
|
-
import { readdirSync as
|
|
27086
|
+
import { readdirSync as readdirSync11 } from "fs";
|
|
27068
27087
|
function readRepoDirs(devDir) {
|
|
27069
27088
|
try {
|
|
27070
|
-
return
|
|
27089
|
+
return readdirSync11(devDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
27071
27090
|
} catch {
|
|
27072
27091
|
return [];
|
|
27073
27092
|
}
|
|
@@ -27224,19 +27243,19 @@ async function findPhaseUnlockItem(itemId2, phase) {
|
|
|
27224
27243
|
}
|
|
27225
27244
|
|
|
27226
27245
|
// src/commands/docs/getDocsUnlockPinPath.ts
|
|
27227
|
-
import { join as
|
|
27246
|
+
import { join as join73 } from "path";
|
|
27228
27247
|
function getDocsUnlockPinPath(pin2) {
|
|
27229
|
-
return
|
|
27248
|
+
return join73(getRestrictedDir(), `docs-unlock-pin-${pin2}.json`);
|
|
27230
27249
|
}
|
|
27231
27250
|
|
|
27232
27251
|
// src/commands/docs/readDocsUnlockPinState.ts
|
|
27233
|
-
import { existsSync as
|
|
27252
|
+
import { existsSync as existsSync58, readFileSync as readFileSync39 } from "fs";
|
|
27234
27253
|
function isPositiveInteger(value) {
|
|
27235
27254
|
return Number.isInteger(value) && value > 0;
|
|
27236
27255
|
}
|
|
27237
27256
|
function readDocsUnlockPinState(pin2) {
|
|
27238
27257
|
const path109 = getDocsUnlockPinPath(pin2);
|
|
27239
|
-
if (!
|
|
27258
|
+
if (!existsSync58(path109)) return void 0;
|
|
27240
27259
|
try {
|
|
27241
27260
|
const state = JSON.parse(readFileSync39(path109, "utf8"));
|
|
27242
27261
|
if (state.pin !== pin2) return void 0;
|
|
@@ -27374,13 +27393,13 @@ import { mkdirSync as mkdirSync21, unlinkSync as unlinkSync11, writeFileSync as
|
|
|
27374
27393
|
import chalk169 from "chalk";
|
|
27375
27394
|
|
|
27376
27395
|
// src/commands/schema/getSchemaUnlockPinPath.ts
|
|
27377
|
-
import { join as
|
|
27396
|
+
import { join as join74 } from "path";
|
|
27378
27397
|
function getSchemaUnlockPinPath(pin2) {
|
|
27379
|
-
return
|
|
27398
|
+
return join74(getRestrictedDir(), `schema-unlock-pin-${pin2}.json`);
|
|
27380
27399
|
}
|
|
27381
27400
|
|
|
27382
27401
|
// src/commands/schema/readSchemaUnlockPinState.ts
|
|
27383
|
-
import { existsSync as
|
|
27402
|
+
import { existsSync as existsSync59, readFileSync as readFileSync40 } from "fs";
|
|
27384
27403
|
function isPositiveInteger2(value) {
|
|
27385
27404
|
return Number.isInteger(value) && value > 0;
|
|
27386
27405
|
}
|
|
@@ -27394,7 +27413,7 @@ function toState(raw) {
|
|
|
27394
27413
|
}
|
|
27395
27414
|
function readSchemaUnlockPinState(pin2) {
|
|
27396
27415
|
const path109 = getSchemaUnlockPinPath(pin2);
|
|
27397
|
-
if (!
|
|
27416
|
+
if (!existsSync59(path109)) return void 0;
|
|
27398
27417
|
try {
|
|
27399
27418
|
const raw = JSON.parse(readFileSync40(path109, "utf8"));
|
|
27400
27419
|
if (raw.pin !== pin2) return void 0;
|
|
@@ -27518,20 +27537,20 @@ function registerSchema(parent) {
|
|
|
27518
27537
|
}
|
|
27519
27538
|
|
|
27520
27539
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
27521
|
-
import { closeSync as closeSync5, openSync as openSync6, readdirSync as
|
|
27522
|
-
import { join as
|
|
27540
|
+
import { closeSync as closeSync5, openSync as openSync6, readdirSync as readdirSync12 } from "fs";
|
|
27541
|
+
import { join as join75 } from "path";
|
|
27523
27542
|
import chalk171 from "chalk";
|
|
27524
27543
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
27525
27544
|
function isLockedDll(debugDir) {
|
|
27526
27545
|
let files;
|
|
27527
27546
|
try {
|
|
27528
|
-
files =
|
|
27547
|
+
files = readdirSync12(debugDir, { recursive: true });
|
|
27529
27548
|
} catch {
|
|
27530
27549
|
return null;
|
|
27531
27550
|
}
|
|
27532
27551
|
for (const file of files) {
|
|
27533
27552
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
27534
|
-
const dllPath =
|
|
27553
|
+
const dllPath = join75(debugDir, file);
|
|
27535
27554
|
try {
|
|
27536
27555
|
const fd = openSync6(dllPath, "r+");
|
|
27537
27556
|
closeSync5(fd);
|
|
@@ -27544,18 +27563,18 @@ function isLockedDll(debugDir) {
|
|
|
27544
27563
|
function findFirstLockedDll(dir) {
|
|
27545
27564
|
let entries;
|
|
27546
27565
|
try {
|
|
27547
|
-
entries =
|
|
27566
|
+
entries = readdirSync12(dir);
|
|
27548
27567
|
} catch {
|
|
27549
27568
|
return null;
|
|
27550
27569
|
}
|
|
27551
27570
|
if (entries.includes("bin")) {
|
|
27552
|
-
const locked = isLockedDll(
|
|
27571
|
+
const locked = isLockedDll(join75(dir, "bin", "Debug"));
|
|
27553
27572
|
if (locked) return locked;
|
|
27554
27573
|
}
|
|
27555
27574
|
for (const entry of entries) {
|
|
27556
27575
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
27557
27576
|
continue;
|
|
27558
|
-
const found = findFirstLockedDll(
|
|
27577
|
+
const found = findFirstLockedDll(join75(dir, entry));
|
|
27559
27578
|
if (found) return found;
|
|
27560
27579
|
}
|
|
27561
27580
|
return null;
|
|
@@ -27624,14 +27643,14 @@ function collectAllDeps(node) {
|
|
|
27624
27643
|
}
|
|
27625
27644
|
|
|
27626
27645
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
27627
|
-
import { readdirSync as
|
|
27646
|
+
import { readdirSync as readdirSync13, readFileSync as readFileSync42, statSync as statSync9 } from "fs";
|
|
27628
27647
|
import path37 from "path";
|
|
27629
27648
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
27630
27649
|
if (depth > maxDepth) return [];
|
|
27631
27650
|
const results = [];
|
|
27632
27651
|
let entries;
|
|
27633
27652
|
try {
|
|
27634
|
-
entries =
|
|
27653
|
+
entries = readdirSync13(dir);
|
|
27635
27654
|
} catch {
|
|
27636
27655
|
return results;
|
|
27637
27656
|
}
|
|
@@ -27640,7 +27659,7 @@ function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
|
27640
27659
|
continue;
|
|
27641
27660
|
const full = path37.join(dir, entry);
|
|
27642
27661
|
try {
|
|
27643
|
-
const stat5 =
|
|
27662
|
+
const stat5 = statSync9(full);
|
|
27644
27663
|
if (stat5.isFile() && entry.endsWith(".sln")) {
|
|
27645
27664
|
results.push(full);
|
|
27646
27665
|
} else if (stat5.isDirectory()) {
|
|
@@ -27723,12 +27742,12 @@ function printJson(tree, totalCount, solutions) {
|
|
|
27723
27742
|
}
|
|
27724
27743
|
|
|
27725
27744
|
// src/commands/dotnet/resolveCsproj.ts
|
|
27726
|
-
import { existsSync as
|
|
27745
|
+
import { existsSync as existsSync60 } from "fs";
|
|
27727
27746
|
import path38 from "path";
|
|
27728
27747
|
import chalk173 from "chalk";
|
|
27729
27748
|
function resolveCsproj(csprojPath) {
|
|
27730
27749
|
const resolved = path38.resolve(csprojPath);
|
|
27731
|
-
if (!
|
|
27750
|
+
if (!existsSync60(resolved)) {
|
|
27732
27751
|
console.error(chalk173.red(`File not found: ${resolved}`));
|
|
27733
27752
|
process.exit(1);
|
|
27734
27753
|
}
|
|
@@ -27896,17 +27915,17 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
27896
27915
|
}
|
|
27897
27916
|
|
|
27898
27917
|
// src/commands/dotnet/resolveSolution.ts
|
|
27899
|
-
import { existsSync as
|
|
27918
|
+
import { existsSync as existsSync61 } from "fs";
|
|
27900
27919
|
import path39 from "path";
|
|
27901
27920
|
import chalk177 from "chalk";
|
|
27902
27921
|
|
|
27903
27922
|
// src/commands/dotnet/findSolution.ts
|
|
27904
|
-
import { readdirSync as
|
|
27905
|
-
import { dirname as dirname32, join as
|
|
27923
|
+
import { readdirSync as readdirSync14 } from "fs";
|
|
27924
|
+
import { dirname as dirname32, join as join76 } from "path";
|
|
27906
27925
|
import chalk176 from "chalk";
|
|
27907
27926
|
function findSlnInDir(dir) {
|
|
27908
27927
|
try {
|
|
27909
|
-
return
|
|
27928
|
+
return readdirSync14(dir).filter((f) => f.endsWith(".sln")).map((f) => join76(dir, f));
|
|
27910
27929
|
} catch {
|
|
27911
27930
|
return [];
|
|
27912
27931
|
}
|
|
@@ -27937,7 +27956,7 @@ function findSolution() {
|
|
|
27937
27956
|
function resolveSolution(sln) {
|
|
27938
27957
|
if (sln) {
|
|
27939
27958
|
const resolved = path39.resolve(sln);
|
|
27940
|
-
if (!
|
|
27959
|
+
if (!existsSync61(resolved)) {
|
|
27941
27960
|
console.error(chalk177.red(`Solution file not found: ${resolved}`));
|
|
27942
27961
|
process.exit(1);
|
|
27943
27962
|
}
|
|
@@ -27977,7 +27996,7 @@ function parseInspectReport(json) {
|
|
|
27977
27996
|
|
|
27978
27997
|
// src/commands/dotnet/runInspectCode.ts
|
|
27979
27998
|
import { execSync as execSync40 } from "child_process";
|
|
27980
|
-
import { existsSync as
|
|
27999
|
+
import { existsSync as existsSync62, readFileSync as readFileSync43, unlinkSync as unlinkSync12 } from "fs";
|
|
27981
28000
|
import { tmpdir as tmpdir4 } from "os";
|
|
27982
28001
|
import path40 from "path";
|
|
27983
28002
|
import chalk178 from "chalk";
|
|
@@ -28008,7 +28027,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
28008
28027
|
console.error(chalk178.red("jb inspectcode failed"));
|
|
28009
28028
|
process.exit(1);
|
|
28010
28029
|
}
|
|
28011
|
-
if (!
|
|
28030
|
+
if (!existsSync62(reportPath)) {
|
|
28012
28031
|
console.error(chalk178.red("Report file not generated"));
|
|
28013
28032
|
process.exit(1);
|
|
28014
28033
|
}
|
|
@@ -28894,7 +28913,7 @@ function aggregateCommitters(authorLists) {
|
|
|
28894
28913
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
28895
28914
|
import { unlinkSync as unlinkSync13, writeFileSync as writeFileSync34 } from "fs";
|
|
28896
28915
|
import { tmpdir as tmpdir5 } from "os";
|
|
28897
|
-
import { join as
|
|
28916
|
+
import { join as join77 } from "path";
|
|
28898
28917
|
function buildArgs2(queryFile, vars) {
|
|
28899
28918
|
const args = ["api", "graphql", "-F", `query=@${queryFile}`];
|
|
28900
28919
|
for (const [key, value] of Object.entries(vars)) {
|
|
@@ -28904,7 +28923,7 @@ function buildArgs2(queryFile, vars) {
|
|
|
28904
28923
|
return args;
|
|
28905
28924
|
}
|
|
28906
28925
|
function runGhGraphql(mutation, vars) {
|
|
28907
|
-
const queryFile =
|
|
28926
|
+
const queryFile = join77(tmpdir5(), `gh-query-${Date.now()}.graphql`);
|
|
28908
28927
|
writeFileSync34(queryFile, mutation);
|
|
28909
28928
|
try {
|
|
28910
28929
|
const result = spawnSync6("gh", buildArgs2(queryFile, vars), {
|
|
@@ -30355,14 +30374,14 @@ function slugFromUrl(url) {
|
|
|
30355
30374
|
import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync35 } from "fs";
|
|
30356
30375
|
|
|
30357
30376
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
30358
|
-
import { join as
|
|
30377
|
+
import { join as join78 } from "path";
|
|
30359
30378
|
function issueWorkingFile(slug2, number) {
|
|
30360
30379
|
const [owner = "unknown", repo = "unknown"] = slug2.split("/");
|
|
30361
|
-
const dir =
|
|
30380
|
+
const dir = join78(getStoreDir(), "github-issues", owner, repo);
|
|
30362
30381
|
return {
|
|
30363
30382
|
dir,
|
|
30364
|
-
bodyPath:
|
|
30365
|
-
metaPath:
|
|
30383
|
+
bodyPath: join78(dir, `${number}.md`),
|
|
30384
|
+
metaPath: join78(dir, `${number}.json`)
|
|
30366
30385
|
};
|
|
30367
30386
|
}
|
|
30368
30387
|
|
|
@@ -30397,10 +30416,10 @@ function fetchIssueToWorkingFile(number, repo) {
|
|
|
30397
30416
|
}
|
|
30398
30417
|
|
|
30399
30418
|
// src/commands/github/issue/resumeIssueBody.ts
|
|
30400
|
-
import { existsSync as
|
|
30419
|
+
import { existsSync as existsSync63, readFileSync as readFileSync44 } from "fs";
|
|
30401
30420
|
function resumeIssueBody(slug2, number, updatedAt) {
|
|
30402
30421
|
const { bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
30403
|
-
if (!
|
|
30422
|
+
if (!existsSync63(bodyPath) || !existsSync63(metaPath)) return void 0;
|
|
30404
30423
|
try {
|
|
30405
30424
|
const meta = JSON.parse(readFileSync44(metaPath, "utf8"));
|
|
30406
30425
|
if (meta.updatedAt !== updatedAt) return void 0;
|
|
@@ -31267,15 +31286,15 @@ function recentDaemonLogLines(includeRelayed = true) {
|
|
|
31267
31286
|
}
|
|
31268
31287
|
|
|
31269
31288
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
31270
|
-
import { existsSync as
|
|
31289
|
+
import { existsSync as existsSync64 } from "fs";
|
|
31271
31290
|
import { basename as basename20, dirname as dirname34 } from "path";
|
|
31272
31291
|
|
|
31273
31292
|
// src/commands/sessions/daemon/worktree/nextWorktreePath.ts
|
|
31274
|
-
import { basename as basename19, join as
|
|
31293
|
+
import { basename as basename19, join as join79 } from "path";
|
|
31275
31294
|
function nextWorktreePath(clone, base, isTaken) {
|
|
31276
31295
|
const name = basename19(clone);
|
|
31277
31296
|
for (let n = 2; n < 1e3; n++) {
|
|
31278
|
-
const candidate =
|
|
31297
|
+
const candidate = join79(base, `${name}-${n}`);
|
|
31279
31298
|
if (!isTaken(candidate)) return candidate;
|
|
31280
31299
|
}
|
|
31281
31300
|
throw new Error(`no free worktree suffix for ${clone}`);
|
|
@@ -31299,7 +31318,7 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
|
31299
31318
|
const base = strategy.root ? expandTilde(strategy.root) : dirname34(clone);
|
|
31300
31319
|
const registered = new Set(listWorktreePaths(clone));
|
|
31301
31320
|
const branches = new Set(listLocalBranches(clone));
|
|
31302
|
-
const isTaken = (candidate) => registered.has(candidate) ||
|
|
31321
|
+
const isTaken = (candidate) => registered.has(candidate) || existsSync64(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename20(candidate));
|
|
31303
31322
|
const path109 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
|
|
31304
31323
|
const ready = addWorktree(clone, path109, strategy.trunk);
|
|
31305
31324
|
ready.catch(() => {
|
|
@@ -31537,21 +31556,21 @@ function persistedTreeRoots() {
|
|
|
31537
31556
|
}
|
|
31538
31557
|
|
|
31539
31558
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
31540
|
-
import { copyFileSync, existsSync as
|
|
31541
|
-
import { dirname as dirname35, join as
|
|
31559
|
+
import { copyFileSync, existsSync as existsSync66, mkdirSync as mkdirSync23 } from "fs";
|
|
31560
|
+
import { dirname as dirname35, join as join81 } from "path";
|
|
31542
31561
|
|
|
31543
31562
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
31544
31563
|
import { resolve as resolve21 } from "path";
|
|
31545
31564
|
|
|
31546
31565
|
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
31547
|
-
import { existsSync as
|
|
31548
|
-
import { join as
|
|
31566
|
+
import { existsSync as existsSync65 } from "fs";
|
|
31567
|
+
import { join as join80 } from "path";
|
|
31549
31568
|
function detectInstallCommand(dir) {
|
|
31550
|
-
if (!
|
|
31551
|
-
if (
|
|
31552
|
-
if (
|
|
31553
|
-
if (
|
|
31554
|
-
if (
|
|
31569
|
+
if (!existsSync65(join80(dir, "package.json"))) return null;
|
|
31570
|
+
if (existsSync65(join80(dir, "pnpm-lock.yaml"))) return "pnpm install";
|
|
31571
|
+
if (existsSync65(join80(dir, "yarn.lock"))) return "yarn install";
|
|
31572
|
+
if (existsSync65(join80(dir, "bun.lockb"))) return "bun install";
|
|
31573
|
+
if (existsSync65(join80(dir, "package-lock.json"))) return "npm ci";
|
|
31555
31574
|
return "npm install";
|
|
31556
31575
|
}
|
|
31557
31576
|
|
|
@@ -31716,9 +31735,9 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
31716
31735
|
}
|
|
31717
31736
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
31718
31737
|
for (const rel of copy) {
|
|
31719
|
-
const src =
|
|
31720
|
-
if (!
|
|
31721
|
-
const dest =
|
|
31738
|
+
const src = join81(clone, rel);
|
|
31739
|
+
if (!existsSync66(src)) continue;
|
|
31740
|
+
const dest = join81(worktreePath, rel);
|
|
31722
31741
|
try {
|
|
31723
31742
|
mkdirSync23(dirname35(dest), { recursive: true });
|
|
31724
31743
|
copyFileSync(src, dest);
|
|
@@ -32187,7 +32206,7 @@ function registerLitellm(program) {
|
|
|
32187
32206
|
}
|
|
32188
32207
|
|
|
32189
32208
|
// src/commands/mermaidExport.ts
|
|
32190
|
-
import { mkdirSync as mkdirSync24, readdirSync as
|
|
32209
|
+
import { mkdirSync as mkdirSync24, readdirSync as readdirSync15 } from "fs";
|
|
32191
32210
|
import { resolve as resolve23 } from "path";
|
|
32192
32211
|
import chalk195 from "chalk";
|
|
32193
32212
|
|
|
@@ -32269,7 +32288,7 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
32269
32288
|
process.exit(1);
|
|
32270
32289
|
}
|
|
32271
32290
|
}
|
|
32272
|
-
const files = file ? [file] :
|
|
32291
|
+
const files = file ? [file] : readdirSync15(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
32273
32292
|
if (files.length === 0) {
|
|
32274
32293
|
console.log(chalk195.gray("No markdown files found in current directory."));
|
|
32275
32294
|
return;
|
|
@@ -32430,10 +32449,10 @@ function applyIgnore(texts, ignore3) {
|
|
|
32430
32449
|
}
|
|
32431
32450
|
|
|
32432
32451
|
// src/commands/miro/readIgnoreList.ts
|
|
32433
|
-
import { existsSync as
|
|
32452
|
+
import { existsSync as existsSync67, readFileSync as readFileSync46 } from "fs";
|
|
32434
32453
|
import { parse as parse2 } from "yaml";
|
|
32435
32454
|
function readIgnoreList(file) {
|
|
32436
|
-
if (!
|
|
32455
|
+
if (!existsSync67(file))
|
|
32437
32456
|
throw new MiroExtractError(
|
|
32438
32457
|
`No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
|
|
32439
32458
|
);
|
|
@@ -32918,15 +32937,15 @@ function createNetcapHandler(options2) {
|
|
|
32918
32937
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
32919
32938
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
32920
32939
|
import { networkInterfaces } from "os";
|
|
32921
|
-
import { join as
|
|
32940
|
+
import { join as join83 } from "path";
|
|
32922
32941
|
import chalk198 from "chalk";
|
|
32923
32942
|
|
|
32924
32943
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
32925
|
-
import { dirname as dirname37, join as
|
|
32944
|
+
import { dirname as dirname37, join as join82 } from "path";
|
|
32926
32945
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
32927
32946
|
var moduleDir2 = dirname37(fileURLToPath7(import.meta.url));
|
|
32928
32947
|
function netcapExtensionDir() {
|
|
32929
|
-
return
|
|
32948
|
+
return join82(moduleDir2, "commands", "netcap", "netcap-extension");
|
|
32930
32949
|
}
|
|
32931
32950
|
|
|
32932
32951
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
@@ -32941,7 +32960,7 @@ function lanIPv4() {
|
|
|
32941
32960
|
return void 0;
|
|
32942
32961
|
}
|
|
32943
32962
|
async function configureBackground(dir, host, port, filter) {
|
|
32944
|
-
const file =
|
|
32963
|
+
const file = join83(dir, "background.js");
|
|
32945
32964
|
const source = await readFile7(file, "utf8");
|
|
32946
32965
|
await writeFile6(
|
|
32947
32966
|
file,
|
|
@@ -32981,20 +33000,20 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
32981
33000
|
}
|
|
32982
33001
|
|
|
32983
33002
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
32984
|
-
import { isAbsolute as isAbsolute5, join as
|
|
33003
|
+
import { isAbsolute as isAbsolute5, join as join85, resolve as resolve25 } from "path";
|
|
32985
33004
|
|
|
32986
33005
|
// src/commands/netcap/defaultCapturePath.ts
|
|
32987
33006
|
import { homedir as homedir25 } from "os";
|
|
32988
|
-
import { join as
|
|
33007
|
+
import { join as join84 } from "path";
|
|
32989
33008
|
function defaultCapturePath() {
|
|
32990
|
-
return
|
|
33009
|
+
return join84(homedir25(), ".assist", "netcap", "capture.jsonl");
|
|
32991
33010
|
}
|
|
32992
33011
|
|
|
32993
33012
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
32994
33013
|
function resolveNetcapOutPath(out) {
|
|
32995
33014
|
if (!out) return defaultCapturePath();
|
|
32996
33015
|
const dir = isAbsolute5(out) ? out : resolve25(process.cwd(), out);
|
|
32997
|
-
return
|
|
33016
|
+
return join85(dir, "capture.jsonl");
|
|
32998
33017
|
}
|
|
32999
33018
|
|
|
33000
33019
|
// src/commands/netcap/netcap.ts
|
|
@@ -33041,7 +33060,7 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
|
|
|
33041
33060
|
|
|
33042
33061
|
// src/commands/netcap/netcapExtract.ts
|
|
33043
33062
|
import { writeFileSync as writeFileSync38 } from "fs";
|
|
33044
|
-
import { join as
|
|
33063
|
+
import { join as join86 } from "path";
|
|
33045
33064
|
import chalk200 from "chalk";
|
|
33046
33065
|
|
|
33047
33066
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
@@ -33486,7 +33505,7 @@ function extractPostsFromCapture(captureFile) {
|
|
|
33486
33505
|
function netcapExtract(file) {
|
|
33487
33506
|
const captureFile = file ?? defaultCapturePath();
|
|
33488
33507
|
const posts = extractPostsFromCapture(captureFile);
|
|
33489
|
-
const outFile =
|
|
33508
|
+
const outFile = join86(captureFile, "..", "posts.json");
|
|
33490
33509
|
writeFileSync38(outFile, `${JSON.stringify(posts, null, 2)}
|
|
33491
33510
|
`);
|
|
33492
33511
|
console.log(
|
|
@@ -33882,9 +33901,9 @@ async function comment2(path109, line, body, options2 = {}) {
|
|
|
33882
33901
|
|
|
33883
33902
|
// src/commands/prs/commentsCachePath.ts
|
|
33884
33903
|
import { homedir as homedir26 } from "os";
|
|
33885
|
-
import { join as
|
|
33904
|
+
import { join as join87 } from "path";
|
|
33886
33905
|
function commentsCachePath(org, repo, prNumber) {
|
|
33887
|
-
return
|
|
33906
|
+
return join87(
|
|
33888
33907
|
homedir26(),
|
|
33889
33908
|
".assist",
|
|
33890
33909
|
"pr-comments",
|
|
@@ -33900,11 +33919,11 @@ import { dirname as dirname39 } from "path";
|
|
|
33900
33919
|
import { stringify as stringify3 } from "yaml";
|
|
33901
33920
|
|
|
33902
33921
|
// src/commands/prs/loadCommentsCache.ts
|
|
33903
|
-
import { existsSync as
|
|
33922
|
+
import { existsSync as existsSync68, readFileSync as readFileSync49, unlinkSync as unlinkSync14 } from "fs";
|
|
33904
33923
|
import { parse as parse3 } from "yaml";
|
|
33905
33924
|
function loadCommentsCache(org, repo, prNumber) {
|
|
33906
33925
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
33907
|
-
if (!
|
|
33926
|
+
if (!existsSync68(cachePath)) {
|
|
33908
33927
|
return null;
|
|
33909
33928
|
}
|
|
33910
33929
|
const content = readFileSync49(cachePath, "utf8");
|
|
@@ -33912,26 +33931,26 @@ function loadCommentsCache(org, repo, prNumber) {
|
|
|
33912
33931
|
}
|
|
33913
33932
|
function deleteCommentsCache(org, repo, prNumber) {
|
|
33914
33933
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
33915
|
-
if (
|
|
33934
|
+
if (existsSync68(cachePath)) {
|
|
33916
33935
|
unlinkSync14(cachePath);
|
|
33917
33936
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
33918
33937
|
}
|
|
33919
33938
|
}
|
|
33920
33939
|
|
|
33921
33940
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
33922
|
-
import { readdirSync as
|
|
33923
|
-
import { join as
|
|
33941
|
+
import { readdirSync as readdirSync16, unlinkSync as unlinkSync15 } from "fs";
|
|
33942
|
+
import { join as join88 } from "path";
|
|
33924
33943
|
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
33925
33944
|
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
33926
|
-
const dir =
|
|
33945
|
+
const dir = join88(cwd, ".assist");
|
|
33927
33946
|
let entries;
|
|
33928
33947
|
try {
|
|
33929
|
-
entries =
|
|
33948
|
+
entries = readdirSync16(dir);
|
|
33930
33949
|
} catch {
|
|
33931
33950
|
return;
|
|
33932
33951
|
}
|
|
33933
33952
|
for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
|
|
33934
|
-
unlinkSync15(
|
|
33953
|
+
unlinkSync15(join88(dir, entry));
|
|
33935
33954
|
}
|
|
33936
33955
|
}
|
|
33937
33956
|
|
|
@@ -34049,7 +34068,7 @@ function failAzureDevops(error) {
|
|
|
34049
34068
|
import { execFileSync as execFileSync19 } from "child_process";
|
|
34050
34069
|
import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as writeFileSync40 } from "fs";
|
|
34051
34070
|
import { tmpdir as tmpdir6 } from "os";
|
|
34052
|
-
import { join as
|
|
34071
|
+
import { join as join89 } from "path";
|
|
34053
34072
|
function azDevopsInvokeArgs(request, inFile) {
|
|
34054
34073
|
return [
|
|
34055
34074
|
"devops",
|
|
@@ -34084,8 +34103,8 @@ function runAz2(args) {
|
|
|
34084
34103
|
}
|
|
34085
34104
|
function invokeAzDevops(request) {
|
|
34086
34105
|
if (request.body === void 0) return runAz2(azDevopsInvokeArgs(request));
|
|
34087
|
-
const dir = mkdtempSync2(
|
|
34088
|
-
const inFile =
|
|
34106
|
+
const dir = mkdtempSync2(join89(tmpdir6(), "assist-az-"));
|
|
34107
|
+
const inFile = join89(dir, "body.json");
|
|
34089
34108
|
try {
|
|
34090
34109
|
writeFileSync40(inFile, JSON.stringify(request.body));
|
|
34091
34110
|
return runAz2(azDevopsInvokeArgs(request, inFile));
|
|
@@ -34831,7 +34850,7 @@ ${resolves}` : baseWhy);
|
|
|
34831
34850
|
}
|
|
34832
34851
|
|
|
34833
34852
|
// src/commands/prs/parseScreenshotSpec.ts
|
|
34834
|
-
import { statSync as
|
|
34853
|
+
import { statSync as statSync10 } from "fs";
|
|
34835
34854
|
import { basename as basename22, extname as extname5, resolve as resolve26 } from "path";
|
|
34836
34855
|
function splitOnce(value, separator) {
|
|
34837
34856
|
const index3 = value.indexOf(separator);
|
|
@@ -34840,7 +34859,7 @@ function splitOnce(value, separator) {
|
|
|
34840
34859
|
}
|
|
34841
34860
|
function isFile2(path109) {
|
|
34842
34861
|
try {
|
|
34843
|
-
return
|
|
34862
|
+
return statSync10(path109).isFile();
|
|
34844
34863
|
} catch {
|
|
34845
34864
|
return false;
|
|
34846
34865
|
}
|
|
@@ -37213,9 +37232,9 @@ async function notify() {
|
|
|
37213
37232
|
|
|
37214
37233
|
// src/commands/screenshot.ts
|
|
37215
37234
|
import { execSync as execSync54 } from "child_process";
|
|
37216
|
-
import { existsSync as
|
|
37235
|
+
import { existsSync as existsSync69, mkdirSync as mkdirSync27, unlinkSync as unlinkSync16, writeFileSync as writeFileSync41 } from "fs";
|
|
37217
37236
|
import { tmpdir as tmpdir7 } from "os";
|
|
37218
|
-
import { join as
|
|
37237
|
+
import { join as join90, resolve as resolve27 } from "path";
|
|
37219
37238
|
import chalk227 from "chalk";
|
|
37220
37239
|
|
|
37221
37240
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -37345,14 +37364,14 @@ Write-Output $OutputPath
|
|
|
37345
37364
|
|
|
37346
37365
|
// src/commands/screenshot.ts
|
|
37347
37366
|
function buildOutputPath(outputDir, processName) {
|
|
37348
|
-
if (!
|
|
37367
|
+
if (!existsSync69(outputDir)) {
|
|
37349
37368
|
mkdirSync27(outputDir, { recursive: true });
|
|
37350
37369
|
}
|
|
37351
37370
|
const timestamp9 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
37352
37371
|
return resolve27(outputDir, `${processName}-${timestamp9}.png`);
|
|
37353
37372
|
}
|
|
37354
37373
|
function runPowerShellScript(processName, outputPath) {
|
|
37355
|
-
const scriptPath =
|
|
37374
|
+
const scriptPath = join90(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
|
|
37356
37375
|
writeFileSync41(scriptPath, captureWindowPs1, "utf8");
|
|
37357
37376
|
try {
|
|
37358
37377
|
execSync54(
|
|
@@ -37453,13 +37472,13 @@ function buildLimitsSegment(rateLimits) {
|
|
|
37453
37472
|
}
|
|
37454
37473
|
|
|
37455
37474
|
// src/commands/readGitBranch.ts
|
|
37456
|
-
import { readFileSync as readFileSync52, statSync as
|
|
37457
|
-
import { isAbsolute as isAbsolute6, join as
|
|
37475
|
+
import { readFileSync as readFileSync52, statSync as statSync11 } from "fs";
|
|
37476
|
+
import { isAbsolute as isAbsolute6, join as join91, resolve as resolve28 } from "path";
|
|
37458
37477
|
function resolveGitDir(cwd) {
|
|
37459
|
-
const dotGit =
|
|
37478
|
+
const dotGit = join91(cwd, ".git");
|
|
37460
37479
|
let stat5;
|
|
37461
37480
|
try {
|
|
37462
|
-
stat5 =
|
|
37481
|
+
stat5 = statSync11(dotGit);
|
|
37463
37482
|
} catch {
|
|
37464
37483
|
return null;
|
|
37465
37484
|
}
|
|
@@ -37486,7 +37505,7 @@ function readGitBranch(cwd) {
|
|
|
37486
37505
|
}
|
|
37487
37506
|
let head;
|
|
37488
37507
|
try {
|
|
37489
|
-
head = readFileSync52(
|
|
37508
|
+
head = readFileSync52(join91(gitDir, "HEAD"), "utf8");
|
|
37490
37509
|
} catch {
|
|
37491
37510
|
return null;
|
|
37492
37511
|
}
|
|
@@ -40491,6 +40510,13 @@ var highLevelChecklist = [
|
|
|
40491
40510
|
short: "Tests",
|
|
40492
40511
|
backing: "The describe/it hierarchy of changed tests in files matching review.highLevel.testPaths"
|
|
40493
40512
|
},
|
|
40513
|
+
{
|
|
40514
|
+
id: "manual-testing",
|
|
40515
|
+
kind: "manual",
|
|
40516
|
+
title: "The change can be exercised by hand",
|
|
40517
|
+
short: "Manual testing",
|
|
40518
|
+
backing: "Setup and numbered action \u2192 expected steps written by the slicing agent"
|
|
40519
|
+
},
|
|
40494
40520
|
{
|
|
40495
40521
|
id: "backend-pr-linked",
|
|
40496
40522
|
kind: "manual",
|
|
@@ -40509,7 +40535,8 @@ var evaluators = {
|
|
|
40509
40535
|
"no-merge-conflicts": (subject) => checkNoMergeConflicts(subject.mergeable, subject.baseRef)
|
|
40510
40536
|
};
|
|
40511
40537
|
function evaluateHighLevelChecks(subject) {
|
|
40512
|
-
|
|
40538
|
+
const checks2 = subject.sliced ? highLevelChecklist : highLevelChecklist.filter((check2) => check2.id !== "manual-testing");
|
|
40539
|
+
return checks2.map((check2) => {
|
|
40513
40540
|
if (check2.kind === "manual")
|
|
40514
40541
|
return { ...check2, status: "manual", reason: check2.backing };
|
|
40515
40542
|
return { ...check2, ...evaluators[check2.id](subject) };
|
|
@@ -40607,31 +40634,60 @@ var RULES = [
|
|
|
40607
40634
|
"Generated files such as lockfiles get their own slice unless they belong with a specific change.",
|
|
40608
40635
|
"List slices in reading order."
|
|
40609
40636
|
];
|
|
40637
|
+
var MANUAL_TESTING_RULES = [
|
|
40638
|
+
"Write PR-wide steps that let a reviewer exercise the change by hand without reading the diff, derived from the hunks.",
|
|
40639
|
+
"`setup` lists what to do first: branches to check out, servers or daemons to restart, config to set, data to seed. Keep each entry short.",
|
|
40640
|
+
"Each step's `action` says exactly what to run or open: the command, the URL or the page and what to click.",
|
|
40641
|
+
"Each step's `expect` says what the reviewer should see when the change works.",
|
|
40642
|
+
"Name repo files by their path from the repo root, and give URLs in full.",
|
|
40643
|
+
"When the change has no observable behaviour (refactors, docs, types), write one step saying which existing command or test shows nothing changed."
|
|
40644
|
+
];
|
|
40645
|
+
var EXAMPLE = {
|
|
40646
|
+
slices: [
|
|
40647
|
+
{
|
|
40648
|
+
title: "Short imperative title",
|
|
40649
|
+
summary: "One or two sentences on what the slice changes.",
|
|
40650
|
+
hunks: ["path/to/file.ts#0"]
|
|
40651
|
+
}
|
|
40652
|
+
],
|
|
40653
|
+
manualTesting: {
|
|
40654
|
+
setup: ["Restart the web server"],
|
|
40655
|
+
steps: [
|
|
40656
|
+
{
|
|
40657
|
+
action: "Open http://localhost:3000/settings",
|
|
40658
|
+
expect: "The new toggle shows under Display"
|
|
40659
|
+
}
|
|
40660
|
+
]
|
|
40661
|
+
}
|
|
40662
|
+
};
|
|
40610
40663
|
function formatSlicingRequest(hunks) {
|
|
40611
40664
|
return [
|
|
40612
40665
|
"Slicing required: review.highLevel.slices is on, so this PR must be split into slices before the review opens.",
|
|
40613
40666
|
"",
|
|
40614
|
-
"Write
|
|
40667
|
+
"Write the slices and the manual testing steps as JSON to a scratch file, then re-run this command with the same arguments plus `--slices <file>`:",
|
|
40615
40668
|
"",
|
|
40616
|
-
|
|
40669
|
+
JSON.stringify(EXAMPLE, null, 2),
|
|
40617
40670
|
"",
|
|
40618
40671
|
'Refer to hunks by the `path#index` labels below. Unknown refs are dropped, and every hunk no slice claims goes into an "Everything else" slice.',
|
|
40619
40672
|
"",
|
|
40620
40673
|
"Slicing rules:",
|
|
40621
40674
|
...RULES.map((rule) => `- ${rule}`),
|
|
40622
40675
|
"",
|
|
40676
|
+
"Manual testing rules:",
|
|
40677
|
+
...MANUAL_TESTING_RULES.map((rule) => `- ${rule}`),
|
|
40678
|
+
"",
|
|
40623
40679
|
`Hunks (${hunks.length}):`,
|
|
40624
40680
|
...hunks.flatMap((hunk) => ["", `### ${hunk.ref}`, hunk.text])
|
|
40625
40681
|
].join("\n");
|
|
40626
40682
|
}
|
|
40627
40683
|
|
|
40628
40684
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
40629
|
-
import { join as
|
|
40685
|
+
import { join as join92 } from "path";
|
|
40630
40686
|
function slug(value) {
|
|
40631
40687
|
return value.replace(/[^\w.-]+/g, "-");
|
|
40632
40688
|
}
|
|
40633
40689
|
function highLevelReviewPath(repo, headRef, headSha) {
|
|
40634
|
-
return
|
|
40690
|
+
return join92(
|
|
40635
40691
|
getStoreDir(),
|
|
40636
40692
|
"high-level-reviews",
|
|
40637
40693
|
slug(repo),
|
|
@@ -40683,9 +40739,9 @@ function listHighLevelHunks(files) {
|
|
|
40683
40739
|
}
|
|
40684
40740
|
|
|
40685
40741
|
// src/commands/review/highLevel/readJsonFile.ts
|
|
40686
|
-
import { existsSync as
|
|
40742
|
+
import { existsSync as existsSync70, readFileSync as readFileSync53 } from "fs";
|
|
40687
40743
|
function readJsonFile(path109) {
|
|
40688
|
-
if (!
|
|
40744
|
+
if (!existsSync70(path109)) return void 0;
|
|
40689
40745
|
try {
|
|
40690
40746
|
return JSON.parse(readFileSync53(path109, "utf8"));
|
|
40691
40747
|
} catch {
|
|
@@ -40695,18 +40751,26 @@ function readJsonFile(path109) {
|
|
|
40695
40751
|
|
|
40696
40752
|
// src/commands/review/highLevel/parseHighLevelSlicesInput.ts
|
|
40697
40753
|
import { z as z20 } from "zod";
|
|
40698
|
-
var
|
|
40754
|
+
var slicesSchema = z20.array(
|
|
40699
40755
|
z20.object({
|
|
40700
40756
|
title: z20.string().min(1),
|
|
40701
40757
|
summary: z20.string(),
|
|
40702
40758
|
hunks: z20.array(z20.string())
|
|
40703
40759
|
})
|
|
40704
40760
|
);
|
|
40761
|
+
var manualTestingSchema = z20.object({
|
|
40762
|
+
setup: z20.array(z20.string()),
|
|
40763
|
+
steps: z20.array(z20.object({ action: z20.string(), expect: z20.string() }))
|
|
40764
|
+
});
|
|
40765
|
+
var slicesInputSchema = z20.union([
|
|
40766
|
+
slicesSchema.transform((slices) => ({ slices })),
|
|
40767
|
+
z20.object({ slices: slicesSchema, manualTesting: manualTestingSchema })
|
|
40768
|
+
]);
|
|
40705
40769
|
function parseHighLevelSlicesInput(raw) {
|
|
40706
40770
|
const parsed = slicesInputSchema.safeParse(raw);
|
|
40707
40771
|
if (!parsed.success)
|
|
40708
40772
|
throw new Error(
|
|
40709
|
-
`slices must be a JSON array of {title, summary, hunks[]}: ${parsed.error.message}`
|
|
40773
|
+
`slices must be a JSON array of {title, summary, hunks[]}, or {slices: [...], manualTesting: {setup[], steps[{action, expect}]}}: ${parsed.error.message}`
|
|
40710
40774
|
);
|
|
40711
40775
|
return parsed.data;
|
|
40712
40776
|
}
|
|
@@ -40737,7 +40801,8 @@ function resolveHighLevelSlices(raw, hunks) {
|
|
|
40737
40801
|
const warnings = [];
|
|
40738
40802
|
const slices = [];
|
|
40739
40803
|
const add5 = (title, summary, refs) => slices.push({ title, summary, hunks: refs, ...sliceTotals(refs, byRef) });
|
|
40740
|
-
|
|
40804
|
+
const { slices: inputs, manualTesting } = parseHighLevelSlicesInput(raw);
|
|
40805
|
+
for (const input of inputs) {
|
|
40741
40806
|
const known = knownRefs(input, byRef, warnings);
|
|
40742
40807
|
if (known.length === 0)
|
|
40743
40808
|
warnings.push(`Dropped slice "${input.title}": it has no known hunks.`);
|
|
@@ -40753,7 +40818,7 @@ function resolveHighLevelSlices(raw, hunks) {
|
|
|
40753
40818
|
...sliceTotals(rest, byRef),
|
|
40754
40819
|
rest: true
|
|
40755
40820
|
});
|
|
40756
|
-
return { slices, warnings };
|
|
40821
|
+
return { slices, ...manualTesting ? { manualTesting } : {}, warnings };
|
|
40757
40822
|
}
|
|
40758
40823
|
|
|
40759
40824
|
// src/commands/review/highLevel/writeJsonFile.ts
|
|
@@ -40777,18 +40842,22 @@ function readSlicesFile(file) {
|
|
|
40777
40842
|
}
|
|
40778
40843
|
}
|
|
40779
40844
|
function sliceFromFile(file, files, path109) {
|
|
40780
|
-
const {
|
|
40845
|
+
const { warnings, ...set } = resolveHighLevelSlices(
|
|
40781
40846
|
readSlicesFile(file),
|
|
40782
40847
|
listHighLevelHunks(files)
|
|
40783
40848
|
);
|
|
40784
40849
|
for (const warning of warnings) console.warn(`Warning: ${warning}`);
|
|
40785
|
-
writeJsonFile(path109,
|
|
40786
|
-
return
|
|
40850
|
+
writeJsonFile(path109, set);
|
|
40851
|
+
return set;
|
|
40852
|
+
}
|
|
40853
|
+
function readSavedSlices(path109) {
|
|
40854
|
+
const saved = readJsonFile(path109);
|
|
40855
|
+
return Array.isArray(saved) ? { slices: saved } : saved;
|
|
40787
40856
|
}
|
|
40788
40857
|
function gatherHighLevelSlices(head, files, slicing) {
|
|
40789
40858
|
const path109 = highLevelSlicesPath(head.repo, head.headRef, head.headSha);
|
|
40790
40859
|
if (slicing.slicesFile) return sliceFromFile(slicing.slicesFile, files, path109);
|
|
40791
|
-
const saved = slicing.force ? void 0 :
|
|
40860
|
+
const saved = slicing.force ? void 0 : readSavedSlices(path109);
|
|
40792
40861
|
if (saved) return saved;
|
|
40793
40862
|
console.log(formatSlicingRequest(listHighLevelHunks(files)));
|
|
40794
40863
|
process.exit(2);
|
|
@@ -41098,7 +41167,7 @@ function gatherHighLevelSubject(prNumber, force, slicing) {
|
|
|
41098
41167
|
const fetched = fetchHighLevelFiles(prNumber, slug2);
|
|
41099
41168
|
const files = capHighLevelPatches(fetched, config.criticalPaths);
|
|
41100
41169
|
const head = { repo: slug2, headRef: pr.headRef, headSha: pr.headSha };
|
|
41101
|
-
const
|
|
41170
|
+
const sliced = slicing && config.slices ? gatherHighLevelSlices(head, files, slicing) : void 0;
|
|
41102
41171
|
return {
|
|
41103
41172
|
...head,
|
|
41104
41173
|
prNumber,
|
|
@@ -41106,7 +41175,8 @@ function gatherHighLevelSubject(prNumber, force, slicing) {
|
|
|
41106
41175
|
checks: evaluateHighLevelChecks({
|
|
41107
41176
|
...pr,
|
|
41108
41177
|
changedFiles: files.map((file) => file.path),
|
|
41109
|
-
config
|
|
41178
|
+
config,
|
|
41179
|
+
sliced: sliced !== void 0
|
|
41110
41180
|
}),
|
|
41111
41181
|
structure: buildHighLevelStructure(files),
|
|
41112
41182
|
criticalDiffs: selectCriticalDiffs(files, config.criticalPaths),
|
|
@@ -41114,7 +41184,7 @@ function gatherHighLevelSubject(prNumber, force, slicing) {
|
|
|
41114
41184
|
tests: gatherHighLevelTests(fetched, config.testPaths, slug2, pr.headSha),
|
|
41115
41185
|
testPaths: config.testPaths,
|
|
41116
41186
|
collapsedPaths: config.collapsedPaths,
|
|
41117
|
-
...
|
|
41187
|
+
...sliced,
|
|
41118
41188
|
...force ? {} : loadReopenedReview(slug2, pr.headRef, pr.headSha)
|
|
41119
41189
|
};
|
|
41120
41190
|
}
|
|
@@ -41223,6 +41293,7 @@ function highLevelPreviewPayload(subject) {
|
|
|
41223
41293
|
testPaths,
|
|
41224
41294
|
collapsedPaths,
|
|
41225
41295
|
slices,
|
|
41296
|
+
manualTesting,
|
|
41226
41297
|
saved,
|
|
41227
41298
|
draft
|
|
41228
41299
|
} = subject;
|
|
@@ -41238,6 +41309,7 @@ function highLevelPreviewPayload(subject) {
|
|
|
41238
41309
|
testPaths,
|
|
41239
41310
|
collapsedPaths,
|
|
41240
41311
|
...slices ? { slices } : {},
|
|
41312
|
+
...manualTesting ? { manualTesting } : {},
|
|
41241
41313
|
...saved ? { saved } : {},
|
|
41242
41314
|
...draft ? { draft } : {}
|
|
41243
41315
|
};
|
|
@@ -42092,11 +42164,11 @@ function exitFailedCiReview(failures, ci) {
|
|
|
42092
42164
|
}
|
|
42093
42165
|
|
|
42094
42166
|
// src/commands/review/cachedReviewerResult.ts
|
|
42095
|
-
import { statSync as
|
|
42167
|
+
import { statSync as statSync12 } from "fs";
|
|
42096
42168
|
function cachedReviewerResult(name, outputPath) {
|
|
42097
42169
|
let size;
|
|
42098
42170
|
try {
|
|
42099
|
-
size =
|
|
42171
|
+
size = statSync12(outputPath).size;
|
|
42100
42172
|
} catch {
|
|
42101
42173
|
return null;
|
|
42102
42174
|
}
|
|
@@ -42144,7 +42216,7 @@ import { format as format2 } from "util";
|
|
|
42144
42216
|
|
|
42145
42217
|
// src/commands/review/createReviewLogSink.ts
|
|
42146
42218
|
import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync29 } from "fs";
|
|
42147
|
-
import { join as
|
|
42219
|
+
import { join as join93 } from "path";
|
|
42148
42220
|
var LOG_FILE = "review.log";
|
|
42149
42221
|
function createReviewLogSink() {
|
|
42150
42222
|
let logPath2;
|
|
@@ -42161,7 +42233,7 @@ function createReviewLogSink() {
|
|
|
42161
42233
|
},
|
|
42162
42234
|
attach(reviewDir) {
|
|
42163
42235
|
mkdirSync29(reviewDir, { recursive: true });
|
|
42164
|
-
logPath2 =
|
|
42236
|
+
logPath2 = join93(reviewDir, LOG_FILE);
|
|
42165
42237
|
const lines2 = [
|
|
42166
42238
|
"",
|
|
42167
42239
|
`=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
|
|
@@ -42846,7 +42918,7 @@ async function runClaudeReviewer(spec) {
|
|
|
42846
42918
|
}
|
|
42847
42919
|
|
|
42848
42920
|
// src/commands/review/runCodexReviewer.ts
|
|
42849
|
-
import { existsSync as
|
|
42921
|
+
import { existsSync as existsSync71, unlinkSync as unlinkSync17 } from "fs";
|
|
42850
42922
|
|
|
42851
42923
|
// src/commands/review/parseCodexUsage.ts
|
|
42852
42924
|
function parseCodexUsage(usage) {
|
|
@@ -42935,7 +43007,7 @@ async function runCodexReviewer(spec) {
|
|
|
42935
43007
|
...override.args.length > 0 ? { env: override.env } : {},
|
|
42936
43008
|
onLine
|
|
42937
43009
|
});
|
|
42938
|
-
if (result.exitCode !== 0 &&
|
|
43010
|
+
if (result.exitCode !== 0 && existsSync71(spec.outputPath)) {
|
|
42939
43011
|
unlinkSync17(spec.outputPath);
|
|
42940
43012
|
}
|
|
42941
43013
|
const finalised = finaliseReviewerRun(
|
|
@@ -43029,7 +43101,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
|
|
|
43029
43101
|
}
|
|
43030
43102
|
|
|
43031
43103
|
// src/commands/review/synthesiseAfterReviewers.ts
|
|
43032
|
-
import { existsSync as
|
|
43104
|
+
import { existsSync as existsSync72, unlinkSync as unlinkSync18 } from "fs";
|
|
43033
43105
|
|
|
43034
43106
|
// src/commands/review/synthesise.ts
|
|
43035
43107
|
import { readFileSync as readFileSync56 } from "fs";
|
|
@@ -43136,7 +43208,7 @@ async function synthesise(paths, options2) {
|
|
|
43136
43208
|
// src/commands/review/synthesiseAfterReviewers.ts
|
|
43137
43209
|
async function synthesiseAfterReviewers(input) {
|
|
43138
43210
|
const { paths, failures } = input;
|
|
43139
|
-
if (input.anyFresh &&
|
|
43211
|
+
if (input.anyFresh && existsSync72(paths.synthesisPath)) {
|
|
43140
43212
|
unlinkSync18(paths.synthesisPath);
|
|
43141
43213
|
}
|
|
43142
43214
|
const synthesisResult = await synthesise(paths, {
|
|
@@ -43368,9 +43440,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
43368
43440
|
|
|
43369
43441
|
// src/commands/review/buildReviewPaths.ts
|
|
43370
43442
|
import { homedir as homedir27 } from "os";
|
|
43371
|
-
import { basename as basename25, join as
|
|
43443
|
+
import { basename as basename25, join as join94 } from "path";
|
|
43372
43444
|
function buildReviewPaths(repoRoot2, key) {
|
|
43373
|
-
const reviewDir =
|
|
43445
|
+
const reviewDir = join94(
|
|
43374
43446
|
homedir27(),
|
|
43375
43447
|
".assist",
|
|
43376
43448
|
"reviews",
|
|
@@ -43379,10 +43451,10 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
43379
43451
|
);
|
|
43380
43452
|
return {
|
|
43381
43453
|
reviewDir,
|
|
43382
|
-
requestPath:
|
|
43383
|
-
claudePath:
|
|
43384
|
-
codexPath:
|
|
43385
|
-
synthesisPath:
|
|
43454
|
+
requestPath: join94(reviewDir, "request.md"),
|
|
43455
|
+
claudePath: join94(reviewDir, "claude.md"),
|
|
43456
|
+
codexPath: join94(reviewDir, "codex.md"),
|
|
43457
|
+
synthesisPath: join94(reviewDir, "synthesis.md")
|
|
43386
43458
|
};
|
|
43387
43459
|
}
|
|
43388
43460
|
|
|
@@ -43420,10 +43492,10 @@ function fetchExistingComments() {
|
|
|
43420
43492
|
}
|
|
43421
43493
|
|
|
43422
43494
|
// src/commands/review/prepareReviewDir.ts
|
|
43423
|
-
import { existsSync as
|
|
43495
|
+
import { existsSync as existsSync73, mkdirSync as mkdirSync30, unlinkSync as unlinkSync19, writeFileSync as writeFileSync44 } from "fs";
|
|
43424
43496
|
function clearReviewFiles(paths) {
|
|
43425
43497
|
for (const path109 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
43426
|
-
if (
|
|
43498
|
+
if (existsSync73(path109)) unlinkSync19(path109);
|
|
43427
43499
|
}
|
|
43428
43500
|
}
|
|
43429
43501
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -44092,7 +44164,7 @@ import path88 from "path";
|
|
|
44092
44164
|
import chalk262 from "chalk";
|
|
44093
44165
|
|
|
44094
44166
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
44095
|
-
import { existsSync as
|
|
44167
|
+
import { existsSync as existsSync74, readFileSync as readFileSync59, writeFileSync as writeFileSync45 } from "fs";
|
|
44096
44168
|
import path87 from "path";
|
|
44097
44169
|
|
|
44098
44170
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
@@ -44100,12 +44172,12 @@ import { readFileSync as readFileSync58 } from "fs";
|
|
|
44100
44172
|
import path86 from "path";
|
|
44101
44173
|
|
|
44102
44174
|
// src/commands/rules/findClaudeFiles.ts
|
|
44103
|
-
import { readdirSync as
|
|
44175
|
+
import { readdirSync as readdirSync17 } from "fs";
|
|
44104
44176
|
import path85 from "path";
|
|
44105
44177
|
var SKIP_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage"]);
|
|
44106
44178
|
function findClaudeFiles(dir) {
|
|
44107
44179
|
const results = [];
|
|
44108
|
-
for (const entry of
|
|
44180
|
+
for (const entry of readdirSync17(dir, { withFileTypes: true })) {
|
|
44109
44181
|
if (entry.isDirectory()) {
|
|
44110
44182
|
if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name))
|
|
44111
44183
|
continue;
|
|
@@ -44162,7 +44234,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
44162
44234
|
function updateScopedRulesIndex(root2) {
|
|
44163
44235
|
const directories = scopedRuleDirectories(root2);
|
|
44164
44236
|
const rootFile = path87.join(root2, "CLAUDE.md");
|
|
44165
|
-
const before =
|
|
44237
|
+
const before = existsSync74(rootFile) ? readFileSync59(rootFile, "utf8") : "";
|
|
44166
44238
|
const after = upsertScopedRulesPointer(before, directories);
|
|
44167
44239
|
if (after !== before) writeFileSync45(rootFile, after);
|
|
44168
44240
|
return directories;
|
|
@@ -44215,7 +44287,7 @@ function listRules(target, options2 = {}) {
|
|
|
44215
44287
|
}
|
|
44216
44288
|
|
|
44217
44289
|
// src/commands/rules/addRule.ts
|
|
44218
|
-
import { existsSync as
|
|
44290
|
+
import { existsSync as existsSync76, readFileSync as readFileSync61, writeFileSync as writeFileSync46 } from "fs";
|
|
44219
44291
|
import path91 from "path";
|
|
44220
44292
|
import chalk264 from "chalk";
|
|
44221
44293
|
|
|
@@ -44252,7 +44324,7 @@ function nextRuleCode(root2) {
|
|
|
44252
44324
|
}
|
|
44253
44325
|
|
|
44254
44326
|
// src/commands/rules/resolveRuleScope.ts
|
|
44255
|
-
import { existsSync as
|
|
44327
|
+
import { existsSync as existsSync75 } from "fs";
|
|
44256
44328
|
import path90 from "path";
|
|
44257
44329
|
function resolveRuleScope(target) {
|
|
44258
44330
|
const resolved = path90.resolve(target);
|
|
@@ -44262,7 +44334,7 @@ function resolveRuleScope(target) {
|
|
|
44262
44334
|
let current = startDir;
|
|
44263
44335
|
while (true) {
|
|
44264
44336
|
const candidate = path90.join(current, "CLAUDE.md");
|
|
44265
|
-
if (
|
|
44337
|
+
if (existsSync75(candidate)) return candidate;
|
|
44266
44338
|
if (current === root2 || current === path90.dirname(current)) break;
|
|
44267
44339
|
current = path90.dirname(current);
|
|
44268
44340
|
}
|
|
@@ -44271,7 +44343,7 @@ function resolveRuleScope(target) {
|
|
|
44271
44343
|
|
|
44272
44344
|
// src/commands/rules/addRule.ts
|
|
44273
44345
|
function read2(file) {
|
|
44274
|
-
return
|
|
44346
|
+
return existsSync76(file) ? readFileSync61(file, "utf8") : "";
|
|
44275
44347
|
}
|
|
44276
44348
|
function addRule(text20, options2) {
|
|
44277
44349
|
const rule = text20.trim();
|
|
@@ -44984,12 +45056,12 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
44984
45056
|
}
|
|
44985
45057
|
|
|
44986
45058
|
// src/commands/slack/slackWorkingFile.ts
|
|
44987
|
-
import { join as
|
|
45059
|
+
import { join as join95 } from "path";
|
|
44988
45060
|
function slackWorkingFile(channel, partIndex) {
|
|
44989
45061
|
const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
|
|
44990
|
-
const dir =
|
|
45062
|
+
const dir = join95(getStoreDir(), "slack");
|
|
44991
45063
|
const name = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
|
|
44992
|
-
return { dir, bodyPath:
|
|
45064
|
+
return { dir, bodyPath: join95(dir, `${name}.md`) };
|
|
44993
45065
|
}
|
|
44994
45066
|
|
|
44995
45067
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
@@ -45810,7 +45882,7 @@ function registerSync(program) {
|
|
|
45810
45882
|
}
|
|
45811
45883
|
|
|
45812
45884
|
// src/commands/transcript/clean.ts
|
|
45813
|
-
import { existsSync as
|
|
45885
|
+
import { existsSync as existsSync81 } from "fs";
|
|
45814
45886
|
|
|
45815
45887
|
// src/commands/transcript/convert/formatTimestamp.ts
|
|
45816
45888
|
function pad2(value, width2) {
|
|
@@ -46088,7 +46160,7 @@ function clean(file, options2 = {}) {
|
|
|
46088
46160
|
);
|
|
46089
46161
|
process.exit(1);
|
|
46090
46162
|
}
|
|
46091
|
-
if (!
|
|
46163
|
+
if (!existsSync81(file)) {
|
|
46092
46164
|
console.error(`Error: VTT file not found: ${file}`);
|
|
46093
46165
|
process.exit(1);
|
|
46094
46166
|
}
|
|
@@ -46171,21 +46243,21 @@ async function configure() {
|
|
|
46171
46243
|
}
|
|
46172
46244
|
|
|
46173
46245
|
// src/commands/transcript/list.ts
|
|
46174
|
-
import { existsSync as
|
|
46175
|
-
import { join as
|
|
46246
|
+
import { existsSync as existsSync82, readdirSync as readdirSync24, statSync as statSync13 } from "fs";
|
|
46247
|
+
import { join as join107 } from "path";
|
|
46176
46248
|
function list5() {
|
|
46177
46249
|
const { vttDir } = getTranscriptConfig();
|
|
46178
|
-
if (!
|
|
46179
|
-
for (const entry of
|
|
46250
|
+
if (!existsSync82(vttDir)) return;
|
|
46251
|
+
for (const entry of readdirSync24(vttDir)) {
|
|
46180
46252
|
if (!entry.endsWith(".vtt")) continue;
|
|
46181
|
-
if (
|
|
46253
|
+
if (statSync13(join107(vttDir, entry)).isDirectory()) continue;
|
|
46182
46254
|
console.log(entry);
|
|
46183
46255
|
}
|
|
46184
46256
|
}
|
|
46185
46257
|
|
|
46186
46258
|
// src/commands/transcript/move.ts
|
|
46187
|
-
import { existsSync as
|
|
46188
|
-
import { basename as basename29, join as
|
|
46259
|
+
import { existsSync as existsSync83, mkdirSync as mkdirSync38, renameSync as renameSync5, writeFileSync as writeFileSync53 } from "fs";
|
|
46260
|
+
import { basename as basename29, join as join108 } from "path";
|
|
46189
46261
|
|
|
46190
46262
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
46191
46263
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -46195,9 +46267,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
46195
46267
|
// src/commands/transcript/move.ts
|
|
46196
46268
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
46197
46269
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
46198
|
-
const processedDir =
|
|
46270
|
+
const processedDir = join108(vttDir, "processed");
|
|
46199
46271
|
mkdirSync38(processedDir, { recursive: true });
|
|
46200
|
-
renameSync5(sourcePath,
|
|
46272
|
+
renameSync5(sourcePath, join108(processedDir, filename));
|
|
46201
46273
|
}
|
|
46202
46274
|
function move(file, options2) {
|
|
46203
46275
|
const { date, client } = options2;
|
|
@@ -46207,25 +46279,25 @@ function move(file, options2) {
|
|
|
46207
46279
|
}
|
|
46208
46280
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
46209
46281
|
const filename = basename29(file);
|
|
46210
|
-
const sourcePath =
|
|
46211
|
-
if (!
|
|
46282
|
+
const sourcePath = join108(vttDir, filename);
|
|
46283
|
+
if (!existsSync83(sourcePath)) {
|
|
46212
46284
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
46213
46285
|
process.exit(1);
|
|
46214
46286
|
}
|
|
46215
46287
|
const base = basename29(filename, ".vtt").replace(/ Transcription$/, "");
|
|
46216
46288
|
const outputName = `${date} ${base}.md`;
|
|
46217
|
-
const formattedDir =
|
|
46289
|
+
const formattedDir = join108(transcriptsDir, client);
|
|
46218
46290
|
mkdirSync38(formattedDir, { recursive: true });
|
|
46219
|
-
const formattedPath =
|
|
46291
|
+
const formattedPath = join108(formattedDir, outputName);
|
|
46220
46292
|
writeFileSync53(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
46221
46293
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
46222
|
-
const summaryPath =
|
|
46294
|
+
const summaryPath = join108(summaryDir, client, outputName);
|
|
46223
46295
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
46224
46296
|
console.log(`Summary target: ${summaryPath}`);
|
|
46225
46297
|
}
|
|
46226
46298
|
|
|
46227
46299
|
// src/commands/transcript/merge.ts
|
|
46228
|
-
import { existsSync as
|
|
46300
|
+
import { existsSync as existsSync84, writeFileSync as writeFileSync54 } from "fs";
|
|
46229
46301
|
import { basename as basename30 } from "path";
|
|
46230
46302
|
|
|
46231
46303
|
// src/commands/transcript/failTranscript.ts
|
|
@@ -46369,7 +46441,7 @@ function widenAudience(passages) {
|
|
|
46369
46441
|
|
|
46370
46442
|
// src/commands/transcript/merge.ts
|
|
46371
46443
|
function readSource3(file) {
|
|
46372
|
-
if (!
|
|
46444
|
+
if (!existsSync84(file)) failTranscript(`VTT file not found: ${file}`);
|
|
46373
46445
|
const cues = readCleanedCues(file);
|
|
46374
46446
|
if (cues.length === 0) failTranscript(`no cues found in: ${file}`);
|
|
46375
46447
|
return { path: file, name: basename30(file), cues };
|
|
@@ -46842,7 +46914,7 @@ function configKeys2() {
|
|
|
46842
46914
|
}
|
|
46843
46915
|
|
|
46844
46916
|
// src/commands/verify/forbiddenStrings.ts
|
|
46845
|
-
import { existsSync as
|
|
46917
|
+
import { existsSync as existsSync85, readFileSync as readFileSync69 } from "fs";
|
|
46846
46918
|
|
|
46847
46919
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
46848
46920
|
import { minimatch as minimatch10 } from "minimatch";
|
|
@@ -46883,7 +46955,7 @@ function forbiddenStrings() {
|
|
|
46883
46955
|
const cache7 = /* @__PURE__ */ new Map();
|
|
46884
46956
|
const readJson = (file) => {
|
|
46885
46957
|
if (cache7.has(file)) return cache7.get(file);
|
|
46886
|
-
if (!
|
|
46958
|
+
if (!existsSync85(file)) {
|
|
46887
46959
|
console.log(`Forbidden-strings file not found: ${file}`);
|
|
46888
46960
|
process.exit(1);
|
|
46889
46961
|
}
|
|
@@ -47033,10 +47105,10 @@ function checkSequential(migrations3, files) {
|
|
|
47033
47105
|
}
|
|
47034
47106
|
|
|
47035
47107
|
// src/commands/verify/migrations/listMigrationFiles.ts
|
|
47036
|
-
import { readdirSync as
|
|
47108
|
+
import { readdirSync as readdirSync25 } from "fs";
|
|
47037
47109
|
var MIGRATION_FILE2 = /^migration\d+[A-Za-z0-9]*\.ts$/;
|
|
47038
47110
|
function listMigrationFiles(dir) {
|
|
47039
|
-
return
|
|
47111
|
+
return readdirSync25(dir).filter((file) => MIGRATION_FILE2.test(file));
|
|
47040
47112
|
}
|
|
47041
47113
|
|
|
47042
47114
|
// src/commands/verify/migrations/readBaselineMigrations.ts
|
|
@@ -47430,7 +47502,7 @@ ${result.reason}`
|
|
|
47430
47502
|
}
|
|
47431
47503
|
|
|
47432
47504
|
// src/commands/watch/markSyncPending.ts
|
|
47433
|
-
import { existsSync as
|
|
47505
|
+
import { existsSync as existsSync86, writeFileSync as writeFileSync55 } from "fs";
|
|
47434
47506
|
|
|
47435
47507
|
// src/commands/watch/gitMarkerPath.ts
|
|
47436
47508
|
import { resolve as resolve30 } from "path";
|
|
@@ -47449,7 +47521,7 @@ function syncPendingPath(cwd) {
|
|
|
47449
47521
|
// src/commands/watch/markSyncPending.ts
|
|
47450
47522
|
function pendingFromEarlierLap() {
|
|
47451
47523
|
try {
|
|
47452
|
-
return
|
|
47524
|
+
return existsSync86(syncPendingPath());
|
|
47453
47525
|
} catch {
|
|
47454
47526
|
return false;
|
|
47455
47527
|
}
|
|
@@ -47612,7 +47684,7 @@ function resolveParams(params, cliArgs) {
|
|
|
47612
47684
|
}
|
|
47613
47685
|
|
|
47614
47686
|
// src/commands/run/resolveRunCwd.ts
|
|
47615
|
-
import { existsSync as
|
|
47687
|
+
import { existsSync as existsSync87 } from "fs";
|
|
47616
47688
|
import { resolve as resolve31 } from "path";
|
|
47617
47689
|
var MissingRunCwdError = class extends Error {
|
|
47618
47690
|
constructor(runName, cwd) {
|
|
@@ -47625,7 +47697,7 @@ var MissingRunCwdError = class extends Error {
|
|
|
47625
47697
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
47626
47698
|
if (!config.cwd) return void 0;
|
|
47627
47699
|
const cwd = resolve31(baseDir, config.cwd);
|
|
47628
|
-
if (!
|
|
47700
|
+
if (!existsSync87(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
47629
47701
|
return cwd;
|
|
47630
47702
|
}
|
|
47631
47703
|
|
|
@@ -47762,10 +47834,10 @@ ${buildWatchReport(from)}`);
|
|
|
47762
47834
|
}
|
|
47763
47835
|
|
|
47764
47836
|
// src/commands/watch/consumeMarker.ts
|
|
47765
|
-
import { existsSync as
|
|
47837
|
+
import { existsSync as existsSync88, rmSync as rmSync12 } from "fs";
|
|
47766
47838
|
function consumeMarker(path109) {
|
|
47767
47839
|
try {
|
|
47768
|
-
if (!
|
|
47840
|
+
if (!existsSync88(path109)) return false;
|
|
47769
47841
|
rmSync12(path109);
|
|
47770
47842
|
return true;
|
|
47771
47843
|
} catch {
|
|
@@ -48047,19 +48119,19 @@ function registerWatch(program) {
|
|
|
48047
48119
|
|
|
48048
48120
|
// src/commands/roam/postRoamActivity.ts
|
|
48049
48121
|
import { execFileSync as execFileSync31 } from "child_process";
|
|
48050
|
-
import { readdirSync as
|
|
48051
|
-
import { join as
|
|
48122
|
+
import { readdirSync as readdirSync26, readFileSync as readFileSync71, statSync as statSync14 } from "fs";
|
|
48123
|
+
import { join as join109 } from "path";
|
|
48052
48124
|
function findPortFile(roamDir) {
|
|
48053
48125
|
let entries;
|
|
48054
48126
|
try {
|
|
48055
|
-
entries =
|
|
48127
|
+
entries = readdirSync26(roamDir);
|
|
48056
48128
|
} catch {
|
|
48057
48129
|
return void 0;
|
|
48058
48130
|
}
|
|
48059
48131
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
48060
|
-
const path109 =
|
|
48132
|
+
const path109 = join109(roamDir, name);
|
|
48061
48133
|
try {
|
|
48062
|
-
return { path: path109, mtimeMs:
|
|
48134
|
+
return { path: path109, mtimeMs: statSync14(path109).mtimeMs };
|
|
48063
48135
|
} catch {
|
|
48064
48136
|
return void 0;
|
|
48065
48137
|
}
|
|
@@ -48074,7 +48146,7 @@ var PID_BY_APP = {
|
|
|
48074
48146
|
function postRoamActivity(app, event) {
|
|
48075
48147
|
const appData = process.env.APPDATA;
|
|
48076
48148
|
if (!appData) return;
|
|
48077
|
-
const portFile = findPortFile(
|
|
48149
|
+
const portFile = findPortFile(join109(appData, "Roam"));
|
|
48078
48150
|
if (!portFile) return;
|
|
48079
48151
|
let port;
|
|
48080
48152
|
try {
|
|
@@ -48417,11 +48489,11 @@ function requireParsedArgs() {
|
|
|
48417
48489
|
}
|
|
48418
48490
|
|
|
48419
48491
|
// src/commands/run/runCommandFilePath.ts
|
|
48420
|
-
import { join as
|
|
48492
|
+
import { join as join110 } from "path";
|
|
48421
48493
|
function runCommandFilePath(name) {
|
|
48422
48494
|
const segments = name.split(":");
|
|
48423
48495
|
const file = `${segments.pop()}.md`;
|
|
48424
|
-
return
|
|
48496
|
+
return join110(".claude", "commands", ...segments, file);
|
|
48425
48497
|
}
|
|
48426
48498
|
|
|
48427
48499
|
// src/commands/run/add.ts
|
|
@@ -48549,8 +48621,8 @@ function registerRunAdd(runCommand) {
|
|
|
48549
48621
|
}
|
|
48550
48622
|
|
|
48551
48623
|
// src/commands/run/remove.ts
|
|
48552
|
-
import { existsSync as
|
|
48553
|
-
import { dirname as dirname47, join as
|
|
48624
|
+
import { existsSync as existsSync89, readdirSync as readdirSync27, rmdirSync, unlinkSync as unlinkSync20 } from "fs";
|
|
48625
|
+
import { dirname as dirname47, join as join111 } from "path";
|
|
48554
48626
|
|
|
48555
48627
|
// src/commands/run/removeRepoRunConfig.ts
|
|
48556
48628
|
function isNamed(entry, name) {
|
|
@@ -48568,17 +48640,17 @@ function removeRepoRunConfig(name, repoName, cwd = process.cwd()) {
|
|
|
48568
48640
|
|
|
48569
48641
|
// src/commands/run/remove.ts
|
|
48570
48642
|
function removeEmptyNamespaceDirs(filePath) {
|
|
48571
|
-
const root2 =
|
|
48643
|
+
const root2 = join111(".claude", "commands");
|
|
48572
48644
|
for (let dir = dirname47(filePath); dir !== root2; dir = dirname47(dir)) {
|
|
48573
|
-
if (!
|
|
48645
|
+
if (!existsSync89(dir) || readdirSync27(dir).length > 0) return;
|
|
48574
48646
|
rmdirSync(dir);
|
|
48575
48647
|
}
|
|
48576
48648
|
}
|
|
48577
48649
|
function deleteCommandFile(name) {
|
|
48578
48650
|
const filePath = runCommandFilePath(name);
|
|
48579
|
-
const legacyPath =
|
|
48651
|
+
const legacyPath = join111(".claude", "commands", `${name}.md`);
|
|
48580
48652
|
for (const path109 of /* @__PURE__ */ new Set([filePath, legacyPath])) {
|
|
48581
|
-
if (
|
|
48653
|
+
if (existsSync89(path109)) {
|
|
48582
48654
|
unlinkSync20(path109);
|
|
48583
48655
|
console.log(`Deleted command file: ${path109}`);
|
|
48584
48656
|
}
|
|
@@ -49301,12 +49373,12 @@ function toSessionViewInfo({
|
|
|
49301
49373
|
}
|
|
49302
49374
|
|
|
49303
49375
|
// src/commands/sessions/daemon/worktree/joinRefusal.ts
|
|
49304
|
-
import { existsSync as
|
|
49376
|
+
import { existsSync as existsSync90 } from "fs";
|
|
49305
49377
|
function joinRefusal(session) {
|
|
49306
49378
|
if (session.commandType === "run") return "a server run has no agent stream";
|
|
49307
49379
|
if (session.closing === true) return "the session is closing";
|
|
49308
49380
|
if (!session.cwd) return "the session has no working directory";
|
|
49309
|
-
if (!
|
|
49381
|
+
if (!existsSync90(session.cwd))
|
|
49310
49382
|
return "the session's workspace no longer exists";
|
|
49311
49383
|
return void 0;
|
|
49312
49384
|
}
|
|
@@ -49382,8 +49454,8 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
|
|
|
49382
49454
|
}
|
|
49383
49455
|
|
|
49384
49456
|
// src/commands/sessions/daemon/findServerParents.ts
|
|
49385
|
-
import { existsSync as
|
|
49386
|
-
import { join as
|
|
49457
|
+
import { existsSync as existsSync91 } from "fs";
|
|
49458
|
+
import { join as join112, resolve as resolve32 } from "path";
|
|
49387
49459
|
function isLive(session) {
|
|
49388
49460
|
return !!session.pty && session.status !== "done" && session.status !== "error";
|
|
49389
49461
|
}
|
|
@@ -49392,7 +49464,7 @@ function isLiveAgent(session) {
|
|
|
49392
49464
|
}
|
|
49393
49465
|
function serverRunDirs(sessions, file) {
|
|
49394
49466
|
return new Set(
|
|
49395
|
-
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve32(s.cwd)).filter((dir) =>
|
|
49467
|
+
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve32(s.cwd)).filter((dir) => existsSync91(join112(dir, file)))
|
|
49396
49468
|
);
|
|
49397
49469
|
}
|
|
49398
49470
|
function findServerParents(sessions, file) {
|
|
@@ -50061,11 +50133,11 @@ function sessionBase(id, status2) {
|
|
|
50061
50133
|
}
|
|
50062
50134
|
|
|
50063
50135
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
50064
|
-
import { existsSync as
|
|
50136
|
+
import { existsSync as existsSync93 } from "fs";
|
|
50065
50137
|
import * as pty from "node-pty";
|
|
50066
50138
|
|
|
50067
50139
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
50068
|
-
import { chmodSync, existsSync as
|
|
50140
|
+
import { chmodSync, existsSync as existsSync92, statSync as statSync15 } from "fs";
|
|
50069
50141
|
import { createRequire as createRequire3 } from "module";
|
|
50070
50142
|
import path106 from "path";
|
|
50071
50143
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -50080,8 +50152,8 @@ function ensureSpawnHelperExecutable() {
|
|
|
50080
50152
|
`${process.platform}-${process.arch}`,
|
|
50081
50153
|
"spawn-helper"
|
|
50082
50154
|
);
|
|
50083
|
-
if (!
|
|
50084
|
-
const mode =
|
|
50155
|
+
if (!existsSync92(helper)) return;
|
|
50156
|
+
const mode = statSync15(helper).mode;
|
|
50085
50157
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
50086
50158
|
}
|
|
50087
50159
|
|
|
@@ -50136,7 +50208,7 @@ function spawnPty(args, cwd, sessionId2, extraEnv) {
|
|
|
50136
50208
|
});
|
|
50137
50209
|
}
|
|
50138
50210
|
function refuseMissingCwd(cwd, sessionId2) {
|
|
50139
|
-
if (!cwd ||
|
|
50211
|
+
if (!cwd || existsSync93(cwd)) return;
|
|
50140
50212
|
daemonLog(
|
|
50141
50213
|
`${sessionId2 ? `session ${sessionId2}` : "pty"} not spawned: working directory ${cwd} no longer exists`
|
|
50142
50214
|
);
|
|
@@ -50306,7 +50378,7 @@ function createRunSession(id, { runName, runArgs, cwd, meta }) {
|
|
|
50306
50378
|
}
|
|
50307
50379
|
|
|
50308
50380
|
// src/commands/sessions/daemon/autoUpdate/autoUpdateControl.ts
|
|
50309
|
-
import { existsSync as
|
|
50381
|
+
import { existsSync as existsSync94, rmSync as rmSync13, writeFileSync as writeFileSync59 } from "fs";
|
|
50310
50382
|
var paused;
|
|
50311
50383
|
var wake;
|
|
50312
50384
|
var holdReleased = false;
|
|
@@ -50319,7 +50391,7 @@ function persist2(value) {
|
|
|
50319
50391
|
}
|
|
50320
50392
|
var autoUpdateControl = {
|
|
50321
50393
|
paused: () => {
|
|
50322
|
-
paused ??=
|
|
50394
|
+
paused ??= existsSync94(daemonPaths.autoUpdatePaused);
|
|
50323
50395
|
return paused;
|
|
50324
50396
|
},
|
|
50325
50397
|
setPaused: (value) => {
|
|
@@ -50548,7 +50620,7 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
50548
50620
|
}
|
|
50549
50621
|
|
|
50550
50622
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
50551
|
-
import { existsSync as
|
|
50623
|
+
import { existsSync as existsSync95 } from "fs";
|
|
50552
50624
|
var treeIsGone = { durable: true, gone: true };
|
|
50553
50625
|
function treeDurability(state) {
|
|
50554
50626
|
if (state.dirty) return { durable: false, reason: "uncommitted changes" };
|
|
@@ -50579,14 +50651,14 @@ function* durabilityProbes() {
|
|
|
50579
50651
|
});
|
|
50580
50652
|
}
|
|
50581
50653
|
async function checkDurability(cwd) {
|
|
50582
|
-
if (!
|
|
50654
|
+
if (!existsSync95(cwd)) return treeIsGone;
|
|
50583
50655
|
const probes = durabilityProbes();
|
|
50584
50656
|
let step3 = probes.next();
|
|
50585
50657
|
while (!step3.done) step3 = probes.next(await gitResult(cwd, step3.value));
|
|
50586
50658
|
return step3.value;
|
|
50587
50659
|
}
|
|
50588
50660
|
function checkDurabilitySync(cwd) {
|
|
50589
|
-
if (!
|
|
50661
|
+
if (!existsSync95(cwd)) return treeIsGone;
|
|
50590
50662
|
const probes = durabilityProbes();
|
|
50591
50663
|
let step3 = probes.next();
|
|
50592
50664
|
while (!step3.done) step3 = probes.next(gitSyncResult(cwd, step3.value));
|
|
@@ -50870,17 +50942,17 @@ function setStatus2(session, newStatus) {
|
|
|
50870
50942
|
}
|
|
50871
50943
|
|
|
50872
50944
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
50873
|
-
import { existsSync as
|
|
50945
|
+
import { existsSync as existsSync97 } from "fs";
|
|
50874
50946
|
import { basename as basename32 } from "path";
|
|
50875
50947
|
|
|
50876
50948
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
50877
|
-
import { existsSync as
|
|
50878
|
-
import { join as
|
|
50949
|
+
import { existsSync as existsSync96 } from "fs";
|
|
50950
|
+
import { join as join115 } from "path";
|
|
50879
50951
|
|
|
50880
50952
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
50881
|
-
import { statSync as
|
|
50953
|
+
import { statSync as statSync16 } from "fs";
|
|
50882
50954
|
import { rm as rm3 } from "fs/promises";
|
|
50883
|
-
import { join as
|
|
50955
|
+
import { join as join114 } from "path";
|
|
50884
50956
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
50885
50957
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
50886
50958
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -50908,7 +50980,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
50908
50980
|
return { removed: true };
|
|
50909
50981
|
}
|
|
50910
50982
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
50911
|
-
return
|
|
50983
|
+
return statSync16(join114(worktreePath, ".git"), {
|
|
50912
50984
|
throwIfNoEntry: false
|
|
50913
50985
|
})?.isDirectory() === true;
|
|
50914
50986
|
}
|
|
@@ -50944,7 +51016,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
50944
51016
|
);
|
|
50945
51017
|
}
|
|
50946
51018
|
function strandedReason(worktreePath, cause) {
|
|
50947
|
-
if (!
|
|
51019
|
+
if (!existsSync96(join115(worktreePath, ".git")))
|
|
50948
51020
|
return "its .git link is already gone";
|
|
50949
51021
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
50950
51022
|
return "git no longer recognises it as a working tree";
|
|
@@ -50996,7 +51068,7 @@ function reason3(error) {
|
|
|
50996
51068
|
|
|
50997
51069
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
50998
51070
|
async function reapWorktree(worktreePath, force = false) {
|
|
50999
|
-
if (!
|
|
51071
|
+
if (!existsSync97(worktreePath)) {
|
|
51000
51072
|
forgetWorktree(worktreePath);
|
|
51001
51073
|
daemonLog(
|
|
51002
51074
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -51021,7 +51093,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
51021
51093
|
}
|
|
51022
51094
|
function owningClone(worktreePath) {
|
|
51023
51095
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
51024
|
-
if (recorded &&
|
|
51096
|
+
if (recorded && existsSync97(recorded)) return recorded;
|
|
51025
51097
|
const detected = mainWorktree(worktreePath);
|
|
51026
51098
|
if (detected) return detected;
|
|
51027
51099
|
daemonLog(
|
|
@@ -51170,12 +51242,12 @@ function closeGateApplies(sessions, session) {
|
|
|
51170
51242
|
}
|
|
51171
51243
|
|
|
51172
51244
|
// src/commands/sessions/daemon/worktree/liveProcessesInTree.ts
|
|
51173
|
-
import { readdirSync as
|
|
51245
|
+
import { readdirSync as readdirSync28, readlinkSync } from "fs";
|
|
51174
51246
|
import { sep as sep4 } from "path";
|
|
51175
51247
|
function liveProcessesInTree(treePath, procRoot = "/proc") {
|
|
51176
51248
|
let entries;
|
|
51177
51249
|
try {
|
|
51178
|
-
entries =
|
|
51250
|
+
entries = readdirSync28(procRoot);
|
|
51179
51251
|
} catch {
|
|
51180
51252
|
return [];
|
|
51181
51253
|
}
|
|
@@ -51308,12 +51380,12 @@ async function closeBlockReason(sessionId2, tree) {
|
|
|
51308
51380
|
}
|
|
51309
51381
|
|
|
51310
51382
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
51311
|
-
import { existsSync as
|
|
51383
|
+
import { existsSync as existsSync98, watch } from "fs";
|
|
51312
51384
|
var DEBOUNCE_MS = 500;
|
|
51313
51385
|
var POLL_MS5 = 3e4;
|
|
51314
51386
|
function watchGitState(cwd, onChange) {
|
|
51315
51387
|
const common = gitCommonDir(cwd);
|
|
51316
|
-
if (!common || !
|
|
51388
|
+
if (!common || !existsSync98(common)) return void 0;
|
|
51317
51389
|
const watchers = [
|
|
51318
51390
|
watchGitDir(common, onChange),
|
|
51319
51391
|
pollGitState(cwd, onChange)
|
|
@@ -52036,10 +52108,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
52036
52108
|
}
|
|
52037
52109
|
|
|
52038
52110
|
// src/commands/sessions/daemon/exitReason.ts
|
|
52039
|
-
import { existsSync as
|
|
52111
|
+
import { existsSync as existsSync99 } from "fs";
|
|
52040
52112
|
import { resolve as resolve33 } from "path";
|
|
52041
52113
|
function exitDetail(session) {
|
|
52042
|
-
if (session.cwd && !
|
|
52114
|
+
if (session.cwd && !existsSync99(session.cwd))
|
|
52043
52115
|
return `working directory ${session.cwd} no longer exists`;
|
|
52044
52116
|
return missingRunConfigCwd(session);
|
|
52045
52117
|
}
|
|
@@ -52053,7 +52125,7 @@ function missingRunConfigCwd(session) {
|
|
|
52053
52125
|
const config = resolveRunConfig(session.runName, dir);
|
|
52054
52126
|
if (!config?.cwd) return void 0;
|
|
52055
52127
|
const configured = resolve33(runConfigBaseDirFrom(dir), config.cwd);
|
|
52056
|
-
if (
|
|
52128
|
+
if (existsSync99(configured)) return void 0;
|
|
52057
52129
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
52058
52130
|
}
|
|
52059
52131
|
|
|
@@ -52101,7 +52173,7 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
|
|
|
52101
52173
|
}
|
|
52102
52174
|
|
|
52103
52175
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
52104
|
-
import { existsSync as
|
|
52176
|
+
import { existsSync as existsSync100, mkdirSync as mkdirSync41, watch as watch2 } from "fs";
|
|
52105
52177
|
import { dirname as dirname50 } from "path";
|
|
52106
52178
|
|
|
52107
52179
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
@@ -52186,7 +52258,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
52186
52258
|
if (timer) clearTimeout(timer);
|
|
52187
52259
|
timer = setTimeout(read3, DEBOUNCE_MS2);
|
|
52188
52260
|
});
|
|
52189
|
-
if (
|
|
52261
|
+
if (existsSync100(path109)) read3();
|
|
52190
52262
|
}
|
|
52191
52263
|
function refreshActivity(session) {
|
|
52192
52264
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -54464,7 +54536,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
54464
54536
|
}
|
|
54465
54537
|
|
|
54466
54538
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
54467
|
-
import { existsSync as
|
|
54539
|
+
import { existsSync as existsSync102 } from "fs";
|
|
54468
54540
|
import { basename as basename35 } from "path";
|
|
54469
54541
|
|
|
54470
54542
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -54485,9 +54557,9 @@ function accountedTrees(sessions) {
|
|
|
54485
54557
|
}
|
|
54486
54558
|
|
|
54487
54559
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
54488
|
-
import { existsSync as
|
|
54560
|
+
import { existsSync as existsSync101 } from "fs";
|
|
54489
54561
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
54490
|
-
if (!
|
|
54562
|
+
if (!existsSync101(clone)) {
|
|
54491
54563
|
for (const { path: path109 } of paths) forgetWorktree(path109);
|
|
54492
54564
|
daemonLog(
|
|
54493
54565
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
@@ -54653,7 +54725,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
54653
54725
|
);
|
|
54654
54726
|
continue;
|
|
54655
54727
|
}
|
|
54656
|
-
if (!
|
|
54728
|
+
if (!existsSync102(path109)) {
|
|
54657
54729
|
logVanishedTree(sessions, path109);
|
|
54658
54730
|
vanished.set(clone, [
|
|
54659
54731
|
...vanished.get(clone) ?? [],
|
|
@@ -55853,7 +55925,7 @@ function spawnAssistInTree(ctx, assistArgs, cwd, meta, context) {
|
|
|
55853
55925
|
}
|
|
55854
55926
|
|
|
55855
55927
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
55856
|
-
import { existsSync as
|
|
55928
|
+
import { existsSync as existsSync105 } from "fs";
|
|
55857
55929
|
|
|
55858
55930
|
// src/commands/sessions/daemon/resumeSession.ts
|
|
55859
55931
|
function resumeSession(id, sessionId2, cwd, name, holdPty, harness) {
|
|
@@ -55884,11 +55956,11 @@ function resumeSession(id, sessionId2, cwd, name, holdPty, harness) {
|
|
|
55884
55956
|
}
|
|
55885
55957
|
|
|
55886
55958
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
55887
|
-
import { existsSync as
|
|
55959
|
+
import { existsSync as existsSync104 } from "fs";
|
|
55888
55960
|
|
|
55889
55961
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
55890
|
-
import { copyFileSync as copyFileSync4, existsSync as
|
|
55891
|
-
import { join as
|
|
55962
|
+
import { copyFileSync as copyFileSync4, existsSync as existsSync103, mkdirSync as mkdirSync43 } from "fs";
|
|
55963
|
+
import { join as join116 } from "path";
|
|
55892
55964
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
55893
55965
|
const dir = projectDirForCwd(toCwd);
|
|
55894
55966
|
if (dir === projectDirForCwd(fromCwd)) {
|
|
@@ -55897,8 +55969,8 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
55897
55969
|
);
|
|
55898
55970
|
return;
|
|
55899
55971
|
}
|
|
55900
|
-
const dest =
|
|
55901
|
-
if (
|
|
55972
|
+
const dest = join116(dir, `${claudeSessionId}.jsonl`);
|
|
55973
|
+
if (existsSync103(dest)) {
|
|
55902
55974
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
55903
55975
|
return;
|
|
55904
55976
|
}
|
|
@@ -55949,7 +56021,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
|
|
|
55949
56021
|
}
|
|
55950
56022
|
function cloneForReapedTree(missingCwd) {
|
|
55951
56023
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
55952
|
-
if (!clone || !
|
|
56024
|
+
if (!clone || !existsSync104(clone))
|
|
55953
56025
|
throw new Error(
|
|
55954
56026
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
55955
56027
|
);
|
|
@@ -55958,7 +56030,7 @@ function cloneForReapedTree(missingCwd) {
|
|
|
55958
56030
|
|
|
55959
56031
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
55960
56032
|
function resumeInTree(ctx, sessionId2, cwd, name, harness) {
|
|
55961
|
-
if (!
|
|
56033
|
+
if (!existsSync105(cwd))
|
|
55962
56034
|
return resumeInReplacementTree(ctx, sessionId2, cwd, name, harness);
|
|
55963
56035
|
const id = ctx.spawnWith(
|
|
55964
56036
|
(sid) => resumeSession(sid, sessionId2, cwd, name, void 0, harness)
|
|
@@ -57227,7 +57299,7 @@ function isPrCheckoutArgs(args) {
|
|
|
57227
57299
|
|
|
57228
57300
|
// src/commands/sessions/daemon/worktree/prCheckoutHolder.ts
|
|
57229
57301
|
import { execFile as execFile14 } from "child_process";
|
|
57230
|
-
import { existsSync as
|
|
57302
|
+
import { existsSync as existsSync106 } from "fs";
|
|
57231
57303
|
function prHeadBranch2(number, cwd) {
|
|
57232
57304
|
const { headBranch } = prCliCommands(number, cwd);
|
|
57233
57305
|
return new Promise((resolve34) => {
|
|
@@ -57241,12 +57313,12 @@ function prHeadBranch2(number, cwd) {
|
|
|
57241
57313
|
}
|
|
57242
57314
|
async function prCheckoutHolder(assistArgs, cwd) {
|
|
57243
57315
|
const number = prCheckoutNumber(assistArgs);
|
|
57244
|
-
if (!number || !cwd || !
|
|
57316
|
+
if (!number || !cwd || !existsSync106(cwd)) return void 0;
|
|
57245
57317
|
const headRef = await prHeadBranch2(number, cwd);
|
|
57246
57318
|
if (!headRef) return void 0;
|
|
57247
57319
|
const listing = await gitOrNull(cwd, ["worktree", "list", "--porcelain"]);
|
|
57248
57320
|
const holder = listing ? worktreeWithBranch(listing, headRef) : null;
|
|
57249
|
-
if (!holder || !
|
|
57321
|
+
if (!holder || !existsSync106(holder)) return void 0;
|
|
57250
57322
|
daemonLog(
|
|
57251
57323
|
`pr #${number} assist ${assistArgs[0]} launched in its checkout ${holder}: head branch ${headRef} is already checked out there, so no worktree is allocated`
|
|
57252
57324
|
);
|