@staff0rd/assist 0.288.0 → 0.288.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +670 -599
- 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.288.
|
|
9
|
+
version: "0.288.2",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -124,10 +124,10 @@ import { stringify as stringifyYaml } from "yaml";
|
|
|
124
124
|
// src/shared/loadRawYaml.ts
|
|
125
125
|
import { existsSync, readFileSync } from "fs";
|
|
126
126
|
import { parse as parseYaml } from "yaml";
|
|
127
|
-
function loadRawYaml(
|
|
128
|
-
if (!existsSync(
|
|
127
|
+
function loadRawYaml(path56) {
|
|
128
|
+
if (!existsSync(path56)) return {};
|
|
129
129
|
try {
|
|
130
|
-
const content = readFileSync(
|
|
130
|
+
const content = readFileSync(path56, "utf-8");
|
|
131
131
|
return parseYaml(content) || {};
|
|
132
132
|
} catch {
|
|
133
133
|
return {};
|
|
@@ -3110,9 +3110,9 @@ var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
|
|
|
3110
3110
|
function backupLocalBacklogFiles(dir) {
|
|
3111
3111
|
const moved = [];
|
|
3112
3112
|
for (const name of LOCAL_FILES) {
|
|
3113
|
-
const
|
|
3114
|
-
if (existsSync15(
|
|
3115
|
-
renameSync(
|
|
3113
|
+
const path56 = join11(dir, ".assist", name);
|
|
3114
|
+
if (existsSync15(path56)) {
|
|
3115
|
+
renameSync(path56, `${path56}.bak`);
|
|
3116
3116
|
moved.push(`${name} \u2192 ${name}.bak`);
|
|
3117
3117
|
}
|
|
3118
3118
|
}
|
|
@@ -3402,8 +3402,8 @@ var backlogItemSchema = z3.strictObject({
|
|
|
3402
3402
|
var backlogFileSchema = z3.array(backlogItemSchema);
|
|
3403
3403
|
|
|
3404
3404
|
// src/commands/backlog/parseBacklogJsonl.ts
|
|
3405
|
-
function parseBacklogJsonl(
|
|
3406
|
-
const content = readFileSync10(
|
|
3405
|
+
function parseBacklogJsonl(path56) {
|
|
3406
|
+
const content = readFileSync10(path56, "utf-8").trim();
|
|
3407
3407
|
if (content.length === 0) return [];
|
|
3408
3408
|
return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
|
|
3409
3409
|
}
|
|
@@ -3477,9 +3477,9 @@ function findBacklogUp(startDir) {
|
|
|
3477
3477
|
}
|
|
3478
3478
|
|
|
3479
3479
|
// src/commands/backlog/getCurrentOrigin.ts
|
|
3480
|
-
import {
|
|
3481
|
-
function stripLeadingSlashes(
|
|
3482
|
-
return
|
|
3480
|
+
import { execFileSync } from "child_process";
|
|
3481
|
+
function stripLeadingSlashes(path56) {
|
|
3482
|
+
return path56.replace(/^\/+/, "");
|
|
3483
3483
|
}
|
|
3484
3484
|
function normalizeOrigin(raw) {
|
|
3485
3485
|
const trimmed = raw.trim().replace(/\.git$/i, "").replace(/\/+$/, "");
|
|
@@ -3498,11 +3498,14 @@ function normalizeOrigin(raw) {
|
|
|
3498
3498
|
return trimmed.toLowerCase();
|
|
3499
3499
|
}
|
|
3500
3500
|
function tryGit(cwd, args) {
|
|
3501
|
+
const windows = /^[A-Za-z]:[\\/]/.test(cwd);
|
|
3502
|
+
const file = windows ? "git.exe" : "git";
|
|
3503
|
+
const argv = windows ? ["-C", cwd, ...args] : args;
|
|
3501
3504
|
try {
|
|
3502
|
-
const out =
|
|
3503
|
-
cwd,
|
|
3505
|
+
const out = execFileSync(file, argv, {
|
|
3504
3506
|
encoding: "utf-8",
|
|
3505
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
3507
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
3508
|
+
...windows ? {} : { cwd }
|
|
3506
3509
|
}).trim();
|
|
3507
3510
|
return out || null;
|
|
3508
3511
|
} catch {
|
|
@@ -3510,18 +3513,18 @@ function tryGit(cwd, args) {
|
|
|
3510
3513
|
}
|
|
3511
3514
|
}
|
|
3512
3515
|
function firstRemoteUrl(cwd) {
|
|
3513
|
-
const remotes = tryGit(cwd, "remote");
|
|
3516
|
+
const remotes = tryGit(cwd, ["remote"]);
|
|
3514
3517
|
if (!remotes) return null;
|
|
3515
3518
|
for (const remote of remotes.split("\n").map((r) => r.trim()).filter(Boolean)) {
|
|
3516
|
-
const url = tryGit(cwd,
|
|
3519
|
+
const url = tryGit(cwd, ["remote", "get-url", remote]);
|
|
3517
3520
|
if (url) return url;
|
|
3518
3521
|
}
|
|
3519
3522
|
return null;
|
|
3520
3523
|
}
|
|
3521
3524
|
function getCurrentOrigin(cwd) {
|
|
3522
|
-
const url = tryGit(cwd, "remote get-url origin") ?? firstRemoteUrl(cwd);
|
|
3525
|
+
const url = tryGit(cwd, ["remote", "get-url", "origin"]) ?? firstRemoteUrl(cwd);
|
|
3523
3526
|
if (url) return normalizeOrigin(url);
|
|
3524
|
-
const root = tryGit(cwd, "rev-parse --show-toplevel");
|
|
3527
|
+
const root = tryGit(cwd, ["rev-parse", "--show-toplevel"]);
|
|
3525
3528
|
return `local:${root ?? cwd}`;
|
|
3526
3529
|
}
|
|
3527
3530
|
|
|
@@ -3743,13 +3746,13 @@ function activityPath(sessionId) {
|
|
|
3743
3746
|
function emitActivity(activity2) {
|
|
3744
3747
|
const sessionId = process.env.ASSIST_ACTIVITY_ID;
|
|
3745
3748
|
if (!sessionId) return;
|
|
3746
|
-
const
|
|
3747
|
-
mkdirSync6(dirname14(
|
|
3748
|
-
writeFileSync13(
|
|
3749
|
+
const path56 = activityPath(sessionId);
|
|
3750
|
+
mkdirSync6(dirname14(path56), { recursive: true });
|
|
3751
|
+
writeFileSync13(path56, JSON.stringify({ ...activity2, startedAt: Date.now() }));
|
|
3749
3752
|
}
|
|
3750
|
-
function readActivity(
|
|
3753
|
+
function readActivity(path56) {
|
|
3751
3754
|
try {
|
|
3752
|
-
return JSON.parse(readFileSync11(
|
|
3755
|
+
return JSON.parse(readFileSync11(path56, "utf-8"));
|
|
3753
3756
|
} catch {
|
|
3754
3757
|
return void 0;
|
|
3755
3758
|
}
|
|
@@ -3909,10 +3912,10 @@ function writeSignal(event, data) {
|
|
|
3909
3912
|
|
|
3910
3913
|
// src/commands/backlog/readSignal.ts
|
|
3911
3914
|
function readSignal() {
|
|
3912
|
-
const
|
|
3913
|
-
if (!existsSync19(
|
|
3915
|
+
const path56 = getSignalPath();
|
|
3916
|
+
if (!existsSync19(path56)) return void 0;
|
|
3914
3917
|
try {
|
|
3915
|
-
return JSON.parse(readFileSync12(
|
|
3918
|
+
return JSON.parse(readFileSync12(path56, "utf-8"));
|
|
3916
3919
|
} catch {
|
|
3917
3920
|
return void 0;
|
|
3918
3921
|
}
|
|
@@ -4369,7 +4372,7 @@ function printComments(item) {
|
|
|
4369
4372
|
import { WebSocketServer } from "ws";
|
|
4370
4373
|
|
|
4371
4374
|
// src/shared/getInstallDir.ts
|
|
4372
|
-
import { execSync as
|
|
4375
|
+
import { execSync as execSync18 } from "child_process";
|
|
4373
4376
|
import { dirname as dirname15, resolve as resolve6 } from "path";
|
|
4374
4377
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
4375
4378
|
var __filename2 = fileURLToPath3(import.meta.url);
|
|
@@ -4379,7 +4382,7 @@ function getInstallDir() {
|
|
|
4379
4382
|
}
|
|
4380
4383
|
function isGitRepo(dir) {
|
|
4381
4384
|
try {
|
|
4382
|
-
const result =
|
|
4385
|
+
const result = execSync18("git rev-parse --show-toplevel", {
|
|
4383
4386
|
cwd: dir,
|
|
4384
4387
|
stdio: "pipe"
|
|
4385
4388
|
}).toString().trim();
|
|
@@ -4396,11 +4399,11 @@ import {
|
|
|
4396
4399
|
import chalk43 from "chalk";
|
|
4397
4400
|
|
|
4398
4401
|
// src/lib/openBrowser.ts
|
|
4399
|
-
import { execSync as
|
|
4402
|
+
import { execSync as execSync19 } from "child_process";
|
|
4400
4403
|
function tryExec(commands) {
|
|
4401
4404
|
for (const cmd of commands) {
|
|
4402
4405
|
try {
|
|
4403
|
-
|
|
4406
|
+
execSync19(cmd, { stdio: "ignore" });
|
|
4404
4407
|
return true;
|
|
4405
4408
|
} catch {
|
|
4406
4409
|
}
|
|
@@ -4932,7 +4935,7 @@ function getHtml() {
|
|
|
4932
4935
|
}
|
|
4933
4936
|
|
|
4934
4937
|
// src/commands/prs/getPreferredRemoteRepo.ts
|
|
4935
|
-
import { execSync as
|
|
4938
|
+
import { execSync as execSync20 } from "child_process";
|
|
4936
4939
|
var GITHUB_URL_PATTERN = /(?:git@github\.com:|https:\/\/github\.com\/)([^/]+)\/([^/]+?)(?:\.git)?\/?$/;
|
|
4937
4940
|
function parseGitHubUrl(url) {
|
|
4938
4941
|
const match = url.match(GITHUB_URL_PATTERN);
|
|
@@ -4941,7 +4944,7 @@ function parseGitHubUrl(url) {
|
|
|
4941
4944
|
}
|
|
4942
4945
|
function tryGetRemoteUrl(remote, cwd) {
|
|
4943
4946
|
try {
|
|
4944
|
-
return
|
|
4947
|
+
return execSync20(`git remote get-url ${remote}`, {
|
|
4945
4948
|
encoding: "utf-8",
|
|
4946
4949
|
stdio: ["pipe", "pipe", "pipe"],
|
|
4947
4950
|
cwd
|
|
@@ -4952,7 +4955,7 @@ function tryGetRemoteUrl(remote, cwd) {
|
|
|
4952
4955
|
}
|
|
4953
4956
|
function getCurrentBranchRemote(cwd) {
|
|
4954
4957
|
try {
|
|
4955
|
-
const ref =
|
|
4958
|
+
const ref = execSync20(
|
|
4956
4959
|
"git rev-parse --abbrev-ref --symbolic-full-name @{u}",
|
|
4957
4960
|
{ encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"], cwd }
|
|
4958
4961
|
).trim();
|
|
@@ -4964,7 +4967,7 @@ function getCurrentBranchRemote(cwd) {
|
|
|
4964
4967
|
}
|
|
4965
4968
|
function listRemotes(cwd) {
|
|
4966
4969
|
try {
|
|
4967
|
-
return
|
|
4970
|
+
return execSync20("git remote", {
|
|
4968
4971
|
encoding: "utf-8",
|
|
4969
4972
|
stdio: ["pipe", "pipe", "pipe"],
|
|
4970
4973
|
cwd
|
|
@@ -6251,8 +6254,8 @@ import chalk57 from "chalk";
|
|
|
6251
6254
|
// src/commands/backlog/originDisplayName.ts
|
|
6252
6255
|
function originDisplayName(origin) {
|
|
6253
6256
|
if (origin.startsWith("local:")) {
|
|
6254
|
-
const
|
|
6255
|
-
const segments =
|
|
6257
|
+
const path56 = origin.slice("local:".length).replace(/\/+$/, "");
|
|
6258
|
+
const segments = path56.split("/").filter(Boolean);
|
|
6256
6259
|
return segments[segments.length - 1] ?? origin;
|
|
6257
6260
|
}
|
|
6258
6261
|
const firstSlash = origin.indexOf("/");
|
|
@@ -7555,9 +7558,9 @@ var __dirname5 = dirname17(__filename3);
|
|
|
7555
7558
|
function packageRoot() {
|
|
7556
7559
|
return __dirname5;
|
|
7557
7560
|
}
|
|
7558
|
-
function readLines(
|
|
7559
|
-
if (!existsSync22(
|
|
7560
|
-
return readFileSync16(
|
|
7561
|
+
function readLines(path56) {
|
|
7562
|
+
if (!existsSync22(path56)) return [];
|
|
7563
|
+
return readFileSync16(path56, "utf-8").split("\n").filter((line) => line.trim() !== "");
|
|
7561
7564
|
}
|
|
7562
7565
|
var cachedReads;
|
|
7563
7566
|
var cachedWrites;
|
|
@@ -7888,7 +7891,7 @@ import { homedir as homedir9 } from "os";
|
|
|
7888
7891
|
import { join as join22 } from "path";
|
|
7889
7892
|
|
|
7890
7893
|
// src/shared/checkCliAvailable.ts
|
|
7891
|
-
import { execSync as
|
|
7894
|
+
import { execSync as execSync21 } from "child_process";
|
|
7892
7895
|
function checkCliAvailable(cli) {
|
|
7893
7896
|
const binary = cli.split(/\s+/)[0];
|
|
7894
7897
|
const opts = {
|
|
@@ -7896,11 +7899,11 @@ function checkCliAvailable(cli) {
|
|
|
7896
7899
|
stdio: ["ignore", "pipe", "pipe"]
|
|
7897
7900
|
};
|
|
7898
7901
|
try {
|
|
7899
|
-
|
|
7902
|
+
execSync21(`command -v ${binary}`, opts);
|
|
7900
7903
|
return true;
|
|
7901
7904
|
} catch {
|
|
7902
7905
|
try {
|
|
7903
|
-
|
|
7906
|
+
execSync21(`where ${binary}`, opts);
|
|
7904
7907
|
return true;
|
|
7905
7908
|
} catch {
|
|
7906
7909
|
return false;
|
|
@@ -8022,14 +8025,14 @@ function showProgress(p, label2) {
|
|
|
8022
8025
|
const pct = Math.round(p.done / p.total * 100);
|
|
8023
8026
|
process.stderr.write(`\r\x1B[K[${pct}%] Scanning ${label2}...`);
|
|
8024
8027
|
}
|
|
8025
|
-
async function resolveCommand(cli,
|
|
8026
|
-
showProgress(p,
|
|
8027
|
-
const subHelp = await runHelp([cli, ...
|
|
8028
|
+
async function resolveCommand(cli, path56, description, depth, p) {
|
|
8029
|
+
showProgress(p, path56.join(" "));
|
|
8030
|
+
const subHelp = await runHelp([cli, ...path56]);
|
|
8028
8031
|
if (!subHelp || !hasSubcommands(subHelp)) {
|
|
8029
|
-
return [{ path:
|
|
8032
|
+
return [{ path: path56, description }];
|
|
8030
8033
|
}
|
|
8031
|
-
const children = await discoverAt(cli,
|
|
8032
|
-
return children.length > 0 ? children : [{ path:
|
|
8034
|
+
const children = await discoverAt(cli, path56, depth + 1, p);
|
|
8035
|
+
return children.length > 0 ? children : [{ path: path56, description }];
|
|
8033
8036
|
}
|
|
8034
8037
|
async function discoverAt(cli, parentPath, depth, p) {
|
|
8035
8038
|
if (depth > SAFETY_DEPTH) return [];
|
|
@@ -8177,9 +8180,9 @@ function logPath(cli) {
|
|
|
8177
8180
|
return join22(homedir9(), ".assist", `cli-discover-${safeName}.log`);
|
|
8178
8181
|
}
|
|
8179
8182
|
function readCache(cli) {
|
|
8180
|
-
const
|
|
8181
|
-
if (!existsSync24(
|
|
8182
|
-
return readFileSync18(
|
|
8183
|
+
const path56 = logPath(cli);
|
|
8184
|
+
if (!existsSync24(path56)) return void 0;
|
|
8185
|
+
return readFileSync18(path56, "utf-8");
|
|
8183
8186
|
}
|
|
8184
8187
|
function writeCache(cli, output) {
|
|
8185
8188
|
const dir = join22(homedir9(), ".assist");
|
|
@@ -8868,8 +8871,8 @@ function stepIntoNested(container, key, nextKey) {
|
|
|
8868
8871
|
}
|
|
8869
8872
|
return ensureObject(container, resolved);
|
|
8870
8873
|
}
|
|
8871
|
-
function setNestedValue(obj,
|
|
8872
|
-
const keys =
|
|
8874
|
+
function setNestedValue(obj, path56, value) {
|
|
8875
|
+
const keys = path56.split(".");
|
|
8873
8876
|
const result = { ...obj };
|
|
8874
8877
|
let current = result;
|
|
8875
8878
|
for (let i = 0; i < keys.length - 1; i++) {
|
|
@@ -8949,9 +8952,9 @@ function isTraversable(value) {
|
|
|
8949
8952
|
function stepInto(current, key) {
|
|
8950
8953
|
return isTraversable(current) ? current[key] : void 0;
|
|
8951
8954
|
}
|
|
8952
|
-
function getNestedValue(obj,
|
|
8955
|
+
function getNestedValue(obj, path56) {
|
|
8953
8956
|
let current = obj;
|
|
8954
|
-
for (const key of
|
|
8957
|
+
for (const key of path56.split(".")) current = stepInto(current, key);
|
|
8955
8958
|
return current;
|
|
8956
8959
|
}
|
|
8957
8960
|
|
|
@@ -9021,7 +9024,7 @@ function registerDeploy(program2) {
|
|
|
9021
9024
|
}
|
|
9022
9025
|
|
|
9023
9026
|
// src/commands/devlog/list/index.ts
|
|
9024
|
-
import { execFileSync } from "child_process";
|
|
9027
|
+
import { execFileSync as execFileSync2 } from "child_process";
|
|
9025
9028
|
import { basename as basename4 } from "path";
|
|
9026
9029
|
|
|
9027
9030
|
// src/commands/devlog/loadBlogSkipDays.ts
|
|
@@ -9036,7 +9039,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
9036
9039
|
}
|
|
9037
9040
|
|
|
9038
9041
|
// src/commands/devlog/shared.ts
|
|
9039
|
-
import { execSync as
|
|
9042
|
+
import { execSync as execSync22 } from "child_process";
|
|
9040
9043
|
import chalk92 from "chalk";
|
|
9041
9044
|
|
|
9042
9045
|
// src/shared/getRepoName.ts
|
|
@@ -9128,7 +9131,7 @@ function loadAllDevlogLatestDates() {
|
|
|
9128
9131
|
// src/commands/devlog/shared.ts
|
|
9129
9132
|
function getCommitFiles(hash) {
|
|
9130
9133
|
try {
|
|
9131
|
-
const output =
|
|
9134
|
+
const output = execSync22(`git show --name-only --format="" ${hash}`, {
|
|
9132
9135
|
encoding: "utf-8"
|
|
9133
9136
|
});
|
|
9134
9137
|
return output.trim().split("\n").filter(Boolean);
|
|
@@ -9201,7 +9204,7 @@ function list3(options2) {
|
|
|
9201
9204
|
if (options2.reverse) args.push("--reverse");
|
|
9202
9205
|
else args.push("-n", "500");
|
|
9203
9206
|
args.push("--pretty=format:%ad|%h|%s", "--date=short");
|
|
9204
|
-
const output =
|
|
9207
|
+
const output = execFileSync2("git", args, { encoding: "utf-8" });
|
|
9205
9208
|
const commitsByDate = parseGitLogCommits(output, ignore2);
|
|
9206
9209
|
let dateCount = 0;
|
|
9207
9210
|
let isFirst = true;
|
|
@@ -9224,11 +9227,11 @@ function list3(options2) {
|
|
|
9224
9227
|
}
|
|
9225
9228
|
|
|
9226
9229
|
// src/commands/devlog/getLastVersionInfo.ts
|
|
9227
|
-
import { execFileSync as
|
|
9230
|
+
import { execFileSync as execFileSync3, execSync as execSync23 } from "child_process";
|
|
9228
9231
|
import semver from "semver";
|
|
9229
9232
|
function getVersionAtCommit(hash) {
|
|
9230
9233
|
try {
|
|
9231
|
-
const content =
|
|
9234
|
+
const content = execSync23(`git show ${hash}:package.json`, {
|
|
9232
9235
|
encoding: "utf-8"
|
|
9233
9236
|
});
|
|
9234
9237
|
const pkg = JSON.parse(content);
|
|
@@ -9243,7 +9246,7 @@ function stripToMinor(version2) {
|
|
|
9243
9246
|
}
|
|
9244
9247
|
function getLastVersionInfoFromGit() {
|
|
9245
9248
|
try {
|
|
9246
|
-
const output =
|
|
9249
|
+
const output = execFileSync3(
|
|
9247
9250
|
"git",
|
|
9248
9251
|
["log", "-1", "--pretty=format:%ad|%h", "--date=short"],
|
|
9249
9252
|
{
|
|
@@ -9288,7 +9291,7 @@ function bumpVersion(version2, type) {
|
|
|
9288
9291
|
}
|
|
9289
9292
|
|
|
9290
9293
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
9291
|
-
import { execFileSync as
|
|
9294
|
+
import { execFileSync as execFileSync4 } from "child_process";
|
|
9292
9295
|
import chalk95 from "chalk";
|
|
9293
9296
|
|
|
9294
9297
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
@@ -9322,7 +9325,7 @@ function findTargetDate(commitsByDate, skipDays) {
|
|
|
9322
9325
|
return Array.from(commitsByDate.keys()).filter((d) => !skipDays.has(d)).sort()[0];
|
|
9323
9326
|
}
|
|
9324
9327
|
function fetchCommitsByDate(ignore2, lastDate) {
|
|
9325
|
-
const output =
|
|
9328
|
+
const output = execFileSync4(
|
|
9326
9329
|
"git",
|
|
9327
9330
|
["log", "--pretty=format:%ad|%h|%s", "--date=short", "-n", "500"],
|
|
9328
9331
|
{ encoding: "utf-8" }
|
|
@@ -9401,7 +9404,7 @@ function next2(options2) {
|
|
|
9401
9404
|
}
|
|
9402
9405
|
|
|
9403
9406
|
// src/commands/devlog/repos/index.ts
|
|
9404
|
-
import { execSync as
|
|
9407
|
+
import { execSync as execSync24 } from "child_process";
|
|
9405
9408
|
|
|
9406
9409
|
// src/commands/devlog/repos/printReposTable.ts
|
|
9407
9410
|
import chalk96 from "chalk";
|
|
@@ -9436,7 +9439,7 @@ function getStatus(lastPush, lastDevlog) {
|
|
|
9436
9439
|
return lastDevlog < lastPush ? "outdated" : "ok";
|
|
9437
9440
|
}
|
|
9438
9441
|
function fetchRepos(days, all) {
|
|
9439
|
-
const json =
|
|
9442
|
+
const json = execSync24(
|
|
9440
9443
|
"gh repo list staff0rd --json name,pushedAt,isArchived --limit 200",
|
|
9441
9444
|
{ encoding: "utf-8" }
|
|
9442
9445
|
);
|
|
@@ -9796,7 +9799,7 @@ async function deps(csprojPath, options2) {
|
|
|
9796
9799
|
}
|
|
9797
9800
|
|
|
9798
9801
|
// src/commands/dotnet/getChangedCsFiles.ts
|
|
9799
|
-
import { execSync as
|
|
9802
|
+
import { execSync as execSync25 } from "child_process";
|
|
9800
9803
|
var SCOPE_ALL = "all";
|
|
9801
9804
|
var SCOPE_BASE = "base:";
|
|
9802
9805
|
var SCOPE_COMMIT = "commit:";
|
|
@@ -9820,7 +9823,7 @@ function getChangedCsFiles(scope) {
|
|
|
9820
9823
|
} else {
|
|
9821
9824
|
cmd = "git diff --name-only HEAD";
|
|
9822
9825
|
}
|
|
9823
|
-
const output =
|
|
9826
|
+
const output = execSync25(cmd, { encoding: "utf-8" }).trim();
|
|
9824
9827
|
if (output === "") return [];
|
|
9825
9828
|
return output.split("\n").filter((f) => f.toLowerCase().endsWith(".cs"));
|
|
9826
9829
|
}
|
|
@@ -10018,14 +10021,14 @@ function parseInspectReport(json) {
|
|
|
10018
10021
|
}
|
|
10019
10022
|
|
|
10020
10023
|
// src/commands/dotnet/runInspectCode.ts
|
|
10021
|
-
import { execSync as
|
|
10024
|
+
import { execSync as execSync26 } from "child_process";
|
|
10022
10025
|
import { existsSync as existsSync30, readFileSync as readFileSync24, unlinkSync as unlinkSync7 } from "fs";
|
|
10023
10026
|
import { tmpdir as tmpdir3 } from "os";
|
|
10024
10027
|
import path25 from "path";
|
|
10025
10028
|
import chalk106 from "chalk";
|
|
10026
10029
|
function assertJbInstalled() {
|
|
10027
10030
|
try {
|
|
10028
|
-
|
|
10031
|
+
execSync26("jb inspectcode --version", { stdio: "pipe" });
|
|
10029
10032
|
} catch {
|
|
10030
10033
|
console.error(chalk106.red("jb is not installed. Install with:"));
|
|
10031
10034
|
console.error(
|
|
@@ -10039,7 +10042,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
10039
10042
|
const includeFlag = include ? ` --include="${include}"` : "";
|
|
10040
10043
|
const sweaFlag = swea ? " --swea" : "";
|
|
10041
10044
|
try {
|
|
10042
|
-
|
|
10045
|
+
execSync26(
|
|
10043
10046
|
`jb inspectcode "${slnPath}" -o="${reportPath}"${includeFlag}${sweaFlag} --verbosity=OFF`,
|
|
10044
10047
|
{ stdio: "pipe" }
|
|
10045
10048
|
);
|
|
@@ -10060,7 +10063,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
10060
10063
|
}
|
|
10061
10064
|
|
|
10062
10065
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
10063
|
-
import { execSync as
|
|
10066
|
+
import { execSync as execSync27 } from "child_process";
|
|
10064
10067
|
import chalk107 from "chalk";
|
|
10065
10068
|
function resolveMsbuildPath() {
|
|
10066
10069
|
const { run: run4 } = loadConfig();
|
|
@@ -10071,7 +10074,7 @@ function resolveMsbuildPath() {
|
|
|
10071
10074
|
function assertMsbuildInstalled() {
|
|
10072
10075
|
const msbuild = resolveMsbuildPath();
|
|
10073
10076
|
try {
|
|
10074
|
-
|
|
10077
|
+
execSync27(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
10075
10078
|
} catch {
|
|
10076
10079
|
console.error(chalk107.red(`msbuild not found at: ${msbuild}`));
|
|
10077
10080
|
console.error(
|
|
@@ -10097,7 +10100,7 @@ function runRoslynInspect(slnPath) {
|
|
|
10097
10100
|
const msbuild = resolveMsbuildPath();
|
|
10098
10101
|
let output;
|
|
10099
10102
|
try {
|
|
10100
|
-
output =
|
|
10103
|
+
output = execSync27(
|
|
10101
10104
|
`"${msbuild}" "${slnPath}" -t:Build -v:minimal -maxcpucount -p:EnforceCodeStyleInBuild=true -p:RunAnalyzersDuringBuild=true 2>&1`,
|
|
10102
10105
|
{ encoding: "utf-8", stdio: "pipe", maxBuffer: 50 * 1024 * 1024 }
|
|
10103
10106
|
);
|
|
@@ -10469,7 +10472,7 @@ function resolveLoadOptions(options2) {
|
|
|
10469
10472
|
}
|
|
10470
10473
|
|
|
10471
10474
|
// src/commands/handover/summarise.ts
|
|
10472
|
-
import { execFileSync as
|
|
10475
|
+
import { execFileSync as execFileSync5 } from "child_process";
|
|
10473
10476
|
|
|
10474
10477
|
// src/commands/sessions/summarise/iterateUserEntries.ts
|
|
10475
10478
|
import * as fs16 from "fs";
|
|
@@ -10534,7 +10537,7 @@ function summarise(jsonlPath2) {
|
|
|
10534
10537
|
const prompt = `${PROMPT_TEMPLATE}
|
|
10535
10538
|
${payload}`;
|
|
10536
10539
|
try {
|
|
10537
|
-
const output =
|
|
10540
|
+
const output = execFileSync5("claude", ["-p", "--model", "haiku", prompt], {
|
|
10538
10541
|
encoding: "utf8",
|
|
10539
10542
|
timeout: 3e4,
|
|
10540
10543
|
stdio: ["ignore", "pipe", "ignore"],
|
|
@@ -10675,12 +10678,12 @@ function adfToText(doc) {
|
|
|
10675
10678
|
}
|
|
10676
10679
|
|
|
10677
10680
|
// src/commands/jira/fetchIssue.ts
|
|
10678
|
-
import { execSync as
|
|
10681
|
+
import { execSync as execSync28 } from "child_process";
|
|
10679
10682
|
import chalk111 from "chalk";
|
|
10680
10683
|
function fetchIssue(issueKey, fields) {
|
|
10681
10684
|
let result;
|
|
10682
10685
|
try {
|
|
10683
|
-
result =
|
|
10686
|
+
result = execSync28(
|
|
10684
10687
|
`acli jira workitem view ${issueKey} -f ${fields} --json`,
|
|
10685
10688
|
{ encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
10686
10689
|
);
|
|
@@ -10726,7 +10729,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
10726
10729
|
}
|
|
10727
10730
|
|
|
10728
10731
|
// src/commands/jira/jiraAuth.ts
|
|
10729
|
-
import { execSync as
|
|
10732
|
+
import { execSync as execSync29 } from "child_process";
|
|
10730
10733
|
|
|
10731
10734
|
// src/shared/loadJson.ts
|
|
10732
10735
|
import { existsSync as existsSync33, mkdirSync as mkdirSync11, readFileSync as readFileSync27, writeFileSync as writeFileSync21 } from "fs";
|
|
@@ -10739,10 +10742,10 @@ function getStorePath(filename) {
|
|
|
10739
10742
|
return join32(getStoreDir(), filename);
|
|
10740
10743
|
}
|
|
10741
10744
|
function loadJson(filename) {
|
|
10742
|
-
const
|
|
10743
|
-
if (existsSync33(
|
|
10745
|
+
const path56 = getStorePath(filename);
|
|
10746
|
+
if (existsSync33(path56)) {
|
|
10744
10747
|
try {
|
|
10745
|
-
return JSON.parse(readFileSync27(
|
|
10748
|
+
return JSON.parse(readFileSync27(path56, "utf-8"));
|
|
10746
10749
|
} catch {
|
|
10747
10750
|
return {};
|
|
10748
10751
|
}
|
|
@@ -10790,7 +10793,7 @@ async function jiraAuth() {
|
|
|
10790
10793
|
console.error("All fields are required.");
|
|
10791
10794
|
process.exit(1);
|
|
10792
10795
|
}
|
|
10793
|
-
|
|
10796
|
+
execSync29(`acli jira auth login --site ${site} --email "${email}" --token`, {
|
|
10794
10797
|
encoding: "utf-8",
|
|
10795
10798
|
input: token,
|
|
10796
10799
|
stdio: ["pipe", "inherit", "inherit"]
|
|
@@ -10841,12 +10844,12 @@ function registerJira(program2) {
|
|
|
10841
10844
|
}
|
|
10842
10845
|
|
|
10843
10846
|
// src/commands/reviewComments.ts
|
|
10844
|
-
import { execFileSync as
|
|
10847
|
+
import { execFileSync as execFileSync6 } from "child_process";
|
|
10845
10848
|
import chalk114 from "chalk";
|
|
10846
10849
|
async function reviewComments(number) {
|
|
10847
10850
|
if (number) {
|
|
10848
10851
|
try {
|
|
10849
|
-
|
|
10852
|
+
execFileSync6("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
10850
10853
|
} catch {
|
|
10851
10854
|
console.error(chalk114.red(`gh pr checkout ${number} failed; aborting.`));
|
|
10852
10855
|
process.exit(1);
|
|
@@ -11085,7 +11088,7 @@ function registerPrompts(program2) {
|
|
|
11085
11088
|
}
|
|
11086
11089
|
|
|
11087
11090
|
// src/commands/prs/shared.ts
|
|
11088
|
-
import { execSync as
|
|
11091
|
+
import { execSync as execSync30 } from "child_process";
|
|
11089
11092
|
function isGhNotInstalled(error) {
|
|
11090
11093
|
if (error instanceof Error) {
|
|
11091
11094
|
const msg = error.message.toLowerCase();
|
|
@@ -11103,12 +11106,12 @@ function getRepoInfo() {
|
|
|
11103
11106
|
const preferred = getPreferredRemoteRepo();
|
|
11104
11107
|
if (preferred) return preferred;
|
|
11105
11108
|
const repoInfo = JSON.parse(
|
|
11106
|
-
|
|
11109
|
+
execSync30("gh repo view --json owner,name", { encoding: "utf-8" })
|
|
11107
11110
|
);
|
|
11108
11111
|
return { org: repoInfo.owner.login, repo: repoInfo.name };
|
|
11109
11112
|
}
|
|
11110
11113
|
function getCurrentBranch() {
|
|
11111
|
-
return
|
|
11114
|
+
return execSync30("git rev-parse --abbrev-ref HEAD", {
|
|
11112
11115
|
encoding: "utf-8"
|
|
11113
11116
|
}).trim();
|
|
11114
11117
|
}
|
|
@@ -11116,7 +11119,7 @@ function viewCurrentPr(fields) {
|
|
|
11116
11119
|
const { org, repo } = getRepoInfo();
|
|
11117
11120
|
const branch = getCurrentBranch();
|
|
11118
11121
|
return JSON.parse(
|
|
11119
|
-
|
|
11122
|
+
execSync30(`gh pr view ${branch} --json ${fields} -R ${org}/${repo}`, {
|
|
11120
11123
|
encoding: "utf-8"
|
|
11121
11124
|
})
|
|
11122
11125
|
);
|
|
@@ -11200,15 +11203,15 @@ function postComment(vars) {
|
|
|
11200
11203
|
const stdout = startLine === void 0 ? runGhGraphql(MUTATION_SINGLE, base) : runGhGraphql(MUTATION_MULTI, { ...base, startLine });
|
|
11201
11204
|
assertThreadCreated(stdout);
|
|
11202
11205
|
}
|
|
11203
|
-
function comment2(
|
|
11206
|
+
function comment2(path56, line, body, startLine) {
|
|
11204
11207
|
validateBody(body);
|
|
11205
11208
|
validateLine(line);
|
|
11206
11209
|
if (startLine !== void 0) validateLine(startLine);
|
|
11207
11210
|
try {
|
|
11208
11211
|
const prId = getCurrentPrNodeId();
|
|
11209
|
-
postComment({ prId, body, path:
|
|
11212
|
+
postComment({ prId, body, path: path56, line, startLine });
|
|
11210
11213
|
const range = startLine !== void 0 ? `${startLine}-${line}` : `${line}`;
|
|
11211
|
-
console.log(`Added review comment on ${
|
|
11214
|
+
console.log(`Added review comment on ${path56}:${range}`);
|
|
11212
11215
|
} catch (error) {
|
|
11213
11216
|
if (isGhNotInstalled(error)) {
|
|
11214
11217
|
console.error("Error: GitHub CLI (gh) is not installed.");
|
|
@@ -11220,7 +11223,7 @@ function comment2(path54, line, body, startLine) {
|
|
|
11220
11223
|
}
|
|
11221
11224
|
|
|
11222
11225
|
// src/commands/prs/edit.ts
|
|
11223
|
-
import { execSync as
|
|
11226
|
+
import { execSync as execSync31 } from "child_process";
|
|
11224
11227
|
|
|
11225
11228
|
// src/commands/prs/buildPrBody.ts
|
|
11226
11229
|
function jiraBrowseUrl(key) {
|
|
@@ -11346,17 +11349,17 @@ function edit(options2) {
|
|
|
11346
11349
|
if (options2.title) args.push(`--title ${shellQuote(options2.title)}`);
|
|
11347
11350
|
args.push(`--body ${shellQuote(newBody)}`);
|
|
11348
11351
|
try {
|
|
11349
|
-
|
|
11352
|
+
execSync31(args.join(" "), { stdio: "inherit" });
|
|
11350
11353
|
} catch (_error) {
|
|
11351
11354
|
process.exit(1);
|
|
11352
11355
|
}
|
|
11353
11356
|
}
|
|
11354
11357
|
|
|
11355
11358
|
// src/commands/prs/fixed.ts
|
|
11356
|
-
import { execSync as
|
|
11359
|
+
import { execSync as execSync33 } from "child_process";
|
|
11357
11360
|
|
|
11358
11361
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
11359
|
-
import { execSync as
|
|
11362
|
+
import { execSync as execSync32 } from "child_process";
|
|
11360
11363
|
import { unlinkSync as unlinkSync10, writeFileSync as writeFileSync23 } from "fs";
|
|
11361
11364
|
import { tmpdir as tmpdir5 } from "os";
|
|
11362
11365
|
import { join as join34 } from "path";
|
|
@@ -11386,7 +11389,7 @@ function deleteCommentsCache(prNumber) {
|
|
|
11386
11389
|
|
|
11387
11390
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
11388
11391
|
function replyToComment(org, repo, prNumber, commentId, message) {
|
|
11389
|
-
|
|
11392
|
+
execSync32(
|
|
11390
11393
|
`gh api repos/${org}/${repo}/pulls/${prNumber}/comments -f body="${message.replace(/"/g, '\\"')}" -F in_reply_to=${commentId}`,
|
|
11391
11394
|
{ stdio: ["inherit", "pipe", "inherit"] }
|
|
11392
11395
|
);
|
|
@@ -11396,7 +11399,7 @@ function resolveThread(threadId) {
|
|
|
11396
11399
|
const queryFile = join34(tmpdir5(), `gh-mutation-${Date.now()}.graphql`);
|
|
11397
11400
|
writeFileSync23(queryFile, mutation);
|
|
11398
11401
|
try {
|
|
11399
|
-
|
|
11402
|
+
execSync32(
|
|
11400
11403
|
`gh api graphql -F query=@${queryFile} -f threadId="${threadId}"`,
|
|
11401
11404
|
{ stdio: ["inherit", "pipe", "inherit"] }
|
|
11402
11405
|
);
|
|
@@ -11448,7 +11451,7 @@ function resolveCommentWithReply(commentId, message) {
|
|
|
11448
11451
|
// src/commands/prs/fixed.ts
|
|
11449
11452
|
function verifySha(sha) {
|
|
11450
11453
|
try {
|
|
11451
|
-
return
|
|
11454
|
+
return execSync33(`git rev-parse --verify ${sha}`, {
|
|
11452
11455
|
encoding: "utf-8"
|
|
11453
11456
|
}).trim();
|
|
11454
11457
|
} catch {
|
|
@@ -11462,7 +11465,7 @@ function fixed(commentId, sha) {
|
|
|
11462
11465
|
const { org, repo } = getRepoInfo();
|
|
11463
11466
|
const repoUrl = `https://github.com/${org}/${repo}`;
|
|
11464
11467
|
const message = `Fixed in [${fullSha}](${repoUrl}/commit/${fullSha})`;
|
|
11465
|
-
|
|
11468
|
+
execSync33("git push", { stdio: "inherit" });
|
|
11466
11469
|
resolveCommentWithReply(commentId, message);
|
|
11467
11470
|
} catch (error) {
|
|
11468
11471
|
if (isGhNotInstalled(error)) {
|
|
@@ -11480,7 +11483,7 @@ import { join as join36 } from "path";
|
|
|
11480
11483
|
import { stringify } from "yaml";
|
|
11481
11484
|
|
|
11482
11485
|
// src/commands/prs/fetchThreadIds.ts
|
|
11483
|
-
import { execSync as
|
|
11486
|
+
import { execSync as execSync34 } from "child_process";
|
|
11484
11487
|
import { unlinkSync as unlinkSync11, writeFileSync as writeFileSync24 } from "fs";
|
|
11485
11488
|
import { tmpdir as tmpdir6 } from "os";
|
|
11486
11489
|
import { join as join35 } from "path";
|
|
@@ -11489,7 +11492,7 @@ function fetchThreadIds(org, repo, prNumber) {
|
|
|
11489
11492
|
const queryFile = join35(tmpdir6(), `gh-query-${Date.now()}.graphql`);
|
|
11490
11493
|
writeFileSync24(queryFile, THREAD_QUERY);
|
|
11491
11494
|
try {
|
|
11492
|
-
const result =
|
|
11495
|
+
const result = execSync34(
|
|
11493
11496
|
`gh api graphql -F query=@${queryFile} -F owner="${org}" -F repo="${repo}" -F prNumber=${prNumber}`,
|
|
11494
11497
|
{ encoding: "utf-8" }
|
|
11495
11498
|
);
|
|
@@ -11511,9 +11514,9 @@ function fetchThreadIds(org, repo, prNumber) {
|
|
|
11511
11514
|
}
|
|
11512
11515
|
|
|
11513
11516
|
// src/commands/prs/listComments/fetchReviewComments.ts
|
|
11514
|
-
import { execSync as
|
|
11517
|
+
import { execSync as execSync35 } from "child_process";
|
|
11515
11518
|
function fetchJson(endpoint) {
|
|
11516
|
-
const result =
|
|
11519
|
+
const result = execSync35(`gh api --paginate ${endpoint}`, {
|
|
11517
11520
|
encoding: "utf-8"
|
|
11518
11521
|
});
|
|
11519
11522
|
if (!result.trim()) return [];
|
|
@@ -11652,7 +11655,7 @@ async function listComments() {
|
|
|
11652
11655
|
}
|
|
11653
11656
|
|
|
11654
11657
|
// src/commands/prs/prs/index.ts
|
|
11655
|
-
import { execSync as
|
|
11658
|
+
import { execSync as execSync36 } from "child_process";
|
|
11656
11659
|
|
|
11657
11660
|
// src/commands/prs/prs/displayPaginated/index.ts
|
|
11658
11661
|
import enquirer9 from "enquirer";
|
|
@@ -11759,7 +11762,7 @@ async function prs(options2) {
|
|
|
11759
11762
|
const state = options2.open ? "open" : options2.closed ? "closed" : "all";
|
|
11760
11763
|
try {
|
|
11761
11764
|
const { org, repo } = getRepoInfo();
|
|
11762
|
-
const result =
|
|
11765
|
+
const result = execSync36(
|
|
11763
11766
|
`gh pr list --state ${state} --json number,title,url,author,createdAt,mergedAt,closedAt,state,changedFiles --limit 100 -R ${org}/${repo}`,
|
|
11764
11767
|
{ encoding: "utf-8" }
|
|
11765
11768
|
);
|
|
@@ -11782,7 +11785,7 @@ async function prs(options2) {
|
|
|
11782
11785
|
}
|
|
11783
11786
|
|
|
11784
11787
|
// src/commands/prs/raise.ts
|
|
11785
|
-
import { execSync as
|
|
11788
|
+
import { execSync as execSync37 } from "child_process";
|
|
11786
11789
|
|
|
11787
11790
|
// src/commands/prs/buildCreateArgs.ts
|
|
11788
11791
|
function buildCreateArgs(title, body, options2) {
|
|
@@ -11842,14 +11845,14 @@ function raise(options2) {
|
|
|
11842
11845
|
`--body ${shellQuote(body)}`
|
|
11843
11846
|
] : buildCreateArgs(options2.title, body, options2);
|
|
11844
11847
|
try {
|
|
11845
|
-
|
|
11848
|
+
execSync37(args.join(" "), { stdio: "inherit" });
|
|
11846
11849
|
} catch (_error) {
|
|
11847
11850
|
process.exit(1);
|
|
11848
11851
|
}
|
|
11849
11852
|
}
|
|
11850
11853
|
|
|
11851
11854
|
// src/commands/prs/wontfix.ts
|
|
11852
|
-
import { execSync as
|
|
11855
|
+
import { execSync as execSync38 } from "child_process";
|
|
11853
11856
|
function validateReason(reason) {
|
|
11854
11857
|
const lowerReason = reason.toLowerCase();
|
|
11855
11858
|
if (lowerReason.includes("claude") || lowerReason.includes("opus")) {
|
|
@@ -11866,7 +11869,7 @@ function validateShaReferences(reason) {
|
|
|
11866
11869
|
const invalidShas = [];
|
|
11867
11870
|
for (const sha of shas) {
|
|
11868
11871
|
try {
|
|
11869
|
-
|
|
11872
|
+
execSync38(`git cat-file -t ${sha}`, { stdio: "pipe" });
|
|
11870
11873
|
} catch {
|
|
11871
11874
|
invalidShas.push(sha);
|
|
11872
11875
|
}
|
|
@@ -11950,8 +11953,8 @@ function registerPrs(program2) {
|
|
|
11950
11953
|
prsCommand.command("wontfix <comment-id> <reason>").description("Reply with reason and resolve thread").action((commentId, reason) => {
|
|
11951
11954
|
wontfix(Number.parseInt(commentId, 10), reason);
|
|
11952
11955
|
});
|
|
11953
|
-
prsCommand.command("comment <path> <line> <body>").description("Add a line comment to the pending review").action((
|
|
11954
|
-
comment2(
|
|
11956
|
+
prsCommand.command("comment <path> <line> <body>").description("Add a line comment to the pending review").action((path56, line, body) => {
|
|
11957
|
+
comment2(path56, Number.parseInt(line, 10), body);
|
|
11955
11958
|
});
|
|
11956
11959
|
}
|
|
11957
11960
|
|
|
@@ -12025,10 +12028,10 @@ import chalk124 from "chalk";
|
|
|
12025
12028
|
import Enquirer2 from "enquirer";
|
|
12026
12029
|
|
|
12027
12030
|
// src/commands/ravendb/searchItems.ts
|
|
12028
|
-
import { execSync as
|
|
12031
|
+
import { execSync as execSync39 } from "child_process";
|
|
12029
12032
|
import chalk123 from "chalk";
|
|
12030
12033
|
function opExec(args) {
|
|
12031
|
-
return
|
|
12034
|
+
return execSync39(`op ${args}`, {
|
|
12032
12035
|
encoding: "utf-8",
|
|
12033
12036
|
stdio: ["pipe", "pipe", "pipe"]
|
|
12034
12037
|
}).trim();
|
|
@@ -12180,7 +12183,7 @@ ${errorText}`
|
|
|
12180
12183
|
}
|
|
12181
12184
|
|
|
12182
12185
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
12183
|
-
import { execSync as
|
|
12186
|
+
import { execSync as execSync40 } from "child_process";
|
|
12184
12187
|
import chalk128 from "chalk";
|
|
12185
12188
|
function resolveOpSecret(reference) {
|
|
12186
12189
|
if (!reference.startsWith("op://")) {
|
|
@@ -12188,7 +12191,7 @@ function resolveOpSecret(reference) {
|
|
|
12188
12191
|
process.exit(1);
|
|
12189
12192
|
}
|
|
12190
12193
|
try {
|
|
12191
|
-
return
|
|
12194
|
+
return execSync40(`op read "${reference}"`, {
|
|
12192
12195
|
encoding: "utf-8",
|
|
12193
12196
|
stdio: ["pipe", "pipe", "pipe"]
|
|
12194
12197
|
}).trim();
|
|
@@ -12203,10 +12206,10 @@ function resolveOpSecret(reference) {
|
|
|
12203
12206
|
}
|
|
12204
12207
|
|
|
12205
12208
|
// src/commands/ravendb/ravenFetch.ts
|
|
12206
|
-
async function ravenFetch(connection,
|
|
12209
|
+
async function ravenFetch(connection, path56) {
|
|
12207
12210
|
const apiKey = resolveOpSecret(connection.apiKeyRef);
|
|
12208
12211
|
let accessToken = await getAccessToken(apiKey);
|
|
12209
|
-
const url = `${connection.url}${
|
|
12212
|
+
const url = `${connection.url}${path56}`;
|
|
12210
12213
|
const headers = {
|
|
12211
12214
|
Authorization: `Bearer ${accessToken}`,
|
|
12212
12215
|
"Content-Type": "application/json"
|
|
@@ -12296,16 +12299,16 @@ import chalk132 from "chalk";
|
|
|
12296
12299
|
// src/commands/ravendb/buildQueryPath.ts
|
|
12297
12300
|
function buildQueryPath(opts) {
|
|
12298
12301
|
const db = encodeURIComponent(opts.db);
|
|
12299
|
-
let
|
|
12302
|
+
let path56;
|
|
12300
12303
|
if (opts.collection) {
|
|
12301
|
-
|
|
12304
|
+
path56 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
|
|
12302
12305
|
} else {
|
|
12303
|
-
|
|
12306
|
+
path56 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
|
|
12304
12307
|
}
|
|
12305
12308
|
if (opts.query) {
|
|
12306
|
-
|
|
12309
|
+
path56 += `&query=${encodeURIComponent(opts.query)}`;
|
|
12307
12310
|
}
|
|
12308
|
-
return
|
|
12311
|
+
return path56;
|
|
12309
12312
|
}
|
|
12310
12313
|
|
|
12311
12314
|
// src/commands/ravendb/fetchAllPages.ts
|
|
@@ -12314,7 +12317,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
12314
12317
|
let start3 = 0;
|
|
12315
12318
|
while (true) {
|
|
12316
12319
|
const effectivePageSize = opts.limit !== void 0 ? Math.min(opts.pageSize, opts.limit - allResults.length) : opts.pageSize;
|
|
12317
|
-
const
|
|
12320
|
+
const path56 = buildQueryPath({
|
|
12318
12321
|
db: connection.database,
|
|
12319
12322
|
collection: opts.collection,
|
|
12320
12323
|
start: start3,
|
|
@@ -12322,7 +12325,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
12322
12325
|
sort: opts.sort,
|
|
12323
12326
|
query: opts.query
|
|
12324
12327
|
});
|
|
12325
|
-
const data = await ravenFetch(connection,
|
|
12328
|
+
const data = await ravenFetch(connection, path56);
|
|
12326
12329
|
const results = data.Results ?? [];
|
|
12327
12330
|
const totalResults = data.TotalResults ?? 0;
|
|
12328
12331
|
if (results.length === 0) break;
|
|
@@ -12437,7 +12440,7 @@ Refactor check failed:
|
|
|
12437
12440
|
}
|
|
12438
12441
|
|
|
12439
12442
|
// src/commands/refactor/check/getViolations/index.ts
|
|
12440
|
-
import { execSync as
|
|
12443
|
+
import { execSync as execSync41 } from "child_process";
|
|
12441
12444
|
import fs18 from "fs";
|
|
12442
12445
|
import { minimatch as minimatch5 } from "minimatch";
|
|
12443
12446
|
|
|
@@ -12487,7 +12490,7 @@ function getGitFiles(options2) {
|
|
|
12487
12490
|
}
|
|
12488
12491
|
const files = /* @__PURE__ */ new Set();
|
|
12489
12492
|
if (options2.staged || options2.modified) {
|
|
12490
|
-
const staged =
|
|
12493
|
+
const staged = execSync41("git diff --cached --name-only", {
|
|
12491
12494
|
encoding: "utf-8"
|
|
12492
12495
|
});
|
|
12493
12496
|
for (const file of staged.trim().split("\n").filter(Boolean)) {
|
|
@@ -12495,7 +12498,7 @@ function getGitFiles(options2) {
|
|
|
12495
12498
|
}
|
|
12496
12499
|
}
|
|
12497
12500
|
if (options2.unstaged || options2.modified) {
|
|
12498
|
-
const unstaged =
|
|
12501
|
+
const unstaged = execSync41("git diff --name-only", { encoding: "utf-8" });
|
|
12499
12502
|
for (const file of unstaged.trim().split("\n").filter(Boolean)) {
|
|
12500
12503
|
files.add(file);
|
|
12501
12504
|
}
|
|
@@ -13326,99 +13329,130 @@ function ignore(file) {
|
|
|
13326
13329
|
}
|
|
13327
13330
|
|
|
13328
13331
|
// src/commands/refactor/rename/index.ts
|
|
13329
|
-
import
|
|
13332
|
+
import fs23 from "fs";
|
|
13333
|
+
import path38 from "path";
|
|
13334
|
+
import chalk141 from "chalk";
|
|
13335
|
+
|
|
13336
|
+
// src/commands/refactor/rename/applyRename.ts
|
|
13337
|
+
import fs22 from "fs";
|
|
13338
|
+
import path35 from "path";
|
|
13330
13339
|
import chalk139 from "chalk";
|
|
13331
|
-
async function rename(source, destination, options2 = {}) {
|
|
13332
|
-
const destPath = path34.resolve(destination);
|
|
13333
|
-
const cwd = process.cwd();
|
|
13334
|
-
const relSource = path34.relative(cwd, path34.resolve(source));
|
|
13335
|
-
const relDest = path34.relative(cwd, destPath);
|
|
13336
|
-
const { project, sourceFile } = loadProjectFile(source);
|
|
13337
|
-
console.log(chalk139.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
13338
|
-
if (options2.apply) {
|
|
13339
|
-
sourceFile.move(destPath);
|
|
13340
|
-
await project.save();
|
|
13341
|
-
console.log(chalk139.green("Done"));
|
|
13342
|
-
} else {
|
|
13343
|
-
console.log(chalk139.dim("Dry run. Use --apply to execute."));
|
|
13344
|
-
}
|
|
13345
|
-
}
|
|
13346
13340
|
|
|
13347
|
-
// src/commands/refactor/
|
|
13348
|
-
import
|
|
13341
|
+
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
13342
|
+
import path34 from "path";
|
|
13349
13343
|
|
|
13350
|
-
// src/commands/refactor/
|
|
13351
|
-
import
|
|
13352
|
-
|
|
13353
|
-
|
|
13354
|
-
|
|
13355
|
-
|
|
13356
|
-
SyntaxKind14.InterfaceDeclaration,
|
|
13357
|
-
SyntaxKind14.TypeAliasDeclaration,
|
|
13358
|
-
SyntaxKind14.EnumDeclaration,
|
|
13359
|
-
SyntaxKind14.PropertyDeclaration,
|
|
13360
|
-
SyntaxKind14.MethodDeclaration,
|
|
13361
|
-
SyntaxKind14.Parameter
|
|
13362
|
-
];
|
|
13363
|
-
function isDeclaration(identifier) {
|
|
13364
|
-
const parent = identifier.getParent();
|
|
13365
|
-
return parent !== void 0 && declarationKinds.includes(parent.getKind());
|
|
13344
|
+
// src/commands/refactor/restructure/computeRewrites/applyRewrites.ts
|
|
13345
|
+
import fs21 from "fs";
|
|
13346
|
+
function getOrCreateList(map, key) {
|
|
13347
|
+
const list4 = map.get(key) ?? [];
|
|
13348
|
+
if (!map.has(key)) map.set(key, list4);
|
|
13349
|
+
return list4;
|
|
13366
13350
|
}
|
|
13367
|
-
function
|
|
13368
|
-
|
|
13369
|
-
|
|
13351
|
+
function groupByFile2(rewrites) {
|
|
13352
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
13353
|
+
for (const rewrite of rewrites) {
|
|
13354
|
+
getOrCreateList(grouped, rewrite.file).push(rewrite);
|
|
13370
13355
|
}
|
|
13371
|
-
return
|
|
13356
|
+
return grouped;
|
|
13357
|
+
}
|
|
13358
|
+
function rewriteSpecifier(content, oldSpecifier, newSpecifier) {
|
|
13359
|
+
const escaped = oldSpecifier.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
13360
|
+
const pattern2 = new RegExp(`(from\\s+["'])${escaped}(["'])`, "g");
|
|
13361
|
+
return content.replace(pattern2, `$1${newSpecifier}$2`);
|
|
13362
|
+
}
|
|
13363
|
+
function applyFileRewrites(file, fileRewrites) {
|
|
13364
|
+
let content = fs21.readFileSync(file, "utf-8");
|
|
13365
|
+
for (const { oldSpecifier, newSpecifier } of fileRewrites) {
|
|
13366
|
+
content = rewriteSpecifier(content, oldSpecifier, newSpecifier);
|
|
13367
|
+
}
|
|
13368
|
+
return content;
|
|
13369
|
+
}
|
|
13370
|
+
function applyRewrites(rewrites) {
|
|
13371
|
+
const updatedContents = /* @__PURE__ */ new Map();
|
|
13372
|
+
for (const [file, fileRewrites] of groupByFile2(rewrites)) {
|
|
13373
|
+
updatedContents.set(file, applyFileRewrites(file, fileRewrites));
|
|
13374
|
+
}
|
|
13375
|
+
return updatedContents;
|
|
13372
13376
|
}
|
|
13373
13377
|
|
|
13374
|
-
// src/commands/refactor/
|
|
13375
|
-
|
|
13376
|
-
|
|
13377
|
-
const
|
|
13378
|
-
|
|
13379
|
-
|
|
13380
|
-
|
|
13381
|
-
|
|
13382
|
-
|
|
13383
|
-
|
|
13378
|
+
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
13379
|
+
function buildMoveMap(moves) {
|
|
13380
|
+
const map = /* @__PURE__ */ new Map();
|
|
13381
|
+
for (const move of moves) map.set(move.from, move.to);
|
|
13382
|
+
return map;
|
|
13383
|
+
}
|
|
13384
|
+
function stripTrailingIndex(specifier) {
|
|
13385
|
+
return specifier.endsWith("/index") ? specifier.slice(0, -"/index".length) : specifier;
|
|
13386
|
+
}
|
|
13387
|
+
function ensureRelative(specifier) {
|
|
13388
|
+
return specifier.startsWith(".") ? specifier : `./${specifier}`;
|
|
13389
|
+
}
|
|
13390
|
+
function normalizeSpecifier(rel) {
|
|
13391
|
+
return ensureRelative(
|
|
13392
|
+
stripTrailingIndex(rel.replace(/\\/g, "/").replace(/\.tsx?$/, ""))
|
|
13393
|
+
);
|
|
13394
|
+
}
|
|
13395
|
+
function computeSpecifier(fromFile, toFile) {
|
|
13396
|
+
return normalizeSpecifier(path34.relative(path34.dirname(fromFile), toFile));
|
|
13397
|
+
}
|
|
13398
|
+
function isAffected(edge, moveMap) {
|
|
13399
|
+
return moveMap.has(edge.target) || moveMap.has(edge.source);
|
|
13400
|
+
}
|
|
13401
|
+
function resolveTarget(edge, moveMap) {
|
|
13402
|
+
return moveMap.get(edge.target) ?? edge.target;
|
|
13403
|
+
}
|
|
13404
|
+
function createRewrite(edge, newSpecifier) {
|
|
13405
|
+
return { file: edge.source, oldSpecifier: edge.specifier, newSpecifier };
|
|
13406
|
+
}
|
|
13407
|
+
function rewriteIfChanged(edge, newSpecifier) {
|
|
13408
|
+
return newSpecifier === edge.specifier ? null : createRewrite(edge, newSpecifier);
|
|
13409
|
+
}
|
|
13410
|
+
function rewriteEdge(edge, newFile, moveMap) {
|
|
13411
|
+
if (!isAffected(edge, moveMap)) return null;
|
|
13412
|
+
return rewriteIfChanged(
|
|
13413
|
+
edge,
|
|
13414
|
+
computeSpecifier(newFile, resolveTarget(edge, moveMap))
|
|
13415
|
+
);
|
|
13416
|
+
}
|
|
13417
|
+
function fileEdges(edges, file) {
|
|
13418
|
+
return edges.filter((e) => e.source === file);
|
|
13419
|
+
}
|
|
13420
|
+
function collectRewrites(edges, newFile, moveMap) {
|
|
13421
|
+
const rewrites = [];
|
|
13422
|
+
for (const edge of edges) {
|
|
13423
|
+
const rewrite = rewriteEdge(edge, newFile, moveMap);
|
|
13424
|
+
if (rewrite) rewrites.push(rewrite);
|
|
13384
13425
|
}
|
|
13385
|
-
return
|
|
13426
|
+
return rewrites;
|
|
13427
|
+
}
|
|
13428
|
+
function rewriteEdgesForFile(file, edges, moveMap) {
|
|
13429
|
+
const newFile = moveMap.get(file) ?? file;
|
|
13430
|
+
return collectRewrites(fileEdges(edges, file), newFile, moveMap);
|
|
13431
|
+
}
|
|
13432
|
+
function computeRewrites(moves, edges, allProjectFiles) {
|
|
13433
|
+
const moveMap = buildMoveMap(moves);
|
|
13434
|
+
return [...allProjectFiles].flatMap(
|
|
13435
|
+
(file) => rewriteEdgesForFile(file, edges, moveMap)
|
|
13436
|
+
);
|
|
13386
13437
|
}
|
|
13387
13438
|
|
|
13388
|
-
// src/commands/refactor/
|
|
13389
|
-
|
|
13390
|
-
const
|
|
13391
|
-
const
|
|
13392
|
-
|
|
13393
|
-
|
|
13394
|
-
console.log(chalk140.red(`Symbol "${oldName}" not found in ${file}`));
|
|
13395
|
-
process.exit(1);
|
|
13439
|
+
// src/commands/refactor/rename/applyRename.ts
|
|
13440
|
+
function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
13441
|
+
const updatedContents = applyRewrites(rewrites);
|
|
13442
|
+
for (const [file, content] of updatedContents) {
|
|
13443
|
+
fs22.writeFileSync(file, content, "utf-8");
|
|
13444
|
+
console.log(chalk139.cyan(` Updated imports in ${path35.relative(cwd, file)}`));
|
|
13396
13445
|
}
|
|
13397
|
-
const
|
|
13398
|
-
|
|
13446
|
+
const destDir = path35.dirname(destPath);
|
|
13447
|
+
if (!fs22.existsSync(destDir)) fs22.mkdirSync(destDir, { recursive: true });
|
|
13448
|
+
fs22.renameSync(sourcePath, destPath);
|
|
13399
13449
|
console.log(
|
|
13400
|
-
|
|
13401
|
-
`)
|
|
13450
|
+
chalk139.white(
|
|
13451
|
+
` Moved ${path35.relative(cwd, sourcePath)} \u2192 ${path35.relative(cwd, destPath)}`
|
|
13452
|
+
)
|
|
13402
13453
|
);
|
|
13403
|
-
for (const [refFile, lines] of grouped) {
|
|
13404
|
-
console.log(
|
|
13405
|
-
` ${chalk140.dim(refFile)}: lines ${chalk140.cyan(lines.join(", "))}`
|
|
13406
|
-
);
|
|
13407
|
-
}
|
|
13408
|
-
if (options2.apply) {
|
|
13409
|
-
symbol.rename(newName);
|
|
13410
|
-
await project.save();
|
|
13411
|
-
console.log(chalk140.green(`
|
|
13412
|
-
Renamed ${oldName} \u2192 ${newName}`));
|
|
13413
|
-
} else {
|
|
13414
|
-
console.log(chalk140.dim("\nDry run. Use --apply to execute."));
|
|
13415
|
-
}
|
|
13416
13454
|
}
|
|
13417
13455
|
|
|
13418
|
-
// src/commands/refactor/restructure/index.ts
|
|
13419
|
-
import path44 from "path";
|
|
13420
|
-
import chalk143 from "chalk";
|
|
13421
|
-
|
|
13422
13456
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
13423
13457
|
import path36 from "path";
|
|
13424
13458
|
import ts7 from "typescript";
|
|
@@ -13485,54 +13519,189 @@ function buildImportGraph(candidateFiles, tsConfigPath) {
|
|
|
13485
13519
|
return { files: candidateFiles, edges, importedBy, imports };
|
|
13486
13520
|
}
|
|
13487
13521
|
|
|
13488
|
-
// src/commands/refactor/
|
|
13522
|
+
// src/commands/refactor/rename/computeRenameRewrites.ts
|
|
13523
|
+
function computeRenameRewrites(sourcePath, destPath) {
|
|
13524
|
+
const tsConfigPath = findTsConfig(sourcePath);
|
|
13525
|
+
const graph = buildImportGraph(/* @__PURE__ */ new Set([sourcePath]), tsConfigPath);
|
|
13526
|
+
const allProjectFiles = /* @__PURE__ */ new Set([
|
|
13527
|
+
...graph.importedBy.keys(),
|
|
13528
|
+
...graph.imports.keys(),
|
|
13529
|
+
sourcePath
|
|
13530
|
+
]);
|
|
13531
|
+
const move = { from: sourcePath, to: destPath, reason: "rename" };
|
|
13532
|
+
return computeRewrites([move], graph.edges, allProjectFiles);
|
|
13533
|
+
}
|
|
13534
|
+
|
|
13535
|
+
// src/commands/refactor/rename/printRenamePreview.ts
|
|
13489
13536
|
import path37 from "path";
|
|
13490
|
-
|
|
13491
|
-
|
|
13492
|
-
for (const
|
|
13493
|
-
|
|
13494
|
-
|
|
13495
|
-
|
|
13496
|
-
|
|
13497
|
-
|
|
13498
|
-
if (!dirImportedBy.has(targetDir)) dirImportedBy.set(targetDir, existing);
|
|
13499
|
-
existing.add(sourceDir);
|
|
13500
|
-
}
|
|
13501
|
-
const clusters = /* @__PURE__ */ new Map();
|
|
13502
|
-
for (const [dir, importers] of dirImportedBy) {
|
|
13503
|
-
if (importers.size !== 1) continue;
|
|
13504
|
-
const parentDir = [...importers][0];
|
|
13505
|
-
if (isAncestor(dir, parentDir)) continue;
|
|
13506
|
-
if (isAncestor(parentDir, dir)) continue;
|
|
13507
|
-
const cluster = clusters.get(parentDir) ?? [];
|
|
13508
|
-
if (!clusters.has(parentDir)) clusters.set(parentDir, cluster);
|
|
13509
|
-
cluster.push(dir);
|
|
13510
|
-
}
|
|
13511
|
-
for (const [parentDir, children] of clusters) {
|
|
13512
|
-
const filtered = children.filter((child) => !clusters.has(child));
|
|
13513
|
-
if (filtered.length === 0) {
|
|
13514
|
-
clusters.delete(parentDir);
|
|
13515
|
-
} else {
|
|
13516
|
-
clusters.set(parentDir, filtered);
|
|
13517
|
-
}
|
|
13537
|
+
import chalk140 from "chalk";
|
|
13538
|
+
function printRenamePreview(rewrites, cwd) {
|
|
13539
|
+
for (const rewrite of rewrites) {
|
|
13540
|
+
console.log(
|
|
13541
|
+
chalk140.dim(
|
|
13542
|
+
` ${path37.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
13543
|
+
)
|
|
13544
|
+
);
|
|
13518
13545
|
}
|
|
13519
|
-
|
|
13546
|
+
console.log(chalk140.dim("Dry run. Use --apply to execute."));
|
|
13520
13547
|
}
|
|
13521
|
-
|
|
13522
|
-
|
|
13548
|
+
|
|
13549
|
+
// src/commands/refactor/rename/index.ts
|
|
13550
|
+
async function rename(source, destination, options2 = {}) {
|
|
13551
|
+
const sourcePath = path38.resolve(source);
|
|
13552
|
+
const destPath = path38.resolve(destination);
|
|
13553
|
+
const cwd = process.cwd();
|
|
13554
|
+
const relSource = path38.relative(cwd, sourcePath);
|
|
13555
|
+
const relDest = path38.relative(cwd, destPath);
|
|
13556
|
+
if (!fs23.existsSync(sourcePath)) {
|
|
13557
|
+
console.log(chalk141.red(`File not found: ${source}`));
|
|
13558
|
+
process.exit(1);
|
|
13559
|
+
}
|
|
13560
|
+
if (destPath !== sourcePath && fs23.existsSync(destPath)) {
|
|
13561
|
+
console.log(chalk141.red(`Destination already exists: ${destination}`));
|
|
13562
|
+
process.exit(1);
|
|
13563
|
+
}
|
|
13564
|
+
console.log(chalk141.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
13565
|
+
console.log(chalk141.dim("Loading project..."));
|
|
13566
|
+
console.log(chalk141.dim("Scanning imports across the project..."));
|
|
13567
|
+
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
13568
|
+
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
13569
|
+
console.log(
|
|
13570
|
+
chalk141.dim(
|
|
13571
|
+
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
13572
|
+
)
|
|
13573
|
+
);
|
|
13574
|
+
if (!options2.apply) {
|
|
13575
|
+
printRenamePreview(rewrites, cwd);
|
|
13576
|
+
return;
|
|
13577
|
+
}
|
|
13578
|
+
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
13579
|
+
console.log(chalk141.green("Done"));
|
|
13580
|
+
}
|
|
13581
|
+
|
|
13582
|
+
// src/commands/refactor/renameSymbol/index.ts
|
|
13583
|
+
import chalk142 from "chalk";
|
|
13584
|
+
|
|
13585
|
+
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
13586
|
+
import { SyntaxKind as SyntaxKind14 } from "ts-morph";
|
|
13587
|
+
var declarationKinds = [
|
|
13588
|
+
SyntaxKind14.VariableDeclaration,
|
|
13589
|
+
SyntaxKind14.FunctionDeclaration,
|
|
13590
|
+
SyntaxKind14.ClassDeclaration,
|
|
13591
|
+
SyntaxKind14.InterfaceDeclaration,
|
|
13592
|
+
SyntaxKind14.TypeAliasDeclaration,
|
|
13593
|
+
SyntaxKind14.EnumDeclaration,
|
|
13594
|
+
SyntaxKind14.PropertyDeclaration,
|
|
13595
|
+
SyntaxKind14.MethodDeclaration,
|
|
13596
|
+
SyntaxKind14.Parameter
|
|
13597
|
+
];
|
|
13598
|
+
function isDeclaration(identifier) {
|
|
13599
|
+
const parent = identifier.getParent();
|
|
13600
|
+
return parent !== void 0 && declarationKinds.includes(parent.getKind());
|
|
13601
|
+
}
|
|
13602
|
+
function findSymbol(sourceFile, symbolName) {
|
|
13603
|
+
for (const id of sourceFile.getDescendantsOfKind(SyntaxKind14.Identifier)) {
|
|
13604
|
+
if (id.getText() === symbolName && isDeclaration(id)) return id;
|
|
13605
|
+
}
|
|
13606
|
+
return void 0;
|
|
13607
|
+
}
|
|
13608
|
+
|
|
13609
|
+
// src/commands/refactor/renameSymbol/groupReferences.ts
|
|
13610
|
+
import path39 from "path";
|
|
13611
|
+
function groupReferences(symbol, cwd) {
|
|
13612
|
+
const refs = symbol.findReferencesAsNodes();
|
|
13613
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
13614
|
+
for (const ref of refs) {
|
|
13615
|
+
const refFile = path39.relative(cwd, ref.getSourceFile().getFilePath());
|
|
13616
|
+
const lines = grouped.get(refFile) ?? [];
|
|
13617
|
+
if (!grouped.has(refFile)) grouped.set(refFile, lines);
|
|
13618
|
+
lines.push(ref.getStartLineNumber());
|
|
13619
|
+
}
|
|
13620
|
+
return grouped;
|
|
13621
|
+
}
|
|
13622
|
+
|
|
13623
|
+
// src/commands/refactor/renameSymbol/index.ts
|
|
13624
|
+
async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
13625
|
+
const cwd = process.cwd();
|
|
13626
|
+
const { project, sourceFile } = loadProjectFile(file);
|
|
13627
|
+
const symbol = findSymbol(sourceFile, oldName);
|
|
13628
|
+
if (!symbol) {
|
|
13629
|
+
console.log(chalk142.red(`Symbol "${oldName}" not found in ${file}`));
|
|
13630
|
+
process.exit(1);
|
|
13631
|
+
}
|
|
13632
|
+
const grouped = groupReferences(symbol, cwd);
|
|
13633
|
+
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
13634
|
+
console.log(
|
|
13635
|
+
chalk142.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
13636
|
+
`)
|
|
13637
|
+
);
|
|
13638
|
+
for (const [refFile, lines] of grouped) {
|
|
13639
|
+
console.log(
|
|
13640
|
+
` ${chalk142.dim(refFile)}: lines ${chalk142.cyan(lines.join(", "))}`
|
|
13641
|
+
);
|
|
13642
|
+
}
|
|
13643
|
+
if (options2.apply) {
|
|
13644
|
+
symbol.rename(newName);
|
|
13645
|
+
await project.save();
|
|
13646
|
+
console.log(chalk142.green(`
|
|
13647
|
+
Renamed ${oldName} \u2192 ${newName}`));
|
|
13648
|
+
} else {
|
|
13649
|
+
console.log(chalk142.dim("\nDry run. Use --apply to execute."));
|
|
13650
|
+
}
|
|
13651
|
+
}
|
|
13652
|
+
|
|
13653
|
+
// src/commands/refactor/restructure/index.ts
|
|
13654
|
+
import path46 from "path";
|
|
13655
|
+
import chalk145 from "chalk";
|
|
13656
|
+
|
|
13657
|
+
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
13658
|
+
import path40 from "path";
|
|
13659
|
+
function clusterDirectories(graph) {
|
|
13660
|
+
const dirImportedBy = /* @__PURE__ */ new Map();
|
|
13661
|
+
for (const edge of graph.edges) {
|
|
13662
|
+
const sourceDir = path40.dirname(edge.source);
|
|
13663
|
+
const targetDir = path40.dirname(edge.target);
|
|
13664
|
+
if (sourceDir === targetDir) continue;
|
|
13665
|
+
if (!graph.files.has(edge.target)) continue;
|
|
13666
|
+
const existing = dirImportedBy.get(targetDir) ?? /* @__PURE__ */ new Set();
|
|
13667
|
+
if (!dirImportedBy.has(targetDir)) dirImportedBy.set(targetDir, existing);
|
|
13668
|
+
existing.add(sourceDir);
|
|
13669
|
+
}
|
|
13670
|
+
const clusters = /* @__PURE__ */ new Map();
|
|
13671
|
+
for (const [dir, importers] of dirImportedBy) {
|
|
13672
|
+
if (importers.size !== 1) continue;
|
|
13673
|
+
const parentDir = [...importers][0];
|
|
13674
|
+
if (isAncestor(dir, parentDir)) continue;
|
|
13675
|
+
if (isAncestor(parentDir, dir)) continue;
|
|
13676
|
+
const cluster = clusters.get(parentDir) ?? [];
|
|
13677
|
+
if (!clusters.has(parentDir)) clusters.set(parentDir, cluster);
|
|
13678
|
+
cluster.push(dir);
|
|
13679
|
+
}
|
|
13680
|
+
for (const [parentDir, children] of clusters) {
|
|
13681
|
+
const filtered = children.filter((child) => !clusters.has(child));
|
|
13682
|
+
if (filtered.length === 0) {
|
|
13683
|
+
clusters.delete(parentDir);
|
|
13684
|
+
} else {
|
|
13685
|
+
clusters.set(parentDir, filtered);
|
|
13686
|
+
}
|
|
13687
|
+
}
|
|
13688
|
+
return clusters;
|
|
13689
|
+
}
|
|
13690
|
+
function isAncestor(ancestor, descendant) {
|
|
13691
|
+
const rel = path40.relative(ancestor, descendant);
|
|
13523
13692
|
return !rel.startsWith("..") && rel !== "";
|
|
13524
13693
|
}
|
|
13525
13694
|
|
|
13526
13695
|
// src/commands/refactor/restructure/clusterFiles.ts
|
|
13527
|
-
import
|
|
13696
|
+
import path41 from "path";
|
|
13528
13697
|
function findRootParent(file, importedBy, visited) {
|
|
13529
13698
|
const importers = importedBy.get(file);
|
|
13530
13699
|
if (!importers || importers.size !== 1) return file;
|
|
13531
13700
|
const parent = [...importers][0];
|
|
13532
|
-
const parentDir =
|
|
13533
|
-
const fileDir =
|
|
13701
|
+
const parentDir = path41.dirname(parent);
|
|
13702
|
+
const fileDir = path41.dirname(file);
|
|
13534
13703
|
if (parentDir !== fileDir) return file;
|
|
13535
|
-
if (
|
|
13704
|
+
if (path41.basename(parent, path41.extname(parent)) === "index") return file;
|
|
13536
13705
|
if (visited.has(parent)) return file;
|
|
13537
13706
|
visited.add(parent);
|
|
13538
13707
|
return findRootParent(parent, importedBy, visited);
|
|
@@ -13540,16 +13709,16 @@ function findRootParent(file, importedBy, visited) {
|
|
|
13540
13709
|
function clusterFiles(graph) {
|
|
13541
13710
|
const clusters = /* @__PURE__ */ new Map();
|
|
13542
13711
|
for (const file of graph.files) {
|
|
13543
|
-
const basename12 =
|
|
13712
|
+
const basename12 = path41.basename(file, path41.extname(file));
|
|
13544
13713
|
if (basename12 === "index") continue;
|
|
13545
13714
|
const importers = graph.importedBy.get(file);
|
|
13546
13715
|
if (!importers || importers.size !== 1) continue;
|
|
13547
13716
|
const parent = [...importers][0];
|
|
13548
13717
|
if (!graph.files.has(parent)) continue;
|
|
13549
|
-
const parentDir =
|
|
13550
|
-
const fileDir =
|
|
13718
|
+
const parentDir = path41.dirname(parent);
|
|
13719
|
+
const fileDir = path41.dirname(file);
|
|
13551
13720
|
if (parentDir !== fileDir) continue;
|
|
13552
|
-
const parentBasename =
|
|
13721
|
+
const parentBasename = path41.basename(parent, path41.extname(parent));
|
|
13553
13722
|
if (parentBasename === "index") continue;
|
|
13554
13723
|
const root = findRootParent(parent, graph.importedBy, /* @__PURE__ */ new Set([file]));
|
|
13555
13724
|
if (!root || root === file) continue;
|
|
@@ -13560,150 +13729,52 @@ function clusterFiles(graph) {
|
|
|
13560
13729
|
return clusters;
|
|
13561
13730
|
}
|
|
13562
13731
|
|
|
13563
|
-
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
13564
|
-
import path39 from "path";
|
|
13565
|
-
|
|
13566
|
-
// src/commands/refactor/restructure/computeRewrites/applyRewrites.ts
|
|
13567
|
-
import fs21 from "fs";
|
|
13568
|
-
function getOrCreateList(map, key) {
|
|
13569
|
-
const list4 = map.get(key) ?? [];
|
|
13570
|
-
if (!map.has(key)) map.set(key, list4);
|
|
13571
|
-
return list4;
|
|
13572
|
-
}
|
|
13573
|
-
function groupByFile2(rewrites) {
|
|
13574
|
-
const grouped = /* @__PURE__ */ new Map();
|
|
13575
|
-
for (const rewrite of rewrites) {
|
|
13576
|
-
getOrCreateList(grouped, rewrite.file).push(rewrite);
|
|
13577
|
-
}
|
|
13578
|
-
return grouped;
|
|
13579
|
-
}
|
|
13580
|
-
function rewriteSpecifier(content, oldSpecifier, newSpecifier) {
|
|
13581
|
-
const escaped = oldSpecifier.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
13582
|
-
const pattern2 = new RegExp(`(from\\s+["'])${escaped}(["'])`, "g");
|
|
13583
|
-
return content.replace(pattern2, `$1${newSpecifier}$2`);
|
|
13584
|
-
}
|
|
13585
|
-
function applyFileRewrites(file, fileRewrites) {
|
|
13586
|
-
let content = fs21.readFileSync(file, "utf-8");
|
|
13587
|
-
for (const { oldSpecifier, newSpecifier } of fileRewrites) {
|
|
13588
|
-
content = rewriteSpecifier(content, oldSpecifier, newSpecifier);
|
|
13589
|
-
}
|
|
13590
|
-
return content;
|
|
13591
|
-
}
|
|
13592
|
-
function applyRewrites(rewrites) {
|
|
13593
|
-
const updatedContents = /* @__PURE__ */ new Map();
|
|
13594
|
-
for (const [file, fileRewrites] of groupByFile2(rewrites)) {
|
|
13595
|
-
updatedContents.set(file, applyFileRewrites(file, fileRewrites));
|
|
13596
|
-
}
|
|
13597
|
-
return updatedContents;
|
|
13598
|
-
}
|
|
13599
|
-
|
|
13600
|
-
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
13601
|
-
function buildMoveMap(moves) {
|
|
13602
|
-
const map = /* @__PURE__ */ new Map();
|
|
13603
|
-
for (const move of moves) map.set(move.from, move.to);
|
|
13604
|
-
return map;
|
|
13605
|
-
}
|
|
13606
|
-
function stripTrailingIndex(specifier) {
|
|
13607
|
-
return specifier.endsWith("/index") ? specifier.slice(0, -"/index".length) : specifier;
|
|
13608
|
-
}
|
|
13609
|
-
function ensureRelative(specifier) {
|
|
13610
|
-
return specifier.startsWith(".") ? specifier : `./${specifier}`;
|
|
13611
|
-
}
|
|
13612
|
-
function normalizeSpecifier(rel) {
|
|
13613
|
-
return ensureRelative(
|
|
13614
|
-
stripTrailingIndex(rel.replace(/\\/g, "/").replace(/\.tsx?$/, ""))
|
|
13615
|
-
);
|
|
13616
|
-
}
|
|
13617
|
-
function computeSpecifier(fromFile, toFile) {
|
|
13618
|
-
return normalizeSpecifier(path39.relative(path39.dirname(fromFile), toFile));
|
|
13619
|
-
}
|
|
13620
|
-
function isAffected(edge, moveMap) {
|
|
13621
|
-
return moveMap.has(edge.target) || moveMap.has(edge.source);
|
|
13622
|
-
}
|
|
13623
|
-
function resolveTarget(edge, moveMap) {
|
|
13624
|
-
return moveMap.get(edge.target) ?? edge.target;
|
|
13625
|
-
}
|
|
13626
|
-
function createRewrite(edge, newSpecifier) {
|
|
13627
|
-
return { file: edge.source, oldSpecifier: edge.specifier, newSpecifier };
|
|
13628
|
-
}
|
|
13629
|
-
function rewriteIfChanged(edge, newSpecifier) {
|
|
13630
|
-
return newSpecifier === edge.specifier ? null : createRewrite(edge, newSpecifier);
|
|
13631
|
-
}
|
|
13632
|
-
function rewriteEdge(edge, newFile, moveMap) {
|
|
13633
|
-
if (!isAffected(edge, moveMap)) return null;
|
|
13634
|
-
return rewriteIfChanged(
|
|
13635
|
-
edge,
|
|
13636
|
-
computeSpecifier(newFile, resolveTarget(edge, moveMap))
|
|
13637
|
-
);
|
|
13638
|
-
}
|
|
13639
|
-
function fileEdges(edges, file) {
|
|
13640
|
-
return edges.filter((e) => e.source === file);
|
|
13641
|
-
}
|
|
13642
|
-
function collectRewrites(edges, newFile, moveMap) {
|
|
13643
|
-
const rewrites = [];
|
|
13644
|
-
for (const edge of edges) {
|
|
13645
|
-
const rewrite = rewriteEdge(edge, newFile, moveMap);
|
|
13646
|
-
if (rewrite) rewrites.push(rewrite);
|
|
13647
|
-
}
|
|
13648
|
-
return rewrites;
|
|
13649
|
-
}
|
|
13650
|
-
function rewriteEdgesForFile(file, edges, moveMap) {
|
|
13651
|
-
const newFile = moveMap.get(file) ?? file;
|
|
13652
|
-
return collectRewrites(fileEdges(edges, file), newFile, moveMap);
|
|
13653
|
-
}
|
|
13654
|
-
function computeRewrites(moves, edges, allProjectFiles) {
|
|
13655
|
-
const moveMap = buildMoveMap(moves);
|
|
13656
|
-
return [...allProjectFiles].flatMap(
|
|
13657
|
-
(file) => rewriteEdgesForFile(file, edges, moveMap)
|
|
13658
|
-
);
|
|
13659
|
-
}
|
|
13660
|
-
|
|
13661
13732
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
13662
|
-
import
|
|
13663
|
-
import
|
|
13733
|
+
import path42 from "path";
|
|
13734
|
+
import chalk143 from "chalk";
|
|
13664
13735
|
function relPath(filePath) {
|
|
13665
|
-
return
|
|
13736
|
+
return path42.relative(process.cwd(), filePath);
|
|
13666
13737
|
}
|
|
13667
13738
|
function displayMoves(plan2) {
|
|
13668
13739
|
if (plan2.moves.length === 0) return;
|
|
13669
|
-
console.log(
|
|
13740
|
+
console.log(chalk143.bold("\nFile moves:"));
|
|
13670
13741
|
for (const move of plan2.moves) {
|
|
13671
13742
|
console.log(
|
|
13672
|
-
` ${
|
|
13743
|
+
` ${chalk143.red(relPath(move.from))} \u2192 ${chalk143.green(relPath(move.to))}`
|
|
13673
13744
|
);
|
|
13674
|
-
console.log(
|
|
13745
|
+
console.log(chalk143.dim(` ${move.reason}`));
|
|
13675
13746
|
}
|
|
13676
13747
|
}
|
|
13677
13748
|
function displayRewrites(rewrites) {
|
|
13678
13749
|
if (rewrites.length === 0) return;
|
|
13679
13750
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
13680
|
-
console.log(
|
|
13751
|
+
console.log(chalk143.bold(`
|
|
13681
13752
|
Import rewrites (${affectedFiles.size} files):`));
|
|
13682
13753
|
for (const file of affectedFiles) {
|
|
13683
|
-
console.log(` ${
|
|
13754
|
+
console.log(` ${chalk143.cyan(relPath(file))}:`);
|
|
13684
13755
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
13685
13756
|
(r) => r.file === file
|
|
13686
13757
|
)) {
|
|
13687
13758
|
console.log(
|
|
13688
|
-
` ${
|
|
13759
|
+
` ${chalk143.red(`"${oldSpecifier}"`)} \u2192 ${chalk143.green(`"${newSpecifier}"`)}`
|
|
13689
13760
|
);
|
|
13690
13761
|
}
|
|
13691
13762
|
}
|
|
13692
13763
|
}
|
|
13693
13764
|
function displayPlan2(plan2) {
|
|
13694
13765
|
if (plan2.warnings.length > 0) {
|
|
13695
|
-
console.log(
|
|
13696
|
-
for (const w of plan2.warnings) console.log(
|
|
13766
|
+
console.log(chalk143.yellow("\nWarnings:"));
|
|
13767
|
+
for (const w of plan2.warnings) console.log(chalk143.yellow(` ${w}`));
|
|
13697
13768
|
}
|
|
13698
13769
|
if (plan2.newDirectories.length > 0) {
|
|
13699
|
-
console.log(
|
|
13770
|
+
console.log(chalk143.bold("\nNew directories:"));
|
|
13700
13771
|
for (const dir of plan2.newDirectories)
|
|
13701
|
-
console.log(
|
|
13772
|
+
console.log(chalk143.green(` ${dir}/`));
|
|
13702
13773
|
}
|
|
13703
13774
|
displayMoves(plan2);
|
|
13704
13775
|
displayRewrites(plan2.rewrites);
|
|
13705
13776
|
console.log(
|
|
13706
|
-
|
|
13777
|
+
chalk143.dim(
|
|
13707
13778
|
`
|
|
13708
13779
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
13709
13780
|
)
|
|
@@ -13711,45 +13782,45 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
13711
13782
|
}
|
|
13712
13783
|
|
|
13713
13784
|
// src/commands/refactor/restructure/executePlan.ts
|
|
13714
|
-
import
|
|
13715
|
-
import
|
|
13716
|
-
import
|
|
13785
|
+
import fs24 from "fs";
|
|
13786
|
+
import path43 from "path";
|
|
13787
|
+
import chalk144 from "chalk";
|
|
13717
13788
|
function executePlan(plan2) {
|
|
13718
13789
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
13719
13790
|
for (const [file, content] of updatedContents) {
|
|
13720
|
-
|
|
13791
|
+
fs24.writeFileSync(file, content, "utf-8");
|
|
13721
13792
|
console.log(
|
|
13722
|
-
|
|
13793
|
+
chalk144.cyan(` Rewrote imports in ${path43.relative(process.cwd(), file)}`)
|
|
13723
13794
|
);
|
|
13724
13795
|
}
|
|
13725
13796
|
for (const dir of plan2.newDirectories) {
|
|
13726
|
-
|
|
13727
|
-
console.log(
|
|
13797
|
+
fs24.mkdirSync(dir, { recursive: true });
|
|
13798
|
+
console.log(chalk144.green(` Created ${path43.relative(process.cwd(), dir)}/`));
|
|
13728
13799
|
}
|
|
13729
13800
|
for (const move of plan2.moves) {
|
|
13730
|
-
const targetDir =
|
|
13731
|
-
if (!
|
|
13732
|
-
|
|
13801
|
+
const targetDir = path43.dirname(move.to);
|
|
13802
|
+
if (!fs24.existsSync(targetDir)) {
|
|
13803
|
+
fs24.mkdirSync(targetDir, { recursive: true });
|
|
13733
13804
|
}
|
|
13734
|
-
|
|
13805
|
+
fs24.renameSync(move.from, move.to);
|
|
13735
13806
|
console.log(
|
|
13736
|
-
|
|
13737
|
-
` Moved ${
|
|
13807
|
+
chalk144.white(
|
|
13808
|
+
` Moved ${path43.relative(process.cwd(), move.from)} \u2192 ${path43.relative(process.cwd(), move.to)}`
|
|
13738
13809
|
)
|
|
13739
13810
|
);
|
|
13740
13811
|
}
|
|
13741
|
-
removeEmptyDirectories(plan2.moves.map((m) =>
|
|
13812
|
+
removeEmptyDirectories(plan2.moves.map((m) => path43.dirname(m.from)));
|
|
13742
13813
|
}
|
|
13743
13814
|
function removeEmptyDirectories(dirs) {
|
|
13744
13815
|
const unique = [...new Set(dirs)];
|
|
13745
13816
|
for (const dir of unique) {
|
|
13746
|
-
if (!
|
|
13747
|
-
const entries =
|
|
13817
|
+
if (!fs24.existsSync(dir)) continue;
|
|
13818
|
+
const entries = fs24.readdirSync(dir);
|
|
13748
13819
|
if (entries.length === 0) {
|
|
13749
|
-
|
|
13820
|
+
fs24.rmdirSync(dir);
|
|
13750
13821
|
console.log(
|
|
13751
|
-
|
|
13752
|
-
` Removed empty directory ${
|
|
13822
|
+
chalk144.dim(
|
|
13823
|
+
` Removed empty directory ${path43.relative(process.cwd(), dir)}`
|
|
13753
13824
|
)
|
|
13754
13825
|
);
|
|
13755
13826
|
}
|
|
@@ -13757,46 +13828,46 @@ function removeEmptyDirectories(dirs) {
|
|
|
13757
13828
|
}
|
|
13758
13829
|
|
|
13759
13830
|
// src/commands/refactor/restructure/planFileMoves/index.ts
|
|
13760
|
-
import
|
|
13831
|
+
import path45 from "path";
|
|
13761
13832
|
|
|
13762
13833
|
// src/commands/refactor/restructure/planFileMoves/shared.ts
|
|
13763
|
-
import
|
|
13834
|
+
import fs25 from "fs";
|
|
13764
13835
|
function emptyResult() {
|
|
13765
13836
|
return { moves: [], directories: [], warnings: [] };
|
|
13766
13837
|
}
|
|
13767
13838
|
function checkDirConflict(result, label2, dir) {
|
|
13768
|
-
if (!
|
|
13839
|
+
if (!fs25.existsSync(dir)) return false;
|
|
13769
13840
|
result.warnings.push(`Skipping ${label2}: directory ${dir} already exists`);
|
|
13770
13841
|
return true;
|
|
13771
13842
|
}
|
|
13772
13843
|
|
|
13773
13844
|
// src/commands/refactor/restructure/planFileMoves/planDirectoryMoves.ts
|
|
13774
|
-
import
|
|
13775
|
-
import
|
|
13845
|
+
import fs26 from "fs";
|
|
13846
|
+
import path44 from "path";
|
|
13776
13847
|
function collectEntry(results, dir, entry) {
|
|
13777
|
-
const full =
|
|
13848
|
+
const full = path44.join(dir, entry.name);
|
|
13778
13849
|
const items2 = entry.isDirectory() ? listFilesRecursive(full) : [full];
|
|
13779
13850
|
results.push(...items2);
|
|
13780
13851
|
}
|
|
13781
13852
|
function listFilesRecursive(dir) {
|
|
13782
|
-
if (!
|
|
13853
|
+
if (!fs26.existsSync(dir)) return [];
|
|
13783
13854
|
const results = [];
|
|
13784
|
-
for (const entry of
|
|
13855
|
+
for (const entry of fs26.readdirSync(dir, { withFileTypes: true })) {
|
|
13785
13856
|
collectEntry(results, dir, entry);
|
|
13786
13857
|
}
|
|
13787
13858
|
return results;
|
|
13788
13859
|
}
|
|
13789
13860
|
function addDirectoryFileMoves(moves, childDir, newLocation, reason) {
|
|
13790
13861
|
for (const file of listFilesRecursive(childDir)) {
|
|
13791
|
-
const rel =
|
|
13792
|
-
moves.push({ from: file, to:
|
|
13862
|
+
const rel = path44.relative(childDir, file);
|
|
13863
|
+
moves.push({ from: file, to: path44.join(newLocation, rel), reason });
|
|
13793
13864
|
}
|
|
13794
13865
|
}
|
|
13795
13866
|
function resolveChildDest(parentDir, childDir) {
|
|
13796
|
-
return
|
|
13867
|
+
return path44.join(parentDir, path44.basename(childDir));
|
|
13797
13868
|
}
|
|
13798
13869
|
function childMoveReason(parentDir) {
|
|
13799
|
-
return `Directory only imported from ${
|
|
13870
|
+
return `Directory only imported from ${path44.basename(parentDir)}/`;
|
|
13800
13871
|
}
|
|
13801
13872
|
function registerDirectoryMove(result, childDir, dest, parentDir) {
|
|
13802
13873
|
result.directories.push(dest);
|
|
@@ -13821,7 +13892,7 @@ function planDirectoryMoves(clusters) {
|
|
|
13821
13892
|
|
|
13822
13893
|
// src/commands/refactor/restructure/planFileMoves/index.ts
|
|
13823
13894
|
function childMoveData(child, newDir, parentBase) {
|
|
13824
|
-
const to =
|
|
13895
|
+
const to = path45.join(newDir, path45.basename(child));
|
|
13825
13896
|
return { from: child, to, reason: `Only imported by ${parentBase}` };
|
|
13826
13897
|
}
|
|
13827
13898
|
function addChildMoves(moves, children, newDir, parentBase) {
|
|
@@ -13829,15 +13900,15 @@ function addChildMoves(moves, children, newDir, parentBase) {
|
|
|
13829
13900
|
moves.push(childMoveData(child, newDir, parentBase));
|
|
13830
13901
|
}
|
|
13831
13902
|
function getBaseName(filePath) {
|
|
13832
|
-
return
|
|
13903
|
+
return path45.basename(filePath, path45.extname(filePath));
|
|
13833
13904
|
}
|
|
13834
13905
|
function resolveClusterDir(parent) {
|
|
13835
|
-
return
|
|
13906
|
+
return path45.join(path45.dirname(parent), getBaseName(parent));
|
|
13836
13907
|
}
|
|
13837
13908
|
function createParentMove(parent, newDir) {
|
|
13838
13909
|
return {
|
|
13839
13910
|
from: parent,
|
|
13840
|
-
to:
|
|
13911
|
+
to: path45.join(newDir, `index${path45.extname(parent)}`),
|
|
13841
13912
|
reason: `Main module of new ${getBaseName(parent)}/ directory`
|
|
13842
13913
|
};
|
|
13843
13914
|
}
|
|
@@ -13861,7 +13932,7 @@ function planFileMoves(clusters) {
|
|
|
13861
13932
|
|
|
13862
13933
|
// src/commands/refactor/restructure/index.ts
|
|
13863
13934
|
function buildPlan3(candidateFiles, tsConfigPath) {
|
|
13864
|
-
const candidates = new Set(candidateFiles.map((f) =>
|
|
13935
|
+
const candidates = new Set(candidateFiles.map((f) => path46.resolve(f)));
|
|
13865
13936
|
const graph = buildImportGraph(candidates, tsConfigPath);
|
|
13866
13937
|
const allProjectFiles = /* @__PURE__ */ new Set([
|
|
13867
13938
|
...graph.importedBy.keys(),
|
|
@@ -13881,22 +13952,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
13881
13952
|
const targetPattern = pattern2 ?? "src";
|
|
13882
13953
|
const files = findSourceFiles2(targetPattern);
|
|
13883
13954
|
if (files.length === 0) {
|
|
13884
|
-
console.log(
|
|
13955
|
+
console.log(chalk145.yellow("No files found matching pattern"));
|
|
13885
13956
|
return;
|
|
13886
13957
|
}
|
|
13887
|
-
const tsConfigPath =
|
|
13958
|
+
const tsConfigPath = path46.resolve("tsconfig.json");
|
|
13888
13959
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
13889
13960
|
if (plan2.moves.length === 0) {
|
|
13890
|
-
console.log(
|
|
13961
|
+
console.log(chalk145.green("No restructuring needed"));
|
|
13891
13962
|
return;
|
|
13892
13963
|
}
|
|
13893
13964
|
displayPlan2(plan2);
|
|
13894
13965
|
if (options2.apply) {
|
|
13895
|
-
console.log(
|
|
13966
|
+
console.log(chalk145.bold("\nApplying changes..."));
|
|
13896
13967
|
executePlan(plan2);
|
|
13897
|
-
console.log(
|
|
13968
|
+
console.log(chalk145.green("\nRestructuring complete"));
|
|
13898
13969
|
} else {
|
|
13899
|
-
console.log(
|
|
13970
|
+
console.log(chalk145.dim("\nDry run. Use --apply to execute."));
|
|
13900
13971
|
}
|
|
13901
13972
|
}
|
|
13902
13973
|
|
|
@@ -13936,7 +14007,7 @@ function registerRefactor(program2) {
|
|
|
13936
14007
|
}
|
|
13937
14008
|
|
|
13938
14009
|
// src/commands/review/review.ts
|
|
13939
|
-
import { execFileSync as
|
|
14010
|
+
import { execFileSync as execFileSync7 } from "child_process";
|
|
13940
14011
|
|
|
13941
14012
|
// src/commands/review/annotateDiffWithLineNumbers.ts
|
|
13942
14013
|
var FILE_HEADER2 = /^\+\+\+ (?:b\/)?(.+)$/;
|
|
@@ -14071,9 +14142,9 @@ function buildReviewPaths(repoRoot, key) {
|
|
|
14071
14142
|
}
|
|
14072
14143
|
|
|
14073
14144
|
// src/commands/review/fetchExistingComments.ts
|
|
14074
|
-
import { execSync as
|
|
14145
|
+
import { execSync as execSync42 } from "child_process";
|
|
14075
14146
|
function fetchRawComments(org, repo, prNumber) {
|
|
14076
|
-
const out =
|
|
14147
|
+
const out = execSync42(
|
|
14077
14148
|
`gh api --paginate repos/${org}/${repo}/pulls/${prNumber}/comments`,
|
|
14078
14149
|
{ encoding: "utf-8", maxBuffer: 64 * 1024 * 1024 }
|
|
14079
14150
|
);
|
|
@@ -14104,14 +14175,14 @@ function fetchExistingComments() {
|
|
|
14104
14175
|
}
|
|
14105
14176
|
|
|
14106
14177
|
// src/commands/review/gatherContext.ts
|
|
14107
|
-
import { execSync as
|
|
14178
|
+
import { execSync as execSync45 } from "child_process";
|
|
14108
14179
|
|
|
14109
14180
|
// src/commands/review/fetchPrDiff.ts
|
|
14110
|
-
import { execSync as
|
|
14181
|
+
import { execSync as execSync43 } from "child_process";
|
|
14111
14182
|
function fetchPrDiff(prNumber, baseSha, headSha) {
|
|
14112
14183
|
const { org, repo } = getRepoInfo();
|
|
14113
14184
|
try {
|
|
14114
|
-
return
|
|
14185
|
+
return execSync43(`gh pr diff ${prNumber} -R ${org}/${repo}`, {
|
|
14115
14186
|
encoding: "utf-8",
|
|
14116
14187
|
maxBuffer: 256 * 1024 * 1024,
|
|
14117
14188
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -14126,19 +14197,19 @@ function isDiffTooLarge(error) {
|
|
|
14126
14197
|
}
|
|
14127
14198
|
function fetchDiffViaGit(baseSha, headSha) {
|
|
14128
14199
|
try {
|
|
14129
|
-
|
|
14200
|
+
execSync43(`git fetch origin ${baseSha} ${headSha}`, { stdio: "ignore" });
|
|
14130
14201
|
} catch {
|
|
14131
14202
|
}
|
|
14132
|
-
return
|
|
14203
|
+
return execSync43(`git diff ${baseSha}...${headSha}`, {
|
|
14133
14204
|
encoding: "utf-8",
|
|
14134
14205
|
maxBuffer: 256 * 1024 * 1024
|
|
14135
14206
|
});
|
|
14136
14207
|
}
|
|
14137
14208
|
|
|
14138
14209
|
// src/commands/review/fetchPrDiffInfo.ts
|
|
14139
|
-
import { execSync as
|
|
14210
|
+
import { execSync as execSync44 } from "child_process";
|
|
14140
14211
|
function getCurrentBranch2() {
|
|
14141
|
-
return
|
|
14212
|
+
return execSync44("git rev-parse --abbrev-ref HEAD", {
|
|
14142
14213
|
encoding: "utf-8"
|
|
14143
14214
|
}).trim();
|
|
14144
14215
|
}
|
|
@@ -14148,7 +14219,7 @@ function fetchPrDiffInfo() {
|
|
|
14148
14219
|
const fields = "number,baseRefName,baseRefOid,headRefName,headRefOid";
|
|
14149
14220
|
let raw;
|
|
14150
14221
|
try {
|
|
14151
|
-
raw =
|
|
14222
|
+
raw = execSync44(`gh pr view ${branch} --json ${fields} -R ${org}/${repo}`, {
|
|
14152
14223
|
encoding: "utf-8",
|
|
14153
14224
|
stdio: ["ignore", "pipe", "pipe"]
|
|
14154
14225
|
});
|
|
@@ -14172,7 +14243,7 @@ function fetchPrDiffInfo() {
|
|
|
14172
14243
|
}
|
|
14173
14244
|
function fetchPrChangedFiles(prNumber) {
|
|
14174
14245
|
const { org, repo } = getRepoInfo();
|
|
14175
|
-
const out =
|
|
14246
|
+
const out = execSync44(
|
|
14176
14247
|
`gh api repos/${org}/${repo}/pulls/${prNumber}/files --paginate --jq ".[].filename"`,
|
|
14177
14248
|
{
|
|
14178
14249
|
encoding: "utf-8",
|
|
@@ -14184,11 +14255,11 @@ function fetchPrChangedFiles(prNumber) {
|
|
|
14184
14255
|
|
|
14185
14256
|
// src/commands/review/gatherContext.ts
|
|
14186
14257
|
function gatherContext() {
|
|
14187
|
-
const branch =
|
|
14258
|
+
const branch = execSync45("git rev-parse --abbrev-ref HEAD", {
|
|
14188
14259
|
encoding: "utf-8"
|
|
14189
14260
|
}).trim();
|
|
14190
|
-
const sha =
|
|
14191
|
-
const shortSha =
|
|
14261
|
+
const sha = execSync45("git rev-parse HEAD", { encoding: "utf-8" }).trim();
|
|
14262
|
+
const shortSha = execSync45("git rev-parse --short=7 HEAD", {
|
|
14192
14263
|
encoding: "utf-8"
|
|
14193
14264
|
}).trim();
|
|
14194
14265
|
const prInfo = fetchPrDiffInfo();
|
|
@@ -14465,18 +14536,18 @@ function partitionFindingsByDiff(findings, index2) {
|
|
|
14465
14536
|
}
|
|
14466
14537
|
|
|
14467
14538
|
// src/commands/review/warnOutOfDiff.ts
|
|
14468
|
-
import
|
|
14539
|
+
import chalk146 from "chalk";
|
|
14469
14540
|
function warnOutOfDiff(outOfDiff) {
|
|
14470
14541
|
if (outOfDiff.length === 0) return;
|
|
14471
14542
|
console.warn(
|
|
14472
|
-
|
|
14543
|
+
chalk146.yellow(
|
|
14473
14544
|
`Skipped ${outOfDiff.length} finding(s) whose lines fall outside the PR diff (GitHub would silently drop these):`
|
|
14474
14545
|
)
|
|
14475
14546
|
);
|
|
14476
14547
|
for (const finding of outOfDiff) {
|
|
14477
14548
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
14478
14549
|
console.warn(
|
|
14479
|
-
` ${
|
|
14550
|
+
` ${chalk146.yellow("\xB7")} ${finding.title} ${chalk146.dim(
|
|
14480
14551
|
`(${finding.file}:${range})`
|
|
14481
14552
|
)}`
|
|
14482
14553
|
);
|
|
@@ -14495,18 +14566,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
14495
14566
|
}
|
|
14496
14567
|
|
|
14497
14568
|
// src/commands/review/warnUnlocated.ts
|
|
14498
|
-
import
|
|
14569
|
+
import chalk147 from "chalk";
|
|
14499
14570
|
function warnUnlocated(unlocated) {
|
|
14500
14571
|
if (unlocated.length === 0) return;
|
|
14501
14572
|
console.warn(
|
|
14502
|
-
|
|
14573
|
+
chalk147.yellow(
|
|
14503
14574
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
14504
14575
|
)
|
|
14505
14576
|
);
|
|
14506
14577
|
for (const finding of unlocated) {
|
|
14507
|
-
const where = finding.location ||
|
|
14578
|
+
const where = finding.location || chalk147.dim("missing");
|
|
14508
14579
|
console.warn(
|
|
14509
|
-
` ${
|
|
14580
|
+
` ${chalk147.yellow("\xB7")} ${finding.title} ${chalk147.dim(`(${where})`)}`
|
|
14510
14581
|
);
|
|
14511
14582
|
}
|
|
14512
14583
|
}
|
|
@@ -14603,8 +14674,8 @@ async function handlePostSynthesis(synthesisPath, options2) {
|
|
|
14603
14674
|
// src/commands/review/prepareReviewDir.ts
|
|
14604
14675
|
import { existsSync as existsSync36, mkdirSync as mkdirSync14, unlinkSync as unlinkSync12, writeFileSync as writeFileSync26 } from "fs";
|
|
14605
14676
|
function clearReviewFiles(paths) {
|
|
14606
|
-
for (const
|
|
14607
|
-
if (existsSync36(
|
|
14677
|
+
for (const path56 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
14678
|
+
if (existsSync36(path56)) unlinkSync12(path56);
|
|
14608
14679
|
}
|
|
14609
14680
|
}
|
|
14610
14681
|
function prepareReviewDir(paths, requestBody, force) {
|
|
@@ -15632,7 +15703,7 @@ function validateOptions(options2) {
|
|
|
15632
15703
|
}
|
|
15633
15704
|
function checkoutPr(number) {
|
|
15634
15705
|
try {
|
|
15635
|
-
|
|
15706
|
+
execFileSync7("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
15636
15707
|
} catch {
|
|
15637
15708
|
console.error(`gh pr checkout ${number} failed; aborting.`);
|
|
15638
15709
|
process.exit(1);
|
|
@@ -15679,7 +15750,7 @@ function registerReview(program2) {
|
|
|
15679
15750
|
}
|
|
15680
15751
|
|
|
15681
15752
|
// src/commands/seq/seqAuth.ts
|
|
15682
|
-
import
|
|
15753
|
+
import chalk149 from "chalk";
|
|
15683
15754
|
|
|
15684
15755
|
// src/commands/seq/loadConnections.ts
|
|
15685
15756
|
function loadConnections2() {
|
|
@@ -15708,10 +15779,10 @@ function setDefaultConnection(name) {
|
|
|
15708
15779
|
}
|
|
15709
15780
|
|
|
15710
15781
|
// src/shared/assertUniqueName.ts
|
|
15711
|
-
import
|
|
15782
|
+
import chalk148 from "chalk";
|
|
15712
15783
|
function assertUniqueName(existingNames, name) {
|
|
15713
15784
|
if (existingNames.includes(name)) {
|
|
15714
|
-
console.error(
|
|
15785
|
+
console.error(chalk148.red(`Connection "${name}" already exists.`));
|
|
15715
15786
|
process.exit(1);
|
|
15716
15787
|
}
|
|
15717
15788
|
}
|
|
@@ -15729,18 +15800,18 @@ async function promptConnection2(existingNames) {
|
|
|
15729
15800
|
var seqAuth = createConnectionAuth({
|
|
15730
15801
|
load: loadConnections2,
|
|
15731
15802
|
save: saveConnections2,
|
|
15732
|
-
format: (c) => `${
|
|
15803
|
+
format: (c) => `${chalk149.bold(c.name)} ${c.url}`,
|
|
15733
15804
|
promptNew: promptConnection2,
|
|
15734
15805
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
15735
15806
|
});
|
|
15736
15807
|
|
|
15737
15808
|
// src/commands/seq/seqQuery.ts
|
|
15738
|
-
import
|
|
15809
|
+
import chalk153 from "chalk";
|
|
15739
15810
|
|
|
15740
15811
|
// src/commands/seq/fetchSeq.ts
|
|
15741
|
-
import
|
|
15742
|
-
async function fetchSeq(conn,
|
|
15743
|
-
const url = `${conn.url}${
|
|
15812
|
+
import chalk150 from "chalk";
|
|
15813
|
+
async function fetchSeq(conn, path56, params) {
|
|
15814
|
+
const url = `${conn.url}${path56}?${params}`;
|
|
15744
15815
|
const response = await fetch(url, {
|
|
15745
15816
|
headers: {
|
|
15746
15817
|
Accept: "application/json",
|
|
@@ -15749,7 +15820,7 @@ async function fetchSeq(conn, path54, params) {
|
|
|
15749
15820
|
});
|
|
15750
15821
|
if (!response.ok) {
|
|
15751
15822
|
const body = await response.text();
|
|
15752
|
-
console.error(
|
|
15823
|
+
console.error(chalk150.red(`Seq returned ${response.status}: ${body}`));
|
|
15753
15824
|
process.exit(1);
|
|
15754
15825
|
}
|
|
15755
15826
|
return response;
|
|
@@ -15804,23 +15875,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
15804
15875
|
}
|
|
15805
15876
|
|
|
15806
15877
|
// src/commands/seq/formatEvent.ts
|
|
15807
|
-
import
|
|
15878
|
+
import chalk151 from "chalk";
|
|
15808
15879
|
function levelColor(level) {
|
|
15809
15880
|
switch (level) {
|
|
15810
15881
|
case "Fatal":
|
|
15811
|
-
return
|
|
15882
|
+
return chalk151.bgRed.white;
|
|
15812
15883
|
case "Error":
|
|
15813
|
-
return
|
|
15884
|
+
return chalk151.red;
|
|
15814
15885
|
case "Warning":
|
|
15815
|
-
return
|
|
15886
|
+
return chalk151.yellow;
|
|
15816
15887
|
case "Information":
|
|
15817
|
-
return
|
|
15888
|
+
return chalk151.cyan;
|
|
15818
15889
|
case "Debug":
|
|
15819
|
-
return
|
|
15890
|
+
return chalk151.gray;
|
|
15820
15891
|
case "Verbose":
|
|
15821
|
-
return
|
|
15892
|
+
return chalk151.dim;
|
|
15822
15893
|
default:
|
|
15823
|
-
return
|
|
15894
|
+
return chalk151.white;
|
|
15824
15895
|
}
|
|
15825
15896
|
}
|
|
15826
15897
|
function levelAbbrev(level) {
|
|
@@ -15861,12 +15932,12 @@ function formatTimestamp(iso) {
|
|
|
15861
15932
|
function formatEvent(event) {
|
|
15862
15933
|
const color = levelColor(event.Level);
|
|
15863
15934
|
const abbrev = levelAbbrev(event.Level);
|
|
15864
|
-
const ts8 =
|
|
15935
|
+
const ts8 = chalk151.dim(formatTimestamp(event.Timestamp));
|
|
15865
15936
|
const msg = renderMessage(event);
|
|
15866
15937
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
15867
15938
|
if (event.Exception) {
|
|
15868
15939
|
for (const line of event.Exception.split("\n")) {
|
|
15869
|
-
lines.push(
|
|
15940
|
+
lines.push(chalk151.red(` ${line}`));
|
|
15870
15941
|
}
|
|
15871
15942
|
}
|
|
15872
15943
|
return lines.join("\n");
|
|
@@ -15899,11 +15970,11 @@ function rejectTimestampFilter(filter) {
|
|
|
15899
15970
|
}
|
|
15900
15971
|
|
|
15901
15972
|
// src/shared/resolveNamedConnection.ts
|
|
15902
|
-
import
|
|
15973
|
+
import chalk152 from "chalk";
|
|
15903
15974
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
15904
15975
|
if (connections.length === 0) {
|
|
15905
15976
|
console.error(
|
|
15906
|
-
|
|
15977
|
+
chalk152.red(
|
|
15907
15978
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
15908
15979
|
)
|
|
15909
15980
|
);
|
|
@@ -15912,7 +15983,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
15912
15983
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
15913
15984
|
const connection = connections.find((c) => c.name === target);
|
|
15914
15985
|
if (!connection) {
|
|
15915
|
-
console.error(
|
|
15986
|
+
console.error(chalk152.red(`${kind} connection "${target}" not found.`));
|
|
15916
15987
|
process.exit(1);
|
|
15917
15988
|
}
|
|
15918
15989
|
return connection;
|
|
@@ -15941,7 +16012,7 @@ async function seqQuery(filter, options2) {
|
|
|
15941
16012
|
new URLSearchParams({ filter, count: String(count6) })
|
|
15942
16013
|
);
|
|
15943
16014
|
if (events.length === 0) {
|
|
15944
|
-
console.log(
|
|
16015
|
+
console.log(chalk153.yellow("No events found."));
|
|
15945
16016
|
return;
|
|
15946
16017
|
}
|
|
15947
16018
|
if (options2.json) {
|
|
@@ -15952,11 +16023,11 @@ async function seqQuery(filter, options2) {
|
|
|
15952
16023
|
for (const event of chronological) {
|
|
15953
16024
|
console.log(formatEvent(event));
|
|
15954
16025
|
}
|
|
15955
|
-
console.log(
|
|
16026
|
+
console.log(chalk153.dim(`
|
|
15956
16027
|
${events.length} events`));
|
|
15957
16028
|
if (events.length >= count6) {
|
|
15958
16029
|
console.log(
|
|
15959
|
-
|
|
16030
|
+
chalk153.yellow(
|
|
15960
16031
|
`Results limited to ${count6}. Use --count to retrieve more.`
|
|
15961
16032
|
)
|
|
15962
16033
|
);
|
|
@@ -15964,10 +16035,10 @@ ${events.length} events`));
|
|
|
15964
16035
|
}
|
|
15965
16036
|
|
|
15966
16037
|
// src/shared/setNamedDefaultConnection.ts
|
|
15967
|
-
import
|
|
16038
|
+
import chalk154 from "chalk";
|
|
15968
16039
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
15969
16040
|
if (!connections.find((c) => c.name === name)) {
|
|
15970
|
-
console.error(
|
|
16041
|
+
console.error(chalk154.red(`Connection "${name}" not found.`));
|
|
15971
16042
|
process.exit(1);
|
|
15972
16043
|
}
|
|
15973
16044
|
setDefault(name);
|
|
@@ -16015,7 +16086,7 @@ function registerSignal(program2) {
|
|
|
16015
16086
|
}
|
|
16016
16087
|
|
|
16017
16088
|
// src/commands/sql/sqlAuth.ts
|
|
16018
|
-
import
|
|
16089
|
+
import chalk156 from "chalk";
|
|
16019
16090
|
|
|
16020
16091
|
// src/commands/sql/loadConnections.ts
|
|
16021
16092
|
function loadConnections3() {
|
|
@@ -16044,7 +16115,7 @@ function setDefaultConnection2(name) {
|
|
|
16044
16115
|
}
|
|
16045
16116
|
|
|
16046
16117
|
// src/commands/sql/promptConnection.ts
|
|
16047
|
-
import
|
|
16118
|
+
import chalk155 from "chalk";
|
|
16048
16119
|
async function promptConnection3(existingNames) {
|
|
16049
16120
|
const name = await promptInput("name", "Connection name:", "default");
|
|
16050
16121
|
assertUniqueName(existingNames, name);
|
|
@@ -16052,7 +16123,7 @@ async function promptConnection3(existingNames) {
|
|
|
16052
16123
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
16053
16124
|
const port = Number.parseInt(portStr, 10);
|
|
16054
16125
|
if (!Number.isFinite(port)) {
|
|
16055
|
-
console.error(
|
|
16126
|
+
console.error(chalk155.red(`Invalid port "${portStr}".`));
|
|
16056
16127
|
process.exit(1);
|
|
16057
16128
|
}
|
|
16058
16129
|
const user = await promptInput("user", "User:");
|
|
@@ -16065,13 +16136,13 @@ async function promptConnection3(existingNames) {
|
|
|
16065
16136
|
var sqlAuth = createConnectionAuth({
|
|
16066
16137
|
load: loadConnections3,
|
|
16067
16138
|
save: saveConnections3,
|
|
16068
|
-
format: (c) => `${
|
|
16139
|
+
format: (c) => `${chalk156.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
16069
16140
|
promptNew: promptConnection3,
|
|
16070
16141
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
16071
16142
|
});
|
|
16072
16143
|
|
|
16073
16144
|
// src/commands/sql/printTable.ts
|
|
16074
|
-
import
|
|
16145
|
+
import chalk157 from "chalk";
|
|
16075
16146
|
function formatCell(value) {
|
|
16076
16147
|
if (value === null || value === void 0) return "";
|
|
16077
16148
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -16080,7 +16151,7 @@ function formatCell(value) {
|
|
|
16080
16151
|
}
|
|
16081
16152
|
function printTable(rows) {
|
|
16082
16153
|
if (rows.length === 0) {
|
|
16083
|
-
console.log(
|
|
16154
|
+
console.log(chalk157.yellow("(no rows)"));
|
|
16084
16155
|
return;
|
|
16085
16156
|
}
|
|
16086
16157
|
const columns = Object.keys(rows[0]);
|
|
@@ -16088,13 +16159,13 @@ function printTable(rows) {
|
|
|
16088
16159
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
16089
16160
|
);
|
|
16090
16161
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
16091
|
-
console.log(
|
|
16092
|
-
console.log(
|
|
16162
|
+
console.log(chalk157.dim(header));
|
|
16163
|
+
console.log(chalk157.dim("-".repeat(header.length)));
|
|
16093
16164
|
for (const row of rows) {
|
|
16094
16165
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
16095
16166
|
console.log(line);
|
|
16096
16167
|
}
|
|
16097
|
-
console.log(
|
|
16168
|
+
console.log(chalk157.dim(`
|
|
16098
16169
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
16099
16170
|
}
|
|
16100
16171
|
|
|
@@ -16154,7 +16225,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
16154
16225
|
}
|
|
16155
16226
|
|
|
16156
16227
|
// src/commands/sql/sqlMutate.ts
|
|
16157
|
-
import
|
|
16228
|
+
import chalk158 from "chalk";
|
|
16158
16229
|
|
|
16159
16230
|
// src/commands/sql/isMutation.ts
|
|
16160
16231
|
var MUTATION_KEYWORDS = [
|
|
@@ -16188,7 +16259,7 @@ function isMutation(sql4) {
|
|
|
16188
16259
|
async function sqlMutate(query, connectionName) {
|
|
16189
16260
|
if (!isMutation(query)) {
|
|
16190
16261
|
console.error(
|
|
16191
|
-
|
|
16262
|
+
chalk158.red(
|
|
16192
16263
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
16193
16264
|
)
|
|
16194
16265
|
);
|
|
@@ -16198,18 +16269,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
16198
16269
|
const pool = await sqlConnect(conn);
|
|
16199
16270
|
try {
|
|
16200
16271
|
const result = await pool.request().query(query);
|
|
16201
|
-
console.log(
|
|
16272
|
+
console.log(chalk158.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
16202
16273
|
} finally {
|
|
16203
16274
|
await pool.close();
|
|
16204
16275
|
}
|
|
16205
16276
|
}
|
|
16206
16277
|
|
|
16207
16278
|
// src/commands/sql/sqlQuery.ts
|
|
16208
|
-
import
|
|
16279
|
+
import chalk159 from "chalk";
|
|
16209
16280
|
async function sqlQuery(query, connectionName) {
|
|
16210
16281
|
if (isMutation(query)) {
|
|
16211
16282
|
console.error(
|
|
16212
|
-
|
|
16283
|
+
chalk159.red(
|
|
16213
16284
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
16214
16285
|
)
|
|
16215
16286
|
);
|
|
@@ -16224,7 +16295,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
16224
16295
|
printTable(rows);
|
|
16225
16296
|
} else {
|
|
16226
16297
|
console.log(
|
|
16227
|
-
|
|
16298
|
+
chalk159.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
16228
16299
|
);
|
|
16229
16300
|
}
|
|
16230
16301
|
} finally {
|
|
@@ -16804,14 +16875,14 @@ import {
|
|
|
16804
16875
|
import { dirname as dirname22, join as join42 } from "path";
|
|
16805
16876
|
|
|
16806
16877
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
16807
|
-
import
|
|
16878
|
+
import chalk160 from "chalk";
|
|
16808
16879
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
16809
16880
|
function validateStagedContent(filename, content) {
|
|
16810
16881
|
const firstLine = content.split("\n")[0];
|
|
16811
16882
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
16812
16883
|
if (!match) {
|
|
16813
16884
|
console.error(
|
|
16814
|
-
|
|
16885
|
+
chalk160.red(
|
|
16815
16886
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
16816
16887
|
)
|
|
16817
16888
|
);
|
|
@@ -16820,7 +16891,7 @@ function validateStagedContent(filename, content) {
|
|
|
16820
16891
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
16821
16892
|
if (!contentAfterLink) {
|
|
16822
16893
|
console.error(
|
|
16823
|
-
|
|
16894
|
+
chalk160.red(
|
|
16824
16895
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
16825
16896
|
)
|
|
16826
16897
|
);
|
|
@@ -17024,7 +17095,7 @@ import { mkdirSync as mkdirSync18 } from "fs";
|
|
|
17024
17095
|
import { join as join47 } from "path";
|
|
17025
17096
|
|
|
17026
17097
|
// src/commands/voice/checkLockFile.ts
|
|
17027
|
-
import { execSync as
|
|
17098
|
+
import { execSync as execSync46 } from "child_process";
|
|
17028
17099
|
import { existsSync as existsSync45, mkdirSync as mkdirSync17, readFileSync as readFileSync35, writeFileSync as writeFileSync29 } from "fs";
|
|
17029
17100
|
import { join as join46 } from "path";
|
|
17030
17101
|
function isProcessAlive2(pid) {
|
|
@@ -17053,7 +17124,7 @@ function bootstrapVenv() {
|
|
|
17053
17124
|
if (existsSync45(getVenvPython())) return;
|
|
17054
17125
|
console.log("Setting up Python environment...");
|
|
17055
17126
|
const pythonDir = getPythonDir();
|
|
17056
|
-
|
|
17127
|
+
execSync46(
|
|
17057
17128
|
`uv sync --project "${pythonDir}" --extra runtime --no-install-project`,
|
|
17058
17129
|
{
|
|
17059
17130
|
stdio: "inherit",
|
|
@@ -17217,7 +17288,7 @@ function registerVoice(program2) {
|
|
|
17217
17288
|
|
|
17218
17289
|
// src/commands/roam/auth.ts
|
|
17219
17290
|
import { randomBytes } from "crypto";
|
|
17220
|
-
import
|
|
17291
|
+
import chalk161 from "chalk";
|
|
17221
17292
|
|
|
17222
17293
|
// src/commands/roam/waitForCallback.ts
|
|
17223
17294
|
import { createServer as createServer2 } from "http";
|
|
@@ -17348,13 +17419,13 @@ async function auth() {
|
|
|
17348
17419
|
saveGlobalConfig(config);
|
|
17349
17420
|
const state = randomBytes(16).toString("hex");
|
|
17350
17421
|
console.log(
|
|
17351
|
-
|
|
17422
|
+
chalk161.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
17352
17423
|
);
|
|
17353
|
-
console.log(
|
|
17354
|
-
console.log(
|
|
17355
|
-
console.log(
|
|
17424
|
+
console.log(chalk161.white("http://localhost:14523/callback\n"));
|
|
17425
|
+
console.log(chalk161.blue("Opening browser for authorization..."));
|
|
17426
|
+
console.log(chalk161.dim("Waiting for authorization callback..."));
|
|
17356
17427
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
17357
|
-
console.log(
|
|
17428
|
+
console.log(chalk161.dim("Exchanging code for tokens..."));
|
|
17358
17429
|
const tokens = await exchangeToken({
|
|
17359
17430
|
code,
|
|
17360
17431
|
clientId,
|
|
@@ -17370,12 +17441,12 @@ async function auth() {
|
|
|
17370
17441
|
};
|
|
17371
17442
|
saveGlobalConfig(config);
|
|
17372
17443
|
console.log(
|
|
17373
|
-
|
|
17444
|
+
chalk161.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
17374
17445
|
);
|
|
17375
17446
|
}
|
|
17376
17447
|
|
|
17377
17448
|
// src/commands/roam/postRoamActivity.ts
|
|
17378
|
-
import { execFileSync as
|
|
17449
|
+
import { execFileSync as execFileSync8 } from "child_process";
|
|
17379
17450
|
import { readdirSync as readdirSync7, readFileSync as readFileSync38, statSync as statSync5 } from "fs";
|
|
17380
17451
|
import { join as join49 } from "path";
|
|
17381
17452
|
function findPortFile(roamDir) {
|
|
@@ -17386,9 +17457,9 @@ function findPortFile(roamDir) {
|
|
|
17386
17457
|
return void 0;
|
|
17387
17458
|
}
|
|
17388
17459
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
17389
|
-
const
|
|
17460
|
+
const path56 = join49(roamDir, name);
|
|
17390
17461
|
try {
|
|
17391
|
-
return { path:
|
|
17462
|
+
return { path: path56, mtimeMs: statSync5(path56).mtimeMs };
|
|
17392
17463
|
} catch {
|
|
17393
17464
|
return void 0;
|
|
17394
17465
|
}
|
|
@@ -17408,7 +17479,7 @@ function postRoamActivity(app, event) {
|
|
|
17408
17479
|
}
|
|
17409
17480
|
const url = `http://127.0.0.1:${port}/api/v1/activity/${app}/${event}?pid=${app === "codex" ? 99998 : 99999}`;
|
|
17410
17481
|
try {
|
|
17411
|
-
|
|
17482
|
+
execFileSync8("curl", ["-sf", "--max-time", "0.2", "-X", "POST", url], {
|
|
17412
17483
|
stdio: "ignore"
|
|
17413
17484
|
});
|
|
17414
17485
|
} catch {
|
|
@@ -17530,11 +17601,11 @@ function resolveParams(params, cliArgs) {
|
|
|
17530
17601
|
}
|
|
17531
17602
|
|
|
17532
17603
|
// src/commands/run/runPreCommands.ts
|
|
17533
|
-
import { execSync as
|
|
17604
|
+
import { execSync as execSync47 } from "child_process";
|
|
17534
17605
|
function runPreCommands(pre, cwd) {
|
|
17535
17606
|
for (const cmd of pre) {
|
|
17536
17607
|
try {
|
|
17537
|
-
|
|
17608
|
+
execSync47(cmd, { stdio: "inherit", cwd });
|
|
17538
17609
|
} catch (err) {
|
|
17539
17610
|
const code = err && typeof err === "object" && "status" in err ? err.status : 1;
|
|
17540
17611
|
process.exit(code);
|
|
@@ -17543,13 +17614,13 @@ function runPreCommands(pre, cwd) {
|
|
|
17543
17614
|
}
|
|
17544
17615
|
|
|
17545
17616
|
// src/commands/run/spawnRunCommand.ts
|
|
17546
|
-
import { execFileSync as
|
|
17617
|
+
import { execFileSync as execFileSync9, spawn as spawn8 } from "child_process";
|
|
17547
17618
|
import { existsSync as existsSync48 } from "fs";
|
|
17548
17619
|
import { dirname as dirname25, join as join50, resolve as resolve11 } from "path";
|
|
17549
17620
|
function resolveCommand2(command) {
|
|
17550
17621
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
17551
17622
|
try {
|
|
17552
|
-
const gitPath =
|
|
17623
|
+
const gitPath = execFileSync9("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
17553
17624
|
const gitRoot = resolve11(dirname25(gitPath), "..");
|
|
17554
17625
|
const gitBash = join50(gitRoot, "bin", "bash.exe");
|
|
17555
17626
|
if (existsSync48(gitBash)) return gitBash;
|
|
@@ -17731,11 +17802,11 @@ function findLinkIndex() {
|
|
|
17731
17802
|
function parseLinkArgs() {
|
|
17732
17803
|
const idx = findLinkIndex();
|
|
17733
17804
|
if (idx === -1) return null;
|
|
17734
|
-
const
|
|
17805
|
+
const path56 = process.argv[idx + 1];
|
|
17735
17806
|
const rest = process.argv.slice(idx + 2);
|
|
17736
17807
|
const { value: prefix2 } = extractOption(rest, "--prefix");
|
|
17737
17808
|
if (!prefix2) return null;
|
|
17738
|
-
return { path:
|
|
17809
|
+
return { path: path56, prefix: prefix2 };
|
|
17739
17810
|
}
|
|
17740
17811
|
function hasDuplicateLink(runList, linkPath) {
|
|
17741
17812
|
return runList.some(
|
|
@@ -17818,11 +17889,11 @@ function registerRun(program2) {
|
|
|
17818
17889
|
}
|
|
17819
17890
|
|
|
17820
17891
|
// src/commands/screenshot/index.ts
|
|
17821
|
-
import { execSync as
|
|
17892
|
+
import { execSync as execSync48 } from "child_process";
|
|
17822
17893
|
import { existsSync as existsSync50, mkdirSync as mkdirSync21, unlinkSync as unlinkSync17, writeFileSync as writeFileSync32 } from "fs";
|
|
17823
17894
|
import { tmpdir as tmpdir7 } from "os";
|
|
17824
17895
|
import { join as join53, resolve as resolve13 } from "path";
|
|
17825
|
-
import
|
|
17896
|
+
import chalk162 from "chalk";
|
|
17826
17897
|
|
|
17827
17898
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
17828
17899
|
var captureWindowPs1 = `
|
|
@@ -17961,7 +18032,7 @@ function runPowerShellScript(processName, outputPath) {
|
|
|
17961
18032
|
const scriptPath = join53(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
|
|
17962
18033
|
writeFileSync32(scriptPath, captureWindowPs1, "utf-8");
|
|
17963
18034
|
try {
|
|
17964
|
-
|
|
18035
|
+
execSync48(
|
|
17965
18036
|
`powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
|
|
17966
18037
|
{ stdio: ["ignore", "pipe", "pipe"], encoding: "utf-8" }
|
|
17967
18038
|
);
|
|
@@ -17973,23 +18044,23 @@ function screenshot(processName) {
|
|
|
17973
18044
|
const config = loadConfig();
|
|
17974
18045
|
const outputDir = resolve13(config.screenshot.outputDir);
|
|
17975
18046
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
17976
|
-
console.log(
|
|
18047
|
+
console.log(chalk162.gray(`Capturing window for process "${processName}" ...`));
|
|
17977
18048
|
try {
|
|
17978
18049
|
runPowerShellScript(processName, outputPath);
|
|
17979
|
-
console.log(
|
|
18050
|
+
console.log(chalk162.green(`Screenshot saved: ${outputPath}`));
|
|
17980
18051
|
} catch (error) {
|
|
17981
18052
|
const msg = error instanceof Error ? error.message : String(error);
|
|
17982
|
-
console.error(
|
|
18053
|
+
console.error(chalk162.red(`Failed to capture screenshot: ${msg}`));
|
|
17983
18054
|
process.exit(1);
|
|
17984
18055
|
}
|
|
17985
18056
|
}
|
|
17986
18057
|
|
|
17987
18058
|
// src/commands/sessions/daemon/listDaemonPids.ts
|
|
17988
|
-
import { execFileSync as
|
|
18059
|
+
import { execFileSync as execFileSync10 } from "child_process";
|
|
17989
18060
|
function listDaemonPids() {
|
|
17990
18061
|
if (process.platform === "win32") return [];
|
|
17991
18062
|
try {
|
|
17992
|
-
const out =
|
|
18063
|
+
const out = execFileSync10("ps", ["-eo", "pid=,args="], {
|
|
17993
18064
|
encoding: "utf-8"
|
|
17994
18065
|
});
|
|
17995
18066
|
return out.split("\n").filter((line) => line.includes("assist") && / daemon run\b/.test(line)).map((line) => Number.parseInt(line.trim(), 10)).filter((pid) => Number.isInteger(pid));
|
|
@@ -18212,14 +18283,14 @@ import * as pty from "node-pty";
|
|
|
18212
18283
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
18213
18284
|
import { chmodSync, existsSync as existsSync51, statSync as statSync6 } from "fs";
|
|
18214
18285
|
import { createRequire as createRequire3 } from "module";
|
|
18215
|
-
import
|
|
18286
|
+
import path47 from "path";
|
|
18216
18287
|
var require4 = createRequire3(import.meta.url);
|
|
18217
18288
|
var ensured = false;
|
|
18218
18289
|
function ensureSpawnHelperExecutable() {
|
|
18219
18290
|
if (ensured || process.platform !== "darwin") return;
|
|
18220
18291
|
ensured = true;
|
|
18221
|
-
const ptyRoot =
|
|
18222
|
-
const helper =
|
|
18292
|
+
const ptyRoot = path47.join(path47.dirname(require4.resolve("node-pty")), "..");
|
|
18293
|
+
const helper = path47.join(
|
|
18223
18294
|
ptyRoot,
|
|
18224
18295
|
"prebuilds",
|
|
18225
18296
|
`${process.platform}-${process.arch}`,
|
|
@@ -18462,8 +18533,8 @@ import { dirname as dirname26 } from "path";
|
|
|
18462
18533
|
var DEBOUNCE_MS = 50;
|
|
18463
18534
|
function watchActivity(session, notify2) {
|
|
18464
18535
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
18465
|
-
const
|
|
18466
|
-
const dir = dirname26(
|
|
18536
|
+
const path56 = activityPath(session.id);
|
|
18537
|
+
const dir = dirname26(path56);
|
|
18467
18538
|
try {
|
|
18468
18539
|
mkdirSync22(dir, { recursive: true });
|
|
18469
18540
|
} catch {
|
|
@@ -18472,7 +18543,7 @@ function watchActivity(session, notify2) {
|
|
|
18472
18543
|
let timer = null;
|
|
18473
18544
|
const read = () => {
|
|
18474
18545
|
timer = null;
|
|
18475
|
-
const activity2 = readActivity(
|
|
18546
|
+
const activity2 = readActivity(path56);
|
|
18476
18547
|
if (!activity2) return;
|
|
18477
18548
|
session.activity = activity2;
|
|
18478
18549
|
if (activity2.claudeSessionId)
|
|
@@ -18480,11 +18551,11 @@ function watchActivity(session, notify2) {
|
|
|
18480
18551
|
notify2();
|
|
18481
18552
|
};
|
|
18482
18553
|
session.activityWatcher = watch(dir, (_event, filename) => {
|
|
18483
|
-
if (filename && !
|
|
18554
|
+
if (filename && !path56.endsWith(filename)) return;
|
|
18484
18555
|
if (timer) clearTimeout(timer);
|
|
18485
18556
|
timer = setTimeout(read, DEBOUNCE_MS);
|
|
18486
18557
|
});
|
|
18487
|
-
if (existsSync52(
|
|
18558
|
+
if (existsSync52(path56)) read();
|
|
18488
18559
|
}
|
|
18489
18560
|
function refreshActivity(session) {
|
|
18490
18561
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -19004,17 +19075,17 @@ var WindowsProxy = class {
|
|
|
19004
19075
|
};
|
|
19005
19076
|
|
|
19006
19077
|
// src/commands/sessions/daemon/watchClaudeSessionId.ts
|
|
19007
|
-
import * as
|
|
19008
|
-
import * as
|
|
19078
|
+
import * as fs29 from "fs";
|
|
19079
|
+
import * as path50 from "path";
|
|
19009
19080
|
|
|
19010
19081
|
// src/commands/sessions/shared/discoverSessions.ts
|
|
19011
|
-
import * as
|
|
19082
|
+
import * as fs28 from "fs";
|
|
19012
19083
|
import * as os from "os";
|
|
19013
|
-
import * as
|
|
19084
|
+
import * as path49 from "path";
|
|
19014
19085
|
|
|
19015
19086
|
// src/commands/sessions/shared/parseSessionFile.ts
|
|
19016
|
-
import * as
|
|
19017
|
-
import * as
|
|
19087
|
+
import * as fs27 from "fs";
|
|
19088
|
+
import * as path48 from "path";
|
|
19018
19089
|
|
|
19019
19090
|
// src/commands/sessions/shared/deriveHistoryFields.ts
|
|
19020
19091
|
var KNOWN = ["draft", "next", "bug", "refine", "run"];
|
|
@@ -19103,10 +19174,10 @@ function matchMarker(text3, tag) {
|
|
|
19103
19174
|
async function parseSessionFile(filePath, origin = "wsl") {
|
|
19104
19175
|
let handle;
|
|
19105
19176
|
try {
|
|
19106
|
-
handle = await
|
|
19177
|
+
handle = await fs27.promises.open(filePath, "r");
|
|
19107
19178
|
const meta = extractSessionMeta(await readHeadLines(handle));
|
|
19108
19179
|
if (!meta.sessionId) return null;
|
|
19109
|
-
const timestamp = meta.timestamp || (await
|
|
19180
|
+
const timestamp = meta.timestamp || (await fs27.promises.stat(filePath)).mtime.toISOString();
|
|
19110
19181
|
return {
|
|
19111
19182
|
sessionId: meta.sessionId,
|
|
19112
19183
|
name: meta.name || `Session ${meta.sessionId.slice(0, 8)}`,
|
|
@@ -19129,10 +19200,10 @@ async function readHeadLines(handle) {
|
|
|
19129
19200
|
}
|
|
19130
19201
|
function deriveProject(cwd, filePath, origin) {
|
|
19131
19202
|
if (!cwd) return dirNameToProject(filePath);
|
|
19132
|
-
return origin === "windows" ?
|
|
19203
|
+
return origin === "windows" ? path48.win32.basename(cwd) : path48.basename(cwd);
|
|
19133
19204
|
}
|
|
19134
19205
|
function dirNameToProject(filePath) {
|
|
19135
|
-
const dirName =
|
|
19206
|
+
const dirName = path48.basename(path48.dirname(filePath));
|
|
19136
19207
|
const parts = dirName.split("--");
|
|
19137
19208
|
return parts[parts.length - 1].replace(/-/g, "/");
|
|
19138
19209
|
}
|
|
@@ -19140,7 +19211,7 @@ function dirNameToProject(filePath) {
|
|
|
19140
19211
|
// src/commands/sessions/shared/discoverSessions.ts
|
|
19141
19212
|
function sessionRoots() {
|
|
19142
19213
|
const roots = [
|
|
19143
|
-
{ dir:
|
|
19214
|
+
{ dir: path49.join(os.homedir(), ".claude", "projects"), origin: "wsl" }
|
|
19144
19215
|
];
|
|
19145
19216
|
const windowsRoot = loadConfig().sessions?.windowsProjectsRoot;
|
|
19146
19217
|
if (windowsRoot) roots.push({ dir: windowsRoot, origin: "windows" });
|
|
@@ -19152,22 +19223,22 @@ async function discoverSessionJsonlPaths() {
|
|
|
19152
19223
|
sessionRoots().map(async ({ dir, origin }) => {
|
|
19153
19224
|
let projectDirs;
|
|
19154
19225
|
try {
|
|
19155
|
-
projectDirs = await
|
|
19226
|
+
projectDirs = await fs28.promises.readdir(dir);
|
|
19156
19227
|
} catch {
|
|
19157
19228
|
return;
|
|
19158
19229
|
}
|
|
19159
19230
|
await Promise.all(
|
|
19160
19231
|
projectDirs.map(async (dirName) => {
|
|
19161
|
-
const dirPath =
|
|
19232
|
+
const dirPath = path49.join(dir, dirName);
|
|
19162
19233
|
let entries;
|
|
19163
19234
|
try {
|
|
19164
|
-
entries = await
|
|
19235
|
+
entries = await fs28.promises.readdir(dirPath);
|
|
19165
19236
|
} catch {
|
|
19166
19237
|
return;
|
|
19167
19238
|
}
|
|
19168
19239
|
for (const file of entries) {
|
|
19169
19240
|
if (file.endsWith(".jsonl"))
|
|
19170
|
-
results.push({ path:
|
|
19241
|
+
results.push({ path: path49.join(dirPath, file), origin });
|
|
19171
19242
|
}
|
|
19172
19243
|
})
|
|
19173
19244
|
);
|
|
@@ -19214,7 +19285,7 @@ async function findLatestSessionId(options2) {
|
|
|
19214
19285
|
if (createdMs === null) continue;
|
|
19215
19286
|
const meta = await parseSessionFile(filePath, origin);
|
|
19216
19287
|
if (!meta?.cwd || options2.isClaimed(meta.sessionId)) continue;
|
|
19217
|
-
if (
|
|
19288
|
+
if (path50.resolve(meta.cwd) !== path50.resolve(options2.cwd)) continue;
|
|
19218
19289
|
if (!latest || createdMs > latest.createdMs)
|
|
19219
19290
|
latest = { sessionId: meta.sessionId, createdMs };
|
|
19220
19291
|
}
|
|
@@ -19222,7 +19293,7 @@ async function findLatestSessionId(options2) {
|
|
|
19222
19293
|
}
|
|
19223
19294
|
async function createdSince(filePath, sinceMs) {
|
|
19224
19295
|
try {
|
|
19225
|
-
const stat = await
|
|
19296
|
+
const stat = await fs29.promises.stat(filePath);
|
|
19226
19297
|
const createdMs = stat.birthtimeMs || stat.mtimeMs;
|
|
19227
19298
|
return createdMs >= sinceMs ? createdMs : null;
|
|
19228
19299
|
} catch {
|
|
@@ -19400,7 +19471,7 @@ import * as net3 from "net";
|
|
|
19400
19471
|
import { createInterface as createInterface7 } from "readline";
|
|
19401
19472
|
|
|
19402
19473
|
// src/commands/sessions/shared/parseTranscript.ts
|
|
19403
|
-
import * as
|
|
19474
|
+
import * as fs30 from "fs";
|
|
19404
19475
|
|
|
19405
19476
|
// src/commands/sessions/shared/toolTarget.ts
|
|
19406
19477
|
function toolTarget(input) {
|
|
@@ -19448,11 +19519,11 @@ function cleanUserText(value) {
|
|
|
19448
19519
|
}
|
|
19449
19520
|
|
|
19450
19521
|
// src/commands/sessions/shared/findSessionJsonlPath.ts
|
|
19451
|
-
import * as
|
|
19522
|
+
import * as path51 from "path";
|
|
19452
19523
|
async function findSessionJsonlPath(sessionId) {
|
|
19453
19524
|
const paths = await discoverSessionJsonlPaths();
|
|
19454
19525
|
const direct = paths.find(
|
|
19455
|
-
(p) =>
|
|
19526
|
+
(p) => path51.basename(p.path, ".jsonl") === sessionId
|
|
19456
19527
|
);
|
|
19457
19528
|
if (direct) return direct.path;
|
|
19458
19529
|
for (const p of paths) {
|
|
@@ -19467,7 +19538,7 @@ async function parseTranscript(sessionId) {
|
|
|
19467
19538
|
const filePath = await findSessionJsonlPath(sessionId);
|
|
19468
19539
|
if (!filePath) return [];
|
|
19469
19540
|
try {
|
|
19470
|
-
const raw = await
|
|
19541
|
+
const raw = await fs30.promises.readFile(filePath, "utf8");
|
|
19471
19542
|
return parseTranscriptLines(raw.split("\n"));
|
|
19472
19543
|
} catch {
|
|
19473
19544
|
return [];
|
|
@@ -19729,37 +19800,37 @@ function registerDaemon(program2) {
|
|
|
19729
19800
|
}
|
|
19730
19801
|
|
|
19731
19802
|
// src/commands/sessions/summarise/index.ts
|
|
19732
|
-
import * as
|
|
19733
|
-
import
|
|
19803
|
+
import * as fs33 from "fs";
|
|
19804
|
+
import chalk163 from "chalk";
|
|
19734
19805
|
|
|
19735
19806
|
// src/commands/sessions/summarise/shared.ts
|
|
19736
|
-
import * as
|
|
19807
|
+
import * as fs31 from "fs";
|
|
19737
19808
|
function writeSummary(jsonlPath2, summary) {
|
|
19738
|
-
|
|
19809
|
+
fs31.writeFileSync(summaryPathFor(jsonlPath2), `${summary.trim()}
|
|
19739
19810
|
`, "utf8");
|
|
19740
19811
|
}
|
|
19741
19812
|
function hasSummary(jsonlPath2) {
|
|
19742
|
-
return
|
|
19813
|
+
return fs31.existsSync(summaryPathFor(jsonlPath2));
|
|
19743
19814
|
}
|
|
19744
19815
|
function summaryPathFor(jsonlPath2) {
|
|
19745
19816
|
return jsonlPath2.replace(/\.jsonl$/, ".summary");
|
|
19746
19817
|
}
|
|
19747
19818
|
|
|
19748
19819
|
// src/commands/sessions/summarise/summariseSession.ts
|
|
19749
|
-
import { execFileSync as
|
|
19820
|
+
import { execFileSync as execFileSync11 } from "child_process";
|
|
19750
19821
|
|
|
19751
19822
|
// src/commands/sessions/summarise/iterateUserMessages.ts
|
|
19752
|
-
import * as
|
|
19823
|
+
import * as fs32 from "fs";
|
|
19753
19824
|
function* iterateUserMessages(filePath, maxBytes = 65536) {
|
|
19754
19825
|
let content;
|
|
19755
19826
|
try {
|
|
19756
|
-
const fd =
|
|
19827
|
+
const fd = fs32.openSync(filePath, "r");
|
|
19757
19828
|
try {
|
|
19758
19829
|
const buf = Buffer.alloc(maxBytes);
|
|
19759
|
-
const bytesRead =
|
|
19830
|
+
const bytesRead = fs32.readSync(fd, buf, 0, buf.length, 0);
|
|
19760
19831
|
content = buf.toString("utf8", 0, bytesRead);
|
|
19761
19832
|
} finally {
|
|
19762
|
-
|
|
19833
|
+
fs32.closeSync(fd);
|
|
19763
19834
|
}
|
|
19764
19835
|
} catch {
|
|
19765
19836
|
return;
|
|
@@ -19823,7 +19894,7 @@ function summariseSession(jsonlPath2) {
|
|
|
19823
19894
|
}
|
|
19824
19895
|
const prompt = buildPrompt2(firstMessage, backlogIds);
|
|
19825
19896
|
try {
|
|
19826
|
-
const output =
|
|
19897
|
+
const output = execFileSync11("claude", ["-p", "--model", "haiku", prompt], {
|
|
19827
19898
|
encoding: "utf8",
|
|
19828
19899
|
timeout: 3e4,
|
|
19829
19900
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -19857,29 +19928,29 @@ ${firstMessage}`);
|
|
|
19857
19928
|
async function summarise4(options2) {
|
|
19858
19929
|
const files = await discoverSessionFiles();
|
|
19859
19930
|
if (files.length === 0) {
|
|
19860
|
-
console.log(
|
|
19931
|
+
console.log(chalk163.yellow("No sessions found."));
|
|
19861
19932
|
return;
|
|
19862
19933
|
}
|
|
19863
19934
|
const toProcess = selectCandidates(files, options2);
|
|
19864
19935
|
if (toProcess.length === 0) {
|
|
19865
|
-
console.log(
|
|
19936
|
+
console.log(chalk163.green("All sessions already summarised."));
|
|
19866
19937
|
return;
|
|
19867
19938
|
}
|
|
19868
19939
|
console.log(
|
|
19869
|
-
|
|
19940
|
+
chalk163.cyan(
|
|
19870
19941
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
19871
19942
|
)
|
|
19872
19943
|
);
|
|
19873
19944
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
19874
19945
|
console.log(
|
|
19875
|
-
|
|
19946
|
+
chalk163.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk163.yellow(`, ${failed2} skipped`) : "")
|
|
19876
19947
|
);
|
|
19877
19948
|
}
|
|
19878
19949
|
function selectCandidates(files, options2) {
|
|
19879
19950
|
const candidates = options2.force ? files : files.filter((f) => !hasSummary(f));
|
|
19880
19951
|
candidates.sort((a, b) => {
|
|
19881
19952
|
try {
|
|
19882
|
-
return
|
|
19953
|
+
return fs33.statSync(b).mtimeMs - fs33.statSync(a).mtimeMs;
|
|
19883
19954
|
} catch {
|
|
19884
19955
|
return 0;
|
|
19885
19956
|
}
|
|
@@ -19892,16 +19963,16 @@ function processSessions(files) {
|
|
|
19892
19963
|
let failed2 = 0;
|
|
19893
19964
|
for (let i = 0; i < files.length; i++) {
|
|
19894
19965
|
const file = files[i];
|
|
19895
|
-
process.stdout.write(
|
|
19966
|
+
process.stdout.write(chalk163.dim(` [${i + 1}/${files.length}] `));
|
|
19896
19967
|
const summary = summariseSession(file);
|
|
19897
19968
|
if (summary) {
|
|
19898
19969
|
writeSummary(file, summary);
|
|
19899
19970
|
succeeded++;
|
|
19900
|
-
process.stdout.write(`${
|
|
19971
|
+
process.stdout.write(`${chalk163.green("\u2713")} ${summary}
|
|
19901
19972
|
`);
|
|
19902
19973
|
} else {
|
|
19903
19974
|
failed2++;
|
|
19904
|
-
process.stdout.write(` ${
|
|
19975
|
+
process.stdout.write(` ${chalk163.yellow("skip")}
|
|
19905
19976
|
`);
|
|
19906
19977
|
}
|
|
19907
19978
|
}
|
|
@@ -19916,10 +19987,10 @@ function registerSessions(program2) {
|
|
|
19916
19987
|
}
|
|
19917
19988
|
|
|
19918
19989
|
// src/commands/statusLine.ts
|
|
19919
|
-
import
|
|
19990
|
+
import chalk165 from "chalk";
|
|
19920
19991
|
|
|
19921
19992
|
// src/commands/buildLimitsSegment.ts
|
|
19922
|
-
import
|
|
19993
|
+
import chalk164 from "chalk";
|
|
19923
19994
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
19924
19995
|
var SEVEN_DAY_SECONDS = 7 * 86400;
|
|
19925
19996
|
function formatTimeLeft(resetsAt) {
|
|
@@ -19942,10 +20013,10 @@ function projectUsage(pct, resetsAt, windowSeconds) {
|
|
|
19942
20013
|
function colorizeRateLimit(pct, resetsAt, windowSeconds) {
|
|
19943
20014
|
const label2 = `${Math.round(pct)}%`;
|
|
19944
20015
|
const projected = projectUsage(pct, resetsAt, windowSeconds);
|
|
19945
|
-
if (projected == null) return
|
|
19946
|
-
if (projected > 100) return
|
|
19947
|
-
if (projected > 75) return
|
|
19948
|
-
return
|
|
20016
|
+
if (projected == null) return chalk164.green(label2);
|
|
20017
|
+
if (projected > 100) return chalk164.red(label2);
|
|
20018
|
+
if (projected > 75) return chalk164.yellow(label2);
|
|
20019
|
+
return chalk164.green(label2);
|
|
19949
20020
|
}
|
|
19950
20021
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel) {
|
|
19951
20022
|
const timeLabel = resetsAt ? formatTimeLeft(resetsAt) : fallbackLabel;
|
|
@@ -19971,14 +20042,14 @@ function buildLimitsSegment(rateLimits) {
|
|
|
19971
20042
|
}
|
|
19972
20043
|
|
|
19973
20044
|
// src/commands/statusLine.ts
|
|
19974
|
-
|
|
20045
|
+
chalk165.level = 3;
|
|
19975
20046
|
function formatNumber(num) {
|
|
19976
20047
|
return num.toLocaleString("en-US");
|
|
19977
20048
|
}
|
|
19978
20049
|
function colorizePercent(pct) {
|
|
19979
20050
|
const label2 = `${Math.round(pct)}%`;
|
|
19980
|
-
if (pct > 80) return
|
|
19981
|
-
if (pct > 40) return
|
|
20051
|
+
if (pct > 80) return chalk165.red(label2);
|
|
20052
|
+
if (pct > 40) return chalk165.yellow(label2);
|
|
19982
20053
|
return label2;
|
|
19983
20054
|
}
|
|
19984
20055
|
async function statusLine() {
|
|
@@ -19993,29 +20064,29 @@ async function statusLine() {
|
|
|
19993
20064
|
}
|
|
19994
20065
|
|
|
19995
20066
|
// src/commands/sync.ts
|
|
19996
|
-
import * as
|
|
20067
|
+
import * as fs36 from "fs";
|
|
19997
20068
|
import * as os2 from "os";
|
|
19998
|
-
import * as
|
|
20069
|
+
import * as path54 from "path";
|
|
19999
20070
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
20000
20071
|
|
|
20001
20072
|
// src/commands/sync/syncClaudeMd.ts
|
|
20002
|
-
import * as
|
|
20003
|
-
import * as
|
|
20004
|
-
import
|
|
20073
|
+
import * as fs34 from "fs";
|
|
20074
|
+
import * as path52 from "path";
|
|
20075
|
+
import chalk166 from "chalk";
|
|
20005
20076
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
20006
|
-
const source =
|
|
20007
|
-
const target =
|
|
20008
|
-
const sourceContent =
|
|
20009
|
-
if (
|
|
20010
|
-
const targetContent =
|
|
20077
|
+
const source = path52.join(claudeDir, "CLAUDE.md");
|
|
20078
|
+
const target = path52.join(targetBase, "CLAUDE.md");
|
|
20079
|
+
const sourceContent = fs34.readFileSync(source, "utf-8");
|
|
20080
|
+
if (fs34.existsSync(target)) {
|
|
20081
|
+
const targetContent = fs34.readFileSync(target, "utf-8");
|
|
20011
20082
|
if (sourceContent !== targetContent) {
|
|
20012
20083
|
console.log(
|
|
20013
|
-
|
|
20084
|
+
chalk166.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
20014
20085
|
);
|
|
20015
20086
|
console.log();
|
|
20016
20087
|
printDiff(targetContent, sourceContent);
|
|
20017
20088
|
const confirm = options2?.yes || await promptConfirm(
|
|
20018
|
-
|
|
20089
|
+
chalk166.red("Overwrite existing CLAUDE.md?"),
|
|
20019
20090
|
false
|
|
20020
20091
|
);
|
|
20021
20092
|
if (!confirm) {
|
|
@@ -20024,21 +20095,21 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
20024
20095
|
}
|
|
20025
20096
|
}
|
|
20026
20097
|
}
|
|
20027
|
-
|
|
20098
|
+
fs34.copyFileSync(source, target);
|
|
20028
20099
|
console.log("Copied CLAUDE.md to ~/.claude/CLAUDE.md");
|
|
20029
20100
|
}
|
|
20030
20101
|
|
|
20031
20102
|
// src/commands/sync/syncSettings.ts
|
|
20032
|
-
import * as
|
|
20033
|
-
import * as
|
|
20034
|
-
import
|
|
20103
|
+
import * as fs35 from "fs";
|
|
20104
|
+
import * as path53 from "path";
|
|
20105
|
+
import chalk167 from "chalk";
|
|
20035
20106
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
20036
|
-
const source =
|
|
20037
|
-
const target =
|
|
20038
|
-
const sourceContent =
|
|
20107
|
+
const source = path53.join(claudeDir, "settings.json");
|
|
20108
|
+
const target = path53.join(targetBase, "settings.json");
|
|
20109
|
+
const sourceContent = fs35.readFileSync(source, "utf-8");
|
|
20039
20110
|
const mergedContent = JSON.stringify(JSON.parse(sourceContent), null, " ");
|
|
20040
|
-
if (
|
|
20041
|
-
const targetContent =
|
|
20111
|
+
if (fs35.existsSync(target)) {
|
|
20112
|
+
const targetContent = fs35.readFileSync(target, "utf-8");
|
|
20042
20113
|
const normalizedTarget = JSON.stringify(
|
|
20043
20114
|
JSON.parse(targetContent),
|
|
20044
20115
|
null,
|
|
@@ -20047,14 +20118,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
20047
20118
|
if (mergedContent !== normalizedTarget) {
|
|
20048
20119
|
if (!options2?.yes) {
|
|
20049
20120
|
console.log(
|
|
20050
|
-
|
|
20121
|
+
chalk167.yellow(
|
|
20051
20122
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
20052
20123
|
)
|
|
20053
20124
|
);
|
|
20054
20125
|
console.log();
|
|
20055
20126
|
printDiff(targetContent, mergedContent);
|
|
20056
20127
|
const confirm = await promptConfirm(
|
|
20057
|
-
|
|
20128
|
+
chalk167.red("Overwrite existing settings.json?"),
|
|
20058
20129
|
false
|
|
20059
20130
|
);
|
|
20060
20131
|
if (!confirm) {
|
|
@@ -20064,45 +20135,45 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
20064
20135
|
}
|
|
20065
20136
|
}
|
|
20066
20137
|
}
|
|
20067
|
-
|
|
20138
|
+
fs35.writeFileSync(target, mergedContent);
|
|
20068
20139
|
console.log("Copied settings.json to ~/.claude/settings.json");
|
|
20069
20140
|
}
|
|
20070
20141
|
|
|
20071
20142
|
// src/commands/sync.ts
|
|
20072
20143
|
var __filename4 = fileURLToPath7(import.meta.url);
|
|
20073
|
-
var __dirname7 =
|
|
20144
|
+
var __dirname7 = path54.dirname(__filename4);
|
|
20074
20145
|
async function sync(options2) {
|
|
20075
20146
|
const config = loadConfig();
|
|
20076
20147
|
const yes = options2?.yes ?? config.sync.autoConfirm;
|
|
20077
|
-
const claudeDir =
|
|
20078
|
-
const targetBase =
|
|
20148
|
+
const claudeDir = path54.join(__dirname7, "..", "claude");
|
|
20149
|
+
const targetBase = path54.join(os2.homedir(), ".claude");
|
|
20079
20150
|
syncCommands(claudeDir, targetBase);
|
|
20080
20151
|
await syncSettings(claudeDir, targetBase, { yes });
|
|
20081
20152
|
await syncClaudeMd(claudeDir, targetBase, { yes });
|
|
20082
20153
|
}
|
|
20083
20154
|
function syncCommands(claudeDir, targetBase) {
|
|
20084
|
-
const sourceDir =
|
|
20085
|
-
const targetDir =
|
|
20086
|
-
|
|
20087
|
-
const files =
|
|
20155
|
+
const sourceDir = path54.join(claudeDir, "commands");
|
|
20156
|
+
const targetDir = path54.join(targetBase, "commands");
|
|
20157
|
+
fs36.mkdirSync(targetDir, { recursive: true });
|
|
20158
|
+
const files = fs36.readdirSync(sourceDir);
|
|
20088
20159
|
for (const file of files) {
|
|
20089
|
-
|
|
20160
|
+
fs36.copyFileSync(path54.join(sourceDir, file), path54.join(targetDir, file));
|
|
20090
20161
|
console.log(`Copied ${file} to ${targetDir}`);
|
|
20091
20162
|
}
|
|
20092
20163
|
console.log(`Synced ${files.length} command(s) to ~/.claude/commands`);
|
|
20093
20164
|
}
|
|
20094
20165
|
|
|
20095
20166
|
// src/commands/update.ts
|
|
20096
|
-
import { execSync as
|
|
20097
|
-
import * as
|
|
20167
|
+
import { execSync as execSync49 } from "child_process";
|
|
20168
|
+
import * as path55 from "path";
|
|
20098
20169
|
function isGlobalNpmInstall(dir) {
|
|
20099
20170
|
try {
|
|
20100
|
-
const resolved =
|
|
20101
|
-
if (resolved.split(
|
|
20171
|
+
const resolved = path55.resolve(dir);
|
|
20172
|
+
if (resolved.split(path55.sep).includes("node_modules")) {
|
|
20102
20173
|
return true;
|
|
20103
20174
|
}
|
|
20104
|
-
const globalPrefix =
|
|
20105
|
-
return resolved.toLowerCase().startsWith(
|
|
20175
|
+
const globalPrefix = execSync49("npm prefix -g", { stdio: "pipe" }).toString().trim();
|
|
20176
|
+
return resolved.toLowerCase().startsWith(path55.resolve(globalPrefix).toLowerCase());
|
|
20106
20177
|
} catch {
|
|
20107
20178
|
return false;
|
|
20108
20179
|
}
|
|
@@ -20112,18 +20183,18 @@ async function update2() {
|
|
|
20112
20183
|
console.log(`Assist is installed at: ${installDir}`);
|
|
20113
20184
|
if (isGitRepo(installDir)) {
|
|
20114
20185
|
console.log("Detected git repo installation, pulling latest...");
|
|
20115
|
-
|
|
20186
|
+
execSync49("git pull", { cwd: installDir, stdio: "inherit" });
|
|
20116
20187
|
console.log("Installing dependencies...");
|
|
20117
|
-
|
|
20188
|
+
execSync49("npm i", { cwd: installDir, stdio: "inherit" });
|
|
20118
20189
|
console.log("Building...");
|
|
20119
|
-
|
|
20190
|
+
execSync49("npm run build", { cwd: installDir, stdio: "inherit" });
|
|
20120
20191
|
console.log("Syncing commands...");
|
|
20121
|
-
|
|
20192
|
+
execSync49("assist sync", { stdio: "inherit" });
|
|
20122
20193
|
} else if (isGlobalNpmInstall(installDir)) {
|
|
20123
20194
|
console.log("Detected global npm installation, updating...");
|
|
20124
|
-
|
|
20195
|
+
execSync49("npm i -g @staff0rd/assist@latest", { stdio: "inherit" });
|
|
20125
20196
|
console.log("Syncing commands...");
|
|
20126
|
-
|
|
20197
|
+
execSync49("assist sync", { stdio: "inherit" });
|
|
20127
20198
|
} else {
|
|
20128
20199
|
console.error(
|
|
20129
20200
|
"Could not determine installation method. Expected a git repo or global npm install."
|