@staff0rd/assist 0.423.1 → 0.425.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/commands/sessions/web/bundle.css +1 -0
- package/dist/commands/sessions/web/bundle.js +532 -495
- package/dist/index.js +511 -412
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.425.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -68,6 +68,8 @@ var package_default = {
|
|
|
68
68
|
"node-pty": "^1.1.0",
|
|
69
69
|
pg: "^8.21.0",
|
|
70
70
|
"pg-copy-streams": "^7.0.0",
|
|
71
|
+
"react-diff-view": "^3.3.3",
|
|
72
|
+
refractor: "^3.6.0",
|
|
71
73
|
semver: "^7.7.3",
|
|
72
74
|
"shell-quote": "^1.8.3",
|
|
73
75
|
"ts-morph": "^27.0.2",
|
|
@@ -3394,11 +3396,11 @@ function collectFileComments(file, lines, project) {
|
|
|
3394
3396
|
// src/commands/verify/blockCodeComments/parseDiffAddedLines.ts
|
|
3395
3397
|
var FILE_HEADER = /^\+\+\+ (?:b\/)?(.+)$/;
|
|
3396
3398
|
var HUNK_HEADER = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/;
|
|
3397
|
-
function parseDiffAddedLines(
|
|
3399
|
+
function parseDiffAddedLines(diff3) {
|
|
3398
3400
|
const added = /* @__PURE__ */ new Map();
|
|
3399
3401
|
let currentFile = null;
|
|
3400
3402
|
let newLine = 0;
|
|
3401
|
-
for (const line of
|
|
3403
|
+
for (const line of diff3.split("\n")) {
|
|
3402
3404
|
const fileMatch = line.match(FILE_HEADER);
|
|
3403
3405
|
if (fileMatch) {
|
|
3404
3406
|
const file = fileMatch[1];
|
|
@@ -3446,11 +3448,11 @@ function shouldScan(file, ignoreGlobs) {
|
|
|
3446
3448
|
return fs15.existsSync(file);
|
|
3447
3449
|
}
|
|
3448
3450
|
function findComments(options2) {
|
|
3449
|
-
const
|
|
3451
|
+
const diff3 = execSync10("git diff HEAD", {
|
|
3450
3452
|
encoding: "utf8",
|
|
3451
3453
|
maxBuffer: 64 * 1024 * 1024
|
|
3452
3454
|
});
|
|
3453
|
-
const addedLines = parseDiffAddedLines(
|
|
3455
|
+
const addedLines = parseDiffAddedLines(diff3);
|
|
3454
3456
|
const project = new Project2({
|
|
3455
3457
|
skipAddingFilesFromTsConfig: true,
|
|
3456
3458
|
compilerOptions: { allowJs: true }
|
|
@@ -8043,7 +8045,7 @@ import { createHash } from "crypto";
|
|
|
8043
8045
|
import { readFileSync as readFileSync18 } from "fs";
|
|
8044
8046
|
import { dirname as dirname19, join as join22 } from "path";
|
|
8045
8047
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
8046
|
-
function createBundleHandler(importMetaUrl, bundlePath) {
|
|
8048
|
+
function createBundleHandler(importMetaUrl, bundlePath, contentType = "application/javascript") {
|
|
8047
8049
|
const dir = dirname19(fileURLToPath4(importMetaUrl));
|
|
8048
8050
|
let cache2;
|
|
8049
8051
|
return (req, res) => {
|
|
@@ -8062,7 +8064,7 @@ function createBundleHandler(importMetaUrl, bundlePath) {
|
|
|
8062
8064
|
return;
|
|
8063
8065
|
}
|
|
8064
8066
|
res.writeHead(200, {
|
|
8065
|
-
"Content-Type":
|
|
8067
|
+
"Content-Type": contentType,
|
|
8066
8068
|
...headers
|
|
8067
8069
|
});
|
|
8068
8070
|
res.end(cache2.body);
|
|
@@ -8520,6 +8522,75 @@ async function handleItemRoute(req, res, pathname) {
|
|
|
8520
8522
|
return false;
|
|
8521
8523
|
}
|
|
8522
8524
|
|
|
8525
|
+
// src/commands/sessions/web/execGit.ts
|
|
8526
|
+
import { execFile as execFile2 } from "child_process";
|
|
8527
|
+
import { promisify as promisify2 } from "util";
|
|
8528
|
+
var execFileAsync2 = promisify2(execFile2);
|
|
8529
|
+
async function execGit(cwd, args, opts = {}) {
|
|
8530
|
+
const { maxBuffer, allowFailure } = opts;
|
|
8531
|
+
const { file, argv } = /^[A-Za-z]:[\\/]/.test(cwd) ? { file: "git.exe", argv: ["-C", cwd, ...args] } : { file: "git", argv: args };
|
|
8532
|
+
try {
|
|
8533
|
+
const { stdout } = await execFileAsync2(file, argv, {
|
|
8534
|
+
encoding: "utf8",
|
|
8535
|
+
...maxBuffer ? { maxBuffer } : {},
|
|
8536
|
+
...file === "git" ? { cwd } : {}
|
|
8537
|
+
});
|
|
8538
|
+
return stdout;
|
|
8539
|
+
} catch (error) {
|
|
8540
|
+
if (allowFailure && error && typeof error === "object" && "stdout" in error) {
|
|
8541
|
+
return String(error.stdout);
|
|
8542
|
+
}
|
|
8543
|
+
throw error;
|
|
8544
|
+
}
|
|
8545
|
+
}
|
|
8546
|
+
|
|
8547
|
+
// src/commands/sessions/web/getCwdParam.ts
|
|
8548
|
+
function getCwdParam(req, res) {
|
|
8549
|
+
const url = new URL(req.url ?? "/", "http://localhost");
|
|
8550
|
+
const cwd = url.searchParams.get("cwd");
|
|
8551
|
+
if (!cwd) {
|
|
8552
|
+
respondJson(res, 400, { error: "Missing cwd" });
|
|
8553
|
+
return null;
|
|
8554
|
+
}
|
|
8555
|
+
return cwd;
|
|
8556
|
+
}
|
|
8557
|
+
|
|
8558
|
+
// src/commands/sessions/web/diff.ts
|
|
8559
|
+
var MAX_DIFF_BYTES = 50 * 1024 * 1024;
|
|
8560
|
+
async function untrackedFileDiff(cwd, path71) {
|
|
8561
|
+
return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path71], {
|
|
8562
|
+
maxBuffer: MAX_DIFF_BYTES,
|
|
8563
|
+
allowFailure: true
|
|
8564
|
+
});
|
|
8565
|
+
}
|
|
8566
|
+
async function untrackedDiff(cwd) {
|
|
8567
|
+
const list5 = await execGit(cwd, [
|
|
8568
|
+
"ls-files",
|
|
8569
|
+
"--others",
|
|
8570
|
+
"--exclude-standard"
|
|
8571
|
+
]);
|
|
8572
|
+
const paths = list5.split("\n").filter(Boolean);
|
|
8573
|
+
const diffs = await Promise.all(
|
|
8574
|
+
paths.map((path71) => untrackedFileDiff(cwd, path71))
|
|
8575
|
+
);
|
|
8576
|
+
return diffs.join("");
|
|
8577
|
+
}
|
|
8578
|
+
async function diff2(req, res) {
|
|
8579
|
+
const cwd = getCwdParam(req, res);
|
|
8580
|
+
if (!cwd) return;
|
|
8581
|
+
try {
|
|
8582
|
+
const tracked = await execGit(cwd, ["diff", "HEAD"], {
|
|
8583
|
+
maxBuffer: MAX_DIFF_BYTES
|
|
8584
|
+
});
|
|
8585
|
+
const untracked = await untrackedDiff(cwd);
|
|
8586
|
+
res.writeHead(200, { "Content-Type": "text/plain; charset=utf-8" });
|
|
8587
|
+
res.end(tracked + untracked);
|
|
8588
|
+
} catch {
|
|
8589
|
+
res.writeHead(500, { "Content-Type": "text/plain; charset=utf-8" });
|
|
8590
|
+
res.end("");
|
|
8591
|
+
}
|
|
8592
|
+
}
|
|
8593
|
+
|
|
8523
8594
|
// src/shared/db/listBackups.ts
|
|
8524
8595
|
import { desc } from "drizzle-orm";
|
|
8525
8596
|
async function listBackups(db) {
|
|
@@ -8540,6 +8611,7 @@ function getHtml() {
|
|
|
8540
8611
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
8541
8612
|
<title>Assist</title>
|
|
8542
8613
|
<link rel="stylesheet" href="/xterm.css">
|
|
8614
|
+
<link rel="stylesheet" href="/bundle.css">
|
|
8543
8615
|
<style>
|
|
8544
8616
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
8545
8617
|
html, body, #app { width: 100%; height: 100%; }
|
|
@@ -8562,17 +8634,6 @@ function getHtml() {
|
|
|
8562
8634
|
</html>`;
|
|
8563
8635
|
}
|
|
8564
8636
|
|
|
8565
|
-
// src/commands/sessions/web/getCwdParam.ts
|
|
8566
|
-
function getCwdParam(req, res) {
|
|
8567
|
-
const url = new URL(req.url ?? "/", "http://localhost");
|
|
8568
|
-
const cwd = url.searchParams.get("cwd");
|
|
8569
|
-
if (!cwd) {
|
|
8570
|
-
respondJson(res, 400, { error: "Missing cwd" });
|
|
8571
|
-
return null;
|
|
8572
|
-
}
|
|
8573
|
-
return cwd;
|
|
8574
|
-
}
|
|
8575
|
-
|
|
8576
8637
|
// src/commands/sessions/web/windowsCwdToWslPath.ts
|
|
8577
8638
|
function windowsCwdToWslPath(cwd) {
|
|
8578
8639
|
const match = /^([A-Za-z]):[\\/](.*)$/.exec(cwd);
|
|
@@ -8604,11 +8665,11 @@ function handleServerRuns(req, res) {
|
|
|
8604
8665
|
}
|
|
8605
8666
|
|
|
8606
8667
|
// src/commands/sessions/web/getReviewSynthesis.ts
|
|
8607
|
-
import { execFile as
|
|
8668
|
+
import { execFile as execFile3 } from "child_process";
|
|
8608
8669
|
import { readFileSync as readFileSync19 } from "fs";
|
|
8609
8670
|
import { homedir as homedir11 } from "os";
|
|
8610
8671
|
import { basename as basename6, join as join25 } from "path";
|
|
8611
|
-
import { promisify as
|
|
8672
|
+
import { promisify as promisify3 } from "util";
|
|
8612
8673
|
|
|
8613
8674
|
// src/commands/sessions/web/findSynthesisForBranch.ts
|
|
8614
8675
|
import { existsSync as existsSync26, readdirSync as readdirSync2, statSync as statSync2 } from "fs";
|
|
@@ -8623,9 +8684,9 @@ function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
|
8623
8684
|
}
|
|
8624
8685
|
|
|
8625
8686
|
// src/commands/sessions/web/getReviewSynthesis.ts
|
|
8626
|
-
var
|
|
8687
|
+
var execFileAsync3 = promisify3(execFile3);
|
|
8627
8688
|
function runGit(cwd, args) {
|
|
8628
|
-
return
|
|
8689
|
+
return execFileAsync3("git", args, {
|
|
8629
8690
|
encoding: "utf8",
|
|
8630
8691
|
cwd: toGitCwd(cwd)
|
|
8631
8692
|
}).then((r) => r.stdout.trim());
|
|
@@ -8668,10 +8729,6 @@ function githubUrl(req, res) {
|
|
|
8668
8729
|
});
|
|
8669
8730
|
}
|
|
8670
8731
|
|
|
8671
|
-
// src/commands/sessions/web/gitStatus.ts
|
|
8672
|
-
import { execFile as execFile3 } from "child_process";
|
|
8673
|
-
import { promisify as promisify3 } from "util";
|
|
8674
|
-
|
|
8675
8732
|
// src/commands/sessions/web/parseGitStatus.ts
|
|
8676
8733
|
function extractPath(rest) {
|
|
8677
8734
|
const arrow = rest.indexOf(" -> ");
|
|
@@ -8700,24 +8757,20 @@ function parseGitStatus(output) {
|
|
|
8700
8757
|
}
|
|
8701
8758
|
|
|
8702
8759
|
// src/commands/sessions/web/gitStatus.ts
|
|
8703
|
-
var execFileAsync3 = promisify3(execFile3);
|
|
8704
8760
|
async function gitStatus(req, res) {
|
|
8705
8761
|
const cwd = getCwdParam(req, res);
|
|
8706
8762
|
if (!cwd) return;
|
|
8707
8763
|
try {
|
|
8708
|
-
|
|
8764
|
+
const output = await execGit(cwd, [
|
|
8765
|
+
"status",
|
|
8766
|
+
"--porcelain",
|
|
8767
|
+
"--untracked-files=all"
|
|
8768
|
+
]);
|
|
8769
|
+
respondJson(res, 200, parseGitStatus(output));
|
|
8709
8770
|
} catch {
|
|
8710
8771
|
respondJson(res, 200, { new: [], modified: [], deleted: [] });
|
|
8711
8772
|
}
|
|
8712
8773
|
}
|
|
8713
|
-
function runGitStatus(cwd) {
|
|
8714
|
-
const args = ["status", "--porcelain", "--untracked-files=all"];
|
|
8715
|
-
const { file, argv } = /^[A-Za-z]:[\\/]/.test(cwd) ? { file: "git.exe", argv: ["-C", cwd, ...args] } : { file: "git", argv: args };
|
|
8716
|
-
return execFileAsync3(file, argv, {
|
|
8717
|
-
encoding: "utf8",
|
|
8718
|
-
...file === "git" ? { cwd } : {}
|
|
8719
|
-
}).then((r) => r.stdout);
|
|
8720
|
-
}
|
|
8721
8774
|
|
|
8722
8775
|
// src/shared/harnesses.ts
|
|
8723
8776
|
import * as os3 from "os";
|
|
@@ -9267,12 +9320,18 @@ var routes2 = {
|
|
|
9267
9320
|
"commands/sessions/web/bundle.js"
|
|
9268
9321
|
),
|
|
9269
9322
|
"GET /xterm.css": createCssHandler("@xterm/xterm/css/xterm.css"),
|
|
9323
|
+
"GET /bundle.css": createBundleHandler(
|
|
9324
|
+
import.meta.url,
|
|
9325
|
+
"commands/sessions/web/bundle.css",
|
|
9326
|
+
"text/css"
|
|
9327
|
+
),
|
|
9270
9328
|
"GET /api/items": listItems,
|
|
9271
9329
|
"GET /api/backlog/summary": getBacklogSummary,
|
|
9272
9330
|
"POST /api/open-in-code": openInCode,
|
|
9273
9331
|
"POST /api/restart": restartWeb,
|
|
9274
9332
|
"GET /api/github-url": githubUrl,
|
|
9275
9333
|
"GET /api/git-status": gitStatus,
|
|
9334
|
+
"GET /api/diff": diff2,
|
|
9276
9335
|
"GET /api/jira-site": jiraSite,
|
|
9277
9336
|
"GET /api/harness": harnessCapabilities,
|
|
9278
9337
|
"GET /api/pr-status": prStatus,
|
|
@@ -13998,6 +14057,9 @@ function exitKeyNotSet(key) {
|
|
|
13998
14057
|
}
|
|
13999
14058
|
|
|
14000
14059
|
// src/commands/config/configSet.ts
|
|
14060
|
+
import chalk127 from "chalk";
|
|
14061
|
+
|
|
14062
|
+
// src/commands/config/applyConfigSet.ts
|
|
14001
14063
|
import chalk126 from "chalk";
|
|
14002
14064
|
|
|
14003
14065
|
// src/commands/config/setNestedValue.ts
|
|
@@ -14070,13 +14132,57 @@ function formatIssuePath(issue, key) {
|
|
|
14070
14132
|
return issue.path.length > 0 ? issue.path.join(".") : key;
|
|
14071
14133
|
}
|
|
14072
14134
|
|
|
14135
|
+
// src/commands/config/applyConfigSet.ts
|
|
14136
|
+
var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
14137
|
+
function applyConfigSet(key, coerced, global) {
|
|
14138
|
+
assertNotGlobalOnly(key, global);
|
|
14139
|
+
const raw = global ? loadGlobalConfigRaw() : loadProjectConfig();
|
|
14140
|
+
const updated = setNestedValue(raw, key, coerced);
|
|
14141
|
+
validateConfig(updated, key);
|
|
14142
|
+
if (global) {
|
|
14143
|
+
saveGlobalConfig(updated);
|
|
14144
|
+
return "global";
|
|
14145
|
+
}
|
|
14146
|
+
saveConfig(updated);
|
|
14147
|
+
return "project";
|
|
14148
|
+
}
|
|
14149
|
+
function assertNotGlobalOnly(key, global) {
|
|
14150
|
+
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
14151
|
+
console.error(
|
|
14152
|
+
chalk126.red(
|
|
14153
|
+
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
14154
|
+
)
|
|
14155
|
+
);
|
|
14156
|
+
process.exit(1);
|
|
14157
|
+
}
|
|
14158
|
+
}
|
|
14159
|
+
|
|
14160
|
+
// src/shared/resolveNamedRepoWriteLabel.ts
|
|
14161
|
+
var UnknownRepoConfigError = class extends Error {
|
|
14162
|
+
name = "UnknownRepoConfigError";
|
|
14163
|
+
};
|
|
14164
|
+
function resolveNamedRepoWriteLabel(globalRaw, name) {
|
|
14165
|
+
const repos2 = globalRaw.repos;
|
|
14166
|
+
const entries = repos2 && typeof repos2 === "object" && !Array.isArray(repos2) ? repos2 : {};
|
|
14167
|
+
const candidates = originKeyCandidates(name);
|
|
14168
|
+
const matches = Object.keys(entries).filter((key) => candidates.has(key));
|
|
14169
|
+
if (matches.length === 0) {
|
|
14170
|
+
throw new UnknownRepoConfigError(
|
|
14171
|
+
`No repo in ~/.assist.yml matches "${name}". Use an existing repos key (full origin, org/repo, or bare repo name).`
|
|
14172
|
+
);
|
|
14173
|
+
}
|
|
14174
|
+
if (matches.length > 1) {
|
|
14175
|
+
throw new AmbiguousRepoConfigError(
|
|
14176
|
+
`Ambiguous repos config in ~/.assist.yml: keys ${matches.map((m) => `"${m}"`).join(", ")} all match "${name}". Keep a single key per repository.`
|
|
14177
|
+
);
|
|
14178
|
+
}
|
|
14179
|
+
return matches[0];
|
|
14180
|
+
}
|
|
14181
|
+
|
|
14073
14182
|
// src/commands/config/applyRepoConfigSet.ts
|
|
14074
|
-
function applyRepoConfigSet(key, coerced) {
|
|
14183
|
+
function applyRepoConfigSet(key, coerced, repoName) {
|
|
14075
14184
|
const globalRaw = loadGlobalConfigRaw();
|
|
14076
|
-
const label2 = resolveRepoWriteLabel(
|
|
14077
|
-
globalRaw,
|
|
14078
|
-
getCurrentOrigin(process.cwd())
|
|
14079
|
-
);
|
|
14185
|
+
const label2 = repoName === void 0 ? resolveRepoWriteLabel(globalRaw, getCurrentOrigin(process.cwd())) : resolveNamedRepoWriteLabel(globalRaw, repoName);
|
|
14080
14186
|
const repos2 = isPlainObject2(globalRaw.repos) ? { ...globalRaw.repos } : {};
|
|
14081
14187
|
const existingBlock = isPlainObject2(repos2[label2]) ? repos2[label2] : {};
|
|
14082
14188
|
const updatedBlock = setNestedValue(existingBlock, key, coerced);
|
|
@@ -14089,17 +14195,32 @@ function isPlainObject2(value) {
|
|
|
14089
14195
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
14090
14196
|
}
|
|
14091
14197
|
|
|
14198
|
+
// src/commands/config/resolveRepoTarget.ts
|
|
14199
|
+
function resolveRepoTarget(key, value, repo) {
|
|
14200
|
+
if (typeof repo === "string") {
|
|
14201
|
+
if (value === void 0) {
|
|
14202
|
+
return { key: repo, value: key, useRepo: true, repoName: void 0 };
|
|
14203
|
+
}
|
|
14204
|
+
return { key, value, useRepo: true, repoName: repo };
|
|
14205
|
+
}
|
|
14206
|
+
return { key, value, useRepo: repo === true, repoName: void 0 };
|
|
14207
|
+
}
|
|
14208
|
+
|
|
14092
14209
|
// src/commands/config/configSet.ts
|
|
14093
|
-
var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
14094
14210
|
function configSet(key, value, options2 = {}) {
|
|
14095
|
-
|
|
14096
|
-
|
|
14097
|
-
console.error(chalk126.red("Use either --repo or --global, not both"));
|
|
14211
|
+
if (options2.repo !== void 0 && options2.global) {
|
|
14212
|
+
console.error(chalk127.red("Use either --repo or --global, not both"));
|
|
14098
14213
|
process.exit(1);
|
|
14099
14214
|
}
|
|
14100
|
-
const
|
|
14215
|
+
const resolved = resolveRepoTarget(key, value, options2.repo);
|
|
14216
|
+
if (resolved.value === void 0) {
|
|
14217
|
+
console.error(chalk127.red(`Missing required argument for '${resolved.key}'`));
|
|
14218
|
+
process.exit(1);
|
|
14219
|
+
}
|
|
14220
|
+
const coerced = coerceValue(resolved.value);
|
|
14221
|
+
const target = resolved.useRepo ? `repo: ${applyRepoConfigSet(resolved.key, coerced, resolved.repoName)}` : applyConfigSet(resolved.key, coerced, options2.global ?? false);
|
|
14101
14222
|
console.log(
|
|
14102
|
-
|
|
14223
|
+
chalk127.green(`Set ${resolved.key} = ${JSON.stringify(coerced)} (${target})`)
|
|
14103
14224
|
);
|
|
14104
14225
|
}
|
|
14105
14226
|
function coerceValue(value) {
|
|
@@ -14107,75 +14228,53 @@ function coerceValue(value) {
|
|
|
14107
14228
|
if (value === "false") return false;
|
|
14108
14229
|
return value;
|
|
14109
14230
|
}
|
|
14110
|
-
function applyConfigSet(key, coerced, global) {
|
|
14111
|
-
assertNotGlobalOnly(key, global);
|
|
14112
|
-
const raw = global ? loadGlobalConfigRaw() : loadProjectConfig();
|
|
14113
|
-
const updated = setNestedValue(raw, key, coerced);
|
|
14114
|
-
validateConfig(updated, key);
|
|
14115
|
-
if (global) {
|
|
14116
|
-
saveGlobalConfig(updated);
|
|
14117
|
-
return "global";
|
|
14118
|
-
}
|
|
14119
|
-
saveConfig(updated);
|
|
14120
|
-
return "project";
|
|
14121
|
-
}
|
|
14122
|
-
function assertNotGlobalOnly(key, global) {
|
|
14123
|
-
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
14124
|
-
console.error(
|
|
14125
|
-
chalk126.red(
|
|
14126
|
-
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
14127
|
-
)
|
|
14128
|
-
);
|
|
14129
|
-
process.exit(1);
|
|
14130
|
-
}
|
|
14131
|
-
}
|
|
14132
14231
|
|
|
14133
14232
|
// src/commands/registerConfig.ts
|
|
14134
14233
|
function registerConfig(program2) {
|
|
14135
14234
|
const configCommand = program2.command("config").description("View and modify assist.yml configuration");
|
|
14136
|
-
configCommand.command("set <key>
|
|
14137
|
-
"-r, --repo",
|
|
14138
|
-
"Write to ~/.assist.yml under
|
|
14235
|
+
configCommand.command("set <key> [value]").description("Set a config value (e.g. commit.push true)").option("-g, --global", "Write to global ~/.assist.yml").option(
|
|
14236
|
+
"-r, --repo [name]",
|
|
14237
|
+
"Write to ~/.assist.yml under a repo's identity (defaults to the current repo)"
|
|
14139
14238
|
).action((key, value, options2) => configSet(key, value, options2));
|
|
14140
14239
|
configCommand.command("get <key>").description("Get a config value").action(configGet);
|
|
14141
14240
|
configCommand.command("list").description("List all config values").action(configList);
|
|
14142
14241
|
}
|
|
14143
14242
|
|
|
14144
14243
|
// src/commands/db/reportMigrationStatus.ts
|
|
14145
|
-
import
|
|
14244
|
+
import chalk128 from "chalk";
|
|
14146
14245
|
function reportApplied(applied) {
|
|
14147
14246
|
if (applied.length === 0) {
|
|
14148
|
-
console.error(
|
|
14247
|
+
console.error(chalk128.green("Database is up to date; nothing to apply."));
|
|
14149
14248
|
return;
|
|
14150
14249
|
}
|
|
14151
14250
|
for (const migration of applied) {
|
|
14152
14251
|
console.error(
|
|
14153
|
-
|
|
14252
|
+
chalk128.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
14154
14253
|
);
|
|
14155
14254
|
}
|
|
14156
14255
|
}
|
|
14157
14256
|
function reportMigrationStatus(status3) {
|
|
14158
14257
|
if (status3.state === "in-sync") {
|
|
14159
14258
|
console.error(
|
|
14160
|
-
|
|
14259
|
+
chalk128.green(`In sync at migration ${status3.version} (latest).`)
|
|
14161
14260
|
);
|
|
14162
14261
|
return;
|
|
14163
14262
|
}
|
|
14164
14263
|
if (status3.state === "behind") {
|
|
14165
14264
|
console.error(
|
|
14166
|
-
|
|
14265
|
+
chalk128.yellow(
|
|
14167
14266
|
`Behind: applied ${status3.applied}, build expects ${status3.expected}.`
|
|
14168
14267
|
)
|
|
14169
14268
|
);
|
|
14170
14269
|
console.error(
|
|
14171
|
-
|
|
14270
|
+
chalk128.yellow(
|
|
14172
14271
|
`Pending: ${status3.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
14173
14272
|
)
|
|
14174
14273
|
);
|
|
14175
14274
|
return;
|
|
14176
14275
|
}
|
|
14177
14276
|
console.error(
|
|
14178
|
-
|
|
14277
|
+
chalk128.red(
|
|
14179
14278
|
`Ahead: applied ${status3.applied}, build knows ${status3.expected}. Update assist.`
|
|
14180
14279
|
)
|
|
14181
14280
|
);
|
|
@@ -14210,7 +14309,7 @@ function registerDb(program2) {
|
|
|
14210
14309
|
|
|
14211
14310
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
14212
14311
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync26 } from "fs";
|
|
14213
|
-
import
|
|
14312
|
+
import chalk129 from "chalk";
|
|
14214
14313
|
|
|
14215
14314
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
14216
14315
|
import { join as join34 } from "path";
|
|
@@ -14241,7 +14340,7 @@ function dbMigrationConfirm(pin) {
|
|
|
14241
14340
|
sweepRestrictedDir();
|
|
14242
14341
|
const state = readMigrationPinState(pin);
|
|
14243
14342
|
if (!state) {
|
|
14244
|
-
console.error(
|
|
14343
|
+
console.error(chalk129.red(`No pending migration unlock for pin: ${pin}`));
|
|
14245
14344
|
process.exitCode = 1;
|
|
14246
14345
|
return;
|
|
14247
14346
|
}
|
|
@@ -14251,7 +14350,7 @@ function dbMigrationConfirm(pin) {
|
|
|
14251
14350
|
);
|
|
14252
14351
|
unlinkSync9(getMigrationPinPath(pin));
|
|
14253
14352
|
console.log(
|
|
14254
|
-
|
|
14353
|
+
chalk129.green(
|
|
14255
14354
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
14256
14355
|
)
|
|
14257
14356
|
);
|
|
@@ -14260,7 +14359,7 @@ function dbMigrationConfirm(pin) {
|
|
|
14260
14359
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
14261
14360
|
import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync27 } from "fs";
|
|
14262
14361
|
import { randomInt as randomInt2 } from "crypto";
|
|
14263
|
-
import
|
|
14362
|
+
import chalk130 from "chalk";
|
|
14264
14363
|
|
|
14265
14364
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
14266
14365
|
function nextMigrationId() {
|
|
@@ -14275,7 +14374,7 @@ function dbMigrationUnlock() {
|
|
|
14275
14374
|
sweepRestrictedDir();
|
|
14276
14375
|
writeFileSync27(getMigrationPinPath(pin), JSON.stringify({ pin, migrationId }));
|
|
14277
14376
|
console.error(
|
|
14278
|
-
|
|
14377
|
+
chalk130.yellow.bold(
|
|
14279
14378
|
"THIS IS YOUR LAST CHANCE TO RECONSIDER BEFORE INVOLVING A HUMAN.\nRequesting this pin pages a real person to approve a new database migration.\nA schema change is hard to reverse once shipped. You had BETTER have confirmed\nthe change with the user and be certain this migration is genuinely necessary."
|
|
14280
14379
|
)
|
|
14281
14380
|
);
|
|
@@ -14285,7 +14384,7 @@ function dbMigrationUnlock() {
|
|
|
14285
14384
|
});
|
|
14286
14385
|
if (!delivered) {
|
|
14287
14386
|
console.error(
|
|
14288
|
-
|
|
14387
|
+
chalk130.red(
|
|
14289
14388
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
14290
14389
|
)
|
|
14291
14390
|
);
|
|
@@ -14295,7 +14394,7 @@ function dbMigrationUnlock() {
|
|
|
14295
14394
|
console.log(
|
|
14296
14395
|
`A confirmation pin was sent to your desktop notifications.
|
|
14297
14396
|
To approve creating migration ${migrationId}, run:
|
|
14298
|
-
${
|
|
14397
|
+
${chalk130.cyan(" assist db-migration confirm <PIN>")}
|
|
14299
14398
|
using the pin from that notification.`
|
|
14300
14399
|
);
|
|
14301
14400
|
}
|
|
@@ -14315,7 +14414,7 @@ function registerDbMigration(parent) {
|
|
|
14315
14414
|
|
|
14316
14415
|
// src/commands/deploy/redirect.ts
|
|
14317
14416
|
import { existsSync as existsSync35, readFileSync as readFileSync29, writeFileSync as writeFileSync28 } from "fs";
|
|
14318
|
-
import
|
|
14417
|
+
import chalk131 from "chalk";
|
|
14319
14418
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
14320
14419
|
if (!window.location.pathname.endsWith('/')) {
|
|
14321
14420
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -14324,23 +14423,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
14324
14423
|
function redirect() {
|
|
14325
14424
|
const indexPath = "index.html";
|
|
14326
14425
|
if (!existsSync35(indexPath)) {
|
|
14327
|
-
console.log(
|
|
14426
|
+
console.log(chalk131.yellow("No index.html found"));
|
|
14328
14427
|
return;
|
|
14329
14428
|
}
|
|
14330
14429
|
const content = readFileSync29(indexPath, "utf8");
|
|
14331
14430
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
14332
|
-
console.log(
|
|
14431
|
+
console.log(chalk131.dim("Trailing slash script already present"));
|
|
14333
14432
|
return;
|
|
14334
14433
|
}
|
|
14335
14434
|
const headCloseIndex = content.indexOf("</head>");
|
|
14336
14435
|
if (headCloseIndex === -1) {
|
|
14337
|
-
console.log(
|
|
14436
|
+
console.log(chalk131.red("Could not find </head> tag in index.html"));
|
|
14338
14437
|
return;
|
|
14339
14438
|
}
|
|
14340
14439
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
14341
14440
|
${content.slice(headCloseIndex)}`;
|
|
14342
14441
|
writeFileSync28(indexPath, newContent);
|
|
14343
|
-
console.log(
|
|
14442
|
+
console.log(chalk131.green("Added trailing slash redirect to index.html"));
|
|
14344
14443
|
}
|
|
14345
14444
|
|
|
14346
14445
|
// src/commands/registerDeploy.ts
|
|
@@ -14367,7 +14466,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
14367
14466
|
|
|
14368
14467
|
// src/commands/devlog/shared.ts
|
|
14369
14468
|
import { execSync as execSync33 } from "child_process";
|
|
14370
|
-
import
|
|
14469
|
+
import chalk132 from "chalk";
|
|
14371
14470
|
|
|
14372
14471
|
// src/shared/getRepoName.ts
|
|
14373
14472
|
import { existsSync as existsSync36, readFileSync as readFileSync30 } from "fs";
|
|
@@ -14476,13 +14575,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
14476
14575
|
}
|
|
14477
14576
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
14478
14577
|
for (const commit2 of commits2) {
|
|
14479
|
-
console.log(` ${
|
|
14578
|
+
console.log(` ${chalk132.yellow(commit2.hash)} ${commit2.message}`);
|
|
14480
14579
|
if (verbose) {
|
|
14481
14580
|
const visibleFiles = commit2.files.filter(
|
|
14482
14581
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
14483
14582
|
);
|
|
14484
14583
|
for (const file of visibleFiles) {
|
|
14485
|
-
console.log(` ${
|
|
14584
|
+
console.log(` ${chalk132.dim(file)}`);
|
|
14486
14585
|
}
|
|
14487
14586
|
}
|
|
14488
14587
|
}
|
|
@@ -14507,15 +14606,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
14507
14606
|
}
|
|
14508
14607
|
|
|
14509
14608
|
// src/commands/devlog/list/printDateHeader.ts
|
|
14510
|
-
import
|
|
14609
|
+
import chalk133 from "chalk";
|
|
14511
14610
|
function printDateHeader(date, isSkipped, entries) {
|
|
14512
14611
|
if (isSkipped) {
|
|
14513
|
-
console.log(`${
|
|
14612
|
+
console.log(`${chalk133.bold.blue(date)} ${chalk133.dim("skipped")}`);
|
|
14514
14613
|
} else if (entries && entries.length > 0) {
|
|
14515
|
-
const entryInfo = entries.map((e) => `${
|
|
14516
|
-
console.log(`${
|
|
14614
|
+
const entryInfo = entries.map((e) => `${chalk133.green(e.version)} ${e.title}`).join(" | ");
|
|
14615
|
+
console.log(`${chalk133.bold.blue(date)} ${entryInfo}`);
|
|
14517
14616
|
} else {
|
|
14518
|
-
console.log(`${
|
|
14617
|
+
console.log(`${chalk133.bold.blue(date)} ${chalk133.red("\u26A0 devlog missing")}`);
|
|
14519
14618
|
}
|
|
14520
14619
|
}
|
|
14521
14620
|
|
|
@@ -14619,24 +14718,24 @@ function bumpVersion(version2, type) {
|
|
|
14619
14718
|
|
|
14620
14719
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
14621
14720
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
14622
|
-
import
|
|
14721
|
+
import chalk135 from "chalk";
|
|
14623
14722
|
|
|
14624
14723
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
14625
|
-
import
|
|
14724
|
+
import chalk134 from "chalk";
|
|
14626
14725
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
14627
14726
|
if (conventional && firstHash) {
|
|
14628
14727
|
const version2 = getVersionAtCommit(firstHash);
|
|
14629
14728
|
if (version2) {
|
|
14630
|
-
console.log(`${
|
|
14729
|
+
console.log(`${chalk134.bold("version:")} ${stripToMinor(version2)}`);
|
|
14631
14730
|
} else {
|
|
14632
|
-
console.log(`${
|
|
14731
|
+
console.log(`${chalk134.bold("version:")} ${chalk134.red("unknown")}`);
|
|
14633
14732
|
}
|
|
14634
14733
|
} else if (patchVersion && minorVersion) {
|
|
14635
14734
|
console.log(
|
|
14636
|
-
`${
|
|
14735
|
+
`${chalk134.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
14637
14736
|
);
|
|
14638
14737
|
} else {
|
|
14639
|
-
console.log(`${
|
|
14738
|
+
console.log(`${chalk134.bold("version:")} v0.1 (initial)`);
|
|
14640
14739
|
}
|
|
14641
14740
|
}
|
|
14642
14741
|
|
|
@@ -14684,16 +14783,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
14684
14783
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
14685
14784
|
}
|
|
14686
14785
|
function logName(repoName) {
|
|
14687
|
-
console.log(`${
|
|
14786
|
+
console.log(`${chalk135.bold("name:")} ${repoName}`);
|
|
14688
14787
|
}
|
|
14689
14788
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
14690
14789
|
logName(ctx.repoName);
|
|
14691
14790
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
14692
|
-
console.log(
|
|
14791
|
+
console.log(chalk135.bold.blue(targetDate));
|
|
14693
14792
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
14694
14793
|
}
|
|
14695
14794
|
function logNoCommits(lastInfo) {
|
|
14696
|
-
console.log(
|
|
14795
|
+
console.log(chalk135.dim(noCommitsMessage(!!lastInfo)));
|
|
14697
14796
|
}
|
|
14698
14797
|
|
|
14699
14798
|
// src/commands/devlog/next/index.ts
|
|
@@ -14734,11 +14833,11 @@ function next2(options2) {
|
|
|
14734
14833
|
import { execSync as execSync35 } from "child_process";
|
|
14735
14834
|
|
|
14736
14835
|
// src/commands/devlog/repos/printReposTable.ts
|
|
14737
|
-
import
|
|
14836
|
+
import chalk136 from "chalk";
|
|
14738
14837
|
function colorStatus(status3) {
|
|
14739
|
-
if (status3 === "missing") return
|
|
14740
|
-
if (status3 === "outdated") return
|
|
14741
|
-
return
|
|
14838
|
+
if (status3 === "missing") return chalk136.red(status3);
|
|
14839
|
+
if (status3 === "outdated") return chalk136.yellow(status3);
|
|
14840
|
+
return chalk136.green(status3);
|
|
14742
14841
|
}
|
|
14743
14842
|
function formatRow(row, nameWidth) {
|
|
14744
14843
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -14752,8 +14851,8 @@ function printReposTable(rows) {
|
|
|
14752
14851
|
"Last Devlog".padEnd(11),
|
|
14753
14852
|
"Status"
|
|
14754
14853
|
].join(" ");
|
|
14755
|
-
console.log(
|
|
14756
|
-
console.log(
|
|
14854
|
+
console.log(chalk136.dim(header));
|
|
14855
|
+
console.log(chalk136.dim("-".repeat(header.length)));
|
|
14757
14856
|
for (const row of rows) {
|
|
14758
14857
|
console.log(formatRow(row, nameWidth));
|
|
14759
14858
|
}
|
|
@@ -14811,14 +14910,14 @@ function repos(options2) {
|
|
|
14811
14910
|
// src/commands/devlog/skip.ts
|
|
14812
14911
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
14813
14912
|
import { join as join38 } from "path";
|
|
14814
|
-
import
|
|
14913
|
+
import chalk137 from "chalk";
|
|
14815
14914
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
14816
14915
|
function getBlogConfigPath() {
|
|
14817
14916
|
return join38(BLOG_REPO_ROOT, "assist.yml");
|
|
14818
14917
|
}
|
|
14819
14918
|
function skip(date) {
|
|
14820
14919
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
14821
|
-
console.log(
|
|
14920
|
+
console.log(chalk137.red("Invalid date format. Use YYYY-MM-DD"));
|
|
14822
14921
|
process.exit(1);
|
|
14823
14922
|
}
|
|
14824
14923
|
const repoName = getRepoName();
|
|
@@ -14829,7 +14928,7 @@ function skip(date) {
|
|
|
14829
14928
|
const skipDays = skip2[repoName] ?? [];
|
|
14830
14929
|
if (skipDays.includes(date)) {
|
|
14831
14930
|
console.log(
|
|
14832
|
-
|
|
14931
|
+
chalk137.yellow(`${date} is already in skip list for ${repoName}`)
|
|
14833
14932
|
);
|
|
14834
14933
|
return;
|
|
14835
14934
|
}
|
|
@@ -14839,20 +14938,20 @@ function skip(date) {
|
|
|
14839
14938
|
devlog.skip = skip2;
|
|
14840
14939
|
config.devlog = devlog;
|
|
14841
14940
|
writeFileSync29(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
14842
|
-
console.log(
|
|
14941
|
+
console.log(chalk137.green(`Added ${date} to skip list for ${repoName}`));
|
|
14843
14942
|
}
|
|
14844
14943
|
|
|
14845
14944
|
// src/commands/devlog/version.ts
|
|
14846
|
-
import
|
|
14945
|
+
import chalk138 from "chalk";
|
|
14847
14946
|
function version() {
|
|
14848
14947
|
const config = loadConfig();
|
|
14849
14948
|
const name = getRepoName();
|
|
14850
14949
|
const lastInfo = getLastVersionInfo(name, config);
|
|
14851
14950
|
const lastVersion = lastInfo?.version ?? null;
|
|
14852
14951
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
14853
|
-
console.log(`${
|
|
14854
|
-
console.log(`${
|
|
14855
|
-
console.log(`${
|
|
14952
|
+
console.log(`${chalk138.bold("name:")} ${name}`);
|
|
14953
|
+
console.log(`${chalk138.bold("last:")} ${lastVersion ?? chalk138.dim("none")}`);
|
|
14954
|
+
console.log(`${chalk138.bold("next:")} ${nextVersion ?? chalk138.dim("none")}`);
|
|
14856
14955
|
}
|
|
14857
14956
|
|
|
14858
14957
|
// src/commands/devlog/devlogConfigHelp.ts
|
|
@@ -14896,7 +14995,7 @@ function registerDevlog(program2) {
|
|
|
14896
14995
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
14897
14996
|
import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync5 } from "fs";
|
|
14898
14997
|
import { join as join39 } from "path";
|
|
14899
|
-
import
|
|
14998
|
+
import chalk139 from "chalk";
|
|
14900
14999
|
|
|
14901
15000
|
// src/shared/findRepoRoot.ts
|
|
14902
15001
|
import { existsSync as existsSync37 } from "fs";
|
|
@@ -14959,14 +15058,14 @@ function checkBuildLocks(startDir) {
|
|
|
14959
15058
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
14960
15059
|
if (locked) {
|
|
14961
15060
|
console.error(
|
|
14962
|
-
|
|
15061
|
+
chalk139.red("Build output locked (is VS debugging?): ") + locked
|
|
14963
15062
|
);
|
|
14964
15063
|
process.exit(1);
|
|
14965
15064
|
}
|
|
14966
15065
|
}
|
|
14967
15066
|
async function checkBuildLocksCommand() {
|
|
14968
15067
|
checkBuildLocks();
|
|
14969
|
-
console.log(
|
|
15068
|
+
console.log(chalk139.green("No build locks detected"));
|
|
14970
15069
|
}
|
|
14971
15070
|
|
|
14972
15071
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -15065,30 +15164,30 @@ function escapeRegex(s) {
|
|
|
15065
15164
|
}
|
|
15066
15165
|
|
|
15067
15166
|
// src/commands/dotnet/printTree.ts
|
|
15068
|
-
import
|
|
15167
|
+
import chalk140 from "chalk";
|
|
15069
15168
|
function printNodes(nodes, prefix2) {
|
|
15070
15169
|
for (let i = 0; i < nodes.length; i++) {
|
|
15071
15170
|
const isLast = i === nodes.length - 1;
|
|
15072
15171
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
15073
15172
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
15074
15173
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
15075
|
-
const label2 = isMissing ?
|
|
15174
|
+
const label2 = isMissing ? chalk140.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
15076
15175
|
console.log(`${prefix2}${connector}${label2}`);
|
|
15077
15176
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
15078
15177
|
}
|
|
15079
15178
|
}
|
|
15080
15179
|
function printTree(tree, totalCount, solutions) {
|
|
15081
|
-
console.log(
|
|
15082
|
-
console.log(
|
|
15180
|
+
console.log(chalk140.bold("\nProject Dependency Tree"));
|
|
15181
|
+
console.log(chalk140.cyan(tree.relativePath));
|
|
15083
15182
|
printNodes(tree.children, "");
|
|
15084
|
-
console.log(
|
|
15183
|
+
console.log(chalk140.dim(`
|
|
15085
15184
|
${totalCount} projects total (including root)`));
|
|
15086
|
-
console.log(
|
|
15185
|
+
console.log(chalk140.bold("\nSolution Membership"));
|
|
15087
15186
|
if (solutions.length === 0) {
|
|
15088
|
-
console.log(
|
|
15187
|
+
console.log(chalk140.yellow(" Not found in any .sln"));
|
|
15089
15188
|
} else {
|
|
15090
15189
|
for (const sln of solutions) {
|
|
15091
|
-
console.log(` ${
|
|
15190
|
+
console.log(` ${chalk140.green(sln)}`);
|
|
15092
15191
|
}
|
|
15093
15192
|
}
|
|
15094
15193
|
console.log();
|
|
@@ -15117,16 +15216,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
15117
15216
|
// src/commands/dotnet/resolveCsproj.ts
|
|
15118
15217
|
import { existsSync as existsSync38 } from "fs";
|
|
15119
15218
|
import path33 from "path";
|
|
15120
|
-
import
|
|
15219
|
+
import chalk141 from "chalk";
|
|
15121
15220
|
function resolveCsproj(csprojPath) {
|
|
15122
15221
|
const resolved = path33.resolve(csprojPath);
|
|
15123
15222
|
if (!existsSync38(resolved)) {
|
|
15124
|
-
console.error(
|
|
15223
|
+
console.error(chalk141.red(`File not found: ${resolved}`));
|
|
15125
15224
|
process.exit(1);
|
|
15126
15225
|
}
|
|
15127
15226
|
const repoRoot = findRepoRoot(path33.dirname(resolved));
|
|
15128
15227
|
if (!repoRoot) {
|
|
15129
|
-
console.error(
|
|
15228
|
+
console.error(chalk141.red("Could not find git repository root"));
|
|
15130
15229
|
process.exit(1);
|
|
15131
15230
|
}
|
|
15132
15231
|
return { resolved, repoRoot };
|
|
@@ -15176,12 +15275,12 @@ function getChangedCsFiles(scope) {
|
|
|
15176
15275
|
}
|
|
15177
15276
|
|
|
15178
15277
|
// src/commands/dotnet/inSln.ts
|
|
15179
|
-
import
|
|
15278
|
+
import chalk142 from "chalk";
|
|
15180
15279
|
async function inSln(csprojPath) {
|
|
15181
15280
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
15182
15281
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
15183
15282
|
if (solutions.length === 0) {
|
|
15184
|
-
console.log(
|
|
15283
|
+
console.log(chalk142.yellow("Not found in any .sln file"));
|
|
15185
15284
|
process.exit(1);
|
|
15186
15285
|
}
|
|
15187
15286
|
for (const sln of solutions) {
|
|
@@ -15190,7 +15289,7 @@ async function inSln(csprojPath) {
|
|
|
15190
15289
|
}
|
|
15191
15290
|
|
|
15192
15291
|
// src/commands/dotnet/inspect.ts
|
|
15193
|
-
import
|
|
15292
|
+
import chalk148 from "chalk";
|
|
15194
15293
|
|
|
15195
15294
|
// src/shared/formatElapsed.ts
|
|
15196
15295
|
function formatElapsed(ms) {
|
|
@@ -15202,12 +15301,12 @@ function formatElapsed(ms) {
|
|
|
15202
15301
|
}
|
|
15203
15302
|
|
|
15204
15303
|
// src/commands/dotnet/displayIssues.ts
|
|
15205
|
-
import
|
|
15304
|
+
import chalk143 from "chalk";
|
|
15206
15305
|
var SEVERITY_COLOR = {
|
|
15207
|
-
ERROR:
|
|
15208
|
-
WARNING:
|
|
15209
|
-
SUGGESTION:
|
|
15210
|
-
HINT:
|
|
15306
|
+
ERROR: chalk143.red,
|
|
15307
|
+
WARNING: chalk143.yellow,
|
|
15308
|
+
SUGGESTION: chalk143.cyan,
|
|
15309
|
+
HINT: chalk143.dim
|
|
15211
15310
|
};
|
|
15212
15311
|
function groupByFile(issues) {
|
|
15213
15312
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -15223,15 +15322,15 @@ function groupByFile(issues) {
|
|
|
15223
15322
|
}
|
|
15224
15323
|
function displayIssues(issues) {
|
|
15225
15324
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
15226
|
-
console.log(
|
|
15325
|
+
console.log(chalk143.bold(file));
|
|
15227
15326
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
15228
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
15327
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk143.white;
|
|
15229
15328
|
console.log(
|
|
15230
|
-
` ${
|
|
15329
|
+
` ${chalk143.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
15231
15330
|
);
|
|
15232
15331
|
}
|
|
15233
15332
|
}
|
|
15234
|
-
console.log(
|
|
15333
|
+
console.log(chalk143.dim(`
|
|
15235
15334
|
${issues.length} issue(s) found`));
|
|
15236
15335
|
}
|
|
15237
15336
|
|
|
@@ -15290,12 +15389,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
15290
15389
|
// src/commands/dotnet/resolveSolution.ts
|
|
15291
15390
|
import { existsSync as existsSync39 } from "fs";
|
|
15292
15391
|
import path34 from "path";
|
|
15293
|
-
import
|
|
15392
|
+
import chalk145 from "chalk";
|
|
15294
15393
|
|
|
15295
15394
|
// src/commands/dotnet/findSolution.ts
|
|
15296
15395
|
import { readdirSync as readdirSync7 } from "fs";
|
|
15297
15396
|
import { dirname as dirname22, join as join40 } from "path";
|
|
15298
|
-
import
|
|
15397
|
+
import chalk144 from "chalk";
|
|
15299
15398
|
function findSlnInDir(dir) {
|
|
15300
15399
|
try {
|
|
15301
15400
|
return readdirSync7(dir).filter((f) => f.endsWith(".sln")).map((f) => join40(dir, f));
|
|
@@ -15311,17 +15410,17 @@ function findSolution() {
|
|
|
15311
15410
|
const slnFiles = findSlnInDir(current);
|
|
15312
15411
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
15313
15412
|
if (slnFiles.length > 1) {
|
|
15314
|
-
console.error(
|
|
15413
|
+
console.error(chalk144.red(`Multiple .sln files found in ${current}:`));
|
|
15315
15414
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
15316
15415
|
console.error(
|
|
15317
|
-
|
|
15416
|
+
chalk144.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
15318
15417
|
);
|
|
15319
15418
|
process.exit(1);
|
|
15320
15419
|
}
|
|
15321
15420
|
if (current === ceiling) break;
|
|
15322
15421
|
current = dirname22(current);
|
|
15323
15422
|
}
|
|
15324
|
-
console.error(
|
|
15423
|
+
console.error(chalk144.red("No .sln file found between cwd and repo root"));
|
|
15325
15424
|
process.exit(1);
|
|
15326
15425
|
}
|
|
15327
15426
|
|
|
@@ -15330,7 +15429,7 @@ function resolveSolution(sln) {
|
|
|
15330
15429
|
if (sln) {
|
|
15331
15430
|
const resolved = path34.resolve(sln);
|
|
15332
15431
|
if (!existsSync39(resolved)) {
|
|
15333
|
-
console.error(
|
|
15432
|
+
console.error(chalk145.red(`Solution file not found: ${resolved}`));
|
|
15334
15433
|
process.exit(1);
|
|
15335
15434
|
}
|
|
15336
15435
|
return resolved;
|
|
@@ -15372,14 +15471,14 @@ import { execSync as execSync37 } from "child_process";
|
|
|
15372
15471
|
import { existsSync as existsSync40, readFileSync as readFileSync34, unlinkSync as unlinkSync10 } from "fs";
|
|
15373
15472
|
import { tmpdir as tmpdir3 } from "os";
|
|
15374
15473
|
import path35 from "path";
|
|
15375
|
-
import
|
|
15474
|
+
import chalk146 from "chalk";
|
|
15376
15475
|
function assertJbInstalled() {
|
|
15377
15476
|
try {
|
|
15378
15477
|
execSync37("jb inspectcode --version", { stdio: "pipe" });
|
|
15379
15478
|
} catch {
|
|
15380
|
-
console.error(
|
|
15479
|
+
console.error(chalk146.red("jb is not installed. Install with:"));
|
|
15381
15480
|
console.error(
|
|
15382
|
-
|
|
15481
|
+
chalk146.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
15383
15482
|
);
|
|
15384
15483
|
process.exit(1);
|
|
15385
15484
|
}
|
|
@@ -15397,11 +15496,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
15397
15496
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
15398
15497
|
process.stderr.write(error.stderr);
|
|
15399
15498
|
}
|
|
15400
|
-
console.error(
|
|
15499
|
+
console.error(chalk146.red("jb inspectcode failed"));
|
|
15401
15500
|
process.exit(1);
|
|
15402
15501
|
}
|
|
15403
15502
|
if (!existsSync40(reportPath)) {
|
|
15404
|
-
console.error(
|
|
15503
|
+
console.error(chalk146.red("Report file not generated"));
|
|
15405
15504
|
process.exit(1);
|
|
15406
15505
|
}
|
|
15407
15506
|
const xml = readFileSync34(reportPath, "utf8");
|
|
@@ -15411,7 +15510,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
15411
15510
|
|
|
15412
15511
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
15413
15512
|
import { execSync as execSync38 } from "child_process";
|
|
15414
|
-
import
|
|
15513
|
+
import chalk147 from "chalk";
|
|
15415
15514
|
function resolveMsbuildPath() {
|
|
15416
15515
|
const { run: run4 } = loadConfig();
|
|
15417
15516
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -15423,9 +15522,9 @@ function assertMsbuildInstalled() {
|
|
|
15423
15522
|
try {
|
|
15424
15523
|
execSync38(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
15425
15524
|
} catch {
|
|
15426
|
-
console.error(
|
|
15525
|
+
console.error(chalk147.red(`msbuild not found at: ${msbuild}`));
|
|
15427
15526
|
console.error(
|
|
15428
|
-
|
|
15527
|
+
chalk147.yellow(
|
|
15429
15528
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
15430
15529
|
)
|
|
15431
15530
|
);
|
|
@@ -15472,17 +15571,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
15472
15571
|
// src/commands/dotnet/inspect.ts
|
|
15473
15572
|
function logScope(changedFiles) {
|
|
15474
15573
|
if (changedFiles === null) {
|
|
15475
|
-
console.log(
|
|
15574
|
+
console.log(chalk148.dim("Inspecting full solution..."));
|
|
15476
15575
|
} else {
|
|
15477
15576
|
console.log(
|
|
15478
|
-
|
|
15577
|
+
chalk148.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
15479
15578
|
);
|
|
15480
15579
|
}
|
|
15481
15580
|
}
|
|
15482
15581
|
function reportResults(issues, elapsed) {
|
|
15483
15582
|
if (issues.length > 0) displayIssues(issues);
|
|
15484
|
-
else console.log(
|
|
15485
|
-
console.log(
|
|
15583
|
+
else console.log(chalk148.green("No issues found"));
|
|
15584
|
+
console.log(chalk148.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
15486
15585
|
if (issues.length > 0) process.exit(1);
|
|
15487
15586
|
}
|
|
15488
15587
|
async function inspect(sln, options2) {
|
|
@@ -15493,7 +15592,7 @@ async function inspect(sln, options2) {
|
|
|
15493
15592
|
const scope = parseScope(options2.scope);
|
|
15494
15593
|
const changedFiles = getChangedCsFiles(scope);
|
|
15495
15594
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
15496
|
-
console.log(
|
|
15595
|
+
console.log(chalk148.green("No changed .cs files found"));
|
|
15497
15596
|
return;
|
|
15498
15597
|
}
|
|
15499
15598
|
logScope(changedFiles);
|
|
@@ -15876,25 +15975,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
15876
15975
|
}
|
|
15877
15976
|
|
|
15878
15977
|
// src/commands/github/printCountTable.ts
|
|
15879
|
-
import
|
|
15978
|
+
import chalk149 from "chalk";
|
|
15880
15979
|
function printCountTable(labelHeader, rows) {
|
|
15881
15980
|
const labelWidth = Math.max(
|
|
15882
15981
|
labelHeader.length,
|
|
15883
15982
|
...rows.map((row) => row.label.length)
|
|
15884
15983
|
);
|
|
15885
15984
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
15886
|
-
console.log(
|
|
15887
|
-
console.log(
|
|
15985
|
+
console.log(chalk149.dim(header));
|
|
15986
|
+
console.log(chalk149.dim("-".repeat(header.length)));
|
|
15888
15987
|
for (const row of rows) {
|
|
15889
15988
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
15890
15989
|
}
|
|
15891
15990
|
}
|
|
15892
15991
|
|
|
15893
15992
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
15894
|
-
import
|
|
15993
|
+
import chalk150 from "chalk";
|
|
15895
15994
|
function printRepoAuthorBreakdown(repos2) {
|
|
15896
15995
|
for (const repo of repos2) {
|
|
15897
|
-
console.log(
|
|
15996
|
+
console.log(chalk150.bold(repo.name));
|
|
15898
15997
|
const authorWidth = Math.max(
|
|
15899
15998
|
0,
|
|
15900
15999
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -16212,7 +16311,7 @@ function registerHandover(program2) {
|
|
|
16212
16311
|
}
|
|
16213
16312
|
|
|
16214
16313
|
// src/commands/jira/acceptanceCriteria.ts
|
|
16215
|
-
import
|
|
16314
|
+
import chalk151 from "chalk";
|
|
16216
16315
|
|
|
16217
16316
|
// src/commands/jira/adfToText.ts
|
|
16218
16317
|
function renderInline(node) {
|
|
@@ -16279,7 +16378,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
16279
16378
|
const parsed = fetchIssue(issueKey, field);
|
|
16280
16379
|
const acValue = parsed?.fields?.[field];
|
|
16281
16380
|
if (!acValue) {
|
|
16282
|
-
console.log(
|
|
16381
|
+
console.log(chalk151.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
16283
16382
|
return;
|
|
16284
16383
|
}
|
|
16285
16384
|
if (typeof acValue === "string") {
|
|
@@ -16345,14 +16444,14 @@ async function jiraAuth() {
|
|
|
16345
16444
|
}
|
|
16346
16445
|
|
|
16347
16446
|
// src/commands/jira/viewIssue.ts
|
|
16348
|
-
import
|
|
16447
|
+
import chalk152 from "chalk";
|
|
16349
16448
|
function viewIssue(issueKey) {
|
|
16350
16449
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
16351
16450
|
const fields = parsed?.fields;
|
|
16352
16451
|
const summary = fields?.summary;
|
|
16353
16452
|
const description = fields?.description;
|
|
16354
16453
|
if (summary) {
|
|
16355
|
-
console.log(
|
|
16454
|
+
console.log(chalk152.bold(summary));
|
|
16356
16455
|
}
|
|
16357
16456
|
if (description) {
|
|
16358
16457
|
if (summary) console.log();
|
|
@@ -16366,7 +16465,7 @@ function viewIssue(issueKey) {
|
|
|
16366
16465
|
}
|
|
16367
16466
|
if (!summary && !description) {
|
|
16368
16467
|
console.log(
|
|
16369
|
-
|
|
16468
|
+
chalk152.yellow(`No summary or description found on ${issueKey}.`)
|
|
16370
16469
|
);
|
|
16371
16470
|
}
|
|
16372
16471
|
}
|
|
@@ -16422,13 +16521,13 @@ function registerRefineLaunch(program2, resumeFlag) {
|
|
|
16422
16521
|
// src/commands/reviewPrComments.ts
|
|
16423
16522
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
16424
16523
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
16425
|
-
import
|
|
16524
|
+
import chalk153 from "chalk";
|
|
16426
16525
|
async function reviewPrComments(number) {
|
|
16427
16526
|
if (number) {
|
|
16428
16527
|
try {
|
|
16429
16528
|
execFileSync5("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
16430
16529
|
} catch {
|
|
16431
|
-
console.error(
|
|
16530
|
+
console.error(chalk153.red(`gh pr checkout ${number} failed; aborting.`));
|
|
16432
16531
|
process.exit(1);
|
|
16433
16532
|
}
|
|
16434
16533
|
}
|
|
@@ -16501,15 +16600,15 @@ function registerList(program2) {
|
|
|
16501
16600
|
// src/commands/mermaid/index.ts
|
|
16502
16601
|
import { mkdirSync as mkdirSync16, readdirSync as readdirSync9 } from "fs";
|
|
16503
16602
|
import { resolve as resolve12 } from "path";
|
|
16504
|
-
import
|
|
16603
|
+
import chalk156 from "chalk";
|
|
16505
16604
|
|
|
16506
16605
|
// src/commands/mermaid/exportFile.ts
|
|
16507
16606
|
import { readFileSync as readFileSync36, writeFileSync as writeFileSync31 } from "fs";
|
|
16508
16607
|
import { basename as basename11, extname, resolve as resolve11 } from "path";
|
|
16509
|
-
import
|
|
16608
|
+
import chalk155 from "chalk";
|
|
16510
16609
|
|
|
16511
16610
|
// src/commands/mermaid/renderBlock.ts
|
|
16512
|
-
import
|
|
16611
|
+
import chalk154 from "chalk";
|
|
16513
16612
|
async function renderBlock(krokiUrl, source) {
|
|
16514
16613
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
16515
16614
|
method: "POST",
|
|
@@ -16518,7 +16617,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
16518
16617
|
});
|
|
16519
16618
|
if (!response.ok) {
|
|
16520
16619
|
console.error(
|
|
16521
|
-
|
|
16620
|
+
chalk154.red(
|
|
16522
16621
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
16523
16622
|
)
|
|
16524
16623
|
);
|
|
@@ -16536,19 +16635,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
16536
16635
|
if (onlyIndex !== void 0) {
|
|
16537
16636
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
16538
16637
|
console.error(
|
|
16539
|
-
|
|
16638
|
+
chalk155.red(
|
|
16540
16639
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
16541
16640
|
)
|
|
16542
16641
|
);
|
|
16543
16642
|
process.exit(1);
|
|
16544
16643
|
}
|
|
16545
16644
|
console.log(
|
|
16546
|
-
|
|
16645
|
+
chalk155.gray(
|
|
16547
16646
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
16548
16647
|
)
|
|
16549
16648
|
);
|
|
16550
16649
|
} else {
|
|
16551
|
-
console.log(
|
|
16650
|
+
console.log(chalk155.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
16552
16651
|
}
|
|
16553
16652
|
for (const [i, source] of blocks.entries()) {
|
|
16554
16653
|
const idx = i + 1;
|
|
@@ -16556,7 +16655,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
16556
16655
|
const outPath = resolve11(outDir, `${stem}-${idx}.svg`);
|
|
16557
16656
|
const svg = await renderBlock(krokiUrl, source);
|
|
16558
16657
|
writeFileSync31(outPath, svg, "utf8");
|
|
16559
|
-
console.log(
|
|
16658
|
+
console.log(chalk155.green(` \u2192 ${outPath}`));
|
|
16560
16659
|
}
|
|
16561
16660
|
}
|
|
16562
16661
|
function extractMermaidBlocks(markdown) {
|
|
@@ -16572,18 +16671,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
16572
16671
|
if (options2.index !== void 0) {
|
|
16573
16672
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
16574
16673
|
console.error(
|
|
16575
|
-
|
|
16674
|
+
chalk156.red(`--index must be a positive integer (got ${options2.index})`)
|
|
16576
16675
|
);
|
|
16577
16676
|
process.exit(1);
|
|
16578
16677
|
}
|
|
16579
16678
|
if (!file) {
|
|
16580
|
-
console.error(
|
|
16679
|
+
console.error(chalk156.red("--index requires a file argument"));
|
|
16581
16680
|
process.exit(1);
|
|
16582
16681
|
}
|
|
16583
16682
|
}
|
|
16584
16683
|
const files = file ? [file] : readdirSync9(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
16585
16684
|
if (files.length === 0) {
|
|
16586
|
-
console.log(
|
|
16685
|
+
console.log(chalk156.gray("No markdown files found in current directory."));
|
|
16587
16686
|
return;
|
|
16588
16687
|
}
|
|
16589
16688
|
for (const f of files) {
|
|
@@ -16616,7 +16715,7 @@ function registerMermaid(program2) {
|
|
|
16616
16715
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
16617
16716
|
import { createServer as createServer2 } from "http";
|
|
16618
16717
|
import { dirname as dirname24 } from "path";
|
|
16619
|
-
import
|
|
16718
|
+
import chalk158 from "chalk";
|
|
16620
16719
|
|
|
16621
16720
|
// src/commands/netcap/corsHeaders.ts
|
|
16622
16721
|
var corsHeaders = {
|
|
@@ -16695,7 +16794,7 @@ function createNetcapHandler(options2) {
|
|
|
16695
16794
|
import { cp, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
|
|
16696
16795
|
import { networkInterfaces } from "os";
|
|
16697
16796
|
import { join as join46 } from "path";
|
|
16698
|
-
import
|
|
16797
|
+
import chalk157 from "chalk";
|
|
16699
16798
|
|
|
16700
16799
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
16701
16800
|
import { dirname as dirname23, join as join45 } from "path";
|
|
@@ -16739,7 +16838,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
16739
16838
|
const host = lanIPv4();
|
|
16740
16839
|
if (!host) {
|
|
16741
16840
|
console.log(
|
|
16742
|
-
|
|
16841
|
+
chalk157.yellow("could not determine the WSL IP for the extension")
|
|
16743
16842
|
);
|
|
16744
16843
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
16745
16844
|
return source;
|
|
@@ -16750,7 +16849,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
16750
16849
|
return WSL_WINDOWS_PATH;
|
|
16751
16850
|
} catch {
|
|
16752
16851
|
console.log(
|
|
16753
|
-
|
|
16852
|
+
chalk157.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
16754
16853
|
);
|
|
16755
16854
|
return source;
|
|
16756
16855
|
}
|
|
@@ -16783,30 +16882,30 @@ async function netcap(options2) {
|
|
|
16783
16882
|
let count7 = 0;
|
|
16784
16883
|
const handler = createNetcapHandler({
|
|
16785
16884
|
outPath,
|
|
16786
|
-
onPing: () => console.log(
|
|
16885
|
+
onPing: () => console.log(chalk158.dim("ping from extension")),
|
|
16787
16886
|
onCapture: (entry) => {
|
|
16788
16887
|
count7 += 1;
|
|
16789
16888
|
console.log(
|
|
16790
|
-
|
|
16791
|
-
|
|
16889
|
+
chalk158.green(`captured #${count7}`),
|
|
16890
|
+
chalk158.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
16792
16891
|
);
|
|
16793
16892
|
}
|
|
16794
16893
|
});
|
|
16795
16894
|
const server = createServer2(handler);
|
|
16796
16895
|
server.listen(port, () => {
|
|
16797
16896
|
console.log(
|
|
16798
|
-
|
|
16897
|
+
chalk158.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
16799
16898
|
);
|
|
16800
|
-
console.log(
|
|
16899
|
+
console.log(chalk158.dim(`appending captures to ${outPath}`));
|
|
16801
16900
|
if (filter)
|
|
16802
|
-
console.log(
|
|
16803
|
-
console.log(
|
|
16804
|
-
console.log(
|
|
16901
|
+
console.log(chalk158.dim(`forwarding only URLs matching "${filter}"`));
|
|
16902
|
+
console.log(chalk158.dim(`load the unpacked extension from ${extensionPath}`));
|
|
16903
|
+
console.log(chalk158.dim("press Ctrl-C to stop"));
|
|
16805
16904
|
});
|
|
16806
16905
|
process.on("SIGINT", () => {
|
|
16807
16906
|
server.close();
|
|
16808
16907
|
console.log(
|
|
16809
|
-
|
|
16908
|
+
chalk158.bold(
|
|
16810
16909
|
`
|
|
16811
16910
|
netcap stopped \u2014 captured ${count7} ${count7 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
16812
16911
|
)
|
|
@@ -16818,7 +16917,7 @@ netcap stopped \u2014 captured ${count7} ${count7 === 1 ? "entry" : "entries"} t
|
|
|
16818
16917
|
// src/commands/netcap/netcapExtract.ts
|
|
16819
16918
|
import { writeFileSync as writeFileSync32 } from "fs";
|
|
16820
16919
|
import { join as join49 } from "path";
|
|
16821
|
-
import
|
|
16920
|
+
import chalk159 from "chalk";
|
|
16822
16921
|
|
|
16823
16922
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
16824
16923
|
import { readFileSync as readFileSync37 } from "fs";
|
|
@@ -17266,8 +17365,8 @@ function netcapExtract(file) {
|
|
|
17266
17365
|
writeFileSync32(outFile, `${JSON.stringify(posts, null, 2)}
|
|
17267
17366
|
`);
|
|
17268
17367
|
console.log(
|
|
17269
|
-
|
|
17270
|
-
|
|
17368
|
+
chalk159.green(`extracted ${posts.length} posts`),
|
|
17369
|
+
chalk159.dim(`-> ${outFile}`)
|
|
17271
17370
|
);
|
|
17272
17371
|
}
|
|
17273
17372
|
|
|
@@ -17288,7 +17387,7 @@ function registerNetcap(program2) {
|
|
|
17288
17387
|
}
|
|
17289
17388
|
|
|
17290
17389
|
// src/commands/news/add/index.ts
|
|
17291
|
-
import
|
|
17390
|
+
import chalk160 from "chalk";
|
|
17292
17391
|
import enquirer8 from "enquirer";
|
|
17293
17392
|
async function add2(url) {
|
|
17294
17393
|
if (!url) {
|
|
@@ -17310,10 +17409,10 @@ async function add2(url) {
|
|
|
17310
17409
|
const { orm } = await getReady();
|
|
17311
17410
|
const added = await addFeed(orm, url);
|
|
17312
17411
|
if (!added) {
|
|
17313
|
-
console.log(
|
|
17412
|
+
console.log(chalk160.yellow("Feed already exists"));
|
|
17314
17413
|
return;
|
|
17315
17414
|
}
|
|
17316
|
-
console.log(
|
|
17415
|
+
console.log(chalk160.green(`Added feed: ${url}`));
|
|
17317
17416
|
}
|
|
17318
17417
|
|
|
17319
17418
|
// src/commands/registerNews.ts
|
|
@@ -17360,7 +17459,7 @@ function registerPiHook(program2) {
|
|
|
17360
17459
|
}
|
|
17361
17460
|
|
|
17362
17461
|
// src/commands/prompts/printPromptsTable.ts
|
|
17363
|
-
import
|
|
17462
|
+
import chalk161 from "chalk";
|
|
17364
17463
|
function truncate(str, max) {
|
|
17365
17464
|
if (str.length <= max) return str;
|
|
17366
17465
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -17378,14 +17477,14 @@ function printPromptsTable(rows) {
|
|
|
17378
17477
|
"Command".padEnd(commandWidth),
|
|
17379
17478
|
"Repos"
|
|
17380
17479
|
].join(" ");
|
|
17381
|
-
console.log(
|
|
17382
|
-
console.log(
|
|
17480
|
+
console.log(chalk161.dim(header));
|
|
17481
|
+
console.log(chalk161.dim("-".repeat(header.length)));
|
|
17383
17482
|
for (const row of rows) {
|
|
17384
17483
|
const count7 = String(row.count).padStart(countWidth);
|
|
17385
17484
|
const tool = row.tool.padEnd(toolWidth);
|
|
17386
17485
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
17387
17486
|
console.log(
|
|
17388
|
-
`${
|
|
17487
|
+
`${chalk161.yellow(count7)} ${tool} ${command} ${chalk161.dim(row.repos)}`
|
|
17389
17488
|
);
|
|
17390
17489
|
}
|
|
17391
17490
|
}
|
|
@@ -17952,20 +18051,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
17952
18051
|
}
|
|
17953
18052
|
|
|
17954
18053
|
// src/commands/prs/listComments/printComments.ts
|
|
17955
|
-
import
|
|
18054
|
+
import chalk162 from "chalk";
|
|
17956
18055
|
function formatForHuman(comment3) {
|
|
17957
18056
|
if (comment3.type === "review") {
|
|
17958
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
18057
|
+
const stateColor = comment3.state === "APPROVED" ? chalk162.green : comment3.state === "CHANGES_REQUESTED" ? chalk162.red : chalk162.yellow;
|
|
17959
18058
|
return [
|
|
17960
|
-
`${
|
|
18059
|
+
`${chalk162.cyan("Review")} by ${chalk162.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
17961
18060
|
comment3.body,
|
|
17962
18061
|
""
|
|
17963
18062
|
].join("\n");
|
|
17964
18063
|
}
|
|
17965
18064
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
17966
18065
|
return [
|
|
17967
|
-
`${
|
|
17968
|
-
|
|
18066
|
+
`${chalk162.cyan("Line comment")} by ${chalk162.bold(comment3.user)} on ${chalk162.dim(`${comment3.path}${location}`)}`,
|
|
18067
|
+
chalk162.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
17969
18068
|
comment3.body,
|
|
17970
18069
|
""
|
|
17971
18070
|
].join("\n");
|
|
@@ -18055,13 +18154,13 @@ import { execSync as execSync46 } from "child_process";
|
|
|
18055
18154
|
import enquirer9 from "enquirer";
|
|
18056
18155
|
|
|
18057
18156
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
18058
|
-
import
|
|
18157
|
+
import chalk163 from "chalk";
|
|
18059
18158
|
var STATUS_MAP = {
|
|
18060
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
18061
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
18159
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk163.magenta("merged"), date: pr.mergedAt } : null,
|
|
18160
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk163.red("closed"), date: pr.closedAt } : null
|
|
18062
18161
|
};
|
|
18063
18162
|
function defaultStatus(pr) {
|
|
18064
|
-
return { label:
|
|
18163
|
+
return { label: chalk163.green("opened"), date: pr.createdAt };
|
|
18065
18164
|
}
|
|
18066
18165
|
function getStatus2(pr) {
|
|
18067
18166
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -18070,11 +18169,11 @@ function formatDate(dateStr) {
|
|
|
18070
18169
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
18071
18170
|
}
|
|
18072
18171
|
function formatPrHeader(pr, status3) {
|
|
18073
|
-
return `${
|
|
18172
|
+
return `${chalk163.cyan(`#${pr.number}`)} ${pr.title} ${chalk163.dim(`(${pr.author.login},`)} ${status3.label} ${chalk163.dim(`${formatDate(status3.date)})`)}`;
|
|
18074
18173
|
}
|
|
18075
18174
|
function logPrDetails(pr) {
|
|
18076
18175
|
console.log(
|
|
18077
|
-
|
|
18176
|
+
chalk163.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
18078
18177
|
);
|
|
18079
18178
|
console.log();
|
|
18080
18179
|
}
|
|
@@ -18655,10 +18754,10 @@ function registerPrs(program2) {
|
|
|
18655
18754
|
}
|
|
18656
18755
|
|
|
18657
18756
|
// src/commands/ravendb/ravendbAuth.ts
|
|
18658
|
-
import
|
|
18757
|
+
import chalk169 from "chalk";
|
|
18659
18758
|
|
|
18660
18759
|
// src/shared/createConnectionAuth.ts
|
|
18661
|
-
import
|
|
18760
|
+
import chalk164 from "chalk";
|
|
18662
18761
|
function listConnections(connections, format) {
|
|
18663
18762
|
if (connections.length === 0) {
|
|
18664
18763
|
console.log("No connections configured.");
|
|
@@ -18671,7 +18770,7 @@ function listConnections(connections, format) {
|
|
|
18671
18770
|
function removeConnection(connections, name, save) {
|
|
18672
18771
|
const filtered = connections.filter((c) => c.name !== name);
|
|
18673
18772
|
if (filtered.length === connections.length) {
|
|
18674
|
-
console.error(
|
|
18773
|
+
console.error(chalk164.red(`Connection "${name}" not found.`));
|
|
18675
18774
|
process.exit(1);
|
|
18676
18775
|
}
|
|
18677
18776
|
save(filtered);
|
|
@@ -18717,15 +18816,15 @@ function saveConnections(connections) {
|
|
|
18717
18816
|
}
|
|
18718
18817
|
|
|
18719
18818
|
// src/commands/ravendb/promptConnection.ts
|
|
18720
|
-
import
|
|
18819
|
+
import chalk167 from "chalk";
|
|
18721
18820
|
|
|
18722
18821
|
// src/commands/ravendb/selectOpSecret.ts
|
|
18723
|
-
import
|
|
18822
|
+
import chalk166 from "chalk";
|
|
18724
18823
|
import Enquirer2 from "enquirer";
|
|
18725
18824
|
|
|
18726
18825
|
// src/commands/ravendb/searchItems.ts
|
|
18727
18826
|
import { execSync as execSync49 } from "child_process";
|
|
18728
|
-
import
|
|
18827
|
+
import chalk165 from "chalk";
|
|
18729
18828
|
function opExec(args) {
|
|
18730
18829
|
return execSync49(`op ${args}`, {
|
|
18731
18830
|
encoding: "utf8",
|
|
@@ -18738,7 +18837,7 @@ function searchItems(search2) {
|
|
|
18738
18837
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
18739
18838
|
} catch {
|
|
18740
18839
|
console.error(
|
|
18741
|
-
|
|
18840
|
+
chalk165.red(
|
|
18742
18841
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
18743
18842
|
)
|
|
18744
18843
|
);
|
|
@@ -18752,7 +18851,7 @@ function getItemFields(itemId2) {
|
|
|
18752
18851
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
18753
18852
|
return item.fields.filter((f) => f.reference && f.label);
|
|
18754
18853
|
} catch {
|
|
18755
|
-
console.error(
|
|
18854
|
+
console.error(chalk165.red("Failed to get item details from 1Password."));
|
|
18756
18855
|
process.exit(1);
|
|
18757
18856
|
}
|
|
18758
18857
|
}
|
|
@@ -18771,7 +18870,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
18771
18870
|
}).run();
|
|
18772
18871
|
const items2 = searchItems(search2);
|
|
18773
18872
|
if (items2.length === 0) {
|
|
18774
|
-
console.error(
|
|
18873
|
+
console.error(chalk166.red(`No items found matching "${search2}".`));
|
|
18775
18874
|
process.exit(1);
|
|
18776
18875
|
}
|
|
18777
18876
|
const itemId2 = await selectOne(
|
|
@@ -18780,7 +18879,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
18780
18879
|
);
|
|
18781
18880
|
const fields = getItemFields(itemId2);
|
|
18782
18881
|
if (fields.length === 0) {
|
|
18783
|
-
console.error(
|
|
18882
|
+
console.error(chalk166.red("No fields with references found on this item."));
|
|
18784
18883
|
process.exit(1);
|
|
18785
18884
|
}
|
|
18786
18885
|
const ref = await selectOne(
|
|
@@ -18794,7 +18893,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
18794
18893
|
async function promptConnection(existingNames) {
|
|
18795
18894
|
const name = await promptInput("name", "Connection name:");
|
|
18796
18895
|
if (existingNames.includes(name)) {
|
|
18797
|
-
console.error(
|
|
18896
|
+
console.error(chalk167.red(`Connection "${name}" already exists.`));
|
|
18798
18897
|
process.exit(1);
|
|
18799
18898
|
}
|
|
18800
18899
|
const url = await promptInput(
|
|
@@ -18803,22 +18902,22 @@ async function promptConnection(existingNames) {
|
|
|
18803
18902
|
);
|
|
18804
18903
|
const database = await promptInput("database", "Database name:");
|
|
18805
18904
|
if (!name || !url || !database) {
|
|
18806
|
-
console.error(
|
|
18905
|
+
console.error(chalk167.red("All fields are required."));
|
|
18807
18906
|
process.exit(1);
|
|
18808
18907
|
}
|
|
18809
18908
|
const apiKeyRef = await selectOpSecret();
|
|
18810
|
-
console.log(
|
|
18909
|
+
console.log(chalk167.dim(`Using: ${apiKeyRef}`));
|
|
18811
18910
|
return { name, url, database, apiKeyRef };
|
|
18812
18911
|
}
|
|
18813
18912
|
|
|
18814
18913
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
18815
|
-
import
|
|
18914
|
+
import chalk168 from "chalk";
|
|
18816
18915
|
function ravendbSetConnection(name) {
|
|
18817
18916
|
const raw = loadGlobalConfigRaw();
|
|
18818
18917
|
const ravendb = raw.ravendb ?? {};
|
|
18819
18918
|
const connections = ravendb.connections ?? [];
|
|
18820
18919
|
if (!connections.some((c) => c.name === name)) {
|
|
18821
|
-
console.error(
|
|
18920
|
+
console.error(chalk168.red(`Connection "${name}" not found.`));
|
|
18822
18921
|
console.error(
|
|
18823
18922
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
18824
18923
|
);
|
|
@@ -18834,16 +18933,16 @@ function ravendbSetConnection(name) {
|
|
|
18834
18933
|
var ravendbAuth = createConnectionAuth({
|
|
18835
18934
|
load: loadConnections,
|
|
18836
18935
|
save: saveConnections,
|
|
18837
|
-
format: (c) => `${
|
|
18936
|
+
format: (c) => `${chalk169.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
18838
18937
|
promptNew: promptConnection,
|
|
18839
18938
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
18840
18939
|
});
|
|
18841
18940
|
|
|
18842
18941
|
// src/commands/ravendb/ravendbCollections.ts
|
|
18843
|
-
import
|
|
18942
|
+
import chalk173 from "chalk";
|
|
18844
18943
|
|
|
18845
18944
|
// src/commands/ravendb/ravenFetch.ts
|
|
18846
|
-
import
|
|
18945
|
+
import chalk171 from "chalk";
|
|
18847
18946
|
|
|
18848
18947
|
// src/commands/ravendb/getAccessToken.ts
|
|
18849
18948
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -18880,10 +18979,10 @@ ${errorText}`
|
|
|
18880
18979
|
|
|
18881
18980
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
18882
18981
|
import { execSync as execSync50 } from "child_process";
|
|
18883
|
-
import
|
|
18982
|
+
import chalk170 from "chalk";
|
|
18884
18983
|
function resolveOpSecret(reference) {
|
|
18885
18984
|
if (!reference.startsWith("op://")) {
|
|
18886
|
-
console.error(
|
|
18985
|
+
console.error(chalk170.red(`Invalid secret reference: must start with op://`));
|
|
18887
18986
|
process.exit(1);
|
|
18888
18987
|
}
|
|
18889
18988
|
try {
|
|
@@ -18893,7 +18992,7 @@ function resolveOpSecret(reference) {
|
|
|
18893
18992
|
}).trim();
|
|
18894
18993
|
} catch {
|
|
18895
18994
|
console.error(
|
|
18896
|
-
|
|
18995
|
+
chalk170.red(
|
|
18897
18996
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
18898
18997
|
)
|
|
18899
18998
|
);
|
|
@@ -18920,7 +19019,7 @@ async function ravenFetch(connection, path71) {
|
|
|
18920
19019
|
if (!response.ok) {
|
|
18921
19020
|
const body = await response.text();
|
|
18922
19021
|
console.error(
|
|
18923
|
-
|
|
19022
|
+
chalk171.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
18924
19023
|
);
|
|
18925
19024
|
console.error(body.substring(0, 500));
|
|
18926
19025
|
process.exit(1);
|
|
@@ -18929,7 +19028,7 @@ async function ravenFetch(connection, path71) {
|
|
|
18929
19028
|
}
|
|
18930
19029
|
|
|
18931
19030
|
// src/commands/ravendb/resolveConnection.ts
|
|
18932
|
-
import
|
|
19031
|
+
import chalk172 from "chalk";
|
|
18933
19032
|
function loadRavendb() {
|
|
18934
19033
|
const raw = loadGlobalConfigRaw();
|
|
18935
19034
|
const ravendb = raw.ravendb;
|
|
@@ -18943,7 +19042,7 @@ function resolveConnection(name) {
|
|
|
18943
19042
|
const connectionName = name ?? defaultConnection;
|
|
18944
19043
|
if (!connectionName) {
|
|
18945
19044
|
console.error(
|
|
18946
|
-
|
|
19045
|
+
chalk172.red(
|
|
18947
19046
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
18948
19047
|
)
|
|
18949
19048
|
);
|
|
@@ -18951,7 +19050,7 @@ function resolveConnection(name) {
|
|
|
18951
19050
|
}
|
|
18952
19051
|
const connection = connections.find((c) => c.name === connectionName);
|
|
18953
19052
|
if (!connection) {
|
|
18954
|
-
console.error(
|
|
19053
|
+
console.error(chalk172.red(`Connection "${connectionName}" not found.`));
|
|
18955
19054
|
console.error(
|
|
18956
19055
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
18957
19056
|
);
|
|
@@ -18982,7 +19081,7 @@ async function ravendbCollections(connectionName) {
|
|
|
18982
19081
|
return;
|
|
18983
19082
|
}
|
|
18984
19083
|
for (const c of collections) {
|
|
18985
|
-
console.log(`${
|
|
19084
|
+
console.log(`${chalk173.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
18986
19085
|
}
|
|
18987
19086
|
}
|
|
18988
19087
|
|
|
@@ -19001,10 +19100,10 @@ var ravendbConfigHelp = [
|
|
|
19001
19100
|
];
|
|
19002
19101
|
|
|
19003
19102
|
// src/commands/ravendb/ravendbQuery.ts
|
|
19004
|
-
import
|
|
19103
|
+
import chalk175 from "chalk";
|
|
19005
19104
|
|
|
19006
19105
|
// src/commands/ravendb/fetchAllPages.ts
|
|
19007
|
-
import
|
|
19106
|
+
import chalk174 from "chalk";
|
|
19008
19107
|
|
|
19009
19108
|
// src/commands/ravendb/buildQueryPath.ts
|
|
19010
19109
|
function buildQueryPath(opts) {
|
|
@@ -19042,7 +19141,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
19042
19141
|
allResults.push(...results);
|
|
19043
19142
|
start3 += results.length;
|
|
19044
19143
|
process.stderr.write(
|
|
19045
|
-
`\r${
|
|
19144
|
+
`\r${chalk174.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
19046
19145
|
);
|
|
19047
19146
|
if (start3 >= totalResults) break;
|
|
19048
19147
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -19057,7 +19156,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
19057
19156
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
19058
19157
|
const resolved = resolveArgs(connectionName, collection);
|
|
19059
19158
|
if (!resolved.collection && !options2.query) {
|
|
19060
|
-
console.error(
|
|
19159
|
+
console.error(chalk175.red("Provide a collection name or --query filter."));
|
|
19061
19160
|
process.exit(1);
|
|
19062
19161
|
}
|
|
19063
19162
|
const { collection: col } = resolved;
|
|
@@ -19096,7 +19195,7 @@ import { spawn as spawn5 } from "child_process";
|
|
|
19096
19195
|
import * as path36 from "path";
|
|
19097
19196
|
|
|
19098
19197
|
// src/commands/refactor/logViolations.ts
|
|
19099
|
-
import
|
|
19198
|
+
import chalk176 from "chalk";
|
|
19100
19199
|
var DEFAULT_MAX_LINES = 100;
|
|
19101
19200
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
19102
19201
|
if (violations.length === 0) {
|
|
@@ -19105,43 +19204,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
19105
19204
|
}
|
|
19106
19205
|
return;
|
|
19107
19206
|
}
|
|
19108
|
-
console.error(
|
|
19207
|
+
console.error(chalk176.red(`
|
|
19109
19208
|
Refactor check failed:
|
|
19110
19209
|
`));
|
|
19111
|
-
console.error(
|
|
19210
|
+
console.error(chalk176.red(` The following files exceed ${maxLines} lines:
|
|
19112
19211
|
`));
|
|
19113
19212
|
for (const violation of violations) {
|
|
19114
|
-
console.error(
|
|
19213
|
+
console.error(chalk176.red(` ${violation.file} (${violation.lines} lines)`));
|
|
19115
19214
|
}
|
|
19116
19215
|
console.error(
|
|
19117
|
-
|
|
19216
|
+
chalk176.yellow(
|
|
19118
19217
|
`
|
|
19119
19218
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
19120
19219
|
way to refactor it, ignore it with:
|
|
19121
19220
|
`
|
|
19122
19221
|
)
|
|
19123
19222
|
);
|
|
19124
|
-
console.error(
|
|
19223
|
+
console.error(chalk176.gray(` assist refactor ignore <file>
|
|
19125
19224
|
`));
|
|
19126
19225
|
if (process.env.CLAUDECODE) {
|
|
19127
|
-
console.error(
|
|
19226
|
+
console.error(chalk176.cyan(`
|
|
19128
19227
|
## Extracting Code to New Files
|
|
19129
19228
|
`));
|
|
19130
19229
|
console.error(
|
|
19131
|
-
|
|
19230
|
+
chalk176.cyan(
|
|
19132
19231
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
19133
19232
|
`
|
|
19134
19233
|
)
|
|
19135
19234
|
);
|
|
19136
19235
|
console.error(
|
|
19137
|
-
|
|
19236
|
+
chalk176.cyan(
|
|
19138
19237
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
19139
19238
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
19140
19239
|
`
|
|
19141
19240
|
)
|
|
19142
19241
|
);
|
|
19143
19242
|
console.error(
|
|
19144
|
-
|
|
19243
|
+
chalk176.cyan(
|
|
19145
19244
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
19146
19245
|
domains, move it to a common/shared folder.
|
|
19147
19246
|
`
|
|
@@ -19297,7 +19396,7 @@ async function check(pattern2, options2) {
|
|
|
19297
19396
|
|
|
19298
19397
|
// src/commands/refactor/extract/index.ts
|
|
19299
19398
|
import path44 from "path";
|
|
19300
|
-
import
|
|
19399
|
+
import chalk179 from "chalk";
|
|
19301
19400
|
|
|
19302
19401
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
19303
19402
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -19896,23 +19995,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
19896
19995
|
|
|
19897
19996
|
// src/commands/refactor/extract/displayPlan.ts
|
|
19898
19997
|
import path40 from "path";
|
|
19899
|
-
import
|
|
19998
|
+
import chalk177 from "chalk";
|
|
19900
19999
|
function section2(title) {
|
|
19901
20000
|
return `
|
|
19902
|
-
${
|
|
20001
|
+
${chalk177.cyan(title)}`;
|
|
19903
20002
|
}
|
|
19904
20003
|
function displayImporters(plan2, cwd) {
|
|
19905
20004
|
if (plan2.importersToUpdate.length === 0) return;
|
|
19906
20005
|
console.log(section2("Update importers:"));
|
|
19907
20006
|
for (const imp of plan2.importersToUpdate) {
|
|
19908
20007
|
const rel = path40.relative(cwd, imp.file.getFilePath());
|
|
19909
|
-
console.log(` ${
|
|
20008
|
+
console.log(` ${chalk177.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
19910
20009
|
}
|
|
19911
20010
|
}
|
|
19912
20011
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
19913
|
-
console.log(
|
|
20012
|
+
console.log(chalk177.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
19914
20013
|
`));
|
|
19915
|
-
console.log(` ${
|
|
20014
|
+
console.log(` ${chalk177.cyan("Functions to move:")}`);
|
|
19916
20015
|
for (const name of plan2.extractedNames) {
|
|
19917
20016
|
console.log(` ${name}`);
|
|
19918
20017
|
}
|
|
@@ -19946,7 +20045,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
19946
20045
|
|
|
19947
20046
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
19948
20047
|
import path43 from "path";
|
|
19949
|
-
import
|
|
20048
|
+
import chalk178 from "chalk";
|
|
19950
20049
|
import { Project as Project4 } from "ts-morph";
|
|
19951
20050
|
|
|
19952
20051
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -20038,7 +20137,7 @@ function loadProjectFile(file) {
|
|
|
20038
20137
|
});
|
|
20039
20138
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
20040
20139
|
if (!sourceFile) {
|
|
20041
|
-
console.log(
|
|
20140
|
+
console.log(chalk178.red(`File not found in project: ${file}`));
|
|
20042
20141
|
process.exit(1);
|
|
20043
20142
|
}
|
|
20044
20143
|
return { project, sourceFile };
|
|
@@ -20061,19 +20160,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
20061
20160
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
20062
20161
|
if (options2.apply) {
|
|
20063
20162
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
20064
|
-
console.log(
|
|
20163
|
+
console.log(chalk179.green("\nExtraction complete"));
|
|
20065
20164
|
} else {
|
|
20066
|
-
console.log(
|
|
20165
|
+
console.log(chalk179.dim("\nDry run. Use --apply to execute."));
|
|
20067
20166
|
}
|
|
20068
20167
|
}
|
|
20069
20168
|
|
|
20070
20169
|
// src/commands/refactor/ignore.ts
|
|
20071
20170
|
import fs28 from "fs";
|
|
20072
|
-
import
|
|
20171
|
+
import chalk180 from "chalk";
|
|
20073
20172
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
20074
20173
|
function ignore2(file) {
|
|
20075
20174
|
if (!fs28.existsSync(file)) {
|
|
20076
|
-
console.error(
|
|
20175
|
+
console.error(chalk180.red(`Error: File does not exist: ${file}`));
|
|
20077
20176
|
process.exit(1);
|
|
20078
20177
|
}
|
|
20079
20178
|
const content = fs28.readFileSync(file, "utf8");
|
|
@@ -20089,7 +20188,7 @@ function ignore2(file) {
|
|
|
20089
20188
|
fs28.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
20090
20189
|
}
|
|
20091
20190
|
console.log(
|
|
20092
|
-
|
|
20191
|
+
chalk180.green(
|
|
20093
20192
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
20094
20193
|
)
|
|
20095
20194
|
);
|
|
@@ -20098,12 +20197,12 @@ function ignore2(file) {
|
|
|
20098
20197
|
// src/commands/refactor/rename/index.ts
|
|
20099
20198
|
import fs31 from "fs";
|
|
20100
20199
|
import path49 from "path";
|
|
20101
|
-
import
|
|
20200
|
+
import chalk183 from "chalk";
|
|
20102
20201
|
|
|
20103
20202
|
// src/commands/refactor/rename/applyRename.ts
|
|
20104
20203
|
import fs30 from "fs";
|
|
20105
20204
|
import path46 from "path";
|
|
20106
|
-
import
|
|
20205
|
+
import chalk181 from "chalk";
|
|
20107
20206
|
|
|
20108
20207
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
20109
20208
|
import path45 from "path";
|
|
@@ -20208,13 +20307,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
20208
20307
|
const updatedContents = applyRewrites(rewrites);
|
|
20209
20308
|
for (const [file, content] of updatedContents) {
|
|
20210
20309
|
fs30.writeFileSync(file, content, "utf8");
|
|
20211
|
-
console.log(
|
|
20310
|
+
console.log(chalk181.cyan(` Updated imports in ${path46.relative(cwd, file)}`));
|
|
20212
20311
|
}
|
|
20213
20312
|
const destDir = path46.dirname(destPath);
|
|
20214
20313
|
if (!fs30.existsSync(destDir)) fs30.mkdirSync(destDir, { recursive: true });
|
|
20215
20314
|
fs30.renameSync(sourcePath, destPath);
|
|
20216
20315
|
console.log(
|
|
20217
|
-
|
|
20316
|
+
chalk181.white(
|
|
20218
20317
|
` Moved ${path46.relative(cwd, sourcePath)} \u2192 ${path46.relative(cwd, destPath)}`
|
|
20219
20318
|
)
|
|
20220
20319
|
);
|
|
@@ -20301,16 +20400,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
20301
20400
|
|
|
20302
20401
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
20303
20402
|
import path48 from "path";
|
|
20304
|
-
import
|
|
20403
|
+
import chalk182 from "chalk";
|
|
20305
20404
|
function printRenamePreview(rewrites, cwd) {
|
|
20306
20405
|
for (const rewrite of rewrites) {
|
|
20307
20406
|
console.log(
|
|
20308
|
-
|
|
20407
|
+
chalk182.dim(
|
|
20309
20408
|
` ${path48.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
20310
20409
|
)
|
|
20311
20410
|
);
|
|
20312
20411
|
}
|
|
20313
|
-
console.log(
|
|
20412
|
+
console.log(chalk182.dim("Dry run. Use --apply to execute."));
|
|
20314
20413
|
}
|
|
20315
20414
|
|
|
20316
20415
|
// src/commands/refactor/rename/index.ts
|
|
@@ -20321,20 +20420,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
20321
20420
|
const relSource = path49.relative(cwd, sourcePath);
|
|
20322
20421
|
const relDest = path49.relative(cwd, destPath);
|
|
20323
20422
|
if (!fs31.existsSync(sourcePath)) {
|
|
20324
|
-
console.log(
|
|
20423
|
+
console.log(chalk183.red(`File not found: ${source}`));
|
|
20325
20424
|
process.exit(1);
|
|
20326
20425
|
}
|
|
20327
20426
|
if (destPath !== sourcePath && fs31.existsSync(destPath)) {
|
|
20328
|
-
console.log(
|
|
20427
|
+
console.log(chalk183.red(`Destination already exists: ${destination}`));
|
|
20329
20428
|
process.exit(1);
|
|
20330
20429
|
}
|
|
20331
|
-
console.log(
|
|
20332
|
-
console.log(
|
|
20333
|
-
console.log(
|
|
20430
|
+
console.log(chalk183.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
20431
|
+
console.log(chalk183.dim("Loading project..."));
|
|
20432
|
+
console.log(chalk183.dim("Scanning imports across the project..."));
|
|
20334
20433
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
20335
20434
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
20336
20435
|
console.log(
|
|
20337
|
-
|
|
20436
|
+
chalk183.dim(
|
|
20338
20437
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
20339
20438
|
)
|
|
20340
20439
|
);
|
|
@@ -20343,11 +20442,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
20343
20442
|
return;
|
|
20344
20443
|
}
|
|
20345
20444
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
20346
|
-
console.log(
|
|
20445
|
+
console.log(chalk183.green("Done"));
|
|
20347
20446
|
}
|
|
20348
20447
|
|
|
20349
20448
|
// src/commands/refactor/renameSymbol/index.ts
|
|
20350
|
-
import
|
|
20449
|
+
import chalk184 from "chalk";
|
|
20351
20450
|
|
|
20352
20451
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
20353
20452
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -20393,33 +20492,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
20393
20492
|
const { project, sourceFile } = loadProjectFile(file);
|
|
20394
20493
|
const symbol = findSymbol(sourceFile, oldName);
|
|
20395
20494
|
if (!symbol) {
|
|
20396
|
-
console.log(
|
|
20495
|
+
console.log(chalk184.red(`Symbol "${oldName}" not found in ${file}`));
|
|
20397
20496
|
process.exit(1);
|
|
20398
20497
|
}
|
|
20399
20498
|
const grouped = groupReferences(symbol, cwd);
|
|
20400
20499
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
20401
20500
|
console.log(
|
|
20402
|
-
|
|
20501
|
+
chalk184.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
20403
20502
|
`)
|
|
20404
20503
|
);
|
|
20405
20504
|
for (const [refFile, lines] of grouped) {
|
|
20406
20505
|
console.log(
|
|
20407
|
-
` ${
|
|
20506
|
+
` ${chalk184.dim(refFile)}: lines ${chalk184.cyan(lines.join(", "))}`
|
|
20408
20507
|
);
|
|
20409
20508
|
}
|
|
20410
20509
|
if (options2.apply) {
|
|
20411
20510
|
symbol.rename(newName);
|
|
20412
20511
|
await project.save();
|
|
20413
|
-
console.log(
|
|
20512
|
+
console.log(chalk184.green(`
|
|
20414
20513
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
20415
20514
|
} else {
|
|
20416
|
-
console.log(
|
|
20515
|
+
console.log(chalk184.dim("\nDry run. Use --apply to execute."));
|
|
20417
20516
|
}
|
|
20418
20517
|
}
|
|
20419
20518
|
|
|
20420
20519
|
// src/commands/refactor/restructure/index.ts
|
|
20421
20520
|
import path57 from "path";
|
|
20422
|
-
import
|
|
20521
|
+
import chalk187 from "chalk";
|
|
20423
20522
|
|
|
20424
20523
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
20425
20524
|
import path51 from "path";
|
|
@@ -20498,50 +20597,50 @@ function clusterFiles(graph) {
|
|
|
20498
20597
|
|
|
20499
20598
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
20500
20599
|
import path53 from "path";
|
|
20501
|
-
import
|
|
20600
|
+
import chalk185 from "chalk";
|
|
20502
20601
|
function relPath(filePath) {
|
|
20503
20602
|
return path53.relative(process.cwd(), filePath);
|
|
20504
20603
|
}
|
|
20505
20604
|
function displayMoves(plan2) {
|
|
20506
20605
|
if (plan2.moves.length === 0) return;
|
|
20507
|
-
console.log(
|
|
20606
|
+
console.log(chalk185.bold("\nFile moves:"));
|
|
20508
20607
|
for (const move2 of plan2.moves) {
|
|
20509
20608
|
console.log(
|
|
20510
|
-
` ${
|
|
20609
|
+
` ${chalk185.red(relPath(move2.from))} \u2192 ${chalk185.green(relPath(move2.to))}`
|
|
20511
20610
|
);
|
|
20512
|
-
console.log(
|
|
20611
|
+
console.log(chalk185.dim(` ${move2.reason}`));
|
|
20513
20612
|
}
|
|
20514
20613
|
}
|
|
20515
20614
|
function displayRewrites(rewrites) {
|
|
20516
20615
|
if (rewrites.length === 0) return;
|
|
20517
20616
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
20518
|
-
console.log(
|
|
20617
|
+
console.log(chalk185.bold(`
|
|
20519
20618
|
Import rewrites (${affectedFiles.size} files):`));
|
|
20520
20619
|
for (const file of affectedFiles) {
|
|
20521
|
-
console.log(` ${
|
|
20620
|
+
console.log(` ${chalk185.cyan(relPath(file))}:`);
|
|
20522
20621
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
20523
20622
|
(r) => r.file === file
|
|
20524
20623
|
)) {
|
|
20525
20624
|
console.log(
|
|
20526
|
-
` ${
|
|
20625
|
+
` ${chalk185.red(`"${oldSpecifier}"`)} \u2192 ${chalk185.green(`"${newSpecifier}"`)}`
|
|
20527
20626
|
);
|
|
20528
20627
|
}
|
|
20529
20628
|
}
|
|
20530
20629
|
}
|
|
20531
20630
|
function displayPlan2(plan2) {
|
|
20532
20631
|
if (plan2.warnings.length > 0) {
|
|
20533
|
-
console.log(
|
|
20534
|
-
for (const w of plan2.warnings) console.log(
|
|
20632
|
+
console.log(chalk185.yellow("\nWarnings:"));
|
|
20633
|
+
for (const w of plan2.warnings) console.log(chalk185.yellow(` ${w}`));
|
|
20535
20634
|
}
|
|
20536
20635
|
if (plan2.newDirectories.length > 0) {
|
|
20537
|
-
console.log(
|
|
20636
|
+
console.log(chalk185.bold("\nNew directories:"));
|
|
20538
20637
|
for (const dir of plan2.newDirectories)
|
|
20539
|
-
console.log(
|
|
20638
|
+
console.log(chalk185.green(` ${dir}/`));
|
|
20540
20639
|
}
|
|
20541
20640
|
displayMoves(plan2);
|
|
20542
20641
|
displayRewrites(plan2.rewrites);
|
|
20543
20642
|
console.log(
|
|
20544
|
-
|
|
20643
|
+
chalk185.dim(
|
|
20545
20644
|
`
|
|
20546
20645
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
20547
20646
|
)
|
|
@@ -20551,18 +20650,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
20551
20650
|
// src/commands/refactor/restructure/executePlan.ts
|
|
20552
20651
|
import fs32 from "fs";
|
|
20553
20652
|
import path54 from "path";
|
|
20554
|
-
import
|
|
20653
|
+
import chalk186 from "chalk";
|
|
20555
20654
|
function executePlan(plan2) {
|
|
20556
20655
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
20557
20656
|
for (const [file, content] of updatedContents) {
|
|
20558
20657
|
fs32.writeFileSync(file, content, "utf8");
|
|
20559
20658
|
console.log(
|
|
20560
|
-
|
|
20659
|
+
chalk186.cyan(` Rewrote imports in ${path54.relative(process.cwd(), file)}`)
|
|
20561
20660
|
);
|
|
20562
20661
|
}
|
|
20563
20662
|
for (const dir of plan2.newDirectories) {
|
|
20564
20663
|
fs32.mkdirSync(dir, { recursive: true });
|
|
20565
|
-
console.log(
|
|
20664
|
+
console.log(chalk186.green(` Created ${path54.relative(process.cwd(), dir)}/`));
|
|
20566
20665
|
}
|
|
20567
20666
|
for (const move2 of plan2.moves) {
|
|
20568
20667
|
const targetDir = path54.dirname(move2.to);
|
|
@@ -20571,7 +20670,7 @@ function executePlan(plan2) {
|
|
|
20571
20670
|
}
|
|
20572
20671
|
fs32.renameSync(move2.from, move2.to);
|
|
20573
20672
|
console.log(
|
|
20574
|
-
|
|
20673
|
+
chalk186.white(
|
|
20575
20674
|
` Moved ${path54.relative(process.cwd(), move2.from)} \u2192 ${path54.relative(process.cwd(), move2.to)}`
|
|
20576
20675
|
)
|
|
20577
20676
|
);
|
|
@@ -20586,7 +20685,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
20586
20685
|
if (entries.length === 0) {
|
|
20587
20686
|
fs32.rmdirSync(dir);
|
|
20588
20687
|
console.log(
|
|
20589
|
-
|
|
20688
|
+
chalk186.dim(
|
|
20590
20689
|
` Removed empty directory ${path54.relative(process.cwd(), dir)}`
|
|
20591
20690
|
)
|
|
20592
20691
|
);
|
|
@@ -20719,22 +20818,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
20719
20818
|
const targetPattern = pattern2 ?? "src";
|
|
20720
20819
|
const files = findSourceFiles2(targetPattern);
|
|
20721
20820
|
if (files.length === 0) {
|
|
20722
|
-
console.log(
|
|
20821
|
+
console.log(chalk187.yellow("No files found matching pattern"));
|
|
20723
20822
|
return;
|
|
20724
20823
|
}
|
|
20725
20824
|
const tsConfigPath = findTsConfig(path57.resolve(files[0]));
|
|
20726
20825
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
20727
20826
|
if (plan2.moves.length === 0) {
|
|
20728
|
-
console.log(
|
|
20827
|
+
console.log(chalk187.green("No restructuring needed"));
|
|
20729
20828
|
return;
|
|
20730
20829
|
}
|
|
20731
20830
|
displayPlan2(plan2);
|
|
20732
20831
|
if (options2.apply) {
|
|
20733
|
-
console.log(
|
|
20832
|
+
console.log(chalk187.bold("\nApplying changes..."));
|
|
20734
20833
|
executePlan(plan2);
|
|
20735
|
-
console.log(
|
|
20834
|
+
console.log(chalk187.green("\nRestructuring complete"));
|
|
20736
20835
|
} else {
|
|
20737
|
-
console.log(
|
|
20836
|
+
console.log(chalk187.dim("\nDry run. Use --apply to execute."));
|
|
20738
20837
|
}
|
|
20739
20838
|
}
|
|
20740
20839
|
|
|
@@ -20794,10 +20893,10 @@ function gutter(lineNumber) {
|
|
|
20794
20893
|
const label2 = lineNumber === null ? "" : String(lineNumber);
|
|
20795
20894
|
return `${label2.padStart(GUTTER_WIDTH, " ")} `;
|
|
20796
20895
|
}
|
|
20797
|
-
function annotateDiffWithLineNumbers(
|
|
20896
|
+
function annotateDiffWithLineNumbers(diff3) {
|
|
20798
20897
|
let inFile = false;
|
|
20799
20898
|
let newLine = 0;
|
|
20800
|
-
return
|
|
20899
|
+
return diff3.split("\n").map((line) => {
|
|
20801
20900
|
if (FILE_HEADER2.test(line)) {
|
|
20802
20901
|
inFile = true;
|
|
20803
20902
|
return gutter(null) + line;
|
|
@@ -21040,7 +21139,7 @@ function gatherContext() {
|
|
|
21040
21139
|
}).trim();
|
|
21041
21140
|
const prInfo = fetchPrDiffInfo();
|
|
21042
21141
|
const changedFiles = fetchPrChangedFiles(prInfo.prNumber);
|
|
21043
|
-
const
|
|
21142
|
+
const diff3 = fetchPrDiff(prInfo.prNumber, prInfo.baseSha, prInfo.headSha);
|
|
21044
21143
|
return {
|
|
21045
21144
|
branch: branch2,
|
|
21046
21145
|
sha,
|
|
@@ -21051,7 +21150,7 @@ function gatherContext() {
|
|
|
21051
21150
|
headRef: prInfo.headRef,
|
|
21052
21151
|
headSha: prInfo.headSha,
|
|
21053
21152
|
changedFiles,
|
|
21054
|
-
diff:
|
|
21153
|
+
diff: diff3
|
|
21055
21154
|
};
|
|
21056
21155
|
}
|
|
21057
21156
|
|
|
@@ -21266,11 +21365,11 @@ async function postAndMaybeSubmit(lineBound, markdown, options2) {
|
|
|
21266
21365
|
// src/commands/review/buildDiffLineIndex.ts
|
|
21267
21366
|
var FILE_HEADER3 = /^\+\+\+ (?:b\/)?(.+)$/;
|
|
21268
21367
|
var HUNK_HEADER3 = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/;
|
|
21269
|
-
function buildDiffLineIndex(
|
|
21368
|
+
function buildDiffLineIndex(diff3) {
|
|
21270
21369
|
const index3 = /* @__PURE__ */ new Map();
|
|
21271
21370
|
let currentFile = null;
|
|
21272
21371
|
let newLine = 0;
|
|
21273
|
-
for (const line of
|
|
21372
|
+
for (const line of diff3.split("\n")) {
|
|
21274
21373
|
const fileMatch = line.match(FILE_HEADER3);
|
|
21275
21374
|
if (fileMatch) {
|
|
21276
21375
|
currentFile = fileMatch[1] === "/dev/null" ? null : fileMatch[1];
|
|
@@ -21317,18 +21416,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
21317
21416
|
}
|
|
21318
21417
|
|
|
21319
21418
|
// src/commands/review/warnOutOfDiff.ts
|
|
21320
|
-
import
|
|
21419
|
+
import chalk188 from "chalk";
|
|
21321
21420
|
function warnOutOfDiff(outOfDiff) {
|
|
21322
21421
|
if (outOfDiff.length === 0) return;
|
|
21323
21422
|
console.warn(
|
|
21324
|
-
|
|
21423
|
+
chalk188.yellow(
|
|
21325
21424
|
`Skipped ${outOfDiff.length} finding(s) whose lines fall outside the PR diff (GitHub would silently drop these):`
|
|
21326
21425
|
)
|
|
21327
21426
|
);
|
|
21328
21427
|
for (const finding of outOfDiff) {
|
|
21329
21428
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
21330
21429
|
console.warn(
|
|
21331
|
-
` ${
|
|
21430
|
+
` ${chalk188.yellow("\xB7")} ${finding.title} ${chalk188.dim(
|
|
21332
21431
|
`(${finding.file}:${range})`
|
|
21333
21432
|
)}`
|
|
21334
21433
|
);
|
|
@@ -21337,28 +21436,28 @@ function warnOutOfDiff(outOfDiff) {
|
|
|
21337
21436
|
|
|
21338
21437
|
// src/commands/review/selectInDiffFindings.ts
|
|
21339
21438
|
function selectInDiffFindings(lineBound, prDiff) {
|
|
21340
|
-
const
|
|
21439
|
+
const diff3 = fetchPrDiff(prDiff.prNumber, prDiff.baseSha, prDiff.headSha);
|
|
21341
21440
|
const { inDiff, outOfDiff } = partitionFindingsByDiff(
|
|
21342
21441
|
lineBound,
|
|
21343
|
-
buildDiffLineIndex(
|
|
21442
|
+
buildDiffLineIndex(diff3)
|
|
21344
21443
|
);
|
|
21345
21444
|
warnOutOfDiff(outOfDiff);
|
|
21346
21445
|
return inDiff;
|
|
21347
21446
|
}
|
|
21348
21447
|
|
|
21349
21448
|
// src/commands/review/warnUnlocated.ts
|
|
21350
|
-
import
|
|
21449
|
+
import chalk189 from "chalk";
|
|
21351
21450
|
function warnUnlocated(unlocated) {
|
|
21352
21451
|
if (unlocated.length === 0) return;
|
|
21353
21452
|
console.warn(
|
|
21354
|
-
|
|
21453
|
+
chalk189.yellow(
|
|
21355
21454
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
21356
21455
|
)
|
|
21357
21456
|
);
|
|
21358
21457
|
for (const finding of unlocated) {
|
|
21359
|
-
const where = finding.location ||
|
|
21458
|
+
const where = finding.location || chalk189.dim("missing");
|
|
21360
21459
|
console.warn(
|
|
21361
|
-
` ${
|
|
21460
|
+
` ${chalk189.yellow("\xB7")} ${finding.title} ${chalk189.dim(`(${where})`)}`
|
|
21362
21461
|
);
|
|
21363
21462
|
}
|
|
21364
21463
|
}
|
|
@@ -22530,7 +22629,7 @@ function registerReview(program2) {
|
|
|
22530
22629
|
}
|
|
22531
22630
|
|
|
22532
22631
|
// src/commands/seq/seqAuth.ts
|
|
22533
|
-
import
|
|
22632
|
+
import chalk191 from "chalk";
|
|
22534
22633
|
|
|
22535
22634
|
// src/commands/seq/loadConnections.ts
|
|
22536
22635
|
function loadConnections2() {
|
|
@@ -22559,10 +22658,10 @@ function setDefaultConnection(name) {
|
|
|
22559
22658
|
}
|
|
22560
22659
|
|
|
22561
22660
|
// src/shared/assertUniqueName.ts
|
|
22562
|
-
import
|
|
22661
|
+
import chalk190 from "chalk";
|
|
22563
22662
|
function assertUniqueName(existingNames, name) {
|
|
22564
22663
|
if (existingNames.includes(name)) {
|
|
22565
|
-
console.error(
|
|
22664
|
+
console.error(chalk190.red(`Connection "${name}" already exists.`));
|
|
22566
22665
|
process.exit(1);
|
|
22567
22666
|
}
|
|
22568
22667
|
}
|
|
@@ -22580,7 +22679,7 @@ async function promptConnection2(existingNames) {
|
|
|
22580
22679
|
var seqAuth = createConnectionAuth({
|
|
22581
22680
|
load: loadConnections2,
|
|
22582
22681
|
save: saveConnections2,
|
|
22583
|
-
format: (c) => `${
|
|
22682
|
+
format: (c) => `${chalk191.bold(c.name)} ${c.url}`,
|
|
22584
22683
|
promptNew: promptConnection2,
|
|
22585
22684
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
22586
22685
|
});
|
|
@@ -22600,10 +22699,10 @@ var seqConfigHelp = [
|
|
|
22600
22699
|
];
|
|
22601
22700
|
|
|
22602
22701
|
// src/commands/seq/seqQuery.ts
|
|
22603
|
-
import
|
|
22702
|
+
import chalk195 from "chalk";
|
|
22604
22703
|
|
|
22605
22704
|
// src/commands/seq/fetchSeq.ts
|
|
22606
|
-
import
|
|
22705
|
+
import chalk192 from "chalk";
|
|
22607
22706
|
async function fetchSeq(conn, path71, params) {
|
|
22608
22707
|
const url = `${conn.url}${path71}?${params}`;
|
|
22609
22708
|
const response = await fetch(url, {
|
|
@@ -22614,7 +22713,7 @@ async function fetchSeq(conn, path71, params) {
|
|
|
22614
22713
|
});
|
|
22615
22714
|
if (!response.ok) {
|
|
22616
22715
|
const body = await response.text();
|
|
22617
|
-
console.error(
|
|
22716
|
+
console.error(chalk192.red(`Seq returned ${response.status}: ${body}`));
|
|
22618
22717
|
process.exit(1);
|
|
22619
22718
|
}
|
|
22620
22719
|
return response;
|
|
@@ -22673,23 +22772,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
22673
22772
|
}
|
|
22674
22773
|
|
|
22675
22774
|
// src/commands/seq/formatEvent.ts
|
|
22676
|
-
import
|
|
22775
|
+
import chalk193 from "chalk";
|
|
22677
22776
|
function levelColor(level) {
|
|
22678
22777
|
switch (level) {
|
|
22679
22778
|
case "Fatal":
|
|
22680
|
-
return
|
|
22779
|
+
return chalk193.bgRed.white;
|
|
22681
22780
|
case "Error":
|
|
22682
|
-
return
|
|
22781
|
+
return chalk193.red;
|
|
22683
22782
|
case "Warning":
|
|
22684
|
-
return
|
|
22783
|
+
return chalk193.yellow;
|
|
22685
22784
|
case "Information":
|
|
22686
|
-
return
|
|
22785
|
+
return chalk193.cyan;
|
|
22687
22786
|
case "Debug":
|
|
22688
|
-
return
|
|
22787
|
+
return chalk193.gray;
|
|
22689
22788
|
case "Verbose":
|
|
22690
|
-
return
|
|
22789
|
+
return chalk193.dim;
|
|
22691
22790
|
default:
|
|
22692
|
-
return
|
|
22791
|
+
return chalk193.white;
|
|
22693
22792
|
}
|
|
22694
22793
|
}
|
|
22695
22794
|
function levelAbbrev(level) {
|
|
@@ -22730,12 +22829,12 @@ function formatTimestamp(iso) {
|
|
|
22730
22829
|
function formatEvent(event) {
|
|
22731
22830
|
const color = levelColor(event.Level);
|
|
22732
22831
|
const abbrev = levelAbbrev(event.Level);
|
|
22733
|
-
const ts8 =
|
|
22832
|
+
const ts8 = chalk193.dim(formatTimestamp(event.Timestamp));
|
|
22734
22833
|
const msg = renderMessage(event);
|
|
22735
22834
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
22736
22835
|
if (event.Exception) {
|
|
22737
22836
|
for (const line of event.Exception.split("\n")) {
|
|
22738
|
-
lines.push(
|
|
22837
|
+
lines.push(chalk193.red(` ${line}`));
|
|
22739
22838
|
}
|
|
22740
22839
|
}
|
|
22741
22840
|
return lines.join("\n");
|
|
@@ -22768,11 +22867,11 @@ function rejectTimestampFilter(filter) {
|
|
|
22768
22867
|
}
|
|
22769
22868
|
|
|
22770
22869
|
// src/shared/resolveNamedConnection.ts
|
|
22771
|
-
import
|
|
22870
|
+
import chalk194 from "chalk";
|
|
22772
22871
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
22773
22872
|
if (connections.length === 0) {
|
|
22774
22873
|
console.error(
|
|
22775
|
-
|
|
22874
|
+
chalk194.red(
|
|
22776
22875
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
22777
22876
|
)
|
|
22778
22877
|
);
|
|
@@ -22781,7 +22880,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
22781
22880
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
22782
22881
|
const connection = connections.find((c) => c.name === target);
|
|
22783
22882
|
if (!connection) {
|
|
22784
|
-
console.error(
|
|
22883
|
+
console.error(chalk194.red(`${kind} connection "${target}" not found.`));
|
|
22785
22884
|
process.exit(1);
|
|
22786
22885
|
}
|
|
22787
22886
|
return connection;
|
|
@@ -22810,7 +22909,7 @@ async function seqQuery(filter, options2) {
|
|
|
22810
22909
|
new URLSearchParams({ filter, count: String(count7) })
|
|
22811
22910
|
);
|
|
22812
22911
|
if (events.length === 0) {
|
|
22813
|
-
console.log(
|
|
22912
|
+
console.log(chalk195.yellow("No events found."));
|
|
22814
22913
|
return;
|
|
22815
22914
|
}
|
|
22816
22915
|
if (options2.json) {
|
|
@@ -22821,11 +22920,11 @@ async function seqQuery(filter, options2) {
|
|
|
22821
22920
|
for (const event of chronological) {
|
|
22822
22921
|
console.log(formatEvent(event));
|
|
22823
22922
|
}
|
|
22824
|
-
console.log(
|
|
22923
|
+
console.log(chalk195.dim(`
|
|
22825
22924
|
${events.length} events`));
|
|
22826
22925
|
if (events.length >= count7) {
|
|
22827
22926
|
console.log(
|
|
22828
|
-
|
|
22927
|
+
chalk195.yellow(
|
|
22829
22928
|
`Results limited to ${count7}. Use --count to retrieve more.`
|
|
22830
22929
|
)
|
|
22831
22930
|
);
|
|
@@ -22833,10 +22932,10 @@ ${events.length} events`));
|
|
|
22833
22932
|
}
|
|
22834
22933
|
|
|
22835
22934
|
// src/shared/setNamedDefaultConnection.ts
|
|
22836
|
-
import
|
|
22935
|
+
import chalk196 from "chalk";
|
|
22837
22936
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
22838
22937
|
if (!connections.find((c) => c.name === name)) {
|
|
22839
|
-
console.error(
|
|
22938
|
+
console.error(chalk196.red(`Connection "${name}" not found.`));
|
|
22840
22939
|
process.exit(1);
|
|
22841
22940
|
}
|
|
22842
22941
|
setDefault(name);
|
|
@@ -22885,7 +22984,7 @@ function registerSignal(program2) {
|
|
|
22885
22984
|
}
|
|
22886
22985
|
|
|
22887
22986
|
// src/commands/sql/sqlAuth.ts
|
|
22888
|
-
import
|
|
22987
|
+
import chalk198 from "chalk";
|
|
22889
22988
|
|
|
22890
22989
|
// src/commands/sql/loadConnections.ts
|
|
22891
22990
|
function loadConnections3() {
|
|
@@ -22914,7 +23013,7 @@ function setDefaultConnection2(name) {
|
|
|
22914
23013
|
}
|
|
22915
23014
|
|
|
22916
23015
|
// src/commands/sql/promptConnection.ts
|
|
22917
|
-
import
|
|
23016
|
+
import chalk197 from "chalk";
|
|
22918
23017
|
async function promptConnection3(existingNames) {
|
|
22919
23018
|
const name = await promptInput("name", "Connection name:", "default");
|
|
22920
23019
|
assertUniqueName(existingNames, name);
|
|
@@ -22922,7 +23021,7 @@ async function promptConnection3(existingNames) {
|
|
|
22922
23021
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
22923
23022
|
const port = Number.parseInt(portStr, 10);
|
|
22924
23023
|
if (!Number.isFinite(port)) {
|
|
22925
|
-
console.error(
|
|
23024
|
+
console.error(chalk197.red(`Invalid port "${portStr}".`));
|
|
22926
23025
|
process.exit(1);
|
|
22927
23026
|
}
|
|
22928
23027
|
const user = await promptInput("user", "User:");
|
|
@@ -22935,13 +23034,13 @@ async function promptConnection3(existingNames) {
|
|
|
22935
23034
|
var sqlAuth = createConnectionAuth({
|
|
22936
23035
|
load: loadConnections3,
|
|
22937
23036
|
save: saveConnections3,
|
|
22938
|
-
format: (c) => `${
|
|
23037
|
+
format: (c) => `${chalk198.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
22939
23038
|
promptNew: promptConnection3,
|
|
22940
23039
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
22941
23040
|
});
|
|
22942
23041
|
|
|
22943
23042
|
// src/commands/sql/printTable.ts
|
|
22944
|
-
import
|
|
23043
|
+
import chalk199 from "chalk";
|
|
22945
23044
|
function formatCell(value) {
|
|
22946
23045
|
if (value === null || value === void 0) return "";
|
|
22947
23046
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -22950,7 +23049,7 @@ function formatCell(value) {
|
|
|
22950
23049
|
}
|
|
22951
23050
|
function printTable(rows) {
|
|
22952
23051
|
if (rows.length === 0) {
|
|
22953
|
-
console.log(
|
|
23052
|
+
console.log(chalk199.yellow("(no rows)"));
|
|
22954
23053
|
return;
|
|
22955
23054
|
}
|
|
22956
23055
|
const columns = Object.keys(rows[0]);
|
|
@@ -22958,13 +23057,13 @@ function printTable(rows) {
|
|
|
22958
23057
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
22959
23058
|
);
|
|
22960
23059
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
22961
|
-
console.log(
|
|
22962
|
-
console.log(
|
|
23060
|
+
console.log(chalk199.dim(header));
|
|
23061
|
+
console.log(chalk199.dim("-".repeat(header.length)));
|
|
22963
23062
|
for (const row of rows) {
|
|
22964
23063
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
22965
23064
|
console.log(line);
|
|
22966
23065
|
}
|
|
22967
|
-
console.log(
|
|
23066
|
+
console.log(chalk199.dim(`
|
|
22968
23067
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
22969
23068
|
}
|
|
22970
23069
|
|
|
@@ -23038,7 +23137,7 @@ var sqlConfigHelp = [
|
|
|
23038
23137
|
];
|
|
23039
23138
|
|
|
23040
23139
|
// src/commands/sql/sqlMutate.ts
|
|
23041
|
-
import
|
|
23140
|
+
import chalk200 from "chalk";
|
|
23042
23141
|
|
|
23043
23142
|
// src/commands/sql/isMutation.ts
|
|
23044
23143
|
var MUTATION_KEYWORDS = [
|
|
@@ -23072,7 +23171,7 @@ function isMutation(sql25) {
|
|
|
23072
23171
|
async function sqlMutate(query, connectionName) {
|
|
23073
23172
|
if (!isMutation(query)) {
|
|
23074
23173
|
console.error(
|
|
23075
|
-
|
|
23174
|
+
chalk200.red(
|
|
23076
23175
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
23077
23176
|
)
|
|
23078
23177
|
);
|
|
@@ -23082,18 +23181,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
23082
23181
|
const pool = await sqlConnect(conn);
|
|
23083
23182
|
try {
|
|
23084
23183
|
const result = await pool.request().query(query);
|
|
23085
|
-
console.log(
|
|
23184
|
+
console.log(chalk200.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
23086
23185
|
} finally {
|
|
23087
23186
|
await pool.close();
|
|
23088
23187
|
}
|
|
23089
23188
|
}
|
|
23090
23189
|
|
|
23091
23190
|
// src/commands/sql/sqlQuery.ts
|
|
23092
|
-
import
|
|
23191
|
+
import chalk201 from "chalk";
|
|
23093
23192
|
async function sqlQuery(query, connectionName) {
|
|
23094
23193
|
if (isMutation(query)) {
|
|
23095
23194
|
console.error(
|
|
23096
|
-
|
|
23195
|
+
chalk201.red(
|
|
23097
23196
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
23098
23197
|
)
|
|
23099
23198
|
);
|
|
@@ -23108,7 +23207,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
23108
23207
|
printTable(rows);
|
|
23109
23208
|
} else {
|
|
23110
23209
|
console.log(
|
|
23111
|
-
|
|
23210
|
+
chalk201.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
23112
23211
|
);
|
|
23113
23212
|
}
|
|
23114
23213
|
} finally {
|
|
@@ -23923,7 +24022,7 @@ function registerVoice(program2) {
|
|
|
23923
24022
|
|
|
23924
24023
|
// src/commands/roam/auth.ts
|
|
23925
24024
|
import { randomBytes } from "crypto";
|
|
23926
|
-
import
|
|
24025
|
+
import chalk202 from "chalk";
|
|
23927
24026
|
|
|
23928
24027
|
// src/commands/roam/waitForCallback.ts
|
|
23929
24028
|
import { createServer as createServer3 } from "http";
|
|
@@ -24054,13 +24153,13 @@ async function auth() {
|
|
|
24054
24153
|
saveGlobalConfig(config);
|
|
24055
24154
|
const state = randomBytes(16).toString("hex");
|
|
24056
24155
|
console.log(
|
|
24057
|
-
|
|
24156
|
+
chalk202.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
24058
24157
|
);
|
|
24059
|
-
console.log(
|
|
24060
|
-
console.log(
|
|
24061
|
-
console.log(
|
|
24158
|
+
console.log(chalk202.white("http://localhost:14523/callback\n"));
|
|
24159
|
+
console.log(chalk202.blue("Opening browser for authorization..."));
|
|
24160
|
+
console.log(chalk202.dim("Waiting for authorization callback..."));
|
|
24062
24161
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
24063
|
-
console.log(
|
|
24162
|
+
console.log(chalk202.dim("Exchanging code for tokens..."));
|
|
24064
24163
|
const tokens = await exchangeToken({
|
|
24065
24164
|
code,
|
|
24066
24165
|
clientId,
|
|
@@ -24076,7 +24175,7 @@ async function auth() {
|
|
|
24076
24175
|
};
|
|
24077
24176
|
saveGlobalConfig(config);
|
|
24078
24177
|
console.log(
|
|
24079
|
-
|
|
24178
|
+
chalk202.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
24080
24179
|
);
|
|
24081
24180
|
}
|
|
24082
24181
|
|
|
@@ -24619,7 +24718,7 @@ import { execSync as execSync58 } from "child_process";
|
|
|
24619
24718
|
import { existsSync as existsSync56, mkdirSync as mkdirSync24, unlinkSync as unlinkSync21, writeFileSync as writeFileSync42 } from "fs";
|
|
24620
24719
|
import { tmpdir as tmpdir7 } from "os";
|
|
24621
24720
|
import { join as join66, resolve as resolve16 } from "path";
|
|
24622
|
-
import
|
|
24721
|
+
import chalk203 from "chalk";
|
|
24623
24722
|
|
|
24624
24723
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
24625
24724
|
var captureWindowPs1 = `
|
|
@@ -24770,13 +24869,13 @@ function screenshot(processName) {
|
|
|
24770
24869
|
const config = loadConfig();
|
|
24771
24870
|
const outputDir = resolve16(config.screenshot.outputDir);
|
|
24772
24871
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
24773
|
-
console.log(
|
|
24872
|
+
console.log(chalk203.gray(`Capturing window for process "${processName}" ...`));
|
|
24774
24873
|
try {
|
|
24775
24874
|
runPowerShellScript(processName, outputPath);
|
|
24776
|
-
console.log(
|
|
24875
|
+
console.log(chalk203.green(`Screenshot saved: ${outputPath}`));
|
|
24777
24876
|
} catch (error) {
|
|
24778
24877
|
const msg = error instanceof Error ? error.message : String(error);
|
|
24779
|
-
console.error(
|
|
24878
|
+
console.error(chalk203.red(`Failed to capture screenshot: ${msg}`));
|
|
24780
24879
|
process.exit(1);
|
|
24781
24880
|
}
|
|
24782
24881
|
}
|
|
@@ -28120,7 +28219,7 @@ function registerSetStatusCommand(cmd) {
|
|
|
28120
28219
|
|
|
28121
28220
|
// src/commands/sessions/summarise/index.ts
|
|
28122
28221
|
import * as fs41 from "fs";
|
|
28123
|
-
import
|
|
28222
|
+
import chalk204 from "chalk";
|
|
28124
28223
|
|
|
28125
28224
|
// src/commands/sessions/summarise/shared.ts
|
|
28126
28225
|
import * as fs40 from "fs";
|
|
@@ -28194,22 +28293,22 @@ ${firstMessage}`);
|
|
|
28194
28293
|
async function summarise2(options2) {
|
|
28195
28294
|
const files = await discoverSessionFiles();
|
|
28196
28295
|
if (files.length === 0) {
|
|
28197
|
-
console.log(
|
|
28296
|
+
console.log(chalk204.yellow("No sessions found."));
|
|
28198
28297
|
return;
|
|
28199
28298
|
}
|
|
28200
28299
|
const toProcess = selectCandidates(files, options2);
|
|
28201
28300
|
if (toProcess.length === 0) {
|
|
28202
|
-
console.log(
|
|
28301
|
+
console.log(chalk204.green("All sessions already summarised."));
|
|
28203
28302
|
return;
|
|
28204
28303
|
}
|
|
28205
28304
|
console.log(
|
|
28206
|
-
|
|
28305
|
+
chalk204.cyan(
|
|
28207
28306
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
28208
28307
|
)
|
|
28209
28308
|
);
|
|
28210
28309
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
28211
28310
|
console.log(
|
|
28212
|
-
|
|
28311
|
+
chalk204.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk204.yellow(`, ${failed2} skipped`) : "")
|
|
28213
28312
|
);
|
|
28214
28313
|
}
|
|
28215
28314
|
function selectCandidates(files, options2) {
|
|
@@ -28229,16 +28328,16 @@ function processSessions(files) {
|
|
|
28229
28328
|
let failed2 = 0;
|
|
28230
28329
|
for (let i = 0; i < files.length; i++) {
|
|
28231
28330
|
const file = files[i];
|
|
28232
|
-
process.stdout.write(
|
|
28331
|
+
process.stdout.write(chalk204.dim(` [${i + 1}/${files.length}] `));
|
|
28233
28332
|
const summary = summariseSession(file);
|
|
28234
28333
|
if (summary) {
|
|
28235
28334
|
writeSummary(file, summary);
|
|
28236
28335
|
succeeded++;
|
|
28237
|
-
process.stdout.write(`${
|
|
28336
|
+
process.stdout.write(`${chalk204.green("\u2713")} ${summary}
|
|
28238
28337
|
`);
|
|
28239
28338
|
} else {
|
|
28240
28339
|
failed2++;
|
|
28241
|
-
process.stdout.write(` ${
|
|
28340
|
+
process.stdout.write(` ${chalk204.yellow("skip")}
|
|
28242
28341
|
`);
|
|
28243
28342
|
}
|
|
28244
28343
|
}
|
|
@@ -28280,7 +28379,7 @@ function registerSessions(program2) {
|
|
|
28280
28379
|
}
|
|
28281
28380
|
|
|
28282
28381
|
// src/commands/statusLine.ts
|
|
28283
|
-
import
|
|
28382
|
+
import chalk206 from "chalk";
|
|
28284
28383
|
|
|
28285
28384
|
// src/shared/contextLevel.ts
|
|
28286
28385
|
function contextLevel(pct) {
|
|
@@ -28290,7 +28389,7 @@ function contextLevel(pct) {
|
|
|
28290
28389
|
}
|
|
28291
28390
|
|
|
28292
28391
|
// src/commands/buildLimitsSegment.ts
|
|
28293
|
-
import
|
|
28392
|
+
import chalk205 from "chalk";
|
|
28294
28393
|
|
|
28295
28394
|
// src/shared/rateLimitLevel.ts
|
|
28296
28395
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -28321,9 +28420,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
28321
28420
|
|
|
28322
28421
|
// src/commands/buildLimitsSegment.ts
|
|
28323
28422
|
var LEVEL_COLOR = {
|
|
28324
|
-
ok:
|
|
28325
|
-
warn:
|
|
28326
|
-
over:
|
|
28423
|
+
ok: chalk205.green,
|
|
28424
|
+
warn: chalk205.yellow,
|
|
28425
|
+
over: chalk205.red
|
|
28327
28426
|
};
|
|
28328
28427
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
28329
28428
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -28419,7 +28518,7 @@ async function relayUsage(claudeSessionId, transcriptPath, usedPct) {
|
|
|
28419
28518
|
}
|
|
28420
28519
|
|
|
28421
28520
|
// src/commands/statusLine.ts
|
|
28422
|
-
|
|
28521
|
+
chalk206.level = 3;
|
|
28423
28522
|
function formatNumber(num) {
|
|
28424
28523
|
return num.toLocaleString("en-US");
|
|
28425
28524
|
}
|
|
@@ -28427,9 +28526,9 @@ function colorizePercent(pct) {
|
|
|
28427
28526
|
const label2 = `${Math.round(pct)}%`;
|
|
28428
28527
|
switch (contextLevel(pct)) {
|
|
28429
28528
|
case "red":
|
|
28430
|
-
return
|
|
28529
|
+
return chalk206.red(label2);
|
|
28431
28530
|
case "yellow":
|
|
28432
|
-
return
|
|
28531
|
+
return chalk206.yellow(label2);
|
|
28433
28532
|
default:
|
|
28434
28533
|
return label2;
|
|
28435
28534
|
}
|
|
@@ -28442,7 +28541,7 @@ async function statusLine() {
|
|
|
28442
28541
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
28443
28542
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
28444
28543
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
28445
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
28544
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk206.cyan(branch2)} | ` : "";
|
|
28446
28545
|
console.log(
|
|
28447
28546
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
28448
28547
|
);
|
|
@@ -28463,7 +28562,7 @@ import { fileURLToPath as fileURLToPath9 } from "url";
|
|
|
28463
28562
|
// src/commands/sync/syncClaudeMd.ts
|
|
28464
28563
|
import * as fs42 from "fs";
|
|
28465
28564
|
import * as path61 from "path";
|
|
28466
|
-
import
|
|
28565
|
+
import chalk207 from "chalk";
|
|
28467
28566
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
28468
28567
|
const source = path61.join(claudeDir, "CLAUDE.md");
|
|
28469
28568
|
const target = path61.join(targetBase, "CLAUDE.md");
|
|
@@ -28472,12 +28571,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
28472
28571
|
const targetContent = fs42.readFileSync(target, "utf8");
|
|
28473
28572
|
if (sourceContent !== targetContent) {
|
|
28474
28573
|
console.log(
|
|
28475
|
-
|
|
28574
|
+
chalk207.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
28476
28575
|
);
|
|
28477
28576
|
console.log();
|
|
28478
28577
|
printDiff(targetContent, sourceContent);
|
|
28479
28578
|
const confirm = options2?.yes || await promptConfirm(
|
|
28480
|
-
|
|
28579
|
+
chalk207.red("Overwrite existing CLAUDE.md?"),
|
|
28481
28580
|
false
|
|
28482
28581
|
);
|
|
28483
28582
|
if (!confirm) {
|
|
@@ -28671,7 +28770,7 @@ function syncPi(claudeDir) {
|
|
|
28671
28770
|
// src/commands/sync/syncSettings.ts
|
|
28672
28771
|
import * as fs47 from "fs";
|
|
28673
28772
|
import * as path68 from "path";
|
|
28674
|
-
import
|
|
28773
|
+
import chalk208 from "chalk";
|
|
28675
28774
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
28676
28775
|
const source = path68.join(claudeDir, "settings.json");
|
|
28677
28776
|
const target = path68.join(targetBase, "settings.json");
|
|
@@ -28690,14 +28789,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
28690
28789
|
if (mergedContent !== normalizedTarget) {
|
|
28691
28790
|
if (!options2?.yes) {
|
|
28692
28791
|
console.log(
|
|
28693
|
-
|
|
28792
|
+
chalk208.yellow(
|
|
28694
28793
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
28695
28794
|
)
|
|
28696
28795
|
);
|
|
28697
28796
|
console.log();
|
|
28698
28797
|
printDiff(targetContent, mergedContent);
|
|
28699
28798
|
const confirm = await promptConfirm(
|
|
28700
|
-
|
|
28799
|
+
chalk208.red("Overwrite existing settings.json?"),
|
|
28701
28800
|
false
|
|
28702
28801
|
);
|
|
28703
28802
|
if (!confirm) {
|
|
@@ -28796,10 +28895,10 @@ async function update2() {
|
|
|
28796
28895
|
}
|
|
28797
28896
|
|
|
28798
28897
|
// src/reportCliError.ts
|
|
28799
|
-
import
|
|
28898
|
+
import chalk209 from "chalk";
|
|
28800
28899
|
function reportCliError(error) {
|
|
28801
|
-
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError) {
|
|
28802
|
-
console.error(
|
|
28900
|
+
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError) {
|
|
28901
|
+
console.error(chalk209.red(error.message));
|
|
28803
28902
|
} else {
|
|
28804
28903
|
console.error(error);
|
|
28805
28904
|
}
|