@staff0rd/assist 0.316.0 → 0.317.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 -1
- package/claude/commands/strip-comments.md +1 -1
- package/dist/index.js +304 -317
- 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.317.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -300,6 +300,13 @@ var assistConfigSchema = z2.strictObject({
|
|
|
300
300
|
message: z2.string()
|
|
301
301
|
})
|
|
302
302
|
).optional(),
|
|
303
|
+
forbiddenStrings: z2.array(
|
|
304
|
+
z2.strictObject({
|
|
305
|
+
file: z2.string(),
|
|
306
|
+
paths: z2.array(z2.string()),
|
|
307
|
+
disallowed: z2.string()
|
|
308
|
+
})
|
|
309
|
+
).optional(),
|
|
303
310
|
sync: z2.strictObject({
|
|
304
311
|
autoConfirm: z2.boolean().default(false)
|
|
305
312
|
}).default({ autoConfirm: false }),
|
|
@@ -771,8 +778,7 @@ import * as path5 from "path";
|
|
|
771
778
|
import chalk13 from "chalk";
|
|
772
779
|
|
|
773
780
|
// src/commands/lint/init.ts
|
|
774
|
-
import {
|
|
775
|
-
import { existsSync as existsSync7, readFileSync as readFileSync5, rmSync, writeFileSync as writeFileSync5 } from "fs";
|
|
781
|
+
import { existsSync as existsSync7, readFileSync as readFileSync5, writeFileSync as writeFileSync5 } from "fs";
|
|
776
782
|
import chalk12 from "chalk";
|
|
777
783
|
|
|
778
784
|
// src/shared/promptConfirm.ts
|
|
@@ -927,8 +933,6 @@ var oxlintrc_template_default = {
|
|
|
927
933
|
async function init() {
|
|
928
934
|
removeEslint();
|
|
929
935
|
await writeOxlintConfig();
|
|
930
|
-
removeBiomeConfig();
|
|
931
|
-
uninstallBiome();
|
|
932
936
|
}
|
|
933
937
|
async function writeOxlintConfig() {
|
|
934
938
|
const newContent = `${JSON.stringify(oxlintrc_template_default, null, " ")}
|
|
@@ -955,29 +959,6 @@ async function writeOxlintConfig() {
|
|
|
955
959
|
writeFileSync5(configPath, newContent);
|
|
956
960
|
console.log("Updated .oxlintrc.json with baseline linter config");
|
|
957
961
|
}
|
|
958
|
-
function removeBiomeConfig() {
|
|
959
|
-
for (const file of ["biome.json", "biome.jsonc"]) {
|
|
960
|
-
if (existsSync7(file)) {
|
|
961
|
-
rmSync(file);
|
|
962
|
-
console.log(`Removed ${file}`);
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
function uninstallBiome() {
|
|
967
|
-
const packageJsonPath = "package.json";
|
|
968
|
-
if (!existsSync7(packageJsonPath)) {
|
|
969
|
-
return;
|
|
970
|
-
}
|
|
971
|
-
const pkg = JSON.parse(readFileSync5(packageJsonPath, "utf8"));
|
|
972
|
-
const hasBiome = Boolean(
|
|
973
|
-
pkg.devDependencies?.["@biomejs/biome"] || pkg.dependencies?.["@biomejs/biome"]
|
|
974
|
-
);
|
|
975
|
-
if (!hasBiome) {
|
|
976
|
-
return;
|
|
977
|
-
}
|
|
978
|
-
console.log("Uninstalling @biomejs/biome...");
|
|
979
|
-
execSync6("npm uninstall @biomejs/biome", { stdio: "inherit" });
|
|
980
|
-
}
|
|
981
962
|
|
|
982
963
|
// src/commands/verify/setup/setupLint.ts
|
|
983
964
|
async function setupLint(packageJsonPath, writer) {
|
|
@@ -1275,17 +1256,12 @@ function createLaunchJson(type) {
|
|
|
1275
1256
|
// src/commands/vscode/init/detectVscodeSetup.ts
|
|
1276
1257
|
import * as fs3 from "fs";
|
|
1277
1258
|
import * as path9 from "path";
|
|
1278
|
-
function fileContainsBiome(filePath) {
|
|
1279
|
-
if (!fs3.existsSync(filePath)) return false;
|
|
1280
|
-
return fs3.readFileSync(filePath, "utf8").includes("biome");
|
|
1281
|
-
}
|
|
1282
1259
|
function detectVscodeSetup(pkg) {
|
|
1283
1260
|
const vscodeDir = path9.join(process.cwd(), ".vscode");
|
|
1284
1261
|
return {
|
|
1285
1262
|
hasVscodeFolder: fs3.existsSync(vscodeDir),
|
|
1286
1263
|
hasLaunchJson: fs3.existsSync(path9.join(vscodeDir, "launch.json")),
|
|
1287
1264
|
hasSettingsJson: fs3.existsSync(path9.join(vscodeDir, "settings.json")),
|
|
1288
|
-
hasBiomeConfig: fileContainsBiome(path9.join(vscodeDir, "settings.json")) || fileContainsBiome(path9.join(vscodeDir, "extensions.json")),
|
|
1289
1265
|
hasVite: !!pkg.devDependencies?.vite || !!pkg.dependencies?.vite,
|
|
1290
1266
|
hasTsup: !!pkg.devDependencies?.tsup || !!pkg.dependencies?.tsup
|
|
1291
1267
|
};
|
|
@@ -1307,7 +1283,7 @@ function getAvailableOptions2(setup2) {
|
|
|
1307
1283
|
value: "launch",
|
|
1308
1284
|
description: launchDescription
|
|
1309
1285
|
});
|
|
1310
|
-
if (!setup2.hasSettingsJson
|
|
1286
|
+
if (!setup2.hasSettingsJson)
|
|
1311
1287
|
options2.push({
|
|
1312
1288
|
name: "settings",
|
|
1313
1289
|
value: "settings",
|
|
@@ -1341,7 +1317,7 @@ function createSettingsJson() {
|
|
|
1341
1317
|
"editor.defaultFormatter": "oxc.oxc-vscode",
|
|
1342
1318
|
"editor.formatOnSave": true,
|
|
1343
1319
|
"editor.codeActionsOnSave": {
|
|
1344
|
-
...
|
|
1320
|
+
...existingCodeActions(existing["editor.codeActionsOnSave"]),
|
|
1345
1321
|
"source.fixAll.oxc": "explicit",
|
|
1346
1322
|
"source.organizeImports.oxc": "explicit"
|
|
1347
1323
|
}
|
|
@@ -1350,13 +1326,9 @@ function createSettingsJson() {
|
|
|
1350
1326
|
`);
|
|
1351
1327
|
console.log(chalk19.green("Created .vscode/settings.json"));
|
|
1352
1328
|
}
|
|
1353
|
-
function
|
|
1329
|
+
function existingCodeActions(actions) {
|
|
1354
1330
|
if (!actions || typeof actions !== "object") return {};
|
|
1355
|
-
return
|
|
1356
|
-
Object.entries(actions).filter(
|
|
1357
|
-
([key]) => !key.includes("biome")
|
|
1358
|
-
)
|
|
1359
|
-
);
|
|
1331
|
+
return actions;
|
|
1360
1332
|
}
|
|
1361
1333
|
|
|
1362
1334
|
// src/commands/vscode/init/createExtensionsJson.ts
|
|
@@ -1366,9 +1338,7 @@ import chalk20 from "chalk";
|
|
|
1366
1338
|
function createExtensionsJson() {
|
|
1367
1339
|
const extensionsPath = path11.join(process.cwd(), ".vscode", "extensions.json");
|
|
1368
1340
|
const existing = readVscodeJson(extensionsPath);
|
|
1369
|
-
const previous = Array.isArray(existing.recommendations) ? existing.recommendations
|
|
1370
|
-
(r) => r !== "biomejs.biome"
|
|
1371
|
-
) : [];
|
|
1341
|
+
const previous = Array.isArray(existing.recommendations) ? existing.recommendations : [];
|
|
1372
1342
|
const recommendations = previous.includes("oxc.oxc-vscode") ? previous : [...previous, "oxc.oxc-vscode"];
|
|
1373
1343
|
const extensions = { ...existing, recommendations };
|
|
1374
1344
|
fs6.writeFileSync(
|
|
@@ -1741,11 +1711,11 @@ function lint(options2 = {}) {
|
|
|
1741
1711
|
}
|
|
1742
1712
|
|
|
1743
1713
|
// src/commands/new/registerNew/newCli/index.ts
|
|
1744
|
-
import { execSync as
|
|
1714
|
+
import { execSync as execSync12 } from "child_process";
|
|
1745
1715
|
import { basename, resolve as resolve5 } from "path";
|
|
1746
1716
|
|
|
1747
1717
|
// src/commands/verify/commentPolicy/findAddedComments.ts
|
|
1748
|
-
import { execSync as
|
|
1718
|
+
import { execSync as execSync6 } from "child_process";
|
|
1749
1719
|
import fs13 from "fs";
|
|
1750
1720
|
import { minimatch } from "minimatch";
|
|
1751
1721
|
import { Project as Project2 } from "ts-morph";
|
|
@@ -1772,7 +1742,6 @@ function collectComments(sourceFile) {
|
|
|
1772
1742
|
|
|
1773
1743
|
// src/commands/verify/commentPolicy/isCommentExempt.ts
|
|
1774
1744
|
var MACHINE_DIRECTIVES = [
|
|
1775
|
-
"biome-ignore",
|
|
1776
1745
|
"oxlint-disable",
|
|
1777
1746
|
"oxlint-enable",
|
|
1778
1747
|
"@ts-expect-error",
|
|
@@ -1839,7 +1808,7 @@ function shouldScan(file, ignoreGlobs) {
|
|
|
1839
1808
|
return fs13.existsSync(file);
|
|
1840
1809
|
}
|
|
1841
1810
|
function findAddedComments(options2) {
|
|
1842
|
-
const diff2 =
|
|
1811
|
+
const diff2 = execSync6("git diff HEAD", {
|
|
1843
1812
|
encoding: "utf8",
|
|
1844
1813
|
maxBuffer: 64 * 1024 * 1024
|
|
1845
1814
|
});
|
|
@@ -1890,21 +1859,94 @@ Total: ${findings.length} comment(s)`);
|
|
|
1890
1859
|
process.exit(1);
|
|
1891
1860
|
}
|
|
1892
1861
|
|
|
1893
|
-
// src/commands/verify/
|
|
1894
|
-
import {
|
|
1862
|
+
// src/commands/verify/forbiddenStrings/index.ts
|
|
1863
|
+
import { existsSync as existsSync11, readFileSync as readFileSync8 } from "fs";
|
|
1864
|
+
|
|
1865
|
+
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
1895
1866
|
import { minimatch as minimatch2 } from "minimatch";
|
|
1867
|
+
function resolveStringsAtPath(data, path57) {
|
|
1868
|
+
let current = data;
|
|
1869
|
+
for (const segment of path57.split(".")) {
|
|
1870
|
+
if (current === null || typeof current !== "object") return [];
|
|
1871
|
+
current = current[segment];
|
|
1872
|
+
}
|
|
1873
|
+
if (typeof current === "string") return [current];
|
|
1874
|
+
if (Array.isArray(current))
|
|
1875
|
+
return current.filter(
|
|
1876
|
+
(value) => typeof value === "string"
|
|
1877
|
+
);
|
|
1878
|
+
return [];
|
|
1879
|
+
}
|
|
1880
|
+
function findRuleViolations(data, rule) {
|
|
1881
|
+
const violations = [];
|
|
1882
|
+
for (const path57 of rule.paths) {
|
|
1883
|
+
for (const value of resolveStringsAtPath(data, path57)) {
|
|
1884
|
+
if (minimatch2(value, rule.disallowed))
|
|
1885
|
+
violations.push({ file: rule.file, path: path57, value });
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
return violations;
|
|
1889
|
+
}
|
|
1890
|
+
function findForbiddenStrings(rules, readJson) {
|
|
1891
|
+
return rules.flatMap((rule) => findRuleViolations(readJson(rule.file), rule));
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1894
|
+
// src/commands/verify/forbiddenStrings/index.ts
|
|
1895
|
+
function forbiddenStrings() {
|
|
1896
|
+
const rules = loadConfig().forbiddenStrings ?? [];
|
|
1897
|
+
if (rules.length === 0) {
|
|
1898
|
+
console.log("No forbidden-strings rules configured.");
|
|
1899
|
+
process.exit(0);
|
|
1900
|
+
}
|
|
1901
|
+
const cache = /* @__PURE__ */ new Map();
|
|
1902
|
+
const readJson = (file) => {
|
|
1903
|
+
if (cache.has(file)) return cache.get(file);
|
|
1904
|
+
if (!existsSync11(file)) {
|
|
1905
|
+
console.log(`Forbidden-strings file not found: ${file}`);
|
|
1906
|
+
process.exit(1);
|
|
1907
|
+
}
|
|
1908
|
+
let parsed;
|
|
1909
|
+
try {
|
|
1910
|
+
parsed = JSON.parse(readFileSync8(file, "utf8"));
|
|
1911
|
+
} catch (error) {
|
|
1912
|
+
console.log(`Could not parse ${file}: ${error.message}`);
|
|
1913
|
+
process.exit(1);
|
|
1914
|
+
}
|
|
1915
|
+
cache.set(file, parsed);
|
|
1916
|
+
return parsed;
|
|
1917
|
+
};
|
|
1918
|
+
const violations = findForbiddenStrings(rules, readJson);
|
|
1919
|
+
if (violations.length === 0) {
|
|
1920
|
+
console.log("No forbidden strings found.");
|
|
1921
|
+
process.exit(0);
|
|
1922
|
+
}
|
|
1923
|
+
console.log("Forbidden strings found:\n");
|
|
1924
|
+
for (const { file, path: path57, value } of violations) {
|
|
1925
|
+
console.log(` ${file} ${path57}: ${value}`);
|
|
1926
|
+
}
|
|
1927
|
+
console.log(`
|
|
1928
|
+
Total: ${violations.length} forbidden string(s).`);
|
|
1929
|
+
console.log(
|
|
1930
|
+
"\nRemove each flagged value, or adjust the matching forbiddenStrings rule in assist.yml."
|
|
1931
|
+
);
|
|
1932
|
+
process.exit(1);
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1935
|
+
// src/commands/verify/hardcodedColors.ts
|
|
1936
|
+
import { execSync as execSync7 } from "child_process";
|
|
1937
|
+
import { minimatch as minimatch3 } from "minimatch";
|
|
1896
1938
|
var pattern = "0x[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,6}";
|
|
1897
1939
|
function hardcodedColors() {
|
|
1898
1940
|
const ignoreGlobs = loadConfig().hardcodedColors?.ignore ?? [];
|
|
1899
1941
|
try {
|
|
1900
|
-
const output =
|
|
1942
|
+
const output = execSync7(`grep -rEnH '${pattern}' src/`, {
|
|
1901
1943
|
encoding: "utf8"
|
|
1902
1944
|
});
|
|
1903
1945
|
const lines = output.trim().split("\n").filter((line) => {
|
|
1904
1946
|
const match = line.match(/^(.+?):\d+:/);
|
|
1905
1947
|
if (!match) return true;
|
|
1906
1948
|
const file = match[1];
|
|
1907
|
-
return !ignoreGlobs.some((glob) =>
|
|
1949
|
+
return !ignoreGlobs.some((glob) => minimatch3(file, glob));
|
|
1908
1950
|
});
|
|
1909
1951
|
if (lines.length === 0) {
|
|
1910
1952
|
console.log("No hardcoded colors found.");
|
|
@@ -1960,14 +2002,14 @@ function assertNoDuplicateRunNames(configs) {
|
|
|
1960
2002
|
}
|
|
1961
2003
|
|
|
1962
2004
|
// src/shared/findLinkedConfigPath.ts
|
|
1963
|
-
import { existsSync as
|
|
2005
|
+
import { existsSync as existsSync12 } from "fs";
|
|
1964
2006
|
import { join as join8, resolve } from "path";
|
|
1965
2007
|
function findLinkedConfigPath(linkPath, fromDir) {
|
|
1966
2008
|
const resolved = resolve(fromDir, linkPath);
|
|
1967
2009
|
const claudePath = join8(resolved, ".claude", "assist.yml");
|
|
1968
|
-
if (
|
|
2010
|
+
if (existsSync12(claudePath)) return claudePath;
|
|
1969
2011
|
const rootPath = join8(resolved, "assist.yml");
|
|
1970
|
-
if (
|
|
2012
|
+
if (existsSync12(rootPath)) return rootPath;
|
|
1971
2013
|
throw new Error(`No assist.yml found in linked project: ${resolved}`);
|
|
1972
2014
|
}
|
|
1973
2015
|
|
|
@@ -2078,10 +2120,10 @@ function list() {
|
|
|
2078
2120
|
}
|
|
2079
2121
|
|
|
2080
2122
|
// src/commands/verify/noVenv.ts
|
|
2081
|
-
import { execSync as
|
|
2123
|
+
import { execSync as execSync8 } from "child_process";
|
|
2082
2124
|
function noVenv() {
|
|
2083
2125
|
try {
|
|
2084
|
-
const output =
|
|
2126
|
+
const output = execSync8(
|
|
2085
2127
|
"find . -type d -name venv -not -path '*/node_modules/*'",
|
|
2086
2128
|
{
|
|
2087
2129
|
encoding: "utf8"
|
|
@@ -2110,12 +2152,12 @@ Total: ${folders.length} venv folder(s)`);
|
|
|
2110
2152
|
}
|
|
2111
2153
|
|
|
2112
2154
|
// src/commands/verify/run/filterByChangedFiles.ts
|
|
2113
|
-
import { minimatch as
|
|
2155
|
+
import { minimatch as minimatch4 } from "minimatch";
|
|
2114
2156
|
|
|
2115
2157
|
// src/commands/verify/run/getChangedFiles.ts
|
|
2116
|
-
import { execSync as
|
|
2158
|
+
import { execSync as execSync9 } from "child_process";
|
|
2117
2159
|
function getChangedFiles() {
|
|
2118
|
-
const output =
|
|
2160
|
+
const output = execSync9("git diff --name-only HEAD", {
|
|
2119
2161
|
encoding: "utf8"
|
|
2120
2162
|
}).trim();
|
|
2121
2163
|
if (output === "") return [];
|
|
@@ -2131,7 +2173,7 @@ function filterByChangedFiles(entries) {
|
|
|
2131
2173
|
const { filter } = entry;
|
|
2132
2174
|
if (!filter) return true;
|
|
2133
2175
|
if (changedFiles.length === 0) return false;
|
|
2134
|
-
return changedFiles.some((file) =>
|
|
2176
|
+
return changedFiles.some((file) => minimatch4(file, filter));
|
|
2135
2177
|
});
|
|
2136
2178
|
}
|
|
2137
2179
|
|
|
@@ -2286,81 +2328,26 @@ async function run(options2 = {}) {
|
|
|
2286
2328
|
handleResults(results, entries.length);
|
|
2287
2329
|
}
|
|
2288
2330
|
|
|
2289
|
-
// src/commands/verify/settingsGuard.ts
|
|
2290
|
-
import { existsSync as existsSync12, readFileSync as readFileSync9 } from "fs";
|
|
2291
|
-
|
|
2292
|
-
// src/commands/verify/findAssistReferences.ts
|
|
2293
|
-
function offendingEntries(list4) {
|
|
2294
|
-
if (!Array.isArray(list4)) return [];
|
|
2295
|
-
return list4.filter(
|
|
2296
|
-
(entry) => typeof entry === "string" && /\bassist\b/.test(entry)
|
|
2297
|
-
);
|
|
2298
|
-
}
|
|
2299
|
-
function findAssistReferences(settings) {
|
|
2300
|
-
const permissions = settings?.permissions ?? {};
|
|
2301
|
-
return [
|
|
2302
|
-
...offendingEntries(permissions.allow).map(
|
|
2303
|
-
(entry) => ({ list: "allow", entry })
|
|
2304
|
-
),
|
|
2305
|
-
...offendingEntries(permissions.deny).map(
|
|
2306
|
-
(entry) => ({ list: "deny", entry })
|
|
2307
|
-
)
|
|
2308
|
-
];
|
|
2309
|
-
}
|
|
2310
|
-
|
|
2311
|
-
// src/commands/verify/settingsGuard.ts
|
|
2312
|
-
var SETTINGS_PATH = "claude/settings.json";
|
|
2313
|
-
function settingsGuard() {
|
|
2314
|
-
if (!existsSync12(SETTINGS_PATH)) {
|
|
2315
|
-
console.log(`No ${SETTINGS_PATH}; nothing to guard.`);
|
|
2316
|
-
process.exit(0);
|
|
2317
|
-
}
|
|
2318
|
-
let settings;
|
|
2319
|
-
try {
|
|
2320
|
-
settings = JSON.parse(readFileSync9(SETTINGS_PATH, "utf8"));
|
|
2321
|
-
} catch (error) {
|
|
2322
|
-
console.log(
|
|
2323
|
-
`Could not parse ${SETTINGS_PATH}: ${error.message}`
|
|
2324
|
-
);
|
|
2325
|
-
process.exit(1);
|
|
2326
|
-
}
|
|
2327
|
-
const offenders = findAssistReferences(settings);
|
|
2328
|
-
if (offenders.length === 0) {
|
|
2329
|
-
console.log(`No assist references in ${SETTINGS_PATH} permissions.`);
|
|
2330
|
-
process.exit(0);
|
|
2331
|
-
}
|
|
2332
|
-
console.log(`assist references found in ${SETTINGS_PATH} permissions:
|
|
2333
|
-
`);
|
|
2334
|
-
for (const { list: list4, entry } of offenders) {
|
|
2335
|
-
console.log(` permissions.${list4}: ${entry}`);
|
|
2336
|
-
}
|
|
2337
|
-
console.log(
|
|
2338
|
-
`
|
|
2339
|
-
Total: ${offenders.length} entry(ies). Remove every assist reference from the permission lists.`
|
|
2340
|
-
);
|
|
2341
|
-
process.exit(1);
|
|
2342
|
-
}
|
|
2343
|
-
|
|
2344
2331
|
// src/commands/new/registerNew/initGit.ts
|
|
2345
|
-
import { execSync as
|
|
2332
|
+
import { execSync as execSync10 } from "child_process";
|
|
2346
2333
|
import { writeFileSync as writeFileSync9 } from "fs";
|
|
2347
2334
|
function initGit() {
|
|
2348
2335
|
console.log("Initializing git repository...");
|
|
2349
|
-
|
|
2336
|
+
execSync10("git init", { stdio: "inherit" });
|
|
2350
2337
|
writeFileSync9(".gitignore", "dist\nnode_modules\n");
|
|
2351
2338
|
}
|
|
2352
2339
|
|
|
2353
2340
|
// src/commands/new/registerNew/newCli/initPackageJson.ts
|
|
2354
|
-
import { execSync as
|
|
2341
|
+
import { execSync as execSync11 } from "child_process";
|
|
2355
2342
|
function initPackageJson(name) {
|
|
2356
2343
|
console.log("Initializing package.json...");
|
|
2357
|
-
|
|
2344
|
+
execSync11("npm init -y", { stdio: "inherit" });
|
|
2358
2345
|
console.log("Configuring package.json...");
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2346
|
+
execSync11("npm pkg delete main", { stdio: "inherit" });
|
|
2347
|
+
execSync11("npm pkg set type=module", { stdio: "inherit" });
|
|
2348
|
+
execSync11(`npm pkg set bin.${name}=./dist/index.js`, { stdio: "inherit" });
|
|
2349
|
+
execSync11("npm pkg set scripts.build=tsup", { stdio: "inherit" });
|
|
2350
|
+
execSync11('npm pkg set scripts.start="node dist/index.js"', {
|
|
2364
2351
|
stdio: "inherit"
|
|
2365
2352
|
});
|
|
2366
2353
|
}
|
|
@@ -2425,8 +2412,8 @@ async function newCli() {
|
|
|
2425
2412
|
initGit();
|
|
2426
2413
|
initPackageJson(name);
|
|
2427
2414
|
console.log("Installing dependencies...");
|
|
2428
|
-
|
|
2429
|
-
|
|
2415
|
+
execSync12("npm install commander", { stdio: "inherit" });
|
|
2416
|
+
execSync12("npm install -D tsup typescript @types/node", {
|
|
2430
2417
|
stdio: "inherit"
|
|
2431
2418
|
});
|
|
2432
2419
|
writeCliTemplate(name);
|
|
@@ -2435,16 +2422,16 @@ async function newCli() {
|
|
|
2435
2422
|
}
|
|
2436
2423
|
|
|
2437
2424
|
// src/commands/new/registerNew/newProject.ts
|
|
2438
|
-
import { execSync as
|
|
2439
|
-
import { existsSync as existsSync14, readFileSync as
|
|
2425
|
+
import { execSync as execSync14 } from "child_process";
|
|
2426
|
+
import { existsSync as existsSync14, readFileSync as readFileSync10, writeFileSync as writeFileSync12 } from "fs";
|
|
2440
2427
|
|
|
2441
2428
|
// src/commands/deploy/init/index.ts
|
|
2442
|
-
import { execSync as
|
|
2429
|
+
import { execSync as execSync13 } from "child_process";
|
|
2443
2430
|
import chalk26 from "chalk";
|
|
2444
2431
|
import enquirer3 from "enquirer";
|
|
2445
2432
|
|
|
2446
2433
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
2447
|
-
import { existsSync as existsSync13, mkdirSync as mkdirSync3, readFileSync as
|
|
2434
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync3, readFileSync as readFileSync9, writeFileSync as writeFileSync11 } from "fs";
|
|
2448
2435
|
import { dirname as dirname11, join as join9 } from "path";
|
|
2449
2436
|
import { fileURLToPath } from "url";
|
|
2450
2437
|
import chalk25 from "chalk";
|
|
@@ -2454,13 +2441,13 @@ function getExistingSiteId() {
|
|
|
2454
2441
|
if (!existsSync13(WORKFLOW_PATH)) {
|
|
2455
2442
|
return null;
|
|
2456
2443
|
}
|
|
2457
|
-
const content =
|
|
2444
|
+
const content = readFileSync9(WORKFLOW_PATH, "utf8");
|
|
2458
2445
|
const match = content.match(/-s\s+([a-f0-9-]{36})/);
|
|
2459
2446
|
return match ? match[1] : null;
|
|
2460
2447
|
}
|
|
2461
2448
|
function getTemplateContent(siteId) {
|
|
2462
2449
|
const templatePath = join9(__dirname2, "commands/deploy/build.yml");
|
|
2463
|
-
const template =
|
|
2450
|
+
const template = readFileSync9(templatePath, "utf8");
|
|
2464
2451
|
return template.replace("{{NETLIFY_SITE_ID}}", siteId);
|
|
2465
2452
|
}
|
|
2466
2453
|
async function updateWorkflow(siteId) {
|
|
@@ -2470,7 +2457,7 @@ async function updateWorkflow(siteId) {
|
|
|
2470
2457
|
mkdirSync3(workflowDir, { recursive: true });
|
|
2471
2458
|
}
|
|
2472
2459
|
if (existsSync13(WORKFLOW_PATH)) {
|
|
2473
|
-
const oldContent =
|
|
2460
|
+
const oldContent = readFileSync9(WORKFLOW_PATH, "utf8");
|
|
2474
2461
|
if (oldContent === newContent) {
|
|
2475
2462
|
console.log(chalk25.green("build.yml is already up to date"));
|
|
2476
2463
|
return;
|
|
@@ -2492,7 +2479,7 @@ Created ${WORKFLOW_PATH}`));
|
|
|
2492
2479
|
// src/commands/deploy/init/index.ts
|
|
2493
2480
|
async function ensureNetlifyCli() {
|
|
2494
2481
|
try {
|
|
2495
|
-
|
|
2482
|
+
execSync13("netlify sites:create --disable-linking", { stdio: "inherit" });
|
|
2496
2483
|
} catch (error) {
|
|
2497
2484
|
if (!(error instanceof Error) || !error.message.includes("command not found"))
|
|
2498
2485
|
throw error;
|
|
@@ -2507,9 +2494,9 @@ async function ensureNetlifyCli() {
|
|
|
2507
2494
|
process.exit(1);
|
|
2508
2495
|
}
|
|
2509
2496
|
console.log(chalk26.dim("\nInstalling netlify-cli...\n"));
|
|
2510
|
-
|
|
2497
|
+
execSync13("npm install -g netlify-cli", { stdio: "inherit" });
|
|
2511
2498
|
console.log();
|
|
2512
|
-
|
|
2499
|
+
execSync13("netlify sites:create --disable-linking", { stdio: "inherit" });
|
|
2513
2500
|
}
|
|
2514
2501
|
}
|
|
2515
2502
|
function printSetupInstructions() {
|
|
@@ -2552,7 +2539,7 @@ async function init5() {
|
|
|
2552
2539
|
// src/commands/new/registerNew/newProject.ts
|
|
2553
2540
|
async function newProject() {
|
|
2554
2541
|
console.log("Initializing Vite with react-ts template...");
|
|
2555
|
-
|
|
2542
|
+
execSync14("npm create vite@latest . -- --template react-ts", {
|
|
2556
2543
|
stdio: "inherit"
|
|
2557
2544
|
});
|
|
2558
2545
|
initGit();
|
|
@@ -2568,7 +2555,7 @@ function addViteBaseConfig() {
|
|
|
2568
2555
|
console.log("No vite.config.ts found, skipping base config");
|
|
2569
2556
|
return;
|
|
2570
2557
|
}
|
|
2571
|
-
const content =
|
|
2558
|
+
const content = readFileSync10(viteConfigPath, "utf8");
|
|
2572
2559
|
if (content.includes("base:")) {
|
|
2573
2560
|
console.log("vite.config.ts already has base config");
|
|
2574
2561
|
return;
|
|
@@ -2744,11 +2731,11 @@ function activityChart(data, range) {
|
|
|
2744
2731
|
}
|
|
2745
2732
|
|
|
2746
2733
|
// src/commands/activity/fetchCommitsPerDay.ts
|
|
2747
|
-
import { execSync as
|
|
2734
|
+
import { execSync as execSync15 } from "child_process";
|
|
2748
2735
|
function fetchContributions(from, to) {
|
|
2749
2736
|
const query = `{ viewer { contributionsCollection(from: "${from}T00:00:00Z", to: "${to}T23:59:59Z") { contributionCalendar { weeks { contributionDays { date contributionCount } } } } } }`;
|
|
2750
2737
|
const jq = ".data.viewer.contributionsCollection.contributionCalendar.weeks[].contributionDays[]";
|
|
2751
|
-
const raw =
|
|
2738
|
+
const raw = execSync15(`gh api graphql -f query='${query}' --jq '${jq}'`, {
|
|
2752
2739
|
encoding: "utf8"
|
|
2753
2740
|
}).trim();
|
|
2754
2741
|
if (!raw) return [];
|
|
@@ -3210,10 +3197,10 @@ import { join as join10 } from "path";
|
|
|
3210
3197
|
import chalk28 from "chalk";
|
|
3211
3198
|
|
|
3212
3199
|
// src/commands/backup/readCrontab.ts
|
|
3213
|
-
import { execSync as
|
|
3200
|
+
import { execSync as execSync16 } from "child_process";
|
|
3214
3201
|
function readCrontab() {
|
|
3215
3202
|
try {
|
|
3216
|
-
return
|
|
3203
|
+
return execSync16("crontab -l", {
|
|
3217
3204
|
encoding: "utf8",
|
|
3218
3205
|
stdio: ["ignore", "pipe", "ignore"]
|
|
3219
3206
|
});
|
|
@@ -3223,7 +3210,7 @@ function readCrontab() {
|
|
|
3223
3210
|
}
|
|
3224
3211
|
function writeCrontab(content) {
|
|
3225
3212
|
try {
|
|
3226
|
-
|
|
3213
|
+
execSync16("crontab -", {
|
|
3227
3214
|
input: content,
|
|
3228
3215
|
stdio: ["pipe", "ignore", "pipe"]
|
|
3229
3216
|
});
|
|
@@ -3557,7 +3544,7 @@ import chalk42 from "chalk";
|
|
|
3557
3544
|
import enquirer5 from "enquirer";
|
|
3558
3545
|
|
|
3559
3546
|
// src/shared/pullIfConfigured.ts
|
|
3560
|
-
import { execSync as
|
|
3547
|
+
import { execSync as execSync17 } from "child_process";
|
|
3561
3548
|
import chalk31 from "chalk";
|
|
3562
3549
|
function pullIfConfigured() {
|
|
3563
3550
|
const config = loadConfig();
|
|
@@ -3571,7 +3558,7 @@ function pullIfConfigured() {
|
|
|
3571
3558
|
return;
|
|
3572
3559
|
}
|
|
3573
3560
|
try {
|
|
3574
|
-
|
|
3561
|
+
execSync17("git pull --ff-only", { stdio: "inherit" });
|
|
3575
3562
|
} catch {
|
|
3576
3563
|
console.error(chalk31.red("git pull --ff-only failed; aborting."));
|
|
3577
3564
|
process.exit(1);
|
|
@@ -3579,7 +3566,7 @@ function pullIfConfigured() {
|
|
|
3579
3566
|
}
|
|
3580
3567
|
function hasLocalChanges() {
|
|
3581
3568
|
try {
|
|
3582
|
-
const status2 =
|
|
3569
|
+
const status2 = execSync17("git status --porcelain", {
|
|
3583
3570
|
encoding: "utf8"
|
|
3584
3571
|
});
|
|
3585
3572
|
return status2.trim().length > 0;
|
|
@@ -3592,7 +3579,7 @@ function hasLocalChanges() {
|
|
|
3592
3579
|
import {
|
|
3593
3580
|
existsSync as existsSync15,
|
|
3594
3581
|
mkdirSync as mkdirSync4,
|
|
3595
|
-
readFileSync as
|
|
3582
|
+
readFileSync as readFileSync11,
|
|
3596
3583
|
unlinkSync as unlinkSync2,
|
|
3597
3584
|
writeFileSync as writeFileSync13
|
|
3598
3585
|
} from "fs";
|
|
@@ -3616,7 +3603,7 @@ function isLockedByOther(itemId) {
|
|
|
3616
3603
|
const lockPath = getLockPath(itemId);
|
|
3617
3604
|
if (!existsSync15(lockPath)) return false;
|
|
3618
3605
|
try {
|
|
3619
|
-
const lock = JSON.parse(
|
|
3606
|
+
const lock = JSON.parse(readFileSync11(lockPath, "utf8"));
|
|
3620
3607
|
if (lock.pid === process.pid) return false;
|
|
3621
3608
|
return isProcessAlive(lock.pid);
|
|
3622
3609
|
} catch {
|
|
@@ -3828,11 +3815,11 @@ function backupLocalBacklogFiles(dir) {
|
|
|
3828
3815
|
}
|
|
3829
3816
|
|
|
3830
3817
|
// src/commands/backlog/gitPullBacklog.ts
|
|
3831
|
-
import { execSync as
|
|
3818
|
+
import { execSync as execSync18 } from "child_process";
|
|
3832
3819
|
import chalk34 from "chalk";
|
|
3833
3820
|
function gitPullBacklog(dir) {
|
|
3834
3821
|
try {
|
|
3835
|
-
|
|
3822
|
+
execSync18("git pull --ff-only", {
|
|
3836
3823
|
cwd: dir,
|
|
3837
3824
|
stdio: ["pipe", "pipe", "pipe"]
|
|
3838
3825
|
});
|
|
@@ -4069,7 +4056,7 @@ async function loadAllItems(orm, origin) {
|
|
|
4069
4056
|
}
|
|
4070
4057
|
|
|
4071
4058
|
// src/commands/backlog/parseBacklogJsonl.ts
|
|
4072
|
-
import { readFileSync as
|
|
4059
|
+
import { readFileSync as readFileSync12 } from "fs";
|
|
4073
4060
|
|
|
4074
4061
|
// src/commands/backlog/types.ts
|
|
4075
4062
|
import { z as z3 } from "zod";
|
|
@@ -4114,7 +4101,7 @@ var backlogFileSchema = z3.array(backlogItemSchema);
|
|
|
4114
4101
|
|
|
4115
4102
|
// src/commands/backlog/parseBacklogJsonl.ts
|
|
4116
4103
|
function parseBacklogJsonl(path57) {
|
|
4117
|
-
const content =
|
|
4104
|
+
const content = readFileSync12(path57, "utf8").trim();
|
|
4118
4105
|
if (content.length === 0) return [];
|
|
4119
4106
|
return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
|
|
4120
4107
|
}
|
|
@@ -4460,7 +4447,7 @@ Failed to launch Claude for ${context}: ${message}`)
|
|
|
4460
4447
|
}
|
|
4461
4448
|
|
|
4462
4449
|
// src/shared/emitActivity.ts
|
|
4463
|
-
import { mkdirSync as mkdirSync7, readFileSync as
|
|
4450
|
+
import { mkdirSync as mkdirSync7, readFileSync as readFileSync13, rmSync, writeFileSync as writeFileSync16 } from "fs";
|
|
4464
4451
|
import { homedir as homedir7 } from "os";
|
|
4465
4452
|
import { dirname as dirname14, join as join18 } from "path";
|
|
4466
4453
|
import { z as z4 } from "zod";
|
|
@@ -4486,7 +4473,7 @@ function emitActivity(activity2) {
|
|
|
4486
4473
|
}
|
|
4487
4474
|
function readActivity(path57) {
|
|
4488
4475
|
try {
|
|
4489
|
-
return JSON.parse(
|
|
4476
|
+
return JSON.parse(readFileSync13(path57, "utf8"));
|
|
4490
4477
|
} catch {
|
|
4491
4478
|
return void 0;
|
|
4492
4479
|
}
|
|
@@ -4502,7 +4489,7 @@ function reconcileActivity(sessionId, activity2) {
|
|
|
4502
4489
|
}
|
|
4503
4490
|
function removeActivity(sessionId) {
|
|
4504
4491
|
try {
|
|
4505
|
-
|
|
4492
|
+
rmSync(activityPath(sessionId));
|
|
4506
4493
|
} catch {
|
|
4507
4494
|
}
|
|
4508
4495
|
}
|
|
@@ -4637,7 +4624,7 @@ async function handleIncompletePhase() {
|
|
|
4637
4624
|
}
|
|
4638
4625
|
|
|
4639
4626
|
// src/commands/backlog/readSignal.ts
|
|
4640
|
-
import { existsSync as existsSync20, readFileSync as
|
|
4627
|
+
import { existsSync as existsSync20, readFileSync as readFileSync14 } from "fs";
|
|
4641
4628
|
|
|
4642
4629
|
// src/commands/backlog/writeSignal.ts
|
|
4643
4630
|
import { writeFileSync as writeFileSync17 } from "fs";
|
|
@@ -4658,7 +4645,7 @@ function readSignal() {
|
|
|
4658
4645
|
const path57 = getSignalPath();
|
|
4659
4646
|
if (!existsSync20(path57)) return void 0;
|
|
4660
4647
|
try {
|
|
4661
|
-
return JSON.parse(
|
|
4648
|
+
return JSON.parse(readFileSync14(path57, "utf8"));
|
|
4662
4649
|
} catch {
|
|
4663
4650
|
return void 0;
|
|
4664
4651
|
}
|
|
@@ -5117,7 +5104,7 @@ function printComments(item) {
|
|
|
5117
5104
|
import { WebSocketServer } from "ws";
|
|
5118
5105
|
|
|
5119
5106
|
// src/shared/getInstallDir.ts
|
|
5120
|
-
import { execSync as
|
|
5107
|
+
import { execSync as execSync19 } from "child_process";
|
|
5121
5108
|
import { dirname as dirname15, resolve as resolve7 } from "path";
|
|
5122
5109
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
5123
5110
|
var __filename2 = fileURLToPath2(import.meta.url);
|
|
@@ -5127,7 +5114,7 @@ function getInstallDir() {
|
|
|
5127
5114
|
}
|
|
5128
5115
|
function isGitRepo(dir) {
|
|
5129
5116
|
try {
|
|
5130
|
-
const result =
|
|
5117
|
+
const result = execSync19("git rev-parse --show-toplevel", {
|
|
5131
5118
|
cwd: dir,
|
|
5132
5119
|
stdio: "pipe"
|
|
5133
5120
|
}).toString().trim();
|
|
@@ -5144,11 +5131,11 @@ import {
|
|
|
5144
5131
|
import chalk49 from "chalk";
|
|
5145
5132
|
|
|
5146
5133
|
// src/lib/openBrowser.ts
|
|
5147
|
-
import { execSync as
|
|
5134
|
+
import { execSync as execSync20 } from "child_process";
|
|
5148
5135
|
function tryExec(commands) {
|
|
5149
5136
|
for (const cmd of commands) {
|
|
5150
5137
|
try {
|
|
5151
|
-
|
|
5138
|
+
execSync20(cmd, { stdio: "ignore" });
|
|
5152
5139
|
return true;
|
|
5153
5140
|
} catch {
|
|
5154
5141
|
}
|
|
@@ -5361,12 +5348,12 @@ function delay(ms) {
|
|
|
5361
5348
|
|
|
5362
5349
|
// src/commands/sessions/web/handleRequest.ts
|
|
5363
5350
|
import { createHash as createHash2 } from "crypto";
|
|
5364
|
-
import { readFileSync as
|
|
5351
|
+
import { readFileSync as readFileSync16 } from "fs";
|
|
5365
5352
|
import { createRequire as createRequire2 } from "module";
|
|
5366
5353
|
|
|
5367
5354
|
// src/shared/createBundleHandler.ts
|
|
5368
5355
|
import { createHash } from "crypto";
|
|
5369
|
-
import { readFileSync as
|
|
5356
|
+
import { readFileSync as readFileSync15 } from "fs";
|
|
5370
5357
|
import { dirname as dirname16, join as join20 } from "path";
|
|
5371
5358
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
5372
5359
|
function createBundleHandler(importMetaUrl, bundlePath) {
|
|
@@ -5374,7 +5361,7 @@ function createBundleHandler(importMetaUrl, bundlePath) {
|
|
|
5374
5361
|
let cache;
|
|
5375
5362
|
return (req, res) => {
|
|
5376
5363
|
if (!cache) {
|
|
5377
|
-
const body =
|
|
5364
|
+
const body = readFileSync15(join20(dir, bundlePath), "utf8");
|
|
5378
5365
|
const etag = `"${createHash("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
5379
5366
|
cache = { body, etag };
|
|
5380
5367
|
}
|
|
@@ -5723,7 +5710,7 @@ function getHtml() {
|
|
|
5723
5710
|
}
|
|
5724
5711
|
|
|
5725
5712
|
// src/commands/prs/getPreferredRemoteRepo.ts
|
|
5726
|
-
import { execSync as
|
|
5713
|
+
import { execSync as execSync21 } from "child_process";
|
|
5727
5714
|
var GITHUB_URL_PATTERN = /(?:git@github\.com:|https:\/\/github\.com\/)([^/]+)\/([^/]+?)(?:\.git)?\/?$/;
|
|
5728
5715
|
function parseGitHubUrl(url) {
|
|
5729
5716
|
const match = url.match(GITHUB_URL_PATTERN);
|
|
@@ -5732,7 +5719,7 @@ function parseGitHubUrl(url) {
|
|
|
5732
5719
|
}
|
|
5733
5720
|
function tryGetRemoteUrl(remote, cwd) {
|
|
5734
5721
|
try {
|
|
5735
|
-
return
|
|
5722
|
+
return execSync21(`git remote get-url ${remote}`, {
|
|
5736
5723
|
encoding: "utf8",
|
|
5737
5724
|
stdio: ["pipe", "pipe", "pipe"],
|
|
5738
5725
|
cwd
|
|
@@ -5743,7 +5730,7 @@ function tryGetRemoteUrl(remote, cwd) {
|
|
|
5743
5730
|
}
|
|
5744
5731
|
function getCurrentBranchRemote(cwd) {
|
|
5745
5732
|
try {
|
|
5746
|
-
const ref =
|
|
5733
|
+
const ref = execSync21(
|
|
5747
5734
|
"git rev-parse --abbrev-ref --symbolic-full-name @{u}",
|
|
5748
5735
|
{ encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], cwd }
|
|
5749
5736
|
).trim();
|
|
@@ -5755,7 +5742,7 @@ function getCurrentBranchRemote(cwd) {
|
|
|
5755
5742
|
}
|
|
5756
5743
|
function listRemotes(cwd) {
|
|
5757
5744
|
try {
|
|
5758
|
-
return
|
|
5745
|
+
return execSync21("git remote", {
|
|
5759
5746
|
encoding: "utf8",
|
|
5760
5747
|
stdio: ["pipe", "pipe", "pipe"],
|
|
5761
5748
|
cwd
|
|
@@ -6121,7 +6108,7 @@ function createCssHandler(packageEntry) {
|
|
|
6121
6108
|
return (req, res) => {
|
|
6122
6109
|
if (!cache) {
|
|
6123
6110
|
const resolved = require3.resolve(packageEntry);
|
|
6124
|
-
const body =
|
|
6111
|
+
const body = readFileSync16(resolved, "utf8");
|
|
6125
6112
|
const etag = `"${createHash2("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
6126
6113
|
cache = { body, etag };
|
|
6127
6114
|
}
|
|
@@ -6852,7 +6839,7 @@ import chalk59 from "chalk";
|
|
|
6852
6839
|
|
|
6853
6840
|
// src/commands/backlog/add/shared.ts
|
|
6854
6841
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
6855
|
-
import { mkdtempSync, readFileSync as
|
|
6842
|
+
import { mkdtempSync, readFileSync as readFileSync17, unlinkSync as unlinkSync6, writeFileSync as writeFileSync18 } from "fs";
|
|
6856
6843
|
import { tmpdir } from "os";
|
|
6857
6844
|
import { join as join21 } from "path";
|
|
6858
6845
|
import enquirer6 from "enquirer";
|
|
@@ -6902,7 +6889,7 @@ function openEditor() {
|
|
|
6902
6889
|
unlinkSync6(filePath);
|
|
6903
6890
|
return void 0;
|
|
6904
6891
|
}
|
|
6905
|
-
const content =
|
|
6892
|
+
const content = readFileSync17(filePath, "utf8").trim();
|
|
6906
6893
|
unlinkSync6(filePath);
|
|
6907
6894
|
return content || void 0;
|
|
6908
6895
|
}
|
|
@@ -8373,7 +8360,7 @@ function extractGraphqlQuery(args) {
|
|
|
8373
8360
|
}
|
|
8374
8361
|
|
|
8375
8362
|
// src/shared/loadCliReads.ts
|
|
8376
|
-
import { existsSync as existsSync23, readFileSync as
|
|
8363
|
+
import { existsSync as existsSync23, readFileSync as readFileSync18, writeFileSync as writeFileSync19 } from "fs";
|
|
8377
8364
|
import { dirname as dirname17, resolve as resolve8 } from "path";
|
|
8378
8365
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
8379
8366
|
var __filename3 = fileURLToPath4(import.meta.url);
|
|
@@ -8383,7 +8370,7 @@ function packageRoot() {
|
|
|
8383
8370
|
}
|
|
8384
8371
|
function readLines(path57) {
|
|
8385
8372
|
if (!existsSync23(path57)) return [];
|
|
8386
|
-
return
|
|
8373
|
+
return readFileSync18(path57, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
8387
8374
|
}
|
|
8388
8375
|
var cachedReads;
|
|
8389
8376
|
var cachedWrites;
|
|
@@ -8429,7 +8416,7 @@ function findCliWrite(command) {
|
|
|
8429
8416
|
}
|
|
8430
8417
|
|
|
8431
8418
|
// src/shared/readSettingsPerms.ts
|
|
8432
|
-
import { existsSync as existsSync24, readFileSync as
|
|
8419
|
+
import { existsSync as existsSync24, readFileSync as readFileSync19 } from "fs";
|
|
8433
8420
|
import { homedir as homedir9 } from "os";
|
|
8434
8421
|
import { join as join23 } from "path";
|
|
8435
8422
|
function readSettingsPerms(key) {
|
|
@@ -8447,7 +8434,7 @@ function readSettingsPerms(key) {
|
|
|
8447
8434
|
function readPermissionArray(filePath, key) {
|
|
8448
8435
|
if (!existsSync24(filePath)) return [];
|
|
8449
8436
|
try {
|
|
8450
|
-
const data = JSON.parse(
|
|
8437
|
+
const data = JSON.parse(readFileSync19(filePath, "utf8"));
|
|
8451
8438
|
const arr = data?.permissions?.[key];
|
|
8452
8439
|
return Array.isArray(arr) ? arr.filter((e) => typeof e === "string") : [];
|
|
8453
8440
|
} catch {
|
|
@@ -8709,12 +8696,12 @@ ${reasons.join("\n")}`);
|
|
|
8709
8696
|
}
|
|
8710
8697
|
|
|
8711
8698
|
// src/commands/permitCliReads/index.ts
|
|
8712
|
-
import { existsSync as existsSync25, mkdirSync as mkdirSync10, readFileSync as
|
|
8699
|
+
import { existsSync as existsSync25, mkdirSync as mkdirSync10, readFileSync as readFileSync20, writeFileSync as writeFileSync20 } from "fs";
|
|
8713
8700
|
import { homedir as homedir10 } from "os";
|
|
8714
8701
|
import { join as join24 } from "path";
|
|
8715
8702
|
|
|
8716
8703
|
// src/shared/checkCliAvailable.ts
|
|
8717
|
-
import { execSync as
|
|
8704
|
+
import { execSync as execSync22 } from "child_process";
|
|
8718
8705
|
function checkCliAvailable(cli) {
|
|
8719
8706
|
const binary = cli.split(/\s+/)[0];
|
|
8720
8707
|
const opts = {
|
|
@@ -8722,11 +8709,11 @@ function checkCliAvailable(cli) {
|
|
|
8722
8709
|
stdio: ["ignore", "pipe", "pipe"]
|
|
8723
8710
|
};
|
|
8724
8711
|
try {
|
|
8725
|
-
|
|
8712
|
+
execSync22(`command -v ${binary}`, opts);
|
|
8726
8713
|
return true;
|
|
8727
8714
|
} catch {
|
|
8728
8715
|
try {
|
|
8729
|
-
|
|
8716
|
+
execSync22(`where ${binary}`, opts);
|
|
8730
8717
|
return true;
|
|
8731
8718
|
} catch {
|
|
8732
8719
|
return false;
|
|
@@ -9005,7 +8992,7 @@ function logPath(cli) {
|
|
|
9005
8992
|
function readCache(cli) {
|
|
9006
8993
|
const path57 = logPath(cli);
|
|
9007
8994
|
if (!existsSync25(path57)) return void 0;
|
|
9008
|
-
return
|
|
8995
|
+
return readFileSync20(path57, "utf8");
|
|
9009
8996
|
}
|
|
9010
8997
|
function writeCache(cli, output) {
|
|
9011
8998
|
const dir = join24(homedir10(), ".assist");
|
|
@@ -9151,11 +9138,11 @@ import ts5 from "typescript";
|
|
|
9151
9138
|
// src/commands/complexity/findSourceFiles.ts
|
|
9152
9139
|
import fs15 from "fs";
|
|
9153
9140
|
import path20 from "path";
|
|
9154
|
-
import { minimatch as
|
|
9141
|
+
import { minimatch as minimatch5 } from "minimatch";
|
|
9155
9142
|
function applyIgnoreGlobs(files, extraIgnore = []) {
|
|
9156
9143
|
const { complexity } = loadConfig();
|
|
9157
9144
|
const ignore2 = [...complexity.ignore, ...extraIgnore];
|
|
9158
|
-
return files.filter((f) => !ignore2.some((glob) =>
|
|
9145
|
+
return files.filter((f) => !ignore2.some((glob) => minimatch5(f, glob)));
|
|
9159
9146
|
}
|
|
9160
9147
|
function walk(dir, results) {
|
|
9161
9148
|
if (!fs15.existsSync(dir)) {
|
|
@@ -9179,7 +9166,7 @@ function findSourceFiles2(pattern2, baseDir = ".", extraIgnore = []) {
|
|
|
9179
9166
|
if (pattern2.includes("*")) {
|
|
9180
9167
|
walk(baseDir, results);
|
|
9181
9168
|
return applyIgnoreGlobs(
|
|
9182
|
-
results.filter((f) =>
|
|
9169
|
+
results.filter((f) => minimatch5(f, pattern2)),
|
|
9183
9170
|
extraIgnore
|
|
9184
9171
|
);
|
|
9185
9172
|
}
|
|
@@ -9192,7 +9179,7 @@ function findSourceFiles2(pattern2, baseDir = ".", extraIgnore = []) {
|
|
|
9192
9179
|
}
|
|
9193
9180
|
walk(baseDir, results);
|
|
9194
9181
|
return applyIgnoreGlobs(
|
|
9195
|
-
results.filter((f) =>
|
|
9182
|
+
results.filter((f) => minimatch5(f, pattern2)),
|
|
9196
9183
|
extraIgnore
|
|
9197
9184
|
);
|
|
9198
9185
|
}
|
|
@@ -9817,7 +9804,7 @@ function registerConfig(program2) {
|
|
|
9817
9804
|
}
|
|
9818
9805
|
|
|
9819
9806
|
// src/commands/deploy/redirect.ts
|
|
9820
|
-
import { existsSync as existsSync26, readFileSync as
|
|
9807
|
+
import { existsSync as existsSync26, readFileSync as readFileSync21, writeFileSync as writeFileSync21 } from "fs";
|
|
9821
9808
|
import chalk99 from "chalk";
|
|
9822
9809
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
9823
9810
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -9830,7 +9817,7 @@ function redirect() {
|
|
|
9830
9817
|
console.log(chalk99.yellow("No index.html found"));
|
|
9831
9818
|
return;
|
|
9832
9819
|
}
|
|
9833
|
-
const content =
|
|
9820
|
+
const content = readFileSync21(indexPath, "utf8");
|
|
9834
9821
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
9835
9822
|
console.log(chalk99.dim("Trailing slash script already present"));
|
|
9836
9823
|
return;
|
|
@@ -9869,11 +9856,11 @@ function loadBlogSkipDays(repoName) {
|
|
|
9869
9856
|
}
|
|
9870
9857
|
|
|
9871
9858
|
// src/commands/devlog/shared.ts
|
|
9872
|
-
import { execSync as
|
|
9859
|
+
import { execSync as execSync23 } from "child_process";
|
|
9873
9860
|
import chalk100 from "chalk";
|
|
9874
9861
|
|
|
9875
9862
|
// src/shared/getRepoName.ts
|
|
9876
|
-
import { existsSync as existsSync27, readFileSync as
|
|
9863
|
+
import { existsSync as existsSync27, readFileSync as readFileSync22 } from "fs";
|
|
9877
9864
|
import { basename as basename3, join as join26 } from "path";
|
|
9878
9865
|
function getRepoName() {
|
|
9879
9866
|
const config = loadConfig();
|
|
@@ -9883,7 +9870,7 @@ function getRepoName() {
|
|
|
9883
9870
|
const packageJsonPath = join26(process.cwd(), "package.json");
|
|
9884
9871
|
if (existsSync27(packageJsonPath)) {
|
|
9885
9872
|
try {
|
|
9886
|
-
const content =
|
|
9873
|
+
const content = readFileSync22(packageJsonPath, "utf8");
|
|
9887
9874
|
const pkg = JSON.parse(content);
|
|
9888
9875
|
if (pkg.name) {
|
|
9889
9876
|
return pkg.name;
|
|
@@ -9895,7 +9882,7 @@ function getRepoName() {
|
|
|
9895
9882
|
}
|
|
9896
9883
|
|
|
9897
9884
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
9898
|
-
import { readdirSync, readFileSync as
|
|
9885
|
+
import { readdirSync, readFileSync as readFileSync23 } from "fs";
|
|
9899
9886
|
import { join as join27 } from "path";
|
|
9900
9887
|
var DEVLOG_DIR = join27(BLOG_REPO_ROOT, "src/content/devlog");
|
|
9901
9888
|
function extractFrontmatter(content) {
|
|
@@ -9925,7 +9912,7 @@ function readDevlogFiles(callback) {
|
|
|
9925
9912
|
try {
|
|
9926
9913
|
const files = readdirSync(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
9927
9914
|
for (const file of files) {
|
|
9928
|
-
const content =
|
|
9915
|
+
const content = readFileSync23(join27(DEVLOG_DIR, file), "utf8");
|
|
9929
9916
|
const parsed = parseFrontmatter(content, file);
|
|
9930
9917
|
if (parsed) callback(parsed);
|
|
9931
9918
|
}
|
|
@@ -9961,7 +9948,7 @@ function loadAllDevlogLatestDates() {
|
|
|
9961
9948
|
// src/commands/devlog/shared.ts
|
|
9962
9949
|
function getCommitFiles(hash) {
|
|
9963
9950
|
try {
|
|
9964
|
-
const output =
|
|
9951
|
+
const output = execSync23(`git show --name-only --format="" ${hash}`, {
|
|
9965
9952
|
encoding: "utf8"
|
|
9966
9953
|
});
|
|
9967
9954
|
return output.trim().split("\n").filter(Boolean);
|
|
@@ -10057,11 +10044,11 @@ function list3(options2) {
|
|
|
10057
10044
|
}
|
|
10058
10045
|
|
|
10059
10046
|
// src/commands/devlog/getLastVersionInfo.ts
|
|
10060
|
-
import { execFileSync as execFileSync3, execSync as
|
|
10047
|
+
import { execFileSync as execFileSync3, execSync as execSync24 } from "child_process";
|
|
10061
10048
|
import semver from "semver";
|
|
10062
10049
|
function getVersionAtCommit(hash) {
|
|
10063
10050
|
try {
|
|
10064
|
-
const content =
|
|
10051
|
+
const content = execSync24(`git show ${hash}:package.json`, {
|
|
10065
10052
|
encoding: "utf8"
|
|
10066
10053
|
});
|
|
10067
10054
|
const pkg = JSON.parse(content);
|
|
@@ -10234,7 +10221,7 @@ function next2(options2) {
|
|
|
10234
10221
|
}
|
|
10235
10222
|
|
|
10236
10223
|
// src/commands/devlog/repos/index.ts
|
|
10237
|
-
import { execSync as
|
|
10224
|
+
import { execSync as execSync25 } from "child_process";
|
|
10238
10225
|
|
|
10239
10226
|
// src/commands/devlog/repos/printReposTable.ts
|
|
10240
10227
|
import chalk104 from "chalk";
|
|
@@ -10269,7 +10256,7 @@ function getStatus(lastPush, lastDevlog) {
|
|
|
10269
10256
|
return lastDevlog < lastPush ? "outdated" : "ok";
|
|
10270
10257
|
}
|
|
10271
10258
|
function fetchRepos(days, all) {
|
|
10272
|
-
const json =
|
|
10259
|
+
const json = execSync25(
|
|
10273
10260
|
"gh repo list staff0rd --json name,pushedAt,isArchived --limit 200",
|
|
10274
10261
|
{ encoding: "utf8" }
|
|
10275
10262
|
);
|
|
@@ -10453,11 +10440,11 @@ async function checkBuildLocksCommand() {
|
|
|
10453
10440
|
}
|
|
10454
10441
|
|
|
10455
10442
|
// src/commands/dotnet/buildTree.ts
|
|
10456
|
-
import { readFileSync as
|
|
10443
|
+
import { readFileSync as readFileSync24 } from "fs";
|
|
10457
10444
|
import path23 from "path";
|
|
10458
10445
|
var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
|
|
10459
10446
|
function getProjectRefs(csprojPath) {
|
|
10460
|
-
const content =
|
|
10447
|
+
const content = readFileSync24(csprojPath, "utf8");
|
|
10461
10448
|
const refs = [];
|
|
10462
10449
|
for (const match of content.matchAll(PROJECT_REF_RE)) {
|
|
10463
10450
|
refs.push(match[1].replace(/\\/g, "/"));
|
|
@@ -10474,7 +10461,7 @@ function buildTree(csprojPath, repoRoot, visited = /* @__PURE__ */ new Set()) {
|
|
|
10474
10461
|
for (const ref of getProjectRefs(abs)) {
|
|
10475
10462
|
const childAbs = path23.resolve(dir, ref);
|
|
10476
10463
|
try {
|
|
10477
|
-
|
|
10464
|
+
readFileSync24(childAbs);
|
|
10478
10465
|
node.children.push(buildTree(childAbs, repoRoot, visited));
|
|
10479
10466
|
} catch {
|
|
10480
10467
|
node.children.push({
|
|
@@ -10499,7 +10486,7 @@ function collectAllDeps(node) {
|
|
|
10499
10486
|
}
|
|
10500
10487
|
|
|
10501
10488
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
10502
|
-
import { readdirSync as readdirSync3, readFileSync as
|
|
10489
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync25, statSync as statSync2 } from "fs";
|
|
10503
10490
|
import path24 from "path";
|
|
10504
10491
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
10505
10492
|
if (depth > maxDepth) return [];
|
|
@@ -10534,7 +10521,7 @@ function findContainingSolutions(csprojPath, repoRoot) {
|
|
|
10534
10521
|
const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
|
|
10535
10522
|
for (const sln of slnFiles) {
|
|
10536
10523
|
try {
|
|
10537
|
-
const content =
|
|
10524
|
+
const content = readFileSync25(sln, "utf8");
|
|
10538
10525
|
if (pattern2.test(content)) {
|
|
10539
10526
|
matches.push(path24.relative(repoRoot, sln));
|
|
10540
10527
|
}
|
|
@@ -10629,7 +10616,7 @@ async function deps(csprojPath, options2) {
|
|
|
10629
10616
|
}
|
|
10630
10617
|
|
|
10631
10618
|
// src/commands/dotnet/getChangedCsFiles.ts
|
|
10632
|
-
import { execSync as
|
|
10619
|
+
import { execSync as execSync26 } from "child_process";
|
|
10633
10620
|
var SCOPE_ALL = "all";
|
|
10634
10621
|
var SCOPE_BASE = "base:";
|
|
10635
10622
|
var SCOPE_COMMIT = "commit:";
|
|
@@ -10653,7 +10640,7 @@ function getChangedCsFiles(scope) {
|
|
|
10653
10640
|
} else {
|
|
10654
10641
|
cmd = "git diff --name-only HEAD";
|
|
10655
10642
|
}
|
|
10656
|
-
const output =
|
|
10643
|
+
const output = execSync26(cmd, { encoding: "utf8" }).trim();
|
|
10657
10644
|
if (output === "") return [];
|
|
10658
10645
|
return output.split("\n").filter((f) => f.toLowerCase().endsWith(".cs"));
|
|
10659
10646
|
}
|
|
@@ -10851,14 +10838,14 @@ function parseInspectReport(json) {
|
|
|
10851
10838
|
}
|
|
10852
10839
|
|
|
10853
10840
|
// src/commands/dotnet/runInspectCode.ts
|
|
10854
|
-
import { execSync as
|
|
10855
|
-
import { existsSync as existsSync31, readFileSync as
|
|
10841
|
+
import { execSync as execSync27 } from "child_process";
|
|
10842
|
+
import { existsSync as existsSync31, readFileSync as readFileSync26, unlinkSync as unlinkSync7 } from "fs";
|
|
10856
10843
|
import { tmpdir as tmpdir3 } from "os";
|
|
10857
10844
|
import path27 from "path";
|
|
10858
10845
|
import chalk114 from "chalk";
|
|
10859
10846
|
function assertJbInstalled() {
|
|
10860
10847
|
try {
|
|
10861
|
-
|
|
10848
|
+
execSync27("jb inspectcode --version", { stdio: "pipe" });
|
|
10862
10849
|
} catch {
|
|
10863
10850
|
console.error(chalk114.red("jb is not installed. Install with:"));
|
|
10864
10851
|
console.error(
|
|
@@ -10872,7 +10859,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
10872
10859
|
const includeFlag = include ? ` --include="${include}"` : "";
|
|
10873
10860
|
const sweaFlag = swea ? " --swea" : "";
|
|
10874
10861
|
try {
|
|
10875
|
-
|
|
10862
|
+
execSync27(
|
|
10876
10863
|
`jb inspectcode "${slnPath}" -o="${reportPath}"${includeFlag}${sweaFlag} --verbosity=OFF`,
|
|
10877
10864
|
{ stdio: "pipe" }
|
|
10878
10865
|
);
|
|
@@ -10887,13 +10874,13 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
10887
10874
|
console.error(chalk114.red("Report file not generated"));
|
|
10888
10875
|
process.exit(1);
|
|
10889
10876
|
}
|
|
10890
|
-
const xml =
|
|
10877
|
+
const xml = readFileSync26(reportPath, "utf8");
|
|
10891
10878
|
unlinkSync7(reportPath);
|
|
10892
10879
|
return xml;
|
|
10893
10880
|
}
|
|
10894
10881
|
|
|
10895
10882
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
10896
|
-
import { execSync as
|
|
10883
|
+
import { execSync as execSync28 } from "child_process";
|
|
10897
10884
|
import chalk115 from "chalk";
|
|
10898
10885
|
function resolveMsbuildPath() {
|
|
10899
10886
|
const { run: run4 } = loadConfig();
|
|
@@ -10904,7 +10891,7 @@ function resolveMsbuildPath() {
|
|
|
10904
10891
|
function assertMsbuildInstalled() {
|
|
10905
10892
|
const msbuild = resolveMsbuildPath();
|
|
10906
10893
|
try {
|
|
10907
|
-
|
|
10894
|
+
execSync28(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
10908
10895
|
} catch {
|
|
10909
10896
|
console.error(chalk115.red(`msbuild not found at: ${msbuild}`));
|
|
10910
10897
|
console.error(
|
|
@@ -10930,7 +10917,7 @@ function runRoslynInspect(slnPath) {
|
|
|
10930
10917
|
const msbuild = resolveMsbuildPath();
|
|
10931
10918
|
let output;
|
|
10932
10919
|
try {
|
|
10933
|
-
output =
|
|
10920
|
+
output = execSync28(
|
|
10934
10921
|
`"${msbuild}" "${slnPath}" -t:Build -v:minimal -maxcpucount -p:EnforceCodeStyleInBuild=true -p:RunAnalyzersDuringBuild=true 2>&1`,
|
|
10935
10922
|
{ encoding: "utf8", stdio: "pipe", maxBuffer: 50 * 1024 * 1024 }
|
|
10936
10923
|
);
|
|
@@ -11230,8 +11217,8 @@ async function countPendingHandovers(orm, origin) {
|
|
|
11230
11217
|
import {
|
|
11231
11218
|
existsSync as existsSync32,
|
|
11232
11219
|
readdirSync as readdirSync5,
|
|
11233
|
-
readFileSync as
|
|
11234
|
-
rmSync as
|
|
11220
|
+
readFileSync as readFileSync27,
|
|
11221
|
+
rmSync as rmSync2,
|
|
11235
11222
|
statSync as statSync3
|
|
11236
11223
|
} from "fs";
|
|
11237
11224
|
import { basename as basename5, join as join34 } from "path";
|
|
@@ -11293,14 +11280,14 @@ function collectMarkdown(dir) {
|
|
|
11293
11280
|
return out;
|
|
11294
11281
|
}
|
|
11295
11282
|
async function migrateFile(orm, origin, file, createdAt) {
|
|
11296
|
-
const content =
|
|
11283
|
+
const content = readFileSync27(file, "utf8");
|
|
11297
11284
|
await saveHandover(orm, {
|
|
11298
11285
|
origin,
|
|
11299
11286
|
summary: summariseHandoverContent(content),
|
|
11300
11287
|
content,
|
|
11301
11288
|
createdAt
|
|
11302
11289
|
});
|
|
11303
|
-
|
|
11290
|
+
rmSync2(file);
|
|
11304
11291
|
}
|
|
11305
11292
|
async function migrateDiskHandovers(orm, origin, cwd = process.cwd()) {
|
|
11306
11293
|
let migrated = 0;
|
|
@@ -11501,12 +11488,12 @@ function adfToText(doc) {
|
|
|
11501
11488
|
}
|
|
11502
11489
|
|
|
11503
11490
|
// src/commands/jira/fetchIssue.ts
|
|
11504
|
-
import { execSync as
|
|
11491
|
+
import { execSync as execSync29 } from "child_process";
|
|
11505
11492
|
import chalk119 from "chalk";
|
|
11506
11493
|
function fetchIssue(issueKey, fields) {
|
|
11507
11494
|
let result;
|
|
11508
11495
|
try {
|
|
11509
|
-
result =
|
|
11496
|
+
result = execSync29(
|
|
11510
11497
|
`acli jira workitem view ${issueKey} -f ${fields} --json`,
|
|
11511
11498
|
{ encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] }
|
|
11512
11499
|
);
|
|
@@ -11552,10 +11539,10 @@ function acceptanceCriteria(issueKey) {
|
|
|
11552
11539
|
}
|
|
11553
11540
|
|
|
11554
11541
|
// src/commands/jira/jiraAuth.ts
|
|
11555
|
-
import { execSync as
|
|
11542
|
+
import { execSync as execSync30 } from "child_process";
|
|
11556
11543
|
|
|
11557
11544
|
// src/shared/loadJson.ts
|
|
11558
|
-
import { existsSync as existsSync33, mkdirSync as mkdirSync11, readFileSync as
|
|
11545
|
+
import { existsSync as existsSync33, mkdirSync as mkdirSync11, readFileSync as readFileSync28, writeFileSync as writeFileSync24 } from "fs";
|
|
11559
11546
|
import { homedir as homedir12 } from "os";
|
|
11560
11547
|
import { join as join35 } from "path";
|
|
11561
11548
|
function getStoreDir() {
|
|
@@ -11568,7 +11555,7 @@ function loadJson(filename) {
|
|
|
11568
11555
|
const path57 = getStorePath(filename);
|
|
11569
11556
|
if (existsSync33(path57)) {
|
|
11570
11557
|
try {
|
|
11571
|
-
return JSON.parse(
|
|
11558
|
+
return JSON.parse(readFileSync28(path57, "utf8"));
|
|
11572
11559
|
} catch {
|
|
11573
11560
|
return {};
|
|
11574
11561
|
}
|
|
@@ -11616,7 +11603,7 @@ async function jiraAuth() {
|
|
|
11616
11603
|
console.error("All fields are required.");
|
|
11617
11604
|
process.exit(1);
|
|
11618
11605
|
}
|
|
11619
|
-
|
|
11606
|
+
execSync30(`acli jira auth login --site ${site} --email "${email}" --token`, {
|
|
11620
11607
|
encoding: "utf8",
|
|
11621
11608
|
input: token,
|
|
11622
11609
|
stdio: ["pipe", "inherit", "inherit"]
|
|
@@ -11724,7 +11711,7 @@ import { resolve as resolve11 } from "path";
|
|
|
11724
11711
|
import chalk125 from "chalk";
|
|
11725
11712
|
|
|
11726
11713
|
// src/commands/mermaid/exportFile.ts
|
|
11727
|
-
import { readFileSync as
|
|
11714
|
+
import { readFileSync as readFileSync29, writeFileSync as writeFileSync25 } from "fs";
|
|
11728
11715
|
import { basename as basename6, extname, resolve as resolve10 } from "path";
|
|
11729
11716
|
import chalk124 from "chalk";
|
|
11730
11717
|
|
|
@@ -11750,7 +11737,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
11750
11737
|
|
|
11751
11738
|
// src/commands/mermaid/exportFile.ts
|
|
11752
11739
|
async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
11753
|
-
const content =
|
|
11740
|
+
const content = readFileSync29(file, "utf8");
|
|
11754
11741
|
const blocks = extractMermaidBlocks(content);
|
|
11755
11742
|
const stem = basename6(file, extname(file));
|
|
11756
11743
|
if (onlyIndex !== void 0) {
|
|
@@ -12034,7 +12021,7 @@ import { join as join40 } from "path";
|
|
|
12034
12021
|
import chalk128 from "chalk";
|
|
12035
12022
|
|
|
12036
12023
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
12037
|
-
import { readFileSync as
|
|
12024
|
+
import { readFileSync as readFileSync30 } from "fs";
|
|
12038
12025
|
|
|
12039
12026
|
// src/commands/netcap/parseRscRows.ts
|
|
12040
12027
|
var isRscRef = (v) => typeof v === "string" && /^\$[0-9a-fL@]/.test(v);
|
|
@@ -12430,7 +12417,7 @@ function extractVoyagerPosts(body) {
|
|
|
12430
12417
|
|
|
12431
12418
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
12432
12419
|
function captureEntries(captureFile) {
|
|
12433
|
-
const lines =
|
|
12420
|
+
const lines = readFileSync30(captureFile, "utf8").split("\n").filter(Boolean);
|
|
12434
12421
|
const entries = [];
|
|
12435
12422
|
for (const line of lines) {
|
|
12436
12423
|
let entry;
|
|
@@ -12590,7 +12577,7 @@ function registerPrompts(program2) {
|
|
|
12590
12577
|
}
|
|
12591
12578
|
|
|
12592
12579
|
// src/commands/prs/shared.ts
|
|
12593
|
-
import { execSync as
|
|
12580
|
+
import { execSync as execSync31 } from "child_process";
|
|
12594
12581
|
function isGhNotInstalled(error) {
|
|
12595
12582
|
if (error instanceof Error) {
|
|
12596
12583
|
const msg = error.message.toLowerCase();
|
|
@@ -12608,12 +12595,12 @@ function getRepoInfo() {
|
|
|
12608
12595
|
const preferred = getPreferredRemoteRepo();
|
|
12609
12596
|
if (preferred) return preferred;
|
|
12610
12597
|
const repoInfo = JSON.parse(
|
|
12611
|
-
|
|
12598
|
+
execSync31("gh repo view --json owner,name", { encoding: "utf8" })
|
|
12612
12599
|
);
|
|
12613
12600
|
return { org: repoInfo.owner.login, repo: repoInfo.name };
|
|
12614
12601
|
}
|
|
12615
12602
|
function getCurrentBranch() {
|
|
12616
|
-
return
|
|
12603
|
+
return execSync31("git rev-parse --abbrev-ref HEAD", {
|
|
12617
12604
|
encoding: "utf8"
|
|
12618
12605
|
}).trim();
|
|
12619
12606
|
}
|
|
@@ -12621,7 +12608,7 @@ function viewCurrentPr(fields) {
|
|
|
12621
12608
|
const { org, repo } = getRepoInfo();
|
|
12622
12609
|
const branch = getCurrentBranch();
|
|
12623
12610
|
return JSON.parse(
|
|
12624
|
-
|
|
12611
|
+
execSync31(`gh pr view ${branch} --json ${fields} -R ${org}/${repo}`, {
|
|
12625
12612
|
encoding: "utf8"
|
|
12626
12613
|
})
|
|
12627
12614
|
);
|
|
@@ -12725,7 +12712,7 @@ function comment2(path57, line, body, startLine) {
|
|
|
12725
12712
|
}
|
|
12726
12713
|
|
|
12727
12714
|
// src/commands/prs/edit.ts
|
|
12728
|
-
import { execSync as
|
|
12715
|
+
import { execSync as execSync32 } from "child_process";
|
|
12729
12716
|
|
|
12730
12717
|
// src/commands/prs/buildPrBody.ts
|
|
12731
12718
|
function jiraBrowseUrl(key) {
|
|
@@ -12898,23 +12885,23 @@ function edit(options2) {
|
|
|
12898
12885
|
if (options2.title) args.push(`--title ${shellQuote(options2.title)}`);
|
|
12899
12886
|
args.push(`--body ${shellQuote(newBody)}`);
|
|
12900
12887
|
try {
|
|
12901
|
-
|
|
12888
|
+
execSync32(args.join(" "), { stdio: "inherit" });
|
|
12902
12889
|
} catch {
|
|
12903
12890
|
process.exit(1);
|
|
12904
12891
|
}
|
|
12905
12892
|
}
|
|
12906
12893
|
|
|
12907
12894
|
// src/commands/prs/fixed.ts
|
|
12908
|
-
import { execSync as
|
|
12895
|
+
import { execSync as execSync35 } from "child_process";
|
|
12909
12896
|
|
|
12910
12897
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
12911
|
-
import { execSync as
|
|
12898
|
+
import { execSync as execSync34 } from "child_process";
|
|
12912
12899
|
import { unlinkSync as unlinkSync10, writeFileSync as writeFileSync27 } from "fs";
|
|
12913
12900
|
import { tmpdir as tmpdir5 } from "os";
|
|
12914
12901
|
import { join as join42 } from "path";
|
|
12915
12902
|
|
|
12916
12903
|
// src/commands/prs/loadCommentsCache.ts
|
|
12917
|
-
import { existsSync as existsSync34, readFileSync as
|
|
12904
|
+
import { existsSync as existsSync34, readFileSync as readFileSync31, unlinkSync as unlinkSync9 } from "fs";
|
|
12918
12905
|
import { join as join41 } from "path";
|
|
12919
12906
|
import { parse as parse2 } from "yaml";
|
|
12920
12907
|
function getCachePath(prNumber) {
|
|
@@ -12925,7 +12912,7 @@ function loadCommentsCache(prNumber) {
|
|
|
12925
12912
|
if (!existsSync34(cachePath)) {
|
|
12926
12913
|
return null;
|
|
12927
12914
|
}
|
|
12928
|
-
const content =
|
|
12915
|
+
const content = readFileSync31(cachePath, "utf8");
|
|
12929
12916
|
return parse2(content);
|
|
12930
12917
|
}
|
|
12931
12918
|
function deleteCommentsCache(prNumber) {
|
|
@@ -12937,9 +12924,9 @@ function deleteCommentsCache(prNumber) {
|
|
|
12937
12924
|
}
|
|
12938
12925
|
|
|
12939
12926
|
// src/commands/prs/replyToComment.ts
|
|
12940
|
-
import { execSync as
|
|
12927
|
+
import { execSync as execSync33 } from "child_process";
|
|
12941
12928
|
function replyToComment(org, repo, prNumber, commentId, message) {
|
|
12942
|
-
|
|
12929
|
+
execSync33(
|
|
12943
12930
|
`gh api repos/${org}/${repo}/pulls/${prNumber}/comments -f body="${message.replace(/"/g, String.raw`\"`)}" -F in_reply_to=${commentId}`,
|
|
12944
12931
|
{ stdio: ["inherit", "pipe", "inherit"] }
|
|
12945
12932
|
);
|
|
@@ -12951,7 +12938,7 @@ function resolveThread(threadId) {
|
|
|
12951
12938
|
const queryFile = join42(tmpdir5(), `gh-mutation-${Date.now()}.graphql`);
|
|
12952
12939
|
writeFileSync27(queryFile, mutation);
|
|
12953
12940
|
try {
|
|
12954
|
-
|
|
12941
|
+
execSync34(
|
|
12955
12942
|
`gh api graphql -F query=@${queryFile} -f threadId="${threadId}"`,
|
|
12956
12943
|
{ stdio: ["inherit", "pipe", "inherit"] }
|
|
12957
12944
|
);
|
|
@@ -13003,7 +12990,7 @@ function resolveCommentWithReply(commentId, message) {
|
|
|
13003
12990
|
// src/commands/prs/fixed.ts
|
|
13004
12991
|
function verifySha(sha) {
|
|
13005
12992
|
try {
|
|
13006
|
-
return
|
|
12993
|
+
return execSync35(`git rev-parse --verify ${sha}`, {
|
|
13007
12994
|
encoding: "utf8"
|
|
13008
12995
|
}).trim();
|
|
13009
12996
|
} catch {
|
|
@@ -13017,7 +13004,7 @@ function fixed(commentId, sha) {
|
|
|
13017
13004
|
const { org, repo } = getRepoInfo();
|
|
13018
13005
|
const repoUrl = `https://github.com/${org}/${repo}`;
|
|
13019
13006
|
const message = `Fixed in [${fullSha}](${repoUrl}/commit/${fullSha})`;
|
|
13020
|
-
|
|
13007
|
+
execSync35("git push", { stdio: "inherit" });
|
|
13021
13008
|
resolveCommentWithReply(commentId, message);
|
|
13022
13009
|
} catch (error) {
|
|
13023
13010
|
if (isGhNotInstalled(error)) {
|
|
@@ -13035,7 +13022,7 @@ import { join as join44 } from "path";
|
|
|
13035
13022
|
import { stringify } from "yaml";
|
|
13036
13023
|
|
|
13037
13024
|
// src/commands/prs/fetchThreadIds.ts
|
|
13038
|
-
import { execSync as
|
|
13025
|
+
import { execSync as execSync36 } from "child_process";
|
|
13039
13026
|
import { unlinkSync as unlinkSync11, writeFileSync as writeFileSync28 } from "fs";
|
|
13040
13027
|
import { tmpdir as tmpdir6 } from "os";
|
|
13041
13028
|
import { join as join43 } from "path";
|
|
@@ -13044,7 +13031,7 @@ function fetchThreadIds(org, repo, prNumber) {
|
|
|
13044
13031
|
const queryFile = join43(tmpdir6(), `gh-query-${Date.now()}.graphql`);
|
|
13045
13032
|
writeFileSync28(queryFile, THREAD_QUERY);
|
|
13046
13033
|
try {
|
|
13047
|
-
const result =
|
|
13034
|
+
const result = execSync36(
|
|
13048
13035
|
`gh api graphql -F query=@${queryFile} -F owner="${org}" -F repo="${repo}" -F prNumber=${prNumber}`,
|
|
13049
13036
|
{ encoding: "utf8" }
|
|
13050
13037
|
);
|
|
@@ -13066,9 +13053,9 @@ function fetchThreadIds(org, repo, prNumber) {
|
|
|
13066
13053
|
}
|
|
13067
13054
|
|
|
13068
13055
|
// src/commands/prs/listComments/fetchReviewComments.ts
|
|
13069
|
-
import { execSync as
|
|
13056
|
+
import { execSync as execSync37 } from "child_process";
|
|
13070
13057
|
function fetchJson(endpoint) {
|
|
13071
|
-
const result =
|
|
13058
|
+
const result = execSync37(`gh api --paginate ${endpoint}`, {
|
|
13072
13059
|
encoding: "utf8"
|
|
13073
13060
|
});
|
|
13074
13061
|
if (!result.trim()) return [];
|
|
@@ -13207,7 +13194,7 @@ async function listComments() {
|
|
|
13207
13194
|
}
|
|
13208
13195
|
|
|
13209
13196
|
// src/commands/prs/prs/index.ts
|
|
13210
|
-
import { execSync as
|
|
13197
|
+
import { execSync as execSync38 } from "child_process";
|
|
13211
13198
|
|
|
13212
13199
|
// src/commands/prs/prs/displayPaginated/index.ts
|
|
13213
13200
|
import enquirer9 from "enquirer";
|
|
@@ -13314,7 +13301,7 @@ async function prs(options2) {
|
|
|
13314
13301
|
const state = options2.open ? "open" : options2.closed ? "closed" : "all";
|
|
13315
13302
|
try {
|
|
13316
13303
|
const { org, repo } = getRepoInfo();
|
|
13317
|
-
const result =
|
|
13304
|
+
const result = execSync38(
|
|
13318
13305
|
`gh pr list --state ${state} --json number,title,url,author,createdAt,mergedAt,closedAt,state,changedFiles --limit 100 -R ${org}/${repo}`,
|
|
13319
13306
|
{ encoding: "utf8" }
|
|
13320
13307
|
);
|
|
@@ -13337,7 +13324,7 @@ async function prs(options2) {
|
|
|
13337
13324
|
}
|
|
13338
13325
|
|
|
13339
13326
|
// src/commands/prs/raise.ts
|
|
13340
|
-
import { execSync as
|
|
13327
|
+
import { execSync as execSync39 } from "child_process";
|
|
13341
13328
|
|
|
13342
13329
|
// src/commands/prs/buildCreateArgs.ts
|
|
13343
13330
|
function buildCreateArgs(title, body, options2) {
|
|
@@ -13397,7 +13384,7 @@ function raise(options2) {
|
|
|
13397
13384
|
`--body ${shellQuote(body)}`
|
|
13398
13385
|
] : buildCreateArgs(options2.title, body, options2);
|
|
13399
13386
|
try {
|
|
13400
|
-
|
|
13387
|
+
execSync39(args.join(" "), { stdio: "inherit" });
|
|
13401
13388
|
} catch {
|
|
13402
13389
|
process.exit(1);
|
|
13403
13390
|
}
|
|
@@ -13429,7 +13416,7 @@ function reply(commentId, body) {
|
|
|
13429
13416
|
}
|
|
13430
13417
|
|
|
13431
13418
|
// src/commands/prs/wontfix.ts
|
|
13432
|
-
import { execSync as
|
|
13419
|
+
import { execSync as execSync40 } from "child_process";
|
|
13433
13420
|
function validateReason(reason) {
|
|
13434
13421
|
const lowerReason = reason.toLowerCase();
|
|
13435
13422
|
if (lowerReason.includes("claude") || lowerReason.includes("opus")) {
|
|
@@ -13446,7 +13433,7 @@ function validateShaReferences(reason) {
|
|
|
13446
13433
|
const invalidShas = [];
|
|
13447
13434
|
for (const sha of shas) {
|
|
13448
13435
|
try {
|
|
13449
|
-
|
|
13436
|
+
execSync40(`git cat-file -t ${sha}`, { stdio: "pipe" });
|
|
13450
13437
|
} catch {
|
|
13451
13438
|
invalidShas.push(sha);
|
|
13452
13439
|
}
|
|
@@ -13608,10 +13595,10 @@ import chalk135 from "chalk";
|
|
|
13608
13595
|
import Enquirer2 from "enquirer";
|
|
13609
13596
|
|
|
13610
13597
|
// src/commands/ravendb/searchItems.ts
|
|
13611
|
-
import { execSync as
|
|
13598
|
+
import { execSync as execSync41 } from "child_process";
|
|
13612
13599
|
import chalk134 from "chalk";
|
|
13613
13600
|
function opExec(args) {
|
|
13614
|
-
return
|
|
13601
|
+
return execSync41(`op ${args}`, {
|
|
13615
13602
|
encoding: "utf8",
|
|
13616
13603
|
stdio: ["pipe", "pipe", "pipe"]
|
|
13617
13604
|
}).trim();
|
|
@@ -13763,7 +13750,7 @@ ${errorText}`
|
|
|
13763
13750
|
}
|
|
13764
13751
|
|
|
13765
13752
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
13766
|
-
import { execSync as
|
|
13753
|
+
import { execSync as execSync42 } from "child_process";
|
|
13767
13754
|
import chalk139 from "chalk";
|
|
13768
13755
|
function resolveOpSecret(reference) {
|
|
13769
13756
|
if (!reference.startsWith("op://")) {
|
|
@@ -13771,7 +13758,7 @@ function resolveOpSecret(reference) {
|
|
|
13771
13758
|
process.exit(1);
|
|
13772
13759
|
}
|
|
13773
13760
|
try {
|
|
13774
|
-
return
|
|
13761
|
+
return execSync42(`op read "${reference}"`, {
|
|
13775
13762
|
encoding: "utf8",
|
|
13776
13763
|
stdio: ["pipe", "pipe", "pipe"]
|
|
13777
13764
|
}).trim();
|
|
@@ -14020,9 +14007,9 @@ Refactor check failed:
|
|
|
14020
14007
|
}
|
|
14021
14008
|
|
|
14022
14009
|
// src/commands/refactor/check/getViolations/index.ts
|
|
14023
|
-
import { execSync as
|
|
14010
|
+
import { execSync as execSync43 } from "child_process";
|
|
14024
14011
|
import fs20 from "fs";
|
|
14025
|
-
import { minimatch as
|
|
14012
|
+
import { minimatch as minimatch6 } from "minimatch";
|
|
14026
14013
|
|
|
14027
14014
|
// src/commands/refactor/check/getViolations/getIgnoredFiles.ts
|
|
14028
14015
|
import fs19 from "fs";
|
|
@@ -14070,7 +14057,7 @@ function getGitFiles(options2) {
|
|
|
14070
14057
|
}
|
|
14071
14058
|
const files = /* @__PURE__ */ new Set();
|
|
14072
14059
|
if (options2.staged || options2.modified) {
|
|
14073
|
-
const staged =
|
|
14060
|
+
const staged = execSync43("git diff --cached --name-only", {
|
|
14074
14061
|
encoding: "utf8"
|
|
14075
14062
|
});
|
|
14076
14063
|
for (const file of staged.trim().split("\n").filter(Boolean)) {
|
|
@@ -14078,7 +14065,7 @@ function getGitFiles(options2) {
|
|
|
14078
14065
|
}
|
|
14079
14066
|
}
|
|
14080
14067
|
if (options2.unstaged || options2.modified) {
|
|
14081
|
-
const unstaged =
|
|
14068
|
+
const unstaged = execSync43("git diff --name-only", { encoding: "utf8" });
|
|
14082
14069
|
for (const file of unstaged.trim().split("\n").filter(Boolean)) {
|
|
14083
14070
|
files.add(file);
|
|
14084
14071
|
}
|
|
@@ -14090,7 +14077,7 @@ function getViolations(pattern2, options2 = {}, maxLines = DEFAULT_MAX_LINES) {
|
|
|
14090
14077
|
const ignoredFiles = getIgnoredFiles();
|
|
14091
14078
|
const gitFiles = getGitFiles(options2);
|
|
14092
14079
|
if (pattern2) {
|
|
14093
|
-
sourceFiles = sourceFiles.filter((f) =>
|
|
14080
|
+
sourceFiles = sourceFiles.filter((f) => minimatch6(f, pattern2));
|
|
14094
14081
|
}
|
|
14095
14082
|
if (gitFiles) {
|
|
14096
14083
|
sourceFiles = sourceFiles.filter((f) => gitFiles.has(f));
|
|
@@ -14175,7 +14162,7 @@ import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
|
14175
14162
|
import {
|
|
14176
14163
|
SyntaxKind as SyntaxKind2
|
|
14177
14164
|
} from "ts-morph";
|
|
14178
|
-
var suppressionPattern = /^\s*(\/\/|\/\*)\s*
|
|
14165
|
+
var suppressionPattern = /^\s*(\/\/|\/\*)\s*oxlint-disable\b/;
|
|
14179
14166
|
function countLeadingSuppressions(sourceFile) {
|
|
14180
14167
|
let count6 = 0;
|
|
14181
14168
|
for (const stmt of sourceFile.getStatementsWithComments()) {
|
|
@@ -15722,9 +15709,9 @@ function buildReviewPaths(repoRoot, key) {
|
|
|
15722
15709
|
}
|
|
15723
15710
|
|
|
15724
15711
|
// src/commands/review/fetchExistingComments.ts
|
|
15725
|
-
import { execSync as
|
|
15712
|
+
import { execSync as execSync44 } from "child_process";
|
|
15726
15713
|
function fetchRawComments(org, repo, prNumber) {
|
|
15727
|
-
const out =
|
|
15714
|
+
const out = execSync44(
|
|
15728
15715
|
`gh api --paginate repos/${org}/${repo}/pulls/${prNumber}/comments`,
|
|
15729
15716
|
{ encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }
|
|
15730
15717
|
);
|
|
@@ -15755,14 +15742,14 @@ function fetchExistingComments() {
|
|
|
15755
15742
|
}
|
|
15756
15743
|
|
|
15757
15744
|
// src/commands/review/gatherContext.ts
|
|
15758
|
-
import { execSync as
|
|
15745
|
+
import { execSync as execSync47 } from "child_process";
|
|
15759
15746
|
|
|
15760
15747
|
// src/commands/review/fetchPrDiff.ts
|
|
15761
|
-
import { execSync as
|
|
15748
|
+
import { execSync as execSync45 } from "child_process";
|
|
15762
15749
|
function fetchPrDiff(prNumber, baseSha, headSha) {
|
|
15763
15750
|
const { org, repo } = getRepoInfo();
|
|
15764
15751
|
try {
|
|
15765
|
-
return
|
|
15752
|
+
return execSync45(`gh pr diff ${prNumber} -R ${org}/${repo}`, {
|
|
15766
15753
|
encoding: "utf8",
|
|
15767
15754
|
maxBuffer: 256 * 1024 * 1024,
|
|
15768
15755
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -15777,19 +15764,19 @@ function isDiffTooLarge(error) {
|
|
|
15777
15764
|
}
|
|
15778
15765
|
function fetchDiffViaGit(baseSha, headSha) {
|
|
15779
15766
|
try {
|
|
15780
|
-
|
|
15767
|
+
execSync45(`git fetch origin ${baseSha} ${headSha}`, { stdio: "ignore" });
|
|
15781
15768
|
} catch {
|
|
15782
15769
|
}
|
|
15783
|
-
return
|
|
15770
|
+
return execSync45(`git diff ${baseSha}...${headSha}`, {
|
|
15784
15771
|
encoding: "utf8",
|
|
15785
15772
|
maxBuffer: 256 * 1024 * 1024
|
|
15786
15773
|
});
|
|
15787
15774
|
}
|
|
15788
15775
|
|
|
15789
15776
|
// src/commands/review/fetchPrDiffInfo.ts
|
|
15790
|
-
import { execSync as
|
|
15777
|
+
import { execSync as execSync46 } from "child_process";
|
|
15791
15778
|
function getCurrentBranch2() {
|
|
15792
|
-
return
|
|
15779
|
+
return execSync46("git rev-parse --abbrev-ref HEAD", {
|
|
15793
15780
|
encoding: "utf8"
|
|
15794
15781
|
}).trim();
|
|
15795
15782
|
}
|
|
@@ -15799,7 +15786,7 @@ function fetchPrDiffInfo() {
|
|
|
15799
15786
|
const fields = "number,baseRefName,baseRefOid,headRefName,headRefOid";
|
|
15800
15787
|
let raw;
|
|
15801
15788
|
try {
|
|
15802
|
-
raw =
|
|
15789
|
+
raw = execSync46(`gh pr view ${branch} --json ${fields} -R ${org}/${repo}`, {
|
|
15803
15790
|
encoding: "utf8",
|
|
15804
15791
|
stdio: ["ignore", "pipe", "pipe"]
|
|
15805
15792
|
});
|
|
@@ -15823,7 +15810,7 @@ function fetchPrDiffInfo() {
|
|
|
15823
15810
|
}
|
|
15824
15811
|
function fetchPrChangedFiles(prNumber) {
|
|
15825
15812
|
const { org, repo } = getRepoInfo();
|
|
15826
|
-
const out =
|
|
15813
|
+
const out = execSync46(
|
|
15827
15814
|
`gh api repos/${org}/${repo}/pulls/${prNumber}/files --paginate --jq ".[].filename"`,
|
|
15828
15815
|
{
|
|
15829
15816
|
encoding: "utf8",
|
|
@@ -15835,11 +15822,11 @@ function fetchPrChangedFiles(prNumber) {
|
|
|
15835
15822
|
|
|
15836
15823
|
// src/commands/review/gatherContext.ts
|
|
15837
15824
|
function gatherContext() {
|
|
15838
|
-
const branch =
|
|
15825
|
+
const branch = execSync47("git rev-parse --abbrev-ref HEAD", {
|
|
15839
15826
|
encoding: "utf8"
|
|
15840
15827
|
}).trim();
|
|
15841
|
-
const sha =
|
|
15842
|
-
const shortSha =
|
|
15828
|
+
const sha = execSync47("git rev-parse HEAD", { encoding: "utf8" }).trim();
|
|
15829
|
+
const shortSha = execSync47("git rev-parse --short=7 HEAD", {
|
|
15843
15830
|
encoding: "utf8"
|
|
15844
15831
|
}).trim();
|
|
15845
15832
|
const prInfo = fetchPrDiffInfo();
|
|
@@ -15860,7 +15847,7 @@ function gatherContext() {
|
|
|
15860
15847
|
}
|
|
15861
15848
|
|
|
15862
15849
|
// src/commands/review/postReviewToPr.ts
|
|
15863
|
-
import { readFileSync as
|
|
15850
|
+
import { readFileSync as readFileSync32 } from "fs";
|
|
15864
15851
|
|
|
15865
15852
|
// src/commands/review/parseFindings.ts
|
|
15866
15853
|
var SEVERITIES = ["blocker", "major", "minor", "nit"];
|
|
@@ -16170,7 +16157,7 @@ async function confirmPost(prNumber, count6, options2) {
|
|
|
16170
16157
|
async function postReviewToPr(synthesisPath, options2) {
|
|
16171
16158
|
const prInfo = fetchPrDiffInfo();
|
|
16172
16159
|
const prNumber = prInfo.prNumber;
|
|
16173
|
-
const markdown =
|
|
16160
|
+
const markdown = readFileSync32(synthesisPath, "utf8");
|
|
16174
16161
|
const findings = parseFindings(markdown);
|
|
16175
16162
|
if (findings.length === 0) {
|
|
16176
16163
|
console.log("Synthesis contains no findings; nothing to post.");
|
|
@@ -17054,7 +17041,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
|
|
|
17054
17041
|
}
|
|
17055
17042
|
|
|
17056
17043
|
// src/commands/review/synthesise.ts
|
|
17057
|
-
import { readFileSync as
|
|
17044
|
+
import { readFileSync as readFileSync33 } from "fs";
|
|
17058
17045
|
|
|
17059
17046
|
// src/commands/review/buildSynthesisStdin.ts
|
|
17060
17047
|
var SYNTHESIS_PROMPT = `You are consolidating two independent code reviews of the same change. The original review request is in request.md. The two reviews are in claude.md and codex.md in the current working directory.
|
|
@@ -17110,7 +17097,7 @@ Files:
|
|
|
17110
17097
|
|
|
17111
17098
|
// src/commands/review/synthesise.ts
|
|
17112
17099
|
function printSummary2(synthesisPath) {
|
|
17113
|
-
const markdown =
|
|
17100
|
+
const markdown = readFileSync33(synthesisPath, "utf8");
|
|
17114
17101
|
console.log("");
|
|
17115
17102
|
console.log(buildReviewSummary(markdown));
|
|
17116
17103
|
console.log("");
|
|
@@ -18124,7 +18111,7 @@ async function fixInvalidDatePrefixes(vttFiles) {
|
|
|
18124
18111
|
}
|
|
18125
18112
|
|
|
18126
18113
|
// src/commands/transcript/format/processVttFile/index.ts
|
|
18127
|
-
import { existsSync as existsSync40, mkdirSync as mkdirSync15, readFileSync as
|
|
18114
|
+
import { existsSync as existsSync40, mkdirSync as mkdirSync15, readFileSync as readFileSync34, writeFileSync as writeFileSync32 } from "fs";
|
|
18128
18115
|
import { basename as basename9, dirname as dirname23, join as join49 } from "path";
|
|
18129
18116
|
|
|
18130
18117
|
// src/commands/transcript/cleanText.ts
|
|
@@ -18372,7 +18359,7 @@ function logReduction(cueCount, messageCount) {
|
|
|
18372
18359
|
}
|
|
18373
18360
|
function readAndParseCues(inputPath) {
|
|
18374
18361
|
console.log(`Reading: ${inputPath}`);
|
|
18375
|
-
return processCues(
|
|
18362
|
+
return processCues(readFileSync34(inputPath, "utf8"));
|
|
18376
18363
|
}
|
|
18377
18364
|
function writeFormatted(outputPath, content) {
|
|
18378
18365
|
writeFileSync32(outputPath, content, "utf8");
|
|
@@ -18450,9 +18437,9 @@ import { basename as basename10, dirname as dirname25, join as join51, relative
|
|
|
18450
18437
|
import {
|
|
18451
18438
|
existsSync as existsSync42,
|
|
18452
18439
|
mkdirSync as mkdirSync16,
|
|
18453
|
-
readFileSync as
|
|
18440
|
+
readFileSync as readFileSync35,
|
|
18454
18441
|
renameSync as renameSync3,
|
|
18455
|
-
rmSync as
|
|
18442
|
+
rmSync as rmSync3
|
|
18456
18443
|
} from "fs";
|
|
18457
18444
|
import { dirname as dirname24, join as join50 } from "path";
|
|
18458
18445
|
|
|
@@ -18494,7 +18481,7 @@ function processStagedFile() {
|
|
|
18494
18481
|
}
|
|
18495
18482
|
const { transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
18496
18483
|
const stagedFile = stagedFiles[0];
|
|
18497
|
-
const content =
|
|
18484
|
+
const content = readFileSync35(stagedFile.absolutePath, "utf8");
|
|
18498
18485
|
validateStagedContent(stagedFile.filename, content);
|
|
18499
18486
|
const stagedBaseName = getTranscriptBaseName(stagedFile.filename);
|
|
18500
18487
|
const transcriptFiles = findMdFilesRecursive(transcriptsDir);
|
|
@@ -18515,7 +18502,7 @@ function processStagedFile() {
|
|
|
18515
18502
|
renameSync3(stagedFile.absolutePath, destPath);
|
|
18516
18503
|
const remaining = findMdFilesRecursive(STAGING_DIR);
|
|
18517
18504
|
if (remaining.length === 0) {
|
|
18518
|
-
|
|
18505
|
+
rmSync3(STAGING_DIR, { recursive: true });
|
|
18519
18506
|
}
|
|
18520
18507
|
return true;
|
|
18521
18508
|
}
|
|
@@ -18606,9 +18593,9 @@ function registerVerify(program2) {
|
|
|
18606
18593
|
verifyCommand.command("hardcoded-colors").description("Check for hardcoded hex colors in src/").action(hardcodedColors);
|
|
18607
18594
|
verifyCommand.command("comment-policy").description("Check for undocumented comments added on changed lines").action(commentPolicy);
|
|
18608
18595
|
verifyCommand.command("no-venv").description("Check that no venv folders exist in the repo").action(noVenv);
|
|
18609
|
-
verifyCommand.command("
|
|
18610
|
-
"Check
|
|
18611
|
-
).action(
|
|
18596
|
+
verifyCommand.command("forbidden-strings").description(
|
|
18597
|
+
"Check configured JSON files for values matching forbiddenStrings rules"
|
|
18598
|
+
).action(forbiddenStrings);
|
|
18612
18599
|
}
|
|
18613
18600
|
|
|
18614
18601
|
// src/commands/voice/devices.ts
|
|
@@ -18649,14 +18636,14 @@ function devices() {
|
|
|
18649
18636
|
}
|
|
18650
18637
|
|
|
18651
18638
|
// src/commands/voice/logs.ts
|
|
18652
|
-
import { existsSync as existsSync44, readFileSync as
|
|
18639
|
+
import { existsSync as existsSync44, readFileSync as readFileSync36 } from "fs";
|
|
18653
18640
|
function logs(options2) {
|
|
18654
18641
|
if (!existsSync44(voicePaths.log)) {
|
|
18655
18642
|
console.log("No voice log file found");
|
|
18656
18643
|
return;
|
|
18657
18644
|
}
|
|
18658
18645
|
const count6 = Number.parseInt(options2.lines ?? "150", 10);
|
|
18659
|
-
const content =
|
|
18646
|
+
const content = readFileSync36(voicePaths.log, "utf8").trim();
|
|
18660
18647
|
if (!content) {
|
|
18661
18648
|
console.log("Voice log is empty");
|
|
18662
18649
|
return;
|
|
@@ -18682,8 +18669,8 @@ import { mkdirSync as mkdirSync18 } from "fs";
|
|
|
18682
18669
|
import { join as join55 } from "path";
|
|
18683
18670
|
|
|
18684
18671
|
// src/commands/voice/checkLockFile.ts
|
|
18685
|
-
import { execSync as
|
|
18686
|
-
import { existsSync as existsSync45, mkdirSync as mkdirSync17, readFileSync as
|
|
18672
|
+
import { execSync as execSync48 } from "child_process";
|
|
18673
|
+
import { existsSync as existsSync45, mkdirSync as mkdirSync17, readFileSync as readFileSync37, writeFileSync as writeFileSync33 } from "fs";
|
|
18687
18674
|
import { join as join54 } from "path";
|
|
18688
18675
|
function isProcessAlive2(pid) {
|
|
18689
18676
|
try {
|
|
@@ -18697,7 +18684,7 @@ function checkLockFile() {
|
|
|
18697
18684
|
const lockFile = getLockFile();
|
|
18698
18685
|
if (!existsSync45(lockFile)) return;
|
|
18699
18686
|
try {
|
|
18700
|
-
const lock = JSON.parse(
|
|
18687
|
+
const lock = JSON.parse(readFileSync37(lockFile, "utf8"));
|
|
18701
18688
|
if (lock.pid && isProcessAlive2(lock.pid)) {
|
|
18702
18689
|
console.error(
|
|
18703
18690
|
`Voice daemon already running (PID ${lock.pid}, env: ${lock.env}). Stop it first with: assist voice stop`
|
|
@@ -18711,7 +18698,7 @@ function bootstrapVenv() {
|
|
|
18711
18698
|
if (existsSync45(getVenvPython())) return;
|
|
18712
18699
|
console.log("Setting up Python environment...");
|
|
18713
18700
|
const pythonDir = getPythonDir();
|
|
18714
|
-
|
|
18701
|
+
execSync48(
|
|
18715
18702
|
`uv sync --project "${pythonDir}" --extra runtime --no-install-project`,
|
|
18716
18703
|
{
|
|
18717
18704
|
stdio: "inherit",
|
|
@@ -18799,7 +18786,7 @@ function start2(options2) {
|
|
|
18799
18786
|
}
|
|
18800
18787
|
|
|
18801
18788
|
// src/commands/voice/status.ts
|
|
18802
|
-
import { existsSync as existsSync46, readFileSync as
|
|
18789
|
+
import { existsSync as existsSync46, readFileSync as readFileSync38 } from "fs";
|
|
18803
18790
|
function isProcessAlive3(pid) {
|
|
18804
18791
|
try {
|
|
18805
18792
|
process.kill(pid, 0);
|
|
@@ -18810,7 +18797,7 @@ function isProcessAlive3(pid) {
|
|
|
18810
18797
|
}
|
|
18811
18798
|
function readRecentLogs(count6) {
|
|
18812
18799
|
if (!existsSync46(voicePaths.log)) return [];
|
|
18813
|
-
const lines =
|
|
18800
|
+
const lines = readFileSync38(voicePaths.log, "utf8").trim().split("\n");
|
|
18814
18801
|
return lines.slice(-count6);
|
|
18815
18802
|
}
|
|
18816
18803
|
function status() {
|
|
@@ -18818,7 +18805,7 @@ function status() {
|
|
|
18818
18805
|
console.log("Voice daemon: not running (no PID file)");
|
|
18819
18806
|
return;
|
|
18820
18807
|
}
|
|
18821
|
-
const pid = Number.parseInt(
|
|
18808
|
+
const pid = Number.parseInt(readFileSync38(voicePaths.pid, "utf8").trim(), 10);
|
|
18822
18809
|
const alive = isProcessAlive3(pid);
|
|
18823
18810
|
console.log(`Voice daemon: ${alive ? "running" : "dead"} (PID ${pid})`);
|
|
18824
18811
|
const recent = readRecentLogs(5);
|
|
@@ -18837,13 +18824,13 @@ function status() {
|
|
|
18837
18824
|
}
|
|
18838
18825
|
|
|
18839
18826
|
// src/commands/voice/stop.ts
|
|
18840
|
-
import { existsSync as existsSync47, readFileSync as
|
|
18827
|
+
import { existsSync as existsSync47, readFileSync as readFileSync39, unlinkSync as unlinkSync15 } from "fs";
|
|
18841
18828
|
function stop2() {
|
|
18842
18829
|
if (!existsSync47(voicePaths.pid)) {
|
|
18843
18830
|
console.log("Voice daemon is not running (no PID file)");
|
|
18844
18831
|
return;
|
|
18845
18832
|
}
|
|
18846
|
-
const pid = Number.parseInt(
|
|
18833
|
+
const pid = Number.parseInt(readFileSync39(voicePaths.pid, "utf8").trim(), 10);
|
|
18847
18834
|
try {
|
|
18848
18835
|
process.kill(pid, "SIGTERM");
|
|
18849
18836
|
console.log(`Sent SIGTERM to voice daemon (PID ${pid})`);
|
|
@@ -19034,7 +19021,7 @@ async function auth() {
|
|
|
19034
19021
|
|
|
19035
19022
|
// src/commands/roam/postRoamActivity.ts
|
|
19036
19023
|
import { execFileSync as execFileSync7 } from "child_process";
|
|
19037
|
-
import { readdirSync as readdirSync8, readFileSync as
|
|
19024
|
+
import { readdirSync as readdirSync8, readFileSync as readFileSync40, statSync as statSync6 } from "fs";
|
|
19038
19025
|
import { join as join57 } from "path";
|
|
19039
19026
|
function findPortFile(roamDir) {
|
|
19040
19027
|
let entries;
|
|
@@ -19060,7 +19047,7 @@ function postRoamActivity(app, event) {
|
|
|
19060
19047
|
if (!portFile) return;
|
|
19061
19048
|
let port;
|
|
19062
19049
|
try {
|
|
19063
|
-
port =
|
|
19050
|
+
port = readFileSync40(portFile, "utf8").trim();
|
|
19064
19051
|
} catch {
|
|
19065
19052
|
return;
|
|
19066
19053
|
}
|
|
@@ -19188,11 +19175,11 @@ function resolveParams(params, cliArgs) {
|
|
|
19188
19175
|
}
|
|
19189
19176
|
|
|
19190
19177
|
// src/commands/run/runPreCommands.ts
|
|
19191
|
-
import { execSync as
|
|
19178
|
+
import { execSync as execSync49 } from "child_process";
|
|
19192
19179
|
function runPreCommands(pre, cwd) {
|
|
19193
19180
|
for (const cmd of pre) {
|
|
19194
19181
|
try {
|
|
19195
|
-
|
|
19182
|
+
execSync49(cmd, { stdio: "inherit", cwd });
|
|
19196
19183
|
} catch (error) {
|
|
19197
19184
|
const code = error && typeof error === "object" && "status" in error ? error.status : 1;
|
|
19198
19185
|
process.exit(code);
|
|
@@ -19476,7 +19463,7 @@ function registerRun(program2) {
|
|
|
19476
19463
|
}
|
|
19477
19464
|
|
|
19478
19465
|
// src/commands/screenshot/index.ts
|
|
19479
|
-
import { execSync as
|
|
19466
|
+
import { execSync as execSync50 } from "child_process";
|
|
19480
19467
|
import { existsSync as existsSync50, mkdirSync as mkdirSync21, unlinkSync as unlinkSync17, writeFileSync as writeFileSync36 } from "fs";
|
|
19481
19468
|
import { tmpdir as tmpdir7 } from "os";
|
|
19482
19469
|
import { join as join61, resolve as resolve15 } from "path";
|
|
@@ -19619,7 +19606,7 @@ function runPowerShellScript(processName, outputPath) {
|
|
|
19619
19606
|
const scriptPath = join61(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
|
|
19620
19607
|
writeFileSync36(scriptPath, captureWindowPs1, "utf8");
|
|
19621
19608
|
try {
|
|
19622
|
-
|
|
19609
|
+
execSync50(
|
|
19623
19610
|
`powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
|
|
19624
19611
|
{ stdio: ["ignore", "pipe", "pipe"], encoding: "utf8" }
|
|
19625
19612
|
);
|
|
@@ -19693,7 +19680,7 @@ function applyLine(result, pending, line) {
|
|
|
19693
19680
|
}
|
|
19694
19681
|
|
|
19695
19682
|
// src/commands/sessions/daemon/reportStolenSocket.ts
|
|
19696
|
-
import { readFileSync as
|
|
19683
|
+
import { readFileSync as readFileSync41 } from "fs";
|
|
19697
19684
|
function reportStolenSocket(socketPid) {
|
|
19698
19685
|
if (!socketPid) return;
|
|
19699
19686
|
const filePid = readPidFile();
|
|
@@ -19705,7 +19692,7 @@ function reportStolenSocket(socketPid) {
|
|
|
19705
19692
|
function readPidFile() {
|
|
19706
19693
|
try {
|
|
19707
19694
|
const pid = Number.parseInt(
|
|
19708
|
-
|
|
19695
|
+
readFileSync41(daemonPaths.pid, "utf8").trim(),
|
|
19709
19696
|
10
|
|
19710
19697
|
);
|
|
19711
19698
|
return Number.isInteger(pid) ? pid : void 0;
|
|
@@ -21566,7 +21553,7 @@ function handleConnection(socket, manager) {
|
|
|
21566
21553
|
import { unlinkSync as unlinkSync18, writeFileSync as writeFileSync37 } from "fs";
|
|
21567
21554
|
|
|
21568
21555
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
21569
|
-
import { readFileSync as
|
|
21556
|
+
import { readFileSync as readFileSync42 } from "fs";
|
|
21570
21557
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
21571
21558
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
21572
21559
|
const timer = setInterval(() => {
|
|
@@ -21577,7 +21564,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
21577
21564
|
}
|
|
21578
21565
|
function ownsPidFile() {
|
|
21579
21566
|
try {
|
|
21580
|
-
return
|
|
21567
|
+
return readFileSync42(daemonPaths.pid, "utf8").trim() === String(process.pid);
|
|
21581
21568
|
} catch {
|
|
21582
21569
|
return false;
|
|
21583
21570
|
}
|
|
@@ -22134,7 +22121,7 @@ function syncCommands(claudeDir, targetBase) {
|
|
|
22134
22121
|
}
|
|
22135
22122
|
|
|
22136
22123
|
// src/commands/update.ts
|
|
22137
|
-
import { execSync as
|
|
22124
|
+
import { execSync as execSync51 } from "child_process";
|
|
22138
22125
|
import * as path56 from "path";
|
|
22139
22126
|
|
|
22140
22127
|
// src/commands/restartDaemonAfterUpdate.ts
|
|
@@ -22158,7 +22145,7 @@ function isGlobalNpmInstall(dir) {
|
|
|
22158
22145
|
if (resolved.split(path56.sep).includes("node_modules")) {
|
|
22159
22146
|
return true;
|
|
22160
22147
|
}
|
|
22161
|
-
const globalPrefix =
|
|
22148
|
+
const globalPrefix = execSync51("npm prefix -g", { stdio: "pipe" }).toString().trim();
|
|
22162
22149
|
return resolved.toLowerCase().startsWith(path56.resolve(globalPrefix).toLowerCase());
|
|
22163
22150
|
} catch {
|
|
22164
22151
|
return false;
|
|
@@ -22169,18 +22156,18 @@ async function update2() {
|
|
|
22169
22156
|
console.log(`Assist is installed at: ${installDir}`);
|
|
22170
22157
|
if (isGitRepo(installDir)) {
|
|
22171
22158
|
console.log("Detected git repo installation, pulling latest...");
|
|
22172
|
-
|
|
22159
|
+
execSync51("git pull", { cwd: installDir, stdio: "inherit" });
|
|
22173
22160
|
console.log("Installing dependencies...");
|
|
22174
|
-
|
|
22161
|
+
execSync51("npm i", { cwd: installDir, stdio: "inherit" });
|
|
22175
22162
|
console.log("Building...");
|
|
22176
|
-
|
|
22163
|
+
execSync51("npm run build", { cwd: installDir, stdio: "inherit" });
|
|
22177
22164
|
console.log("Syncing commands...");
|
|
22178
|
-
|
|
22165
|
+
execSync51("assist sync", { stdio: "inherit" });
|
|
22179
22166
|
} else if (isGlobalNpmInstall(installDir)) {
|
|
22180
22167
|
console.log("Detected global npm installation, updating...");
|
|
22181
|
-
|
|
22168
|
+
execSync51("npm i -g @staff0rd/assist@latest", { stdio: "inherit" });
|
|
22182
22169
|
console.log("Syncing commands...");
|
|
22183
|
-
|
|
22170
|
+
execSync51("assist sync", { stdio: "inherit" });
|
|
22184
22171
|
} else {
|
|
22185
22172
|
console.error(
|
|
22186
22173
|
"Could not determine installation method. Expected a git repo or global npm install."
|