@staff0rd/assist 0.412.0 → 0.414.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 +3 -1
- package/dist/commands/sessions/web/bundle.js +401 -401
- package/dist/index.js +810 -556
- 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.414.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -134,12 +134,70 @@ import chalk2 from "chalk";
|
|
|
134
134
|
import { Pool } from "pg";
|
|
135
135
|
|
|
136
136
|
// src/shared/loadConfig.ts
|
|
137
|
-
import {
|
|
138
|
-
import { homedir } from "os";
|
|
139
|
-
import { dirname, join } from "path";
|
|
137
|
+
import { writeFileSync } from "fs";
|
|
140
138
|
import chalk from "chalk";
|
|
141
139
|
import { stringify as stringifyYaml } from "yaml";
|
|
142
140
|
|
|
141
|
+
// src/shared/loadConfigFrom.ts
|
|
142
|
+
import { existsSync as existsSync2 } from "fs";
|
|
143
|
+
import { homedir } from "os";
|
|
144
|
+
import { dirname, join } from "path";
|
|
145
|
+
|
|
146
|
+
// src/commands/backlog/getCurrentOrigin.ts
|
|
147
|
+
import { execFileSync } from "child_process";
|
|
148
|
+
function stripLeadingSlashes(path71) {
|
|
149
|
+
return path71.replace(/^\/+/, "");
|
|
150
|
+
}
|
|
151
|
+
function normalizeOrigin(raw) {
|
|
152
|
+
const trimmed = raw.trim().replace(/\.git$/i, "").replace(/\/+$/, "");
|
|
153
|
+
const url = trimmed.match(
|
|
154
|
+
/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?\/(.+)$/
|
|
155
|
+
);
|
|
156
|
+
if (url) {
|
|
157
|
+
return `${url[1].toLowerCase()}/${stripLeadingSlashes(url[2])}`;
|
|
158
|
+
}
|
|
159
|
+
if (!trimmed.includes("://")) {
|
|
160
|
+
const scp = trimmed.match(/^(?:[^@/]+@)?([^/:]+):(.+)$/);
|
|
161
|
+
if (scp) {
|
|
162
|
+
return `${scp[1].toLowerCase()}/${stripLeadingSlashes(scp[2])}`;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return trimmed.toLowerCase();
|
|
166
|
+
}
|
|
167
|
+
function tryGit(cwd, args) {
|
|
168
|
+
const windows = /^[A-Za-z]:[\\/]/.test(cwd);
|
|
169
|
+
const file = windows ? "git.exe" : "git";
|
|
170
|
+
const argv = windows ? ["-C", cwd, ...args] : args;
|
|
171
|
+
try {
|
|
172
|
+
const out = execFileSync(file, argv, {
|
|
173
|
+
encoding: "utf8",
|
|
174
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
175
|
+
...windows ? {} : { cwd }
|
|
176
|
+
}).trim();
|
|
177
|
+
return out || null;
|
|
178
|
+
} catch {
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
function firstRemoteUrl(cwd) {
|
|
183
|
+
const remotes = tryGit(cwd, ["remote"]);
|
|
184
|
+
if (!remotes) return null;
|
|
185
|
+
for (const remote of remotes.split("\n").map((r) => r.trim()).filter(Boolean)) {
|
|
186
|
+
const url = tryGit(cwd, ["remote", "get-url", remote]);
|
|
187
|
+
if (url) return url;
|
|
188
|
+
}
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
function getRemoteOriginUrl(cwd) {
|
|
192
|
+
return tryGit(cwd, ["remote", "get-url", "origin"]) ?? firstRemoteUrl(cwd);
|
|
193
|
+
}
|
|
194
|
+
function getCurrentOrigin(cwd) {
|
|
195
|
+
const url = getRemoteOriginUrl(cwd);
|
|
196
|
+
if (url) return normalizeOrigin(url);
|
|
197
|
+
const root = tryGit(cwd, ["rev-parse", "--show-toplevel"]);
|
|
198
|
+
return `local:${root ?? cwd}`;
|
|
199
|
+
}
|
|
200
|
+
|
|
143
201
|
// src/shared/loadRawYaml.ts
|
|
144
202
|
import { existsSync, readFileSync } from "fs";
|
|
145
203
|
import { parse as parseYaml } from "yaml";
|
|
@@ -179,6 +237,84 @@ function mergeRawConfigs(globalRaw, projectRaw) {
|
|
|
179
237
|
return merged;
|
|
180
238
|
}
|
|
181
239
|
|
|
240
|
+
// src/commands/backlog/originDisplayName.ts
|
|
241
|
+
function originDisplayName(origin) {
|
|
242
|
+
if (origin.startsWith("local:")) {
|
|
243
|
+
const path71 = origin.slice("local:".length).replace(/\/+$/, "");
|
|
244
|
+
const segments = path71.split("/").filter(Boolean);
|
|
245
|
+
return segments[segments.length - 1] ?? origin;
|
|
246
|
+
}
|
|
247
|
+
const firstSlash = origin.indexOf("/");
|
|
248
|
+
if (firstSlash === -1) return origin;
|
|
249
|
+
return origin.slice(firstSlash + 1);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// src/commands/backlog/originDisplayLabels.ts
|
|
253
|
+
function originDisplayLabels(origins) {
|
|
254
|
+
const isLocal = (origin) => origin.startsWith("local:");
|
|
255
|
+
const bareName = (origin) => {
|
|
256
|
+
const full = originDisplayName(origin);
|
|
257
|
+
const segments = full.split("/");
|
|
258
|
+
return segments[segments.length - 1] ?? full;
|
|
259
|
+
};
|
|
260
|
+
const remoteCounts = /* @__PURE__ */ new Map();
|
|
261
|
+
for (const origin of new Set(origins)) {
|
|
262
|
+
if (isLocal(origin)) continue;
|
|
263
|
+
const name = bareName(origin);
|
|
264
|
+
remoteCounts.set(name, (remoteCounts.get(name) ?? 0) + 1);
|
|
265
|
+
}
|
|
266
|
+
const labels = /* @__PURE__ */ new Map();
|
|
267
|
+
for (const origin of origins) {
|
|
268
|
+
if (isLocal(origin)) {
|
|
269
|
+
labels.set(origin, originDisplayName(origin));
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
const name = bareName(origin);
|
|
273
|
+
const collides = (remoteCounts.get(name) ?? 0) > 1;
|
|
274
|
+
labels.set(origin, collides ? originDisplayName(origin) : name);
|
|
275
|
+
}
|
|
276
|
+
return labels;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// src/shared/resolveRepoOverride.ts
|
|
280
|
+
var AmbiguousRepoConfigError = class extends Error {
|
|
281
|
+
name = "AmbiguousRepoConfigError";
|
|
282
|
+
};
|
|
283
|
+
function originKeyCandidates(origin) {
|
|
284
|
+
const displayName = originDisplayName(origin);
|
|
285
|
+
const segments = displayName.split("/");
|
|
286
|
+
const bare = segments[segments.length - 1] ?? displayName;
|
|
287
|
+
return /* @__PURE__ */ new Set([origin, displayName, bare]);
|
|
288
|
+
}
|
|
289
|
+
function resolveRepoOverride(globalRaw, origin) {
|
|
290
|
+
const repos2 = globalRaw.repos;
|
|
291
|
+
if (!repos2 || typeof repos2 !== "object" || Array.isArray(repos2)) return {};
|
|
292
|
+
const entries = repos2;
|
|
293
|
+
const candidates = originKeyCandidates(origin);
|
|
294
|
+
const matches = Object.keys(entries).filter((key) => candidates.has(key));
|
|
295
|
+
if (matches.length === 0) return {};
|
|
296
|
+
if (matches.length > 1) {
|
|
297
|
+
throw new AmbiguousRepoConfigError(
|
|
298
|
+
`Ambiguous repos config in ~/.assist.yml: keys ${matches.map((m) => `"${m}"`).join(", ")} all match the current repository (${origin}). Keep a single key per repository.`
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
const override = entries[matches[0]];
|
|
302
|
+
if (!override || typeof override !== "object" || Array.isArray(override))
|
|
303
|
+
return {};
|
|
304
|
+
return override;
|
|
305
|
+
}
|
|
306
|
+
function resolveRepoWriteLabel(globalRaw, origin) {
|
|
307
|
+
const repos2 = globalRaw.repos;
|
|
308
|
+
if (repos2 && typeof repos2 === "object" && !Array.isArray(repos2)) {
|
|
309
|
+
const candidates = originKeyCandidates(origin);
|
|
310
|
+
const existing = Object.keys(repos2).find(
|
|
311
|
+
(key) => candidates.has(key)
|
|
312
|
+
);
|
|
313
|
+
if (existing) return existing;
|
|
314
|
+
}
|
|
315
|
+
return originDisplayLabels([origin]).get(origin) ?? origin;
|
|
316
|
+
}
|
|
317
|
+
|
|
182
318
|
// src/shared/types.ts
|
|
183
319
|
import { z as z2 } from "zod";
|
|
184
320
|
|
|
@@ -199,7 +335,9 @@ var runConfigSchema = z.strictObject({
|
|
|
199
335
|
filter: z.string().optional(),
|
|
200
336
|
pre: z.array(z.string()).optional(),
|
|
201
337
|
cwd: z.string().optional(),
|
|
202
|
-
quiet: z.boolean().optional()
|
|
338
|
+
quiet: z.boolean().optional(),
|
|
339
|
+
server: z.boolean().optional(),
|
|
340
|
+
port: z.number().optional()
|
|
203
341
|
});
|
|
204
342
|
var runLinkSchema = z.strictObject({
|
|
205
343
|
link: z.string(),
|
|
@@ -267,6 +405,7 @@ var assistConfigSchema = z2.strictObject({
|
|
|
267
405
|
slack: z2.string().optional(),
|
|
268
406
|
required: z2.boolean().default(false)
|
|
269
407
|
}).optional(),
|
|
408
|
+
repos: z2.record(z2.string(), z2.record(z2.string(), z2.unknown())).optional(),
|
|
270
409
|
run: z2.array(z2.union([runConfigSchema, runLinkSchema])).optional(),
|
|
271
410
|
subtasks: z2.array(
|
|
272
411
|
z2.strictObject({
|
|
@@ -372,7 +511,7 @@ var assistConfigSchema = z2.strictObject({
|
|
|
372
511
|
})
|
|
373
512
|
});
|
|
374
513
|
|
|
375
|
-
// src/shared/
|
|
514
|
+
// src/shared/loadConfigFrom.ts
|
|
376
515
|
function findConfigUp(startDir) {
|
|
377
516
|
let current = startDir;
|
|
378
517
|
while (current !== dirname(current)) {
|
|
@@ -385,27 +524,41 @@ function findConfigUp(startDir) {
|
|
|
385
524
|
}
|
|
386
525
|
return null;
|
|
387
526
|
}
|
|
388
|
-
function
|
|
389
|
-
const found = findConfigUp(
|
|
527
|
+
function getConfigPathFrom(cwd) {
|
|
528
|
+
const found = findConfigUp(cwd);
|
|
390
529
|
if (found) return found.configPath;
|
|
391
|
-
return join(
|
|
530
|
+
return join(cwd, "assist.yml");
|
|
392
531
|
}
|
|
393
532
|
function getGlobalConfigPath() {
|
|
394
533
|
return join(homedir(), ".assist.yml");
|
|
395
534
|
}
|
|
535
|
+
function getConfigDirFrom(cwd) {
|
|
536
|
+
return dirname(getConfigPathFrom(cwd));
|
|
537
|
+
}
|
|
538
|
+
function loadConfigFrom(cwd) {
|
|
539
|
+
const globalRaw = loadRawYaml(getGlobalConfigPath());
|
|
540
|
+
const projectRaw = loadRawYaml(getConfigPathFrom(cwd));
|
|
541
|
+
const repoOverride = globalRaw.repos ? resolveRepoOverride(globalRaw, getCurrentOrigin(cwd)) : {};
|
|
542
|
+
const globalWithRepo = mergeRawConfigs(globalRaw, repoOverride);
|
|
543
|
+
const merged = mergeRawConfigs(globalWithRepo, projectRaw);
|
|
544
|
+
delete merged.repos;
|
|
545
|
+
delete merged.news;
|
|
546
|
+
return assistConfigSchema.parse(merged);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
// src/shared/loadConfig.ts
|
|
550
|
+
function getConfigPath() {
|
|
551
|
+
return getConfigPathFrom(process.cwd());
|
|
552
|
+
}
|
|
396
553
|
function getConfigDir() {
|
|
397
|
-
return
|
|
554
|
+
return getConfigDirFrom(process.cwd());
|
|
398
555
|
}
|
|
399
556
|
function getProjectRoot() {
|
|
400
557
|
const found = findConfigUp(process.cwd());
|
|
401
558
|
return found?.rootDir ?? process.cwd();
|
|
402
559
|
}
|
|
403
560
|
function loadConfig() {
|
|
404
|
-
|
|
405
|
-
const projectRaw = loadRawYaml(getConfigPath());
|
|
406
|
-
const merged = mergeRawConfigs(globalRaw, projectRaw);
|
|
407
|
-
delete merged.news;
|
|
408
|
-
return assistConfigSchema.parse(merged);
|
|
561
|
+
return loadConfigFrom(process.cwd());
|
|
409
562
|
}
|
|
410
563
|
function loadProjectConfig() {
|
|
411
564
|
return loadRawYaml(getConfigPath());
|
|
@@ -3362,7 +3515,7 @@ function enumerateConfigLeafKeys(schema2) {
|
|
|
3362
3515
|
}
|
|
3363
3516
|
|
|
3364
3517
|
// src/commands/verify/pendingConfigDocumentation.ts
|
|
3365
|
-
var pendingConfigDocumentation = /* @__PURE__ */ new Set();
|
|
3518
|
+
var pendingConfigDocumentation = /* @__PURE__ */ new Set(["repos"]);
|
|
3366
3519
|
|
|
3367
3520
|
// src/commands/verify/configKeys.ts
|
|
3368
3521
|
function section(label2, keys) {
|
|
@@ -5959,61 +6112,6 @@ function findBacklogUp(startDir) {
|
|
|
5959
6112
|
return null;
|
|
5960
6113
|
}
|
|
5961
6114
|
|
|
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
6115
|
// src/commands/backlog/loadItem.ts
|
|
6018
6116
|
import { eq as eq5 } from "drizzle-orm";
|
|
6019
6117
|
async function loadItem(orm, id) {
|
|
@@ -8036,45 +8134,6 @@ async function loadItemSummaries(orm, origin) {
|
|
|
8036
8134
|
return rows.map(rowToItemSummary);
|
|
8037
8135
|
}
|
|
8038
8136
|
|
|
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
8137
|
// src/commands/backlog/resolveRepoLocation.ts
|
|
8079
8138
|
import { existsSync as existsSync25 } from "fs";
|
|
8080
8139
|
|
|
@@ -8461,6 +8520,32 @@ function getHtml() {
|
|
|
8461
8520
|
</html>`;
|
|
8462
8521
|
}
|
|
8463
8522
|
|
|
8523
|
+
// src/commands/sessions/web/getCwdParam.ts
|
|
8524
|
+
function getCwdParam(req, res) {
|
|
8525
|
+
const url = new URL(req.url ?? "/", "http://localhost");
|
|
8526
|
+
const cwd = url.searchParams.get("cwd");
|
|
8527
|
+
if (!cwd) {
|
|
8528
|
+
respondJson(res, 400, { error: "Missing cwd" });
|
|
8529
|
+
return null;
|
|
8530
|
+
}
|
|
8531
|
+
return cwd;
|
|
8532
|
+
}
|
|
8533
|
+
|
|
8534
|
+
// src/commands/sessions/web/handleServerRuns.ts
|
|
8535
|
+
function getServerRuns(cwd) {
|
|
8536
|
+
try {
|
|
8537
|
+
const { run: run4 } = loadConfigFrom(cwd);
|
|
8538
|
+
return resolveRunConfigs(run4, getConfigDirFrom(cwd)).filter((r) => r.server).map((r) => ({ name: r.name, port: r.port }));
|
|
8539
|
+
} catch {
|
|
8540
|
+
return [];
|
|
8541
|
+
}
|
|
8542
|
+
}
|
|
8543
|
+
function handleServerRuns(req, res) {
|
|
8544
|
+
const cwd = getCwdParam(req, res);
|
|
8545
|
+
if (!cwd) return;
|
|
8546
|
+
respondJson(res, 200, { runs: getServerRuns(cwd) });
|
|
8547
|
+
}
|
|
8548
|
+
|
|
8464
8549
|
// src/commands/sessions/web/getReviewSynthesis.ts
|
|
8465
8550
|
import { execFile as execFile2 } from "child_process";
|
|
8466
8551
|
import { readFileSync as readFileSync19 } from "fs";
|
|
@@ -8480,17 +8565,6 @@ function findSynthesisForBranch(repoReviewsDir, branch2) {
|
|
|
8480
8565
|
return synthesisFiles[0]?.path ?? null;
|
|
8481
8566
|
}
|
|
8482
8567
|
|
|
8483
|
-
// src/commands/sessions/web/getCwdParam.ts
|
|
8484
|
-
function getCwdParam(req, res) {
|
|
8485
|
-
const url = new URL(req.url ?? "/", "http://localhost");
|
|
8486
|
-
const cwd = url.searchParams.get("cwd");
|
|
8487
|
-
if (!cwd) {
|
|
8488
|
-
respondJson(res, 400, { error: "Missing cwd" });
|
|
8489
|
-
return null;
|
|
8490
|
-
}
|
|
8491
|
-
return cwd;
|
|
8492
|
-
}
|
|
8493
|
-
|
|
8494
8568
|
// src/commands/sessions/web/windowsCwdToWslPath.ts
|
|
8495
8569
|
function windowsCwdToWslPath(cwd) {
|
|
8496
8570
|
const match = /^([A-Za-z]):[\\/](.*)$/.exec(cwd);
|
|
@@ -9159,6 +9233,7 @@ var routes2 = {
|
|
|
9159
9233
|
"GET /api/jira-site": jiraSite,
|
|
9160
9234
|
"GET /api/harness": harnessCapabilities,
|
|
9161
9235
|
"GET /api/pr-status": prStatus,
|
|
9236
|
+
"GET /api/server-runs": handleServerRuns,
|
|
9162
9237
|
"GET /api/pr-list": prList,
|
|
9163
9238
|
"GET /api/news/items": listNewsItems,
|
|
9164
9239
|
"GET /api/usage/history": listUsageHistory,
|
|
@@ -13800,8 +13875,51 @@ function registerComplexity(program2) {
|
|
|
13800
13875
|
}
|
|
13801
13876
|
|
|
13802
13877
|
// src/commands/config/index.ts
|
|
13803
|
-
import chalk122 from "chalk";
|
|
13804
13878
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
13879
|
+
function configList() {
|
|
13880
|
+
const config = loadConfig();
|
|
13881
|
+
console.log(stringifyYaml2(config, { lineWidth: 0 }).trimEnd());
|
|
13882
|
+
}
|
|
13883
|
+
|
|
13884
|
+
// src/commands/config/configGet.ts
|
|
13885
|
+
import chalk122 from "chalk";
|
|
13886
|
+
|
|
13887
|
+
// src/commands/config/getNestedValue.ts
|
|
13888
|
+
function isTraversable(value) {
|
|
13889
|
+
return value !== null && value !== void 0 && typeof value === "object";
|
|
13890
|
+
}
|
|
13891
|
+
function stepInto(current, key) {
|
|
13892
|
+
return isTraversable(current) ? current[key] : void 0;
|
|
13893
|
+
}
|
|
13894
|
+
function getNestedValue(obj, path71) {
|
|
13895
|
+
let current = obj;
|
|
13896
|
+
for (const key of path71.split(".")) current = stepInto(current, key);
|
|
13897
|
+
return current;
|
|
13898
|
+
}
|
|
13899
|
+
|
|
13900
|
+
// src/commands/config/configGet.ts
|
|
13901
|
+
function configGet(key) {
|
|
13902
|
+
console.log(
|
|
13903
|
+
formatOutput(
|
|
13904
|
+
requireNestedValue(loadConfig(), key)
|
|
13905
|
+
)
|
|
13906
|
+
);
|
|
13907
|
+
}
|
|
13908
|
+
function formatOutput(value) {
|
|
13909
|
+
return typeof value === "object" && value !== null ? JSON.stringify(value, null, 2) : String(value);
|
|
13910
|
+
}
|
|
13911
|
+
function requireNestedValue(config, key) {
|
|
13912
|
+
const value = getNestedValue(config, key);
|
|
13913
|
+
if (value === void 0) return exitKeyNotSet(key);
|
|
13914
|
+
return value;
|
|
13915
|
+
}
|
|
13916
|
+
function exitKeyNotSet(key) {
|
|
13917
|
+
console.error(chalk122.red(`Key "${key}" is not set`));
|
|
13918
|
+
process.exit(1);
|
|
13919
|
+
}
|
|
13920
|
+
|
|
13921
|
+
// src/commands/config/configSet.ts
|
|
13922
|
+
import chalk124 from "chalk";
|
|
13805
13923
|
|
|
13806
13924
|
// src/commands/config/setNestedValue.ts
|
|
13807
13925
|
function isPlainObject(val) {
|
|
@@ -13851,146 +13969,134 @@ function setNestedValue(obj, path71, value) {
|
|
|
13851
13969
|
return result;
|
|
13852
13970
|
}
|
|
13853
13971
|
|
|
13854
|
-
// src/commands/config/
|
|
13855
|
-
|
|
13856
|
-
if (value === "true") return true;
|
|
13857
|
-
if (value === "false") return false;
|
|
13858
|
-
return value;
|
|
13859
|
-
}
|
|
13860
|
-
function formatIssuePath(issue, key) {
|
|
13861
|
-
return issue.path.length > 0 ? issue.path.join(".") : key;
|
|
13862
|
-
}
|
|
13863
|
-
function printValidationErrors(issues, key) {
|
|
13864
|
-
for (const issue of issues) {
|
|
13865
|
-
console.error(
|
|
13866
|
-
chalk122.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
13867
|
-
);
|
|
13868
|
-
}
|
|
13869
|
-
}
|
|
13870
|
-
function exitValidationFailed(issues, key) {
|
|
13871
|
-
printValidationErrors(issues, key);
|
|
13872
|
-
process.exit(1);
|
|
13873
|
-
}
|
|
13972
|
+
// src/commands/config/validateConfig.ts
|
|
13973
|
+
import chalk123 from "chalk";
|
|
13874
13974
|
function validateConfig(updated, key) {
|
|
13875
13975
|
const result = assistConfigSchema.safeParse(updated);
|
|
13876
13976
|
if (!result.success) return exitValidationFailed(result.error.issues, key);
|
|
13877
13977
|
return updated;
|
|
13878
13978
|
}
|
|
13879
|
-
|
|
13880
|
-
|
|
13881
|
-
|
|
13979
|
+
function exitValidationFailed(issues, key) {
|
|
13980
|
+
printValidationErrors(issues, key);
|
|
13981
|
+
process.exit(1);
|
|
13982
|
+
}
|
|
13983
|
+
function printValidationErrors(issues, key) {
|
|
13984
|
+
for (const issue of issues) {
|
|
13882
13985
|
console.error(
|
|
13883
|
-
|
|
13884
|
-
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
13885
|
-
)
|
|
13986
|
+
chalk123.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
13886
13987
|
);
|
|
13887
|
-
process.exit(1);
|
|
13888
|
-
}
|
|
13889
|
-
}
|
|
13890
|
-
function applyConfigSet(key, coerced, global) {
|
|
13891
|
-
assertNotGlobalOnly(key, global);
|
|
13892
|
-
const raw = global ? loadGlobalConfigRaw() : loadProjectConfig();
|
|
13893
|
-
const updated = setNestedValue(raw, key, coerced);
|
|
13894
|
-
validateConfig(updated, key);
|
|
13895
|
-
if (global) {
|
|
13896
|
-
saveGlobalConfig(updated);
|
|
13897
|
-
} else {
|
|
13898
|
-
saveConfig(updated);
|
|
13899
13988
|
}
|
|
13900
13989
|
}
|
|
13901
|
-
function
|
|
13902
|
-
|
|
13903
|
-
applyConfigSet(key, coerced, options2.global ?? false);
|
|
13904
|
-
const target = options2.global ? "global" : "project";
|
|
13905
|
-
console.log(
|
|
13906
|
-
chalk122.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
13907
|
-
);
|
|
13908
|
-
}
|
|
13909
|
-
function configList() {
|
|
13910
|
-
const config = loadConfig();
|
|
13911
|
-
console.log(stringifyYaml2(config, { lineWidth: 0 }).trimEnd());
|
|
13990
|
+
function formatIssuePath(issue, key) {
|
|
13991
|
+
return issue.path.length > 0 ? issue.path.join(".") : key;
|
|
13912
13992
|
}
|
|
13913
13993
|
|
|
13914
|
-
// src/commands/config/
|
|
13915
|
-
|
|
13916
|
-
|
|
13917
|
-
|
|
13918
|
-
|
|
13919
|
-
|
|
13994
|
+
// src/commands/config/applyRepoConfigSet.ts
|
|
13995
|
+
function applyRepoConfigSet(key, coerced) {
|
|
13996
|
+
const globalRaw = loadGlobalConfigRaw();
|
|
13997
|
+
const label2 = resolveRepoWriteLabel(
|
|
13998
|
+
globalRaw,
|
|
13999
|
+
getCurrentOrigin(process.cwd())
|
|
14000
|
+
);
|
|
14001
|
+
const repos2 = isPlainObject2(globalRaw.repos) ? { ...globalRaw.repos } : {};
|
|
14002
|
+
const existingBlock = isPlainObject2(repos2[label2]) ? repos2[label2] : {};
|
|
14003
|
+
const updatedBlock = setNestedValue(existingBlock, key, coerced);
|
|
14004
|
+
validateConfig(updatedBlock, key);
|
|
14005
|
+
repos2[label2] = updatedBlock;
|
|
14006
|
+
saveGlobalConfig({ ...globalRaw, repos: repos2 });
|
|
14007
|
+
return label2;
|
|
13920
14008
|
}
|
|
13921
|
-
function
|
|
13922
|
-
return
|
|
13923
|
-
}
|
|
13924
|
-
function getNestedValue(obj, path71) {
|
|
13925
|
-
let current = obj;
|
|
13926
|
-
for (const key of path71.split(".")) current = stepInto(current, key);
|
|
13927
|
-
return current;
|
|
14009
|
+
function isPlainObject2(value) {
|
|
14010
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
13928
14011
|
}
|
|
13929
14012
|
|
|
13930
|
-
// src/commands/config/
|
|
13931
|
-
|
|
14013
|
+
// src/commands/config/configSet.ts
|
|
14014
|
+
var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
14015
|
+
function configSet(key, value, options2 = {}) {
|
|
14016
|
+
const coerced = coerceValue(value);
|
|
14017
|
+
if (options2.repo && options2.global) {
|
|
14018
|
+
console.error(chalk124.red("Use either --repo or --global, not both"));
|
|
14019
|
+
process.exit(1);
|
|
14020
|
+
}
|
|
14021
|
+
const target = options2.repo ? `repo: ${applyRepoConfigSet(key, coerced)}` : applyConfigSet(key, coerced, options2.global ?? false);
|
|
13932
14022
|
console.log(
|
|
13933
|
-
|
|
13934
|
-
requireNestedValue(loadConfig(), key)
|
|
13935
|
-
)
|
|
14023
|
+
chalk124.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
13936
14024
|
);
|
|
13937
14025
|
}
|
|
13938
|
-
function
|
|
13939
|
-
|
|
13940
|
-
|
|
13941
|
-
function requireNestedValue(config, key) {
|
|
13942
|
-
const value = getNestedValue(config, key);
|
|
13943
|
-
if (value === void 0) return exitKeyNotSet(key);
|
|
14026
|
+
function coerceValue(value) {
|
|
14027
|
+
if (value === "true") return true;
|
|
14028
|
+
if (value === "false") return false;
|
|
13944
14029
|
return value;
|
|
13945
14030
|
}
|
|
13946
|
-
function
|
|
13947
|
-
|
|
13948
|
-
|
|
14031
|
+
function applyConfigSet(key, coerced, global) {
|
|
14032
|
+
assertNotGlobalOnly(key, global);
|
|
14033
|
+
const raw = global ? loadGlobalConfigRaw() : loadProjectConfig();
|
|
14034
|
+
const updated = setNestedValue(raw, key, coerced);
|
|
14035
|
+
validateConfig(updated, key);
|
|
14036
|
+
if (global) {
|
|
14037
|
+
saveGlobalConfig(updated);
|
|
14038
|
+
return "global";
|
|
14039
|
+
}
|
|
14040
|
+
saveConfig(updated);
|
|
14041
|
+
return "project";
|
|
14042
|
+
}
|
|
14043
|
+
function assertNotGlobalOnly(key, global) {
|
|
14044
|
+
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
14045
|
+
console.error(
|
|
14046
|
+
chalk124.red(
|
|
14047
|
+
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
14048
|
+
)
|
|
14049
|
+
);
|
|
14050
|
+
process.exit(1);
|
|
14051
|
+
}
|
|
13949
14052
|
}
|
|
13950
14053
|
|
|
13951
14054
|
// src/commands/registerConfig.ts
|
|
13952
14055
|
function registerConfig(program2) {
|
|
13953
14056
|
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").
|
|
14057
|
+
configCommand.command("set <key> <value>").description("Set a config value (e.g. commit.push true)").option("-g, --global", "Write to global ~/.assist.yml").option(
|
|
14058
|
+
"-r, --repo",
|
|
14059
|
+
"Write to ~/.assist.yml under the current repo's identity"
|
|
14060
|
+
).action((key, value, options2) => configSet(key, value, options2));
|
|
13955
14061
|
configCommand.command("get <key>").description("Get a config value").action(configGet);
|
|
13956
14062
|
configCommand.command("list").description("List all config values").action(configList);
|
|
13957
14063
|
}
|
|
13958
14064
|
|
|
13959
14065
|
// src/commands/db/reportMigrationStatus.ts
|
|
13960
|
-
import
|
|
14066
|
+
import chalk125 from "chalk";
|
|
13961
14067
|
function reportApplied(applied) {
|
|
13962
14068
|
if (applied.length === 0) {
|
|
13963
|
-
console.error(
|
|
14069
|
+
console.error(chalk125.green("Database is up to date; nothing to apply."));
|
|
13964
14070
|
return;
|
|
13965
14071
|
}
|
|
13966
14072
|
for (const migration of applied) {
|
|
13967
14073
|
console.error(
|
|
13968
|
-
|
|
14074
|
+
chalk125.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
13969
14075
|
);
|
|
13970
14076
|
}
|
|
13971
14077
|
}
|
|
13972
14078
|
function reportMigrationStatus(status3) {
|
|
13973
14079
|
if (status3.state === "in-sync") {
|
|
13974
14080
|
console.error(
|
|
13975
|
-
|
|
14081
|
+
chalk125.green(`In sync at migration ${status3.version} (latest).`)
|
|
13976
14082
|
);
|
|
13977
14083
|
return;
|
|
13978
14084
|
}
|
|
13979
14085
|
if (status3.state === "behind") {
|
|
13980
14086
|
console.error(
|
|
13981
|
-
|
|
14087
|
+
chalk125.yellow(
|
|
13982
14088
|
`Behind: applied ${status3.applied}, build expects ${status3.expected}.`
|
|
13983
14089
|
)
|
|
13984
14090
|
);
|
|
13985
14091
|
console.error(
|
|
13986
|
-
|
|
14092
|
+
chalk125.yellow(
|
|
13987
14093
|
`Pending: ${status3.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
13988
14094
|
)
|
|
13989
14095
|
);
|
|
13990
14096
|
return;
|
|
13991
14097
|
}
|
|
13992
14098
|
console.error(
|
|
13993
|
-
|
|
14099
|
+
chalk125.red(
|
|
13994
14100
|
`Ahead: applied ${status3.applied}, build knows ${status3.expected}. Update assist.`
|
|
13995
14101
|
)
|
|
13996
14102
|
);
|
|
@@ -14025,7 +14131,7 @@ function registerDb(program2) {
|
|
|
14025
14131
|
|
|
14026
14132
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
14027
14133
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync26 } from "fs";
|
|
14028
|
-
import
|
|
14134
|
+
import chalk126 from "chalk";
|
|
14029
14135
|
|
|
14030
14136
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
14031
14137
|
import { join as join34 } from "path";
|
|
@@ -14056,7 +14162,7 @@ function dbMigrationConfirm(pin) {
|
|
|
14056
14162
|
sweepRestrictedDir();
|
|
14057
14163
|
const state = readMigrationPinState(pin);
|
|
14058
14164
|
if (!state) {
|
|
14059
|
-
console.error(
|
|
14165
|
+
console.error(chalk126.red(`No pending migration unlock for pin: ${pin}`));
|
|
14060
14166
|
process.exitCode = 1;
|
|
14061
14167
|
return;
|
|
14062
14168
|
}
|
|
@@ -14066,7 +14172,7 @@ function dbMigrationConfirm(pin) {
|
|
|
14066
14172
|
);
|
|
14067
14173
|
unlinkSync9(getMigrationPinPath(pin));
|
|
14068
14174
|
console.log(
|
|
14069
|
-
|
|
14175
|
+
chalk126.green(
|
|
14070
14176
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
14071
14177
|
)
|
|
14072
14178
|
);
|
|
@@ -14075,7 +14181,7 @@ function dbMigrationConfirm(pin) {
|
|
|
14075
14181
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
14076
14182
|
import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync27 } from "fs";
|
|
14077
14183
|
import { randomInt as randomInt2 } from "crypto";
|
|
14078
|
-
import
|
|
14184
|
+
import chalk127 from "chalk";
|
|
14079
14185
|
|
|
14080
14186
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
14081
14187
|
function nextMigrationId() {
|
|
@@ -14090,7 +14196,7 @@ function dbMigrationUnlock() {
|
|
|
14090
14196
|
sweepRestrictedDir();
|
|
14091
14197
|
writeFileSync27(getMigrationPinPath(pin), JSON.stringify({ pin, migrationId }));
|
|
14092
14198
|
console.error(
|
|
14093
|
-
|
|
14199
|
+
chalk127.yellow.bold(
|
|
14094
14200
|
"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
14201
|
)
|
|
14096
14202
|
);
|
|
@@ -14100,7 +14206,7 @@ function dbMigrationUnlock() {
|
|
|
14100
14206
|
});
|
|
14101
14207
|
if (!delivered) {
|
|
14102
14208
|
console.error(
|
|
14103
|
-
|
|
14209
|
+
chalk127.red(
|
|
14104
14210
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
14105
14211
|
)
|
|
14106
14212
|
);
|
|
@@ -14110,7 +14216,7 @@ function dbMigrationUnlock() {
|
|
|
14110
14216
|
console.log(
|
|
14111
14217
|
`A confirmation pin was sent to your desktop notifications.
|
|
14112
14218
|
To approve creating migration ${migrationId}, run:
|
|
14113
|
-
${
|
|
14219
|
+
${chalk127.cyan(" assist db-migration confirm <PIN>")}
|
|
14114
14220
|
using the pin from that notification.`
|
|
14115
14221
|
);
|
|
14116
14222
|
}
|
|
@@ -14130,7 +14236,7 @@ function registerDbMigration(parent) {
|
|
|
14130
14236
|
|
|
14131
14237
|
// src/commands/deploy/redirect.ts
|
|
14132
14238
|
import { existsSync as existsSync35, readFileSync as readFileSync29, writeFileSync as writeFileSync28 } from "fs";
|
|
14133
|
-
import
|
|
14239
|
+
import chalk128 from "chalk";
|
|
14134
14240
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
14135
14241
|
if (!window.location.pathname.endsWith('/')) {
|
|
14136
14242
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -14139,23 +14245,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
14139
14245
|
function redirect() {
|
|
14140
14246
|
const indexPath = "index.html";
|
|
14141
14247
|
if (!existsSync35(indexPath)) {
|
|
14142
|
-
console.log(
|
|
14248
|
+
console.log(chalk128.yellow("No index.html found"));
|
|
14143
14249
|
return;
|
|
14144
14250
|
}
|
|
14145
14251
|
const content = readFileSync29(indexPath, "utf8");
|
|
14146
14252
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
14147
|
-
console.log(
|
|
14253
|
+
console.log(chalk128.dim("Trailing slash script already present"));
|
|
14148
14254
|
return;
|
|
14149
14255
|
}
|
|
14150
14256
|
const headCloseIndex = content.indexOf("</head>");
|
|
14151
14257
|
if (headCloseIndex === -1) {
|
|
14152
|
-
console.log(
|
|
14258
|
+
console.log(chalk128.red("Could not find </head> tag in index.html"));
|
|
14153
14259
|
return;
|
|
14154
14260
|
}
|
|
14155
14261
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
14156
14262
|
${content.slice(headCloseIndex)}`;
|
|
14157
14263
|
writeFileSync28(indexPath, newContent);
|
|
14158
|
-
console.log(
|
|
14264
|
+
console.log(chalk128.green("Added trailing slash redirect to index.html"));
|
|
14159
14265
|
}
|
|
14160
14266
|
|
|
14161
14267
|
// src/commands/registerDeploy.ts
|
|
@@ -14182,7 +14288,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
14182
14288
|
|
|
14183
14289
|
// src/commands/devlog/shared.ts
|
|
14184
14290
|
import { execSync as execSync33 } from "child_process";
|
|
14185
|
-
import
|
|
14291
|
+
import chalk129 from "chalk";
|
|
14186
14292
|
|
|
14187
14293
|
// src/shared/getRepoName.ts
|
|
14188
14294
|
import { existsSync as existsSync36, readFileSync as readFileSync30 } from "fs";
|
|
@@ -14291,13 +14397,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
14291
14397
|
}
|
|
14292
14398
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
14293
14399
|
for (const commit2 of commits2) {
|
|
14294
|
-
console.log(` ${
|
|
14400
|
+
console.log(` ${chalk129.yellow(commit2.hash)} ${commit2.message}`);
|
|
14295
14401
|
if (verbose) {
|
|
14296
14402
|
const visibleFiles = commit2.files.filter(
|
|
14297
14403
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
14298
14404
|
);
|
|
14299
14405
|
for (const file of visibleFiles) {
|
|
14300
|
-
console.log(` ${
|
|
14406
|
+
console.log(` ${chalk129.dim(file)}`);
|
|
14301
14407
|
}
|
|
14302
14408
|
}
|
|
14303
14409
|
}
|
|
@@ -14322,15 +14428,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
14322
14428
|
}
|
|
14323
14429
|
|
|
14324
14430
|
// src/commands/devlog/list/printDateHeader.ts
|
|
14325
|
-
import
|
|
14431
|
+
import chalk130 from "chalk";
|
|
14326
14432
|
function printDateHeader(date, isSkipped, entries) {
|
|
14327
14433
|
if (isSkipped) {
|
|
14328
|
-
console.log(`${
|
|
14434
|
+
console.log(`${chalk130.bold.blue(date)} ${chalk130.dim("skipped")}`);
|
|
14329
14435
|
} else if (entries && entries.length > 0) {
|
|
14330
|
-
const entryInfo = entries.map((e) => `${
|
|
14331
|
-
console.log(`${
|
|
14436
|
+
const entryInfo = entries.map((e) => `${chalk130.green(e.version)} ${e.title}`).join(" | ");
|
|
14437
|
+
console.log(`${chalk130.bold.blue(date)} ${entryInfo}`);
|
|
14332
14438
|
} else {
|
|
14333
|
-
console.log(`${
|
|
14439
|
+
console.log(`${chalk130.bold.blue(date)} ${chalk130.red("\u26A0 devlog missing")}`);
|
|
14334
14440
|
}
|
|
14335
14441
|
}
|
|
14336
14442
|
|
|
@@ -14434,24 +14540,24 @@ function bumpVersion(version2, type) {
|
|
|
14434
14540
|
|
|
14435
14541
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
14436
14542
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
14437
|
-
import
|
|
14543
|
+
import chalk132 from "chalk";
|
|
14438
14544
|
|
|
14439
14545
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
14440
|
-
import
|
|
14546
|
+
import chalk131 from "chalk";
|
|
14441
14547
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
14442
14548
|
if (conventional && firstHash) {
|
|
14443
14549
|
const version2 = getVersionAtCommit(firstHash);
|
|
14444
14550
|
if (version2) {
|
|
14445
|
-
console.log(`${
|
|
14551
|
+
console.log(`${chalk131.bold("version:")} ${stripToMinor(version2)}`);
|
|
14446
14552
|
} else {
|
|
14447
|
-
console.log(`${
|
|
14553
|
+
console.log(`${chalk131.bold("version:")} ${chalk131.red("unknown")}`);
|
|
14448
14554
|
}
|
|
14449
14555
|
} else if (patchVersion && minorVersion) {
|
|
14450
14556
|
console.log(
|
|
14451
|
-
`${
|
|
14557
|
+
`${chalk131.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
14452
14558
|
);
|
|
14453
14559
|
} else {
|
|
14454
|
-
console.log(`${
|
|
14560
|
+
console.log(`${chalk131.bold("version:")} v0.1 (initial)`);
|
|
14455
14561
|
}
|
|
14456
14562
|
}
|
|
14457
14563
|
|
|
@@ -14499,16 +14605,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
14499
14605
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
14500
14606
|
}
|
|
14501
14607
|
function logName(repoName) {
|
|
14502
|
-
console.log(`${
|
|
14608
|
+
console.log(`${chalk132.bold("name:")} ${repoName}`);
|
|
14503
14609
|
}
|
|
14504
14610
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
14505
14611
|
logName(ctx.repoName);
|
|
14506
14612
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
14507
|
-
console.log(
|
|
14613
|
+
console.log(chalk132.bold.blue(targetDate));
|
|
14508
14614
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
14509
14615
|
}
|
|
14510
14616
|
function logNoCommits(lastInfo) {
|
|
14511
|
-
console.log(
|
|
14617
|
+
console.log(chalk132.dim(noCommitsMessage(!!lastInfo)));
|
|
14512
14618
|
}
|
|
14513
14619
|
|
|
14514
14620
|
// src/commands/devlog/next/index.ts
|
|
@@ -14549,11 +14655,11 @@ function next2(options2) {
|
|
|
14549
14655
|
import { execSync as execSync35 } from "child_process";
|
|
14550
14656
|
|
|
14551
14657
|
// src/commands/devlog/repos/printReposTable.ts
|
|
14552
|
-
import
|
|
14658
|
+
import chalk133 from "chalk";
|
|
14553
14659
|
function colorStatus(status3) {
|
|
14554
|
-
if (status3 === "missing") return
|
|
14555
|
-
if (status3 === "outdated") return
|
|
14556
|
-
return
|
|
14660
|
+
if (status3 === "missing") return chalk133.red(status3);
|
|
14661
|
+
if (status3 === "outdated") return chalk133.yellow(status3);
|
|
14662
|
+
return chalk133.green(status3);
|
|
14557
14663
|
}
|
|
14558
14664
|
function formatRow(row, nameWidth) {
|
|
14559
14665
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -14567,8 +14673,8 @@ function printReposTable(rows) {
|
|
|
14567
14673
|
"Last Devlog".padEnd(11),
|
|
14568
14674
|
"Status"
|
|
14569
14675
|
].join(" ");
|
|
14570
|
-
console.log(
|
|
14571
|
-
console.log(
|
|
14676
|
+
console.log(chalk133.dim(header));
|
|
14677
|
+
console.log(chalk133.dim("-".repeat(header.length)));
|
|
14572
14678
|
for (const row of rows) {
|
|
14573
14679
|
console.log(formatRow(row, nameWidth));
|
|
14574
14680
|
}
|
|
@@ -14626,14 +14732,14 @@ function repos(options2) {
|
|
|
14626
14732
|
// src/commands/devlog/skip.ts
|
|
14627
14733
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
14628
14734
|
import { join as join38 } from "path";
|
|
14629
|
-
import
|
|
14735
|
+
import chalk134 from "chalk";
|
|
14630
14736
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
14631
14737
|
function getBlogConfigPath() {
|
|
14632
14738
|
return join38(BLOG_REPO_ROOT, "assist.yml");
|
|
14633
14739
|
}
|
|
14634
14740
|
function skip(date) {
|
|
14635
14741
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
14636
|
-
console.log(
|
|
14742
|
+
console.log(chalk134.red("Invalid date format. Use YYYY-MM-DD"));
|
|
14637
14743
|
process.exit(1);
|
|
14638
14744
|
}
|
|
14639
14745
|
const repoName = getRepoName();
|
|
@@ -14644,7 +14750,7 @@ function skip(date) {
|
|
|
14644
14750
|
const skipDays = skip2[repoName] ?? [];
|
|
14645
14751
|
if (skipDays.includes(date)) {
|
|
14646
14752
|
console.log(
|
|
14647
|
-
|
|
14753
|
+
chalk134.yellow(`${date} is already in skip list for ${repoName}`)
|
|
14648
14754
|
);
|
|
14649
14755
|
return;
|
|
14650
14756
|
}
|
|
@@ -14654,20 +14760,20 @@ function skip(date) {
|
|
|
14654
14760
|
devlog.skip = skip2;
|
|
14655
14761
|
config.devlog = devlog;
|
|
14656
14762
|
writeFileSync29(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
14657
|
-
console.log(
|
|
14763
|
+
console.log(chalk134.green(`Added ${date} to skip list for ${repoName}`));
|
|
14658
14764
|
}
|
|
14659
14765
|
|
|
14660
14766
|
// src/commands/devlog/version.ts
|
|
14661
|
-
import
|
|
14767
|
+
import chalk135 from "chalk";
|
|
14662
14768
|
function version() {
|
|
14663
14769
|
const config = loadConfig();
|
|
14664
14770
|
const name = getRepoName();
|
|
14665
14771
|
const lastInfo = getLastVersionInfo(name, config);
|
|
14666
14772
|
const lastVersion = lastInfo?.version ?? null;
|
|
14667
14773
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
14668
|
-
console.log(`${
|
|
14669
|
-
console.log(`${
|
|
14670
|
-
console.log(`${
|
|
14774
|
+
console.log(`${chalk135.bold("name:")} ${name}`);
|
|
14775
|
+
console.log(`${chalk135.bold("last:")} ${lastVersion ?? chalk135.dim("none")}`);
|
|
14776
|
+
console.log(`${chalk135.bold("next:")} ${nextVersion ?? chalk135.dim("none")}`);
|
|
14671
14777
|
}
|
|
14672
14778
|
|
|
14673
14779
|
// src/commands/devlog/devlogConfigHelp.ts
|
|
@@ -14711,7 +14817,7 @@ function registerDevlog(program2) {
|
|
|
14711
14817
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
14712
14818
|
import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync5 } from "fs";
|
|
14713
14819
|
import { join as join39 } from "path";
|
|
14714
|
-
import
|
|
14820
|
+
import chalk136 from "chalk";
|
|
14715
14821
|
|
|
14716
14822
|
// src/shared/findRepoRoot.ts
|
|
14717
14823
|
import { existsSync as existsSync37 } from "fs";
|
|
@@ -14774,14 +14880,14 @@ function checkBuildLocks(startDir) {
|
|
|
14774
14880
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
14775
14881
|
if (locked) {
|
|
14776
14882
|
console.error(
|
|
14777
|
-
|
|
14883
|
+
chalk136.red("Build output locked (is VS debugging?): ") + locked
|
|
14778
14884
|
);
|
|
14779
14885
|
process.exit(1);
|
|
14780
14886
|
}
|
|
14781
14887
|
}
|
|
14782
14888
|
async function checkBuildLocksCommand() {
|
|
14783
14889
|
checkBuildLocks();
|
|
14784
|
-
console.log(
|
|
14890
|
+
console.log(chalk136.green("No build locks detected"));
|
|
14785
14891
|
}
|
|
14786
14892
|
|
|
14787
14893
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -14880,30 +14986,30 @@ function escapeRegex(s) {
|
|
|
14880
14986
|
}
|
|
14881
14987
|
|
|
14882
14988
|
// src/commands/dotnet/printTree.ts
|
|
14883
|
-
import
|
|
14989
|
+
import chalk137 from "chalk";
|
|
14884
14990
|
function printNodes(nodes, prefix2) {
|
|
14885
14991
|
for (let i = 0; i < nodes.length; i++) {
|
|
14886
14992
|
const isLast = i === nodes.length - 1;
|
|
14887
14993
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
14888
14994
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
14889
14995
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
14890
|
-
const label2 = isMissing ?
|
|
14996
|
+
const label2 = isMissing ? chalk137.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
14891
14997
|
console.log(`${prefix2}${connector}${label2}`);
|
|
14892
14998
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
14893
14999
|
}
|
|
14894
15000
|
}
|
|
14895
15001
|
function printTree(tree, totalCount, solutions) {
|
|
14896
|
-
console.log(
|
|
14897
|
-
console.log(
|
|
15002
|
+
console.log(chalk137.bold("\nProject Dependency Tree"));
|
|
15003
|
+
console.log(chalk137.cyan(tree.relativePath));
|
|
14898
15004
|
printNodes(tree.children, "");
|
|
14899
|
-
console.log(
|
|
15005
|
+
console.log(chalk137.dim(`
|
|
14900
15006
|
${totalCount} projects total (including root)`));
|
|
14901
|
-
console.log(
|
|
15007
|
+
console.log(chalk137.bold("\nSolution Membership"));
|
|
14902
15008
|
if (solutions.length === 0) {
|
|
14903
|
-
console.log(
|
|
15009
|
+
console.log(chalk137.yellow(" Not found in any .sln"));
|
|
14904
15010
|
} else {
|
|
14905
15011
|
for (const sln of solutions) {
|
|
14906
|
-
console.log(` ${
|
|
15012
|
+
console.log(` ${chalk137.green(sln)}`);
|
|
14907
15013
|
}
|
|
14908
15014
|
}
|
|
14909
15015
|
console.log();
|
|
@@ -14932,16 +15038,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
14932
15038
|
// src/commands/dotnet/resolveCsproj.ts
|
|
14933
15039
|
import { existsSync as existsSync38 } from "fs";
|
|
14934
15040
|
import path33 from "path";
|
|
14935
|
-
import
|
|
15041
|
+
import chalk138 from "chalk";
|
|
14936
15042
|
function resolveCsproj(csprojPath) {
|
|
14937
15043
|
const resolved = path33.resolve(csprojPath);
|
|
14938
15044
|
if (!existsSync38(resolved)) {
|
|
14939
|
-
console.error(
|
|
15045
|
+
console.error(chalk138.red(`File not found: ${resolved}`));
|
|
14940
15046
|
process.exit(1);
|
|
14941
15047
|
}
|
|
14942
15048
|
const repoRoot = findRepoRoot(path33.dirname(resolved));
|
|
14943
15049
|
if (!repoRoot) {
|
|
14944
|
-
console.error(
|
|
15050
|
+
console.error(chalk138.red("Could not find git repository root"));
|
|
14945
15051
|
process.exit(1);
|
|
14946
15052
|
}
|
|
14947
15053
|
return { resolved, repoRoot };
|
|
@@ -14991,12 +15097,12 @@ function getChangedCsFiles(scope) {
|
|
|
14991
15097
|
}
|
|
14992
15098
|
|
|
14993
15099
|
// src/commands/dotnet/inSln.ts
|
|
14994
|
-
import
|
|
15100
|
+
import chalk139 from "chalk";
|
|
14995
15101
|
async function inSln(csprojPath) {
|
|
14996
15102
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
14997
15103
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
14998
15104
|
if (solutions.length === 0) {
|
|
14999
|
-
console.log(
|
|
15105
|
+
console.log(chalk139.yellow("Not found in any .sln file"));
|
|
15000
15106
|
process.exit(1);
|
|
15001
15107
|
}
|
|
15002
15108
|
for (const sln of solutions) {
|
|
@@ -15005,7 +15111,7 @@ async function inSln(csprojPath) {
|
|
|
15005
15111
|
}
|
|
15006
15112
|
|
|
15007
15113
|
// src/commands/dotnet/inspect.ts
|
|
15008
|
-
import
|
|
15114
|
+
import chalk145 from "chalk";
|
|
15009
15115
|
|
|
15010
15116
|
// src/shared/formatElapsed.ts
|
|
15011
15117
|
function formatElapsed(ms) {
|
|
@@ -15017,12 +15123,12 @@ function formatElapsed(ms) {
|
|
|
15017
15123
|
}
|
|
15018
15124
|
|
|
15019
15125
|
// src/commands/dotnet/displayIssues.ts
|
|
15020
|
-
import
|
|
15126
|
+
import chalk140 from "chalk";
|
|
15021
15127
|
var SEVERITY_COLOR = {
|
|
15022
|
-
ERROR:
|
|
15023
|
-
WARNING:
|
|
15024
|
-
SUGGESTION:
|
|
15025
|
-
HINT:
|
|
15128
|
+
ERROR: chalk140.red,
|
|
15129
|
+
WARNING: chalk140.yellow,
|
|
15130
|
+
SUGGESTION: chalk140.cyan,
|
|
15131
|
+
HINT: chalk140.dim
|
|
15026
15132
|
};
|
|
15027
15133
|
function groupByFile(issues) {
|
|
15028
15134
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -15038,15 +15144,15 @@ function groupByFile(issues) {
|
|
|
15038
15144
|
}
|
|
15039
15145
|
function displayIssues(issues) {
|
|
15040
15146
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
15041
|
-
console.log(
|
|
15147
|
+
console.log(chalk140.bold(file));
|
|
15042
15148
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
15043
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
15149
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk140.white;
|
|
15044
15150
|
console.log(
|
|
15045
|
-
` ${
|
|
15151
|
+
` ${chalk140.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
15046
15152
|
);
|
|
15047
15153
|
}
|
|
15048
15154
|
}
|
|
15049
|
-
console.log(
|
|
15155
|
+
console.log(chalk140.dim(`
|
|
15050
15156
|
${issues.length} issue(s) found`));
|
|
15051
15157
|
}
|
|
15052
15158
|
|
|
@@ -15105,12 +15211,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
15105
15211
|
// src/commands/dotnet/resolveSolution.ts
|
|
15106
15212
|
import { existsSync as existsSync39 } from "fs";
|
|
15107
15213
|
import path34 from "path";
|
|
15108
|
-
import
|
|
15214
|
+
import chalk142 from "chalk";
|
|
15109
15215
|
|
|
15110
15216
|
// src/commands/dotnet/findSolution.ts
|
|
15111
15217
|
import { readdirSync as readdirSync7 } from "fs";
|
|
15112
15218
|
import { dirname as dirname22, join as join40 } from "path";
|
|
15113
|
-
import
|
|
15219
|
+
import chalk141 from "chalk";
|
|
15114
15220
|
function findSlnInDir(dir) {
|
|
15115
15221
|
try {
|
|
15116
15222
|
return readdirSync7(dir).filter((f) => f.endsWith(".sln")).map((f) => join40(dir, f));
|
|
@@ -15126,17 +15232,17 @@ function findSolution() {
|
|
|
15126
15232
|
const slnFiles = findSlnInDir(current);
|
|
15127
15233
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
15128
15234
|
if (slnFiles.length > 1) {
|
|
15129
|
-
console.error(
|
|
15235
|
+
console.error(chalk141.red(`Multiple .sln files found in ${current}:`));
|
|
15130
15236
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
15131
15237
|
console.error(
|
|
15132
|
-
|
|
15238
|
+
chalk141.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
15133
15239
|
);
|
|
15134
15240
|
process.exit(1);
|
|
15135
15241
|
}
|
|
15136
15242
|
if (current === ceiling) break;
|
|
15137
15243
|
current = dirname22(current);
|
|
15138
15244
|
}
|
|
15139
|
-
console.error(
|
|
15245
|
+
console.error(chalk141.red("No .sln file found between cwd and repo root"));
|
|
15140
15246
|
process.exit(1);
|
|
15141
15247
|
}
|
|
15142
15248
|
|
|
@@ -15145,7 +15251,7 @@ function resolveSolution(sln) {
|
|
|
15145
15251
|
if (sln) {
|
|
15146
15252
|
const resolved = path34.resolve(sln);
|
|
15147
15253
|
if (!existsSync39(resolved)) {
|
|
15148
|
-
console.error(
|
|
15254
|
+
console.error(chalk142.red(`Solution file not found: ${resolved}`));
|
|
15149
15255
|
process.exit(1);
|
|
15150
15256
|
}
|
|
15151
15257
|
return resolved;
|
|
@@ -15187,14 +15293,14 @@ import { execSync as execSync37 } from "child_process";
|
|
|
15187
15293
|
import { existsSync as existsSync40, readFileSync as readFileSync34, unlinkSync as unlinkSync10 } from "fs";
|
|
15188
15294
|
import { tmpdir as tmpdir3 } from "os";
|
|
15189
15295
|
import path35 from "path";
|
|
15190
|
-
import
|
|
15296
|
+
import chalk143 from "chalk";
|
|
15191
15297
|
function assertJbInstalled() {
|
|
15192
15298
|
try {
|
|
15193
15299
|
execSync37("jb inspectcode --version", { stdio: "pipe" });
|
|
15194
15300
|
} catch {
|
|
15195
|
-
console.error(
|
|
15301
|
+
console.error(chalk143.red("jb is not installed. Install with:"));
|
|
15196
15302
|
console.error(
|
|
15197
|
-
|
|
15303
|
+
chalk143.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
15198
15304
|
);
|
|
15199
15305
|
process.exit(1);
|
|
15200
15306
|
}
|
|
@@ -15212,11 +15318,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
15212
15318
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
15213
15319
|
process.stderr.write(error.stderr);
|
|
15214
15320
|
}
|
|
15215
|
-
console.error(
|
|
15321
|
+
console.error(chalk143.red("jb inspectcode failed"));
|
|
15216
15322
|
process.exit(1);
|
|
15217
15323
|
}
|
|
15218
15324
|
if (!existsSync40(reportPath)) {
|
|
15219
|
-
console.error(
|
|
15325
|
+
console.error(chalk143.red("Report file not generated"));
|
|
15220
15326
|
process.exit(1);
|
|
15221
15327
|
}
|
|
15222
15328
|
const xml = readFileSync34(reportPath, "utf8");
|
|
@@ -15226,7 +15332,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
15226
15332
|
|
|
15227
15333
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
15228
15334
|
import { execSync as execSync38 } from "child_process";
|
|
15229
|
-
import
|
|
15335
|
+
import chalk144 from "chalk";
|
|
15230
15336
|
function resolveMsbuildPath() {
|
|
15231
15337
|
const { run: run4 } = loadConfig();
|
|
15232
15338
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -15238,9 +15344,9 @@ function assertMsbuildInstalled() {
|
|
|
15238
15344
|
try {
|
|
15239
15345
|
execSync38(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
15240
15346
|
} catch {
|
|
15241
|
-
console.error(
|
|
15347
|
+
console.error(chalk144.red(`msbuild not found at: ${msbuild}`));
|
|
15242
15348
|
console.error(
|
|
15243
|
-
|
|
15349
|
+
chalk144.yellow(
|
|
15244
15350
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
15245
15351
|
)
|
|
15246
15352
|
);
|
|
@@ -15287,17 +15393,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
15287
15393
|
// src/commands/dotnet/inspect.ts
|
|
15288
15394
|
function logScope(changedFiles) {
|
|
15289
15395
|
if (changedFiles === null) {
|
|
15290
|
-
console.log(
|
|
15396
|
+
console.log(chalk145.dim("Inspecting full solution..."));
|
|
15291
15397
|
} else {
|
|
15292
15398
|
console.log(
|
|
15293
|
-
|
|
15399
|
+
chalk145.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
15294
15400
|
);
|
|
15295
15401
|
}
|
|
15296
15402
|
}
|
|
15297
15403
|
function reportResults(issues, elapsed) {
|
|
15298
15404
|
if (issues.length > 0) displayIssues(issues);
|
|
15299
|
-
else console.log(
|
|
15300
|
-
console.log(
|
|
15405
|
+
else console.log(chalk145.green("No issues found"));
|
|
15406
|
+
console.log(chalk145.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
15301
15407
|
if (issues.length > 0) process.exit(1);
|
|
15302
15408
|
}
|
|
15303
15409
|
async function inspect(sln, options2) {
|
|
@@ -15308,7 +15414,7 @@ async function inspect(sln, options2) {
|
|
|
15308
15414
|
const scope = parseScope(options2.scope);
|
|
15309
15415
|
const changedFiles = getChangedCsFiles(scope);
|
|
15310
15416
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
15311
|
-
console.log(
|
|
15417
|
+
console.log(chalk145.green("No changed .cs files found"));
|
|
15312
15418
|
return;
|
|
15313
15419
|
}
|
|
15314
15420
|
logScope(changedFiles);
|
|
@@ -15691,25 +15797,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
15691
15797
|
}
|
|
15692
15798
|
|
|
15693
15799
|
// src/commands/github/printCountTable.ts
|
|
15694
|
-
import
|
|
15800
|
+
import chalk146 from "chalk";
|
|
15695
15801
|
function printCountTable(labelHeader, rows) {
|
|
15696
15802
|
const labelWidth = Math.max(
|
|
15697
15803
|
labelHeader.length,
|
|
15698
15804
|
...rows.map((row) => row.label.length)
|
|
15699
15805
|
);
|
|
15700
15806
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
15701
|
-
console.log(
|
|
15702
|
-
console.log(
|
|
15807
|
+
console.log(chalk146.dim(header));
|
|
15808
|
+
console.log(chalk146.dim("-".repeat(header.length)));
|
|
15703
15809
|
for (const row of rows) {
|
|
15704
15810
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
15705
15811
|
}
|
|
15706
15812
|
}
|
|
15707
15813
|
|
|
15708
15814
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
15709
|
-
import
|
|
15815
|
+
import chalk147 from "chalk";
|
|
15710
15816
|
function printRepoAuthorBreakdown(repos2) {
|
|
15711
15817
|
for (const repo of repos2) {
|
|
15712
|
-
console.log(
|
|
15818
|
+
console.log(chalk147.bold(repo.name));
|
|
15713
15819
|
const authorWidth = Math.max(
|
|
15714
15820
|
0,
|
|
15715
15821
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -16027,7 +16133,7 @@ function registerHandover(program2) {
|
|
|
16027
16133
|
}
|
|
16028
16134
|
|
|
16029
16135
|
// src/commands/jira/acceptanceCriteria.ts
|
|
16030
|
-
import
|
|
16136
|
+
import chalk148 from "chalk";
|
|
16031
16137
|
|
|
16032
16138
|
// src/commands/jira/adfToText.ts
|
|
16033
16139
|
function renderInline(node) {
|
|
@@ -16094,7 +16200,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
16094
16200
|
const parsed = fetchIssue(issueKey, field);
|
|
16095
16201
|
const acValue = parsed?.fields?.[field];
|
|
16096
16202
|
if (!acValue) {
|
|
16097
|
-
console.log(
|
|
16203
|
+
console.log(chalk148.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
16098
16204
|
return;
|
|
16099
16205
|
}
|
|
16100
16206
|
if (typeof acValue === "string") {
|
|
@@ -16160,14 +16266,14 @@ async function jiraAuth() {
|
|
|
16160
16266
|
}
|
|
16161
16267
|
|
|
16162
16268
|
// src/commands/jira/viewIssue.ts
|
|
16163
|
-
import
|
|
16269
|
+
import chalk149 from "chalk";
|
|
16164
16270
|
function viewIssue(issueKey) {
|
|
16165
16271
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
16166
16272
|
const fields = parsed?.fields;
|
|
16167
16273
|
const summary = fields?.summary;
|
|
16168
16274
|
const description = fields?.description;
|
|
16169
16275
|
if (summary) {
|
|
16170
|
-
console.log(
|
|
16276
|
+
console.log(chalk149.bold(summary));
|
|
16171
16277
|
}
|
|
16172
16278
|
if (description) {
|
|
16173
16279
|
if (summary) console.log();
|
|
@@ -16181,7 +16287,7 @@ function viewIssue(issueKey) {
|
|
|
16181
16287
|
}
|
|
16182
16288
|
if (!summary && !description) {
|
|
16183
16289
|
console.log(
|
|
16184
|
-
|
|
16290
|
+
chalk149.yellow(`No summary or description found on ${issueKey}.`)
|
|
16185
16291
|
);
|
|
16186
16292
|
}
|
|
16187
16293
|
}
|
|
@@ -16237,13 +16343,13 @@ function registerRefineLaunch(program2, resumeFlag) {
|
|
|
16237
16343
|
// src/commands/reviewPrComments.ts
|
|
16238
16344
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
16239
16345
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
16240
|
-
import
|
|
16346
|
+
import chalk150 from "chalk";
|
|
16241
16347
|
async function reviewPrComments(number) {
|
|
16242
16348
|
if (number) {
|
|
16243
16349
|
try {
|
|
16244
16350
|
execFileSync5("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
16245
16351
|
} catch {
|
|
16246
|
-
console.error(
|
|
16352
|
+
console.error(chalk150.red(`gh pr checkout ${number} failed; aborting.`));
|
|
16247
16353
|
process.exit(1);
|
|
16248
16354
|
}
|
|
16249
16355
|
}
|
|
@@ -16316,15 +16422,15 @@ function registerList(program2) {
|
|
|
16316
16422
|
// src/commands/mermaid/index.ts
|
|
16317
16423
|
import { mkdirSync as mkdirSync16, readdirSync as readdirSync9 } from "fs";
|
|
16318
16424
|
import { resolve as resolve12 } from "path";
|
|
16319
|
-
import
|
|
16425
|
+
import chalk153 from "chalk";
|
|
16320
16426
|
|
|
16321
16427
|
// src/commands/mermaid/exportFile.ts
|
|
16322
16428
|
import { readFileSync as readFileSync36, writeFileSync as writeFileSync31 } from "fs";
|
|
16323
16429
|
import { basename as basename11, extname, resolve as resolve11 } from "path";
|
|
16324
|
-
import
|
|
16430
|
+
import chalk152 from "chalk";
|
|
16325
16431
|
|
|
16326
16432
|
// src/commands/mermaid/renderBlock.ts
|
|
16327
|
-
import
|
|
16433
|
+
import chalk151 from "chalk";
|
|
16328
16434
|
async function renderBlock(krokiUrl, source) {
|
|
16329
16435
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
16330
16436
|
method: "POST",
|
|
@@ -16333,7 +16439,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
16333
16439
|
});
|
|
16334
16440
|
if (!response.ok) {
|
|
16335
16441
|
console.error(
|
|
16336
|
-
|
|
16442
|
+
chalk151.red(
|
|
16337
16443
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
16338
16444
|
)
|
|
16339
16445
|
);
|
|
@@ -16351,19 +16457,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
16351
16457
|
if (onlyIndex !== void 0) {
|
|
16352
16458
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
16353
16459
|
console.error(
|
|
16354
|
-
|
|
16460
|
+
chalk152.red(
|
|
16355
16461
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
16356
16462
|
)
|
|
16357
16463
|
);
|
|
16358
16464
|
process.exit(1);
|
|
16359
16465
|
}
|
|
16360
16466
|
console.log(
|
|
16361
|
-
|
|
16467
|
+
chalk152.gray(
|
|
16362
16468
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
16363
16469
|
)
|
|
16364
16470
|
);
|
|
16365
16471
|
} else {
|
|
16366
|
-
console.log(
|
|
16472
|
+
console.log(chalk152.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
16367
16473
|
}
|
|
16368
16474
|
for (const [i, source] of blocks.entries()) {
|
|
16369
16475
|
const idx = i + 1;
|
|
@@ -16371,7 +16477,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
16371
16477
|
const outPath = resolve11(outDir, `${stem}-${idx}.svg`);
|
|
16372
16478
|
const svg = await renderBlock(krokiUrl, source);
|
|
16373
16479
|
writeFileSync31(outPath, svg, "utf8");
|
|
16374
|
-
console.log(
|
|
16480
|
+
console.log(chalk152.green(` \u2192 ${outPath}`));
|
|
16375
16481
|
}
|
|
16376
16482
|
}
|
|
16377
16483
|
function extractMermaidBlocks(markdown) {
|
|
@@ -16387,18 +16493,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
16387
16493
|
if (options2.index !== void 0) {
|
|
16388
16494
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
16389
16495
|
console.error(
|
|
16390
|
-
|
|
16496
|
+
chalk153.red(`--index must be a positive integer (got ${options2.index})`)
|
|
16391
16497
|
);
|
|
16392
16498
|
process.exit(1);
|
|
16393
16499
|
}
|
|
16394
16500
|
if (!file) {
|
|
16395
|
-
console.error(
|
|
16501
|
+
console.error(chalk153.red("--index requires a file argument"));
|
|
16396
16502
|
process.exit(1);
|
|
16397
16503
|
}
|
|
16398
16504
|
}
|
|
16399
16505
|
const files = file ? [file] : readdirSync9(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
16400
16506
|
if (files.length === 0) {
|
|
16401
|
-
console.log(
|
|
16507
|
+
console.log(chalk153.gray("No markdown files found in current directory."));
|
|
16402
16508
|
return;
|
|
16403
16509
|
}
|
|
16404
16510
|
for (const f of files) {
|
|
@@ -16431,7 +16537,7 @@ function registerMermaid(program2) {
|
|
|
16431
16537
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
16432
16538
|
import { createServer as createServer2 } from "http";
|
|
16433
16539
|
import { dirname as dirname24 } from "path";
|
|
16434
|
-
import
|
|
16540
|
+
import chalk155 from "chalk";
|
|
16435
16541
|
|
|
16436
16542
|
// src/commands/netcap/corsHeaders.ts
|
|
16437
16543
|
var corsHeaders = {
|
|
@@ -16510,7 +16616,7 @@ function createNetcapHandler(options2) {
|
|
|
16510
16616
|
import { cp, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
|
|
16511
16617
|
import { networkInterfaces } from "os";
|
|
16512
16618
|
import { join as join46 } from "path";
|
|
16513
|
-
import
|
|
16619
|
+
import chalk154 from "chalk";
|
|
16514
16620
|
|
|
16515
16621
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
16516
16622
|
import { dirname as dirname23, join as join45 } from "path";
|
|
@@ -16554,7 +16660,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
16554
16660
|
const host = lanIPv4();
|
|
16555
16661
|
if (!host) {
|
|
16556
16662
|
console.log(
|
|
16557
|
-
|
|
16663
|
+
chalk154.yellow("could not determine the WSL IP for the extension")
|
|
16558
16664
|
);
|
|
16559
16665
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
16560
16666
|
return source;
|
|
@@ -16565,7 +16671,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
16565
16671
|
return WSL_WINDOWS_PATH;
|
|
16566
16672
|
} catch {
|
|
16567
16673
|
console.log(
|
|
16568
|
-
|
|
16674
|
+
chalk154.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
16569
16675
|
);
|
|
16570
16676
|
return source;
|
|
16571
16677
|
}
|
|
@@ -16598,30 +16704,30 @@ async function netcap(options2) {
|
|
|
16598
16704
|
let count7 = 0;
|
|
16599
16705
|
const handler = createNetcapHandler({
|
|
16600
16706
|
outPath,
|
|
16601
|
-
onPing: () => console.log(
|
|
16707
|
+
onPing: () => console.log(chalk155.dim("ping from extension")),
|
|
16602
16708
|
onCapture: (entry) => {
|
|
16603
16709
|
count7 += 1;
|
|
16604
16710
|
console.log(
|
|
16605
|
-
|
|
16606
|
-
|
|
16711
|
+
chalk155.green(`captured #${count7}`),
|
|
16712
|
+
chalk155.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
16607
16713
|
);
|
|
16608
16714
|
}
|
|
16609
16715
|
});
|
|
16610
16716
|
const server = createServer2(handler);
|
|
16611
16717
|
server.listen(port, () => {
|
|
16612
16718
|
console.log(
|
|
16613
|
-
|
|
16719
|
+
chalk155.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
16614
16720
|
);
|
|
16615
|
-
console.log(
|
|
16721
|
+
console.log(chalk155.dim(`appending captures to ${outPath}`));
|
|
16616
16722
|
if (filter)
|
|
16617
|
-
console.log(
|
|
16618
|
-
console.log(
|
|
16619
|
-
console.log(
|
|
16723
|
+
console.log(chalk155.dim(`forwarding only URLs matching "${filter}"`));
|
|
16724
|
+
console.log(chalk155.dim(`load the unpacked extension from ${extensionPath}`));
|
|
16725
|
+
console.log(chalk155.dim("press Ctrl-C to stop"));
|
|
16620
16726
|
});
|
|
16621
16727
|
process.on("SIGINT", () => {
|
|
16622
16728
|
server.close();
|
|
16623
16729
|
console.log(
|
|
16624
|
-
|
|
16730
|
+
chalk155.bold(
|
|
16625
16731
|
`
|
|
16626
16732
|
netcap stopped \u2014 captured ${count7} ${count7 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
16627
16733
|
)
|
|
@@ -16633,7 +16739,7 @@ netcap stopped \u2014 captured ${count7} ${count7 === 1 ? "entry" : "entries"} t
|
|
|
16633
16739
|
// src/commands/netcap/netcapExtract.ts
|
|
16634
16740
|
import { writeFileSync as writeFileSync32 } from "fs";
|
|
16635
16741
|
import { join as join49 } from "path";
|
|
16636
|
-
import
|
|
16742
|
+
import chalk156 from "chalk";
|
|
16637
16743
|
|
|
16638
16744
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
16639
16745
|
import { readFileSync as readFileSync37 } from "fs";
|
|
@@ -17081,8 +17187,8 @@ function netcapExtract(file) {
|
|
|
17081
17187
|
writeFileSync32(outFile, `${JSON.stringify(posts, null, 2)}
|
|
17082
17188
|
`);
|
|
17083
17189
|
console.log(
|
|
17084
|
-
|
|
17085
|
-
|
|
17190
|
+
chalk156.green(`extracted ${posts.length} posts`),
|
|
17191
|
+
chalk156.dim(`-> ${outFile}`)
|
|
17086
17192
|
);
|
|
17087
17193
|
}
|
|
17088
17194
|
|
|
@@ -17103,7 +17209,7 @@ function registerNetcap(program2) {
|
|
|
17103
17209
|
}
|
|
17104
17210
|
|
|
17105
17211
|
// src/commands/news/add/index.ts
|
|
17106
|
-
import
|
|
17212
|
+
import chalk157 from "chalk";
|
|
17107
17213
|
import enquirer8 from "enquirer";
|
|
17108
17214
|
async function add2(url) {
|
|
17109
17215
|
if (!url) {
|
|
@@ -17125,10 +17231,10 @@ async function add2(url) {
|
|
|
17125
17231
|
const { orm } = await getReady();
|
|
17126
17232
|
const added = await addFeed(orm, url);
|
|
17127
17233
|
if (!added) {
|
|
17128
|
-
console.log(
|
|
17234
|
+
console.log(chalk157.yellow("Feed already exists"));
|
|
17129
17235
|
return;
|
|
17130
17236
|
}
|
|
17131
|
-
console.log(
|
|
17237
|
+
console.log(chalk157.green(`Added feed: ${url}`));
|
|
17132
17238
|
}
|
|
17133
17239
|
|
|
17134
17240
|
// src/commands/registerNews.ts
|
|
@@ -17175,7 +17281,7 @@ function registerPiHook(program2) {
|
|
|
17175
17281
|
}
|
|
17176
17282
|
|
|
17177
17283
|
// src/commands/prompts/printPromptsTable.ts
|
|
17178
|
-
import
|
|
17284
|
+
import chalk158 from "chalk";
|
|
17179
17285
|
function truncate(str, max) {
|
|
17180
17286
|
if (str.length <= max) return str;
|
|
17181
17287
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -17193,14 +17299,14 @@ function printPromptsTable(rows) {
|
|
|
17193
17299
|
"Command".padEnd(commandWidth),
|
|
17194
17300
|
"Repos"
|
|
17195
17301
|
].join(" ");
|
|
17196
|
-
console.log(
|
|
17197
|
-
console.log(
|
|
17302
|
+
console.log(chalk158.dim(header));
|
|
17303
|
+
console.log(chalk158.dim("-".repeat(header.length)));
|
|
17198
17304
|
for (const row of rows) {
|
|
17199
17305
|
const count7 = String(row.count).padStart(countWidth);
|
|
17200
17306
|
const tool = row.tool.padEnd(toolWidth);
|
|
17201
17307
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
17202
17308
|
console.log(
|
|
17203
|
-
`${
|
|
17309
|
+
`${chalk158.yellow(count7)} ${tool} ${command} ${chalk158.dim(row.repos)}`
|
|
17204
17310
|
);
|
|
17205
17311
|
}
|
|
17206
17312
|
}
|
|
@@ -17767,20 +17873,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
17767
17873
|
}
|
|
17768
17874
|
|
|
17769
17875
|
// src/commands/prs/listComments/printComments.ts
|
|
17770
|
-
import
|
|
17876
|
+
import chalk159 from "chalk";
|
|
17771
17877
|
function formatForHuman(comment3) {
|
|
17772
17878
|
if (comment3.type === "review") {
|
|
17773
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
17879
|
+
const stateColor = comment3.state === "APPROVED" ? chalk159.green : comment3.state === "CHANGES_REQUESTED" ? chalk159.red : chalk159.yellow;
|
|
17774
17880
|
return [
|
|
17775
|
-
`${
|
|
17881
|
+
`${chalk159.cyan("Review")} by ${chalk159.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
17776
17882
|
comment3.body,
|
|
17777
17883
|
""
|
|
17778
17884
|
].join("\n");
|
|
17779
17885
|
}
|
|
17780
17886
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
17781
17887
|
return [
|
|
17782
|
-
`${
|
|
17783
|
-
|
|
17888
|
+
`${chalk159.cyan("Line comment")} by ${chalk159.bold(comment3.user)} on ${chalk159.dim(`${comment3.path}${location}`)}`,
|
|
17889
|
+
chalk159.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
17784
17890
|
comment3.body,
|
|
17785
17891
|
""
|
|
17786
17892
|
].join("\n");
|
|
@@ -17870,13 +17976,13 @@ import { execSync as execSync46 } from "child_process";
|
|
|
17870
17976
|
import enquirer9 from "enquirer";
|
|
17871
17977
|
|
|
17872
17978
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
17873
|
-
import
|
|
17979
|
+
import chalk160 from "chalk";
|
|
17874
17980
|
var STATUS_MAP = {
|
|
17875
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
17876
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
17981
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk160.magenta("merged"), date: pr.mergedAt } : null,
|
|
17982
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk160.red("closed"), date: pr.closedAt } : null
|
|
17877
17983
|
};
|
|
17878
17984
|
function defaultStatus(pr) {
|
|
17879
|
-
return { label:
|
|
17985
|
+
return { label: chalk160.green("opened"), date: pr.createdAt };
|
|
17880
17986
|
}
|
|
17881
17987
|
function getStatus2(pr) {
|
|
17882
17988
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -17885,11 +17991,11 @@ function formatDate(dateStr) {
|
|
|
17885
17991
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
17886
17992
|
}
|
|
17887
17993
|
function formatPrHeader(pr, status3) {
|
|
17888
|
-
return `${
|
|
17994
|
+
return `${chalk160.cyan(`#${pr.number}`)} ${pr.title} ${chalk160.dim(`(${pr.author.login},`)} ${status3.label} ${chalk160.dim(`${formatDate(status3.date)})`)}`;
|
|
17889
17995
|
}
|
|
17890
17996
|
function logPrDetails(pr) {
|
|
17891
17997
|
console.log(
|
|
17892
|
-
|
|
17998
|
+
chalk160.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
17893
17999
|
);
|
|
17894
18000
|
console.log();
|
|
17895
18001
|
}
|
|
@@ -18238,10 +18344,10 @@ function registerPrs(program2) {
|
|
|
18238
18344
|
}
|
|
18239
18345
|
|
|
18240
18346
|
// src/commands/ravendb/ravendbAuth.ts
|
|
18241
|
-
import
|
|
18347
|
+
import chalk166 from "chalk";
|
|
18242
18348
|
|
|
18243
18349
|
// src/shared/createConnectionAuth.ts
|
|
18244
|
-
import
|
|
18350
|
+
import chalk161 from "chalk";
|
|
18245
18351
|
function listConnections(connections, format) {
|
|
18246
18352
|
if (connections.length === 0) {
|
|
18247
18353
|
console.log("No connections configured.");
|
|
@@ -18254,7 +18360,7 @@ function listConnections(connections, format) {
|
|
|
18254
18360
|
function removeConnection(connections, name, save) {
|
|
18255
18361
|
const filtered = connections.filter((c) => c.name !== name);
|
|
18256
18362
|
if (filtered.length === connections.length) {
|
|
18257
|
-
console.error(
|
|
18363
|
+
console.error(chalk161.red(`Connection "${name}" not found.`));
|
|
18258
18364
|
process.exit(1);
|
|
18259
18365
|
}
|
|
18260
18366
|
save(filtered);
|
|
@@ -18300,15 +18406,15 @@ function saveConnections(connections) {
|
|
|
18300
18406
|
}
|
|
18301
18407
|
|
|
18302
18408
|
// src/commands/ravendb/promptConnection.ts
|
|
18303
|
-
import
|
|
18409
|
+
import chalk164 from "chalk";
|
|
18304
18410
|
|
|
18305
18411
|
// src/commands/ravendb/selectOpSecret.ts
|
|
18306
|
-
import
|
|
18412
|
+
import chalk163 from "chalk";
|
|
18307
18413
|
import Enquirer2 from "enquirer";
|
|
18308
18414
|
|
|
18309
18415
|
// src/commands/ravendb/searchItems.ts
|
|
18310
18416
|
import { execSync as execSync49 } from "child_process";
|
|
18311
|
-
import
|
|
18417
|
+
import chalk162 from "chalk";
|
|
18312
18418
|
function opExec(args) {
|
|
18313
18419
|
return execSync49(`op ${args}`, {
|
|
18314
18420
|
encoding: "utf8",
|
|
@@ -18321,7 +18427,7 @@ function searchItems(search2) {
|
|
|
18321
18427
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
18322
18428
|
} catch {
|
|
18323
18429
|
console.error(
|
|
18324
|
-
|
|
18430
|
+
chalk162.red(
|
|
18325
18431
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
18326
18432
|
)
|
|
18327
18433
|
);
|
|
@@ -18335,7 +18441,7 @@ function getItemFields(itemId2) {
|
|
|
18335
18441
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
18336
18442
|
return item.fields.filter((f) => f.reference && f.label);
|
|
18337
18443
|
} catch {
|
|
18338
|
-
console.error(
|
|
18444
|
+
console.error(chalk162.red("Failed to get item details from 1Password."));
|
|
18339
18445
|
process.exit(1);
|
|
18340
18446
|
}
|
|
18341
18447
|
}
|
|
@@ -18354,7 +18460,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
18354
18460
|
}).run();
|
|
18355
18461
|
const items2 = searchItems(search2);
|
|
18356
18462
|
if (items2.length === 0) {
|
|
18357
|
-
console.error(
|
|
18463
|
+
console.error(chalk163.red(`No items found matching "${search2}".`));
|
|
18358
18464
|
process.exit(1);
|
|
18359
18465
|
}
|
|
18360
18466
|
const itemId2 = await selectOne(
|
|
@@ -18363,7 +18469,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
18363
18469
|
);
|
|
18364
18470
|
const fields = getItemFields(itemId2);
|
|
18365
18471
|
if (fields.length === 0) {
|
|
18366
|
-
console.error(
|
|
18472
|
+
console.error(chalk163.red("No fields with references found on this item."));
|
|
18367
18473
|
process.exit(1);
|
|
18368
18474
|
}
|
|
18369
18475
|
const ref = await selectOne(
|
|
@@ -18377,7 +18483,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
18377
18483
|
async function promptConnection(existingNames) {
|
|
18378
18484
|
const name = await promptInput("name", "Connection name:");
|
|
18379
18485
|
if (existingNames.includes(name)) {
|
|
18380
|
-
console.error(
|
|
18486
|
+
console.error(chalk164.red(`Connection "${name}" already exists.`));
|
|
18381
18487
|
process.exit(1);
|
|
18382
18488
|
}
|
|
18383
18489
|
const url = await promptInput(
|
|
@@ -18386,22 +18492,22 @@ async function promptConnection(existingNames) {
|
|
|
18386
18492
|
);
|
|
18387
18493
|
const database = await promptInput("database", "Database name:");
|
|
18388
18494
|
if (!name || !url || !database) {
|
|
18389
|
-
console.error(
|
|
18495
|
+
console.error(chalk164.red("All fields are required."));
|
|
18390
18496
|
process.exit(1);
|
|
18391
18497
|
}
|
|
18392
18498
|
const apiKeyRef = await selectOpSecret();
|
|
18393
|
-
console.log(
|
|
18499
|
+
console.log(chalk164.dim(`Using: ${apiKeyRef}`));
|
|
18394
18500
|
return { name, url, database, apiKeyRef };
|
|
18395
18501
|
}
|
|
18396
18502
|
|
|
18397
18503
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
18398
|
-
import
|
|
18504
|
+
import chalk165 from "chalk";
|
|
18399
18505
|
function ravendbSetConnection(name) {
|
|
18400
18506
|
const raw = loadGlobalConfigRaw();
|
|
18401
18507
|
const ravendb = raw.ravendb ?? {};
|
|
18402
18508
|
const connections = ravendb.connections ?? [];
|
|
18403
18509
|
if (!connections.some((c) => c.name === name)) {
|
|
18404
|
-
console.error(
|
|
18510
|
+
console.error(chalk165.red(`Connection "${name}" not found.`));
|
|
18405
18511
|
console.error(
|
|
18406
18512
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
18407
18513
|
);
|
|
@@ -18417,16 +18523,16 @@ function ravendbSetConnection(name) {
|
|
|
18417
18523
|
var ravendbAuth = createConnectionAuth({
|
|
18418
18524
|
load: loadConnections,
|
|
18419
18525
|
save: saveConnections,
|
|
18420
|
-
format: (c) => `${
|
|
18526
|
+
format: (c) => `${chalk166.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
18421
18527
|
promptNew: promptConnection,
|
|
18422
18528
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
18423
18529
|
});
|
|
18424
18530
|
|
|
18425
18531
|
// src/commands/ravendb/ravendbCollections.ts
|
|
18426
|
-
import
|
|
18532
|
+
import chalk170 from "chalk";
|
|
18427
18533
|
|
|
18428
18534
|
// src/commands/ravendb/ravenFetch.ts
|
|
18429
|
-
import
|
|
18535
|
+
import chalk168 from "chalk";
|
|
18430
18536
|
|
|
18431
18537
|
// src/commands/ravendb/getAccessToken.ts
|
|
18432
18538
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -18463,10 +18569,10 @@ ${errorText}`
|
|
|
18463
18569
|
|
|
18464
18570
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
18465
18571
|
import { execSync as execSync50 } from "child_process";
|
|
18466
|
-
import
|
|
18572
|
+
import chalk167 from "chalk";
|
|
18467
18573
|
function resolveOpSecret(reference) {
|
|
18468
18574
|
if (!reference.startsWith("op://")) {
|
|
18469
|
-
console.error(
|
|
18575
|
+
console.error(chalk167.red(`Invalid secret reference: must start with op://`));
|
|
18470
18576
|
process.exit(1);
|
|
18471
18577
|
}
|
|
18472
18578
|
try {
|
|
@@ -18476,7 +18582,7 @@ function resolveOpSecret(reference) {
|
|
|
18476
18582
|
}).trim();
|
|
18477
18583
|
} catch {
|
|
18478
18584
|
console.error(
|
|
18479
|
-
|
|
18585
|
+
chalk167.red(
|
|
18480
18586
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
18481
18587
|
)
|
|
18482
18588
|
);
|
|
@@ -18503,7 +18609,7 @@ async function ravenFetch(connection, path71) {
|
|
|
18503
18609
|
if (!response.ok) {
|
|
18504
18610
|
const body = await response.text();
|
|
18505
18611
|
console.error(
|
|
18506
|
-
|
|
18612
|
+
chalk168.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
18507
18613
|
);
|
|
18508
18614
|
console.error(body.substring(0, 500));
|
|
18509
18615
|
process.exit(1);
|
|
@@ -18512,7 +18618,7 @@ async function ravenFetch(connection, path71) {
|
|
|
18512
18618
|
}
|
|
18513
18619
|
|
|
18514
18620
|
// src/commands/ravendb/resolveConnection.ts
|
|
18515
|
-
import
|
|
18621
|
+
import chalk169 from "chalk";
|
|
18516
18622
|
function loadRavendb() {
|
|
18517
18623
|
const raw = loadGlobalConfigRaw();
|
|
18518
18624
|
const ravendb = raw.ravendb;
|
|
@@ -18526,7 +18632,7 @@ function resolveConnection(name) {
|
|
|
18526
18632
|
const connectionName = name ?? defaultConnection;
|
|
18527
18633
|
if (!connectionName) {
|
|
18528
18634
|
console.error(
|
|
18529
|
-
|
|
18635
|
+
chalk169.red(
|
|
18530
18636
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
18531
18637
|
)
|
|
18532
18638
|
);
|
|
@@ -18534,7 +18640,7 @@ function resolveConnection(name) {
|
|
|
18534
18640
|
}
|
|
18535
18641
|
const connection = connections.find((c) => c.name === connectionName);
|
|
18536
18642
|
if (!connection) {
|
|
18537
|
-
console.error(
|
|
18643
|
+
console.error(chalk169.red(`Connection "${connectionName}" not found.`));
|
|
18538
18644
|
console.error(
|
|
18539
18645
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
18540
18646
|
);
|
|
@@ -18565,7 +18671,7 @@ async function ravendbCollections(connectionName) {
|
|
|
18565
18671
|
return;
|
|
18566
18672
|
}
|
|
18567
18673
|
for (const c of collections) {
|
|
18568
|
-
console.log(`${
|
|
18674
|
+
console.log(`${chalk170.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
18569
18675
|
}
|
|
18570
18676
|
}
|
|
18571
18677
|
|
|
@@ -18584,10 +18690,10 @@ var ravendbConfigHelp = [
|
|
|
18584
18690
|
];
|
|
18585
18691
|
|
|
18586
18692
|
// src/commands/ravendb/ravendbQuery.ts
|
|
18587
|
-
import
|
|
18693
|
+
import chalk172 from "chalk";
|
|
18588
18694
|
|
|
18589
18695
|
// src/commands/ravendb/fetchAllPages.ts
|
|
18590
|
-
import
|
|
18696
|
+
import chalk171 from "chalk";
|
|
18591
18697
|
|
|
18592
18698
|
// src/commands/ravendb/buildQueryPath.ts
|
|
18593
18699
|
function buildQueryPath(opts) {
|
|
@@ -18625,7 +18731,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
18625
18731
|
allResults.push(...results);
|
|
18626
18732
|
start3 += results.length;
|
|
18627
18733
|
process.stderr.write(
|
|
18628
|
-
`\r${
|
|
18734
|
+
`\r${chalk171.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
18629
18735
|
);
|
|
18630
18736
|
if (start3 >= totalResults) break;
|
|
18631
18737
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -18640,7 +18746,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
18640
18746
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
18641
18747
|
const resolved = resolveArgs(connectionName, collection);
|
|
18642
18748
|
if (!resolved.collection && !options2.query) {
|
|
18643
|
-
console.error(
|
|
18749
|
+
console.error(chalk172.red("Provide a collection name or --query filter."));
|
|
18644
18750
|
process.exit(1);
|
|
18645
18751
|
}
|
|
18646
18752
|
const { collection: col } = resolved;
|
|
@@ -18679,7 +18785,7 @@ import { spawn as spawn5 } from "child_process";
|
|
|
18679
18785
|
import * as path36 from "path";
|
|
18680
18786
|
|
|
18681
18787
|
// src/commands/refactor/logViolations.ts
|
|
18682
|
-
import
|
|
18788
|
+
import chalk173 from "chalk";
|
|
18683
18789
|
var DEFAULT_MAX_LINES = 100;
|
|
18684
18790
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
18685
18791
|
if (violations.length === 0) {
|
|
@@ -18688,43 +18794,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
18688
18794
|
}
|
|
18689
18795
|
return;
|
|
18690
18796
|
}
|
|
18691
|
-
console.error(
|
|
18797
|
+
console.error(chalk173.red(`
|
|
18692
18798
|
Refactor check failed:
|
|
18693
18799
|
`));
|
|
18694
|
-
console.error(
|
|
18800
|
+
console.error(chalk173.red(` The following files exceed ${maxLines} lines:
|
|
18695
18801
|
`));
|
|
18696
18802
|
for (const violation of violations) {
|
|
18697
|
-
console.error(
|
|
18803
|
+
console.error(chalk173.red(` ${violation.file} (${violation.lines} lines)`));
|
|
18698
18804
|
}
|
|
18699
18805
|
console.error(
|
|
18700
|
-
|
|
18806
|
+
chalk173.yellow(
|
|
18701
18807
|
`
|
|
18702
18808
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
18703
18809
|
way to refactor it, ignore it with:
|
|
18704
18810
|
`
|
|
18705
18811
|
)
|
|
18706
18812
|
);
|
|
18707
|
-
console.error(
|
|
18813
|
+
console.error(chalk173.gray(` assist refactor ignore <file>
|
|
18708
18814
|
`));
|
|
18709
18815
|
if (process.env.CLAUDECODE) {
|
|
18710
|
-
console.error(
|
|
18816
|
+
console.error(chalk173.cyan(`
|
|
18711
18817
|
## Extracting Code to New Files
|
|
18712
18818
|
`));
|
|
18713
18819
|
console.error(
|
|
18714
|
-
|
|
18820
|
+
chalk173.cyan(
|
|
18715
18821
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
18716
18822
|
`
|
|
18717
18823
|
)
|
|
18718
18824
|
);
|
|
18719
18825
|
console.error(
|
|
18720
|
-
|
|
18826
|
+
chalk173.cyan(
|
|
18721
18827
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
18722
18828
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
18723
18829
|
`
|
|
18724
18830
|
)
|
|
18725
18831
|
);
|
|
18726
18832
|
console.error(
|
|
18727
|
-
|
|
18833
|
+
chalk173.cyan(
|
|
18728
18834
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
18729
18835
|
domains, move it to a common/shared folder.
|
|
18730
18836
|
`
|
|
@@ -18880,7 +18986,7 @@ async function check(pattern2, options2) {
|
|
|
18880
18986
|
|
|
18881
18987
|
// src/commands/refactor/extract/index.ts
|
|
18882
18988
|
import path44 from "path";
|
|
18883
|
-
import
|
|
18989
|
+
import chalk176 from "chalk";
|
|
18884
18990
|
|
|
18885
18991
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
18886
18992
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -19479,23 +19585,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
19479
19585
|
|
|
19480
19586
|
// src/commands/refactor/extract/displayPlan.ts
|
|
19481
19587
|
import path40 from "path";
|
|
19482
|
-
import
|
|
19588
|
+
import chalk174 from "chalk";
|
|
19483
19589
|
function section2(title) {
|
|
19484
19590
|
return `
|
|
19485
|
-
${
|
|
19591
|
+
${chalk174.cyan(title)}`;
|
|
19486
19592
|
}
|
|
19487
19593
|
function displayImporters(plan2, cwd) {
|
|
19488
19594
|
if (plan2.importersToUpdate.length === 0) return;
|
|
19489
19595
|
console.log(section2("Update importers:"));
|
|
19490
19596
|
for (const imp of plan2.importersToUpdate) {
|
|
19491
19597
|
const rel = path40.relative(cwd, imp.file.getFilePath());
|
|
19492
|
-
console.log(` ${
|
|
19598
|
+
console.log(` ${chalk174.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
19493
19599
|
}
|
|
19494
19600
|
}
|
|
19495
19601
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
19496
|
-
console.log(
|
|
19602
|
+
console.log(chalk174.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
19497
19603
|
`));
|
|
19498
|
-
console.log(` ${
|
|
19604
|
+
console.log(` ${chalk174.cyan("Functions to move:")}`);
|
|
19499
19605
|
for (const name of plan2.extractedNames) {
|
|
19500
19606
|
console.log(` ${name}`);
|
|
19501
19607
|
}
|
|
@@ -19529,7 +19635,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
19529
19635
|
|
|
19530
19636
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
19531
19637
|
import path43 from "path";
|
|
19532
|
-
import
|
|
19638
|
+
import chalk175 from "chalk";
|
|
19533
19639
|
import { Project as Project4 } from "ts-morph";
|
|
19534
19640
|
|
|
19535
19641
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -19621,7 +19727,7 @@ function loadProjectFile(file) {
|
|
|
19621
19727
|
});
|
|
19622
19728
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
19623
19729
|
if (!sourceFile) {
|
|
19624
|
-
console.log(
|
|
19730
|
+
console.log(chalk175.red(`File not found in project: ${file}`));
|
|
19625
19731
|
process.exit(1);
|
|
19626
19732
|
}
|
|
19627
19733
|
return { project, sourceFile };
|
|
@@ -19644,19 +19750,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
19644
19750
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
19645
19751
|
if (options2.apply) {
|
|
19646
19752
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
19647
|
-
console.log(
|
|
19753
|
+
console.log(chalk176.green("\nExtraction complete"));
|
|
19648
19754
|
} else {
|
|
19649
|
-
console.log(
|
|
19755
|
+
console.log(chalk176.dim("\nDry run. Use --apply to execute."));
|
|
19650
19756
|
}
|
|
19651
19757
|
}
|
|
19652
19758
|
|
|
19653
19759
|
// src/commands/refactor/ignore.ts
|
|
19654
19760
|
import fs28 from "fs";
|
|
19655
|
-
import
|
|
19761
|
+
import chalk177 from "chalk";
|
|
19656
19762
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
19657
19763
|
function ignore2(file) {
|
|
19658
19764
|
if (!fs28.existsSync(file)) {
|
|
19659
|
-
console.error(
|
|
19765
|
+
console.error(chalk177.red(`Error: File does not exist: ${file}`));
|
|
19660
19766
|
process.exit(1);
|
|
19661
19767
|
}
|
|
19662
19768
|
const content = fs28.readFileSync(file, "utf8");
|
|
@@ -19672,7 +19778,7 @@ function ignore2(file) {
|
|
|
19672
19778
|
fs28.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
19673
19779
|
}
|
|
19674
19780
|
console.log(
|
|
19675
|
-
|
|
19781
|
+
chalk177.green(
|
|
19676
19782
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
19677
19783
|
)
|
|
19678
19784
|
);
|
|
@@ -19681,12 +19787,12 @@ function ignore2(file) {
|
|
|
19681
19787
|
// src/commands/refactor/rename/index.ts
|
|
19682
19788
|
import fs31 from "fs";
|
|
19683
19789
|
import path49 from "path";
|
|
19684
|
-
import
|
|
19790
|
+
import chalk180 from "chalk";
|
|
19685
19791
|
|
|
19686
19792
|
// src/commands/refactor/rename/applyRename.ts
|
|
19687
19793
|
import fs30 from "fs";
|
|
19688
19794
|
import path46 from "path";
|
|
19689
|
-
import
|
|
19795
|
+
import chalk178 from "chalk";
|
|
19690
19796
|
|
|
19691
19797
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
19692
19798
|
import path45 from "path";
|
|
@@ -19791,13 +19897,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
19791
19897
|
const updatedContents = applyRewrites(rewrites);
|
|
19792
19898
|
for (const [file, content] of updatedContents) {
|
|
19793
19899
|
fs30.writeFileSync(file, content, "utf8");
|
|
19794
|
-
console.log(
|
|
19900
|
+
console.log(chalk178.cyan(` Updated imports in ${path46.relative(cwd, file)}`));
|
|
19795
19901
|
}
|
|
19796
19902
|
const destDir = path46.dirname(destPath);
|
|
19797
19903
|
if (!fs30.existsSync(destDir)) fs30.mkdirSync(destDir, { recursive: true });
|
|
19798
19904
|
fs30.renameSync(sourcePath, destPath);
|
|
19799
19905
|
console.log(
|
|
19800
|
-
|
|
19906
|
+
chalk178.white(
|
|
19801
19907
|
` Moved ${path46.relative(cwd, sourcePath)} \u2192 ${path46.relative(cwd, destPath)}`
|
|
19802
19908
|
)
|
|
19803
19909
|
);
|
|
@@ -19884,16 +19990,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
19884
19990
|
|
|
19885
19991
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
19886
19992
|
import path48 from "path";
|
|
19887
|
-
import
|
|
19993
|
+
import chalk179 from "chalk";
|
|
19888
19994
|
function printRenamePreview(rewrites, cwd) {
|
|
19889
19995
|
for (const rewrite of rewrites) {
|
|
19890
19996
|
console.log(
|
|
19891
|
-
|
|
19997
|
+
chalk179.dim(
|
|
19892
19998
|
` ${path48.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
19893
19999
|
)
|
|
19894
20000
|
);
|
|
19895
20001
|
}
|
|
19896
|
-
console.log(
|
|
20002
|
+
console.log(chalk179.dim("Dry run. Use --apply to execute."));
|
|
19897
20003
|
}
|
|
19898
20004
|
|
|
19899
20005
|
// src/commands/refactor/rename/index.ts
|
|
@@ -19904,20 +20010,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
19904
20010
|
const relSource = path49.relative(cwd, sourcePath);
|
|
19905
20011
|
const relDest = path49.relative(cwd, destPath);
|
|
19906
20012
|
if (!fs31.existsSync(sourcePath)) {
|
|
19907
|
-
console.log(
|
|
20013
|
+
console.log(chalk180.red(`File not found: ${source}`));
|
|
19908
20014
|
process.exit(1);
|
|
19909
20015
|
}
|
|
19910
20016
|
if (destPath !== sourcePath && fs31.existsSync(destPath)) {
|
|
19911
|
-
console.log(
|
|
20017
|
+
console.log(chalk180.red(`Destination already exists: ${destination}`));
|
|
19912
20018
|
process.exit(1);
|
|
19913
20019
|
}
|
|
19914
|
-
console.log(
|
|
19915
|
-
console.log(
|
|
19916
|
-
console.log(
|
|
20020
|
+
console.log(chalk180.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
20021
|
+
console.log(chalk180.dim("Loading project..."));
|
|
20022
|
+
console.log(chalk180.dim("Scanning imports across the project..."));
|
|
19917
20023
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
19918
20024
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
19919
20025
|
console.log(
|
|
19920
|
-
|
|
20026
|
+
chalk180.dim(
|
|
19921
20027
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
19922
20028
|
)
|
|
19923
20029
|
);
|
|
@@ -19926,11 +20032,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
19926
20032
|
return;
|
|
19927
20033
|
}
|
|
19928
20034
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
19929
|
-
console.log(
|
|
20035
|
+
console.log(chalk180.green("Done"));
|
|
19930
20036
|
}
|
|
19931
20037
|
|
|
19932
20038
|
// src/commands/refactor/renameSymbol/index.ts
|
|
19933
|
-
import
|
|
20039
|
+
import chalk181 from "chalk";
|
|
19934
20040
|
|
|
19935
20041
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
19936
20042
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -19976,33 +20082,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
19976
20082
|
const { project, sourceFile } = loadProjectFile(file);
|
|
19977
20083
|
const symbol = findSymbol(sourceFile, oldName);
|
|
19978
20084
|
if (!symbol) {
|
|
19979
|
-
console.log(
|
|
20085
|
+
console.log(chalk181.red(`Symbol "${oldName}" not found in ${file}`));
|
|
19980
20086
|
process.exit(1);
|
|
19981
20087
|
}
|
|
19982
20088
|
const grouped = groupReferences(symbol, cwd);
|
|
19983
20089
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
19984
20090
|
console.log(
|
|
19985
|
-
|
|
20091
|
+
chalk181.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
19986
20092
|
`)
|
|
19987
20093
|
);
|
|
19988
20094
|
for (const [refFile, lines] of grouped) {
|
|
19989
20095
|
console.log(
|
|
19990
|
-
` ${
|
|
20096
|
+
` ${chalk181.dim(refFile)}: lines ${chalk181.cyan(lines.join(", "))}`
|
|
19991
20097
|
);
|
|
19992
20098
|
}
|
|
19993
20099
|
if (options2.apply) {
|
|
19994
20100
|
symbol.rename(newName);
|
|
19995
20101
|
await project.save();
|
|
19996
|
-
console.log(
|
|
20102
|
+
console.log(chalk181.green(`
|
|
19997
20103
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
19998
20104
|
} else {
|
|
19999
|
-
console.log(
|
|
20105
|
+
console.log(chalk181.dim("\nDry run. Use --apply to execute."));
|
|
20000
20106
|
}
|
|
20001
20107
|
}
|
|
20002
20108
|
|
|
20003
20109
|
// src/commands/refactor/restructure/index.ts
|
|
20004
20110
|
import path57 from "path";
|
|
20005
|
-
import
|
|
20111
|
+
import chalk184 from "chalk";
|
|
20006
20112
|
|
|
20007
20113
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
20008
20114
|
import path51 from "path";
|
|
@@ -20081,50 +20187,50 @@ function clusterFiles(graph) {
|
|
|
20081
20187
|
|
|
20082
20188
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
20083
20189
|
import path53 from "path";
|
|
20084
|
-
import
|
|
20190
|
+
import chalk182 from "chalk";
|
|
20085
20191
|
function relPath(filePath) {
|
|
20086
20192
|
return path53.relative(process.cwd(), filePath);
|
|
20087
20193
|
}
|
|
20088
20194
|
function displayMoves(plan2) {
|
|
20089
20195
|
if (plan2.moves.length === 0) return;
|
|
20090
|
-
console.log(
|
|
20196
|
+
console.log(chalk182.bold("\nFile moves:"));
|
|
20091
20197
|
for (const move2 of plan2.moves) {
|
|
20092
20198
|
console.log(
|
|
20093
|
-
` ${
|
|
20199
|
+
` ${chalk182.red(relPath(move2.from))} \u2192 ${chalk182.green(relPath(move2.to))}`
|
|
20094
20200
|
);
|
|
20095
|
-
console.log(
|
|
20201
|
+
console.log(chalk182.dim(` ${move2.reason}`));
|
|
20096
20202
|
}
|
|
20097
20203
|
}
|
|
20098
20204
|
function displayRewrites(rewrites) {
|
|
20099
20205
|
if (rewrites.length === 0) return;
|
|
20100
20206
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
20101
|
-
console.log(
|
|
20207
|
+
console.log(chalk182.bold(`
|
|
20102
20208
|
Import rewrites (${affectedFiles.size} files):`));
|
|
20103
20209
|
for (const file of affectedFiles) {
|
|
20104
|
-
console.log(` ${
|
|
20210
|
+
console.log(` ${chalk182.cyan(relPath(file))}:`);
|
|
20105
20211
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
20106
20212
|
(r) => r.file === file
|
|
20107
20213
|
)) {
|
|
20108
20214
|
console.log(
|
|
20109
|
-
` ${
|
|
20215
|
+
` ${chalk182.red(`"${oldSpecifier}"`)} \u2192 ${chalk182.green(`"${newSpecifier}"`)}`
|
|
20110
20216
|
);
|
|
20111
20217
|
}
|
|
20112
20218
|
}
|
|
20113
20219
|
}
|
|
20114
20220
|
function displayPlan2(plan2) {
|
|
20115
20221
|
if (plan2.warnings.length > 0) {
|
|
20116
|
-
console.log(
|
|
20117
|
-
for (const w of plan2.warnings) console.log(
|
|
20222
|
+
console.log(chalk182.yellow("\nWarnings:"));
|
|
20223
|
+
for (const w of plan2.warnings) console.log(chalk182.yellow(` ${w}`));
|
|
20118
20224
|
}
|
|
20119
20225
|
if (plan2.newDirectories.length > 0) {
|
|
20120
|
-
console.log(
|
|
20226
|
+
console.log(chalk182.bold("\nNew directories:"));
|
|
20121
20227
|
for (const dir of plan2.newDirectories)
|
|
20122
|
-
console.log(
|
|
20228
|
+
console.log(chalk182.green(` ${dir}/`));
|
|
20123
20229
|
}
|
|
20124
20230
|
displayMoves(plan2);
|
|
20125
20231
|
displayRewrites(plan2.rewrites);
|
|
20126
20232
|
console.log(
|
|
20127
|
-
|
|
20233
|
+
chalk182.dim(
|
|
20128
20234
|
`
|
|
20129
20235
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
20130
20236
|
)
|
|
@@ -20134,18 +20240,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
20134
20240
|
// src/commands/refactor/restructure/executePlan.ts
|
|
20135
20241
|
import fs32 from "fs";
|
|
20136
20242
|
import path54 from "path";
|
|
20137
|
-
import
|
|
20243
|
+
import chalk183 from "chalk";
|
|
20138
20244
|
function executePlan(plan2) {
|
|
20139
20245
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
20140
20246
|
for (const [file, content] of updatedContents) {
|
|
20141
20247
|
fs32.writeFileSync(file, content, "utf8");
|
|
20142
20248
|
console.log(
|
|
20143
|
-
|
|
20249
|
+
chalk183.cyan(` Rewrote imports in ${path54.relative(process.cwd(), file)}`)
|
|
20144
20250
|
);
|
|
20145
20251
|
}
|
|
20146
20252
|
for (const dir of plan2.newDirectories) {
|
|
20147
20253
|
fs32.mkdirSync(dir, { recursive: true });
|
|
20148
|
-
console.log(
|
|
20254
|
+
console.log(chalk183.green(` Created ${path54.relative(process.cwd(), dir)}/`));
|
|
20149
20255
|
}
|
|
20150
20256
|
for (const move2 of plan2.moves) {
|
|
20151
20257
|
const targetDir = path54.dirname(move2.to);
|
|
@@ -20154,7 +20260,7 @@ function executePlan(plan2) {
|
|
|
20154
20260
|
}
|
|
20155
20261
|
fs32.renameSync(move2.from, move2.to);
|
|
20156
20262
|
console.log(
|
|
20157
|
-
|
|
20263
|
+
chalk183.white(
|
|
20158
20264
|
` Moved ${path54.relative(process.cwd(), move2.from)} \u2192 ${path54.relative(process.cwd(), move2.to)}`
|
|
20159
20265
|
)
|
|
20160
20266
|
);
|
|
@@ -20169,7 +20275,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
20169
20275
|
if (entries.length === 0) {
|
|
20170
20276
|
fs32.rmdirSync(dir);
|
|
20171
20277
|
console.log(
|
|
20172
|
-
|
|
20278
|
+
chalk183.dim(
|
|
20173
20279
|
` Removed empty directory ${path54.relative(process.cwd(), dir)}`
|
|
20174
20280
|
)
|
|
20175
20281
|
);
|
|
@@ -20302,22 +20408,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
20302
20408
|
const targetPattern = pattern2 ?? "src";
|
|
20303
20409
|
const files = findSourceFiles2(targetPattern);
|
|
20304
20410
|
if (files.length === 0) {
|
|
20305
|
-
console.log(
|
|
20411
|
+
console.log(chalk184.yellow("No files found matching pattern"));
|
|
20306
20412
|
return;
|
|
20307
20413
|
}
|
|
20308
20414
|
const tsConfigPath = findTsConfig(path57.resolve(files[0]));
|
|
20309
20415
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
20310
20416
|
if (plan2.moves.length === 0) {
|
|
20311
|
-
console.log(
|
|
20417
|
+
console.log(chalk184.green("No restructuring needed"));
|
|
20312
20418
|
return;
|
|
20313
20419
|
}
|
|
20314
20420
|
displayPlan2(plan2);
|
|
20315
20421
|
if (options2.apply) {
|
|
20316
|
-
console.log(
|
|
20422
|
+
console.log(chalk184.bold("\nApplying changes..."));
|
|
20317
20423
|
executePlan(plan2);
|
|
20318
|
-
console.log(
|
|
20424
|
+
console.log(chalk184.green("\nRestructuring complete"));
|
|
20319
20425
|
} else {
|
|
20320
|
-
console.log(
|
|
20426
|
+
console.log(chalk184.dim("\nDry run. Use --apply to execute."));
|
|
20321
20427
|
}
|
|
20322
20428
|
}
|
|
20323
20429
|
|
|
@@ -20900,18 +21006,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
20900
21006
|
}
|
|
20901
21007
|
|
|
20902
21008
|
// src/commands/review/warnOutOfDiff.ts
|
|
20903
|
-
import
|
|
21009
|
+
import chalk185 from "chalk";
|
|
20904
21010
|
function warnOutOfDiff(outOfDiff) {
|
|
20905
21011
|
if (outOfDiff.length === 0) return;
|
|
20906
21012
|
console.warn(
|
|
20907
|
-
|
|
21013
|
+
chalk185.yellow(
|
|
20908
21014
|
`Skipped ${outOfDiff.length} finding(s) whose lines fall outside the PR diff (GitHub would silently drop these):`
|
|
20909
21015
|
)
|
|
20910
21016
|
);
|
|
20911
21017
|
for (const finding of outOfDiff) {
|
|
20912
21018
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
20913
21019
|
console.warn(
|
|
20914
|
-
` ${
|
|
21020
|
+
` ${chalk185.yellow("\xB7")} ${finding.title} ${chalk185.dim(
|
|
20915
21021
|
`(${finding.file}:${range})`
|
|
20916
21022
|
)}`
|
|
20917
21023
|
);
|
|
@@ -20930,18 +21036,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
20930
21036
|
}
|
|
20931
21037
|
|
|
20932
21038
|
// src/commands/review/warnUnlocated.ts
|
|
20933
|
-
import
|
|
21039
|
+
import chalk186 from "chalk";
|
|
20934
21040
|
function warnUnlocated(unlocated) {
|
|
20935
21041
|
if (unlocated.length === 0) return;
|
|
20936
21042
|
console.warn(
|
|
20937
|
-
|
|
21043
|
+
chalk186.yellow(
|
|
20938
21044
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
20939
21045
|
)
|
|
20940
21046
|
);
|
|
20941
21047
|
for (const finding of unlocated) {
|
|
20942
|
-
const where = finding.location ||
|
|
21048
|
+
const where = finding.location || chalk186.dim("missing");
|
|
20943
21049
|
console.warn(
|
|
20944
|
-
` ${
|
|
21050
|
+
` ${chalk186.yellow("\xB7")} ${finding.title} ${chalk186.dim(`(${where})`)}`
|
|
20945
21051
|
);
|
|
20946
21052
|
}
|
|
20947
21053
|
}
|
|
@@ -22113,7 +22219,7 @@ function registerReview(program2) {
|
|
|
22113
22219
|
}
|
|
22114
22220
|
|
|
22115
22221
|
// src/commands/seq/seqAuth.ts
|
|
22116
|
-
import
|
|
22222
|
+
import chalk188 from "chalk";
|
|
22117
22223
|
|
|
22118
22224
|
// src/commands/seq/loadConnections.ts
|
|
22119
22225
|
function loadConnections2() {
|
|
@@ -22142,10 +22248,10 @@ function setDefaultConnection(name) {
|
|
|
22142
22248
|
}
|
|
22143
22249
|
|
|
22144
22250
|
// src/shared/assertUniqueName.ts
|
|
22145
|
-
import
|
|
22251
|
+
import chalk187 from "chalk";
|
|
22146
22252
|
function assertUniqueName(existingNames, name) {
|
|
22147
22253
|
if (existingNames.includes(name)) {
|
|
22148
|
-
console.error(
|
|
22254
|
+
console.error(chalk187.red(`Connection "${name}" already exists.`));
|
|
22149
22255
|
process.exit(1);
|
|
22150
22256
|
}
|
|
22151
22257
|
}
|
|
@@ -22163,7 +22269,7 @@ async function promptConnection2(existingNames) {
|
|
|
22163
22269
|
var seqAuth = createConnectionAuth({
|
|
22164
22270
|
load: loadConnections2,
|
|
22165
22271
|
save: saveConnections2,
|
|
22166
|
-
format: (c) => `${
|
|
22272
|
+
format: (c) => `${chalk188.bold(c.name)} ${c.url}`,
|
|
22167
22273
|
promptNew: promptConnection2,
|
|
22168
22274
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
22169
22275
|
});
|
|
@@ -22183,10 +22289,10 @@ var seqConfigHelp = [
|
|
|
22183
22289
|
];
|
|
22184
22290
|
|
|
22185
22291
|
// src/commands/seq/seqQuery.ts
|
|
22186
|
-
import
|
|
22292
|
+
import chalk192 from "chalk";
|
|
22187
22293
|
|
|
22188
22294
|
// src/commands/seq/fetchSeq.ts
|
|
22189
|
-
import
|
|
22295
|
+
import chalk189 from "chalk";
|
|
22190
22296
|
async function fetchSeq(conn, path71, params) {
|
|
22191
22297
|
const url = `${conn.url}${path71}?${params}`;
|
|
22192
22298
|
const response = await fetch(url, {
|
|
@@ -22197,7 +22303,7 @@ async function fetchSeq(conn, path71, params) {
|
|
|
22197
22303
|
});
|
|
22198
22304
|
if (!response.ok) {
|
|
22199
22305
|
const body = await response.text();
|
|
22200
|
-
console.error(
|
|
22306
|
+
console.error(chalk189.red(`Seq returned ${response.status}: ${body}`));
|
|
22201
22307
|
process.exit(1);
|
|
22202
22308
|
}
|
|
22203
22309
|
return response;
|
|
@@ -22256,23 +22362,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
22256
22362
|
}
|
|
22257
22363
|
|
|
22258
22364
|
// src/commands/seq/formatEvent.ts
|
|
22259
|
-
import
|
|
22365
|
+
import chalk190 from "chalk";
|
|
22260
22366
|
function levelColor(level) {
|
|
22261
22367
|
switch (level) {
|
|
22262
22368
|
case "Fatal":
|
|
22263
|
-
return
|
|
22369
|
+
return chalk190.bgRed.white;
|
|
22264
22370
|
case "Error":
|
|
22265
|
-
return
|
|
22371
|
+
return chalk190.red;
|
|
22266
22372
|
case "Warning":
|
|
22267
|
-
return
|
|
22373
|
+
return chalk190.yellow;
|
|
22268
22374
|
case "Information":
|
|
22269
|
-
return
|
|
22375
|
+
return chalk190.cyan;
|
|
22270
22376
|
case "Debug":
|
|
22271
|
-
return
|
|
22377
|
+
return chalk190.gray;
|
|
22272
22378
|
case "Verbose":
|
|
22273
|
-
return
|
|
22379
|
+
return chalk190.dim;
|
|
22274
22380
|
default:
|
|
22275
|
-
return
|
|
22381
|
+
return chalk190.white;
|
|
22276
22382
|
}
|
|
22277
22383
|
}
|
|
22278
22384
|
function levelAbbrev(level) {
|
|
@@ -22313,12 +22419,12 @@ function formatTimestamp(iso) {
|
|
|
22313
22419
|
function formatEvent(event) {
|
|
22314
22420
|
const color = levelColor(event.Level);
|
|
22315
22421
|
const abbrev = levelAbbrev(event.Level);
|
|
22316
|
-
const ts8 =
|
|
22422
|
+
const ts8 = chalk190.dim(formatTimestamp(event.Timestamp));
|
|
22317
22423
|
const msg = renderMessage(event);
|
|
22318
22424
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
22319
22425
|
if (event.Exception) {
|
|
22320
22426
|
for (const line of event.Exception.split("\n")) {
|
|
22321
|
-
lines.push(
|
|
22427
|
+
lines.push(chalk190.red(` ${line}`));
|
|
22322
22428
|
}
|
|
22323
22429
|
}
|
|
22324
22430
|
return lines.join("\n");
|
|
@@ -22351,11 +22457,11 @@ function rejectTimestampFilter(filter) {
|
|
|
22351
22457
|
}
|
|
22352
22458
|
|
|
22353
22459
|
// src/shared/resolveNamedConnection.ts
|
|
22354
|
-
import
|
|
22460
|
+
import chalk191 from "chalk";
|
|
22355
22461
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
22356
22462
|
if (connections.length === 0) {
|
|
22357
22463
|
console.error(
|
|
22358
|
-
|
|
22464
|
+
chalk191.red(
|
|
22359
22465
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
22360
22466
|
)
|
|
22361
22467
|
);
|
|
@@ -22364,7 +22470,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
22364
22470
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
22365
22471
|
const connection = connections.find((c) => c.name === target);
|
|
22366
22472
|
if (!connection) {
|
|
22367
|
-
console.error(
|
|
22473
|
+
console.error(chalk191.red(`${kind} connection "${target}" not found.`));
|
|
22368
22474
|
process.exit(1);
|
|
22369
22475
|
}
|
|
22370
22476
|
return connection;
|
|
@@ -22393,7 +22499,7 @@ async function seqQuery(filter, options2) {
|
|
|
22393
22499
|
new URLSearchParams({ filter, count: String(count7) })
|
|
22394
22500
|
);
|
|
22395
22501
|
if (events.length === 0) {
|
|
22396
|
-
console.log(
|
|
22502
|
+
console.log(chalk192.yellow("No events found."));
|
|
22397
22503
|
return;
|
|
22398
22504
|
}
|
|
22399
22505
|
if (options2.json) {
|
|
@@ -22404,11 +22510,11 @@ async function seqQuery(filter, options2) {
|
|
|
22404
22510
|
for (const event of chronological) {
|
|
22405
22511
|
console.log(formatEvent(event));
|
|
22406
22512
|
}
|
|
22407
|
-
console.log(
|
|
22513
|
+
console.log(chalk192.dim(`
|
|
22408
22514
|
${events.length} events`));
|
|
22409
22515
|
if (events.length >= count7) {
|
|
22410
22516
|
console.log(
|
|
22411
|
-
|
|
22517
|
+
chalk192.yellow(
|
|
22412
22518
|
`Results limited to ${count7}. Use --count to retrieve more.`
|
|
22413
22519
|
)
|
|
22414
22520
|
);
|
|
@@ -22416,10 +22522,10 @@ ${events.length} events`));
|
|
|
22416
22522
|
}
|
|
22417
22523
|
|
|
22418
22524
|
// src/shared/setNamedDefaultConnection.ts
|
|
22419
|
-
import
|
|
22525
|
+
import chalk193 from "chalk";
|
|
22420
22526
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
22421
22527
|
if (!connections.find((c) => c.name === name)) {
|
|
22422
|
-
console.error(
|
|
22528
|
+
console.error(chalk193.red(`Connection "${name}" not found.`));
|
|
22423
22529
|
process.exit(1);
|
|
22424
22530
|
}
|
|
22425
22531
|
setDefault(name);
|
|
@@ -22468,7 +22574,7 @@ function registerSignal(program2) {
|
|
|
22468
22574
|
}
|
|
22469
22575
|
|
|
22470
22576
|
// src/commands/sql/sqlAuth.ts
|
|
22471
|
-
import
|
|
22577
|
+
import chalk195 from "chalk";
|
|
22472
22578
|
|
|
22473
22579
|
// src/commands/sql/loadConnections.ts
|
|
22474
22580
|
function loadConnections3() {
|
|
@@ -22497,7 +22603,7 @@ function setDefaultConnection2(name) {
|
|
|
22497
22603
|
}
|
|
22498
22604
|
|
|
22499
22605
|
// src/commands/sql/promptConnection.ts
|
|
22500
|
-
import
|
|
22606
|
+
import chalk194 from "chalk";
|
|
22501
22607
|
async function promptConnection3(existingNames) {
|
|
22502
22608
|
const name = await promptInput("name", "Connection name:", "default");
|
|
22503
22609
|
assertUniqueName(existingNames, name);
|
|
@@ -22505,7 +22611,7 @@ async function promptConnection3(existingNames) {
|
|
|
22505
22611
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
22506
22612
|
const port = Number.parseInt(portStr, 10);
|
|
22507
22613
|
if (!Number.isFinite(port)) {
|
|
22508
|
-
console.error(
|
|
22614
|
+
console.error(chalk194.red(`Invalid port "${portStr}".`));
|
|
22509
22615
|
process.exit(1);
|
|
22510
22616
|
}
|
|
22511
22617
|
const user = await promptInput("user", "User:");
|
|
@@ -22518,13 +22624,13 @@ async function promptConnection3(existingNames) {
|
|
|
22518
22624
|
var sqlAuth = createConnectionAuth({
|
|
22519
22625
|
load: loadConnections3,
|
|
22520
22626
|
save: saveConnections3,
|
|
22521
|
-
format: (c) => `${
|
|
22627
|
+
format: (c) => `${chalk195.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
22522
22628
|
promptNew: promptConnection3,
|
|
22523
22629
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
22524
22630
|
});
|
|
22525
22631
|
|
|
22526
22632
|
// src/commands/sql/printTable.ts
|
|
22527
|
-
import
|
|
22633
|
+
import chalk196 from "chalk";
|
|
22528
22634
|
function formatCell(value) {
|
|
22529
22635
|
if (value === null || value === void 0) return "";
|
|
22530
22636
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -22533,7 +22639,7 @@ function formatCell(value) {
|
|
|
22533
22639
|
}
|
|
22534
22640
|
function printTable(rows) {
|
|
22535
22641
|
if (rows.length === 0) {
|
|
22536
|
-
console.log(
|
|
22642
|
+
console.log(chalk196.yellow("(no rows)"));
|
|
22537
22643
|
return;
|
|
22538
22644
|
}
|
|
22539
22645
|
const columns = Object.keys(rows[0]);
|
|
@@ -22541,13 +22647,13 @@ function printTable(rows) {
|
|
|
22541
22647
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
22542
22648
|
);
|
|
22543
22649
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
22544
|
-
console.log(
|
|
22545
|
-
console.log(
|
|
22650
|
+
console.log(chalk196.dim(header));
|
|
22651
|
+
console.log(chalk196.dim("-".repeat(header.length)));
|
|
22546
22652
|
for (const row of rows) {
|
|
22547
22653
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
22548
22654
|
console.log(line);
|
|
22549
22655
|
}
|
|
22550
|
-
console.log(
|
|
22656
|
+
console.log(chalk196.dim(`
|
|
22551
22657
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
22552
22658
|
}
|
|
22553
22659
|
|
|
@@ -22621,7 +22727,7 @@ var sqlConfigHelp = [
|
|
|
22621
22727
|
];
|
|
22622
22728
|
|
|
22623
22729
|
// src/commands/sql/sqlMutate.ts
|
|
22624
|
-
import
|
|
22730
|
+
import chalk197 from "chalk";
|
|
22625
22731
|
|
|
22626
22732
|
// src/commands/sql/isMutation.ts
|
|
22627
22733
|
var MUTATION_KEYWORDS = [
|
|
@@ -22655,7 +22761,7 @@ function isMutation(sql25) {
|
|
|
22655
22761
|
async function sqlMutate(query, connectionName) {
|
|
22656
22762
|
if (!isMutation(query)) {
|
|
22657
22763
|
console.error(
|
|
22658
|
-
|
|
22764
|
+
chalk197.red(
|
|
22659
22765
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
22660
22766
|
)
|
|
22661
22767
|
);
|
|
@@ -22665,18 +22771,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
22665
22771
|
const pool = await sqlConnect(conn);
|
|
22666
22772
|
try {
|
|
22667
22773
|
const result = await pool.request().query(query);
|
|
22668
|
-
console.log(
|
|
22774
|
+
console.log(chalk197.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
22669
22775
|
} finally {
|
|
22670
22776
|
await pool.close();
|
|
22671
22777
|
}
|
|
22672
22778
|
}
|
|
22673
22779
|
|
|
22674
22780
|
// src/commands/sql/sqlQuery.ts
|
|
22675
|
-
import
|
|
22781
|
+
import chalk198 from "chalk";
|
|
22676
22782
|
async function sqlQuery(query, connectionName) {
|
|
22677
22783
|
if (isMutation(query)) {
|
|
22678
22784
|
console.error(
|
|
22679
|
-
|
|
22785
|
+
chalk198.red(
|
|
22680
22786
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
22681
22787
|
)
|
|
22682
22788
|
);
|
|
@@ -22691,7 +22797,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
22691
22797
|
printTable(rows);
|
|
22692
22798
|
} else {
|
|
22693
22799
|
console.log(
|
|
22694
|
-
|
|
22800
|
+
chalk198.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
22695
22801
|
);
|
|
22696
22802
|
}
|
|
22697
22803
|
} finally {
|
|
@@ -23506,7 +23612,7 @@ function registerVoice(program2) {
|
|
|
23506
23612
|
|
|
23507
23613
|
// src/commands/roam/auth.ts
|
|
23508
23614
|
import { randomBytes } from "crypto";
|
|
23509
|
-
import
|
|
23615
|
+
import chalk199 from "chalk";
|
|
23510
23616
|
|
|
23511
23617
|
// src/commands/roam/waitForCallback.ts
|
|
23512
23618
|
import { createServer as createServer3 } from "http";
|
|
@@ -23637,13 +23743,13 @@ async function auth() {
|
|
|
23637
23743
|
saveGlobalConfig(config);
|
|
23638
23744
|
const state = randomBytes(16).toString("hex");
|
|
23639
23745
|
console.log(
|
|
23640
|
-
|
|
23746
|
+
chalk199.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
23641
23747
|
);
|
|
23642
|
-
console.log(
|
|
23643
|
-
console.log(
|
|
23644
|
-
console.log(
|
|
23748
|
+
console.log(chalk199.white("http://localhost:14523/callback\n"));
|
|
23749
|
+
console.log(chalk199.blue("Opening browser for authorization..."));
|
|
23750
|
+
console.log(chalk199.dim("Waiting for authorization callback..."));
|
|
23645
23751
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
23646
|
-
console.log(
|
|
23752
|
+
console.log(chalk199.dim("Exchanging code for tokens..."));
|
|
23647
23753
|
const tokens = await exchangeToken({
|
|
23648
23754
|
code,
|
|
23649
23755
|
clientId,
|
|
@@ -23659,7 +23765,7 @@ async function auth() {
|
|
|
23659
23765
|
};
|
|
23660
23766
|
saveGlobalConfig(config);
|
|
23661
23767
|
console.log(
|
|
23662
|
-
|
|
23768
|
+
chalk199.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
23663
23769
|
);
|
|
23664
23770
|
}
|
|
23665
23771
|
|
|
@@ -24202,7 +24308,7 @@ import { execSync as execSync58 } from "child_process";
|
|
|
24202
24308
|
import { existsSync as existsSync56, mkdirSync as mkdirSync24, unlinkSync as unlinkSync21, writeFileSync as writeFileSync42 } from "fs";
|
|
24203
24309
|
import { tmpdir as tmpdir7 } from "os";
|
|
24204
24310
|
import { join as join66, resolve as resolve16 } from "path";
|
|
24205
|
-
import
|
|
24311
|
+
import chalk200 from "chalk";
|
|
24206
24312
|
|
|
24207
24313
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
24208
24314
|
var captureWindowPs1 = `
|
|
@@ -24353,13 +24459,13 @@ function screenshot(processName) {
|
|
|
24353
24459
|
const config = loadConfig();
|
|
24354
24460
|
const outputDir = resolve16(config.screenshot.outputDir);
|
|
24355
24461
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
24356
|
-
console.log(
|
|
24462
|
+
console.log(chalk200.gray(`Capturing window for process "${processName}" ...`));
|
|
24357
24463
|
try {
|
|
24358
24464
|
runPowerShellScript(processName, outputPath);
|
|
24359
|
-
console.log(
|
|
24465
|
+
console.log(chalk200.green(`Screenshot saved: ${outputPath}`));
|
|
24360
24466
|
} catch (error) {
|
|
24361
24467
|
const msg = error instanceof Error ? error.message : String(error);
|
|
24362
|
-
console.error(
|
|
24468
|
+
console.error(chalk200.red(`Failed to capture screenshot: ${msg}`));
|
|
24363
24469
|
process.exit(1);
|
|
24364
24470
|
}
|
|
24365
24471
|
}
|
|
@@ -24685,6 +24791,8 @@ function toSessionInfo({
|
|
|
24685
24791
|
runningSince,
|
|
24686
24792
|
runName,
|
|
24687
24793
|
runArgs,
|
|
24794
|
+
server,
|
|
24795
|
+
serverPort,
|
|
24688
24796
|
assistArgs,
|
|
24689
24797
|
cwd,
|
|
24690
24798
|
restored,
|
|
@@ -24710,6 +24818,8 @@ function toSessionInfo({
|
|
|
24710
24818
|
runningSince,
|
|
24711
24819
|
runName,
|
|
24712
24820
|
runArgs,
|
|
24821
|
+
server,
|
|
24822
|
+
port: serverPort,
|
|
24713
24823
|
assistArgs,
|
|
24714
24824
|
cwd,
|
|
24715
24825
|
restored,
|
|
@@ -24883,6 +24993,28 @@ function createAssistSession(id, assistArgs, cwd, meta) {
|
|
|
24883
24993
|
// src/commands/sessions/daemon/createSession.ts
|
|
24884
24994
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
24885
24995
|
|
|
24996
|
+
// src/commands/sessions/daemon/resolveRunConfig.ts
|
|
24997
|
+
function resolveRunConfig(name, cwd) {
|
|
24998
|
+
try {
|
|
24999
|
+
const { run: run4 } = loadConfigFrom(cwd);
|
|
25000
|
+
const configs = resolveRunConfigs(run4, getConfigDirFrom(cwd));
|
|
25001
|
+
const exact = configs.find((r) => r.name === name);
|
|
25002
|
+
if (exact) return exact;
|
|
25003
|
+
const suffixMatches = configs.filter((r) => r.name.endsWith(`:${name}`));
|
|
25004
|
+
return suffixMatches.length === 1 ? suffixMatches[0] : void 0;
|
|
25005
|
+
} catch {
|
|
25006
|
+
return void 0;
|
|
25007
|
+
}
|
|
25008
|
+
}
|
|
25009
|
+
|
|
25010
|
+
// src/commands/sessions/daemon/serverRunMeta.ts
|
|
25011
|
+
function serverRunMeta(runName, cwd) {
|
|
25012
|
+
const dir = cwd ?? process.cwd();
|
|
25013
|
+
const config = resolveRunConfig(runName, dir);
|
|
25014
|
+
if (!config?.server) return { server: false };
|
|
25015
|
+
return { server: true, port: config.port, origin: getCurrentOrigin(dir) };
|
|
25016
|
+
}
|
|
25017
|
+
|
|
24886
25018
|
// src/commands/sessions/daemon/readDesignSystemPrompt.ts
|
|
24887
25019
|
import * as fs35 from "fs";
|
|
24888
25020
|
import * as path59 from "path";
|
|
@@ -24963,7 +25095,7 @@ function createPiSession(id, prompt, cwd) {
|
|
|
24963
25095
|
initialPrompt: prompt
|
|
24964
25096
|
};
|
|
24965
25097
|
}
|
|
24966
|
-
function createRunSession(id, runName, runArgs, cwd) {
|
|
25098
|
+
function createRunSession(id, runName, runArgs, cwd, meta = serverRunMeta(runName, cwd)) {
|
|
24967
25099
|
return {
|
|
24968
25100
|
...sessionBase(id, "running"),
|
|
24969
25101
|
name: `run: ${runName}`,
|
|
@@ -24971,7 +25103,10 @@ function createRunSession(id, runName, runArgs, cwd) {
|
|
|
24971
25103
|
pty: spawnRun({ name: runName, args: runArgs, cwd }),
|
|
24972
25104
|
runName,
|
|
24973
25105
|
runArgs,
|
|
24974
|
-
cwd
|
|
25106
|
+
cwd,
|
|
25107
|
+
server: meta.server || void 0,
|
|
25108
|
+
serverPort: meta.port,
|
|
25109
|
+
serverOrigin: meta.origin
|
|
24975
25110
|
};
|
|
24976
25111
|
}
|
|
24977
25112
|
|
|
@@ -25368,6 +25503,18 @@ function errorTail(scrollback) {
|
|
|
25368
25503
|
return tail.length > MAX_TAIL_CHARS ? tail.slice(-MAX_TAIL_CHARS) : tail;
|
|
25369
25504
|
}
|
|
25370
25505
|
|
|
25506
|
+
// src/commands/sessions/daemon/handleFailedResume.ts
|
|
25507
|
+
function handleFailedResume(session, exitCode, onStatusChange) {
|
|
25508
|
+
const failed2 = session.restored === true && exitCode !== 0 && session.scrollback.length === 0;
|
|
25509
|
+
if (!failed2) return false;
|
|
25510
|
+
session.error = `resume process exited with code ${exitCode} before producing any output`;
|
|
25511
|
+
daemonLog(
|
|
25512
|
+
`could not resume restored session "${session.name}" (id ${session.id}): ${session.error}`
|
|
25513
|
+
);
|
|
25514
|
+
onStatusChange(session, "error", exitCode);
|
|
25515
|
+
return true;
|
|
25516
|
+
}
|
|
25517
|
+
|
|
25371
25518
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
25372
25519
|
import { existsSync as existsSync58, mkdirSync as mkdirSync25, watch } from "fs";
|
|
25373
25520
|
import { dirname as dirname29 } from "path";
|
|
@@ -25461,6 +25608,18 @@ function refreshActivity(session) {
|
|
|
25461
25608
|
session.claudeSessionId = activity2.claudeSessionId;
|
|
25462
25609
|
}
|
|
25463
25610
|
|
|
25611
|
+
// src/commands/sessions/daemon/handleStoppedExit.ts
|
|
25612
|
+
function handleStoppedExit(session, exitCode, onStatusChange) {
|
|
25613
|
+
if (!session.stopping) return false;
|
|
25614
|
+
session.stopping = void 0;
|
|
25615
|
+
refreshActivity(session);
|
|
25616
|
+
daemonLog(
|
|
25617
|
+
`session ${session.id} ("${session.name}") pty exited (code ${exitCode}) after stop request; marking done`
|
|
25618
|
+
);
|
|
25619
|
+
onStatusChange(session, "done", 0);
|
|
25620
|
+
return true;
|
|
25621
|
+
}
|
|
25622
|
+
|
|
25464
25623
|
// src/commands/sessions/daemon/handlePtyExit.ts
|
|
25465
25624
|
function handlePtyExit(session, exitCode, onStatusChange) {
|
|
25466
25625
|
if (session.pendingRestart) {
|
|
@@ -25472,16 +25631,9 @@ function handlePtyExit(session, exitCode, onStatusChange) {
|
|
|
25472
25631
|
resume();
|
|
25473
25632
|
return;
|
|
25474
25633
|
}
|
|
25634
|
+
if (handleStoppedExit(session, exitCode, onStatusChange)) return;
|
|
25475
25635
|
refreshActivity(session);
|
|
25476
|
-
|
|
25477
|
-
if (failedResume) {
|
|
25478
|
-
session.error = `resume process exited with code ${exitCode} before producing any output`;
|
|
25479
|
-
daemonLog(
|
|
25480
|
-
`could not resume restored session "${session.name}" (id ${session.id}): ${session.error}`
|
|
25481
|
-
);
|
|
25482
|
-
onStatusChange(session, "error", exitCode);
|
|
25483
|
-
return;
|
|
25484
|
-
}
|
|
25636
|
+
if (handleFailedResume(session, exitCode, onStatusChange)) return;
|
|
25485
25637
|
const priorStatus = session.status;
|
|
25486
25638
|
if (exitCode !== 0) {
|
|
25487
25639
|
const tail = errorTail(session.scrollback);
|
|
@@ -26096,6 +26248,59 @@ function respawnThunk(session) {
|
|
|
26096
26248
|
return null;
|
|
26097
26249
|
}
|
|
26098
26250
|
|
|
26251
|
+
// src/commands/sessions/daemon/serverConflictInfo.ts
|
|
26252
|
+
function serverConflictInfo(session) {
|
|
26253
|
+
return {
|
|
26254
|
+
id: session.id,
|
|
26255
|
+
name: session.name,
|
|
26256
|
+
cwd: session.cwd,
|
|
26257
|
+
port: session.serverPort
|
|
26258
|
+
};
|
|
26259
|
+
}
|
|
26260
|
+
|
|
26261
|
+
// src/commands/sessions/daemon/liveServerRun.ts
|
|
26262
|
+
function liveServerRun(sessions, origin, excludeId) {
|
|
26263
|
+
for (const s of sessions.values()) {
|
|
26264
|
+
if (s.id === excludeId || !s.server || s.serverOrigin !== origin) continue;
|
|
26265
|
+
if (s.status !== "done" && s.status !== "error") return s;
|
|
26266
|
+
}
|
|
26267
|
+
return void 0;
|
|
26268
|
+
}
|
|
26269
|
+
function stopServerSession(sessions, id) {
|
|
26270
|
+
const s = sessions.get(id);
|
|
26271
|
+
if (!s?.pty || s.status === "done" || s.status === "error") return;
|
|
26272
|
+
s.stopping = true;
|
|
26273
|
+
daemonLog(`session ${id} stopped (${s.name})`);
|
|
26274
|
+
s.pty.kill();
|
|
26275
|
+
}
|
|
26276
|
+
|
|
26277
|
+
// src/commands/sessions/daemon/runRetry.ts
|
|
26278
|
+
function tagServerSession(session, meta) {
|
|
26279
|
+
session.server = meta.server || void 0;
|
|
26280
|
+
session.serverPort = meta.port;
|
|
26281
|
+
session.serverOrigin = meta.origin;
|
|
26282
|
+
}
|
|
26283
|
+
function findRetryConflict(sessions, session, replace, dismiss) {
|
|
26284
|
+
const meta = serverRunMeta(session.runName ?? "", session.cwd);
|
|
26285
|
+
if (meta.server && meta.origin) {
|
|
26286
|
+
const existing = liveServerRun(sessions, meta.origin, session.id);
|
|
26287
|
+
if (existing && !replace) return serverConflictInfo(existing);
|
|
26288
|
+
if (existing) dismiss(existing.id);
|
|
26289
|
+
}
|
|
26290
|
+
tagServerSession(session, meta);
|
|
26291
|
+
return null;
|
|
26292
|
+
}
|
|
26293
|
+
function runRetry(sessions, id, replace, deps2) {
|
|
26294
|
+
const s = sessions.get(id);
|
|
26295
|
+
if (!s) return null;
|
|
26296
|
+
if (s.commandType === "run" && s.runName) {
|
|
26297
|
+
const conflict = findRetryConflict(sessions, s, replace, deps2.dismiss);
|
|
26298
|
+
if (conflict) return conflict;
|
|
26299
|
+
}
|
|
26300
|
+
if (retrySession(s, deps2.clients, deps2.onStatusChange)) deps2.notify();
|
|
26301
|
+
return null;
|
|
26302
|
+
}
|
|
26303
|
+
|
|
26099
26304
|
// src/commands/sessions/daemon/reuseSessionForRun.ts
|
|
26100
26305
|
function reuseSessionForRun(session, itemId2, clients, onStatusChange) {
|
|
26101
26306
|
const assistArgs = ["backlog", "run", String(itemId2)];
|
|
@@ -26970,8 +27175,13 @@ var SessionManager = class {
|
|
|
26970
27175
|
(id) => createSession(id, prompt, cwd, design, harness)
|
|
26971
27176
|
);
|
|
26972
27177
|
}
|
|
26973
|
-
spawnRun(runName, runArgs, cwd) {
|
|
26974
|
-
return this.spawnWith(
|
|
27178
|
+
spawnRun(runName, runArgs, cwd, meta) {
|
|
27179
|
+
return this.spawnWith(
|
|
27180
|
+
(id) => createRunSession(id, runName, runArgs, cwd, meta)
|
|
27181
|
+
);
|
|
27182
|
+
}
|
|
27183
|
+
liveServerRun(origin, excludeId) {
|
|
27184
|
+
return liveServerRun(this.sessions, origin, excludeId);
|
|
26975
27185
|
}
|
|
26976
27186
|
spawnAssist(assistArgs, cwd, meta) {
|
|
26977
27187
|
return this.spawnWith(
|
|
@@ -26997,9 +27207,13 @@ var SessionManager = class {
|
|
|
26997
27207
|
resizeSession(id, cols, rows) {
|
|
26998
27208
|
resizeSession(this.sessions, id, cols, rows);
|
|
26999
27209
|
}
|
|
27000
|
-
retrySession(id) {
|
|
27001
|
-
|
|
27002
|
-
|
|
27210
|
+
retrySession(id, replace = false) {
|
|
27211
|
+
return runRetry(this.sessions, id, replace, {
|
|
27212
|
+
clients: this.clients,
|
|
27213
|
+
onStatusChange: this.onStatusChange,
|
|
27214
|
+
dismiss: this.dismissSession,
|
|
27215
|
+
notify: this.notify
|
|
27216
|
+
});
|
|
27003
27217
|
}
|
|
27004
27218
|
restart(id) {
|
|
27005
27219
|
const result = restartManagedSession(
|
|
@@ -27014,6 +27228,9 @@ var SessionManager = class {
|
|
|
27014
27228
|
dismissSession = (id) => {
|
|
27015
27229
|
if (dismissSession(this.sessions, id)) this.notify();
|
|
27016
27230
|
};
|
|
27231
|
+
stopSession(id) {
|
|
27232
|
+
stopServerSession(this.sessions, id);
|
|
27233
|
+
}
|
|
27017
27234
|
setAutoRun(id, enabled) {
|
|
27018
27235
|
if (setAutoRun(this.sessions, id, enabled)) this.notify();
|
|
27019
27236
|
}
|
|
@@ -27065,6 +27282,41 @@ function creator(isNew, spawn12) {
|
|
|
27065
27282
|
};
|
|
27066
27283
|
}
|
|
27067
27284
|
|
|
27285
|
+
// src/commands/sessions/daemon/handleCreateRun.ts
|
|
27286
|
+
function handleCreateRun(client, m, d) {
|
|
27287
|
+
if (m.windowsProxy.route(client, d)) return;
|
|
27288
|
+
const runName = d.runName;
|
|
27289
|
+
const cwd = d.cwd;
|
|
27290
|
+
const runArgs = d.runArgs ?? [];
|
|
27291
|
+
const meta = serverRunMeta(runName, cwd);
|
|
27292
|
+
if (meta.server && meta.origin) {
|
|
27293
|
+
const existing = m.liveServerRun(meta.origin);
|
|
27294
|
+
if (existing && d.replace !== true) {
|
|
27295
|
+
daemonLog(
|
|
27296
|
+
`create-run ${runName} rejected: server ${existing.id} already live for ${meta.origin}`
|
|
27297
|
+
);
|
|
27298
|
+
sendTo(client, {
|
|
27299
|
+
type: "run-conflict",
|
|
27300
|
+
runName,
|
|
27301
|
+
cwd,
|
|
27302
|
+
existing: serverConflictInfo(existing)
|
|
27303
|
+
});
|
|
27304
|
+
return;
|
|
27305
|
+
}
|
|
27306
|
+
if (existing) {
|
|
27307
|
+
daemonLog(
|
|
27308
|
+
`create-run ${runName} replacing live server ${existing.id} for ${meta.origin}`
|
|
27309
|
+
);
|
|
27310
|
+
m.dismissSession(existing.id);
|
|
27311
|
+
}
|
|
27312
|
+
}
|
|
27313
|
+
sendTo(client, {
|
|
27314
|
+
type: "created",
|
|
27315
|
+
sessionId: m.spawnRun(runName, runArgs, cwd, meta),
|
|
27316
|
+
isNew: true
|
|
27317
|
+
});
|
|
27318
|
+
}
|
|
27319
|
+
|
|
27068
27320
|
// src/commands/sessions/daemon/handleSetStatus.ts
|
|
27069
27321
|
function handleSetStatus(client, m, d) {
|
|
27070
27322
|
daemonLog(
|
|
@@ -27206,14 +27458,7 @@ var messageHandlers = {
|
|
|
27206
27458
|
"subscribe-logs": (client, m, d) => m.clients.subscribeLogs(client, d.replay !== false),
|
|
27207
27459
|
hello: (client) => sendTo(client, buildHello()),
|
|
27208
27460
|
create: creator(true, spawnCreate),
|
|
27209
|
-
"create-run":
|
|
27210
|
-
true,
|
|
27211
|
-
(m, d) => m.spawnRun(
|
|
27212
|
-
d.runName,
|
|
27213
|
-
d.runArgs ?? [],
|
|
27214
|
-
d.cwd
|
|
27215
|
-
)
|
|
27216
|
-
),
|
|
27461
|
+
"create-run": handleCreateRun,
|
|
27217
27462
|
"create-assist": creator(
|
|
27218
27463
|
true,
|
|
27219
27464
|
(m, d) => m.spawnAssist(
|
|
@@ -27247,13 +27492,22 @@ var messageHandlers = {
|
|
|
27247
27492
|
resize: routed(
|
|
27248
27493
|
(_client, m, d) => m.resizeSession(d.sessionId, d.cols, d.rows)
|
|
27249
27494
|
),
|
|
27250
|
-
retry: routed((
|
|
27495
|
+
retry: routed((client, m, d) => {
|
|
27496
|
+
const conflict = m.retrySession(d.sessionId, d.replace === true);
|
|
27497
|
+
if (conflict)
|
|
27498
|
+
sendTo(client, {
|
|
27499
|
+
type: "run-conflict",
|
|
27500
|
+
sessionId: d.sessionId,
|
|
27501
|
+
existing: conflict
|
|
27502
|
+
});
|
|
27503
|
+
}),
|
|
27251
27504
|
restart: routed((client, m, d) => {
|
|
27252
27505
|
const result = m.restart(d.sessionId);
|
|
27253
27506
|
if (!result.ok && result.reason)
|
|
27254
27507
|
sendTo(client, { type: "error", message: result.reason });
|
|
27255
27508
|
}),
|
|
27256
27509
|
dismiss: routed((_client, m, d) => m.dismissSession(d.sessionId)),
|
|
27510
|
+
stop: routed((_client, m, d) => m.stopSession(d.sessionId)),
|
|
27257
27511
|
"set-autorun": routed(
|
|
27258
27512
|
(_client, m, d) => m.setAutoRun(d.sessionId, d.enabled)
|
|
27259
27513
|
),
|
|
@@ -27467,7 +27721,7 @@ function registerSetStatusCommand(cmd) {
|
|
|
27467
27721
|
|
|
27468
27722
|
// src/commands/sessions/summarise/index.ts
|
|
27469
27723
|
import * as fs41 from "fs";
|
|
27470
|
-
import
|
|
27724
|
+
import chalk201 from "chalk";
|
|
27471
27725
|
|
|
27472
27726
|
// src/commands/sessions/summarise/shared.ts
|
|
27473
27727
|
import * as fs40 from "fs";
|
|
@@ -27541,22 +27795,22 @@ ${firstMessage}`);
|
|
|
27541
27795
|
async function summarise2(options2) {
|
|
27542
27796
|
const files = await discoverSessionFiles();
|
|
27543
27797
|
if (files.length === 0) {
|
|
27544
|
-
console.log(
|
|
27798
|
+
console.log(chalk201.yellow("No sessions found."));
|
|
27545
27799
|
return;
|
|
27546
27800
|
}
|
|
27547
27801
|
const toProcess = selectCandidates(files, options2);
|
|
27548
27802
|
if (toProcess.length === 0) {
|
|
27549
|
-
console.log(
|
|
27803
|
+
console.log(chalk201.green("All sessions already summarised."));
|
|
27550
27804
|
return;
|
|
27551
27805
|
}
|
|
27552
27806
|
console.log(
|
|
27553
|
-
|
|
27807
|
+
chalk201.cyan(
|
|
27554
27808
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
27555
27809
|
)
|
|
27556
27810
|
);
|
|
27557
27811
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
27558
27812
|
console.log(
|
|
27559
|
-
|
|
27813
|
+
chalk201.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk201.yellow(`, ${failed2} skipped`) : "")
|
|
27560
27814
|
);
|
|
27561
27815
|
}
|
|
27562
27816
|
function selectCandidates(files, options2) {
|
|
@@ -27576,16 +27830,16 @@ function processSessions(files) {
|
|
|
27576
27830
|
let failed2 = 0;
|
|
27577
27831
|
for (let i = 0; i < files.length; i++) {
|
|
27578
27832
|
const file = files[i];
|
|
27579
|
-
process.stdout.write(
|
|
27833
|
+
process.stdout.write(chalk201.dim(` [${i + 1}/${files.length}] `));
|
|
27580
27834
|
const summary = summariseSession(file);
|
|
27581
27835
|
if (summary) {
|
|
27582
27836
|
writeSummary(file, summary);
|
|
27583
27837
|
succeeded++;
|
|
27584
|
-
process.stdout.write(`${
|
|
27838
|
+
process.stdout.write(`${chalk201.green("\u2713")} ${summary}
|
|
27585
27839
|
`);
|
|
27586
27840
|
} else {
|
|
27587
27841
|
failed2++;
|
|
27588
|
-
process.stdout.write(` ${
|
|
27842
|
+
process.stdout.write(` ${chalk201.yellow("skip")}
|
|
27589
27843
|
`);
|
|
27590
27844
|
}
|
|
27591
27845
|
}
|
|
@@ -27627,7 +27881,7 @@ function registerSessions(program2) {
|
|
|
27627
27881
|
}
|
|
27628
27882
|
|
|
27629
27883
|
// src/commands/statusLine.ts
|
|
27630
|
-
import
|
|
27884
|
+
import chalk203 from "chalk";
|
|
27631
27885
|
|
|
27632
27886
|
// src/shared/contextLevel.ts
|
|
27633
27887
|
function contextLevel(pct) {
|
|
@@ -27637,7 +27891,7 @@ function contextLevel(pct) {
|
|
|
27637
27891
|
}
|
|
27638
27892
|
|
|
27639
27893
|
// src/commands/buildLimitsSegment.ts
|
|
27640
|
-
import
|
|
27894
|
+
import chalk202 from "chalk";
|
|
27641
27895
|
|
|
27642
27896
|
// src/shared/rateLimitLevel.ts
|
|
27643
27897
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -27668,9 +27922,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
27668
27922
|
|
|
27669
27923
|
// src/commands/buildLimitsSegment.ts
|
|
27670
27924
|
var LEVEL_COLOR = {
|
|
27671
|
-
ok:
|
|
27672
|
-
warn:
|
|
27673
|
-
over:
|
|
27925
|
+
ok: chalk202.green,
|
|
27926
|
+
warn: chalk202.yellow,
|
|
27927
|
+
over: chalk202.red
|
|
27674
27928
|
};
|
|
27675
27929
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
27676
27930
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -27766,7 +28020,7 @@ async function relayUsage(claudeSessionId, transcriptPath, usedPct) {
|
|
|
27766
28020
|
}
|
|
27767
28021
|
|
|
27768
28022
|
// src/commands/statusLine.ts
|
|
27769
|
-
|
|
28023
|
+
chalk203.level = 3;
|
|
27770
28024
|
function formatNumber(num) {
|
|
27771
28025
|
return num.toLocaleString("en-US");
|
|
27772
28026
|
}
|
|
@@ -27774,9 +28028,9 @@ function colorizePercent(pct) {
|
|
|
27774
28028
|
const label2 = `${Math.round(pct)}%`;
|
|
27775
28029
|
switch (contextLevel(pct)) {
|
|
27776
28030
|
case "red":
|
|
27777
|
-
return
|
|
28031
|
+
return chalk203.red(label2);
|
|
27778
28032
|
case "yellow":
|
|
27779
|
-
return
|
|
28033
|
+
return chalk203.yellow(label2);
|
|
27780
28034
|
default:
|
|
27781
28035
|
return label2;
|
|
27782
28036
|
}
|
|
@@ -27789,7 +28043,7 @@ async function statusLine() {
|
|
|
27789
28043
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
27790
28044
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
27791
28045
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
27792
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
28046
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk203.cyan(branch2)} | ` : "";
|
|
27793
28047
|
console.log(
|
|
27794
28048
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
27795
28049
|
);
|
|
@@ -27810,7 +28064,7 @@ import { fileURLToPath as fileURLToPath9 } from "url";
|
|
|
27810
28064
|
// src/commands/sync/syncClaudeMd.ts
|
|
27811
28065
|
import * as fs42 from "fs";
|
|
27812
28066
|
import * as path61 from "path";
|
|
27813
|
-
import
|
|
28067
|
+
import chalk204 from "chalk";
|
|
27814
28068
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
27815
28069
|
const source = path61.join(claudeDir, "CLAUDE.md");
|
|
27816
28070
|
const target = path61.join(targetBase, "CLAUDE.md");
|
|
@@ -27819,12 +28073,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
27819
28073
|
const targetContent = fs42.readFileSync(target, "utf8");
|
|
27820
28074
|
if (sourceContent !== targetContent) {
|
|
27821
28075
|
console.log(
|
|
27822
|
-
|
|
28076
|
+
chalk204.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
27823
28077
|
);
|
|
27824
28078
|
console.log();
|
|
27825
28079
|
printDiff(targetContent, sourceContent);
|
|
27826
28080
|
const confirm = options2?.yes || await promptConfirm(
|
|
27827
|
-
|
|
28081
|
+
chalk204.red("Overwrite existing CLAUDE.md?"),
|
|
27828
28082
|
false
|
|
27829
28083
|
);
|
|
27830
28084
|
if (!confirm) {
|
|
@@ -28018,7 +28272,7 @@ function syncPi(claudeDir) {
|
|
|
28018
28272
|
// src/commands/sync/syncSettings.ts
|
|
28019
28273
|
import * as fs47 from "fs";
|
|
28020
28274
|
import * as path68 from "path";
|
|
28021
|
-
import
|
|
28275
|
+
import chalk205 from "chalk";
|
|
28022
28276
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
28023
28277
|
const source = path68.join(claudeDir, "settings.json");
|
|
28024
28278
|
const target = path68.join(targetBase, "settings.json");
|
|
@@ -28037,14 +28291,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
28037
28291
|
if (mergedContent !== normalizedTarget) {
|
|
28038
28292
|
if (!options2?.yes) {
|
|
28039
28293
|
console.log(
|
|
28040
|
-
|
|
28294
|
+
chalk205.yellow(
|
|
28041
28295
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
28042
28296
|
)
|
|
28043
28297
|
);
|
|
28044
28298
|
console.log();
|
|
28045
28299
|
printDiff(targetContent, mergedContent);
|
|
28046
28300
|
const confirm = await promptConfirm(
|
|
28047
|
-
|
|
28301
|
+
chalk205.red("Overwrite existing settings.json?"),
|
|
28048
28302
|
false
|
|
28049
28303
|
);
|
|
28050
28304
|
if (!confirm) {
|
|
@@ -28143,10 +28397,10 @@ async function update2() {
|
|
|
28143
28397
|
}
|
|
28144
28398
|
|
|
28145
28399
|
// src/reportCliError.ts
|
|
28146
|
-
import
|
|
28400
|
+
import chalk206 from "chalk";
|
|
28147
28401
|
function reportCliError(error) {
|
|
28148
|
-
if (error instanceof InvalidItemIdError) {
|
|
28149
|
-
console.error(
|
|
28402
|
+
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError) {
|
|
28403
|
+
console.error(chalk206.red(error.message));
|
|
28150
28404
|
} else {
|
|
28151
28405
|
console.error(error);
|
|
28152
28406
|
}
|