@staff0rd/assist 0.261.0 → 0.263.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/index.js +586 -429
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.263.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -204,6 +204,10 @@ var assistConfigSchema = z2.strictObject({
|
|
|
204
204
|
hardcodedColors: z2.strictObject({
|
|
205
205
|
ignore: z2.array(z2.string()).default([])
|
|
206
206
|
}).optional(),
|
|
207
|
+
commentPolicy: z2.strictObject({
|
|
208
|
+
ignore: z2.array(z2.string()).default([]),
|
|
209
|
+
markers: z2.array(z2.string()).default(["HACK:", "why:"])
|
|
210
|
+
}).optional(),
|
|
207
211
|
restructure: z2.strictObject({
|
|
208
212
|
ignore: z2.array(z2.string()).default([])
|
|
209
213
|
}).optional(),
|
|
@@ -1815,24 +1819,166 @@ function lint(options2 = {}) {
|
|
|
1815
1819
|
}
|
|
1816
1820
|
|
|
1817
1821
|
// src/commands/new/registerNew/newCli/index.ts
|
|
1818
|
-
import { execSync as
|
|
1822
|
+
import { execSync as execSync12 } from "child_process";
|
|
1819
1823
|
import { basename, resolve as resolve5 } from "path";
|
|
1820
1824
|
|
|
1821
|
-
// src/commands/verify/
|
|
1825
|
+
// src/commands/verify/commentPolicy/findAddedComments.ts
|
|
1822
1826
|
import { execSync as execSync6 } from "child_process";
|
|
1827
|
+
import fs10 from "fs";
|
|
1823
1828
|
import { minimatch } from "minimatch";
|
|
1829
|
+
import { Project as Project2 } from "ts-morph";
|
|
1830
|
+
|
|
1831
|
+
// src/commands/verify/commentPolicy/collectComments.ts
|
|
1832
|
+
function collectComments(sourceFile) {
|
|
1833
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1834
|
+
const comments3 = [];
|
|
1835
|
+
const collect3 = (node) => {
|
|
1836
|
+
for (const range of [
|
|
1837
|
+
...node.getLeadingCommentRanges(),
|
|
1838
|
+
...node.getTrailingCommentRanges()
|
|
1839
|
+
]) {
|
|
1840
|
+
const pos = range.getPos();
|
|
1841
|
+
if (seen.has(pos)) continue;
|
|
1842
|
+
seen.add(pos);
|
|
1843
|
+
comments3.push({ pos, text: range.getText() });
|
|
1844
|
+
}
|
|
1845
|
+
};
|
|
1846
|
+
collect3(sourceFile);
|
|
1847
|
+
sourceFile.forEachDescendant(collect3);
|
|
1848
|
+
return comments3;
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
// src/commands/verify/commentPolicy/isCommentExempt.ts
|
|
1852
|
+
var MACHINE_DIRECTIVES = [
|
|
1853
|
+
"biome-ignore",
|
|
1854
|
+
"@ts-expect-error",
|
|
1855
|
+
"@ts-ignore",
|
|
1856
|
+
"@ts-nocheck",
|
|
1857
|
+
"eslint-disable",
|
|
1858
|
+
"eslint-enable",
|
|
1859
|
+
"prettier-ignore",
|
|
1860
|
+
"istanbul ignore",
|
|
1861
|
+
"v8 ignore",
|
|
1862
|
+
"c8 ignore"
|
|
1863
|
+
];
|
|
1864
|
+
function isCommentExempt(text2, markers) {
|
|
1865
|
+
const lower = text2.toLowerCase();
|
|
1866
|
+
if (MACHINE_DIRECTIVES.some((d) => lower.includes(d))) return true;
|
|
1867
|
+
return markers.some((m) => lower.includes(m.toLowerCase()));
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1870
|
+
// src/commands/verify/commentPolicy/parseDiffAddedLines.ts
|
|
1871
|
+
var FILE_HEADER = /^\+\+\+ (?:b\/)?(.+)$/;
|
|
1872
|
+
var HUNK_HEADER = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/;
|
|
1873
|
+
function parseDiffAddedLines(diff2) {
|
|
1874
|
+
const added = /* @__PURE__ */ new Map();
|
|
1875
|
+
let currentFile = null;
|
|
1876
|
+
let newLine = 0;
|
|
1877
|
+
for (const line of diff2.split("\n")) {
|
|
1878
|
+
const fileMatch = line.match(FILE_HEADER);
|
|
1879
|
+
if (fileMatch) {
|
|
1880
|
+
const file = fileMatch[1];
|
|
1881
|
+
currentFile = file === "/dev/null" ? null : file;
|
|
1882
|
+
continue;
|
|
1883
|
+
}
|
|
1884
|
+
const hunkMatch = line.match(HUNK_HEADER);
|
|
1885
|
+
if (hunkMatch) {
|
|
1886
|
+
newLine = Number(hunkMatch[1]);
|
|
1887
|
+
continue;
|
|
1888
|
+
}
|
|
1889
|
+
if (currentFile === null) continue;
|
|
1890
|
+
if (line.startsWith("+")) {
|
|
1891
|
+
let set = added.get(currentFile);
|
|
1892
|
+
if (!set) {
|
|
1893
|
+
set = /* @__PURE__ */ new Set();
|
|
1894
|
+
added.set(currentFile, set);
|
|
1895
|
+
}
|
|
1896
|
+
set.add(newLine);
|
|
1897
|
+
newLine++;
|
|
1898
|
+
} else if (line.startsWith("-")) {
|
|
1899
|
+
} else {
|
|
1900
|
+
newLine++;
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
return added;
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
// src/commands/verify/commentPolicy/findAddedComments.ts
|
|
1907
|
+
var SOURCE_EXTENSIONS = [".ts", ".tsx", ".cts", ".mts", ".js", ".jsx"];
|
|
1908
|
+
function toSingleLine(text2) {
|
|
1909
|
+
return text2.replace(/\s+/g, " ").trim();
|
|
1910
|
+
}
|
|
1911
|
+
function shouldScan(file, ignoreGlobs) {
|
|
1912
|
+
if (!SOURCE_EXTENSIONS.some((ext) => file.endsWith(ext))) return false;
|
|
1913
|
+
if (ignoreGlobs.some((glob) => minimatch(file, glob))) return false;
|
|
1914
|
+
return fs10.existsSync(file);
|
|
1915
|
+
}
|
|
1916
|
+
function findAddedComments(options2) {
|
|
1917
|
+
const diff2 = execSync6("git diff HEAD", {
|
|
1918
|
+
encoding: "utf-8",
|
|
1919
|
+
maxBuffer: 64 * 1024 * 1024
|
|
1920
|
+
});
|
|
1921
|
+
const addedLines = parseDiffAddedLines(diff2);
|
|
1922
|
+
const project = new Project2({
|
|
1923
|
+
skipAddingFilesFromTsConfig: true,
|
|
1924
|
+
compilerOptions: { allowJs: true }
|
|
1925
|
+
});
|
|
1926
|
+
const findings = [];
|
|
1927
|
+
for (const [file, lines] of addedLines) {
|
|
1928
|
+
if (!shouldScan(file, options2.ignoreGlobs)) continue;
|
|
1929
|
+
const sourceFile = project.addSourceFileAtPath(file);
|
|
1930
|
+
for (const { pos, text: text2 } of collectComments(sourceFile)) {
|
|
1931
|
+
const { line } = sourceFile.getLineAndColumnAtPos(pos);
|
|
1932
|
+
if (!lines.has(line)) continue;
|
|
1933
|
+
if (isCommentExempt(text2, options2.markers)) continue;
|
|
1934
|
+
findings.push({ file, line, text: toSingleLine(text2) });
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
findings.sort((a, b) => a.file.localeCompare(b.file) || a.line - b.line);
|
|
1938
|
+
return findings;
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1941
|
+
// src/commands/verify/commentPolicy/index.ts
|
|
1942
|
+
var DEFAULT_MARKERS = ["HACK:", "why:"];
|
|
1943
|
+
function commentPolicy() {
|
|
1944
|
+
const config = loadConfig().commentPolicy;
|
|
1945
|
+
const markers = config?.markers ?? DEFAULT_MARKERS;
|
|
1946
|
+
const ignoreGlobs = config?.ignore ?? [];
|
|
1947
|
+
const findings = findAddedComments({ markers, ignoreGlobs });
|
|
1948
|
+
if (findings.length === 0) {
|
|
1949
|
+
console.log("No undocumented comments on changed lines.");
|
|
1950
|
+
process.exit(0);
|
|
1951
|
+
}
|
|
1952
|
+
console.log("Comments added on changed lines:\n");
|
|
1953
|
+
for (const { file, line, text: text2 } of findings) {
|
|
1954
|
+
console.log(`${file}:${line} \u2192 ${text2}`);
|
|
1955
|
+
}
|
|
1956
|
+
console.log(`
|
|
1957
|
+
Total: ${findings.length} comment(s)`);
|
|
1958
|
+
console.log(
|
|
1959
|
+
"\nDon't comment standard logic or syntax \u2014 only unintuitive complexity or a hack."
|
|
1960
|
+
);
|
|
1961
|
+
console.log(
|
|
1962
|
+
`Remove each comment, or justify it inline with a ${markers.map((m) => `'${m}'`).join(" or ")} marker.`
|
|
1963
|
+
);
|
|
1964
|
+
process.exit(1);
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
// src/commands/verify/hardcodedColors.ts
|
|
1968
|
+
import { execSync as execSync7 } from "child_process";
|
|
1969
|
+
import { minimatch as minimatch2 } from "minimatch";
|
|
1824
1970
|
var pattern = "0x[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,6}";
|
|
1825
1971
|
function hardcodedColors() {
|
|
1826
1972
|
const ignoreGlobs = loadConfig().hardcodedColors?.ignore ?? [];
|
|
1827
1973
|
try {
|
|
1828
|
-
const output =
|
|
1974
|
+
const output = execSync7(`grep -rEnH '${pattern}' src/`, {
|
|
1829
1975
|
encoding: "utf-8"
|
|
1830
1976
|
});
|
|
1831
1977
|
const lines = output.trim().split("\n").filter((line) => {
|
|
1832
1978
|
const match = line.match(/^(.+?):\d+:/);
|
|
1833
1979
|
if (!match) return true;
|
|
1834
1980
|
const file = match[1];
|
|
1835
|
-
return !ignoreGlobs.some((glob) =>
|
|
1981
|
+
return !ignoreGlobs.some((glob) => minimatch2(file, glob));
|
|
1836
1982
|
});
|
|
1837
1983
|
if (lines.length === 0) {
|
|
1838
1984
|
console.log("No hardcoded colors found.");
|
|
@@ -2001,10 +2147,10 @@ function list() {
|
|
|
2001
2147
|
}
|
|
2002
2148
|
|
|
2003
2149
|
// src/commands/verify/noVenv.ts
|
|
2004
|
-
import { execSync as
|
|
2150
|
+
import { execSync as execSync8 } from "child_process";
|
|
2005
2151
|
function noVenv() {
|
|
2006
2152
|
try {
|
|
2007
|
-
const output =
|
|
2153
|
+
const output = execSync8(
|
|
2008
2154
|
"find . -type d -name venv -not -path '*/node_modules/*'",
|
|
2009
2155
|
{
|
|
2010
2156
|
encoding: "utf-8"
|
|
@@ -2033,12 +2179,12 @@ Total: ${folders.length} venv folder(s)`);
|
|
|
2033
2179
|
}
|
|
2034
2180
|
|
|
2035
2181
|
// src/commands/verify/run/filterByChangedFiles.ts
|
|
2036
|
-
import { minimatch as
|
|
2182
|
+
import { minimatch as minimatch3 } from "minimatch";
|
|
2037
2183
|
|
|
2038
2184
|
// src/commands/verify/run/getChangedFiles.ts
|
|
2039
|
-
import { execSync as
|
|
2185
|
+
import { execSync as execSync9 } from "child_process";
|
|
2040
2186
|
function getChangedFiles() {
|
|
2041
|
-
const output =
|
|
2187
|
+
const output = execSync9("git diff --name-only HEAD", {
|
|
2042
2188
|
encoding: "utf-8"
|
|
2043
2189
|
}).trim();
|
|
2044
2190
|
if (output === "") return [];
|
|
@@ -2054,7 +2200,7 @@ function filterByChangedFiles(entries) {
|
|
|
2054
2200
|
const { filter } = entry;
|
|
2055
2201
|
if (!filter) return true;
|
|
2056
2202
|
if (changedFiles.length === 0) return false;
|
|
2057
|
-
return changedFiles.some((file) =>
|
|
2203
|
+
return changedFiles.some((file) => minimatch3(file, filter));
|
|
2058
2204
|
});
|
|
2059
2205
|
}
|
|
2060
2206
|
|
|
@@ -2209,25 +2355,25 @@ async function run(options2 = {}) {
|
|
|
2209
2355
|
}
|
|
2210
2356
|
|
|
2211
2357
|
// src/commands/new/registerNew/initGit.ts
|
|
2212
|
-
import { execSync as
|
|
2358
|
+
import { execSync as execSync10 } from "child_process";
|
|
2213
2359
|
import { writeFileSync as writeFileSync7 } from "fs";
|
|
2214
2360
|
function initGit() {
|
|
2215
2361
|
console.log("Initializing git repository...");
|
|
2216
|
-
|
|
2362
|
+
execSync10("git init", { stdio: "inherit" });
|
|
2217
2363
|
writeFileSync7(".gitignore", "dist\nnode_modules\n");
|
|
2218
2364
|
}
|
|
2219
2365
|
|
|
2220
2366
|
// src/commands/new/registerNew/newCli/initPackageJson.ts
|
|
2221
|
-
import { execSync as
|
|
2367
|
+
import { execSync as execSync11 } from "child_process";
|
|
2222
2368
|
function initPackageJson(name) {
|
|
2223
2369
|
console.log("Initializing package.json...");
|
|
2224
|
-
|
|
2370
|
+
execSync11("npm init -y", { stdio: "inherit" });
|
|
2225
2371
|
console.log("Configuring package.json...");
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2372
|
+
execSync11("npm pkg delete main", { stdio: "inherit" });
|
|
2373
|
+
execSync11("npm pkg set type=module", { stdio: "inherit" });
|
|
2374
|
+
execSync11(`npm pkg set bin.${name}=./dist/index.js`, { stdio: "inherit" });
|
|
2375
|
+
execSync11("npm pkg set scripts.build=tsup", { stdio: "inherit" });
|
|
2376
|
+
execSync11('npm pkg set scripts.start="node dist/index.js"', {
|
|
2231
2377
|
stdio: "inherit"
|
|
2232
2378
|
});
|
|
2233
2379
|
}
|
|
@@ -2292,8 +2438,8 @@ async function newCli() {
|
|
|
2292
2438
|
initGit();
|
|
2293
2439
|
initPackageJson(name);
|
|
2294
2440
|
console.log("Installing dependencies...");
|
|
2295
|
-
|
|
2296
|
-
|
|
2441
|
+
execSync12("npm install commander", { stdio: "inherit" });
|
|
2442
|
+
execSync12("npm install -D tsup typescript @types/node", {
|
|
2297
2443
|
stdio: "inherit"
|
|
2298
2444
|
});
|
|
2299
2445
|
writeCliTemplate(name);
|
|
@@ -2302,11 +2448,11 @@ async function newCli() {
|
|
|
2302
2448
|
}
|
|
2303
2449
|
|
|
2304
2450
|
// src/commands/new/registerNew/newProject.ts
|
|
2305
|
-
import { execSync as
|
|
2451
|
+
import { execSync as execSync14 } from "child_process";
|
|
2306
2452
|
import { existsSync as existsSync12, readFileSync as readFileSync8, writeFileSync as writeFileSync10 } from "fs";
|
|
2307
2453
|
|
|
2308
2454
|
// src/commands/deploy/init/index.ts
|
|
2309
|
-
import { execSync as
|
|
2455
|
+
import { execSync as execSync13 } from "child_process";
|
|
2310
2456
|
import chalk24 from "chalk";
|
|
2311
2457
|
import enquirer3 from "enquirer";
|
|
2312
2458
|
|
|
@@ -2359,7 +2505,7 @@ Created ${WORKFLOW_PATH}`));
|
|
|
2359
2505
|
// src/commands/deploy/init/index.ts
|
|
2360
2506
|
async function ensureNetlifyCli() {
|
|
2361
2507
|
try {
|
|
2362
|
-
|
|
2508
|
+
execSync13("netlify sites:create --disable-linking", { stdio: "inherit" });
|
|
2363
2509
|
} catch (error) {
|
|
2364
2510
|
if (!(error instanceof Error) || !error.message.includes("command not found"))
|
|
2365
2511
|
throw error;
|
|
@@ -2374,9 +2520,9 @@ async function ensureNetlifyCli() {
|
|
|
2374
2520
|
process.exit(1);
|
|
2375
2521
|
}
|
|
2376
2522
|
console.log(chalk24.dim("\nInstalling netlify-cli...\n"));
|
|
2377
|
-
|
|
2523
|
+
execSync13("npm install -g netlify-cli", { stdio: "inherit" });
|
|
2378
2524
|
console.log();
|
|
2379
|
-
|
|
2525
|
+
execSync13("netlify sites:create --disable-linking", { stdio: "inherit" });
|
|
2380
2526
|
}
|
|
2381
2527
|
}
|
|
2382
2528
|
function printSetupInstructions() {
|
|
@@ -2419,7 +2565,7 @@ async function init5() {
|
|
|
2419
2565
|
// src/commands/new/registerNew/newProject.ts
|
|
2420
2566
|
async function newProject() {
|
|
2421
2567
|
console.log("Initializing Vite with react-ts template...");
|
|
2422
|
-
|
|
2568
|
+
execSync14("npm create vite@latest . -- --template react-ts", {
|
|
2423
2569
|
stdio: "inherit"
|
|
2424
2570
|
});
|
|
2425
2571
|
initGit();
|
|
@@ -2493,7 +2639,7 @@ function detectPlatform() {
|
|
|
2493
2639
|
|
|
2494
2640
|
// src/commands/notify/showNotification/showWindowsNotificationFromWsl.ts
|
|
2495
2641
|
import { spawn as spawn2 } from "child_process";
|
|
2496
|
-
import
|
|
2642
|
+
import fs11 from "fs";
|
|
2497
2643
|
import { createRequire } from "module";
|
|
2498
2644
|
import path17 from "path";
|
|
2499
2645
|
var require2 = createRequire(import.meta.url);
|
|
@@ -2505,7 +2651,7 @@ function showWindowsNotificationFromWsl(options2) {
|
|
|
2505
2651
|
const { title, message, sound } = options2;
|
|
2506
2652
|
const snoreToastPath = getSnoreToastPath();
|
|
2507
2653
|
try {
|
|
2508
|
-
|
|
2654
|
+
fs11.chmodSync(snoreToastPath, 493);
|
|
2509
2655
|
} catch {
|
|
2510
2656
|
}
|
|
2511
2657
|
const args = ["-t", title, "-m", message];
|
|
@@ -2611,11 +2757,11 @@ function activityChart(data, range) {
|
|
|
2611
2757
|
}
|
|
2612
2758
|
|
|
2613
2759
|
// src/commands/activity/fetchCommitsPerDay.ts
|
|
2614
|
-
import { execSync as
|
|
2760
|
+
import { execSync as execSync15 } from "child_process";
|
|
2615
2761
|
function fetchContributions(from, to) {
|
|
2616
2762
|
const query = `{ viewer { contributionsCollection(from: "${from}T00:00:00Z", to: "${to}T23:59:59Z") { contributionCalendar { weeks { contributionDays { date contributionCount } } } } } }`;
|
|
2617
2763
|
const jq = ".data.viewer.contributionsCollection.contributionCalendar.weeks[].contributionDays[]";
|
|
2618
|
-
const raw =
|
|
2764
|
+
const raw = execSync15(`gh api graphql -f query='${query}' --jq '${jq}'`, {
|
|
2619
2765
|
encoding: "utf-8"
|
|
2620
2766
|
}).trim();
|
|
2621
2767
|
if (!raw) return [];
|
|
@@ -2681,13 +2827,13 @@ import chalk36 from "chalk";
|
|
|
2681
2827
|
import enquirer5 from "enquirer";
|
|
2682
2828
|
|
|
2683
2829
|
// src/shared/pullIfConfigured.ts
|
|
2684
|
-
import { execSync as
|
|
2830
|
+
import { execSync as execSync16 } from "child_process";
|
|
2685
2831
|
import chalk25 from "chalk";
|
|
2686
2832
|
function pullIfConfigured() {
|
|
2687
2833
|
const config = loadConfig();
|
|
2688
2834
|
if (!config.commit?.pull) return;
|
|
2689
2835
|
try {
|
|
2690
|
-
|
|
2836
|
+
execSync16("git pull --ff-only", { stdio: "inherit" });
|
|
2691
2837
|
} catch {
|
|
2692
2838
|
console.error(chalk25.red("git pull --ff-only failed; aborting."));
|
|
2693
2839
|
process.exit(1);
|
|
@@ -2721,11 +2867,153 @@ function blockedByHandover(cwd = process.cwd()) {
|
|
|
2721
2867
|
}
|
|
2722
2868
|
|
|
2723
2869
|
// src/commands/backlog/acquireLock.ts
|
|
2724
|
-
import {
|
|
2725
|
-
|
|
2870
|
+
import {
|
|
2871
|
+
existsSync as existsSync14,
|
|
2872
|
+
mkdirSync as mkdirSync4,
|
|
2873
|
+
readFileSync as readFileSync9,
|
|
2874
|
+
unlinkSync as unlinkSync2,
|
|
2875
|
+
writeFileSync as writeFileSync11
|
|
2876
|
+
} from "fs";
|
|
2877
|
+
import { homedir as homedir3 } from "os";
|
|
2878
|
+
import { join as join10 } from "path";
|
|
2879
|
+
function getLocksDir() {
|
|
2880
|
+
return join10(homedir3(), ".assist", "locks");
|
|
2881
|
+
}
|
|
2882
|
+
function getLockPath(itemId) {
|
|
2883
|
+
return join10(getLocksDir(), `lock-${itemId}.json`);
|
|
2884
|
+
}
|
|
2885
|
+
function isProcessAlive(pid) {
|
|
2886
|
+
try {
|
|
2887
|
+
process.kill(pid, 0);
|
|
2888
|
+
return true;
|
|
2889
|
+
} catch {
|
|
2890
|
+
return false;
|
|
2891
|
+
}
|
|
2892
|
+
}
|
|
2893
|
+
function isLockedByOther(itemId) {
|
|
2894
|
+
const lockPath = getLockPath(itemId);
|
|
2895
|
+
if (!existsSync14(lockPath)) return false;
|
|
2896
|
+
try {
|
|
2897
|
+
const lock = JSON.parse(readFileSync9(lockPath, "utf-8"));
|
|
2898
|
+
if (lock.pid === process.pid) return false;
|
|
2899
|
+
return isProcessAlive(lock.pid);
|
|
2900
|
+
} catch {
|
|
2901
|
+
return false;
|
|
2902
|
+
}
|
|
2903
|
+
}
|
|
2904
|
+
function acquireLock(itemId) {
|
|
2905
|
+
mkdirSync4(getLocksDir(), { recursive: true });
|
|
2906
|
+
writeFileSync11(
|
|
2907
|
+
getLockPath(itemId),
|
|
2908
|
+
JSON.stringify({ pid: process.pid, timestamp: (/* @__PURE__ */ new Date()).toISOString() })
|
|
2909
|
+
);
|
|
2910
|
+
}
|
|
2911
|
+
function releaseLock(itemId) {
|
|
2912
|
+
const lockPath = getLockPath(itemId);
|
|
2913
|
+
try {
|
|
2914
|
+
unlinkSync2(lockPath);
|
|
2915
|
+
} catch {
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2918
|
+
|
|
2919
|
+
// src/commands/backlog/list/shared.ts
|
|
2920
|
+
import chalk27 from "chalk";
|
|
2921
|
+
function statusIcon(status2) {
|
|
2922
|
+
switch (status2) {
|
|
2923
|
+
case "todo":
|
|
2924
|
+
return chalk27.dim("[ ]");
|
|
2925
|
+
case "in-progress":
|
|
2926
|
+
return chalk27.yellow("[~]");
|
|
2927
|
+
case "done":
|
|
2928
|
+
return chalk27.green("[x]");
|
|
2929
|
+
case "wontdo":
|
|
2930
|
+
return chalk27.dim("[-]");
|
|
2931
|
+
}
|
|
2932
|
+
}
|
|
2933
|
+
function typeLabel(type) {
|
|
2934
|
+
switch (type) {
|
|
2935
|
+
case "bug":
|
|
2936
|
+
return chalk27.magenta("Bug");
|
|
2937
|
+
case "story":
|
|
2938
|
+
return chalk27.cyan("Story");
|
|
2939
|
+
}
|
|
2940
|
+
}
|
|
2941
|
+
function phaseLabel(item) {
|
|
2942
|
+
if (!item.plan) return "";
|
|
2943
|
+
return chalk27.dim(` (phase ${item.currentPhase ?? 1}/${item.plan.length})`);
|
|
2944
|
+
}
|
|
2945
|
+
function isBlocked(item, items2) {
|
|
2946
|
+
const deps2 = (item.links ?? []).filter((l) => l.type === "depends-on");
|
|
2947
|
+
return deps2.some((dep) => {
|
|
2948
|
+
const target = items2.find((i) => i.id === dep.targetId);
|
|
2949
|
+
return target !== void 0 && target.status !== "done";
|
|
2950
|
+
});
|
|
2951
|
+
}
|
|
2952
|
+
function dependencyLabel(item, items2) {
|
|
2953
|
+
const deps2 = (item.links ?? []).filter((l) => l.type === "depends-on");
|
|
2954
|
+
if (deps2.length === 0) return "";
|
|
2955
|
+
if (isBlocked(item, items2)) return chalk27.red(" [blocked]");
|
|
2956
|
+
return chalk27.dim(` [${deps2.length} dep${deps2.length > 1 ? "s" : ""}]`);
|
|
2957
|
+
}
|
|
2958
|
+
function printVerboseDetails(item) {
|
|
2959
|
+
if (item.description) {
|
|
2960
|
+
console.log(` ${chalk27.dim("Description:")} ${item.description}`);
|
|
2961
|
+
}
|
|
2962
|
+
if (item.acceptanceCriteria.length > 0) {
|
|
2963
|
+
console.log(` ${chalk27.dim("Acceptance criteria:")}`);
|
|
2964
|
+
for (const [i, criterion] of item.acceptanceCriteria.entries()) {
|
|
2965
|
+
console.log(` ${i + 1}. ${criterion}`);
|
|
2966
|
+
}
|
|
2967
|
+
}
|
|
2968
|
+
console.log();
|
|
2969
|
+
}
|
|
2970
|
+
|
|
2971
|
+
// src/commands/backlog/findResumable.ts
|
|
2972
|
+
function findResumable(items2) {
|
|
2973
|
+
return items2.find(
|
|
2974
|
+
(i) => i.status === "in-progress" && i.plan && !isLockedByOther(i.id) && !isBlocked(i, items2)
|
|
2975
|
+
);
|
|
2976
|
+
}
|
|
2977
|
+
|
|
2978
|
+
// src/commands/backlog/findUnblockedTodos.ts
|
|
2979
|
+
import chalk28 from "chalk";
|
|
2980
|
+
function findUnblockedTodos(items2) {
|
|
2981
|
+
const todo = items2.filter((i) => i.status === "todo");
|
|
2982
|
+
if (todo.length === 0) {
|
|
2983
|
+
console.log(chalk28.green("All backlog items complete."));
|
|
2984
|
+
return void 0;
|
|
2985
|
+
}
|
|
2986
|
+
const unblocked = todo.filter((i) => !isBlocked(i, items2));
|
|
2987
|
+
if (unblocked.length === 0) {
|
|
2988
|
+
console.log(
|
|
2989
|
+
chalk28.yellow("All remaining todo items are blocked by dependencies.")
|
|
2990
|
+
);
|
|
2991
|
+
return void 0;
|
|
2992
|
+
}
|
|
2993
|
+
return unblocked;
|
|
2994
|
+
}
|
|
2995
|
+
|
|
2996
|
+
// src/commands/backlog/run.ts
|
|
2997
|
+
import chalk35 from "chalk";
|
|
2998
|
+
|
|
2999
|
+
// src/commands/backlog/prepareRun.ts
|
|
3000
|
+
import chalk32 from "chalk";
|
|
3001
|
+
|
|
3002
|
+
// src/commands/backlog/resolvePlan.ts
|
|
3003
|
+
function resolvePlan(item) {
|
|
3004
|
+
if (item.plan && item.plan.length > 0) {
|
|
3005
|
+
return item.plan;
|
|
3006
|
+
}
|
|
3007
|
+
return [
|
|
3008
|
+
{
|
|
3009
|
+
name: "Implement",
|
|
3010
|
+
tasks: item.acceptanceCriteria.map((ac) => ({ task: ac }))
|
|
3011
|
+
}
|
|
3012
|
+
];
|
|
3013
|
+
}
|
|
2726
3014
|
|
|
2727
3015
|
// src/commands/backlog/shared.ts
|
|
2728
|
-
import
|
|
3016
|
+
import chalk31 from "chalk";
|
|
2729
3017
|
|
|
2730
3018
|
// src/commands/backlog/deleteItem.ts
|
|
2731
3019
|
import { eq } from "drizzle-orm";
|
|
@@ -2735,19 +3023,19 @@ async function deleteItem(orm, id) {
|
|
|
2735
3023
|
}
|
|
2736
3024
|
|
|
2737
3025
|
// src/commands/backlog/migrateLocalBacklog.ts
|
|
2738
|
-
import { existsSync as
|
|
2739
|
-
import { join as
|
|
2740
|
-
import
|
|
3026
|
+
import { existsSync as existsSync16 } from "fs";
|
|
3027
|
+
import { join as join12 } from "path";
|
|
3028
|
+
import chalk30 from "chalk";
|
|
2741
3029
|
|
|
2742
3030
|
// src/commands/backlog/backupLocalBacklogFiles.ts
|
|
2743
|
-
import { existsSync as
|
|
2744
|
-
import { join as
|
|
3031
|
+
import { existsSync as existsSync15, renameSync } from "fs";
|
|
3032
|
+
import { join as join11 } from "path";
|
|
2745
3033
|
var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
|
|
2746
3034
|
function backupLocalBacklogFiles(dir) {
|
|
2747
3035
|
const moved = [];
|
|
2748
3036
|
for (const name of LOCAL_FILES) {
|
|
2749
|
-
const path53 =
|
|
2750
|
-
if (
|
|
3037
|
+
const path53 = join11(dir, ".assist", name);
|
|
3038
|
+
if (existsSync15(path53)) {
|
|
2751
3039
|
renameSync(path53, `${path53}.bak`);
|
|
2752
3040
|
moved.push(`${name} \u2192 ${name}.bak`);
|
|
2753
3041
|
}
|
|
@@ -2756,17 +3044,17 @@ function backupLocalBacklogFiles(dir) {
|
|
|
2756
3044
|
}
|
|
2757
3045
|
|
|
2758
3046
|
// src/commands/backlog/gitPullBacklog.ts
|
|
2759
|
-
import { execSync as
|
|
2760
|
-
import
|
|
3047
|
+
import { execSync as execSync17 } from "child_process";
|
|
3048
|
+
import chalk29 from "chalk";
|
|
2761
3049
|
function gitPullBacklog(dir) {
|
|
2762
3050
|
try {
|
|
2763
|
-
|
|
3051
|
+
execSync17("git pull --ff-only", {
|
|
2764
3052
|
cwd: dir,
|
|
2765
3053
|
stdio: ["pipe", "pipe", "pipe"]
|
|
2766
3054
|
});
|
|
2767
3055
|
} catch {
|
|
2768
3056
|
console.error(
|
|
2769
|
-
|
|
3057
|
+
chalk29.yellow(
|
|
2770
3058
|
"backlog migrate: git pull skipped (no upstream or pull failed); using the local file."
|
|
2771
3059
|
)
|
|
2772
3060
|
);
|
|
@@ -2995,7 +3283,7 @@ async function loadAllItems(orm, origin) {
|
|
|
2995
3283
|
}
|
|
2996
3284
|
|
|
2997
3285
|
// src/commands/backlog/parseBacklogJsonl.ts
|
|
2998
|
-
import { readFileSync as
|
|
3286
|
+
import { readFileSync as readFileSync10 } from "fs";
|
|
2999
3287
|
|
|
3000
3288
|
// src/commands/backlog/types.ts
|
|
3001
3289
|
import { z as z3 } from "zod";
|
|
@@ -3039,14 +3327,14 @@ var backlogFileSchema = z3.array(backlogItemSchema);
|
|
|
3039
3327
|
|
|
3040
3328
|
// src/commands/backlog/parseBacklogJsonl.ts
|
|
3041
3329
|
function parseBacklogJsonl(path53) {
|
|
3042
|
-
const content =
|
|
3330
|
+
const content = readFileSync10(path53, "utf-8").trim();
|
|
3043
3331
|
if (content.length === 0) return [];
|
|
3044
3332
|
return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
|
|
3045
3333
|
}
|
|
3046
3334
|
|
|
3047
3335
|
// src/commands/backlog/migrateLocalBacklog.ts
|
|
3048
3336
|
function jsonlPath(dir) {
|
|
3049
|
-
return
|
|
3337
|
+
return join12(dir, ".assist", "backlog.jsonl");
|
|
3050
3338
|
}
|
|
3051
3339
|
async function verifyImport(orm, origin, items2, imported) {
|
|
3052
3340
|
const reloaded = await loadAllItems(orm, origin);
|
|
@@ -3062,12 +3350,12 @@ async function verifyImport(orm, origin, items2, imported) {
|
|
|
3062
3350
|
}
|
|
3063
3351
|
}
|
|
3064
3352
|
async function migrateLocalBacklog(orm, dir, origin) {
|
|
3065
|
-
if (!
|
|
3353
|
+
if (!existsSync16(jsonlPath(dir))) return;
|
|
3066
3354
|
const existing = (await loadAllItems(orm, origin)).length;
|
|
3067
3355
|
if (existing > 0) {
|
|
3068
3356
|
const moved2 = backupLocalBacklogFiles(dir);
|
|
3069
3357
|
console.error(
|
|
3070
|
-
|
|
3358
|
+
chalk30.yellow(
|
|
3071
3359
|
`backlog migrate: Postgres already has ${existing} item(s) for ${origin}; skipped import to avoid duplicates and archived the local file (${moved2.join(", ")}).`
|
|
3072
3360
|
)
|
|
3073
3361
|
);
|
|
@@ -3079,7 +3367,7 @@ async function migrateLocalBacklog(orm, dir, origin) {
|
|
|
3079
3367
|
await verifyImport(orm, origin, items2, imported);
|
|
3080
3368
|
const moved = backupLocalBacklogFiles(dir);
|
|
3081
3369
|
console.error(
|
|
3082
|
-
|
|
3370
|
+
chalk30.green(
|
|
3083
3371
|
`backlog migrate: imported ${imported} item(s) into Postgres (${moved.join(", ")}).`
|
|
3084
3372
|
)
|
|
3085
3373
|
);
|
|
@@ -3094,17 +3382,17 @@ async function ensureMigrated(orm, dir, origin) {
|
|
|
3094
3382
|
}
|
|
3095
3383
|
|
|
3096
3384
|
// src/commands/backlog/findBacklogUp.ts
|
|
3097
|
-
import { existsSync as
|
|
3098
|
-
import { dirname as dirname13, join as
|
|
3385
|
+
import { existsSync as existsSync17 } from "fs";
|
|
3386
|
+
import { dirname as dirname13, join as join13 } from "path";
|
|
3099
3387
|
var BACKLOG_MARKERS = [
|
|
3100
|
-
|
|
3101
|
-
|
|
3388
|
+
join13(".assist", "backlog.db"),
|
|
3389
|
+
join13(".assist", "backlog.jsonl"),
|
|
3102
3390
|
"assist.backlog.yml"
|
|
3103
3391
|
];
|
|
3104
3392
|
function findBacklogUp(startDir) {
|
|
3105
3393
|
let current = startDir;
|
|
3106
3394
|
while (current !== dirname13(current)) {
|
|
3107
|
-
if (BACKLOG_MARKERS.some((marker) =>
|
|
3395
|
+
if (BACKLOG_MARKERS.some((marker) => existsSync17(join13(current, marker)))) {
|
|
3108
3396
|
return current;
|
|
3109
3397
|
}
|
|
3110
3398
|
current = dirname13(current);
|
|
@@ -3113,7 +3401,7 @@ function findBacklogUp(startDir) {
|
|
|
3113
3401
|
}
|
|
3114
3402
|
|
|
3115
3403
|
// src/commands/backlog/getCurrentOrigin.ts
|
|
3116
|
-
import { execSync as
|
|
3404
|
+
import { execSync as execSync18 } from "child_process";
|
|
3117
3405
|
function stripLeadingSlashes(path53) {
|
|
3118
3406
|
return path53.replace(/^\/+/, "");
|
|
3119
3407
|
}
|
|
@@ -3135,7 +3423,7 @@ function normalizeOrigin(raw) {
|
|
|
3135
3423
|
}
|
|
3136
3424
|
function tryGit(cwd, args) {
|
|
3137
3425
|
try {
|
|
3138
|
-
const out =
|
|
3426
|
+
const out = execSync18(`git ${args}`, {
|
|
3139
3427
|
cwd,
|
|
3140
3428
|
encoding: "utf-8",
|
|
3141
3429
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -3241,7 +3529,7 @@ async function findOneItem(id) {
|
|
|
3241
3529
|
const { orm } = await getReady();
|
|
3242
3530
|
const item = Number.isNaN(numId) ? void 0 : await loadItem(orm, numId);
|
|
3243
3531
|
if (!item) {
|
|
3244
|
-
console.log(
|
|
3532
|
+
console.log(chalk31.red(`Item #${id} not found.`));
|
|
3245
3533
|
return void 0;
|
|
3246
3534
|
}
|
|
3247
3535
|
return { orm, item };
|
|
@@ -3249,7 +3537,7 @@ async function findOneItem(id) {
|
|
|
3249
3537
|
async function setStatus(id, status2) {
|
|
3250
3538
|
const { orm } = await getReady();
|
|
3251
3539
|
const name = await updateStatus(orm, Number.parseInt(id, 10), status2);
|
|
3252
|
-
if (name === void 0) console.log(
|
|
3540
|
+
if (name === void 0) console.log(chalk31.red(`Item #${id} not found.`));
|
|
3253
3541
|
return name;
|
|
3254
3542
|
}
|
|
3255
3543
|
async function setCurrentPhase(id, phase) {
|
|
@@ -3259,143 +3547,10 @@ async function setCurrentPhase(id, phase) {
|
|
|
3259
3547
|
async function removeItem(id) {
|
|
3260
3548
|
const { orm } = await getReady();
|
|
3261
3549
|
const name = await deleteItem(orm, Number.parseInt(id, 10));
|
|
3262
|
-
if (name === void 0) console.log(
|
|
3550
|
+
if (name === void 0) console.log(chalk31.red(`Item #${id} not found.`));
|
|
3263
3551
|
return name;
|
|
3264
3552
|
}
|
|
3265
3553
|
|
|
3266
|
-
// src/commands/backlog/acquireLock.ts
|
|
3267
|
-
function getLockPath(itemId) {
|
|
3268
|
-
return join13(getBacklogDir(), `.assist-lock-${itemId}.json`);
|
|
3269
|
-
}
|
|
3270
|
-
function isProcessAlive(pid) {
|
|
3271
|
-
try {
|
|
3272
|
-
process.kill(pid, 0);
|
|
3273
|
-
return true;
|
|
3274
|
-
} catch {
|
|
3275
|
-
return false;
|
|
3276
|
-
}
|
|
3277
|
-
}
|
|
3278
|
-
function isLockedByOther(itemId) {
|
|
3279
|
-
const lockPath = getLockPath(itemId);
|
|
3280
|
-
if (!existsSync17(lockPath)) return false;
|
|
3281
|
-
try {
|
|
3282
|
-
const lock = JSON.parse(readFileSync10(lockPath, "utf-8"));
|
|
3283
|
-
if (lock.pid === process.pid) return false;
|
|
3284
|
-
return isProcessAlive(lock.pid);
|
|
3285
|
-
} catch {
|
|
3286
|
-
return false;
|
|
3287
|
-
}
|
|
3288
|
-
}
|
|
3289
|
-
function acquireLock(itemId) {
|
|
3290
|
-
writeFileSync11(
|
|
3291
|
-
getLockPath(itemId),
|
|
3292
|
-
JSON.stringify({ pid: process.pid, timestamp: (/* @__PURE__ */ new Date()).toISOString() })
|
|
3293
|
-
);
|
|
3294
|
-
}
|
|
3295
|
-
function releaseLock(itemId) {
|
|
3296
|
-
const lockPath = getLockPath(itemId);
|
|
3297
|
-
try {
|
|
3298
|
-
unlinkSync2(lockPath);
|
|
3299
|
-
} catch {
|
|
3300
|
-
}
|
|
3301
|
-
}
|
|
3302
|
-
|
|
3303
|
-
// src/commands/backlog/list/shared.ts
|
|
3304
|
-
import chalk30 from "chalk";
|
|
3305
|
-
function statusIcon(status2) {
|
|
3306
|
-
switch (status2) {
|
|
3307
|
-
case "todo":
|
|
3308
|
-
return chalk30.dim("[ ]");
|
|
3309
|
-
case "in-progress":
|
|
3310
|
-
return chalk30.yellow("[~]");
|
|
3311
|
-
case "done":
|
|
3312
|
-
return chalk30.green("[x]");
|
|
3313
|
-
case "wontdo":
|
|
3314
|
-
return chalk30.dim("[-]");
|
|
3315
|
-
}
|
|
3316
|
-
}
|
|
3317
|
-
function typeLabel(type) {
|
|
3318
|
-
switch (type) {
|
|
3319
|
-
case "bug":
|
|
3320
|
-
return chalk30.magenta("Bug");
|
|
3321
|
-
case "story":
|
|
3322
|
-
return chalk30.cyan("Story");
|
|
3323
|
-
}
|
|
3324
|
-
}
|
|
3325
|
-
function phaseLabel(item) {
|
|
3326
|
-
if (!item.plan) return "";
|
|
3327
|
-
return chalk30.dim(` (phase ${item.currentPhase ?? 1}/${item.plan.length})`);
|
|
3328
|
-
}
|
|
3329
|
-
function isBlocked(item, items2) {
|
|
3330
|
-
const deps2 = (item.links ?? []).filter((l) => l.type === "depends-on");
|
|
3331
|
-
return deps2.some((dep) => {
|
|
3332
|
-
const target = items2.find((i) => i.id === dep.targetId);
|
|
3333
|
-
return target !== void 0 && target.status !== "done";
|
|
3334
|
-
});
|
|
3335
|
-
}
|
|
3336
|
-
function dependencyLabel(item, items2) {
|
|
3337
|
-
const deps2 = (item.links ?? []).filter((l) => l.type === "depends-on");
|
|
3338
|
-
if (deps2.length === 0) return "";
|
|
3339
|
-
if (isBlocked(item, items2)) return chalk30.red(" [blocked]");
|
|
3340
|
-
return chalk30.dim(` [${deps2.length} dep${deps2.length > 1 ? "s" : ""}]`);
|
|
3341
|
-
}
|
|
3342
|
-
function printVerboseDetails(item) {
|
|
3343
|
-
if (item.description) {
|
|
3344
|
-
console.log(` ${chalk30.dim("Description:")} ${item.description}`);
|
|
3345
|
-
}
|
|
3346
|
-
if (item.acceptanceCriteria.length > 0) {
|
|
3347
|
-
console.log(` ${chalk30.dim("Acceptance criteria:")}`);
|
|
3348
|
-
for (const [i, criterion] of item.acceptanceCriteria.entries()) {
|
|
3349
|
-
console.log(` ${i + 1}. ${criterion}`);
|
|
3350
|
-
}
|
|
3351
|
-
}
|
|
3352
|
-
console.log();
|
|
3353
|
-
}
|
|
3354
|
-
|
|
3355
|
-
// src/commands/backlog/findResumable.ts
|
|
3356
|
-
function findResumable(items2) {
|
|
3357
|
-
return items2.find(
|
|
3358
|
-
(i) => i.status === "in-progress" && i.plan && !isLockedByOther(i.id) && !isBlocked(i, items2)
|
|
3359
|
-
);
|
|
3360
|
-
}
|
|
3361
|
-
|
|
3362
|
-
// src/commands/backlog/findUnblockedTodos.ts
|
|
3363
|
-
import chalk31 from "chalk";
|
|
3364
|
-
function findUnblockedTodos(items2) {
|
|
3365
|
-
const todo = items2.filter((i) => i.status === "todo");
|
|
3366
|
-
if (todo.length === 0) {
|
|
3367
|
-
console.log(chalk31.green("All backlog items complete."));
|
|
3368
|
-
return void 0;
|
|
3369
|
-
}
|
|
3370
|
-
const unblocked = todo.filter((i) => !isBlocked(i, items2));
|
|
3371
|
-
if (unblocked.length === 0) {
|
|
3372
|
-
console.log(
|
|
3373
|
-
chalk31.yellow("All remaining todo items are blocked by dependencies.")
|
|
3374
|
-
);
|
|
3375
|
-
return void 0;
|
|
3376
|
-
}
|
|
3377
|
-
return unblocked;
|
|
3378
|
-
}
|
|
3379
|
-
|
|
3380
|
-
// src/commands/backlog/run.ts
|
|
3381
|
-
import chalk35 from "chalk";
|
|
3382
|
-
|
|
3383
|
-
// src/commands/backlog/prepareRun.ts
|
|
3384
|
-
import chalk32 from "chalk";
|
|
3385
|
-
|
|
3386
|
-
// src/commands/backlog/resolvePlan.ts
|
|
3387
|
-
function resolvePlan(item) {
|
|
3388
|
-
if (item.plan && item.plan.length > 0) {
|
|
3389
|
-
return item.plan;
|
|
3390
|
-
}
|
|
3391
|
-
return [
|
|
3392
|
-
{
|
|
3393
|
-
name: "Implement",
|
|
3394
|
-
tasks: item.acceptanceCriteria.map((ac) => ({ task: ac }))
|
|
3395
|
-
}
|
|
3396
|
-
];
|
|
3397
|
-
}
|
|
3398
|
-
|
|
3399
3554
|
// src/commands/backlog/prepareRun.ts
|
|
3400
3555
|
async function prepareRun(id) {
|
|
3401
3556
|
const found = await findOneItem(id);
|
|
@@ -3428,16 +3583,17 @@ async function reloadPlan(id) {
|
|
|
3428
3583
|
import chalk34 from "chalk";
|
|
3429
3584
|
|
|
3430
3585
|
// src/shared/emitActivity.ts
|
|
3431
|
-
import { mkdirSync as
|
|
3586
|
+
import { mkdirSync as mkdirSync5, readFileSync as readFileSync11, rmSync, writeFileSync as writeFileSync12 } from "fs";
|
|
3587
|
+
import { homedir as homedir4 } from "os";
|
|
3432
3588
|
import { dirname as dirname14, join as join14 } from "path";
|
|
3433
|
-
function activityPath(
|
|
3434
|
-
return join14(
|
|
3589
|
+
function activityPath(sessionId) {
|
|
3590
|
+
return join14(homedir4(), ".assist", "activity", `activity-${sessionId}.json`);
|
|
3435
3591
|
}
|
|
3436
3592
|
function emitActivity(activity2) {
|
|
3437
3593
|
const sessionId = process.env.ASSIST_ACTIVITY_ID;
|
|
3438
3594
|
if (!sessionId) return;
|
|
3439
|
-
const path53 = activityPath(
|
|
3440
|
-
|
|
3595
|
+
const path53 = activityPath(sessionId);
|
|
3596
|
+
mkdirSync5(dirname14(path53), { recursive: true });
|
|
3441
3597
|
writeFileSync12(path53, JSON.stringify({ ...activity2, startedAt: Date.now() }));
|
|
3442
3598
|
}
|
|
3443
3599
|
function readActivity(path53) {
|
|
@@ -3447,9 +3603,9 @@ function readActivity(path53) {
|
|
|
3447
3603
|
return void 0;
|
|
3448
3604
|
}
|
|
3449
3605
|
}
|
|
3450
|
-
function removeActivity(
|
|
3606
|
+
function removeActivity(sessionId) {
|
|
3451
3607
|
try {
|
|
3452
|
-
rmSync(activityPath(
|
|
3608
|
+
rmSync(activityPath(sessionId));
|
|
3453
3609
|
} catch {
|
|
3454
3610
|
}
|
|
3455
3611
|
}
|
|
@@ -4064,7 +4220,7 @@ function printComments(item) {
|
|
|
4064
4220
|
import { WebSocketServer } from "ws";
|
|
4065
4221
|
|
|
4066
4222
|
// src/shared/getInstallDir.ts
|
|
4067
|
-
import { execSync as
|
|
4223
|
+
import { execSync as execSync19 } from "child_process";
|
|
4068
4224
|
import { dirname as dirname15, resolve as resolve6 } from "path";
|
|
4069
4225
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
4070
4226
|
var __filename2 = fileURLToPath3(import.meta.url);
|
|
@@ -4074,7 +4230,7 @@ function getInstallDir() {
|
|
|
4074
4230
|
}
|
|
4075
4231
|
function isGitRepo(dir) {
|
|
4076
4232
|
try {
|
|
4077
|
-
const result =
|
|
4233
|
+
const result = execSync19("git rev-parse --show-toplevel", {
|
|
4078
4234
|
cwd: dir,
|
|
4079
4235
|
stdio: "pipe"
|
|
4080
4236
|
}).toString().trim();
|
|
@@ -4145,7 +4301,7 @@ function startWebServer(label2, port, handler, initialPath) {
|
|
|
4145
4301
|
import { spawn as spawn4 } from "child_process";
|
|
4146
4302
|
import {
|
|
4147
4303
|
closeSync,
|
|
4148
|
-
mkdirSync as
|
|
4304
|
+
mkdirSync as mkdirSync6,
|
|
4149
4305
|
openSync,
|
|
4150
4306
|
statSync,
|
|
4151
4307
|
unlinkSync as unlinkSync4,
|
|
@@ -4156,9 +4312,9 @@ import {
|
|
|
4156
4312
|
import * as net from "net";
|
|
4157
4313
|
|
|
4158
4314
|
// src/commands/sessions/daemon/daemonPaths.ts
|
|
4159
|
-
import { homedir as
|
|
4315
|
+
import { homedir as homedir5 } from "os";
|
|
4160
4316
|
import { join as join16 } from "path";
|
|
4161
|
-
var DAEMON_DIR = join16(
|
|
4317
|
+
var DAEMON_DIR = join16(homedir5(), ".assist", "daemon");
|
|
4162
4318
|
var daemonPaths = {
|
|
4163
4319
|
dir: DAEMON_DIR,
|
|
4164
4320
|
socket: process.platform === "win32" ? "\\\\.\\pipe\\assist-sessions-daemon" : join16(DAEMON_DIR, "daemon.sock"),
|
|
@@ -4190,7 +4346,7 @@ var RETRY_DELAY_MS = 200;
|
|
|
4190
4346
|
var STALE_LOCK_MS = SPAWN_TIMEOUT_MS + 5e3;
|
|
4191
4347
|
async function ensureDaemonRunning(reason = "unspecified") {
|
|
4192
4348
|
if (await isDaemonRunning()) return;
|
|
4193
|
-
|
|
4349
|
+
mkdirSync6(daemonPaths.dir, { recursive: true });
|
|
4194
4350
|
const holdsLock = acquireSpawnLock();
|
|
4195
4351
|
if (holdsLock) spawnDaemon(reason);
|
|
4196
4352
|
try {
|
|
@@ -4588,7 +4744,7 @@ function getHtml() {
|
|
|
4588
4744
|
}
|
|
4589
4745
|
|
|
4590
4746
|
// src/commands/prs/getPreferredRemoteRepo.ts
|
|
4591
|
-
import { execSync as
|
|
4747
|
+
import { execSync as execSync20 } from "child_process";
|
|
4592
4748
|
var GITHUB_URL_PATTERN = /(?:git@github\.com:|https:\/\/github\.com\/)([^/]+)\/([^/]+?)(?:\.git)?\/?$/;
|
|
4593
4749
|
function parseGitHubUrl(url) {
|
|
4594
4750
|
const match = url.match(GITHUB_URL_PATTERN);
|
|
@@ -4597,7 +4753,7 @@ function parseGitHubUrl(url) {
|
|
|
4597
4753
|
}
|
|
4598
4754
|
function tryGetRemoteUrl(remote, cwd) {
|
|
4599
4755
|
try {
|
|
4600
|
-
return
|
|
4756
|
+
return execSync20(`git remote get-url ${remote}`, {
|
|
4601
4757
|
encoding: "utf-8",
|
|
4602
4758
|
stdio: ["pipe", "pipe", "pipe"],
|
|
4603
4759
|
cwd
|
|
@@ -4608,7 +4764,7 @@ function tryGetRemoteUrl(remote, cwd) {
|
|
|
4608
4764
|
}
|
|
4609
4765
|
function getCurrentBranchRemote(cwd) {
|
|
4610
4766
|
try {
|
|
4611
|
-
const ref =
|
|
4767
|
+
const ref = execSync20(
|
|
4612
4768
|
"git rev-parse --abbrev-ref --symbolic-full-name @{u}",
|
|
4613
4769
|
{ encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"], cwd }
|
|
4614
4770
|
).trim();
|
|
@@ -4620,7 +4776,7 @@ function getCurrentBranchRemote(cwd) {
|
|
|
4620
4776
|
}
|
|
4621
4777
|
function listRemotes(cwd) {
|
|
4622
4778
|
try {
|
|
4623
|
-
return
|
|
4779
|
+
return execSync20("git remote", {
|
|
4624
4780
|
encoding: "utf-8",
|
|
4625
4781
|
stdio: ["pipe", "pipe", "pipe"],
|
|
4626
4782
|
cwd
|
|
@@ -6454,13 +6610,13 @@ function stripEnvPrefix(parts) {
|
|
|
6454
6610
|
}
|
|
6455
6611
|
|
|
6456
6612
|
// src/commands/cliHook/logDeniedToolCall.ts
|
|
6457
|
-
import { mkdirSync as
|
|
6458
|
-
import { homedir as
|
|
6613
|
+
import { mkdirSync as mkdirSync7 } from "fs";
|
|
6614
|
+
import { homedir as homedir6 } from "os";
|
|
6459
6615
|
import { join as join19 } from "path";
|
|
6460
6616
|
import Database from "better-sqlite3";
|
|
6461
6617
|
var _db;
|
|
6462
6618
|
function getDbDir() {
|
|
6463
|
-
return join19(
|
|
6619
|
+
return join19(homedir6(), ".assist");
|
|
6464
6620
|
}
|
|
6465
6621
|
function initSchema(db) {
|
|
6466
6622
|
db.exec(`
|
|
@@ -6478,7 +6634,7 @@ function initSchema(db) {
|
|
|
6478
6634
|
function openPromptsDb(dir) {
|
|
6479
6635
|
if (_db) return _db;
|
|
6480
6636
|
const dbDir = dir ?? getDbDir();
|
|
6481
|
-
|
|
6637
|
+
mkdirSync7(dbDir, { recursive: true });
|
|
6482
6638
|
const db = new Database(join19(dbDir, "assist.db"));
|
|
6483
6639
|
db.pragma("journal_mode = WAL");
|
|
6484
6640
|
initSchema(db);
|
|
@@ -6638,11 +6794,11 @@ function findCliWrite(command) {
|
|
|
6638
6794
|
|
|
6639
6795
|
// src/shared/readSettingsPerms.ts
|
|
6640
6796
|
import { existsSync as existsSync22, readFileSync as readFileSync17 } from "fs";
|
|
6641
|
-
import { homedir as
|
|
6797
|
+
import { homedir as homedir7 } from "os";
|
|
6642
6798
|
import { join as join20 } from "path";
|
|
6643
6799
|
function readSettingsPerms(key) {
|
|
6644
6800
|
const paths = [
|
|
6645
|
-
join20(
|
|
6801
|
+
join20(homedir7(), ".claude", "settings.json"),
|
|
6646
6802
|
join20(process.cwd(), ".claude", "settings.json"),
|
|
6647
6803
|
join20(process.cwd(), ".claude", "settings.local.json")
|
|
6648
6804
|
];
|
|
@@ -6935,12 +7091,12 @@ ${reasons.join("\n")}`);
|
|
|
6935
7091
|
}
|
|
6936
7092
|
|
|
6937
7093
|
// src/commands/permitCliReads/index.ts
|
|
6938
|
-
import { existsSync as existsSync23, mkdirSync as
|
|
6939
|
-
import { homedir as
|
|
7094
|
+
import { existsSync as existsSync23, mkdirSync as mkdirSync8, readFileSync as readFileSync18, writeFileSync as writeFileSync16 } from "fs";
|
|
7095
|
+
import { homedir as homedir8 } from "os";
|
|
6940
7096
|
import { join as join21 } from "path";
|
|
6941
7097
|
|
|
6942
7098
|
// src/shared/checkCliAvailable.ts
|
|
6943
|
-
import { execSync as
|
|
7099
|
+
import { execSync as execSync21 } from "child_process";
|
|
6944
7100
|
function checkCliAvailable(cli) {
|
|
6945
7101
|
const binary = cli.split(/\s+/)[0];
|
|
6946
7102
|
const opts = {
|
|
@@ -6948,11 +7104,11 @@ function checkCliAvailable(cli) {
|
|
|
6948
7104
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6949
7105
|
};
|
|
6950
7106
|
try {
|
|
6951
|
-
|
|
7107
|
+
execSync21(`command -v ${binary}`, opts);
|
|
6952
7108
|
return true;
|
|
6953
7109
|
} catch {
|
|
6954
7110
|
try {
|
|
6955
|
-
|
|
7111
|
+
execSync21(`where ${binary}`, opts);
|
|
6956
7112
|
return true;
|
|
6957
7113
|
} catch {
|
|
6958
7114
|
return false;
|
|
@@ -7226,7 +7382,7 @@ function updateSettings(cli, commands) {
|
|
|
7226
7382
|
// src/commands/permitCliReads/index.ts
|
|
7227
7383
|
function logPath(cli) {
|
|
7228
7384
|
const safeName = cli.replace(/\s+/g, "-");
|
|
7229
|
-
return join21(
|
|
7385
|
+
return join21(homedir8(), ".assist", `cli-discover-${safeName}.log`);
|
|
7230
7386
|
}
|
|
7231
7387
|
function readCache(cli) {
|
|
7232
7388
|
const path53 = logPath(cli);
|
|
@@ -7234,8 +7390,8 @@ function readCache(cli) {
|
|
|
7234
7390
|
return readFileSync18(path53, "utf-8");
|
|
7235
7391
|
}
|
|
7236
7392
|
function writeCache(cli, output) {
|
|
7237
|
-
const dir = join21(
|
|
7238
|
-
|
|
7393
|
+
const dir = join21(homedir8(), ".assist");
|
|
7394
|
+
mkdirSync8(dir, { recursive: true });
|
|
7239
7395
|
writeFileSync16(logPath(cli), output);
|
|
7240
7396
|
}
|
|
7241
7397
|
async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
@@ -7369,27 +7525,27 @@ import chalk85 from "chalk";
|
|
|
7369
7525
|
import chalk80 from "chalk";
|
|
7370
7526
|
|
|
7371
7527
|
// src/commands/complexity/shared/index.ts
|
|
7372
|
-
import
|
|
7528
|
+
import fs13 from "fs";
|
|
7373
7529
|
import path19 from "path";
|
|
7374
7530
|
import chalk79 from "chalk";
|
|
7375
7531
|
import ts5 from "typescript";
|
|
7376
7532
|
|
|
7377
7533
|
// src/commands/complexity/findSourceFiles.ts
|
|
7378
|
-
import
|
|
7534
|
+
import fs12 from "fs";
|
|
7379
7535
|
import path18 from "path";
|
|
7380
|
-
import { minimatch as
|
|
7536
|
+
import { minimatch as minimatch4 } from "minimatch";
|
|
7381
7537
|
function applyIgnoreGlobs(files) {
|
|
7382
7538
|
const { complexity } = loadConfig();
|
|
7383
7539
|
return files.filter(
|
|
7384
|
-
(f) => !complexity.ignore.some((glob) =>
|
|
7540
|
+
(f) => !complexity.ignore.some((glob) => minimatch4(f, glob))
|
|
7385
7541
|
);
|
|
7386
7542
|
}
|
|
7387
7543
|
function walk(dir, results) {
|
|
7388
|
-
if (!
|
|
7544
|
+
if (!fs12.existsSync(dir)) {
|
|
7389
7545
|
return;
|
|
7390
7546
|
}
|
|
7391
7547
|
const extensions = [".ts", ".tsx"];
|
|
7392
|
-
const entries =
|
|
7548
|
+
const entries = fs12.readdirSync(dir, { withFileTypes: true });
|
|
7393
7549
|
for (const entry of entries) {
|
|
7394
7550
|
const fullPath = path18.join(dir, entry.name);
|
|
7395
7551
|
if (entry.isDirectory()) {
|
|
@@ -7405,17 +7561,17 @@ function findSourceFiles2(pattern2, baseDir = ".") {
|
|
|
7405
7561
|
const results = [];
|
|
7406
7562
|
if (pattern2.includes("*")) {
|
|
7407
7563
|
walk(baseDir, results);
|
|
7408
|
-
return applyIgnoreGlobs(results.filter((f) =>
|
|
7564
|
+
return applyIgnoreGlobs(results.filter((f) => minimatch4(f, pattern2)));
|
|
7409
7565
|
}
|
|
7410
|
-
if (
|
|
7566
|
+
if (fs12.existsSync(pattern2) && fs12.statSync(pattern2).isFile()) {
|
|
7411
7567
|
return [pattern2];
|
|
7412
7568
|
}
|
|
7413
|
-
if (
|
|
7569
|
+
if (fs12.existsSync(pattern2) && fs12.statSync(pattern2).isDirectory()) {
|
|
7414
7570
|
walk(pattern2, results);
|
|
7415
7571
|
return applyIgnoreGlobs(results);
|
|
7416
7572
|
}
|
|
7417
7573
|
walk(baseDir, results);
|
|
7418
|
-
return applyIgnoreGlobs(results.filter((f) =>
|
|
7574
|
+
return applyIgnoreGlobs(results.filter((f) => minimatch4(f, pattern2)));
|
|
7419
7575
|
}
|
|
7420
7576
|
|
|
7421
7577
|
// src/commands/complexity/shared/getNodeName.ts
|
|
@@ -7605,7 +7761,7 @@ function countSloc(content) {
|
|
|
7605
7761
|
|
|
7606
7762
|
// src/commands/complexity/shared/index.ts
|
|
7607
7763
|
function createSourceFromFile(filePath) {
|
|
7608
|
-
const content =
|
|
7764
|
+
const content = fs13.readFileSync(filePath, "utf-8");
|
|
7609
7765
|
return ts5.createSourceFile(
|
|
7610
7766
|
path19.basename(filePath),
|
|
7611
7767
|
content,
|
|
@@ -7699,7 +7855,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
7699
7855
|
}
|
|
7700
7856
|
|
|
7701
7857
|
// src/commands/complexity/maintainability/index.ts
|
|
7702
|
-
import
|
|
7858
|
+
import fs14 from "fs";
|
|
7703
7859
|
|
|
7704
7860
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
7705
7861
|
import chalk82 from "chalk";
|
|
@@ -7748,7 +7904,7 @@ function calculateMaintainabilityIndex(halsteadVolume, cyclomaticComplexity, slo
|
|
|
7748
7904
|
function collectFileMetrics(files) {
|
|
7749
7905
|
const fileMetrics = /* @__PURE__ */ new Map();
|
|
7750
7906
|
for (const file of files) {
|
|
7751
|
-
const content =
|
|
7907
|
+
const content = fs14.readFileSync(file, "utf-8");
|
|
7752
7908
|
fileMetrics.set(file, { sloc: countSloc(content), functions: [] });
|
|
7753
7909
|
}
|
|
7754
7910
|
forEachFunction(files, (file, _name, node) => {
|
|
@@ -7787,14 +7943,14 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
7787
7943
|
}
|
|
7788
7944
|
|
|
7789
7945
|
// src/commands/complexity/sloc.ts
|
|
7790
|
-
import
|
|
7946
|
+
import fs15 from "fs";
|
|
7791
7947
|
import chalk84 from "chalk";
|
|
7792
7948
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
7793
7949
|
withSourceFiles(pattern2, (files) => {
|
|
7794
7950
|
const results = [];
|
|
7795
7951
|
let hasViolation = false;
|
|
7796
7952
|
for (const file of files) {
|
|
7797
|
-
const content =
|
|
7953
|
+
const content = fs15.readFileSync(file, "utf-8");
|
|
7798
7954
|
const lines = countSloc(content);
|
|
7799
7955
|
results.push({ file, lines });
|
|
7800
7956
|
if (options2.threshold !== void 0 && lines > options2.threshold) {
|
|
@@ -8061,9 +8217,9 @@ import { execFileSync } from "child_process";
|
|
|
8061
8217
|
import { basename as basename4 } from "path";
|
|
8062
8218
|
|
|
8063
8219
|
// src/commands/devlog/loadBlogSkipDays.ts
|
|
8064
|
-
import { homedir as
|
|
8220
|
+
import { homedir as homedir9 } from "os";
|
|
8065
8221
|
import { join as join22 } from "path";
|
|
8066
|
-
var BLOG_REPO_ROOT = join22(
|
|
8222
|
+
var BLOG_REPO_ROOT = join22(homedir9(), "git/blog");
|
|
8067
8223
|
function loadBlogSkipDays(repoName) {
|
|
8068
8224
|
const config = loadRawYaml(join22(BLOG_REPO_ROOT, "assist.yml"));
|
|
8069
8225
|
const devlog = config.devlog;
|
|
@@ -8072,7 +8228,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
8072
8228
|
}
|
|
8073
8229
|
|
|
8074
8230
|
// src/commands/devlog/shared.ts
|
|
8075
|
-
import { execSync as
|
|
8231
|
+
import { execSync as execSync22 } from "child_process";
|
|
8076
8232
|
import chalk89 from "chalk";
|
|
8077
8233
|
|
|
8078
8234
|
// src/shared/getRepoName.ts
|
|
@@ -8164,7 +8320,7 @@ function loadAllDevlogLatestDates() {
|
|
|
8164
8320
|
// src/commands/devlog/shared.ts
|
|
8165
8321
|
function getCommitFiles(hash) {
|
|
8166
8322
|
try {
|
|
8167
|
-
const output =
|
|
8323
|
+
const output = execSync22(`git show --name-only --format="" ${hash}`, {
|
|
8168
8324
|
encoding: "utf-8"
|
|
8169
8325
|
});
|
|
8170
8326
|
return output.trim().split("\n").filter(Boolean);
|
|
@@ -8260,11 +8416,11 @@ function list3(options2) {
|
|
|
8260
8416
|
}
|
|
8261
8417
|
|
|
8262
8418
|
// src/commands/devlog/getLastVersionInfo.ts
|
|
8263
|
-
import { execFileSync as execFileSync2, execSync as
|
|
8419
|
+
import { execFileSync as execFileSync2, execSync as execSync23 } from "child_process";
|
|
8264
8420
|
import semver from "semver";
|
|
8265
8421
|
function getVersionAtCommit(hash) {
|
|
8266
8422
|
try {
|
|
8267
|
-
const content =
|
|
8423
|
+
const content = execSync23(`git show ${hash}:package.json`, {
|
|
8268
8424
|
encoding: "utf-8"
|
|
8269
8425
|
});
|
|
8270
8426
|
const pkg = JSON.parse(content);
|
|
@@ -8437,7 +8593,7 @@ function next2(options2) {
|
|
|
8437
8593
|
}
|
|
8438
8594
|
|
|
8439
8595
|
// src/commands/devlog/repos/index.ts
|
|
8440
|
-
import { execSync as
|
|
8596
|
+
import { execSync as execSync24 } from "child_process";
|
|
8441
8597
|
|
|
8442
8598
|
// src/commands/devlog/repos/printReposTable.ts
|
|
8443
8599
|
import chalk93 from "chalk";
|
|
@@ -8472,7 +8628,7 @@ function getStatus(lastPush, lastDevlog) {
|
|
|
8472
8628
|
return lastDevlog < lastPush ? "outdated" : "ok";
|
|
8473
8629
|
}
|
|
8474
8630
|
function fetchRepos(days, all) {
|
|
8475
|
-
const json =
|
|
8631
|
+
const json = execSync24(
|
|
8476
8632
|
"gh repo list staff0rd --json name,pushedAt,isArchived --limit 200",
|
|
8477
8633
|
{ encoding: "utf-8" }
|
|
8478
8634
|
);
|
|
@@ -8832,7 +8988,7 @@ async function deps(csprojPath, options2) {
|
|
|
8832
8988
|
}
|
|
8833
8989
|
|
|
8834
8990
|
// src/commands/dotnet/getChangedCsFiles.ts
|
|
8835
|
-
import { execSync as
|
|
8991
|
+
import { execSync as execSync25 } from "child_process";
|
|
8836
8992
|
var SCOPE_ALL = "all";
|
|
8837
8993
|
var SCOPE_BASE = "base:";
|
|
8838
8994
|
var SCOPE_COMMIT = "commit:";
|
|
@@ -8856,7 +9012,7 @@ function getChangedCsFiles(scope) {
|
|
|
8856
9012
|
} else {
|
|
8857
9013
|
cmd = "git diff --name-only HEAD";
|
|
8858
9014
|
}
|
|
8859
|
-
const output =
|
|
9015
|
+
const output = execSync25(cmd, { encoding: "utf-8" }).trim();
|
|
8860
9016
|
if (output === "") return [];
|
|
8861
9017
|
return output.split("\n").filter((f) => f.toLowerCase().endsWith(".cs"));
|
|
8862
9018
|
}
|
|
@@ -9054,14 +9210,14 @@ function parseInspectReport(json) {
|
|
|
9054
9210
|
}
|
|
9055
9211
|
|
|
9056
9212
|
// src/commands/dotnet/runInspectCode.ts
|
|
9057
|
-
import { execSync as
|
|
9213
|
+
import { execSync as execSync26 } from "child_process";
|
|
9058
9214
|
import { existsSync as existsSync29, readFileSync as readFileSync24, unlinkSync as unlinkSync6 } from "fs";
|
|
9059
9215
|
import { tmpdir as tmpdir3 } from "os";
|
|
9060
9216
|
import path25 from "path";
|
|
9061
9217
|
import chalk103 from "chalk";
|
|
9062
9218
|
function assertJbInstalled() {
|
|
9063
9219
|
try {
|
|
9064
|
-
|
|
9220
|
+
execSync26("jb inspectcode --version", { stdio: "pipe" });
|
|
9065
9221
|
} catch {
|
|
9066
9222
|
console.error(chalk103.red("jb is not installed. Install with:"));
|
|
9067
9223
|
console.error(
|
|
@@ -9075,7 +9231,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
9075
9231
|
const includeFlag = include ? ` --include="${include}"` : "";
|
|
9076
9232
|
const sweaFlag = swea ? " --swea" : "";
|
|
9077
9233
|
try {
|
|
9078
|
-
|
|
9234
|
+
execSync26(
|
|
9079
9235
|
`jb inspectcode "${slnPath}" -o="${reportPath}"${includeFlag}${sweaFlag} --verbosity=OFF`,
|
|
9080
9236
|
{ stdio: "pipe" }
|
|
9081
9237
|
);
|
|
@@ -9096,7 +9252,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
9096
9252
|
}
|
|
9097
9253
|
|
|
9098
9254
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
9099
|
-
import { execSync as
|
|
9255
|
+
import { execSync as execSync27 } from "child_process";
|
|
9100
9256
|
import chalk104 from "chalk";
|
|
9101
9257
|
function resolveMsbuildPath() {
|
|
9102
9258
|
const { run: run4 } = loadConfig();
|
|
@@ -9107,7 +9263,7 @@ function resolveMsbuildPath() {
|
|
|
9107
9263
|
function assertMsbuildInstalled() {
|
|
9108
9264
|
const msbuild = resolveMsbuildPath();
|
|
9109
9265
|
try {
|
|
9110
|
-
|
|
9266
|
+
execSync27(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
9111
9267
|
} catch {
|
|
9112
9268
|
console.error(chalk104.red(`msbuild not found at: ${msbuild}`));
|
|
9113
9269
|
console.error(
|
|
@@ -9133,7 +9289,7 @@ function runRoslynInspect(slnPath) {
|
|
|
9133
9289
|
const msbuild = resolveMsbuildPath();
|
|
9134
9290
|
let output;
|
|
9135
9291
|
try {
|
|
9136
|
-
output =
|
|
9292
|
+
output = execSync27(
|
|
9137
9293
|
`"${msbuild}" "${slnPath}" -t:Build -v:minimal -maxcpucount -p:EnforceCodeStyleInBuild=true -p:RunAnalyzersDuringBuild=true 2>&1`,
|
|
9138
9294
|
{ encoding: "utf-8", stdio: "pipe", maxBuffer: 50 * 1024 * 1024 }
|
|
9139
9295
|
);
|
|
@@ -9407,7 +9563,7 @@ function registerGithub(program2) {
|
|
|
9407
9563
|
}
|
|
9408
9564
|
|
|
9409
9565
|
// src/commands/handover/archive.ts
|
|
9410
|
-
import { existsSync as existsSync30, mkdirSync as
|
|
9566
|
+
import { existsSync as existsSync30, mkdirSync as mkdirSync9, renameSync as renameSync2 } from "fs";
|
|
9411
9567
|
import { join as join30 } from "path";
|
|
9412
9568
|
|
|
9413
9569
|
// src/commands/handover/formatArchiveTimestamp.ts
|
|
@@ -9454,7 +9610,7 @@ function archive(options2 = {}) {
|
|
|
9454
9610
|
const handoverPath = getHandoverPath(cwd);
|
|
9455
9611
|
if (!existsSync30(handoverPath)) return void 0;
|
|
9456
9612
|
const archiveDir = getHandoverArchiveDir(cwd);
|
|
9457
|
-
|
|
9613
|
+
mkdirSync9(archiveDir, { recursive: true });
|
|
9458
9614
|
const timestamp = formatArchiveTimestamp(options2.now);
|
|
9459
9615
|
const destination = resolveCollisionPath(
|
|
9460
9616
|
archiveDir,
|
|
@@ -9492,7 +9648,7 @@ function resolveLoadOptions(options2) {
|
|
|
9492
9648
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
9493
9649
|
|
|
9494
9650
|
// src/commands/sessions/summarise/iterateUserEntries.ts
|
|
9495
|
-
import * as
|
|
9651
|
+
import * as fs16 from "fs";
|
|
9496
9652
|
|
|
9497
9653
|
// src/commands/sessions/summarise/parseUserLine.ts
|
|
9498
9654
|
function parseUserLine(line) {
|
|
@@ -9523,7 +9679,7 @@ function parseUserLine(line) {
|
|
|
9523
9679
|
function* iterateUserEntries(filePath) {
|
|
9524
9680
|
let content;
|
|
9525
9681
|
try {
|
|
9526
|
-
content =
|
|
9682
|
+
content = fs16.readFileSync(filePath, "utf8");
|
|
9527
9683
|
} catch {
|
|
9528
9684
|
return;
|
|
9529
9685
|
}
|
|
@@ -9695,12 +9851,12 @@ function adfToText(doc) {
|
|
|
9695
9851
|
}
|
|
9696
9852
|
|
|
9697
9853
|
// src/commands/jira/fetchIssue.ts
|
|
9698
|
-
import { execSync as
|
|
9854
|
+
import { execSync as execSync28 } from "child_process";
|
|
9699
9855
|
import chalk108 from "chalk";
|
|
9700
9856
|
function fetchIssue(issueKey, fields) {
|
|
9701
9857
|
let result;
|
|
9702
9858
|
try {
|
|
9703
|
-
result =
|
|
9859
|
+
result = execSync28(
|
|
9704
9860
|
`acli jira workitem view ${issueKey} -f ${fields} --json`,
|
|
9705
9861
|
{ encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
9706
9862
|
);
|
|
@@ -9746,14 +9902,14 @@ function acceptanceCriteria(issueKey) {
|
|
|
9746
9902
|
}
|
|
9747
9903
|
|
|
9748
9904
|
// src/commands/jira/jiraAuth.ts
|
|
9749
|
-
import { execSync as
|
|
9905
|
+
import { execSync as execSync29 } from "child_process";
|
|
9750
9906
|
|
|
9751
9907
|
// src/shared/loadJson.ts
|
|
9752
|
-
import { existsSync as existsSync32, mkdirSync as
|
|
9753
|
-
import { homedir as
|
|
9908
|
+
import { existsSync as existsSync32, mkdirSync as mkdirSync10, readFileSync as readFileSync27, writeFileSync as writeFileSync20 } from "fs";
|
|
9909
|
+
import { homedir as homedir10 } from "os";
|
|
9754
9910
|
import { join as join31 } from "path";
|
|
9755
9911
|
function getStoreDir() {
|
|
9756
|
-
return join31(
|
|
9912
|
+
return join31(homedir10(), ".assist");
|
|
9757
9913
|
}
|
|
9758
9914
|
function getStorePath(filename) {
|
|
9759
9915
|
return join31(getStoreDir(), filename);
|
|
@@ -9772,7 +9928,7 @@ function loadJson(filename) {
|
|
|
9772
9928
|
function saveJson(filename, data) {
|
|
9773
9929
|
const dir = getStoreDir();
|
|
9774
9930
|
if (!existsSync32(dir)) {
|
|
9775
|
-
|
|
9931
|
+
mkdirSync10(dir, { recursive: true });
|
|
9776
9932
|
}
|
|
9777
9933
|
writeFileSync20(getStorePath(filename), JSON.stringify(data, null, 2));
|
|
9778
9934
|
}
|
|
@@ -9810,7 +9966,7 @@ async function jiraAuth() {
|
|
|
9810
9966
|
console.error("All fields are required.");
|
|
9811
9967
|
process.exit(1);
|
|
9812
9968
|
}
|
|
9813
|
-
|
|
9969
|
+
execSync29(`acli jira auth login --site ${site} --email "${email}" --token`, {
|
|
9814
9970
|
encoding: "utf-8",
|
|
9815
9971
|
input: token,
|
|
9816
9972
|
stdio: ["pipe", "inherit", "inherit"]
|
|
@@ -9907,7 +10063,7 @@ function registerList(program2) {
|
|
|
9907
10063
|
}
|
|
9908
10064
|
|
|
9909
10065
|
// src/commands/mermaid/index.ts
|
|
9910
|
-
import { mkdirSync as
|
|
10066
|
+
import { mkdirSync as mkdirSync11, readdirSync as readdirSync5 } from "fs";
|
|
9911
10067
|
import { resolve as resolve10 } from "path";
|
|
9912
10068
|
import chalk114 from "chalk";
|
|
9913
10069
|
|
|
@@ -9976,7 +10132,7 @@ function extractMermaidBlocks(markdown) {
|
|
|
9976
10132
|
async function mermaidExport(file, options2 = {}) {
|
|
9977
10133
|
const { mermaid } = loadConfig();
|
|
9978
10134
|
const outDir = resolve10(process.cwd(), options2.out ?? ".");
|
|
9979
|
-
|
|
10135
|
+
mkdirSync11(outDir, { recursive: true });
|
|
9980
10136
|
if (options2.index !== void 0) {
|
|
9981
10137
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
9982
10138
|
console.error(
|
|
@@ -10292,7 +10448,7 @@ function registerPrompts(program2) {
|
|
|
10292
10448
|
}
|
|
10293
10449
|
|
|
10294
10450
|
// src/commands/prs/shared.ts
|
|
10295
|
-
import { execSync as
|
|
10451
|
+
import { execSync as execSync30 } from "child_process";
|
|
10296
10452
|
function isGhNotInstalled(error) {
|
|
10297
10453
|
if (error instanceof Error) {
|
|
10298
10454
|
const msg = error.message.toLowerCase();
|
|
@@ -10310,12 +10466,12 @@ function getRepoInfo() {
|
|
|
10310
10466
|
const preferred = getPreferredRemoteRepo();
|
|
10311
10467
|
if (preferred) return preferred;
|
|
10312
10468
|
const repoInfo = JSON.parse(
|
|
10313
|
-
|
|
10469
|
+
execSync30("gh repo view --json owner,name", { encoding: "utf-8" })
|
|
10314
10470
|
);
|
|
10315
10471
|
return { org: repoInfo.owner.login, repo: repoInfo.name };
|
|
10316
10472
|
}
|
|
10317
10473
|
function getCurrentBranch() {
|
|
10318
|
-
return
|
|
10474
|
+
return execSync30("git rev-parse --abbrev-ref HEAD", {
|
|
10319
10475
|
encoding: "utf-8"
|
|
10320
10476
|
}).trim();
|
|
10321
10477
|
}
|
|
@@ -10323,7 +10479,7 @@ function viewCurrentPr(fields) {
|
|
|
10323
10479
|
const { org, repo } = getRepoInfo();
|
|
10324
10480
|
const branch = getCurrentBranch();
|
|
10325
10481
|
return JSON.parse(
|
|
10326
|
-
|
|
10482
|
+
execSync30(`gh pr view ${branch} --json ${fields} -R ${org}/${repo}`, {
|
|
10327
10483
|
encoding: "utf-8"
|
|
10328
10484
|
})
|
|
10329
10485
|
);
|
|
@@ -10405,7 +10561,7 @@ function comment2(path53, line, body, startLine) {
|
|
|
10405
10561
|
}
|
|
10406
10562
|
|
|
10407
10563
|
// src/commands/prs/create.ts
|
|
10408
|
-
import { execSync as
|
|
10564
|
+
import { execSync as execSync31 } from "child_process";
|
|
10409
10565
|
|
|
10410
10566
|
// src/commands/prs/buildCreateArgs.ts
|
|
10411
10567
|
function buildCreateArgs(title, body, options2) {
|
|
@@ -10460,17 +10616,17 @@ function create(options2) {
|
|
|
10460
10616
|
validatePrContent(options2.title, options2.body);
|
|
10461
10617
|
const args = buildCreateArgs(options2.title, options2.body, options2);
|
|
10462
10618
|
try {
|
|
10463
|
-
|
|
10619
|
+
execSync31(args.join(" "), { stdio: "inherit" });
|
|
10464
10620
|
} catch (_error) {
|
|
10465
10621
|
process.exit(1);
|
|
10466
10622
|
}
|
|
10467
10623
|
}
|
|
10468
10624
|
|
|
10469
10625
|
// src/commands/prs/fixed.ts
|
|
10470
|
-
import { execSync as
|
|
10626
|
+
import { execSync as execSync33 } from "child_process";
|
|
10471
10627
|
|
|
10472
10628
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
10473
|
-
import { execSync as
|
|
10629
|
+
import { execSync as execSync32 } from "child_process";
|
|
10474
10630
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync22 } from "fs";
|
|
10475
10631
|
import { tmpdir as tmpdir5 } from "os";
|
|
10476
10632
|
import { join as join33 } from "path";
|
|
@@ -10500,7 +10656,7 @@ function deleteCommentsCache(prNumber) {
|
|
|
10500
10656
|
|
|
10501
10657
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
10502
10658
|
function replyToComment(org, repo, prNumber, commentId, message) {
|
|
10503
|
-
|
|
10659
|
+
execSync32(
|
|
10504
10660
|
`gh api repos/${org}/${repo}/pulls/${prNumber}/comments -f body="${message.replace(/"/g, '\\"')}" -F in_reply_to=${commentId}`,
|
|
10505
10661
|
{ stdio: ["inherit", "pipe", "inherit"] }
|
|
10506
10662
|
);
|
|
@@ -10510,7 +10666,7 @@ function resolveThread(threadId) {
|
|
|
10510
10666
|
const queryFile = join33(tmpdir5(), `gh-mutation-${Date.now()}.graphql`);
|
|
10511
10667
|
writeFileSync22(queryFile, mutation);
|
|
10512
10668
|
try {
|
|
10513
|
-
|
|
10669
|
+
execSync32(
|
|
10514
10670
|
`gh api graphql -F query=@${queryFile} -f threadId="${threadId}"`,
|
|
10515
10671
|
{ stdio: ["inherit", "pipe", "inherit"] }
|
|
10516
10672
|
);
|
|
@@ -10562,7 +10718,7 @@ function resolveCommentWithReply(commentId, message) {
|
|
|
10562
10718
|
// src/commands/prs/fixed.ts
|
|
10563
10719
|
function verifySha(sha) {
|
|
10564
10720
|
try {
|
|
10565
|
-
return
|
|
10721
|
+
return execSync33(`git rev-parse --verify ${sha}`, {
|
|
10566
10722
|
encoding: "utf-8"
|
|
10567
10723
|
}).trim();
|
|
10568
10724
|
} catch {
|
|
@@ -10576,7 +10732,7 @@ function fixed(commentId, sha) {
|
|
|
10576
10732
|
const { org, repo } = getRepoInfo();
|
|
10577
10733
|
const repoUrl = `https://github.com/${org}/${repo}`;
|
|
10578
10734
|
const message = `Fixed in [${fullSha}](${repoUrl}/commit/${fullSha})`;
|
|
10579
|
-
|
|
10735
|
+
execSync33("git push", { stdio: "inherit" });
|
|
10580
10736
|
resolveCommentWithReply(commentId, message);
|
|
10581
10737
|
} catch (error) {
|
|
10582
10738
|
if (isGhNotInstalled(error)) {
|
|
@@ -10589,12 +10745,12 @@ function fixed(commentId, sha) {
|
|
|
10589
10745
|
}
|
|
10590
10746
|
|
|
10591
10747
|
// src/commands/prs/listComments/index.ts
|
|
10592
|
-
import { existsSync as existsSync34, mkdirSync as
|
|
10748
|
+
import { existsSync as existsSync34, mkdirSync as mkdirSync12, writeFileSync as writeFileSync24 } from "fs";
|
|
10593
10749
|
import { join as join35 } from "path";
|
|
10594
10750
|
import { stringify } from "yaml";
|
|
10595
10751
|
|
|
10596
10752
|
// src/commands/prs/fetchThreadIds.ts
|
|
10597
|
-
import { execSync as
|
|
10753
|
+
import { execSync as execSync34 } from "child_process";
|
|
10598
10754
|
import { unlinkSync as unlinkSync10, writeFileSync as writeFileSync23 } from "fs";
|
|
10599
10755
|
import { tmpdir as tmpdir6 } from "os";
|
|
10600
10756
|
import { join as join34 } from "path";
|
|
@@ -10603,7 +10759,7 @@ function fetchThreadIds(org, repo, prNumber) {
|
|
|
10603
10759
|
const queryFile = join34(tmpdir6(), `gh-query-${Date.now()}.graphql`);
|
|
10604
10760
|
writeFileSync23(queryFile, THREAD_QUERY);
|
|
10605
10761
|
try {
|
|
10606
|
-
const result =
|
|
10762
|
+
const result = execSync34(
|
|
10607
10763
|
`gh api graphql -F query=@${queryFile} -F owner="${org}" -F repo="${repo}" -F prNumber=${prNumber}`,
|
|
10608
10764
|
{ encoding: "utf-8" }
|
|
10609
10765
|
);
|
|
@@ -10625,9 +10781,9 @@ function fetchThreadIds(org, repo, prNumber) {
|
|
|
10625
10781
|
}
|
|
10626
10782
|
|
|
10627
10783
|
// src/commands/prs/listComments/fetchReviewComments.ts
|
|
10628
|
-
import { execSync as
|
|
10784
|
+
import { execSync as execSync35 } from "child_process";
|
|
10629
10785
|
function fetchJson(endpoint) {
|
|
10630
|
-
const result =
|
|
10786
|
+
const result = execSync35(`gh api --paginate ${endpoint}`, {
|
|
10631
10787
|
encoding: "utf-8"
|
|
10632
10788
|
});
|
|
10633
10789
|
if (!result.trim()) return [];
|
|
@@ -10716,7 +10872,7 @@ function printComments2(result) {
|
|
|
10716
10872
|
function writeCommentsCache(prNumber, comments3) {
|
|
10717
10873
|
const assistDir = join35(process.cwd(), ".assist");
|
|
10718
10874
|
if (!existsSync34(assistDir)) {
|
|
10719
|
-
|
|
10875
|
+
mkdirSync12(assistDir, { recursive: true });
|
|
10720
10876
|
}
|
|
10721
10877
|
const cacheData = {
|
|
10722
10878
|
prNumber,
|
|
@@ -10766,7 +10922,7 @@ async function listComments() {
|
|
|
10766
10922
|
}
|
|
10767
10923
|
|
|
10768
10924
|
// src/commands/prs/prs/index.ts
|
|
10769
|
-
import { execSync as
|
|
10925
|
+
import { execSync as execSync36 } from "child_process";
|
|
10770
10926
|
|
|
10771
10927
|
// src/commands/prs/prs/displayPaginated/index.ts
|
|
10772
10928
|
import enquirer9 from "enquirer";
|
|
@@ -10873,7 +11029,7 @@ async function prs(options2) {
|
|
|
10873
11029
|
const state = options2.open ? "open" : options2.closed ? "closed" : "all";
|
|
10874
11030
|
try {
|
|
10875
11031
|
const { org, repo } = getRepoInfo();
|
|
10876
|
-
const result =
|
|
11032
|
+
const result = execSync36(
|
|
10877
11033
|
`gh pr list --state ${state} --json number,title,url,author,createdAt,mergedAt,closedAt,state,changedFiles --limit 100 -R ${org}/${repo}`,
|
|
10878
11034
|
{ encoding: "utf-8" }
|
|
10879
11035
|
);
|
|
@@ -10896,7 +11052,7 @@ async function prs(options2) {
|
|
|
10896
11052
|
}
|
|
10897
11053
|
|
|
10898
11054
|
// src/commands/prs/wontfix.ts
|
|
10899
|
-
import { execSync as
|
|
11055
|
+
import { execSync as execSync37 } from "child_process";
|
|
10900
11056
|
function validateReason(reason) {
|
|
10901
11057
|
const lowerReason = reason.toLowerCase();
|
|
10902
11058
|
if (lowerReason.includes("claude") || lowerReason.includes("opus")) {
|
|
@@ -10913,7 +11069,7 @@ function validateShaReferences(reason) {
|
|
|
10913
11069
|
const invalidShas = [];
|
|
10914
11070
|
for (const sha of shas) {
|
|
10915
11071
|
try {
|
|
10916
|
-
|
|
11072
|
+
execSync37(`git cat-file -t ${sha}`, { stdio: "pipe" });
|
|
10917
11073
|
} catch {
|
|
10918
11074
|
invalidShas.push(sha);
|
|
10919
11075
|
}
|
|
@@ -11048,10 +11204,10 @@ import chalk122 from "chalk";
|
|
|
11048
11204
|
import Enquirer2 from "enquirer";
|
|
11049
11205
|
|
|
11050
11206
|
// src/commands/ravendb/searchItems.ts
|
|
11051
|
-
import { execSync as
|
|
11207
|
+
import { execSync as execSync38 } from "child_process";
|
|
11052
11208
|
import chalk121 from "chalk";
|
|
11053
11209
|
function opExec(args) {
|
|
11054
|
-
return
|
|
11210
|
+
return execSync38(`op ${args}`, {
|
|
11055
11211
|
encoding: "utf-8",
|
|
11056
11212
|
stdio: ["pipe", "pipe", "pipe"]
|
|
11057
11213
|
}).trim();
|
|
@@ -11203,7 +11359,7 @@ ${errorText}`
|
|
|
11203
11359
|
}
|
|
11204
11360
|
|
|
11205
11361
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
11206
|
-
import { execSync as
|
|
11362
|
+
import { execSync as execSync39 } from "child_process";
|
|
11207
11363
|
import chalk126 from "chalk";
|
|
11208
11364
|
function resolveOpSecret(reference) {
|
|
11209
11365
|
if (!reference.startsWith("op://")) {
|
|
@@ -11211,7 +11367,7 @@ function resolveOpSecret(reference) {
|
|
|
11211
11367
|
process.exit(1);
|
|
11212
11368
|
}
|
|
11213
11369
|
try {
|
|
11214
|
-
return
|
|
11370
|
+
return execSync39(`op read "${reference}"`, {
|
|
11215
11371
|
encoding: "utf-8",
|
|
11216
11372
|
stdio: ["pipe", "pipe", "pipe"]
|
|
11217
11373
|
}).trim();
|
|
@@ -11460,18 +11616,18 @@ Refactor check failed:
|
|
|
11460
11616
|
}
|
|
11461
11617
|
|
|
11462
11618
|
// src/commands/refactor/check/getViolations/index.ts
|
|
11463
|
-
import { execSync as
|
|
11464
|
-
import
|
|
11465
|
-
import { minimatch as
|
|
11619
|
+
import { execSync as execSync40 } from "child_process";
|
|
11620
|
+
import fs18 from "fs";
|
|
11621
|
+
import { minimatch as minimatch5 } from "minimatch";
|
|
11466
11622
|
|
|
11467
11623
|
// src/commands/refactor/check/getViolations/getIgnoredFiles.ts
|
|
11468
|
-
import
|
|
11624
|
+
import fs17 from "fs";
|
|
11469
11625
|
var REFACTOR_YML_PATH = "refactor.yml";
|
|
11470
11626
|
function parseRefactorYml() {
|
|
11471
|
-
if (!
|
|
11627
|
+
if (!fs17.existsSync(REFACTOR_YML_PATH)) {
|
|
11472
11628
|
return [];
|
|
11473
11629
|
}
|
|
11474
|
-
const content =
|
|
11630
|
+
const content = fs17.readFileSync(REFACTOR_YML_PATH, "utf-8");
|
|
11475
11631
|
const entries = [];
|
|
11476
11632
|
const lines = content.split("\n");
|
|
11477
11633
|
let currentEntry = {};
|
|
@@ -11501,7 +11657,7 @@ function getIgnoredFiles() {
|
|
|
11501
11657
|
|
|
11502
11658
|
// src/commands/refactor/check/getViolations/index.ts
|
|
11503
11659
|
function countLines(filePath) {
|
|
11504
|
-
const content =
|
|
11660
|
+
const content = fs18.readFileSync(filePath, "utf-8");
|
|
11505
11661
|
return content.split("\n").length;
|
|
11506
11662
|
}
|
|
11507
11663
|
function getGitFiles(options2) {
|
|
@@ -11510,7 +11666,7 @@ function getGitFiles(options2) {
|
|
|
11510
11666
|
}
|
|
11511
11667
|
const files = /* @__PURE__ */ new Set();
|
|
11512
11668
|
if (options2.staged || options2.modified) {
|
|
11513
|
-
const staged =
|
|
11669
|
+
const staged = execSync40("git diff --cached --name-only", {
|
|
11514
11670
|
encoding: "utf-8"
|
|
11515
11671
|
});
|
|
11516
11672
|
for (const file of staged.trim().split("\n").filter(Boolean)) {
|
|
@@ -11518,7 +11674,7 @@ function getGitFiles(options2) {
|
|
|
11518
11674
|
}
|
|
11519
11675
|
}
|
|
11520
11676
|
if (options2.unstaged || options2.modified) {
|
|
11521
|
-
const unstaged =
|
|
11677
|
+
const unstaged = execSync40("git diff --name-only", { encoding: "utf-8" });
|
|
11522
11678
|
for (const file of unstaged.trim().split("\n").filter(Boolean)) {
|
|
11523
11679
|
files.add(file);
|
|
11524
11680
|
}
|
|
@@ -11530,7 +11686,7 @@ function getViolations(pattern2, options2 = {}, maxLines = DEFAULT_MAX_LINES) {
|
|
|
11530
11686
|
const ignoredFiles = getIgnoredFiles();
|
|
11531
11687
|
const gitFiles = getGitFiles(options2);
|
|
11532
11688
|
if (pattern2) {
|
|
11533
|
-
sourceFiles = sourceFiles.filter((f) =>
|
|
11689
|
+
sourceFiles = sourceFiles.filter((f) => minimatch5(f, pattern2));
|
|
11534
11690
|
}
|
|
11535
11691
|
if (gitFiles) {
|
|
11536
11692
|
sourceFiles = sourceFiles.filter((f) => gitFiles.has(f));
|
|
@@ -12232,15 +12388,15 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
12232
12388
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
12233
12389
|
import path32 from "path";
|
|
12234
12390
|
import chalk134 from "chalk";
|
|
12235
|
-
import { Project as
|
|
12391
|
+
import { Project as Project4 } from "ts-morph";
|
|
12236
12392
|
|
|
12237
12393
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
12238
|
-
import
|
|
12394
|
+
import fs19 from "fs";
|
|
12239
12395
|
import path31 from "path";
|
|
12240
|
-
import { Project as
|
|
12396
|
+
import { Project as Project3 } from "ts-morph";
|
|
12241
12397
|
function findTsConfig(sourcePath) {
|
|
12242
12398
|
const rootConfig = path31.resolve("tsconfig.json");
|
|
12243
|
-
if (!
|
|
12399
|
+
if (!fs19.existsSync(rootConfig)) return rootConfig;
|
|
12244
12400
|
const tried = /* @__PURE__ */ new Set();
|
|
12245
12401
|
const candidates = [rootConfig, ...readReferences(rootConfig)];
|
|
12246
12402
|
for (const candidate of candidates) {
|
|
@@ -12248,7 +12404,7 @@ function findTsConfig(sourcePath) {
|
|
|
12248
12404
|
tried.add(candidate);
|
|
12249
12405
|
if (projectIncludes(candidate, sourcePath)) return candidate;
|
|
12250
12406
|
}
|
|
12251
|
-
const siblings =
|
|
12407
|
+
const siblings = fs19.readdirSync(path31.dirname(rootConfig)).filter((f) => /^tsconfig.*\.json$/.test(f)).map((f) => path31.resolve(path31.dirname(rootConfig), f));
|
|
12252
12408
|
for (const sibling of siblings) {
|
|
12253
12409
|
if (tried.has(sibling)) continue;
|
|
12254
12410
|
tried.add(sibling);
|
|
@@ -12257,8 +12413,8 @@ function findTsConfig(sourcePath) {
|
|
|
12257
12413
|
return rootConfig;
|
|
12258
12414
|
}
|
|
12259
12415
|
function readReferences(configPath) {
|
|
12260
|
-
if (!
|
|
12261
|
-
const raw =
|
|
12416
|
+
if (!fs19.existsSync(configPath)) return [];
|
|
12417
|
+
const raw = fs19.readFileSync(configPath, "utf-8");
|
|
12262
12418
|
const stripped = raw.replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
12263
12419
|
let parsed;
|
|
12264
12420
|
try {
|
|
@@ -12270,12 +12426,12 @@ function readReferences(configPath) {
|
|
|
12270
12426
|
const cwd = path31.dirname(configPath);
|
|
12271
12427
|
return parsed.references.map((ref) => {
|
|
12272
12428
|
const refPath = path31.resolve(cwd, ref.path);
|
|
12273
|
-
return
|
|
12274
|
-
}).filter((p) =>
|
|
12429
|
+
return fs19.statSync(refPath, { throwIfNoEntry: false })?.isDirectory() ? path31.join(refPath, "tsconfig.json") : refPath;
|
|
12430
|
+
}).filter((p) => fs19.existsSync(p));
|
|
12275
12431
|
}
|
|
12276
12432
|
function projectIncludes(configPath, sourcePath) {
|
|
12277
12433
|
try {
|
|
12278
|
-
const project = new
|
|
12434
|
+
const project = new Project3({ tsConfigFilePath: configPath });
|
|
12279
12435
|
return !!project.getSourceFile(sourcePath);
|
|
12280
12436
|
} catch {
|
|
12281
12437
|
return false;
|
|
@@ -12286,7 +12442,7 @@ function projectIncludes(configPath, sourcePath) {
|
|
|
12286
12442
|
function loadProjectFile(file) {
|
|
12287
12443
|
const sourcePath = path32.resolve(file);
|
|
12288
12444
|
const tsConfigPath = findTsConfig(sourcePath);
|
|
12289
|
-
const project = new
|
|
12445
|
+
const project = new Project4({
|
|
12290
12446
|
tsConfigFilePath: tsConfigPath
|
|
12291
12447
|
});
|
|
12292
12448
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
@@ -12321,25 +12477,25 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
12321
12477
|
}
|
|
12322
12478
|
|
|
12323
12479
|
// src/commands/refactor/ignore.ts
|
|
12324
|
-
import
|
|
12480
|
+
import fs20 from "fs";
|
|
12325
12481
|
import chalk136 from "chalk";
|
|
12326
12482
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
12327
12483
|
function ignore(file) {
|
|
12328
|
-
if (!
|
|
12484
|
+
if (!fs20.existsSync(file)) {
|
|
12329
12485
|
console.error(chalk136.red(`Error: File does not exist: ${file}`));
|
|
12330
12486
|
process.exit(1);
|
|
12331
12487
|
}
|
|
12332
|
-
const content =
|
|
12488
|
+
const content = fs20.readFileSync(file, "utf-8");
|
|
12333
12489
|
const lineCount = content.split("\n").length;
|
|
12334
12490
|
const maxLines = lineCount + 10;
|
|
12335
12491
|
const entry = `- file: ${file}
|
|
12336
12492
|
maxLines: ${maxLines}
|
|
12337
12493
|
`;
|
|
12338
|
-
if (
|
|
12339
|
-
const existing =
|
|
12340
|
-
|
|
12494
|
+
if (fs20.existsSync(REFACTOR_YML_PATH2)) {
|
|
12495
|
+
const existing = fs20.readFileSync(REFACTOR_YML_PATH2, "utf-8");
|
|
12496
|
+
fs20.writeFileSync(REFACTOR_YML_PATH2, existing + entry);
|
|
12341
12497
|
} else {
|
|
12342
|
-
|
|
12498
|
+
fs20.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
12343
12499
|
}
|
|
12344
12500
|
console.log(
|
|
12345
12501
|
chalk136.green(
|
|
@@ -12587,7 +12743,7 @@ function clusterFiles(graph) {
|
|
|
12587
12743
|
import path39 from "path";
|
|
12588
12744
|
|
|
12589
12745
|
// src/commands/refactor/restructure/computeRewrites/applyRewrites.ts
|
|
12590
|
-
import
|
|
12746
|
+
import fs21 from "fs";
|
|
12591
12747
|
function getOrCreateList(map, key) {
|
|
12592
12748
|
const list4 = map.get(key) ?? [];
|
|
12593
12749
|
if (!map.has(key)) map.set(key, list4);
|
|
@@ -12606,7 +12762,7 @@ function rewriteSpecifier(content, oldSpecifier, newSpecifier) {
|
|
|
12606
12762
|
return content.replace(pattern2, `$1${newSpecifier}$2`);
|
|
12607
12763
|
}
|
|
12608
12764
|
function applyFileRewrites(file, fileRewrites) {
|
|
12609
|
-
let content =
|
|
12765
|
+
let content = fs21.readFileSync(file, "utf-8");
|
|
12610
12766
|
for (const { oldSpecifier, newSpecifier } of fileRewrites) {
|
|
12611
12767
|
content = rewriteSpecifier(content, oldSpecifier, newSpecifier);
|
|
12612
12768
|
}
|
|
@@ -12734,27 +12890,27 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
12734
12890
|
}
|
|
12735
12891
|
|
|
12736
12892
|
// src/commands/refactor/restructure/executePlan.ts
|
|
12737
|
-
import
|
|
12893
|
+
import fs22 from "fs";
|
|
12738
12894
|
import path41 from "path";
|
|
12739
12895
|
import chalk140 from "chalk";
|
|
12740
12896
|
function executePlan(plan2) {
|
|
12741
12897
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
12742
12898
|
for (const [file, content] of updatedContents) {
|
|
12743
|
-
|
|
12899
|
+
fs22.writeFileSync(file, content, "utf-8");
|
|
12744
12900
|
console.log(
|
|
12745
12901
|
chalk140.cyan(` Rewrote imports in ${path41.relative(process.cwd(), file)}`)
|
|
12746
12902
|
);
|
|
12747
12903
|
}
|
|
12748
12904
|
for (const dir of plan2.newDirectories) {
|
|
12749
|
-
|
|
12905
|
+
fs22.mkdirSync(dir, { recursive: true });
|
|
12750
12906
|
console.log(chalk140.green(` Created ${path41.relative(process.cwd(), dir)}/`));
|
|
12751
12907
|
}
|
|
12752
12908
|
for (const move of plan2.moves) {
|
|
12753
12909
|
const targetDir = path41.dirname(move.to);
|
|
12754
|
-
if (!
|
|
12755
|
-
|
|
12910
|
+
if (!fs22.existsSync(targetDir)) {
|
|
12911
|
+
fs22.mkdirSync(targetDir, { recursive: true });
|
|
12756
12912
|
}
|
|
12757
|
-
|
|
12913
|
+
fs22.renameSync(move.from, move.to);
|
|
12758
12914
|
console.log(
|
|
12759
12915
|
chalk140.white(
|
|
12760
12916
|
` Moved ${path41.relative(process.cwd(), move.from)} \u2192 ${path41.relative(process.cwd(), move.to)}`
|
|
@@ -12766,10 +12922,10 @@ function executePlan(plan2) {
|
|
|
12766
12922
|
function removeEmptyDirectories(dirs) {
|
|
12767
12923
|
const unique = [...new Set(dirs)];
|
|
12768
12924
|
for (const dir of unique) {
|
|
12769
|
-
if (!
|
|
12770
|
-
const entries =
|
|
12925
|
+
if (!fs22.existsSync(dir)) continue;
|
|
12926
|
+
const entries = fs22.readdirSync(dir);
|
|
12771
12927
|
if (entries.length === 0) {
|
|
12772
|
-
|
|
12928
|
+
fs22.rmdirSync(dir);
|
|
12773
12929
|
console.log(
|
|
12774
12930
|
chalk140.dim(
|
|
12775
12931
|
` Removed empty directory ${path41.relative(process.cwd(), dir)}`
|
|
@@ -12783,18 +12939,18 @@ function removeEmptyDirectories(dirs) {
|
|
|
12783
12939
|
import path43 from "path";
|
|
12784
12940
|
|
|
12785
12941
|
// src/commands/refactor/restructure/planFileMoves/shared.ts
|
|
12786
|
-
import
|
|
12942
|
+
import fs23 from "fs";
|
|
12787
12943
|
function emptyResult() {
|
|
12788
12944
|
return { moves: [], directories: [], warnings: [] };
|
|
12789
12945
|
}
|
|
12790
12946
|
function checkDirConflict(result, label2, dir) {
|
|
12791
|
-
if (!
|
|
12947
|
+
if (!fs23.existsSync(dir)) return false;
|
|
12792
12948
|
result.warnings.push(`Skipping ${label2}: directory ${dir} already exists`);
|
|
12793
12949
|
return true;
|
|
12794
12950
|
}
|
|
12795
12951
|
|
|
12796
12952
|
// src/commands/refactor/restructure/planFileMoves/planDirectoryMoves.ts
|
|
12797
|
-
import
|
|
12953
|
+
import fs24 from "fs";
|
|
12798
12954
|
import path42 from "path";
|
|
12799
12955
|
function collectEntry(results, dir, entry) {
|
|
12800
12956
|
const full = path42.join(dir, entry.name);
|
|
@@ -12802,9 +12958,9 @@ function collectEntry(results, dir, entry) {
|
|
|
12802
12958
|
results.push(...items2);
|
|
12803
12959
|
}
|
|
12804
12960
|
function listFilesRecursive(dir) {
|
|
12805
|
-
if (!
|
|
12961
|
+
if (!fs24.existsSync(dir)) return [];
|
|
12806
12962
|
const results = [];
|
|
12807
|
-
for (const entry of
|
|
12963
|
+
for (const entry of fs24.readdirSync(dir, { withFileTypes: true })) {
|
|
12808
12964
|
collectEntry(results, dir, entry);
|
|
12809
12965
|
}
|
|
12810
12966
|
return results;
|
|
@@ -13083,9 +13239,9 @@ function ensureReviewsIgnored(repoRoot) {
|
|
|
13083
13239
|
}
|
|
13084
13240
|
|
|
13085
13241
|
// src/commands/review/fetchExistingComments.ts
|
|
13086
|
-
import { execSync as
|
|
13242
|
+
import { execSync as execSync41 } from "child_process";
|
|
13087
13243
|
function fetchRawComments(org, repo, prNumber) {
|
|
13088
|
-
const out =
|
|
13244
|
+
const out = execSync41(
|
|
13089
13245
|
`gh api --paginate repos/${org}/${repo}/pulls/${prNumber}/comments`,
|
|
13090
13246
|
{ encoding: "utf-8", maxBuffer: 64 * 1024 * 1024 }
|
|
13091
13247
|
);
|
|
@@ -13116,14 +13272,14 @@ function fetchExistingComments() {
|
|
|
13116
13272
|
}
|
|
13117
13273
|
|
|
13118
13274
|
// src/commands/review/gatherContext.ts
|
|
13119
|
-
import { execSync as
|
|
13275
|
+
import { execSync as execSync44 } from "child_process";
|
|
13120
13276
|
|
|
13121
13277
|
// src/commands/review/fetchPrDiff.ts
|
|
13122
|
-
import { execSync as
|
|
13278
|
+
import { execSync as execSync42 } from "child_process";
|
|
13123
13279
|
function fetchPrDiff(prNumber, baseSha, headSha) {
|
|
13124
13280
|
const { org, repo } = getRepoInfo();
|
|
13125
13281
|
try {
|
|
13126
|
-
return
|
|
13282
|
+
return execSync42(`gh pr diff ${prNumber} -R ${org}/${repo}`, {
|
|
13127
13283
|
encoding: "utf-8",
|
|
13128
13284
|
maxBuffer: 256 * 1024 * 1024,
|
|
13129
13285
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -13138,19 +13294,19 @@ function isDiffTooLarge(error) {
|
|
|
13138
13294
|
}
|
|
13139
13295
|
function fetchDiffViaGit(baseSha, headSha) {
|
|
13140
13296
|
try {
|
|
13141
|
-
|
|
13297
|
+
execSync42(`git fetch origin ${baseSha} ${headSha}`, { stdio: "ignore" });
|
|
13142
13298
|
} catch {
|
|
13143
13299
|
}
|
|
13144
|
-
return
|
|
13300
|
+
return execSync42(`git diff ${baseSha}...${headSha}`, {
|
|
13145
13301
|
encoding: "utf-8",
|
|
13146
13302
|
maxBuffer: 256 * 1024 * 1024
|
|
13147
13303
|
});
|
|
13148
13304
|
}
|
|
13149
13305
|
|
|
13150
13306
|
// src/commands/review/fetchPrDiffInfo.ts
|
|
13151
|
-
import { execSync as
|
|
13307
|
+
import { execSync as execSync43 } from "child_process";
|
|
13152
13308
|
function getCurrentBranch2() {
|
|
13153
|
-
return
|
|
13309
|
+
return execSync43("git rev-parse --abbrev-ref HEAD", {
|
|
13154
13310
|
encoding: "utf-8"
|
|
13155
13311
|
}).trim();
|
|
13156
13312
|
}
|
|
@@ -13160,7 +13316,7 @@ function fetchPrDiffInfo() {
|
|
|
13160
13316
|
const fields = "number,baseRefName,baseRefOid,headRefName,headRefOid";
|
|
13161
13317
|
let raw;
|
|
13162
13318
|
try {
|
|
13163
|
-
raw =
|
|
13319
|
+
raw = execSync43(`gh pr view ${branch} --json ${fields} -R ${org}/${repo}`, {
|
|
13164
13320
|
encoding: "utf-8",
|
|
13165
13321
|
stdio: ["ignore", "pipe", "pipe"]
|
|
13166
13322
|
});
|
|
@@ -13184,7 +13340,7 @@ function fetchPrDiffInfo() {
|
|
|
13184
13340
|
}
|
|
13185
13341
|
function fetchPrChangedFiles(prNumber) {
|
|
13186
13342
|
const { org, repo } = getRepoInfo();
|
|
13187
|
-
const out =
|
|
13343
|
+
const out = execSync43(
|
|
13188
13344
|
`gh api repos/${org}/${repo}/pulls/${prNumber}/files --paginate --jq ".[].filename"`,
|
|
13189
13345
|
{
|
|
13190
13346
|
encoding: "utf-8",
|
|
@@ -13196,11 +13352,11 @@ function fetchPrChangedFiles(prNumber) {
|
|
|
13196
13352
|
|
|
13197
13353
|
// src/commands/review/gatherContext.ts
|
|
13198
13354
|
function gatherContext() {
|
|
13199
|
-
const branch =
|
|
13355
|
+
const branch = execSync44("git rev-parse --abbrev-ref HEAD", {
|
|
13200
13356
|
encoding: "utf-8"
|
|
13201
13357
|
}).trim();
|
|
13202
|
-
const sha =
|
|
13203
|
-
const shortSha =
|
|
13358
|
+
const sha = execSync44("git rev-parse HEAD", { encoding: "utf-8" }).trim();
|
|
13359
|
+
const shortSha = execSync44("git rev-parse --short=7 HEAD", {
|
|
13204
13360
|
encoding: "utf-8"
|
|
13205
13361
|
}).trim();
|
|
13206
13362
|
const prInfo = fetchPrDiffInfo();
|
|
@@ -13528,14 +13684,14 @@ async function handlePostSynthesis(synthesisPath, options2) {
|
|
|
13528
13684
|
}
|
|
13529
13685
|
|
|
13530
13686
|
// src/commands/review/prepareReviewDir.ts
|
|
13531
|
-
import { existsSync as existsSync36, mkdirSync as
|
|
13687
|
+
import { existsSync as existsSync36, mkdirSync as mkdirSync13, unlinkSync as unlinkSync11, writeFileSync as writeFileSync26 } from "fs";
|
|
13532
13688
|
function clearReviewFiles(paths) {
|
|
13533
13689
|
for (const path53 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
13534
13690
|
if (existsSync36(path53)) unlinkSync11(path53);
|
|
13535
13691
|
}
|
|
13536
13692
|
}
|
|
13537
13693
|
function prepareReviewDir(paths, requestBody, force) {
|
|
13538
|
-
|
|
13694
|
+
mkdirSync13(paths.reviewDir, { recursive: true });
|
|
13539
13695
|
if (force) clearReviewFiles(paths);
|
|
13540
13696
|
writeFileSync26(paths.requestPath, requestBody);
|
|
13541
13697
|
}
|
|
@@ -15399,7 +15555,7 @@ async function fixInvalidDatePrefixes(vttFiles) {
|
|
|
15399
15555
|
}
|
|
15400
15556
|
|
|
15401
15557
|
// src/commands/transcript/format/processVttFile/index.ts
|
|
15402
|
-
import { existsSync as existsSync40, mkdirSync as
|
|
15558
|
+
import { existsSync as existsSync40, mkdirSync as mkdirSync14, readFileSync as readFileSync33, writeFileSync as writeFileSync28 } from "fs";
|
|
15403
15559
|
import { basename as basename7, dirname as dirname21, join as join41 } from "path";
|
|
15404
15560
|
|
|
15405
15561
|
// src/commands/transcript/cleanText.ts
|
|
@@ -15625,7 +15781,7 @@ function logSkipped(relativeDir, mdFile) {
|
|
|
15625
15781
|
}
|
|
15626
15782
|
function ensureDirectory(dir, label2) {
|
|
15627
15783
|
if (!existsSync40(dir)) {
|
|
15628
|
-
|
|
15784
|
+
mkdirSync14(dir, { recursive: true });
|
|
15629
15785
|
console.log(`Created ${label2}: ${dir}`);
|
|
15630
15786
|
}
|
|
15631
15787
|
}
|
|
@@ -15724,7 +15880,7 @@ import { basename as basename8, dirname as dirname23, join as join43, relative a
|
|
|
15724
15880
|
// src/commands/transcript/summarise/processStagedFile/index.ts
|
|
15725
15881
|
import {
|
|
15726
15882
|
existsSync as existsSync42,
|
|
15727
|
-
mkdirSync as
|
|
15883
|
+
mkdirSync as mkdirSync15,
|
|
15728
15884
|
readFileSync as readFileSync34,
|
|
15729
15885
|
renameSync as renameSync4,
|
|
15730
15886
|
rmSync as rmSync2
|
|
@@ -15785,7 +15941,7 @@ function processStagedFile() {
|
|
|
15785
15941
|
const destPath = join42(summaryDir, matchingTranscript.relativePath);
|
|
15786
15942
|
const destDir = dirname22(destPath);
|
|
15787
15943
|
if (!existsSync42(destDir)) {
|
|
15788
|
-
|
|
15944
|
+
mkdirSync15(destDir, { recursive: true });
|
|
15789
15945
|
}
|
|
15790
15946
|
renameSync4(stagedFile.absolutePath, destPath);
|
|
15791
15947
|
const remaining = findMdFilesRecursive(STAGING_DIR);
|
|
@@ -15877,6 +16033,7 @@ function registerVerify(program2) {
|
|
|
15877
16033
|
"Write scripts to package.json instead of assist.yml"
|
|
15878
16034
|
).action(init2);
|
|
15879
16035
|
verifyCommand.command("hardcoded-colors").description("Check for hardcoded hex colors in src/").action(hardcodedColors);
|
|
16036
|
+
verifyCommand.command("comment-policy").description("Check for undocumented comments added on changed lines").action(commentPolicy);
|
|
15880
16037
|
verifyCommand.command("no-venv").description("Check that no venv folders exist in the repo").action(noVenv);
|
|
15881
16038
|
}
|
|
15882
16039
|
|
|
@@ -15885,11 +16042,11 @@ import { spawnSync as spawnSync4 } from "child_process";
|
|
|
15885
16042
|
import { join as join45 } from "path";
|
|
15886
16043
|
|
|
15887
16044
|
// src/commands/voice/shared.ts
|
|
15888
|
-
import { homedir as
|
|
16045
|
+
import { homedir as homedir11 } from "os";
|
|
15889
16046
|
import { dirname as dirname24, join as join44 } from "path";
|
|
15890
16047
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
15891
16048
|
var __dirname6 = dirname24(fileURLToPath6(import.meta.url));
|
|
15892
|
-
var VOICE_DIR = join44(
|
|
16049
|
+
var VOICE_DIR = join44(homedir11(), ".assist", "voice");
|
|
15893
16050
|
var voicePaths = {
|
|
15894
16051
|
dir: VOICE_DIR,
|
|
15895
16052
|
pid: join44(VOICE_DIR, "voice.pid"),
|
|
@@ -15947,12 +16104,12 @@ function logs(options2) {
|
|
|
15947
16104
|
|
|
15948
16105
|
// src/commands/voice/setup.ts
|
|
15949
16106
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
15950
|
-
import { mkdirSync as
|
|
16107
|
+
import { mkdirSync as mkdirSync17 } from "fs";
|
|
15951
16108
|
import { join as join47 } from "path";
|
|
15952
16109
|
|
|
15953
16110
|
// src/commands/voice/checkLockFile.ts
|
|
15954
|
-
import { execSync as
|
|
15955
|
-
import { existsSync as existsSync45, mkdirSync as
|
|
16111
|
+
import { execSync as execSync45 } from "child_process";
|
|
16112
|
+
import { existsSync as existsSync45, mkdirSync as mkdirSync16, readFileSync as readFileSync36, writeFileSync as writeFileSync29 } from "fs";
|
|
15956
16113
|
import { join as join46 } from "path";
|
|
15957
16114
|
function isProcessAlive2(pid) {
|
|
15958
16115
|
try {
|
|
@@ -15980,7 +16137,7 @@ function bootstrapVenv() {
|
|
|
15980
16137
|
if (existsSync45(getVenvPython())) return;
|
|
15981
16138
|
console.log("Setting up Python environment...");
|
|
15982
16139
|
const pythonDir = getPythonDir();
|
|
15983
|
-
|
|
16140
|
+
execSync45(
|
|
15984
16141
|
`uv sync --project "${pythonDir}" --extra runtime --no-install-project`,
|
|
15985
16142
|
{
|
|
15986
16143
|
stdio: "inherit",
|
|
@@ -15990,7 +16147,7 @@ function bootstrapVenv() {
|
|
|
15990
16147
|
}
|
|
15991
16148
|
function writeLockFile(pid) {
|
|
15992
16149
|
const lockFile = getLockFile();
|
|
15993
|
-
|
|
16150
|
+
mkdirSync16(join46(lockFile, ".."), { recursive: true });
|
|
15994
16151
|
writeFileSync29(
|
|
15995
16152
|
lockFile,
|
|
15996
16153
|
JSON.stringify({
|
|
@@ -16003,7 +16160,7 @@ function writeLockFile(pid) {
|
|
|
16003
16160
|
|
|
16004
16161
|
// src/commands/voice/setup.ts
|
|
16005
16162
|
function setup() {
|
|
16006
|
-
|
|
16163
|
+
mkdirSync17(voicePaths.dir, { recursive: true });
|
|
16007
16164
|
bootstrapVenv();
|
|
16008
16165
|
console.log("\nDownloading models...\n");
|
|
16009
16166
|
const script = join47(getPythonDir(), "setup_models.py");
|
|
@@ -16019,7 +16176,7 @@ function setup() {
|
|
|
16019
16176
|
|
|
16020
16177
|
// src/commands/voice/start.ts
|
|
16021
16178
|
import { spawn as spawn7 } from "child_process";
|
|
16022
|
-
import { mkdirSync as
|
|
16179
|
+
import { mkdirSync as mkdirSync18, writeFileSync as writeFileSync30 } from "fs";
|
|
16023
16180
|
import { join as join48 } from "path";
|
|
16024
16181
|
|
|
16025
16182
|
// src/commands/voice/buildDaemonEnv.ts
|
|
@@ -16053,7 +16210,7 @@ function spawnBackground(python, script, env) {
|
|
|
16053
16210
|
console.log(`Voice daemon started (PID ${pid})`);
|
|
16054
16211
|
}
|
|
16055
16212
|
function start2(options2) {
|
|
16056
|
-
|
|
16213
|
+
mkdirSync18(voicePaths.dir, { recursive: true });
|
|
16057
16214
|
checkLockFile();
|
|
16058
16215
|
bootstrapVenv();
|
|
16059
16216
|
const debug = options2.debug || options2.foreground || process.platform === "win32";
|
|
@@ -16147,11 +16304,11 @@ import { randomBytes } from "crypto";
|
|
|
16147
16304
|
import chalk156 from "chalk";
|
|
16148
16305
|
|
|
16149
16306
|
// src/lib/openBrowser.ts
|
|
16150
|
-
import { execSync as
|
|
16307
|
+
import { execSync as execSync46 } from "child_process";
|
|
16151
16308
|
function tryExec(commands) {
|
|
16152
16309
|
for (const cmd of commands) {
|
|
16153
16310
|
try {
|
|
16154
|
-
|
|
16311
|
+
execSync46(cmd);
|
|
16155
16312
|
return true;
|
|
16156
16313
|
} catch {
|
|
16157
16314
|
}
|
|
@@ -16501,11 +16658,11 @@ function resolveParams(params, cliArgs) {
|
|
|
16501
16658
|
}
|
|
16502
16659
|
|
|
16503
16660
|
// src/commands/run/runPreCommands.ts
|
|
16504
|
-
import { execSync as
|
|
16661
|
+
import { execSync as execSync47 } from "child_process";
|
|
16505
16662
|
function runPreCommands(pre, cwd) {
|
|
16506
16663
|
for (const cmd of pre) {
|
|
16507
16664
|
try {
|
|
16508
|
-
|
|
16665
|
+
execSync47(cmd, { stdio: "inherit", cwd });
|
|
16509
16666
|
} catch (err) {
|
|
16510
16667
|
const code = err && typeof err === "object" && "status" in err ? err.status : 1;
|
|
16511
16668
|
process.exit(code);
|
|
@@ -16608,7 +16765,7 @@ async function run3(name, args) {
|
|
|
16608
16765
|
}
|
|
16609
16766
|
|
|
16610
16767
|
// src/commands/run/add.ts
|
|
16611
|
-
import { mkdirSync as
|
|
16768
|
+
import { mkdirSync as mkdirSync19, writeFileSync as writeFileSync31 } from "fs";
|
|
16612
16769
|
import { join as join51 } from "path";
|
|
16613
16770
|
|
|
16614
16771
|
// src/commands/run/extractOption.ts
|
|
@@ -16671,7 +16828,7 @@ function saveNewRunConfig(name, command, args, cwd) {
|
|
|
16671
16828
|
}
|
|
16672
16829
|
function createCommandFile(name) {
|
|
16673
16830
|
const dir = join51(".claude", "commands");
|
|
16674
|
-
|
|
16831
|
+
mkdirSync19(dir, { recursive: true });
|
|
16675
16832
|
const content = `---
|
|
16676
16833
|
description: Run ${name}
|
|
16677
16834
|
---
|
|
@@ -16789,8 +16946,8 @@ function registerRun(program2) {
|
|
|
16789
16946
|
}
|
|
16790
16947
|
|
|
16791
16948
|
// src/commands/screenshot/index.ts
|
|
16792
|
-
import { execSync as
|
|
16793
|
-
import { existsSync as existsSync50, mkdirSync as
|
|
16949
|
+
import { execSync as execSync48 } from "child_process";
|
|
16950
|
+
import { existsSync as existsSync50, mkdirSync as mkdirSync20, unlinkSync as unlinkSync16, writeFileSync as writeFileSync32 } from "fs";
|
|
16794
16951
|
import { tmpdir as tmpdir7 } from "os";
|
|
16795
16952
|
import { join as join53, resolve as resolve13 } from "path";
|
|
16796
16953
|
import chalk157 from "chalk";
|
|
@@ -16923,7 +17080,7 @@ Write-Output $OutputPath
|
|
|
16923
17080
|
// src/commands/screenshot/index.ts
|
|
16924
17081
|
function buildOutputPath(outputDir, processName) {
|
|
16925
17082
|
if (!existsSync50(outputDir)) {
|
|
16926
|
-
|
|
17083
|
+
mkdirSync20(outputDir, { recursive: true });
|
|
16927
17084
|
}
|
|
16928
17085
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
16929
17086
|
return resolve13(outputDir, `${processName}-${timestamp}.png`);
|
|
@@ -16932,7 +17089,7 @@ function runPowerShellScript(processName, outputPath) {
|
|
|
16932
17089
|
const scriptPath = join53(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
|
|
16933
17090
|
writeFileSync32(scriptPath, captureWindowPs1, "utf-8");
|
|
16934
17091
|
try {
|
|
16935
|
-
|
|
17092
|
+
execSync48(
|
|
16936
17093
|
`powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
|
|
16937
17094
|
{ stdio: ["ignore", "pipe", "pipe"], encoding: "utf-8" }
|
|
16938
17095
|
);
|
|
@@ -17105,7 +17262,7 @@ async function restartDaemon() {
|
|
|
17105
17262
|
}
|
|
17106
17263
|
|
|
17107
17264
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
17108
|
-
import { mkdirSync as
|
|
17265
|
+
import { mkdirSync as mkdirSync22 } from "fs";
|
|
17109
17266
|
|
|
17110
17267
|
// src/commands/sessions/daemon/createAutoExit.ts
|
|
17111
17268
|
var DEFAULT_GRACE_MS = 6e4;
|
|
@@ -17127,12 +17284,12 @@ function daemonLog(message) {
|
|
|
17127
17284
|
}
|
|
17128
17285
|
|
|
17129
17286
|
// src/commands/sessions/shared/discoverSessions.ts
|
|
17130
|
-
import * as
|
|
17287
|
+
import * as fs26 from "fs";
|
|
17131
17288
|
import * as os from "os";
|
|
17132
17289
|
import * as path46 from "path";
|
|
17133
17290
|
|
|
17134
17291
|
// src/commands/sessions/shared/parseSessionFile.ts
|
|
17135
|
-
import * as
|
|
17292
|
+
import * as fs25 from "fs";
|
|
17136
17293
|
import * as path45 from "path";
|
|
17137
17294
|
|
|
17138
17295
|
// src/commands/sessions/shared/extractSessionMeta.ts
|
|
@@ -17172,13 +17329,13 @@ function extractName(entry) {
|
|
|
17172
17329
|
async function parseSessionFile(filePath) {
|
|
17173
17330
|
let handle;
|
|
17174
17331
|
try {
|
|
17175
|
-
handle = await
|
|
17332
|
+
handle = await fs25.promises.open(filePath, "r");
|
|
17176
17333
|
const buf = Buffer.alloc(16384);
|
|
17177
17334
|
const { bytesRead } = await handle.read(buf, 0, buf.length, 0);
|
|
17178
17335
|
const lines = buf.toString("utf8", 0, bytesRead).split("\n").filter(Boolean);
|
|
17179
17336
|
const meta = extractSessionMeta(lines);
|
|
17180
17337
|
if (!meta.sessionId) return null;
|
|
17181
|
-
const timestamp = meta.timestamp || (await
|
|
17338
|
+
const timestamp = meta.timestamp || (await fs25.promises.stat(filePath)).mtime.toISOString();
|
|
17182
17339
|
const project = meta.cwd ? path45.basename(meta.cwd) : dirNameToProject(filePath);
|
|
17183
17340
|
return {
|
|
17184
17341
|
sessionId: meta.sessionId,
|
|
@@ -17204,7 +17361,7 @@ async function discoverSessionJsonlPaths() {
|
|
|
17204
17361
|
const projectsDir = path46.join(os.homedir(), ".claude", "projects");
|
|
17205
17362
|
let projectDirs;
|
|
17206
17363
|
try {
|
|
17207
|
-
projectDirs = await
|
|
17364
|
+
projectDirs = await fs26.promises.readdir(projectsDir);
|
|
17208
17365
|
} catch {
|
|
17209
17366
|
return [];
|
|
17210
17367
|
}
|
|
@@ -17214,7 +17371,7 @@ async function discoverSessionJsonlPaths() {
|
|
|
17214
17371
|
const dirPath = path46.join(projectsDir, dirName);
|
|
17215
17372
|
let entries;
|
|
17216
17373
|
try {
|
|
17217
|
-
entries = await
|
|
17374
|
+
entries = await fs26.promises.readdir(dirPath);
|
|
17218
17375
|
} catch {
|
|
17219
17376
|
return;
|
|
17220
17377
|
}
|
|
@@ -17559,15 +17716,15 @@ function clearIdle(session) {
|
|
|
17559
17716
|
}
|
|
17560
17717
|
|
|
17561
17718
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
17562
|
-
import { existsSync as existsSync52, mkdirSync as
|
|
17719
|
+
import { existsSync as existsSync52, mkdirSync as mkdirSync21, watch } from "fs";
|
|
17563
17720
|
import { dirname as dirname27 } from "path";
|
|
17564
17721
|
var DEBOUNCE_MS = 50;
|
|
17565
17722
|
function watchActivity(session, notify2) {
|
|
17566
17723
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
17567
|
-
const path53 = activityPath(session.
|
|
17724
|
+
const path53 = activityPath(session.id);
|
|
17568
17725
|
const dir = dirname27(path53);
|
|
17569
17726
|
try {
|
|
17570
|
-
|
|
17727
|
+
mkdirSync21(dir, { recursive: true });
|
|
17571
17728
|
} catch {
|
|
17572
17729
|
return;
|
|
17573
17730
|
}
|
|
@@ -17588,7 +17745,7 @@ function watchActivity(session, notify2) {
|
|
|
17588
17745
|
}
|
|
17589
17746
|
function refreshActivity(session) {
|
|
17590
17747
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
17591
|
-
const activity2 = readActivity(activityPath(session.
|
|
17748
|
+
const activity2 = readActivity(activityPath(session.id));
|
|
17592
17749
|
if (activity2) session.activity = activity2;
|
|
17593
17750
|
}
|
|
17594
17751
|
|
|
@@ -17653,7 +17810,7 @@ function shutdownSessions(sessions) {
|
|
|
17653
17810
|
}
|
|
17654
17811
|
|
|
17655
17812
|
// src/commands/sessions/daemon/discoverClaudeSessionId.ts
|
|
17656
|
-
import * as
|
|
17813
|
+
import * as fs27 from "fs";
|
|
17657
17814
|
import * as path48 from "path";
|
|
17658
17815
|
var POLL_MS = 3e3;
|
|
17659
17816
|
async function discoverClaudeSessionId(options2) {
|
|
@@ -17677,7 +17834,7 @@ async function findNewSessionId(options2) {
|
|
|
17677
17834
|
}
|
|
17678
17835
|
async function isCreatedSince(filePath, sinceMs) {
|
|
17679
17836
|
try {
|
|
17680
|
-
const stat = await
|
|
17837
|
+
const stat = await fs27.promises.stat(filePath);
|
|
17681
17838
|
return (stat.birthtimeMs || stat.mtimeMs) >= sinceMs;
|
|
17682
17839
|
} catch {
|
|
17683
17840
|
return false;
|
|
@@ -17729,7 +17886,7 @@ function dismissSession(sessions, id) {
|
|
|
17729
17886
|
if (s.status !== "done") s.pty?.kill();
|
|
17730
17887
|
clearIdle(s);
|
|
17731
17888
|
s.activityWatcher?.close();
|
|
17732
|
-
|
|
17889
|
+
removeActivity(s.id);
|
|
17733
17890
|
sessions.delete(id);
|
|
17734
17891
|
return true;
|
|
17735
17892
|
}
|
|
@@ -18020,7 +18177,7 @@ async function recoverFromAddrInUse(server, manager, checkAutoExit) {
|
|
|
18020
18177
|
|
|
18021
18178
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
18022
18179
|
async function runDaemon() {
|
|
18023
|
-
|
|
18180
|
+
mkdirSync22(daemonPaths.dir, { recursive: true });
|
|
18024
18181
|
daemonLog(
|
|
18025
18182
|
`starting (reason: ${process.env.ASSIST_DAEMON_SPAWN_REASON ?? "manual"})`
|
|
18026
18183
|
);
|
|
@@ -18054,17 +18211,17 @@ function registerDaemon(program2) {
|
|
|
18054
18211
|
}
|
|
18055
18212
|
|
|
18056
18213
|
// src/commands/sessions/summarise/index.ts
|
|
18057
|
-
import * as
|
|
18214
|
+
import * as fs30 from "fs";
|
|
18058
18215
|
import chalk158 from "chalk";
|
|
18059
18216
|
|
|
18060
18217
|
// src/commands/sessions/summarise/shared.ts
|
|
18061
|
-
import * as
|
|
18218
|
+
import * as fs28 from "fs";
|
|
18062
18219
|
function writeSummary(jsonlPath2, summary) {
|
|
18063
|
-
|
|
18220
|
+
fs28.writeFileSync(summaryPathFor(jsonlPath2), `${summary.trim()}
|
|
18064
18221
|
`, "utf8");
|
|
18065
18222
|
}
|
|
18066
18223
|
function hasSummary(jsonlPath2) {
|
|
18067
|
-
return
|
|
18224
|
+
return fs28.existsSync(summaryPathFor(jsonlPath2));
|
|
18068
18225
|
}
|
|
18069
18226
|
function summaryPathFor(jsonlPath2) {
|
|
18070
18227
|
return jsonlPath2.replace(/\.jsonl$/, ".summary");
|
|
@@ -18074,17 +18231,17 @@ function summaryPathFor(jsonlPath2) {
|
|
|
18074
18231
|
import { execFileSync as execFileSync10 } from "child_process";
|
|
18075
18232
|
|
|
18076
18233
|
// src/commands/sessions/summarise/iterateUserMessages.ts
|
|
18077
|
-
import * as
|
|
18234
|
+
import * as fs29 from "fs";
|
|
18078
18235
|
function* iterateUserMessages(filePath, maxBytes = 65536) {
|
|
18079
18236
|
let content;
|
|
18080
18237
|
try {
|
|
18081
|
-
const fd =
|
|
18238
|
+
const fd = fs29.openSync(filePath, "r");
|
|
18082
18239
|
try {
|
|
18083
18240
|
const buf = Buffer.alloc(maxBytes);
|
|
18084
|
-
const bytesRead =
|
|
18241
|
+
const bytesRead = fs29.readSync(fd, buf, 0, buf.length, 0);
|
|
18085
18242
|
content = buf.toString("utf8", 0, bytesRead);
|
|
18086
18243
|
} finally {
|
|
18087
|
-
|
|
18244
|
+
fs29.closeSync(fd);
|
|
18088
18245
|
}
|
|
18089
18246
|
} catch {
|
|
18090
18247
|
return;
|
|
@@ -18204,7 +18361,7 @@ function selectCandidates(files, options2) {
|
|
|
18204
18361
|
const candidates = options2.force ? files : files.filter((f) => !hasSummary(f));
|
|
18205
18362
|
candidates.sort((a, b) => {
|
|
18206
18363
|
try {
|
|
18207
|
-
return
|
|
18364
|
+
return fs30.statSync(b).mtimeMs - fs30.statSync(a).mtimeMs;
|
|
18208
18365
|
} catch {
|
|
18209
18366
|
return 0;
|
|
18210
18367
|
}
|
|
@@ -18318,21 +18475,21 @@ async function statusLine() {
|
|
|
18318
18475
|
}
|
|
18319
18476
|
|
|
18320
18477
|
// src/commands/sync.ts
|
|
18321
|
-
import * as
|
|
18478
|
+
import * as fs33 from "fs";
|
|
18322
18479
|
import * as os2 from "os";
|
|
18323
18480
|
import * as path51 from "path";
|
|
18324
18481
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
18325
18482
|
|
|
18326
18483
|
// src/commands/sync/syncClaudeMd.ts
|
|
18327
|
-
import * as
|
|
18484
|
+
import * as fs31 from "fs";
|
|
18328
18485
|
import * as path49 from "path";
|
|
18329
18486
|
import chalk161 from "chalk";
|
|
18330
18487
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
18331
18488
|
const source = path49.join(claudeDir, "CLAUDE.md");
|
|
18332
18489
|
const target = path49.join(targetBase, "CLAUDE.md");
|
|
18333
|
-
const sourceContent =
|
|
18334
|
-
if (
|
|
18335
|
-
const targetContent =
|
|
18490
|
+
const sourceContent = fs31.readFileSync(source, "utf-8");
|
|
18491
|
+
if (fs31.existsSync(target)) {
|
|
18492
|
+
const targetContent = fs31.readFileSync(target, "utf-8");
|
|
18336
18493
|
if (sourceContent !== targetContent) {
|
|
18337
18494
|
console.log(
|
|
18338
18495
|
chalk161.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
@@ -18349,21 +18506,21 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
18349
18506
|
}
|
|
18350
18507
|
}
|
|
18351
18508
|
}
|
|
18352
|
-
|
|
18509
|
+
fs31.copyFileSync(source, target);
|
|
18353
18510
|
console.log("Copied CLAUDE.md to ~/.claude/CLAUDE.md");
|
|
18354
18511
|
}
|
|
18355
18512
|
|
|
18356
18513
|
// src/commands/sync/syncSettings.ts
|
|
18357
|
-
import * as
|
|
18514
|
+
import * as fs32 from "fs";
|
|
18358
18515
|
import * as path50 from "path";
|
|
18359
18516
|
import chalk162 from "chalk";
|
|
18360
18517
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
18361
18518
|
const source = path50.join(claudeDir, "settings.json");
|
|
18362
18519
|
const target = path50.join(targetBase, "settings.json");
|
|
18363
|
-
const sourceContent =
|
|
18520
|
+
const sourceContent = fs32.readFileSync(source, "utf-8");
|
|
18364
18521
|
const mergedContent = JSON.stringify(JSON.parse(sourceContent), null, " ");
|
|
18365
|
-
if (
|
|
18366
|
-
const targetContent =
|
|
18522
|
+
if (fs32.existsSync(target)) {
|
|
18523
|
+
const targetContent = fs32.readFileSync(target, "utf-8");
|
|
18367
18524
|
const normalizedTarget = JSON.stringify(
|
|
18368
18525
|
JSON.parse(targetContent),
|
|
18369
18526
|
null,
|
|
@@ -18389,7 +18546,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
18389
18546
|
}
|
|
18390
18547
|
}
|
|
18391
18548
|
}
|
|
18392
|
-
|
|
18549
|
+
fs32.writeFileSync(target, mergedContent);
|
|
18393
18550
|
console.log("Copied settings.json to ~/.claude/settings.json");
|
|
18394
18551
|
}
|
|
18395
18552
|
|
|
@@ -18408,17 +18565,17 @@ async function sync(options2) {
|
|
|
18408
18565
|
function syncCommands(claudeDir, targetBase) {
|
|
18409
18566
|
const sourceDir = path51.join(claudeDir, "commands");
|
|
18410
18567
|
const targetDir = path51.join(targetBase, "commands");
|
|
18411
|
-
|
|
18412
|
-
const files =
|
|
18568
|
+
fs33.mkdirSync(targetDir, { recursive: true });
|
|
18569
|
+
const files = fs33.readdirSync(sourceDir);
|
|
18413
18570
|
for (const file of files) {
|
|
18414
|
-
|
|
18571
|
+
fs33.copyFileSync(path51.join(sourceDir, file), path51.join(targetDir, file));
|
|
18415
18572
|
console.log(`Copied ${file} to ${targetDir}`);
|
|
18416
18573
|
}
|
|
18417
18574
|
console.log(`Synced ${files.length} command(s) to ~/.claude/commands`);
|
|
18418
18575
|
}
|
|
18419
18576
|
|
|
18420
18577
|
// src/commands/update.ts
|
|
18421
|
-
import { execSync as
|
|
18578
|
+
import { execSync as execSync49 } from "child_process";
|
|
18422
18579
|
import * as path52 from "path";
|
|
18423
18580
|
function isGlobalNpmInstall(dir) {
|
|
18424
18581
|
try {
|
|
@@ -18426,7 +18583,7 @@ function isGlobalNpmInstall(dir) {
|
|
|
18426
18583
|
if (resolved.split(path52.sep).includes("node_modules")) {
|
|
18427
18584
|
return true;
|
|
18428
18585
|
}
|
|
18429
|
-
const globalPrefix =
|
|
18586
|
+
const globalPrefix = execSync49("npm prefix -g", { stdio: "pipe" }).toString().trim();
|
|
18430
18587
|
return resolved.toLowerCase().startsWith(path52.resolve(globalPrefix).toLowerCase());
|
|
18431
18588
|
} catch {
|
|
18432
18589
|
return false;
|
|
@@ -18437,18 +18594,18 @@ async function update2() {
|
|
|
18437
18594
|
console.log(`Assist is installed at: ${installDir}`);
|
|
18438
18595
|
if (isGitRepo(installDir)) {
|
|
18439
18596
|
console.log("Detected git repo installation, pulling latest...");
|
|
18440
|
-
|
|
18597
|
+
execSync49("git pull", { cwd: installDir, stdio: "inherit" });
|
|
18441
18598
|
console.log("Installing dependencies...");
|
|
18442
|
-
|
|
18599
|
+
execSync49("npm i", { cwd: installDir, stdio: "inherit" });
|
|
18443
18600
|
console.log("Building...");
|
|
18444
|
-
|
|
18601
|
+
execSync49("npm run build", { cwd: installDir, stdio: "inherit" });
|
|
18445
18602
|
console.log("Syncing commands...");
|
|
18446
|
-
|
|
18603
|
+
execSync49("assist sync", { stdio: "inherit" });
|
|
18447
18604
|
} else if (isGlobalNpmInstall(installDir)) {
|
|
18448
18605
|
console.log("Detected global npm installation, updating...");
|
|
18449
|
-
|
|
18606
|
+
execSync49("npm i -g @staff0rd/assist@latest", { stdio: "inherit" });
|
|
18450
18607
|
console.log("Syncing commands...");
|
|
18451
|
-
|
|
18608
|
+
execSync49("assist sync", { stdio: "inherit" });
|
|
18452
18609
|
} else {
|
|
18453
18610
|
console.error(
|
|
18454
18611
|
"Could not determine installation method. Expected a git repo or global npm install."
|