@staff0rd/assist 0.1051.2 → 0.1053.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 +450 -450
- package/dist/index.js +508 -433
- 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.1053.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) };
|
|
@@ -40601,37 +40628,69 @@ import { readFileSync as readFileSync54 } from "fs";
|
|
|
40601
40628
|
|
|
40602
40629
|
// src/commands/review/highLevel/formatSlicingRequest.ts
|
|
40603
40630
|
var RULES = [
|
|
40604
|
-
"Each slice is
|
|
40631
|
+
"Each slice is one behaviour end to end: the code, wiring, config, tests and docs that deliver it, so a reviewer can judge whether that behaviour is right.",
|
|
40632
|
+
"Never split one behaviour by layer or file type: its command, workflow, generated output, tests and docs stay in one slice.",
|
|
40633
|
+
"Split only where the PR does independent things a reviewer could accept or reject separately. Most PRs need one to three slices.",
|
|
40634
|
+
"A refactor or move with no behaviour change gets its own slice.",
|
|
40605
40635
|
"A hunk may appear in more than one slice.",
|
|
40606
|
-
"Tests go in the same slice as the code they test, and get their own slice only when they stand alone.",
|
|
40607
40636
|
"Generated files such as lockfiles get their own slice unless they belong with a specific change.",
|
|
40608
40637
|
"List slices in reading order."
|
|
40609
40638
|
];
|
|
40639
|
+
var MANUAL_TESTING_RULES = [
|
|
40640
|
+
"Write PR-wide steps for only what needs a human: looking at a UI, clicking through a page, judging how something reads or looks, or acting in a system an agent cannot drive.",
|
|
40641
|
+
"Leave out anything an agent could run and check itself: CLI commands with checkable output, test runs, builds, lint, API or HTTP calls, reading files.",
|
|
40642
|
+
"When nothing in the PR needs a human, write `steps: []` and `setup: []`.",
|
|
40643
|
+
"`setup` lists what the reviewer must do first: branches to check out, servers or daemons to restart, config to set, data to seed. Keep each entry short.",
|
|
40644
|
+
"Each step's `action` says exactly what to open and do: the URL or page and what to click or enter.",
|
|
40645
|
+
"Each step's `expect` says what the reviewer should see when the change works.",
|
|
40646
|
+
"Name repo files by their path from the repo root, and give URLs in full."
|
|
40647
|
+
];
|
|
40648
|
+
var EXAMPLE = {
|
|
40649
|
+
slices: [
|
|
40650
|
+
{
|
|
40651
|
+
title: "Short imperative title",
|
|
40652
|
+
summary: "One or two sentences on what the slice changes.",
|
|
40653
|
+
hunks: ["path/to/file.ts#0"]
|
|
40654
|
+
}
|
|
40655
|
+
],
|
|
40656
|
+
manualTesting: {
|
|
40657
|
+
setup: ["Restart the web server"],
|
|
40658
|
+
steps: [
|
|
40659
|
+
{
|
|
40660
|
+
action: "Open http://localhost:3000/settings",
|
|
40661
|
+
expect: "The new toggle shows under Display"
|
|
40662
|
+
}
|
|
40663
|
+
]
|
|
40664
|
+
}
|
|
40665
|
+
};
|
|
40610
40666
|
function formatSlicingRequest(hunks) {
|
|
40611
40667
|
return [
|
|
40612
40668
|
"Slicing required: review.highLevel.slices is on, so this PR must be split into slices before the review opens.",
|
|
40613
40669
|
"",
|
|
40614
|
-
"Write
|
|
40670
|
+
"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
40671
|
"",
|
|
40616
|
-
|
|
40672
|
+
JSON.stringify(EXAMPLE, null, 2),
|
|
40617
40673
|
"",
|
|
40618
40674
|
'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
40675
|
"",
|
|
40620
40676
|
"Slicing rules:",
|
|
40621
40677
|
...RULES.map((rule) => `- ${rule}`),
|
|
40622
40678
|
"",
|
|
40679
|
+
"Manual testing rules:",
|
|
40680
|
+
...MANUAL_TESTING_RULES.map((rule) => `- ${rule}`),
|
|
40681
|
+
"",
|
|
40623
40682
|
`Hunks (${hunks.length}):`,
|
|
40624
40683
|
...hunks.flatMap((hunk) => ["", `### ${hunk.ref}`, hunk.text])
|
|
40625
40684
|
].join("\n");
|
|
40626
40685
|
}
|
|
40627
40686
|
|
|
40628
40687
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
40629
|
-
import { join as
|
|
40688
|
+
import { join as join92 } from "path";
|
|
40630
40689
|
function slug(value) {
|
|
40631
40690
|
return value.replace(/[^\w.-]+/g, "-");
|
|
40632
40691
|
}
|
|
40633
40692
|
function highLevelReviewPath(repo, headRef, headSha) {
|
|
40634
|
-
return
|
|
40693
|
+
return join92(
|
|
40635
40694
|
getStoreDir(),
|
|
40636
40695
|
"high-level-reviews",
|
|
40637
40696
|
slug(repo),
|
|
@@ -40683,9 +40742,9 @@ function listHighLevelHunks(files) {
|
|
|
40683
40742
|
}
|
|
40684
40743
|
|
|
40685
40744
|
// src/commands/review/highLevel/readJsonFile.ts
|
|
40686
|
-
import { existsSync as
|
|
40745
|
+
import { existsSync as existsSync70, readFileSync as readFileSync53 } from "fs";
|
|
40687
40746
|
function readJsonFile(path109) {
|
|
40688
|
-
if (!
|
|
40747
|
+
if (!existsSync70(path109)) return void 0;
|
|
40689
40748
|
try {
|
|
40690
40749
|
return JSON.parse(readFileSync53(path109, "utf8"));
|
|
40691
40750
|
} catch {
|
|
@@ -40695,18 +40754,26 @@ function readJsonFile(path109) {
|
|
|
40695
40754
|
|
|
40696
40755
|
// src/commands/review/highLevel/parseHighLevelSlicesInput.ts
|
|
40697
40756
|
import { z as z20 } from "zod";
|
|
40698
|
-
var
|
|
40757
|
+
var slicesSchema = z20.array(
|
|
40699
40758
|
z20.object({
|
|
40700
40759
|
title: z20.string().min(1),
|
|
40701
40760
|
summary: z20.string(),
|
|
40702
40761
|
hunks: z20.array(z20.string())
|
|
40703
40762
|
})
|
|
40704
40763
|
);
|
|
40764
|
+
var manualTestingSchema = z20.object({
|
|
40765
|
+
setup: z20.array(z20.string()),
|
|
40766
|
+
steps: z20.array(z20.object({ action: z20.string(), expect: z20.string() }))
|
|
40767
|
+
});
|
|
40768
|
+
var slicesInputSchema = z20.union([
|
|
40769
|
+
slicesSchema.transform((slices) => ({ slices })),
|
|
40770
|
+
z20.object({ slices: slicesSchema, manualTesting: manualTestingSchema })
|
|
40771
|
+
]);
|
|
40705
40772
|
function parseHighLevelSlicesInput(raw) {
|
|
40706
40773
|
const parsed = slicesInputSchema.safeParse(raw);
|
|
40707
40774
|
if (!parsed.success)
|
|
40708
40775
|
throw new Error(
|
|
40709
|
-
`slices must be a JSON array of {title, summary, hunks[]}: ${parsed.error.message}`
|
|
40776
|
+
`slices must be a JSON array of {title, summary, hunks[]}, or {slices: [...], manualTesting: {setup[], steps[{action, expect}]}}: ${parsed.error.message}`
|
|
40710
40777
|
);
|
|
40711
40778
|
return parsed.data;
|
|
40712
40779
|
}
|
|
@@ -40737,7 +40804,8 @@ function resolveHighLevelSlices(raw, hunks) {
|
|
|
40737
40804
|
const warnings = [];
|
|
40738
40805
|
const slices = [];
|
|
40739
40806
|
const add5 = (title, summary, refs) => slices.push({ title, summary, hunks: refs, ...sliceTotals(refs, byRef) });
|
|
40740
|
-
|
|
40807
|
+
const { slices: inputs, manualTesting } = parseHighLevelSlicesInput(raw);
|
|
40808
|
+
for (const input of inputs) {
|
|
40741
40809
|
const known = knownRefs(input, byRef, warnings);
|
|
40742
40810
|
if (known.length === 0)
|
|
40743
40811
|
warnings.push(`Dropped slice "${input.title}": it has no known hunks.`);
|
|
@@ -40753,7 +40821,7 @@ function resolveHighLevelSlices(raw, hunks) {
|
|
|
40753
40821
|
...sliceTotals(rest, byRef),
|
|
40754
40822
|
rest: true
|
|
40755
40823
|
});
|
|
40756
|
-
return { slices, warnings };
|
|
40824
|
+
return { slices, ...manualTesting ? { manualTesting } : {}, warnings };
|
|
40757
40825
|
}
|
|
40758
40826
|
|
|
40759
40827
|
// src/commands/review/highLevel/writeJsonFile.ts
|
|
@@ -40777,18 +40845,22 @@ function readSlicesFile(file) {
|
|
|
40777
40845
|
}
|
|
40778
40846
|
}
|
|
40779
40847
|
function sliceFromFile(file, files, path109) {
|
|
40780
|
-
const {
|
|
40848
|
+
const { warnings, ...set } = resolveHighLevelSlices(
|
|
40781
40849
|
readSlicesFile(file),
|
|
40782
40850
|
listHighLevelHunks(files)
|
|
40783
40851
|
);
|
|
40784
40852
|
for (const warning of warnings) console.warn(`Warning: ${warning}`);
|
|
40785
|
-
writeJsonFile(path109,
|
|
40786
|
-
return
|
|
40853
|
+
writeJsonFile(path109, set);
|
|
40854
|
+
return set;
|
|
40855
|
+
}
|
|
40856
|
+
function readSavedSlices(path109) {
|
|
40857
|
+
const saved = readJsonFile(path109);
|
|
40858
|
+
return Array.isArray(saved) ? { slices: saved } : saved;
|
|
40787
40859
|
}
|
|
40788
40860
|
function gatherHighLevelSlices(head, files, slicing) {
|
|
40789
40861
|
const path109 = highLevelSlicesPath(head.repo, head.headRef, head.headSha);
|
|
40790
40862
|
if (slicing.slicesFile) return sliceFromFile(slicing.slicesFile, files, path109);
|
|
40791
|
-
const saved = slicing.force ? void 0 :
|
|
40863
|
+
const saved = slicing.force ? void 0 : readSavedSlices(path109);
|
|
40792
40864
|
if (saved) return saved;
|
|
40793
40865
|
console.log(formatSlicingRequest(listHighLevelHunks(files)));
|
|
40794
40866
|
process.exit(2);
|
|
@@ -41098,7 +41170,7 @@ function gatherHighLevelSubject(prNumber, force, slicing) {
|
|
|
41098
41170
|
const fetched = fetchHighLevelFiles(prNumber, slug2);
|
|
41099
41171
|
const files = capHighLevelPatches(fetched, config.criticalPaths);
|
|
41100
41172
|
const head = { repo: slug2, headRef: pr.headRef, headSha: pr.headSha };
|
|
41101
|
-
const
|
|
41173
|
+
const sliced = slicing && config.slices ? gatherHighLevelSlices(head, files, slicing) : void 0;
|
|
41102
41174
|
return {
|
|
41103
41175
|
...head,
|
|
41104
41176
|
prNumber,
|
|
@@ -41106,7 +41178,8 @@ function gatherHighLevelSubject(prNumber, force, slicing) {
|
|
|
41106
41178
|
checks: evaluateHighLevelChecks({
|
|
41107
41179
|
...pr,
|
|
41108
41180
|
changedFiles: files.map((file) => file.path),
|
|
41109
|
-
config
|
|
41181
|
+
config,
|
|
41182
|
+
sliced: sliced !== void 0
|
|
41110
41183
|
}),
|
|
41111
41184
|
structure: buildHighLevelStructure(files),
|
|
41112
41185
|
criticalDiffs: selectCriticalDiffs(files, config.criticalPaths),
|
|
@@ -41114,7 +41187,7 @@ function gatherHighLevelSubject(prNumber, force, slicing) {
|
|
|
41114
41187
|
tests: gatherHighLevelTests(fetched, config.testPaths, slug2, pr.headSha),
|
|
41115
41188
|
testPaths: config.testPaths,
|
|
41116
41189
|
collapsedPaths: config.collapsedPaths,
|
|
41117
|
-
...
|
|
41190
|
+
...sliced,
|
|
41118
41191
|
...force ? {} : loadReopenedReview(slug2, pr.headRef, pr.headSha)
|
|
41119
41192
|
};
|
|
41120
41193
|
}
|
|
@@ -41223,6 +41296,7 @@ function highLevelPreviewPayload(subject) {
|
|
|
41223
41296
|
testPaths,
|
|
41224
41297
|
collapsedPaths,
|
|
41225
41298
|
slices,
|
|
41299
|
+
manualTesting,
|
|
41226
41300
|
saved,
|
|
41227
41301
|
draft
|
|
41228
41302
|
} = subject;
|
|
@@ -41238,6 +41312,7 @@ function highLevelPreviewPayload(subject) {
|
|
|
41238
41312
|
testPaths,
|
|
41239
41313
|
collapsedPaths,
|
|
41240
41314
|
...slices ? { slices } : {},
|
|
41315
|
+
...manualTesting ? { manualTesting } : {},
|
|
41241
41316
|
...saved ? { saved } : {},
|
|
41242
41317
|
...draft ? { draft } : {}
|
|
41243
41318
|
};
|
|
@@ -42092,11 +42167,11 @@ function exitFailedCiReview(failures, ci) {
|
|
|
42092
42167
|
}
|
|
42093
42168
|
|
|
42094
42169
|
// src/commands/review/cachedReviewerResult.ts
|
|
42095
|
-
import { statSync as
|
|
42170
|
+
import { statSync as statSync12 } from "fs";
|
|
42096
42171
|
function cachedReviewerResult(name, outputPath) {
|
|
42097
42172
|
let size;
|
|
42098
42173
|
try {
|
|
42099
|
-
size =
|
|
42174
|
+
size = statSync12(outputPath).size;
|
|
42100
42175
|
} catch {
|
|
42101
42176
|
return null;
|
|
42102
42177
|
}
|
|
@@ -42144,7 +42219,7 @@ import { format as format2 } from "util";
|
|
|
42144
42219
|
|
|
42145
42220
|
// src/commands/review/createReviewLogSink.ts
|
|
42146
42221
|
import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync29 } from "fs";
|
|
42147
|
-
import { join as
|
|
42222
|
+
import { join as join93 } from "path";
|
|
42148
42223
|
var LOG_FILE = "review.log";
|
|
42149
42224
|
function createReviewLogSink() {
|
|
42150
42225
|
let logPath2;
|
|
@@ -42161,7 +42236,7 @@ function createReviewLogSink() {
|
|
|
42161
42236
|
},
|
|
42162
42237
|
attach(reviewDir) {
|
|
42163
42238
|
mkdirSync29(reviewDir, { recursive: true });
|
|
42164
|
-
logPath2 =
|
|
42239
|
+
logPath2 = join93(reviewDir, LOG_FILE);
|
|
42165
42240
|
const lines2 = [
|
|
42166
42241
|
"",
|
|
42167
42242
|
`=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
|
|
@@ -42846,7 +42921,7 @@ async function runClaudeReviewer(spec) {
|
|
|
42846
42921
|
}
|
|
42847
42922
|
|
|
42848
42923
|
// src/commands/review/runCodexReviewer.ts
|
|
42849
|
-
import { existsSync as
|
|
42924
|
+
import { existsSync as existsSync71, unlinkSync as unlinkSync17 } from "fs";
|
|
42850
42925
|
|
|
42851
42926
|
// src/commands/review/parseCodexUsage.ts
|
|
42852
42927
|
function parseCodexUsage(usage) {
|
|
@@ -42935,7 +43010,7 @@ async function runCodexReviewer(spec) {
|
|
|
42935
43010
|
...override.args.length > 0 ? { env: override.env } : {},
|
|
42936
43011
|
onLine
|
|
42937
43012
|
});
|
|
42938
|
-
if (result.exitCode !== 0 &&
|
|
43013
|
+
if (result.exitCode !== 0 && existsSync71(spec.outputPath)) {
|
|
42939
43014
|
unlinkSync17(spec.outputPath);
|
|
42940
43015
|
}
|
|
42941
43016
|
const finalised = finaliseReviewerRun(
|
|
@@ -43029,7 +43104,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
|
|
|
43029
43104
|
}
|
|
43030
43105
|
|
|
43031
43106
|
// src/commands/review/synthesiseAfterReviewers.ts
|
|
43032
|
-
import { existsSync as
|
|
43107
|
+
import { existsSync as existsSync72, unlinkSync as unlinkSync18 } from "fs";
|
|
43033
43108
|
|
|
43034
43109
|
// src/commands/review/synthesise.ts
|
|
43035
43110
|
import { readFileSync as readFileSync56 } from "fs";
|
|
@@ -43136,7 +43211,7 @@ async function synthesise(paths, options2) {
|
|
|
43136
43211
|
// src/commands/review/synthesiseAfterReviewers.ts
|
|
43137
43212
|
async function synthesiseAfterReviewers(input) {
|
|
43138
43213
|
const { paths, failures } = input;
|
|
43139
|
-
if (input.anyFresh &&
|
|
43214
|
+
if (input.anyFresh && existsSync72(paths.synthesisPath)) {
|
|
43140
43215
|
unlinkSync18(paths.synthesisPath);
|
|
43141
43216
|
}
|
|
43142
43217
|
const synthesisResult = await synthesise(paths, {
|
|
@@ -43368,9 +43443,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
43368
43443
|
|
|
43369
43444
|
// src/commands/review/buildReviewPaths.ts
|
|
43370
43445
|
import { homedir as homedir27 } from "os";
|
|
43371
|
-
import { basename as basename25, join as
|
|
43446
|
+
import { basename as basename25, join as join94 } from "path";
|
|
43372
43447
|
function buildReviewPaths(repoRoot2, key) {
|
|
43373
|
-
const reviewDir =
|
|
43448
|
+
const reviewDir = join94(
|
|
43374
43449
|
homedir27(),
|
|
43375
43450
|
".assist",
|
|
43376
43451
|
"reviews",
|
|
@@ -43379,10 +43454,10 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
43379
43454
|
);
|
|
43380
43455
|
return {
|
|
43381
43456
|
reviewDir,
|
|
43382
|
-
requestPath:
|
|
43383
|
-
claudePath:
|
|
43384
|
-
codexPath:
|
|
43385
|
-
synthesisPath:
|
|
43457
|
+
requestPath: join94(reviewDir, "request.md"),
|
|
43458
|
+
claudePath: join94(reviewDir, "claude.md"),
|
|
43459
|
+
codexPath: join94(reviewDir, "codex.md"),
|
|
43460
|
+
synthesisPath: join94(reviewDir, "synthesis.md")
|
|
43386
43461
|
};
|
|
43387
43462
|
}
|
|
43388
43463
|
|
|
@@ -43420,10 +43495,10 @@ function fetchExistingComments() {
|
|
|
43420
43495
|
}
|
|
43421
43496
|
|
|
43422
43497
|
// src/commands/review/prepareReviewDir.ts
|
|
43423
|
-
import { existsSync as
|
|
43498
|
+
import { existsSync as existsSync73, mkdirSync as mkdirSync30, unlinkSync as unlinkSync19, writeFileSync as writeFileSync44 } from "fs";
|
|
43424
43499
|
function clearReviewFiles(paths) {
|
|
43425
43500
|
for (const path109 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
43426
|
-
if (
|
|
43501
|
+
if (existsSync73(path109)) unlinkSync19(path109);
|
|
43427
43502
|
}
|
|
43428
43503
|
}
|
|
43429
43504
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -44092,7 +44167,7 @@ import path88 from "path";
|
|
|
44092
44167
|
import chalk262 from "chalk";
|
|
44093
44168
|
|
|
44094
44169
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
44095
|
-
import { existsSync as
|
|
44170
|
+
import { existsSync as existsSync74, readFileSync as readFileSync59, writeFileSync as writeFileSync45 } from "fs";
|
|
44096
44171
|
import path87 from "path";
|
|
44097
44172
|
|
|
44098
44173
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
@@ -44100,12 +44175,12 @@ import { readFileSync as readFileSync58 } from "fs";
|
|
|
44100
44175
|
import path86 from "path";
|
|
44101
44176
|
|
|
44102
44177
|
// src/commands/rules/findClaudeFiles.ts
|
|
44103
|
-
import { readdirSync as
|
|
44178
|
+
import { readdirSync as readdirSync17 } from "fs";
|
|
44104
44179
|
import path85 from "path";
|
|
44105
44180
|
var SKIP_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage"]);
|
|
44106
44181
|
function findClaudeFiles(dir) {
|
|
44107
44182
|
const results = [];
|
|
44108
|
-
for (const entry of
|
|
44183
|
+
for (const entry of readdirSync17(dir, { withFileTypes: true })) {
|
|
44109
44184
|
if (entry.isDirectory()) {
|
|
44110
44185
|
if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name))
|
|
44111
44186
|
continue;
|
|
@@ -44162,7 +44237,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
44162
44237
|
function updateScopedRulesIndex(root2) {
|
|
44163
44238
|
const directories = scopedRuleDirectories(root2);
|
|
44164
44239
|
const rootFile = path87.join(root2, "CLAUDE.md");
|
|
44165
|
-
const before =
|
|
44240
|
+
const before = existsSync74(rootFile) ? readFileSync59(rootFile, "utf8") : "";
|
|
44166
44241
|
const after = upsertScopedRulesPointer(before, directories);
|
|
44167
44242
|
if (after !== before) writeFileSync45(rootFile, after);
|
|
44168
44243
|
return directories;
|
|
@@ -44215,7 +44290,7 @@ function listRules(target, options2 = {}) {
|
|
|
44215
44290
|
}
|
|
44216
44291
|
|
|
44217
44292
|
// src/commands/rules/addRule.ts
|
|
44218
|
-
import { existsSync as
|
|
44293
|
+
import { existsSync as existsSync76, readFileSync as readFileSync61, writeFileSync as writeFileSync46 } from "fs";
|
|
44219
44294
|
import path91 from "path";
|
|
44220
44295
|
import chalk264 from "chalk";
|
|
44221
44296
|
|
|
@@ -44252,7 +44327,7 @@ function nextRuleCode(root2) {
|
|
|
44252
44327
|
}
|
|
44253
44328
|
|
|
44254
44329
|
// src/commands/rules/resolveRuleScope.ts
|
|
44255
|
-
import { existsSync as
|
|
44330
|
+
import { existsSync as existsSync75 } from "fs";
|
|
44256
44331
|
import path90 from "path";
|
|
44257
44332
|
function resolveRuleScope(target) {
|
|
44258
44333
|
const resolved = path90.resolve(target);
|
|
@@ -44262,7 +44337,7 @@ function resolveRuleScope(target) {
|
|
|
44262
44337
|
let current = startDir;
|
|
44263
44338
|
while (true) {
|
|
44264
44339
|
const candidate = path90.join(current, "CLAUDE.md");
|
|
44265
|
-
if (
|
|
44340
|
+
if (existsSync75(candidate)) return candidate;
|
|
44266
44341
|
if (current === root2 || current === path90.dirname(current)) break;
|
|
44267
44342
|
current = path90.dirname(current);
|
|
44268
44343
|
}
|
|
@@ -44271,7 +44346,7 @@ function resolveRuleScope(target) {
|
|
|
44271
44346
|
|
|
44272
44347
|
// src/commands/rules/addRule.ts
|
|
44273
44348
|
function read2(file) {
|
|
44274
|
-
return
|
|
44349
|
+
return existsSync76(file) ? readFileSync61(file, "utf8") : "";
|
|
44275
44350
|
}
|
|
44276
44351
|
function addRule(text20, options2) {
|
|
44277
44352
|
const rule = text20.trim();
|
|
@@ -44984,12 +45059,12 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
44984
45059
|
}
|
|
44985
45060
|
|
|
44986
45061
|
// src/commands/slack/slackWorkingFile.ts
|
|
44987
|
-
import { join as
|
|
45062
|
+
import { join as join95 } from "path";
|
|
44988
45063
|
function slackWorkingFile(channel, partIndex) {
|
|
44989
45064
|
const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
|
|
44990
|
-
const dir =
|
|
45065
|
+
const dir = join95(getStoreDir(), "slack");
|
|
44991
45066
|
const name = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
|
|
44992
|
-
return { dir, bodyPath:
|
|
45067
|
+
return { dir, bodyPath: join95(dir, `${name}.md`) };
|
|
44993
45068
|
}
|
|
44994
45069
|
|
|
44995
45070
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
@@ -45810,7 +45885,7 @@ function registerSync(program) {
|
|
|
45810
45885
|
}
|
|
45811
45886
|
|
|
45812
45887
|
// src/commands/transcript/clean.ts
|
|
45813
|
-
import { existsSync as
|
|
45888
|
+
import { existsSync as existsSync81 } from "fs";
|
|
45814
45889
|
|
|
45815
45890
|
// src/commands/transcript/convert/formatTimestamp.ts
|
|
45816
45891
|
function pad2(value, width2) {
|
|
@@ -46088,7 +46163,7 @@ function clean(file, options2 = {}) {
|
|
|
46088
46163
|
);
|
|
46089
46164
|
process.exit(1);
|
|
46090
46165
|
}
|
|
46091
|
-
if (!
|
|
46166
|
+
if (!existsSync81(file)) {
|
|
46092
46167
|
console.error(`Error: VTT file not found: ${file}`);
|
|
46093
46168
|
process.exit(1);
|
|
46094
46169
|
}
|
|
@@ -46171,21 +46246,21 @@ async function configure() {
|
|
|
46171
46246
|
}
|
|
46172
46247
|
|
|
46173
46248
|
// src/commands/transcript/list.ts
|
|
46174
|
-
import { existsSync as
|
|
46175
|
-
import { join as
|
|
46249
|
+
import { existsSync as existsSync82, readdirSync as readdirSync24, statSync as statSync13 } from "fs";
|
|
46250
|
+
import { join as join107 } from "path";
|
|
46176
46251
|
function list5() {
|
|
46177
46252
|
const { vttDir } = getTranscriptConfig();
|
|
46178
|
-
if (!
|
|
46179
|
-
for (const entry of
|
|
46253
|
+
if (!existsSync82(vttDir)) return;
|
|
46254
|
+
for (const entry of readdirSync24(vttDir)) {
|
|
46180
46255
|
if (!entry.endsWith(".vtt")) continue;
|
|
46181
|
-
if (
|
|
46256
|
+
if (statSync13(join107(vttDir, entry)).isDirectory()) continue;
|
|
46182
46257
|
console.log(entry);
|
|
46183
46258
|
}
|
|
46184
46259
|
}
|
|
46185
46260
|
|
|
46186
46261
|
// src/commands/transcript/move.ts
|
|
46187
|
-
import { existsSync as
|
|
46188
|
-
import { basename as basename29, join as
|
|
46262
|
+
import { existsSync as existsSync83, mkdirSync as mkdirSync38, renameSync as renameSync5, writeFileSync as writeFileSync53 } from "fs";
|
|
46263
|
+
import { basename as basename29, join as join108 } from "path";
|
|
46189
46264
|
|
|
46190
46265
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
46191
46266
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -46195,9 +46270,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
46195
46270
|
// src/commands/transcript/move.ts
|
|
46196
46271
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
46197
46272
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
46198
|
-
const processedDir =
|
|
46273
|
+
const processedDir = join108(vttDir, "processed");
|
|
46199
46274
|
mkdirSync38(processedDir, { recursive: true });
|
|
46200
|
-
renameSync5(sourcePath,
|
|
46275
|
+
renameSync5(sourcePath, join108(processedDir, filename));
|
|
46201
46276
|
}
|
|
46202
46277
|
function move(file, options2) {
|
|
46203
46278
|
const { date, client } = options2;
|
|
@@ -46207,25 +46282,25 @@ function move(file, options2) {
|
|
|
46207
46282
|
}
|
|
46208
46283
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
46209
46284
|
const filename = basename29(file);
|
|
46210
|
-
const sourcePath =
|
|
46211
|
-
if (!
|
|
46285
|
+
const sourcePath = join108(vttDir, filename);
|
|
46286
|
+
if (!existsSync83(sourcePath)) {
|
|
46212
46287
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
46213
46288
|
process.exit(1);
|
|
46214
46289
|
}
|
|
46215
46290
|
const base = basename29(filename, ".vtt").replace(/ Transcription$/, "");
|
|
46216
46291
|
const outputName = `${date} ${base}.md`;
|
|
46217
|
-
const formattedDir =
|
|
46292
|
+
const formattedDir = join108(transcriptsDir, client);
|
|
46218
46293
|
mkdirSync38(formattedDir, { recursive: true });
|
|
46219
|
-
const formattedPath =
|
|
46294
|
+
const formattedPath = join108(formattedDir, outputName);
|
|
46220
46295
|
writeFileSync53(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
46221
46296
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
46222
|
-
const summaryPath =
|
|
46297
|
+
const summaryPath = join108(summaryDir, client, outputName);
|
|
46223
46298
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
46224
46299
|
console.log(`Summary target: ${summaryPath}`);
|
|
46225
46300
|
}
|
|
46226
46301
|
|
|
46227
46302
|
// src/commands/transcript/merge.ts
|
|
46228
|
-
import { existsSync as
|
|
46303
|
+
import { existsSync as existsSync84, writeFileSync as writeFileSync54 } from "fs";
|
|
46229
46304
|
import { basename as basename30 } from "path";
|
|
46230
46305
|
|
|
46231
46306
|
// src/commands/transcript/failTranscript.ts
|
|
@@ -46369,7 +46444,7 @@ function widenAudience(passages) {
|
|
|
46369
46444
|
|
|
46370
46445
|
// src/commands/transcript/merge.ts
|
|
46371
46446
|
function readSource3(file) {
|
|
46372
|
-
if (!
|
|
46447
|
+
if (!existsSync84(file)) failTranscript(`VTT file not found: ${file}`);
|
|
46373
46448
|
const cues = readCleanedCues(file);
|
|
46374
46449
|
if (cues.length === 0) failTranscript(`no cues found in: ${file}`);
|
|
46375
46450
|
return { path: file, name: basename30(file), cues };
|
|
@@ -46842,7 +46917,7 @@ function configKeys2() {
|
|
|
46842
46917
|
}
|
|
46843
46918
|
|
|
46844
46919
|
// src/commands/verify/forbiddenStrings.ts
|
|
46845
|
-
import { existsSync as
|
|
46920
|
+
import { existsSync as existsSync85, readFileSync as readFileSync69 } from "fs";
|
|
46846
46921
|
|
|
46847
46922
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
46848
46923
|
import { minimatch as minimatch10 } from "minimatch";
|
|
@@ -46883,7 +46958,7 @@ function forbiddenStrings() {
|
|
|
46883
46958
|
const cache7 = /* @__PURE__ */ new Map();
|
|
46884
46959
|
const readJson = (file) => {
|
|
46885
46960
|
if (cache7.has(file)) return cache7.get(file);
|
|
46886
|
-
if (!
|
|
46961
|
+
if (!existsSync85(file)) {
|
|
46887
46962
|
console.log(`Forbidden-strings file not found: ${file}`);
|
|
46888
46963
|
process.exit(1);
|
|
46889
46964
|
}
|
|
@@ -47033,10 +47108,10 @@ function checkSequential(migrations3, files) {
|
|
|
47033
47108
|
}
|
|
47034
47109
|
|
|
47035
47110
|
// src/commands/verify/migrations/listMigrationFiles.ts
|
|
47036
|
-
import { readdirSync as
|
|
47111
|
+
import { readdirSync as readdirSync25 } from "fs";
|
|
47037
47112
|
var MIGRATION_FILE2 = /^migration\d+[A-Za-z0-9]*\.ts$/;
|
|
47038
47113
|
function listMigrationFiles(dir) {
|
|
47039
|
-
return
|
|
47114
|
+
return readdirSync25(dir).filter((file) => MIGRATION_FILE2.test(file));
|
|
47040
47115
|
}
|
|
47041
47116
|
|
|
47042
47117
|
// src/commands/verify/migrations/readBaselineMigrations.ts
|
|
@@ -47430,7 +47505,7 @@ ${result.reason}`
|
|
|
47430
47505
|
}
|
|
47431
47506
|
|
|
47432
47507
|
// src/commands/watch/markSyncPending.ts
|
|
47433
|
-
import { existsSync as
|
|
47508
|
+
import { existsSync as existsSync86, writeFileSync as writeFileSync55 } from "fs";
|
|
47434
47509
|
|
|
47435
47510
|
// src/commands/watch/gitMarkerPath.ts
|
|
47436
47511
|
import { resolve as resolve30 } from "path";
|
|
@@ -47449,7 +47524,7 @@ function syncPendingPath(cwd) {
|
|
|
47449
47524
|
// src/commands/watch/markSyncPending.ts
|
|
47450
47525
|
function pendingFromEarlierLap() {
|
|
47451
47526
|
try {
|
|
47452
|
-
return
|
|
47527
|
+
return existsSync86(syncPendingPath());
|
|
47453
47528
|
} catch {
|
|
47454
47529
|
return false;
|
|
47455
47530
|
}
|
|
@@ -47612,7 +47687,7 @@ function resolveParams(params, cliArgs) {
|
|
|
47612
47687
|
}
|
|
47613
47688
|
|
|
47614
47689
|
// src/commands/run/resolveRunCwd.ts
|
|
47615
|
-
import { existsSync as
|
|
47690
|
+
import { existsSync as existsSync87 } from "fs";
|
|
47616
47691
|
import { resolve as resolve31 } from "path";
|
|
47617
47692
|
var MissingRunCwdError = class extends Error {
|
|
47618
47693
|
constructor(runName, cwd) {
|
|
@@ -47625,7 +47700,7 @@ var MissingRunCwdError = class extends Error {
|
|
|
47625
47700
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
47626
47701
|
if (!config.cwd) return void 0;
|
|
47627
47702
|
const cwd = resolve31(baseDir, config.cwd);
|
|
47628
|
-
if (!
|
|
47703
|
+
if (!existsSync87(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
47629
47704
|
return cwd;
|
|
47630
47705
|
}
|
|
47631
47706
|
|
|
@@ -47762,10 +47837,10 @@ ${buildWatchReport(from)}`);
|
|
|
47762
47837
|
}
|
|
47763
47838
|
|
|
47764
47839
|
// src/commands/watch/consumeMarker.ts
|
|
47765
|
-
import { existsSync as
|
|
47840
|
+
import { existsSync as existsSync88, rmSync as rmSync12 } from "fs";
|
|
47766
47841
|
function consumeMarker(path109) {
|
|
47767
47842
|
try {
|
|
47768
|
-
if (!
|
|
47843
|
+
if (!existsSync88(path109)) return false;
|
|
47769
47844
|
rmSync12(path109);
|
|
47770
47845
|
return true;
|
|
47771
47846
|
} catch {
|
|
@@ -48047,19 +48122,19 @@ function registerWatch(program) {
|
|
|
48047
48122
|
|
|
48048
48123
|
// src/commands/roam/postRoamActivity.ts
|
|
48049
48124
|
import { execFileSync as execFileSync31 } from "child_process";
|
|
48050
|
-
import { readdirSync as
|
|
48051
|
-
import { join as
|
|
48125
|
+
import { readdirSync as readdirSync26, readFileSync as readFileSync71, statSync as statSync14 } from "fs";
|
|
48126
|
+
import { join as join109 } from "path";
|
|
48052
48127
|
function findPortFile(roamDir) {
|
|
48053
48128
|
let entries;
|
|
48054
48129
|
try {
|
|
48055
|
-
entries =
|
|
48130
|
+
entries = readdirSync26(roamDir);
|
|
48056
48131
|
} catch {
|
|
48057
48132
|
return void 0;
|
|
48058
48133
|
}
|
|
48059
48134
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
48060
|
-
const path109 =
|
|
48135
|
+
const path109 = join109(roamDir, name);
|
|
48061
48136
|
try {
|
|
48062
|
-
return { path: path109, mtimeMs:
|
|
48137
|
+
return { path: path109, mtimeMs: statSync14(path109).mtimeMs };
|
|
48063
48138
|
} catch {
|
|
48064
48139
|
return void 0;
|
|
48065
48140
|
}
|
|
@@ -48074,7 +48149,7 @@ var PID_BY_APP = {
|
|
|
48074
48149
|
function postRoamActivity(app, event) {
|
|
48075
48150
|
const appData = process.env.APPDATA;
|
|
48076
48151
|
if (!appData) return;
|
|
48077
|
-
const portFile = findPortFile(
|
|
48152
|
+
const portFile = findPortFile(join109(appData, "Roam"));
|
|
48078
48153
|
if (!portFile) return;
|
|
48079
48154
|
let port;
|
|
48080
48155
|
try {
|
|
@@ -48417,11 +48492,11 @@ function requireParsedArgs() {
|
|
|
48417
48492
|
}
|
|
48418
48493
|
|
|
48419
48494
|
// src/commands/run/runCommandFilePath.ts
|
|
48420
|
-
import { join as
|
|
48495
|
+
import { join as join110 } from "path";
|
|
48421
48496
|
function runCommandFilePath(name) {
|
|
48422
48497
|
const segments = name.split(":");
|
|
48423
48498
|
const file = `${segments.pop()}.md`;
|
|
48424
|
-
return
|
|
48499
|
+
return join110(".claude", "commands", ...segments, file);
|
|
48425
48500
|
}
|
|
48426
48501
|
|
|
48427
48502
|
// src/commands/run/add.ts
|
|
@@ -48549,8 +48624,8 @@ function registerRunAdd(runCommand) {
|
|
|
48549
48624
|
}
|
|
48550
48625
|
|
|
48551
48626
|
// src/commands/run/remove.ts
|
|
48552
|
-
import { existsSync as
|
|
48553
|
-
import { dirname as dirname47, join as
|
|
48627
|
+
import { existsSync as existsSync89, readdirSync as readdirSync27, rmdirSync, unlinkSync as unlinkSync20 } from "fs";
|
|
48628
|
+
import { dirname as dirname47, join as join111 } from "path";
|
|
48554
48629
|
|
|
48555
48630
|
// src/commands/run/removeRepoRunConfig.ts
|
|
48556
48631
|
function isNamed(entry, name) {
|
|
@@ -48568,17 +48643,17 @@ function removeRepoRunConfig(name, repoName, cwd = process.cwd()) {
|
|
|
48568
48643
|
|
|
48569
48644
|
// src/commands/run/remove.ts
|
|
48570
48645
|
function removeEmptyNamespaceDirs(filePath) {
|
|
48571
|
-
const root2 =
|
|
48646
|
+
const root2 = join111(".claude", "commands");
|
|
48572
48647
|
for (let dir = dirname47(filePath); dir !== root2; dir = dirname47(dir)) {
|
|
48573
|
-
if (!
|
|
48648
|
+
if (!existsSync89(dir) || readdirSync27(dir).length > 0) return;
|
|
48574
48649
|
rmdirSync(dir);
|
|
48575
48650
|
}
|
|
48576
48651
|
}
|
|
48577
48652
|
function deleteCommandFile(name) {
|
|
48578
48653
|
const filePath = runCommandFilePath(name);
|
|
48579
|
-
const legacyPath =
|
|
48654
|
+
const legacyPath = join111(".claude", "commands", `${name}.md`);
|
|
48580
48655
|
for (const path109 of /* @__PURE__ */ new Set([filePath, legacyPath])) {
|
|
48581
|
-
if (
|
|
48656
|
+
if (existsSync89(path109)) {
|
|
48582
48657
|
unlinkSync20(path109);
|
|
48583
48658
|
console.log(`Deleted command file: ${path109}`);
|
|
48584
48659
|
}
|
|
@@ -49301,12 +49376,12 @@ function toSessionViewInfo({
|
|
|
49301
49376
|
}
|
|
49302
49377
|
|
|
49303
49378
|
// src/commands/sessions/daemon/worktree/joinRefusal.ts
|
|
49304
|
-
import { existsSync as
|
|
49379
|
+
import { existsSync as existsSync90 } from "fs";
|
|
49305
49380
|
function joinRefusal(session) {
|
|
49306
49381
|
if (session.commandType === "run") return "a server run has no agent stream";
|
|
49307
49382
|
if (session.closing === true) return "the session is closing";
|
|
49308
49383
|
if (!session.cwd) return "the session has no working directory";
|
|
49309
|
-
if (!
|
|
49384
|
+
if (!existsSync90(session.cwd))
|
|
49310
49385
|
return "the session's workspace no longer exists";
|
|
49311
49386
|
return void 0;
|
|
49312
49387
|
}
|
|
@@ -49382,8 +49457,8 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
|
|
|
49382
49457
|
}
|
|
49383
49458
|
|
|
49384
49459
|
// src/commands/sessions/daemon/findServerParents.ts
|
|
49385
|
-
import { existsSync as
|
|
49386
|
-
import { join as
|
|
49460
|
+
import { existsSync as existsSync91 } from "fs";
|
|
49461
|
+
import { join as join112, resolve as resolve32 } from "path";
|
|
49387
49462
|
function isLive(session) {
|
|
49388
49463
|
return !!session.pty && session.status !== "done" && session.status !== "error";
|
|
49389
49464
|
}
|
|
@@ -49392,7 +49467,7 @@ function isLiveAgent(session) {
|
|
|
49392
49467
|
}
|
|
49393
49468
|
function serverRunDirs(sessions, file) {
|
|
49394
49469
|
return new Set(
|
|
49395
|
-
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve32(s.cwd)).filter((dir) =>
|
|
49470
|
+
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve32(s.cwd)).filter((dir) => existsSync91(join112(dir, file)))
|
|
49396
49471
|
);
|
|
49397
49472
|
}
|
|
49398
49473
|
function findServerParents(sessions, file) {
|
|
@@ -50061,11 +50136,11 @@ function sessionBase(id, status2) {
|
|
|
50061
50136
|
}
|
|
50062
50137
|
|
|
50063
50138
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
50064
|
-
import { existsSync as
|
|
50139
|
+
import { existsSync as existsSync93 } from "fs";
|
|
50065
50140
|
import * as pty from "node-pty";
|
|
50066
50141
|
|
|
50067
50142
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
50068
|
-
import { chmodSync, existsSync as
|
|
50143
|
+
import { chmodSync, existsSync as existsSync92, statSync as statSync15 } from "fs";
|
|
50069
50144
|
import { createRequire as createRequire3 } from "module";
|
|
50070
50145
|
import path106 from "path";
|
|
50071
50146
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -50080,8 +50155,8 @@ function ensureSpawnHelperExecutable() {
|
|
|
50080
50155
|
`${process.platform}-${process.arch}`,
|
|
50081
50156
|
"spawn-helper"
|
|
50082
50157
|
);
|
|
50083
|
-
if (!
|
|
50084
|
-
const mode =
|
|
50158
|
+
if (!existsSync92(helper)) return;
|
|
50159
|
+
const mode = statSync15(helper).mode;
|
|
50085
50160
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
50086
50161
|
}
|
|
50087
50162
|
|
|
@@ -50136,7 +50211,7 @@ function spawnPty(args, cwd, sessionId2, extraEnv) {
|
|
|
50136
50211
|
});
|
|
50137
50212
|
}
|
|
50138
50213
|
function refuseMissingCwd(cwd, sessionId2) {
|
|
50139
|
-
if (!cwd ||
|
|
50214
|
+
if (!cwd || existsSync93(cwd)) return;
|
|
50140
50215
|
daemonLog(
|
|
50141
50216
|
`${sessionId2 ? `session ${sessionId2}` : "pty"} not spawned: working directory ${cwd} no longer exists`
|
|
50142
50217
|
);
|
|
@@ -50306,7 +50381,7 @@ function createRunSession(id, { runName, runArgs, cwd, meta }) {
|
|
|
50306
50381
|
}
|
|
50307
50382
|
|
|
50308
50383
|
// src/commands/sessions/daemon/autoUpdate/autoUpdateControl.ts
|
|
50309
|
-
import { existsSync as
|
|
50384
|
+
import { existsSync as existsSync94, rmSync as rmSync13, writeFileSync as writeFileSync59 } from "fs";
|
|
50310
50385
|
var paused;
|
|
50311
50386
|
var wake;
|
|
50312
50387
|
var holdReleased = false;
|
|
@@ -50319,7 +50394,7 @@ function persist2(value) {
|
|
|
50319
50394
|
}
|
|
50320
50395
|
var autoUpdateControl = {
|
|
50321
50396
|
paused: () => {
|
|
50322
|
-
paused ??=
|
|
50397
|
+
paused ??= existsSync94(daemonPaths.autoUpdatePaused);
|
|
50323
50398
|
return paused;
|
|
50324
50399
|
},
|
|
50325
50400
|
setPaused: (value) => {
|
|
@@ -50548,7 +50623,7 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
50548
50623
|
}
|
|
50549
50624
|
|
|
50550
50625
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
50551
|
-
import { existsSync as
|
|
50626
|
+
import { existsSync as existsSync95 } from "fs";
|
|
50552
50627
|
var treeIsGone = { durable: true, gone: true };
|
|
50553
50628
|
function treeDurability(state) {
|
|
50554
50629
|
if (state.dirty) return { durable: false, reason: "uncommitted changes" };
|
|
@@ -50579,14 +50654,14 @@ function* durabilityProbes() {
|
|
|
50579
50654
|
});
|
|
50580
50655
|
}
|
|
50581
50656
|
async function checkDurability(cwd) {
|
|
50582
|
-
if (!
|
|
50657
|
+
if (!existsSync95(cwd)) return treeIsGone;
|
|
50583
50658
|
const probes = durabilityProbes();
|
|
50584
50659
|
let step3 = probes.next();
|
|
50585
50660
|
while (!step3.done) step3 = probes.next(await gitResult(cwd, step3.value));
|
|
50586
50661
|
return step3.value;
|
|
50587
50662
|
}
|
|
50588
50663
|
function checkDurabilitySync(cwd) {
|
|
50589
|
-
if (!
|
|
50664
|
+
if (!existsSync95(cwd)) return treeIsGone;
|
|
50590
50665
|
const probes = durabilityProbes();
|
|
50591
50666
|
let step3 = probes.next();
|
|
50592
50667
|
while (!step3.done) step3 = probes.next(gitSyncResult(cwd, step3.value));
|
|
@@ -50870,17 +50945,17 @@ function setStatus2(session, newStatus) {
|
|
|
50870
50945
|
}
|
|
50871
50946
|
|
|
50872
50947
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
50873
|
-
import { existsSync as
|
|
50948
|
+
import { existsSync as existsSync97 } from "fs";
|
|
50874
50949
|
import { basename as basename32 } from "path";
|
|
50875
50950
|
|
|
50876
50951
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
50877
|
-
import { existsSync as
|
|
50878
|
-
import { join as
|
|
50952
|
+
import { existsSync as existsSync96 } from "fs";
|
|
50953
|
+
import { join as join115 } from "path";
|
|
50879
50954
|
|
|
50880
50955
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
50881
|
-
import { statSync as
|
|
50956
|
+
import { statSync as statSync16 } from "fs";
|
|
50882
50957
|
import { rm as rm3 } from "fs/promises";
|
|
50883
|
-
import { join as
|
|
50958
|
+
import { join as join114 } from "path";
|
|
50884
50959
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
50885
50960
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
50886
50961
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -50908,7 +50983,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
50908
50983
|
return { removed: true };
|
|
50909
50984
|
}
|
|
50910
50985
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
50911
|
-
return
|
|
50986
|
+
return statSync16(join114(worktreePath, ".git"), {
|
|
50912
50987
|
throwIfNoEntry: false
|
|
50913
50988
|
})?.isDirectory() === true;
|
|
50914
50989
|
}
|
|
@@ -50944,7 +51019,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
50944
51019
|
);
|
|
50945
51020
|
}
|
|
50946
51021
|
function strandedReason(worktreePath, cause) {
|
|
50947
|
-
if (!
|
|
51022
|
+
if (!existsSync96(join115(worktreePath, ".git")))
|
|
50948
51023
|
return "its .git link is already gone";
|
|
50949
51024
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
50950
51025
|
return "git no longer recognises it as a working tree";
|
|
@@ -50996,7 +51071,7 @@ function reason3(error) {
|
|
|
50996
51071
|
|
|
50997
51072
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
50998
51073
|
async function reapWorktree(worktreePath, force = false) {
|
|
50999
|
-
if (!
|
|
51074
|
+
if (!existsSync97(worktreePath)) {
|
|
51000
51075
|
forgetWorktree(worktreePath);
|
|
51001
51076
|
daemonLog(
|
|
51002
51077
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -51021,7 +51096,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
51021
51096
|
}
|
|
51022
51097
|
function owningClone(worktreePath) {
|
|
51023
51098
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
51024
|
-
if (recorded &&
|
|
51099
|
+
if (recorded && existsSync97(recorded)) return recorded;
|
|
51025
51100
|
const detected = mainWorktree(worktreePath);
|
|
51026
51101
|
if (detected) return detected;
|
|
51027
51102
|
daemonLog(
|
|
@@ -51170,12 +51245,12 @@ function closeGateApplies(sessions, session) {
|
|
|
51170
51245
|
}
|
|
51171
51246
|
|
|
51172
51247
|
// src/commands/sessions/daemon/worktree/liveProcessesInTree.ts
|
|
51173
|
-
import { readdirSync as
|
|
51248
|
+
import { readdirSync as readdirSync28, readlinkSync } from "fs";
|
|
51174
51249
|
import { sep as sep4 } from "path";
|
|
51175
51250
|
function liveProcessesInTree(treePath, procRoot = "/proc") {
|
|
51176
51251
|
let entries;
|
|
51177
51252
|
try {
|
|
51178
|
-
entries =
|
|
51253
|
+
entries = readdirSync28(procRoot);
|
|
51179
51254
|
} catch {
|
|
51180
51255
|
return [];
|
|
51181
51256
|
}
|
|
@@ -51308,12 +51383,12 @@ async function closeBlockReason(sessionId2, tree) {
|
|
|
51308
51383
|
}
|
|
51309
51384
|
|
|
51310
51385
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
51311
|
-
import { existsSync as
|
|
51386
|
+
import { existsSync as existsSync98, watch } from "fs";
|
|
51312
51387
|
var DEBOUNCE_MS = 500;
|
|
51313
51388
|
var POLL_MS5 = 3e4;
|
|
51314
51389
|
function watchGitState(cwd, onChange) {
|
|
51315
51390
|
const common = gitCommonDir(cwd);
|
|
51316
|
-
if (!common || !
|
|
51391
|
+
if (!common || !existsSync98(common)) return void 0;
|
|
51317
51392
|
const watchers = [
|
|
51318
51393
|
watchGitDir(common, onChange),
|
|
51319
51394
|
pollGitState(cwd, onChange)
|
|
@@ -52036,10 +52111,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
52036
52111
|
}
|
|
52037
52112
|
|
|
52038
52113
|
// src/commands/sessions/daemon/exitReason.ts
|
|
52039
|
-
import { existsSync as
|
|
52114
|
+
import { existsSync as existsSync99 } from "fs";
|
|
52040
52115
|
import { resolve as resolve33 } from "path";
|
|
52041
52116
|
function exitDetail(session) {
|
|
52042
|
-
if (session.cwd && !
|
|
52117
|
+
if (session.cwd && !existsSync99(session.cwd))
|
|
52043
52118
|
return `working directory ${session.cwd} no longer exists`;
|
|
52044
52119
|
return missingRunConfigCwd(session);
|
|
52045
52120
|
}
|
|
@@ -52053,7 +52128,7 @@ function missingRunConfigCwd(session) {
|
|
|
52053
52128
|
const config = resolveRunConfig(session.runName, dir);
|
|
52054
52129
|
if (!config?.cwd) return void 0;
|
|
52055
52130
|
const configured = resolve33(runConfigBaseDirFrom(dir), config.cwd);
|
|
52056
|
-
if (
|
|
52131
|
+
if (existsSync99(configured)) return void 0;
|
|
52057
52132
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
52058
52133
|
}
|
|
52059
52134
|
|
|
@@ -52101,7 +52176,7 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
|
|
|
52101
52176
|
}
|
|
52102
52177
|
|
|
52103
52178
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
52104
|
-
import { existsSync as
|
|
52179
|
+
import { existsSync as existsSync100, mkdirSync as mkdirSync41, watch as watch2 } from "fs";
|
|
52105
52180
|
import { dirname as dirname50 } from "path";
|
|
52106
52181
|
|
|
52107
52182
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
@@ -52186,7 +52261,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
52186
52261
|
if (timer) clearTimeout(timer);
|
|
52187
52262
|
timer = setTimeout(read3, DEBOUNCE_MS2);
|
|
52188
52263
|
});
|
|
52189
|
-
if (
|
|
52264
|
+
if (existsSync100(path109)) read3();
|
|
52190
52265
|
}
|
|
52191
52266
|
function refreshActivity(session) {
|
|
52192
52267
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -54464,7 +54539,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
54464
54539
|
}
|
|
54465
54540
|
|
|
54466
54541
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
54467
|
-
import { existsSync as
|
|
54542
|
+
import { existsSync as existsSync102 } from "fs";
|
|
54468
54543
|
import { basename as basename35 } from "path";
|
|
54469
54544
|
|
|
54470
54545
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -54485,9 +54560,9 @@ function accountedTrees(sessions) {
|
|
|
54485
54560
|
}
|
|
54486
54561
|
|
|
54487
54562
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
54488
|
-
import { existsSync as
|
|
54563
|
+
import { existsSync as existsSync101 } from "fs";
|
|
54489
54564
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
54490
|
-
if (!
|
|
54565
|
+
if (!existsSync101(clone)) {
|
|
54491
54566
|
for (const { path: path109 } of paths) forgetWorktree(path109);
|
|
54492
54567
|
daemonLog(
|
|
54493
54568
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
@@ -54653,7 +54728,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
54653
54728
|
);
|
|
54654
54729
|
continue;
|
|
54655
54730
|
}
|
|
54656
|
-
if (!
|
|
54731
|
+
if (!existsSync102(path109)) {
|
|
54657
54732
|
logVanishedTree(sessions, path109);
|
|
54658
54733
|
vanished.set(clone, [
|
|
54659
54734
|
...vanished.get(clone) ?? [],
|
|
@@ -55853,7 +55928,7 @@ function spawnAssistInTree(ctx, assistArgs, cwd, meta, context) {
|
|
|
55853
55928
|
}
|
|
55854
55929
|
|
|
55855
55930
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
55856
|
-
import { existsSync as
|
|
55931
|
+
import { existsSync as existsSync105 } from "fs";
|
|
55857
55932
|
|
|
55858
55933
|
// src/commands/sessions/daemon/resumeSession.ts
|
|
55859
55934
|
function resumeSession(id, sessionId2, cwd, name, holdPty, harness) {
|
|
@@ -55884,11 +55959,11 @@ function resumeSession(id, sessionId2, cwd, name, holdPty, harness) {
|
|
|
55884
55959
|
}
|
|
55885
55960
|
|
|
55886
55961
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
55887
|
-
import { existsSync as
|
|
55962
|
+
import { existsSync as existsSync104 } from "fs";
|
|
55888
55963
|
|
|
55889
55964
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
55890
|
-
import { copyFileSync as copyFileSync4, existsSync as
|
|
55891
|
-
import { join as
|
|
55965
|
+
import { copyFileSync as copyFileSync4, existsSync as existsSync103, mkdirSync as mkdirSync43 } from "fs";
|
|
55966
|
+
import { join as join116 } from "path";
|
|
55892
55967
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
55893
55968
|
const dir = projectDirForCwd(toCwd);
|
|
55894
55969
|
if (dir === projectDirForCwd(fromCwd)) {
|
|
@@ -55897,8 +55972,8 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
55897
55972
|
);
|
|
55898
55973
|
return;
|
|
55899
55974
|
}
|
|
55900
|
-
const dest =
|
|
55901
|
-
if (
|
|
55975
|
+
const dest = join116(dir, `${claudeSessionId}.jsonl`);
|
|
55976
|
+
if (existsSync103(dest)) {
|
|
55902
55977
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
55903
55978
|
return;
|
|
55904
55979
|
}
|
|
@@ -55949,7 +56024,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
|
|
|
55949
56024
|
}
|
|
55950
56025
|
function cloneForReapedTree(missingCwd) {
|
|
55951
56026
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
55952
|
-
if (!clone || !
|
|
56027
|
+
if (!clone || !existsSync104(clone))
|
|
55953
56028
|
throw new Error(
|
|
55954
56029
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
55955
56030
|
);
|
|
@@ -55958,7 +56033,7 @@ function cloneForReapedTree(missingCwd) {
|
|
|
55958
56033
|
|
|
55959
56034
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
55960
56035
|
function resumeInTree(ctx, sessionId2, cwd, name, harness) {
|
|
55961
|
-
if (!
|
|
56036
|
+
if (!existsSync105(cwd))
|
|
55962
56037
|
return resumeInReplacementTree(ctx, sessionId2, cwd, name, harness);
|
|
55963
56038
|
const id = ctx.spawnWith(
|
|
55964
56039
|
(sid) => resumeSession(sid, sessionId2, cwd, name, void 0, harness)
|
|
@@ -57227,7 +57302,7 @@ function isPrCheckoutArgs(args) {
|
|
|
57227
57302
|
|
|
57228
57303
|
// src/commands/sessions/daemon/worktree/prCheckoutHolder.ts
|
|
57229
57304
|
import { execFile as execFile14 } from "child_process";
|
|
57230
|
-
import { existsSync as
|
|
57305
|
+
import { existsSync as existsSync106 } from "fs";
|
|
57231
57306
|
function prHeadBranch2(number, cwd) {
|
|
57232
57307
|
const { headBranch } = prCliCommands(number, cwd);
|
|
57233
57308
|
return new Promise((resolve34) => {
|
|
@@ -57241,12 +57316,12 @@ function prHeadBranch2(number, cwd) {
|
|
|
57241
57316
|
}
|
|
57242
57317
|
async function prCheckoutHolder(assistArgs, cwd) {
|
|
57243
57318
|
const number = prCheckoutNumber(assistArgs);
|
|
57244
|
-
if (!number || !cwd || !
|
|
57319
|
+
if (!number || !cwd || !existsSync106(cwd)) return void 0;
|
|
57245
57320
|
const headRef = await prHeadBranch2(number, cwd);
|
|
57246
57321
|
if (!headRef) return void 0;
|
|
57247
57322
|
const listing = await gitOrNull(cwd, ["worktree", "list", "--porcelain"]);
|
|
57248
57323
|
const holder = listing ? worktreeWithBranch(listing, headRef) : null;
|
|
57249
|
-
if (!holder || !
|
|
57324
|
+
if (!holder || !existsSync106(holder)) return void 0;
|
|
57250
57325
|
daemonLog(
|
|
57251
57326
|
`pr #${number} assist ${assistArgs[0]} launched in its checkout ${holder}: head branch ${headRef} is already checked out there, so no worktree is allocated`
|
|
57252
57327
|
);
|