@staff0rd/assist 0.937.0 → 0.939.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 +2 -1
- package/claude/commands/add-rule.md +12 -3
- package/dist/commands/sessions/web/bundle.js +404 -404
- package/dist/index.js +138 -96
- 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.939.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -6211,7 +6211,7 @@ var adviceConfigHelp = [
|
|
|
6211
6211
|
},
|
|
6212
6212
|
{
|
|
6213
6213
|
key: "advice.rules",
|
|
6214
|
-
setter: "
|
|
6214
|
+
setter: "assist rules add '<text>' --title '<title>' --global",
|
|
6215
6215
|
note: 'listed under "Your rules"; global and repo entries are concatenated, global first'
|
|
6216
6216
|
}
|
|
6217
6217
|
];
|
|
@@ -40224,10 +40224,49 @@ function registerReview(program) {
|
|
|
40224
40224
|
);
|
|
40225
40225
|
}
|
|
40226
40226
|
|
|
40227
|
+
// src/commands/rules/addGlobalRule.ts
|
|
40228
|
+
import chalk244 from "chalk";
|
|
40229
|
+
function fail8(message3) {
|
|
40230
|
+
console.error(chalk244.red(message3));
|
|
40231
|
+
process.exitCode = 1;
|
|
40232
|
+
}
|
|
40233
|
+
function existingRules(globalConfigPath) {
|
|
40234
|
+
const advice = loadGlobalConfigRaw(globalConfigPath).advice;
|
|
40235
|
+
return Array.isArray(advice?.rules) ? advice.rules : [];
|
|
40236
|
+
}
|
|
40237
|
+
function addGlobalRule(text17, options2, globalConfigPath = getGlobalConfigPath()) {
|
|
40238
|
+
if (options2.scope !== void 0) {
|
|
40239
|
+
fail8(
|
|
40240
|
+
"--global writes to ~/.assist.yml and cannot be combined with --scope"
|
|
40241
|
+
);
|
|
40242
|
+
return;
|
|
40243
|
+
}
|
|
40244
|
+
const rule = text17.trim();
|
|
40245
|
+
const title = options2.title?.trim() ?? "";
|
|
40246
|
+
if (rule === "" || title === "") {
|
|
40247
|
+
fail8("Global rules need both rule text and --title");
|
|
40248
|
+
return;
|
|
40249
|
+
}
|
|
40250
|
+
const result = applyConfigSet(
|
|
40251
|
+
"advice.rules",
|
|
40252
|
+
[...existingRules(globalConfigPath), { title, text: rule }],
|
|
40253
|
+
true,
|
|
40254
|
+
process.cwd(),
|
|
40255
|
+
globalConfigPath
|
|
40256
|
+
);
|
|
40257
|
+
if (!result.ok) {
|
|
40258
|
+
fail8(result.errors.join("\n"));
|
|
40259
|
+
return;
|
|
40260
|
+
}
|
|
40261
|
+
console.log(
|
|
40262
|
+
`Added ${chalk244.cyan(title)} to advice.rules in ${globalConfigFileLabel(globalConfigPath)}`
|
|
40263
|
+
);
|
|
40264
|
+
}
|
|
40265
|
+
|
|
40227
40266
|
// src/commands/rules/addRule.ts
|
|
40228
40267
|
import { existsSync as existsSync72, readFileSync as readFileSync56, writeFileSync as writeFileSync44 } from "fs";
|
|
40229
40268
|
import path87 from "path";
|
|
40230
|
-
import
|
|
40269
|
+
import chalk245 from "chalk";
|
|
40231
40270
|
|
|
40232
40271
|
// src/commands/rules/insertRuleBullet.ts
|
|
40233
40272
|
function ruleBullet({ code, title, text: text17 }) {
|
|
@@ -40363,7 +40402,7 @@ function read2(file) {
|
|
|
40363
40402
|
function addRule(text17, options2) {
|
|
40364
40403
|
const rule = text17.trim();
|
|
40365
40404
|
if (rule === "") {
|
|
40366
|
-
console.error(
|
|
40405
|
+
console.error(chalk245.red("Rule text is required"));
|
|
40367
40406
|
process.exitCode = 1;
|
|
40368
40407
|
return;
|
|
40369
40408
|
}
|
|
@@ -40381,13 +40420,13 @@ function addRule(text17, options2) {
|
|
|
40381
40420
|
);
|
|
40382
40421
|
updateScopedRulesIndex(root2);
|
|
40383
40422
|
console.log(
|
|
40384
|
-
`Added ${
|
|
40423
|
+
`Added ${chalk245.cyan(code)} to ${path87.relative(process.cwd(), target) || target}`
|
|
40385
40424
|
);
|
|
40386
40425
|
}
|
|
40387
40426
|
|
|
40388
40427
|
// src/commands/rules/indexRules.ts
|
|
40389
40428
|
import path88 from "path";
|
|
40390
|
-
import
|
|
40429
|
+
import chalk246 from "chalk";
|
|
40391
40430
|
function indexRules() {
|
|
40392
40431
|
const startDir = scopeDirectory(process.cwd());
|
|
40393
40432
|
const root2 = findRepoRoot(startDir) ?? startDir;
|
|
@@ -40395,24 +40434,24 @@ function indexRules() {
|
|
|
40395
40434
|
const rootFile = path88.relative(process.cwd(), path88.join(root2, "CLAUDE.md"));
|
|
40396
40435
|
if (directories.length === 0) {
|
|
40397
40436
|
console.log(
|
|
40398
|
-
|
|
40437
|
+
chalk246.gray(`No directories carry their own \`## Rules\` under ${root2}`)
|
|
40399
40438
|
);
|
|
40400
40439
|
return;
|
|
40401
40440
|
}
|
|
40402
40441
|
console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
|
|
40403
40442
|
for (const directory of directories)
|
|
40404
|
-
console.log(` ${
|
|
40443
|
+
console.log(` ${chalk246.cyan(directory)}`);
|
|
40405
40444
|
}
|
|
40406
40445
|
|
|
40407
40446
|
// src/commands/rules/listRules.ts
|
|
40408
40447
|
import path89 from "path";
|
|
40409
|
-
import
|
|
40448
|
+
import chalk247 from "chalk";
|
|
40410
40449
|
function listRules(target, options2 = {}) {
|
|
40411
40450
|
const resolved = path89.resolve(target ?? process.cwd());
|
|
40412
40451
|
const rules2 = readScopedRules(resolved);
|
|
40413
40452
|
if (rules2.length === 0) {
|
|
40414
40453
|
const label = path89.relative(process.cwd(), resolved) || ".";
|
|
40415
|
-
console.log(
|
|
40454
|
+
console.log(chalk247.gray(`No rules in scope for ${label}`));
|
|
40416
40455
|
return;
|
|
40417
40456
|
}
|
|
40418
40457
|
const base = findRepoRoot(scopeDirectory(resolved));
|
|
@@ -40422,14 +40461,14 @@ function listRules(target, options2 = {}) {
|
|
|
40422
40461
|
if (rule.source !== shown) {
|
|
40423
40462
|
shown = rule.source;
|
|
40424
40463
|
console.log(
|
|
40425
|
-
|
|
40464
|
+
chalk247.dim(base ? path89.relative(base, rule.source) : rule.source)
|
|
40426
40465
|
);
|
|
40427
40466
|
}
|
|
40428
40467
|
console.log(
|
|
40429
|
-
` ${
|
|
40468
|
+
` ${chalk247.cyan(rule.code.padEnd(width2))} ${rule.title ?? rule.text}`
|
|
40430
40469
|
);
|
|
40431
40470
|
if (options2.full && rule.title)
|
|
40432
|
-
console.log(` ${" ".repeat(width2)} ${
|
|
40471
|
+
console.log(` ${" ".repeat(width2)} ${chalk247.dim(rule.text)}`);
|
|
40433
40472
|
}
|
|
40434
40473
|
}
|
|
40435
40474
|
|
|
@@ -40450,8 +40489,11 @@ function registerRules(program) {
|
|
|
40450
40489
|
).option(
|
|
40451
40490
|
"--scope <path>",
|
|
40452
40491
|
"File or directory whose nearest CLAUDE.md receives the rule, or a CLAUDE.md path to write to directly (default: cwd)"
|
|
40492
|
+
).option(
|
|
40493
|
+
"--global",
|
|
40494
|
+
"Append the rule to advice.rules in ~/.assist.yml instead of a CLAUDE.md, for rules about agent conduct that hold in every repo. Needs --title; takes no R-code and cannot be combined with --scope"
|
|
40453
40495
|
).action(
|
|
40454
|
-
(text17, options2) => addRule(text17, options2)
|
|
40496
|
+
(text17, options2) => options2.global ? addGlobalRule(text17, options2) : addRule(text17, options2)
|
|
40455
40497
|
),
|
|
40456
40498
|
"/add-rule and /fix-rules"
|
|
40457
40499
|
);
|
|
@@ -40464,7 +40506,7 @@ function registerRules(program) {
|
|
|
40464
40506
|
}
|
|
40465
40507
|
|
|
40466
40508
|
// src/commands/seq/seqAuth.ts
|
|
40467
|
-
import
|
|
40509
|
+
import chalk249 from "chalk";
|
|
40468
40510
|
|
|
40469
40511
|
// src/commands/seq/loadConnections.ts
|
|
40470
40512
|
function loadConnections2() {
|
|
@@ -40493,10 +40535,10 @@ function setDefaultConnection(name) {
|
|
|
40493
40535
|
}
|
|
40494
40536
|
|
|
40495
40537
|
// src/shared/assertUniqueName.ts
|
|
40496
|
-
import
|
|
40538
|
+
import chalk248 from "chalk";
|
|
40497
40539
|
function assertUniqueName(existingNames, name) {
|
|
40498
40540
|
if (existingNames.includes(name)) {
|
|
40499
|
-
console.error(
|
|
40541
|
+
console.error(chalk248.red(`Connection "${name}" already exists.`));
|
|
40500
40542
|
process.exit(1);
|
|
40501
40543
|
}
|
|
40502
40544
|
}
|
|
@@ -40514,16 +40556,16 @@ async function promptConnection2(existingNames) {
|
|
|
40514
40556
|
var seqAuth = createConnectionAuth({
|
|
40515
40557
|
load: loadConnections2,
|
|
40516
40558
|
save: saveConnections2,
|
|
40517
|
-
format: (c) => `${
|
|
40559
|
+
format: (c) => `${chalk249.bold(c.name)} ${c.url}`,
|
|
40518
40560
|
promptNew: promptConnection2,
|
|
40519
40561
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
40520
40562
|
});
|
|
40521
40563
|
|
|
40522
40564
|
// src/commands/seq/seqQuery.ts
|
|
40523
|
-
import
|
|
40565
|
+
import chalk253 from "chalk";
|
|
40524
40566
|
|
|
40525
40567
|
// src/commands/seq/fetchSeq.ts
|
|
40526
|
-
import
|
|
40568
|
+
import chalk250 from "chalk";
|
|
40527
40569
|
async function fetchSeq(conn, path108, params) {
|
|
40528
40570
|
const url = `${conn.url}${path108}?${params}`;
|
|
40529
40571
|
const response = await fetch(url, {
|
|
@@ -40534,7 +40576,7 @@ async function fetchSeq(conn, path108, params) {
|
|
|
40534
40576
|
});
|
|
40535
40577
|
if (!response.ok) {
|
|
40536
40578
|
const body = await response.text();
|
|
40537
|
-
console.error(
|
|
40579
|
+
console.error(chalk250.red(`Seq returned ${response.status}: ${body}`));
|
|
40538
40580
|
process.exit(1);
|
|
40539
40581
|
}
|
|
40540
40582
|
return response;
|
|
@@ -40593,23 +40635,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
40593
40635
|
}
|
|
40594
40636
|
|
|
40595
40637
|
// src/commands/seq/formatEvent.ts
|
|
40596
|
-
import
|
|
40638
|
+
import chalk251 from "chalk";
|
|
40597
40639
|
function levelColor(level) {
|
|
40598
40640
|
switch (level) {
|
|
40599
40641
|
case "Fatal":
|
|
40600
|
-
return
|
|
40642
|
+
return chalk251.bgRed.white;
|
|
40601
40643
|
case "Error":
|
|
40602
|
-
return
|
|
40644
|
+
return chalk251.red;
|
|
40603
40645
|
case "Warning":
|
|
40604
|
-
return
|
|
40646
|
+
return chalk251.yellow;
|
|
40605
40647
|
case "Information":
|
|
40606
|
-
return
|
|
40648
|
+
return chalk251.cyan;
|
|
40607
40649
|
case "Debug":
|
|
40608
|
-
return
|
|
40650
|
+
return chalk251.gray;
|
|
40609
40651
|
case "Verbose":
|
|
40610
|
-
return
|
|
40652
|
+
return chalk251.dim;
|
|
40611
40653
|
default:
|
|
40612
|
-
return
|
|
40654
|
+
return chalk251.white;
|
|
40613
40655
|
}
|
|
40614
40656
|
}
|
|
40615
40657
|
function levelAbbrev(level) {
|
|
@@ -40650,12 +40692,12 @@ function formatTimestamp(iso) {
|
|
|
40650
40692
|
function formatEvent(event) {
|
|
40651
40693
|
const color = levelColor(event.Level);
|
|
40652
40694
|
const abbrev = levelAbbrev(event.Level);
|
|
40653
|
-
const ts10 =
|
|
40695
|
+
const ts10 = chalk251.dim(formatTimestamp(event.Timestamp));
|
|
40654
40696
|
const msg = renderMessage(event);
|
|
40655
40697
|
const lines2 = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
|
|
40656
40698
|
if (event.Exception) {
|
|
40657
40699
|
for (const line of event.Exception.split("\n")) {
|
|
40658
|
-
lines2.push(
|
|
40700
|
+
lines2.push(chalk251.red(` ${line}`));
|
|
40659
40701
|
}
|
|
40660
40702
|
}
|
|
40661
40703
|
return lines2.join("\n");
|
|
@@ -40688,11 +40730,11 @@ function rejectTimestampFilter(filter) {
|
|
|
40688
40730
|
}
|
|
40689
40731
|
|
|
40690
40732
|
// src/shared/resolveNamedConnection.ts
|
|
40691
|
-
import
|
|
40733
|
+
import chalk252 from "chalk";
|
|
40692
40734
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
40693
40735
|
if (connections.length === 0) {
|
|
40694
40736
|
console.error(
|
|
40695
|
-
|
|
40737
|
+
chalk252.red(
|
|
40696
40738
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
40697
40739
|
)
|
|
40698
40740
|
);
|
|
@@ -40701,7 +40743,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
40701
40743
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
40702
40744
|
const connection = connections.find((c) => c.name === target);
|
|
40703
40745
|
if (!connection) {
|
|
40704
|
-
console.error(
|
|
40746
|
+
console.error(chalk252.red(`${kind} connection "${target}" not found.`));
|
|
40705
40747
|
process.exit(1);
|
|
40706
40748
|
}
|
|
40707
40749
|
return connection;
|
|
@@ -40730,7 +40772,7 @@ async function seqQuery(filter, options2) {
|
|
|
40730
40772
|
new URLSearchParams({ filter, count: String(count10) })
|
|
40731
40773
|
);
|
|
40732
40774
|
if (events.length === 0) {
|
|
40733
|
-
console.log(
|
|
40775
|
+
console.log(chalk253.yellow("No events found."));
|
|
40734
40776
|
return;
|
|
40735
40777
|
}
|
|
40736
40778
|
if (options2.json) {
|
|
@@ -40741,11 +40783,11 @@ async function seqQuery(filter, options2) {
|
|
|
40741
40783
|
for (const event of chronological) {
|
|
40742
40784
|
console.log(formatEvent(event));
|
|
40743
40785
|
}
|
|
40744
|
-
console.log(
|
|
40786
|
+
console.log(chalk253.dim(`
|
|
40745
40787
|
${events.length} events`));
|
|
40746
40788
|
if (events.length >= count10) {
|
|
40747
40789
|
console.log(
|
|
40748
|
-
|
|
40790
|
+
chalk253.yellow(
|
|
40749
40791
|
`Results limited to ${count10}. Use --count to retrieve more.`
|
|
40750
40792
|
)
|
|
40751
40793
|
);
|
|
@@ -40753,10 +40795,10 @@ ${events.length} events`));
|
|
|
40753
40795
|
}
|
|
40754
40796
|
|
|
40755
40797
|
// src/shared/setNamedDefaultConnection.ts
|
|
40756
|
-
import
|
|
40798
|
+
import chalk254 from "chalk";
|
|
40757
40799
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
40758
40800
|
if (!connections.find((c) => c.name === name)) {
|
|
40759
|
-
console.error(
|
|
40801
|
+
console.error(chalk254.red(`Connection "${name}" not found.`));
|
|
40760
40802
|
process.exit(1);
|
|
40761
40803
|
}
|
|
40762
40804
|
setDefault(name);
|
|
@@ -41058,7 +41100,7 @@ function registerSlack(program) {
|
|
|
41058
41100
|
}
|
|
41059
41101
|
|
|
41060
41102
|
// src/commands/sql/sqlAuth.ts
|
|
41061
|
-
import
|
|
41103
|
+
import chalk256 from "chalk";
|
|
41062
41104
|
|
|
41063
41105
|
// src/commands/sql/loadConnections.ts
|
|
41064
41106
|
function loadConnections3() {
|
|
@@ -41087,7 +41129,7 @@ function setDefaultConnection2(name) {
|
|
|
41087
41129
|
}
|
|
41088
41130
|
|
|
41089
41131
|
// src/commands/sql/promptConnection.ts
|
|
41090
|
-
import
|
|
41132
|
+
import chalk255 from "chalk";
|
|
41091
41133
|
async function promptConnection3(existingNames) {
|
|
41092
41134
|
const name = await promptInput("name", "Connection name:", "default");
|
|
41093
41135
|
assertUniqueName(existingNames, name);
|
|
@@ -41095,7 +41137,7 @@ async function promptConnection3(existingNames) {
|
|
|
41095
41137
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
41096
41138
|
const port = Number.parseInt(portStr, 10);
|
|
41097
41139
|
if (!Number.isFinite(port)) {
|
|
41098
|
-
console.error(
|
|
41140
|
+
console.error(chalk255.red(`Invalid port "${portStr}".`));
|
|
41099
41141
|
process.exit(1);
|
|
41100
41142
|
}
|
|
41101
41143
|
const user = await promptInput("user", "User:");
|
|
@@ -41108,13 +41150,13 @@ async function promptConnection3(existingNames) {
|
|
|
41108
41150
|
var sqlAuth = createConnectionAuth({
|
|
41109
41151
|
load: loadConnections3,
|
|
41110
41152
|
save: saveConnections3,
|
|
41111
|
-
format: (c) => `${
|
|
41153
|
+
format: (c) => `${chalk256.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
41112
41154
|
promptNew: promptConnection3,
|
|
41113
41155
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
41114
41156
|
});
|
|
41115
41157
|
|
|
41116
41158
|
// src/commands/sql/printTable.ts
|
|
41117
|
-
import
|
|
41159
|
+
import chalk257 from "chalk";
|
|
41118
41160
|
function formatCell(value) {
|
|
41119
41161
|
if (value === null || value === void 0) return "";
|
|
41120
41162
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -41123,7 +41165,7 @@ function formatCell(value) {
|
|
|
41123
41165
|
}
|
|
41124
41166
|
function printTable(rows) {
|
|
41125
41167
|
if (rows.length === 0) {
|
|
41126
|
-
console.log(
|
|
41168
|
+
console.log(chalk257.yellow("(no rows)"));
|
|
41127
41169
|
return;
|
|
41128
41170
|
}
|
|
41129
41171
|
const columns = Object.keys(rows[0]);
|
|
@@ -41131,13 +41173,13 @@ function printTable(rows) {
|
|
|
41131
41173
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
41132
41174
|
);
|
|
41133
41175
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
41134
|
-
console.log(
|
|
41135
|
-
console.log(
|
|
41176
|
+
console.log(chalk257.dim(header));
|
|
41177
|
+
console.log(chalk257.dim("-".repeat(header.length)));
|
|
41136
41178
|
for (const row3 of rows) {
|
|
41137
41179
|
const line = columns.map((c, i) => formatCell(row3[c]).padEnd(widths[i])).join(" ");
|
|
41138
41180
|
console.log(line);
|
|
41139
41181
|
}
|
|
41140
|
-
console.log(
|
|
41182
|
+
console.log(chalk257.dim(`
|
|
41141
41183
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
41142
41184
|
}
|
|
41143
41185
|
|
|
@@ -41197,7 +41239,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
41197
41239
|
}
|
|
41198
41240
|
|
|
41199
41241
|
// src/commands/sql/sqlMutate.ts
|
|
41200
|
-
import
|
|
41242
|
+
import chalk258 from "chalk";
|
|
41201
41243
|
|
|
41202
41244
|
// src/commands/sql/isMutation.ts
|
|
41203
41245
|
var MUTATION_KEYWORDS = [
|
|
@@ -41231,7 +41273,7 @@ function isMutation(sql27) {
|
|
|
41231
41273
|
async function sqlMutate(query, connectionName) {
|
|
41232
41274
|
if (!isMutation(query)) {
|
|
41233
41275
|
console.error(
|
|
41234
|
-
|
|
41276
|
+
chalk258.red(
|
|
41235
41277
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
41236
41278
|
)
|
|
41237
41279
|
);
|
|
@@ -41241,18 +41283,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
41241
41283
|
const pool = await sqlConnect(conn);
|
|
41242
41284
|
try {
|
|
41243
41285
|
const result = await pool.request().query(query);
|
|
41244
|
-
console.log(
|
|
41286
|
+
console.log(chalk258.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
41245
41287
|
} finally {
|
|
41246
41288
|
await pool.close();
|
|
41247
41289
|
}
|
|
41248
41290
|
}
|
|
41249
41291
|
|
|
41250
41292
|
// src/commands/sql/sqlQuery.ts
|
|
41251
|
-
import
|
|
41293
|
+
import chalk259 from "chalk";
|
|
41252
41294
|
async function sqlQuery(query, connectionName) {
|
|
41253
41295
|
if (isMutation(query)) {
|
|
41254
41296
|
console.error(
|
|
41255
|
-
|
|
41297
|
+
chalk259.red(
|
|
41256
41298
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
41257
41299
|
)
|
|
41258
41300
|
);
|
|
@@ -41267,7 +41309,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
41267
41309
|
printTable(rows);
|
|
41268
41310
|
} else {
|
|
41269
41311
|
console.log(
|
|
41270
|
-
|
|
41312
|
+
chalk259.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
41271
41313
|
);
|
|
41272
41314
|
}
|
|
41273
41315
|
} finally {
|
|
@@ -41682,7 +41724,7 @@ function syncPi(claudeDir, options2) {
|
|
|
41682
41724
|
// src/commands/sync/syncSettings.ts
|
|
41683
41725
|
import * as fs46 from "fs";
|
|
41684
41726
|
import * as path100 from "path";
|
|
41685
|
-
import
|
|
41727
|
+
import chalk260 from "chalk";
|
|
41686
41728
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
41687
41729
|
const source = path100.join(claudeDir, "settings.json");
|
|
41688
41730
|
const target = path100.join(targetBase, "settings.json");
|
|
@@ -41701,7 +41743,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
41701
41743
|
if (mergedContent !== normalizedTarget) {
|
|
41702
41744
|
if (!options2?.yes) {
|
|
41703
41745
|
console.log(
|
|
41704
|
-
|
|
41746
|
+
chalk260.yellow(
|
|
41705
41747
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
41706
41748
|
)
|
|
41707
41749
|
);
|
|
@@ -41709,7 +41751,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
41709
41751
|
printDiff(targetContent, mergedContent);
|
|
41710
41752
|
printAutoConfirmHint();
|
|
41711
41753
|
const confirm = await promptConfirm(
|
|
41712
|
-
|
|
41754
|
+
chalk260.red("Overwrite existing settings.json?"),
|
|
41713
41755
|
false
|
|
41714
41756
|
);
|
|
41715
41757
|
if (!confirm) {
|
|
@@ -44257,7 +44299,7 @@ function parseEnvPairs(pairs) {
|
|
|
44257
44299
|
}
|
|
44258
44300
|
|
|
44259
44301
|
// src/commands/run/parseParamSpecs.ts
|
|
44260
|
-
function
|
|
44302
|
+
function fail9(spec) {
|
|
44261
44303
|
console.error(
|
|
44262
44304
|
`--param must be <name>, <name>! or <name>=<default>, got "${spec}"`
|
|
44263
44305
|
);
|
|
@@ -44267,14 +44309,14 @@ function parseParamSpec(spec) {
|
|
|
44267
44309
|
const eq46 = spec.indexOf("=");
|
|
44268
44310
|
const name = eq46 === -1 ? spec : spec.slice(0, eq46);
|
|
44269
44311
|
if (eq46 !== -1) {
|
|
44270
|
-
if (eq46 === 0 || name.endsWith("!"))
|
|
44312
|
+
if (eq46 === 0 || name.endsWith("!")) fail9(spec);
|
|
44271
44313
|
return { name, default: spec.slice(eq46 + 1) };
|
|
44272
44314
|
}
|
|
44273
44315
|
if (name.endsWith("!")) {
|
|
44274
|
-
if (name.length === 1)
|
|
44316
|
+
if (name.length === 1) fail9(spec);
|
|
44275
44317
|
return { name: name.slice(0, -1), required: true };
|
|
44276
44318
|
}
|
|
44277
|
-
if (name.length === 0)
|
|
44319
|
+
if (name.length === 0) fail9(spec);
|
|
44278
44320
|
return { name };
|
|
44279
44321
|
}
|
|
44280
44322
|
function parseParamSpecs(specs) {
|
|
@@ -44533,18 +44575,18 @@ function registerRun(program) {
|
|
|
44533
44575
|
}
|
|
44534
44576
|
|
|
44535
44577
|
// src/commands/sessions/nodes/formatLink.ts
|
|
44536
|
-
import
|
|
44578
|
+
import chalk261 from "chalk";
|
|
44537
44579
|
var STATE_COLOURS = {
|
|
44538
|
-
connected:
|
|
44539
|
-
connecting:
|
|
44540
|
-
disconnected:
|
|
44541
|
-
"version-blocked":
|
|
44580
|
+
connected: chalk261.green,
|
|
44581
|
+
connecting: chalk261.yellow,
|
|
44582
|
+
disconnected: chalk261.red,
|
|
44583
|
+
"version-blocked": chalk261.red
|
|
44542
44584
|
};
|
|
44543
44585
|
function formatLink(link3) {
|
|
44544
|
-
const colour = STATE_COLOURS[link3.state] ??
|
|
44586
|
+
const colour = STATE_COLOURS[link3.state] ?? chalk261.white;
|
|
44545
44587
|
const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
|
|
44546
44588
|
const error = link3.error ? `
|
|
44547
|
-
${
|
|
44589
|
+
${chalk261.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
|
|
44548
44590
|
return ` ${link3.name} ${colour(link3.state)} ${link3.url}${peer}${error}`;
|
|
44549
44591
|
}
|
|
44550
44592
|
|
|
@@ -52304,7 +52346,7 @@ async function closeSession() {
|
|
|
52304
52346
|
}
|
|
52305
52347
|
|
|
52306
52348
|
// src/commands/sessions/nodes/listNodes.ts
|
|
52307
|
-
import
|
|
52349
|
+
import chalk262 from "chalk";
|
|
52308
52350
|
async function nodesReport() {
|
|
52309
52351
|
const live = await queryNodes();
|
|
52310
52352
|
if (live)
|
|
@@ -52321,10 +52363,10 @@ async function listNodes(options2) {
|
|
|
52321
52363
|
console.log(JSON.stringify(report, null, 2));
|
|
52322
52364
|
return;
|
|
52323
52365
|
}
|
|
52324
|
-
console.log(`${report.local} ${
|
|
52366
|
+
console.log(`${report.local} ${chalk262.dim("(this node)")}`);
|
|
52325
52367
|
if (!report.daemonRunning)
|
|
52326
|
-
console.log(
|
|
52327
|
-
if (report.links.length === 0) console.log(
|
|
52368
|
+
console.log(chalk262.dim(" daemon not running; showing configured links"));
|
|
52369
|
+
if (report.links.length === 0) console.log(chalk262.dim(" no links"));
|
|
52328
52370
|
for (const link3 of report.links) console.log(formatLink(link3));
|
|
52329
52371
|
}
|
|
52330
52372
|
|
|
@@ -52346,7 +52388,7 @@ async function findUnlinkedWindowsNode(health2, platform = detectPlatform()) {
|
|
|
52346
52388
|
}
|
|
52347
52389
|
|
|
52348
52390
|
// src/commands/sessions/nodes/printReport.ts
|
|
52349
|
-
import
|
|
52391
|
+
import chalk263 from "chalk";
|
|
52350
52392
|
function printReport(report) {
|
|
52351
52393
|
if (report.links.length === 0) {
|
|
52352
52394
|
console.log(`${report.local} has no links`);
|
|
@@ -52360,11 +52402,11 @@ function printReport(report) {
|
|
|
52360
52402
|
for (const diagnosis of report.links) printDiagnosis(diagnosis);
|
|
52361
52403
|
}
|
|
52362
52404
|
function printDiagnosis(diagnosis) {
|
|
52363
|
-
console.log(`${
|
|
52405
|
+
console.log(`${chalk263.bold(diagnosis.name)} ${chalk263.dim(diagnosis.url)}`);
|
|
52364
52406
|
for (const hop of diagnosis.hops) {
|
|
52365
|
-
const mark = hop.ok ?
|
|
52407
|
+
const mark = hop.ok ? chalk263.green("\u2713") : chalk263.red("\u2717");
|
|
52366
52408
|
console.log(` ${mark} ${hop.hop.padEnd(9)} ${hop.detail ?? hop.error}`);
|
|
52367
|
-
if (hop.remediation) console.log(` ${
|
|
52409
|
+
if (hop.remediation) console.log(` ${chalk263.yellow(hop.remediation)}`);
|
|
52368
52410
|
}
|
|
52369
52411
|
}
|
|
52370
52412
|
|
|
@@ -52436,14 +52478,14 @@ function registerDiagnoseCommands(nodes, calledBy4) {
|
|
|
52436
52478
|
}
|
|
52437
52479
|
|
|
52438
52480
|
// src/commands/sessions/nodes/linkNode.ts
|
|
52439
|
-
import
|
|
52481
|
+
import chalk266 from "chalk";
|
|
52440
52482
|
|
|
52441
52483
|
// src/commands/sessions/nodes/notifyDaemonLinks.ts
|
|
52442
|
-
import
|
|
52484
|
+
import chalk264 from "chalk";
|
|
52443
52485
|
async function notifyDaemonLinks() {
|
|
52444
52486
|
if (!await isDaemonRunning()) {
|
|
52445
52487
|
console.log(
|
|
52446
|
-
|
|
52488
|
+
chalk264.yellow(
|
|
52447
52489
|
"The sessions daemon is not running; it loads the links when it starts."
|
|
52448
52490
|
)
|
|
52449
52491
|
);
|
|
@@ -52451,11 +52493,11 @@ async function notifyDaemonLinks() {
|
|
|
52451
52493
|
}
|
|
52452
52494
|
try {
|
|
52453
52495
|
await sendToDaemonAwaitAck({ type: "reload-links" });
|
|
52454
|
-
console.log(
|
|
52496
|
+
console.log(chalk264.dim("The sessions daemon reloaded its links."));
|
|
52455
52497
|
} catch (error) {
|
|
52456
52498
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
52457
52499
|
console.log(
|
|
52458
|
-
|
|
52500
|
+
chalk264.yellow(
|
|
52459
52501
|
`Could not notify the sessions daemon (${message3}); run \`assist daemon restart\` to apply the change.`
|
|
52460
52502
|
)
|
|
52461
52503
|
);
|
|
@@ -52463,7 +52505,7 @@ async function notifyDaemonLinks() {
|
|
|
52463
52505
|
}
|
|
52464
52506
|
|
|
52465
52507
|
// src/commands/sessions/nodes/readLinks.ts
|
|
52466
|
-
import
|
|
52508
|
+
import chalk265 from "chalk";
|
|
52467
52509
|
|
|
52468
52510
|
// src/commands/sessions/nodes/writeLinks.ts
|
|
52469
52511
|
async function writeLinks(links2) {
|
|
@@ -52486,7 +52528,7 @@ async function readLinks() {
|
|
|
52486
52528
|
await writeLinks(links2);
|
|
52487
52529
|
const dropped = stored.filter((link3) => !link3.url).map((link3) => link3.name);
|
|
52488
52530
|
console.log(
|
|
52489
|
-
|
|
52531
|
+
chalk265.yellow(`Removed ${dropped.join(", ")}: ${SSH_LINK_RETIRED}`)
|
|
52490
52532
|
);
|
|
52491
52533
|
return links2;
|
|
52492
52534
|
}
|
|
@@ -52542,7 +52584,7 @@ async function linkNode(name, url, options2) {
|
|
|
52542
52584
|
throw new Error(`${name} is this node; link to a different node`);
|
|
52543
52585
|
const link3 = await buildLink(name, url, options2);
|
|
52544
52586
|
await writeLinks([...others, link3]);
|
|
52545
|
-
console.log(
|
|
52587
|
+
console.log(chalk266.green(`Linked ${name} (${link3.url})`));
|
|
52546
52588
|
await notifyDaemonLinks();
|
|
52547
52589
|
}
|
|
52548
52590
|
|
|
@@ -52607,14 +52649,14 @@ function startPeerAction(name, action) {
|
|
|
52607
52649
|
const line = `nodes ${action} ${name} trace=${traceId}`;
|
|
52608
52650
|
console.log(line);
|
|
52609
52651
|
appendDaemonLog(line);
|
|
52610
|
-
const
|
|
52652
|
+
const fail11 = async (summary, error) => new Error(await describeFailure(name, summary, error));
|
|
52611
52653
|
return {
|
|
52612
52654
|
spec,
|
|
52613
52655
|
traceId,
|
|
52614
|
-
fail:
|
|
52656
|
+
fail: fail11,
|
|
52615
52657
|
async awaitReturn(sawDown, timeoutMs = RETURN_TIMEOUT_MS) {
|
|
52616
52658
|
const link3 = await awaitLinkReturn(name, { sawDown, timeoutMs });
|
|
52617
|
-
if (!link3) throw await
|
|
52659
|
+
if (!link3) throw await fail11(`${name} did not come back`);
|
|
52618
52660
|
return link3;
|
|
52619
52661
|
}
|
|
52620
52662
|
};
|
|
@@ -52725,16 +52767,16 @@ function registerPeerActionCommands(nodes, calledBy4) {
|
|
|
52725
52767
|
}
|
|
52726
52768
|
|
|
52727
52769
|
// src/commands/sessions/nodes/unlinkNode.ts
|
|
52728
|
-
import
|
|
52770
|
+
import chalk267 from "chalk";
|
|
52729
52771
|
async function unlinkNode(name) {
|
|
52730
52772
|
const links2 = await readLinks();
|
|
52731
52773
|
const remaining = links2.filter((link3) => link3.name !== name);
|
|
52732
52774
|
if (remaining.length === links2.length) {
|
|
52733
|
-
console.log(
|
|
52775
|
+
console.log(chalk267.yellow(`No link named ${name}`));
|
|
52734
52776
|
return;
|
|
52735
52777
|
}
|
|
52736
52778
|
await writeLinks(remaining);
|
|
52737
|
-
console.log(
|
|
52779
|
+
console.log(chalk267.green(`Unlinked ${name}`));
|
|
52738
52780
|
await notifyDaemonLinks();
|
|
52739
52781
|
}
|
|
52740
52782
|
|
|
@@ -52808,17 +52850,17 @@ function resolveTarget3(sessionId, server) {
|
|
|
52808
52850
|
async function sessionOutput(sessionId, options2) {
|
|
52809
52851
|
const count10 = Number.parseInt(options2.lines, 10);
|
|
52810
52852
|
if (!Number.isInteger(count10) || count10 < 1)
|
|
52811
|
-
return
|
|
52853
|
+
return fail10(`-n must be a positive integer, got ${options2.lines}`);
|
|
52812
52854
|
const target = resolveTarget3(sessionId, options2.server);
|
|
52813
|
-
if (typeof target === "string") return
|
|
52855
|
+
if (typeof target === "string") return fail10(target);
|
|
52814
52856
|
try {
|
|
52815
52857
|
const scrollback = await requestSessionOutput(target);
|
|
52816
52858
|
for (const line of lastLines(scrollback, count10)) console.log(line);
|
|
52817
52859
|
} catch (error) {
|
|
52818
|
-
|
|
52860
|
+
fail10(error instanceof Error ? error.message : String(error));
|
|
52819
52861
|
}
|
|
52820
52862
|
}
|
|
52821
|
-
function
|
|
52863
|
+
function fail10(message3) {
|
|
52822
52864
|
console.error(message3);
|
|
52823
52865
|
process.exitCode = 1;
|
|
52824
52866
|
}
|
|
@@ -52969,10 +53011,10 @@ function createProgram() {
|
|
|
52969
53011
|
}
|
|
52970
53012
|
|
|
52971
53013
|
// src/reportCliError.ts
|
|
52972
|
-
import
|
|
53014
|
+
import chalk268 from "chalk";
|
|
52973
53015
|
function reportCliError(error) {
|
|
52974
53016
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
|
|
52975
|
-
console.error(
|
|
53017
|
+
console.error(chalk268.red(error.message));
|
|
52976
53018
|
} else {
|
|
52977
53019
|
console.error(error);
|
|
52978
53020
|
}
|