@staff0rd/assist 0.384.3 → 0.385.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 +4 -1
- package/claude/commands/design.md +24 -0
- package/claude/skills/accessibility-audit.md +51 -0
- package/claude/skills/ai-slop-check.md +71 -0
- package/claude/skills/component-extract.md +52 -0
- package/claude/skills/design-system-extract.md +75 -0
- package/claude/skills/discovery-questions.md +60 -0
- package/claude/skills/frontend-aesthetic-direction.md +76 -0
- package/claude/skills/generate-variations.md +40 -0
- package/claude/skills/hierarchy-rhythm-review.md +50 -0
- package/claude/skills/interaction-states-pass.md +38 -0
- package/claude/skills/make-a-deck.md +43 -0
- package/claude/skills/make-a-prototype.md +56 -0
- package/claude/skills/make-tweakable.md +66 -0
- package/claude/skills/polish-pass.md +43 -0
- package/claude/skills/wireframe.md +48 -0
- package/claude/system-prompt.md +661 -0
- package/dist/commands/sessions/web/bundle.js +65 -65
- package/dist/index.js +466 -336
- 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.385.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -115,7 +115,7 @@ var package_default = {
|
|
|
115
115
|
};
|
|
116
116
|
|
|
117
117
|
// src/commands/commit.ts
|
|
118
|
-
import { execSync as
|
|
118
|
+
import { execSync as execSync6 } from "child_process";
|
|
119
119
|
|
|
120
120
|
// src/shared/resolveSessionItemId.ts
|
|
121
121
|
var ITEM_ID_ENV = "ASSIST_BACKLOG_ITEM_ID";
|
|
@@ -140,10 +140,10 @@ import { stringify as stringifyYaml } from "yaml";
|
|
|
140
140
|
// src/shared/loadRawYaml.ts
|
|
141
141
|
import { existsSync, readFileSync } from "fs";
|
|
142
142
|
import { parse as parseYaml } from "yaml";
|
|
143
|
-
function loadRawYaml(
|
|
144
|
-
if (!existsSync(
|
|
143
|
+
function loadRawYaml(path60) {
|
|
144
|
+
if (!existsSync(path60)) return {};
|
|
145
145
|
try {
|
|
146
|
-
const content = readFileSync(
|
|
146
|
+
const content = readFileSync(path60, "utf8");
|
|
147
147
|
return parseYaml(content) || {};
|
|
148
148
|
} catch {
|
|
149
149
|
return {};
|
|
@@ -1090,17 +1090,6 @@ async function persist(itemId2, refs) {
|
|
|
1090
1090
|
function ignore() {
|
|
1091
1091
|
}
|
|
1092
1092
|
|
|
1093
|
-
// src/shared/shellQuote.ts
|
|
1094
|
-
function shellQuote(arg) {
|
|
1095
|
-
if (/[^a-zA-Z0-9_./:=@%^+,-]/.test(arg)) {
|
|
1096
|
-
if (process.platform === "win32") {
|
|
1097
|
-
return `"${arg.replace(/"/g, String.raw`\"`)}"`;
|
|
1098
|
-
}
|
|
1099
|
-
return `'${arg.replace(/'/g, String.raw`'\''`)}'`;
|
|
1100
|
-
}
|
|
1101
|
-
return arg;
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
1093
|
// src/shared/warnIfUnexpectedBranch.ts
|
|
1105
1094
|
import { execSync } from "child_process";
|
|
1106
1095
|
import chalk3 from "chalk";
|
|
@@ -1133,11 +1122,98 @@ function currentBranch() {
|
|
|
1133
1122
|
}
|
|
1134
1123
|
}
|
|
1135
1124
|
|
|
1125
|
+
// src/commands/commit/findConflictMarkers.ts
|
|
1126
|
+
import { execSync as execSync2 } from "child_process";
|
|
1127
|
+
|
|
1128
|
+
// src/shared/shellQuote.ts
|
|
1129
|
+
function shellQuote(arg) {
|
|
1130
|
+
if (/[^a-zA-Z0-9_./:=@%^+,-]/.test(arg)) {
|
|
1131
|
+
if (process.platform === "win32") {
|
|
1132
|
+
return `"${arg.replace(/"/g, String.raw`\"`)}"`;
|
|
1133
|
+
}
|
|
1134
|
+
return `'${arg.replace(/'/g, String.raw`'\''`)}'`;
|
|
1135
|
+
}
|
|
1136
|
+
return arg;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
// src/commands/commit/findConflictMarkers.ts
|
|
1140
|
+
function gitCheckOutput(cmd) {
|
|
1141
|
+
try {
|
|
1142
|
+
return execSync2(cmd, { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] });
|
|
1143
|
+
} catch (error) {
|
|
1144
|
+
const stdout = error.stdout;
|
|
1145
|
+
if (typeof stdout === "string") return stdout;
|
|
1146
|
+
return stdout?.toString() ?? "";
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
function checkCommands(files) {
|
|
1150
|
+
if (files.length === 0) return ["git diff --cached --check"];
|
|
1151
|
+
const scope = files.map(shellQuote).join(" ");
|
|
1152
|
+
return [
|
|
1153
|
+
`git diff --check -- ${scope}`,
|
|
1154
|
+
`git diff --cached --check -- ${scope}`
|
|
1155
|
+
];
|
|
1156
|
+
}
|
|
1157
|
+
function findConflictMarkers(files) {
|
|
1158
|
+
const found = /* @__PURE__ */ new Set();
|
|
1159
|
+
for (const cmd of checkCommands(files)) {
|
|
1160
|
+
for (const line of gitCheckOutput(cmd).split("\n")) {
|
|
1161
|
+
if (!line.includes("leftover conflict marker")) continue;
|
|
1162
|
+
const file = line.slice(0, line.indexOf(":"));
|
|
1163
|
+
if (file) found.add(file);
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
return [...found];
|
|
1167
|
+
}
|
|
1168
|
+
function findUnmergedPaths() {
|
|
1169
|
+
let output;
|
|
1170
|
+
try {
|
|
1171
|
+
output = execSync2("git ls-files -u", {
|
|
1172
|
+
encoding: "utf8",
|
|
1173
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
1174
|
+
});
|
|
1175
|
+
} catch {
|
|
1176
|
+
return [];
|
|
1177
|
+
}
|
|
1178
|
+
const found = /* @__PURE__ */ new Set();
|
|
1179
|
+
for (const line of output.split("\n")) {
|
|
1180
|
+
const path60 = line.split(" ")[1];
|
|
1181
|
+
if (path60) found.add(path60.trim());
|
|
1182
|
+
}
|
|
1183
|
+
return [...found];
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
// src/commands/commit/abortOnConflicts.ts
|
|
1187
|
+
function abort(headline, guidance) {
|
|
1188
|
+
console.error(`Error: refusing to commit \u2014 ${headline}`);
|
|
1189
|
+
console.error(guidance);
|
|
1190
|
+
console.error("Nothing was committed or pushed.");
|
|
1191
|
+
process.exit(1);
|
|
1192
|
+
}
|
|
1193
|
+
function abortOnConflicts(files, pulled) {
|
|
1194
|
+
if (pulled) {
|
|
1195
|
+
const unmerged = findUnmergedPaths();
|
|
1196
|
+
if (unmerged.length > 0) {
|
|
1197
|
+
abort(
|
|
1198
|
+
`git pull --autostash left unresolved conflicts in: ${unmerged.join(", ")}`,
|
|
1199
|
+
"Your local changes are safe in the stash. Resolve the autostash conflict manually (edit the files, then `git stash drop`, or run `git stash pop`), then re-run the commit."
|
|
1200
|
+
);
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
const conflicted = findConflictMarkers(files);
|
|
1204
|
+
if (conflicted.length > 0) {
|
|
1205
|
+
abort(
|
|
1206
|
+
`merge-conflict markers found in: ${conflicted.join(", ")}`,
|
|
1207
|
+
"Resolve the conflict markers, then re-run the commit."
|
|
1208
|
+
);
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1136
1212
|
// src/commands/commit/collectCommitRefs.ts
|
|
1137
|
-
import { execSync as
|
|
1213
|
+
import { execSync as execSync4 } from "child_process";
|
|
1138
1214
|
|
|
1139
1215
|
// src/commands/prs/getPreferredRemoteRepo.ts
|
|
1140
|
-
import { execSync as
|
|
1216
|
+
import { execSync as execSync3 } from "child_process";
|
|
1141
1217
|
var GITHUB_URL_PATTERN = /(?:git@github\.com:|https:\/\/github\.com\/)([^/]+)\/([^/]+?)(?:\.git)?\/?$/;
|
|
1142
1218
|
function parseGitHubUrl(url) {
|
|
1143
1219
|
const match = url.match(GITHUB_URL_PATTERN);
|
|
@@ -1146,7 +1222,7 @@ function parseGitHubUrl(url) {
|
|
|
1146
1222
|
}
|
|
1147
1223
|
function tryGetRemoteUrl(remote, cwd) {
|
|
1148
1224
|
try {
|
|
1149
|
-
return
|
|
1225
|
+
return execSync3(`git remote get-url ${remote}`, {
|
|
1150
1226
|
encoding: "utf8",
|
|
1151
1227
|
stdio: ["pipe", "pipe", "pipe"],
|
|
1152
1228
|
cwd
|
|
@@ -1157,7 +1233,7 @@ function tryGetRemoteUrl(remote, cwd) {
|
|
|
1157
1233
|
}
|
|
1158
1234
|
function getCurrentBranchRemote(cwd) {
|
|
1159
1235
|
try {
|
|
1160
|
-
const ref =
|
|
1236
|
+
const ref = execSync3(
|
|
1161
1237
|
"git rev-parse --abbrev-ref --symbolic-full-name @{u}",
|
|
1162
1238
|
{ encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], cwd }
|
|
1163
1239
|
).trim();
|
|
@@ -1169,7 +1245,7 @@ function getCurrentBranchRemote(cwd) {
|
|
|
1169
1245
|
}
|
|
1170
1246
|
function listRemotes(cwd) {
|
|
1171
1247
|
try {
|
|
1172
|
-
return
|
|
1248
|
+
return execSync3("git remote", {
|
|
1173
1249
|
encoding: "utf8",
|
|
1174
1250
|
stdio: ["pipe", "pipe", "pipe"],
|
|
1175
1251
|
cwd
|
|
@@ -1201,8 +1277,8 @@ function getPreferredRemoteRepo(cwd) {
|
|
|
1201
1277
|
function gitRefUrl(kind, ref, cwd) {
|
|
1202
1278
|
const repo = getPreferredRemoteRepo(cwd);
|
|
1203
1279
|
if (!repo) return void 0;
|
|
1204
|
-
const
|
|
1205
|
-
return `https://github.com/${repo.org}/${repo.repo}/${
|
|
1280
|
+
const path60 = kind === "branch" ? "tree" : "commit";
|
|
1281
|
+
return `https://github.com/${repo.org}/${repo.repo}/${path60}/${ref}`;
|
|
1206
1282
|
}
|
|
1207
1283
|
|
|
1208
1284
|
// src/commands/commit/collectCommitRefs.ts
|
|
@@ -1231,7 +1307,7 @@ function collectCommitRefs(message) {
|
|
|
1231
1307
|
}
|
|
1232
1308
|
function git(args) {
|
|
1233
1309
|
try {
|
|
1234
|
-
return
|
|
1310
|
+
return execSync4(`git ${args}`, {
|
|
1235
1311
|
encoding: "utf8",
|
|
1236
1312
|
stdio: ["pipe", "pipe", "pipe"]
|
|
1237
1313
|
}).trim();
|
|
@@ -1240,6 +1316,20 @@ function git(args) {
|
|
|
1240
1316
|
}
|
|
1241
1317
|
}
|
|
1242
1318
|
|
|
1319
|
+
// src/commands/commit/stageAndCommit.ts
|
|
1320
|
+
import { execSync as execSync5 } from "child_process";
|
|
1321
|
+
function commitStaged(message) {
|
|
1322
|
+
execSync5(`git commit -m ${shellQuote(message)}`, { stdio: "inherit" });
|
|
1323
|
+
return execSync5("git rev-parse --short=7 HEAD", {
|
|
1324
|
+
encoding: "utf8"
|
|
1325
|
+
}).trim();
|
|
1326
|
+
}
|
|
1327
|
+
function stageAndCommit(files, message) {
|
|
1328
|
+
const escaped = files.map(shellQuote).join(" ");
|
|
1329
|
+
execSync5(`git add ${escaped}`, { stdio: "inherit" });
|
|
1330
|
+
return commitStaged(message);
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1243
1333
|
// src/commands/commit/validateMessage.ts
|
|
1244
1334
|
var MAX_MESSAGE_LENGTH = 50;
|
|
1245
1335
|
var CONVENTIONAL_COMMIT_REGEX = /^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(!)?(\(.+\))?!?: .+$/;
|
|
@@ -1263,27 +1353,18 @@ function validateMessage(message, config) {
|
|
|
1263
1353
|
}
|
|
1264
1354
|
|
|
1265
1355
|
// src/commands/commit.ts
|
|
1266
|
-
function commitStaged(message) {
|
|
1267
|
-
execSync4(`git commit -m ${shellQuote(message)}`, { stdio: "inherit" });
|
|
1268
|
-
return execSync4("git rev-parse --short=7 HEAD", {
|
|
1269
|
-
encoding: "utf8"
|
|
1270
|
-
}).trim();
|
|
1271
|
-
}
|
|
1272
|
-
function stageAndCommit(files, message) {
|
|
1273
|
-
const escaped = files.map(shellQuote).join(" ");
|
|
1274
|
-
execSync4(`git add ${escaped}`, { stdio: "inherit" });
|
|
1275
|
-
return commitStaged(message);
|
|
1276
|
-
}
|
|
1277
1356
|
async function execCommit(files, message, config) {
|
|
1278
1357
|
try {
|
|
1279
1358
|
warnIfUnexpectedBranch(config);
|
|
1280
|
-
|
|
1281
|
-
|
|
1359
|
+
const pulled = Boolean(config.commit?.pull);
|
|
1360
|
+
if (pulled) {
|
|
1361
|
+
execSync6("git pull --autostash", { stdio: "inherit" });
|
|
1282
1362
|
}
|
|
1363
|
+
abortOnConflicts(files, pulled);
|
|
1283
1364
|
const sha = files.length > 0 ? stageAndCommit(files, message) : commitStaged(message);
|
|
1284
1365
|
console.log(`Committed: ${sha}`);
|
|
1285
1366
|
if (config.commit?.push) {
|
|
1286
|
-
|
|
1367
|
+
execSync6("git push", { stdio: "inherit" });
|
|
1287
1368
|
console.log("Pushed to remote");
|
|
1288
1369
|
}
|
|
1289
1370
|
await recordCommitActivity(message);
|
|
@@ -1298,7 +1379,7 @@ async function recordCommitActivity(message) {
|
|
|
1298
1379
|
}
|
|
1299
1380
|
async function commit(args) {
|
|
1300
1381
|
if (args[0] === "status") {
|
|
1301
|
-
|
|
1382
|
+
execSync6("git status && echo '---DIFF---' && git diff", {
|
|
1302
1383
|
stdio: "inherit"
|
|
1303
1384
|
});
|
|
1304
1385
|
return;
|
|
@@ -1315,9 +1396,9 @@ async function commit(args) {
|
|
|
1315
1396
|
}
|
|
1316
1397
|
|
|
1317
1398
|
// src/commands/coverage.ts
|
|
1318
|
-
import { execSync as
|
|
1399
|
+
import { execSync as execSync7 } from "child_process";
|
|
1319
1400
|
function coverage() {
|
|
1320
|
-
const output =
|
|
1401
|
+
const output = execSync7(
|
|
1321
1402
|
"npx vitest run --coverage --coverage.include='src/**/*.ts' --coverage.all --coverage.reporter=text 2>&1",
|
|
1322
1403
|
{ encoding: "utf8", timeout: 12e4 }
|
|
1323
1404
|
);
|
|
@@ -1417,7 +1498,7 @@ function findPackageJsonWithVerifyScripts(startDir) {
|
|
|
1417
1498
|
}
|
|
1418
1499
|
|
|
1419
1500
|
// src/commands/verify/installPackage.ts
|
|
1420
|
-
import { execSync as
|
|
1501
|
+
import { execSync as execSync8 } from "child_process";
|
|
1421
1502
|
import { writeFileSync as writeFileSync2 } from "fs";
|
|
1422
1503
|
import chalk6 from "chalk";
|
|
1423
1504
|
function writePackageJson(filePath, pkg) {
|
|
@@ -1436,7 +1517,7 @@ function addScript(pkg, name, command) {
|
|
|
1436
1517
|
function installPackage(name, cwd) {
|
|
1437
1518
|
console.log(chalk6.dim(`Installing ${name}...`));
|
|
1438
1519
|
try {
|
|
1439
|
-
|
|
1520
|
+
execSync8(`npm install -D ${name}`, { stdio: "inherit", cwd });
|
|
1440
1521
|
return true;
|
|
1441
1522
|
} catch {
|
|
1442
1523
|
console.error(chalk6.red(`Failed to install ${name}`));
|
|
@@ -1680,7 +1761,7 @@ import { existsSync as existsSync8, readFileSync as readFileSync6, writeFileSync
|
|
|
1680
1761
|
import chalk14 from "chalk";
|
|
1681
1762
|
|
|
1682
1763
|
// src/shared/removeEslint/index.ts
|
|
1683
|
-
import { execSync as
|
|
1764
|
+
import { execSync as execSync9 } from "child_process";
|
|
1684
1765
|
import { existsSync as existsSync7, readFileSync as readFileSync5, writeFileSync as writeFileSync5 } from "fs";
|
|
1685
1766
|
|
|
1686
1767
|
// src/shared/removeEslint/removeEslintConfigFiles.ts
|
|
@@ -1715,7 +1796,7 @@ function removeEslint(options2 = {}) {
|
|
|
1715
1796
|
const removedConfigFiles = removeEslintConfigFiles();
|
|
1716
1797
|
if (removedFromPackageJson || removedConfigFiles) {
|
|
1717
1798
|
console.log("Running npm install...");
|
|
1718
|
-
|
|
1799
|
+
execSync9("npm install", { stdio: "inherit" });
|
|
1719
1800
|
return true;
|
|
1720
1801
|
}
|
|
1721
1802
|
return false;
|
|
@@ -2563,11 +2644,11 @@ function lint(options2 = {}) {
|
|
|
2563
2644
|
}
|
|
2564
2645
|
|
|
2565
2646
|
// src/commands/new/registerNew/newCli/index.ts
|
|
2566
|
-
import { execSync as
|
|
2647
|
+
import { execSync as execSync16 } from "child_process";
|
|
2567
2648
|
import { basename, resolve as resolve5 } from "path";
|
|
2568
2649
|
|
|
2569
2650
|
// src/commands/verify/blockComments/findComments.ts
|
|
2570
|
-
import { execSync as
|
|
2651
|
+
import { execSync as execSync10 } from "child_process";
|
|
2571
2652
|
import fs14 from "fs";
|
|
2572
2653
|
import { minimatch } from "minimatch";
|
|
2573
2654
|
import { Project as Project2 } from "ts-morph";
|
|
@@ -2793,7 +2874,7 @@ function shouldScan(file, ignoreGlobs) {
|
|
|
2793
2874
|
return fs14.existsSync(file);
|
|
2794
2875
|
}
|
|
2795
2876
|
function findComments(options2) {
|
|
2796
|
-
const diff2 =
|
|
2877
|
+
const diff2 = execSync10("git diff HEAD", {
|
|
2797
2878
|
encoding: "utf8",
|
|
2798
2879
|
maxBuffer: 64 * 1024 * 1024
|
|
2799
2880
|
});
|
|
@@ -2934,9 +3015,9 @@ import { existsSync as existsSync12, readFileSync as readFileSync9 } from "fs";
|
|
|
2934
3015
|
|
|
2935
3016
|
// src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
|
|
2936
3017
|
import { minimatch as minimatch2 } from "minimatch";
|
|
2937
|
-
function resolveStringsAtPath(data,
|
|
3018
|
+
function resolveStringsAtPath(data, path60) {
|
|
2938
3019
|
let current = data;
|
|
2939
|
-
for (const segment of
|
|
3020
|
+
for (const segment of path60.split(".")) {
|
|
2940
3021
|
if (current === null || typeof current !== "object") return [];
|
|
2941
3022
|
current = current[segment];
|
|
2942
3023
|
}
|
|
@@ -2949,10 +3030,10 @@ function resolveStringsAtPath(data, path58) {
|
|
|
2949
3030
|
}
|
|
2950
3031
|
function findRuleViolations(data, rule) {
|
|
2951
3032
|
const violations = [];
|
|
2952
|
-
for (const
|
|
2953
|
-
for (const value of resolveStringsAtPath(data,
|
|
3033
|
+
for (const path60 of rule.paths) {
|
|
3034
|
+
for (const value of resolveStringsAtPath(data, path60)) {
|
|
2954
3035
|
if (minimatch2(value, rule.disallowed))
|
|
2955
|
-
violations.push({ file: rule.file, path:
|
|
3036
|
+
violations.push({ file: rule.file, path: path60, value });
|
|
2956
3037
|
}
|
|
2957
3038
|
}
|
|
2958
3039
|
return violations;
|
|
@@ -2991,8 +3072,8 @@ function forbiddenStrings() {
|
|
|
2991
3072
|
process.exit(0);
|
|
2992
3073
|
}
|
|
2993
3074
|
console.log("Forbidden strings found:\n");
|
|
2994
|
-
for (const { file, path:
|
|
2995
|
-
console.log(` ${file} ${
|
|
3075
|
+
for (const { file, path: path60, value } of violations) {
|
|
3076
|
+
console.log(` ${file} ${path60}: ${value}`);
|
|
2996
3077
|
}
|
|
2997
3078
|
console.log(`
|
|
2998
3079
|
Total: ${violations.length} forbidden string(s).`);
|
|
@@ -3003,13 +3084,13 @@ Total: ${violations.length} forbidden string(s).`);
|
|
|
3003
3084
|
}
|
|
3004
3085
|
|
|
3005
3086
|
// src/commands/verify/hardcodedColors.ts
|
|
3006
|
-
import { execSync as
|
|
3087
|
+
import { execSync as execSync11 } from "child_process";
|
|
3007
3088
|
import { minimatch as minimatch3 } from "minimatch";
|
|
3008
3089
|
var pattern = "0x[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,6}";
|
|
3009
3090
|
function hardcodedColors() {
|
|
3010
3091
|
const ignoreGlobs = loadConfig().hardcodedColors?.ignore ?? [];
|
|
3011
3092
|
try {
|
|
3012
|
-
const output =
|
|
3093
|
+
const output = execSync11(`grep -rEnH '${pattern}' src/`, {
|
|
3013
3094
|
encoding: "utf8"
|
|
3014
3095
|
});
|
|
3015
3096
|
const lines = output.trim().split("\n").filter((line) => {
|
|
@@ -3190,10 +3271,10 @@ function list() {
|
|
|
3190
3271
|
}
|
|
3191
3272
|
|
|
3192
3273
|
// src/commands/verify/noVenv.ts
|
|
3193
|
-
import { execSync as
|
|
3274
|
+
import { execSync as execSync12 } from "child_process";
|
|
3194
3275
|
function noVenv() {
|
|
3195
3276
|
try {
|
|
3196
|
-
const output =
|
|
3277
|
+
const output = execSync12(
|
|
3197
3278
|
"find . -type d -name venv -not -path '*/node_modules/*'",
|
|
3198
3279
|
{
|
|
3199
3280
|
encoding: "utf8"
|
|
@@ -3225,9 +3306,9 @@ Total: ${folders.length} venv folder(s)`);
|
|
|
3225
3306
|
import { minimatch as minimatch4 } from "minimatch";
|
|
3226
3307
|
|
|
3227
3308
|
// src/commands/verify/run/getChangedFiles.ts
|
|
3228
|
-
import { execSync as
|
|
3309
|
+
import { execSync as execSync13 } from "child_process";
|
|
3229
3310
|
function getChangedFiles() {
|
|
3230
|
-
const output =
|
|
3311
|
+
const output = execSync13("git diff --name-only HEAD", {
|
|
3231
3312
|
encoding: "utf8"
|
|
3232
3313
|
}).trim();
|
|
3233
3314
|
if (output === "") return [];
|
|
@@ -3399,25 +3480,25 @@ async function run(options2 = {}) {
|
|
|
3399
3480
|
}
|
|
3400
3481
|
|
|
3401
3482
|
// src/commands/new/registerNew/initGit.ts
|
|
3402
|
-
import { execSync as
|
|
3483
|
+
import { execSync as execSync14 } from "child_process";
|
|
3403
3484
|
import { writeFileSync as writeFileSync10 } from "fs";
|
|
3404
3485
|
function initGit() {
|
|
3405
3486
|
console.log("Initializing git repository...");
|
|
3406
|
-
|
|
3487
|
+
execSync14("git init", { stdio: "inherit" });
|
|
3407
3488
|
writeFileSync10(".gitignore", "dist\nnode_modules\n");
|
|
3408
3489
|
}
|
|
3409
3490
|
|
|
3410
3491
|
// src/commands/new/registerNew/newCli/initPackageJson.ts
|
|
3411
|
-
import { execSync as
|
|
3492
|
+
import { execSync as execSync15 } from "child_process";
|
|
3412
3493
|
function initPackageJson(name) {
|
|
3413
3494
|
console.log("Initializing package.json...");
|
|
3414
|
-
|
|
3495
|
+
execSync15("npm init -y", { stdio: "inherit" });
|
|
3415
3496
|
console.log("Configuring package.json...");
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3497
|
+
execSync15("npm pkg delete main", { stdio: "inherit" });
|
|
3498
|
+
execSync15("npm pkg set type=module", { stdio: "inherit" });
|
|
3499
|
+
execSync15(`npm pkg set bin.${name}=./dist/index.js`, { stdio: "inherit" });
|
|
3500
|
+
execSync15("npm pkg set scripts.build=tsup", { stdio: "inherit" });
|
|
3501
|
+
execSync15('npm pkg set scripts.start="node dist/index.js"', {
|
|
3421
3502
|
stdio: "inherit"
|
|
3422
3503
|
});
|
|
3423
3504
|
}
|
|
@@ -3482,8 +3563,8 @@ async function newCli() {
|
|
|
3482
3563
|
initGit();
|
|
3483
3564
|
initPackageJson(name);
|
|
3484
3565
|
console.log("Installing dependencies...");
|
|
3485
|
-
|
|
3486
|
-
|
|
3566
|
+
execSync16("npm install commander", { stdio: "inherit" });
|
|
3567
|
+
execSync16("npm install -D tsup typescript @types/node", {
|
|
3487
3568
|
stdio: "inherit"
|
|
3488
3569
|
});
|
|
3489
3570
|
writeCliTemplate(name);
|
|
@@ -3492,11 +3573,11 @@ async function newCli() {
|
|
|
3492
3573
|
}
|
|
3493
3574
|
|
|
3494
3575
|
// src/commands/new/registerNew/newProject.ts
|
|
3495
|
-
import { execSync as
|
|
3576
|
+
import { execSync as execSync18 } from "child_process";
|
|
3496
3577
|
import { existsSync as existsSync15, readFileSync as readFileSync11, writeFileSync as writeFileSync13 } from "fs";
|
|
3497
3578
|
|
|
3498
3579
|
// src/commands/deploy/init/index.ts
|
|
3499
|
-
import { execSync as
|
|
3580
|
+
import { execSync as execSync17 } from "child_process";
|
|
3500
3581
|
import chalk28 from "chalk";
|
|
3501
3582
|
import enquirer3 from "enquirer";
|
|
3502
3583
|
|
|
@@ -3549,7 +3630,7 @@ Created ${WORKFLOW_PATH}`));
|
|
|
3549
3630
|
// src/commands/deploy/init/index.ts
|
|
3550
3631
|
async function ensureNetlifyCli() {
|
|
3551
3632
|
try {
|
|
3552
|
-
|
|
3633
|
+
execSync17("netlify sites:create --disable-linking", { stdio: "inherit" });
|
|
3553
3634
|
} catch (error) {
|
|
3554
3635
|
if (!(error instanceof Error) || !error.message.includes("command not found"))
|
|
3555
3636
|
throw error;
|
|
@@ -3564,9 +3645,9 @@ async function ensureNetlifyCli() {
|
|
|
3564
3645
|
process.exit(1);
|
|
3565
3646
|
}
|
|
3566
3647
|
console.log(chalk28.dim("\nInstalling netlify-cli...\n"));
|
|
3567
|
-
|
|
3648
|
+
execSync17("npm install -g netlify-cli", { stdio: "inherit" });
|
|
3568
3649
|
console.log();
|
|
3569
|
-
|
|
3650
|
+
execSync17("netlify sites:create --disable-linking", { stdio: "inherit" });
|
|
3570
3651
|
}
|
|
3571
3652
|
}
|
|
3572
3653
|
function printSetupInstructions() {
|
|
@@ -3609,7 +3690,7 @@ async function init6() {
|
|
|
3609
3690
|
// src/commands/new/registerNew/newProject.ts
|
|
3610
3691
|
async function newProject() {
|
|
3611
3692
|
console.log("Initializing Vite with react-ts template...");
|
|
3612
|
-
|
|
3693
|
+
execSync18("npm create vite@latest . -- --template react-ts", {
|
|
3613
3694
|
stdio: "inherit"
|
|
3614
3695
|
});
|
|
3615
3696
|
initGit();
|
|
@@ -3800,11 +3881,11 @@ function activityChart(data, range) {
|
|
|
3800
3881
|
}
|
|
3801
3882
|
|
|
3802
3883
|
// src/commands/activity/fetchCommitsPerDay.ts
|
|
3803
|
-
import { execSync as
|
|
3884
|
+
import { execSync as execSync19 } from "child_process";
|
|
3804
3885
|
function fetchContributions(from, to) {
|
|
3805
3886
|
const query = `{ viewer { contributionsCollection(from: "${from}T00:00:00Z", to: "${to}T23:59:59Z") { contributionCalendar { weeks { contributionDays { date contributionCount } } } } } }`;
|
|
3806
3887
|
const jq = ".data.viewer.contributionsCollection.contributionCalendar.weeks[].contributionDays[]";
|
|
3807
|
-
const raw =
|
|
3888
|
+
const raw = execSync19(`gh api graphql -f query='${query}' --jq '${jq}'`, {
|
|
3808
3889
|
encoding: "utf8"
|
|
3809
3890
|
}).trim();
|
|
3810
3891
|
if (!raw) return [];
|
|
@@ -3891,10 +3972,10 @@ import { join as join10 } from "path";
|
|
|
3891
3972
|
import chalk29 from "chalk";
|
|
3892
3973
|
|
|
3893
3974
|
// src/commands/backup/readCrontab.ts
|
|
3894
|
-
import { execSync as
|
|
3975
|
+
import { execSync as execSync20 } from "child_process";
|
|
3895
3976
|
function readCrontab() {
|
|
3896
3977
|
try {
|
|
3897
|
-
return
|
|
3978
|
+
return execSync20("crontab -l", {
|
|
3898
3979
|
encoding: "utf8",
|
|
3899
3980
|
stdio: ["ignore", "pipe", "ignore"]
|
|
3900
3981
|
});
|
|
@@ -3904,7 +3985,7 @@ function readCrontab() {
|
|
|
3904
3985
|
}
|
|
3905
3986
|
function writeCrontab(content) {
|
|
3906
3987
|
try {
|
|
3907
|
-
|
|
3988
|
+
execSync20("crontab -", {
|
|
3908
3989
|
input: content,
|
|
3909
3990
|
stdio: ["pipe", "ignore", "pipe"]
|
|
3910
3991
|
});
|
|
@@ -4245,7 +4326,7 @@ import chalk45 from "chalk";
|
|
|
4245
4326
|
import enquirer5 from "enquirer";
|
|
4246
4327
|
|
|
4247
4328
|
// src/shared/pullIfConfigured.ts
|
|
4248
|
-
import { execSync as
|
|
4329
|
+
import { execSync as execSync21 } from "child_process";
|
|
4249
4330
|
import chalk32 from "chalk";
|
|
4250
4331
|
function pullIfConfigured() {
|
|
4251
4332
|
const config = loadConfig();
|
|
@@ -4259,7 +4340,7 @@ function pullIfConfigured() {
|
|
|
4259
4340
|
return;
|
|
4260
4341
|
}
|
|
4261
4342
|
try {
|
|
4262
|
-
|
|
4343
|
+
execSync21("git pull --ff-only", { stdio: "inherit" });
|
|
4263
4344
|
} catch {
|
|
4264
4345
|
console.error(chalk32.red("git pull --ff-only failed; aborting."));
|
|
4265
4346
|
process.exit(1);
|
|
@@ -4267,7 +4348,7 @@ function pullIfConfigured() {
|
|
|
4267
4348
|
}
|
|
4268
4349
|
function hasLocalChanges() {
|
|
4269
4350
|
try {
|
|
4270
|
-
const status2 =
|
|
4351
|
+
const status2 = execSync21("git status --porcelain", {
|
|
4271
4352
|
encoding: "utf8"
|
|
4272
4353
|
});
|
|
4273
4354
|
return status2.trim().length > 0;
|
|
@@ -4475,10 +4556,10 @@ var hooksSettings = {
|
|
|
4475
4556
|
}
|
|
4476
4557
|
};
|
|
4477
4558
|
function ensureHooksSettings() {
|
|
4478
|
-
const
|
|
4479
|
-
mkdirSync5(dirname12(
|
|
4480
|
-
writeFileSync15(
|
|
4481
|
-
return
|
|
4559
|
+
const path60 = daemonPaths.hooksSettings;
|
|
4560
|
+
mkdirSync5(dirname12(path60), { recursive: true });
|
|
4561
|
+
writeFileSync15(path60, JSON.stringify(hooksSettings, null, 2));
|
|
4562
|
+
return path60;
|
|
4482
4563
|
}
|
|
4483
4564
|
|
|
4484
4565
|
// src/shared/spawnClaude.ts
|
|
@@ -4570,7 +4651,7 @@ function consumePause(itemId2) {
|
|
|
4570
4651
|
}
|
|
4571
4652
|
|
|
4572
4653
|
// src/commands/branch/createBranch.ts
|
|
4573
|
-
import { execSync as
|
|
4654
|
+
import { execSync as execSync23 } from "child_process";
|
|
4574
4655
|
|
|
4575
4656
|
// src/commands/branch/buildBranchName.ts
|
|
4576
4657
|
function buildBranchName({
|
|
@@ -4586,12 +4667,12 @@ function buildBranchName({
|
|
|
4586
4667
|
}
|
|
4587
4668
|
|
|
4588
4669
|
// src/commands/branch/resolveDefaultBranch.ts
|
|
4589
|
-
import { execSync as
|
|
4670
|
+
import { execSync as execSync22 } from "child_process";
|
|
4590
4671
|
var REMOTE_HEAD_REGEX = /^ref:\s+refs\/heads\/(\S+)\s+HEAD$/m;
|
|
4591
4672
|
function resolveDefaultBranch(override, cwd) {
|
|
4592
4673
|
if (override) return override;
|
|
4593
4674
|
try {
|
|
4594
|
-
const output =
|
|
4675
|
+
const output = execSync22("git ls-remote --symref origin HEAD", {
|
|
4595
4676
|
encoding: "utf8",
|
|
4596
4677
|
stdio: ["pipe", "pipe", "pipe"],
|
|
4597
4678
|
cwd
|
|
@@ -4615,8 +4696,8 @@ async function createBranch({
|
|
|
4615
4696
|
slug
|
|
4616
4697
|
});
|
|
4617
4698
|
const defaultBranch = resolveDefaultBranch(config.branch?.defaultBranch);
|
|
4618
|
-
|
|
4619
|
-
|
|
4699
|
+
execSync23("git fetch", { stdio: "inherit" });
|
|
4700
|
+
execSync23(
|
|
4620
4701
|
`git switch -c ${shellQuote(branchName)} ${shellQuote(`origin/${defaultBranch}`)}`,
|
|
4621
4702
|
{ stdio: "inherit" }
|
|
4622
4703
|
);
|
|
@@ -4736,9 +4817,9 @@ var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
|
|
|
4736
4817
|
function backupLocalBacklogFiles(dir) {
|
|
4737
4818
|
const moved = [];
|
|
4738
4819
|
for (const name of LOCAL_FILES) {
|
|
4739
|
-
const
|
|
4740
|
-
if (existsSync18(
|
|
4741
|
-
renameSync(
|
|
4820
|
+
const path60 = join15(dir, ".assist", name);
|
|
4821
|
+
if (existsSync18(path60)) {
|
|
4822
|
+
renameSync(path60, `${path60}.bak`);
|
|
4742
4823
|
moved.push(`${name} \u2192 ${name}.bak`);
|
|
4743
4824
|
}
|
|
4744
4825
|
}
|
|
@@ -4746,11 +4827,11 @@ function backupLocalBacklogFiles(dir) {
|
|
|
4746
4827
|
}
|
|
4747
4828
|
|
|
4748
4829
|
// src/commands/backlog/gitPullBacklog.ts
|
|
4749
|
-
import { execSync as
|
|
4830
|
+
import { execSync as execSync24 } from "child_process";
|
|
4750
4831
|
import chalk35 from "chalk";
|
|
4751
4832
|
function gitPullBacklog(dir) {
|
|
4752
4833
|
try {
|
|
4753
|
-
|
|
4834
|
+
execSync24("git pull --ff-only", {
|
|
4754
4835
|
cwd: dir,
|
|
4755
4836
|
stdio: ["pipe", "pipe", "pipe"]
|
|
4756
4837
|
});
|
|
@@ -5177,8 +5258,8 @@ var backlogItemSchema = z3.strictObject({
|
|
|
5177
5258
|
var backlogFileSchema = z3.array(backlogItemSchema);
|
|
5178
5259
|
|
|
5179
5260
|
// src/commands/backlog/parseBacklogJsonl.ts
|
|
5180
|
-
function parseBacklogJsonl(
|
|
5181
|
-
const content = readFileSync13(
|
|
5261
|
+
function parseBacklogJsonl(path60) {
|
|
5262
|
+
const content = readFileSync13(path60, "utf8").trim();
|
|
5182
5263
|
if (content.length === 0) return [];
|
|
5183
5264
|
return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
|
|
5184
5265
|
}
|
|
@@ -5260,8 +5341,8 @@ function findBacklogUp(startDir) {
|
|
|
5260
5341
|
|
|
5261
5342
|
// src/commands/backlog/getCurrentOrigin.ts
|
|
5262
5343
|
import { execFileSync } from "child_process";
|
|
5263
|
-
function stripLeadingSlashes(
|
|
5264
|
-
return
|
|
5344
|
+
function stripLeadingSlashes(path60) {
|
|
5345
|
+
return path60.replace(/^\/+/, "");
|
|
5265
5346
|
}
|
|
5266
5347
|
function normalizeOrigin(raw) {
|
|
5267
5348
|
const trimmed = raw.trim().replace(/\.git$/i, "").replace(/\/+$/, "");
|
|
@@ -5768,24 +5849,24 @@ function getOwnerPath(itemId2) {
|
|
|
5768
5849
|
function recordSignalOwner(itemId2) {
|
|
5769
5850
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
5770
5851
|
if (!sessionId) return;
|
|
5771
|
-
const
|
|
5772
|
-
mkdirSync7(dirname14(
|
|
5773
|
-
writeFileSync17(
|
|
5852
|
+
const path60 = getOwnerPath(itemId2);
|
|
5853
|
+
mkdirSync7(dirname14(path60), { recursive: true });
|
|
5854
|
+
writeFileSync17(path60, JSON.stringify({ sessionId }));
|
|
5774
5855
|
}
|
|
5775
5856
|
function readSignalOwner(itemId2) {
|
|
5776
|
-
const
|
|
5777
|
-
if (!existsSync21(
|
|
5857
|
+
const path60 = getOwnerPath(itemId2);
|
|
5858
|
+
if (!existsSync21(path60)) return void 0;
|
|
5778
5859
|
try {
|
|
5779
|
-
const parsed = JSON.parse(readFileSync14(
|
|
5860
|
+
const parsed = JSON.parse(readFileSync14(path60, "utf8"));
|
|
5780
5861
|
return parsed.sessionId;
|
|
5781
5862
|
} catch {
|
|
5782
5863
|
return void 0;
|
|
5783
5864
|
}
|
|
5784
5865
|
}
|
|
5785
5866
|
function clearSignalOwner(itemId2) {
|
|
5786
|
-
const
|
|
5867
|
+
const path60 = getOwnerPath(itemId2);
|
|
5787
5868
|
try {
|
|
5788
|
-
rmSync(
|
|
5869
|
+
rmSync(path60);
|
|
5789
5870
|
} catch {
|
|
5790
5871
|
}
|
|
5791
5872
|
}
|
|
@@ -5822,19 +5903,19 @@ function resolveSignalTarget(event, data) {
|
|
|
5822
5903
|
function writeSignal(event, data) {
|
|
5823
5904
|
const target = resolveSignalTarget(event, data);
|
|
5824
5905
|
if (!target) return;
|
|
5825
|
-
const
|
|
5826
|
-
if (!
|
|
5906
|
+
const path60 = getSignalPath(target);
|
|
5907
|
+
if (!path60) return;
|
|
5827
5908
|
const signal = { event, sessionId: target, ...data };
|
|
5828
|
-
mkdirSync8(dirname15(
|
|
5829
|
-
writeFileSync18(
|
|
5909
|
+
mkdirSync8(dirname15(path60), { recursive: true });
|
|
5910
|
+
writeFileSync18(path60, JSON.stringify(signal));
|
|
5830
5911
|
}
|
|
5831
5912
|
|
|
5832
5913
|
// src/commands/backlog/readSignal.ts
|
|
5833
5914
|
function readSignal() {
|
|
5834
|
-
const
|
|
5835
|
-
if (!
|
|
5915
|
+
const path60 = getSignalPath();
|
|
5916
|
+
if (!path60 || !existsSync22(path60)) return void 0;
|
|
5836
5917
|
try {
|
|
5837
|
-
return JSON.parse(readFileSync15(
|
|
5918
|
+
return JSON.parse(readFileSync15(path60, "utf8"));
|
|
5838
5919
|
} catch {
|
|
5839
5920
|
return void 0;
|
|
5840
5921
|
}
|
|
@@ -5929,13 +6010,13 @@ function activityPath(sessionId) {
|
|
|
5929
6010
|
function emitActivity(activity2) {
|
|
5930
6011
|
const sessionId = process.env.ASSIST_ACTIVITY_ID;
|
|
5931
6012
|
if (!sessionId) return;
|
|
5932
|
-
const
|
|
5933
|
-
mkdirSync9(dirname16(
|
|
5934
|
-
writeFileSync19(
|
|
6013
|
+
const path60 = activityPath(sessionId);
|
|
6014
|
+
mkdirSync9(dirname16(path60), { recursive: true });
|
|
6015
|
+
writeFileSync19(path60, JSON.stringify({ ...activity2, startedAt: Date.now() }));
|
|
5935
6016
|
}
|
|
5936
|
-
function readActivity(
|
|
6017
|
+
function readActivity(path60) {
|
|
5937
6018
|
try {
|
|
5938
|
-
return JSON.parse(readFileSync16(
|
|
6019
|
+
return JSON.parse(readFileSync16(path60, "utf8"));
|
|
5939
6020
|
} catch {
|
|
5940
6021
|
return void 0;
|
|
5941
6022
|
}
|
|
@@ -5945,9 +6026,9 @@ function reconcileActivity(sessionId, activity2) {
|
|
|
5945
6026
|
removeActivity(sessionId);
|
|
5946
6027
|
return;
|
|
5947
6028
|
}
|
|
5948
|
-
const
|
|
5949
|
-
mkdirSync9(dirname16(
|
|
5950
|
-
writeFileSync19(
|
|
6029
|
+
const path60 = activityPath(sessionId);
|
|
6030
|
+
mkdirSync9(dirname16(path60), { recursive: true });
|
|
6031
|
+
writeFileSync19(path60, JSON.stringify(activity2));
|
|
5951
6032
|
}
|
|
5952
6033
|
function removeActivity(sessionId) {
|
|
5953
6034
|
try {
|
|
@@ -6791,7 +6872,7 @@ import chalk61 from "chalk";
|
|
|
6791
6872
|
import { WebSocketServer } from "ws";
|
|
6792
6873
|
|
|
6793
6874
|
// src/shared/getInstallDir.ts
|
|
6794
|
-
import { execSync as
|
|
6875
|
+
import { execSync as execSync25 } from "child_process";
|
|
6795
6876
|
import { dirname as dirname18, resolve as resolve7 } from "path";
|
|
6796
6877
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
6797
6878
|
var __filename2 = fileURLToPath2(import.meta.url);
|
|
@@ -6801,7 +6882,7 @@ function getInstallDir() {
|
|
|
6801
6882
|
}
|
|
6802
6883
|
function isGitRepo(dir) {
|
|
6803
6884
|
try {
|
|
6804
|
-
const result =
|
|
6885
|
+
const result = execSync25("git rev-parse --show-toplevel", {
|
|
6805
6886
|
cwd: dir,
|
|
6806
6887
|
stdio: "pipe"
|
|
6807
6888
|
}).toString().trim();
|
|
@@ -6818,11 +6899,11 @@ import {
|
|
|
6818
6899
|
import chalk56 from "chalk";
|
|
6819
6900
|
|
|
6820
6901
|
// src/lib/openBrowser.ts
|
|
6821
|
-
import { execSync as
|
|
6902
|
+
import { execSync as execSync26 } from "child_process";
|
|
6822
6903
|
function tryExec(commands) {
|
|
6823
6904
|
for (const cmd of commands) {
|
|
6824
6905
|
try {
|
|
6825
|
-
|
|
6906
|
+
execSync26(cmd, { stdio: "ignore" });
|
|
6826
6907
|
return true;
|
|
6827
6908
|
} catch {
|
|
6828
6909
|
}
|
|
@@ -7171,8 +7252,8 @@ async function getBacklogExists(req, res) {
|
|
|
7171
7252
|
// src/commands/backlog/originDisplayName.ts
|
|
7172
7253
|
function originDisplayName(origin) {
|
|
7173
7254
|
if (origin.startsWith("local:")) {
|
|
7174
|
-
const
|
|
7175
|
-
const segments =
|
|
7255
|
+
const path60 = origin.slice("local:".length).replace(/\/+$/, "");
|
|
7256
|
+
const segments = path60.split("/").filter(Boolean);
|
|
7176
7257
|
return segments[segments.length - 1] ?? origin;
|
|
7177
7258
|
}
|
|
7178
7259
|
const firstSlash = origin.indexOf("/");
|
|
@@ -7563,7 +7644,7 @@ function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
|
7563
7644
|
const parent = dirname20(branchKeyPath);
|
|
7564
7645
|
const branchPrefix = basename4(branchKeyPath);
|
|
7565
7646
|
if (!existsSync25(parent)) return null;
|
|
7566
|
-
const synthesisFiles = readdirSync(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join23(parent, name, "synthesis.md")).filter((
|
|
7647
|
+
const synthesisFiles = readdirSync(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join23(parent, name, "synthesis.md")).filter((path60) => existsSync25(path60)).map((path60) => ({ path: path60, mtime: statSync2(path60).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
|
|
7567
7648
|
return synthesisFiles[0]?.path ?? null;
|
|
7568
7649
|
}
|
|
7569
7650
|
|
|
@@ -7612,12 +7693,12 @@ async function getReviewSynthesis(req, res) {
|
|
|
7612
7693
|
const cwd = getCwdParam(req, res);
|
|
7613
7694
|
if (!cwd) return;
|
|
7614
7695
|
try {
|
|
7615
|
-
const
|
|
7616
|
-
if (!
|
|
7696
|
+
const path60 = await resolveSynthesisPath(cwd);
|
|
7697
|
+
if (!path60) {
|
|
7617
7698
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
7618
7699
|
return;
|
|
7619
7700
|
}
|
|
7620
|
-
respondJson(res, 200, { synthesis: readFileSync18(
|
|
7701
|
+
respondJson(res, 200, { synthesis: readFileSync18(path60, "utf8") });
|
|
7621
7702
|
} catch {
|
|
7622
7703
|
respondJson(res, 404, { error: "No synthesis found" });
|
|
7623
7704
|
}
|
|
@@ -7695,10 +7776,10 @@ function getStorePath(filename) {
|
|
|
7695
7776
|
return join25(getStoreDir(), filename);
|
|
7696
7777
|
}
|
|
7697
7778
|
function loadJson(filename) {
|
|
7698
|
-
const
|
|
7699
|
-
if (existsSync26(
|
|
7779
|
+
const path60 = getStorePath(filename);
|
|
7780
|
+
if (existsSync26(path60)) {
|
|
7700
7781
|
try {
|
|
7701
|
-
return JSON.parse(readFileSync19(
|
|
7782
|
+
return JSON.parse(readFileSync19(path60, "utf8"));
|
|
7702
7783
|
} catch {
|
|
7703
7784
|
return {};
|
|
7704
7785
|
}
|
|
@@ -8604,12 +8685,12 @@ import chalk64 from "chalk";
|
|
|
8604
8685
|
import { eq as eq17 } from "drizzle-orm";
|
|
8605
8686
|
|
|
8606
8687
|
// src/commands/jira/fetchIssue.ts
|
|
8607
|
-
import { execSync as
|
|
8688
|
+
import { execSync as execSync27 } from "child_process";
|
|
8608
8689
|
import chalk63 from "chalk";
|
|
8609
8690
|
function fetchIssue(issueKey, fields) {
|
|
8610
8691
|
let result;
|
|
8611
8692
|
try {
|
|
8612
|
-
result =
|
|
8693
|
+
result = execSync27(
|
|
8613
8694
|
`acli jira workitem view ${issueKey} -f ${fields} --json`,
|
|
8614
8695
|
{ encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] }
|
|
8615
8696
|
);
|
|
@@ -10926,9 +11007,9 @@ var __dirname4 = dirname21(__filename3);
|
|
|
10926
11007
|
function packageRoot() {
|
|
10927
11008
|
return __dirname4;
|
|
10928
11009
|
}
|
|
10929
|
-
function readLines(
|
|
10930
|
-
if (!existsSync27(
|
|
10931
|
-
return readFileSync22(
|
|
11010
|
+
function readLines(path60) {
|
|
11011
|
+
if (!existsSync27(path60)) return [];
|
|
11012
|
+
return readFileSync22(path60, "utf8").split("\n").filter((line) => line.trim() !== "");
|
|
10932
11013
|
}
|
|
10933
11014
|
var cachedReads;
|
|
10934
11015
|
var cachedWrites;
|
|
@@ -11259,7 +11340,7 @@ import { homedir as homedir15 } from "os";
|
|
|
11259
11340
|
import { join as join29 } from "path";
|
|
11260
11341
|
|
|
11261
11342
|
// src/shared/checkCliAvailable.ts
|
|
11262
|
-
import { execSync as
|
|
11343
|
+
import { execSync as execSync28 } from "child_process";
|
|
11263
11344
|
function checkCliAvailable(cli) {
|
|
11264
11345
|
const binary = cli.split(/\s+/)[0];
|
|
11265
11346
|
const opts = {
|
|
@@ -11267,11 +11348,11 @@ function checkCliAvailable(cli) {
|
|
|
11267
11348
|
stdio: ["ignore", "pipe", "pipe"]
|
|
11268
11349
|
};
|
|
11269
11350
|
try {
|
|
11270
|
-
|
|
11351
|
+
execSync28(`command -v ${binary}`, opts);
|
|
11271
11352
|
return true;
|
|
11272
11353
|
} catch {
|
|
11273
11354
|
try {
|
|
11274
|
-
|
|
11355
|
+
execSync28(`where ${binary}`, opts);
|
|
11275
11356
|
return true;
|
|
11276
11357
|
} catch {
|
|
11277
11358
|
return false;
|
|
@@ -11393,14 +11474,14 @@ function showProgress(p, label2) {
|
|
|
11393
11474
|
const pct = Math.round(p.done / p.total * 100);
|
|
11394
11475
|
process.stderr.write(`\r\x1B[K[${pct}%] Scanning ${label2}...`);
|
|
11395
11476
|
}
|
|
11396
|
-
async function resolveCommand(cli,
|
|
11397
|
-
showProgress(p,
|
|
11398
|
-
const subHelp = await runHelp([cli, ...
|
|
11477
|
+
async function resolveCommand(cli, path60, description, depth, p) {
|
|
11478
|
+
showProgress(p, path60.join(" "));
|
|
11479
|
+
const subHelp = await runHelp([cli, ...path60]);
|
|
11399
11480
|
if (!subHelp || !hasSubcommands(subHelp)) {
|
|
11400
|
-
return [{ path:
|
|
11481
|
+
return [{ path: path60, description }];
|
|
11401
11482
|
}
|
|
11402
|
-
const children = await discoverAt(cli,
|
|
11403
|
-
return children.length > 0 ? children : [{ path:
|
|
11483
|
+
const children = await discoverAt(cli, path60, depth + 1, p);
|
|
11484
|
+
return children.length > 0 ? children : [{ path: path60, description }];
|
|
11404
11485
|
}
|
|
11405
11486
|
async function discoverAt(cli, parentPath, depth, p) {
|
|
11406
11487
|
if (depth > SAFETY_DEPTH) return [];
|
|
@@ -11548,9 +11629,9 @@ function logPath(cli) {
|
|
|
11548
11629
|
return join29(homedir15(), ".assist", `cli-discover-${safeName}.log`);
|
|
11549
11630
|
}
|
|
11550
11631
|
function readCache(cli) {
|
|
11551
|
-
const
|
|
11552
|
-
if (!existsSync29(
|
|
11553
|
-
return readFileSync24(
|
|
11632
|
+
const path60 = logPath(cli);
|
|
11633
|
+
if (!existsSync29(path60)) return void 0;
|
|
11634
|
+
return readFileSync24(path60, "utf8");
|
|
11554
11635
|
}
|
|
11555
11636
|
function writeCache(cli, output) {
|
|
11556
11637
|
const dir = join29(homedir15(), ".assist");
|
|
@@ -11722,9 +11803,9 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
11722
11803
|
}
|
|
11723
11804
|
const cutoff = Date.now() - STALE_AFTER_MS;
|
|
11724
11805
|
for (const entry of entries) {
|
|
11725
|
-
const
|
|
11806
|
+
const path60 = join31(dir, entry);
|
|
11726
11807
|
try {
|
|
11727
|
-
if (statSync3(
|
|
11808
|
+
if (statSync3(path60).mtimeMs < cutoff) unlinkSync7(path60);
|
|
11728
11809
|
} catch {
|
|
11729
11810
|
continue;
|
|
11730
11811
|
}
|
|
@@ -11734,10 +11815,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
|
|
|
11734
11815
|
// src/commands/codeComment/readPinState.ts
|
|
11735
11816
|
import { existsSync as existsSync30, readFileSync as readFileSync25 } from "fs";
|
|
11736
11817
|
function readPinState(pin) {
|
|
11737
|
-
const
|
|
11738
|
-
if (!existsSync30(
|
|
11818
|
+
const path60 = getPinStatePath(pin);
|
|
11819
|
+
if (!existsSync30(path60)) return void 0;
|
|
11739
11820
|
try {
|
|
11740
|
-
const state = JSON.parse(readFileSync25(
|
|
11821
|
+
const state = JSON.parse(readFileSync25(path60, "utf8"));
|
|
11741
11822
|
if (state.pin !== pin) return void 0;
|
|
11742
11823
|
return state;
|
|
11743
11824
|
} catch {
|
|
@@ -12503,8 +12584,8 @@ function stepIntoNested(container, key, nextKey) {
|
|
|
12503
12584
|
}
|
|
12504
12585
|
return ensureObject(container, resolved);
|
|
12505
12586
|
}
|
|
12506
|
-
function setNestedValue(obj,
|
|
12507
|
-
const keys =
|
|
12587
|
+
function setNestedValue(obj, path60, value) {
|
|
12588
|
+
const keys = path60.split(".");
|
|
12508
12589
|
const result = { ...obj };
|
|
12509
12590
|
let current = result;
|
|
12510
12591
|
for (let i = 0; i < keys.length - 1; i++) {
|
|
@@ -12584,9 +12665,9 @@ function isTraversable(value) {
|
|
|
12584
12665
|
function stepInto(current, key) {
|
|
12585
12666
|
return isTraversable(current) ? current[key] : void 0;
|
|
12586
12667
|
}
|
|
12587
|
-
function getNestedValue(obj,
|
|
12668
|
+
function getNestedValue(obj, path60) {
|
|
12588
12669
|
let current = obj;
|
|
12589
|
-
for (const key of
|
|
12670
|
+
for (const key of path60.split(".")) current = stepInto(current, key);
|
|
12590
12671
|
return current;
|
|
12591
12672
|
}
|
|
12592
12673
|
|
|
@@ -12672,7 +12753,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
12672
12753
|
}
|
|
12673
12754
|
|
|
12674
12755
|
// src/commands/devlog/shared.ts
|
|
12675
|
-
import { execSync as
|
|
12756
|
+
import { execSync as execSync29 } from "child_process";
|
|
12676
12757
|
import chalk123 from "chalk";
|
|
12677
12758
|
|
|
12678
12759
|
// src/shared/getRepoName.ts
|
|
@@ -12764,7 +12845,7 @@ function loadAllDevlogLatestDates() {
|
|
|
12764
12845
|
// src/commands/devlog/shared.ts
|
|
12765
12846
|
function getCommitFiles(hash) {
|
|
12766
12847
|
try {
|
|
12767
|
-
const output =
|
|
12848
|
+
const output = execSync29(`git show --name-only --format="" ${hash}`, {
|
|
12768
12849
|
encoding: "utf8"
|
|
12769
12850
|
});
|
|
12770
12851
|
return output.trim().split("\n").filter(Boolean);
|
|
@@ -12860,11 +12941,11 @@ function list3(options2) {
|
|
|
12860
12941
|
}
|
|
12861
12942
|
|
|
12862
12943
|
// src/commands/devlog/getLastVersionInfo.ts
|
|
12863
|
-
import { execFileSync as execFileSync3, execSync as
|
|
12944
|
+
import { execFileSync as execFileSync3, execSync as execSync30 } from "child_process";
|
|
12864
12945
|
import semver from "semver";
|
|
12865
12946
|
function getVersionAtCommit(hash) {
|
|
12866
12947
|
try {
|
|
12867
|
-
const content =
|
|
12948
|
+
const content = execSync30(`git show ${hash}:package.json`, {
|
|
12868
12949
|
encoding: "utf8"
|
|
12869
12950
|
});
|
|
12870
12951
|
const pkg = JSON.parse(content);
|
|
@@ -13037,7 +13118,7 @@ function next2(options2) {
|
|
|
13037
13118
|
}
|
|
13038
13119
|
|
|
13039
13120
|
// src/commands/devlog/repos/index.ts
|
|
13040
|
-
import { execSync as
|
|
13121
|
+
import { execSync as execSync31 } from "child_process";
|
|
13041
13122
|
|
|
13042
13123
|
// src/commands/devlog/repos/printReposTable.ts
|
|
13043
13124
|
import chalk127 from "chalk";
|
|
@@ -13072,7 +13153,7 @@ function getStatus(lastPush, lastDevlog) {
|
|
|
13072
13153
|
return lastDevlog < lastPush ? "outdated" : "ok";
|
|
13073
13154
|
}
|
|
13074
13155
|
function fetchRepos(days, all) {
|
|
13075
|
-
const json =
|
|
13156
|
+
const json = execSync31(
|
|
13076
13157
|
"gh repo list staff0rd --json name,pushedAt,isArchived --limit 200",
|
|
13077
13158
|
{ encoding: "utf8" }
|
|
13078
13159
|
);
|
|
@@ -13452,7 +13533,7 @@ async function deps(csprojPath, options2) {
|
|
|
13452
13533
|
}
|
|
13453
13534
|
|
|
13454
13535
|
// src/commands/dotnet/getChangedCsFiles.ts
|
|
13455
|
-
import { execSync as
|
|
13536
|
+
import { execSync as execSync32 } from "child_process";
|
|
13456
13537
|
var SCOPE_ALL = "all";
|
|
13457
13538
|
var SCOPE_BASE = "base:";
|
|
13458
13539
|
var SCOPE_COMMIT = "commit:";
|
|
@@ -13476,7 +13557,7 @@ function getChangedCsFiles(scope) {
|
|
|
13476
13557
|
} else {
|
|
13477
13558
|
cmd = "git diff --name-only HEAD";
|
|
13478
13559
|
}
|
|
13479
|
-
const output =
|
|
13560
|
+
const output = execSync32(cmd, { encoding: "utf8" }).trim();
|
|
13480
13561
|
if (output === "") return [];
|
|
13481
13562
|
return output.split("\n").filter((f) => f.toLowerCase().endsWith(".cs"));
|
|
13482
13563
|
}
|
|
@@ -13674,14 +13755,14 @@ function parseInspectReport(json) {
|
|
|
13674
13755
|
}
|
|
13675
13756
|
|
|
13676
13757
|
// src/commands/dotnet/runInspectCode.ts
|
|
13677
|
-
import { execSync as
|
|
13758
|
+
import { execSync as execSync33 } from "child_process";
|
|
13678
13759
|
import { existsSync as existsSync37, readFileSync as readFileSync32, unlinkSync as unlinkSync9 } from "fs";
|
|
13679
13760
|
import { tmpdir as tmpdir3 } from "os";
|
|
13680
13761
|
import path31 from "path";
|
|
13681
13762
|
import chalk137 from "chalk";
|
|
13682
13763
|
function assertJbInstalled() {
|
|
13683
13764
|
try {
|
|
13684
|
-
|
|
13765
|
+
execSync33("jb inspectcode --version", { stdio: "pipe" });
|
|
13685
13766
|
} catch {
|
|
13686
13767
|
console.error(chalk137.red("jb is not installed. Install with:"));
|
|
13687
13768
|
console.error(
|
|
@@ -13695,7 +13776,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
13695
13776
|
const includeFlag = include ? ` --include="${include}"` : "";
|
|
13696
13777
|
const sweaFlag = swea ? " --swea" : "";
|
|
13697
13778
|
try {
|
|
13698
|
-
|
|
13779
|
+
execSync33(
|
|
13699
13780
|
`jb inspectcode "${slnPath}" -o="${reportPath}"${includeFlag}${sweaFlag} --verbosity=OFF`,
|
|
13700
13781
|
{ stdio: "pipe" }
|
|
13701
13782
|
);
|
|
@@ -13716,7 +13797,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
13716
13797
|
}
|
|
13717
13798
|
|
|
13718
13799
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
13719
|
-
import { execSync as
|
|
13800
|
+
import { execSync as execSync34 } from "child_process";
|
|
13720
13801
|
import chalk138 from "chalk";
|
|
13721
13802
|
function resolveMsbuildPath() {
|
|
13722
13803
|
const { run: run4 } = loadConfig();
|
|
@@ -13727,7 +13808,7 @@ function resolveMsbuildPath() {
|
|
|
13727
13808
|
function assertMsbuildInstalled() {
|
|
13728
13809
|
const msbuild = resolveMsbuildPath();
|
|
13729
13810
|
try {
|
|
13730
|
-
|
|
13811
|
+
execSync34(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
13731
13812
|
} catch {
|
|
13732
13813
|
console.error(chalk138.red(`msbuild not found at: ${msbuild}`));
|
|
13733
13814
|
console.error(
|
|
@@ -13753,7 +13834,7 @@ function runRoslynInspect(slnPath) {
|
|
|
13753
13834
|
const msbuild = resolveMsbuildPath();
|
|
13754
13835
|
let output;
|
|
13755
13836
|
try {
|
|
13756
|
-
output =
|
|
13837
|
+
output = execSync34(
|
|
13757
13838
|
`"${msbuild}" "${slnPath}" -t:Build -v:minimal -maxcpucount -p:EnforceCodeStyleInBuild=true -p:RunAnalyzersDuringBuild=true 2>&1`,
|
|
13758
13839
|
{ encoding: "utf8", stdio: "pipe", maxBuffer: 50 * 1024 * 1024 }
|
|
13759
13840
|
);
|
|
@@ -14563,7 +14644,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
14563
14644
|
}
|
|
14564
14645
|
|
|
14565
14646
|
// src/commands/jira/jiraAuth.ts
|
|
14566
|
-
import { execSync as
|
|
14647
|
+
import { execSync as execSync35 } from "child_process";
|
|
14567
14648
|
|
|
14568
14649
|
// src/shared/promptInput.ts
|
|
14569
14650
|
import Enquirer from "enquirer";
|
|
@@ -14598,7 +14679,7 @@ async function jiraAuth() {
|
|
|
14598
14679
|
console.error("All fields are required.");
|
|
14599
14680
|
process.exit(1);
|
|
14600
14681
|
}
|
|
14601
|
-
|
|
14682
|
+
execSync35(`acli jira auth login --site ${site} --email "${email}" --token`, {
|
|
14602
14683
|
encoding: "utf8",
|
|
14603
14684
|
input: token,
|
|
14604
14685
|
stdio: ["pipe", "inherit", "inherit"]
|
|
@@ -15080,9 +15161,9 @@ function parseRscRows(flight) {
|
|
|
15080
15161
|
}
|
|
15081
15162
|
function makeRscResolver(rows) {
|
|
15082
15163
|
return (ref) => {
|
|
15083
|
-
const [id, ...
|
|
15164
|
+
const [id, ...path60] = ref.slice(1).replace(/^[L@]/, "").split(":");
|
|
15084
15165
|
let v = rows[id];
|
|
15085
|
-
for (const key of
|
|
15166
|
+
for (const key of path60) {
|
|
15086
15167
|
if (v == null || typeof v !== "object") return void 0;
|
|
15087
15168
|
v = v[key];
|
|
15088
15169
|
}
|
|
@@ -15614,7 +15695,7 @@ function registerPrompts(program2) {
|
|
|
15614
15695
|
}
|
|
15615
15696
|
|
|
15616
15697
|
// src/commands/prs/shared.ts
|
|
15617
|
-
import { execSync as
|
|
15698
|
+
import { execSync as execSync36 } from "child_process";
|
|
15618
15699
|
function isGhNotInstalled(error) {
|
|
15619
15700
|
if (error instanceof Error) {
|
|
15620
15701
|
const msg = error.message.toLowerCase();
|
|
@@ -15632,12 +15713,12 @@ function getRepoInfo() {
|
|
|
15632
15713
|
const preferred = getPreferredRemoteRepo();
|
|
15633
15714
|
if (preferred) return preferred;
|
|
15634
15715
|
const repoInfo = JSON.parse(
|
|
15635
|
-
|
|
15716
|
+
execSync36("gh repo view --json owner,name", { encoding: "utf8" })
|
|
15636
15717
|
);
|
|
15637
15718
|
return { org: repoInfo.owner.login, repo: repoInfo.name };
|
|
15638
15719
|
}
|
|
15639
15720
|
function getCurrentBranch2() {
|
|
15640
|
-
return
|
|
15721
|
+
return execSync36("git rev-parse --abbrev-ref HEAD", {
|
|
15641
15722
|
encoding: "utf8"
|
|
15642
15723
|
}).trim();
|
|
15643
15724
|
}
|
|
@@ -15645,7 +15726,7 @@ function viewCurrentPr(fields) {
|
|
|
15645
15726
|
const { org, repo } = getRepoInfo();
|
|
15646
15727
|
const branch2 = getCurrentBranch2();
|
|
15647
15728
|
return JSON.parse(
|
|
15648
|
-
|
|
15729
|
+
execSync36(`gh pr view ${branch2} --json ${fields} -R ${org}/${repo}`, {
|
|
15649
15730
|
encoding: "utf8"
|
|
15650
15731
|
})
|
|
15651
15732
|
);
|
|
@@ -15729,15 +15810,15 @@ function postComment(vars) {
|
|
|
15729
15810
|
const stdout = startLine === void 0 ? runGhGraphql(MUTATION_SINGLE, base) : runGhGraphql(MUTATION_MULTI, { ...base, startLine });
|
|
15730
15811
|
assertThreadCreated(stdout);
|
|
15731
15812
|
}
|
|
15732
|
-
function comment2(
|
|
15813
|
+
function comment2(path60, line, body, startLine) {
|
|
15733
15814
|
validateBody(body);
|
|
15734
15815
|
validateLine(line);
|
|
15735
15816
|
if (startLine !== void 0) validateLine(startLine);
|
|
15736
15817
|
try {
|
|
15737
15818
|
const prId = getCurrentPrNodeId();
|
|
15738
|
-
postComment({ prId, body, path:
|
|
15819
|
+
postComment({ prId, body, path: path60, line, startLine });
|
|
15739
15820
|
const range = startLine !== void 0 ? `${startLine}-${line}` : `${line}`;
|
|
15740
|
-
console.log(`Added review comment on ${
|
|
15821
|
+
console.log(`Added review comment on ${path60}:${range}`);
|
|
15741
15822
|
} catch (error) {
|
|
15742
15823
|
if (isGhNotInstalled(error)) {
|
|
15743
15824
|
console.error("Error: GitHub CLI (gh) is not installed.");
|
|
@@ -15749,7 +15830,7 @@ function comment2(path58, line, body, startLine) {
|
|
|
15749
15830
|
}
|
|
15750
15831
|
|
|
15751
15832
|
// src/commands/prs/edit.ts
|
|
15752
|
-
import { execSync as
|
|
15833
|
+
import { execSync as execSync37 } from "child_process";
|
|
15753
15834
|
|
|
15754
15835
|
// src/commands/prs/buildPrBody.ts
|
|
15755
15836
|
function jiraBrowseUrl(key) {
|
|
@@ -15922,17 +16003,17 @@ function edit(options2) {
|
|
|
15922
16003
|
if (options2.title) args.push(`--title ${shellQuote(options2.title)}`);
|
|
15923
16004
|
args.push(`--body ${shellQuote(newBody)}`);
|
|
15924
16005
|
try {
|
|
15925
|
-
|
|
16006
|
+
execSync37(args.join(" "), { stdio: "inherit" });
|
|
15926
16007
|
} catch {
|
|
15927
16008
|
process.exit(1);
|
|
15928
16009
|
}
|
|
15929
16010
|
}
|
|
15930
16011
|
|
|
15931
16012
|
// src/commands/prs/fixed.ts
|
|
15932
|
-
import { execSync as
|
|
16013
|
+
import { execSync as execSync40 } from "child_process";
|
|
15933
16014
|
|
|
15934
16015
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
15935
|
-
import { execSync as
|
|
16016
|
+
import { execSync as execSync39 } from "child_process";
|
|
15936
16017
|
import { unlinkSync as unlinkSync12, writeFileSync as writeFileSync31 } from "fs";
|
|
15937
16018
|
import { tmpdir as tmpdir5 } from "os";
|
|
15938
16019
|
import { join as join48 } from "path";
|
|
@@ -15961,9 +16042,9 @@ function deleteCommentsCache(prNumber) {
|
|
|
15961
16042
|
}
|
|
15962
16043
|
|
|
15963
16044
|
// src/commands/prs/replyToComment.ts
|
|
15964
|
-
import { execSync as
|
|
16045
|
+
import { execSync as execSync38 } from "child_process";
|
|
15965
16046
|
function replyToComment(org, repo, prNumber, commentId, message) {
|
|
15966
|
-
|
|
16047
|
+
execSync38(
|
|
15967
16048
|
`gh api repos/${org}/${repo}/pulls/${prNumber}/comments -f body="${message.replace(/"/g, String.raw`\"`)}" -F in_reply_to=${commentId}`,
|
|
15968
16049
|
{ stdio: ["inherit", "pipe", "inherit"] }
|
|
15969
16050
|
);
|
|
@@ -15975,7 +16056,7 @@ function resolveThread(threadId) {
|
|
|
15975
16056
|
const queryFile = join48(tmpdir5(), `gh-mutation-${Date.now()}.graphql`);
|
|
15976
16057
|
writeFileSync31(queryFile, mutation);
|
|
15977
16058
|
try {
|
|
15978
|
-
|
|
16059
|
+
execSync39(
|
|
15979
16060
|
`gh api graphql -F query=@${queryFile} -f threadId="${threadId}"`,
|
|
15980
16061
|
{ stdio: ["inherit", "pipe", "inherit"] }
|
|
15981
16062
|
);
|
|
@@ -16027,7 +16108,7 @@ function resolveCommentWithReply(commentId, message) {
|
|
|
16027
16108
|
// src/commands/prs/fixed.ts
|
|
16028
16109
|
function verifySha(sha) {
|
|
16029
16110
|
try {
|
|
16030
|
-
return
|
|
16111
|
+
return execSync40(`git rev-parse --verify ${sha}`, {
|
|
16031
16112
|
encoding: "utf8"
|
|
16032
16113
|
}).trim();
|
|
16033
16114
|
} catch {
|
|
@@ -16041,7 +16122,7 @@ function fixed(commentId, sha) {
|
|
|
16041
16122
|
const { org, repo } = getRepoInfo();
|
|
16042
16123
|
const repoUrl = `https://github.com/${org}/${repo}`;
|
|
16043
16124
|
const message = `Fixed in [${fullSha}](${repoUrl}/commit/${fullSha})`;
|
|
16044
|
-
|
|
16125
|
+
execSync40("git push", { stdio: "inherit" });
|
|
16045
16126
|
resolveCommentWithReply(commentId, message);
|
|
16046
16127
|
} catch (error) {
|
|
16047
16128
|
if (isGhNotInstalled(error)) {
|
|
@@ -16059,7 +16140,7 @@ import { join as join50 } from "path";
|
|
|
16059
16140
|
import { stringify } from "yaml";
|
|
16060
16141
|
|
|
16061
16142
|
// src/commands/prs/fetchThreadIds.ts
|
|
16062
|
-
import { execSync as
|
|
16143
|
+
import { execSync as execSync41 } from "child_process";
|
|
16063
16144
|
import { unlinkSync as unlinkSync13, writeFileSync as writeFileSync32 } from "fs";
|
|
16064
16145
|
import { tmpdir as tmpdir6 } from "os";
|
|
16065
16146
|
import { join as join49 } from "path";
|
|
@@ -16068,7 +16149,7 @@ function fetchThreadIds(org, repo, prNumber) {
|
|
|
16068
16149
|
const queryFile = join49(tmpdir6(), `gh-query-${Date.now()}.graphql`);
|
|
16069
16150
|
writeFileSync32(queryFile, THREAD_QUERY);
|
|
16070
16151
|
try {
|
|
16071
|
-
const result =
|
|
16152
|
+
const result = execSync41(
|
|
16072
16153
|
`gh api graphql -F query=@${queryFile} -F owner="${org}" -F repo="${repo}" -F prNumber=${prNumber}`,
|
|
16073
16154
|
{ encoding: "utf8" }
|
|
16074
16155
|
);
|
|
@@ -16090,9 +16171,9 @@ function fetchThreadIds(org, repo, prNumber) {
|
|
|
16090
16171
|
}
|
|
16091
16172
|
|
|
16092
16173
|
// src/commands/prs/listComments/fetchReviewComments.ts
|
|
16093
|
-
import { execSync as
|
|
16174
|
+
import { execSync as execSync42 } from "child_process";
|
|
16094
16175
|
function fetchJson(endpoint) {
|
|
16095
|
-
const result =
|
|
16176
|
+
const result = execSync42(`gh api --paginate ${endpoint}`, {
|
|
16096
16177
|
encoding: "utf8"
|
|
16097
16178
|
});
|
|
16098
16179
|
if (!result.trim()) return [];
|
|
@@ -16231,7 +16312,7 @@ async function listComments() {
|
|
|
16231
16312
|
}
|
|
16232
16313
|
|
|
16233
16314
|
// src/commands/prs/prs/index.ts
|
|
16234
|
-
import { execSync as
|
|
16315
|
+
import { execSync as execSync43 } from "child_process";
|
|
16235
16316
|
|
|
16236
16317
|
// src/commands/prs/prs/displayPaginated/index.ts
|
|
16237
16318
|
import enquirer9 from "enquirer";
|
|
@@ -16338,7 +16419,7 @@ async function prs(options2) {
|
|
|
16338
16419
|
const state = options2.open ? "open" : options2.closed ? "closed" : "all";
|
|
16339
16420
|
try {
|
|
16340
16421
|
const { org, repo } = getRepoInfo();
|
|
16341
|
-
const result =
|
|
16422
|
+
const result = execSync43(
|
|
16342
16423
|
`gh pr list --state ${state} --json number,title,url,author,createdAt,mergedAt,closedAt,state,changedFiles --limit 100 -R ${org}/${repo}`,
|
|
16343
16424
|
{ encoding: "utf8" }
|
|
16344
16425
|
);
|
|
@@ -16361,7 +16442,7 @@ async function prs(options2) {
|
|
|
16361
16442
|
}
|
|
16362
16443
|
|
|
16363
16444
|
// src/commands/prs/raise.ts
|
|
16364
|
-
import { execSync as
|
|
16445
|
+
import { execSync as execSync45 } from "child_process";
|
|
16365
16446
|
|
|
16366
16447
|
// src/commands/prs/buildCreateArgs.ts
|
|
16367
16448
|
function buildCreateArgs(title, body, options2) {
|
|
@@ -16394,16 +16475,16 @@ function buildCreateArgs(title, body, options2) {
|
|
|
16394
16475
|
}
|
|
16395
16476
|
|
|
16396
16477
|
// src/commands/prs/readSessionPrRef.ts
|
|
16397
|
-
import { execSync as
|
|
16478
|
+
import { execSync as execSync44 } from "child_process";
|
|
16398
16479
|
function readSessionPrRef() {
|
|
16399
16480
|
try {
|
|
16400
|
-
const branch2 =
|
|
16481
|
+
const branch2 = execSync44("git rev-parse --abbrev-ref HEAD", {
|
|
16401
16482
|
encoding: "utf8",
|
|
16402
16483
|
stdio: ["pipe", "pipe", "pipe"]
|
|
16403
16484
|
}).trim();
|
|
16404
16485
|
if (!branch2 || branch2 === "HEAD") return null;
|
|
16405
16486
|
const pr = JSON.parse(
|
|
16406
|
-
|
|
16487
|
+
execSync44(`gh pr view ${branch2} --json number,title,url,state`, {
|
|
16407
16488
|
encoding: "utf8",
|
|
16408
16489
|
stdio: ["pipe", "pipe", "pipe"]
|
|
16409
16490
|
})
|
|
@@ -16447,7 +16528,7 @@ async function raise(options2) {
|
|
|
16447
16528
|
`--body ${shellQuote(body)}`
|
|
16448
16529
|
] : buildCreateArgs(options2.title, body, options2);
|
|
16449
16530
|
try {
|
|
16450
|
-
|
|
16531
|
+
execSync45(args.join(" "), { stdio: "inherit" });
|
|
16451
16532
|
} catch {
|
|
16452
16533
|
process.exit(1);
|
|
16453
16534
|
}
|
|
@@ -16485,7 +16566,7 @@ function reply(commentId, body) {
|
|
|
16485
16566
|
}
|
|
16486
16567
|
|
|
16487
16568
|
// src/commands/prs/wontfix.ts
|
|
16488
|
-
import { execSync as
|
|
16569
|
+
import { execSync as execSync46 } from "child_process";
|
|
16489
16570
|
function validateReason(reason) {
|
|
16490
16571
|
const lowerReason = reason.toLowerCase();
|
|
16491
16572
|
if (lowerReason.includes("claude") || lowerReason.includes("opus")) {
|
|
@@ -16502,7 +16583,7 @@ function validateShaReferences(reason) {
|
|
|
16502
16583
|
const invalidShas = [];
|
|
16503
16584
|
for (const sha of shas) {
|
|
16504
16585
|
try {
|
|
16505
|
-
|
|
16586
|
+
execSync46(`git cat-file -t ${sha}`, { stdio: "pipe" });
|
|
16506
16587
|
} catch {
|
|
16507
16588
|
invalidShas.push(sha);
|
|
16508
16589
|
}
|
|
@@ -16603,8 +16684,8 @@ function registerPrs(program2) {
|
|
|
16603
16684
|
prsCommand.command("reply <comment-id> <body>").description("Reply to a comment thread without resolving it").action((commentId, body) => {
|
|
16604
16685
|
reply(Number.parseInt(commentId, 10), body);
|
|
16605
16686
|
});
|
|
16606
|
-
prsCommand.command("comment <path> <line> <body>").description("Add a line comment to the pending review").action((
|
|
16607
|
-
comment2(
|
|
16687
|
+
prsCommand.command("comment <path> <line> <body>").description("Add a line comment to the pending review").action((path60, line, body) => {
|
|
16688
|
+
comment2(path60, Number.parseInt(line, 10), body);
|
|
16608
16689
|
});
|
|
16609
16690
|
configHelp(prsCommand, prsConfigHelp);
|
|
16610
16691
|
}
|
|
@@ -16679,10 +16760,10 @@ import chalk157 from "chalk";
|
|
|
16679
16760
|
import Enquirer2 from "enquirer";
|
|
16680
16761
|
|
|
16681
16762
|
// src/commands/ravendb/searchItems.ts
|
|
16682
|
-
import { execSync as
|
|
16763
|
+
import { execSync as execSync47 } from "child_process";
|
|
16683
16764
|
import chalk156 from "chalk";
|
|
16684
16765
|
function opExec(args) {
|
|
16685
|
-
return
|
|
16766
|
+
return execSync47(`op ${args}`, {
|
|
16686
16767
|
encoding: "utf8",
|
|
16687
16768
|
stdio: ["pipe", "pipe", "pipe"]
|
|
16688
16769
|
}).trim();
|
|
@@ -16834,7 +16915,7 @@ ${errorText}`
|
|
|
16834
16915
|
}
|
|
16835
16916
|
|
|
16836
16917
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
16837
|
-
import { execSync as
|
|
16918
|
+
import { execSync as execSync48 } from "child_process";
|
|
16838
16919
|
import chalk161 from "chalk";
|
|
16839
16920
|
function resolveOpSecret(reference) {
|
|
16840
16921
|
if (!reference.startsWith("op://")) {
|
|
@@ -16842,7 +16923,7 @@ function resolveOpSecret(reference) {
|
|
|
16842
16923
|
process.exit(1);
|
|
16843
16924
|
}
|
|
16844
16925
|
try {
|
|
16845
|
-
return
|
|
16926
|
+
return execSync48(`op read "${reference}"`, {
|
|
16846
16927
|
encoding: "utf8",
|
|
16847
16928
|
stdio: ["pipe", "pipe", "pipe"]
|
|
16848
16929
|
}).trim();
|
|
@@ -16857,10 +16938,10 @@ function resolveOpSecret(reference) {
|
|
|
16857
16938
|
}
|
|
16858
16939
|
|
|
16859
16940
|
// src/commands/ravendb/ravenFetch.ts
|
|
16860
|
-
async function ravenFetch(connection,
|
|
16941
|
+
async function ravenFetch(connection, path60) {
|
|
16861
16942
|
const apiKey = resolveOpSecret(connection.apiKeyRef);
|
|
16862
16943
|
let accessToken = await getAccessToken(apiKey);
|
|
16863
|
-
const url = `${connection.url}${
|
|
16944
|
+
const url = `${connection.url}${path60}`;
|
|
16864
16945
|
const headers = {
|
|
16865
16946
|
Authorization: `Bearer ${accessToken}`,
|
|
16866
16947
|
"Content-Type": "application/json"
|
|
@@ -16964,16 +17045,16 @@ import chalk165 from "chalk";
|
|
|
16964
17045
|
// src/commands/ravendb/buildQueryPath.ts
|
|
16965
17046
|
function buildQueryPath(opts) {
|
|
16966
17047
|
const db = encodeURIComponent(opts.db);
|
|
16967
|
-
let
|
|
17048
|
+
let path60;
|
|
16968
17049
|
if (opts.collection) {
|
|
16969
|
-
|
|
17050
|
+
path60 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
|
|
16970
17051
|
} else {
|
|
16971
|
-
|
|
17052
|
+
path60 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
|
|
16972
17053
|
}
|
|
16973
17054
|
if (opts.query) {
|
|
16974
|
-
|
|
17055
|
+
path60 += `&query=${encodeURIComponent(opts.query)}`;
|
|
16975
17056
|
}
|
|
16976
|
-
return
|
|
17057
|
+
return path60;
|
|
16977
17058
|
}
|
|
16978
17059
|
|
|
16979
17060
|
// src/commands/ravendb/fetchAllPages.ts
|
|
@@ -16982,7 +17063,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
16982
17063
|
let start3 = 0;
|
|
16983
17064
|
while (true) {
|
|
16984
17065
|
const effectivePageSize = opts.limit !== void 0 ? Math.min(opts.pageSize, opts.limit - allResults.length) : opts.pageSize;
|
|
16985
|
-
const
|
|
17066
|
+
const path60 = buildQueryPath({
|
|
16986
17067
|
db: connection.database,
|
|
16987
17068
|
collection: opts.collection,
|
|
16988
17069
|
start: start3,
|
|
@@ -16990,7 +17071,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
16990
17071
|
sort: opts.sort,
|
|
16991
17072
|
query: opts.query
|
|
16992
17073
|
});
|
|
16993
|
-
const data = await ravenFetch(connection,
|
|
17074
|
+
const data = await ravenFetch(connection, path60);
|
|
16994
17075
|
const results = data.Results ?? [];
|
|
16995
17076
|
const totalResults = data.TotalResults ?? 0;
|
|
16996
17077
|
if (results.length === 0) break;
|
|
@@ -17106,7 +17187,7 @@ Refactor check failed:
|
|
|
17106
17187
|
}
|
|
17107
17188
|
|
|
17108
17189
|
// src/commands/refactor/check/getViolations/index.ts
|
|
17109
|
-
import { execSync as
|
|
17190
|
+
import { execSync as execSync49 } from "child_process";
|
|
17110
17191
|
import fs24 from "fs";
|
|
17111
17192
|
import { minimatch as minimatch6 } from "minimatch";
|
|
17112
17193
|
|
|
@@ -17156,7 +17237,7 @@ function getGitFiles(options2) {
|
|
|
17156
17237
|
}
|
|
17157
17238
|
const files = /* @__PURE__ */ new Set();
|
|
17158
17239
|
if (options2.staged || options2.modified) {
|
|
17159
|
-
const staged =
|
|
17240
|
+
const staged = execSync49("git diff --cached --name-only", {
|
|
17160
17241
|
encoding: "utf8"
|
|
17161
17242
|
});
|
|
17162
17243
|
for (const file of staged.trim().split("\n").filter(Boolean)) {
|
|
@@ -17164,7 +17245,7 @@ function getGitFiles(options2) {
|
|
|
17164
17245
|
}
|
|
17165
17246
|
}
|
|
17166
17247
|
if (options2.unstaged || options2.modified) {
|
|
17167
|
-
const unstaged =
|
|
17248
|
+
const unstaged = execSync49("git diff --name-only", { encoding: "utf8" });
|
|
17168
17249
|
for (const file of unstaged.trim().split("\n").filter(Boolean)) {
|
|
17169
17250
|
files.add(file);
|
|
17170
17251
|
}
|
|
@@ -18818,9 +18899,9 @@ function buildReviewPaths(repoRoot, key) {
|
|
|
18818
18899
|
}
|
|
18819
18900
|
|
|
18820
18901
|
// src/commands/review/fetchExistingComments.ts
|
|
18821
|
-
import { execSync as
|
|
18902
|
+
import { execSync as execSync50 } from "child_process";
|
|
18822
18903
|
function fetchRawComments(org, repo, prNumber) {
|
|
18823
|
-
const out =
|
|
18904
|
+
const out = execSync50(
|
|
18824
18905
|
`gh api --paginate repos/${org}/${repo}/pulls/${prNumber}/comments`,
|
|
18825
18906
|
{ encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }
|
|
18826
18907
|
);
|
|
@@ -18851,14 +18932,14 @@ function fetchExistingComments() {
|
|
|
18851
18932
|
}
|
|
18852
18933
|
|
|
18853
18934
|
// src/commands/review/gatherContext.ts
|
|
18854
|
-
import { execSync as
|
|
18935
|
+
import { execSync as execSync53 } from "child_process";
|
|
18855
18936
|
|
|
18856
18937
|
// src/commands/review/fetchPrDiff.ts
|
|
18857
|
-
import { execSync as
|
|
18938
|
+
import { execSync as execSync51 } from "child_process";
|
|
18858
18939
|
function fetchPrDiff(prNumber, baseSha, headSha) {
|
|
18859
18940
|
const { org, repo } = getRepoInfo();
|
|
18860
18941
|
try {
|
|
18861
|
-
return
|
|
18942
|
+
return execSync51(`gh pr diff ${prNumber} -R ${org}/${repo}`, {
|
|
18862
18943
|
encoding: "utf8",
|
|
18863
18944
|
maxBuffer: 256 * 1024 * 1024,
|
|
18864
18945
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -18873,19 +18954,19 @@ function isDiffTooLarge(error) {
|
|
|
18873
18954
|
}
|
|
18874
18955
|
function fetchDiffViaGit(baseSha, headSha) {
|
|
18875
18956
|
try {
|
|
18876
|
-
|
|
18957
|
+
execSync51(`git fetch origin ${baseSha} ${headSha}`, { stdio: "ignore" });
|
|
18877
18958
|
} catch {
|
|
18878
18959
|
}
|
|
18879
|
-
return
|
|
18960
|
+
return execSync51(`git diff ${baseSha}...${headSha}`, {
|
|
18880
18961
|
encoding: "utf8",
|
|
18881
18962
|
maxBuffer: 256 * 1024 * 1024
|
|
18882
18963
|
});
|
|
18883
18964
|
}
|
|
18884
18965
|
|
|
18885
18966
|
// src/commands/review/fetchPrDiffInfo.ts
|
|
18886
|
-
import { execSync as
|
|
18967
|
+
import { execSync as execSync52 } from "child_process";
|
|
18887
18968
|
function getCurrentBranch3() {
|
|
18888
|
-
return
|
|
18969
|
+
return execSync52("git rev-parse --abbrev-ref HEAD", {
|
|
18889
18970
|
encoding: "utf8"
|
|
18890
18971
|
}).trim();
|
|
18891
18972
|
}
|
|
@@ -18893,7 +18974,7 @@ function fetchPrDiffInfo() {
|
|
|
18893
18974
|
const { org, repo } = getRepoInfo();
|
|
18894
18975
|
const branch2 = getCurrentBranch3();
|
|
18895
18976
|
const fields = "number,baseRefName,baseRefOid,headRefName,headRefOid";
|
|
18896
|
-
const raw =
|
|
18977
|
+
const raw = execSync52(
|
|
18897
18978
|
`gh pr list --state open --head ${branch2} --json ${fields} -R ${org}/${repo}`,
|
|
18898
18979
|
{
|
|
18899
18980
|
encoding: "utf8",
|
|
@@ -18918,7 +18999,7 @@ function fetchPrDiffInfo() {
|
|
|
18918
18999
|
}
|
|
18919
19000
|
function fetchPrChangedFiles(prNumber) {
|
|
18920
19001
|
const { org, repo } = getRepoInfo();
|
|
18921
|
-
const out =
|
|
19002
|
+
const out = execSync52(
|
|
18922
19003
|
`gh api repos/${org}/${repo}/pulls/${prNumber}/files --paginate --jq ".[].filename"`,
|
|
18923
19004
|
{
|
|
18924
19005
|
encoding: "utf8",
|
|
@@ -18930,11 +19011,11 @@ function fetchPrChangedFiles(prNumber) {
|
|
|
18930
19011
|
|
|
18931
19012
|
// src/commands/review/gatherContext.ts
|
|
18932
19013
|
function gatherContext() {
|
|
18933
|
-
const branch2 =
|
|
19014
|
+
const branch2 = execSync53("git rev-parse --abbrev-ref HEAD", {
|
|
18934
19015
|
encoding: "utf8"
|
|
18935
19016
|
}).trim();
|
|
18936
|
-
const sha =
|
|
18937
|
-
const shortSha =
|
|
19017
|
+
const sha = execSync53("git rev-parse HEAD", { encoding: "utf8" }).trim();
|
|
19018
|
+
const shortSha = execSync53("git rev-parse --short=7 HEAD", {
|
|
18938
19019
|
encoding: "utf8"
|
|
18939
19020
|
}).trim();
|
|
18940
19021
|
const prInfo = fetchPrDiffInfo();
|
|
@@ -19354,8 +19435,8 @@ async function handlePostSynthesis(synthesisPath, options2) {
|
|
|
19354
19435
|
// src/commands/review/prepareReviewDir.ts
|
|
19355
19436
|
import { existsSync as existsSync41, mkdirSync as mkdirSync17, unlinkSync as unlinkSync14, writeFileSync as writeFileSync34 } from "fs";
|
|
19356
19437
|
function clearReviewFiles(paths) {
|
|
19357
|
-
for (const
|
|
19358
|
-
if (existsSync41(
|
|
19438
|
+
for (const path60 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
19439
|
+
if (existsSync41(path60)) unlinkSync14(path60);
|
|
19359
19440
|
}
|
|
19360
19441
|
}
|
|
19361
19442
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -20503,8 +20584,8 @@ import chalk186 from "chalk";
|
|
|
20503
20584
|
|
|
20504
20585
|
// src/commands/seq/fetchSeq.ts
|
|
20505
20586
|
import chalk183 from "chalk";
|
|
20506
|
-
async function fetchSeq(conn,
|
|
20507
|
-
const url = `${conn.url}${
|
|
20587
|
+
async function fetchSeq(conn, path60, params) {
|
|
20588
|
+
const url = `${conn.url}${path60}?${params}`;
|
|
20508
20589
|
const response = await fetch(url, {
|
|
20509
20590
|
headers: {
|
|
20510
20591
|
Accept: "application/json",
|
|
@@ -21579,7 +21660,7 @@ import { mkdirSync as mkdirSync20 } from "fs";
|
|
|
21579
21660
|
import { join as join57 } from "path";
|
|
21580
21661
|
|
|
21581
21662
|
// src/commands/voice/checkLockFile.ts
|
|
21582
|
-
import { execSync as
|
|
21663
|
+
import { execSync as execSync54 } from "child_process";
|
|
21583
21664
|
import { existsSync as existsSync47, mkdirSync as mkdirSync19, readFileSync as readFileSync41, writeFileSync as writeFileSync37 } from "fs";
|
|
21584
21665
|
import { join as join56 } from "path";
|
|
21585
21666
|
function isProcessAlive2(pid) {
|
|
@@ -21608,7 +21689,7 @@ function bootstrapVenv() {
|
|
|
21608
21689
|
if (existsSync47(getVenvPython())) return;
|
|
21609
21690
|
console.log("Setting up Python environment...");
|
|
21610
21691
|
const pythonDir = getPythonDir();
|
|
21611
|
-
|
|
21692
|
+
execSync54(
|
|
21612
21693
|
`uv sync --project "${pythonDir}" --extra runtime --no-install-project`,
|
|
21613
21694
|
{
|
|
21614
21695
|
stdio: "inherit",
|
|
@@ -21986,9 +22067,9 @@ function findPortFile(roamDir) {
|
|
|
21986
22067
|
return void 0;
|
|
21987
22068
|
}
|
|
21988
22069
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
21989
|
-
const
|
|
22070
|
+
const path60 = join59(roamDir, name);
|
|
21990
22071
|
try {
|
|
21991
|
-
return { path:
|
|
22072
|
+
return { path: path60, mtimeMs: statSync8(path60).mtimeMs };
|
|
21992
22073
|
} catch {
|
|
21993
22074
|
return void 0;
|
|
21994
22075
|
}
|
|
@@ -22204,11 +22285,11 @@ function resolveParams(params, cliArgs) {
|
|
|
22204
22285
|
}
|
|
22205
22286
|
|
|
22206
22287
|
// src/commands/run/runPreCommands.ts
|
|
22207
|
-
import { execSync as
|
|
22288
|
+
import { execSync as execSync55 } from "child_process";
|
|
22208
22289
|
function runPreCommands(pre, cwd) {
|
|
22209
22290
|
for (const cmd of pre) {
|
|
22210
22291
|
try {
|
|
22211
|
-
|
|
22292
|
+
execSync55(cmd, { stdio: "inherit", cwd });
|
|
22212
22293
|
} catch (error) {
|
|
22213
22294
|
const code = error && typeof error === "object" && "status" in error ? error.status : 1;
|
|
22214
22295
|
process.exit(code);
|
|
@@ -22407,11 +22488,11 @@ function findLinkIndex() {
|
|
|
22407
22488
|
function parseLinkArgs() {
|
|
22408
22489
|
const idx = findLinkIndex();
|
|
22409
22490
|
if (idx === -1) return null;
|
|
22410
|
-
const
|
|
22491
|
+
const path60 = process.argv[idx + 1];
|
|
22411
22492
|
const rest = process.argv.slice(idx + 2);
|
|
22412
22493
|
const { value: prefix2 } = extractOption(rest, "--prefix");
|
|
22413
22494
|
if (!prefix2) return null;
|
|
22414
|
-
return { path:
|
|
22495
|
+
return { path: path60, prefix: prefix2 };
|
|
22415
22496
|
}
|
|
22416
22497
|
function hasDuplicateLink(runList, linkPath) {
|
|
22417
22498
|
return runList.some(
|
|
@@ -22509,7 +22590,7 @@ function registerRun(program2) {
|
|
|
22509
22590
|
}
|
|
22510
22591
|
|
|
22511
22592
|
// src/commands/screenshot/index.ts
|
|
22512
|
-
import { execSync as
|
|
22593
|
+
import { execSync as execSync56 } from "child_process";
|
|
22513
22594
|
import { existsSync as existsSync52, mkdirSync as mkdirSync23, unlinkSync as unlinkSync19, writeFileSync as writeFileSync40 } from "fs";
|
|
22514
22595
|
import { tmpdir as tmpdir7 } from "os";
|
|
22515
22596
|
import { join as join63, resolve as resolve15 } from "path";
|
|
@@ -22652,7 +22733,7 @@ function runPowerShellScript(processName, outputPath) {
|
|
|
22652
22733
|
const scriptPath = join63(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
|
|
22653
22734
|
writeFileSync40(scriptPath, captureWindowPs1, "utf8");
|
|
22654
22735
|
try {
|
|
22655
|
-
|
|
22736
|
+
execSync56(
|
|
22656
22737
|
`powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
|
|
22657
22738
|
{ stdio: ["ignore", "pipe", "pipe"], encoding: "utf8" }
|
|
22658
22739
|
);
|
|
@@ -22999,7 +23080,8 @@ function toSessionInfo({
|
|
|
22999
23080
|
autoRun,
|
|
23000
23081
|
autoAdvance,
|
|
23001
23082
|
starred,
|
|
23002
|
-
usedPct
|
|
23083
|
+
usedPct,
|
|
23084
|
+
design
|
|
23003
23085
|
}) {
|
|
23004
23086
|
return {
|
|
23005
23087
|
id,
|
|
@@ -23021,7 +23103,8 @@ function toSessionInfo({
|
|
|
23021
23103
|
autoRun,
|
|
23022
23104
|
autoAdvance,
|
|
23023
23105
|
starred,
|
|
23024
|
-
usedPct
|
|
23106
|
+
usedPct,
|
|
23107
|
+
design
|
|
23025
23108
|
};
|
|
23026
23109
|
}
|
|
23027
23110
|
|
|
@@ -23184,12 +23267,27 @@ function createAssistSession(id, assistArgs, cwd, meta) {
|
|
|
23184
23267
|
// src/commands/sessions/daemon/createSession.ts
|
|
23185
23268
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
23186
23269
|
|
|
23270
|
+
// src/commands/sessions/daemon/readDesignSystemPrompt.ts
|
|
23271
|
+
import * as fs33 from "fs";
|
|
23272
|
+
import * as path54 from "path";
|
|
23273
|
+
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
23274
|
+
var __filename4 = fileURLToPath7(import.meta.url);
|
|
23275
|
+
var __dirname6 = path54.dirname(__filename4);
|
|
23276
|
+
function readDesignSystemPrompt() {
|
|
23277
|
+
const promptPath = path54.join(__dirname6, "..", "claude", "system-prompt.md");
|
|
23278
|
+
return fs33.readFileSync(promptPath, "utf8");
|
|
23279
|
+
}
|
|
23280
|
+
|
|
23187
23281
|
// src/commands/sessions/daemon/spawnClaude.ts
|
|
23188
23282
|
function spawnClaude2(opts = {}) {
|
|
23189
23283
|
return spawnPty(buildArgs3(opts), opts.cwd, opts.sessionId);
|
|
23190
23284
|
}
|
|
23191
23285
|
function buildArgs3(opts) {
|
|
23192
23286
|
const base = ["claude", "--settings", ensureHooksSettings()];
|
|
23287
|
+
if (opts.design) {
|
|
23288
|
+
base.push("--append-system-prompt", readDesignSystemPrompt());
|
|
23289
|
+
base.push("--permission-mode", "auto");
|
|
23290
|
+
}
|
|
23193
23291
|
if (opts.resumeSessionId) {
|
|
23194
23292
|
return opts.prompt ? [...base, "--resume", opts.resumeSessionId, opts.prompt] : [...base, "--resume", opts.resumeSessionId];
|
|
23195
23293
|
}
|
|
@@ -23217,16 +23315,17 @@ function sessionBase(id, status2) {
|
|
|
23217
23315
|
scrollback: ""
|
|
23218
23316
|
};
|
|
23219
23317
|
}
|
|
23220
|
-
function createSession(id, prompt, cwd) {
|
|
23318
|
+
function createSession(id, prompt, cwd, design) {
|
|
23221
23319
|
const claudeSessionId = randomUUID4();
|
|
23222
23320
|
return {
|
|
23223
23321
|
...sessionBase(id, prompt ? "running" : "waiting"),
|
|
23224
23322
|
name: prompt?.slice(0, 40) || `Session ${id}`,
|
|
23225
23323
|
commandType: "claude",
|
|
23226
|
-
pty: spawnClaude2({ prompt, cwd, sessionId: id, claudeSessionId }),
|
|
23324
|
+
pty: spawnClaude2({ prompt, cwd, sessionId: id, claudeSessionId, design }),
|
|
23227
23325
|
cwd,
|
|
23228
23326
|
claudeSessionId,
|
|
23229
|
-
initialPrompt: prompt
|
|
23327
|
+
initialPrompt: prompt,
|
|
23328
|
+
design
|
|
23230
23329
|
};
|
|
23231
23330
|
}
|
|
23232
23331
|
function createRunSession(id, runName, runArgs, cwd) {
|
|
@@ -23519,7 +23618,7 @@ async function recordWindowTokens(db, window, resetsAt, tokensUp, tokensDown) {
|
|
|
23519
23618
|
}
|
|
23520
23619
|
|
|
23521
23620
|
// src/commands/sessions/shared/transcriptUsage.ts
|
|
23522
|
-
import * as
|
|
23621
|
+
import * as fs34 from "fs";
|
|
23523
23622
|
function transcriptUsage(lines) {
|
|
23524
23623
|
const byId = /* @__PURE__ */ new Map();
|
|
23525
23624
|
for (const line of lines) {
|
|
@@ -23543,7 +23642,7 @@ function transcriptUsage(lines) {
|
|
|
23543
23642
|
return [...byId.values()];
|
|
23544
23643
|
}
|
|
23545
23644
|
async function readTranscriptUsage(transcriptPath) {
|
|
23546
|
-
const content = await
|
|
23645
|
+
const content = await fs34.promises.readFile(transcriptPath, "utf8");
|
|
23547
23646
|
return transcriptUsage(content.split("\n"));
|
|
23548
23647
|
}
|
|
23549
23648
|
|
|
@@ -23592,7 +23691,7 @@ function recordSessionUsage(sessions, claudeSessionId, transcriptPath, usedPct,
|
|
|
23592
23691
|
|
|
23593
23692
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
23594
23693
|
import { existsSync as existsSync54, mkdirSync as mkdirSync24, watch } from "fs";
|
|
23595
|
-
import { dirname as
|
|
23694
|
+
import { dirname as dirname29 } from "path";
|
|
23596
23695
|
|
|
23597
23696
|
// src/commands/sessions/daemon/applyReviewPause.ts
|
|
23598
23697
|
function applyReviewPause(session, activity2) {
|
|
@@ -23645,8 +23744,8 @@ async function seedRunningMsFromUsage(session, notify2) {
|
|
|
23645
23744
|
var DEBOUNCE_MS = 50;
|
|
23646
23745
|
function watchActivity(session, notify2) {
|
|
23647
23746
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
23648
|
-
const
|
|
23649
|
-
const dir =
|
|
23747
|
+
const path60 = activityPath(session.id);
|
|
23748
|
+
const dir = dirname29(path60);
|
|
23650
23749
|
try {
|
|
23651
23750
|
mkdirSync24(dir, { recursive: true });
|
|
23652
23751
|
} catch {
|
|
@@ -23656,7 +23755,7 @@ function watchActivity(session, notify2) {
|
|
|
23656
23755
|
let timer = null;
|
|
23657
23756
|
const read = () => {
|
|
23658
23757
|
timer = null;
|
|
23659
|
-
const activity2 = readActivity(
|
|
23758
|
+
const activity2 = readActivity(path60);
|
|
23660
23759
|
if (!activity2) return;
|
|
23661
23760
|
session.activity = activity2;
|
|
23662
23761
|
if (activity2.claudeSessionId)
|
|
@@ -23666,11 +23765,11 @@ function watchActivity(session, notify2) {
|
|
|
23666
23765
|
notify2();
|
|
23667
23766
|
};
|
|
23668
23767
|
session.activityWatcher = watch(dir, (_event, filename) => {
|
|
23669
|
-
if (filename && !
|
|
23768
|
+
if (filename && !path60.endsWith(filename)) return;
|
|
23670
23769
|
if (timer) clearTimeout(timer);
|
|
23671
23770
|
timer = setTimeout(read, DEBOUNCE_MS);
|
|
23672
23771
|
});
|
|
23673
|
-
if (existsSync54(
|
|
23772
|
+
if (existsSync54(path60)) read();
|
|
23674
23773
|
}
|
|
23675
23774
|
function refreshActivity(session) {
|
|
23676
23775
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -24815,8 +24914,8 @@ var SessionManager = class {
|
|
|
24815
24914
|
return session.id;
|
|
24816
24915
|
}
|
|
24817
24916
|
spawnWith = (create) => this.add(create(sessionLimits.nextId(this.sessions.size, this.idCounter)));
|
|
24818
|
-
spawn(prompt, cwd) {
|
|
24819
|
-
return this.spawnWith((id) => createSession(id, prompt, cwd));
|
|
24917
|
+
spawn(prompt, cwd, design) {
|
|
24918
|
+
return this.spawnWith((id) => createSession(id, prompt, cwd, design));
|
|
24820
24919
|
}
|
|
24821
24920
|
spawnRun(runName, runArgs, cwd) {
|
|
24822
24921
|
return this.spawnWith((id) => createRunSession(id, runName, runArgs, cwd));
|
|
@@ -24908,7 +25007,7 @@ import * as net3 from "net";
|
|
|
24908
25007
|
import { createInterface as createInterface9 } from "readline";
|
|
24909
25008
|
|
|
24910
25009
|
// src/commands/sessions/shared/parseTranscript.ts
|
|
24911
|
-
import * as
|
|
25010
|
+
import * as fs35 from "fs";
|
|
24912
25011
|
|
|
24913
25012
|
// src/commands/sessions/shared/toolTarget.ts
|
|
24914
25013
|
function toolTarget(input) {
|
|
@@ -24960,7 +25059,7 @@ async function parseTranscript(sessionId) {
|
|
|
24960
25059
|
const filePath = await findSessionJsonlPath(sessionId);
|
|
24961
25060
|
if (!filePath) return [];
|
|
24962
25061
|
try {
|
|
24963
|
-
const raw = await
|
|
25062
|
+
const raw = await fs35.promises.readFile(filePath, "utf8");
|
|
24964
25063
|
return parseTranscriptLines(raw.split("\n"));
|
|
24965
25064
|
} catch {
|
|
24966
25065
|
return [];
|
|
@@ -25007,6 +25106,18 @@ var lifecycleHandlers = {
|
|
|
25007
25106
|
shutdown: handleShutdown
|
|
25008
25107
|
};
|
|
25009
25108
|
|
|
25109
|
+
// src/commands/sessions/daemon/spawnCreate.ts
|
|
25110
|
+
function spawnCreate(m, d) {
|
|
25111
|
+
const design = d.design === true;
|
|
25112
|
+
if (design)
|
|
25113
|
+
daemonLog(`create: design session (cwd=${d.cwd ?? ""})`);
|
|
25114
|
+
return m.spawn(
|
|
25115
|
+
d.prompt,
|
|
25116
|
+
d.cwd,
|
|
25117
|
+
design
|
|
25118
|
+
);
|
|
25119
|
+
}
|
|
25120
|
+
|
|
25010
25121
|
// src/commands/sessions/daemon/messageHandlers.ts
|
|
25011
25122
|
function creator(isNew, spawn12) {
|
|
25012
25123
|
return (client, m, d) => {
|
|
@@ -25023,10 +25134,7 @@ var messageHandlers = {
|
|
|
25023
25134
|
ping: (client) => sendTo(client, { type: "pong", pid: process.pid }),
|
|
25024
25135
|
"subscribe-logs": (client, m, d) => m.clients.subscribeLogs(client, d.replay !== false),
|
|
25025
25136
|
hello: (client) => sendTo(client, buildHello()),
|
|
25026
|
-
create: creator(
|
|
25027
|
-
true,
|
|
25028
|
-
(m, d) => m.spawn(d.prompt, d.cwd)
|
|
25029
|
-
),
|
|
25137
|
+
create: creator(true, spawnCreate),
|
|
25030
25138
|
"create-run": creator(
|
|
25031
25139
|
true,
|
|
25032
25140
|
(m, d) => m.spawnRun(
|
|
@@ -25132,7 +25240,7 @@ function handleConnection(socket, manager) {
|
|
|
25132
25240
|
import { unlinkSync as unlinkSync20, writeFileSync as writeFileSync41 } from "fs";
|
|
25133
25241
|
|
|
25134
25242
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
25135
|
-
import { readFileSync as
|
|
25243
|
+
import { readFileSync as readFileSync47 } from "fs";
|
|
25136
25244
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
25137
25245
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
25138
25246
|
const timer = setInterval(() => {
|
|
@@ -25143,7 +25251,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
25143
25251
|
}
|
|
25144
25252
|
function ownsPidFile() {
|
|
25145
25253
|
try {
|
|
25146
|
-
return
|
|
25254
|
+
return readFileSync47(daemonPaths.pid, "utf8").trim() === String(process.pid);
|
|
25147
25255
|
} catch {
|
|
25148
25256
|
return false;
|
|
25149
25257
|
}
|
|
@@ -25272,17 +25380,17 @@ function registerDaemon(program2) {
|
|
|
25272
25380
|
}
|
|
25273
25381
|
|
|
25274
25382
|
// src/commands/sessions/summarise/index.ts
|
|
25275
|
-
import * as
|
|
25383
|
+
import * as fs38 from "fs";
|
|
25276
25384
|
import chalk195 from "chalk";
|
|
25277
25385
|
|
|
25278
25386
|
// src/commands/sessions/summarise/shared.ts
|
|
25279
|
-
import * as
|
|
25387
|
+
import * as fs36 from "fs";
|
|
25280
25388
|
function writeSummary(jsonlPath2, summary) {
|
|
25281
|
-
|
|
25389
|
+
fs36.writeFileSync(summaryPathFor(jsonlPath2), `${summary.trim()}
|
|
25282
25390
|
`, "utf8");
|
|
25283
25391
|
}
|
|
25284
25392
|
function hasSummary(jsonlPath2) {
|
|
25285
|
-
return
|
|
25393
|
+
return fs36.existsSync(summaryPathFor(jsonlPath2));
|
|
25286
25394
|
}
|
|
25287
25395
|
function summaryPathFor(jsonlPath2) {
|
|
25288
25396
|
return jsonlPath2.replace(/\.jsonl$/, ".summary");
|
|
@@ -25292,7 +25400,7 @@ function summaryPathFor(jsonlPath2) {
|
|
|
25292
25400
|
import { execFileSync as execFileSync10 } from "child_process";
|
|
25293
25401
|
|
|
25294
25402
|
// src/commands/sessions/summarise/iterateUserMessages.ts
|
|
25295
|
-
import * as
|
|
25403
|
+
import * as fs37 from "fs";
|
|
25296
25404
|
|
|
25297
25405
|
// src/commands/sessions/summarise/parseUserLine.ts
|
|
25298
25406
|
function parseUserLine(line) {
|
|
@@ -25323,13 +25431,13 @@ function parseUserLine(line) {
|
|
|
25323
25431
|
function* iterateUserMessages(filePath, maxBytes = 65536) {
|
|
25324
25432
|
let content;
|
|
25325
25433
|
try {
|
|
25326
|
-
const fd =
|
|
25434
|
+
const fd = fs37.openSync(filePath, "r");
|
|
25327
25435
|
try {
|
|
25328
25436
|
const buf = Buffer.alloc(maxBytes);
|
|
25329
|
-
const bytesRead =
|
|
25437
|
+
const bytesRead = fs37.readSync(fd, buf, 0, buf.length, 0);
|
|
25330
25438
|
content = buf.toString("utf8", 0, bytesRead);
|
|
25331
25439
|
} finally {
|
|
25332
|
-
|
|
25440
|
+
fs37.closeSync(fd);
|
|
25333
25441
|
}
|
|
25334
25442
|
} catch {
|
|
25335
25443
|
return;
|
|
@@ -25449,7 +25557,7 @@ function selectCandidates(files, options2) {
|
|
|
25449
25557
|
const candidates = options2.force ? files : files.filter((f) => !hasSummary(f));
|
|
25450
25558
|
candidates.sort((a, b) => {
|
|
25451
25559
|
try {
|
|
25452
|
-
return
|
|
25560
|
+
return fs38.statSync(b).mtimeMs - fs38.statSync(a).mtimeMs;
|
|
25453
25561
|
} catch {
|
|
25454
25562
|
return 0;
|
|
25455
25563
|
}
|
|
@@ -25582,10 +25690,10 @@ function buildLimitsSegment(rateLimits) {
|
|
|
25582
25690
|
}
|
|
25583
25691
|
|
|
25584
25692
|
// src/commands/readGitBranch.ts
|
|
25585
|
-
import { readFileSync as
|
|
25586
|
-
import { isAbsolute as isAbsolute2, join as
|
|
25693
|
+
import { readFileSync as readFileSync49, statSync as statSync11 } from "fs";
|
|
25694
|
+
import { isAbsolute as isAbsolute2, join as join65, resolve as resolve16 } from "path";
|
|
25587
25695
|
function resolveGitDir(cwd) {
|
|
25588
|
-
const dotGit =
|
|
25696
|
+
const dotGit = join65(cwd, ".git");
|
|
25589
25697
|
let stat2;
|
|
25590
25698
|
try {
|
|
25591
25699
|
stat2 = statSync11(dotGit);
|
|
@@ -25597,7 +25705,7 @@ function resolveGitDir(cwd) {
|
|
|
25597
25705
|
}
|
|
25598
25706
|
let contents;
|
|
25599
25707
|
try {
|
|
25600
|
-
contents =
|
|
25708
|
+
contents = readFileSync49(dotGit, "utf8");
|
|
25601
25709
|
} catch {
|
|
25602
25710
|
return null;
|
|
25603
25711
|
}
|
|
@@ -25615,7 +25723,7 @@ function readGitBranch(cwd) {
|
|
|
25615
25723
|
}
|
|
25616
25724
|
let head;
|
|
25617
25725
|
try {
|
|
25618
|
-
head =
|
|
25726
|
+
head = readFileSync49(join65(gitDir, "HEAD"), "utf8");
|
|
25619
25727
|
} catch {
|
|
25620
25728
|
return null;
|
|
25621
25729
|
}
|
|
@@ -25678,21 +25786,21 @@ async function statusLine() {
|
|
|
25678
25786
|
}
|
|
25679
25787
|
|
|
25680
25788
|
// src/commands/sync.ts
|
|
25681
|
-
import * as
|
|
25789
|
+
import * as fs42 from "fs";
|
|
25682
25790
|
import * as os2 from "os";
|
|
25683
|
-
import * as
|
|
25684
|
-
import { fileURLToPath as
|
|
25791
|
+
import * as path58 from "path";
|
|
25792
|
+
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
25685
25793
|
|
|
25686
25794
|
// src/commands/sync/syncClaudeMd.ts
|
|
25687
|
-
import * as
|
|
25688
|
-
import * as
|
|
25795
|
+
import * as fs39 from "fs";
|
|
25796
|
+
import * as path55 from "path";
|
|
25689
25797
|
import chalk198 from "chalk";
|
|
25690
25798
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
25691
|
-
const source =
|
|
25692
|
-
const target =
|
|
25693
|
-
const sourceContent =
|
|
25694
|
-
if (
|
|
25695
|
-
const targetContent =
|
|
25799
|
+
const source = path55.join(claudeDir, "CLAUDE.md");
|
|
25800
|
+
const target = path55.join(targetBase, "CLAUDE.md");
|
|
25801
|
+
const sourceContent = fs39.readFileSync(source, "utf8");
|
|
25802
|
+
if (fs39.existsSync(target)) {
|
|
25803
|
+
const targetContent = fs39.readFileSync(target, "utf8");
|
|
25696
25804
|
if (sourceContent !== targetContent) {
|
|
25697
25805
|
console.log(
|
|
25698
25806
|
chalk198.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
@@ -25709,21 +25817,42 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
25709
25817
|
}
|
|
25710
25818
|
}
|
|
25711
25819
|
}
|
|
25712
|
-
|
|
25820
|
+
fs39.copyFileSync(source, target);
|
|
25713
25821
|
console.log("Copied CLAUDE.md to ~/.claude/CLAUDE.md");
|
|
25714
25822
|
}
|
|
25715
25823
|
|
|
25824
|
+
// src/commands/sync/syncDesign.ts
|
|
25825
|
+
import * as fs40 from "fs";
|
|
25826
|
+
import * as path56 from "path";
|
|
25827
|
+
function syncDesign(claudeDir, targetBase) {
|
|
25828
|
+
const systemPromptSource = path56.join(claudeDir, "system-prompt.md");
|
|
25829
|
+
const systemPromptTarget = path56.join(targetBase, "system-prompt.md");
|
|
25830
|
+
fs40.copyFileSync(systemPromptSource, systemPromptTarget);
|
|
25831
|
+
console.log("Copied system-prompt.md to ~/.claude/system-prompt.md");
|
|
25832
|
+
const skillsSource = path56.join(claudeDir, "skills");
|
|
25833
|
+
const skillsTarget = path56.join(targetBase, "skills");
|
|
25834
|
+
fs40.mkdirSync(skillsTarget, { recursive: true });
|
|
25835
|
+
const files = fs40.readdirSync(skillsSource);
|
|
25836
|
+
for (const file of files) {
|
|
25837
|
+
fs40.copyFileSync(
|
|
25838
|
+
path56.join(skillsSource, file),
|
|
25839
|
+
path56.join(skillsTarget, file)
|
|
25840
|
+
);
|
|
25841
|
+
}
|
|
25842
|
+
console.log(`Synced ${files.length} design skill(s) to ~/.claude/skills`);
|
|
25843
|
+
}
|
|
25844
|
+
|
|
25716
25845
|
// src/commands/sync/syncSettings.ts
|
|
25717
|
-
import * as
|
|
25718
|
-
import * as
|
|
25846
|
+
import * as fs41 from "fs";
|
|
25847
|
+
import * as path57 from "path";
|
|
25719
25848
|
import chalk199 from "chalk";
|
|
25720
25849
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
25721
|
-
const source =
|
|
25722
|
-
const target =
|
|
25723
|
-
const sourceContent =
|
|
25850
|
+
const source = path57.join(claudeDir, "settings.json");
|
|
25851
|
+
const target = path57.join(targetBase, "settings.json");
|
|
25852
|
+
const sourceContent = fs41.readFileSync(source, "utf8");
|
|
25724
25853
|
const sourceSettings = JSON.parse(sourceContent);
|
|
25725
|
-
const targetExists =
|
|
25726
|
-
const targetContent = targetExists ?
|
|
25854
|
+
const targetExists = fs41.existsSync(target);
|
|
25855
|
+
const targetContent = targetExists ? fs41.readFileSync(target, "utf8") : "";
|
|
25727
25856
|
const preservedUserSettings = targetExists ? JSON.parse(targetContent) : {};
|
|
25728
25857
|
const mergedContent = JSON.stringify(
|
|
25729
25858
|
{ ...preservedUserSettings, ...sourceSettings },
|
|
@@ -25752,37 +25881,38 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
25752
25881
|
}
|
|
25753
25882
|
}
|
|
25754
25883
|
}
|
|
25755
|
-
|
|
25884
|
+
fs41.writeFileSync(target, mergedContent);
|
|
25756
25885
|
console.log("Copied settings.json to ~/.claude/settings.json");
|
|
25757
25886
|
}
|
|
25758
25887
|
|
|
25759
25888
|
// src/commands/sync.ts
|
|
25760
|
-
var
|
|
25761
|
-
var
|
|
25889
|
+
var __filename5 = fileURLToPath8(import.meta.url);
|
|
25890
|
+
var __dirname7 = path58.dirname(__filename5);
|
|
25762
25891
|
async function sync(options2) {
|
|
25763
25892
|
const config = loadConfig();
|
|
25764
25893
|
const yes = options2?.yes ?? config.sync.autoConfirm;
|
|
25765
|
-
const claudeDir =
|
|
25766
|
-
const targetBase =
|
|
25894
|
+
const claudeDir = path58.join(__dirname7, "..", "claude");
|
|
25895
|
+
const targetBase = path58.join(os2.homedir(), ".claude");
|
|
25767
25896
|
syncCommands(claudeDir, targetBase);
|
|
25897
|
+
syncDesign(claudeDir, targetBase);
|
|
25768
25898
|
await syncSettings(claudeDir, targetBase, { yes });
|
|
25769
25899
|
await syncClaudeMd(claudeDir, targetBase, { yes });
|
|
25770
25900
|
}
|
|
25771
25901
|
function syncCommands(claudeDir, targetBase) {
|
|
25772
|
-
const sourceDir =
|
|
25773
|
-
const targetDir =
|
|
25774
|
-
|
|
25775
|
-
const files =
|
|
25902
|
+
const sourceDir = path58.join(claudeDir, "commands");
|
|
25903
|
+
const targetDir = path58.join(targetBase, "commands");
|
|
25904
|
+
fs42.mkdirSync(targetDir, { recursive: true });
|
|
25905
|
+
const files = fs42.readdirSync(sourceDir);
|
|
25776
25906
|
for (const file of files) {
|
|
25777
|
-
|
|
25907
|
+
fs42.copyFileSync(path58.join(sourceDir, file), path58.join(targetDir, file));
|
|
25778
25908
|
console.log(`Copied ${file} to ${targetDir}`);
|
|
25779
25909
|
}
|
|
25780
25910
|
console.log(`Synced ${files.length} command(s) to ~/.claude/commands`);
|
|
25781
25911
|
}
|
|
25782
25912
|
|
|
25783
25913
|
// src/commands/update.ts
|
|
25784
|
-
import { execSync as
|
|
25785
|
-
import * as
|
|
25914
|
+
import { execSync as execSync57 } from "child_process";
|
|
25915
|
+
import * as path59 from "path";
|
|
25786
25916
|
|
|
25787
25917
|
// src/commands/restartDaemonAfterUpdate.ts
|
|
25788
25918
|
async function restartDaemonAfterUpdate() {
|
|
@@ -25801,12 +25931,12 @@ async function restartDaemonAfterUpdate() {
|
|
|
25801
25931
|
// src/commands/update.ts
|
|
25802
25932
|
function isGlobalNpmInstall(dir) {
|
|
25803
25933
|
try {
|
|
25804
|
-
const resolved =
|
|
25805
|
-
if (resolved.split(
|
|
25934
|
+
const resolved = path59.resolve(dir);
|
|
25935
|
+
if (resolved.split(path59.sep).includes("node_modules")) {
|
|
25806
25936
|
return true;
|
|
25807
25937
|
}
|
|
25808
|
-
const globalPrefix =
|
|
25809
|
-
return resolved.toLowerCase().startsWith(
|
|
25938
|
+
const globalPrefix = execSync57("npm prefix -g", { stdio: "pipe" }).toString().trim();
|
|
25939
|
+
return resolved.toLowerCase().startsWith(path59.resolve(globalPrefix).toLowerCase());
|
|
25810
25940
|
} catch {
|
|
25811
25941
|
return false;
|
|
25812
25942
|
}
|
|
@@ -25816,18 +25946,18 @@ async function update2() {
|
|
|
25816
25946
|
console.log(`Assist is installed at: ${installDir}`);
|
|
25817
25947
|
if (isGitRepo(installDir)) {
|
|
25818
25948
|
console.log("Detected git repo installation, pulling latest...");
|
|
25819
|
-
|
|
25949
|
+
execSync57("git pull", { cwd: installDir, stdio: "inherit" });
|
|
25820
25950
|
console.log("Installing dependencies...");
|
|
25821
|
-
|
|
25951
|
+
execSync57("npm i", { cwd: installDir, stdio: "inherit" });
|
|
25822
25952
|
console.log("Building...");
|
|
25823
|
-
|
|
25953
|
+
execSync57("npm run build", { cwd: installDir, stdio: "inherit" });
|
|
25824
25954
|
console.log("Syncing commands...");
|
|
25825
|
-
|
|
25955
|
+
execSync57("assist sync", { stdio: "inherit" });
|
|
25826
25956
|
} else if (isGlobalNpmInstall(installDir)) {
|
|
25827
25957
|
console.log("Detected global npm installation, updating...");
|
|
25828
|
-
|
|
25958
|
+
execSync57("npm i -g @staff0rd/assist@latest", { stdio: "inherit" });
|
|
25829
25959
|
console.log("Syncing commands...");
|
|
25830
|
-
|
|
25960
|
+
execSync57("assist sync", { stdio: "inherit" });
|
|
25831
25961
|
} else {
|
|
25832
25962
|
console.error(
|
|
25833
25963
|
"Could not determine installation method. Expected a git repo or global npm install."
|