@staff0rd/assist 0.412.0 → 0.413.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.js +1 -1
- package/dist/index.js +577 -503
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.413.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -140,6 +140,61 @@ import { dirname, join } from "path";
|
|
|
140
140
|
import chalk from "chalk";
|
|
141
141
|
import { stringify as stringifyYaml } from "yaml";
|
|
142
142
|
|
|
143
|
+
// src/commands/backlog/getCurrentOrigin.ts
|
|
144
|
+
import { execFileSync } from "child_process";
|
|
145
|
+
function stripLeadingSlashes(path71) {
|
|
146
|
+
return path71.replace(/^\/+/, "");
|
|
147
|
+
}
|
|
148
|
+
function normalizeOrigin(raw) {
|
|
149
|
+
const trimmed = raw.trim().replace(/\.git$/i, "").replace(/\/+$/, "");
|
|
150
|
+
const url = trimmed.match(
|
|
151
|
+
/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?\/(.+)$/
|
|
152
|
+
);
|
|
153
|
+
if (url) {
|
|
154
|
+
return `${url[1].toLowerCase()}/${stripLeadingSlashes(url[2])}`;
|
|
155
|
+
}
|
|
156
|
+
if (!trimmed.includes("://")) {
|
|
157
|
+
const scp = trimmed.match(/^(?:[^@/]+@)?([^/:]+):(.+)$/);
|
|
158
|
+
if (scp) {
|
|
159
|
+
return `${scp[1].toLowerCase()}/${stripLeadingSlashes(scp[2])}`;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return trimmed.toLowerCase();
|
|
163
|
+
}
|
|
164
|
+
function tryGit(cwd, args) {
|
|
165
|
+
const windows = /^[A-Za-z]:[\\/]/.test(cwd);
|
|
166
|
+
const file = windows ? "git.exe" : "git";
|
|
167
|
+
const argv = windows ? ["-C", cwd, ...args] : args;
|
|
168
|
+
try {
|
|
169
|
+
const out = execFileSync(file, argv, {
|
|
170
|
+
encoding: "utf8",
|
|
171
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
172
|
+
...windows ? {} : { cwd }
|
|
173
|
+
}).trim();
|
|
174
|
+
return out || null;
|
|
175
|
+
} catch {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function firstRemoteUrl(cwd) {
|
|
180
|
+
const remotes = tryGit(cwd, ["remote"]);
|
|
181
|
+
if (!remotes) return null;
|
|
182
|
+
for (const remote of remotes.split("\n").map((r) => r.trim()).filter(Boolean)) {
|
|
183
|
+
const url = tryGit(cwd, ["remote", "get-url", remote]);
|
|
184
|
+
if (url) return url;
|
|
185
|
+
}
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
function getRemoteOriginUrl(cwd) {
|
|
189
|
+
return tryGit(cwd, ["remote", "get-url", "origin"]) ?? firstRemoteUrl(cwd);
|
|
190
|
+
}
|
|
191
|
+
function getCurrentOrigin(cwd) {
|
|
192
|
+
const url = getRemoteOriginUrl(cwd);
|
|
193
|
+
if (url) return normalizeOrigin(url);
|
|
194
|
+
const root = tryGit(cwd, ["rev-parse", "--show-toplevel"]);
|
|
195
|
+
return `local:${root ?? cwd}`;
|
|
196
|
+
}
|
|
197
|
+
|
|
143
198
|
// src/shared/loadRawYaml.ts
|
|
144
199
|
import { existsSync, readFileSync } from "fs";
|
|
145
200
|
import { parse as parseYaml } from "yaml";
|
|
@@ -179,6 +234,84 @@ function mergeRawConfigs(globalRaw, projectRaw) {
|
|
|
179
234
|
return merged;
|
|
180
235
|
}
|
|
181
236
|
|
|
237
|
+
// src/commands/backlog/originDisplayName.ts
|
|
238
|
+
function originDisplayName(origin) {
|
|
239
|
+
if (origin.startsWith("local:")) {
|
|
240
|
+
const path71 = origin.slice("local:".length).replace(/\/+$/, "");
|
|
241
|
+
const segments = path71.split("/").filter(Boolean);
|
|
242
|
+
return segments[segments.length - 1] ?? origin;
|
|
243
|
+
}
|
|
244
|
+
const firstSlash = origin.indexOf("/");
|
|
245
|
+
if (firstSlash === -1) return origin;
|
|
246
|
+
return origin.slice(firstSlash + 1);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// src/commands/backlog/originDisplayLabels.ts
|
|
250
|
+
function originDisplayLabels(origins) {
|
|
251
|
+
const isLocal = (origin) => origin.startsWith("local:");
|
|
252
|
+
const bareName = (origin) => {
|
|
253
|
+
const full = originDisplayName(origin);
|
|
254
|
+
const segments = full.split("/");
|
|
255
|
+
return segments[segments.length - 1] ?? full;
|
|
256
|
+
};
|
|
257
|
+
const remoteCounts = /* @__PURE__ */ new Map();
|
|
258
|
+
for (const origin of new Set(origins)) {
|
|
259
|
+
if (isLocal(origin)) continue;
|
|
260
|
+
const name = bareName(origin);
|
|
261
|
+
remoteCounts.set(name, (remoteCounts.get(name) ?? 0) + 1);
|
|
262
|
+
}
|
|
263
|
+
const labels = /* @__PURE__ */ new Map();
|
|
264
|
+
for (const origin of origins) {
|
|
265
|
+
if (isLocal(origin)) {
|
|
266
|
+
labels.set(origin, originDisplayName(origin));
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
const name = bareName(origin);
|
|
270
|
+
const collides = (remoteCounts.get(name) ?? 0) > 1;
|
|
271
|
+
labels.set(origin, collides ? originDisplayName(origin) : name);
|
|
272
|
+
}
|
|
273
|
+
return labels;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// src/shared/resolveRepoOverride.ts
|
|
277
|
+
var AmbiguousRepoConfigError = class extends Error {
|
|
278
|
+
name = "AmbiguousRepoConfigError";
|
|
279
|
+
};
|
|
280
|
+
function originKeyCandidates(origin) {
|
|
281
|
+
const displayName = originDisplayName(origin);
|
|
282
|
+
const segments = displayName.split("/");
|
|
283
|
+
const bare = segments[segments.length - 1] ?? displayName;
|
|
284
|
+
return /* @__PURE__ */ new Set([origin, displayName, bare]);
|
|
285
|
+
}
|
|
286
|
+
function resolveRepoOverride(globalRaw, origin) {
|
|
287
|
+
const repos2 = globalRaw.repos;
|
|
288
|
+
if (!repos2 || typeof repos2 !== "object" || Array.isArray(repos2)) return {};
|
|
289
|
+
const entries = repos2;
|
|
290
|
+
const candidates = originKeyCandidates(origin);
|
|
291
|
+
const matches = Object.keys(entries).filter((key) => candidates.has(key));
|
|
292
|
+
if (matches.length === 0) return {};
|
|
293
|
+
if (matches.length > 1) {
|
|
294
|
+
throw new AmbiguousRepoConfigError(
|
|
295
|
+
`Ambiguous repos config in ~/.assist.yml: keys ${matches.map((m) => `"${m}"`).join(", ")} all match the current repository (${origin}). Keep a single key per repository.`
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
const override = entries[matches[0]];
|
|
299
|
+
if (!override || typeof override !== "object" || Array.isArray(override))
|
|
300
|
+
return {};
|
|
301
|
+
return override;
|
|
302
|
+
}
|
|
303
|
+
function resolveRepoWriteLabel(globalRaw, origin) {
|
|
304
|
+
const repos2 = globalRaw.repos;
|
|
305
|
+
if (repos2 && typeof repos2 === "object" && !Array.isArray(repos2)) {
|
|
306
|
+
const candidates = originKeyCandidates(origin);
|
|
307
|
+
const existing = Object.keys(repos2).find(
|
|
308
|
+
(key) => candidates.has(key)
|
|
309
|
+
);
|
|
310
|
+
if (existing) return existing;
|
|
311
|
+
}
|
|
312
|
+
return originDisplayLabels([origin]).get(origin) ?? origin;
|
|
313
|
+
}
|
|
314
|
+
|
|
182
315
|
// src/shared/types.ts
|
|
183
316
|
import { z as z2 } from "zod";
|
|
184
317
|
|
|
@@ -267,6 +400,7 @@ var assistConfigSchema = z2.strictObject({
|
|
|
267
400
|
slack: z2.string().optional(),
|
|
268
401
|
required: z2.boolean().default(false)
|
|
269
402
|
}).optional(),
|
|
403
|
+
repos: z2.record(z2.string(), z2.record(z2.string(), z2.unknown())).optional(),
|
|
270
404
|
run: z2.array(z2.union([runConfigSchema, runLinkSchema])).optional(),
|
|
271
405
|
subtasks: z2.array(
|
|
272
406
|
z2.strictObject({
|
|
@@ -403,7 +537,10 @@ function getProjectRoot() {
|
|
|
403
537
|
function loadConfig() {
|
|
404
538
|
const globalRaw = loadRawYaml(getGlobalConfigPath());
|
|
405
539
|
const projectRaw = loadRawYaml(getConfigPath());
|
|
406
|
-
const
|
|
540
|
+
const repoOverride = globalRaw.repos ? resolveRepoOverride(globalRaw, getCurrentOrigin(process.cwd())) : {};
|
|
541
|
+
const globalWithRepo = mergeRawConfigs(globalRaw, repoOverride);
|
|
542
|
+
const merged = mergeRawConfigs(globalWithRepo, projectRaw);
|
|
543
|
+
delete merged.repos;
|
|
407
544
|
delete merged.news;
|
|
408
545
|
return assistConfigSchema.parse(merged);
|
|
409
546
|
}
|
|
@@ -3362,7 +3499,7 @@ function enumerateConfigLeafKeys(schema2) {
|
|
|
3362
3499
|
}
|
|
3363
3500
|
|
|
3364
3501
|
// src/commands/verify/pendingConfigDocumentation.ts
|
|
3365
|
-
var pendingConfigDocumentation = /* @__PURE__ */ new Set();
|
|
3502
|
+
var pendingConfigDocumentation = /* @__PURE__ */ new Set(["repos"]);
|
|
3366
3503
|
|
|
3367
3504
|
// src/commands/verify/configKeys.ts
|
|
3368
3505
|
function section(label2, keys) {
|
|
@@ -5959,61 +6096,6 @@ function findBacklogUp(startDir) {
|
|
|
5959
6096
|
return null;
|
|
5960
6097
|
}
|
|
5961
6098
|
|
|
5962
|
-
// src/commands/backlog/getCurrentOrigin.ts
|
|
5963
|
-
import { execFileSync } from "child_process";
|
|
5964
|
-
function stripLeadingSlashes(path71) {
|
|
5965
|
-
return path71.replace(/^\/+/, "");
|
|
5966
|
-
}
|
|
5967
|
-
function normalizeOrigin(raw) {
|
|
5968
|
-
const trimmed = raw.trim().replace(/\.git$/i, "").replace(/\/+$/, "");
|
|
5969
|
-
const url = trimmed.match(
|
|
5970
|
-
/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?\/(.+)$/
|
|
5971
|
-
);
|
|
5972
|
-
if (url) {
|
|
5973
|
-
return `${url[1].toLowerCase()}/${stripLeadingSlashes(url[2])}`;
|
|
5974
|
-
}
|
|
5975
|
-
if (!trimmed.includes("://")) {
|
|
5976
|
-
const scp = trimmed.match(/^(?:[^@/]+@)?([^/:]+):(.+)$/);
|
|
5977
|
-
if (scp) {
|
|
5978
|
-
return `${scp[1].toLowerCase()}/${stripLeadingSlashes(scp[2])}`;
|
|
5979
|
-
}
|
|
5980
|
-
}
|
|
5981
|
-
return trimmed.toLowerCase();
|
|
5982
|
-
}
|
|
5983
|
-
function tryGit(cwd, args) {
|
|
5984
|
-
const windows = /^[A-Za-z]:[\\/]/.test(cwd);
|
|
5985
|
-
const file = windows ? "git.exe" : "git";
|
|
5986
|
-
const argv = windows ? ["-C", cwd, ...args] : args;
|
|
5987
|
-
try {
|
|
5988
|
-
const out = execFileSync(file, argv, {
|
|
5989
|
-
encoding: "utf8",
|
|
5990
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
5991
|
-
...windows ? {} : { cwd }
|
|
5992
|
-
}).trim();
|
|
5993
|
-
return out || null;
|
|
5994
|
-
} catch {
|
|
5995
|
-
return null;
|
|
5996
|
-
}
|
|
5997
|
-
}
|
|
5998
|
-
function firstRemoteUrl(cwd) {
|
|
5999
|
-
const remotes = tryGit(cwd, ["remote"]);
|
|
6000
|
-
if (!remotes) return null;
|
|
6001
|
-
for (const remote of remotes.split("\n").map((r) => r.trim()).filter(Boolean)) {
|
|
6002
|
-
const url = tryGit(cwd, ["remote", "get-url", remote]);
|
|
6003
|
-
if (url) return url;
|
|
6004
|
-
}
|
|
6005
|
-
return null;
|
|
6006
|
-
}
|
|
6007
|
-
function getRemoteOriginUrl(cwd) {
|
|
6008
|
-
return tryGit(cwd, ["remote", "get-url", "origin"]) ?? firstRemoteUrl(cwd);
|
|
6009
|
-
}
|
|
6010
|
-
function getCurrentOrigin(cwd) {
|
|
6011
|
-
const url = getRemoteOriginUrl(cwd);
|
|
6012
|
-
if (url) return normalizeOrigin(url);
|
|
6013
|
-
const root = tryGit(cwd, ["rev-parse", "--show-toplevel"]);
|
|
6014
|
-
return `local:${root ?? cwd}`;
|
|
6015
|
-
}
|
|
6016
|
-
|
|
6017
6099
|
// src/commands/backlog/loadItem.ts
|
|
6018
6100
|
import { eq as eq5 } from "drizzle-orm";
|
|
6019
6101
|
async function loadItem(orm, id) {
|
|
@@ -8036,45 +8118,6 @@ async function loadItemSummaries(orm, origin) {
|
|
|
8036
8118
|
return rows.map(rowToItemSummary);
|
|
8037
8119
|
}
|
|
8038
8120
|
|
|
8039
|
-
// src/commands/backlog/originDisplayName.ts
|
|
8040
|
-
function originDisplayName(origin) {
|
|
8041
|
-
if (origin.startsWith("local:")) {
|
|
8042
|
-
const path71 = origin.slice("local:".length).replace(/\/+$/, "");
|
|
8043
|
-
const segments = path71.split("/").filter(Boolean);
|
|
8044
|
-
return segments[segments.length - 1] ?? origin;
|
|
8045
|
-
}
|
|
8046
|
-
const firstSlash = origin.indexOf("/");
|
|
8047
|
-
if (firstSlash === -1) return origin;
|
|
8048
|
-
return origin.slice(firstSlash + 1);
|
|
8049
|
-
}
|
|
8050
|
-
|
|
8051
|
-
// src/commands/backlog/originDisplayLabels.ts
|
|
8052
|
-
function originDisplayLabels(origins) {
|
|
8053
|
-
const isLocal = (origin) => origin.startsWith("local:");
|
|
8054
|
-
const bareName = (origin) => {
|
|
8055
|
-
const full = originDisplayName(origin);
|
|
8056
|
-
const segments = full.split("/");
|
|
8057
|
-
return segments[segments.length - 1] ?? full;
|
|
8058
|
-
};
|
|
8059
|
-
const remoteCounts = /* @__PURE__ */ new Map();
|
|
8060
|
-
for (const origin of new Set(origins)) {
|
|
8061
|
-
if (isLocal(origin)) continue;
|
|
8062
|
-
const name = bareName(origin);
|
|
8063
|
-
remoteCounts.set(name, (remoteCounts.get(name) ?? 0) + 1);
|
|
8064
|
-
}
|
|
8065
|
-
const labels = /* @__PURE__ */ new Map();
|
|
8066
|
-
for (const origin of origins) {
|
|
8067
|
-
if (isLocal(origin)) {
|
|
8068
|
-
labels.set(origin, originDisplayName(origin));
|
|
8069
|
-
continue;
|
|
8070
|
-
}
|
|
8071
|
-
const name = bareName(origin);
|
|
8072
|
-
const collides = (remoteCounts.get(name) ?? 0) > 1;
|
|
8073
|
-
labels.set(origin, collides ? originDisplayName(origin) : name);
|
|
8074
|
-
}
|
|
8075
|
-
return labels;
|
|
8076
|
-
}
|
|
8077
|
-
|
|
8078
8121
|
// src/commands/backlog/resolveRepoLocation.ts
|
|
8079
8122
|
import { existsSync as existsSync25 } from "fs";
|
|
8080
8123
|
|
|
@@ -13800,8 +13843,51 @@ function registerComplexity(program2) {
|
|
|
13800
13843
|
}
|
|
13801
13844
|
|
|
13802
13845
|
// src/commands/config/index.ts
|
|
13803
|
-
import chalk122 from "chalk";
|
|
13804
13846
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
13847
|
+
function configList() {
|
|
13848
|
+
const config = loadConfig();
|
|
13849
|
+
console.log(stringifyYaml2(config, { lineWidth: 0 }).trimEnd());
|
|
13850
|
+
}
|
|
13851
|
+
|
|
13852
|
+
// src/commands/config/configGet.ts
|
|
13853
|
+
import chalk122 from "chalk";
|
|
13854
|
+
|
|
13855
|
+
// src/commands/config/getNestedValue.ts
|
|
13856
|
+
function isTraversable(value) {
|
|
13857
|
+
return value !== null && value !== void 0 && typeof value === "object";
|
|
13858
|
+
}
|
|
13859
|
+
function stepInto(current, key) {
|
|
13860
|
+
return isTraversable(current) ? current[key] : void 0;
|
|
13861
|
+
}
|
|
13862
|
+
function getNestedValue(obj, path71) {
|
|
13863
|
+
let current = obj;
|
|
13864
|
+
for (const key of path71.split(".")) current = stepInto(current, key);
|
|
13865
|
+
return current;
|
|
13866
|
+
}
|
|
13867
|
+
|
|
13868
|
+
// src/commands/config/configGet.ts
|
|
13869
|
+
function configGet(key) {
|
|
13870
|
+
console.log(
|
|
13871
|
+
formatOutput(
|
|
13872
|
+
requireNestedValue(loadConfig(), key)
|
|
13873
|
+
)
|
|
13874
|
+
);
|
|
13875
|
+
}
|
|
13876
|
+
function formatOutput(value) {
|
|
13877
|
+
return typeof value === "object" && value !== null ? JSON.stringify(value, null, 2) : String(value);
|
|
13878
|
+
}
|
|
13879
|
+
function requireNestedValue(config, key) {
|
|
13880
|
+
const value = getNestedValue(config, key);
|
|
13881
|
+
if (value === void 0) return exitKeyNotSet(key);
|
|
13882
|
+
return value;
|
|
13883
|
+
}
|
|
13884
|
+
function exitKeyNotSet(key) {
|
|
13885
|
+
console.error(chalk122.red(`Key "${key}" is not set`));
|
|
13886
|
+
process.exit(1);
|
|
13887
|
+
}
|
|
13888
|
+
|
|
13889
|
+
// src/commands/config/configSet.ts
|
|
13890
|
+
import chalk124 from "chalk";
|
|
13805
13891
|
|
|
13806
13892
|
// src/commands/config/setNestedValue.ts
|
|
13807
13893
|
function isPlainObject(val) {
|
|
@@ -13851,41 +13937,64 @@ function setNestedValue(obj, path71, value) {
|
|
|
13851
13937
|
return result;
|
|
13852
13938
|
}
|
|
13853
13939
|
|
|
13854
|
-
// src/commands/config/
|
|
13855
|
-
|
|
13856
|
-
|
|
13857
|
-
|
|
13858
|
-
return
|
|
13940
|
+
// src/commands/config/validateConfig.ts
|
|
13941
|
+
import chalk123 from "chalk";
|
|
13942
|
+
function validateConfig(updated, key) {
|
|
13943
|
+
const result = assistConfigSchema.safeParse(updated);
|
|
13944
|
+
if (!result.success) return exitValidationFailed(result.error.issues, key);
|
|
13945
|
+
return updated;
|
|
13859
13946
|
}
|
|
13860
|
-
function
|
|
13861
|
-
|
|
13947
|
+
function exitValidationFailed(issues, key) {
|
|
13948
|
+
printValidationErrors(issues, key);
|
|
13949
|
+
process.exit(1);
|
|
13862
13950
|
}
|
|
13863
13951
|
function printValidationErrors(issues, key) {
|
|
13864
13952
|
for (const issue of issues) {
|
|
13865
13953
|
console.error(
|
|
13866
|
-
|
|
13954
|
+
chalk123.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
13867
13955
|
);
|
|
13868
13956
|
}
|
|
13869
13957
|
}
|
|
13870
|
-
function
|
|
13871
|
-
|
|
13872
|
-
process.exit(1);
|
|
13958
|
+
function formatIssuePath(issue, key) {
|
|
13959
|
+
return issue.path.length > 0 ? issue.path.join(".") : key;
|
|
13873
13960
|
}
|
|
13874
|
-
|
|
13875
|
-
|
|
13876
|
-
|
|
13877
|
-
|
|
13961
|
+
|
|
13962
|
+
// src/commands/config/applyRepoConfigSet.ts
|
|
13963
|
+
function applyRepoConfigSet(key, coerced) {
|
|
13964
|
+
const globalRaw = loadGlobalConfigRaw();
|
|
13965
|
+
const label2 = resolveRepoWriteLabel(
|
|
13966
|
+
globalRaw,
|
|
13967
|
+
getCurrentOrigin(process.cwd())
|
|
13968
|
+
);
|
|
13969
|
+
const repos2 = isPlainObject2(globalRaw.repos) ? { ...globalRaw.repos } : {};
|
|
13970
|
+
const existingBlock = isPlainObject2(repos2[label2]) ? repos2[label2] : {};
|
|
13971
|
+
const updatedBlock = setNestedValue(existingBlock, key, coerced);
|
|
13972
|
+
validateConfig(updatedBlock, key);
|
|
13973
|
+
repos2[label2] = updatedBlock;
|
|
13974
|
+
saveGlobalConfig({ ...globalRaw, repos: repos2 });
|
|
13975
|
+
return label2;
|
|
13878
13976
|
}
|
|
13977
|
+
function isPlainObject2(value) {
|
|
13978
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
13979
|
+
}
|
|
13980
|
+
|
|
13981
|
+
// src/commands/config/configSet.ts
|
|
13879
13982
|
var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
13880
|
-
function
|
|
13881
|
-
|
|
13882
|
-
|
|
13883
|
-
|
|
13884
|
-
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
13885
|
-
)
|
|
13886
|
-
);
|
|
13983
|
+
function configSet(key, value, options2 = {}) {
|
|
13984
|
+
const coerced = coerceValue(value);
|
|
13985
|
+
if (options2.repo && options2.global) {
|
|
13986
|
+
console.error(chalk124.red("Use either --repo or --global, not both"));
|
|
13887
13987
|
process.exit(1);
|
|
13888
13988
|
}
|
|
13989
|
+
const target = options2.repo ? `repo: ${applyRepoConfigSet(key, coerced)}` : applyConfigSet(key, coerced, options2.global ?? false);
|
|
13990
|
+
console.log(
|
|
13991
|
+
chalk124.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
13992
|
+
);
|
|
13993
|
+
}
|
|
13994
|
+
function coerceValue(value) {
|
|
13995
|
+
if (value === "true") return true;
|
|
13996
|
+
if (value === "false") return false;
|
|
13997
|
+
return value;
|
|
13889
13998
|
}
|
|
13890
13999
|
function applyConfigSet(key, coerced, global) {
|
|
13891
14000
|
assertNotGlobalOnly(key, global);
|
|
@@ -13894,103 +14003,68 @@ function applyConfigSet(key, coerced, global) {
|
|
|
13894
14003
|
validateConfig(updated, key);
|
|
13895
14004
|
if (global) {
|
|
13896
14005
|
saveGlobalConfig(updated);
|
|
13897
|
-
|
|
13898
|
-
saveConfig(updated);
|
|
14006
|
+
return "global";
|
|
13899
14007
|
}
|
|
14008
|
+
saveConfig(updated);
|
|
14009
|
+
return "project";
|
|
13900
14010
|
}
|
|
13901
|
-
function
|
|
13902
|
-
|
|
13903
|
-
|
|
13904
|
-
|
|
13905
|
-
|
|
13906
|
-
|
|
13907
|
-
|
|
13908
|
-
|
|
13909
|
-
|
|
13910
|
-
const config = loadConfig();
|
|
13911
|
-
console.log(stringifyYaml2(config, { lineWidth: 0 }).trimEnd());
|
|
13912
|
-
}
|
|
13913
|
-
|
|
13914
|
-
// src/commands/config/configGet.ts
|
|
13915
|
-
import chalk123 from "chalk";
|
|
13916
|
-
|
|
13917
|
-
// src/commands/config/getNestedValue.ts
|
|
13918
|
-
function isTraversable(value) {
|
|
13919
|
-
return value !== null && value !== void 0 && typeof value === "object";
|
|
13920
|
-
}
|
|
13921
|
-
function stepInto(current, key) {
|
|
13922
|
-
return isTraversable(current) ? current[key] : void 0;
|
|
13923
|
-
}
|
|
13924
|
-
function getNestedValue(obj, path71) {
|
|
13925
|
-
let current = obj;
|
|
13926
|
-
for (const key of path71.split(".")) current = stepInto(current, key);
|
|
13927
|
-
return current;
|
|
13928
|
-
}
|
|
13929
|
-
|
|
13930
|
-
// src/commands/config/configGet.ts
|
|
13931
|
-
function configGet(key) {
|
|
13932
|
-
console.log(
|
|
13933
|
-
formatOutput(
|
|
13934
|
-
requireNestedValue(loadConfig(), key)
|
|
13935
|
-
)
|
|
13936
|
-
);
|
|
13937
|
-
}
|
|
13938
|
-
function formatOutput(value) {
|
|
13939
|
-
return typeof value === "object" && value !== null ? JSON.stringify(value, null, 2) : String(value);
|
|
13940
|
-
}
|
|
13941
|
-
function requireNestedValue(config, key) {
|
|
13942
|
-
const value = getNestedValue(config, key);
|
|
13943
|
-
if (value === void 0) return exitKeyNotSet(key);
|
|
13944
|
-
return value;
|
|
13945
|
-
}
|
|
13946
|
-
function exitKeyNotSet(key) {
|
|
13947
|
-
console.error(chalk123.red(`Key "${key}" is not set`));
|
|
13948
|
-
process.exit(1);
|
|
14011
|
+
function assertNotGlobalOnly(key, global) {
|
|
14012
|
+
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
14013
|
+
console.error(
|
|
14014
|
+
chalk124.red(
|
|
14015
|
+
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
14016
|
+
)
|
|
14017
|
+
);
|
|
14018
|
+
process.exit(1);
|
|
14019
|
+
}
|
|
13949
14020
|
}
|
|
13950
14021
|
|
|
13951
14022
|
// src/commands/registerConfig.ts
|
|
13952
14023
|
function registerConfig(program2) {
|
|
13953
14024
|
const configCommand = program2.command("config").description("View and modify assist.yml configuration");
|
|
13954
|
-
configCommand.command("set <key> <value>").description("Set a config value (e.g. commit.push true)").option("-g, --global", "Write to global ~/.assist.yml").
|
|
14025
|
+
configCommand.command("set <key> <value>").description("Set a config value (e.g. commit.push true)").option("-g, --global", "Write to global ~/.assist.yml").option(
|
|
14026
|
+
"-r, --repo",
|
|
14027
|
+
"Write to ~/.assist.yml under the current repo's identity"
|
|
14028
|
+
).action((key, value, options2) => configSet(key, value, options2));
|
|
13955
14029
|
configCommand.command("get <key>").description("Get a config value").action(configGet);
|
|
13956
14030
|
configCommand.command("list").description("List all config values").action(configList);
|
|
13957
14031
|
}
|
|
13958
14032
|
|
|
13959
14033
|
// src/commands/db/reportMigrationStatus.ts
|
|
13960
|
-
import
|
|
14034
|
+
import chalk125 from "chalk";
|
|
13961
14035
|
function reportApplied(applied) {
|
|
13962
14036
|
if (applied.length === 0) {
|
|
13963
|
-
console.error(
|
|
14037
|
+
console.error(chalk125.green("Database is up to date; nothing to apply."));
|
|
13964
14038
|
return;
|
|
13965
14039
|
}
|
|
13966
14040
|
for (const migration of applied) {
|
|
13967
14041
|
console.error(
|
|
13968
|
-
|
|
14042
|
+
chalk125.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
13969
14043
|
);
|
|
13970
14044
|
}
|
|
13971
14045
|
}
|
|
13972
14046
|
function reportMigrationStatus(status3) {
|
|
13973
14047
|
if (status3.state === "in-sync") {
|
|
13974
14048
|
console.error(
|
|
13975
|
-
|
|
14049
|
+
chalk125.green(`In sync at migration ${status3.version} (latest).`)
|
|
13976
14050
|
);
|
|
13977
14051
|
return;
|
|
13978
14052
|
}
|
|
13979
14053
|
if (status3.state === "behind") {
|
|
13980
14054
|
console.error(
|
|
13981
|
-
|
|
14055
|
+
chalk125.yellow(
|
|
13982
14056
|
`Behind: applied ${status3.applied}, build expects ${status3.expected}.`
|
|
13983
14057
|
)
|
|
13984
14058
|
);
|
|
13985
14059
|
console.error(
|
|
13986
|
-
|
|
14060
|
+
chalk125.yellow(
|
|
13987
14061
|
`Pending: ${status3.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
13988
14062
|
)
|
|
13989
14063
|
);
|
|
13990
14064
|
return;
|
|
13991
14065
|
}
|
|
13992
14066
|
console.error(
|
|
13993
|
-
|
|
14067
|
+
chalk125.red(
|
|
13994
14068
|
`Ahead: applied ${status3.applied}, build knows ${status3.expected}. Update assist.`
|
|
13995
14069
|
)
|
|
13996
14070
|
);
|
|
@@ -14025,7 +14099,7 @@ function registerDb(program2) {
|
|
|
14025
14099
|
|
|
14026
14100
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
14027
14101
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync26 } from "fs";
|
|
14028
|
-
import
|
|
14102
|
+
import chalk126 from "chalk";
|
|
14029
14103
|
|
|
14030
14104
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
14031
14105
|
import { join as join34 } from "path";
|
|
@@ -14056,7 +14130,7 @@ function dbMigrationConfirm(pin) {
|
|
|
14056
14130
|
sweepRestrictedDir();
|
|
14057
14131
|
const state = readMigrationPinState(pin);
|
|
14058
14132
|
if (!state) {
|
|
14059
|
-
console.error(
|
|
14133
|
+
console.error(chalk126.red(`No pending migration unlock for pin: ${pin}`));
|
|
14060
14134
|
process.exitCode = 1;
|
|
14061
14135
|
return;
|
|
14062
14136
|
}
|
|
@@ -14066,7 +14140,7 @@ function dbMigrationConfirm(pin) {
|
|
|
14066
14140
|
);
|
|
14067
14141
|
unlinkSync9(getMigrationPinPath(pin));
|
|
14068
14142
|
console.log(
|
|
14069
|
-
|
|
14143
|
+
chalk126.green(
|
|
14070
14144
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
14071
14145
|
)
|
|
14072
14146
|
);
|
|
@@ -14075,7 +14149,7 @@ function dbMigrationConfirm(pin) {
|
|
|
14075
14149
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
14076
14150
|
import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync27 } from "fs";
|
|
14077
14151
|
import { randomInt as randomInt2 } from "crypto";
|
|
14078
|
-
import
|
|
14152
|
+
import chalk127 from "chalk";
|
|
14079
14153
|
|
|
14080
14154
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
14081
14155
|
function nextMigrationId() {
|
|
@@ -14090,7 +14164,7 @@ function dbMigrationUnlock() {
|
|
|
14090
14164
|
sweepRestrictedDir();
|
|
14091
14165
|
writeFileSync27(getMigrationPinPath(pin), JSON.stringify({ pin, migrationId }));
|
|
14092
14166
|
console.error(
|
|
14093
|
-
|
|
14167
|
+
chalk127.yellow.bold(
|
|
14094
14168
|
"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."
|
|
14095
14169
|
)
|
|
14096
14170
|
);
|
|
@@ -14100,7 +14174,7 @@ function dbMigrationUnlock() {
|
|
|
14100
14174
|
});
|
|
14101
14175
|
if (!delivered) {
|
|
14102
14176
|
console.error(
|
|
14103
|
-
|
|
14177
|
+
chalk127.red(
|
|
14104
14178
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
14105
14179
|
)
|
|
14106
14180
|
);
|
|
@@ -14110,7 +14184,7 @@ function dbMigrationUnlock() {
|
|
|
14110
14184
|
console.log(
|
|
14111
14185
|
`A confirmation pin was sent to your desktop notifications.
|
|
14112
14186
|
To approve creating migration ${migrationId}, run:
|
|
14113
|
-
${
|
|
14187
|
+
${chalk127.cyan(" assist db-migration confirm <PIN>")}
|
|
14114
14188
|
using the pin from that notification.`
|
|
14115
14189
|
);
|
|
14116
14190
|
}
|
|
@@ -14130,7 +14204,7 @@ function registerDbMigration(parent) {
|
|
|
14130
14204
|
|
|
14131
14205
|
// src/commands/deploy/redirect.ts
|
|
14132
14206
|
import { existsSync as existsSync35, readFileSync as readFileSync29, writeFileSync as writeFileSync28 } from "fs";
|
|
14133
|
-
import
|
|
14207
|
+
import chalk128 from "chalk";
|
|
14134
14208
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
14135
14209
|
if (!window.location.pathname.endsWith('/')) {
|
|
14136
14210
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -14139,23 +14213,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
14139
14213
|
function redirect() {
|
|
14140
14214
|
const indexPath = "index.html";
|
|
14141
14215
|
if (!existsSync35(indexPath)) {
|
|
14142
|
-
console.log(
|
|
14216
|
+
console.log(chalk128.yellow("No index.html found"));
|
|
14143
14217
|
return;
|
|
14144
14218
|
}
|
|
14145
14219
|
const content = readFileSync29(indexPath, "utf8");
|
|
14146
14220
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
14147
|
-
console.log(
|
|
14221
|
+
console.log(chalk128.dim("Trailing slash script already present"));
|
|
14148
14222
|
return;
|
|
14149
14223
|
}
|
|
14150
14224
|
const headCloseIndex = content.indexOf("</head>");
|
|
14151
14225
|
if (headCloseIndex === -1) {
|
|
14152
|
-
console.log(
|
|
14226
|
+
console.log(chalk128.red("Could not find </head> tag in index.html"));
|
|
14153
14227
|
return;
|
|
14154
14228
|
}
|
|
14155
14229
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
14156
14230
|
${content.slice(headCloseIndex)}`;
|
|
14157
14231
|
writeFileSync28(indexPath, newContent);
|
|
14158
|
-
console.log(
|
|
14232
|
+
console.log(chalk128.green("Added trailing slash redirect to index.html"));
|
|
14159
14233
|
}
|
|
14160
14234
|
|
|
14161
14235
|
// src/commands/registerDeploy.ts
|
|
@@ -14182,7 +14256,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
14182
14256
|
|
|
14183
14257
|
// src/commands/devlog/shared.ts
|
|
14184
14258
|
import { execSync as execSync33 } from "child_process";
|
|
14185
|
-
import
|
|
14259
|
+
import chalk129 from "chalk";
|
|
14186
14260
|
|
|
14187
14261
|
// src/shared/getRepoName.ts
|
|
14188
14262
|
import { existsSync as existsSync36, readFileSync as readFileSync30 } from "fs";
|
|
@@ -14291,13 +14365,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
14291
14365
|
}
|
|
14292
14366
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
14293
14367
|
for (const commit2 of commits2) {
|
|
14294
|
-
console.log(` ${
|
|
14368
|
+
console.log(` ${chalk129.yellow(commit2.hash)} ${commit2.message}`);
|
|
14295
14369
|
if (verbose) {
|
|
14296
14370
|
const visibleFiles = commit2.files.filter(
|
|
14297
14371
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
14298
14372
|
);
|
|
14299
14373
|
for (const file of visibleFiles) {
|
|
14300
|
-
console.log(` ${
|
|
14374
|
+
console.log(` ${chalk129.dim(file)}`);
|
|
14301
14375
|
}
|
|
14302
14376
|
}
|
|
14303
14377
|
}
|
|
@@ -14322,15 +14396,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
14322
14396
|
}
|
|
14323
14397
|
|
|
14324
14398
|
// src/commands/devlog/list/printDateHeader.ts
|
|
14325
|
-
import
|
|
14399
|
+
import chalk130 from "chalk";
|
|
14326
14400
|
function printDateHeader(date, isSkipped, entries) {
|
|
14327
14401
|
if (isSkipped) {
|
|
14328
|
-
console.log(`${
|
|
14402
|
+
console.log(`${chalk130.bold.blue(date)} ${chalk130.dim("skipped")}`);
|
|
14329
14403
|
} else if (entries && entries.length > 0) {
|
|
14330
|
-
const entryInfo = entries.map((e) => `${
|
|
14331
|
-
console.log(`${
|
|
14404
|
+
const entryInfo = entries.map((e) => `${chalk130.green(e.version)} ${e.title}`).join(" | ");
|
|
14405
|
+
console.log(`${chalk130.bold.blue(date)} ${entryInfo}`);
|
|
14332
14406
|
} else {
|
|
14333
|
-
console.log(`${
|
|
14407
|
+
console.log(`${chalk130.bold.blue(date)} ${chalk130.red("\u26A0 devlog missing")}`);
|
|
14334
14408
|
}
|
|
14335
14409
|
}
|
|
14336
14410
|
|
|
@@ -14434,24 +14508,24 @@ function bumpVersion(version2, type) {
|
|
|
14434
14508
|
|
|
14435
14509
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
14436
14510
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
14437
|
-
import
|
|
14511
|
+
import chalk132 from "chalk";
|
|
14438
14512
|
|
|
14439
14513
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
14440
|
-
import
|
|
14514
|
+
import chalk131 from "chalk";
|
|
14441
14515
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
14442
14516
|
if (conventional && firstHash) {
|
|
14443
14517
|
const version2 = getVersionAtCommit(firstHash);
|
|
14444
14518
|
if (version2) {
|
|
14445
|
-
console.log(`${
|
|
14519
|
+
console.log(`${chalk131.bold("version:")} ${stripToMinor(version2)}`);
|
|
14446
14520
|
} else {
|
|
14447
|
-
console.log(`${
|
|
14521
|
+
console.log(`${chalk131.bold("version:")} ${chalk131.red("unknown")}`);
|
|
14448
14522
|
}
|
|
14449
14523
|
} else if (patchVersion && minorVersion) {
|
|
14450
14524
|
console.log(
|
|
14451
|
-
`${
|
|
14525
|
+
`${chalk131.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
14452
14526
|
);
|
|
14453
14527
|
} else {
|
|
14454
|
-
console.log(`${
|
|
14528
|
+
console.log(`${chalk131.bold("version:")} v0.1 (initial)`);
|
|
14455
14529
|
}
|
|
14456
14530
|
}
|
|
14457
14531
|
|
|
@@ -14499,16 +14573,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
14499
14573
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
14500
14574
|
}
|
|
14501
14575
|
function logName(repoName) {
|
|
14502
|
-
console.log(`${
|
|
14576
|
+
console.log(`${chalk132.bold("name:")} ${repoName}`);
|
|
14503
14577
|
}
|
|
14504
14578
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
14505
14579
|
logName(ctx.repoName);
|
|
14506
14580
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
14507
|
-
console.log(
|
|
14581
|
+
console.log(chalk132.bold.blue(targetDate));
|
|
14508
14582
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
14509
14583
|
}
|
|
14510
14584
|
function logNoCommits(lastInfo) {
|
|
14511
|
-
console.log(
|
|
14585
|
+
console.log(chalk132.dim(noCommitsMessage(!!lastInfo)));
|
|
14512
14586
|
}
|
|
14513
14587
|
|
|
14514
14588
|
// src/commands/devlog/next/index.ts
|
|
@@ -14549,11 +14623,11 @@ function next2(options2) {
|
|
|
14549
14623
|
import { execSync as execSync35 } from "child_process";
|
|
14550
14624
|
|
|
14551
14625
|
// src/commands/devlog/repos/printReposTable.ts
|
|
14552
|
-
import
|
|
14626
|
+
import chalk133 from "chalk";
|
|
14553
14627
|
function colorStatus(status3) {
|
|
14554
|
-
if (status3 === "missing") return
|
|
14555
|
-
if (status3 === "outdated") return
|
|
14556
|
-
return
|
|
14628
|
+
if (status3 === "missing") return chalk133.red(status3);
|
|
14629
|
+
if (status3 === "outdated") return chalk133.yellow(status3);
|
|
14630
|
+
return chalk133.green(status3);
|
|
14557
14631
|
}
|
|
14558
14632
|
function formatRow(row, nameWidth) {
|
|
14559
14633
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -14567,8 +14641,8 @@ function printReposTable(rows) {
|
|
|
14567
14641
|
"Last Devlog".padEnd(11),
|
|
14568
14642
|
"Status"
|
|
14569
14643
|
].join(" ");
|
|
14570
|
-
console.log(
|
|
14571
|
-
console.log(
|
|
14644
|
+
console.log(chalk133.dim(header));
|
|
14645
|
+
console.log(chalk133.dim("-".repeat(header.length)));
|
|
14572
14646
|
for (const row of rows) {
|
|
14573
14647
|
console.log(formatRow(row, nameWidth));
|
|
14574
14648
|
}
|
|
@@ -14626,14 +14700,14 @@ function repos(options2) {
|
|
|
14626
14700
|
// src/commands/devlog/skip.ts
|
|
14627
14701
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
14628
14702
|
import { join as join38 } from "path";
|
|
14629
|
-
import
|
|
14703
|
+
import chalk134 from "chalk";
|
|
14630
14704
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
14631
14705
|
function getBlogConfigPath() {
|
|
14632
14706
|
return join38(BLOG_REPO_ROOT, "assist.yml");
|
|
14633
14707
|
}
|
|
14634
14708
|
function skip(date) {
|
|
14635
14709
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
14636
|
-
console.log(
|
|
14710
|
+
console.log(chalk134.red("Invalid date format. Use YYYY-MM-DD"));
|
|
14637
14711
|
process.exit(1);
|
|
14638
14712
|
}
|
|
14639
14713
|
const repoName = getRepoName();
|
|
@@ -14644,7 +14718,7 @@ function skip(date) {
|
|
|
14644
14718
|
const skipDays = skip2[repoName] ?? [];
|
|
14645
14719
|
if (skipDays.includes(date)) {
|
|
14646
14720
|
console.log(
|
|
14647
|
-
|
|
14721
|
+
chalk134.yellow(`${date} is already in skip list for ${repoName}`)
|
|
14648
14722
|
);
|
|
14649
14723
|
return;
|
|
14650
14724
|
}
|
|
@@ -14654,20 +14728,20 @@ function skip(date) {
|
|
|
14654
14728
|
devlog.skip = skip2;
|
|
14655
14729
|
config.devlog = devlog;
|
|
14656
14730
|
writeFileSync29(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
14657
|
-
console.log(
|
|
14731
|
+
console.log(chalk134.green(`Added ${date} to skip list for ${repoName}`));
|
|
14658
14732
|
}
|
|
14659
14733
|
|
|
14660
14734
|
// src/commands/devlog/version.ts
|
|
14661
|
-
import
|
|
14735
|
+
import chalk135 from "chalk";
|
|
14662
14736
|
function version() {
|
|
14663
14737
|
const config = loadConfig();
|
|
14664
14738
|
const name = getRepoName();
|
|
14665
14739
|
const lastInfo = getLastVersionInfo(name, config);
|
|
14666
14740
|
const lastVersion = lastInfo?.version ?? null;
|
|
14667
14741
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
14668
|
-
console.log(`${
|
|
14669
|
-
console.log(`${
|
|
14670
|
-
console.log(`${
|
|
14742
|
+
console.log(`${chalk135.bold("name:")} ${name}`);
|
|
14743
|
+
console.log(`${chalk135.bold("last:")} ${lastVersion ?? chalk135.dim("none")}`);
|
|
14744
|
+
console.log(`${chalk135.bold("next:")} ${nextVersion ?? chalk135.dim("none")}`);
|
|
14671
14745
|
}
|
|
14672
14746
|
|
|
14673
14747
|
// src/commands/devlog/devlogConfigHelp.ts
|
|
@@ -14711,7 +14785,7 @@ function registerDevlog(program2) {
|
|
|
14711
14785
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
14712
14786
|
import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync5 } from "fs";
|
|
14713
14787
|
import { join as join39 } from "path";
|
|
14714
|
-
import
|
|
14788
|
+
import chalk136 from "chalk";
|
|
14715
14789
|
|
|
14716
14790
|
// src/shared/findRepoRoot.ts
|
|
14717
14791
|
import { existsSync as existsSync37 } from "fs";
|
|
@@ -14774,14 +14848,14 @@ function checkBuildLocks(startDir) {
|
|
|
14774
14848
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
14775
14849
|
if (locked) {
|
|
14776
14850
|
console.error(
|
|
14777
|
-
|
|
14851
|
+
chalk136.red("Build output locked (is VS debugging?): ") + locked
|
|
14778
14852
|
);
|
|
14779
14853
|
process.exit(1);
|
|
14780
14854
|
}
|
|
14781
14855
|
}
|
|
14782
14856
|
async function checkBuildLocksCommand() {
|
|
14783
14857
|
checkBuildLocks();
|
|
14784
|
-
console.log(
|
|
14858
|
+
console.log(chalk136.green("No build locks detected"));
|
|
14785
14859
|
}
|
|
14786
14860
|
|
|
14787
14861
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -14880,30 +14954,30 @@ function escapeRegex(s) {
|
|
|
14880
14954
|
}
|
|
14881
14955
|
|
|
14882
14956
|
// src/commands/dotnet/printTree.ts
|
|
14883
|
-
import
|
|
14957
|
+
import chalk137 from "chalk";
|
|
14884
14958
|
function printNodes(nodes, prefix2) {
|
|
14885
14959
|
for (let i = 0; i < nodes.length; i++) {
|
|
14886
14960
|
const isLast = i === nodes.length - 1;
|
|
14887
14961
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
14888
14962
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
14889
14963
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
14890
|
-
const label2 = isMissing ?
|
|
14964
|
+
const label2 = isMissing ? chalk137.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
14891
14965
|
console.log(`${prefix2}${connector}${label2}`);
|
|
14892
14966
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
14893
14967
|
}
|
|
14894
14968
|
}
|
|
14895
14969
|
function printTree(tree, totalCount, solutions) {
|
|
14896
|
-
console.log(
|
|
14897
|
-
console.log(
|
|
14970
|
+
console.log(chalk137.bold("\nProject Dependency Tree"));
|
|
14971
|
+
console.log(chalk137.cyan(tree.relativePath));
|
|
14898
14972
|
printNodes(tree.children, "");
|
|
14899
|
-
console.log(
|
|
14973
|
+
console.log(chalk137.dim(`
|
|
14900
14974
|
${totalCount} projects total (including root)`));
|
|
14901
|
-
console.log(
|
|
14975
|
+
console.log(chalk137.bold("\nSolution Membership"));
|
|
14902
14976
|
if (solutions.length === 0) {
|
|
14903
|
-
console.log(
|
|
14977
|
+
console.log(chalk137.yellow(" Not found in any .sln"));
|
|
14904
14978
|
} else {
|
|
14905
14979
|
for (const sln of solutions) {
|
|
14906
|
-
console.log(` ${
|
|
14980
|
+
console.log(` ${chalk137.green(sln)}`);
|
|
14907
14981
|
}
|
|
14908
14982
|
}
|
|
14909
14983
|
console.log();
|
|
@@ -14932,16 +15006,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
14932
15006
|
// src/commands/dotnet/resolveCsproj.ts
|
|
14933
15007
|
import { existsSync as existsSync38 } from "fs";
|
|
14934
15008
|
import path33 from "path";
|
|
14935
|
-
import
|
|
15009
|
+
import chalk138 from "chalk";
|
|
14936
15010
|
function resolveCsproj(csprojPath) {
|
|
14937
15011
|
const resolved = path33.resolve(csprojPath);
|
|
14938
15012
|
if (!existsSync38(resolved)) {
|
|
14939
|
-
console.error(
|
|
15013
|
+
console.error(chalk138.red(`File not found: ${resolved}`));
|
|
14940
15014
|
process.exit(1);
|
|
14941
15015
|
}
|
|
14942
15016
|
const repoRoot = findRepoRoot(path33.dirname(resolved));
|
|
14943
15017
|
if (!repoRoot) {
|
|
14944
|
-
console.error(
|
|
15018
|
+
console.error(chalk138.red("Could not find git repository root"));
|
|
14945
15019
|
process.exit(1);
|
|
14946
15020
|
}
|
|
14947
15021
|
return { resolved, repoRoot };
|
|
@@ -14991,12 +15065,12 @@ function getChangedCsFiles(scope) {
|
|
|
14991
15065
|
}
|
|
14992
15066
|
|
|
14993
15067
|
// src/commands/dotnet/inSln.ts
|
|
14994
|
-
import
|
|
15068
|
+
import chalk139 from "chalk";
|
|
14995
15069
|
async function inSln(csprojPath) {
|
|
14996
15070
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
14997
15071
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
14998
15072
|
if (solutions.length === 0) {
|
|
14999
|
-
console.log(
|
|
15073
|
+
console.log(chalk139.yellow("Not found in any .sln file"));
|
|
15000
15074
|
process.exit(1);
|
|
15001
15075
|
}
|
|
15002
15076
|
for (const sln of solutions) {
|
|
@@ -15005,7 +15079,7 @@ async function inSln(csprojPath) {
|
|
|
15005
15079
|
}
|
|
15006
15080
|
|
|
15007
15081
|
// src/commands/dotnet/inspect.ts
|
|
15008
|
-
import
|
|
15082
|
+
import chalk145 from "chalk";
|
|
15009
15083
|
|
|
15010
15084
|
// src/shared/formatElapsed.ts
|
|
15011
15085
|
function formatElapsed(ms) {
|
|
@@ -15017,12 +15091,12 @@ function formatElapsed(ms) {
|
|
|
15017
15091
|
}
|
|
15018
15092
|
|
|
15019
15093
|
// src/commands/dotnet/displayIssues.ts
|
|
15020
|
-
import
|
|
15094
|
+
import chalk140 from "chalk";
|
|
15021
15095
|
var SEVERITY_COLOR = {
|
|
15022
|
-
ERROR:
|
|
15023
|
-
WARNING:
|
|
15024
|
-
SUGGESTION:
|
|
15025
|
-
HINT:
|
|
15096
|
+
ERROR: chalk140.red,
|
|
15097
|
+
WARNING: chalk140.yellow,
|
|
15098
|
+
SUGGESTION: chalk140.cyan,
|
|
15099
|
+
HINT: chalk140.dim
|
|
15026
15100
|
};
|
|
15027
15101
|
function groupByFile(issues) {
|
|
15028
15102
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -15038,15 +15112,15 @@ function groupByFile(issues) {
|
|
|
15038
15112
|
}
|
|
15039
15113
|
function displayIssues(issues) {
|
|
15040
15114
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
15041
|
-
console.log(
|
|
15115
|
+
console.log(chalk140.bold(file));
|
|
15042
15116
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
15043
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
15117
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk140.white;
|
|
15044
15118
|
console.log(
|
|
15045
|
-
` ${
|
|
15119
|
+
` ${chalk140.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
15046
15120
|
);
|
|
15047
15121
|
}
|
|
15048
15122
|
}
|
|
15049
|
-
console.log(
|
|
15123
|
+
console.log(chalk140.dim(`
|
|
15050
15124
|
${issues.length} issue(s) found`));
|
|
15051
15125
|
}
|
|
15052
15126
|
|
|
@@ -15105,12 +15179,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
15105
15179
|
// src/commands/dotnet/resolveSolution.ts
|
|
15106
15180
|
import { existsSync as existsSync39 } from "fs";
|
|
15107
15181
|
import path34 from "path";
|
|
15108
|
-
import
|
|
15182
|
+
import chalk142 from "chalk";
|
|
15109
15183
|
|
|
15110
15184
|
// src/commands/dotnet/findSolution.ts
|
|
15111
15185
|
import { readdirSync as readdirSync7 } from "fs";
|
|
15112
15186
|
import { dirname as dirname22, join as join40 } from "path";
|
|
15113
|
-
import
|
|
15187
|
+
import chalk141 from "chalk";
|
|
15114
15188
|
function findSlnInDir(dir) {
|
|
15115
15189
|
try {
|
|
15116
15190
|
return readdirSync7(dir).filter((f) => f.endsWith(".sln")).map((f) => join40(dir, f));
|
|
@@ -15126,17 +15200,17 @@ function findSolution() {
|
|
|
15126
15200
|
const slnFiles = findSlnInDir(current);
|
|
15127
15201
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
15128
15202
|
if (slnFiles.length > 1) {
|
|
15129
|
-
console.error(
|
|
15203
|
+
console.error(chalk141.red(`Multiple .sln files found in ${current}:`));
|
|
15130
15204
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
15131
15205
|
console.error(
|
|
15132
|
-
|
|
15206
|
+
chalk141.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
15133
15207
|
);
|
|
15134
15208
|
process.exit(1);
|
|
15135
15209
|
}
|
|
15136
15210
|
if (current === ceiling) break;
|
|
15137
15211
|
current = dirname22(current);
|
|
15138
15212
|
}
|
|
15139
|
-
console.error(
|
|
15213
|
+
console.error(chalk141.red("No .sln file found between cwd and repo root"));
|
|
15140
15214
|
process.exit(1);
|
|
15141
15215
|
}
|
|
15142
15216
|
|
|
@@ -15145,7 +15219,7 @@ function resolveSolution(sln) {
|
|
|
15145
15219
|
if (sln) {
|
|
15146
15220
|
const resolved = path34.resolve(sln);
|
|
15147
15221
|
if (!existsSync39(resolved)) {
|
|
15148
|
-
console.error(
|
|
15222
|
+
console.error(chalk142.red(`Solution file not found: ${resolved}`));
|
|
15149
15223
|
process.exit(1);
|
|
15150
15224
|
}
|
|
15151
15225
|
return resolved;
|
|
@@ -15187,14 +15261,14 @@ import { execSync as execSync37 } from "child_process";
|
|
|
15187
15261
|
import { existsSync as existsSync40, readFileSync as readFileSync34, unlinkSync as unlinkSync10 } from "fs";
|
|
15188
15262
|
import { tmpdir as tmpdir3 } from "os";
|
|
15189
15263
|
import path35 from "path";
|
|
15190
|
-
import
|
|
15264
|
+
import chalk143 from "chalk";
|
|
15191
15265
|
function assertJbInstalled() {
|
|
15192
15266
|
try {
|
|
15193
15267
|
execSync37("jb inspectcode --version", { stdio: "pipe" });
|
|
15194
15268
|
} catch {
|
|
15195
|
-
console.error(
|
|
15269
|
+
console.error(chalk143.red("jb is not installed. Install with:"));
|
|
15196
15270
|
console.error(
|
|
15197
|
-
|
|
15271
|
+
chalk143.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
15198
15272
|
);
|
|
15199
15273
|
process.exit(1);
|
|
15200
15274
|
}
|
|
@@ -15212,11 +15286,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
15212
15286
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
15213
15287
|
process.stderr.write(error.stderr);
|
|
15214
15288
|
}
|
|
15215
|
-
console.error(
|
|
15289
|
+
console.error(chalk143.red("jb inspectcode failed"));
|
|
15216
15290
|
process.exit(1);
|
|
15217
15291
|
}
|
|
15218
15292
|
if (!existsSync40(reportPath)) {
|
|
15219
|
-
console.error(
|
|
15293
|
+
console.error(chalk143.red("Report file not generated"));
|
|
15220
15294
|
process.exit(1);
|
|
15221
15295
|
}
|
|
15222
15296
|
const xml = readFileSync34(reportPath, "utf8");
|
|
@@ -15226,7 +15300,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
15226
15300
|
|
|
15227
15301
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
15228
15302
|
import { execSync as execSync38 } from "child_process";
|
|
15229
|
-
import
|
|
15303
|
+
import chalk144 from "chalk";
|
|
15230
15304
|
function resolveMsbuildPath() {
|
|
15231
15305
|
const { run: run4 } = loadConfig();
|
|
15232
15306
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -15238,9 +15312,9 @@ function assertMsbuildInstalled() {
|
|
|
15238
15312
|
try {
|
|
15239
15313
|
execSync38(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
15240
15314
|
} catch {
|
|
15241
|
-
console.error(
|
|
15315
|
+
console.error(chalk144.red(`msbuild not found at: ${msbuild}`));
|
|
15242
15316
|
console.error(
|
|
15243
|
-
|
|
15317
|
+
chalk144.yellow(
|
|
15244
15318
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
15245
15319
|
)
|
|
15246
15320
|
);
|
|
@@ -15287,17 +15361,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
15287
15361
|
// src/commands/dotnet/inspect.ts
|
|
15288
15362
|
function logScope(changedFiles) {
|
|
15289
15363
|
if (changedFiles === null) {
|
|
15290
|
-
console.log(
|
|
15364
|
+
console.log(chalk145.dim("Inspecting full solution..."));
|
|
15291
15365
|
} else {
|
|
15292
15366
|
console.log(
|
|
15293
|
-
|
|
15367
|
+
chalk145.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
15294
15368
|
);
|
|
15295
15369
|
}
|
|
15296
15370
|
}
|
|
15297
15371
|
function reportResults(issues, elapsed) {
|
|
15298
15372
|
if (issues.length > 0) displayIssues(issues);
|
|
15299
|
-
else console.log(
|
|
15300
|
-
console.log(
|
|
15373
|
+
else console.log(chalk145.green("No issues found"));
|
|
15374
|
+
console.log(chalk145.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
15301
15375
|
if (issues.length > 0) process.exit(1);
|
|
15302
15376
|
}
|
|
15303
15377
|
async function inspect(sln, options2) {
|
|
@@ -15308,7 +15382,7 @@ async function inspect(sln, options2) {
|
|
|
15308
15382
|
const scope = parseScope(options2.scope);
|
|
15309
15383
|
const changedFiles = getChangedCsFiles(scope);
|
|
15310
15384
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
15311
|
-
console.log(
|
|
15385
|
+
console.log(chalk145.green("No changed .cs files found"));
|
|
15312
15386
|
return;
|
|
15313
15387
|
}
|
|
15314
15388
|
logScope(changedFiles);
|
|
@@ -15691,25 +15765,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
15691
15765
|
}
|
|
15692
15766
|
|
|
15693
15767
|
// src/commands/github/printCountTable.ts
|
|
15694
|
-
import
|
|
15768
|
+
import chalk146 from "chalk";
|
|
15695
15769
|
function printCountTable(labelHeader, rows) {
|
|
15696
15770
|
const labelWidth = Math.max(
|
|
15697
15771
|
labelHeader.length,
|
|
15698
15772
|
...rows.map((row) => row.label.length)
|
|
15699
15773
|
);
|
|
15700
15774
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
15701
|
-
console.log(
|
|
15702
|
-
console.log(
|
|
15775
|
+
console.log(chalk146.dim(header));
|
|
15776
|
+
console.log(chalk146.dim("-".repeat(header.length)));
|
|
15703
15777
|
for (const row of rows) {
|
|
15704
15778
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
15705
15779
|
}
|
|
15706
15780
|
}
|
|
15707
15781
|
|
|
15708
15782
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
15709
|
-
import
|
|
15783
|
+
import chalk147 from "chalk";
|
|
15710
15784
|
function printRepoAuthorBreakdown(repos2) {
|
|
15711
15785
|
for (const repo of repos2) {
|
|
15712
|
-
console.log(
|
|
15786
|
+
console.log(chalk147.bold(repo.name));
|
|
15713
15787
|
const authorWidth = Math.max(
|
|
15714
15788
|
0,
|
|
15715
15789
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -16027,7 +16101,7 @@ function registerHandover(program2) {
|
|
|
16027
16101
|
}
|
|
16028
16102
|
|
|
16029
16103
|
// src/commands/jira/acceptanceCriteria.ts
|
|
16030
|
-
import
|
|
16104
|
+
import chalk148 from "chalk";
|
|
16031
16105
|
|
|
16032
16106
|
// src/commands/jira/adfToText.ts
|
|
16033
16107
|
function renderInline(node) {
|
|
@@ -16094,7 +16168,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
16094
16168
|
const parsed = fetchIssue(issueKey, field);
|
|
16095
16169
|
const acValue = parsed?.fields?.[field];
|
|
16096
16170
|
if (!acValue) {
|
|
16097
|
-
console.log(
|
|
16171
|
+
console.log(chalk148.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
16098
16172
|
return;
|
|
16099
16173
|
}
|
|
16100
16174
|
if (typeof acValue === "string") {
|
|
@@ -16160,14 +16234,14 @@ async function jiraAuth() {
|
|
|
16160
16234
|
}
|
|
16161
16235
|
|
|
16162
16236
|
// src/commands/jira/viewIssue.ts
|
|
16163
|
-
import
|
|
16237
|
+
import chalk149 from "chalk";
|
|
16164
16238
|
function viewIssue(issueKey) {
|
|
16165
16239
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
16166
16240
|
const fields = parsed?.fields;
|
|
16167
16241
|
const summary = fields?.summary;
|
|
16168
16242
|
const description = fields?.description;
|
|
16169
16243
|
if (summary) {
|
|
16170
|
-
console.log(
|
|
16244
|
+
console.log(chalk149.bold(summary));
|
|
16171
16245
|
}
|
|
16172
16246
|
if (description) {
|
|
16173
16247
|
if (summary) console.log();
|
|
@@ -16181,7 +16255,7 @@ function viewIssue(issueKey) {
|
|
|
16181
16255
|
}
|
|
16182
16256
|
if (!summary && !description) {
|
|
16183
16257
|
console.log(
|
|
16184
|
-
|
|
16258
|
+
chalk149.yellow(`No summary or description found on ${issueKey}.`)
|
|
16185
16259
|
);
|
|
16186
16260
|
}
|
|
16187
16261
|
}
|
|
@@ -16237,13 +16311,13 @@ function registerRefineLaunch(program2, resumeFlag) {
|
|
|
16237
16311
|
// src/commands/reviewPrComments.ts
|
|
16238
16312
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
16239
16313
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
16240
|
-
import
|
|
16314
|
+
import chalk150 from "chalk";
|
|
16241
16315
|
async function reviewPrComments(number) {
|
|
16242
16316
|
if (number) {
|
|
16243
16317
|
try {
|
|
16244
16318
|
execFileSync5("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
16245
16319
|
} catch {
|
|
16246
|
-
console.error(
|
|
16320
|
+
console.error(chalk150.red(`gh pr checkout ${number} failed; aborting.`));
|
|
16247
16321
|
process.exit(1);
|
|
16248
16322
|
}
|
|
16249
16323
|
}
|
|
@@ -16316,15 +16390,15 @@ function registerList(program2) {
|
|
|
16316
16390
|
// src/commands/mermaid/index.ts
|
|
16317
16391
|
import { mkdirSync as mkdirSync16, readdirSync as readdirSync9 } from "fs";
|
|
16318
16392
|
import { resolve as resolve12 } from "path";
|
|
16319
|
-
import
|
|
16393
|
+
import chalk153 from "chalk";
|
|
16320
16394
|
|
|
16321
16395
|
// src/commands/mermaid/exportFile.ts
|
|
16322
16396
|
import { readFileSync as readFileSync36, writeFileSync as writeFileSync31 } from "fs";
|
|
16323
16397
|
import { basename as basename11, extname, resolve as resolve11 } from "path";
|
|
16324
|
-
import
|
|
16398
|
+
import chalk152 from "chalk";
|
|
16325
16399
|
|
|
16326
16400
|
// src/commands/mermaid/renderBlock.ts
|
|
16327
|
-
import
|
|
16401
|
+
import chalk151 from "chalk";
|
|
16328
16402
|
async function renderBlock(krokiUrl, source) {
|
|
16329
16403
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
16330
16404
|
method: "POST",
|
|
@@ -16333,7 +16407,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
16333
16407
|
});
|
|
16334
16408
|
if (!response.ok) {
|
|
16335
16409
|
console.error(
|
|
16336
|
-
|
|
16410
|
+
chalk151.red(
|
|
16337
16411
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
16338
16412
|
)
|
|
16339
16413
|
);
|
|
@@ -16351,19 +16425,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
16351
16425
|
if (onlyIndex !== void 0) {
|
|
16352
16426
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
16353
16427
|
console.error(
|
|
16354
|
-
|
|
16428
|
+
chalk152.red(
|
|
16355
16429
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
16356
16430
|
)
|
|
16357
16431
|
);
|
|
16358
16432
|
process.exit(1);
|
|
16359
16433
|
}
|
|
16360
16434
|
console.log(
|
|
16361
|
-
|
|
16435
|
+
chalk152.gray(
|
|
16362
16436
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
16363
16437
|
)
|
|
16364
16438
|
);
|
|
16365
16439
|
} else {
|
|
16366
|
-
console.log(
|
|
16440
|
+
console.log(chalk152.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
16367
16441
|
}
|
|
16368
16442
|
for (const [i, source] of blocks.entries()) {
|
|
16369
16443
|
const idx = i + 1;
|
|
@@ -16371,7 +16445,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
16371
16445
|
const outPath = resolve11(outDir, `${stem}-${idx}.svg`);
|
|
16372
16446
|
const svg = await renderBlock(krokiUrl, source);
|
|
16373
16447
|
writeFileSync31(outPath, svg, "utf8");
|
|
16374
|
-
console.log(
|
|
16448
|
+
console.log(chalk152.green(` \u2192 ${outPath}`));
|
|
16375
16449
|
}
|
|
16376
16450
|
}
|
|
16377
16451
|
function extractMermaidBlocks(markdown) {
|
|
@@ -16387,18 +16461,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
16387
16461
|
if (options2.index !== void 0) {
|
|
16388
16462
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
16389
16463
|
console.error(
|
|
16390
|
-
|
|
16464
|
+
chalk153.red(`--index must be a positive integer (got ${options2.index})`)
|
|
16391
16465
|
);
|
|
16392
16466
|
process.exit(1);
|
|
16393
16467
|
}
|
|
16394
16468
|
if (!file) {
|
|
16395
|
-
console.error(
|
|
16469
|
+
console.error(chalk153.red("--index requires a file argument"));
|
|
16396
16470
|
process.exit(1);
|
|
16397
16471
|
}
|
|
16398
16472
|
}
|
|
16399
16473
|
const files = file ? [file] : readdirSync9(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
16400
16474
|
if (files.length === 0) {
|
|
16401
|
-
console.log(
|
|
16475
|
+
console.log(chalk153.gray("No markdown files found in current directory."));
|
|
16402
16476
|
return;
|
|
16403
16477
|
}
|
|
16404
16478
|
for (const f of files) {
|
|
@@ -16431,7 +16505,7 @@ function registerMermaid(program2) {
|
|
|
16431
16505
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
16432
16506
|
import { createServer as createServer2 } from "http";
|
|
16433
16507
|
import { dirname as dirname24 } from "path";
|
|
16434
|
-
import
|
|
16508
|
+
import chalk155 from "chalk";
|
|
16435
16509
|
|
|
16436
16510
|
// src/commands/netcap/corsHeaders.ts
|
|
16437
16511
|
var corsHeaders = {
|
|
@@ -16510,7 +16584,7 @@ function createNetcapHandler(options2) {
|
|
|
16510
16584
|
import { cp, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
|
|
16511
16585
|
import { networkInterfaces } from "os";
|
|
16512
16586
|
import { join as join46 } from "path";
|
|
16513
|
-
import
|
|
16587
|
+
import chalk154 from "chalk";
|
|
16514
16588
|
|
|
16515
16589
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
16516
16590
|
import { dirname as dirname23, join as join45 } from "path";
|
|
@@ -16554,7 +16628,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
16554
16628
|
const host = lanIPv4();
|
|
16555
16629
|
if (!host) {
|
|
16556
16630
|
console.log(
|
|
16557
|
-
|
|
16631
|
+
chalk154.yellow("could not determine the WSL IP for the extension")
|
|
16558
16632
|
);
|
|
16559
16633
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
16560
16634
|
return source;
|
|
@@ -16565,7 +16639,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
16565
16639
|
return WSL_WINDOWS_PATH;
|
|
16566
16640
|
} catch {
|
|
16567
16641
|
console.log(
|
|
16568
|
-
|
|
16642
|
+
chalk154.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
16569
16643
|
);
|
|
16570
16644
|
return source;
|
|
16571
16645
|
}
|
|
@@ -16598,30 +16672,30 @@ async function netcap(options2) {
|
|
|
16598
16672
|
let count7 = 0;
|
|
16599
16673
|
const handler = createNetcapHandler({
|
|
16600
16674
|
outPath,
|
|
16601
|
-
onPing: () => console.log(
|
|
16675
|
+
onPing: () => console.log(chalk155.dim("ping from extension")),
|
|
16602
16676
|
onCapture: (entry) => {
|
|
16603
16677
|
count7 += 1;
|
|
16604
16678
|
console.log(
|
|
16605
|
-
|
|
16606
|
-
|
|
16679
|
+
chalk155.green(`captured #${count7}`),
|
|
16680
|
+
chalk155.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
16607
16681
|
);
|
|
16608
16682
|
}
|
|
16609
16683
|
});
|
|
16610
16684
|
const server = createServer2(handler);
|
|
16611
16685
|
server.listen(port, () => {
|
|
16612
16686
|
console.log(
|
|
16613
|
-
|
|
16687
|
+
chalk155.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
16614
16688
|
);
|
|
16615
|
-
console.log(
|
|
16689
|
+
console.log(chalk155.dim(`appending captures to ${outPath}`));
|
|
16616
16690
|
if (filter)
|
|
16617
|
-
console.log(
|
|
16618
|
-
console.log(
|
|
16619
|
-
console.log(
|
|
16691
|
+
console.log(chalk155.dim(`forwarding only URLs matching "${filter}"`));
|
|
16692
|
+
console.log(chalk155.dim(`load the unpacked extension from ${extensionPath}`));
|
|
16693
|
+
console.log(chalk155.dim("press Ctrl-C to stop"));
|
|
16620
16694
|
});
|
|
16621
16695
|
process.on("SIGINT", () => {
|
|
16622
16696
|
server.close();
|
|
16623
16697
|
console.log(
|
|
16624
|
-
|
|
16698
|
+
chalk155.bold(
|
|
16625
16699
|
`
|
|
16626
16700
|
netcap stopped \u2014 captured ${count7} ${count7 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
16627
16701
|
)
|
|
@@ -16633,7 +16707,7 @@ netcap stopped \u2014 captured ${count7} ${count7 === 1 ? "entry" : "entries"} t
|
|
|
16633
16707
|
// src/commands/netcap/netcapExtract.ts
|
|
16634
16708
|
import { writeFileSync as writeFileSync32 } from "fs";
|
|
16635
16709
|
import { join as join49 } from "path";
|
|
16636
|
-
import
|
|
16710
|
+
import chalk156 from "chalk";
|
|
16637
16711
|
|
|
16638
16712
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
16639
16713
|
import { readFileSync as readFileSync37 } from "fs";
|
|
@@ -17081,8 +17155,8 @@ function netcapExtract(file) {
|
|
|
17081
17155
|
writeFileSync32(outFile, `${JSON.stringify(posts, null, 2)}
|
|
17082
17156
|
`);
|
|
17083
17157
|
console.log(
|
|
17084
|
-
|
|
17085
|
-
|
|
17158
|
+
chalk156.green(`extracted ${posts.length} posts`),
|
|
17159
|
+
chalk156.dim(`-> ${outFile}`)
|
|
17086
17160
|
);
|
|
17087
17161
|
}
|
|
17088
17162
|
|
|
@@ -17103,7 +17177,7 @@ function registerNetcap(program2) {
|
|
|
17103
17177
|
}
|
|
17104
17178
|
|
|
17105
17179
|
// src/commands/news/add/index.ts
|
|
17106
|
-
import
|
|
17180
|
+
import chalk157 from "chalk";
|
|
17107
17181
|
import enquirer8 from "enquirer";
|
|
17108
17182
|
async function add2(url) {
|
|
17109
17183
|
if (!url) {
|
|
@@ -17125,10 +17199,10 @@ async function add2(url) {
|
|
|
17125
17199
|
const { orm } = await getReady();
|
|
17126
17200
|
const added = await addFeed(orm, url);
|
|
17127
17201
|
if (!added) {
|
|
17128
|
-
console.log(
|
|
17202
|
+
console.log(chalk157.yellow("Feed already exists"));
|
|
17129
17203
|
return;
|
|
17130
17204
|
}
|
|
17131
|
-
console.log(
|
|
17205
|
+
console.log(chalk157.green(`Added feed: ${url}`));
|
|
17132
17206
|
}
|
|
17133
17207
|
|
|
17134
17208
|
// src/commands/registerNews.ts
|
|
@@ -17175,7 +17249,7 @@ function registerPiHook(program2) {
|
|
|
17175
17249
|
}
|
|
17176
17250
|
|
|
17177
17251
|
// src/commands/prompts/printPromptsTable.ts
|
|
17178
|
-
import
|
|
17252
|
+
import chalk158 from "chalk";
|
|
17179
17253
|
function truncate(str, max) {
|
|
17180
17254
|
if (str.length <= max) return str;
|
|
17181
17255
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -17193,14 +17267,14 @@ function printPromptsTable(rows) {
|
|
|
17193
17267
|
"Command".padEnd(commandWidth),
|
|
17194
17268
|
"Repos"
|
|
17195
17269
|
].join(" ");
|
|
17196
|
-
console.log(
|
|
17197
|
-
console.log(
|
|
17270
|
+
console.log(chalk158.dim(header));
|
|
17271
|
+
console.log(chalk158.dim("-".repeat(header.length)));
|
|
17198
17272
|
for (const row of rows) {
|
|
17199
17273
|
const count7 = String(row.count).padStart(countWidth);
|
|
17200
17274
|
const tool = row.tool.padEnd(toolWidth);
|
|
17201
17275
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
17202
17276
|
console.log(
|
|
17203
|
-
`${
|
|
17277
|
+
`${chalk158.yellow(count7)} ${tool} ${command} ${chalk158.dim(row.repos)}`
|
|
17204
17278
|
);
|
|
17205
17279
|
}
|
|
17206
17280
|
}
|
|
@@ -17767,20 +17841,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
17767
17841
|
}
|
|
17768
17842
|
|
|
17769
17843
|
// src/commands/prs/listComments/printComments.ts
|
|
17770
|
-
import
|
|
17844
|
+
import chalk159 from "chalk";
|
|
17771
17845
|
function formatForHuman(comment3) {
|
|
17772
17846
|
if (comment3.type === "review") {
|
|
17773
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
17847
|
+
const stateColor = comment3.state === "APPROVED" ? chalk159.green : comment3.state === "CHANGES_REQUESTED" ? chalk159.red : chalk159.yellow;
|
|
17774
17848
|
return [
|
|
17775
|
-
`${
|
|
17849
|
+
`${chalk159.cyan("Review")} by ${chalk159.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
17776
17850
|
comment3.body,
|
|
17777
17851
|
""
|
|
17778
17852
|
].join("\n");
|
|
17779
17853
|
}
|
|
17780
17854
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
17781
17855
|
return [
|
|
17782
|
-
`${
|
|
17783
|
-
|
|
17856
|
+
`${chalk159.cyan("Line comment")} by ${chalk159.bold(comment3.user)} on ${chalk159.dim(`${comment3.path}${location}`)}`,
|
|
17857
|
+
chalk159.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
17784
17858
|
comment3.body,
|
|
17785
17859
|
""
|
|
17786
17860
|
].join("\n");
|
|
@@ -17870,13 +17944,13 @@ import { execSync as execSync46 } from "child_process";
|
|
|
17870
17944
|
import enquirer9 from "enquirer";
|
|
17871
17945
|
|
|
17872
17946
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
17873
|
-
import
|
|
17947
|
+
import chalk160 from "chalk";
|
|
17874
17948
|
var STATUS_MAP = {
|
|
17875
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
17876
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
17949
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk160.magenta("merged"), date: pr.mergedAt } : null,
|
|
17950
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk160.red("closed"), date: pr.closedAt } : null
|
|
17877
17951
|
};
|
|
17878
17952
|
function defaultStatus(pr) {
|
|
17879
|
-
return { label:
|
|
17953
|
+
return { label: chalk160.green("opened"), date: pr.createdAt };
|
|
17880
17954
|
}
|
|
17881
17955
|
function getStatus2(pr) {
|
|
17882
17956
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -17885,11 +17959,11 @@ function formatDate(dateStr) {
|
|
|
17885
17959
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
17886
17960
|
}
|
|
17887
17961
|
function formatPrHeader(pr, status3) {
|
|
17888
|
-
return `${
|
|
17962
|
+
return `${chalk160.cyan(`#${pr.number}`)} ${pr.title} ${chalk160.dim(`(${pr.author.login},`)} ${status3.label} ${chalk160.dim(`${formatDate(status3.date)})`)}`;
|
|
17889
17963
|
}
|
|
17890
17964
|
function logPrDetails(pr) {
|
|
17891
17965
|
console.log(
|
|
17892
|
-
|
|
17966
|
+
chalk160.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
17893
17967
|
);
|
|
17894
17968
|
console.log();
|
|
17895
17969
|
}
|
|
@@ -18238,10 +18312,10 @@ function registerPrs(program2) {
|
|
|
18238
18312
|
}
|
|
18239
18313
|
|
|
18240
18314
|
// src/commands/ravendb/ravendbAuth.ts
|
|
18241
|
-
import
|
|
18315
|
+
import chalk166 from "chalk";
|
|
18242
18316
|
|
|
18243
18317
|
// src/shared/createConnectionAuth.ts
|
|
18244
|
-
import
|
|
18318
|
+
import chalk161 from "chalk";
|
|
18245
18319
|
function listConnections(connections, format) {
|
|
18246
18320
|
if (connections.length === 0) {
|
|
18247
18321
|
console.log("No connections configured.");
|
|
@@ -18254,7 +18328,7 @@ function listConnections(connections, format) {
|
|
|
18254
18328
|
function removeConnection(connections, name, save) {
|
|
18255
18329
|
const filtered = connections.filter((c) => c.name !== name);
|
|
18256
18330
|
if (filtered.length === connections.length) {
|
|
18257
|
-
console.error(
|
|
18331
|
+
console.error(chalk161.red(`Connection "${name}" not found.`));
|
|
18258
18332
|
process.exit(1);
|
|
18259
18333
|
}
|
|
18260
18334
|
save(filtered);
|
|
@@ -18300,15 +18374,15 @@ function saveConnections(connections) {
|
|
|
18300
18374
|
}
|
|
18301
18375
|
|
|
18302
18376
|
// src/commands/ravendb/promptConnection.ts
|
|
18303
|
-
import
|
|
18377
|
+
import chalk164 from "chalk";
|
|
18304
18378
|
|
|
18305
18379
|
// src/commands/ravendb/selectOpSecret.ts
|
|
18306
|
-
import
|
|
18380
|
+
import chalk163 from "chalk";
|
|
18307
18381
|
import Enquirer2 from "enquirer";
|
|
18308
18382
|
|
|
18309
18383
|
// src/commands/ravendb/searchItems.ts
|
|
18310
18384
|
import { execSync as execSync49 } from "child_process";
|
|
18311
|
-
import
|
|
18385
|
+
import chalk162 from "chalk";
|
|
18312
18386
|
function opExec(args) {
|
|
18313
18387
|
return execSync49(`op ${args}`, {
|
|
18314
18388
|
encoding: "utf8",
|
|
@@ -18321,7 +18395,7 @@ function searchItems(search2) {
|
|
|
18321
18395
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
18322
18396
|
} catch {
|
|
18323
18397
|
console.error(
|
|
18324
|
-
|
|
18398
|
+
chalk162.red(
|
|
18325
18399
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
18326
18400
|
)
|
|
18327
18401
|
);
|
|
@@ -18335,7 +18409,7 @@ function getItemFields(itemId2) {
|
|
|
18335
18409
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
18336
18410
|
return item.fields.filter((f) => f.reference && f.label);
|
|
18337
18411
|
} catch {
|
|
18338
|
-
console.error(
|
|
18412
|
+
console.error(chalk162.red("Failed to get item details from 1Password."));
|
|
18339
18413
|
process.exit(1);
|
|
18340
18414
|
}
|
|
18341
18415
|
}
|
|
@@ -18354,7 +18428,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
18354
18428
|
}).run();
|
|
18355
18429
|
const items2 = searchItems(search2);
|
|
18356
18430
|
if (items2.length === 0) {
|
|
18357
|
-
console.error(
|
|
18431
|
+
console.error(chalk163.red(`No items found matching "${search2}".`));
|
|
18358
18432
|
process.exit(1);
|
|
18359
18433
|
}
|
|
18360
18434
|
const itemId2 = await selectOne(
|
|
@@ -18363,7 +18437,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
18363
18437
|
);
|
|
18364
18438
|
const fields = getItemFields(itemId2);
|
|
18365
18439
|
if (fields.length === 0) {
|
|
18366
|
-
console.error(
|
|
18440
|
+
console.error(chalk163.red("No fields with references found on this item."));
|
|
18367
18441
|
process.exit(1);
|
|
18368
18442
|
}
|
|
18369
18443
|
const ref = await selectOne(
|
|
@@ -18377,7 +18451,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
18377
18451
|
async function promptConnection(existingNames) {
|
|
18378
18452
|
const name = await promptInput("name", "Connection name:");
|
|
18379
18453
|
if (existingNames.includes(name)) {
|
|
18380
|
-
console.error(
|
|
18454
|
+
console.error(chalk164.red(`Connection "${name}" already exists.`));
|
|
18381
18455
|
process.exit(1);
|
|
18382
18456
|
}
|
|
18383
18457
|
const url = await promptInput(
|
|
@@ -18386,22 +18460,22 @@ async function promptConnection(existingNames) {
|
|
|
18386
18460
|
);
|
|
18387
18461
|
const database = await promptInput("database", "Database name:");
|
|
18388
18462
|
if (!name || !url || !database) {
|
|
18389
|
-
console.error(
|
|
18463
|
+
console.error(chalk164.red("All fields are required."));
|
|
18390
18464
|
process.exit(1);
|
|
18391
18465
|
}
|
|
18392
18466
|
const apiKeyRef = await selectOpSecret();
|
|
18393
|
-
console.log(
|
|
18467
|
+
console.log(chalk164.dim(`Using: ${apiKeyRef}`));
|
|
18394
18468
|
return { name, url, database, apiKeyRef };
|
|
18395
18469
|
}
|
|
18396
18470
|
|
|
18397
18471
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
18398
|
-
import
|
|
18472
|
+
import chalk165 from "chalk";
|
|
18399
18473
|
function ravendbSetConnection(name) {
|
|
18400
18474
|
const raw = loadGlobalConfigRaw();
|
|
18401
18475
|
const ravendb = raw.ravendb ?? {};
|
|
18402
18476
|
const connections = ravendb.connections ?? [];
|
|
18403
18477
|
if (!connections.some((c) => c.name === name)) {
|
|
18404
|
-
console.error(
|
|
18478
|
+
console.error(chalk165.red(`Connection "${name}" not found.`));
|
|
18405
18479
|
console.error(
|
|
18406
18480
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
18407
18481
|
);
|
|
@@ -18417,16 +18491,16 @@ function ravendbSetConnection(name) {
|
|
|
18417
18491
|
var ravendbAuth = createConnectionAuth({
|
|
18418
18492
|
load: loadConnections,
|
|
18419
18493
|
save: saveConnections,
|
|
18420
|
-
format: (c) => `${
|
|
18494
|
+
format: (c) => `${chalk166.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
18421
18495
|
promptNew: promptConnection,
|
|
18422
18496
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
18423
18497
|
});
|
|
18424
18498
|
|
|
18425
18499
|
// src/commands/ravendb/ravendbCollections.ts
|
|
18426
|
-
import
|
|
18500
|
+
import chalk170 from "chalk";
|
|
18427
18501
|
|
|
18428
18502
|
// src/commands/ravendb/ravenFetch.ts
|
|
18429
|
-
import
|
|
18503
|
+
import chalk168 from "chalk";
|
|
18430
18504
|
|
|
18431
18505
|
// src/commands/ravendb/getAccessToken.ts
|
|
18432
18506
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -18463,10 +18537,10 @@ ${errorText}`
|
|
|
18463
18537
|
|
|
18464
18538
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
18465
18539
|
import { execSync as execSync50 } from "child_process";
|
|
18466
|
-
import
|
|
18540
|
+
import chalk167 from "chalk";
|
|
18467
18541
|
function resolveOpSecret(reference) {
|
|
18468
18542
|
if (!reference.startsWith("op://")) {
|
|
18469
|
-
console.error(
|
|
18543
|
+
console.error(chalk167.red(`Invalid secret reference: must start with op://`));
|
|
18470
18544
|
process.exit(1);
|
|
18471
18545
|
}
|
|
18472
18546
|
try {
|
|
@@ -18476,7 +18550,7 @@ function resolveOpSecret(reference) {
|
|
|
18476
18550
|
}).trim();
|
|
18477
18551
|
} catch {
|
|
18478
18552
|
console.error(
|
|
18479
|
-
|
|
18553
|
+
chalk167.red(
|
|
18480
18554
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
18481
18555
|
)
|
|
18482
18556
|
);
|
|
@@ -18503,7 +18577,7 @@ async function ravenFetch(connection, path71) {
|
|
|
18503
18577
|
if (!response.ok) {
|
|
18504
18578
|
const body = await response.text();
|
|
18505
18579
|
console.error(
|
|
18506
|
-
|
|
18580
|
+
chalk168.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
18507
18581
|
);
|
|
18508
18582
|
console.error(body.substring(0, 500));
|
|
18509
18583
|
process.exit(1);
|
|
@@ -18512,7 +18586,7 @@ async function ravenFetch(connection, path71) {
|
|
|
18512
18586
|
}
|
|
18513
18587
|
|
|
18514
18588
|
// src/commands/ravendb/resolveConnection.ts
|
|
18515
|
-
import
|
|
18589
|
+
import chalk169 from "chalk";
|
|
18516
18590
|
function loadRavendb() {
|
|
18517
18591
|
const raw = loadGlobalConfigRaw();
|
|
18518
18592
|
const ravendb = raw.ravendb;
|
|
@@ -18526,7 +18600,7 @@ function resolveConnection(name) {
|
|
|
18526
18600
|
const connectionName = name ?? defaultConnection;
|
|
18527
18601
|
if (!connectionName) {
|
|
18528
18602
|
console.error(
|
|
18529
|
-
|
|
18603
|
+
chalk169.red(
|
|
18530
18604
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
18531
18605
|
)
|
|
18532
18606
|
);
|
|
@@ -18534,7 +18608,7 @@ function resolveConnection(name) {
|
|
|
18534
18608
|
}
|
|
18535
18609
|
const connection = connections.find((c) => c.name === connectionName);
|
|
18536
18610
|
if (!connection) {
|
|
18537
|
-
console.error(
|
|
18611
|
+
console.error(chalk169.red(`Connection "${connectionName}" not found.`));
|
|
18538
18612
|
console.error(
|
|
18539
18613
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
18540
18614
|
);
|
|
@@ -18565,7 +18639,7 @@ async function ravendbCollections(connectionName) {
|
|
|
18565
18639
|
return;
|
|
18566
18640
|
}
|
|
18567
18641
|
for (const c of collections) {
|
|
18568
|
-
console.log(`${
|
|
18642
|
+
console.log(`${chalk170.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
18569
18643
|
}
|
|
18570
18644
|
}
|
|
18571
18645
|
|
|
@@ -18584,10 +18658,10 @@ var ravendbConfigHelp = [
|
|
|
18584
18658
|
];
|
|
18585
18659
|
|
|
18586
18660
|
// src/commands/ravendb/ravendbQuery.ts
|
|
18587
|
-
import
|
|
18661
|
+
import chalk172 from "chalk";
|
|
18588
18662
|
|
|
18589
18663
|
// src/commands/ravendb/fetchAllPages.ts
|
|
18590
|
-
import
|
|
18664
|
+
import chalk171 from "chalk";
|
|
18591
18665
|
|
|
18592
18666
|
// src/commands/ravendb/buildQueryPath.ts
|
|
18593
18667
|
function buildQueryPath(opts) {
|
|
@@ -18625,7 +18699,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
18625
18699
|
allResults.push(...results);
|
|
18626
18700
|
start3 += results.length;
|
|
18627
18701
|
process.stderr.write(
|
|
18628
|
-
`\r${
|
|
18702
|
+
`\r${chalk171.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
18629
18703
|
);
|
|
18630
18704
|
if (start3 >= totalResults) break;
|
|
18631
18705
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -18640,7 +18714,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
18640
18714
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
18641
18715
|
const resolved = resolveArgs(connectionName, collection);
|
|
18642
18716
|
if (!resolved.collection && !options2.query) {
|
|
18643
|
-
console.error(
|
|
18717
|
+
console.error(chalk172.red("Provide a collection name or --query filter."));
|
|
18644
18718
|
process.exit(1);
|
|
18645
18719
|
}
|
|
18646
18720
|
const { collection: col } = resolved;
|
|
@@ -18679,7 +18753,7 @@ import { spawn as spawn5 } from "child_process";
|
|
|
18679
18753
|
import * as path36 from "path";
|
|
18680
18754
|
|
|
18681
18755
|
// src/commands/refactor/logViolations.ts
|
|
18682
|
-
import
|
|
18756
|
+
import chalk173 from "chalk";
|
|
18683
18757
|
var DEFAULT_MAX_LINES = 100;
|
|
18684
18758
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
18685
18759
|
if (violations.length === 0) {
|
|
@@ -18688,43 +18762,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
18688
18762
|
}
|
|
18689
18763
|
return;
|
|
18690
18764
|
}
|
|
18691
|
-
console.error(
|
|
18765
|
+
console.error(chalk173.red(`
|
|
18692
18766
|
Refactor check failed:
|
|
18693
18767
|
`));
|
|
18694
|
-
console.error(
|
|
18768
|
+
console.error(chalk173.red(` The following files exceed ${maxLines} lines:
|
|
18695
18769
|
`));
|
|
18696
18770
|
for (const violation of violations) {
|
|
18697
|
-
console.error(
|
|
18771
|
+
console.error(chalk173.red(` ${violation.file} (${violation.lines} lines)`));
|
|
18698
18772
|
}
|
|
18699
18773
|
console.error(
|
|
18700
|
-
|
|
18774
|
+
chalk173.yellow(
|
|
18701
18775
|
`
|
|
18702
18776
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
18703
18777
|
way to refactor it, ignore it with:
|
|
18704
18778
|
`
|
|
18705
18779
|
)
|
|
18706
18780
|
);
|
|
18707
|
-
console.error(
|
|
18781
|
+
console.error(chalk173.gray(` assist refactor ignore <file>
|
|
18708
18782
|
`));
|
|
18709
18783
|
if (process.env.CLAUDECODE) {
|
|
18710
|
-
console.error(
|
|
18784
|
+
console.error(chalk173.cyan(`
|
|
18711
18785
|
## Extracting Code to New Files
|
|
18712
18786
|
`));
|
|
18713
18787
|
console.error(
|
|
18714
|
-
|
|
18788
|
+
chalk173.cyan(
|
|
18715
18789
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
18716
18790
|
`
|
|
18717
18791
|
)
|
|
18718
18792
|
);
|
|
18719
18793
|
console.error(
|
|
18720
|
-
|
|
18794
|
+
chalk173.cyan(
|
|
18721
18795
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
18722
18796
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
18723
18797
|
`
|
|
18724
18798
|
)
|
|
18725
18799
|
);
|
|
18726
18800
|
console.error(
|
|
18727
|
-
|
|
18801
|
+
chalk173.cyan(
|
|
18728
18802
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
18729
18803
|
domains, move it to a common/shared folder.
|
|
18730
18804
|
`
|
|
@@ -18880,7 +18954,7 @@ async function check(pattern2, options2) {
|
|
|
18880
18954
|
|
|
18881
18955
|
// src/commands/refactor/extract/index.ts
|
|
18882
18956
|
import path44 from "path";
|
|
18883
|
-
import
|
|
18957
|
+
import chalk176 from "chalk";
|
|
18884
18958
|
|
|
18885
18959
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
18886
18960
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -19479,23 +19553,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
19479
19553
|
|
|
19480
19554
|
// src/commands/refactor/extract/displayPlan.ts
|
|
19481
19555
|
import path40 from "path";
|
|
19482
|
-
import
|
|
19556
|
+
import chalk174 from "chalk";
|
|
19483
19557
|
function section2(title) {
|
|
19484
19558
|
return `
|
|
19485
|
-
${
|
|
19559
|
+
${chalk174.cyan(title)}`;
|
|
19486
19560
|
}
|
|
19487
19561
|
function displayImporters(plan2, cwd) {
|
|
19488
19562
|
if (plan2.importersToUpdate.length === 0) return;
|
|
19489
19563
|
console.log(section2("Update importers:"));
|
|
19490
19564
|
for (const imp of plan2.importersToUpdate) {
|
|
19491
19565
|
const rel = path40.relative(cwd, imp.file.getFilePath());
|
|
19492
|
-
console.log(` ${
|
|
19566
|
+
console.log(` ${chalk174.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
19493
19567
|
}
|
|
19494
19568
|
}
|
|
19495
19569
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
19496
|
-
console.log(
|
|
19570
|
+
console.log(chalk174.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
19497
19571
|
`));
|
|
19498
|
-
console.log(` ${
|
|
19572
|
+
console.log(` ${chalk174.cyan("Functions to move:")}`);
|
|
19499
19573
|
for (const name of plan2.extractedNames) {
|
|
19500
19574
|
console.log(` ${name}`);
|
|
19501
19575
|
}
|
|
@@ -19529,7 +19603,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
19529
19603
|
|
|
19530
19604
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
19531
19605
|
import path43 from "path";
|
|
19532
|
-
import
|
|
19606
|
+
import chalk175 from "chalk";
|
|
19533
19607
|
import { Project as Project4 } from "ts-morph";
|
|
19534
19608
|
|
|
19535
19609
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -19621,7 +19695,7 @@ function loadProjectFile(file) {
|
|
|
19621
19695
|
});
|
|
19622
19696
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
19623
19697
|
if (!sourceFile) {
|
|
19624
|
-
console.log(
|
|
19698
|
+
console.log(chalk175.red(`File not found in project: ${file}`));
|
|
19625
19699
|
process.exit(1);
|
|
19626
19700
|
}
|
|
19627
19701
|
return { project, sourceFile };
|
|
@@ -19644,19 +19718,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
19644
19718
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
19645
19719
|
if (options2.apply) {
|
|
19646
19720
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
19647
|
-
console.log(
|
|
19721
|
+
console.log(chalk176.green("\nExtraction complete"));
|
|
19648
19722
|
} else {
|
|
19649
|
-
console.log(
|
|
19723
|
+
console.log(chalk176.dim("\nDry run. Use --apply to execute."));
|
|
19650
19724
|
}
|
|
19651
19725
|
}
|
|
19652
19726
|
|
|
19653
19727
|
// src/commands/refactor/ignore.ts
|
|
19654
19728
|
import fs28 from "fs";
|
|
19655
|
-
import
|
|
19729
|
+
import chalk177 from "chalk";
|
|
19656
19730
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
19657
19731
|
function ignore2(file) {
|
|
19658
19732
|
if (!fs28.existsSync(file)) {
|
|
19659
|
-
console.error(
|
|
19733
|
+
console.error(chalk177.red(`Error: File does not exist: ${file}`));
|
|
19660
19734
|
process.exit(1);
|
|
19661
19735
|
}
|
|
19662
19736
|
const content = fs28.readFileSync(file, "utf8");
|
|
@@ -19672,7 +19746,7 @@ function ignore2(file) {
|
|
|
19672
19746
|
fs28.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
19673
19747
|
}
|
|
19674
19748
|
console.log(
|
|
19675
|
-
|
|
19749
|
+
chalk177.green(
|
|
19676
19750
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
19677
19751
|
)
|
|
19678
19752
|
);
|
|
@@ -19681,12 +19755,12 @@ function ignore2(file) {
|
|
|
19681
19755
|
// src/commands/refactor/rename/index.ts
|
|
19682
19756
|
import fs31 from "fs";
|
|
19683
19757
|
import path49 from "path";
|
|
19684
|
-
import
|
|
19758
|
+
import chalk180 from "chalk";
|
|
19685
19759
|
|
|
19686
19760
|
// src/commands/refactor/rename/applyRename.ts
|
|
19687
19761
|
import fs30 from "fs";
|
|
19688
19762
|
import path46 from "path";
|
|
19689
|
-
import
|
|
19763
|
+
import chalk178 from "chalk";
|
|
19690
19764
|
|
|
19691
19765
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
19692
19766
|
import path45 from "path";
|
|
@@ -19791,13 +19865,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
19791
19865
|
const updatedContents = applyRewrites(rewrites);
|
|
19792
19866
|
for (const [file, content] of updatedContents) {
|
|
19793
19867
|
fs30.writeFileSync(file, content, "utf8");
|
|
19794
|
-
console.log(
|
|
19868
|
+
console.log(chalk178.cyan(` Updated imports in ${path46.relative(cwd, file)}`));
|
|
19795
19869
|
}
|
|
19796
19870
|
const destDir = path46.dirname(destPath);
|
|
19797
19871
|
if (!fs30.existsSync(destDir)) fs30.mkdirSync(destDir, { recursive: true });
|
|
19798
19872
|
fs30.renameSync(sourcePath, destPath);
|
|
19799
19873
|
console.log(
|
|
19800
|
-
|
|
19874
|
+
chalk178.white(
|
|
19801
19875
|
` Moved ${path46.relative(cwd, sourcePath)} \u2192 ${path46.relative(cwd, destPath)}`
|
|
19802
19876
|
)
|
|
19803
19877
|
);
|
|
@@ -19884,16 +19958,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
19884
19958
|
|
|
19885
19959
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
19886
19960
|
import path48 from "path";
|
|
19887
|
-
import
|
|
19961
|
+
import chalk179 from "chalk";
|
|
19888
19962
|
function printRenamePreview(rewrites, cwd) {
|
|
19889
19963
|
for (const rewrite of rewrites) {
|
|
19890
19964
|
console.log(
|
|
19891
|
-
|
|
19965
|
+
chalk179.dim(
|
|
19892
19966
|
` ${path48.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
19893
19967
|
)
|
|
19894
19968
|
);
|
|
19895
19969
|
}
|
|
19896
|
-
console.log(
|
|
19970
|
+
console.log(chalk179.dim("Dry run. Use --apply to execute."));
|
|
19897
19971
|
}
|
|
19898
19972
|
|
|
19899
19973
|
// src/commands/refactor/rename/index.ts
|
|
@@ -19904,20 +19978,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
19904
19978
|
const relSource = path49.relative(cwd, sourcePath);
|
|
19905
19979
|
const relDest = path49.relative(cwd, destPath);
|
|
19906
19980
|
if (!fs31.existsSync(sourcePath)) {
|
|
19907
|
-
console.log(
|
|
19981
|
+
console.log(chalk180.red(`File not found: ${source}`));
|
|
19908
19982
|
process.exit(1);
|
|
19909
19983
|
}
|
|
19910
19984
|
if (destPath !== sourcePath && fs31.existsSync(destPath)) {
|
|
19911
|
-
console.log(
|
|
19985
|
+
console.log(chalk180.red(`Destination already exists: ${destination}`));
|
|
19912
19986
|
process.exit(1);
|
|
19913
19987
|
}
|
|
19914
|
-
console.log(
|
|
19915
|
-
console.log(
|
|
19916
|
-
console.log(
|
|
19988
|
+
console.log(chalk180.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
19989
|
+
console.log(chalk180.dim("Loading project..."));
|
|
19990
|
+
console.log(chalk180.dim("Scanning imports across the project..."));
|
|
19917
19991
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
19918
19992
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
19919
19993
|
console.log(
|
|
19920
|
-
|
|
19994
|
+
chalk180.dim(
|
|
19921
19995
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
19922
19996
|
)
|
|
19923
19997
|
);
|
|
@@ -19926,11 +20000,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
19926
20000
|
return;
|
|
19927
20001
|
}
|
|
19928
20002
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
19929
|
-
console.log(
|
|
20003
|
+
console.log(chalk180.green("Done"));
|
|
19930
20004
|
}
|
|
19931
20005
|
|
|
19932
20006
|
// src/commands/refactor/renameSymbol/index.ts
|
|
19933
|
-
import
|
|
20007
|
+
import chalk181 from "chalk";
|
|
19934
20008
|
|
|
19935
20009
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
19936
20010
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -19976,33 +20050,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
19976
20050
|
const { project, sourceFile } = loadProjectFile(file);
|
|
19977
20051
|
const symbol = findSymbol(sourceFile, oldName);
|
|
19978
20052
|
if (!symbol) {
|
|
19979
|
-
console.log(
|
|
20053
|
+
console.log(chalk181.red(`Symbol "${oldName}" not found in ${file}`));
|
|
19980
20054
|
process.exit(1);
|
|
19981
20055
|
}
|
|
19982
20056
|
const grouped = groupReferences(symbol, cwd);
|
|
19983
20057
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
19984
20058
|
console.log(
|
|
19985
|
-
|
|
20059
|
+
chalk181.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
19986
20060
|
`)
|
|
19987
20061
|
);
|
|
19988
20062
|
for (const [refFile, lines] of grouped) {
|
|
19989
20063
|
console.log(
|
|
19990
|
-
` ${
|
|
20064
|
+
` ${chalk181.dim(refFile)}: lines ${chalk181.cyan(lines.join(", "))}`
|
|
19991
20065
|
);
|
|
19992
20066
|
}
|
|
19993
20067
|
if (options2.apply) {
|
|
19994
20068
|
symbol.rename(newName);
|
|
19995
20069
|
await project.save();
|
|
19996
|
-
console.log(
|
|
20070
|
+
console.log(chalk181.green(`
|
|
19997
20071
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
19998
20072
|
} else {
|
|
19999
|
-
console.log(
|
|
20073
|
+
console.log(chalk181.dim("\nDry run. Use --apply to execute."));
|
|
20000
20074
|
}
|
|
20001
20075
|
}
|
|
20002
20076
|
|
|
20003
20077
|
// src/commands/refactor/restructure/index.ts
|
|
20004
20078
|
import path57 from "path";
|
|
20005
|
-
import
|
|
20079
|
+
import chalk184 from "chalk";
|
|
20006
20080
|
|
|
20007
20081
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
20008
20082
|
import path51 from "path";
|
|
@@ -20081,50 +20155,50 @@ function clusterFiles(graph) {
|
|
|
20081
20155
|
|
|
20082
20156
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
20083
20157
|
import path53 from "path";
|
|
20084
|
-
import
|
|
20158
|
+
import chalk182 from "chalk";
|
|
20085
20159
|
function relPath(filePath) {
|
|
20086
20160
|
return path53.relative(process.cwd(), filePath);
|
|
20087
20161
|
}
|
|
20088
20162
|
function displayMoves(plan2) {
|
|
20089
20163
|
if (plan2.moves.length === 0) return;
|
|
20090
|
-
console.log(
|
|
20164
|
+
console.log(chalk182.bold("\nFile moves:"));
|
|
20091
20165
|
for (const move2 of plan2.moves) {
|
|
20092
20166
|
console.log(
|
|
20093
|
-
` ${
|
|
20167
|
+
` ${chalk182.red(relPath(move2.from))} \u2192 ${chalk182.green(relPath(move2.to))}`
|
|
20094
20168
|
);
|
|
20095
|
-
console.log(
|
|
20169
|
+
console.log(chalk182.dim(` ${move2.reason}`));
|
|
20096
20170
|
}
|
|
20097
20171
|
}
|
|
20098
20172
|
function displayRewrites(rewrites) {
|
|
20099
20173
|
if (rewrites.length === 0) return;
|
|
20100
20174
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
20101
|
-
console.log(
|
|
20175
|
+
console.log(chalk182.bold(`
|
|
20102
20176
|
Import rewrites (${affectedFiles.size} files):`));
|
|
20103
20177
|
for (const file of affectedFiles) {
|
|
20104
|
-
console.log(` ${
|
|
20178
|
+
console.log(` ${chalk182.cyan(relPath(file))}:`);
|
|
20105
20179
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
20106
20180
|
(r) => r.file === file
|
|
20107
20181
|
)) {
|
|
20108
20182
|
console.log(
|
|
20109
|
-
` ${
|
|
20183
|
+
` ${chalk182.red(`"${oldSpecifier}"`)} \u2192 ${chalk182.green(`"${newSpecifier}"`)}`
|
|
20110
20184
|
);
|
|
20111
20185
|
}
|
|
20112
20186
|
}
|
|
20113
20187
|
}
|
|
20114
20188
|
function displayPlan2(plan2) {
|
|
20115
20189
|
if (plan2.warnings.length > 0) {
|
|
20116
|
-
console.log(
|
|
20117
|
-
for (const w of plan2.warnings) console.log(
|
|
20190
|
+
console.log(chalk182.yellow("\nWarnings:"));
|
|
20191
|
+
for (const w of plan2.warnings) console.log(chalk182.yellow(` ${w}`));
|
|
20118
20192
|
}
|
|
20119
20193
|
if (plan2.newDirectories.length > 0) {
|
|
20120
|
-
console.log(
|
|
20194
|
+
console.log(chalk182.bold("\nNew directories:"));
|
|
20121
20195
|
for (const dir of plan2.newDirectories)
|
|
20122
|
-
console.log(
|
|
20196
|
+
console.log(chalk182.green(` ${dir}/`));
|
|
20123
20197
|
}
|
|
20124
20198
|
displayMoves(plan2);
|
|
20125
20199
|
displayRewrites(plan2.rewrites);
|
|
20126
20200
|
console.log(
|
|
20127
|
-
|
|
20201
|
+
chalk182.dim(
|
|
20128
20202
|
`
|
|
20129
20203
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
20130
20204
|
)
|
|
@@ -20134,18 +20208,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
20134
20208
|
// src/commands/refactor/restructure/executePlan.ts
|
|
20135
20209
|
import fs32 from "fs";
|
|
20136
20210
|
import path54 from "path";
|
|
20137
|
-
import
|
|
20211
|
+
import chalk183 from "chalk";
|
|
20138
20212
|
function executePlan(plan2) {
|
|
20139
20213
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
20140
20214
|
for (const [file, content] of updatedContents) {
|
|
20141
20215
|
fs32.writeFileSync(file, content, "utf8");
|
|
20142
20216
|
console.log(
|
|
20143
|
-
|
|
20217
|
+
chalk183.cyan(` Rewrote imports in ${path54.relative(process.cwd(), file)}`)
|
|
20144
20218
|
);
|
|
20145
20219
|
}
|
|
20146
20220
|
for (const dir of plan2.newDirectories) {
|
|
20147
20221
|
fs32.mkdirSync(dir, { recursive: true });
|
|
20148
|
-
console.log(
|
|
20222
|
+
console.log(chalk183.green(` Created ${path54.relative(process.cwd(), dir)}/`));
|
|
20149
20223
|
}
|
|
20150
20224
|
for (const move2 of plan2.moves) {
|
|
20151
20225
|
const targetDir = path54.dirname(move2.to);
|
|
@@ -20154,7 +20228,7 @@ function executePlan(plan2) {
|
|
|
20154
20228
|
}
|
|
20155
20229
|
fs32.renameSync(move2.from, move2.to);
|
|
20156
20230
|
console.log(
|
|
20157
|
-
|
|
20231
|
+
chalk183.white(
|
|
20158
20232
|
` Moved ${path54.relative(process.cwd(), move2.from)} \u2192 ${path54.relative(process.cwd(), move2.to)}`
|
|
20159
20233
|
)
|
|
20160
20234
|
);
|
|
@@ -20169,7 +20243,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
20169
20243
|
if (entries.length === 0) {
|
|
20170
20244
|
fs32.rmdirSync(dir);
|
|
20171
20245
|
console.log(
|
|
20172
|
-
|
|
20246
|
+
chalk183.dim(
|
|
20173
20247
|
` Removed empty directory ${path54.relative(process.cwd(), dir)}`
|
|
20174
20248
|
)
|
|
20175
20249
|
);
|
|
@@ -20302,22 +20376,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
20302
20376
|
const targetPattern = pattern2 ?? "src";
|
|
20303
20377
|
const files = findSourceFiles2(targetPattern);
|
|
20304
20378
|
if (files.length === 0) {
|
|
20305
|
-
console.log(
|
|
20379
|
+
console.log(chalk184.yellow("No files found matching pattern"));
|
|
20306
20380
|
return;
|
|
20307
20381
|
}
|
|
20308
20382
|
const tsConfigPath = findTsConfig(path57.resolve(files[0]));
|
|
20309
20383
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
20310
20384
|
if (plan2.moves.length === 0) {
|
|
20311
|
-
console.log(
|
|
20385
|
+
console.log(chalk184.green("No restructuring needed"));
|
|
20312
20386
|
return;
|
|
20313
20387
|
}
|
|
20314
20388
|
displayPlan2(plan2);
|
|
20315
20389
|
if (options2.apply) {
|
|
20316
|
-
console.log(
|
|
20390
|
+
console.log(chalk184.bold("\nApplying changes..."));
|
|
20317
20391
|
executePlan(plan2);
|
|
20318
|
-
console.log(
|
|
20392
|
+
console.log(chalk184.green("\nRestructuring complete"));
|
|
20319
20393
|
} else {
|
|
20320
|
-
console.log(
|
|
20394
|
+
console.log(chalk184.dim("\nDry run. Use --apply to execute."));
|
|
20321
20395
|
}
|
|
20322
20396
|
}
|
|
20323
20397
|
|
|
@@ -20900,18 +20974,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
20900
20974
|
}
|
|
20901
20975
|
|
|
20902
20976
|
// src/commands/review/warnOutOfDiff.ts
|
|
20903
|
-
import
|
|
20977
|
+
import chalk185 from "chalk";
|
|
20904
20978
|
function warnOutOfDiff(outOfDiff) {
|
|
20905
20979
|
if (outOfDiff.length === 0) return;
|
|
20906
20980
|
console.warn(
|
|
20907
|
-
|
|
20981
|
+
chalk185.yellow(
|
|
20908
20982
|
`Skipped ${outOfDiff.length} finding(s) whose lines fall outside the PR diff (GitHub would silently drop these):`
|
|
20909
20983
|
)
|
|
20910
20984
|
);
|
|
20911
20985
|
for (const finding of outOfDiff) {
|
|
20912
20986
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
20913
20987
|
console.warn(
|
|
20914
|
-
` ${
|
|
20988
|
+
` ${chalk185.yellow("\xB7")} ${finding.title} ${chalk185.dim(
|
|
20915
20989
|
`(${finding.file}:${range})`
|
|
20916
20990
|
)}`
|
|
20917
20991
|
);
|
|
@@ -20930,18 +21004,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
20930
21004
|
}
|
|
20931
21005
|
|
|
20932
21006
|
// src/commands/review/warnUnlocated.ts
|
|
20933
|
-
import
|
|
21007
|
+
import chalk186 from "chalk";
|
|
20934
21008
|
function warnUnlocated(unlocated) {
|
|
20935
21009
|
if (unlocated.length === 0) return;
|
|
20936
21010
|
console.warn(
|
|
20937
|
-
|
|
21011
|
+
chalk186.yellow(
|
|
20938
21012
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
20939
21013
|
)
|
|
20940
21014
|
);
|
|
20941
21015
|
for (const finding of unlocated) {
|
|
20942
|
-
const where = finding.location ||
|
|
21016
|
+
const where = finding.location || chalk186.dim("missing");
|
|
20943
21017
|
console.warn(
|
|
20944
|
-
` ${
|
|
21018
|
+
` ${chalk186.yellow("\xB7")} ${finding.title} ${chalk186.dim(`(${where})`)}`
|
|
20945
21019
|
);
|
|
20946
21020
|
}
|
|
20947
21021
|
}
|
|
@@ -22113,7 +22187,7 @@ function registerReview(program2) {
|
|
|
22113
22187
|
}
|
|
22114
22188
|
|
|
22115
22189
|
// src/commands/seq/seqAuth.ts
|
|
22116
|
-
import
|
|
22190
|
+
import chalk188 from "chalk";
|
|
22117
22191
|
|
|
22118
22192
|
// src/commands/seq/loadConnections.ts
|
|
22119
22193
|
function loadConnections2() {
|
|
@@ -22142,10 +22216,10 @@ function setDefaultConnection(name) {
|
|
|
22142
22216
|
}
|
|
22143
22217
|
|
|
22144
22218
|
// src/shared/assertUniqueName.ts
|
|
22145
|
-
import
|
|
22219
|
+
import chalk187 from "chalk";
|
|
22146
22220
|
function assertUniqueName(existingNames, name) {
|
|
22147
22221
|
if (existingNames.includes(name)) {
|
|
22148
|
-
console.error(
|
|
22222
|
+
console.error(chalk187.red(`Connection "${name}" already exists.`));
|
|
22149
22223
|
process.exit(1);
|
|
22150
22224
|
}
|
|
22151
22225
|
}
|
|
@@ -22163,7 +22237,7 @@ async function promptConnection2(existingNames) {
|
|
|
22163
22237
|
var seqAuth = createConnectionAuth({
|
|
22164
22238
|
load: loadConnections2,
|
|
22165
22239
|
save: saveConnections2,
|
|
22166
|
-
format: (c) => `${
|
|
22240
|
+
format: (c) => `${chalk188.bold(c.name)} ${c.url}`,
|
|
22167
22241
|
promptNew: promptConnection2,
|
|
22168
22242
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
22169
22243
|
});
|
|
@@ -22183,10 +22257,10 @@ var seqConfigHelp = [
|
|
|
22183
22257
|
];
|
|
22184
22258
|
|
|
22185
22259
|
// src/commands/seq/seqQuery.ts
|
|
22186
|
-
import
|
|
22260
|
+
import chalk192 from "chalk";
|
|
22187
22261
|
|
|
22188
22262
|
// src/commands/seq/fetchSeq.ts
|
|
22189
|
-
import
|
|
22263
|
+
import chalk189 from "chalk";
|
|
22190
22264
|
async function fetchSeq(conn, path71, params) {
|
|
22191
22265
|
const url = `${conn.url}${path71}?${params}`;
|
|
22192
22266
|
const response = await fetch(url, {
|
|
@@ -22197,7 +22271,7 @@ async function fetchSeq(conn, path71, params) {
|
|
|
22197
22271
|
});
|
|
22198
22272
|
if (!response.ok) {
|
|
22199
22273
|
const body = await response.text();
|
|
22200
|
-
console.error(
|
|
22274
|
+
console.error(chalk189.red(`Seq returned ${response.status}: ${body}`));
|
|
22201
22275
|
process.exit(1);
|
|
22202
22276
|
}
|
|
22203
22277
|
return response;
|
|
@@ -22256,23 +22330,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
22256
22330
|
}
|
|
22257
22331
|
|
|
22258
22332
|
// src/commands/seq/formatEvent.ts
|
|
22259
|
-
import
|
|
22333
|
+
import chalk190 from "chalk";
|
|
22260
22334
|
function levelColor(level) {
|
|
22261
22335
|
switch (level) {
|
|
22262
22336
|
case "Fatal":
|
|
22263
|
-
return
|
|
22337
|
+
return chalk190.bgRed.white;
|
|
22264
22338
|
case "Error":
|
|
22265
|
-
return
|
|
22339
|
+
return chalk190.red;
|
|
22266
22340
|
case "Warning":
|
|
22267
|
-
return
|
|
22341
|
+
return chalk190.yellow;
|
|
22268
22342
|
case "Information":
|
|
22269
|
-
return
|
|
22343
|
+
return chalk190.cyan;
|
|
22270
22344
|
case "Debug":
|
|
22271
|
-
return
|
|
22345
|
+
return chalk190.gray;
|
|
22272
22346
|
case "Verbose":
|
|
22273
|
-
return
|
|
22347
|
+
return chalk190.dim;
|
|
22274
22348
|
default:
|
|
22275
|
-
return
|
|
22349
|
+
return chalk190.white;
|
|
22276
22350
|
}
|
|
22277
22351
|
}
|
|
22278
22352
|
function levelAbbrev(level) {
|
|
@@ -22313,12 +22387,12 @@ function formatTimestamp(iso) {
|
|
|
22313
22387
|
function formatEvent(event) {
|
|
22314
22388
|
const color = levelColor(event.Level);
|
|
22315
22389
|
const abbrev = levelAbbrev(event.Level);
|
|
22316
|
-
const ts8 =
|
|
22390
|
+
const ts8 = chalk190.dim(formatTimestamp(event.Timestamp));
|
|
22317
22391
|
const msg = renderMessage(event);
|
|
22318
22392
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
22319
22393
|
if (event.Exception) {
|
|
22320
22394
|
for (const line of event.Exception.split("\n")) {
|
|
22321
|
-
lines.push(
|
|
22395
|
+
lines.push(chalk190.red(` ${line}`));
|
|
22322
22396
|
}
|
|
22323
22397
|
}
|
|
22324
22398
|
return lines.join("\n");
|
|
@@ -22351,11 +22425,11 @@ function rejectTimestampFilter(filter) {
|
|
|
22351
22425
|
}
|
|
22352
22426
|
|
|
22353
22427
|
// src/shared/resolveNamedConnection.ts
|
|
22354
|
-
import
|
|
22428
|
+
import chalk191 from "chalk";
|
|
22355
22429
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
22356
22430
|
if (connections.length === 0) {
|
|
22357
22431
|
console.error(
|
|
22358
|
-
|
|
22432
|
+
chalk191.red(
|
|
22359
22433
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
22360
22434
|
)
|
|
22361
22435
|
);
|
|
@@ -22364,7 +22438,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
22364
22438
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
22365
22439
|
const connection = connections.find((c) => c.name === target);
|
|
22366
22440
|
if (!connection) {
|
|
22367
|
-
console.error(
|
|
22441
|
+
console.error(chalk191.red(`${kind} connection "${target}" not found.`));
|
|
22368
22442
|
process.exit(1);
|
|
22369
22443
|
}
|
|
22370
22444
|
return connection;
|
|
@@ -22393,7 +22467,7 @@ async function seqQuery(filter, options2) {
|
|
|
22393
22467
|
new URLSearchParams({ filter, count: String(count7) })
|
|
22394
22468
|
);
|
|
22395
22469
|
if (events.length === 0) {
|
|
22396
|
-
console.log(
|
|
22470
|
+
console.log(chalk192.yellow("No events found."));
|
|
22397
22471
|
return;
|
|
22398
22472
|
}
|
|
22399
22473
|
if (options2.json) {
|
|
@@ -22404,11 +22478,11 @@ async function seqQuery(filter, options2) {
|
|
|
22404
22478
|
for (const event of chronological) {
|
|
22405
22479
|
console.log(formatEvent(event));
|
|
22406
22480
|
}
|
|
22407
|
-
console.log(
|
|
22481
|
+
console.log(chalk192.dim(`
|
|
22408
22482
|
${events.length} events`));
|
|
22409
22483
|
if (events.length >= count7) {
|
|
22410
22484
|
console.log(
|
|
22411
|
-
|
|
22485
|
+
chalk192.yellow(
|
|
22412
22486
|
`Results limited to ${count7}. Use --count to retrieve more.`
|
|
22413
22487
|
)
|
|
22414
22488
|
);
|
|
@@ -22416,10 +22490,10 @@ ${events.length} events`));
|
|
|
22416
22490
|
}
|
|
22417
22491
|
|
|
22418
22492
|
// src/shared/setNamedDefaultConnection.ts
|
|
22419
|
-
import
|
|
22493
|
+
import chalk193 from "chalk";
|
|
22420
22494
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
22421
22495
|
if (!connections.find((c) => c.name === name)) {
|
|
22422
|
-
console.error(
|
|
22496
|
+
console.error(chalk193.red(`Connection "${name}" not found.`));
|
|
22423
22497
|
process.exit(1);
|
|
22424
22498
|
}
|
|
22425
22499
|
setDefault(name);
|
|
@@ -22468,7 +22542,7 @@ function registerSignal(program2) {
|
|
|
22468
22542
|
}
|
|
22469
22543
|
|
|
22470
22544
|
// src/commands/sql/sqlAuth.ts
|
|
22471
|
-
import
|
|
22545
|
+
import chalk195 from "chalk";
|
|
22472
22546
|
|
|
22473
22547
|
// src/commands/sql/loadConnections.ts
|
|
22474
22548
|
function loadConnections3() {
|
|
@@ -22497,7 +22571,7 @@ function setDefaultConnection2(name) {
|
|
|
22497
22571
|
}
|
|
22498
22572
|
|
|
22499
22573
|
// src/commands/sql/promptConnection.ts
|
|
22500
|
-
import
|
|
22574
|
+
import chalk194 from "chalk";
|
|
22501
22575
|
async function promptConnection3(existingNames) {
|
|
22502
22576
|
const name = await promptInput("name", "Connection name:", "default");
|
|
22503
22577
|
assertUniqueName(existingNames, name);
|
|
@@ -22505,7 +22579,7 @@ async function promptConnection3(existingNames) {
|
|
|
22505
22579
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
22506
22580
|
const port = Number.parseInt(portStr, 10);
|
|
22507
22581
|
if (!Number.isFinite(port)) {
|
|
22508
|
-
console.error(
|
|
22582
|
+
console.error(chalk194.red(`Invalid port "${portStr}".`));
|
|
22509
22583
|
process.exit(1);
|
|
22510
22584
|
}
|
|
22511
22585
|
const user = await promptInput("user", "User:");
|
|
@@ -22518,13 +22592,13 @@ async function promptConnection3(existingNames) {
|
|
|
22518
22592
|
var sqlAuth = createConnectionAuth({
|
|
22519
22593
|
load: loadConnections3,
|
|
22520
22594
|
save: saveConnections3,
|
|
22521
|
-
format: (c) => `${
|
|
22595
|
+
format: (c) => `${chalk195.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
22522
22596
|
promptNew: promptConnection3,
|
|
22523
22597
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
22524
22598
|
});
|
|
22525
22599
|
|
|
22526
22600
|
// src/commands/sql/printTable.ts
|
|
22527
|
-
import
|
|
22601
|
+
import chalk196 from "chalk";
|
|
22528
22602
|
function formatCell(value) {
|
|
22529
22603
|
if (value === null || value === void 0) return "";
|
|
22530
22604
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -22533,7 +22607,7 @@ function formatCell(value) {
|
|
|
22533
22607
|
}
|
|
22534
22608
|
function printTable(rows) {
|
|
22535
22609
|
if (rows.length === 0) {
|
|
22536
|
-
console.log(
|
|
22610
|
+
console.log(chalk196.yellow("(no rows)"));
|
|
22537
22611
|
return;
|
|
22538
22612
|
}
|
|
22539
22613
|
const columns = Object.keys(rows[0]);
|
|
@@ -22541,13 +22615,13 @@ function printTable(rows) {
|
|
|
22541
22615
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
22542
22616
|
);
|
|
22543
22617
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
22544
|
-
console.log(
|
|
22545
|
-
console.log(
|
|
22618
|
+
console.log(chalk196.dim(header));
|
|
22619
|
+
console.log(chalk196.dim("-".repeat(header.length)));
|
|
22546
22620
|
for (const row of rows) {
|
|
22547
22621
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
22548
22622
|
console.log(line);
|
|
22549
22623
|
}
|
|
22550
|
-
console.log(
|
|
22624
|
+
console.log(chalk196.dim(`
|
|
22551
22625
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
22552
22626
|
}
|
|
22553
22627
|
|
|
@@ -22621,7 +22695,7 @@ var sqlConfigHelp = [
|
|
|
22621
22695
|
];
|
|
22622
22696
|
|
|
22623
22697
|
// src/commands/sql/sqlMutate.ts
|
|
22624
|
-
import
|
|
22698
|
+
import chalk197 from "chalk";
|
|
22625
22699
|
|
|
22626
22700
|
// src/commands/sql/isMutation.ts
|
|
22627
22701
|
var MUTATION_KEYWORDS = [
|
|
@@ -22655,7 +22729,7 @@ function isMutation(sql25) {
|
|
|
22655
22729
|
async function sqlMutate(query, connectionName) {
|
|
22656
22730
|
if (!isMutation(query)) {
|
|
22657
22731
|
console.error(
|
|
22658
|
-
|
|
22732
|
+
chalk197.red(
|
|
22659
22733
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
22660
22734
|
)
|
|
22661
22735
|
);
|
|
@@ -22665,18 +22739,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
22665
22739
|
const pool = await sqlConnect(conn);
|
|
22666
22740
|
try {
|
|
22667
22741
|
const result = await pool.request().query(query);
|
|
22668
|
-
console.log(
|
|
22742
|
+
console.log(chalk197.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
22669
22743
|
} finally {
|
|
22670
22744
|
await pool.close();
|
|
22671
22745
|
}
|
|
22672
22746
|
}
|
|
22673
22747
|
|
|
22674
22748
|
// src/commands/sql/sqlQuery.ts
|
|
22675
|
-
import
|
|
22749
|
+
import chalk198 from "chalk";
|
|
22676
22750
|
async function sqlQuery(query, connectionName) {
|
|
22677
22751
|
if (isMutation(query)) {
|
|
22678
22752
|
console.error(
|
|
22679
|
-
|
|
22753
|
+
chalk198.red(
|
|
22680
22754
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
22681
22755
|
)
|
|
22682
22756
|
);
|
|
@@ -22691,7 +22765,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
22691
22765
|
printTable(rows);
|
|
22692
22766
|
} else {
|
|
22693
22767
|
console.log(
|
|
22694
|
-
|
|
22768
|
+
chalk198.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
22695
22769
|
);
|
|
22696
22770
|
}
|
|
22697
22771
|
} finally {
|
|
@@ -23506,7 +23580,7 @@ function registerVoice(program2) {
|
|
|
23506
23580
|
|
|
23507
23581
|
// src/commands/roam/auth.ts
|
|
23508
23582
|
import { randomBytes } from "crypto";
|
|
23509
|
-
import
|
|
23583
|
+
import chalk199 from "chalk";
|
|
23510
23584
|
|
|
23511
23585
|
// src/commands/roam/waitForCallback.ts
|
|
23512
23586
|
import { createServer as createServer3 } from "http";
|
|
@@ -23637,13 +23711,13 @@ async function auth() {
|
|
|
23637
23711
|
saveGlobalConfig(config);
|
|
23638
23712
|
const state = randomBytes(16).toString("hex");
|
|
23639
23713
|
console.log(
|
|
23640
|
-
|
|
23714
|
+
chalk199.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
23641
23715
|
);
|
|
23642
|
-
console.log(
|
|
23643
|
-
console.log(
|
|
23644
|
-
console.log(
|
|
23716
|
+
console.log(chalk199.white("http://localhost:14523/callback\n"));
|
|
23717
|
+
console.log(chalk199.blue("Opening browser for authorization..."));
|
|
23718
|
+
console.log(chalk199.dim("Waiting for authorization callback..."));
|
|
23645
23719
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
23646
|
-
console.log(
|
|
23720
|
+
console.log(chalk199.dim("Exchanging code for tokens..."));
|
|
23647
23721
|
const tokens = await exchangeToken({
|
|
23648
23722
|
code,
|
|
23649
23723
|
clientId,
|
|
@@ -23659,7 +23733,7 @@ async function auth() {
|
|
|
23659
23733
|
};
|
|
23660
23734
|
saveGlobalConfig(config);
|
|
23661
23735
|
console.log(
|
|
23662
|
-
|
|
23736
|
+
chalk199.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
23663
23737
|
);
|
|
23664
23738
|
}
|
|
23665
23739
|
|
|
@@ -24202,7 +24276,7 @@ import { execSync as execSync58 } from "child_process";
|
|
|
24202
24276
|
import { existsSync as existsSync56, mkdirSync as mkdirSync24, unlinkSync as unlinkSync21, writeFileSync as writeFileSync42 } from "fs";
|
|
24203
24277
|
import { tmpdir as tmpdir7 } from "os";
|
|
24204
24278
|
import { join as join66, resolve as resolve16 } from "path";
|
|
24205
|
-
import
|
|
24279
|
+
import chalk200 from "chalk";
|
|
24206
24280
|
|
|
24207
24281
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
24208
24282
|
var captureWindowPs1 = `
|
|
@@ -24353,13 +24427,13 @@ function screenshot(processName) {
|
|
|
24353
24427
|
const config = loadConfig();
|
|
24354
24428
|
const outputDir = resolve16(config.screenshot.outputDir);
|
|
24355
24429
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
24356
|
-
console.log(
|
|
24430
|
+
console.log(chalk200.gray(`Capturing window for process "${processName}" ...`));
|
|
24357
24431
|
try {
|
|
24358
24432
|
runPowerShellScript(processName, outputPath);
|
|
24359
|
-
console.log(
|
|
24433
|
+
console.log(chalk200.green(`Screenshot saved: ${outputPath}`));
|
|
24360
24434
|
} catch (error) {
|
|
24361
24435
|
const msg = error instanceof Error ? error.message : String(error);
|
|
24362
|
-
console.error(
|
|
24436
|
+
console.error(chalk200.red(`Failed to capture screenshot: ${msg}`));
|
|
24363
24437
|
process.exit(1);
|
|
24364
24438
|
}
|
|
24365
24439
|
}
|
|
@@ -27467,7 +27541,7 @@ function registerSetStatusCommand(cmd) {
|
|
|
27467
27541
|
|
|
27468
27542
|
// src/commands/sessions/summarise/index.ts
|
|
27469
27543
|
import * as fs41 from "fs";
|
|
27470
|
-
import
|
|
27544
|
+
import chalk201 from "chalk";
|
|
27471
27545
|
|
|
27472
27546
|
// src/commands/sessions/summarise/shared.ts
|
|
27473
27547
|
import * as fs40 from "fs";
|
|
@@ -27541,22 +27615,22 @@ ${firstMessage}`);
|
|
|
27541
27615
|
async function summarise2(options2) {
|
|
27542
27616
|
const files = await discoverSessionFiles();
|
|
27543
27617
|
if (files.length === 0) {
|
|
27544
|
-
console.log(
|
|
27618
|
+
console.log(chalk201.yellow("No sessions found."));
|
|
27545
27619
|
return;
|
|
27546
27620
|
}
|
|
27547
27621
|
const toProcess = selectCandidates(files, options2);
|
|
27548
27622
|
if (toProcess.length === 0) {
|
|
27549
|
-
console.log(
|
|
27623
|
+
console.log(chalk201.green("All sessions already summarised."));
|
|
27550
27624
|
return;
|
|
27551
27625
|
}
|
|
27552
27626
|
console.log(
|
|
27553
|
-
|
|
27627
|
+
chalk201.cyan(
|
|
27554
27628
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
27555
27629
|
)
|
|
27556
27630
|
);
|
|
27557
27631
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
27558
27632
|
console.log(
|
|
27559
|
-
|
|
27633
|
+
chalk201.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk201.yellow(`, ${failed2} skipped`) : "")
|
|
27560
27634
|
);
|
|
27561
27635
|
}
|
|
27562
27636
|
function selectCandidates(files, options2) {
|
|
@@ -27576,16 +27650,16 @@ function processSessions(files) {
|
|
|
27576
27650
|
let failed2 = 0;
|
|
27577
27651
|
for (let i = 0; i < files.length; i++) {
|
|
27578
27652
|
const file = files[i];
|
|
27579
|
-
process.stdout.write(
|
|
27653
|
+
process.stdout.write(chalk201.dim(` [${i + 1}/${files.length}] `));
|
|
27580
27654
|
const summary = summariseSession(file);
|
|
27581
27655
|
if (summary) {
|
|
27582
27656
|
writeSummary(file, summary);
|
|
27583
27657
|
succeeded++;
|
|
27584
|
-
process.stdout.write(`${
|
|
27658
|
+
process.stdout.write(`${chalk201.green("\u2713")} ${summary}
|
|
27585
27659
|
`);
|
|
27586
27660
|
} else {
|
|
27587
27661
|
failed2++;
|
|
27588
|
-
process.stdout.write(` ${
|
|
27662
|
+
process.stdout.write(` ${chalk201.yellow("skip")}
|
|
27589
27663
|
`);
|
|
27590
27664
|
}
|
|
27591
27665
|
}
|
|
@@ -27627,7 +27701,7 @@ function registerSessions(program2) {
|
|
|
27627
27701
|
}
|
|
27628
27702
|
|
|
27629
27703
|
// src/commands/statusLine.ts
|
|
27630
|
-
import
|
|
27704
|
+
import chalk203 from "chalk";
|
|
27631
27705
|
|
|
27632
27706
|
// src/shared/contextLevel.ts
|
|
27633
27707
|
function contextLevel(pct) {
|
|
@@ -27637,7 +27711,7 @@ function contextLevel(pct) {
|
|
|
27637
27711
|
}
|
|
27638
27712
|
|
|
27639
27713
|
// src/commands/buildLimitsSegment.ts
|
|
27640
|
-
import
|
|
27714
|
+
import chalk202 from "chalk";
|
|
27641
27715
|
|
|
27642
27716
|
// src/shared/rateLimitLevel.ts
|
|
27643
27717
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -27668,9 +27742,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
27668
27742
|
|
|
27669
27743
|
// src/commands/buildLimitsSegment.ts
|
|
27670
27744
|
var LEVEL_COLOR = {
|
|
27671
|
-
ok:
|
|
27672
|
-
warn:
|
|
27673
|
-
over:
|
|
27745
|
+
ok: chalk202.green,
|
|
27746
|
+
warn: chalk202.yellow,
|
|
27747
|
+
over: chalk202.red
|
|
27674
27748
|
};
|
|
27675
27749
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
27676
27750
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -27766,7 +27840,7 @@ async function relayUsage(claudeSessionId, transcriptPath, usedPct) {
|
|
|
27766
27840
|
}
|
|
27767
27841
|
|
|
27768
27842
|
// src/commands/statusLine.ts
|
|
27769
|
-
|
|
27843
|
+
chalk203.level = 3;
|
|
27770
27844
|
function formatNumber(num) {
|
|
27771
27845
|
return num.toLocaleString("en-US");
|
|
27772
27846
|
}
|
|
@@ -27774,9 +27848,9 @@ function colorizePercent(pct) {
|
|
|
27774
27848
|
const label2 = `${Math.round(pct)}%`;
|
|
27775
27849
|
switch (contextLevel(pct)) {
|
|
27776
27850
|
case "red":
|
|
27777
|
-
return
|
|
27851
|
+
return chalk203.red(label2);
|
|
27778
27852
|
case "yellow":
|
|
27779
|
-
return
|
|
27853
|
+
return chalk203.yellow(label2);
|
|
27780
27854
|
default:
|
|
27781
27855
|
return label2;
|
|
27782
27856
|
}
|
|
@@ -27789,7 +27863,7 @@ async function statusLine() {
|
|
|
27789
27863
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
27790
27864
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
27791
27865
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
27792
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
27866
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk203.cyan(branch2)} | ` : "";
|
|
27793
27867
|
console.log(
|
|
27794
27868
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
27795
27869
|
);
|
|
@@ -27810,7 +27884,7 @@ import { fileURLToPath as fileURLToPath9 } from "url";
|
|
|
27810
27884
|
// src/commands/sync/syncClaudeMd.ts
|
|
27811
27885
|
import * as fs42 from "fs";
|
|
27812
27886
|
import * as path61 from "path";
|
|
27813
|
-
import
|
|
27887
|
+
import chalk204 from "chalk";
|
|
27814
27888
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
27815
27889
|
const source = path61.join(claudeDir, "CLAUDE.md");
|
|
27816
27890
|
const target = path61.join(targetBase, "CLAUDE.md");
|
|
@@ -27819,12 +27893,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
27819
27893
|
const targetContent = fs42.readFileSync(target, "utf8");
|
|
27820
27894
|
if (sourceContent !== targetContent) {
|
|
27821
27895
|
console.log(
|
|
27822
|
-
|
|
27896
|
+
chalk204.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
27823
27897
|
);
|
|
27824
27898
|
console.log();
|
|
27825
27899
|
printDiff(targetContent, sourceContent);
|
|
27826
27900
|
const confirm = options2?.yes || await promptConfirm(
|
|
27827
|
-
|
|
27901
|
+
chalk204.red("Overwrite existing CLAUDE.md?"),
|
|
27828
27902
|
false
|
|
27829
27903
|
);
|
|
27830
27904
|
if (!confirm) {
|
|
@@ -28018,7 +28092,7 @@ function syncPi(claudeDir) {
|
|
|
28018
28092
|
// src/commands/sync/syncSettings.ts
|
|
28019
28093
|
import * as fs47 from "fs";
|
|
28020
28094
|
import * as path68 from "path";
|
|
28021
|
-
import
|
|
28095
|
+
import chalk205 from "chalk";
|
|
28022
28096
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
28023
28097
|
const source = path68.join(claudeDir, "settings.json");
|
|
28024
28098
|
const target = path68.join(targetBase, "settings.json");
|
|
@@ -28037,14 +28111,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
28037
28111
|
if (mergedContent !== normalizedTarget) {
|
|
28038
28112
|
if (!options2?.yes) {
|
|
28039
28113
|
console.log(
|
|
28040
|
-
|
|
28114
|
+
chalk205.yellow(
|
|
28041
28115
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
28042
28116
|
)
|
|
28043
28117
|
);
|
|
28044
28118
|
console.log();
|
|
28045
28119
|
printDiff(targetContent, mergedContent);
|
|
28046
28120
|
const confirm = await promptConfirm(
|
|
28047
|
-
|
|
28121
|
+
chalk205.red("Overwrite existing settings.json?"),
|
|
28048
28122
|
false
|
|
28049
28123
|
);
|
|
28050
28124
|
if (!confirm) {
|
|
@@ -28143,10 +28217,10 @@ async function update2() {
|
|
|
28143
28217
|
}
|
|
28144
28218
|
|
|
28145
28219
|
// src/reportCliError.ts
|
|
28146
|
-
import
|
|
28220
|
+
import chalk206 from "chalk";
|
|
28147
28221
|
function reportCliError(error) {
|
|
28148
|
-
if (error instanceof InvalidItemIdError) {
|
|
28149
|
-
console.error(
|
|
28222
|
+
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError) {
|
|
28223
|
+
console.error(chalk206.red(error.message));
|
|
28150
28224
|
} else {
|
|
28151
28225
|
console.error(error);
|
|
28152
28226
|
}
|