@staff0rd/assist 0.316.0 → 0.317.1
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 +533 -458
- 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.1",
|
|
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) {
|
|
@@ -1151,8 +1132,8 @@ var options = [
|
|
|
1151
1132
|
];
|
|
1152
1133
|
|
|
1153
1134
|
// src/commands/verify/init/getAvailableOptions/index.ts
|
|
1154
|
-
function resolveDescription(
|
|
1155
|
-
return typeof
|
|
1135
|
+
function resolveDescription(desc6, setup2) {
|
|
1136
|
+
return typeof desc6 === "function" ? desc6(setup2) : desc6;
|
|
1156
1137
|
}
|
|
1157
1138
|
function toVerifyOption(def, setup2) {
|
|
1158
1139
|
return {
|
|
@@ -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 [];
|
|
@@ -2988,6 +2975,107 @@ async function seedNewsFeeds(db) {
|
|
|
2988
2975
|
}
|
|
2989
2976
|
}
|
|
2990
2977
|
|
|
2978
|
+
// src/shared/db/cleanupFalseResetSegments.ts
|
|
2979
|
+
import { and as and2, eq as eq2 } from "drizzle-orm";
|
|
2980
|
+
|
|
2981
|
+
// src/shared/db/recordWindowPeak.ts
|
|
2982
|
+
import { and, eq, gt, sql } from "drizzle-orm";
|
|
2983
|
+
var RESET_DROP_THRESHOLD = 1;
|
|
2984
|
+
var at = ({ window, resetsAt }, segment) => segment === void 0 ? and(eq(usagePeaks.window, window), eq(usagePeaks.resetsAt, resetsAt)) : and(
|
|
2985
|
+
eq(usagePeaks.window, window),
|
|
2986
|
+
eq(usagePeaks.resetsAt, resetsAt),
|
|
2987
|
+
eq(usagePeaks.segment, segment)
|
|
2988
|
+
);
|
|
2989
|
+
var lock = ({ tx, window, resetsAt }) => tx.execute(
|
|
2990
|
+
sql`SELECT pg_advisory_xact_lock(hashtextextended(${`${window}:${resetsAt}`}, 0))`
|
|
2991
|
+
);
|
|
2992
|
+
var load = (c) => c.tx.select().from(usagePeaks).where(at(c)).orderBy(usagePeaks.segment);
|
|
2993
|
+
var insertSegment = (c, segment, usedPercentage) => c.tx.insert(usagePeaks).values({
|
|
2994
|
+
window: c.window,
|
|
2995
|
+
resetsAt: c.resetsAt,
|
|
2996
|
+
segment,
|
|
2997
|
+
usedPercentage
|
|
2998
|
+
});
|
|
2999
|
+
async function collapseToReached(c, reached, usedPercentage) {
|
|
3000
|
+
await c.tx.delete(usagePeaks).where(and(at(c), gt(usagePeaks.segment, reached.segment)));
|
|
3001
|
+
await c.tx.update(usagePeaks).set({ usedPercentage, resetDetected: false }).where(at(c, reached.segment));
|
|
3002
|
+
}
|
|
3003
|
+
async function openReset(c, active, usedPercentage) {
|
|
3004
|
+
await c.tx.update(usagePeaks).set({ resetDetected: true }).where(at(c, active.segment));
|
|
3005
|
+
await insertSegment(c, active.segment + 1, usedPercentage);
|
|
3006
|
+
}
|
|
3007
|
+
async function reconcile(c, segments, usedPercentage) {
|
|
3008
|
+
const reached = segments.find((s) => usedPercentage >= s.usedPercentage);
|
|
3009
|
+
if (reached) {
|
|
3010
|
+
await collapseToReached(c, reached, usedPercentage);
|
|
3011
|
+
return;
|
|
3012
|
+
}
|
|
3013
|
+
const active = segments[segments.length - 1];
|
|
3014
|
+
if (usedPercentage < active.usedPercentage - RESET_DROP_THRESHOLD) {
|
|
3015
|
+
await openReset(c, active, usedPercentage);
|
|
3016
|
+
}
|
|
3017
|
+
}
|
|
3018
|
+
async function recordWindowPeak(db, window, resetsAt, usedPercentage) {
|
|
3019
|
+
await db.transaction(async (tx) => {
|
|
3020
|
+
const c = { tx, window, resetsAt };
|
|
3021
|
+
await lock(c);
|
|
3022
|
+
const segments = await load(c);
|
|
3023
|
+
if (segments.length === 0) await insertSegment(c, 0, usedPercentage);
|
|
3024
|
+
else await reconcile(c, segments, usedPercentage);
|
|
3025
|
+
});
|
|
3026
|
+
}
|
|
3027
|
+
|
|
3028
|
+
// src/shared/db/cleanupFalseResetSegments.ts
|
|
3029
|
+
var MIGRATION_KEY = "usage_peaks_false_reset_cleanup";
|
|
3030
|
+
var climbsBack = (top, peak) => top !== void 0 && peak > top - RESET_DROP_THRESHOLD;
|
|
3031
|
+
function mergeDown(stack, peak) {
|
|
3032
|
+
while (climbsBack(stack.at(-1), peak))
|
|
3033
|
+
peak = Math.max(peak, stack.pop() ?? peak);
|
|
3034
|
+
return peak;
|
|
3035
|
+
}
|
|
3036
|
+
function collapseSegments(peaks) {
|
|
3037
|
+
const stack = [];
|
|
3038
|
+
for (const peak of peaks) stack.push(mergeDown(stack, peak));
|
|
3039
|
+
return stack.map((usedPercentage, i) => ({
|
|
3040
|
+
segment: i,
|
|
3041
|
+
usedPercentage,
|
|
3042
|
+
resetDetected: i < stack.length - 1
|
|
3043
|
+
}));
|
|
3044
|
+
}
|
|
3045
|
+
var sig = (s) => `${s.segment}:${s.usedPercentage}:${s.resetDetected}`;
|
|
3046
|
+
var isUnchanged = (rows, collapsed) => rows.length === collapsed.length && rows.every((r, i) => sig(r) === sig(collapsed[i]));
|
|
3047
|
+
var groupByCycle = (rows) => rows.reduce((cycles, r) => {
|
|
3048
|
+
const key = `${r.window} ${r.resetsAt}`;
|
|
3049
|
+
return cycles.set(key, [...cycles.get(key) ?? [], r]);
|
|
3050
|
+
}, /* @__PURE__ */ new Map());
|
|
3051
|
+
var earliest = (rows) => rows.reduce((a, r) => r.createdAt < a ? r.createdAt : a, rows[0].createdAt);
|
|
3052
|
+
async function overwrite(tx, { window, resetsAt }, createdAt, collapsed) {
|
|
3053
|
+
await tx.delete(usagePeaks).where(
|
|
3054
|
+
and2(eq2(usagePeaks.window, window), eq2(usagePeaks.resetsAt, resetsAt))
|
|
3055
|
+
);
|
|
3056
|
+
await tx.insert(usagePeaks).values(collapsed.map((c) => ({ window, resetsAt, createdAt, ...c })));
|
|
3057
|
+
}
|
|
3058
|
+
async function rewriteCycle(tx, rows) {
|
|
3059
|
+
const collapsed = collapseSegments(rows.map((r) => r.usedPercentage));
|
|
3060
|
+
if (isUnchanged(rows, collapsed)) return;
|
|
3061
|
+
await overwrite(tx, rows[0], earliest(rows), collapsed);
|
|
3062
|
+
}
|
|
3063
|
+
var loadAll = (tx) => tx.select().from(usagePeaks).orderBy(usagePeaks.window, usagePeaks.resetsAt, usagePeaks.segment);
|
|
3064
|
+
var markRun = (tx) => tx.insert(metadata).values({ key: MIGRATION_KEY, value: "done" }).onConflictDoNothing();
|
|
3065
|
+
async function alreadyRun(tx) {
|
|
3066
|
+
const done2 = await tx.select().from(metadata).where(eq2(metadata.key, MIGRATION_KEY));
|
|
3067
|
+
return done2.length > 0;
|
|
3068
|
+
}
|
|
3069
|
+
async function cleanupFalseResetSegments(db) {
|
|
3070
|
+
await db.transaction(async (tx) => {
|
|
3071
|
+
if (await alreadyRun(tx)) return;
|
|
3072
|
+
for (const rows of groupByCycle(await loadAll(tx)).values()) {
|
|
3073
|
+
await rewriteCycle(tx, rows);
|
|
3074
|
+
}
|
|
3075
|
+
await markRun(tx);
|
|
3076
|
+
});
|
|
3077
|
+
}
|
|
3078
|
+
|
|
2991
3079
|
// src/shared/db/Db.ts
|
|
2992
3080
|
import {
|
|
2993
3081
|
drizzle as drizzleNodePg
|
|
@@ -3139,6 +3227,39 @@ function getDatabaseUrl() {
|
|
|
3139
3227
|
}
|
|
3140
3228
|
return url;
|
|
3141
3229
|
}
|
|
3230
|
+
async function runUsagePeakCleanup(orm) {
|
|
3231
|
+
try {
|
|
3232
|
+
await cleanupFalseResetSegments(orm);
|
|
3233
|
+
} catch (error) {
|
|
3234
|
+
console.error(
|
|
3235
|
+
`${(/* @__PURE__ */ new Date()).toISOString()} usage-peaks cleanup failed: ${String(error)}`
|
|
3236
|
+
);
|
|
3237
|
+
}
|
|
3238
|
+
}
|
|
3239
|
+
function logPoolError(error) {
|
|
3240
|
+
console.error(
|
|
3241
|
+
`${(/* @__PURE__ */ new Date()).toISOString()} backlog pool error: ${error.message}`
|
|
3242
|
+
);
|
|
3243
|
+
}
|
|
3244
|
+
function createPool() {
|
|
3245
|
+
const pool = new Pool({
|
|
3246
|
+
connectionString: getDatabaseUrl(),
|
|
3247
|
+
max: 10,
|
|
3248
|
+
// why: retire idle clients before managed Postgres (Supabase/Neon) drops them server-side, so we never check out a dead socket and stall on a timeout.
|
|
3249
|
+
idleTimeoutMillis: 3e4,
|
|
3250
|
+
// why: bound the wait for a free client so a degraded pool fails fast (500 + log line) rather than hanging for seconds.
|
|
3251
|
+
connectionTimeoutMillis: 1e4
|
|
3252
|
+
});
|
|
3253
|
+
pool.on("error", logPoolError);
|
|
3254
|
+
return pool;
|
|
3255
|
+
}
|
|
3256
|
+
async function initSchema(pool) {
|
|
3257
|
+
await ensureSchema((sql6) => pool.query(sql6));
|
|
3258
|
+
const orm = makeOrmFromPool(pool);
|
|
3259
|
+
await seedNewsFeeds(orm);
|
|
3260
|
+
await runUsagePeakCleanup(orm);
|
|
3261
|
+
return orm;
|
|
3262
|
+
}
|
|
3142
3263
|
var _connecting;
|
|
3143
3264
|
var _pool;
|
|
3144
3265
|
var _orm;
|
|
@@ -3146,23 +3267,8 @@ function getDb() {
|
|
|
3146
3267
|
if (_orm) return Promise.resolve(_orm);
|
|
3147
3268
|
if (_connecting) return _connecting;
|
|
3148
3269
|
_connecting = (async () => {
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
max: 10,
|
|
3152
|
-
// why: retire idle clients before managed Postgres (Supabase/Neon) drops them server-side, so we never check out a dead socket and stall on a timeout.
|
|
3153
|
-
idleTimeoutMillis: 3e4,
|
|
3154
|
-
// why: bound the wait for a free client so a degraded pool fails fast (500 + log line) rather than hanging for seconds.
|
|
3155
|
-
connectionTimeoutMillis: 1e4
|
|
3156
|
-
});
|
|
3157
|
-
pool.on("error", (err) => {
|
|
3158
|
-
console.error(
|
|
3159
|
-
`${(/* @__PURE__ */ new Date()).toISOString()} backlog pool error: ${err.message}`
|
|
3160
|
-
);
|
|
3161
|
-
});
|
|
3162
|
-
_pool = pool;
|
|
3163
|
-
await ensureSchema((sql6) => pool.query(sql6));
|
|
3164
|
-
_orm = makeOrmFromPool(pool);
|
|
3165
|
-
await seedNewsFeeds(_orm);
|
|
3270
|
+
_pool = createPool();
|
|
3271
|
+
_orm = await initSchema(_pool);
|
|
3166
3272
|
return _orm;
|
|
3167
3273
|
})();
|
|
3168
3274
|
return _connecting;
|
|
@@ -3210,10 +3316,10 @@ import { join as join10 } from "path";
|
|
|
3210
3316
|
import chalk28 from "chalk";
|
|
3211
3317
|
|
|
3212
3318
|
// src/commands/backup/readCrontab.ts
|
|
3213
|
-
import { execSync as
|
|
3319
|
+
import { execSync as execSync16 } from "child_process";
|
|
3214
3320
|
function readCrontab() {
|
|
3215
3321
|
try {
|
|
3216
|
-
return
|
|
3322
|
+
return execSync16("crontab -l", {
|
|
3217
3323
|
encoding: "utf8",
|
|
3218
3324
|
stdio: ["ignore", "pipe", "ignore"]
|
|
3219
3325
|
});
|
|
@@ -3223,7 +3329,7 @@ function readCrontab() {
|
|
|
3223
3329
|
}
|
|
3224
3330
|
function writeCrontab(content) {
|
|
3225
3331
|
try {
|
|
3226
|
-
|
|
3332
|
+
execSync16("crontab -", {
|
|
3227
3333
|
input: content,
|
|
3228
3334
|
stdio: ["pipe", "ignore", "pipe"]
|
|
3229
3335
|
});
|
|
@@ -3557,7 +3663,7 @@ import chalk42 from "chalk";
|
|
|
3557
3663
|
import enquirer5 from "enquirer";
|
|
3558
3664
|
|
|
3559
3665
|
// src/shared/pullIfConfigured.ts
|
|
3560
|
-
import { execSync as
|
|
3666
|
+
import { execSync as execSync17 } from "child_process";
|
|
3561
3667
|
import chalk31 from "chalk";
|
|
3562
3668
|
function pullIfConfigured() {
|
|
3563
3669
|
const config = loadConfig();
|
|
@@ -3571,7 +3677,7 @@ function pullIfConfigured() {
|
|
|
3571
3677
|
return;
|
|
3572
3678
|
}
|
|
3573
3679
|
try {
|
|
3574
|
-
|
|
3680
|
+
execSync17("git pull --ff-only", { stdio: "inherit" });
|
|
3575
3681
|
} catch {
|
|
3576
3682
|
console.error(chalk31.red("git pull --ff-only failed; aborting."));
|
|
3577
3683
|
process.exit(1);
|
|
@@ -3579,7 +3685,7 @@ function pullIfConfigured() {
|
|
|
3579
3685
|
}
|
|
3580
3686
|
function hasLocalChanges() {
|
|
3581
3687
|
try {
|
|
3582
|
-
const status2 =
|
|
3688
|
+
const status2 = execSync17("git status --porcelain", {
|
|
3583
3689
|
encoding: "utf8"
|
|
3584
3690
|
});
|
|
3585
3691
|
return status2.trim().length > 0;
|
|
@@ -3592,7 +3698,7 @@ function hasLocalChanges() {
|
|
|
3592
3698
|
import {
|
|
3593
3699
|
existsSync as existsSync15,
|
|
3594
3700
|
mkdirSync as mkdirSync4,
|
|
3595
|
-
readFileSync as
|
|
3701
|
+
readFileSync as readFileSync11,
|
|
3596
3702
|
unlinkSync as unlinkSync2,
|
|
3597
3703
|
writeFileSync as writeFileSync13
|
|
3598
3704
|
} from "fs";
|
|
@@ -3616,9 +3722,9 @@ function isLockedByOther(itemId) {
|
|
|
3616
3722
|
const lockPath = getLockPath(itemId);
|
|
3617
3723
|
if (!existsSync15(lockPath)) return false;
|
|
3618
3724
|
try {
|
|
3619
|
-
const
|
|
3620
|
-
if (
|
|
3621
|
-
return isProcessAlive(
|
|
3725
|
+
const lock2 = JSON.parse(readFileSync11(lockPath, "utf8"));
|
|
3726
|
+
if (lock2.pid === process.pid) return false;
|
|
3727
|
+
return isProcessAlive(lock2.pid);
|
|
3622
3728
|
} catch {
|
|
3623
3729
|
return false;
|
|
3624
3730
|
}
|
|
@@ -3828,11 +3934,11 @@ function backupLocalBacklogFiles(dir) {
|
|
|
3828
3934
|
}
|
|
3829
3935
|
|
|
3830
3936
|
// src/commands/backlog/gitPullBacklog.ts
|
|
3831
|
-
import { execSync as
|
|
3937
|
+
import { execSync as execSync18 } from "child_process";
|
|
3832
3938
|
import chalk34 from "chalk";
|
|
3833
3939
|
function gitPullBacklog(dir) {
|
|
3834
3940
|
try {
|
|
3835
|
-
|
|
3941
|
+
execSync18("git pull --ff-only", {
|
|
3836
3942
|
cwd: dir,
|
|
3837
3943
|
stdio: ["pipe", "pipe", "pipe"]
|
|
3838
3944
|
});
|
|
@@ -3948,7 +4054,7 @@ async function importItemsRemapped(orm, items2, origin) {
|
|
|
3948
4054
|
}
|
|
3949
4055
|
|
|
3950
4056
|
// src/commands/backlog/loadAllItems.ts
|
|
3951
|
-
import { asc as asc3, eq } from "drizzle-orm";
|
|
4057
|
+
import { asc as asc3, eq as eq3 } from "drizzle-orm";
|
|
3952
4058
|
|
|
3953
4059
|
// src/commands/backlog/loadRelations.ts
|
|
3954
4060
|
import { asc as asc2, inArray } from "drizzle-orm";
|
|
@@ -4058,7 +4164,7 @@ function rowToItem(row, rel) {
|
|
|
4058
4164
|
|
|
4059
4165
|
// src/commands/backlog/loadAllItems.ts
|
|
4060
4166
|
async function loadAllItems(orm, origin) {
|
|
4061
|
-
const rows = await orm.select().from(items).where(origin === void 0 ? void 0 :
|
|
4167
|
+
const rows = await orm.select().from(items).where(origin === void 0 ? void 0 : eq3(items.origin, origin)).orderBy(asc3(items.id));
|
|
4062
4168
|
if (rows.length === 0) return [];
|
|
4063
4169
|
const rel = await loadRelations(
|
|
4064
4170
|
orm,
|
|
@@ -4069,7 +4175,7 @@ async function loadAllItems(orm, origin) {
|
|
|
4069
4175
|
}
|
|
4070
4176
|
|
|
4071
4177
|
// src/commands/backlog/parseBacklogJsonl.ts
|
|
4072
|
-
import { readFileSync as
|
|
4178
|
+
import { readFileSync as readFileSync12 } from "fs";
|
|
4073
4179
|
|
|
4074
4180
|
// src/commands/backlog/types.ts
|
|
4075
4181
|
import { z as z3 } from "zod";
|
|
@@ -4114,7 +4220,7 @@ var backlogFileSchema = z3.array(backlogItemSchema);
|
|
|
4114
4220
|
|
|
4115
4221
|
// src/commands/backlog/parseBacklogJsonl.ts
|
|
4116
4222
|
function parseBacklogJsonl(path57) {
|
|
4117
|
-
const content =
|
|
4223
|
+
const content = readFileSync12(path57, "utf8").trim();
|
|
4118
4224
|
if (content.length === 0) return [];
|
|
4119
4225
|
return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
|
|
4120
4226
|
}
|
|
@@ -4169,9 +4275,9 @@ async function ensureMigrated(orm, dir, origin) {
|
|
|
4169
4275
|
}
|
|
4170
4276
|
|
|
4171
4277
|
// src/commands/backlog/deleteItem.ts
|
|
4172
|
-
import { eq as
|
|
4278
|
+
import { eq as eq4 } from "drizzle-orm";
|
|
4173
4279
|
async function deleteItem(orm, id2) {
|
|
4174
|
-
const [row] = await orm.delete(items).where(
|
|
4280
|
+
const [row] = await orm.delete(items).where(eq4(items.id, id2)).returning({ name: items.name });
|
|
4175
4281
|
return row?.name;
|
|
4176
4282
|
}
|
|
4177
4283
|
|
|
@@ -4247,27 +4353,27 @@ function getCurrentOrigin(cwd) {
|
|
|
4247
4353
|
}
|
|
4248
4354
|
|
|
4249
4355
|
// src/commands/backlog/loadItem.ts
|
|
4250
|
-
import { eq as
|
|
4356
|
+
import { eq as eq5 } from "drizzle-orm";
|
|
4251
4357
|
async function loadItem(orm, id2) {
|
|
4252
|
-
const [row] = await orm.select().from(items).where(
|
|
4358
|
+
const [row] = await orm.select().from(items).where(eq5(items.id, id2));
|
|
4253
4359
|
if (!row) return void 0;
|
|
4254
4360
|
const rel = await loadRelations(orm, [id2]);
|
|
4255
4361
|
return rowToItem(row, rel);
|
|
4256
4362
|
}
|
|
4257
4363
|
|
|
4258
4364
|
// src/commands/backlog/saveAllItems.ts
|
|
4259
|
-
import { eq as
|
|
4365
|
+
import { eq as eq7, sql as sql2 } from "drizzle-orm";
|
|
4260
4366
|
|
|
4261
4367
|
// src/commands/backlog/deleteItemRelations.ts
|
|
4262
|
-
import { eq as
|
|
4368
|
+
import { eq as eq6 } from "drizzle-orm";
|
|
4263
4369
|
|
|
4264
4370
|
// src/commands/backlog/searchItemIds.ts
|
|
4265
|
-
import { and, asc as asc4, eq as
|
|
4371
|
+
import { and as and3, asc as asc4, eq as eq8, ilike, or } from "drizzle-orm";
|
|
4266
4372
|
async function searchItemIds(orm, query, origin) {
|
|
4267
4373
|
const pattern2 = `%${query}%`;
|
|
4268
|
-
const rows = await orm.selectDistinct({ id: items.id }).from(items).leftJoin(comments,
|
|
4269
|
-
|
|
4270
|
-
origin ?
|
|
4374
|
+
const rows = await orm.selectDistinct({ id: items.id }).from(items).leftJoin(comments, eq8(comments.itemId, items.id)).leftJoin(planPhases, eq8(planPhases.itemId, items.id)).where(
|
|
4375
|
+
and3(
|
|
4376
|
+
origin ? eq8(items.origin, origin) : void 0,
|
|
4271
4377
|
or(
|
|
4272
4378
|
ilike(items.name, pattern2),
|
|
4273
4379
|
ilike(items.description, pattern2),
|
|
@@ -4281,15 +4387,15 @@ async function searchItemIds(orm, query, origin) {
|
|
|
4281
4387
|
}
|
|
4282
4388
|
|
|
4283
4389
|
// src/commands/backlog/updateCurrentPhase.ts
|
|
4284
|
-
import { eq as
|
|
4390
|
+
import { eq as eq9 } from "drizzle-orm";
|
|
4285
4391
|
async function updateCurrentPhase(orm, id2, phase) {
|
|
4286
|
-
await orm.update(items).set({ currentPhase: phase }).where(
|
|
4392
|
+
await orm.update(items).set({ currentPhase: phase }).where(eq9(items.id, id2));
|
|
4287
4393
|
}
|
|
4288
4394
|
|
|
4289
4395
|
// src/commands/backlog/updateStatus.ts
|
|
4290
|
-
import { eq as
|
|
4396
|
+
import { eq as eq10 } from "drizzle-orm";
|
|
4291
4397
|
async function updateStatus(orm, id2, status2) {
|
|
4292
|
-
const [row] = await orm.update(items).set({ status: status2 }).where(
|
|
4398
|
+
const [row] = await orm.update(items).set({ status: status2 }).where(eq10(items.id, id2)).returning({ name: items.name });
|
|
4293
4399
|
return row?.name;
|
|
4294
4400
|
}
|
|
4295
4401
|
|
|
@@ -4460,7 +4566,7 @@ Failed to launch Claude for ${context}: ${message}`)
|
|
|
4460
4566
|
}
|
|
4461
4567
|
|
|
4462
4568
|
// src/shared/emitActivity.ts
|
|
4463
|
-
import { mkdirSync as mkdirSync7, readFileSync as
|
|
4569
|
+
import { mkdirSync as mkdirSync7, readFileSync as readFileSync13, rmSync, writeFileSync as writeFileSync16 } from "fs";
|
|
4464
4570
|
import { homedir as homedir7 } from "os";
|
|
4465
4571
|
import { dirname as dirname14, join as join18 } from "path";
|
|
4466
4572
|
import { z as z4 } from "zod";
|
|
@@ -4486,7 +4592,7 @@ function emitActivity(activity2) {
|
|
|
4486
4592
|
}
|
|
4487
4593
|
function readActivity(path57) {
|
|
4488
4594
|
try {
|
|
4489
|
-
return JSON.parse(
|
|
4595
|
+
return JSON.parse(readFileSync13(path57, "utf8"));
|
|
4490
4596
|
} catch {
|
|
4491
4597
|
return void 0;
|
|
4492
4598
|
}
|
|
@@ -4502,7 +4608,7 @@ function reconcileActivity(sessionId, activity2) {
|
|
|
4502
4608
|
}
|
|
4503
4609
|
function removeActivity(sessionId) {
|
|
4504
4610
|
try {
|
|
4505
|
-
|
|
4611
|
+
rmSync(activityPath(sessionId));
|
|
4506
4612
|
} catch {
|
|
4507
4613
|
}
|
|
4508
4614
|
}
|
|
@@ -4637,7 +4743,7 @@ async function handleIncompletePhase() {
|
|
|
4637
4743
|
}
|
|
4638
4744
|
|
|
4639
4745
|
// src/commands/backlog/readSignal.ts
|
|
4640
|
-
import { existsSync as existsSync20, readFileSync as
|
|
4746
|
+
import { existsSync as existsSync20, readFileSync as readFileSync14 } from "fs";
|
|
4641
4747
|
|
|
4642
4748
|
// src/commands/backlog/writeSignal.ts
|
|
4643
4749
|
import { writeFileSync as writeFileSync17 } from "fs";
|
|
@@ -4658,7 +4764,7 @@ function readSignal() {
|
|
|
4658
4764
|
const path57 = getSignalPath();
|
|
4659
4765
|
if (!existsSync20(path57)) return void 0;
|
|
4660
4766
|
try {
|
|
4661
|
-
return JSON.parse(
|
|
4767
|
+
return JSON.parse(readFileSync14(path57, "utf8"));
|
|
4662
4768
|
} catch {
|
|
4663
4769
|
return void 0;
|
|
4664
4770
|
}
|
|
@@ -4915,11 +5021,11 @@ async function next(options2, startId) {
|
|
|
4915
5021
|
import chalk43 from "chalk";
|
|
4916
5022
|
|
|
4917
5023
|
// src/commands/backlog/appendComment.ts
|
|
4918
|
-
import { sql as
|
|
5024
|
+
import { sql as sql3 } from "drizzle-orm";
|
|
4919
5025
|
async function appendComment(orm, itemId, text6, opts = {}) {
|
|
4920
5026
|
await orm.insert(comments).values({
|
|
4921
5027
|
itemId,
|
|
4922
|
-
idx:
|
|
5028
|
+
idx: sql3`(SELECT COALESCE(MAX(${comments.idx}) + 1, 0) FROM ${comments} WHERE ${comments.itemId} = ${itemId})`,
|
|
4923
5029
|
text: text6,
|
|
4924
5030
|
phase: opts.phase ?? null,
|
|
4925
5031
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -4928,9 +5034,9 @@ async function appendComment(orm, itemId, text6, opts = {}) {
|
|
|
4928
5034
|
}
|
|
4929
5035
|
|
|
4930
5036
|
// src/commands/backlog/getItemStatus.ts
|
|
4931
|
-
import { eq as
|
|
5037
|
+
import { eq as eq11 } from "drizzle-orm";
|
|
4932
5038
|
async function getItemStatus(orm, id2) {
|
|
4933
|
-
const [row] = await orm.select({ status: items.status }).from(items).where(
|
|
5039
|
+
const [row] = await orm.select({ status: items.status }).from(items).where(eq11(items.id, id2));
|
|
4934
5040
|
return row?.status;
|
|
4935
5041
|
}
|
|
4936
5042
|
|
|
@@ -5117,7 +5223,7 @@ function printComments(item) {
|
|
|
5117
5223
|
import { WebSocketServer } from "ws";
|
|
5118
5224
|
|
|
5119
5225
|
// src/shared/getInstallDir.ts
|
|
5120
|
-
import { execSync as
|
|
5226
|
+
import { execSync as execSync19 } from "child_process";
|
|
5121
5227
|
import { dirname as dirname15, resolve as resolve7 } from "path";
|
|
5122
5228
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
5123
5229
|
var __filename2 = fileURLToPath2(import.meta.url);
|
|
@@ -5127,7 +5233,7 @@ function getInstallDir() {
|
|
|
5127
5233
|
}
|
|
5128
5234
|
function isGitRepo(dir) {
|
|
5129
5235
|
try {
|
|
5130
|
-
const result =
|
|
5236
|
+
const result = execSync19("git rev-parse --show-toplevel", {
|
|
5131
5237
|
cwd: dir,
|
|
5132
5238
|
stdio: "pipe"
|
|
5133
5239
|
}).toString().trim();
|
|
@@ -5144,11 +5250,11 @@ import {
|
|
|
5144
5250
|
import chalk49 from "chalk";
|
|
5145
5251
|
|
|
5146
5252
|
// src/lib/openBrowser.ts
|
|
5147
|
-
import { execSync as
|
|
5253
|
+
import { execSync as execSync20 } from "child_process";
|
|
5148
5254
|
function tryExec(commands) {
|
|
5149
5255
|
for (const cmd of commands) {
|
|
5150
5256
|
try {
|
|
5151
|
-
|
|
5257
|
+
execSync20(cmd, { stdio: "ignore" });
|
|
5152
5258
|
return true;
|
|
5153
5259
|
} catch {
|
|
5154
5260
|
}
|
|
@@ -5361,12 +5467,12 @@ function delay(ms) {
|
|
|
5361
5467
|
|
|
5362
5468
|
// src/commands/sessions/web/handleRequest.ts
|
|
5363
5469
|
import { createHash as createHash2 } from "crypto";
|
|
5364
|
-
import { readFileSync as
|
|
5470
|
+
import { readFileSync as readFileSync16 } from "fs";
|
|
5365
5471
|
import { createRequire as createRequire2 } from "module";
|
|
5366
5472
|
|
|
5367
5473
|
// src/shared/createBundleHandler.ts
|
|
5368
5474
|
import { createHash } from "crypto";
|
|
5369
|
-
import { readFileSync as
|
|
5475
|
+
import { readFileSync as readFileSync15 } from "fs";
|
|
5370
5476
|
import { dirname as dirname16, join as join20 } from "path";
|
|
5371
5477
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
5372
5478
|
function createBundleHandler(importMetaUrl, bundlePath) {
|
|
@@ -5374,7 +5480,7 @@ function createBundleHandler(importMetaUrl, bundlePath) {
|
|
|
5374
5480
|
let cache;
|
|
5375
5481
|
return (req, res) => {
|
|
5376
5482
|
if (!cache) {
|
|
5377
|
-
const body =
|
|
5483
|
+
const body = readFileSync15(join20(dir, bundlePath), "utf8");
|
|
5378
5484
|
const etag = `"${createHash("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
5379
5485
|
cache = { body, etag };
|
|
5380
5486
|
}
|
|
@@ -5414,10 +5520,10 @@ function createFallbackHandler(routes3, htmlHandler2, extra) {
|
|
|
5414
5520
|
}
|
|
5415
5521
|
|
|
5416
5522
|
// src/commands/backlog/loadBacklogSummaries.ts
|
|
5417
|
-
import { eq as
|
|
5523
|
+
import { eq as eq13 } from "drizzle-orm";
|
|
5418
5524
|
|
|
5419
5525
|
// src/commands/backlog/loadItemSummaries.ts
|
|
5420
|
-
import { asc as asc5, eq as
|
|
5526
|
+
import { asc as asc5, eq as eq12 } from "drizzle-orm";
|
|
5421
5527
|
async function loadItemSummaries(orm, origin) {
|
|
5422
5528
|
const rows = await orm.select({
|
|
5423
5529
|
id: items.id,
|
|
@@ -5426,7 +5532,7 @@ async function loadItemSummaries(orm, origin) {
|
|
|
5426
5532
|
name: items.name,
|
|
5427
5533
|
status: items.status,
|
|
5428
5534
|
starred: items.starred
|
|
5429
|
-
}).from(items).where(origin === void 0 ? void 0 :
|
|
5535
|
+
}).from(items).where(origin === void 0 ? void 0 : eq12(items.origin, origin)).orderBy(asc5(items.id));
|
|
5430
5536
|
return rows.map((row) => ({
|
|
5431
5537
|
id: row.id,
|
|
5432
5538
|
origin: row.origin,
|
|
@@ -5451,7 +5557,7 @@ async function searchBacklogSummaries(query) {
|
|
|
5451
5557
|
}
|
|
5452
5558
|
async function backlogHasItems() {
|
|
5453
5559
|
const { orm } = await getReady();
|
|
5454
|
-
const [row] = await orm.select({ id: items.id }).from(items).where(
|
|
5560
|
+
const [row] = await orm.select({ id: items.id }).from(items).where(eq13(items.origin, getOrigin())).limit(1);
|
|
5455
5561
|
return row !== void 0;
|
|
5456
5562
|
}
|
|
5457
5563
|
|
|
@@ -5468,19 +5574,19 @@ async function getBacklogExists(req, res) {
|
|
|
5468
5574
|
}
|
|
5469
5575
|
|
|
5470
5576
|
// src/commands/backlog/deleteComment.ts
|
|
5471
|
-
import { and as
|
|
5577
|
+
import { and as and4, eq as eq14 } from "drizzle-orm";
|
|
5472
5578
|
async function deleteComment(orm, itemId, commentId) {
|
|
5473
|
-
const [row] = await orm.select({ type: comments.type }).from(comments).where(
|
|
5579
|
+
const [row] = await orm.select({ type: comments.type }).from(comments).where(and4(eq14(comments.id, commentId), eq14(comments.itemId, itemId)));
|
|
5474
5580
|
if (!row) return "not-found";
|
|
5475
5581
|
if (row.type === "summary") return "is-summary";
|
|
5476
|
-
await orm.delete(comments).where(
|
|
5582
|
+
await orm.delete(comments).where(and4(eq14(comments.id, commentId), eq14(comments.itemId, itemId)));
|
|
5477
5583
|
return "deleted";
|
|
5478
5584
|
}
|
|
5479
5585
|
|
|
5480
5586
|
// src/commands/backlog/updateStarred.ts
|
|
5481
|
-
import { eq as
|
|
5587
|
+
import { eq as eq15 } from "drizzle-orm";
|
|
5482
5588
|
async function updateStarred(orm, id2, starred) {
|
|
5483
|
-
const [row] = await orm.update(items).set({ starred }).where(
|
|
5589
|
+
const [row] = await orm.update(items).set({ starred }).where(eq15(items.id, id2)).returning({ name: items.name });
|
|
5484
5590
|
return row?.name;
|
|
5485
5591
|
}
|
|
5486
5592
|
|
|
@@ -5578,7 +5684,7 @@ async function deleteItemComment(res, itemId, commentId) {
|
|
|
5578
5684
|
}
|
|
5579
5685
|
|
|
5580
5686
|
// src/commands/backlog/web/rewindItemPhase.ts
|
|
5581
|
-
import { eq as
|
|
5687
|
+
import { eq as eq16 } from "drizzle-orm";
|
|
5582
5688
|
|
|
5583
5689
|
// src/commands/backlog/resolveRewindPlan.ts
|
|
5584
5690
|
function resolveRewindPlan(item) {
|
|
@@ -5604,7 +5710,7 @@ async function rewindItemPhase(req, res, id2) {
|
|
|
5604
5710
|
`Rewound to phase ${phase} (${phaseName}): ${reason}`,
|
|
5605
5711
|
{ phase }
|
|
5606
5712
|
);
|
|
5607
|
-
await orm.update(items).set({ currentPhase: phase, status: "in-progress" }).where(
|
|
5713
|
+
await orm.update(items).set({ currentPhase: phase, status: "in-progress" }).where(eq16(items.id, id2));
|
|
5608
5714
|
respondJson(res, 200, await loadItem(orm, id2));
|
|
5609
5715
|
}
|
|
5610
5716
|
function validateRewind(item, plan2, phase) {
|
|
@@ -5723,7 +5829,7 @@ function getHtml() {
|
|
|
5723
5829
|
}
|
|
5724
5830
|
|
|
5725
5831
|
// src/commands/prs/getPreferredRemoteRepo.ts
|
|
5726
|
-
import { execSync as
|
|
5832
|
+
import { execSync as execSync21 } from "child_process";
|
|
5727
5833
|
var GITHUB_URL_PATTERN = /(?:git@github\.com:|https:\/\/github\.com\/)([^/]+)\/([^/]+?)(?:\.git)?\/?$/;
|
|
5728
5834
|
function parseGitHubUrl(url) {
|
|
5729
5835
|
const match = url.match(GITHUB_URL_PATTERN);
|
|
@@ -5732,7 +5838,7 @@ function parseGitHubUrl(url) {
|
|
|
5732
5838
|
}
|
|
5733
5839
|
function tryGetRemoteUrl(remote, cwd) {
|
|
5734
5840
|
try {
|
|
5735
|
-
return
|
|
5841
|
+
return execSync21(`git remote get-url ${remote}`, {
|
|
5736
5842
|
encoding: "utf8",
|
|
5737
5843
|
stdio: ["pipe", "pipe", "pipe"],
|
|
5738
5844
|
cwd
|
|
@@ -5743,7 +5849,7 @@ function tryGetRemoteUrl(remote, cwd) {
|
|
|
5743
5849
|
}
|
|
5744
5850
|
function getCurrentBranchRemote(cwd) {
|
|
5745
5851
|
try {
|
|
5746
|
-
const ref =
|
|
5852
|
+
const ref = execSync21(
|
|
5747
5853
|
"git rev-parse --abbrev-ref --symbolic-full-name @{u}",
|
|
5748
5854
|
{ encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], cwd }
|
|
5749
5855
|
).trim();
|
|
@@ -5755,7 +5861,7 @@ function getCurrentBranchRemote(cwd) {
|
|
|
5755
5861
|
}
|
|
5756
5862
|
function listRemotes(cwd) {
|
|
5757
5863
|
try {
|
|
5758
|
-
return
|
|
5864
|
+
return execSync21("git remote", {
|
|
5759
5865
|
encoding: "utf8",
|
|
5760
5866
|
stdio: ["pipe", "pipe", "pipe"],
|
|
5761
5867
|
cwd
|
|
@@ -6121,7 +6227,7 @@ function createCssHandler(packageEntry) {
|
|
|
6121
6227
|
return (req, res) => {
|
|
6122
6228
|
if (!cache) {
|
|
6123
6229
|
const resolved = require3.resolve(packageEntry);
|
|
6124
|
-
const body =
|
|
6230
|
+
const body = readFileSync16(resolved, "utf8");
|
|
6125
6231
|
const etag = `"${createHash2("sha256").update(body).digest("hex").slice(0, 16)}"`;
|
|
6126
6232
|
cache = { body, etag };
|
|
6127
6233
|
}
|
|
@@ -6852,7 +6958,7 @@ import chalk59 from "chalk";
|
|
|
6852
6958
|
|
|
6853
6959
|
// src/commands/backlog/add/shared.ts
|
|
6854
6960
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
6855
|
-
import { mkdtempSync, readFileSync as
|
|
6961
|
+
import { mkdtempSync, readFileSync as readFileSync17, unlinkSync as unlinkSync6, writeFileSync as writeFileSync18 } from "fs";
|
|
6856
6962
|
import { tmpdir } from "os";
|
|
6857
6963
|
import { join as join21 } from "path";
|
|
6858
6964
|
import enquirer6 from "enquirer";
|
|
@@ -6902,7 +7008,7 @@ function openEditor() {
|
|
|
6902
7008
|
unlinkSync6(filePath);
|
|
6903
7009
|
return void 0;
|
|
6904
7010
|
}
|
|
6905
|
-
const content =
|
|
7011
|
+
const content = readFileSync17(filePath, "utf8").trim();
|
|
6906
7012
|
unlinkSync6(filePath);
|
|
6907
7013
|
return content || void 0;
|
|
6908
7014
|
}
|
|
@@ -6946,22 +7052,22 @@ async function add(options2) {
|
|
|
6946
7052
|
import chalk61 from "chalk";
|
|
6947
7053
|
|
|
6948
7054
|
// src/commands/backlog/insertPhaseAt.ts
|
|
6949
|
-
import { count, eq as
|
|
7055
|
+
import { count, eq as eq18 } from "drizzle-orm";
|
|
6950
7056
|
|
|
6951
7057
|
// src/commands/backlog/shiftPhasesUp.ts
|
|
6952
|
-
import { and as
|
|
7058
|
+
import { and as and5, desc as desc3, eq as eq17, gte } from "drizzle-orm";
|
|
6953
7059
|
async function shiftPhasesUp(db, itemId, fromIdx) {
|
|
6954
|
-
const toShift = await db.select({ idx: planPhases.idx }).from(planPhases).where(
|
|
7060
|
+
const toShift = await db.select({ idx: planPhases.idx }).from(planPhases).where(and5(eq17(planPhases.itemId, itemId), gte(planPhases.idx, fromIdx))).orderBy(desc3(planPhases.idx));
|
|
6955
7061
|
for (const p of toShift) {
|
|
6956
|
-
await db.update(planTasks).set({ phaseIdx: p.idx + 1 }).where(
|
|
6957
|
-
await db.update(planPhases).set({ idx: p.idx + 1 }).where(
|
|
7062
|
+
await db.update(planTasks).set({ phaseIdx: p.idx + 1 }).where(and5(eq17(planTasks.itemId, itemId), eq17(planTasks.phaseIdx, p.idx)));
|
|
7063
|
+
await db.update(planPhases).set({ idx: p.idx + 1 }).where(and5(eq17(planPhases.itemId, itemId), eq17(planPhases.idx, p.idx)));
|
|
6958
7064
|
}
|
|
6959
7065
|
}
|
|
6960
7066
|
|
|
6961
7067
|
// src/commands/backlog/insertPhaseAt.ts
|
|
6962
7068
|
async function insertPhaseAt(orm, itemId, phaseIdx, name, tasks, manualChecks, currentPhase) {
|
|
6963
7069
|
await orm.transaction(async (tx) => {
|
|
6964
|
-
const [row] = await tx.select({ cnt: count() }).from(planPhases).where(
|
|
7070
|
+
const [row] = await tx.select({ cnt: count() }).from(planPhases).where(eq18(planPhases.itemId, itemId));
|
|
6965
7071
|
const phaseCount = row?.cnt ?? 0;
|
|
6966
7072
|
await shiftPhasesUp(tx, itemId, phaseIdx);
|
|
6967
7073
|
await tx.insert(planPhases).values({ itemId, idx: phaseIdx, name, manualChecks });
|
|
@@ -6970,16 +7076,16 @@ async function insertPhaseAt(orm, itemId, phaseIdx, name, tasks, manualChecks, c
|
|
|
6970
7076
|
}
|
|
6971
7077
|
if (currentPhase !== void 0 && currentPhase - 1 >= phaseIdx) {
|
|
6972
7078
|
const atReviewSlot = currentPhase - 1 >= phaseCount;
|
|
6973
|
-
await tx.update(items).set({ currentPhase: atReviewSlot ? phaseIdx + 1 : currentPhase + 1 }).where(
|
|
7079
|
+
await tx.update(items).set({ currentPhase: atReviewSlot ? phaseIdx + 1 : currentPhase + 1 }).where(eq18(items.id, itemId));
|
|
6974
7080
|
}
|
|
6975
7081
|
});
|
|
6976
7082
|
}
|
|
6977
7083
|
|
|
6978
7084
|
// src/commands/backlog/resolveInsertPosition.ts
|
|
6979
7085
|
import chalk60 from "chalk";
|
|
6980
|
-
import { count as count2, eq as
|
|
7086
|
+
import { count as count2, eq as eq19 } from "drizzle-orm";
|
|
6981
7087
|
async function resolveInsertPosition(orm, itemId, position) {
|
|
6982
|
-
const [row] = await orm.select({ cnt: count2() }).from(planPhases).where(
|
|
7088
|
+
const [row] = await orm.select({ cnt: count2() }).from(planPhases).where(eq19(planPhases.itemId, itemId));
|
|
6983
7089
|
const phaseCount = row?.cnt ?? 0;
|
|
6984
7090
|
if (position === void 0) return phaseCount;
|
|
6985
7091
|
const pos = Number.parseInt(position, 10);
|
|
@@ -7140,9 +7246,9 @@ function hasCycle(adjacency, fromId, toId) {
|
|
|
7140
7246
|
}
|
|
7141
7247
|
|
|
7142
7248
|
// src/commands/backlog/loadDependencyGraph.ts
|
|
7143
|
-
import { eq as
|
|
7249
|
+
import { eq as eq20 } from "drizzle-orm";
|
|
7144
7250
|
async function loadDependencyGraph(orm) {
|
|
7145
|
-
const rows = await orm.select({ itemId: links.itemId, targetId: links.targetId }).from(links).where(
|
|
7251
|
+
const rows = await orm.select({ itemId: links.itemId, targetId: links.targetId }).from(links).where(eq20(links.type, "depends-on"));
|
|
7146
7252
|
const graph = /* @__PURE__ */ new Map();
|
|
7147
7253
|
for (const { itemId, targetId } of rows) {
|
|
7148
7254
|
const bucket = graph.get(itemId);
|
|
@@ -7205,7 +7311,7 @@ async function link(fromId, toId, opts) {
|
|
|
7205
7311
|
|
|
7206
7312
|
// src/commands/backlog/unlink.ts
|
|
7207
7313
|
import chalk65 from "chalk";
|
|
7208
|
-
import { and as
|
|
7314
|
+
import { and as and6, eq as eq21 } from "drizzle-orm";
|
|
7209
7315
|
async function unlink(fromId, toId) {
|
|
7210
7316
|
const fromNum = Number.parseInt(fromId, 10);
|
|
7211
7317
|
const toNum = Number.parseInt(toId, 10);
|
|
@@ -7223,7 +7329,7 @@ async function unlink(fromId, toId) {
|
|
|
7223
7329
|
console.log(chalk65.yellow(`No link from #${fromId} to #${toId} found.`));
|
|
7224
7330
|
return;
|
|
7225
7331
|
}
|
|
7226
|
-
await orm.delete(links).where(
|
|
7332
|
+
await orm.delete(links).where(and6(eq21(links.itemId, fromNum), eq21(links.targetId, toNum)));
|
|
7227
7333
|
console.log(chalk65.green(`Removed link from #${fromId} to #${toId}.`));
|
|
7228
7334
|
}
|
|
7229
7335
|
|
|
@@ -7239,7 +7345,7 @@ function registerLinkCommands(cmd) {
|
|
|
7239
7345
|
|
|
7240
7346
|
// src/commands/backlog/move-repo/index.ts
|
|
7241
7347
|
import chalk67 from "chalk";
|
|
7242
|
-
import { eq as
|
|
7348
|
+
import { eq as eq23 } from "drizzle-orm";
|
|
7243
7349
|
|
|
7244
7350
|
// src/commands/backlog/move-repo/confirmMove.ts
|
|
7245
7351
|
import chalk66 from "chalk";
|
|
@@ -7254,9 +7360,9 @@ async function confirmMove(cnt, oldOrigin, newOrigin) {
|
|
|
7254
7360
|
}
|
|
7255
7361
|
|
|
7256
7362
|
// src/commands/backlog/move-repo/countByOrigin.ts
|
|
7257
|
-
import { count as count3, eq as
|
|
7363
|
+
import { count as count3, eq as eq22 } from "drizzle-orm";
|
|
7258
7364
|
async function countByOrigin(orm, origin) {
|
|
7259
|
-
const [{ cnt }] = await orm.select({ cnt: count3() }).from(items).where(
|
|
7365
|
+
const [{ cnt }] = await orm.select({ cnt: count3() }).from(items).where(eq22(items.origin, origin));
|
|
7260
7366
|
return cnt;
|
|
7261
7367
|
}
|
|
7262
7368
|
|
|
@@ -7299,7 +7405,7 @@ async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
|
|
|
7299
7405
|
console.log(chalk67.yellow("Move cancelled; no changes made."));
|
|
7300
7406
|
return;
|
|
7301
7407
|
}
|
|
7302
|
-
await orm.update(items).set({ origin: newOrigin }).where(
|
|
7408
|
+
await orm.update(items).set({ origin: newOrigin }).where(eq23(items.origin, oldOrigin));
|
|
7303
7409
|
console.log(
|
|
7304
7410
|
chalk67.green(
|
|
7305
7411
|
`Moved ${pluralItems(cnt)} from "${oldOrigin}" to "${newOrigin}".`
|
|
@@ -7638,10 +7744,10 @@ async function start(id2) {
|
|
|
7638
7744
|
|
|
7639
7745
|
// src/commands/backlog/stop/index.ts
|
|
7640
7746
|
import chalk78 from "chalk";
|
|
7641
|
-
import { and as
|
|
7747
|
+
import { and as and7, eq as eq24 } from "drizzle-orm";
|
|
7642
7748
|
async function stop() {
|
|
7643
7749
|
const { orm } = await getReady();
|
|
7644
|
-
const stopped = await orm.update(items).set({ status: "todo", currentPhase: 1 }).where(
|
|
7750
|
+
const stopped = await orm.update(items).set({ status: "todo", currentPhase: 1 }).where(and7(eq24(items.status, "in-progress"), eq24(items.origin, getOrigin()))).returning({ id: items.id, name: items.name });
|
|
7645
7751
|
if (stopped.length === 0) {
|
|
7646
7752
|
console.log(chalk78.yellow("No in-progress items to stop."));
|
|
7647
7753
|
return;
|
|
@@ -7687,18 +7793,18 @@ function registerStatusCommands(cmd) {
|
|
|
7687
7793
|
|
|
7688
7794
|
// src/commands/backlog/removePhase.ts
|
|
7689
7795
|
import chalk82 from "chalk";
|
|
7690
|
-
import { and as
|
|
7796
|
+
import { and as and10, eq as eq27 } from "drizzle-orm";
|
|
7691
7797
|
|
|
7692
7798
|
// src/commands/backlog/findPhase.ts
|
|
7693
7799
|
import chalk81 from "chalk";
|
|
7694
|
-
import { and as
|
|
7800
|
+
import { and as and8, count as count4, eq as eq25 } from "drizzle-orm";
|
|
7695
7801
|
async function findPhase(id2, phase) {
|
|
7696
7802
|
const found = await findOneItem(id2);
|
|
7697
7803
|
if (!found) return void 0;
|
|
7698
7804
|
const { orm, item } = found;
|
|
7699
7805
|
const itemId = item.id;
|
|
7700
7806
|
const phaseIdx = Number.parseInt(phase, 10) - 1;
|
|
7701
|
-
const [row] = await orm.select({ cnt: count4() }).from(planPhases).where(
|
|
7807
|
+
const [row] = await orm.select({ cnt: count4() }).from(planPhases).where(and8(eq25(planPhases.itemId, itemId), eq25(planPhases.idx, phaseIdx)));
|
|
7702
7808
|
if (!row || row.cnt === 0) {
|
|
7703
7809
|
console.log(
|
|
7704
7810
|
chalk81.red(`Phase ${phaseIdx + 1} not found on item #${itemId}.`)
|
|
@@ -7710,14 +7816,14 @@ async function findPhase(id2, phase) {
|
|
|
7710
7816
|
}
|
|
7711
7817
|
|
|
7712
7818
|
// src/commands/backlog/reindexPhases.ts
|
|
7713
|
-
import { and as
|
|
7819
|
+
import { and as and9, asc as asc6, count as count5, eq as eq26 } from "drizzle-orm";
|
|
7714
7820
|
async function reindexPhases(db, itemId) {
|
|
7715
|
-
const remaining = await db.select({ idx: planPhases.idx }).from(planPhases).where(
|
|
7821
|
+
const remaining = await db.select({ idx: planPhases.idx }).from(planPhases).where(eq26(planPhases.itemId, itemId)).orderBy(asc6(planPhases.idx));
|
|
7716
7822
|
for (let i = 0; i < remaining.length; i++) {
|
|
7717
7823
|
const oldIdx = remaining[i].idx;
|
|
7718
7824
|
if (oldIdx === i) continue;
|
|
7719
|
-
await db.update(planTasks).set({ phaseIdx: i }).where(
|
|
7720
|
-
await db.update(planPhases).set({ idx: i }).where(
|
|
7825
|
+
await db.update(planTasks).set({ phaseIdx: i }).where(and9(eq26(planTasks.itemId, itemId), eq26(planTasks.phaseIdx, oldIdx)));
|
|
7826
|
+
await db.update(planPhases).set({ idx: i }).where(and9(eq26(planPhases.itemId, itemId), eq26(planPhases.idx, oldIdx)));
|
|
7721
7827
|
}
|
|
7722
7828
|
}
|
|
7723
7829
|
async function adjustCurrentPhase(db, item, removedIdx) {
|
|
@@ -7725,13 +7831,13 @@ async function adjustCurrentPhase(db, item, removedIdx) {
|
|
|
7725
7831
|
if (currentPhase === void 0) return;
|
|
7726
7832
|
const currentIdx = currentPhase - 1;
|
|
7727
7833
|
if (removedIdx < currentIdx) {
|
|
7728
|
-
await db.update(items).set({ currentPhase: currentPhase - 1 }).where(
|
|
7834
|
+
await db.update(items).set({ currentPhase: currentPhase - 1 }).where(eq26(items.id, item.id));
|
|
7729
7835
|
return;
|
|
7730
7836
|
}
|
|
7731
7837
|
if (removedIdx !== currentIdx) return;
|
|
7732
|
-
const [row] = await db.select({ cnt: count5() }).from(planPhases).where(
|
|
7838
|
+
const [row] = await db.select({ cnt: count5() }).from(planPhases).where(eq26(planPhases.itemId, item.id));
|
|
7733
7839
|
const cnt = row?.cnt ?? 0;
|
|
7734
|
-
await db.update(items).set({ currentPhase: cnt === 0 ? null : Math.min(currentPhase, cnt) }).where(
|
|
7840
|
+
await db.update(items).set({ currentPhase: cnt === 0 ? null : Math.min(currentPhase, cnt) }).where(eq26(items.id, item.id));
|
|
7735
7841
|
}
|
|
7736
7842
|
|
|
7737
7843
|
// src/commands/backlog/removePhase.ts
|
|
@@ -7741,9 +7847,9 @@ async function removePhase(id2, phase) {
|
|
|
7741
7847
|
const { item, orm, itemId, phaseIdx } = found;
|
|
7742
7848
|
await orm.transaction(async (tx) => {
|
|
7743
7849
|
await tx.delete(planTasks).where(
|
|
7744
|
-
|
|
7850
|
+
and10(eq27(planTasks.itemId, itemId), eq27(planTasks.phaseIdx, phaseIdx))
|
|
7745
7851
|
);
|
|
7746
|
-
await tx.delete(planPhases).where(
|
|
7852
|
+
await tx.delete(planPhases).where(and10(eq27(planPhases.itemId, itemId), eq27(planPhases.idx, phaseIdx)));
|
|
7747
7853
|
await reindexPhases(tx, itemId);
|
|
7748
7854
|
await adjustCurrentPhase(tx, item, phaseIdx);
|
|
7749
7855
|
});
|
|
@@ -7754,7 +7860,7 @@ async function removePhase(id2, phase) {
|
|
|
7754
7860
|
|
|
7755
7861
|
// src/commands/backlog/update/index.ts
|
|
7756
7862
|
import chalk84 from "chalk";
|
|
7757
|
-
import { eq as
|
|
7863
|
+
import { eq as eq28 } from "drizzle-orm";
|
|
7758
7864
|
|
|
7759
7865
|
// src/commands/backlog/update/parseListIndex.ts
|
|
7760
7866
|
function parseListIndex(raw, length, label2) {
|
|
@@ -7831,8 +7937,8 @@ function applyAcMutations(current, options2) {
|
|
|
7831
7937
|
// src/commands/backlog/update/buildUpdateValues.ts
|
|
7832
7938
|
import chalk83 from "chalk";
|
|
7833
7939
|
function buildUpdateValues(options2) {
|
|
7834
|
-
const { name, desc:
|
|
7835
|
-
if (!name && !
|
|
7940
|
+
const { name, desc: desc6, type, ac } = options2;
|
|
7941
|
+
if (!name && !desc6 && !type && !ac) {
|
|
7836
7942
|
console.log(chalk83.red("Nothing to update. Provide at least one flag."));
|
|
7837
7943
|
process.exitCode = 1;
|
|
7838
7944
|
return void 0;
|
|
@@ -7848,8 +7954,8 @@ function buildUpdateValues(options2) {
|
|
|
7848
7954
|
set.name = name;
|
|
7849
7955
|
fieldNames.push("name");
|
|
7850
7956
|
}
|
|
7851
|
-
if (
|
|
7852
|
-
set.description =
|
|
7957
|
+
if (desc6) {
|
|
7958
|
+
set.description = desc6;
|
|
7853
7959
|
fieldNames.push("description");
|
|
7854
7960
|
}
|
|
7855
7961
|
if (type) {
|
|
@@ -7888,7 +7994,7 @@ async function update(id2, options2) {
|
|
|
7888
7994
|
if (!built) return;
|
|
7889
7995
|
const { orm } = found;
|
|
7890
7996
|
const itemId = found.item.id;
|
|
7891
|
-
await orm.update(items).set(built.set).where(
|
|
7997
|
+
await orm.update(items).set(built.set).where(eq28(items.id, itemId));
|
|
7892
7998
|
console.log(chalk84.green(`Updated ${built.fields} on item #${itemId}.`));
|
|
7893
7999
|
}
|
|
7894
8000
|
|
|
@@ -7896,22 +8002,22 @@ async function update(id2, options2) {
|
|
|
7896
8002
|
import chalk85 from "chalk";
|
|
7897
8003
|
|
|
7898
8004
|
// src/commands/backlog/applyPhaseUpdate.ts
|
|
7899
|
-
import { and as
|
|
8005
|
+
import { and as and11, eq as eq29 } from "drizzle-orm";
|
|
7900
8006
|
async function applyPhaseUpdate(orm, itemId, phaseIdx, fields) {
|
|
7901
8007
|
await orm.transaction(async (tx) => {
|
|
7902
8008
|
if (fields.name) {
|
|
7903
8009
|
await tx.update(planPhases).set({ name: fields.name }).where(
|
|
7904
|
-
|
|
8010
|
+
and11(eq29(planPhases.itemId, itemId), eq29(planPhases.idx, phaseIdx))
|
|
7905
8011
|
);
|
|
7906
8012
|
}
|
|
7907
8013
|
if (fields.manualCheck) {
|
|
7908
8014
|
await tx.update(planPhases).set({ manualChecks: JSON.stringify(fields.manualCheck) }).where(
|
|
7909
|
-
|
|
8015
|
+
and11(eq29(planPhases.itemId, itemId), eq29(planPhases.idx, phaseIdx))
|
|
7910
8016
|
);
|
|
7911
8017
|
}
|
|
7912
8018
|
if (fields.task) {
|
|
7913
8019
|
await tx.delete(planTasks).where(
|
|
7914
|
-
|
|
8020
|
+
and11(eq29(planTasks.itemId, itemId), eq29(planTasks.phaseIdx, phaseIdx))
|
|
7915
8021
|
);
|
|
7916
8022
|
if (fields.task.length) {
|
|
7917
8023
|
await tx.insert(planTasks).values(
|
|
@@ -8254,7 +8360,7 @@ var _db;
|
|
|
8254
8360
|
function getDbDir() {
|
|
8255
8361
|
return join22(homedir8(), ".assist");
|
|
8256
8362
|
}
|
|
8257
|
-
function
|
|
8363
|
+
function initSchema2(db) {
|
|
8258
8364
|
db.exec(`
|
|
8259
8365
|
CREATE TABLE IF NOT EXISTS denied_tool_calls (
|
|
8260
8366
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
@@ -8273,7 +8379,7 @@ function openPromptsDb(dir) {
|
|
|
8273
8379
|
mkdirSync9(dbDir, { recursive: true });
|
|
8274
8380
|
const db = new Database(join22(dbDir, "assist.db"));
|
|
8275
8381
|
db.pragma("journal_mode = WAL");
|
|
8276
|
-
|
|
8382
|
+
initSchema2(db);
|
|
8277
8383
|
_db = db;
|
|
8278
8384
|
return db;
|
|
8279
8385
|
}
|
|
@@ -8373,7 +8479,7 @@ function extractGraphqlQuery(args) {
|
|
|
8373
8479
|
}
|
|
8374
8480
|
|
|
8375
8481
|
// src/shared/loadCliReads.ts
|
|
8376
|
-
import { existsSync as existsSync23, readFileSync as
|
|
8482
|
+
import { existsSync as existsSync23, readFileSync as readFileSync18, writeFileSync as writeFileSync19 } from "fs";
|
|
8377
8483
|
import { dirname as dirname17, resolve as resolve8 } from "path";
|
|
8378
8484
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
8379
8485
|
var __filename3 = fileURLToPath4(import.meta.url);
|
|
@@ -8383,7 +8489,7 @@ function packageRoot() {
|
|
|
8383
8489
|
}
|
|
8384
8490
|
function readLines(path57) {
|
|
8385
8491
|
if (!existsSync23(path57)) return [];
|
|
8386
|
-
return
|
|
8492
|
+
return readFileSync18(path57, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
8387
8493
|
}
|
|
8388
8494
|
var cachedReads;
|
|
8389
8495
|
var cachedWrites;
|
|
@@ -8429,7 +8535,7 @@ function findCliWrite(command) {
|
|
|
8429
8535
|
}
|
|
8430
8536
|
|
|
8431
8537
|
// src/shared/readSettingsPerms.ts
|
|
8432
|
-
import { existsSync as existsSync24, readFileSync as
|
|
8538
|
+
import { existsSync as existsSync24, readFileSync as readFileSync19 } from "fs";
|
|
8433
8539
|
import { homedir as homedir9 } from "os";
|
|
8434
8540
|
import { join as join23 } from "path";
|
|
8435
8541
|
function readSettingsPerms(key) {
|
|
@@ -8447,7 +8553,7 @@ function readSettingsPerms(key) {
|
|
|
8447
8553
|
function readPermissionArray(filePath, key) {
|
|
8448
8554
|
if (!existsSync24(filePath)) return [];
|
|
8449
8555
|
try {
|
|
8450
|
-
const data = JSON.parse(
|
|
8556
|
+
const data = JSON.parse(readFileSync19(filePath, "utf8"));
|
|
8451
8557
|
const arr = data?.permissions?.[key];
|
|
8452
8558
|
return Array.isArray(arr) ? arr.filter((e) => typeof e === "string") : [];
|
|
8453
8559
|
} catch {
|
|
@@ -8709,12 +8815,12 @@ ${reasons.join("\n")}`);
|
|
|
8709
8815
|
}
|
|
8710
8816
|
|
|
8711
8817
|
// src/commands/permitCliReads/index.ts
|
|
8712
|
-
import { existsSync as existsSync25, mkdirSync as mkdirSync10, readFileSync as
|
|
8818
|
+
import { existsSync as existsSync25, mkdirSync as mkdirSync10, readFileSync as readFileSync20, writeFileSync as writeFileSync20 } from "fs";
|
|
8713
8819
|
import { homedir as homedir10 } from "os";
|
|
8714
8820
|
import { join as join24 } from "path";
|
|
8715
8821
|
|
|
8716
8822
|
// src/shared/checkCliAvailable.ts
|
|
8717
|
-
import { execSync as
|
|
8823
|
+
import { execSync as execSync22 } from "child_process";
|
|
8718
8824
|
function checkCliAvailable(cli) {
|
|
8719
8825
|
const binary = cli.split(/\s+/)[0];
|
|
8720
8826
|
const opts = {
|
|
@@ -8722,11 +8828,11 @@ function checkCliAvailable(cli) {
|
|
|
8722
8828
|
stdio: ["ignore", "pipe", "pipe"]
|
|
8723
8829
|
};
|
|
8724
8830
|
try {
|
|
8725
|
-
|
|
8831
|
+
execSync22(`command -v ${binary}`, opts);
|
|
8726
8832
|
return true;
|
|
8727
8833
|
} catch {
|
|
8728
8834
|
try {
|
|
8729
|
-
|
|
8835
|
+
execSync22(`where ${binary}`, opts);
|
|
8730
8836
|
return true;
|
|
8731
8837
|
} catch {
|
|
8732
8838
|
return false;
|
|
@@ -9005,7 +9111,7 @@ function logPath(cli) {
|
|
|
9005
9111
|
function readCache(cli) {
|
|
9006
9112
|
const path57 = logPath(cli);
|
|
9007
9113
|
if (!existsSync25(path57)) return void 0;
|
|
9008
|
-
return
|
|
9114
|
+
return readFileSync20(path57, "utf8");
|
|
9009
9115
|
}
|
|
9010
9116
|
function writeCache(cli, output) {
|
|
9011
9117
|
const dir = join24(homedir10(), ".assist");
|
|
@@ -9151,11 +9257,11 @@ import ts5 from "typescript";
|
|
|
9151
9257
|
// src/commands/complexity/findSourceFiles.ts
|
|
9152
9258
|
import fs15 from "fs";
|
|
9153
9259
|
import path20 from "path";
|
|
9154
|
-
import { minimatch as
|
|
9260
|
+
import { minimatch as minimatch5 } from "minimatch";
|
|
9155
9261
|
function applyIgnoreGlobs(files, extraIgnore = []) {
|
|
9156
9262
|
const { complexity } = loadConfig();
|
|
9157
9263
|
const ignore2 = [...complexity.ignore, ...extraIgnore];
|
|
9158
|
-
return files.filter((f) => !ignore2.some((glob) =>
|
|
9264
|
+
return files.filter((f) => !ignore2.some((glob) => minimatch5(f, glob)));
|
|
9159
9265
|
}
|
|
9160
9266
|
function walk(dir, results) {
|
|
9161
9267
|
if (!fs15.existsSync(dir)) {
|
|
@@ -9179,7 +9285,7 @@ function findSourceFiles2(pattern2, baseDir = ".", extraIgnore = []) {
|
|
|
9179
9285
|
if (pattern2.includes("*")) {
|
|
9180
9286
|
walk(baseDir, results);
|
|
9181
9287
|
return applyIgnoreGlobs(
|
|
9182
|
-
results.filter((f) =>
|
|
9288
|
+
results.filter((f) => minimatch5(f, pattern2)),
|
|
9183
9289
|
extraIgnore
|
|
9184
9290
|
);
|
|
9185
9291
|
}
|
|
@@ -9192,7 +9298,7 @@ function findSourceFiles2(pattern2, baseDir = ".", extraIgnore = []) {
|
|
|
9192
9298
|
}
|
|
9193
9299
|
walk(baseDir, results);
|
|
9194
9300
|
return applyIgnoreGlobs(
|
|
9195
|
-
results.filter((f) =>
|
|
9301
|
+
results.filter((f) => minimatch5(f, pattern2)),
|
|
9196
9302
|
extraIgnore
|
|
9197
9303
|
);
|
|
9198
9304
|
}
|
|
@@ -9817,7 +9923,7 @@ function registerConfig(program2) {
|
|
|
9817
9923
|
}
|
|
9818
9924
|
|
|
9819
9925
|
// src/commands/deploy/redirect.ts
|
|
9820
|
-
import { existsSync as existsSync26, readFileSync as
|
|
9926
|
+
import { existsSync as existsSync26, readFileSync as readFileSync21, writeFileSync as writeFileSync21 } from "fs";
|
|
9821
9927
|
import chalk99 from "chalk";
|
|
9822
9928
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
9823
9929
|
if (!window.location.pathname.endsWith('/')) {
|
|
@@ -9830,7 +9936,7 @@ function redirect() {
|
|
|
9830
9936
|
console.log(chalk99.yellow("No index.html found"));
|
|
9831
9937
|
return;
|
|
9832
9938
|
}
|
|
9833
|
-
const content =
|
|
9939
|
+
const content = readFileSync21(indexPath, "utf8");
|
|
9834
9940
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
9835
9941
|
console.log(chalk99.dim("Trailing slash script already present"));
|
|
9836
9942
|
return;
|
|
@@ -9869,11 +9975,11 @@ function loadBlogSkipDays(repoName) {
|
|
|
9869
9975
|
}
|
|
9870
9976
|
|
|
9871
9977
|
// src/commands/devlog/shared.ts
|
|
9872
|
-
import { execSync as
|
|
9978
|
+
import { execSync as execSync23 } from "child_process";
|
|
9873
9979
|
import chalk100 from "chalk";
|
|
9874
9980
|
|
|
9875
9981
|
// src/shared/getRepoName.ts
|
|
9876
|
-
import { existsSync as existsSync27, readFileSync as
|
|
9982
|
+
import { existsSync as existsSync27, readFileSync as readFileSync22 } from "fs";
|
|
9877
9983
|
import { basename as basename3, join as join26 } from "path";
|
|
9878
9984
|
function getRepoName() {
|
|
9879
9985
|
const config = loadConfig();
|
|
@@ -9883,7 +9989,7 @@ function getRepoName() {
|
|
|
9883
9989
|
const packageJsonPath = join26(process.cwd(), "package.json");
|
|
9884
9990
|
if (existsSync27(packageJsonPath)) {
|
|
9885
9991
|
try {
|
|
9886
|
-
const content =
|
|
9992
|
+
const content = readFileSync22(packageJsonPath, "utf8");
|
|
9887
9993
|
const pkg = JSON.parse(content);
|
|
9888
9994
|
if (pkg.name) {
|
|
9889
9995
|
return pkg.name;
|
|
@@ -9895,7 +10001,7 @@ function getRepoName() {
|
|
|
9895
10001
|
}
|
|
9896
10002
|
|
|
9897
10003
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
9898
|
-
import { readdirSync, readFileSync as
|
|
10004
|
+
import { readdirSync, readFileSync as readFileSync23 } from "fs";
|
|
9899
10005
|
import { join as join27 } from "path";
|
|
9900
10006
|
var DEVLOG_DIR = join27(BLOG_REPO_ROOT, "src/content/devlog");
|
|
9901
10007
|
function extractFrontmatter(content) {
|
|
@@ -9925,7 +10031,7 @@ function readDevlogFiles(callback) {
|
|
|
9925
10031
|
try {
|
|
9926
10032
|
const files = readdirSync(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
9927
10033
|
for (const file of files) {
|
|
9928
|
-
const content =
|
|
10034
|
+
const content = readFileSync23(join27(DEVLOG_DIR, file), "utf8");
|
|
9929
10035
|
const parsed = parseFrontmatter(content, file);
|
|
9930
10036
|
if (parsed) callback(parsed);
|
|
9931
10037
|
}
|
|
@@ -9961,7 +10067,7 @@ function loadAllDevlogLatestDates() {
|
|
|
9961
10067
|
// src/commands/devlog/shared.ts
|
|
9962
10068
|
function getCommitFiles(hash) {
|
|
9963
10069
|
try {
|
|
9964
|
-
const output =
|
|
10070
|
+
const output = execSync23(`git show --name-only --format="" ${hash}`, {
|
|
9965
10071
|
encoding: "utf8"
|
|
9966
10072
|
});
|
|
9967
10073
|
return output.trim().split("\n").filter(Boolean);
|
|
@@ -10057,11 +10163,11 @@ function list3(options2) {
|
|
|
10057
10163
|
}
|
|
10058
10164
|
|
|
10059
10165
|
// src/commands/devlog/getLastVersionInfo.ts
|
|
10060
|
-
import { execFileSync as execFileSync3, execSync as
|
|
10166
|
+
import { execFileSync as execFileSync3, execSync as execSync24 } from "child_process";
|
|
10061
10167
|
import semver from "semver";
|
|
10062
10168
|
function getVersionAtCommit(hash) {
|
|
10063
10169
|
try {
|
|
10064
|
-
const content =
|
|
10170
|
+
const content = execSync24(`git show ${hash}:package.json`, {
|
|
10065
10171
|
encoding: "utf8"
|
|
10066
10172
|
});
|
|
10067
10173
|
const pkg = JSON.parse(content);
|
|
@@ -10234,7 +10340,7 @@ function next2(options2) {
|
|
|
10234
10340
|
}
|
|
10235
10341
|
|
|
10236
10342
|
// src/commands/devlog/repos/index.ts
|
|
10237
|
-
import { execSync as
|
|
10343
|
+
import { execSync as execSync25 } from "child_process";
|
|
10238
10344
|
|
|
10239
10345
|
// src/commands/devlog/repos/printReposTable.ts
|
|
10240
10346
|
import chalk104 from "chalk";
|
|
@@ -10269,7 +10375,7 @@ function getStatus(lastPush, lastDevlog) {
|
|
|
10269
10375
|
return lastDevlog < lastPush ? "outdated" : "ok";
|
|
10270
10376
|
}
|
|
10271
10377
|
function fetchRepos(days, all) {
|
|
10272
|
-
const json =
|
|
10378
|
+
const json = execSync25(
|
|
10273
10379
|
"gh repo list staff0rd --json name,pushedAt,isArchived --limit 200",
|
|
10274
10380
|
{ encoding: "utf8" }
|
|
10275
10381
|
);
|
|
@@ -10453,11 +10559,11 @@ async function checkBuildLocksCommand() {
|
|
|
10453
10559
|
}
|
|
10454
10560
|
|
|
10455
10561
|
// src/commands/dotnet/buildTree.ts
|
|
10456
|
-
import { readFileSync as
|
|
10562
|
+
import { readFileSync as readFileSync24 } from "fs";
|
|
10457
10563
|
import path23 from "path";
|
|
10458
10564
|
var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
|
|
10459
10565
|
function getProjectRefs(csprojPath) {
|
|
10460
|
-
const content =
|
|
10566
|
+
const content = readFileSync24(csprojPath, "utf8");
|
|
10461
10567
|
const refs = [];
|
|
10462
10568
|
for (const match of content.matchAll(PROJECT_REF_RE)) {
|
|
10463
10569
|
refs.push(match[1].replace(/\\/g, "/"));
|
|
@@ -10474,7 +10580,7 @@ function buildTree(csprojPath, repoRoot, visited = /* @__PURE__ */ new Set()) {
|
|
|
10474
10580
|
for (const ref of getProjectRefs(abs)) {
|
|
10475
10581
|
const childAbs = path23.resolve(dir, ref);
|
|
10476
10582
|
try {
|
|
10477
|
-
|
|
10583
|
+
readFileSync24(childAbs);
|
|
10478
10584
|
node.children.push(buildTree(childAbs, repoRoot, visited));
|
|
10479
10585
|
} catch {
|
|
10480
10586
|
node.children.push({
|
|
@@ -10499,7 +10605,7 @@ function collectAllDeps(node) {
|
|
|
10499
10605
|
}
|
|
10500
10606
|
|
|
10501
10607
|
// src/commands/dotnet/findContainingSolutions.ts
|
|
10502
|
-
import { readdirSync as readdirSync3, readFileSync as
|
|
10608
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync25, statSync as statSync2 } from "fs";
|
|
10503
10609
|
import path24 from "path";
|
|
10504
10610
|
function findSlnFiles(dir, maxDepth, depth = 0) {
|
|
10505
10611
|
if (depth > maxDepth) return [];
|
|
@@ -10534,7 +10640,7 @@ function findContainingSolutions(csprojPath, repoRoot) {
|
|
|
10534
10640
|
const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
|
|
10535
10641
|
for (const sln of slnFiles) {
|
|
10536
10642
|
try {
|
|
10537
|
-
const content =
|
|
10643
|
+
const content = readFileSync25(sln, "utf8");
|
|
10538
10644
|
if (pattern2.test(content)) {
|
|
10539
10645
|
matches.push(path24.relative(repoRoot, sln));
|
|
10540
10646
|
}
|
|
@@ -10629,7 +10735,7 @@ async function deps(csprojPath, options2) {
|
|
|
10629
10735
|
}
|
|
10630
10736
|
|
|
10631
10737
|
// src/commands/dotnet/getChangedCsFiles.ts
|
|
10632
|
-
import { execSync as
|
|
10738
|
+
import { execSync as execSync26 } from "child_process";
|
|
10633
10739
|
var SCOPE_ALL = "all";
|
|
10634
10740
|
var SCOPE_BASE = "base:";
|
|
10635
10741
|
var SCOPE_COMMIT = "commit:";
|
|
@@ -10653,7 +10759,7 @@ function getChangedCsFiles(scope) {
|
|
|
10653
10759
|
} else {
|
|
10654
10760
|
cmd = "git diff --name-only HEAD";
|
|
10655
10761
|
}
|
|
10656
|
-
const output =
|
|
10762
|
+
const output = execSync26(cmd, { encoding: "utf8" }).trim();
|
|
10657
10763
|
if (output === "") return [];
|
|
10658
10764
|
return output.split("\n").filter((f) => f.toLowerCase().endsWith(".cs"));
|
|
10659
10765
|
}
|
|
@@ -10851,14 +10957,14 @@ function parseInspectReport(json) {
|
|
|
10851
10957
|
}
|
|
10852
10958
|
|
|
10853
10959
|
// src/commands/dotnet/runInspectCode.ts
|
|
10854
|
-
import { execSync as
|
|
10855
|
-
import { existsSync as existsSync31, readFileSync as
|
|
10960
|
+
import { execSync as execSync27 } from "child_process";
|
|
10961
|
+
import { existsSync as existsSync31, readFileSync as readFileSync26, unlinkSync as unlinkSync7 } from "fs";
|
|
10856
10962
|
import { tmpdir as tmpdir3 } from "os";
|
|
10857
10963
|
import path27 from "path";
|
|
10858
10964
|
import chalk114 from "chalk";
|
|
10859
10965
|
function assertJbInstalled() {
|
|
10860
10966
|
try {
|
|
10861
|
-
|
|
10967
|
+
execSync27("jb inspectcode --version", { stdio: "pipe" });
|
|
10862
10968
|
} catch {
|
|
10863
10969
|
console.error(chalk114.red("jb is not installed. Install with:"));
|
|
10864
10970
|
console.error(
|
|
@@ -10872,7 +10978,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
10872
10978
|
const includeFlag = include ? ` --include="${include}"` : "";
|
|
10873
10979
|
const sweaFlag = swea ? " --swea" : "";
|
|
10874
10980
|
try {
|
|
10875
|
-
|
|
10981
|
+
execSync27(
|
|
10876
10982
|
`jb inspectcode "${slnPath}" -o="${reportPath}"${includeFlag}${sweaFlag} --verbosity=OFF`,
|
|
10877
10983
|
{ stdio: "pipe" }
|
|
10878
10984
|
);
|
|
@@ -10887,13 +10993,13 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
10887
10993
|
console.error(chalk114.red("Report file not generated"));
|
|
10888
10994
|
process.exit(1);
|
|
10889
10995
|
}
|
|
10890
|
-
const xml =
|
|
10996
|
+
const xml = readFileSync26(reportPath, "utf8");
|
|
10891
10997
|
unlinkSync7(reportPath);
|
|
10892
10998
|
return xml;
|
|
10893
10999
|
}
|
|
10894
11000
|
|
|
10895
11001
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
10896
|
-
import { execSync as
|
|
11002
|
+
import { execSync as execSync28 } from "child_process";
|
|
10897
11003
|
import chalk115 from "chalk";
|
|
10898
11004
|
function resolveMsbuildPath() {
|
|
10899
11005
|
const { run: run4 } = loadConfig();
|
|
@@ -10904,7 +11010,7 @@ function resolveMsbuildPath() {
|
|
|
10904
11010
|
function assertMsbuildInstalled() {
|
|
10905
11011
|
const msbuild = resolveMsbuildPath();
|
|
10906
11012
|
try {
|
|
10907
|
-
|
|
11013
|
+
execSync28(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
10908
11014
|
} catch {
|
|
10909
11015
|
console.error(chalk115.red(`msbuild not found at: ${msbuild}`));
|
|
10910
11016
|
console.error(
|
|
@@ -10930,7 +11036,7 @@ function runRoslynInspect(slnPath) {
|
|
|
10930
11036
|
const msbuild = resolveMsbuildPath();
|
|
10931
11037
|
let output;
|
|
10932
11038
|
try {
|
|
10933
|
-
output =
|
|
11039
|
+
output = execSync28(
|
|
10934
11040
|
`"${msbuild}" "${slnPath}" -t:Build -v:minimal -maxcpucount -p:EnforceCodeStyleInBuild=true -p:RunAnalyzersDuringBuild=true 2>&1`,
|
|
10935
11041
|
{ encoding: "utf8", stdio: "pipe", maxBuffer: 50 * 1024 * 1024 }
|
|
10936
11042
|
);
|
|
@@ -11220,9 +11326,9 @@ function registerGithub(program2) {
|
|
|
11220
11326
|
}
|
|
11221
11327
|
|
|
11222
11328
|
// src/commands/handover/countPendingHandovers.ts
|
|
11223
|
-
import { and as
|
|
11329
|
+
import { and as and12, eq as eq30, isNull, sql as sql4 } from "drizzle-orm";
|
|
11224
11330
|
async function countPendingHandovers(orm, origin) {
|
|
11225
|
-
const [row] = await orm.select({ count:
|
|
11331
|
+
const [row] = await orm.select({ count: sql4`count(*)::int` }).from(handovers).where(and12(eq30(handovers.origin, origin), isNull(handovers.recalledAt)));
|
|
11226
11332
|
return row?.count ?? 0;
|
|
11227
11333
|
}
|
|
11228
11334
|
|
|
@@ -11230,8 +11336,8 @@ async function countPendingHandovers(orm, origin) {
|
|
|
11230
11336
|
import {
|
|
11231
11337
|
existsSync as existsSync32,
|
|
11232
11338
|
readdirSync as readdirSync5,
|
|
11233
|
-
readFileSync as
|
|
11234
|
-
rmSync as
|
|
11339
|
+
readFileSync as readFileSync27,
|
|
11340
|
+
rmSync as rmSync2,
|
|
11235
11341
|
statSync as statSync3
|
|
11236
11342
|
} from "fs";
|
|
11237
11343
|
import { basename as basename5, join as join34 } from "path";
|
|
@@ -11293,14 +11399,14 @@ function collectMarkdown(dir) {
|
|
|
11293
11399
|
return out;
|
|
11294
11400
|
}
|
|
11295
11401
|
async function migrateFile(orm, origin, file, createdAt) {
|
|
11296
|
-
const content =
|
|
11402
|
+
const content = readFileSync27(file, "utf8");
|
|
11297
11403
|
await saveHandover(orm, {
|
|
11298
11404
|
origin,
|
|
11299
11405
|
summary: summariseHandoverContent(content),
|
|
11300
11406
|
content,
|
|
11301
11407
|
createdAt
|
|
11302
11408
|
});
|
|
11303
|
-
|
|
11409
|
+
rmSync2(file);
|
|
11304
11410
|
}
|
|
11305
11411
|
async function migrateDiskHandovers(orm, origin, cwd = process.cwd()) {
|
|
11306
11412
|
let migrated = 0;
|
|
@@ -11349,7 +11455,7 @@ function emit(message) {
|
|
|
11349
11455
|
console.log(json);
|
|
11350
11456
|
return json;
|
|
11351
11457
|
}
|
|
11352
|
-
async function
|
|
11458
|
+
async function load2(options2 = {}) {
|
|
11353
11459
|
const opts = resolveLoadOptions(options2);
|
|
11354
11460
|
const input = await parseLoadInput(opts.stdin);
|
|
11355
11461
|
const cwd = input.cwd ?? opts.cwdFallback;
|
|
@@ -11362,13 +11468,13 @@ async function load(options2 = {}) {
|
|
|
11362
11468
|
}
|
|
11363
11469
|
|
|
11364
11470
|
// src/commands/handover/listPendingHandovers.ts
|
|
11365
|
-
import { and as
|
|
11471
|
+
import { and as and13, desc as desc4, eq as eq31, isNull as isNull2 } from "drizzle-orm";
|
|
11366
11472
|
async function listPendingHandovers(orm, origin) {
|
|
11367
11473
|
return orm.select({
|
|
11368
11474
|
id: handovers.id,
|
|
11369
11475
|
summary: handovers.summary,
|
|
11370
11476
|
createdAt: handovers.createdAt
|
|
11371
|
-
}).from(handovers).where(
|
|
11477
|
+
}).from(handovers).where(and13(eq31(handovers.origin, origin), isNull2(handovers.recalledAt))).orderBy(desc4(handovers.createdAt), desc4(handovers.id));
|
|
11372
11478
|
}
|
|
11373
11479
|
|
|
11374
11480
|
// src/commands/handover/printPendingHandovers.ts
|
|
@@ -11381,17 +11487,17 @@ async function printPendingHandovers() {
|
|
|
11381
11487
|
}
|
|
11382
11488
|
|
|
11383
11489
|
// src/commands/handover/recallHandover.ts
|
|
11384
|
-
import { and as
|
|
11490
|
+
import { and as and14, desc as desc5, eq as eq32, isNull as isNull3 } from "drizzle-orm";
|
|
11385
11491
|
async function recallHandover(orm, origin, id2) {
|
|
11386
11492
|
const [row] = await orm.select().from(handovers).where(
|
|
11387
|
-
|
|
11388
|
-
|
|
11493
|
+
and14(
|
|
11494
|
+
eq32(handovers.origin, origin),
|
|
11389
11495
|
isNull3(handovers.recalledAt),
|
|
11390
|
-
...id2 === void 0 ? [] : [
|
|
11496
|
+
...id2 === void 0 ? [] : [eq32(handovers.id, id2)]
|
|
11391
11497
|
)
|
|
11392
11498
|
).orderBy(desc5(handovers.createdAt), desc5(handovers.id)).limit(1);
|
|
11393
11499
|
if (!row) return void 0;
|
|
11394
|
-
await orm.update(handovers).set({ recalledAt: /* @__PURE__ */ new Date() }).where(
|
|
11500
|
+
await orm.update(handovers).set({ recalledAt: /* @__PURE__ */ new Date() }).where(eq32(handovers.id, row.id));
|
|
11395
11501
|
return row.content;
|
|
11396
11502
|
}
|
|
11397
11503
|
|
|
@@ -11436,7 +11542,7 @@ function registerHandover(program2) {
|
|
|
11436
11542
|
cmd.command("load").description(
|
|
11437
11543
|
"SessionStart hook: migrate any disk handovers, then advise how many unrecalled handovers exist for this repo"
|
|
11438
11544
|
).action(async () => {
|
|
11439
|
-
await
|
|
11545
|
+
await load2();
|
|
11440
11546
|
});
|
|
11441
11547
|
}
|
|
11442
11548
|
|
|
@@ -11501,12 +11607,12 @@ function adfToText(doc) {
|
|
|
11501
11607
|
}
|
|
11502
11608
|
|
|
11503
11609
|
// src/commands/jira/fetchIssue.ts
|
|
11504
|
-
import { execSync as
|
|
11610
|
+
import { execSync as execSync29 } from "child_process";
|
|
11505
11611
|
import chalk119 from "chalk";
|
|
11506
11612
|
function fetchIssue(issueKey, fields) {
|
|
11507
11613
|
let result;
|
|
11508
11614
|
try {
|
|
11509
|
-
result =
|
|
11615
|
+
result = execSync29(
|
|
11510
11616
|
`acli jira workitem view ${issueKey} -f ${fields} --json`,
|
|
11511
11617
|
{ encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] }
|
|
11512
11618
|
);
|
|
@@ -11552,10 +11658,10 @@ function acceptanceCriteria(issueKey) {
|
|
|
11552
11658
|
}
|
|
11553
11659
|
|
|
11554
11660
|
// src/commands/jira/jiraAuth.ts
|
|
11555
|
-
import { execSync as
|
|
11661
|
+
import { execSync as execSync30 } from "child_process";
|
|
11556
11662
|
|
|
11557
11663
|
// src/shared/loadJson.ts
|
|
11558
|
-
import { existsSync as existsSync33, mkdirSync as mkdirSync11, readFileSync as
|
|
11664
|
+
import { existsSync as existsSync33, mkdirSync as mkdirSync11, readFileSync as readFileSync28, writeFileSync as writeFileSync24 } from "fs";
|
|
11559
11665
|
import { homedir as homedir12 } from "os";
|
|
11560
11666
|
import { join as join35 } from "path";
|
|
11561
11667
|
function getStoreDir() {
|
|
@@ -11568,7 +11674,7 @@ function loadJson(filename) {
|
|
|
11568
11674
|
const path57 = getStorePath(filename);
|
|
11569
11675
|
if (existsSync33(path57)) {
|
|
11570
11676
|
try {
|
|
11571
|
-
return JSON.parse(
|
|
11677
|
+
return JSON.parse(readFileSync28(path57, "utf8"));
|
|
11572
11678
|
} catch {
|
|
11573
11679
|
return {};
|
|
11574
11680
|
}
|
|
@@ -11616,7 +11722,7 @@ async function jiraAuth() {
|
|
|
11616
11722
|
console.error("All fields are required.");
|
|
11617
11723
|
process.exit(1);
|
|
11618
11724
|
}
|
|
11619
|
-
|
|
11725
|
+
execSync30(`acli jira auth login --site ${site} --email "${email}" --token`, {
|
|
11620
11726
|
encoding: "utf8",
|
|
11621
11727
|
input: token,
|
|
11622
11728
|
stdio: ["pipe", "inherit", "inherit"]
|
|
@@ -11724,7 +11830,7 @@ import { resolve as resolve11 } from "path";
|
|
|
11724
11830
|
import chalk125 from "chalk";
|
|
11725
11831
|
|
|
11726
11832
|
// src/commands/mermaid/exportFile.ts
|
|
11727
|
-
import { readFileSync as
|
|
11833
|
+
import { readFileSync as readFileSync29, writeFileSync as writeFileSync25 } from "fs";
|
|
11728
11834
|
import { basename as basename6, extname, resolve as resolve10 } from "path";
|
|
11729
11835
|
import chalk124 from "chalk";
|
|
11730
11836
|
|
|
@@ -11750,7 +11856,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
11750
11856
|
|
|
11751
11857
|
// src/commands/mermaid/exportFile.ts
|
|
11752
11858
|
async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
11753
|
-
const content =
|
|
11859
|
+
const content = readFileSync29(file, "utf8");
|
|
11754
11860
|
const blocks = extractMermaidBlocks(content);
|
|
11755
11861
|
const stem = basename6(file, extname(file));
|
|
11756
11862
|
if (onlyIndex !== void 0) {
|
|
@@ -12034,7 +12140,7 @@ import { join as join40 } from "path";
|
|
|
12034
12140
|
import chalk128 from "chalk";
|
|
12035
12141
|
|
|
12036
12142
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
12037
|
-
import { readFileSync as
|
|
12143
|
+
import { readFileSync as readFileSync30 } from "fs";
|
|
12038
12144
|
|
|
12039
12145
|
// src/commands/netcap/parseRscRows.ts
|
|
12040
12146
|
var isRscRef = (v) => typeof v === "string" && /^\$[0-9a-fL@]/.test(v);
|
|
@@ -12430,7 +12536,7 @@ function extractVoyagerPosts(body) {
|
|
|
12430
12536
|
|
|
12431
12537
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
12432
12538
|
function captureEntries(captureFile) {
|
|
12433
|
-
const lines =
|
|
12539
|
+
const lines = readFileSync30(captureFile, "utf8").split("\n").filter(Boolean);
|
|
12434
12540
|
const entries = [];
|
|
12435
12541
|
for (const line of lines) {
|
|
12436
12542
|
let entry;
|
|
@@ -12590,7 +12696,7 @@ function registerPrompts(program2) {
|
|
|
12590
12696
|
}
|
|
12591
12697
|
|
|
12592
12698
|
// src/commands/prs/shared.ts
|
|
12593
|
-
import { execSync as
|
|
12699
|
+
import { execSync as execSync31 } from "child_process";
|
|
12594
12700
|
function isGhNotInstalled(error) {
|
|
12595
12701
|
if (error instanceof Error) {
|
|
12596
12702
|
const msg = error.message.toLowerCase();
|
|
@@ -12608,12 +12714,12 @@ function getRepoInfo() {
|
|
|
12608
12714
|
const preferred = getPreferredRemoteRepo();
|
|
12609
12715
|
if (preferred) return preferred;
|
|
12610
12716
|
const repoInfo = JSON.parse(
|
|
12611
|
-
|
|
12717
|
+
execSync31("gh repo view --json owner,name", { encoding: "utf8" })
|
|
12612
12718
|
);
|
|
12613
12719
|
return { org: repoInfo.owner.login, repo: repoInfo.name };
|
|
12614
12720
|
}
|
|
12615
12721
|
function getCurrentBranch() {
|
|
12616
|
-
return
|
|
12722
|
+
return execSync31("git rev-parse --abbrev-ref HEAD", {
|
|
12617
12723
|
encoding: "utf8"
|
|
12618
12724
|
}).trim();
|
|
12619
12725
|
}
|
|
@@ -12621,7 +12727,7 @@ function viewCurrentPr(fields) {
|
|
|
12621
12727
|
const { org, repo } = getRepoInfo();
|
|
12622
12728
|
const branch = getCurrentBranch();
|
|
12623
12729
|
return JSON.parse(
|
|
12624
|
-
|
|
12730
|
+
execSync31(`gh pr view ${branch} --json ${fields} -R ${org}/${repo}`, {
|
|
12625
12731
|
encoding: "utf8"
|
|
12626
12732
|
})
|
|
12627
12733
|
);
|
|
@@ -12725,7 +12831,7 @@ function comment2(path57, line, body, startLine) {
|
|
|
12725
12831
|
}
|
|
12726
12832
|
|
|
12727
12833
|
// src/commands/prs/edit.ts
|
|
12728
|
-
import { execSync as
|
|
12834
|
+
import { execSync as execSync32 } from "child_process";
|
|
12729
12835
|
|
|
12730
12836
|
// src/commands/prs/buildPrBody.ts
|
|
12731
12837
|
function jiraBrowseUrl(key) {
|
|
@@ -12898,23 +13004,23 @@ function edit(options2) {
|
|
|
12898
13004
|
if (options2.title) args.push(`--title ${shellQuote(options2.title)}`);
|
|
12899
13005
|
args.push(`--body ${shellQuote(newBody)}`);
|
|
12900
13006
|
try {
|
|
12901
|
-
|
|
13007
|
+
execSync32(args.join(" "), { stdio: "inherit" });
|
|
12902
13008
|
} catch {
|
|
12903
13009
|
process.exit(1);
|
|
12904
13010
|
}
|
|
12905
13011
|
}
|
|
12906
13012
|
|
|
12907
13013
|
// src/commands/prs/fixed.ts
|
|
12908
|
-
import { execSync as
|
|
13014
|
+
import { execSync as execSync35 } from "child_process";
|
|
12909
13015
|
|
|
12910
13016
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
12911
|
-
import { execSync as
|
|
13017
|
+
import { execSync as execSync34 } from "child_process";
|
|
12912
13018
|
import { unlinkSync as unlinkSync10, writeFileSync as writeFileSync27 } from "fs";
|
|
12913
13019
|
import { tmpdir as tmpdir5 } from "os";
|
|
12914
13020
|
import { join as join42 } from "path";
|
|
12915
13021
|
|
|
12916
13022
|
// src/commands/prs/loadCommentsCache.ts
|
|
12917
|
-
import { existsSync as existsSync34, readFileSync as
|
|
13023
|
+
import { existsSync as existsSync34, readFileSync as readFileSync31, unlinkSync as unlinkSync9 } from "fs";
|
|
12918
13024
|
import { join as join41 } from "path";
|
|
12919
13025
|
import { parse as parse2 } from "yaml";
|
|
12920
13026
|
function getCachePath(prNumber) {
|
|
@@ -12925,7 +13031,7 @@ function loadCommentsCache(prNumber) {
|
|
|
12925
13031
|
if (!existsSync34(cachePath)) {
|
|
12926
13032
|
return null;
|
|
12927
13033
|
}
|
|
12928
|
-
const content =
|
|
13034
|
+
const content = readFileSync31(cachePath, "utf8");
|
|
12929
13035
|
return parse2(content);
|
|
12930
13036
|
}
|
|
12931
13037
|
function deleteCommentsCache(prNumber) {
|
|
@@ -12937,9 +13043,9 @@ function deleteCommentsCache(prNumber) {
|
|
|
12937
13043
|
}
|
|
12938
13044
|
|
|
12939
13045
|
// src/commands/prs/replyToComment.ts
|
|
12940
|
-
import { execSync as
|
|
13046
|
+
import { execSync as execSync33 } from "child_process";
|
|
12941
13047
|
function replyToComment(org, repo, prNumber, commentId, message) {
|
|
12942
|
-
|
|
13048
|
+
execSync33(
|
|
12943
13049
|
`gh api repos/${org}/${repo}/pulls/${prNumber}/comments -f body="${message.replace(/"/g, String.raw`\"`)}" -F in_reply_to=${commentId}`,
|
|
12944
13050
|
{ stdio: ["inherit", "pipe", "inherit"] }
|
|
12945
13051
|
);
|
|
@@ -12951,7 +13057,7 @@ function resolveThread(threadId) {
|
|
|
12951
13057
|
const queryFile = join42(tmpdir5(), `gh-mutation-${Date.now()}.graphql`);
|
|
12952
13058
|
writeFileSync27(queryFile, mutation);
|
|
12953
13059
|
try {
|
|
12954
|
-
|
|
13060
|
+
execSync34(
|
|
12955
13061
|
`gh api graphql -F query=@${queryFile} -f threadId="${threadId}"`,
|
|
12956
13062
|
{ stdio: ["inherit", "pipe", "inherit"] }
|
|
12957
13063
|
);
|
|
@@ -13003,7 +13109,7 @@ function resolveCommentWithReply(commentId, message) {
|
|
|
13003
13109
|
// src/commands/prs/fixed.ts
|
|
13004
13110
|
function verifySha(sha) {
|
|
13005
13111
|
try {
|
|
13006
|
-
return
|
|
13112
|
+
return execSync35(`git rev-parse --verify ${sha}`, {
|
|
13007
13113
|
encoding: "utf8"
|
|
13008
13114
|
}).trim();
|
|
13009
13115
|
} catch {
|
|
@@ -13017,7 +13123,7 @@ function fixed(commentId, sha) {
|
|
|
13017
13123
|
const { org, repo } = getRepoInfo();
|
|
13018
13124
|
const repoUrl = `https://github.com/${org}/${repo}`;
|
|
13019
13125
|
const message = `Fixed in [${fullSha}](${repoUrl}/commit/${fullSha})`;
|
|
13020
|
-
|
|
13126
|
+
execSync35("git push", { stdio: "inherit" });
|
|
13021
13127
|
resolveCommentWithReply(commentId, message);
|
|
13022
13128
|
} catch (error) {
|
|
13023
13129
|
if (isGhNotInstalled(error)) {
|
|
@@ -13035,7 +13141,7 @@ import { join as join44 } from "path";
|
|
|
13035
13141
|
import { stringify } from "yaml";
|
|
13036
13142
|
|
|
13037
13143
|
// src/commands/prs/fetchThreadIds.ts
|
|
13038
|
-
import { execSync as
|
|
13144
|
+
import { execSync as execSync36 } from "child_process";
|
|
13039
13145
|
import { unlinkSync as unlinkSync11, writeFileSync as writeFileSync28 } from "fs";
|
|
13040
13146
|
import { tmpdir as tmpdir6 } from "os";
|
|
13041
13147
|
import { join as join43 } from "path";
|
|
@@ -13044,7 +13150,7 @@ function fetchThreadIds(org, repo, prNumber) {
|
|
|
13044
13150
|
const queryFile = join43(tmpdir6(), `gh-query-${Date.now()}.graphql`);
|
|
13045
13151
|
writeFileSync28(queryFile, THREAD_QUERY);
|
|
13046
13152
|
try {
|
|
13047
|
-
const result =
|
|
13153
|
+
const result = execSync36(
|
|
13048
13154
|
`gh api graphql -F query=@${queryFile} -F owner="${org}" -F repo="${repo}" -F prNumber=${prNumber}`,
|
|
13049
13155
|
{ encoding: "utf8" }
|
|
13050
13156
|
);
|
|
@@ -13066,9 +13172,9 @@ function fetchThreadIds(org, repo, prNumber) {
|
|
|
13066
13172
|
}
|
|
13067
13173
|
|
|
13068
13174
|
// src/commands/prs/listComments/fetchReviewComments.ts
|
|
13069
|
-
import { execSync as
|
|
13175
|
+
import { execSync as execSync37 } from "child_process";
|
|
13070
13176
|
function fetchJson(endpoint) {
|
|
13071
|
-
const result =
|
|
13177
|
+
const result = execSync37(`gh api --paginate ${endpoint}`, {
|
|
13072
13178
|
encoding: "utf8"
|
|
13073
13179
|
});
|
|
13074
13180
|
if (!result.trim()) return [];
|
|
@@ -13207,7 +13313,7 @@ async function listComments() {
|
|
|
13207
13313
|
}
|
|
13208
13314
|
|
|
13209
13315
|
// src/commands/prs/prs/index.ts
|
|
13210
|
-
import { execSync as
|
|
13316
|
+
import { execSync as execSync38 } from "child_process";
|
|
13211
13317
|
|
|
13212
13318
|
// src/commands/prs/prs/displayPaginated/index.ts
|
|
13213
13319
|
import enquirer9 from "enquirer";
|
|
@@ -13314,7 +13420,7 @@ async function prs(options2) {
|
|
|
13314
13420
|
const state = options2.open ? "open" : options2.closed ? "closed" : "all";
|
|
13315
13421
|
try {
|
|
13316
13422
|
const { org, repo } = getRepoInfo();
|
|
13317
|
-
const result =
|
|
13423
|
+
const result = execSync38(
|
|
13318
13424
|
`gh pr list --state ${state} --json number,title,url,author,createdAt,mergedAt,closedAt,state,changedFiles --limit 100 -R ${org}/${repo}`,
|
|
13319
13425
|
{ encoding: "utf8" }
|
|
13320
13426
|
);
|
|
@@ -13337,7 +13443,7 @@ async function prs(options2) {
|
|
|
13337
13443
|
}
|
|
13338
13444
|
|
|
13339
13445
|
// src/commands/prs/raise.ts
|
|
13340
|
-
import { execSync as
|
|
13446
|
+
import { execSync as execSync39 } from "child_process";
|
|
13341
13447
|
|
|
13342
13448
|
// src/commands/prs/buildCreateArgs.ts
|
|
13343
13449
|
function buildCreateArgs(title, body, options2) {
|
|
@@ -13397,7 +13503,7 @@ function raise(options2) {
|
|
|
13397
13503
|
`--body ${shellQuote(body)}`
|
|
13398
13504
|
] : buildCreateArgs(options2.title, body, options2);
|
|
13399
13505
|
try {
|
|
13400
|
-
|
|
13506
|
+
execSync39(args.join(" "), { stdio: "inherit" });
|
|
13401
13507
|
} catch {
|
|
13402
13508
|
process.exit(1);
|
|
13403
13509
|
}
|
|
@@ -13429,7 +13535,7 @@ function reply(commentId, body) {
|
|
|
13429
13535
|
}
|
|
13430
13536
|
|
|
13431
13537
|
// src/commands/prs/wontfix.ts
|
|
13432
|
-
import { execSync as
|
|
13538
|
+
import { execSync as execSync40 } from "child_process";
|
|
13433
13539
|
function validateReason(reason) {
|
|
13434
13540
|
const lowerReason = reason.toLowerCase();
|
|
13435
13541
|
if (lowerReason.includes("claude") || lowerReason.includes("opus")) {
|
|
@@ -13446,7 +13552,7 @@ function validateShaReferences(reason) {
|
|
|
13446
13552
|
const invalidShas = [];
|
|
13447
13553
|
for (const sha of shas) {
|
|
13448
13554
|
try {
|
|
13449
|
-
|
|
13555
|
+
execSync40(`git cat-file -t ${sha}`, { stdio: "pipe" });
|
|
13450
13556
|
} catch {
|
|
13451
13557
|
invalidShas.push(sha);
|
|
13452
13558
|
}
|
|
@@ -13608,10 +13714,10 @@ import chalk135 from "chalk";
|
|
|
13608
13714
|
import Enquirer2 from "enquirer";
|
|
13609
13715
|
|
|
13610
13716
|
// src/commands/ravendb/searchItems.ts
|
|
13611
|
-
import { execSync as
|
|
13717
|
+
import { execSync as execSync41 } from "child_process";
|
|
13612
13718
|
import chalk134 from "chalk";
|
|
13613
13719
|
function opExec(args) {
|
|
13614
|
-
return
|
|
13720
|
+
return execSync41(`op ${args}`, {
|
|
13615
13721
|
encoding: "utf8",
|
|
13616
13722
|
stdio: ["pipe", "pipe", "pipe"]
|
|
13617
13723
|
}).trim();
|
|
@@ -13763,7 +13869,7 @@ ${errorText}`
|
|
|
13763
13869
|
}
|
|
13764
13870
|
|
|
13765
13871
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
13766
|
-
import { execSync as
|
|
13872
|
+
import { execSync as execSync42 } from "child_process";
|
|
13767
13873
|
import chalk139 from "chalk";
|
|
13768
13874
|
function resolveOpSecret(reference) {
|
|
13769
13875
|
if (!reference.startsWith("op://")) {
|
|
@@ -13771,7 +13877,7 @@ function resolveOpSecret(reference) {
|
|
|
13771
13877
|
process.exit(1);
|
|
13772
13878
|
}
|
|
13773
13879
|
try {
|
|
13774
|
-
return
|
|
13880
|
+
return execSync42(`op read "${reference}"`, {
|
|
13775
13881
|
encoding: "utf8",
|
|
13776
13882
|
stdio: ["pipe", "pipe", "pipe"]
|
|
13777
13883
|
}).trim();
|
|
@@ -14020,9 +14126,9 @@ Refactor check failed:
|
|
|
14020
14126
|
}
|
|
14021
14127
|
|
|
14022
14128
|
// src/commands/refactor/check/getViolations/index.ts
|
|
14023
|
-
import { execSync as
|
|
14129
|
+
import { execSync as execSync43 } from "child_process";
|
|
14024
14130
|
import fs20 from "fs";
|
|
14025
|
-
import { minimatch as
|
|
14131
|
+
import { minimatch as minimatch6 } from "minimatch";
|
|
14026
14132
|
|
|
14027
14133
|
// src/commands/refactor/check/getViolations/getIgnoredFiles.ts
|
|
14028
14134
|
import fs19 from "fs";
|
|
@@ -14070,7 +14176,7 @@ function getGitFiles(options2) {
|
|
|
14070
14176
|
}
|
|
14071
14177
|
const files = /* @__PURE__ */ new Set();
|
|
14072
14178
|
if (options2.staged || options2.modified) {
|
|
14073
|
-
const staged =
|
|
14179
|
+
const staged = execSync43("git diff --cached --name-only", {
|
|
14074
14180
|
encoding: "utf8"
|
|
14075
14181
|
});
|
|
14076
14182
|
for (const file of staged.trim().split("\n").filter(Boolean)) {
|
|
@@ -14078,7 +14184,7 @@ function getGitFiles(options2) {
|
|
|
14078
14184
|
}
|
|
14079
14185
|
}
|
|
14080
14186
|
if (options2.unstaged || options2.modified) {
|
|
14081
|
-
const unstaged =
|
|
14187
|
+
const unstaged = execSync43("git diff --name-only", { encoding: "utf8" });
|
|
14082
14188
|
for (const file of unstaged.trim().split("\n").filter(Boolean)) {
|
|
14083
14189
|
files.add(file);
|
|
14084
14190
|
}
|
|
@@ -14090,7 +14196,7 @@ function getViolations(pattern2, options2 = {}, maxLines = DEFAULT_MAX_LINES) {
|
|
|
14090
14196
|
const ignoredFiles = getIgnoredFiles();
|
|
14091
14197
|
const gitFiles = getGitFiles(options2);
|
|
14092
14198
|
if (pattern2) {
|
|
14093
|
-
sourceFiles = sourceFiles.filter((f) =>
|
|
14199
|
+
sourceFiles = sourceFiles.filter((f) => minimatch6(f, pattern2));
|
|
14094
14200
|
}
|
|
14095
14201
|
if (gitFiles) {
|
|
14096
14202
|
sourceFiles = sourceFiles.filter((f) => gitFiles.has(f));
|
|
@@ -14175,7 +14281,7 @@ import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
|
14175
14281
|
import {
|
|
14176
14282
|
SyntaxKind as SyntaxKind2
|
|
14177
14283
|
} from "ts-morph";
|
|
14178
|
-
var suppressionPattern = /^\s*(\/\/|\/\*)\s*
|
|
14284
|
+
var suppressionPattern = /^\s*(\/\/|\/\*)\s*oxlint-disable\b/;
|
|
14179
14285
|
function countLeadingSuppressions(sourceFile) {
|
|
14180
14286
|
let count6 = 0;
|
|
14181
14287
|
for (const stmt of sourceFile.getStatementsWithComments()) {
|
|
@@ -15722,9 +15828,9 @@ function buildReviewPaths(repoRoot, key) {
|
|
|
15722
15828
|
}
|
|
15723
15829
|
|
|
15724
15830
|
// src/commands/review/fetchExistingComments.ts
|
|
15725
|
-
import { execSync as
|
|
15831
|
+
import { execSync as execSync44 } from "child_process";
|
|
15726
15832
|
function fetchRawComments(org, repo, prNumber) {
|
|
15727
|
-
const out =
|
|
15833
|
+
const out = execSync44(
|
|
15728
15834
|
`gh api --paginate repos/${org}/${repo}/pulls/${prNumber}/comments`,
|
|
15729
15835
|
{ encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }
|
|
15730
15836
|
);
|
|
@@ -15755,14 +15861,14 @@ function fetchExistingComments() {
|
|
|
15755
15861
|
}
|
|
15756
15862
|
|
|
15757
15863
|
// src/commands/review/gatherContext.ts
|
|
15758
|
-
import { execSync as
|
|
15864
|
+
import { execSync as execSync47 } from "child_process";
|
|
15759
15865
|
|
|
15760
15866
|
// src/commands/review/fetchPrDiff.ts
|
|
15761
|
-
import { execSync as
|
|
15867
|
+
import { execSync as execSync45 } from "child_process";
|
|
15762
15868
|
function fetchPrDiff(prNumber, baseSha, headSha) {
|
|
15763
15869
|
const { org, repo } = getRepoInfo();
|
|
15764
15870
|
try {
|
|
15765
|
-
return
|
|
15871
|
+
return execSync45(`gh pr diff ${prNumber} -R ${org}/${repo}`, {
|
|
15766
15872
|
encoding: "utf8",
|
|
15767
15873
|
maxBuffer: 256 * 1024 * 1024,
|
|
15768
15874
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -15777,19 +15883,19 @@ function isDiffTooLarge(error) {
|
|
|
15777
15883
|
}
|
|
15778
15884
|
function fetchDiffViaGit(baseSha, headSha) {
|
|
15779
15885
|
try {
|
|
15780
|
-
|
|
15886
|
+
execSync45(`git fetch origin ${baseSha} ${headSha}`, { stdio: "ignore" });
|
|
15781
15887
|
} catch {
|
|
15782
15888
|
}
|
|
15783
|
-
return
|
|
15889
|
+
return execSync45(`git diff ${baseSha}...${headSha}`, {
|
|
15784
15890
|
encoding: "utf8",
|
|
15785
15891
|
maxBuffer: 256 * 1024 * 1024
|
|
15786
15892
|
});
|
|
15787
15893
|
}
|
|
15788
15894
|
|
|
15789
15895
|
// src/commands/review/fetchPrDiffInfo.ts
|
|
15790
|
-
import { execSync as
|
|
15896
|
+
import { execSync as execSync46 } from "child_process";
|
|
15791
15897
|
function getCurrentBranch2() {
|
|
15792
|
-
return
|
|
15898
|
+
return execSync46("git rev-parse --abbrev-ref HEAD", {
|
|
15793
15899
|
encoding: "utf8"
|
|
15794
15900
|
}).trim();
|
|
15795
15901
|
}
|
|
@@ -15799,7 +15905,7 @@ function fetchPrDiffInfo() {
|
|
|
15799
15905
|
const fields = "number,baseRefName,baseRefOid,headRefName,headRefOid";
|
|
15800
15906
|
let raw;
|
|
15801
15907
|
try {
|
|
15802
|
-
raw =
|
|
15908
|
+
raw = execSync46(`gh pr view ${branch} --json ${fields} -R ${org}/${repo}`, {
|
|
15803
15909
|
encoding: "utf8",
|
|
15804
15910
|
stdio: ["ignore", "pipe", "pipe"]
|
|
15805
15911
|
});
|
|
@@ -15823,7 +15929,7 @@ function fetchPrDiffInfo() {
|
|
|
15823
15929
|
}
|
|
15824
15930
|
function fetchPrChangedFiles(prNumber) {
|
|
15825
15931
|
const { org, repo } = getRepoInfo();
|
|
15826
|
-
const out =
|
|
15932
|
+
const out = execSync46(
|
|
15827
15933
|
`gh api repos/${org}/${repo}/pulls/${prNumber}/files --paginate --jq ".[].filename"`,
|
|
15828
15934
|
{
|
|
15829
15935
|
encoding: "utf8",
|
|
@@ -15835,11 +15941,11 @@ function fetchPrChangedFiles(prNumber) {
|
|
|
15835
15941
|
|
|
15836
15942
|
// src/commands/review/gatherContext.ts
|
|
15837
15943
|
function gatherContext() {
|
|
15838
|
-
const branch =
|
|
15944
|
+
const branch = execSync47("git rev-parse --abbrev-ref HEAD", {
|
|
15839
15945
|
encoding: "utf8"
|
|
15840
15946
|
}).trim();
|
|
15841
|
-
const sha =
|
|
15842
|
-
const shortSha =
|
|
15947
|
+
const sha = execSync47("git rev-parse HEAD", { encoding: "utf8" }).trim();
|
|
15948
|
+
const shortSha = execSync47("git rev-parse --short=7 HEAD", {
|
|
15843
15949
|
encoding: "utf8"
|
|
15844
15950
|
}).trim();
|
|
15845
15951
|
const prInfo = fetchPrDiffInfo();
|
|
@@ -15860,7 +15966,7 @@ function gatherContext() {
|
|
|
15860
15966
|
}
|
|
15861
15967
|
|
|
15862
15968
|
// src/commands/review/postReviewToPr.ts
|
|
15863
|
-
import { readFileSync as
|
|
15969
|
+
import { readFileSync as readFileSync32 } from "fs";
|
|
15864
15970
|
|
|
15865
15971
|
// src/commands/review/parseFindings.ts
|
|
15866
15972
|
var SEVERITIES = ["blocker", "major", "minor", "nit"];
|
|
@@ -16170,7 +16276,7 @@ async function confirmPost(prNumber, count6, options2) {
|
|
|
16170
16276
|
async function postReviewToPr(synthesisPath, options2) {
|
|
16171
16277
|
const prInfo = fetchPrDiffInfo();
|
|
16172
16278
|
const prNumber = prInfo.prNumber;
|
|
16173
|
-
const markdown =
|
|
16279
|
+
const markdown = readFileSync32(synthesisPath, "utf8");
|
|
16174
16280
|
const findings = parseFindings(markdown);
|
|
16175
16281
|
if (findings.length === 0) {
|
|
16176
16282
|
console.log("Synthesis contains no findings; nothing to post.");
|
|
@@ -17054,7 +17160,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
|
|
|
17054
17160
|
}
|
|
17055
17161
|
|
|
17056
17162
|
// src/commands/review/synthesise.ts
|
|
17057
|
-
import { readFileSync as
|
|
17163
|
+
import { readFileSync as readFileSync33 } from "fs";
|
|
17058
17164
|
|
|
17059
17165
|
// src/commands/review/buildSynthesisStdin.ts
|
|
17060
17166
|
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 +17216,7 @@ Files:
|
|
|
17110
17216
|
|
|
17111
17217
|
// src/commands/review/synthesise.ts
|
|
17112
17218
|
function printSummary2(synthesisPath) {
|
|
17113
|
-
const markdown =
|
|
17219
|
+
const markdown = readFileSync33(synthesisPath, "utf8");
|
|
17114
17220
|
console.log("");
|
|
17115
17221
|
console.log(buildReviewSummary(markdown));
|
|
17116
17222
|
console.log("");
|
|
@@ -17763,9 +17869,9 @@ function resolveConnection3(name) {
|
|
|
17763
17869
|
}
|
|
17764
17870
|
|
|
17765
17871
|
// src/commands/sql/sqlConnect.ts
|
|
17766
|
-
import
|
|
17872
|
+
import sql5 from "mssql";
|
|
17767
17873
|
async function sqlConnect(conn) {
|
|
17768
|
-
return await
|
|
17874
|
+
return await sql5.connect({
|
|
17769
17875
|
server: conn.server,
|
|
17770
17876
|
port: conn.port,
|
|
17771
17877
|
user: conn.user,
|
|
@@ -18124,7 +18230,7 @@ async function fixInvalidDatePrefixes(vttFiles) {
|
|
|
18124
18230
|
}
|
|
18125
18231
|
|
|
18126
18232
|
// src/commands/transcript/format/processVttFile/index.ts
|
|
18127
|
-
import { existsSync as existsSync40, mkdirSync as mkdirSync15, readFileSync as
|
|
18233
|
+
import { existsSync as existsSync40, mkdirSync as mkdirSync15, readFileSync as readFileSync34, writeFileSync as writeFileSync32 } from "fs";
|
|
18128
18234
|
import { basename as basename9, dirname as dirname23, join as join49 } from "path";
|
|
18129
18235
|
|
|
18130
18236
|
// src/commands/transcript/cleanText.ts
|
|
@@ -18372,7 +18478,7 @@ function logReduction(cueCount, messageCount) {
|
|
|
18372
18478
|
}
|
|
18373
18479
|
function readAndParseCues(inputPath) {
|
|
18374
18480
|
console.log(`Reading: ${inputPath}`);
|
|
18375
|
-
return processCues(
|
|
18481
|
+
return processCues(readFileSync34(inputPath, "utf8"));
|
|
18376
18482
|
}
|
|
18377
18483
|
function writeFormatted(outputPath, content) {
|
|
18378
18484
|
writeFileSync32(outputPath, content, "utf8");
|
|
@@ -18450,9 +18556,9 @@ import { basename as basename10, dirname as dirname25, join as join51, relative
|
|
|
18450
18556
|
import {
|
|
18451
18557
|
existsSync as existsSync42,
|
|
18452
18558
|
mkdirSync as mkdirSync16,
|
|
18453
|
-
readFileSync as
|
|
18559
|
+
readFileSync as readFileSync35,
|
|
18454
18560
|
renameSync as renameSync3,
|
|
18455
|
-
rmSync as
|
|
18561
|
+
rmSync as rmSync3
|
|
18456
18562
|
} from "fs";
|
|
18457
18563
|
import { dirname as dirname24, join as join50 } from "path";
|
|
18458
18564
|
|
|
@@ -18494,7 +18600,7 @@ function processStagedFile() {
|
|
|
18494
18600
|
}
|
|
18495
18601
|
const { transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
18496
18602
|
const stagedFile = stagedFiles[0];
|
|
18497
|
-
const content =
|
|
18603
|
+
const content = readFileSync35(stagedFile.absolutePath, "utf8");
|
|
18498
18604
|
validateStagedContent(stagedFile.filename, content);
|
|
18499
18605
|
const stagedBaseName = getTranscriptBaseName(stagedFile.filename);
|
|
18500
18606
|
const transcriptFiles = findMdFilesRecursive(transcriptsDir);
|
|
@@ -18515,7 +18621,7 @@ function processStagedFile() {
|
|
|
18515
18621
|
renameSync3(stagedFile.absolutePath, destPath);
|
|
18516
18622
|
const remaining = findMdFilesRecursive(STAGING_DIR);
|
|
18517
18623
|
if (remaining.length === 0) {
|
|
18518
|
-
|
|
18624
|
+
rmSync3(STAGING_DIR, { recursive: true });
|
|
18519
18625
|
}
|
|
18520
18626
|
return true;
|
|
18521
18627
|
}
|
|
@@ -18606,9 +18712,9 @@ function registerVerify(program2) {
|
|
|
18606
18712
|
verifyCommand.command("hardcoded-colors").description("Check for hardcoded hex colors in src/").action(hardcodedColors);
|
|
18607
18713
|
verifyCommand.command("comment-policy").description("Check for undocumented comments added on changed lines").action(commentPolicy);
|
|
18608
18714
|
verifyCommand.command("no-venv").description("Check that no venv folders exist in the repo").action(noVenv);
|
|
18609
|
-
verifyCommand.command("
|
|
18610
|
-
"Check
|
|
18611
|
-
).action(
|
|
18715
|
+
verifyCommand.command("forbidden-strings").description(
|
|
18716
|
+
"Check configured JSON files for values matching forbiddenStrings rules"
|
|
18717
|
+
).action(forbiddenStrings);
|
|
18612
18718
|
}
|
|
18613
18719
|
|
|
18614
18720
|
// src/commands/voice/devices.ts
|
|
@@ -18649,14 +18755,14 @@ function devices() {
|
|
|
18649
18755
|
}
|
|
18650
18756
|
|
|
18651
18757
|
// src/commands/voice/logs.ts
|
|
18652
|
-
import { existsSync as existsSync44, readFileSync as
|
|
18758
|
+
import { existsSync as existsSync44, readFileSync as readFileSync36 } from "fs";
|
|
18653
18759
|
function logs(options2) {
|
|
18654
18760
|
if (!existsSync44(voicePaths.log)) {
|
|
18655
18761
|
console.log("No voice log file found");
|
|
18656
18762
|
return;
|
|
18657
18763
|
}
|
|
18658
18764
|
const count6 = Number.parseInt(options2.lines ?? "150", 10);
|
|
18659
|
-
const content =
|
|
18765
|
+
const content = readFileSync36(voicePaths.log, "utf8").trim();
|
|
18660
18766
|
if (!content) {
|
|
18661
18767
|
console.log("Voice log is empty");
|
|
18662
18768
|
return;
|
|
@@ -18682,8 +18788,8 @@ import { mkdirSync as mkdirSync18 } from "fs";
|
|
|
18682
18788
|
import { join as join55 } from "path";
|
|
18683
18789
|
|
|
18684
18790
|
// src/commands/voice/checkLockFile.ts
|
|
18685
|
-
import { execSync as
|
|
18686
|
-
import { existsSync as existsSync45, mkdirSync as mkdirSync17, readFileSync as
|
|
18791
|
+
import { execSync as execSync48 } from "child_process";
|
|
18792
|
+
import { existsSync as existsSync45, mkdirSync as mkdirSync17, readFileSync as readFileSync37, writeFileSync as writeFileSync33 } from "fs";
|
|
18687
18793
|
import { join as join54 } from "path";
|
|
18688
18794
|
function isProcessAlive2(pid) {
|
|
18689
18795
|
try {
|
|
@@ -18697,10 +18803,10 @@ function checkLockFile() {
|
|
|
18697
18803
|
const lockFile = getLockFile();
|
|
18698
18804
|
if (!existsSync45(lockFile)) return;
|
|
18699
18805
|
try {
|
|
18700
|
-
const
|
|
18701
|
-
if (
|
|
18806
|
+
const lock2 = JSON.parse(readFileSync37(lockFile, "utf8"));
|
|
18807
|
+
if (lock2.pid && isProcessAlive2(lock2.pid)) {
|
|
18702
18808
|
console.error(
|
|
18703
|
-
`Voice daemon already running (PID ${
|
|
18809
|
+
`Voice daemon already running (PID ${lock2.pid}, env: ${lock2.env}). Stop it first with: assist voice stop`
|
|
18704
18810
|
);
|
|
18705
18811
|
process.exit(1);
|
|
18706
18812
|
}
|
|
@@ -18711,7 +18817,7 @@ function bootstrapVenv() {
|
|
|
18711
18817
|
if (existsSync45(getVenvPython())) return;
|
|
18712
18818
|
console.log("Setting up Python environment...");
|
|
18713
18819
|
const pythonDir = getPythonDir();
|
|
18714
|
-
|
|
18820
|
+
execSync48(
|
|
18715
18821
|
`uv sync --project "${pythonDir}" --extra runtime --no-install-project`,
|
|
18716
18822
|
{
|
|
18717
18823
|
stdio: "inherit",
|
|
@@ -18799,7 +18905,7 @@ function start2(options2) {
|
|
|
18799
18905
|
}
|
|
18800
18906
|
|
|
18801
18907
|
// src/commands/voice/status.ts
|
|
18802
|
-
import { existsSync as existsSync46, readFileSync as
|
|
18908
|
+
import { existsSync as existsSync46, readFileSync as readFileSync38 } from "fs";
|
|
18803
18909
|
function isProcessAlive3(pid) {
|
|
18804
18910
|
try {
|
|
18805
18911
|
process.kill(pid, 0);
|
|
@@ -18810,7 +18916,7 @@ function isProcessAlive3(pid) {
|
|
|
18810
18916
|
}
|
|
18811
18917
|
function readRecentLogs(count6) {
|
|
18812
18918
|
if (!existsSync46(voicePaths.log)) return [];
|
|
18813
|
-
const lines =
|
|
18919
|
+
const lines = readFileSync38(voicePaths.log, "utf8").trim().split("\n");
|
|
18814
18920
|
return lines.slice(-count6);
|
|
18815
18921
|
}
|
|
18816
18922
|
function status() {
|
|
@@ -18818,7 +18924,7 @@ function status() {
|
|
|
18818
18924
|
console.log("Voice daemon: not running (no PID file)");
|
|
18819
18925
|
return;
|
|
18820
18926
|
}
|
|
18821
|
-
const pid = Number.parseInt(
|
|
18927
|
+
const pid = Number.parseInt(readFileSync38(voicePaths.pid, "utf8").trim(), 10);
|
|
18822
18928
|
const alive = isProcessAlive3(pid);
|
|
18823
18929
|
console.log(`Voice daemon: ${alive ? "running" : "dead"} (PID ${pid})`);
|
|
18824
18930
|
const recent = readRecentLogs(5);
|
|
@@ -18837,13 +18943,13 @@ function status() {
|
|
|
18837
18943
|
}
|
|
18838
18944
|
|
|
18839
18945
|
// src/commands/voice/stop.ts
|
|
18840
|
-
import { existsSync as existsSync47, readFileSync as
|
|
18946
|
+
import { existsSync as existsSync47, readFileSync as readFileSync39, unlinkSync as unlinkSync15 } from "fs";
|
|
18841
18947
|
function stop2() {
|
|
18842
18948
|
if (!existsSync47(voicePaths.pid)) {
|
|
18843
18949
|
console.log("Voice daemon is not running (no PID file)");
|
|
18844
18950
|
return;
|
|
18845
18951
|
}
|
|
18846
|
-
const pid = Number.parseInt(
|
|
18952
|
+
const pid = Number.parseInt(readFileSync39(voicePaths.pid, "utf8").trim(), 10);
|
|
18847
18953
|
try {
|
|
18848
18954
|
process.kill(pid, "SIGTERM");
|
|
18849
18955
|
console.log(`Sent SIGTERM to voice daemon (PID ${pid})`);
|
|
@@ -19034,7 +19140,7 @@ async function auth() {
|
|
|
19034
19140
|
|
|
19035
19141
|
// src/commands/roam/postRoamActivity.ts
|
|
19036
19142
|
import { execFileSync as execFileSync7 } from "child_process";
|
|
19037
|
-
import { readdirSync as readdirSync8, readFileSync as
|
|
19143
|
+
import { readdirSync as readdirSync8, readFileSync as readFileSync40, statSync as statSync6 } from "fs";
|
|
19038
19144
|
import { join as join57 } from "path";
|
|
19039
19145
|
function findPortFile(roamDir) {
|
|
19040
19146
|
let entries;
|
|
@@ -19060,7 +19166,7 @@ function postRoamActivity(app, event) {
|
|
|
19060
19166
|
if (!portFile) return;
|
|
19061
19167
|
let port;
|
|
19062
19168
|
try {
|
|
19063
|
-
port =
|
|
19169
|
+
port = readFileSync40(portFile, "utf8").trim();
|
|
19064
19170
|
} catch {
|
|
19065
19171
|
return;
|
|
19066
19172
|
}
|
|
@@ -19188,11 +19294,11 @@ function resolveParams(params, cliArgs) {
|
|
|
19188
19294
|
}
|
|
19189
19295
|
|
|
19190
19296
|
// src/commands/run/runPreCommands.ts
|
|
19191
|
-
import { execSync as
|
|
19297
|
+
import { execSync as execSync49 } from "child_process";
|
|
19192
19298
|
function runPreCommands(pre, cwd) {
|
|
19193
19299
|
for (const cmd of pre) {
|
|
19194
19300
|
try {
|
|
19195
|
-
|
|
19301
|
+
execSync49(cmd, { stdio: "inherit", cwd });
|
|
19196
19302
|
} catch (error) {
|
|
19197
19303
|
const code = error && typeof error === "object" && "status" in error ? error.status : 1;
|
|
19198
19304
|
process.exit(code);
|
|
@@ -19476,7 +19582,7 @@ function registerRun(program2) {
|
|
|
19476
19582
|
}
|
|
19477
19583
|
|
|
19478
19584
|
// src/commands/screenshot/index.ts
|
|
19479
|
-
import { execSync as
|
|
19585
|
+
import { execSync as execSync50 } from "child_process";
|
|
19480
19586
|
import { existsSync as existsSync50, mkdirSync as mkdirSync21, unlinkSync as unlinkSync17, writeFileSync as writeFileSync36 } from "fs";
|
|
19481
19587
|
import { tmpdir as tmpdir7 } from "os";
|
|
19482
19588
|
import { join as join61, resolve as resolve15 } from "path";
|
|
@@ -19619,7 +19725,7 @@ function runPowerShellScript(processName, outputPath) {
|
|
|
19619
19725
|
const scriptPath = join61(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
|
|
19620
19726
|
writeFileSync36(scriptPath, captureWindowPs1, "utf8");
|
|
19621
19727
|
try {
|
|
19622
|
-
|
|
19728
|
+
execSync50(
|
|
19623
19729
|
`powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
|
|
19624
19730
|
{ stdio: ["ignore", "pipe", "pipe"], encoding: "utf8" }
|
|
19625
19731
|
);
|
|
@@ -19693,7 +19799,7 @@ function applyLine(result, pending, line) {
|
|
|
19693
19799
|
}
|
|
19694
19800
|
|
|
19695
19801
|
// src/commands/sessions/daemon/reportStolenSocket.ts
|
|
19696
|
-
import { readFileSync as
|
|
19802
|
+
import { readFileSync as readFileSync41 } from "fs";
|
|
19697
19803
|
function reportStolenSocket(socketPid) {
|
|
19698
19804
|
if (!socketPid) return;
|
|
19699
19805
|
const filePid = readPidFile();
|
|
@@ -19705,7 +19811,7 @@ function reportStolenSocket(socketPid) {
|
|
|
19705
19811
|
function readPidFile() {
|
|
19706
19812
|
try {
|
|
19707
19813
|
const pid = Number.parseInt(
|
|
19708
|
-
|
|
19814
|
+
readFileSync41(daemonPaths.pid, "utf8").trim(),
|
|
19709
19815
|
10
|
|
19710
19816
|
);
|
|
19711
19817
|
return Number.isInteger(pid) ? pid : void 0;
|
|
@@ -19915,37 +20021,6 @@ function broadcastSessions(sessions, clients, windowsSessions = [], active) {
|
|
|
19915
20021
|
});
|
|
19916
20022
|
}
|
|
19917
20023
|
|
|
19918
|
-
// src/shared/db/recordWindowPeak.ts
|
|
19919
|
-
import { and as and13, desc as desc6, eq as eq31, sql as sql5 } from "drizzle-orm";
|
|
19920
|
-
var RESET_DROP_THRESHOLD = 1;
|
|
19921
|
-
async function recordWindowPeak(db, window, resetsAt, usedPercentage) {
|
|
19922
|
-
const [active] = await db.select().from(usagePeaks).where(
|
|
19923
|
-
and13(eq31(usagePeaks.window, window), eq31(usagePeaks.resetsAt, resetsAt))
|
|
19924
|
-
).orderBy(desc6(usagePeaks.segment)).limit(1);
|
|
19925
|
-
if (!active) {
|
|
19926
|
-
await db.insert(usagePeaks).values({ window, resetsAt, segment: 0, usedPercentage });
|
|
19927
|
-
return;
|
|
19928
|
-
}
|
|
19929
|
-
const matchActive = and13(
|
|
19930
|
-
eq31(usagePeaks.window, window),
|
|
19931
|
-
eq31(usagePeaks.resetsAt, resetsAt),
|
|
19932
|
-
eq31(usagePeaks.segment, active.segment)
|
|
19933
|
-
);
|
|
19934
|
-
if (usedPercentage < active.usedPercentage - RESET_DROP_THRESHOLD) {
|
|
19935
|
-
await db.update(usagePeaks).set({ resetDetected: true }).where(matchActive);
|
|
19936
|
-
await db.insert(usagePeaks).values({
|
|
19937
|
-
window,
|
|
19938
|
-
resetsAt,
|
|
19939
|
-
segment: active.segment + 1,
|
|
19940
|
-
usedPercentage
|
|
19941
|
-
});
|
|
19942
|
-
return;
|
|
19943
|
-
}
|
|
19944
|
-
await db.update(usagePeaks).set({
|
|
19945
|
-
usedPercentage: sql5`GREATEST(${usagePeaks.usedPercentage}, ${usedPercentage})`
|
|
19946
|
-
}).where(matchActive);
|
|
19947
|
-
}
|
|
19948
|
-
|
|
19949
20024
|
// src/shared/db/recordUsagePeak.ts
|
|
19950
20025
|
var WINDOWS = ["five_hour", "seven_day"];
|
|
19951
20026
|
async function recordUsagePeak(db, rateLimits) {
|
|
@@ -21566,7 +21641,7 @@ function handleConnection(socket, manager) {
|
|
|
21566
21641
|
import { unlinkSync as unlinkSync18, writeFileSync as writeFileSync37 } from "fs";
|
|
21567
21642
|
|
|
21568
21643
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
21569
|
-
import { readFileSync as
|
|
21644
|
+
import { readFileSync as readFileSync42 } from "fs";
|
|
21570
21645
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
21571
21646
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
21572
21647
|
const timer = setInterval(() => {
|
|
@@ -21577,7 +21652,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
21577
21652
|
}
|
|
21578
21653
|
function ownsPidFile() {
|
|
21579
21654
|
try {
|
|
21580
|
-
return
|
|
21655
|
+
return readFileSync42(daemonPaths.pid, "utf8").trim() === String(process.pid);
|
|
21581
21656
|
} catch {
|
|
21582
21657
|
return false;
|
|
21583
21658
|
}
|
|
@@ -22134,7 +22209,7 @@ function syncCommands(claudeDir, targetBase) {
|
|
|
22134
22209
|
}
|
|
22135
22210
|
|
|
22136
22211
|
// src/commands/update.ts
|
|
22137
|
-
import { execSync as
|
|
22212
|
+
import { execSync as execSync51 } from "child_process";
|
|
22138
22213
|
import * as path56 from "path";
|
|
22139
22214
|
|
|
22140
22215
|
// src/commands/restartDaemonAfterUpdate.ts
|
|
@@ -22158,7 +22233,7 @@ function isGlobalNpmInstall(dir) {
|
|
|
22158
22233
|
if (resolved.split(path56.sep).includes("node_modules")) {
|
|
22159
22234
|
return true;
|
|
22160
22235
|
}
|
|
22161
|
-
const globalPrefix =
|
|
22236
|
+
const globalPrefix = execSync51("npm prefix -g", { stdio: "pipe" }).toString().trim();
|
|
22162
22237
|
return resolved.toLowerCase().startsWith(path56.resolve(globalPrefix).toLowerCase());
|
|
22163
22238
|
} catch {
|
|
22164
22239
|
return false;
|
|
@@ -22169,18 +22244,18 @@ async function update2() {
|
|
|
22169
22244
|
console.log(`Assist is installed at: ${installDir}`);
|
|
22170
22245
|
if (isGitRepo(installDir)) {
|
|
22171
22246
|
console.log("Detected git repo installation, pulling latest...");
|
|
22172
|
-
|
|
22247
|
+
execSync51("git pull", { cwd: installDir, stdio: "inherit" });
|
|
22173
22248
|
console.log("Installing dependencies...");
|
|
22174
|
-
|
|
22249
|
+
execSync51("npm i", { cwd: installDir, stdio: "inherit" });
|
|
22175
22250
|
console.log("Building...");
|
|
22176
|
-
|
|
22251
|
+
execSync51("npm run build", { cwd: installDir, stdio: "inherit" });
|
|
22177
22252
|
console.log("Syncing commands...");
|
|
22178
|
-
|
|
22253
|
+
execSync51("assist sync", { stdio: "inherit" });
|
|
22179
22254
|
} else if (isGlobalNpmInstall(installDir)) {
|
|
22180
22255
|
console.log("Detected global npm installation, updating...");
|
|
22181
|
-
|
|
22256
|
+
execSync51("npm i -g @staff0rd/assist@latest", { stdio: "inherit" });
|
|
22182
22257
|
console.log("Syncing commands...");
|
|
22183
|
-
|
|
22258
|
+
execSync51("assist sync", { stdio: "inherit" });
|
|
22184
22259
|
} else {
|
|
22185
22260
|
console.error(
|
|
22186
22261
|
"Could not determine installation method. Expected a git repo or global npm install."
|