@staff0rd/assist 0.161.0 → 0.162.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/dist/index.js +71 -62
- 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.162.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -8958,26 +8958,44 @@ var seqAuth = createConnectionAuth({
|
|
|
8958
8958
|
});
|
|
8959
8959
|
|
|
8960
8960
|
// src/commands/seq/seqQuery.ts
|
|
8961
|
-
import
|
|
8961
|
+
import chalk107 from "chalk";
|
|
8962
8962
|
|
|
8963
|
-
// src/commands/seq/
|
|
8963
|
+
// src/commands/seq/fetchSeqEvents.ts
|
|
8964
8964
|
import chalk104 from "chalk";
|
|
8965
|
+
async function fetchSeqEvents(conn, params) {
|
|
8966
|
+
const url = `${conn.url}/api/events?${params}`;
|
|
8967
|
+
const response = await fetch(url, {
|
|
8968
|
+
headers: {
|
|
8969
|
+
Accept: "application/json",
|
|
8970
|
+
"X-Seq-ApiKey": conn.apiToken
|
|
8971
|
+
}
|
|
8972
|
+
});
|
|
8973
|
+
if (!response.ok) {
|
|
8974
|
+
const body = await response.text();
|
|
8975
|
+
console.error(chalk104.red(`Seq returned ${response.status}: ${body}`));
|
|
8976
|
+
process.exit(1);
|
|
8977
|
+
}
|
|
8978
|
+
return response.json();
|
|
8979
|
+
}
|
|
8980
|
+
|
|
8981
|
+
// src/commands/seq/formatEvent.ts
|
|
8982
|
+
import chalk105 from "chalk";
|
|
8965
8983
|
function levelColor(level) {
|
|
8966
8984
|
switch (level) {
|
|
8967
8985
|
case "Fatal":
|
|
8968
|
-
return
|
|
8986
|
+
return chalk105.bgRed.white;
|
|
8969
8987
|
case "Error":
|
|
8970
|
-
return
|
|
8988
|
+
return chalk105.red;
|
|
8971
8989
|
case "Warning":
|
|
8972
|
-
return
|
|
8990
|
+
return chalk105.yellow;
|
|
8973
8991
|
case "Information":
|
|
8974
|
-
return
|
|
8992
|
+
return chalk105.cyan;
|
|
8975
8993
|
case "Debug":
|
|
8976
|
-
return
|
|
8994
|
+
return chalk105.gray;
|
|
8977
8995
|
case "Verbose":
|
|
8978
|
-
return
|
|
8996
|
+
return chalk105.dim;
|
|
8979
8997
|
default:
|
|
8980
|
-
return
|
|
8998
|
+
return chalk105.white;
|
|
8981
8999
|
}
|
|
8982
9000
|
}
|
|
8983
9001
|
function levelAbbrev(level) {
|
|
@@ -9018,31 +9036,31 @@ function formatTimestamp(iso) {
|
|
|
9018
9036
|
function formatEvent(event) {
|
|
9019
9037
|
const color = levelColor(event.Level);
|
|
9020
9038
|
const abbrev = levelAbbrev(event.Level);
|
|
9021
|
-
const ts8 =
|
|
9039
|
+
const ts8 = chalk105.dim(formatTimestamp(event.Timestamp));
|
|
9022
9040
|
const msg = renderMessage(event);
|
|
9023
9041
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
9024
9042
|
if (event.Exception) {
|
|
9025
9043
|
for (const line of event.Exception.split("\n")) {
|
|
9026
|
-
lines.push(
|
|
9044
|
+
lines.push(chalk105.red(` ${line}`));
|
|
9027
9045
|
}
|
|
9028
9046
|
}
|
|
9029
9047
|
return lines.join("\n");
|
|
9030
9048
|
}
|
|
9031
9049
|
|
|
9032
9050
|
// src/commands/seq/resolveConnection.ts
|
|
9033
|
-
import
|
|
9051
|
+
import chalk106 from "chalk";
|
|
9034
9052
|
function resolveConnection2(name) {
|
|
9035
9053
|
const connections = loadConnections2();
|
|
9036
9054
|
if (connections.length === 0) {
|
|
9037
9055
|
console.error(
|
|
9038
|
-
|
|
9056
|
+
chalk106.red("No Seq connections configured. Run 'assist seq auth' first.")
|
|
9039
9057
|
);
|
|
9040
9058
|
process.exit(1);
|
|
9041
9059
|
}
|
|
9042
9060
|
const target = name ?? getDefaultConnection() ?? connections[0].name;
|
|
9043
9061
|
const connection = connections.find((c) => c.name === target);
|
|
9044
9062
|
if (!connection) {
|
|
9045
|
-
console.error(
|
|
9063
|
+
console.error(chalk106.red(`Seq connection "${target}" not found.`));
|
|
9046
9064
|
process.exit(1);
|
|
9047
9065
|
}
|
|
9048
9066
|
return connection;
|
|
@@ -9053,21 +9071,12 @@ async function seqQuery(filter, options2) {
|
|
|
9053
9071
|
const conn = resolveConnection2(options2.connection);
|
|
9054
9072
|
const count = Number.parseInt(options2.count ?? "1000", 10);
|
|
9055
9073
|
const params = new URLSearchParams({ filter, count: String(count) });
|
|
9056
|
-
|
|
9057
|
-
|
|
9058
|
-
headers: {
|
|
9059
|
-
Accept: "application/json",
|
|
9060
|
-
"X-Seq-ApiKey": conn.apiToken
|
|
9061
|
-
}
|
|
9062
|
-
});
|
|
9063
|
-
if (!response.ok) {
|
|
9064
|
-
const body = await response.text();
|
|
9065
|
-
console.error(chalk106.red(`Seq returned ${response.status}: ${body}`));
|
|
9066
|
-
process.exit(1);
|
|
9074
|
+
if (options2.from) {
|
|
9075
|
+
params.set("fromDateUtc", options2.from);
|
|
9067
9076
|
}
|
|
9068
|
-
const events = await
|
|
9077
|
+
const events = await fetchSeqEvents(conn, params);
|
|
9069
9078
|
if (events.length === 0) {
|
|
9070
|
-
console.log(
|
|
9079
|
+
console.log(chalk107.yellow("No events found."));
|
|
9071
9080
|
return;
|
|
9072
9081
|
}
|
|
9073
9082
|
if (options2.json) {
|
|
@@ -9078,11 +9087,11 @@ async function seqQuery(filter, options2) {
|
|
|
9078
9087
|
for (const event of chronological) {
|
|
9079
9088
|
console.log(formatEvent(event));
|
|
9080
9089
|
}
|
|
9081
|
-
console.log(
|
|
9090
|
+
console.log(chalk107.dim(`
|
|
9082
9091
|
${events.length} events`));
|
|
9083
9092
|
if (events.length >= count) {
|
|
9084
9093
|
console.log(
|
|
9085
|
-
|
|
9094
|
+
chalk107.yellow(
|
|
9086
9095
|
`Results limited to ${count}. Use --count to retrieve more.`
|
|
9087
9096
|
)
|
|
9088
9097
|
);
|
|
@@ -9090,11 +9099,11 @@ ${events.length} events`));
|
|
|
9090
9099
|
}
|
|
9091
9100
|
|
|
9092
9101
|
// src/commands/seq/seqSetConnection.ts
|
|
9093
|
-
import
|
|
9102
|
+
import chalk108 from "chalk";
|
|
9094
9103
|
function seqSetConnection(name) {
|
|
9095
9104
|
const connections = loadConnections2();
|
|
9096
9105
|
if (!connections.find((c) => c.name === name)) {
|
|
9097
|
-
console.error(
|
|
9106
|
+
console.error(chalk108.red(`Connection "${name}" not found.`));
|
|
9098
9107
|
process.exit(1);
|
|
9099
9108
|
}
|
|
9100
9109
|
setDefaultConnection(name);
|
|
@@ -9109,7 +9118,7 @@ function registerSeq(program2) {
|
|
|
9109
9118
|
auth2.command("list").description("List configured connections").action(() => seqAuth.list());
|
|
9110
9119
|
auth2.command("remove <name>").description("Remove a configured connection").action((name) => seqAuth.remove(name));
|
|
9111
9120
|
cmd.command("set-connection <name>").description("Set the default Seq connection").action((name) => seqSetConnection(name));
|
|
9112
|
-
cmd.command("query <filter>").description("Query Seq events with a filter expression").option("-c, --connection <name>", "Connection to use").option("-n, --count <n>", "Number of events to fetch", "50").option("--json", "Output raw JSON").action((filter, options2) => seqQuery(filter, options2));
|
|
9121
|
+
cmd.command("query <filter>").description("Query Seq events with a filter expression").option("-c, --connection <name>", "Connection to use").option("-n, --count <n>", "Number of events to fetch", "50").option("--from <date>", "Start date (UTC) for the query window").option("--json", "Output raw JSON").action((filter, options2) => seqQuery(filter, options2));
|
|
9113
9122
|
}
|
|
9114
9123
|
|
|
9115
9124
|
// src/commands/transcript/shared.ts
|
|
@@ -9633,14 +9642,14 @@ import {
|
|
|
9633
9642
|
import { dirname as dirname20, join as join30 } from "path";
|
|
9634
9643
|
|
|
9635
9644
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
9636
|
-
import
|
|
9645
|
+
import chalk109 from "chalk";
|
|
9637
9646
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
9638
9647
|
function validateStagedContent(filename, content) {
|
|
9639
9648
|
const firstLine = content.split("\n")[0];
|
|
9640
9649
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
9641
9650
|
if (!match) {
|
|
9642
9651
|
console.error(
|
|
9643
|
-
|
|
9652
|
+
chalk109.red(
|
|
9644
9653
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
9645
9654
|
)
|
|
9646
9655
|
);
|
|
@@ -9649,7 +9658,7 @@ function validateStagedContent(filename, content) {
|
|
|
9649
9658
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
9650
9659
|
if (!contentAfterLink) {
|
|
9651
9660
|
console.error(
|
|
9652
|
-
|
|
9661
|
+
chalk109.red(
|
|
9653
9662
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
9654
9663
|
)
|
|
9655
9664
|
);
|
|
@@ -10042,7 +10051,7 @@ function registerVoice(program2) {
|
|
|
10042
10051
|
|
|
10043
10052
|
// src/commands/roam/auth.ts
|
|
10044
10053
|
import { randomBytes } from "crypto";
|
|
10045
|
-
import
|
|
10054
|
+
import chalk110 from "chalk";
|
|
10046
10055
|
|
|
10047
10056
|
// src/lib/openBrowser.ts
|
|
10048
10057
|
import { execSync as execSync38 } from "child_process";
|
|
@@ -10217,13 +10226,13 @@ async function auth() {
|
|
|
10217
10226
|
saveGlobalConfig(config);
|
|
10218
10227
|
const state = randomBytes(16).toString("hex");
|
|
10219
10228
|
console.log(
|
|
10220
|
-
|
|
10229
|
+
chalk110.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
10221
10230
|
);
|
|
10222
|
-
console.log(
|
|
10223
|
-
console.log(
|
|
10224
|
-
console.log(
|
|
10231
|
+
console.log(chalk110.white("http://localhost:14523/callback\n"));
|
|
10232
|
+
console.log(chalk110.blue("Opening browser for authorization..."));
|
|
10233
|
+
console.log(chalk110.dim("Waiting for authorization callback..."));
|
|
10225
10234
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
10226
|
-
console.log(
|
|
10235
|
+
console.log(chalk110.dim("Exchanging code for tokens..."));
|
|
10227
10236
|
const tokens = await exchangeToken({
|
|
10228
10237
|
code,
|
|
10229
10238
|
clientId,
|
|
@@ -10239,7 +10248,7 @@ async function auth() {
|
|
|
10239
10248
|
};
|
|
10240
10249
|
saveGlobalConfig(config);
|
|
10241
10250
|
console.log(
|
|
10242
|
-
|
|
10251
|
+
chalk110.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
10243
10252
|
);
|
|
10244
10253
|
}
|
|
10245
10254
|
|
|
@@ -10452,7 +10461,7 @@ import { execSync as execSync40 } from "child_process";
|
|
|
10452
10461
|
import { existsSync as existsSync40, mkdirSync as mkdirSync13, unlinkSync as unlinkSync11, writeFileSync as writeFileSync28 } from "fs";
|
|
10453
10462
|
import { tmpdir as tmpdir6 } from "os";
|
|
10454
10463
|
import { join as join39, resolve as resolve5 } from "path";
|
|
10455
|
-
import
|
|
10464
|
+
import chalk111 from "chalk";
|
|
10456
10465
|
|
|
10457
10466
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
10458
10467
|
var captureWindowPs1 = `
|
|
@@ -10603,22 +10612,22 @@ function screenshot(processName) {
|
|
|
10603
10612
|
const config = loadConfig();
|
|
10604
10613
|
const outputDir = resolve5(config.screenshot.outputDir);
|
|
10605
10614
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
10606
|
-
console.log(
|
|
10615
|
+
console.log(chalk111.gray(`Capturing window for process "${processName}" ...`));
|
|
10607
10616
|
try {
|
|
10608
10617
|
runPowerShellScript(processName, outputPath);
|
|
10609
|
-
console.log(
|
|
10618
|
+
console.log(chalk111.green(`Screenshot saved: ${outputPath}`));
|
|
10610
10619
|
} catch (error) {
|
|
10611
10620
|
const msg = error instanceof Error ? error.message : String(error);
|
|
10612
|
-
console.error(
|
|
10621
|
+
console.error(chalk111.red(`Failed to capture screenshot: ${msg}`));
|
|
10613
10622
|
process.exit(1);
|
|
10614
10623
|
}
|
|
10615
10624
|
}
|
|
10616
10625
|
|
|
10617
10626
|
// src/commands/statusLine.ts
|
|
10618
|
-
import
|
|
10627
|
+
import chalk113 from "chalk";
|
|
10619
10628
|
|
|
10620
10629
|
// src/commands/buildLimitsSegment.ts
|
|
10621
|
-
import
|
|
10630
|
+
import chalk112 from "chalk";
|
|
10622
10631
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
10623
10632
|
var SEVEN_DAY_SECONDS = 7 * 86400;
|
|
10624
10633
|
function formatTimeLeft(resetsAt) {
|
|
@@ -10641,10 +10650,10 @@ function projectUsage(pct, resetsAt, windowSeconds) {
|
|
|
10641
10650
|
function colorizeRateLimit(pct, resetsAt, windowSeconds) {
|
|
10642
10651
|
const label2 = `${Math.round(pct)}%`;
|
|
10643
10652
|
const projected = projectUsage(pct, resetsAt, windowSeconds);
|
|
10644
|
-
if (projected == null) return
|
|
10645
|
-
if (projected > 100) return
|
|
10646
|
-
if (projected > 75) return
|
|
10647
|
-
return
|
|
10653
|
+
if (projected == null) return chalk112.green(label2);
|
|
10654
|
+
if (projected > 100) return chalk112.red(label2);
|
|
10655
|
+
if (projected > 75) return chalk112.yellow(label2);
|
|
10656
|
+
return chalk112.green(label2);
|
|
10648
10657
|
}
|
|
10649
10658
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel) {
|
|
10650
10659
|
const timeLabel = resetsAt ? formatTimeLeft(resetsAt) : fallbackLabel;
|
|
@@ -10670,14 +10679,14 @@ function buildLimitsSegment(rateLimits) {
|
|
|
10670
10679
|
}
|
|
10671
10680
|
|
|
10672
10681
|
// src/commands/statusLine.ts
|
|
10673
|
-
|
|
10682
|
+
chalk113.level = 3;
|
|
10674
10683
|
function formatNumber(num) {
|
|
10675
10684
|
return num.toLocaleString("en-US");
|
|
10676
10685
|
}
|
|
10677
10686
|
function colorizePercent(pct) {
|
|
10678
10687
|
const label2 = `${Math.round(pct)}%`;
|
|
10679
|
-
if (pct > 80) return
|
|
10680
|
-
if (pct > 40) return
|
|
10688
|
+
if (pct > 80) return chalk113.red(label2);
|
|
10689
|
+
if (pct > 40) return chalk113.yellow(label2);
|
|
10681
10690
|
return label2;
|
|
10682
10691
|
}
|
|
10683
10692
|
async function statusLine() {
|
|
@@ -10700,7 +10709,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
10700
10709
|
// src/commands/sync/syncClaudeMd.ts
|
|
10701
10710
|
import * as fs23 from "fs";
|
|
10702
10711
|
import * as path46 from "path";
|
|
10703
|
-
import
|
|
10712
|
+
import chalk114 from "chalk";
|
|
10704
10713
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
10705
10714
|
const source = path46.join(claudeDir, "CLAUDE.md");
|
|
10706
10715
|
const target = path46.join(targetBase, "CLAUDE.md");
|
|
@@ -10709,12 +10718,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
10709
10718
|
const targetContent = fs23.readFileSync(target, "utf-8");
|
|
10710
10719
|
if (sourceContent !== targetContent) {
|
|
10711
10720
|
console.log(
|
|
10712
|
-
|
|
10721
|
+
chalk114.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
10713
10722
|
);
|
|
10714
10723
|
console.log();
|
|
10715
10724
|
printDiff(targetContent, sourceContent);
|
|
10716
10725
|
const confirm = options2?.yes || await promptConfirm(
|
|
10717
|
-
|
|
10726
|
+
chalk114.red("Overwrite existing CLAUDE.md?"),
|
|
10718
10727
|
false
|
|
10719
10728
|
);
|
|
10720
10729
|
if (!confirm) {
|
|
@@ -10730,7 +10739,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
10730
10739
|
// src/commands/sync/syncSettings.ts
|
|
10731
10740
|
import * as fs24 from "fs";
|
|
10732
10741
|
import * as path47 from "path";
|
|
10733
|
-
import
|
|
10742
|
+
import chalk115 from "chalk";
|
|
10734
10743
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
10735
10744
|
const source = path47.join(claudeDir, "settings.json");
|
|
10736
10745
|
const target = path47.join(targetBase, "settings.json");
|
|
@@ -10746,14 +10755,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
10746
10755
|
if (mergedContent !== normalizedTarget) {
|
|
10747
10756
|
if (!options2?.yes) {
|
|
10748
10757
|
console.log(
|
|
10749
|
-
|
|
10758
|
+
chalk115.yellow(
|
|
10750
10759
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
10751
10760
|
)
|
|
10752
10761
|
);
|
|
10753
10762
|
console.log();
|
|
10754
10763
|
printDiff(targetContent, mergedContent);
|
|
10755
10764
|
const confirm = await promptConfirm(
|
|
10756
|
-
|
|
10765
|
+
chalk115.red("Overwrite existing settings.json?"),
|
|
10757
10766
|
false
|
|
10758
10767
|
);
|
|
10759
10768
|
if (!confirm) {
|