@staff0rd/assist 0.195.0 → 0.195.1
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 -0
- package/dist/index.js +42 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -172,6 +172,8 @@ After installation, the `assist` command will be available globally. You can als
|
|
|
172
172
|
- `assist seq query <filter> -c <connection>` - Query using a specific connection
|
|
173
173
|
- `assist seq query <filter> --json` - Output raw JSON
|
|
174
174
|
- `assist seq query <filter> -n <count>` - Fetch a specific number of events (default 50)
|
|
175
|
+
- `assist seq query <filter> --from <date>` - Start of query window (UTC date or relative e.g. 5m, 1h, 2d)
|
|
176
|
+
- `assist seq query <filter> --to <date>` - End of query window (UTC date or relative e.g. 5m, 1h, 2d)
|
|
175
177
|
- `assist screenshot <process>` - Capture a screenshot of a running application window (e.g. `assist screenshot notepad`). Output directory is configurable via `screenshot.outputDir` (default `./screenshots`)
|
|
176
178
|
- `assist coverage` - Print global statement coverage percentage
|
|
177
179
|
- `assist complexity <pattern>` - Analyze a file (all metrics if single match, maintainability if multiple)
|
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.195.
|
|
9
|
+
version: "0.195.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -10603,10 +10603,12 @@ function filterToSql(filter) {
|
|
|
10603
10603
|
}
|
|
10604
10604
|
|
|
10605
10605
|
// src/commands/seq/fetchSeqData.ts
|
|
10606
|
-
async function fetchSeqData(conn, filter, count, from) {
|
|
10606
|
+
async function fetchSeqData(conn, filter, count, from, to) {
|
|
10607
10607
|
const sqlFilter = filterToSql(filter);
|
|
10608
10608
|
const sql = `select @Timestamp, @Level, @Exception, @Message from stream where ${sqlFilter} order by @Timestamp desc limit ${count}`;
|
|
10609
|
-
const params = new URLSearchParams({ q: sql
|
|
10609
|
+
const params = new URLSearchParams({ q: sql });
|
|
10610
|
+
if (from) params.set("fromDateUtc", from);
|
|
10611
|
+
if (to) params.set("toDateUtc", to);
|
|
10610
10612
|
const response = await fetchSeq(conn, "/api/data", params);
|
|
10611
10613
|
const data = await response.json();
|
|
10612
10614
|
return mapDataToEvents(data);
|
|
@@ -10712,6 +10714,32 @@ function formatEvent(event) {
|
|
|
10712
10714
|
return lines.join("\n");
|
|
10713
10715
|
}
|
|
10714
10716
|
|
|
10717
|
+
// src/commands/seq/parseRelativeTime.ts
|
|
10718
|
+
var relativePattern = /^(\d+)([smhdw])$/;
|
|
10719
|
+
var unitMs = {
|
|
10720
|
+
s: 1e3,
|
|
10721
|
+
m: 6e4,
|
|
10722
|
+
h: 36e5,
|
|
10723
|
+
d: 864e5,
|
|
10724
|
+
w: 6048e5
|
|
10725
|
+
};
|
|
10726
|
+
function parseRelativeTime(value, now = /* @__PURE__ */ new Date()) {
|
|
10727
|
+
const match = relativePattern.exec(value);
|
|
10728
|
+
if (!match) return value;
|
|
10729
|
+
const [, amount, unit] = match;
|
|
10730
|
+
return new Date(now.getTime() - Number(amount) * unitMs[unit]).toISOString();
|
|
10731
|
+
}
|
|
10732
|
+
|
|
10733
|
+
// src/commands/seq/rejectTimestampFilter.ts
|
|
10734
|
+
var timestampPattern = /@Timestamp/i;
|
|
10735
|
+
function rejectTimestampFilter(filter) {
|
|
10736
|
+
if (timestampPattern.test(filter)) {
|
|
10737
|
+
throw new Error(
|
|
10738
|
+
"Timestamp expressions are not supported in the filter string. Use --from and --to options instead."
|
|
10739
|
+
);
|
|
10740
|
+
}
|
|
10741
|
+
}
|
|
10742
|
+
|
|
10715
10743
|
// src/commands/seq/resolveConnection.ts
|
|
10716
10744
|
import chalk127 from "chalk";
|
|
10717
10745
|
function resolveConnection2(name) {
|
|
@@ -10733,9 +10761,12 @@ function resolveConnection2(name) {
|
|
|
10733
10761
|
|
|
10734
10762
|
// src/commands/seq/seqQuery.ts
|
|
10735
10763
|
async function seqQuery(filter, options2) {
|
|
10764
|
+
rejectTimestampFilter(filter);
|
|
10736
10765
|
const conn = resolveConnection2(options2.connection);
|
|
10737
10766
|
const count = Number.parseInt(options2.count ?? "1000", 10);
|
|
10738
|
-
const
|
|
10767
|
+
const from = options2.from ? parseRelativeTime(options2.from) : void 0;
|
|
10768
|
+
const to = options2.to ? parseRelativeTime(options2.to) : void 0;
|
|
10769
|
+
const events = from || to ? await fetchSeqData(conn, filter, count, from, to) : await fetchSeqEvents(
|
|
10739
10770
|
conn,
|
|
10740
10771
|
new URLSearchParams({ filter, count: String(count) })
|
|
10741
10772
|
);
|
|
@@ -10782,7 +10813,13 @@ function registerSeq(program2) {
|
|
|
10782
10813
|
auth2.command("list").description("List configured connections").action(() => seqAuth.list());
|
|
10783
10814
|
auth2.command("remove <name>").description("Remove a configured connection").action((name) => seqAuth.remove(name));
|
|
10784
10815
|
cmd.command("set-connection <name>").description("Set the default Seq connection").action((name) => seqSetConnection(name));
|
|
10785
|
-
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(
|
|
10816
|
+
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(
|
|
10817
|
+
"--from <date>",
|
|
10818
|
+
"Start of query window (UTC date or relative e.g. 5m, 1h, 2d)"
|
|
10819
|
+
).option(
|
|
10820
|
+
"--to <date>",
|
|
10821
|
+
"End of query window (UTC date or relative e.g. 5m, 1h, 2d)"
|
|
10822
|
+
).option("--json", "Output raw JSON").action((filter, options2) => seqQuery(filter, options2));
|
|
10786
10823
|
}
|
|
10787
10824
|
|
|
10788
10825
|
// src/commands/transcript/shared.ts
|