@staff0rd/assist 0.1121.2 → 0.1122.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/claude/commands/add-rule.md +12 -6
- package/dist/built-version +1 -1
- package/dist/commands/sessions/web/bundle.js +401 -401
- package/dist/index.js +154 -116
- 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.1122.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -29153,17 +29153,17 @@ function routeCodexRpcLine(line, pending) {
|
|
|
29153
29153
|
}
|
|
29154
29154
|
|
|
29155
29155
|
// src/commands/sync/watchCodexAppServer.ts
|
|
29156
|
-
function watchCodexAppServer(child2,
|
|
29156
|
+
function watchCodexAppServer(child2, fail14) {
|
|
29157
29157
|
let stderr = "";
|
|
29158
29158
|
child2.stderr.on("data", (chunk2) => {
|
|
29159
29159
|
stderr += chunk2;
|
|
29160
29160
|
});
|
|
29161
|
-
child2.on("error",
|
|
29161
|
+
child2.on("error", fail14);
|
|
29162
29162
|
child2.stdin.on("error", () => {
|
|
29163
29163
|
});
|
|
29164
29164
|
child2.on(
|
|
29165
29165
|
"exit",
|
|
29166
|
-
(code) =>
|
|
29166
|
+
(code) => fail14(
|
|
29167
29167
|
new Error(
|
|
29168
29168
|
`codex app-server exited (${code})${stderr.trim() ? `: ${stderr.trim()}` : ""}`
|
|
29169
29169
|
)
|
|
@@ -50009,50 +50009,85 @@ function addRule(text18, options2) {
|
|
|
50009
50009
|
}
|
|
50010
50010
|
|
|
50011
50011
|
// src/commands/rules/addUserRule.ts
|
|
50012
|
+
import chalk280 from "chalk";
|
|
50013
|
+
|
|
50014
|
+
// src/commands/rules/addToRepoDb.ts
|
|
50015
|
+
import chalk279 from "chalk";
|
|
50016
|
+
|
|
50017
|
+
// src/commands/rules/appendRule.ts
|
|
50018
|
+
function appendRule(current2, rule) {
|
|
50019
|
+
return [...Array.isArray(current2) ? current2 : [], rule];
|
|
50020
|
+
}
|
|
50021
|
+
|
|
50022
|
+
// src/commands/rules/failRule.ts
|
|
50012
50023
|
import chalk278 from "chalk";
|
|
50013
|
-
function
|
|
50024
|
+
function failRule(message4) {
|
|
50014
50025
|
console.error(chalk278.red(message4));
|
|
50015
50026
|
process.exitCode = 1;
|
|
50016
50027
|
}
|
|
50017
|
-
|
|
50018
|
-
|
|
50028
|
+
|
|
50029
|
+
// src/commands/rules/addToRepoDb.ts
|
|
50030
|
+
async function addToRepoDb(rule, repo, cwd) {
|
|
50031
|
+
const repoName = typeof repo === "string" ? repo : void 0;
|
|
50032
|
+
const { block } = await resolveSharedRepoBlock(await getDb(), repoName, cwd);
|
|
50033
|
+
const advice = block.advice;
|
|
50034
|
+
const result = await applySharedRepoConfigSet(
|
|
50035
|
+
"advice.rules",
|
|
50036
|
+
appendRule(advice?.rules, rule),
|
|
50037
|
+
repoName,
|
|
50038
|
+
cwd
|
|
50039
|
+
);
|
|
50040
|
+
if (!result.ok) return failRule(result.errors.join("\n"));
|
|
50041
|
+
console.log(
|
|
50042
|
+
`Added ${chalk279.cyan(rule.title)} to advice.rules in repo (db): ${result.label}`
|
|
50043
|
+
);
|
|
50019
50044
|
}
|
|
50020
|
-
|
|
50021
|
-
|
|
50022
|
-
|
|
50045
|
+
|
|
50046
|
+
// src/commands/rules/userRuleOptionsError.ts
|
|
50047
|
+
function userRuleOptionsError(options2) {
|
|
50048
|
+
const targets = [
|
|
50049
|
+
options2.user && "--user",
|
|
50050
|
+
options2.node && "--node",
|
|
50051
|
+
options2.repo !== void 0 && "--repo"
|
|
50052
|
+
].filter(Boolean);
|
|
50053
|
+
if (targets.length > 1)
|
|
50054
|
+
return `${targets.join(", ")} each write advice.rules in a different scope (user (db), user (node), repo (db)); pass one`;
|
|
50023
50055
|
if (options2.scope !== void 0)
|
|
50024
|
-
return
|
|
50056
|
+
return `${targets[0]} writes advice.rules, not a CLAUDE.md, and cannot be combined with --scope`;
|
|
50025
50057
|
return void 0;
|
|
50026
50058
|
}
|
|
50059
|
+
|
|
50060
|
+
// src/commands/rules/addUserRule.ts
|
|
50027
50061
|
async function addToUserDb(rule) {
|
|
50028
|
-
const result = await applyUserConfigSet(
|
|
50029
|
-
|
|
50030
|
-
rule
|
|
50031
|
-
|
|
50032
|
-
if (!result.ok) return
|
|
50033
|
-
console.log(`Added ${
|
|
50062
|
+
const result = await applyUserConfigSet(
|
|
50063
|
+
"advice.rules",
|
|
50064
|
+
(current2) => appendRule(current2, rule)
|
|
50065
|
+
);
|
|
50066
|
+
if (!result.ok) return failRule(result.errors.join("\n"));
|
|
50067
|
+
console.log(`Added ${chalk280.cyan(rule.title)} to advice.rules in user (db)`);
|
|
50034
50068
|
}
|
|
50035
50069
|
function addToUserNode(rule, globalConfigPath) {
|
|
50036
50070
|
const advice = loadGlobalConfigRaw(globalConfigPath).advice;
|
|
50037
50071
|
const result = applyConfigSet(
|
|
50038
50072
|
"advice.rules",
|
|
50039
|
-
|
|
50073
|
+
appendRule(advice?.rules, rule),
|
|
50040
50074
|
true,
|
|
50041
50075
|
process.cwd(),
|
|
50042
50076
|
globalConfigPath
|
|
50043
50077
|
);
|
|
50044
|
-
if (!result.ok) return
|
|
50078
|
+
if (!result.ok) return failRule(result.errors.join("\n"));
|
|
50045
50079
|
console.log(
|
|
50046
|
-
`Added ${
|
|
50080
|
+
`Added ${chalk280.cyan(rule.title)} to advice.rules in user (node) (${globalConfigFileLabel(globalConfigPath)})`
|
|
50047
50081
|
);
|
|
50048
50082
|
}
|
|
50049
|
-
async function addUserRule(text18, options2, globalConfigPath = getGlobalConfigPath()) {
|
|
50050
|
-
const error =
|
|
50051
|
-
if (error) return
|
|
50083
|
+
async function addUserRule(text18, options2, globalConfigPath = getGlobalConfigPath(), cwd = process.cwd()) {
|
|
50084
|
+
const error = userRuleOptionsError(options2);
|
|
50085
|
+
if (error) return failRule(error);
|
|
50052
50086
|
const rule = { title: options2.title?.trim() ?? "", text: text18.trim() };
|
|
50053
50087
|
if (rule.text === "" || rule.title === "")
|
|
50054
|
-
return
|
|
50088
|
+
return failRule("advice.rules entries need both rule text and --title");
|
|
50055
50089
|
if (options2.user) return addToUserDb(rule);
|
|
50090
|
+
if (options2.repo !== void 0) return addToRepoDb(rule, options2.repo, cwd);
|
|
50056
50091
|
addToUserNode(rule, globalConfigPath);
|
|
50057
50092
|
}
|
|
50058
50093
|
|
|
@@ -50073,8 +50108,11 @@ function registerRulesAdd(rulesCommand) {
|
|
|
50073
50108
|
).option(
|
|
50074
50109
|
"--node",
|
|
50075
50110
|
"As --user, but append to advice.rules in user (node), this node's ~/.assist.yml"
|
|
50111
|
+
).option(
|
|
50112
|
+
"--repo [name]",
|
|
50113
|
+
"As --user, but append to advice.rules in repo (db), the shared per-repo override every node sees, for the current repo or the named one"
|
|
50076
50114
|
).action(
|
|
50077
|
-
(text18, options2) => options2.user || options2.node ? addUserRule(text18, options2) : addRule(text18, options2)
|
|
50115
|
+
(text18, options2) => options2.user || options2.node || options2.repo !== void 0 ? addUserRule(text18, options2) : addRule(text18, options2)
|
|
50078
50116
|
),
|
|
50079
50117
|
"/add-rule and /fix-rules"
|
|
50080
50118
|
);
|
|
@@ -50098,7 +50136,7 @@ function registerRules(program) {
|
|
|
50098
50136
|
}
|
|
50099
50137
|
|
|
50100
50138
|
// src/commands/seq/seqAuth.ts
|
|
50101
|
-
import
|
|
50139
|
+
import chalk282 from "chalk";
|
|
50102
50140
|
|
|
50103
50141
|
// src/commands/seq/loadConnections.ts
|
|
50104
50142
|
function loadConnections2() {
|
|
@@ -50127,10 +50165,10 @@ function setDefaultConnection(name2) {
|
|
|
50127
50165
|
}
|
|
50128
50166
|
|
|
50129
50167
|
// src/shared/assertUniqueName.ts
|
|
50130
|
-
import
|
|
50168
|
+
import chalk281 from "chalk";
|
|
50131
50169
|
function assertUniqueName(existingNames, name2) {
|
|
50132
50170
|
if (existingNames.includes(name2)) {
|
|
50133
|
-
console.error(
|
|
50171
|
+
console.error(chalk281.red(`Connection "${name2}" already exists.`));
|
|
50134
50172
|
process.exit(1);
|
|
50135
50173
|
}
|
|
50136
50174
|
}
|
|
@@ -50148,16 +50186,16 @@ async function promptConnection2(existingNames) {
|
|
|
50148
50186
|
var seqAuth = createConnectionAuth({
|
|
50149
50187
|
load: loadConnections2,
|
|
50150
50188
|
save: saveConnections2,
|
|
50151
|
-
format: (c) => `${
|
|
50189
|
+
format: (c) => `${chalk282.bold(c.name)} ${c.url}`,
|
|
50152
50190
|
promptNew: promptConnection2,
|
|
50153
50191
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
50154
50192
|
});
|
|
50155
50193
|
|
|
50156
50194
|
// src/commands/seq/seqQuery.ts
|
|
50157
|
-
import
|
|
50195
|
+
import chalk286 from "chalk";
|
|
50158
50196
|
|
|
50159
50197
|
// src/commands/seq/fetchSeq.ts
|
|
50160
|
-
import
|
|
50198
|
+
import chalk283 from "chalk";
|
|
50161
50199
|
async function fetchSeq(conn, path128, params) {
|
|
50162
50200
|
const url = `${conn.url}${path128}?${params}`;
|
|
50163
50201
|
const response = await fetch(url, {
|
|
@@ -50168,7 +50206,7 @@ async function fetchSeq(conn, path128, params) {
|
|
|
50168
50206
|
});
|
|
50169
50207
|
if (!response.ok) {
|
|
50170
50208
|
const body = await response.text();
|
|
50171
|
-
console.error(
|
|
50209
|
+
console.error(chalk283.red(`Seq returned ${response.status}: ${body}`));
|
|
50172
50210
|
process.exit(1);
|
|
50173
50211
|
}
|
|
50174
50212
|
return response;
|
|
@@ -50227,23 +50265,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
50227
50265
|
}
|
|
50228
50266
|
|
|
50229
50267
|
// src/commands/seq/formatEvent.ts
|
|
50230
|
-
import
|
|
50268
|
+
import chalk284 from "chalk";
|
|
50231
50269
|
function levelColor(level) {
|
|
50232
50270
|
switch (level) {
|
|
50233
50271
|
case "Fatal":
|
|
50234
|
-
return
|
|
50272
|
+
return chalk284.bgRed.white;
|
|
50235
50273
|
case "Error":
|
|
50236
|
-
return
|
|
50274
|
+
return chalk284.red;
|
|
50237
50275
|
case "Warning":
|
|
50238
|
-
return
|
|
50276
|
+
return chalk284.yellow;
|
|
50239
50277
|
case "Information":
|
|
50240
|
-
return
|
|
50278
|
+
return chalk284.cyan;
|
|
50241
50279
|
case "Debug":
|
|
50242
|
-
return
|
|
50280
|
+
return chalk284.gray;
|
|
50243
50281
|
case "Verbose":
|
|
50244
|
-
return
|
|
50282
|
+
return chalk284.dim;
|
|
50245
50283
|
default:
|
|
50246
|
-
return
|
|
50284
|
+
return chalk284.white;
|
|
50247
50285
|
}
|
|
50248
50286
|
}
|
|
50249
50287
|
function levelAbbrev(level) {
|
|
@@ -50284,12 +50322,12 @@ function formatTimestamp(iso) {
|
|
|
50284
50322
|
function formatEvent(event) {
|
|
50285
50323
|
const color = levelColor(event.Level);
|
|
50286
50324
|
const abbrev = levelAbbrev(event.Level);
|
|
50287
|
-
const ts10 =
|
|
50325
|
+
const ts10 = chalk284.dim(formatTimestamp(event.Timestamp));
|
|
50288
50326
|
const msg = renderMessage(event);
|
|
50289
50327
|
const lines = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
|
|
50290
50328
|
if (event.Exception) {
|
|
50291
50329
|
for (const line of event.Exception.split("\n")) {
|
|
50292
|
-
lines.push(
|
|
50330
|
+
lines.push(chalk284.red(` ${line}`));
|
|
50293
50331
|
}
|
|
50294
50332
|
}
|
|
50295
50333
|
return lines.join("\n");
|
|
@@ -50322,11 +50360,11 @@ function rejectTimestampFilter(filter) {
|
|
|
50322
50360
|
}
|
|
50323
50361
|
|
|
50324
50362
|
// src/shared/resolveNamedConnection.ts
|
|
50325
|
-
import
|
|
50363
|
+
import chalk285 from "chalk";
|
|
50326
50364
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
50327
50365
|
if (connections.length === 0) {
|
|
50328
50366
|
console.error(
|
|
50329
|
-
|
|
50367
|
+
chalk285.red(
|
|
50330
50368
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
50331
50369
|
)
|
|
50332
50370
|
);
|
|
@@ -50335,7 +50373,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
50335
50373
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
50336
50374
|
const connection = connections.find((c) => c.name === target);
|
|
50337
50375
|
if (!connection) {
|
|
50338
|
-
console.error(
|
|
50376
|
+
console.error(chalk285.red(`${kind} connection "${target}" not found.`));
|
|
50339
50377
|
process.exit(1);
|
|
50340
50378
|
}
|
|
50341
50379
|
return connection;
|
|
@@ -50364,7 +50402,7 @@ async function seqQuery(filter, options2) {
|
|
|
50364
50402
|
new URLSearchParams({ filter, count: String(count10) })
|
|
50365
50403
|
);
|
|
50366
50404
|
if (events.length === 0) {
|
|
50367
|
-
console.log(
|
|
50405
|
+
console.log(chalk286.yellow("No events found."));
|
|
50368
50406
|
return;
|
|
50369
50407
|
}
|
|
50370
50408
|
if (options2.json) {
|
|
@@ -50375,11 +50413,11 @@ async function seqQuery(filter, options2) {
|
|
|
50375
50413
|
for (const event of chronological) {
|
|
50376
50414
|
console.log(formatEvent(event));
|
|
50377
50415
|
}
|
|
50378
|
-
console.log(
|
|
50416
|
+
console.log(chalk286.dim(`
|
|
50379
50417
|
${events.length} events`));
|
|
50380
50418
|
if (events.length >= count10) {
|
|
50381
50419
|
console.log(
|
|
50382
|
-
|
|
50420
|
+
chalk286.yellow(
|
|
50383
50421
|
`Results limited to ${count10}. Use --count to retrieve more.`
|
|
50384
50422
|
)
|
|
50385
50423
|
);
|
|
@@ -50387,10 +50425,10 @@ ${events.length} events`));
|
|
|
50387
50425
|
}
|
|
50388
50426
|
|
|
50389
50427
|
// src/shared/setNamedDefaultConnection.ts
|
|
50390
|
-
import
|
|
50428
|
+
import chalk287 from "chalk";
|
|
50391
50429
|
function setNamedDefaultConnection(connections, name2, setDefault, kind) {
|
|
50392
50430
|
if (!connections.find((c) => c.name === name2)) {
|
|
50393
|
-
console.error(
|
|
50431
|
+
console.error(chalk287.red(`Connection "${name2}" not found.`));
|
|
50394
50432
|
process.exit(1);
|
|
50395
50433
|
}
|
|
50396
50434
|
setDefault(name2);
|
|
@@ -50641,7 +50679,7 @@ function registerSlack(program) {
|
|
|
50641
50679
|
}
|
|
50642
50680
|
|
|
50643
50681
|
// src/commands/sql/sqlAuth.ts
|
|
50644
|
-
import
|
|
50682
|
+
import chalk289 from "chalk";
|
|
50645
50683
|
|
|
50646
50684
|
// src/commands/sql/loadConnections.ts
|
|
50647
50685
|
function loadConnections3() {
|
|
@@ -50670,7 +50708,7 @@ function setDefaultConnection2(name2) {
|
|
|
50670
50708
|
}
|
|
50671
50709
|
|
|
50672
50710
|
// src/commands/sql/promptConnection.ts
|
|
50673
|
-
import
|
|
50711
|
+
import chalk288 from "chalk";
|
|
50674
50712
|
async function promptConnection3(existingNames) {
|
|
50675
50713
|
const name2 = await promptInput("name", "Connection name:", "default");
|
|
50676
50714
|
assertUniqueName(existingNames, name2);
|
|
@@ -50678,7 +50716,7 @@ async function promptConnection3(existingNames) {
|
|
|
50678
50716
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
50679
50717
|
const port = Number.parseInt(portStr, 10);
|
|
50680
50718
|
if (!Number.isFinite(port)) {
|
|
50681
|
-
console.error(
|
|
50719
|
+
console.error(chalk288.red(`Invalid port "${portStr}".`));
|
|
50682
50720
|
process.exit(1);
|
|
50683
50721
|
}
|
|
50684
50722
|
const user = await promptInput("user", "User:");
|
|
@@ -50691,13 +50729,13 @@ async function promptConnection3(existingNames) {
|
|
|
50691
50729
|
var sqlAuth = createConnectionAuth({
|
|
50692
50730
|
load: loadConnections3,
|
|
50693
50731
|
save: saveConnections3,
|
|
50694
|
-
format: (c) => `${
|
|
50732
|
+
format: (c) => `${chalk289.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
50695
50733
|
promptNew: promptConnection3,
|
|
50696
50734
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
50697
50735
|
});
|
|
50698
50736
|
|
|
50699
50737
|
// src/commands/sql/printTable.ts
|
|
50700
|
-
import
|
|
50738
|
+
import chalk290 from "chalk";
|
|
50701
50739
|
function formatCell(value) {
|
|
50702
50740
|
if (value === null || value === void 0) return "";
|
|
50703
50741
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -50706,7 +50744,7 @@ function formatCell(value) {
|
|
|
50706
50744
|
}
|
|
50707
50745
|
function printTable(rows) {
|
|
50708
50746
|
if (rows.length === 0) {
|
|
50709
|
-
console.log(
|
|
50747
|
+
console.log(chalk290.yellow("(no rows)"));
|
|
50710
50748
|
return;
|
|
50711
50749
|
}
|
|
50712
50750
|
const columns = Object.keys(rows[0]);
|
|
@@ -50714,13 +50752,13 @@ function printTable(rows) {
|
|
|
50714
50752
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
50715
50753
|
);
|
|
50716
50754
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
50717
|
-
console.log(
|
|
50718
|
-
console.log(
|
|
50755
|
+
console.log(chalk290.dim(header));
|
|
50756
|
+
console.log(chalk290.dim("-".repeat(header.length)));
|
|
50719
50757
|
for (const row2 of rows) {
|
|
50720
50758
|
const line = columns.map((c, i) => formatCell(row2[c]).padEnd(widths[i])).join(" ");
|
|
50721
50759
|
console.log(line);
|
|
50722
50760
|
}
|
|
50723
|
-
console.log(
|
|
50761
|
+
console.log(chalk290.dim(`
|
|
50724
50762
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
50725
50763
|
}
|
|
50726
50764
|
|
|
@@ -50780,7 +50818,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
50780
50818
|
}
|
|
50781
50819
|
|
|
50782
50820
|
// src/commands/sql/sqlMutate.ts
|
|
50783
|
-
import
|
|
50821
|
+
import chalk291 from "chalk";
|
|
50784
50822
|
|
|
50785
50823
|
// src/commands/sql/isMutation.ts
|
|
50786
50824
|
var MUTATION_KEYWORDS = [
|
|
@@ -50814,7 +50852,7 @@ function isMutation(sql33) {
|
|
|
50814
50852
|
async function sqlMutate(query, connectionName) {
|
|
50815
50853
|
if (!isMutation(query)) {
|
|
50816
50854
|
console.error(
|
|
50817
|
-
|
|
50855
|
+
chalk291.red(
|
|
50818
50856
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
50819
50857
|
)
|
|
50820
50858
|
);
|
|
@@ -50824,18 +50862,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
50824
50862
|
const pool = await sqlConnect(conn);
|
|
50825
50863
|
try {
|
|
50826
50864
|
const result = await pool.request().query(query);
|
|
50827
|
-
console.log(
|
|
50865
|
+
console.log(chalk291.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
50828
50866
|
} finally {
|
|
50829
50867
|
await pool.close();
|
|
50830
50868
|
}
|
|
50831
50869
|
}
|
|
50832
50870
|
|
|
50833
50871
|
// src/commands/sql/sqlQuery.ts
|
|
50834
|
-
import
|
|
50872
|
+
import chalk292 from "chalk";
|
|
50835
50873
|
async function sqlQuery(query, connectionName) {
|
|
50836
50874
|
if (isMutation(query)) {
|
|
50837
50875
|
console.error(
|
|
50838
|
-
|
|
50876
|
+
chalk292.red(
|
|
50839
50877
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
50840
50878
|
)
|
|
50841
50879
|
);
|
|
@@ -50850,7 +50888,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
50850
50888
|
printTable(rows);
|
|
50851
50889
|
} else {
|
|
50852
50890
|
console.log(
|
|
50853
|
-
|
|
50891
|
+
chalk292.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
50854
50892
|
);
|
|
50855
50893
|
}
|
|
50856
50894
|
} finally {
|
|
@@ -50922,11 +50960,11 @@ import * as fs56 from "fs";
|
|
|
50922
50960
|
import * as fs52 from "fs";
|
|
50923
50961
|
|
|
50924
50962
|
// src/commands/sync/resolveSyncConflicts.ts
|
|
50925
|
-
import
|
|
50963
|
+
import chalk293 from "chalk";
|
|
50926
50964
|
async function resolveSyncConflicts(conflicts, yes) {
|
|
50927
50965
|
if (conflicts.length === 0) return [];
|
|
50928
50966
|
console.log(
|
|
50929
|
-
|
|
50967
|
+
chalk293.yellow(
|
|
50930
50968
|
`
|
|
50931
50969
|
\u26A0\uFE0F ${conflicts.length} file(s) exist that assist sync did not write:`
|
|
50932
50970
|
)
|
|
@@ -50935,7 +50973,7 @@ async function resolveSyncConflicts(conflicts, yes) {
|
|
|
50935
50973
|
console.log(` ${action} ${target}`);
|
|
50936
50974
|
}
|
|
50937
50975
|
const confirmed = !yes && await promptConfirm(
|
|
50938
|
-
|
|
50976
|
+
chalk293.red("Replace them with assist's versions?"),
|
|
50939
50977
|
false
|
|
50940
50978
|
);
|
|
50941
50979
|
if (confirmed) return conflicts;
|
|
@@ -51530,7 +51568,7 @@ function syncPi(claudeDir, files, options2) {
|
|
|
51530
51568
|
// src/commands/sync/syncSettings.ts
|
|
51531
51569
|
import * as fs68 from "fs";
|
|
51532
51570
|
import * as path123 from "path";
|
|
51533
|
-
import
|
|
51571
|
+
import chalk294 from "chalk";
|
|
51534
51572
|
|
|
51535
51573
|
// src/commands/sync/mergeSettings.ts
|
|
51536
51574
|
function isPlainObject7(value) {
|
|
@@ -51599,7 +51637,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
51599
51637
|
if (mergedContent !== normalizedTarget) {
|
|
51600
51638
|
if (!options2?.yes) {
|
|
51601
51639
|
console.log(
|
|
51602
|
-
|
|
51640
|
+
chalk294.yellow(
|
|
51603
51641
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
51604
51642
|
)
|
|
51605
51643
|
);
|
|
@@ -51607,7 +51645,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
51607
51645
|
printDiff(targetContent, mergedContent);
|
|
51608
51646
|
printAutoConfirmHint();
|
|
51609
51647
|
const confirm = await promptConfirm(
|
|
51610
|
-
|
|
51648
|
+
chalk294.red("Write merged settings.json?"),
|
|
51611
51649
|
false
|
|
51612
51650
|
);
|
|
51613
51651
|
if (!confirm) {
|
|
@@ -51668,17 +51706,17 @@ function registerSync(program) {
|
|
|
51668
51706
|
}
|
|
51669
51707
|
|
|
51670
51708
|
// src/commands/testflight/testflightAdd.ts
|
|
51671
|
-
import
|
|
51709
|
+
import chalk295 from "chalk";
|
|
51672
51710
|
async function testflightAdd(email, options2) {
|
|
51673
51711
|
try {
|
|
51674
51712
|
const config = readTestflightConfig(loadConfig());
|
|
51675
51713
|
const { message: message4, waiting: waiting2 } = await addTesterOutcome(config, email, {
|
|
51676
51714
|
internal: options2.internal
|
|
51677
51715
|
});
|
|
51678
|
-
console.log(waiting2 ?
|
|
51716
|
+
console.log(waiting2 ? chalk295.yellow(message4) : chalk295.green(message4));
|
|
51679
51717
|
} catch (error) {
|
|
51680
51718
|
if (!(error instanceof TestflightError)) throw error;
|
|
51681
|
-
console.error(
|
|
51719
|
+
console.error(chalk295.red(error.message));
|
|
51682
51720
|
process.exit(1);
|
|
51683
51721
|
}
|
|
51684
51722
|
}
|
|
@@ -54330,7 +54368,7 @@ function parseEnvPairs(pairs) {
|
|
|
54330
54368
|
}
|
|
54331
54369
|
|
|
54332
54370
|
// src/commands/run/parseParamSpecs.ts
|
|
54333
|
-
function
|
|
54371
|
+
function fail12(spec) {
|
|
54334
54372
|
console.error(
|
|
54335
54373
|
`--param must be <name>, <name>! or <name>=<default>, got "${spec}"`
|
|
54336
54374
|
);
|
|
@@ -54340,14 +54378,14 @@ function parseParamSpec(spec) {
|
|
|
54340
54378
|
const eq60 = spec.indexOf("=");
|
|
54341
54379
|
const name2 = eq60 === -1 ? spec : spec.slice(0, eq60);
|
|
54342
54380
|
if (eq60 !== -1) {
|
|
54343
|
-
if (eq60 === 0 || name2.endsWith("!"))
|
|
54381
|
+
if (eq60 === 0 || name2.endsWith("!")) fail12(spec);
|
|
54344
54382
|
return { name: name2, default: spec.slice(eq60 + 1) };
|
|
54345
54383
|
}
|
|
54346
54384
|
if (name2.endsWith("!")) {
|
|
54347
|
-
if (name2.length === 1)
|
|
54385
|
+
if (name2.length === 1) fail12(spec);
|
|
54348
54386
|
return { name: name2.slice(0, -1), required: true };
|
|
54349
54387
|
}
|
|
54350
|
-
if (name2.length === 0)
|
|
54388
|
+
if (name2.length === 0) fail12(spec);
|
|
54351
54389
|
return { name: name2 };
|
|
54352
54390
|
}
|
|
54353
54391
|
function parseParamSpecs(specs) {
|
|
@@ -54656,18 +54694,18 @@ function registerRun(program) {
|
|
|
54656
54694
|
}
|
|
54657
54695
|
|
|
54658
54696
|
// src/commands/sessions/nodes/formatLink.ts
|
|
54659
|
-
import
|
|
54697
|
+
import chalk296 from "chalk";
|
|
54660
54698
|
var STATE_COLOURS = {
|
|
54661
|
-
connected:
|
|
54662
|
-
connecting:
|
|
54663
|
-
disconnected:
|
|
54664
|
-
"version-blocked":
|
|
54699
|
+
connected: chalk296.green,
|
|
54700
|
+
connecting: chalk296.yellow,
|
|
54701
|
+
disconnected: chalk296.red,
|
|
54702
|
+
"version-blocked": chalk296.red
|
|
54665
54703
|
};
|
|
54666
54704
|
function formatLink(link3) {
|
|
54667
|
-
const colour = STATE_COLOURS[link3.state] ??
|
|
54705
|
+
const colour = STATE_COLOURS[link3.state] ?? chalk296.white;
|
|
54668
54706
|
const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
|
|
54669
54707
|
const error = link3.error ? `
|
|
54670
|
-
${
|
|
54708
|
+
${chalk296.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
|
|
54671
54709
|
return ` ${link3.name} ${colour(link3.state)} ${link3.url}${peer}${error}`;
|
|
54672
54710
|
}
|
|
54673
54711
|
|
|
@@ -62308,7 +62346,7 @@ function creator(isNew, spawn14) {
|
|
|
62308
62346
|
}
|
|
62309
62347
|
sendTo(client, { type: "created", sessionId: result, isNew, traceId });
|
|
62310
62348
|
};
|
|
62311
|
-
const
|
|
62349
|
+
const fail14 = (client, d, error) => {
|
|
62312
62350
|
const reason4 = error instanceof Error ? error.message : String(error);
|
|
62313
62351
|
daemonLog(`${d.type} failed: ${reason4}`);
|
|
62314
62352
|
reply2(client, d, { error: `${d.type} failed: ${reason4}` });
|
|
@@ -62319,13 +62357,13 @@ function creator(isNew, spawn14) {
|
|
|
62319
62357
|
try {
|
|
62320
62358
|
result = spawn14(m, d);
|
|
62321
62359
|
} catch (error) {
|
|
62322
|
-
|
|
62360
|
+
fail14(client, d, error);
|
|
62323
62361
|
return;
|
|
62324
62362
|
}
|
|
62325
62363
|
if (result instanceof Promise)
|
|
62326
62364
|
result.then(
|
|
62327
62365
|
(resolved) => reply2(client, d, resolved),
|
|
62328
|
-
(error) =>
|
|
62366
|
+
(error) => fail14(client, d, error)
|
|
62329
62367
|
);
|
|
62330
62368
|
else reply2(client, d, result);
|
|
62331
62369
|
};
|
|
@@ -63480,7 +63518,7 @@ async function closeSession2() {
|
|
|
63480
63518
|
}
|
|
63481
63519
|
|
|
63482
63520
|
// src/commands/sessions/nodes/listNodes.ts
|
|
63483
|
-
import
|
|
63521
|
+
import chalk297 from "chalk";
|
|
63484
63522
|
async function nodesReport() {
|
|
63485
63523
|
const live = await queryNodes();
|
|
63486
63524
|
if (live)
|
|
@@ -63497,10 +63535,10 @@ async function listNodes(options2) {
|
|
|
63497
63535
|
console.log(JSON.stringify(report, null, 2));
|
|
63498
63536
|
return;
|
|
63499
63537
|
}
|
|
63500
|
-
console.log(`${report.local} ${
|
|
63538
|
+
console.log(`${report.local} ${chalk297.dim("(this node)")}`);
|
|
63501
63539
|
if (!report.daemonRunning)
|
|
63502
|
-
console.log(
|
|
63503
|
-
if (report.links.length === 0) console.log(
|
|
63540
|
+
console.log(chalk297.dim(" daemon not running; showing configured links"));
|
|
63541
|
+
if (report.links.length === 0) console.log(chalk297.dim(" no links"));
|
|
63504
63542
|
for (const link3 of report.links) console.log(formatLink(link3));
|
|
63505
63543
|
}
|
|
63506
63544
|
|
|
@@ -63522,7 +63560,7 @@ async function findUnlinkedWindowsNode(health2, platform = detectPlatform()) {
|
|
|
63522
63560
|
}
|
|
63523
63561
|
|
|
63524
63562
|
// src/commands/sessions/nodes/printReport.ts
|
|
63525
|
-
import
|
|
63563
|
+
import chalk298 from "chalk";
|
|
63526
63564
|
function printReport(report) {
|
|
63527
63565
|
if (report.links.length === 0) {
|
|
63528
63566
|
console.log(`${report.local} has no links`);
|
|
@@ -63536,11 +63574,11 @@ function printReport(report) {
|
|
|
63536
63574
|
for (const diagnosis of report.links) printDiagnosis(diagnosis);
|
|
63537
63575
|
}
|
|
63538
63576
|
function printDiagnosis(diagnosis) {
|
|
63539
|
-
console.log(`${
|
|
63577
|
+
console.log(`${chalk298.bold(diagnosis.name)} ${chalk298.dim(diagnosis.url)}`);
|
|
63540
63578
|
for (const hop of diagnosis.hops) {
|
|
63541
|
-
const mark = hop.ok ?
|
|
63579
|
+
const mark = hop.ok ? chalk298.green("\u2713") : chalk298.red("\u2717");
|
|
63542
63580
|
console.log(` ${mark} ${hop.hop.padEnd(9)} ${hop.detail ?? hop.error}`);
|
|
63543
|
-
if (hop.remediation) console.log(` ${
|
|
63581
|
+
if (hop.remediation) console.log(` ${chalk298.yellow(hop.remediation)}`);
|
|
63544
63582
|
}
|
|
63545
63583
|
}
|
|
63546
63584
|
|
|
@@ -63612,14 +63650,14 @@ function registerDiagnoseCommands(nodes, calledBy5) {
|
|
|
63612
63650
|
}
|
|
63613
63651
|
|
|
63614
63652
|
// src/commands/sessions/nodes/linkNode.ts
|
|
63615
|
-
import
|
|
63653
|
+
import chalk301 from "chalk";
|
|
63616
63654
|
|
|
63617
63655
|
// src/commands/sessions/nodes/notifyDaemonLinks.ts
|
|
63618
|
-
import
|
|
63656
|
+
import chalk299 from "chalk";
|
|
63619
63657
|
async function notifyDaemonLinks() {
|
|
63620
63658
|
if (!await isDaemonRunning()) {
|
|
63621
63659
|
console.log(
|
|
63622
|
-
|
|
63660
|
+
chalk299.yellow(
|
|
63623
63661
|
"The sessions daemon is not running; it loads the links when it starts."
|
|
63624
63662
|
)
|
|
63625
63663
|
);
|
|
@@ -63627,11 +63665,11 @@ async function notifyDaemonLinks() {
|
|
|
63627
63665
|
}
|
|
63628
63666
|
try {
|
|
63629
63667
|
await sendToDaemonAwaitAck({ type: "reload-links" });
|
|
63630
|
-
console.log(
|
|
63668
|
+
console.log(chalk299.dim("The sessions daemon reloaded its links."));
|
|
63631
63669
|
} catch (error) {
|
|
63632
63670
|
const message4 = error instanceof Error ? error.message : String(error);
|
|
63633
63671
|
console.log(
|
|
63634
|
-
|
|
63672
|
+
chalk299.yellow(
|
|
63635
63673
|
`Could not notify the sessions daemon (${message4}); run \`assist daemon restart\` to apply the change.`
|
|
63636
63674
|
)
|
|
63637
63675
|
);
|
|
@@ -63639,7 +63677,7 @@ async function notifyDaemonLinks() {
|
|
|
63639
63677
|
}
|
|
63640
63678
|
|
|
63641
63679
|
// src/commands/sessions/nodes/readLinks.ts
|
|
63642
|
-
import
|
|
63680
|
+
import chalk300 from "chalk";
|
|
63643
63681
|
|
|
63644
63682
|
// src/commands/sessions/nodes/writeLinks.ts
|
|
63645
63683
|
async function writeLinks(links2) {
|
|
@@ -63662,7 +63700,7 @@ async function readLinks() {
|
|
|
63662
63700
|
await writeLinks(links2);
|
|
63663
63701
|
const dropped = stored.filter((link3) => !link3.url).map((link3) => link3.name);
|
|
63664
63702
|
console.log(
|
|
63665
|
-
|
|
63703
|
+
chalk300.yellow(`Removed ${dropped.join(", ")}: ${SSH_LINK_RETIRED}`)
|
|
63666
63704
|
);
|
|
63667
63705
|
return links2;
|
|
63668
63706
|
}
|
|
@@ -63718,7 +63756,7 @@ async function linkNode(name2, url, options2) {
|
|
|
63718
63756
|
throw new Error(`${name2} is this node; link to a different node`);
|
|
63719
63757
|
const link3 = await buildLink(name2, url, options2);
|
|
63720
63758
|
await writeLinks([...others, link3]);
|
|
63721
|
-
console.log(
|
|
63759
|
+
console.log(chalk301.green(`Linked ${name2} (${link3.url})`));
|
|
63722
63760
|
await notifyDaemonLinks();
|
|
63723
63761
|
}
|
|
63724
63762
|
|
|
@@ -63783,14 +63821,14 @@ function startPeerAction(name2, action) {
|
|
|
63783
63821
|
const line = `nodes ${action} ${name2} trace=${traceId}`;
|
|
63784
63822
|
console.log(line);
|
|
63785
63823
|
appendDaemonLog(line);
|
|
63786
|
-
const
|
|
63824
|
+
const fail14 = async (summary, error) => new Error(await describeFailure(name2, summary, error));
|
|
63787
63825
|
return {
|
|
63788
63826
|
spec,
|
|
63789
63827
|
traceId,
|
|
63790
|
-
fail:
|
|
63828
|
+
fail: fail14,
|
|
63791
63829
|
async awaitReturn(sawDown, timeoutMs = RETURN_TIMEOUT_MS) {
|
|
63792
63830
|
const link3 = await awaitLinkReturn(name2, { sawDown, timeoutMs });
|
|
63793
|
-
if (!link3) throw await
|
|
63831
|
+
if (!link3) throw await fail14(`${name2} did not come back`);
|
|
63794
63832
|
return link3;
|
|
63795
63833
|
}
|
|
63796
63834
|
};
|
|
@@ -63901,16 +63939,16 @@ function registerPeerActionCommands(nodes, calledBy5) {
|
|
|
63901
63939
|
}
|
|
63902
63940
|
|
|
63903
63941
|
// src/commands/sessions/nodes/unlinkNode.ts
|
|
63904
|
-
import
|
|
63942
|
+
import chalk302 from "chalk";
|
|
63905
63943
|
async function unlinkNode(name2) {
|
|
63906
63944
|
const links2 = await readLinks();
|
|
63907
63945
|
const remaining = links2.filter((link3) => link3.name !== name2);
|
|
63908
63946
|
if (remaining.length === links2.length) {
|
|
63909
|
-
console.log(
|
|
63947
|
+
console.log(chalk302.yellow(`No link named ${name2}`));
|
|
63910
63948
|
return;
|
|
63911
63949
|
}
|
|
63912
63950
|
await writeLinks(remaining);
|
|
63913
|
-
console.log(
|
|
63951
|
+
console.log(chalk302.green(`Unlinked ${name2}`));
|
|
63914
63952
|
await notifyDaemonLinks();
|
|
63915
63953
|
}
|
|
63916
63954
|
|
|
@@ -63984,9 +64022,9 @@ function resolveTarget4(sessionId2, server) {
|
|
|
63984
64022
|
async function sessionOutput(sessionId2, options2) {
|
|
63985
64023
|
const count10 = Number.parseInt(options2.lines, 10);
|
|
63986
64024
|
if (!Number.isInteger(count10) || count10 < 1)
|
|
63987
|
-
return
|
|
64025
|
+
return fail13(`-n must be a positive integer, got ${options2.lines}`);
|
|
63988
64026
|
const target = resolveTarget4(sessionId2, options2.server);
|
|
63989
|
-
if (typeof target === "string") return
|
|
64027
|
+
if (typeof target === "string") return fail13(target);
|
|
63990
64028
|
try {
|
|
63991
64029
|
const {
|
|
63992
64030
|
sessionId: id,
|
|
@@ -63999,10 +64037,10 @@ async function sessionOutput(sessionId2, options2) {
|
|
|
63999
64037
|
);
|
|
64000
64038
|
for (const line of lastLines(scrollback, count10)) console.log(line);
|
|
64001
64039
|
} catch (error) {
|
|
64002
|
-
|
|
64040
|
+
fail13(error instanceof Error ? error.message : String(error));
|
|
64003
64041
|
}
|
|
64004
64042
|
}
|
|
64005
|
-
function
|
|
64043
|
+
function fail13(message4) {
|
|
64006
64044
|
console.error(message4);
|
|
64007
64045
|
process.exitCode = 1;
|
|
64008
64046
|
}
|
|
@@ -64159,10 +64197,10 @@ function createProgram() {
|
|
|
64159
64197
|
}
|
|
64160
64198
|
|
|
64161
64199
|
// src/reportCliError.ts
|
|
64162
|
-
import
|
|
64200
|
+
import chalk303 from "chalk";
|
|
64163
64201
|
function reportCliError(error) {
|
|
64164
64202
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError || error instanceof MissingDatabaseUrlError || error instanceof DatabaseConnectionError) {
|
|
64165
|
-
console.error(
|
|
64203
|
+
console.error(chalk303.red(error.message));
|
|
64166
64204
|
} else {
|
|
64167
64205
|
console.error(error);
|
|
64168
64206
|
}
|