@staff0rd/assist 0.1135.0 → 0.1135.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/built-version +1 -1
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +515 -472
- 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.1135.
|
|
9
|
+
version: "0.1135.2",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -5089,7 +5089,8 @@ async function commitBase(cwd, sha) {
|
|
|
5089
5089
|
async function resolveCommit(cwd, sha) {
|
|
5090
5090
|
const base = await commitBase(cwd, sha);
|
|
5091
5091
|
if (!base) return void 0;
|
|
5092
|
-
|
|
5092
|
+
const paths = await commitPaths(cwd, sha);
|
|
5093
|
+
return { base, paths: paths ?? [], pathsListed: paths !== void 0 };
|
|
5093
5094
|
}
|
|
5094
5095
|
async function commitExists(cwd, sha) {
|
|
5095
5096
|
try {
|
|
@@ -5124,10 +5125,30 @@ async function commitPaths(cwd, sha) {
|
|
|
5124
5125
|
]);
|
|
5125
5126
|
return output.split("\n").filter(Boolean);
|
|
5126
5127
|
} catch {
|
|
5127
|
-
return
|
|
5128
|
+
return void 0;
|
|
5128
5129
|
}
|
|
5129
5130
|
}
|
|
5130
5131
|
|
|
5132
|
+
// src/commands/sessions/web/resolveCommitCached.ts
|
|
5133
|
+
var REVALIDATE_AFTER_MS = 10 * 6e4;
|
|
5134
|
+
var resolved = /* @__PURE__ */ new Map();
|
|
5135
|
+
async function resolveCommitCached(scope, cwd, sha) {
|
|
5136
|
+
const key = `${scope} ${sha}`;
|
|
5137
|
+
const known = resolved.get(key);
|
|
5138
|
+
if (known && known.expiresAt > Date.now()) return known.commit;
|
|
5139
|
+
const found = await resolveCommit(cwd, sha);
|
|
5140
|
+
if (found?.pathsListed) remember(key, found);
|
|
5141
|
+
else resolved.delete(key);
|
|
5142
|
+
return found;
|
|
5143
|
+
}
|
|
5144
|
+
function remember(key, commit2) {
|
|
5145
|
+
const now = Date.now();
|
|
5146
|
+
for (const [other, entry] of resolved) {
|
|
5147
|
+
if (entry.expiresAt <= now) resolved.delete(other);
|
|
5148
|
+
}
|
|
5149
|
+
resolved.set(key, { commit: commit2, expiresAt: now + REVALIDATE_AFTER_MS });
|
|
5150
|
+
}
|
|
5151
|
+
|
|
5131
5152
|
// src/shared/harnessAdapters/harnessLabel.ts
|
|
5132
5153
|
var HARNESS_LABELS = {
|
|
5133
5154
|
claude: "Claude",
|
|
@@ -5880,9 +5901,9 @@ var ASK_USER_QUESTION2 = "AskUserQuestion";
|
|
|
5880
5901
|
function hasPendingAskUserQuestion(events, idx) {
|
|
5881
5902
|
const ev = events[idx];
|
|
5882
5903
|
if (ev?.kind !== "assistant") return false;
|
|
5883
|
-
const
|
|
5904
|
+
const resolved2 = resolvedToolUseIds(events, idx);
|
|
5884
5905
|
return ev.toolUses.some(
|
|
5885
|
-
(tool) => tool.name === ASK_USER_QUESTION2 && !
|
|
5906
|
+
(tool) => tool.name === ASK_USER_QUESTION2 && !resolved2.has(tool.id)
|
|
5886
5907
|
);
|
|
5887
5908
|
}
|
|
5888
5909
|
function resolvedToolUseIds(events, afterIdx) {
|
|
@@ -7874,11 +7895,20 @@ function buildHarnessCodexArgs() {
|
|
|
7874
7895
|
// src/shared/codexIsolatedHookArgs.ts
|
|
7875
7896
|
var codexIsolatedHookArgs = ["--no-daemon"];
|
|
7876
7897
|
|
|
7877
|
-
// src/shared/
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7898
|
+
// src/shared/codexSandboxArgs.ts
|
|
7899
|
+
import { mkdirSync as mkdirSync5 } from "fs";
|
|
7900
|
+
import { homedir as homedir10 } from "os";
|
|
7901
|
+
import { join as join19 } from "path";
|
|
7902
|
+
function codexSandboxArgs() {
|
|
7903
|
+
const assistHome = join19(homedir10(), ".assist");
|
|
7904
|
+
mkdirSync5(assistHome, { recursive: true });
|
|
7905
|
+
return [
|
|
7906
|
+
"-c",
|
|
7907
|
+
"sandbox_workspace_write.network_access=true",
|
|
7908
|
+
"--add-dir",
|
|
7909
|
+
assistHome
|
|
7910
|
+
];
|
|
7911
|
+
}
|
|
7882
7912
|
|
|
7883
7913
|
// src/shared/prepareCodexHookTrust.ts
|
|
7884
7914
|
import { spawnSync } from "child_process";
|
|
@@ -8043,7 +8073,7 @@ function spawnCodex(opts2 = {}) {
|
|
|
8043
8073
|
...codexIsolatedHookArgs,
|
|
8044
8074
|
...override.args,
|
|
8045
8075
|
...sessionEnv,
|
|
8046
|
-
...
|
|
8076
|
+
...codexSandboxArgs(),
|
|
8047
8077
|
...codexDeveloperInstructionsArgs(opts2.appendSystemPromptFile),
|
|
8048
8078
|
...codexArgs(opts2)
|
|
8049
8079
|
],
|
|
@@ -8788,7 +8818,7 @@ function codexHookProbe() {
|
|
|
8788
8818
|
|
|
8789
8819
|
// src/shared/readCodexRulePerms.ts
|
|
8790
8820
|
import { existsSync as existsSync19, readdirSync as readdirSync5, readFileSync as readFileSync13 } from "fs";
|
|
8791
|
-
import { join as
|
|
8821
|
+
import { join as join26 } from "path";
|
|
8792
8822
|
|
|
8793
8823
|
// src/shared/readPatternList.ts
|
|
8794
8824
|
function readString(text18, start2) {
|
|
@@ -8868,15 +8898,15 @@ function parseCodexRules(text18) {
|
|
|
8868
8898
|
function ruleFiles(dir) {
|
|
8869
8899
|
if (!existsSync19(dir)) return [];
|
|
8870
8900
|
try {
|
|
8871
|
-
return readdirSync5(dir).filter((name2) => name2.endsWith(".rules")).sort().map((name2) =>
|
|
8901
|
+
return readdirSync5(dir).filter((name2) => name2.endsWith(".rules")).sort().map((name2) => join26(dir, name2));
|
|
8872
8902
|
} catch {
|
|
8873
8903
|
return [];
|
|
8874
8904
|
}
|
|
8875
8905
|
}
|
|
8876
8906
|
function readCodexRulePerms(key) {
|
|
8877
8907
|
const dirs = [
|
|
8878
|
-
|
|
8879
|
-
|
|
8908
|
+
join26(harnesses.codex.homeDir, "rules"),
|
|
8909
|
+
join26(process.cwd(), ".codex", "rules")
|
|
8880
8910
|
];
|
|
8881
8911
|
return dirs.flatMap(ruleFiles).flatMap((file) => {
|
|
8882
8912
|
try {
|
|
@@ -8910,7 +8940,7 @@ function spawnCodex2(prompt, options2 = {}) {
|
|
|
8910
8940
|
...codexIsolatedHookArgs,
|
|
8911
8941
|
...override.args,
|
|
8912
8942
|
...codexSessionEnvArgs(process.env),
|
|
8913
|
-
...
|
|
8943
|
+
...codexSandboxArgs(),
|
|
8914
8944
|
"-C",
|
|
8915
8945
|
cwd,
|
|
8916
8946
|
"--sandbox",
|
|
@@ -9476,22 +9506,22 @@ async function committedPaths(cwd, session) {
|
|
|
9476
9506
|
if (cached3 && cached3.expiresAt > Date.now()) return cached3.value;
|
|
9477
9507
|
const pending = inFlight.get(key);
|
|
9478
9508
|
if (pending) return pending;
|
|
9479
|
-
const lookup = loadCommittedPaths(cwd, session).then((value) => {
|
|
9509
|
+
const lookup = loadCommittedPaths(key, cwd, session).then((value) => {
|
|
9480
9510
|
cache.set(key, { value, expiresAt: Date.now() + CACHE_TTL_MS });
|
|
9481
9511
|
return value;
|
|
9482
9512
|
}).finally(() => inFlight.delete(key));
|
|
9483
9513
|
inFlight.set(key, lookup);
|
|
9484
9514
|
return lookup;
|
|
9485
9515
|
}
|
|
9486
|
-
async function loadCommittedPaths(cwd, session) {
|
|
9516
|
+
async function loadCommittedPaths(key, cwd, session) {
|
|
9487
9517
|
const itemCommitRefs = await itemCommits(session.conversationId);
|
|
9488
9518
|
const commits2 = itemCommitRefs.length > 0 ? itemCommitRefs : await transcriptCommits(cwd, session);
|
|
9489
9519
|
const bases = /* @__PURE__ */ new Map();
|
|
9490
9520
|
for (const commit2 of commits2) {
|
|
9491
|
-
const
|
|
9492
|
-
if (!
|
|
9493
|
-
for (const path128 of
|
|
9494
|
-
if (!bases.has(path128)) bases.set(path128,
|
|
9521
|
+
const resolved2 = await resolveCommitCached(key, cwd, commit2.sha);
|
|
9522
|
+
if (!resolved2) continue;
|
|
9523
|
+
for (const path128 of resolved2.paths) {
|
|
9524
|
+
if (!bases.has(path128)) bases.set(path128, resolved2.base);
|
|
9495
9525
|
}
|
|
9496
9526
|
}
|
|
9497
9527
|
return { commits: commits2, bases };
|
|
@@ -9657,12 +9687,12 @@ async function diffScopes(req, res) {
|
|
|
9657
9687
|
}
|
|
9658
9688
|
|
|
9659
9689
|
// src/commands/sessions/daemon/recordPromptJournal.ts
|
|
9660
|
-
import { appendFileSync as appendFileSync2, mkdirSync as
|
|
9690
|
+
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync8 } from "fs";
|
|
9661
9691
|
import { dirname as dirname9 } from "path";
|
|
9662
9692
|
function recordPromptJournal(entry) {
|
|
9663
9693
|
const line = JSON.stringify({ at: (/* @__PURE__ */ new Date()).toISOString(), ...entry });
|
|
9664
9694
|
try {
|
|
9665
|
-
|
|
9695
|
+
mkdirSync8(dirname9(daemonPaths.promptJournal), { recursive: true });
|
|
9666
9696
|
appendFileSync2(daemonPaths.promptJournal, `${line}
|
|
9667
9697
|
`);
|
|
9668
9698
|
} catch {
|
|
@@ -9848,17 +9878,17 @@ function getFileTarget(req, res) {
|
|
|
9848
9878
|
|
|
9849
9879
|
// src/commands/sessions/web/fileContent.ts
|
|
9850
9880
|
async function fileContent(req, res) {
|
|
9851
|
-
const
|
|
9852
|
-
if (!
|
|
9881
|
+
const resolved2 = getFileTarget(req, res);
|
|
9882
|
+
if (!resolved2) return;
|
|
9853
9883
|
const commit2 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
|
|
9854
9884
|
"commit"
|
|
9855
9885
|
);
|
|
9856
9886
|
if (commit2) {
|
|
9857
|
-
await respondCommitFile(req, res,
|
|
9887
|
+
await respondCommitFile(req, res, resolved2, commit2);
|
|
9858
9888
|
return;
|
|
9859
9889
|
}
|
|
9860
9890
|
try {
|
|
9861
|
-
const info = await stat(
|
|
9891
|
+
const info = await stat(resolved2.target);
|
|
9862
9892
|
if (!info.isFile()) {
|
|
9863
9893
|
respondJson(res, 404, { error: "File not found" });
|
|
9864
9894
|
return;
|
|
@@ -9868,7 +9898,7 @@ async function fileContent(req, res) {
|
|
|
9868
9898
|
return;
|
|
9869
9899
|
}
|
|
9870
9900
|
respondJson(res, 200, {
|
|
9871
|
-
content: await readFile(
|
|
9901
|
+
content: await readFile(resolved2.target, "utf8"),
|
|
9872
9902
|
mtimeMs: info.mtimeMs
|
|
9873
9903
|
});
|
|
9874
9904
|
} catch {
|
|
@@ -9881,10 +9911,10 @@ import { basename as basename7 } from "path";
|
|
|
9881
9911
|
|
|
9882
9912
|
// src/commands/sessions/web/fromGithub/listClones.ts
|
|
9883
9913
|
import { existsSync as existsSync22, readdirSync as readdirSync7 } from "fs";
|
|
9884
|
-
import { join as
|
|
9914
|
+
import { join as join29 } from "path";
|
|
9885
9915
|
function listClones(baseDir) {
|
|
9886
9916
|
if (!existsSync22(baseDir)) return [];
|
|
9887
|
-
return readdirSync7(baseDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) =>
|
|
9917
|
+
return readdirSync7(baseDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join29(baseDir, entry.name)).filter((dir) => existsSync22(join29(dir, ".git"))).sort();
|
|
9888
9918
|
}
|
|
9889
9919
|
|
|
9890
9920
|
// src/commands/sessions/web/fromGithub/getClones.ts
|
|
@@ -10063,7 +10093,7 @@ function azureDevopsRepoUrl({ org, project, repo }) {
|
|
|
10063
10093
|
|
|
10064
10094
|
// src/commands/sessions/web/fromGithub/findAzureDevopsClone.ts
|
|
10065
10095
|
import { existsSync as existsSync23, readdirSync as readdirSync8 } from "fs";
|
|
10066
|
-
import { join as
|
|
10096
|
+
import { join as join30 } from "path";
|
|
10067
10097
|
|
|
10068
10098
|
// src/shared/azureDevops/parseAzureDevopsRemote.ts
|
|
10069
10099
|
var HTTPS_DEV = /^https?:\/\/(?:[^@/]+@)?dev\.azure\.com\/([^/]+)\/([^/]+)\/_git\/([^/]+)$/i;
|
|
@@ -10084,15 +10114,15 @@ function sameAzureDevopsRepo(a, b) {
|
|
|
10084
10114
|
|
|
10085
10115
|
// src/commands/sessions/web/fromGithub/findAzureDevopsClone.ts
|
|
10086
10116
|
function clonesRepo(dir, repo) {
|
|
10087
|
-
if (!existsSync23(
|
|
10117
|
+
if (!existsSync23(join30(dir, ".git"))) return false;
|
|
10088
10118
|
const url = remoteUrl(dir).url;
|
|
10089
10119
|
const remote = url ? parseAzureDevopsRemote(url) : null;
|
|
10090
10120
|
return remote !== null && sameAzureDevopsRepo(remote, repo);
|
|
10091
10121
|
}
|
|
10092
10122
|
function findAzureDevopsClone(repo, baseDir) {
|
|
10093
10123
|
if (!existsSync23(baseDir)) return void 0;
|
|
10094
|
-
const named =
|
|
10095
|
-
const others = readdirSync8(baseDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) =>
|
|
10124
|
+
const named = join30(baseDir, repo.repo);
|
|
10125
|
+
const others = readdirSync8(baseDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join30(baseDir, entry.name)).filter((dir) => dir !== named).sort();
|
|
10096
10126
|
return [named, ...others].find((dir) => clonesRepo(dir, repo));
|
|
10097
10127
|
}
|
|
10098
10128
|
|
|
@@ -11844,11 +11874,11 @@ function ensureObject(container, key) {
|
|
|
11844
11874
|
return obj;
|
|
11845
11875
|
}
|
|
11846
11876
|
function stepIntoNested(container, key, nextKey) {
|
|
11847
|
-
const
|
|
11877
|
+
const resolved2 = resolveKey(key);
|
|
11848
11878
|
if (nextKey !== void 0 && isNumericKey(nextKey)) {
|
|
11849
|
-
return ensureArray(container,
|
|
11879
|
+
return ensureArray(container, resolved2);
|
|
11850
11880
|
}
|
|
11851
|
-
return ensureObject(container,
|
|
11881
|
+
return ensureObject(container, resolved2);
|
|
11852
11882
|
}
|
|
11853
11883
|
function setNestedValue(obj, path128, value) {
|
|
11854
11884
|
const keys = path128.split(".");
|
|
@@ -11979,14 +12009,14 @@ function assertNoDuplicateRunNames(configs) {
|
|
|
11979
12009
|
|
|
11980
12010
|
// src/shared/findLinkedConfigPath.ts
|
|
11981
12011
|
import { existsSync as existsSync24 } from "fs";
|
|
11982
|
-
import { join as
|
|
12012
|
+
import { join as join31, resolve as resolve5 } from "path";
|
|
11983
12013
|
function findLinkedConfigPath(linkPath, fromDir) {
|
|
11984
|
-
const
|
|
11985
|
-
const claudePath =
|
|
12014
|
+
const resolved2 = resolve5(fromDir, linkPath);
|
|
12015
|
+
const claudePath = join31(resolved2, ".claude", "assist.yml");
|
|
11986
12016
|
if (existsSync24(claudePath)) return claudePath;
|
|
11987
|
-
const rootPath =
|
|
12017
|
+
const rootPath = join31(resolved2, "assist.yml");
|
|
11988
12018
|
if (existsSync24(rootPath)) return rootPath;
|
|
11989
|
-
throw new Error(`No assist.yml found in linked project: ${
|
|
12019
|
+
throw new Error(`No assist.yml found in linked project: ${resolved2}`);
|
|
11990
12020
|
}
|
|
11991
12021
|
|
|
11992
12022
|
// src/shared/loadLinkedEntries.ts
|
|
@@ -12074,19 +12104,19 @@ function handleServerRuns(req, res) {
|
|
|
12074
12104
|
// src/commands/sessions/web/getReviewSynthesis.ts
|
|
12075
12105
|
import { execFile as execFile6 } from "child_process";
|
|
12076
12106
|
import { readFileSync as readFileSync14 } from "fs";
|
|
12077
|
-
import { homedir as
|
|
12078
|
-
import { basename as basename10, join as
|
|
12107
|
+
import { homedir as homedir11 } from "os";
|
|
12108
|
+
import { basename as basename10, join as join33 } from "path";
|
|
12079
12109
|
import { promisify as promisify6 } from "util";
|
|
12080
12110
|
|
|
12081
12111
|
// src/commands/sessions/web/findSynthesisForBranch.ts
|
|
12082
12112
|
import { existsSync as existsSync25, readdirSync as readdirSync9, statSync as statSync8 } from "fs";
|
|
12083
|
-
import { basename as basename9, dirname as dirname11, join as
|
|
12113
|
+
import { basename as basename9, dirname as dirname11, join as join32 } from "path";
|
|
12084
12114
|
function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
12085
|
-
const branchKeyPath =
|
|
12115
|
+
const branchKeyPath = join32(repoReviewsDir, `${branch2}-`);
|
|
12086
12116
|
const parent = dirname11(branchKeyPath);
|
|
12087
12117
|
const branchPrefix = basename9(branchKeyPath);
|
|
12088
12118
|
if (!existsSync25(parent)) return null;
|
|
12089
|
-
const synthesisFiles = readdirSync9(parent).filter((name2) => name2.startsWith(branchPrefix)).map((name2) =>
|
|
12119
|
+
const synthesisFiles = readdirSync9(parent).filter((name2) => name2.startsWith(branchPrefix)).map((name2) => join32(parent, name2, "synthesis.md")).filter((path128) => existsSync25(path128)).map((path128) => ({ path: path128, mtime: statSync8(path128).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
|
|
12090
12120
|
return synthesisFiles[0]?.path ?? null;
|
|
12091
12121
|
}
|
|
12092
12122
|
|
|
@@ -12104,8 +12134,8 @@ async function resolveSynthesisPath(cwd) {
|
|
|
12104
12134
|
runGit2(cwd, ["rev-parse", "--show-toplevel"]),
|
|
12105
12135
|
runGit2(cwd, ["rev-parse", "--abbrev-ref", "HEAD"])
|
|
12106
12136
|
]);
|
|
12107
|
-
const repoReviewsDir =
|
|
12108
|
-
|
|
12137
|
+
const repoReviewsDir = join33(
|
|
12138
|
+
homedir11(),
|
|
12109
12139
|
".assist",
|
|
12110
12140
|
"reviews",
|
|
12111
12141
|
basename10(repoRoot3)
|
|
@@ -12973,29 +13003,29 @@ function resolveRewindPlan(item) {
|
|
|
12973
13003
|
}
|
|
12974
13004
|
|
|
12975
13005
|
// src/commands/backlog/writeSignal.ts
|
|
12976
|
-
import { mkdirSync as
|
|
12977
|
-
import { homedir as
|
|
12978
|
-
import { dirname as dirname13, join as
|
|
13006
|
+
import { mkdirSync as mkdirSync10, writeFileSync as writeFileSync8 } from "fs";
|
|
13007
|
+
import { homedir as homedir13 } from "os";
|
|
13008
|
+
import { dirname as dirname13, join as join35 } from "path";
|
|
12979
13009
|
import chalk10 from "chalk";
|
|
12980
13010
|
|
|
12981
13011
|
// src/commands/backlog/recordSignalOwner.ts
|
|
12982
13012
|
import {
|
|
12983
13013
|
existsSync as existsSync26,
|
|
12984
|
-
mkdirSync as
|
|
13014
|
+
mkdirSync as mkdirSync9,
|
|
12985
13015
|
readFileSync as readFileSync15,
|
|
12986
13016
|
rmSync as rmSync3,
|
|
12987
13017
|
writeFileSync as writeFileSync7
|
|
12988
13018
|
} from "fs";
|
|
12989
|
-
import { homedir as
|
|
12990
|
-
import { dirname as dirname12, join as
|
|
13019
|
+
import { homedir as homedir12 } from "os";
|
|
13020
|
+
import { dirname as dirname12, join as join34 } from "path";
|
|
12991
13021
|
function getOwnerPath(itemId2) {
|
|
12992
|
-
return
|
|
13022
|
+
return join34(homedir12(), ".assist", "signals", `owner-${itemId2}.json`);
|
|
12993
13023
|
}
|
|
12994
13024
|
function recordSignalOwner(itemId2) {
|
|
12995
13025
|
const sessionId2 = process.env.ASSIST_SESSION_ID;
|
|
12996
13026
|
if (!sessionId2) return;
|
|
12997
13027
|
const path128 = getOwnerPath(itemId2);
|
|
12998
|
-
|
|
13028
|
+
mkdirSync9(dirname12(path128), { recursive: true });
|
|
12999
13029
|
writeFileSync7(path128, JSON.stringify({ sessionId: sessionId2 }));
|
|
13000
13030
|
}
|
|
13001
13031
|
function readSignalOwner(itemId2) {
|
|
@@ -13019,7 +13049,7 @@ function clearSignalOwner(itemId2) {
|
|
|
13019
13049
|
// src/commands/backlog/writeSignal.ts
|
|
13020
13050
|
function getSignalPath(sessionId2 = process.env.ASSIST_SESSION_ID) {
|
|
13021
13051
|
if (!sessionId2) return void 0;
|
|
13022
|
-
return
|
|
13052
|
+
return join35(homedir13(), ".assist", "signals", `signal-${sessionId2}.json`);
|
|
13023
13053
|
}
|
|
13024
13054
|
function resolveSignalTarget(event, data) {
|
|
13025
13055
|
const caller = process.env.ASSIST_SESSION_ID;
|
|
@@ -13051,7 +13081,7 @@ function writeSignal(event, data) {
|
|
|
13051
13081
|
const path128 = getSignalPath(target);
|
|
13052
13082
|
if (!path128) return;
|
|
13053
13083
|
const signal = { event, sessionId: target, ...data };
|
|
13054
|
-
|
|
13084
|
+
mkdirSync10(dirname13(path128), { recursive: true });
|
|
13055
13085
|
writeFileSync8(path128, JSON.stringify(signal));
|
|
13056
13086
|
}
|
|
13057
13087
|
|
|
@@ -13874,7 +13904,7 @@ var linkStateCache = {
|
|
|
13874
13904
|
// src/commands/sessions/web/linkStatus/fetchLinkStateChunks.ts
|
|
13875
13905
|
var CHUNK_SIZE = 100;
|
|
13876
13906
|
async function fetchLinkStateChunks(refs, query2) {
|
|
13877
|
-
const
|
|
13907
|
+
const resolved2 = /* @__PURE__ */ new Map();
|
|
13878
13908
|
for (let start2 = 0; start2 < refs.length; start2 += CHUNK_SIZE) {
|
|
13879
13909
|
const chunk2 = refs.slice(start2, start2 + CHUNK_SIZE);
|
|
13880
13910
|
const states2 = await query2(chunk2).catch(() => void 0);
|
|
@@ -13882,11 +13912,11 @@ async function fetchLinkStateChunks(refs, query2) {
|
|
|
13882
13912
|
chunk2.forEach((ref, i) => {
|
|
13883
13913
|
const key = linkRefKey(ref);
|
|
13884
13914
|
const state = states2[i] ?? null;
|
|
13885
|
-
|
|
13915
|
+
resolved2.set(key, state);
|
|
13886
13916
|
linkStateCache.set(key, state);
|
|
13887
13917
|
});
|
|
13888
13918
|
}
|
|
13889
|
-
return
|
|
13919
|
+
return resolved2;
|
|
13890
13920
|
}
|
|
13891
13921
|
|
|
13892
13922
|
// src/commands/sessions/web/linkStatus/queryLinkStates.ts
|
|
@@ -13962,7 +13992,7 @@ function startFetch(refs, query2) {
|
|
|
13962
13992
|
const batch = fetchLinkStateChunks(refs, query2);
|
|
13963
13993
|
for (const ref of refs) {
|
|
13964
13994
|
const key = linkRefKey(ref);
|
|
13965
|
-
const pending = batch.then((
|
|
13995
|
+
const pending = batch.then((resolved2) => resolved2.get(key) ?? null);
|
|
13966
13996
|
inFlight2.set(key, pending);
|
|
13967
13997
|
void pending.finally(() => {
|
|
13968
13998
|
if (inFlight2.get(key) === pending) inFlight2.delete(key);
|
|
@@ -15037,8 +15067,8 @@ function parseRulesSection(content) {
|
|
|
15037
15067
|
import { existsSync as existsSync27, statSync as statSync9 } from "fs";
|
|
15038
15068
|
import path20 from "path";
|
|
15039
15069
|
function scopeDirectory(target) {
|
|
15040
|
-
const
|
|
15041
|
-
return existsSync27(
|
|
15070
|
+
const resolved2 = path20.resolve(target);
|
|
15071
|
+
return existsSync27(resolved2) && statSync9(resolved2).isDirectory() ? resolved2 : path20.dirname(resolved2);
|
|
15042
15072
|
}
|
|
15043
15073
|
|
|
15044
15074
|
// src/commands/rules/readScopedRules.ts
|
|
@@ -16463,11 +16493,11 @@ async function revertPathChanges(cwd, path128) {
|
|
|
16463
16493
|
|
|
16464
16494
|
// src/commands/sessions/web/revertDiffFile.ts
|
|
16465
16495
|
async function revertDiffFile(req, res) {
|
|
16466
|
-
const
|
|
16467
|
-
if (!
|
|
16468
|
-
const path128 = relative5(repoRoot2(
|
|
16496
|
+
const resolved2 = getFileTarget(req, res);
|
|
16497
|
+
if (!resolved2) return;
|
|
16498
|
+
const path128 = relative5(repoRoot2(resolved2.cwd), resolved2.target);
|
|
16469
16499
|
try {
|
|
16470
|
-
await revertPathChanges(
|
|
16500
|
+
await revertPathChanges(resolved2.cwd, path128);
|
|
16471
16501
|
respondJson(res, 200, { reverted: path128 });
|
|
16472
16502
|
} catch (error) {
|
|
16473
16503
|
respondJson(res, 500, {
|
|
@@ -16481,9 +16511,9 @@ import { spawn as spawn7 } from "child_process";
|
|
|
16481
16511
|
import { existsSync as existsSync30 } from "fs";
|
|
16482
16512
|
|
|
16483
16513
|
// src/shared/expandEnv.ts
|
|
16484
|
-
import { homedir as
|
|
16514
|
+
import { homedir as homedir14 } from "os";
|
|
16485
16515
|
function expandTilde2(value) {
|
|
16486
|
-
return value.startsWith("~/") ?
|
|
16516
|
+
return value.startsWith("~/") ? homedir14() + value.slice(1) : value;
|
|
16487
16517
|
}
|
|
16488
16518
|
function expandEnv(env) {
|
|
16489
16519
|
return Object.fromEntries(
|
|
@@ -16494,13 +16524,13 @@ function expandEnv(env) {
|
|
|
16494
16524
|
// src/commands/run/resolveCommand.ts
|
|
16495
16525
|
import { execFileSync as execFileSync6 } from "child_process";
|
|
16496
16526
|
import { existsSync as existsSync29 } from "fs";
|
|
16497
|
-
import { dirname as dirname14, join as
|
|
16527
|
+
import { dirname as dirname14, join as join36, resolve as resolve10 } from "path";
|
|
16498
16528
|
function resolveCommand(command) {
|
|
16499
16529
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
16500
16530
|
try {
|
|
16501
16531
|
const gitPath = execFileSync6("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
16502
16532
|
const gitRoot = resolve10(dirname14(gitPath), "..");
|
|
16503
|
-
const gitBash =
|
|
16533
|
+
const gitBash = join36(gitRoot, "bin", "bash.exe");
|
|
16504
16534
|
if (existsSync29(gitBash)) return gitBash;
|
|
16505
16535
|
} catch {
|
|
16506
16536
|
return command;
|
|
@@ -16674,12 +16704,12 @@ function newSessionDefaults(req, res) {
|
|
|
16674
16704
|
});
|
|
16675
16705
|
return;
|
|
16676
16706
|
}
|
|
16677
|
-
const
|
|
16678
|
-
if ("error" in
|
|
16679
|
-
respondJson(res, 422, { error: `Invalid config ${
|
|
16707
|
+
const resolved2 = resolveDialogHarnesses(raw);
|
|
16708
|
+
if ("error" in resolved2) {
|
|
16709
|
+
respondJson(res, 422, { error: `Invalid config ${resolved2.error}` });
|
|
16680
16710
|
return;
|
|
16681
16711
|
}
|
|
16682
|
-
respondJson(res, 200, { mode: parsed.data, ...
|
|
16712
|
+
respondJson(res, 200, { mode: parsed.data, ...resolved2 });
|
|
16683
16713
|
}
|
|
16684
16714
|
|
|
16685
16715
|
// src/commands/sessions/nodes/fetchPeerJson.ts
|
|
@@ -17996,11 +18026,11 @@ async function readUserConfig(orm) {
|
|
|
17996
18026
|
}
|
|
17997
18027
|
|
|
17998
18028
|
// src/shared/writeRepoConfigCache.ts
|
|
17999
|
-
import { mkdirSync as
|
|
18029
|
+
import { mkdirSync as mkdirSync11, renameSync as renameSync3, writeFileSync as writeFileSync9 } from "fs";
|
|
18000
18030
|
import { dirname as dirname15 } from "path";
|
|
18001
18031
|
function writeRepoConfigCache(repos2, user = {}) {
|
|
18002
18032
|
const path128 = repoConfigCachePath();
|
|
18003
|
-
|
|
18033
|
+
mkdirSync11(dirname15(path128), { recursive: true });
|
|
18004
18034
|
const cache7 = {
|
|
18005
18035
|
refreshedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
18006
18036
|
repos: repos2,
|
|
@@ -18504,17 +18534,17 @@ var autoRestartWait = {
|
|
|
18504
18534
|
|
|
18505
18535
|
// src/commands/extension/fetchLatestSignedExtension.ts
|
|
18506
18536
|
import { readFile as readFile2 } from "fs/promises";
|
|
18507
|
-
import { join as
|
|
18537
|
+
import { join as join38 } from "path";
|
|
18508
18538
|
|
|
18509
18539
|
// src/commands/extension/extensionDir.ts
|
|
18510
18540
|
import { existsSync as existsSync31 } from "fs";
|
|
18511
|
-
import { dirname as dirname16, join as
|
|
18541
|
+
import { dirname as dirname16, join as join37 } from "path";
|
|
18512
18542
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
18513
18543
|
var moduleDir = dirname16(fileURLToPath2(import.meta.url));
|
|
18514
18544
|
function extensionDir() {
|
|
18515
|
-
const bundled =
|
|
18545
|
+
const bundled = join37(moduleDir, "commands", "extension", "extension");
|
|
18516
18546
|
if (existsSync31(bundled)) return bundled;
|
|
18517
|
-
return
|
|
18547
|
+
return join37(moduleDir, "..", "..", "..", "extension");
|
|
18518
18548
|
}
|
|
18519
18549
|
|
|
18520
18550
|
// src/commands/extension/latestUpdate.ts
|
|
@@ -18526,7 +18556,7 @@ function latestUpdate(manifest, updates2) {
|
|
|
18526
18556
|
// src/commands/extension/fetchLatestSignedExtension.ts
|
|
18527
18557
|
async function fetchLatestSignedExtension() {
|
|
18528
18558
|
const manifest = await readFile2(
|
|
18529
|
-
|
|
18559
|
+
join38(extensionDir(), "manifest.json"),
|
|
18530
18560
|
"utf8"
|
|
18531
18561
|
);
|
|
18532
18562
|
const updateUrl = JSON.parse(manifest).browser_specific_settings.gecko.update_url;
|
|
@@ -18570,7 +18600,7 @@ function buildPendingPath(cwd) {
|
|
|
18570
18600
|
}
|
|
18571
18601
|
|
|
18572
18602
|
// src/commands/watch/readBuiltVersion.ts
|
|
18573
|
-
import { join as
|
|
18603
|
+
import { join as join40 } from "path";
|
|
18574
18604
|
|
|
18575
18605
|
// src/shared/readPackageJson.ts
|
|
18576
18606
|
import * as fs18 from "fs";
|
|
@@ -18620,7 +18650,7 @@ function findPackageJsonWithVerifyScripts(startDir) {
|
|
|
18620
18650
|
function readBuiltVersion(cwd) {
|
|
18621
18651
|
try {
|
|
18622
18652
|
const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
18623
|
-
return readPackageJson(
|
|
18653
|
+
return readPackageJson(join40(root2, "package.json")).version ?? "unknown";
|
|
18624
18654
|
} catch {
|
|
18625
18655
|
return "unknown";
|
|
18626
18656
|
}
|
|
@@ -18628,11 +18658,11 @@ function readBuiltVersion(cwd) {
|
|
|
18628
18658
|
|
|
18629
18659
|
// src/commands/watch/readDistVersion.ts
|
|
18630
18660
|
import { readFileSync as readFileSync18 } from "fs";
|
|
18631
|
-
import { join as
|
|
18661
|
+
import { join as join41 } from "path";
|
|
18632
18662
|
function readDistVersion(cwd) {
|
|
18633
18663
|
try {
|
|
18634
18664
|
const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
|
|
18635
|
-
return readFileSync18(
|
|
18665
|
+
return readFileSync18(join41(root2, "dist", "built-version"), "utf8").trim();
|
|
18636
18666
|
} catch {
|
|
18637
18667
|
return void 0;
|
|
18638
18668
|
}
|
|
@@ -18742,8 +18772,8 @@ function stripAnsi(text18) {
|
|
|
18742
18772
|
|
|
18743
18773
|
// src/commands/sessions/daemon/worktree/watcherLogPath.ts
|
|
18744
18774
|
import { createHash } from "crypto";
|
|
18745
|
-
import { homedir as
|
|
18746
|
-
import { basename as basename13, join as
|
|
18775
|
+
import { homedir as homedir15 } from "os";
|
|
18776
|
+
import { basename as basename13, join as join42 } from "path";
|
|
18747
18777
|
|
|
18748
18778
|
// src/commands/sessions/daemon/worktree/canonicalTreePath.ts
|
|
18749
18779
|
import { realpathSync as realpathSync2 } from "fs";
|
|
@@ -18760,8 +18790,8 @@ function canonicalTreePath(path128) {
|
|
|
18760
18790
|
function watcherLogPath(cwd) {
|
|
18761
18791
|
const clone = canonicalTreePath(cwd);
|
|
18762
18792
|
const key = createHash("sha1").update(clone).digest("hex").slice(0, 8);
|
|
18763
|
-
const dir = process.env.ASSIST_WATCHER_LOG_DIR ??
|
|
18764
|
-
return
|
|
18793
|
+
const dir = process.env.ASSIST_WATCHER_LOG_DIR ?? join42(homedir15(), ".assist", "watchers");
|
|
18794
|
+
return join42(dir, `${basename13(clone) || "root"}-${key}.log`);
|
|
18765
18795
|
}
|
|
18766
18796
|
|
|
18767
18797
|
// src/commands/sessions/web/updates/readUpdateHistory.ts
|
|
@@ -18894,7 +18924,7 @@ async function readRequestBuffer(req, limit) {
|
|
|
18894
18924
|
|
|
18895
18925
|
// src/commands/sessions/web/stageAttachment.ts
|
|
18896
18926
|
import { mkdir, mkdtemp, writeFile } from "fs/promises";
|
|
18897
|
-
import { extname as extname2, join as
|
|
18927
|
+
import { extname as extname2, join as join43 } from "path";
|
|
18898
18928
|
|
|
18899
18929
|
// src/commands/sessions/web/ghAttachableExtensions.ts
|
|
18900
18930
|
var ghAttachableExtensions = /* @__PURE__ */ new Set([
|
|
@@ -18926,9 +18956,9 @@ function safeBaseName(name2) {
|
|
|
18926
18956
|
async function stageAttachment(name2, contentType, body) {
|
|
18927
18957
|
const ext = pickExtension(name2, contentType);
|
|
18928
18958
|
await mkdir(stagedAttachmentsDir, { recursive: true });
|
|
18929
|
-
const dir = await mkdtemp(
|
|
18959
|
+
const dir = await mkdtemp(join43(stagedAttachmentsDir, "upload-"));
|
|
18930
18960
|
const alt = safeBaseName(name2);
|
|
18931
|
-
const filePath =
|
|
18961
|
+
const filePath = join43(dir, `${alt}.${ext}`);
|
|
18932
18962
|
await writeFile(filePath, body);
|
|
18933
18963
|
return { dir, filePath, alt };
|
|
18934
18964
|
}
|
|
@@ -18978,14 +19008,14 @@ import { readFile as readFile3, stat as stat3, writeFile as writeFile2 } from "f
|
|
|
18978
19008
|
// src/commands/sessions/web/formatWithOxfmt.ts
|
|
18979
19009
|
import { execFile as execFile13 } from "child_process";
|
|
18980
19010
|
import { existsSync as existsSync34 } from "fs";
|
|
18981
|
-
import { dirname as dirname18, join as
|
|
19011
|
+
import { dirname as dirname18, join as join44 } from "path";
|
|
18982
19012
|
import { promisify as promisify13 } from "util";
|
|
18983
19013
|
var execFileAsync11 = promisify13(execFile13);
|
|
18984
19014
|
var TIMEOUT_MS2 = 15e3;
|
|
18985
19015
|
function findOxfmtScript(root2) {
|
|
18986
19016
|
let dir = root2;
|
|
18987
19017
|
for (; ; ) {
|
|
18988
|
-
const candidate =
|
|
19018
|
+
const candidate = join44(dir, "node_modules", "oxfmt", "bin", "oxfmt");
|
|
18989
19019
|
if (existsSync34(candidate)) return candidate;
|
|
18990
19020
|
const parent = dirname18(dir);
|
|
18991
19021
|
if (parent === dir) return void 0;
|
|
@@ -19033,20 +19063,20 @@ async function currentMtimeMs(target) {
|
|
|
19033
19063
|
}
|
|
19034
19064
|
}
|
|
19035
19065
|
async function writeFileContent(req, res) {
|
|
19036
|
-
const
|
|
19037
|
-
if (!
|
|
19066
|
+
const resolved2 = getFileTarget(req, res);
|
|
19067
|
+
if (!resolved2) return;
|
|
19038
19068
|
const body = await getFileWriteBody(req, res);
|
|
19039
19069
|
if (!body) return;
|
|
19040
|
-
if (await currentMtimeMs(
|
|
19070
|
+
if (await currentMtimeMs(resolved2.target) !== body.mtimeMs) {
|
|
19041
19071
|
respondJson(res, 409, { error: STALE_MESSAGE });
|
|
19042
19072
|
return;
|
|
19043
19073
|
}
|
|
19044
19074
|
try {
|
|
19045
|
-
await writeFile2(
|
|
19046
|
-
await formatWithOxfmt(
|
|
19075
|
+
await writeFile2(resolved2.target, body.content, "utf8");
|
|
19076
|
+
await formatWithOxfmt(resolved2.target, repoRoot2(resolved2.cwd));
|
|
19047
19077
|
respondJson(res, 200, {
|
|
19048
|
-
content: await readFile3(
|
|
19049
|
-
mtimeMs: await currentMtimeMs(
|
|
19078
|
+
content: await readFile3(resolved2.target, "utf8"),
|
|
19079
|
+
mtimeMs: await currentMtimeMs(resolved2.target)
|
|
19050
19080
|
});
|
|
19051
19081
|
} catch (error) {
|
|
19052
19082
|
respondJson(res, 500, {
|
|
@@ -19058,10 +19088,10 @@ async function writeFileContent(req, res) {
|
|
|
19058
19088
|
// src/shared/createBundleHandler.ts
|
|
19059
19089
|
import { createHash as createHash2 } from "crypto";
|
|
19060
19090
|
import { readFileSync as readFileSync19, statSync as statSync10 } from "fs";
|
|
19061
|
-
import { dirname as dirname19, join as
|
|
19091
|
+
import { dirname as dirname19, join as join45 } from "path";
|
|
19062
19092
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
19063
19093
|
function createBundleHandler(importMetaUrl, bundlePath, contentType = "application/javascript") {
|
|
19064
|
-
const file =
|
|
19094
|
+
const file = join45(dirname19(fileURLToPath3(importMetaUrl)), bundlePath);
|
|
19065
19095
|
let cache7;
|
|
19066
19096
|
return (req, res) => {
|
|
19067
19097
|
const mtimeMs = statSync10(file).mtimeMs;
|
|
@@ -19096,8 +19126,8 @@ function createCssHandler(packageEntry) {
|
|
|
19096
19126
|
let cache7;
|
|
19097
19127
|
return (req, res) => {
|
|
19098
19128
|
if (!cache7) {
|
|
19099
|
-
const
|
|
19100
|
-
const body = readFileSync20(
|
|
19129
|
+
const resolved2 = require3.resolve(packageEntry);
|
|
19130
|
+
const body = readFileSync20(resolved2, "utf8");
|
|
19101
19131
|
const etag = `"${createHash3("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
19102
19132
|
cache7 = { body, etag };
|
|
19103
19133
|
}
|
|
@@ -19504,9 +19534,9 @@ function scheduleReconnect() {
|
|
|
19504
19534
|
}
|
|
19505
19535
|
|
|
19506
19536
|
// src/commands/sessions/web/updates/autoRestart/autoRestartAttempts.ts
|
|
19507
|
-
import { mkdirSync as
|
|
19508
|
-
import { dirname as dirname20, join as
|
|
19509
|
-
var defaultPath =
|
|
19537
|
+
import { mkdirSync as mkdirSync12, readFileSync as readFileSync21, writeFileSync as writeFileSync10 } from "fs";
|
|
19538
|
+
import { dirname as dirname20, join as join46 } from "path";
|
|
19539
|
+
var defaultPath = join46(daemonPaths.dir, "auto-restart-attempts.json");
|
|
19510
19540
|
function read(path128) {
|
|
19511
19541
|
try {
|
|
19512
19542
|
return JSON.parse(readFileSync21(path128, "utf8"));
|
|
@@ -19519,7 +19549,7 @@ function autoRestartAttempts(port, path128 = defaultPath) {
|
|
|
19519
19549
|
return {
|
|
19520
19550
|
get: () => read(path128)[key],
|
|
19521
19551
|
set: (built) => {
|
|
19522
|
-
|
|
19552
|
+
mkdirSync12(dirname20(path128), { recursive: true });
|
|
19523
19553
|
writeFileSync10(
|
|
19524
19554
|
path128,
|
|
19525
19555
|
`${JSON.stringify({ ...read(path128), [key]: built }, null, 2)}
|
|
@@ -19720,9 +19750,9 @@ function originResolutionForCwd(cwd) {
|
|
|
19720
19750
|
if (!cwd) return void 0;
|
|
19721
19751
|
const cached3 = cache5.get(cwd);
|
|
19722
19752
|
if (cached3 !== void 0) return { origin: cached3, stable: true };
|
|
19723
|
-
const
|
|
19724
|
-
if (
|
|
19725
|
-
return
|
|
19753
|
+
const resolved2 = resolveCurrentOrigin(cwd);
|
|
19754
|
+
if (resolved2.stable) cache5.set(cwd, resolved2.origin);
|
|
19755
|
+
return resolved2;
|
|
19726
19756
|
}
|
|
19727
19757
|
function originForCwd(cwd) {
|
|
19728
19758
|
return originResolutionForCwd(cwd)?.origin;
|
|
@@ -20250,7 +20280,7 @@ import chalk22 from "chalk";
|
|
|
20250
20280
|
|
|
20251
20281
|
// src/commands/verify/addToKnipIgnoreBinaries.ts
|
|
20252
20282
|
import { existsSync as existsSync36, readFileSync as readFileSync22, writeFileSync as writeFileSync12 } from "fs";
|
|
20253
|
-
import { join as
|
|
20283
|
+
import { join as join47 } from "path";
|
|
20254
20284
|
import chalk21 from "chalk";
|
|
20255
20285
|
function loadKnipConfig(knipJsonPath) {
|
|
20256
20286
|
if (existsSync36(knipJsonPath)) {
|
|
@@ -20259,7 +20289,7 @@ function loadKnipConfig(knipJsonPath) {
|
|
|
20259
20289
|
return { $schema: "https://unpkg.com/knip@5/schema.json" };
|
|
20260
20290
|
}
|
|
20261
20291
|
function addToKnipIgnoreBinaries(cwd, binary) {
|
|
20262
|
-
const knipJsonPath =
|
|
20292
|
+
const knipJsonPath = join47(cwd, "knip.json");
|
|
20263
20293
|
try {
|
|
20264
20294
|
const knipConfig = loadKnipConfig(knipJsonPath);
|
|
20265
20295
|
const ignoreBinaries = knipConfig.ignoreBinaries ?? [];
|
|
@@ -21203,7 +21233,7 @@ function initPackageJson(name2) {
|
|
|
21203
21233
|
}
|
|
21204
21234
|
|
|
21205
21235
|
// src/commands/new/registerNew/newCli/writeCliTemplate.ts
|
|
21206
|
-
import { mkdirSync as
|
|
21236
|
+
import { mkdirSync as mkdirSync14, writeFileSync as writeFileSync20 } from "fs";
|
|
21207
21237
|
function writeCliTemplate(name2) {
|
|
21208
21238
|
console.log("Writing tsconfig.json...");
|
|
21209
21239
|
writeFileSync20(
|
|
@@ -21244,7 +21274,7 @@ export default defineConfig({
|
|
|
21244
21274
|
`
|
|
21245
21275
|
);
|
|
21246
21276
|
console.log("Writing src/index.ts...");
|
|
21247
|
-
|
|
21277
|
+
mkdirSync14("src", { recursive: true });
|
|
21248
21278
|
writeFileSync20(
|
|
21249
21279
|
"src/index.ts",
|
|
21250
21280
|
`#!/usr/bin/env node
|
|
@@ -21281,8 +21311,8 @@ import chalk37 from "chalk";
|
|
|
21281
21311
|
import enquirer3 from "enquirer";
|
|
21282
21312
|
|
|
21283
21313
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
21284
|
-
import { existsSync as existsSync44, mkdirSync as
|
|
21285
|
-
import { dirname as dirname28, join as
|
|
21314
|
+
import { existsSync as existsSync44, mkdirSync as mkdirSync15, readFileSync as readFileSync28, writeFileSync as writeFileSync21 } from "fs";
|
|
21315
|
+
import { dirname as dirname28, join as join54 } from "path";
|
|
21286
21316
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
21287
21317
|
import chalk36 from "chalk";
|
|
21288
21318
|
var WORKFLOW_PATH = ".github/workflows/build.yml";
|
|
@@ -21296,7 +21326,7 @@ function getExistingSiteId() {
|
|
|
21296
21326
|
return match ? match[1] : null;
|
|
21297
21327
|
}
|
|
21298
21328
|
function getTemplateContent(siteId) {
|
|
21299
|
-
const templatePath =
|
|
21329
|
+
const templatePath = join54(__dirname3, "commands/deploy/build.yml");
|
|
21300
21330
|
const template = readFileSync28(templatePath, "utf8");
|
|
21301
21331
|
return template.replace("{{NETLIFY_SITE_ID}}", siteId);
|
|
21302
21332
|
}
|
|
@@ -21304,7 +21334,7 @@ async function updateWorkflow(siteId) {
|
|
|
21304
21334
|
const newContent = getTemplateContent(siteId);
|
|
21305
21335
|
const workflowDir = ".github/workflows";
|
|
21306
21336
|
if (!existsSync44(workflowDir)) {
|
|
21307
|
-
|
|
21337
|
+
mkdirSync15(workflowDir, { recursive: true });
|
|
21308
21338
|
}
|
|
21309
21339
|
if (existsSync44(WORKFLOW_PATH)) {
|
|
21310
21340
|
const oldContent = readFileSync28(WORKFLOW_PATH, "utf8");
|
|
@@ -21605,16 +21635,16 @@ function adviceContextFor(cwd, env = process.env) {
|
|
|
21605
21635
|
|
|
21606
21636
|
// src/commands/advise/loadAdviceFragments.ts
|
|
21607
21637
|
import { readdirSync as readdirSync10, readFileSync as readFileSync30 } from "fs";
|
|
21608
|
-
import { basename as basename15, join as
|
|
21638
|
+
import { basename as basename15, join as join56 } from "path";
|
|
21609
21639
|
|
|
21610
21640
|
// src/commands/advise/adviceDir.ts
|
|
21611
21641
|
import { existsSync as existsSync46 } from "fs";
|
|
21612
|
-
import { dirname as dirname29, join as
|
|
21642
|
+
import { dirname as dirname29, join as join55 } from "path";
|
|
21613
21643
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
21614
21644
|
function adviceDir() {
|
|
21615
21645
|
let current2 = dirname29(fileURLToPath5(import.meta.url));
|
|
21616
21646
|
while (current2 !== dirname29(current2)) {
|
|
21617
|
-
const candidate =
|
|
21647
|
+
const candidate = join55(current2, "agent", "advice");
|
|
21618
21648
|
if (existsSync46(candidate)) return candidate;
|
|
21619
21649
|
current2 = dirname29(current2);
|
|
21620
21650
|
}
|
|
@@ -21647,7 +21677,7 @@ function loadAdviceFragments(dir = adviceDir()) {
|
|
|
21647
21677
|
return readdirSync10(dir).filter((file) => file.endsWith(".md")).sort().map(
|
|
21648
21678
|
(file) => parseAdviceFragment(
|
|
21649
21679
|
basename15(file, ".md"),
|
|
21650
|
-
readFileSync30(
|
|
21680
|
+
readFileSync30(join56(dir, file), "utf8")
|
|
21651
21681
|
)
|
|
21652
21682
|
);
|
|
21653
21683
|
}
|
|
@@ -21682,12 +21712,12 @@ function renderAdviceBody(fragment, context) {
|
|
|
21682
21712
|
|
|
21683
21713
|
// src/commands/advise/adviceConditions.ts
|
|
21684
21714
|
import { existsSync as existsSync47 } from "fs";
|
|
21685
|
-
import { join as
|
|
21715
|
+
import { join as join57 } from "path";
|
|
21686
21716
|
function repoFile(file, label) {
|
|
21687
21717
|
return {
|
|
21688
21718
|
whenMet: `the repo has ${label}`,
|
|
21689
21719
|
whenUnmet: `the repo has no ${label}`,
|
|
21690
|
-
matches: ({ rootDir }) => existsSync47(
|
|
21720
|
+
matches: ({ rootDir }) => existsSync47(join57(rootDir, file))
|
|
21691
21721
|
};
|
|
21692
21722
|
}
|
|
21693
21723
|
var adviceConditions = {
|
|
@@ -21713,11 +21743,11 @@ var adviceConditions = {
|
|
|
21713
21743
|
},
|
|
21714
21744
|
typescript: repoFile("tsconfig.json", "a tsconfig.json"),
|
|
21715
21745
|
filenameConvention: repoFile(
|
|
21716
|
-
|
|
21746
|
+
join57("oxlint-rules", "filenameConvention.ts"),
|
|
21717
21747
|
"oxlint-rules/filenameConvention.ts"
|
|
21718
21748
|
),
|
|
21719
21749
|
claudeSettings: repoFile(
|
|
21720
|
-
|
|
21750
|
+
join57("claude", "settings.json"),
|
|
21721
21751
|
"claude/settings.json"
|
|
21722
21752
|
),
|
|
21723
21753
|
verify: {
|
|
@@ -21883,6 +21913,17 @@ async function readBodyArgument(value) {
|
|
|
21883
21913
|
return body;
|
|
21884
21914
|
}
|
|
21885
21915
|
|
|
21916
|
+
// src/commands/sessions/shared/exitNoPreview.ts
|
|
21917
|
+
function exitNoPreview(error) {
|
|
21918
|
+
console.error(
|
|
21919
|
+
`Error: ${error instanceof Error ? error.message : String(error)}`
|
|
21920
|
+
);
|
|
21921
|
+
console.error(
|
|
21922
|
+
"No preview is open \u2014 nothing is awaiting approval in the preview pane. Do not tell the user to look for one; report this failure instead."
|
|
21923
|
+
);
|
|
21924
|
+
process.exit(1);
|
|
21925
|
+
}
|
|
21926
|
+
|
|
21886
21927
|
// src/commands/sessions/shared/formatPreviewComments.ts
|
|
21887
21928
|
function formatPreviewComments(comments3) {
|
|
21888
21929
|
return comments3.map((c, i) => {
|
|
@@ -22074,10 +22115,7 @@ async function awaitPreviewApproval(subject, request, options2 = {}) {
|
|
|
22074
22115
|
try {
|
|
22075
22116
|
outcome = await requestPreviewDecision(request);
|
|
22076
22117
|
} catch (error) {
|
|
22077
|
-
|
|
22078
|
-
`Error: ${error instanceof Error ? error.message : String(error)}`
|
|
22079
|
-
);
|
|
22080
|
-
process.exit(1);
|
|
22118
|
+
exitNoPreview(error);
|
|
22081
22119
|
}
|
|
22082
22120
|
if (outcome === "superseded") {
|
|
22083
22121
|
console.log(
|
|
@@ -22647,7 +22685,7 @@ function registerAskQuestion(program) {
|
|
|
22647
22685
|
|
|
22648
22686
|
// src/commands/registerBackup.ts
|
|
22649
22687
|
import { mkdir as mkdir3, stat as stat4 } from "fs/promises";
|
|
22650
|
-
import { join as
|
|
22688
|
+
import { join as join59, resolve as resolve16 } from "path";
|
|
22651
22689
|
import chalk42 from "chalk";
|
|
22652
22690
|
|
|
22653
22691
|
// src/shared/db/recordBackup.ts
|
|
@@ -22661,7 +22699,7 @@ async function recordBackup(db, {
|
|
|
22661
22699
|
|
|
22662
22700
|
// src/commands/backup/scheduleBackup.ts
|
|
22663
22701
|
import { mkdir as mkdir2 } from "fs/promises";
|
|
22664
|
-
import { join as
|
|
22702
|
+
import { join as join58 } from "path";
|
|
22665
22703
|
import chalk40 from "chalk";
|
|
22666
22704
|
|
|
22667
22705
|
// src/commands/backup/readCrontab.ts
|
|
@@ -22803,7 +22841,7 @@ async function scheduleBackup({
|
|
|
22803
22841
|
const cronExpr = durationToCron(every);
|
|
22804
22842
|
const dir = expandTilde(loadConfig().backup.dir);
|
|
22805
22843
|
await mkdir2(dir, { recursive: true });
|
|
22806
|
-
const logPath2 =
|
|
22844
|
+
const logPath2 = join58(dir, "cron.log");
|
|
22807
22845
|
const cronLine = `${cronExpr} ${resolveAssistCommand()} backup >> ${logPath2} 2>&1`;
|
|
22808
22846
|
writeCrontab(upsertScheduleBlock(readCrontab(), every, cronLine));
|
|
22809
22847
|
console.error(
|
|
@@ -22982,7 +23020,7 @@ async function backup({ out }) {
|
|
|
22982
23020
|
await mkdir3(dir, { recursive: true });
|
|
22983
23021
|
const start2 = Date.now();
|
|
22984
23022
|
const timestamp9 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
22985
|
-
const filePath = resolve16(
|
|
23023
|
+
const filePath = resolve16(join59(dir, `backup-${timestamp9}.dump`));
|
|
22986
23024
|
await exportBacklog(filePath);
|
|
22987
23025
|
const { size } = await stat4(filePath);
|
|
22988
23026
|
const durationMs = Date.now() - start2;
|
|
@@ -23893,7 +23931,7 @@ function ensureRemoteOrigin() {
|
|
|
23893
23931
|
import { spawnSync as spawnSync7 } from "child_process";
|
|
23894
23932
|
import { mkdtempSync, readFileSync as readFileSync32, unlinkSync as unlinkSync4, writeFileSync as writeFileSync23 } from "fs";
|
|
23895
23933
|
import { tmpdir as tmpdir2 } from "os";
|
|
23896
|
-
import { join as
|
|
23934
|
+
import { join as join60 } from "path";
|
|
23897
23935
|
import enquirer4 from "enquirer";
|
|
23898
23936
|
async function promptType() {
|
|
23899
23937
|
const { type } = await enquirer4.prompt({
|
|
@@ -23933,8 +23971,8 @@ async function promptDescription() {
|
|
|
23933
23971
|
}
|
|
23934
23972
|
function openEditor() {
|
|
23935
23973
|
const editor = process.env.EDITOR || process.env.VISUAL || "vi";
|
|
23936
|
-
const dir = mkdtempSync(
|
|
23937
|
-
const filePath =
|
|
23974
|
+
const dir = mkdtempSync(join60(tmpdir2(), "assist-"));
|
|
23975
|
+
const filePath = join60(dir, "description.md");
|
|
23938
23976
|
writeFileSync23(filePath, "");
|
|
23939
23977
|
const result = spawnSync7(editor, [filePath], { stdio: "inherit" });
|
|
23940
23978
|
if (result.status !== 0) {
|
|
@@ -24376,7 +24414,7 @@ function startProposedRun(id, startOn, cwd = process.cwd()) {
|
|
|
24376
24414
|
import { randomUUID as randomUUID10 } from "crypto";
|
|
24377
24415
|
|
|
24378
24416
|
// src/commands/backlog/propose/mutateLedger.ts
|
|
24379
|
-
import { mkdirSync as
|
|
24417
|
+
import { mkdirSync as mkdirSync16, readFileSync as readFileSync33, renameSync as renameSync4, writeFileSync as writeFileSync24 } from "fs";
|
|
24380
24418
|
import { dirname as dirname30 } from "path";
|
|
24381
24419
|
function readLedger(path128) {
|
|
24382
24420
|
try {
|
|
@@ -24389,7 +24427,7 @@ function readLedger(path128) {
|
|
|
24389
24427
|
function mutateLedger(path128, mutate) {
|
|
24390
24428
|
const ledger = readLedger(path128);
|
|
24391
24429
|
mutate(ledger);
|
|
24392
|
-
|
|
24430
|
+
mkdirSync16(dirname30(path128), { recursive: true });
|
|
24393
24431
|
const tmp = `${path128}.${process.pid}.tmp`;
|
|
24394
24432
|
writeFileSync24(tmp, JSON.stringify(ledger));
|
|
24395
24433
|
renameSync4(tmp, path128);
|
|
@@ -24419,10 +24457,10 @@ async function findPredecessor(path128, token, startedAt) {
|
|
|
24419
24457
|
}
|
|
24420
24458
|
|
|
24421
24459
|
// src/commands/backlog/propose/proposalLedgerPath.ts
|
|
24422
|
-
import { homedir as
|
|
24423
|
-
import { join as
|
|
24460
|
+
import { homedir as homedir16 } from "os";
|
|
24461
|
+
import { join as join61 } from "path";
|
|
24424
24462
|
function proposalLedgerPath(sessionId2) {
|
|
24425
|
-
return
|
|
24463
|
+
return join61(homedir16(), ".assist", "proposals", `session-${sessionId2}.json`);
|
|
24426
24464
|
}
|
|
24427
24465
|
|
|
24428
24466
|
// src/commands/backlog/propose/trackProposal.ts
|
|
@@ -24471,7 +24509,12 @@ async function propose(options2) {
|
|
|
24471
24509
|
return;
|
|
24472
24510
|
}
|
|
24473
24511
|
const item = await readProposedItem(options2.json);
|
|
24474
|
-
|
|
24512
|
+
let tracker;
|
|
24513
|
+
try {
|
|
24514
|
+
tracker = sessionId2 ? trackProposal(sessionId2) : void 0;
|
|
24515
|
+
} catch (error) {
|
|
24516
|
+
exitNoPreview(error);
|
|
24517
|
+
}
|
|
24475
24518
|
try {
|
|
24476
24519
|
const approval = await reviewProposal(
|
|
24477
24520
|
item,
|
|
@@ -24713,9 +24756,9 @@ function fail5(message4) {
|
|
|
24713
24756
|
async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
24714
24757
|
const newOrigin = newOriginRaw ? normalizeOrigin(newOriginRaw) : getOrigin();
|
|
24715
24758
|
const { orm } = await getReady();
|
|
24716
|
-
const
|
|
24717
|
-
if ("error" in
|
|
24718
|
-
const oldOrigin =
|
|
24759
|
+
const resolved2 = await resolveOldOrigin(orm, normalizeOrigin(oldOriginRaw));
|
|
24760
|
+
if ("error" in resolved2) return fail5(resolved2.error);
|
|
24761
|
+
const oldOrigin = resolved2.origin;
|
|
24719
24762
|
if (oldOrigin === newOrigin) {
|
|
24720
24763
|
return fail5(
|
|
24721
24764
|
`Old and new origins both resolve to "${oldOrigin}"; nothing to move.`
|
|
@@ -24916,13 +24959,13 @@ function hasLocalChanges() {
|
|
|
24916
24959
|
// src/commands/backlog/acquireLock.ts
|
|
24917
24960
|
import {
|
|
24918
24961
|
existsSync as existsSync50,
|
|
24919
|
-
mkdirSync as
|
|
24962
|
+
mkdirSync as mkdirSync17,
|
|
24920
24963
|
readFileSync as readFileSync35,
|
|
24921
24964
|
unlinkSync as unlinkSync5,
|
|
24922
24965
|
writeFileSync as writeFileSync25
|
|
24923
24966
|
} from "fs";
|
|
24924
|
-
import { homedir as
|
|
24925
|
-
import { join as
|
|
24967
|
+
import { homedir as homedir17 } from "os";
|
|
24968
|
+
import { join as join62 } from "path";
|
|
24926
24969
|
|
|
24927
24970
|
// src/commands/backlog/bootedAt.ts
|
|
24928
24971
|
import { uptime } from "os";
|
|
@@ -24958,10 +25001,10 @@ function isStaleLock(pid, timestamp9) {
|
|
|
24958
25001
|
|
|
24959
25002
|
// src/commands/backlog/acquireLock.ts
|
|
24960
25003
|
function getLocksDir() {
|
|
24961
|
-
return
|
|
25004
|
+
return join62(homedir17(), ".assist", "locks");
|
|
24962
25005
|
}
|
|
24963
25006
|
function getLockPath(itemId2) {
|
|
24964
|
-
return
|
|
25007
|
+
return join62(getLocksDir(), `lock-${itemId2}.json`);
|
|
24965
25008
|
}
|
|
24966
25009
|
function isProcessAlive(pid) {
|
|
24967
25010
|
try {
|
|
@@ -24988,7 +25031,7 @@ function isLockedByOther(itemId2) {
|
|
|
24988
25031
|
return foreignLockHolder(itemId2) !== null;
|
|
24989
25032
|
}
|
|
24990
25033
|
function acquireLock(itemId2) {
|
|
24991
|
-
|
|
25034
|
+
mkdirSync17(getLocksDir(), { recursive: true });
|
|
24992
25035
|
writeFileSync25(
|
|
24993
25036
|
getLockPath(itemId2),
|
|
24994
25037
|
JSON.stringify({ pid: process.pid, timestamp: (/* @__PURE__ */ new Date()).toISOString() })
|
|
@@ -25432,17 +25475,17 @@ async function resumeDoneConversation({ item, resumeSessionId }, spawnOptions) {
|
|
|
25432
25475
|
}
|
|
25433
25476
|
|
|
25434
25477
|
// src/commands/backlog/consumePause.ts
|
|
25435
|
-
import { existsSync as existsSync51, mkdirSync as
|
|
25436
|
-
import { homedir as
|
|
25437
|
-
import { join as
|
|
25478
|
+
import { existsSync as existsSync51, mkdirSync as mkdirSync18, unlinkSync as unlinkSync6, writeFileSync as writeFileSync26 } from "fs";
|
|
25479
|
+
import { homedir as homedir18 } from "os";
|
|
25480
|
+
import { join as join63 } from "path";
|
|
25438
25481
|
function getControlsDir() {
|
|
25439
|
-
return
|
|
25482
|
+
return join63(homedir18(), ".assist", "controls");
|
|
25440
25483
|
}
|
|
25441
25484
|
function getPausePath(itemId2) {
|
|
25442
|
-
return
|
|
25485
|
+
return join63(getControlsDir(), `pause-${itemId2}.json`);
|
|
25443
25486
|
}
|
|
25444
25487
|
function requestPause(itemId2) {
|
|
25445
|
-
|
|
25488
|
+
mkdirSync18(getControlsDir(), { recursive: true });
|
|
25446
25489
|
writeFileSync26(
|
|
25447
25490
|
getPausePath(itemId2),
|
|
25448
25491
|
JSON.stringify({ timestamp: (/* @__PURE__ */ new Date()).toISOString() })
|
|
@@ -25775,9 +25818,9 @@ async function persistPhaseSessionId(itemId2, phaseIdx, claudeSessionId) {
|
|
|
25775
25818
|
}
|
|
25776
25819
|
|
|
25777
25820
|
// src/shared/emitActivity.ts
|
|
25778
|
-
import { mkdirSync as
|
|
25779
|
-
import { homedir as
|
|
25780
|
-
import { dirname as dirname31, join as
|
|
25821
|
+
import { mkdirSync as mkdirSync19, readFileSync as readFileSync37, rmSync as rmSync4, writeFileSync as writeFileSync27 } from "fs";
|
|
25822
|
+
import { homedir as homedir19 } from "os";
|
|
25823
|
+
import { dirname as dirname31, join as join64 } from "path";
|
|
25781
25824
|
import { z as z19 } from "zod";
|
|
25782
25825
|
var activitySchema = z19.object({
|
|
25783
25826
|
kind: z19.enum(["command", "backlog"]),
|
|
@@ -25795,13 +25838,13 @@ var activitySchema = z19.object({
|
|
|
25795
25838
|
startedAt: z19.number()
|
|
25796
25839
|
});
|
|
25797
25840
|
function activityPath(sessionId2) {
|
|
25798
|
-
return
|
|
25841
|
+
return join64(homedir19(), ".assist", "activity", `activity-${sessionId2}.json`);
|
|
25799
25842
|
}
|
|
25800
25843
|
function emitActivity(activity2) {
|
|
25801
25844
|
const sessionId2 = process.env.ASSIST_ACTIVITY_ID;
|
|
25802
25845
|
if (!sessionId2) return;
|
|
25803
25846
|
const path128 = activityPath(sessionId2);
|
|
25804
|
-
|
|
25847
|
+
mkdirSync19(dirname31(path128), { recursive: true });
|
|
25805
25848
|
writeFileSync27(path128, JSON.stringify({ ...activity2, startedAt: Date.now() }));
|
|
25806
25849
|
}
|
|
25807
25850
|
function readActivity(path128) {
|
|
@@ -25817,12 +25860,12 @@ function reconcileActivity(sessionId2, activity2) {
|
|
|
25817
25860
|
return;
|
|
25818
25861
|
}
|
|
25819
25862
|
const path128 = activityPath(sessionId2);
|
|
25820
|
-
|
|
25863
|
+
mkdirSync19(dirname31(path128), { recursive: true });
|
|
25821
25864
|
writeFileSync27(path128, JSON.stringify(activity2));
|
|
25822
25865
|
}
|
|
25823
25866
|
function writeActivityIfAbsent(sessionId2, activity2) {
|
|
25824
25867
|
const path128 = activityPath(sessionId2);
|
|
25825
|
-
|
|
25868
|
+
mkdirSync19(dirname31(path128), { recursive: true });
|
|
25826
25869
|
try {
|
|
25827
25870
|
writeFileSync27(path128, JSON.stringify(activity2), { flag: "wx" });
|
|
25828
25871
|
return true;
|
|
@@ -27036,13 +27079,13 @@ async function updatePhase(id, phase, options2) {
|
|
|
27036
27079
|
const found = await findPhase(id, phase);
|
|
27037
27080
|
if (!found) return;
|
|
27038
27081
|
const { item, orm, itemId: itemId2, phaseIdx } = found;
|
|
27039
|
-
const
|
|
27040
|
-
if (!
|
|
27041
|
-
console.log(chalk106.red(
|
|
27082
|
+
const resolved2 = resolvePhaseFields(options2, item.plan?.[phaseIdx]);
|
|
27083
|
+
if (!resolved2.ok) {
|
|
27084
|
+
console.log(chalk106.red(resolved2.error));
|
|
27042
27085
|
process.exitCode = 1;
|
|
27043
27086
|
return;
|
|
27044
27087
|
}
|
|
27045
|
-
const { name: name2, task, manualCheck } =
|
|
27088
|
+
const { name: name2, task, manualCheck } = resolved2.fields;
|
|
27046
27089
|
await applyPhaseUpdate(orm, itemId2, phaseIdx, { name: name2, task, manualCheck });
|
|
27047
27090
|
const fields = [
|
|
27048
27091
|
name2 && "name",
|
|
@@ -28611,13 +28654,13 @@ function findCliWrite(command) {
|
|
|
28611
28654
|
|
|
28612
28655
|
// src/shared/readSettingsPerms.ts
|
|
28613
28656
|
import { existsSync as existsSync56, readFileSync as readFileSync40 } from "fs";
|
|
28614
|
-
import { homedir as
|
|
28615
|
-
import { join as
|
|
28657
|
+
import { homedir as homedir20 } from "os";
|
|
28658
|
+
import { join as join65 } from "path";
|
|
28616
28659
|
function readSettingsPerms(key) {
|
|
28617
28660
|
const paths = [
|
|
28618
|
-
|
|
28619
|
-
|
|
28620
|
-
|
|
28661
|
+
join65(homedir20(), ".claude", "settings.json"),
|
|
28662
|
+
join65(process.cwd(), ".claude", "settings.json"),
|
|
28663
|
+
join65(process.cwd(), ".claude", "settings.local.json")
|
|
28621
28664
|
];
|
|
28622
28665
|
const entries2 = [];
|
|
28623
28666
|
for (const p of paths) {
|
|
@@ -28726,8 +28769,8 @@ function isCdToCwd(command) {
|
|
|
28726
28769
|
const parts2 = command.split(/\s+/);
|
|
28727
28770
|
if (parts2[0] !== "cd" || parts2.length > 2) return false;
|
|
28728
28771
|
if (parts2.length === 1) return false;
|
|
28729
|
-
const
|
|
28730
|
-
return
|
|
28772
|
+
const resolved2 = resolve19(normalizeMsysPath(parts2[1]));
|
|
28773
|
+
return resolved2 === resolve19(process.cwd());
|
|
28731
28774
|
}
|
|
28732
28775
|
function isCdToReadAllowedDir(command) {
|
|
28733
28776
|
const parts2 = command.split(/\s+/);
|
|
@@ -28738,8 +28781,8 @@ function isCdToReadAllowedDir(command) {
|
|
|
28738
28781
|
if (!m) continue;
|
|
28739
28782
|
const base = globBaseDir(m[1]);
|
|
28740
28783
|
if (!base) continue;
|
|
28741
|
-
const
|
|
28742
|
-
if (target ===
|
|
28784
|
+
const resolved2 = resolve19(normalizeMsysPath(base));
|
|
28785
|
+
if (target === resolved2 || target.startsWith(resolved2 + sep3)) {
|
|
28743
28786
|
return `cd to Read-allowed directory: ${entry}`;
|
|
28744
28787
|
}
|
|
28745
28788
|
}
|
|
@@ -28986,29 +29029,29 @@ async function decideDocsGuard({
|
|
|
28986
29029
|
import { existsSync as existsSync57, readFileSync as readFileSync42 } from "fs";
|
|
28987
29030
|
|
|
28988
29031
|
// src/commands/schema/getSchemaSessionApprovalPath.ts
|
|
28989
|
-
import { join as
|
|
29032
|
+
import { join as join67 } from "path";
|
|
28990
29033
|
|
|
28991
29034
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
28992
|
-
import { homedir as
|
|
28993
|
-
import { join as
|
|
29035
|
+
import { homedir as homedir21 } from "os";
|
|
29036
|
+
import { join as join66 } from "path";
|
|
28994
29037
|
function getRestrictedDir() {
|
|
28995
|
-
return
|
|
29038
|
+
return join66(homedir21(), ".assist", "restricted");
|
|
28996
29039
|
}
|
|
28997
29040
|
function getPinStatePath(pin2) {
|
|
28998
|
-
return
|
|
29041
|
+
return join66(getRestrictedDir(), `code-comment-${pin2}.json`);
|
|
28999
29042
|
}
|
|
29000
29043
|
|
|
29001
29044
|
// src/commands/schema/getSchemaSessionApprovalPath.ts
|
|
29002
29045
|
var SESSION_ID = /^[\w-]+$/;
|
|
29003
29046
|
function getSchemaSessionApprovalDir() {
|
|
29004
|
-
return
|
|
29047
|
+
return join67(getRestrictedDir(), "schema-sessions");
|
|
29005
29048
|
}
|
|
29006
29049
|
function getSchemaSessionApprovalPath(scope) {
|
|
29007
29050
|
const { harness, conversationId } = scope;
|
|
29008
29051
|
if (!SESSION_ID.test(conversationId) || !SESSION_ID.test(harness))
|
|
29009
29052
|
return void 0;
|
|
29010
29053
|
const name2 = harness === legacyDefaultHarness ? conversationId : `${harness}-${conversationId}`;
|
|
29011
|
-
return
|
|
29054
|
+
return join67(getSchemaSessionApprovalDir(), `${name2}.json`);
|
|
29012
29055
|
}
|
|
29013
29056
|
|
|
29014
29057
|
// src/commands/schema/isSchemaLocked.ts
|
|
@@ -29101,13 +29144,13 @@ async function decideToolOperations(operations2, identity) {
|
|
|
29101
29144
|
import { basename as basename17 } from "path";
|
|
29102
29145
|
|
|
29103
29146
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
29104
|
-
import { mkdirSync as
|
|
29105
|
-
import { homedir as
|
|
29106
|
-
import { join as
|
|
29147
|
+
import { mkdirSync as mkdirSync20 } from "fs";
|
|
29148
|
+
import { homedir as homedir22 } from "os";
|
|
29149
|
+
import { join as join68 } from "path";
|
|
29107
29150
|
import Database from "better-sqlite3";
|
|
29108
29151
|
var _db;
|
|
29109
29152
|
function getDbDir() {
|
|
29110
|
-
return
|
|
29153
|
+
return join68(homedir22(), ".assist");
|
|
29111
29154
|
}
|
|
29112
29155
|
function initSchema(db) {
|
|
29113
29156
|
db.exec(`
|
|
@@ -29125,8 +29168,8 @@ function initSchema(db) {
|
|
|
29125
29168
|
function openPromptsDb(dir) {
|
|
29126
29169
|
if (_db) return _db;
|
|
29127
29170
|
const dbDir = dir ?? getDbDir();
|
|
29128
|
-
|
|
29129
|
-
const db = new Database(
|
|
29171
|
+
mkdirSync20(dbDir, { recursive: true });
|
|
29172
|
+
const db = new Database(join68(dbDir, "assist.db"));
|
|
29130
29173
|
db.pragma("journal_mode = WAL");
|
|
29131
29174
|
initSchema(db);
|
|
29132
29175
|
_db = db;
|
|
@@ -29230,9 +29273,9 @@ ${reasons.join("\n")}`);
|
|
|
29230
29273
|
}
|
|
29231
29274
|
|
|
29232
29275
|
// src/commands/permitCliReads.ts
|
|
29233
|
-
import { existsSync as existsSync58, mkdirSync as
|
|
29234
|
-
import { homedir as
|
|
29235
|
-
import { join as
|
|
29276
|
+
import { existsSync as existsSync58, mkdirSync as mkdirSync21, readFileSync as readFileSync43, writeFileSync as writeFileSync29 } from "fs";
|
|
29277
|
+
import { homedir as homedir23 } from "os";
|
|
29278
|
+
import { join as join69 } from "path";
|
|
29236
29279
|
|
|
29237
29280
|
// src/commands/permitCliReads/assertCliExists.ts
|
|
29238
29281
|
function assertCliExists(cli) {
|
|
@@ -29369,7 +29412,7 @@ async function discoverAll(cli, prefixPath = []) {
|
|
|
29369
29412
|
const p = { done: 0, total: topLevel.length };
|
|
29370
29413
|
const results = await mapAsync(topLevel, CONCURRENCY, async (cmd) => {
|
|
29371
29414
|
showProgress(p, cmd.name);
|
|
29372
|
-
const
|
|
29415
|
+
const resolved2 = await resolveCommand2(
|
|
29373
29416
|
cli,
|
|
29374
29417
|
[...prefixPath, cmd.name],
|
|
29375
29418
|
cmd.description,
|
|
@@ -29378,7 +29421,7 @@ async function discoverAll(cli, prefixPath = []) {
|
|
|
29378
29421
|
);
|
|
29379
29422
|
p.done++;
|
|
29380
29423
|
showProgress(p, cmd.name);
|
|
29381
|
-
return
|
|
29424
|
+
return resolved2;
|
|
29382
29425
|
});
|
|
29383
29426
|
if (interactive) process.stderr.write("\r\x1B[K");
|
|
29384
29427
|
return results.flat();
|
|
@@ -29495,7 +29538,7 @@ function updateSettings(cli, commands) {
|
|
|
29495
29538
|
// src/commands/permitCliReads.ts
|
|
29496
29539
|
function logPath(cli) {
|
|
29497
29540
|
const safeName = cli.replace(/\s+/g, "-");
|
|
29498
|
-
return
|
|
29541
|
+
return join69(homedir23(), ".assist", `cli-discover-${safeName}.log`);
|
|
29499
29542
|
}
|
|
29500
29543
|
function readCache(cli) {
|
|
29501
29544
|
const path128 = logPath(cli);
|
|
@@ -29503,8 +29546,8 @@ function readCache(cli) {
|
|
|
29503
29546
|
return readFileSync43(path128, "utf8");
|
|
29504
29547
|
}
|
|
29505
29548
|
function writeCache(cli, output) {
|
|
29506
|
-
const dir =
|
|
29507
|
-
|
|
29549
|
+
const dir = join69(homedir23(), ".assist");
|
|
29550
|
+
mkdirSync21(dir, { recursive: true });
|
|
29508
29551
|
writeFileSync29(logPath(cli), output);
|
|
29509
29552
|
}
|
|
29510
29553
|
async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
@@ -29669,7 +29712,7 @@ function isHashCommentFile(filePath) {
|
|
|
29669
29712
|
|
|
29670
29713
|
// src/commands/codeComment/sweepRestrictedDir.ts
|
|
29671
29714
|
import { readdirSync as readdirSync11, statSync as statSync11, unlinkSync as unlinkSync8 } from "fs";
|
|
29672
|
-
import { join as
|
|
29715
|
+
import { join as join70 } from "path";
|
|
29673
29716
|
var STALE_AFTER_MS = 30 * 60 * 1e3;
|
|
29674
29717
|
function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
29675
29718
|
let entries2;
|
|
@@ -29680,7 +29723,7 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
29680
29723
|
}
|
|
29681
29724
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
29682
29725
|
for (const entry of entries2) {
|
|
29683
|
-
const path128 =
|
|
29726
|
+
const path128 = join70(dir, entry);
|
|
29684
29727
|
try {
|
|
29685
29728
|
if (statSync11(path128).mtimeMs < cutoff) unlinkSync8(path128);
|
|
29686
29729
|
} catch {
|
|
@@ -29771,7 +29814,7 @@ function validateCommentText(raw, isHash = false) {
|
|
|
29771
29814
|
}
|
|
29772
29815
|
|
|
29773
29816
|
// src/commands/codeComment/issuePin.ts
|
|
29774
|
-
import { mkdirSync as
|
|
29817
|
+
import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync31 } from "fs";
|
|
29775
29818
|
import { randomInt } from "crypto";
|
|
29776
29819
|
|
|
29777
29820
|
// src/commands/notify/deliverPinNotification.ts
|
|
@@ -29856,7 +29899,7 @@ async function deliverPinNotification(notification) {
|
|
|
29856
29899
|
// src/commands/codeComment/issuePin.ts
|
|
29857
29900
|
function issuePin(file, lineNumber, text18) {
|
|
29858
29901
|
const pin2 = generatePin();
|
|
29859
|
-
|
|
29902
|
+
mkdirSync22(getRestrictedDir(), { recursive: true });
|
|
29860
29903
|
sweepRestrictedDir();
|
|
29861
29904
|
writeFileSync31(
|
|
29862
29905
|
getPinStatePath(pin2),
|
|
@@ -31984,19 +32027,19 @@ function scopeOptionsError(options2) {
|
|
|
31984
32027
|
async function configSet(key, value, options2 = {}) {
|
|
31985
32028
|
const scopeError = scopeOptionsError(options2);
|
|
31986
32029
|
if (scopeError) exitWithConfigErrors([scopeError]);
|
|
31987
|
-
const
|
|
31988
|
-
if (
|
|
31989
|
-
console.error(chalk148.red(`Missing required argument for '${
|
|
32030
|
+
const resolved2 = resolveRepoTarget(key, value, options2.repo);
|
|
32031
|
+
if (resolved2.value === void 0) {
|
|
32032
|
+
console.error(chalk148.red(`Missing required argument for '${resolved2.key}'`));
|
|
31990
32033
|
process.exit(1);
|
|
31991
32034
|
}
|
|
31992
|
-
const coercion = coerceCliConfigValue(
|
|
32035
|
+
const coercion = coerceCliConfigValue(resolved2.key, resolved2.value);
|
|
31993
32036
|
if (!coercion.ok) exitWithConfigErrors([coercion.error]);
|
|
31994
|
-
if (isDbBackedConfigKey(
|
|
31995
|
-
return setDbBackedConfigKey(
|
|
32037
|
+
if (isDbBackedConfigKey(resolved2.key))
|
|
32038
|
+
return setDbBackedConfigKey(resolved2.key, coercion.value, resolved2.useRepo);
|
|
31996
32039
|
await setFileConfigKey(
|
|
31997
32040
|
{
|
|
31998
|
-
...
|
|
31999
|
-
node: defaultsToNode(
|
|
32041
|
+
...resolved2,
|
|
32042
|
+
node: defaultsToNode(resolved2.key, options2),
|
|
32000
32043
|
user: options2.user ?? false
|
|
32001
32044
|
},
|
|
32002
32045
|
coercion.value
|
|
@@ -32053,19 +32096,19 @@ function targetLabel(result) {
|
|
|
32053
32096
|
async function configUnset(key, options2 = {}) {
|
|
32054
32097
|
const scopeError = scopeOptionsError(options2);
|
|
32055
32098
|
if (scopeError) exitWithConfigErrors([scopeError]);
|
|
32056
|
-
const
|
|
32057
|
-
if (
|
|
32099
|
+
const resolved2 = resolveRepoUnsetTarget(key, options2.repo);
|
|
32100
|
+
if (resolved2.key === void 0) {
|
|
32058
32101
|
console.error(chalk151.red("Missing required argument 'key'"));
|
|
32059
32102
|
process.exit(1);
|
|
32060
32103
|
return;
|
|
32061
32104
|
}
|
|
32062
|
-
if (isDbBackedConfigKey(
|
|
32063
|
-
return unsetDbBackedConfigKey(
|
|
32105
|
+
if (isDbBackedConfigKey(resolved2.key))
|
|
32106
|
+
return unsetDbBackedConfigKey(resolved2.key, resolved2.useRepo);
|
|
32064
32107
|
await unsetFileConfigKey({
|
|
32065
|
-
key:
|
|
32066
|
-
useRepo:
|
|
32067
|
-
repoName:
|
|
32068
|
-
node: defaultsToNode(
|
|
32108
|
+
key: resolved2.key,
|
|
32109
|
+
useRepo: resolved2.useRepo,
|
|
32110
|
+
repoName: resolved2.repoName,
|
|
32111
|
+
node: defaultsToNode(resolved2.key, options2),
|
|
32069
32112
|
user: options2.user ?? false
|
|
32070
32113
|
});
|
|
32071
32114
|
}
|
|
@@ -32242,16 +32285,16 @@ async function browserRun(options2) {
|
|
|
32242
32285
|
}
|
|
32243
32286
|
|
|
32244
32287
|
// src/commands/browser/browserSnapshot.ts
|
|
32245
|
-
import { mkdirSync as
|
|
32288
|
+
import { mkdirSync as mkdirSync23, writeFileSync as writeFileSync32 } from "fs";
|
|
32246
32289
|
import { dirname as dirname35 } from "path";
|
|
32247
32290
|
|
|
32248
32291
|
// src/commands/browser/snapshotPath.ts
|
|
32249
|
-
import { homedir as
|
|
32250
|
-
import { join as
|
|
32292
|
+
import { homedir as homedir24 } from "os";
|
|
32293
|
+
import { join as join73 } from "path";
|
|
32251
32294
|
function snapshotPath(tabUrl, now) {
|
|
32252
32295
|
const host = new URL(tabUrl).host.replace(/[^\w.-]/g, "-");
|
|
32253
32296
|
const timestamp9 = now.toISOString().replace(/[:.]/g, "-");
|
|
32254
|
-
return
|
|
32297
|
+
return join73(homedir24(), ".assist", "browser", `${host}-${timestamp9}.html`);
|
|
32255
32298
|
}
|
|
32256
32299
|
|
|
32257
32300
|
// src/commands/browser/browserSnapshot.ts
|
|
@@ -32261,7 +32304,7 @@ async function browserSnapshot(options2) {
|
|
|
32261
32304
|
url: options2.url
|
|
32262
32305
|
});
|
|
32263
32306
|
const path128 = snapshotPath(result.tabUrl, /* @__PURE__ */ new Date());
|
|
32264
|
-
|
|
32307
|
+
mkdirSync23(dirname35(path128), { recursive: true });
|
|
32265
32308
|
writeFileSync32(path128, result.html);
|
|
32266
32309
|
console.log(`snapshot: ${path128}`);
|
|
32267
32310
|
}
|
|
@@ -32457,16 +32500,16 @@ async function printExtensionUrl() {
|
|
|
32457
32500
|
|
|
32458
32501
|
// src/commands/extension/signExtension.ts
|
|
32459
32502
|
import { rm as rm2 } from "fs/promises";
|
|
32460
|
-
import { homedir as
|
|
32461
|
-
import { join as
|
|
32503
|
+
import { homedir as homedir25, tmpdir as tmpdir4 } from "os";
|
|
32504
|
+
import { join as join79 } from "path";
|
|
32462
32505
|
import chalk159 from "chalk";
|
|
32463
32506
|
|
|
32464
32507
|
// src/commands/extension/copySignedXpi.ts
|
|
32465
32508
|
import { copyFile } from "fs/promises";
|
|
32466
|
-
import { join as
|
|
32509
|
+
import { join as join74 } from "path";
|
|
32467
32510
|
var SIGNED_XPI_NAME = "assist-extension.xpi";
|
|
32468
32511
|
async function copySignedXpi(xpi, dir) {
|
|
32469
|
-
const fixed2 =
|
|
32512
|
+
const fixed2 = join74(dir, SIGNED_XPI_NAME);
|
|
32470
32513
|
if (fixed2 === xpi) return fixed2;
|
|
32471
32514
|
await copyFile(xpi, fixed2);
|
|
32472
32515
|
return fixed2;
|
|
@@ -32475,11 +32518,11 @@ async function copySignedXpi(xpi, dir) {
|
|
|
32475
32518
|
// src/commands/extension/findSignedXpi.ts
|
|
32476
32519
|
import { existsSync as existsSync62 } from "fs";
|
|
32477
32520
|
import { readdir } from "fs/promises";
|
|
32478
|
-
import { join as
|
|
32521
|
+
import { join as join75 } from "path";
|
|
32479
32522
|
async function findSignedXpi(dir) {
|
|
32480
32523
|
if (!existsSync62(dir)) return null;
|
|
32481
32524
|
const name2 = (await readdir(dir)).find((entry) => entry.endsWith(".xpi"));
|
|
32482
|
-
return name2 ?
|
|
32525
|
+
return name2 ? join75(dir, name2) : null;
|
|
32483
32526
|
}
|
|
32484
32527
|
|
|
32485
32528
|
// src/commands/extension/signedAddonInstallPath.ts
|
|
@@ -32502,10 +32545,10 @@ async function signedAddonInstallPath(xpi) {
|
|
|
32502
32545
|
|
|
32503
32546
|
// src/commands/extension/signPreflightProblem.ts
|
|
32504
32547
|
import { existsSync as existsSync63 } from "fs";
|
|
32505
|
-
import { join as
|
|
32548
|
+
import { join as join76 } from "path";
|
|
32506
32549
|
var KEY_URL = "https://addons.mozilla.org/en-US/developers/addon/api/key/";
|
|
32507
32550
|
function signPreflightProblem(source) {
|
|
32508
|
-
if (!existsSync63(
|
|
32551
|
+
if (!existsSync63(join76(source, "content.js")))
|
|
32509
32552
|
return {
|
|
32510
32553
|
message: `no content.js in ${source}`,
|
|
32511
32554
|
hint: "run npm run build to bundle the content script"
|
|
@@ -32520,7 +32563,7 @@ function signPreflightProblem(source) {
|
|
|
32520
32563
|
|
|
32521
32564
|
// src/commands/extension/stageExtension.ts
|
|
32522
32565
|
import { cp as cp3, mkdir as mkdir5, readFile as readFile5, rm, writeFile as writeFile4 } from "fs/promises";
|
|
32523
|
-
import { basename as basename18, join as
|
|
32566
|
+
import { basename as basename18, join as join77 } from "path";
|
|
32524
32567
|
|
|
32525
32568
|
// src/commands/extension/stampManifestVersion.ts
|
|
32526
32569
|
function stampManifestVersion(manifest, version2) {
|
|
@@ -32537,7 +32580,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
32537
32580
|
recursive: true,
|
|
32538
32581
|
filter: (path128) => basename18(path128) !== "updates.json"
|
|
32539
32582
|
});
|
|
32540
|
-
const manifest =
|
|
32583
|
+
const manifest = join77(staging, "manifest.json");
|
|
32541
32584
|
const stamped = stampManifestVersion(
|
|
32542
32585
|
await readFile5(manifest, "utf8"),
|
|
32543
32586
|
version2
|
|
@@ -32547,7 +32590,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
32547
32590
|
|
|
32548
32591
|
// src/commands/extension/writeUpdateManifest.ts
|
|
32549
32592
|
import { readFile as readFile6, writeFile as writeFile5 } from "fs/promises";
|
|
32550
|
-
import { join as
|
|
32593
|
+
import { join as join78 } from "path";
|
|
32551
32594
|
|
|
32552
32595
|
// src/commands/extension/buildUpdateManifest.ts
|
|
32553
32596
|
var RELEASE_DOWNLOAD_URL = "https://github.com/staff0rd/assist/releases/download";
|
|
@@ -32572,17 +32615,17 @@ function buildUpdateManifest(manifest, version2) {
|
|
|
32572
32615
|
// src/commands/extension/writeUpdateManifest.ts
|
|
32573
32616
|
async function writeUpdateManifest(source, dir, version2) {
|
|
32574
32617
|
await writeFile5(
|
|
32575
|
-
|
|
32618
|
+
join78(dir, "updates.json"),
|
|
32576
32619
|
buildUpdateManifest(
|
|
32577
|
-
await readFile6(
|
|
32620
|
+
await readFile6(join78(source, "manifest.json"), "utf8"),
|
|
32578
32621
|
version2
|
|
32579
32622
|
)
|
|
32580
32623
|
);
|
|
32581
32624
|
}
|
|
32582
32625
|
|
|
32583
32626
|
// src/commands/extension/signExtension.ts
|
|
32584
|
-
var ARTIFACTS_DIR =
|
|
32585
|
-
var STAGING_DIR =
|
|
32627
|
+
var ARTIFACTS_DIR = join79(homedir25(), ".assist", "extension");
|
|
32628
|
+
var STAGING_DIR = join79(tmpdir4(), "assist-extension");
|
|
32586
32629
|
async function signExtension() {
|
|
32587
32630
|
const source = extensionDir();
|
|
32588
32631
|
const problem = signPreflightProblem(source);
|
|
@@ -32876,9 +32919,9 @@ import { readFileSync as readFileSync49 } from "fs";
|
|
|
32876
32919
|
import { parse as parseYaml3 } from "yaml";
|
|
32877
32920
|
|
|
32878
32921
|
// src/commands/devlog/devEntryPath.ts
|
|
32879
|
-
import { join as
|
|
32922
|
+
import { join as join80 } from "path";
|
|
32880
32923
|
function devEntryPath(repoName, week, devDir) {
|
|
32881
|
-
return
|
|
32924
|
+
return join80(devDir, repoName, `${week.toLowerCase()}.md`);
|
|
32882
32925
|
}
|
|
32883
32926
|
|
|
32884
32927
|
// src/commands/devlog/loadDevEntry.ts
|
|
@@ -32991,13 +33034,13 @@ import chalk165 from "chalk";
|
|
|
32991
33034
|
|
|
32992
33035
|
// src/shared/getRepoName.ts
|
|
32993
33036
|
import { existsSync as existsSync65, readFileSync as readFileSync50 } from "fs";
|
|
32994
|
-
import { basename as basename19, join as
|
|
33037
|
+
import { basename as basename19, join as join81 } from "path";
|
|
32995
33038
|
function getRepoName() {
|
|
32996
33039
|
const config = loadConfig();
|
|
32997
33040
|
if (config.devlog?.name) {
|
|
32998
33041
|
return config.devlog.name;
|
|
32999
33042
|
}
|
|
33000
|
-
const packageJsonPath =
|
|
33043
|
+
const packageJsonPath = join81(process.cwd(), "package.json");
|
|
33001
33044
|
if (existsSync65(packageJsonPath)) {
|
|
33002
33045
|
try {
|
|
33003
33046
|
const content = readFileSync50(packageJsonPath, "utf8");
|
|
@@ -33076,7 +33119,7 @@ function list2(options2) {
|
|
|
33076
33119
|
|
|
33077
33120
|
// src/commands/devlog/loadDevWeeks.ts
|
|
33078
33121
|
import { readdirSync as readdirSync12 } from "fs";
|
|
33079
|
-
import { join as
|
|
33122
|
+
import { join as join82 } from "path";
|
|
33080
33123
|
var DEV_FILENAME_PATTERN = /^(\d{4})-w(\d{2})\.md$/;
|
|
33081
33124
|
function parseDevWeekFilename(filename) {
|
|
33082
33125
|
const match = filename.match(DEV_FILENAME_PATTERN);
|
|
@@ -33090,7 +33133,7 @@ function readFilenames(dir) {
|
|
|
33090
33133
|
}
|
|
33091
33134
|
}
|
|
33092
33135
|
function loadDevWeeks(repoName, devDir) {
|
|
33093
|
-
return readFilenames(
|
|
33136
|
+
return readFilenames(join82(devDir, repoName)).map(parseDevWeekFilename).filter((week) => week !== null).sort();
|
|
33094
33137
|
}
|
|
33095
33138
|
|
|
33096
33139
|
// src/commands/devlog/next/displayNextEntry.ts
|
|
@@ -33355,14 +33398,14 @@ async function skip2(week, cwd = process.cwd()) {
|
|
|
33355
33398
|
}
|
|
33356
33399
|
|
|
33357
33400
|
// src/commands/devlog/slack/slack.ts
|
|
33358
|
-
import { mkdirSync as
|
|
33401
|
+
import { mkdirSync as mkdirSync26, writeFileSync as writeFileSync37 } from "fs";
|
|
33359
33402
|
import chalk171 from "chalk";
|
|
33360
33403
|
|
|
33361
33404
|
// src/commands/slack/postSlackMessage.ts
|
|
33362
|
-
import { mkdirSync as
|
|
33405
|
+
import { mkdirSync as mkdirSync25, writeFileSync as writeFileSync36 } from "fs";
|
|
33363
33406
|
|
|
33364
33407
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
33365
|
-
import { mkdirSync as
|
|
33408
|
+
import { mkdirSync as mkdirSync24, writeFileSync as writeFileSync35 } from "fs";
|
|
33366
33409
|
|
|
33367
33410
|
// src/commands/slack/readSlackParts.ts
|
|
33368
33411
|
import { readFileSync as readFileSync52 } from "fs";
|
|
@@ -33408,12 +33451,12 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
33408
33451
|
}
|
|
33409
33452
|
|
|
33410
33453
|
// src/commands/slack/slackWorkingFile.ts
|
|
33411
|
-
import { join as
|
|
33454
|
+
import { join as join83 } from "path";
|
|
33412
33455
|
function slackWorkingFile(channel, partIndex) {
|
|
33413
33456
|
const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
|
|
33414
|
-
const dir =
|
|
33457
|
+
const dir = join83(getStoreDir(), "slack");
|
|
33415
33458
|
const name2 = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
|
|
33416
|
-
return { dir, bodyPath:
|
|
33459
|
+
return { dir, bodyPath: join83(dir, `${name2}.md`) };
|
|
33417
33460
|
}
|
|
33418
33461
|
|
|
33419
33462
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
@@ -33425,7 +33468,7 @@ async function previewSlackThreadParts({
|
|
|
33425
33468
|
}) {
|
|
33426
33469
|
const bodies = readSlackParts(partFiles);
|
|
33427
33470
|
const { dir } = slackWorkingFile(channel);
|
|
33428
|
-
|
|
33471
|
+
mkdirSync24(dir, { recursive: true });
|
|
33429
33472
|
const paths = bodies.map((body, index3) => {
|
|
33430
33473
|
const { bodyPath } = slackWorkingFile(channel, index3 + 1);
|
|
33431
33474
|
writeFileSync35(bodyPath, `${body}
|
|
@@ -33479,7 +33522,7 @@ async function postSlackMessage(channelArg, options2) {
|
|
|
33479
33522
|
process.exit(1);
|
|
33480
33523
|
}
|
|
33481
33524
|
const { dir, bodyPath } = slackWorkingFile(channel);
|
|
33482
|
-
|
|
33525
|
+
mkdirSync25(dir, { recursive: true });
|
|
33483
33526
|
writeFileSync36(bodyPath, `${body}
|
|
33484
33527
|
`);
|
|
33485
33528
|
await reviewProposedSlackMessage({ channel, threadTs }, body, bodyPath);
|
|
@@ -33619,7 +33662,7 @@ function fail8(message4) {
|
|
|
33619
33662
|
process.exit(1);
|
|
33620
33663
|
}
|
|
33621
33664
|
function writeParts(channel, parts2) {
|
|
33622
|
-
|
|
33665
|
+
mkdirSync26(slackWorkingFile(channel).dir, { recursive: true });
|
|
33623
33666
|
return parts2.map((part, index3) => {
|
|
33624
33667
|
const { bodyPath } = slackWorkingFile(channel, index3 + 1);
|
|
33625
33668
|
writeFileSync37(bodyPath, `${part}
|
|
@@ -33663,7 +33706,7 @@ async function slack2(week) {
|
|
|
33663
33706
|
}
|
|
33664
33707
|
|
|
33665
33708
|
// src/commands/devlog/write.ts
|
|
33666
|
-
import { mkdirSync as
|
|
33709
|
+
import { mkdirSync as mkdirSync27, writeFileSync as writeFileSync38 } from "fs";
|
|
33667
33710
|
import { dirname as dirname36 } from "path";
|
|
33668
33711
|
import chalk172 from "chalk";
|
|
33669
33712
|
|
|
@@ -33758,7 +33801,7 @@ async function write() {
|
|
|
33758
33801
|
const devDir = resolveDevDir();
|
|
33759
33802
|
const repoName = getRepoName();
|
|
33760
33803
|
const path128 = devEntryPath(repoName, result.data.week, devDir);
|
|
33761
|
-
|
|
33804
|
+
mkdirSync27(dirname36(path128), { recursive: true });
|
|
33762
33805
|
writeFileSync38(path128, formatDevEntry(repoName, result.data));
|
|
33763
33806
|
console.log(chalk172.green(`Wrote ${path128}`));
|
|
33764
33807
|
}
|
|
@@ -33955,9 +33998,9 @@ async function findPhaseUnlockItem(itemId2, phase) {
|
|
|
33955
33998
|
}
|
|
33956
33999
|
|
|
33957
34000
|
// src/commands/docs/getDocsUnlockPinPath.ts
|
|
33958
|
-
import { join as
|
|
34001
|
+
import { join as join84 } from "path";
|
|
33959
34002
|
function getDocsUnlockPinPath(pin2) {
|
|
33960
|
-
return
|
|
34003
|
+
return join84(getRestrictedDir(), `docs-unlock-pin-${pin2}.json`);
|
|
33961
34004
|
}
|
|
33962
34005
|
|
|
33963
34006
|
// src/commands/docs/readDocsUnlockPinState.ts
|
|
@@ -34013,7 +34056,7 @@ import chalk177 from "chalk";
|
|
|
34013
34056
|
|
|
34014
34057
|
// src/commands/notify/issueUnlockPin.ts
|
|
34015
34058
|
import { randomInt as randomInt2 } from "crypto";
|
|
34016
|
-
import { mkdirSync as
|
|
34059
|
+
import { mkdirSync as mkdirSync28, unlinkSync as unlinkSync11, writeFileSync as writeFileSync39 } from "fs";
|
|
34017
34060
|
async function issueUnlockPin({
|
|
34018
34061
|
area,
|
|
34019
34062
|
label,
|
|
@@ -34021,7 +34064,7 @@ async function issueUnlockPin({
|
|
|
34021
34064
|
state
|
|
34022
34065
|
}) {
|
|
34023
34066
|
const pin2 = randomInt2(0, 1e3).toString().padStart(3, "0");
|
|
34024
|
-
|
|
34067
|
+
mkdirSync28(getRestrictedDir(), { recursive: true });
|
|
34025
34068
|
sweepRestrictedDir();
|
|
34026
34069
|
const path128 = pinPath(pin2);
|
|
34027
34070
|
writeFileSync39(path128, JSON.stringify({ ...state, pin: pin2 }));
|
|
@@ -34100,7 +34143,7 @@ import { unlinkSync as unlinkSync12 } from "fs";
|
|
|
34100
34143
|
import chalk179 from "chalk";
|
|
34101
34144
|
|
|
34102
34145
|
// src/commands/schema/approveSchemaUnlock.ts
|
|
34103
|
-
import { mkdirSync as
|
|
34146
|
+
import { mkdirSync as mkdirSync29, writeFileSync as writeFileSync40 } from "fs";
|
|
34104
34147
|
import chalk178 from "chalk";
|
|
34105
34148
|
|
|
34106
34149
|
// src/commands/schema/schemaHarnessLabel.ts
|
|
@@ -34131,7 +34174,7 @@ function approveSession({ harness, conversationId }) {
|
|
|
34131
34174
|
const scope = { harness, conversationId };
|
|
34132
34175
|
const path128 = getSchemaSessionApprovalPath(scope);
|
|
34133
34176
|
if (!path128) return;
|
|
34134
|
-
|
|
34177
|
+
mkdirSync29(getSchemaSessionApprovalDir(), { recursive: true });
|
|
34135
34178
|
writeFileSync40(path128, JSON.stringify(scope));
|
|
34136
34179
|
console.log(
|
|
34137
34180
|
chalk178.green(
|
|
@@ -34145,9 +34188,9 @@ async function approveSchemaUnlock(state) {
|
|
|
34145
34188
|
}
|
|
34146
34189
|
|
|
34147
34190
|
// src/commands/schema/getSchemaUnlockPinPath.ts
|
|
34148
|
-
import { join as
|
|
34191
|
+
import { join as join85 } from "path";
|
|
34149
34192
|
function getSchemaUnlockPinPath(pin2) {
|
|
34150
|
-
return
|
|
34193
|
+
return join85(getRestrictedDir(), `schema-unlock-pin-${pin2}.json`);
|
|
34151
34194
|
}
|
|
34152
34195
|
|
|
34153
34196
|
// src/commands/schema/readSchemaUnlockPinState.ts
|
|
@@ -34306,7 +34349,7 @@ function registerSchema(parent) {
|
|
|
34306
34349
|
|
|
34307
34350
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
34308
34351
|
import { closeSync as closeSync6, openSync as openSync7, readdirSync as readdirSync14 } from "fs";
|
|
34309
|
-
import { join as
|
|
34352
|
+
import { join as join86 } from "path";
|
|
34310
34353
|
import chalk182 from "chalk";
|
|
34311
34354
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
34312
34355
|
function isLockedDll(debugDir) {
|
|
@@ -34318,7 +34361,7 @@ function isLockedDll(debugDir) {
|
|
|
34318
34361
|
}
|
|
34319
34362
|
for (const file of files) {
|
|
34320
34363
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
34321
|
-
const dllPath =
|
|
34364
|
+
const dllPath = join86(debugDir, file);
|
|
34322
34365
|
try {
|
|
34323
34366
|
const fd = openSync7(dllPath, "r+");
|
|
34324
34367
|
closeSync6(fd);
|
|
@@ -34336,13 +34379,13 @@ function findFirstLockedDll(dir) {
|
|
|
34336
34379
|
return null;
|
|
34337
34380
|
}
|
|
34338
34381
|
if (entries2.includes("bin")) {
|
|
34339
|
-
const locked = isLockedDll(
|
|
34382
|
+
const locked = isLockedDll(join86(dir, "bin", "Debug"));
|
|
34340
34383
|
if (locked) return locked;
|
|
34341
34384
|
}
|
|
34342
34385
|
for (const entry of entries2) {
|
|
34343
34386
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
34344
34387
|
continue;
|
|
34345
|
-
const found = findFirstLockedDll(
|
|
34388
|
+
const found = findFirstLockedDll(join86(dir, entry));
|
|
34346
34389
|
if (found) return found;
|
|
34347
34390
|
}
|
|
34348
34391
|
return null;
|
|
@@ -34514,25 +34557,25 @@ import { existsSync as existsSync68 } from "fs";
|
|
|
34514
34557
|
import path50 from "path";
|
|
34515
34558
|
import chalk184 from "chalk";
|
|
34516
34559
|
function resolveCsproj(csprojPath) {
|
|
34517
|
-
const
|
|
34518
|
-
if (!existsSync68(
|
|
34519
|
-
console.error(chalk184.red(`File not found: ${
|
|
34560
|
+
const resolved2 = path50.resolve(csprojPath);
|
|
34561
|
+
if (!existsSync68(resolved2)) {
|
|
34562
|
+
console.error(chalk184.red(`File not found: ${resolved2}`));
|
|
34520
34563
|
process.exit(1);
|
|
34521
34564
|
}
|
|
34522
|
-
const repoRoot3 = findRepoRoot(path50.dirname(
|
|
34565
|
+
const repoRoot3 = findRepoRoot(path50.dirname(resolved2));
|
|
34523
34566
|
if (!repoRoot3) {
|
|
34524
34567
|
console.error(chalk184.red("Could not find git repository root"));
|
|
34525
34568
|
process.exit(1);
|
|
34526
34569
|
}
|
|
34527
|
-
return { resolved, repoRoot: repoRoot3 };
|
|
34570
|
+
return { resolved: resolved2, repoRoot: repoRoot3 };
|
|
34528
34571
|
}
|
|
34529
34572
|
|
|
34530
34573
|
// src/commands/dotnet/deps.ts
|
|
34531
34574
|
async function deps(csprojPath, options2) {
|
|
34532
|
-
const { resolved, repoRoot: repoRoot3 } = resolveCsproj(csprojPath);
|
|
34533
|
-
const tree = buildTree(
|
|
34575
|
+
const { resolved: resolved2, repoRoot: repoRoot3 } = resolveCsproj(csprojPath);
|
|
34576
|
+
const tree = buildTree(resolved2, repoRoot3);
|
|
34534
34577
|
const totalCount = collectAllDeps(tree).size + 1;
|
|
34535
|
-
const solutions = findContainingSolutions(
|
|
34578
|
+
const solutions = findContainingSolutions(resolved2, repoRoot3);
|
|
34536
34579
|
if (options2.json) {
|
|
34537
34580
|
printJson(tree, totalCount, solutions);
|
|
34538
34581
|
} else {
|
|
@@ -34573,8 +34616,8 @@ function getChangedCsFiles(scope) {
|
|
|
34573
34616
|
// src/commands/dotnet/inSln.ts
|
|
34574
34617
|
import chalk185 from "chalk";
|
|
34575
34618
|
async function inSln(csprojPath) {
|
|
34576
|
-
const { resolved, repoRoot: repoRoot3 } = resolveCsproj(csprojPath);
|
|
34577
|
-
const solutions = findContainingSolutions(
|
|
34619
|
+
const { resolved: resolved2, repoRoot: repoRoot3 } = resolveCsproj(csprojPath);
|
|
34620
|
+
const solutions = findContainingSolutions(resolved2, repoRoot3);
|
|
34578
34621
|
if (solutions.length === 0) {
|
|
34579
34622
|
console.log(chalk185.yellow("Not found in any .sln file"));
|
|
34580
34623
|
process.exit(1);
|
|
@@ -34689,11 +34732,11 @@ import chalk188 from "chalk";
|
|
|
34689
34732
|
|
|
34690
34733
|
// src/commands/dotnet/findSolution.ts
|
|
34691
34734
|
import { readdirSync as readdirSync16 } from "fs";
|
|
34692
|
-
import { dirname as dirname37, join as
|
|
34735
|
+
import { dirname as dirname37, join as join87 } from "path";
|
|
34693
34736
|
import chalk187 from "chalk";
|
|
34694
34737
|
function findSlnInDir(dir) {
|
|
34695
34738
|
try {
|
|
34696
|
-
return readdirSync16(dir).filter((f) => f.endsWith(".sln")).map((f) =>
|
|
34739
|
+
return readdirSync16(dir).filter((f) => f.endsWith(".sln")).map((f) => join87(dir, f));
|
|
34697
34740
|
} catch {
|
|
34698
34741
|
return [];
|
|
34699
34742
|
}
|
|
@@ -34723,12 +34766,12 @@ function findSolution() {
|
|
|
34723
34766
|
// src/commands/dotnet/resolveSolution.ts
|
|
34724
34767
|
function resolveSolution(sln) {
|
|
34725
34768
|
if (sln) {
|
|
34726
|
-
const
|
|
34727
|
-
if (!existsSync69(
|
|
34728
|
-
console.error(chalk188.red(`Solution file not found: ${
|
|
34769
|
+
const resolved2 = path51.resolve(sln);
|
|
34770
|
+
if (!existsSync69(resolved2)) {
|
|
34771
|
+
console.error(chalk188.red(`Solution file not found: ${resolved2}`));
|
|
34729
34772
|
process.exit(1);
|
|
34730
34773
|
}
|
|
34731
|
-
return
|
|
34774
|
+
return resolved2;
|
|
34732
34775
|
}
|
|
34733
34776
|
return findSolution();
|
|
34734
34777
|
}
|
|
@@ -34854,13 +34897,13 @@ function runRoslynInspect(slnPath) {
|
|
|
34854
34897
|
}
|
|
34855
34898
|
|
|
34856
34899
|
// src/commands/dotnet/runEngine.ts
|
|
34857
|
-
function runEngine(
|
|
34900
|
+
function runEngine(resolved2, changedFiles2, options2) {
|
|
34858
34901
|
if (options2.roslyn) {
|
|
34859
|
-
const issues = runRoslynInspect(
|
|
34902
|
+
const issues = runRoslynInspect(resolved2);
|
|
34860
34903
|
return changedFiles2 ? filterToChangedFiles(issues, changedFiles2) : issues;
|
|
34861
34904
|
}
|
|
34862
34905
|
return parseInspectReport(
|
|
34863
|
-
runInspectCode(
|
|
34906
|
+
runInspectCode(resolved2, changedFiles2?.join(";") ?? null, !!options2.swea)
|
|
34864
34907
|
);
|
|
34865
34908
|
}
|
|
34866
34909
|
|
|
@@ -34881,7 +34924,7 @@ function reportResults(issues, elapsed) {
|
|
|
34881
34924
|
if (issues.length > 0) process.exit(1);
|
|
34882
34925
|
}
|
|
34883
34926
|
async function inspect(sln, options2) {
|
|
34884
|
-
const
|
|
34927
|
+
const resolved2 = resolveSolution(sln);
|
|
34885
34928
|
checkBuildLocks();
|
|
34886
34929
|
if (options2.roslyn) assertMsbuildInstalled();
|
|
34887
34930
|
else assertJbInstalled();
|
|
@@ -34893,7 +34936,7 @@ async function inspect(sln, options2) {
|
|
|
34893
34936
|
}
|
|
34894
34937
|
logScope(changedFiles2);
|
|
34895
34938
|
const start2 = Date.now();
|
|
34896
|
-
const issues = runEngine(
|
|
34939
|
+
const issues = runEngine(resolved2, changedFiles2, options2);
|
|
34897
34940
|
const elapsed = Date.now() - start2;
|
|
34898
34941
|
const { all = false, only = [], suppress = [] } = options2;
|
|
34899
34942
|
reportResults(filterIssues(issues, all, only, suppress), elapsed);
|
|
@@ -35735,7 +35778,7 @@ function aggregateCommitters(authorLists) {
|
|
|
35735
35778
|
import { spawnSync as spawnSync8 } from "child_process";
|
|
35736
35779
|
import { unlinkSync as unlinkSync14, writeFileSync as writeFileSync41 } from "fs";
|
|
35737
35780
|
import { tmpdir as tmpdir6 } from "os";
|
|
35738
|
-
import { join as
|
|
35781
|
+
import { join as join88 } from "path";
|
|
35739
35782
|
function buildArgs3(queryFile, vars) {
|
|
35740
35783
|
const args = ["api", "graphql", "-F", `query=@${queryFile}`];
|
|
35741
35784
|
for (const [key, value] of Object.entries(vars)) {
|
|
@@ -35745,7 +35788,7 @@ function buildArgs3(queryFile, vars) {
|
|
|
35745
35788
|
return args;
|
|
35746
35789
|
}
|
|
35747
35790
|
function runGhGraphql(mutation, vars) {
|
|
35748
|
-
const queryFile =
|
|
35791
|
+
const queryFile = join88(tmpdir6(), `gh-query-${Date.now()}.graphql`);
|
|
35749
35792
|
writeFileSync41(queryFile, mutation);
|
|
35750
35793
|
try {
|
|
35751
35794
|
const result = spawnSync8("gh", buildArgs3(queryFile, vars), {
|
|
@@ -36388,10 +36431,10 @@ var defaultTypeChain = ["Epic", "Story", "Subtask"];
|
|
|
36388
36431
|
function fixStructure(target, options2) {
|
|
36389
36432
|
try {
|
|
36390
36433
|
const chain2 = options2.typeChain ? parseTypeChain(options2.typeChain) : defaultTypeChain;
|
|
36391
|
-
const
|
|
36392
|
-
const issueTypes = resolveOrgIssueTypes(
|
|
36434
|
+
const resolved2 = resolveFixStructureTarget(target, options2.repo);
|
|
36435
|
+
const issueTypes = resolveOrgIssueTypes(resolved2.owner);
|
|
36393
36436
|
assertChainTypesExist(chain2, issueTypes);
|
|
36394
|
-
const root2 = fetchRootIssue(
|
|
36437
|
+
const root2 = fetchRootIssue(resolved2);
|
|
36395
36438
|
const { index: index3, asserted } = resolveRootLevelIndex(
|
|
36396
36439
|
chain2,
|
|
36397
36440
|
root2.typeName,
|
|
@@ -36407,7 +36450,7 @@ function fixStructure(target, options2) {
|
|
|
36407
36450
|
const plan2 = planSubtree(root2, context);
|
|
36408
36451
|
printFixStructurePlan(plan2, chain2, options2.apply === true);
|
|
36409
36452
|
assertNothingTooDeep(plan2.tooDeep, chain2);
|
|
36410
|
-
if (options2.apply) applyAndVerifySubtree(
|
|
36453
|
+
if (options2.apply) applyAndVerifySubtree(resolved2, plan2, context);
|
|
36411
36454
|
} catch (error) {
|
|
36412
36455
|
console.error(error instanceof Error ? error.message : String(error));
|
|
36413
36456
|
process.exit(1);
|
|
@@ -36722,9 +36765,9 @@ function applyCreatedIssueMetadata(createOutput, metadata2) {
|
|
|
36722
36765
|
}
|
|
36723
36766
|
|
|
36724
36767
|
// src/commands/github/issue/issuePreviewMetadata.ts
|
|
36725
|
-
function issuePreviewMetadata(
|
|
36726
|
-
if (!
|
|
36727
|
-
const { target, issueType, parent, project, labels, milestone } =
|
|
36768
|
+
function issuePreviewMetadata(resolved2) {
|
|
36769
|
+
if (!resolved2) return [];
|
|
36770
|
+
const { target, issueType, parent, project, labels, milestone } = resolved2;
|
|
36728
36771
|
const items3 = [
|
|
36729
36772
|
{ label: "Repository", value: `${target.owner}/${target.repo}` }
|
|
36730
36773
|
];
|
|
@@ -37132,22 +37175,22 @@ async function createIssue(options2) {
|
|
|
37132
37175
|
title,
|
|
37133
37176
|
body
|
|
37134
37177
|
);
|
|
37135
|
-
const
|
|
37178
|
+
const resolved2 = preflight(options2);
|
|
37136
37179
|
const decision = await reviewProposedIssue(
|
|
37137
37180
|
title,
|
|
37138
37181
|
body,
|
|
37139
|
-
issuePreviewMetadata(
|
|
37182
|
+
issuePreviewMetadata(resolved2)
|
|
37140
37183
|
);
|
|
37141
37184
|
const attachments = decision?.screenshots ?? [];
|
|
37142
37185
|
const output = runGhIssueCreate(
|
|
37143
37186
|
title,
|
|
37144
37187
|
appendScreenshots(body, attachments),
|
|
37145
37188
|
options2.repo,
|
|
37146
|
-
|
|
37189
|
+
resolved2,
|
|
37147
37190
|
attachments
|
|
37148
37191
|
);
|
|
37149
37192
|
console.log(output.trim());
|
|
37150
|
-
if (
|
|
37193
|
+
if (resolved2) applyCreatedIssueMetadata(output, resolved2);
|
|
37151
37194
|
}
|
|
37152
37195
|
|
|
37153
37196
|
// src/commands/github/issue/registerCreateIssue.ts
|
|
@@ -37221,24 +37264,24 @@ function slugFromUrl(url) {
|
|
|
37221
37264
|
}
|
|
37222
37265
|
|
|
37223
37266
|
// src/commands/github/issue/writeIssueWorkingFile.ts
|
|
37224
|
-
import { mkdirSync as
|
|
37267
|
+
import { mkdirSync as mkdirSync30, writeFileSync as writeFileSync42 } from "fs";
|
|
37225
37268
|
|
|
37226
37269
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
37227
|
-
import { join as
|
|
37270
|
+
import { join as join89 } from "path";
|
|
37228
37271
|
function issueWorkingFile(slug2, number) {
|
|
37229
37272
|
const [owner = "unknown", repo = "unknown"] = slug2.split("/");
|
|
37230
|
-
const dir =
|
|
37273
|
+
const dir = join89(getStoreDir(), "github-issues", owner, repo);
|
|
37231
37274
|
return {
|
|
37232
37275
|
dir,
|
|
37233
|
-
bodyPath:
|
|
37234
|
-
metaPath:
|
|
37276
|
+
bodyPath: join89(dir, `${number}.md`),
|
|
37277
|
+
metaPath: join89(dir, `${number}.json`)
|
|
37235
37278
|
};
|
|
37236
37279
|
}
|
|
37237
37280
|
|
|
37238
37281
|
// src/commands/github/issue/writeIssueWorkingFile.ts
|
|
37239
37282
|
function writeIssueWorkingFile(slug2, number, target, updatedAt, body) {
|
|
37240
37283
|
const { dir, bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
37241
|
-
|
|
37284
|
+
mkdirSync30(dir, { recursive: true });
|
|
37242
37285
|
writeFileSync42(bodyPath, body);
|
|
37243
37286
|
writeFileSync42(
|
|
37244
37287
|
metaPath,
|
|
@@ -38418,11 +38461,11 @@ import { existsSync as existsSync72 } from "fs";
|
|
|
38418
38461
|
import { basename as basename22, dirname as dirname39 } from "path";
|
|
38419
38462
|
|
|
38420
38463
|
// src/commands/sessions/daemon/worktree/nextWorktreePath.ts
|
|
38421
|
-
import { basename as basename21, join as
|
|
38464
|
+
import { basename as basename21, join as join90 } from "path";
|
|
38422
38465
|
function nextWorktreePath(clone, base, isTaken) {
|
|
38423
38466
|
const name2 = basename21(clone);
|
|
38424
38467
|
for (let n = 2; n < 1e3; n++) {
|
|
38425
|
-
const candidate =
|
|
38468
|
+
const candidate = join90(base, `${name2}-${n}`);
|
|
38426
38469
|
if (!isTaken(candidate)) return candidate;
|
|
38427
38470
|
}
|
|
38428
38471
|
throw new Error(`no free worktree suffix for ${clone}`);
|
|
@@ -38688,8 +38731,8 @@ function persistedTreeRoots() {
|
|
|
38688
38731
|
}
|
|
38689
38732
|
|
|
38690
38733
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
38691
|
-
import { copyFileSync as copyFileSync3, existsSync as existsSync74, mkdirSync as
|
|
38692
|
-
import { dirname as dirname40, join as
|
|
38734
|
+
import { copyFileSync as copyFileSync3, existsSync as existsSync74, mkdirSync as mkdirSync31 } from "fs";
|
|
38735
|
+
import { dirname as dirname40, join as join92 } from "path";
|
|
38693
38736
|
|
|
38694
38737
|
// src/commands/sessions/daemon/worktree/installPaths.ts
|
|
38695
38738
|
import { resolve as resolve22 } from "path";
|
|
@@ -38720,13 +38763,13 @@ function pendingPathAction(enclosing, states2, paths, stopped) {
|
|
|
38720
38763
|
|
|
38721
38764
|
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
38722
38765
|
import { existsSync as existsSync73 } from "fs";
|
|
38723
|
-
import { join as
|
|
38766
|
+
import { join as join91 } from "path";
|
|
38724
38767
|
function detectInstallCommand(dir) {
|
|
38725
|
-
if (!existsSync73(
|
|
38726
|
-
if (existsSync73(
|
|
38727
|
-
if (existsSync73(
|
|
38728
|
-
if (existsSync73(
|
|
38729
|
-
if (existsSync73(
|
|
38768
|
+
if (!existsSync73(join91(dir, "package.json"))) return null;
|
|
38769
|
+
if (existsSync73(join91(dir, "pnpm-lock.yaml"))) return "pnpm install";
|
|
38770
|
+
if (existsSync73(join91(dir, "yarn.lock"))) return "yarn install";
|
|
38771
|
+
if (existsSync73(join91(dir, "bun.lockb"))) return "bun install";
|
|
38772
|
+
if (existsSync73(join91(dir, "package-lock.json"))) return "npm ci";
|
|
38730
38773
|
return "npm install";
|
|
38731
38774
|
}
|
|
38732
38775
|
|
|
@@ -38918,11 +38961,11 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
38918
38961
|
}
|
|
38919
38962
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
38920
38963
|
for (const rel of copy) {
|
|
38921
|
-
const src =
|
|
38964
|
+
const src = join92(clone, rel);
|
|
38922
38965
|
if (!existsSync74(src)) continue;
|
|
38923
|
-
const dest =
|
|
38966
|
+
const dest = join92(worktreePath, rel);
|
|
38924
38967
|
try {
|
|
38925
|
-
|
|
38968
|
+
mkdirSync31(dirname40(dest), { recursive: true });
|
|
38926
38969
|
copyFileSync3(src, dest);
|
|
38927
38970
|
daemonLog(`worktree ${worktreePath} seeded ${rel}`);
|
|
38928
38971
|
} catch (error) {
|
|
@@ -39424,7 +39467,7 @@ function registerLitellm(program) {
|
|
|
39424
39467
|
}
|
|
39425
39468
|
|
|
39426
39469
|
// src/commands/mermaidExport.ts
|
|
39427
|
-
import { mkdirSync as
|
|
39470
|
+
import { mkdirSync as mkdirSync32, readdirSync as readdirSync17 } from "fs";
|
|
39428
39471
|
import { resolve as resolve24 } from "path";
|
|
39429
39472
|
import chalk207 from "chalk";
|
|
39430
39473
|
|
|
@@ -39493,7 +39536,7 @@ function extractMermaidBlocks(markdown) {
|
|
|
39493
39536
|
async function mermaidExport(file, options2 = {}) {
|
|
39494
39537
|
const { mermaid } = loadConfig();
|
|
39495
39538
|
const outDir = resolve24(process.cwd(), options2.out ?? ".");
|
|
39496
|
-
|
|
39539
|
+
mkdirSync32(outDir, { recursive: true });
|
|
39497
39540
|
if (options2.index !== void 0) {
|
|
39498
39541
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
39499
39542
|
console.error(
|
|
@@ -39588,7 +39631,7 @@ function boardSource(raw, anchorId, options2) {
|
|
|
39588
39631
|
import { stringify as stringify2 } from "yaml";
|
|
39589
39632
|
|
|
39590
39633
|
// src/commands/miro/writeExtract.ts
|
|
39591
|
-
import { mkdirSync as
|
|
39634
|
+
import { mkdirSync as mkdirSync33, writeFileSync as writeFileSync44 } from "fs";
|
|
39592
39635
|
import { dirname as dirname41 } from "path";
|
|
39593
39636
|
import { stringify } from "yaml";
|
|
39594
39637
|
function headerLines(header) {
|
|
@@ -39602,7 +39645,7 @@ function headerLines(header) {
|
|
|
39602
39645
|
];
|
|
39603
39646
|
}
|
|
39604
39647
|
function writeExtract(file, header, texts) {
|
|
39605
|
-
|
|
39648
|
+
mkdirSync33(dirname41(file), { recursive: true });
|
|
39606
39649
|
writeFileSync44(file, `${headerLines(header).join("\n")}
|
|
39607
39650
|
${stringify(texts)}`);
|
|
39608
39651
|
}
|
|
@@ -39776,7 +39819,7 @@ async function saveToRepo(key, extract2, repo, cwd) {
|
|
|
39776
39819
|
return `${SHARED_REPO_CONFIG_SOURCE} under repos.${result.label}`;
|
|
39777
39820
|
}
|
|
39778
39821
|
async function saveMiroExtract(name2, extract2, options2, paths = {}) {
|
|
39779
|
-
const
|
|
39822
|
+
const resolved2 = {
|
|
39780
39823
|
cwd: paths.cwd ?? process.cwd(),
|
|
39781
39824
|
globalConfigPath: paths.globalConfigPath ?? getGlobalConfigPath()
|
|
39782
39825
|
};
|
|
@@ -39786,16 +39829,16 @@ async function saveMiroExtract(name2, extract2, options2, paths = {}) {
|
|
|
39786
39829
|
);
|
|
39787
39830
|
const key = `miro.extracts.${name2}`;
|
|
39788
39831
|
if (options2.repo !== void 0)
|
|
39789
|
-
return saveToRepo(key, extract2, options2.repo,
|
|
39832
|
+
return saveToRepo(key, extract2, options2.repo, resolved2.cwd);
|
|
39790
39833
|
const result = applyConfigSet(
|
|
39791
39834
|
key,
|
|
39792
39835
|
extract2,
|
|
39793
39836
|
options2.node ?? false,
|
|
39794
|
-
|
|
39795
|
-
|
|
39837
|
+
resolved2.cwd,
|
|
39838
|
+
resolved2.globalConfigPath
|
|
39796
39839
|
);
|
|
39797
39840
|
if (!result.ok) throw new MiroExtractError(result.errors.join("\n"));
|
|
39798
|
-
return result.target === "global" ? globalConfigFileLabel(
|
|
39841
|
+
return result.target === "global" ? globalConfigFileLabel(resolved2.globalConfigPath) : projectConfigPathFrom(resolved2.cwd);
|
|
39799
39842
|
}
|
|
39800
39843
|
|
|
39801
39844
|
// src/commands/miro/offerSaveExtract.ts
|
|
@@ -39966,14 +40009,14 @@ function resolveMiroExtract(name2, options2, cwd = process.cwd(), globalConfigPa
|
|
|
39966
40009
|
// src/commands/miro/resolveExtractOptions.ts
|
|
39967
40010
|
function resolveExtractOptions(name2, options2, paths) {
|
|
39968
40011
|
if (!name2) return options2;
|
|
39969
|
-
const
|
|
40012
|
+
const resolved2 = resolveMiroExtract(
|
|
39970
40013
|
name2,
|
|
39971
40014
|
options2,
|
|
39972
40015
|
paths.cwd,
|
|
39973
40016
|
paths.globalConfigPath
|
|
39974
40017
|
);
|
|
39975
|
-
console.error(chalk209.dim(`Extract "${name2}" from ${
|
|
39976
|
-
return
|
|
40018
|
+
console.error(chalk209.dim(`Extract "${name2}" from ${resolved2.from}`));
|
|
40019
|
+
return resolved2.options;
|
|
39977
40020
|
}
|
|
39978
40021
|
|
|
39979
40022
|
// src/commands/miro/selectBoxes.ts
|
|
@@ -40012,26 +40055,26 @@ function requireItems(file) {
|
|
|
40012
40055
|
return file;
|
|
40013
40056
|
}
|
|
40014
40057
|
async function runExtract(name2, options2, paths = {}) {
|
|
40015
|
-
const
|
|
40016
|
-
const source = anchorSource(
|
|
40017
|
-
const itemsFile = requireItems(
|
|
40058
|
+
const resolved2 = resolveExtractOptions(name2, options2, paths);
|
|
40059
|
+
const source = anchorSource(resolved2);
|
|
40060
|
+
const itemsFile = requireItems(resolved2.items);
|
|
40018
40061
|
const raw = readMiroItems(itemsFile);
|
|
40019
40062
|
const items3 = normaliseItems(raw);
|
|
40020
40063
|
const [topLeft, bottomRight] = source.pick ? await pickAnchors(source.sessionId, items3) : [source.topLeft, source.bottomRight];
|
|
40021
40064
|
const selection = selectBoxes(items3, topLeft, bottomRight);
|
|
40022
|
-
const board = boardSource(raw, topLeft,
|
|
40065
|
+
const board = boardSource(raw, topLeft, resolved2);
|
|
40023
40066
|
emitExtract(
|
|
40024
|
-
|
|
40067
|
+
resolved2.out,
|
|
40025
40068
|
{ ...board, topLeft, bottomRight, rect: selection.rect },
|
|
40026
|
-
keptTexts(
|
|
40069
|
+
keptTexts(resolved2, selection.boxes)
|
|
40027
40070
|
);
|
|
40028
|
-
if (source.pick ||
|
|
40071
|
+
if (source.pick || resolved2.save)
|
|
40029
40072
|
await offerSaveExtract(
|
|
40030
40073
|
extractToSave(
|
|
40031
|
-
{ options:
|
|
40074
|
+
{ options: resolved2, items: itemsFile, topLeft, bottomRight, ...board },
|
|
40032
40075
|
paths.cwd
|
|
40033
40076
|
),
|
|
40034
|
-
|
|
40077
|
+
resolved2,
|
|
40035
40078
|
paths
|
|
40036
40079
|
);
|
|
40037
40080
|
}
|
|
@@ -40155,15 +40198,15 @@ function createNetcapHandler(options2) {
|
|
|
40155
40198
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
40156
40199
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
40157
40200
|
import { networkInterfaces } from "os";
|
|
40158
|
-
import { join as
|
|
40201
|
+
import { join as join94 } from "path";
|
|
40159
40202
|
import chalk210 from "chalk";
|
|
40160
40203
|
|
|
40161
40204
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
40162
|
-
import { dirname as dirname42, join as
|
|
40205
|
+
import { dirname as dirname42, join as join93 } from "path";
|
|
40163
40206
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
40164
40207
|
var moduleDir2 = dirname42(fileURLToPath8(import.meta.url));
|
|
40165
40208
|
function netcapExtensionDir() {
|
|
40166
|
-
return
|
|
40209
|
+
return join93(moduleDir2, "commands", "netcap", "netcap-extension");
|
|
40167
40210
|
}
|
|
40168
40211
|
|
|
40169
40212
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
@@ -40178,7 +40221,7 @@ function lanIPv4() {
|
|
|
40178
40221
|
return void 0;
|
|
40179
40222
|
}
|
|
40180
40223
|
async function configureBackground(dir, host, port, filter) {
|
|
40181
|
-
const file =
|
|
40224
|
+
const file = join94(dir, "background.js");
|
|
40182
40225
|
const source = await readFile7(file, "utf8");
|
|
40183
40226
|
await writeFile6(
|
|
40184
40227
|
file,
|
|
@@ -40218,20 +40261,20 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
40218
40261
|
}
|
|
40219
40262
|
|
|
40220
40263
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
40221
|
-
import { isAbsolute as isAbsolute6, join as
|
|
40264
|
+
import { isAbsolute as isAbsolute6, join as join96, resolve as resolve26 } from "path";
|
|
40222
40265
|
|
|
40223
40266
|
// src/commands/netcap/defaultCapturePath.ts
|
|
40224
|
-
import { homedir as
|
|
40225
|
-
import { join as
|
|
40267
|
+
import { homedir as homedir26 } from "os";
|
|
40268
|
+
import { join as join95 } from "path";
|
|
40226
40269
|
function defaultCapturePath() {
|
|
40227
|
-
return
|
|
40270
|
+
return join95(homedir26(), ".assist", "netcap", "capture.jsonl");
|
|
40228
40271
|
}
|
|
40229
40272
|
|
|
40230
40273
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
40231
40274
|
function resolveNetcapOutPath(out) {
|
|
40232
40275
|
if (!out) return defaultCapturePath();
|
|
40233
40276
|
const dir = isAbsolute6(out) ? out : resolve26(process.cwd(), out);
|
|
40234
|
-
return
|
|
40277
|
+
return join96(dir, "capture.jsonl");
|
|
40235
40278
|
}
|
|
40236
40279
|
|
|
40237
40280
|
// src/commands/netcap/netcap.ts
|
|
@@ -40278,7 +40321,7 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
|
|
|
40278
40321
|
|
|
40279
40322
|
// src/commands/netcap/netcapExtract.ts
|
|
40280
40323
|
import { writeFileSync as writeFileSync45 } from "fs";
|
|
40281
|
-
import { join as
|
|
40324
|
+
import { join as join97 } from "path";
|
|
40282
40325
|
import chalk212 from "chalk";
|
|
40283
40326
|
|
|
40284
40327
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
@@ -40723,7 +40766,7 @@ function extractPostsFromCapture(captureFile) {
|
|
|
40723
40766
|
function netcapExtract(file) {
|
|
40724
40767
|
const captureFile = file ?? defaultCapturePath();
|
|
40725
40768
|
const posts = extractPostsFromCapture(captureFile);
|
|
40726
|
-
const outFile =
|
|
40769
|
+
const outFile = join97(captureFile, "..", "posts.json");
|
|
40727
40770
|
writeFileSync45(outFile, `${JSON.stringify(posts, null, 2)}
|
|
40728
40771
|
`);
|
|
40729
40772
|
console.log(
|
|
@@ -41118,11 +41161,11 @@ async function comment2(path128, line, body, options2 = {}) {
|
|
|
41118
41161
|
}
|
|
41119
41162
|
|
|
41120
41163
|
// src/commands/prs/commentsCachePath.ts
|
|
41121
|
-
import { homedir as
|
|
41122
|
-
import { join as
|
|
41164
|
+
import { homedir as homedir27 } from "os";
|
|
41165
|
+
import { join as join98 } from "path";
|
|
41123
41166
|
function commentsCachePath(org, repo, prNumber) {
|
|
41124
|
-
return
|
|
41125
|
-
|
|
41167
|
+
return join98(
|
|
41168
|
+
homedir27(),
|
|
41126
41169
|
".assist",
|
|
41127
41170
|
"pr-comments",
|
|
41128
41171
|
org,
|
|
@@ -41132,7 +41175,7 @@ function commentsCachePath(org, repo, prNumber) {
|
|
|
41132
41175
|
}
|
|
41133
41176
|
|
|
41134
41177
|
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
41135
|
-
import { mkdirSync as
|
|
41178
|
+
import { mkdirSync as mkdirSync34, writeFileSync as writeFileSync46 } from "fs";
|
|
41136
41179
|
import { dirname as dirname44 } from "path";
|
|
41137
41180
|
import { stringify as stringify3 } from "yaml";
|
|
41138
41181
|
|
|
@@ -41157,10 +41200,10 @@ function deleteCommentsCache(org, repo, prNumber) {
|
|
|
41157
41200
|
|
|
41158
41201
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
41159
41202
|
import { readdirSync as readdirSync18, unlinkSync as unlinkSync16 } from "fs";
|
|
41160
|
-
import { join as
|
|
41203
|
+
import { join as join99 } from "path";
|
|
41161
41204
|
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
41162
41205
|
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
41163
|
-
const dir =
|
|
41206
|
+
const dir = join99(cwd, ".assist");
|
|
41164
41207
|
let entries2;
|
|
41165
41208
|
try {
|
|
41166
41209
|
entries2 = readdirSync18(dir);
|
|
@@ -41168,14 +41211,14 @@ function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
|
41168
41211
|
return;
|
|
41169
41212
|
}
|
|
41170
41213
|
for (const entry of entries2.filter((e) => STALE_PATTERN.test(e))) {
|
|
41171
|
-
unlinkSync16(
|
|
41214
|
+
unlinkSync16(join99(dir, entry));
|
|
41172
41215
|
}
|
|
41173
41216
|
}
|
|
41174
41217
|
|
|
41175
41218
|
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
41176
41219
|
function writeCommentsCache(org, repo, prNumber, comments3) {
|
|
41177
41220
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
41178
|
-
|
|
41221
|
+
mkdirSync34(dirname44(cachePath), { recursive: true });
|
|
41179
41222
|
const cacheData = {
|
|
41180
41223
|
prNumber,
|
|
41181
41224
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -41286,7 +41329,7 @@ function failAzureDevops(error) {
|
|
|
41286
41329
|
import { execFileSync as execFileSync23 } from "child_process";
|
|
41287
41330
|
import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as writeFileSync47 } from "fs";
|
|
41288
41331
|
import { tmpdir as tmpdir7 } from "os";
|
|
41289
|
-
import { join as
|
|
41332
|
+
import { join as join100 } from "path";
|
|
41290
41333
|
function azDevopsInvokeArgs(request, inFile) {
|
|
41291
41334
|
return [
|
|
41292
41335
|
"devops",
|
|
@@ -41321,8 +41364,8 @@ function runAz2(args) {
|
|
|
41321
41364
|
}
|
|
41322
41365
|
function invokeAzDevops(request) {
|
|
41323
41366
|
if (request.body === void 0) return runAz2(azDevopsInvokeArgs(request));
|
|
41324
|
-
const dir = mkdtempSync2(
|
|
41325
|
-
const inFile =
|
|
41367
|
+
const dir = mkdtempSync2(join100(tmpdir7(), "assist-az-"));
|
|
41368
|
+
const inFile = join100(dir, "body.json");
|
|
41326
41369
|
try {
|
|
41327
41370
|
writeFileSync47(inFile, JSON.stringify(request.body));
|
|
41328
41371
|
return runAz2(azDevopsInvokeArgs(request, inFile));
|
|
@@ -41613,8 +41656,8 @@ function renderReview(comment3, style) {
|
|
|
41613
41656
|
}
|
|
41614
41657
|
|
|
41615
41658
|
// src/commands/prs/listComments/summarise.ts
|
|
41616
|
-
function summarise(reviewCount, unresolved,
|
|
41617
|
-
const threadCounts = `${unresolved.length} unresolved and ${
|
|
41659
|
+
function summarise(reviewCount, unresolved, resolved2) {
|
|
41660
|
+
const threadCounts = `${unresolved.length} unresolved and ${resolved2.length} resolved threads.`;
|
|
41618
41661
|
if (reviewCount === 0) return `Found ${threadCounts}`;
|
|
41619
41662
|
const reviews = `${reviewCount} review comment${reviewCount === 1 ? "" : "s"}`;
|
|
41620
41663
|
return `Found ${reviews}, ${threadCounts}`;
|
|
@@ -41635,7 +41678,7 @@ function printComments2(result) {
|
|
|
41635
41678
|
comments3.filter((c) => c.type === "line")
|
|
41636
41679
|
);
|
|
41637
41680
|
const unresolved = threads.filter((t) => !t.resolved);
|
|
41638
|
-
const
|
|
41681
|
+
const resolved2 = threads.filter((t) => t.resolved);
|
|
41639
41682
|
for (const review2 of reviews) {
|
|
41640
41683
|
console.log(renderReview(review2, style));
|
|
41641
41684
|
}
|
|
@@ -41646,10 +41689,10 @@ function printComments2(result) {
|
|
|
41646
41689
|
console.log(renderThreadBlock(thread, style));
|
|
41647
41690
|
}
|
|
41648
41691
|
}
|
|
41649
|
-
if (
|
|
41650
|
-
console.log(renderResolvedIndex(
|
|
41692
|
+
if (resolved2.length > 0) {
|
|
41693
|
+
console.log(renderResolvedIndex(resolved2, style));
|
|
41651
41694
|
}
|
|
41652
|
-
console.log(summarise(reviews.length, unresolved,
|
|
41695
|
+
console.log(summarise(reviews.length, unresolved, resolved2));
|
|
41653
41696
|
if (style.agent) {
|
|
41654
41697
|
console.log(agentFooter(unresolved.length));
|
|
41655
41698
|
return;
|
|
@@ -42569,7 +42612,7 @@ var USAGE8 = "Usage: assist prs raise --title <title> --what <what> --why <why>
|
|
|
42569
42612
|
async function raise(options2, command) {
|
|
42570
42613
|
const screenshots = parseScreenshotSpecs(options2.screenshot);
|
|
42571
42614
|
const { title, body } = buildValidatedBody(options2, USAGE8);
|
|
42572
|
-
const
|
|
42615
|
+
const resolved2 = { ...options2, draft: resolveDraftState(options2, command) };
|
|
42573
42616
|
const existing = findOpenPrNumber();
|
|
42574
42617
|
const sessionId2 = process.env.ASSIST_SESSION_ID;
|
|
42575
42618
|
if (process.env.ASSIST_SESSION === "1" && sessionId2) {
|
|
@@ -42578,7 +42621,7 @@ async function raise(options2, command) {
|
|
|
42578
42621
|
title,
|
|
42579
42622
|
body,
|
|
42580
42623
|
prNumber: existing,
|
|
42581
|
-
options:
|
|
42624
|
+
options: resolved2,
|
|
42582
42625
|
reviewAfter: loadConfig().prs?.reviewAfterRaise ?? true,
|
|
42583
42626
|
screenshots
|
|
42584
42627
|
});
|
|
@@ -42594,7 +42637,7 @@ async function raise(options2, command) {
|
|
|
42594
42637
|
existing,
|
|
42595
42638
|
title,
|
|
42596
42639
|
appendScreenshots(body, screenshots),
|
|
42597
|
-
|
|
42640
|
+
resolved2,
|
|
42598
42641
|
screenshots
|
|
42599
42642
|
);
|
|
42600
42643
|
}
|
|
@@ -43692,13 +43735,13 @@ async function fetchAllPages(connection, opts2) {
|
|
|
43692
43735
|
|
|
43693
43736
|
// src/commands/ravendb/ravendbQuery.ts
|
|
43694
43737
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
43695
|
-
const
|
|
43696
|
-
if (!
|
|
43738
|
+
const resolved2 = resolveArgs(connectionName, collection);
|
|
43739
|
+
if (!resolved2.collection && !options2.query) {
|
|
43697
43740
|
console.error(chalk232.red("Provide a collection name or --query filter."));
|
|
43698
43741
|
process.exit(1);
|
|
43699
43742
|
}
|
|
43700
|
-
const { collection: col } =
|
|
43701
|
-
const connection =
|
|
43743
|
+
const { collection: col } = resolved2;
|
|
43744
|
+
const connection = resolved2.connection;
|
|
43702
43745
|
const allResults = await fetchAllPages(connection, {
|
|
43703
43746
|
collection: col,
|
|
43704
43747
|
pageSize: Number.parseInt(options2.pageSize ?? "25", 10),
|
|
@@ -44452,9 +44495,9 @@ async function notify() {
|
|
|
44452
44495
|
|
|
44453
44496
|
// src/commands/screenshot.ts
|
|
44454
44497
|
import { execSync as execSync54 } from "child_process";
|
|
44455
|
-
import { existsSync as existsSync77, mkdirSync as
|
|
44498
|
+
import { existsSync as existsSync77, mkdirSync as mkdirSync35, unlinkSync as unlinkSync17, writeFileSync as writeFileSync48 } from "fs";
|
|
44456
44499
|
import { tmpdir as tmpdir8 } from "os";
|
|
44457
|
-
import { join as
|
|
44500
|
+
import { join as join101, resolve as resolve28 } from "path";
|
|
44458
44501
|
import chalk239 from "chalk";
|
|
44459
44502
|
|
|
44460
44503
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
@@ -44585,13 +44628,13 @@ Write-Output $OutputPath
|
|
|
44585
44628
|
// src/commands/screenshot.ts
|
|
44586
44629
|
function buildOutputPath(outputDir, processName) {
|
|
44587
44630
|
if (!existsSync77(outputDir)) {
|
|
44588
|
-
|
|
44631
|
+
mkdirSync35(outputDir, { recursive: true });
|
|
44589
44632
|
}
|
|
44590
44633
|
const timestamp9 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
44591
44634
|
return resolve28(outputDir, `${processName}-${timestamp9}.png`);
|
|
44592
44635
|
}
|
|
44593
44636
|
function runPowerShellScript(processName, outputPath) {
|
|
44594
|
-
const scriptPath =
|
|
44637
|
+
const scriptPath = join101(tmpdir8(), `assist-screenshot-${Date.now()}.ps1`);
|
|
44595
44638
|
writeFileSync48(scriptPath, captureWindowPs1, "utf8");
|
|
44596
44639
|
try {
|
|
44597
44640
|
execSync54(
|
|
@@ -44693,9 +44736,9 @@ function buildLimitsSegment(rateLimits) {
|
|
|
44693
44736
|
|
|
44694
44737
|
// src/commands/readGitBranch.ts
|
|
44695
44738
|
import { readFileSync as readFileSync67, statSync as statSync14 } from "fs";
|
|
44696
|
-
import { isAbsolute as isAbsolute7, join as
|
|
44739
|
+
import { isAbsolute as isAbsolute7, join as join102, resolve as resolve29 } from "path";
|
|
44697
44740
|
function resolveGitDir(cwd) {
|
|
44698
|
-
const dotGit =
|
|
44741
|
+
const dotGit = join102(cwd, ".git");
|
|
44699
44742
|
let stat5;
|
|
44700
44743
|
try {
|
|
44701
44744
|
stat5 = statSync14(dotGit);
|
|
@@ -44725,7 +44768,7 @@ function readGitBranch(cwd) {
|
|
|
44725
44768
|
}
|
|
44726
44769
|
let head;
|
|
44727
44770
|
try {
|
|
44728
|
-
head = readFileSync67(
|
|
44771
|
+
head = readFileSync67(join102(gitDir, "HEAD"), "utf8");
|
|
44729
44772
|
} catch {
|
|
44730
44773
|
return null;
|
|
44731
44774
|
}
|
|
@@ -44833,12 +44876,12 @@ async function restartDaemonAfterUpdate() {
|
|
|
44833
44876
|
// src/commands/update.ts
|
|
44834
44877
|
function isGlobalNpmInstall(dir) {
|
|
44835
44878
|
try {
|
|
44836
|
-
const
|
|
44837
|
-
if (
|
|
44879
|
+
const resolved2 = path61.resolve(dir);
|
|
44880
|
+
if (resolved2.split(path61.sep).includes("node_modules")) {
|
|
44838
44881
|
return true;
|
|
44839
44882
|
}
|
|
44840
44883
|
const globalPrefix = execSync55("npm prefix -g", { stdio: "pipe" }).toString().trim();
|
|
44841
|
-
return
|
|
44884
|
+
return resolved2.toLowerCase().startsWith(path61.resolve(globalPrefix).toLowerCase());
|
|
44842
44885
|
} catch {
|
|
44843
44886
|
return false;
|
|
44844
44887
|
}
|
|
@@ -46116,8 +46159,8 @@ function specifiersOf(sourceFile, includeMocks) {
|
|
|
46116
46159
|
// src/commands/refactor/restructure/buildImportGraph/collectSourceFileEdges.ts
|
|
46117
46160
|
function resolveImport(specifier, filePath, options2) {
|
|
46118
46161
|
if (!specifier.startsWith(".")) return null;
|
|
46119
|
-
const
|
|
46120
|
-
const resolvedPath =
|
|
46162
|
+
const resolved2 = ts8.resolveModuleName(specifier, filePath, options2, ts8.sys);
|
|
46163
|
+
const resolvedPath = resolved2.resolvedModule?.resolvedFileName;
|
|
46121
46164
|
if (!resolvedPath || resolvedPath.includes("node_modules")) return null;
|
|
46122
46165
|
return path73.resolve(resolvedPath);
|
|
46123
46166
|
}
|
|
@@ -47901,12 +47944,12 @@ function formatSlicingRequest(hunks) {
|
|
|
47901
47944
|
}
|
|
47902
47945
|
|
|
47903
47946
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
47904
|
-
import { join as
|
|
47947
|
+
import { join as join103 } from "path";
|
|
47905
47948
|
function slug(value) {
|
|
47906
47949
|
return value.replace(/[^\w.-]+/g, "-");
|
|
47907
47950
|
}
|
|
47908
47951
|
function highLevelReviewPath(repo, headRef, headSha) {
|
|
47909
|
-
return
|
|
47952
|
+
return join103(
|
|
47910
47953
|
getStoreDir(),
|
|
47911
47954
|
"high-level-reviews",
|
|
47912
47955
|
slug(repo),
|
|
@@ -48041,10 +48084,10 @@ function resolveHighLevelSlices(raw, hunks) {
|
|
|
48041
48084
|
}
|
|
48042
48085
|
|
|
48043
48086
|
// src/commands/review/highLevel/writeJsonFile.ts
|
|
48044
|
-
import { mkdirSync as
|
|
48087
|
+
import { mkdirSync as mkdirSync36, writeFileSync as writeFileSync49 } from "fs";
|
|
48045
48088
|
import { dirname as dirname47 } from "path";
|
|
48046
48089
|
function writeJsonFile(path128, data) {
|
|
48047
|
-
|
|
48090
|
+
mkdirSync36(dirname47(path128), { recursive: true });
|
|
48048
48091
|
writeFileSync49(path128, `${JSON.stringify(data, null, 2)}
|
|
48049
48092
|
`);
|
|
48050
48093
|
return path128;
|
|
@@ -49068,8 +49111,8 @@ function renderEntry(entry, frame) {
|
|
|
49068
49111
|
import { format } from "util";
|
|
49069
49112
|
|
|
49070
49113
|
// src/commands/review/createReviewLogSink.ts
|
|
49071
|
-
import { appendFileSync as appendFileSync3, mkdirSync as
|
|
49072
|
-
import { join as
|
|
49114
|
+
import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync37 } from "fs";
|
|
49115
|
+
import { join as join104 } from "path";
|
|
49073
49116
|
var LOG_FILE = "review.log";
|
|
49074
49117
|
function createReviewLogSink() {
|
|
49075
49118
|
let logPath2;
|
|
@@ -49085,8 +49128,8 @@ function createReviewLogSink() {
|
|
|
49085
49128
|
`);
|
|
49086
49129
|
},
|
|
49087
49130
|
attach(reviewDir) {
|
|
49088
|
-
|
|
49089
|
-
logPath2 =
|
|
49131
|
+
mkdirSync37(reviewDir, { recursive: true });
|
|
49132
|
+
logPath2 = join104(reviewDir, LOG_FILE);
|
|
49090
49133
|
const lines = [
|
|
49091
49134
|
"",
|
|
49092
49135
|
`=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
|
|
@@ -49872,11 +49915,11 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
49872
49915
|
}
|
|
49873
49916
|
|
|
49874
49917
|
// src/commands/review/buildReviewPaths.ts
|
|
49875
|
-
import { homedir as
|
|
49876
|
-
import { basename as basename27, join as
|
|
49918
|
+
import { homedir as homedir28 } from "os";
|
|
49919
|
+
import { basename as basename27, join as join105 } from "path";
|
|
49877
49920
|
function buildReviewPaths(repoRoot3, key) {
|
|
49878
|
-
const reviewDir =
|
|
49879
|
-
|
|
49921
|
+
const reviewDir = join105(
|
|
49922
|
+
homedir28(),
|
|
49880
49923
|
".assist",
|
|
49881
49924
|
"reviews",
|
|
49882
49925
|
basename27(repoRoot3),
|
|
@@ -49884,10 +49927,10 @@ function buildReviewPaths(repoRoot3, key) {
|
|
|
49884
49927
|
);
|
|
49885
49928
|
return {
|
|
49886
49929
|
reviewDir,
|
|
49887
|
-
requestPath:
|
|
49888
|
-
claudePath:
|
|
49889
|
-
codexPath:
|
|
49890
|
-
synthesisPath:
|
|
49930
|
+
requestPath: join105(reviewDir, "request.md"),
|
|
49931
|
+
claudePath: join105(reviewDir, "claude.md"),
|
|
49932
|
+
codexPath: join105(reviewDir, "codex.md"),
|
|
49933
|
+
synthesisPath: join105(reviewDir, "synthesis.md")
|
|
49891
49934
|
};
|
|
49892
49935
|
}
|
|
49893
49936
|
|
|
@@ -49925,14 +49968,14 @@ function fetchExistingComments() {
|
|
|
49925
49968
|
}
|
|
49926
49969
|
|
|
49927
49970
|
// src/commands/review/prepareReviewDir.ts
|
|
49928
|
-
import { existsSync as existsSync80, mkdirSync as
|
|
49971
|
+
import { existsSync as existsSync80, mkdirSync as mkdirSync38, unlinkSync as unlinkSync19, writeFileSync as writeFileSync50 } from "fs";
|
|
49929
49972
|
function clearReviewFiles(paths) {
|
|
49930
49973
|
for (const path128 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
49931
49974
|
if (existsSync80(path128)) unlinkSync19(path128);
|
|
49932
49975
|
}
|
|
49933
49976
|
}
|
|
49934
49977
|
function prepareReviewDir(paths, requestBody, force) {
|
|
49935
|
-
|
|
49978
|
+
mkdirSync38(paths.reviewDir, { recursive: true });
|
|
49936
49979
|
if (force) clearReviewFiles(paths);
|
|
49937
49980
|
writeFileSync50(paths.requestPath, requestBody);
|
|
49938
49981
|
}
|
|
@@ -50931,14 +50974,14 @@ function indexRules() {
|
|
|
50931
50974
|
import path102 from "path";
|
|
50932
50975
|
import chalk277 from "chalk";
|
|
50933
50976
|
function listRules(target, options2 = {}) {
|
|
50934
|
-
const
|
|
50935
|
-
const rules2 = readScopedRules(
|
|
50977
|
+
const resolved2 = path102.resolve(target ?? process.cwd());
|
|
50978
|
+
const rules2 = readScopedRules(resolved2);
|
|
50936
50979
|
if (rules2.length === 0) {
|
|
50937
|
-
const label = path102.relative(process.cwd(),
|
|
50980
|
+
const label = path102.relative(process.cwd(), resolved2) || ".";
|
|
50938
50981
|
console.log(chalk277.gray(`No rules in scope for ${label}`));
|
|
50939
50982
|
return;
|
|
50940
50983
|
}
|
|
50941
|
-
const base = findRepoRoot(scopeDirectory(
|
|
50984
|
+
const base = findRepoRoot(scopeDirectory(resolved2));
|
|
50942
50985
|
const width2 = Math.max(...rules2.map((rule) => rule.code.length));
|
|
50943
50986
|
let shown;
|
|
50944
50987
|
for (const rule of rules2) {
|
|
@@ -50997,9 +51040,9 @@ function nextRuleCode(root2) {
|
|
|
50997
51040
|
import { existsSync as existsSync82 } from "fs";
|
|
50998
51041
|
import path103 from "path";
|
|
50999
51042
|
function resolveRuleScope(target) {
|
|
51000
|
-
const
|
|
51001
|
-
if (path103.basename(
|
|
51002
|
-
const startDir = scopeDirectory(
|
|
51043
|
+
const resolved2 = path103.resolve(target);
|
|
51044
|
+
if (path103.basename(resolved2) === "CLAUDE.md") return resolved2;
|
|
51045
|
+
const startDir = scopeDirectory(resolved2);
|
|
51003
51046
|
const root2 = findRepoRoot(startDir) ?? startDir;
|
|
51004
51047
|
let current2 = startDir;
|
|
51005
51048
|
while (true) {
|
|
@@ -51534,7 +51577,7 @@ function parseReply(line) {
|
|
|
51534
51577
|
}
|
|
51535
51578
|
|
|
51536
51579
|
// src/commands/show/refuseSessionFiles.ts
|
|
51537
|
-
import { homedir as
|
|
51580
|
+
import { homedir as homedir29 } from "os";
|
|
51538
51581
|
|
|
51539
51582
|
// src/commands/show/findShownSessionFiles.ts
|
|
51540
51583
|
var NOT_AFTER = String.raw`(?![\w\-/]|\.\w)`;
|
|
@@ -51594,7 +51637,7 @@ async function refuseSessionFiles(body) {
|
|
|
51594
51637
|
harness
|
|
51595
51638
|
});
|
|
51596
51639
|
const shown = findShownSessionFiles(body, sessionWrittenPaths(events), {
|
|
51597
|
-
home:
|
|
51640
|
+
home: homedir29(),
|
|
51598
51641
|
cwd: process.cwd()
|
|
51599
51642
|
});
|
|
51600
51643
|
if (shown.length === 0) return;
|
|
@@ -53162,20 +53205,20 @@ async function configure() {
|
|
|
53162
53205
|
|
|
53163
53206
|
// src/commands/transcript/list.ts
|
|
53164
53207
|
import { existsSync as existsSync93, readdirSync as readdirSync25, statSync as statSync17 } from "fs";
|
|
53165
|
-
import { join as
|
|
53208
|
+
import { join as join122 } from "path";
|
|
53166
53209
|
function list5() {
|
|
53167
53210
|
const { vttDir } = getTranscriptConfig();
|
|
53168
53211
|
if (!existsSync93(vttDir)) return;
|
|
53169
53212
|
for (const entry of readdirSync25(vttDir)) {
|
|
53170
53213
|
if (!entry.endsWith(".vtt")) continue;
|
|
53171
|
-
if (statSync17(
|
|
53214
|
+
if (statSync17(join122(vttDir, entry)).isDirectory()) continue;
|
|
53172
53215
|
console.log(entry);
|
|
53173
53216
|
}
|
|
53174
53217
|
}
|
|
53175
53218
|
|
|
53176
53219
|
// src/commands/transcript/move.ts
|
|
53177
|
-
import { existsSync as existsSync94, mkdirSync as
|
|
53178
|
-
import { basename as basename31, join as
|
|
53220
|
+
import { existsSync as existsSync94, mkdirSync as mkdirSync41, renameSync as renameSync5, writeFileSync as writeFileSync56 } from "fs";
|
|
53221
|
+
import { basename as basename31, join as join123 } from "path";
|
|
53179
53222
|
|
|
53180
53223
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
53181
53224
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -53185,9 +53228,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
53185
53228
|
// src/commands/transcript/move.ts
|
|
53186
53229
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
53187
53230
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
53188
|
-
const processedDir =
|
|
53189
|
-
|
|
53190
|
-
renameSync5(sourcePath,
|
|
53231
|
+
const processedDir = join123(vttDir, "processed");
|
|
53232
|
+
mkdirSync41(processedDir, { recursive: true });
|
|
53233
|
+
renameSync5(sourcePath, join123(processedDir, filename));
|
|
53191
53234
|
}
|
|
53192
53235
|
function move(file, options2) {
|
|
53193
53236
|
const { date, client } = options2;
|
|
@@ -53197,19 +53240,19 @@ function move(file, options2) {
|
|
|
53197
53240
|
}
|
|
53198
53241
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
53199
53242
|
const filename = basename31(file);
|
|
53200
|
-
const sourcePath =
|
|
53243
|
+
const sourcePath = join123(vttDir, filename);
|
|
53201
53244
|
if (!existsSync94(sourcePath)) {
|
|
53202
53245
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
53203
53246
|
process.exit(1);
|
|
53204
53247
|
}
|
|
53205
53248
|
const base = basename31(filename, ".vtt").replace(/ Transcription$/, "");
|
|
53206
53249
|
const outputName = `${date} ${base}.md`;
|
|
53207
|
-
const formattedDir =
|
|
53208
|
-
|
|
53209
|
-
const formattedPath =
|
|
53250
|
+
const formattedDir = join123(transcriptsDir, client);
|
|
53251
|
+
mkdirSync41(formattedDir, { recursive: true });
|
|
53252
|
+
const formattedPath = join123(formattedDir, outputName);
|
|
53210
53253
|
writeFileSync56(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
53211
53254
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
53212
|
-
const summaryPath =
|
|
53255
|
+
const summaryPath = join123(summaryDir, client, outputName);
|
|
53213
53256
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
53214
53257
|
console.log(`Summary target: ${summaryPath}`);
|
|
53215
53258
|
}
|
|
@@ -54468,13 +54511,13 @@ function findRunConfig(name2) {
|
|
|
54468
54511
|
// src/commands/run/resolveParams.ts
|
|
54469
54512
|
function resolveParams(params, cliArgs) {
|
|
54470
54513
|
if (!params || params.length === 0) return cliArgs;
|
|
54471
|
-
const
|
|
54514
|
+
const resolved2 = [];
|
|
54472
54515
|
const missing = [];
|
|
54473
54516
|
for (let i = 0; i < params.length; i++) {
|
|
54474
54517
|
const param = params[i];
|
|
54475
54518
|
const value = cliArgs[i] ?? param.default;
|
|
54476
54519
|
if (value !== void 0) {
|
|
54477
|
-
|
|
54520
|
+
resolved2.push(value);
|
|
54478
54521
|
} else if (param.required) {
|
|
54479
54522
|
missing.push(param.name);
|
|
54480
54523
|
}
|
|
@@ -54485,8 +54528,8 @@ function resolveParams(params, cliArgs) {
|
|
|
54485
54528
|
console.error(`Missing required param${s}: ${names}`);
|
|
54486
54529
|
process.exit(1);
|
|
54487
54530
|
}
|
|
54488
|
-
|
|
54489
|
-
return
|
|
54531
|
+
resolved2.push(...cliArgs.slice(params.length));
|
|
54532
|
+
return resolved2;
|
|
54490
54533
|
}
|
|
54491
54534
|
|
|
54492
54535
|
// src/commands/run/resolveRunCwd.ts
|
|
@@ -55141,7 +55184,7 @@ function registerWatch(program) {
|
|
|
55141
55184
|
// src/commands/roam/postRoamActivity.ts
|
|
55142
55185
|
import { execFileSync as execFileSync34 } from "child_process";
|
|
55143
55186
|
import { readdirSync as readdirSync27, readFileSync as readFileSync87, statSync as statSync18 } from "fs";
|
|
55144
|
-
import { join as
|
|
55187
|
+
import { join as join124 } from "path";
|
|
55145
55188
|
function findPortFile(roamDir) {
|
|
55146
55189
|
let entries2;
|
|
55147
55190
|
try {
|
|
@@ -55150,7 +55193,7 @@ function findPortFile(roamDir) {
|
|
|
55150
55193
|
return void 0;
|
|
55151
55194
|
}
|
|
55152
55195
|
const candidates = entries2.filter((name2) => /^roam-local-api(-[^.]+)?\.port$/.test(name2)).map((name2) => {
|
|
55153
|
-
const path128 =
|
|
55196
|
+
const path128 = join124(roamDir, name2);
|
|
55154
55197
|
try {
|
|
55155
55198
|
return { path: path128, mtimeMs: statSync18(path128).mtimeMs };
|
|
55156
55199
|
} catch {
|
|
@@ -55167,7 +55210,7 @@ var PID_BY_APP = {
|
|
|
55167
55210
|
function postRoamActivity(app, event) {
|
|
55168
55211
|
const appData = process.env.APPDATA;
|
|
55169
55212
|
if (!appData) return;
|
|
55170
|
-
const portFile = findPortFile(
|
|
55213
|
+
const portFile = findPortFile(join124(appData, "Roam"));
|
|
55171
55214
|
if (!portFile) return;
|
|
55172
55215
|
let port;
|
|
55173
55216
|
try {
|
|
@@ -55261,10 +55304,10 @@ function listRunConfigs(verbose) {
|
|
|
55261
55304
|
function execRunConfig(config, args) {
|
|
55262
55305
|
const cwd = resolveRunCwd(config);
|
|
55263
55306
|
if (config.pre) runPreCommands(config.pre, cwd);
|
|
55264
|
-
const
|
|
55307
|
+
const resolved2 = resolveParams(config.params, args);
|
|
55265
55308
|
spawnRunCommand(
|
|
55266
55309
|
config.command,
|
|
55267
|
-
[...config.args ?? [], ...
|
|
55310
|
+
[...config.args ?? [], ...resolved2],
|
|
55268
55311
|
config.env,
|
|
55269
55312
|
cwd,
|
|
55270
55313
|
config.quiet
|
|
@@ -55350,7 +55393,7 @@ function link2() {
|
|
|
55350
55393
|
}
|
|
55351
55394
|
|
|
55352
55395
|
// src/commands/run/add.ts
|
|
55353
|
-
import { mkdirSync as
|
|
55396
|
+
import { mkdirSync as mkdirSync42, writeFileSync as writeFileSync61 } from "fs";
|
|
55354
55397
|
import { dirname as dirname51 } from "path";
|
|
55355
55398
|
|
|
55356
55399
|
// src/commands/run/editRepoRunList.ts
|
|
@@ -55526,11 +55569,11 @@ function requireParsedArgs() {
|
|
|
55526
55569
|
}
|
|
55527
55570
|
|
|
55528
55571
|
// src/commands/run/runCommandFilePath.ts
|
|
55529
|
-
import { join as
|
|
55572
|
+
import { join as join125 } from "path";
|
|
55530
55573
|
function runCommandFilePath(name2) {
|
|
55531
55574
|
const segments = name2.split(":");
|
|
55532
55575
|
const file = `${segments.pop()}.md`;
|
|
55533
|
-
return
|
|
55576
|
+
return join125(".claude", "commands", ...segments, file);
|
|
55534
55577
|
}
|
|
55535
55578
|
|
|
55536
55579
|
// src/commands/run/add.ts
|
|
@@ -55547,7 +55590,7 @@ function saveProjectRunConfig(entry) {
|
|
|
55547
55590
|
}
|
|
55548
55591
|
function createCommandFile(name2) {
|
|
55549
55592
|
const filePath = runCommandFilePath(name2);
|
|
55550
|
-
|
|
55593
|
+
mkdirSync42(dirname51(filePath), { recursive: true });
|
|
55551
55594
|
const content = `---
|
|
55552
55595
|
description: Run ${name2}
|
|
55553
55596
|
---
|
|
@@ -55675,7 +55718,7 @@ function registerRunAdd(runCommand) {
|
|
|
55675
55718
|
|
|
55676
55719
|
// src/commands/run/remove.ts
|
|
55677
55720
|
import { existsSync as existsSync100, readdirSync as readdirSync28, rmdirSync, unlinkSync as unlinkSync20 } from "fs";
|
|
55678
|
-
import { dirname as dirname52, join as
|
|
55721
|
+
import { dirname as dirname52, join as join126 } from "path";
|
|
55679
55722
|
|
|
55680
55723
|
// src/commands/run/removeRepoRunConfig.ts
|
|
55681
55724
|
function isNamed(entry, name2) {
|
|
@@ -55693,7 +55736,7 @@ function removeRepoRunConfig(name2, repoName, cwd = process.cwd()) {
|
|
|
55693
55736
|
|
|
55694
55737
|
// src/commands/run/remove.ts
|
|
55695
55738
|
function removeEmptyNamespaceDirs(filePath) {
|
|
55696
|
-
const root2 =
|
|
55739
|
+
const root2 = join126(".claude", "commands");
|
|
55697
55740
|
for (let dir = dirname52(filePath); dir !== root2; dir = dirname52(dir)) {
|
|
55698
55741
|
if (!existsSync100(dir) || readdirSync28(dir).length > 0) return;
|
|
55699
55742
|
rmdirSync(dir);
|
|
@@ -55701,7 +55744,7 @@ function removeEmptyNamespaceDirs(filePath) {
|
|
|
55701
55744
|
}
|
|
55702
55745
|
function deleteCommandFile(name2) {
|
|
55703
55746
|
const filePath = runCommandFilePath(name2);
|
|
55704
|
-
const legacyPath =
|
|
55747
|
+
const legacyPath = join126(".claude", "commands", `${name2}.md`);
|
|
55705
55748
|
for (const path128 of /* @__PURE__ */ new Set([filePath, legacyPath])) {
|
|
55706
55749
|
if (existsSync100(path128)) {
|
|
55707
55750
|
unlinkSync20(path128);
|
|
@@ -55985,7 +56028,7 @@ function requestDrain(socket, lines) {
|
|
|
55985
56028
|
}
|
|
55986
56029
|
|
|
55987
56030
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
55988
|
-
import { mkdirSync as
|
|
56031
|
+
import { mkdirSync as mkdirSync46 } from "fs";
|
|
55989
56032
|
|
|
55990
56033
|
// src/commands/sessions/daemon/broadcast.ts
|
|
55991
56034
|
function sendTo(client, msg) {
|
|
@@ -56552,7 +56595,7 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
|
|
|
56552
56595
|
|
|
56553
56596
|
// src/commands/sessions/daemon/findServerParents.ts
|
|
56554
56597
|
import { existsSync as existsSync102 } from "fs";
|
|
56555
|
-
import { join as
|
|
56598
|
+
import { join as join127, resolve as resolve33 } from "path";
|
|
56556
56599
|
function isLive(session) {
|
|
56557
56600
|
return !!session.pty && session.status !== "done" && session.status !== "error";
|
|
56558
56601
|
}
|
|
@@ -56561,7 +56604,7 @@ function isLiveAgent(session) {
|
|
|
56561
56604
|
}
|
|
56562
56605
|
function serverRunDirs(sessions, file) {
|
|
56563
56606
|
return new Set(
|
|
56564
|
-
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve33(s.cwd)).filter((dir) => existsSync102(
|
|
56607
|
+
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve33(s.cwd)).filter((dir) => existsSync102(join127(dir, file)))
|
|
56565
56608
|
);
|
|
56566
56609
|
}
|
|
56567
56610
|
function findServerParents(sessions, file) {
|
|
@@ -57410,12 +57453,12 @@ function trimWatcherLog(cwd) {
|
|
|
57410
57453
|
}
|
|
57411
57454
|
|
|
57412
57455
|
// src/commands/sessions/daemon/worktree/appendWatcherLog.ts
|
|
57413
|
-
import { appendFileSync as appendFileSync4, mkdirSync as
|
|
57456
|
+
import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync43 } from "fs";
|
|
57414
57457
|
import { dirname as dirname53 } from "path";
|
|
57415
57458
|
function appendWatcherLog(cwd, data) {
|
|
57416
57459
|
try {
|
|
57417
57460
|
const path128 = watcherLogPath(cwd);
|
|
57418
|
-
|
|
57461
|
+
mkdirSync43(dirname53(path128), { recursive: true });
|
|
57419
57462
|
appendFileSync4(path128, data);
|
|
57420
57463
|
} catch {
|
|
57421
57464
|
}
|
|
@@ -57590,9 +57633,9 @@ import { existsSync as existsSync105 } from "fs";
|
|
|
57590
57633
|
|
|
57591
57634
|
// src/commands/sessions/daemon/worktree/holdsNoCheckout.ts
|
|
57592
57635
|
import { existsSync as existsSync104 } from "fs";
|
|
57593
|
-
import { join as
|
|
57636
|
+
import { join as join129 } from "path";
|
|
57594
57637
|
function holdsNoCheckout(path128) {
|
|
57595
|
-
return existsSync104(path128) && !existsSync104(
|
|
57638
|
+
return existsSync104(path128) && !existsSync104(join129(path128, ".git"));
|
|
57596
57639
|
}
|
|
57597
57640
|
|
|
57598
57641
|
// src/commands/sessions/daemon/worktree/treeDurability.ts
|
|
@@ -57935,12 +57978,12 @@ import { basename as basename34 } from "path";
|
|
|
57935
57978
|
|
|
57936
57979
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
57937
57980
|
import { existsSync as existsSync106 } from "fs";
|
|
57938
|
-
import { join as
|
|
57981
|
+
import { join as join131 } from "path";
|
|
57939
57982
|
|
|
57940
57983
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
57941
57984
|
import { statSync as statSync19 } from "fs";
|
|
57942
57985
|
import { rm as rm3 } from "fs/promises";
|
|
57943
|
-
import { join as
|
|
57986
|
+
import { join as join130 } from "path";
|
|
57944
57987
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
57945
57988
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
57946
57989
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -57969,7 +58012,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
57969
58012
|
return { removed: true };
|
|
57970
58013
|
}
|
|
57971
58014
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
57972
|
-
return statSync19(
|
|
58015
|
+
return statSync19(join130(worktreePath, ".git"), {
|
|
57973
58016
|
throwIfNoEntry: false
|
|
57974
58017
|
})?.isDirectory() === true;
|
|
57975
58018
|
}
|
|
@@ -58010,7 +58053,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
58010
58053
|
);
|
|
58011
58054
|
}
|
|
58012
58055
|
function strandedReason(worktreePath, cause) {
|
|
58013
|
-
if (!existsSync106(
|
|
58056
|
+
if (!existsSync106(join131(worktreePath, ".git")))
|
|
58014
58057
|
return "its .git link is already gone";
|
|
58015
58058
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
58016
58059
|
return "git no longer recognises it as a working tree";
|
|
@@ -59254,7 +59297,7 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
|
|
|
59254
59297
|
}
|
|
59255
59298
|
|
|
59256
59299
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
59257
|
-
import { existsSync as existsSync110, mkdirSync as
|
|
59300
|
+
import { existsSync as existsSync110, mkdirSync as mkdirSync44, watch as watch2 } from "fs";
|
|
59258
59301
|
import { dirname as dirname55 } from "path";
|
|
59259
59302
|
|
|
59260
59303
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
@@ -59441,7 +59484,7 @@ function watchActivity(session, notify2, onConversation) {
|
|
|
59441
59484
|
const path128 = activityPath(session.id);
|
|
59442
59485
|
const dir = dirname55(path128);
|
|
59443
59486
|
try {
|
|
59444
|
-
|
|
59487
|
+
mkdirSync44(dir, { recursive: true });
|
|
59445
59488
|
} catch {
|
|
59446
59489
|
return;
|
|
59447
59490
|
}
|
|
@@ -59579,10 +59622,10 @@ function reportSilentFailure(session, clients) {
|
|
|
59579
59622
|
import { watch as watch3 } from "fs";
|
|
59580
59623
|
|
|
59581
59624
|
// src/commands/sessions/daemon/ensureProjectDirExists.ts
|
|
59582
|
-
import { mkdirSync as
|
|
59625
|
+
import { mkdirSync as mkdirSync45 } from "fs";
|
|
59583
59626
|
function ensureProjectDirExists(dir, sessionId2) {
|
|
59584
59627
|
try {
|
|
59585
|
-
|
|
59628
|
+
mkdirSync45(dir, { recursive: true });
|
|
59586
59629
|
return true;
|
|
59587
59630
|
} catch (error) {
|
|
59588
59631
|
daemonLog(
|
|
@@ -61631,7 +61674,7 @@ import { existsSync as existsSync112 } from "fs";
|
|
|
61631
61674
|
|
|
61632
61675
|
// src/commands/sessions/daemon/worktree/leftoverContents.ts
|
|
61633
61676
|
import { lstatSync, readdirSync as readdirSync30 } from "fs";
|
|
61634
|
-
import { join as
|
|
61677
|
+
import { join as join132 } from "path";
|
|
61635
61678
|
function leftoverContents(path128) {
|
|
61636
61679
|
const contents = { holdsFiles: false, foreignOwned: false };
|
|
61637
61680
|
walk2(path128, contents, process.getuid?.());
|
|
@@ -61653,7 +61696,7 @@ function walk2(path128, contents, uid) {
|
|
|
61653
61696
|
contents.holdsFiles = true;
|
|
61654
61697
|
return;
|
|
61655
61698
|
}
|
|
61656
|
-
for (const entry of entries2) walk2(
|
|
61699
|
+
for (const entry of entries2) walk2(join132(path128, entry), contents, uid);
|
|
61657
61700
|
}
|
|
61658
61701
|
|
|
61659
61702
|
// src/commands/sessions/daemon/worktree/recheckReapedWorktrees.ts
|
|
@@ -61691,7 +61734,7 @@ function reviewFirst(path128, contents) {
|
|
|
61691
61734
|
}
|
|
61692
61735
|
|
|
61693
61736
|
// src/commands/sessions/daemon/worktree/reportLeftovers.ts
|
|
61694
|
-
import { homedir as
|
|
61737
|
+
import { homedir as homedir32 } from "os";
|
|
61695
61738
|
|
|
61696
61739
|
// src/commands/sessions/daemon/worktree/noticeContent.ts
|
|
61697
61740
|
function noticeContent(leftovers) {
|
|
@@ -61754,7 +61797,7 @@ function reportLeftovers(sessions, spawnNotice, leftovers, notify2) {
|
|
|
61754
61797
|
...content,
|
|
61755
61798
|
commandType: "assist",
|
|
61756
61799
|
pty: null,
|
|
61757
|
-
cwd:
|
|
61800
|
+
cwd: homedir32(),
|
|
61758
61801
|
leftoverNotice: true
|
|
61759
61802
|
}));
|
|
61760
61803
|
daemonLog(`leftover notice ${id} created: ${leftovers.length} leftover(s)`);
|
|
@@ -63715,7 +63758,7 @@ function creator(isNew, spawn15) {
|
|
|
63715
63758
|
}
|
|
63716
63759
|
if (result instanceof Promise)
|
|
63717
63760
|
result.then(
|
|
63718
|
-
(
|
|
63761
|
+
(resolved2) => reply2(client, d, resolved2),
|
|
63719
63762
|
(error) => fail14(client, d, error)
|
|
63720
63763
|
);
|
|
63721
63764
|
else reply2(client, d, result);
|
|
@@ -64889,7 +64932,7 @@ async function recoverFromAddrInUse(server, manager, checkAutoExit) {
|
|
|
64889
64932
|
|
|
64890
64933
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
64891
64934
|
async function runDaemon() {
|
|
64892
|
-
|
|
64935
|
+
mkdirSync46(daemonPaths.dir, { recursive: true });
|
|
64893
64936
|
daemonLog(
|
|
64894
64937
|
`starting (reason: ${process.env.ASSIST_DAEMON_SPAWN_REASON ?? "manual"})`
|
|
64895
64938
|
);
|