@darkrymit/crunes-cli 0.7.2 → 0.8.2
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 +5 -4
- package/dist/chunks/{add-OWYVF3IE.js → add-CBHWFGCA.js} +2 -2
- package/dist/chunks/{apply-OMEVXCHC.js → apply-YC6JEPUN.js} +6 -5
- package/dist/chunks/args-repl-TX3YWUOO.js +81 -0
- package/dist/chunks/banner-repl-DD22Z33A.js +52 -0
- package/dist/chunks/benchmark-BJEAAFWG.js +234 -0
- package/dist/chunks/{browse-COH6IJEX.js → browse-JZFU52ET.js} +2 -2
- package/dist/chunks/{chunk-2Q24YPGL.js → chunk-2PBPDTRD.js} +2 -2
- package/dist/chunks/chunk-63H5VXZY.js +101 -0
- package/dist/chunks/{chunk-GHQOK4L7.js → chunk-65J65MAP.js} +1 -1
- package/dist/chunks/{chunk-HMU2J25D.js → chunk-6MRZXASS.js} +3 -3
- package/dist/chunks/{chunk-BEVULQIG.js → chunk-ASZKAC24.js} +2 -1
- package/dist/chunks/{chunk-AIEWOUXT.js → chunk-DZJRYFOP.js} +104 -41
- package/dist/chunks/{chunk-QMWGQXEZ.js → chunk-G4ZAUHHA.js} +2 -4
- package/dist/chunks/{chunk-67I2J474.js → chunk-J3GZ3DXD.js} +14 -55
- package/dist/chunks/{chunk-XIXND2M4.js → chunk-JOAL437H.js} +5 -1
- package/dist/chunks/{chunk-6I7RHSAA.js → chunk-JU6FKUBY.js} +30394 -26055
- package/dist/chunks/{chunk-5RGDIMK6.js → chunk-NAEVMRNA.js} +22031 -13353
- package/dist/chunks/{chunk-NXSDVVTW.js → chunk-NDEYEYSU.js} +22 -69
- package/dist/chunks/{chunk-L72BG6DS.js → chunk-NYLRTAAA.js} +1 -1
- package/dist/chunks/{chunk-UGN3FFEF.js → chunk-V35LVVNV.js} +5113 -2117
- package/dist/chunks/chunk-ZJDKCC2Y.js +105 -0
- package/dist/chunks/{clear-Y5POLIMF.js → clear-YBDIPEEH.js} +5 -9
- package/dist/chunks/commands-repl-IPLJ4M7X.js +65 -0
- package/dist/chunks/complete-input-repl-IDSCMRYL.js +71 -0
- package/dist/chunks/{create-I6BNYZ5Q.js → create-ZFFV3Z2P.js} +2 -1
- package/dist/chunks/{delete-UB5SXO5I.js → delete-C4UJ7X5K.js} +5 -9
- package/dist/chunks/delete-E4TEBRPX.js +27 -0
- package/dist/chunks/{delete-7CQFYIXS.js → delete-LNOYM5KG.js} +5 -9
- package/dist/chunks/{disable-FCBW7WVG.js → disable-TMG2K3BF.js} +6 -6
- package/dist/chunks/{doctor-DS57HDLJ.js → doctor-N43QEMAH.js} +2 -2
- package/dist/chunks/{enable-IXRVUXJM.js → enable-327OMBPC.js} +6 -6
- package/dist/chunks/{globals-YCJ2DGWC.js → globals-H2WF344Y.js} +2 -2
- package/dist/chunks/{init-WGKQVAZE.js → init-HU5OMHEH.js} +1 -1
- package/dist/chunks/input-repl-ZBH6FVPV.js +87 -0
- package/dist/chunks/{install-BCTBOPBS.js → install-RRLUOYFO.js} +6 -6
- package/dist/chunks/intro-4CICBP2J.js +2727 -0
- package/dist/chunks/{kill-LWRXZVM5.js → kill-2UG7PHUV.js} +4 -10
- package/dist/chunks/list-4X3JFQGS.js +41 -0
- package/dist/chunks/{list-ZBYPMUID.js → list-7VHJIUDX.js} +2 -2
- package/dist/chunks/list-A5WVDBWF.js +53 -0
- package/dist/chunks/{list-NGOCMJXE.js → list-CK5X2YN3.js} +5 -4
- package/dist/chunks/{list-TTKLNJKI.js → list-FLAYJQKN.js} +2 -2
- package/dist/chunks/list-PTAWQYWG.js +35 -0
- package/dist/chunks/list-U7PAYNAH.js +47 -0
- package/dist/chunks/{list-OTOMCFLA.js → list-WH7KESMV.js} +12 -11
- package/dist/chunks/{query-NY4SCO77.js → query-AW7WYILM.js} +5 -9
- package/dist/chunks/{registry-W5XFI5T6.js → registry-3QIL5SVL.js} +2 -2
- package/dist/chunks/{remove-WEAZFZCO.js → remove-QUH2D3S5.js} +2 -2
- package/dist/chunks/repl-STBZC4P2.js +180 -0
- package/dist/chunks/repl-VGC5FUJG.js +378 -0
- package/dist/chunks/resolver-QMIY33FM.js +26 -0
- package/dist/chunks/run-T33CMCFZ.js +26 -0
- package/dist/chunks/{run-J2A5YTTY.js → run-Y4TG3EM3.js} +22 -3
- package/dist/chunks/rune-UBRVWG5A.js +139 -0
- package/dist/chunks/{search-XENXL3GC.js → search-MSSDGJTF.js} +2 -2
- package/dist/chunks/{uninstall-MX5PLGDI.js → uninstall-55YTHZRH.js} +5 -5
- package/dist/chunks/unset-YASSMSE5.js +24 -0
- package/dist/chunks/{update-7XDTVFZ3.js → update-EWWDROKW.js} +2 -2
- package/dist/chunks/{update-IEE54GPY.js → update-G6XO4RIM.js} +6 -6
- package/dist/chunks/{utils-JKGIWZTS.js → utils-XOWJQWNR.js} +2 -2
- package/dist/chunks/{version-OPTLR63W.js → version-W7MA4ZCA.js} +9 -4
- package/dist/cli.js +114 -81
- package/package.json +8 -3
- package/dist/chunks/benchmark-ATSRQIDC.js +0 -164
- package/dist/chunks/check-G72VZKIP.js +0 -144
- package/dist/chunks/chunk-3TM6B4E5.js +0 -70
- package/dist/chunks/chunk-XXUNHQIB.js +0 -129
- package/dist/chunks/intro-QVSLNH4R.js +0 -1510
- package/dist/chunks/list-5DVVP7HX.js +0 -50
- package/dist/chunks/list-6WL5LGIZ.js +0 -80
- package/dist/chunks/list-YPI7YDKK.js +0 -80
- package/dist/chunks/run-AUAGELWL.js +0 -23
- package/dist/chunks/rune-ZYEVEYID.js +0 -87
- package/dist/chunks/unset-KQOZYVTE.js +0 -28
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveFromMarketplace
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NYLRTAAA.js";
|
|
4
4
|
import {
|
|
5
5
|
installPlugin
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-2PBPDTRD.js";
|
|
7
7
|
import {
|
|
8
8
|
R2 as R,
|
|
9
9
|
fe,
|
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
loadRegistry,
|
|
15
15
|
resolvePluginKey
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-65J65MAP.js";
|
|
17
|
+
import "./chunk-6MRZXASS.js";
|
|
18
18
|
import "./chunk-G3U4V32O.js";
|
|
19
19
|
import {
|
|
20
20
|
init_require_shim
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
|
|
23
23
|
// src/plugin/commands/update.js
|
|
24
24
|
init_require_shim();
|
|
25
|
-
async function handler({ name, projectRoot }) {
|
|
25
|
+
async function handler({ name, projectRoot, configRoot }) {
|
|
26
26
|
const registry = await loadRegistry();
|
|
27
27
|
let plugins;
|
|
28
28
|
if (name) {
|
|
@@ -62,7 +62,7 @@ async function handler({ name, projectRoot }) {
|
|
|
62
62
|
continue;
|
|
63
63
|
}
|
|
64
64
|
try {
|
|
65
|
-
const result = await installPlugin(resolvedSource, projectRoot, provenance);
|
|
65
|
+
const result = await installPlugin(resolvedSource, configRoot ?? projectRoot, provenance);
|
|
66
66
|
if (result.installed) {
|
|
67
67
|
R.success(`Updated ${pluginName}@${result.version}`);
|
|
68
68
|
} else {
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-WCODTMDN.js";
|
|
4
4
|
import {
|
|
5
5
|
getStorePath
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6MRZXASS.js";
|
|
7
7
|
import {
|
|
8
8
|
init_require_shim
|
|
9
9
|
} from "./chunk-TPK5AGRA.js";
|
|
@@ -16,7 +16,7 @@ import path from "node:path";
|
|
|
16
16
|
// package.json
|
|
17
17
|
var package_default = {
|
|
18
18
|
name: "@darkrymit/crunes-cli",
|
|
19
|
-
version: "0.
|
|
19
|
+
version: "0.8.2",
|
|
20
20
|
description: "CLI tool for querying crunes enrichers",
|
|
21
21
|
type: "module",
|
|
22
22
|
bin: {
|
|
@@ -39,17 +39,22 @@ var package_default = {
|
|
|
39
39
|
devDependencies: {
|
|
40
40
|
"@clack/prompts": "^1.5.0",
|
|
41
41
|
archiver: "^8.0.0",
|
|
42
|
-
chalk: "^5.
|
|
42
|
+
chalk: "^5.6.2",
|
|
43
|
+
chokidar: "^5.0.0",
|
|
43
44
|
"cli-table3": "^0.6.5",
|
|
44
45
|
commander: "^15.0.0",
|
|
46
|
+
"comment-json": "^5.0.0",
|
|
47
|
+
"csv-parse": "^7.0.0",
|
|
48
|
+
"csv-stringify": "^6.8.0",
|
|
45
49
|
dotenv: "^17.4.2",
|
|
46
50
|
esbuild: "^0.28.0",
|
|
47
51
|
"fast-text-encoding": "^1.0.6",
|
|
48
52
|
"fast-xml-parser": "^5.8.0",
|
|
53
|
+
json5: "^2.2.3",
|
|
49
54
|
"jsonpath-plus": "^10.4.0",
|
|
50
|
-
micromatch: "^4.0.8",
|
|
51
55
|
mysql2: "^3.12.0",
|
|
52
56
|
pg: "^8.11.0",
|
|
57
|
+
picomatch: "^4.0.2",
|
|
53
58
|
tar: "^7.5.15",
|
|
54
59
|
tinyglobby: "^0.2.17",
|
|
55
60
|
typedoc: "^0.28.19",
|
package/dist/cli.js
CHANGED
|
@@ -3396,7 +3396,7 @@ var program = new Command();
|
|
|
3396
3396
|
// src/cli/program.js
|
|
3397
3397
|
function buildProgram() {
|
|
3398
3398
|
const program3 = new Command();
|
|
3399
|
-
program3.name("crunes").description("CLI tool for managing context runes").version("0.
|
|
3399
|
+
program3.name("crunes").description("CLI tool for managing context runes").version("0.8.2", "-v, --version").enablePositionalOptions().option("-y, --yes", "assume yes to all prompts and skip interactive mode (also auto-detected in non-TTY environments)").option("-p, --plain", "plain output: no colors, no box-drawing, plain symbols \u2014 optimised for AI/pipe use").option("--cwd <path>", "project root to use instead of the current working directory").option("--ccd <path>", "config directory \u2014 where .crunes/config.json and local rune files live (default: --cwd)").option("--verbose", "print full error stack traces and other verbose output");
|
|
3400
3400
|
program3.hook("preAction", (_thisCommand, actionCommand) => {
|
|
3401
3401
|
configure({ plain: !!program3.opts().plain, verbose: !!program3.opts().verbose });
|
|
3402
3402
|
if (program3.opts().verbose) {
|
|
@@ -3413,27 +3413,35 @@ function buildProgram() {
|
|
|
3413
3413
|
}
|
|
3414
3414
|
program3.command("run [args...]").description("Run one or more runes and output the result.").addHelpText(
|
|
3415
3415
|
"after",
|
|
3416
|
-
'\nImportant: Global flags (e.g. --cwd) MUST appear before the "run" command.\n\nSyntax:\n [-
|
|
3417
|
-
).allowUnknownOption().passThroughOptions().action(async (args) => {
|
|
3418
|
-
const { handler, parseRunArgs } = await import("./chunks/run-
|
|
3419
|
-
const { segments, format, failFast } = parseRunArgs(args);
|
|
3420
|
-
await handler({ segments, format, failFast, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3416
|
+
'\nImportant: Global flags (e.g. --cwd) MUST appear before the "run" command.\n\nSyntax:\n [run-flags] <key>[-s s1,s2] [rune-args...]\n -b [run-flags] <key1>[-s s1] [rune-args1] + <key2>[-s s2] [rune-args2]\n\nCommand flags:\n -b, --batch enable batching multiple runes with +\n --format text|jsonl output format (default: text)\n --fail-fast stop on first error\n\nPer-rune bracket flags (inside key[...]):\n -s, --section s1,s2 filter output sections for this rune\n\nKey prefixes:\n project:name resolve from project config only\n plugin:name resolve directly from an enabled plugin\n name auto-resolve: project config first, then plugins\n\nFor rune argument documentation: crunes docs rune <key>'
|
|
3417
|
+
).allowUnknownOption().passThroughOptions().action(async (args, _opts, _command) => {
|
|
3418
|
+
const { handler, parseRunArgs } = await import("./chunks/run-T33CMCFZ.js");
|
|
3419
|
+
const { segments, format, failFast, isBatch } = parseRunArgs(args);
|
|
3420
|
+
await handler({ segments, format, failFast, isBatch, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3421
|
+
});
|
|
3422
|
+
program3.command("repl [args...]").description("Run a rune in interactive REPL mode (keeps isolate alive across inputs).").addHelpText(
|
|
3423
|
+
"after",
|
|
3424
|
+
'\nImportant: Global flags (e.g. --cwd) MUST appear before the "repl" command.\n\nSyntax:\n [--format text|jsonl] <key>[-s s1,s2] [rune-args...]\n\nPer-rune bracket flags (inside key[...]):\n -s, --section s1,s2 filter output sections for this rune\n\nThe rune must export repl(args) and/or inputRepl(input).\nFor rune argument documentation: crunes docs rune <key>'
|
|
3425
|
+
).allowUnknownOption().passThroughOptions().action(async (args, _opts, _command) => {
|
|
3426
|
+
const { handler, parseReplArgs } = await import("./chunks/repl-VGC5FUJG.js");
|
|
3427
|
+
const { key, runeArgs, sections, format } = parseReplArgs(args);
|
|
3428
|
+
await handler({ key, runeArgs, sections, format, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3421
3429
|
});
|
|
3422
3430
|
const helpGroup = program3.command("docs").description("Show documentation for runes and other resources");
|
|
3423
3431
|
helpGroup.command("rune <rune...>").description("Show usage, argument schema, and examples for one or more runes").addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).action(async (keys, opts) => {
|
|
3424
|
-
const { handler } = await import("./chunks/rune-
|
|
3432
|
+
const { handler } = await import("./chunks/rune-UBRVWG5A.js");
|
|
3425
3433
|
await handler({ keys, format: opts.format, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3426
3434
|
});
|
|
3427
3435
|
helpGroup.command("utils [namespaces...]").description("Show function signatures and parameter docs for utils.* namespaces").addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).action(async (namespaces, opts) => {
|
|
3428
|
-
const { handler } = await import("./chunks/utils-
|
|
3436
|
+
const { handler } = await import("./chunks/utils-XOWJQWNR.js");
|
|
3429
3437
|
await handler({ namespaces, format: opts.format });
|
|
3430
3438
|
});
|
|
3431
3439
|
helpGroup.command("globals").description("Show injected sandbox globals and ES2020 builtins available in rune scripts").addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).action(async (opts) => {
|
|
3432
|
-
const { handler } = await import("./chunks/globals-
|
|
3440
|
+
const { handler } = await import("./chunks/globals-H2WF344Y.js");
|
|
3433
3441
|
await handler({ format: opts.format });
|
|
3434
3442
|
});
|
|
3435
3443
|
helpGroup.command("intro").description("Generate a comprehensive introduction and context document for Crunes and the active project").option("-g, --global", "generate a global, pure-ecosystem guide (skip local project context)").option("--out <path>", "output file path (defaults to stdout)").addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).action(async (opts) => {
|
|
3436
|
-
const { handler } = await import("./chunks/intro-
|
|
3444
|
+
const { handler } = await import("./chunks/intro-4CICBP2J.js");
|
|
3437
3445
|
await handler({
|
|
3438
3446
|
global: !!opts.global,
|
|
3439
3447
|
out: opts.out,
|
|
@@ -3447,32 +3455,48 @@ function buildProgram() {
|
|
|
3447
3455
|
await handler();
|
|
3448
3456
|
});
|
|
3449
3457
|
helpGroup.command("run").description("Show detailed documentation, conventions, and examples for the run(args) export").action(async () => {
|
|
3450
|
-
const { handler } = await import("./chunks/run-
|
|
3458
|
+
const { handler } = await import("./chunks/run-Y4TG3EM3.js");
|
|
3459
|
+
await handler();
|
|
3460
|
+
});
|
|
3461
|
+
helpGroup.command("repl").description("Show detailed documentation, conventions, and examples for the repl(args) export").action(async () => {
|
|
3462
|
+
const { handler } = await import("./chunks/repl-STBZC4P2.js");
|
|
3463
|
+
await handler();
|
|
3464
|
+
});
|
|
3465
|
+
helpGroup.command("args-repl").description("Show detailed documentation, conventions, and examples for the argsRepl(builder) export").action(async () => {
|
|
3466
|
+
const { handler } = await import("./chunks/args-repl-TX3YWUOO.js");
|
|
3467
|
+
await handler();
|
|
3468
|
+
});
|
|
3469
|
+
helpGroup.command("banner-repl").description("Show detailed documentation and examples for the bannerRepl(args) export").action(async () => {
|
|
3470
|
+
const { handler } = await import("./chunks/banner-repl-DD22Z33A.js");
|
|
3471
|
+
await handler();
|
|
3472
|
+
});
|
|
3473
|
+
helpGroup.command("commands-repl").description("Show detailed documentation and examples for the commandsRepl(builder) export").action(async () => {
|
|
3474
|
+
const { handler } = await import("./chunks/commands-repl-IPLJ4M7X.js");
|
|
3475
|
+
await handler();
|
|
3476
|
+
});
|
|
3477
|
+
helpGroup.command("input-repl").description("Show detailed documentation and examples for the inputRepl(input) export").action(async () => {
|
|
3478
|
+
const { handler } = await import("./chunks/input-repl-ZBH6FVPV.js");
|
|
3479
|
+
await handler();
|
|
3480
|
+
});
|
|
3481
|
+
helpGroup.command("complete-input-repl").description("Show detailed documentation and examples for the completeInputRepl(tokens) export").action(async () => {
|
|
3482
|
+
const { handler } = await import("./chunks/complete-input-repl-IDSCMRYL.js");
|
|
3451
3483
|
await handler();
|
|
3452
3484
|
});
|
|
3453
3485
|
program3.command("version").description("Print the installed version and check for updates").option("--no-check", "skip the npm update check").action(async (opts) => {
|
|
3454
|
-
const { handler } = await import("./chunks/version-
|
|
3486
|
+
const { handler } = await import("./chunks/version-W7MA4ZCA.js");
|
|
3455
3487
|
await handler({ check: opts.check, plain: !!program3.opts().plain });
|
|
3456
3488
|
});
|
|
3457
3489
|
program3.command("doctor").description("Verify environment and project setup").action(async () => {
|
|
3458
|
-
const { handler } = await import("./chunks/doctor-
|
|
3490
|
+
const { handler } = await import("./chunks/doctor-N43QEMAH.js");
|
|
3459
3491
|
await handler({ projectRoot: projectRoot() });
|
|
3460
3492
|
});
|
|
3461
|
-
program3.command("
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
const { output } = await import("./chunks/output-RJ6JSNY7.js");
|
|
3467
|
-
output.error("Missing required argument: <rune>");
|
|
3468
|
-
process.exit(1);
|
|
3469
|
-
}
|
|
3470
|
-
await handler({ key, sections, runeArgs, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3471
|
-
});
|
|
3472
|
-
program3.command("bench [args...]").description("Time rune execution and report fast, ok, or slow.").addHelpText("after", '\nImportant: Global flags (e.g. --cwd) MUST appear before the "bench" command.\n\nSyntax:\n [--runs <n>] [--warmup] [--section s1,s2] <key> [rune-args...]').allowUnknownOption().passThroughOptions().action(async (args) => {
|
|
3473
|
-
const { handler, parseBenchArgs } = await import("./chunks/benchmark-ATSRQIDC.js");
|
|
3493
|
+
program3.command("bench [args...]").description("Time rune execution and report fast, ok, or slow.").addHelpText(
|
|
3494
|
+
"after",
|
|
3495
|
+
'\nImportant: Global flags (e.g. --cwd) MUST appear before the "bench" command.\n\nSyntax:\n [--runs <n>] [--warmup] <key>[--runs <n>] [--warmup] [-s s1,s2] [rune-args...]\n\nCommand flags:\n -b, --batch enable batching multiple runes with +\n --format text|jsonl output format (default: text)\n --fail-fast stop on first error\n --runs <n> default number of runs for all runes (default: 1)\n --warmup default warmup run for all runes\n\nPer-rune bracket flags (inside key[...]):\n --runs <n> override run count for this rune\n --warmup override warmup for this rune\n -s, --section s1,s2 filter output sections for this rune'
|
|
3496
|
+
).allowUnknownOption().passThroughOptions().action(async (args, _opts, _command) => {
|
|
3497
|
+
const { handler, parseBenchArgs } = await import("./chunks/benchmark-BJEAAFWG.js");
|
|
3474
3498
|
const parsed = parseBenchArgs(args);
|
|
3475
|
-
if (!parsed.key) {
|
|
3499
|
+
if (!parsed.segments[0]?.key) {
|
|
3476
3500
|
const { output } = await import("./chunks/output-RJ6JSNY7.js");
|
|
3477
3501
|
output.error("Missing required argument: <rune>");
|
|
3478
3502
|
process.exit(1);
|
|
@@ -3480,50 +3504,59 @@ function buildProgram() {
|
|
|
3480
3504
|
await handler({ ...parsed, plain: !!program3.opts().plain, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3481
3505
|
});
|
|
3482
3506
|
program3.command("list").description("List all registered runes").addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).action(async (opts) => {
|
|
3483
|
-
const { handler } = await import("./chunks/list-
|
|
3507
|
+
const { handler } = await import("./chunks/list-WH7KESMV.js");
|
|
3484
3508
|
await handler({ format: opts.format, plain: !!program3.opts().plain, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3485
3509
|
});
|
|
3486
3510
|
const jobs = program3.command("job").description("Manage background jobs");
|
|
3487
|
-
jobs.command("list").description("List background jobs for the current project").
|
|
3488
|
-
const { handler } = await import("./chunks/list-
|
|
3489
|
-
await handler({ projectDir: projectRoot()
|
|
3511
|
+
jobs.command("list").description("List background jobs for the current project").action(async () => {
|
|
3512
|
+
const { handler } = await import("./chunks/list-4X3JFQGS.js");
|
|
3513
|
+
await handler({ projectDir: projectRoot() });
|
|
3490
3514
|
});
|
|
3491
|
-
jobs.command("kill <id>").description("Send SIGTERM to a background job and remove its record").
|
|
3492
|
-
const { handler } = await import("./chunks/kill-
|
|
3493
|
-
await handler({ id, projectDir: projectRoot()
|
|
3515
|
+
jobs.command("kill <id>").description("Send SIGTERM to a background job and remove its record").action(async (id) => {
|
|
3516
|
+
const { handler } = await import("./chunks/kill-2UG7PHUV.js");
|
|
3517
|
+
await handler({ id, projectDir: projectRoot() });
|
|
3494
3518
|
});
|
|
3495
3519
|
const cache = program3.command("cache").description("Manage cache buckets");
|
|
3496
|
-
cache.command("list").description("List cache buckets for the current project").option("-
|
|
3497
|
-
const { handler } = await import("./chunks/list-
|
|
3498
|
-
await handler({ projectDir: projectRoot(),
|
|
3520
|
+
cache.command("list").description("List cache buckets for the current project").option("-p, --plugin [pluginId]", "filter to plugin-related buckets; pass a value to match a specific plugin").action(async (opts) => {
|
|
3521
|
+
const { handler } = await import("./chunks/list-A5WVDBWF.js");
|
|
3522
|
+
await handler({ projectDir: projectRoot(), plugin: opts.plugin });
|
|
3523
|
+
});
|
|
3524
|
+
cache.command("clear <id>").description("Remove expired keys from a cache bucket").option("-p, --plugin [pluginId]", "filter to plugin-related buckets").action(async (id, opts) => {
|
|
3525
|
+
const { handler } = await import("./chunks/clear-YBDIPEEH.js");
|
|
3526
|
+
await handler({ id, projectDir: projectRoot(), plugin: opts.plugin });
|
|
3527
|
+
});
|
|
3528
|
+
cache.command("delete <id>").description("Delete a cache bucket directory and deregister it").option("-p, --plugin [pluginId]", "filter to plugin-related buckets").action(async (id, opts) => {
|
|
3529
|
+
const { handler } = await import("./chunks/delete-LNOYM5KG.js");
|
|
3530
|
+
await handler({ id, projectDir: projectRoot(), yes: !!program3.opts().yes, plugin: opts.plugin });
|
|
3499
3531
|
});
|
|
3500
|
-
cache.command("
|
|
3501
|
-
const { handler } = await import("./chunks/
|
|
3502
|
-
await handler({ id, projectDir: projectRoot(),
|
|
3532
|
+
cache.command("unset <id> <key>").description("Remove a single key from a cache bucket").option("-p, --plugin [pluginId]", "filter to plugin-related buckets").action(async (id, key, opts) => {
|
|
3533
|
+
const { handler } = await import("./chunks/unset-YASSMSE5.js");
|
|
3534
|
+
await handler({ id, key, projectDir: projectRoot(), plugin: opts.plugin });
|
|
3503
3535
|
});
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3536
|
+
const schema = program3.command("schema").description("Manage schema cache");
|
|
3537
|
+
schema.command("list").description("List cached schemas for the current project").action(async () => {
|
|
3538
|
+
const { handler } = await import("./chunks/list-PTAWQYWG.js");
|
|
3539
|
+
await handler({ projectDir: projectRoot() });
|
|
3507
3540
|
});
|
|
3508
|
-
|
|
3509
|
-
const { handler } = await import("./chunks/
|
|
3510
|
-
await handler({
|
|
3541
|
+
schema.command("delete <rune-key>").description("Delete cached schema files for a rune key").action(async (runeKey) => {
|
|
3542
|
+
const { handler } = await import("./chunks/delete-E4TEBRPX.js");
|
|
3543
|
+
await handler({ runeKey, projectDir: projectRoot() });
|
|
3511
3544
|
});
|
|
3512
3545
|
const sqlite = program3.command("sqlite").description("Manage SQLite databases");
|
|
3513
|
-
sqlite.command("list").description("List all registered SQLite databases").option("-
|
|
3514
|
-
const { handler } = await import("./chunks/list-
|
|
3515
|
-
await handler({ projectDir: projectRoot(),
|
|
3546
|
+
sqlite.command("list").description("List all registered SQLite databases").option("-p, --plugin [pluginId]", "filter to plugin-related databases; pass a value to match a specific plugin").action(async (opts) => {
|
|
3547
|
+
const { handler } = await import("./chunks/list-U7PAYNAH.js");
|
|
3548
|
+
await handler({ projectDir: projectRoot(), plugin: opts.plugin });
|
|
3516
3549
|
});
|
|
3517
|
-
sqlite.command("delete <id>").description("Delete a SQLite database file and deregister it").option("-
|
|
3518
|
-
const { handler } = await import("./chunks/delete-
|
|
3519
|
-
await handler({ id, yes: !!program3.opts().yes, projectDir: projectRoot(),
|
|
3550
|
+
sqlite.command("delete <id>").description("Delete a SQLite database file and deregister it").option("-p, --plugin [pluginId]", "filter to plugin-related databases").action(async (id, opts) => {
|
|
3551
|
+
const { handler } = await import("./chunks/delete-C4UJ7X5K.js");
|
|
3552
|
+
await handler({ id, yes: !!program3.opts().yes, projectDir: projectRoot(), plugin: opts.plugin });
|
|
3520
3553
|
});
|
|
3521
|
-
sqlite.command("query <id> <sql>").description("Run a SQL query against a registered SQLite database (readonly)").option("-
|
|
3522
|
-
const { handler } = await import("./chunks/query-
|
|
3523
|
-
await handler({ id, sql, projectDir: projectRoot(),
|
|
3554
|
+
sqlite.command("query <id> <sql>").description("Run a SQL query against a registered SQLite database (readonly)").option("-p, --plugin [pluginId]", "filter to plugin-related databases").action(async (id, sql, opts) => {
|
|
3555
|
+
const { handler } = await import("./chunks/query-AW7WYILM.js");
|
|
3556
|
+
await handler({ id, sql, projectDir: projectRoot(), plugin: opts.plugin });
|
|
3524
3557
|
});
|
|
3525
3558
|
program3.command("init").description("Create .crunes/config.json in the current project").action(async () => {
|
|
3526
|
-
const { handler } = await import("./chunks/init-
|
|
3559
|
+
const { handler } = await import("./chunks/init-HU5OMHEH.js");
|
|
3527
3560
|
await handler({ yes: !!program3.opts().yes, projectRoot: projectRoot() });
|
|
3528
3561
|
});
|
|
3529
3562
|
program3.command("create [new-rune]").description("Scaffold a new rune and register it in config").addOption(new Option("--format <format>", "rune output format").choices(["tree", "markdown"])).option("--path <path>", "file path for the rune (default: .crunes/runes/<key>.js)").option("--name <name>", "human-readable label shown in crunes list").option("--description <description>", "short description of what context this rune provides").action(async (key, opts) => {
|
|
@@ -3532,44 +3565,44 @@ function buildProgram() {
|
|
|
3532
3565
|
});
|
|
3533
3566
|
const plugin = program3.command("plugin").description("Manage rune plugins");
|
|
3534
3567
|
plugin.command("install <source>").description("Install a plugin from a configured marketplace in the format <marketplace>@<plugin>").action(async (source) => {
|
|
3535
|
-
const { handler } = await import("./chunks/install-
|
|
3536
|
-
await handler({ source, projectRoot: projectRoot(), yes: !!program3.opts().yes });
|
|
3568
|
+
const { handler } = await import("./chunks/install-RRLUOYFO.js");
|
|
3569
|
+
await handler({ source, projectRoot: projectRoot(), configRoot: configRoot(), yes: !!program3.opts().yes });
|
|
3537
3570
|
});
|
|
3538
3571
|
plugin.command("uninstall <plugin>").description("Uninstall an installed plugin").action(async (name) => {
|
|
3539
|
-
const { handler } = await import("./chunks/uninstall-
|
|
3540
|
-
await handler({ name, yes: !!program3.opts().yes, projectRoot: projectRoot() });
|
|
3572
|
+
const { handler } = await import("./chunks/uninstall-55YTHZRH.js");
|
|
3573
|
+
await handler({ name, yes: !!program3.opts().yes, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3541
3574
|
});
|
|
3542
3575
|
plugin.command("list").description("List installed plugins").addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).action(async (opts) => {
|
|
3543
|
-
const { handler } = await import("./chunks/list-
|
|
3576
|
+
const { handler } = await import("./chunks/list-FLAYJQKN.js");
|
|
3544
3577
|
await handler({ format: opts.format });
|
|
3545
3578
|
});
|
|
3546
3579
|
plugin.command("update [plugin]").description("Update one or all installed plugins").action(async (name) => {
|
|
3547
|
-
const { handler } = await import("./chunks/update-
|
|
3548
|
-
await handler({ name, projectRoot: projectRoot() });
|
|
3580
|
+
const { handler } = await import("./chunks/update-G6XO4RIM.js");
|
|
3581
|
+
await handler({ name, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3549
3582
|
});
|
|
3550
3583
|
plugin.command("enable <plugin>").description("Add a plugin to this project's enabled list").action(async (name) => {
|
|
3551
|
-
const { handler } = await import("./chunks/enable-
|
|
3552
|
-
await handler({ name, projectRoot: projectRoot() });
|
|
3584
|
+
const { handler } = await import("./chunks/enable-327OMBPC.js");
|
|
3585
|
+
await handler({ name, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3553
3586
|
});
|
|
3554
3587
|
plugin.command("disable <plugin>").description("Remove a plugin from this project's enabled list").action(async (name) => {
|
|
3555
|
-
const { handler } = await import("./chunks/disable-
|
|
3556
|
-
await handler({ name, projectRoot: projectRoot() });
|
|
3588
|
+
const { handler } = await import("./chunks/disable-TMG2K3BF.js");
|
|
3589
|
+
await handler({ name, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3557
3590
|
});
|
|
3558
3591
|
plugin.command("create [new-plugin]").description("Scaffold a new plugin directory with all required files").option("--description <text>", "short description for plugin.json and marketplace.json").option("--author <name>", "author name (default: git config user.name)").option("--license <spdx>", "SPDX license identifier (default: MIT)").option("--out <path>", "output directory (default: ./<name>)").action(async (name, opts) => {
|
|
3559
|
-
const { handler } = await import("./chunks/create-
|
|
3592
|
+
const { handler } = await import("./chunks/create-ZFFV3Z2P.js");
|
|
3560
3593
|
await handler({ name, description: opts.description, author: opts.author, license: opts.license, out: opts.out, yes: !!program3.opts().yes, projectRoot: projectRoot() });
|
|
3561
3594
|
});
|
|
3562
3595
|
const template = program3.command("template").description("Manage rune templates");
|
|
3563
3596
|
template.command("list [template-source]").description('List available templates. [template-source] can be "project" (project config only) or a plugin name; omit to list all.').addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).action(async (source, opts) => {
|
|
3564
|
-
const { handler } = await import("./chunks/list-
|
|
3565
|
-
await handler({ source, format: opts.format, plain: !!program3.opts().plain, projectRoot: projectRoot() });
|
|
3597
|
+
const { handler } = await import("./chunks/list-CK5X2YN3.js");
|
|
3598
|
+
await handler({ source, format: opts.format, plain: !!program3.opts().plain, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3566
3599
|
});
|
|
3567
3600
|
template.command("apply <template>").description("Copy a template into the project as a new rune and register it in config.").addHelpText(
|
|
3568
3601
|
"after",
|
|
3569
3602
|
"\nKey prefixes:\n project:name \u2014 use a template defined in this project's config\n plugin:name \u2014 use a template from a specific installed plugin\n name \u2014 auto-resolve: project config first, then installed plugins"
|
|
3570
3603
|
).option("--as <new-rune>", "register the rune under a different key (default: template name)").option("--path <path>", "file path for the rune (default: .crunes/runes/<key>.js)").option("--name <name>", "human-readable label shown in crunes list").option("--description <description>", "short description of what context this rune provides").action(async (ref, opts) => {
|
|
3571
|
-
const { handler } = await import("./chunks/apply-
|
|
3572
|
-
await handler({ ref, key: opts.as, path: opts.path, name: opts.name, description: opts.description, yes: !!program3.opts().yes, projectRoot: projectRoot() });
|
|
3604
|
+
const { handler } = await import("./chunks/apply-YC6JEPUN.js");
|
|
3605
|
+
await handler({ ref, key: opts.as, path: opts.path, name: opts.name, description: opts.description, yes: !!program3.opts().yes, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3573
3606
|
});
|
|
3574
3607
|
template.command("create [new-template]").description("Scaffold a new template file and register it in config").option("--path <path>", "file path for the template (default: .crunes/templates/<name>.js)").option("--name <name>", "display label shown in crunes template list (separate from the template key)").option("--description <description>", "short description of what kind of rune this template produces").action(async (name, opts) => {
|
|
3575
3608
|
const { handler } = await import("./chunks/create-GPDE2YKL.js");
|
|
@@ -3577,27 +3610,27 @@ function buildProgram() {
|
|
|
3577
3610
|
});
|
|
3578
3611
|
const marketplace = program3.command("marketplace").description("Manage plugin marketplace sources");
|
|
3579
3612
|
marketplace.command("add <url>").description("Add a marketplace source URL").action(async (url) => {
|
|
3580
|
-
const { handler } = await import("./chunks/add-
|
|
3613
|
+
const { handler } = await import("./chunks/add-CBHWFGCA.js");
|
|
3581
3614
|
await handler({ url });
|
|
3582
3615
|
});
|
|
3583
3616
|
marketplace.command("remove <url>").description("Remove a marketplace source URL").action(async (url) => {
|
|
3584
|
-
const { handler } = await import("./chunks/remove-
|
|
3617
|
+
const { handler } = await import("./chunks/remove-QUH2D3S5.js");
|
|
3585
3618
|
await handler({ url });
|
|
3586
3619
|
});
|
|
3587
3620
|
marketplace.command("list").description("List configured marketplace sources").action(async () => {
|
|
3588
|
-
const { handler } = await import("./chunks/list-
|
|
3621
|
+
const { handler } = await import("./chunks/list-7VHJIUDX.js");
|
|
3589
3622
|
await handler();
|
|
3590
3623
|
});
|
|
3591
3624
|
marketplace.command("search <query>").description("Search for plugins across configured marketplace sources").action(async (query) => {
|
|
3592
|
-
const { handler } = await import("./chunks/search-
|
|
3625
|
+
const { handler } = await import("./chunks/search-MSSDGJTF.js");
|
|
3593
3626
|
await handler({ query });
|
|
3594
3627
|
});
|
|
3595
3628
|
marketplace.command("update [url]").description("Refresh cached marketplace data (all sources if no URL given)").action(async (url) => {
|
|
3596
|
-
const { handler } = await import("./chunks/update-
|
|
3629
|
+
const { handler } = await import("./chunks/update-EWWDROKW.js");
|
|
3597
3630
|
await handler({ url });
|
|
3598
3631
|
});
|
|
3599
3632
|
marketplace.command("browse").description("List all plugins from all configured marketplace sources").addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).action(async (opts) => {
|
|
3600
|
-
const { handler } = await import("./chunks/browse-
|
|
3633
|
+
const { handler } = await import("./chunks/browse-JZFU52ET.js");
|
|
3601
3634
|
await handler({ format: opts.format });
|
|
3602
3635
|
});
|
|
3603
3636
|
const completions = program3.command("completions").description("Manage shell tab-completions");
|
|
@@ -3628,9 +3661,9 @@ function buildProgram() {
|
|
|
3628
3661
|
|
|
3629
3662
|
// src/cli/cli.js
|
|
3630
3663
|
if (process.env.CRUNES_NO_TIMEOUT === "1") {
|
|
3631
|
-
const
|
|
3632
|
-
if (
|
|
3633
|
-
process.title = `crunes: ${process.argv[
|
|
3664
|
+
const runIdx = process.argv.indexOf("run");
|
|
3665
|
+
if (runIdx !== -1 && process.argv[runIdx + 1]) {
|
|
3666
|
+
process.title = `crunes: ${process.argv[runIdx + 1]}`;
|
|
3634
3667
|
}
|
|
3635
3668
|
}
|
|
3636
3669
|
var program2 = buildProgram();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@darkrymit/crunes-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "CLI tool for querying crunes enrichers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -23,17 +23,22 @@
|
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@clack/prompts": "^1.5.0",
|
|
25
25
|
"archiver": "^8.0.0",
|
|
26
|
-
"chalk": "^5.
|
|
26
|
+
"chalk": "^5.6.2",
|
|
27
|
+
"chokidar": "^5.0.0",
|
|
27
28
|
"cli-table3": "^0.6.5",
|
|
28
29
|
"commander": "^15.0.0",
|
|
30
|
+
"comment-json": "^5.0.0",
|
|
31
|
+
"csv-parse": "^7.0.0",
|
|
32
|
+
"csv-stringify": "^6.8.0",
|
|
29
33
|
"dotenv": "^17.4.2",
|
|
30
34
|
"esbuild": "^0.28.0",
|
|
31
35
|
"fast-text-encoding": "^1.0.6",
|
|
32
36
|
"fast-xml-parser": "^5.8.0",
|
|
37
|
+
"json5": "^2.2.3",
|
|
33
38
|
"jsonpath-plus": "^10.4.0",
|
|
34
|
-
"micromatch": "^4.0.8",
|
|
35
39
|
"mysql2": "^3.12.0",
|
|
36
40
|
"pg": "^8.11.0",
|
|
41
|
+
"picomatch": "^4.0.2",
|
|
37
42
|
"tar": "^7.5.15",
|
|
38
43
|
"tinyglobby": "^0.2.17",
|
|
39
44
|
"typedoc": "^0.28.19",
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
parseSegment
|
|
3
|
-
} from "./chunk-AIEWOUXT.js";
|
|
4
|
-
import {
|
|
5
|
-
runRune
|
|
6
|
-
} from "./chunk-6I7RHSAA.js";
|
|
7
|
-
import "./chunk-67I2J474.js";
|
|
8
|
-
import "./chunk-XXUNHQIB.js";
|
|
9
|
-
import "./chunk-NXSDVVTW.js";
|
|
10
|
-
import "./chunk-QMWGQXEZ.js";
|
|
11
|
-
import "./chunk-3TM6B4E5.js";
|
|
12
|
-
import {
|
|
13
|
-
loadConfig
|
|
14
|
-
} from "./chunk-H3BVJCIL.js";
|
|
15
|
-
import {
|
|
16
|
-
output
|
|
17
|
-
} from "./chunk-6XLT25GS.js";
|
|
18
|
-
import {
|
|
19
|
-
source_default
|
|
20
|
-
} from "./chunk-WCODTMDN.js";
|
|
21
|
-
import "./chunk-GHQOK4L7.js";
|
|
22
|
-
import "./chunk-HMU2J25D.js";
|
|
23
|
-
import "./chunk-G3U4V32O.js";
|
|
24
|
-
import {
|
|
25
|
-
init_require_shim
|
|
26
|
-
} from "./chunk-TPK5AGRA.js";
|
|
27
|
-
|
|
28
|
-
// src/rune/commands/benchmark.js
|
|
29
|
-
init_require_shim();
|
|
30
|
-
import { performance } from "node:perf_hooks";
|
|
31
|
-
var FAST_MS = 200;
|
|
32
|
-
var SLOW_MS = 1e3;
|
|
33
|
-
var BAR_WIDTH = 10;
|
|
34
|
-
function label(ms) {
|
|
35
|
-
if (ms >= SLOW_MS) return "slow";
|
|
36
|
-
if (ms >= FAST_MS) return "ok";
|
|
37
|
-
return "fast";
|
|
38
|
-
}
|
|
39
|
-
function bar(ms, plain) {
|
|
40
|
-
const ratio = Math.min(ms / SLOW_MS, 1);
|
|
41
|
-
const filled = Math.round(ratio * BAR_WIDTH);
|
|
42
|
-
const empty = BAR_WIDTH - filled;
|
|
43
|
-
const fill = "\u2588".repeat(filled) + "\u2591".repeat(empty);
|
|
44
|
-
if (plain) return fill;
|
|
45
|
-
if (ms >= SLOW_MS) return source_default.red(fill);
|
|
46
|
-
if (ms >= FAST_MS) return source_default.yellow(fill);
|
|
47
|
-
return source_default.green(fill);
|
|
48
|
-
}
|
|
49
|
-
function labelColour(l, plain) {
|
|
50
|
-
if (plain) return l;
|
|
51
|
-
if (l === "slow") return source_default.red(l);
|
|
52
|
-
if (l === "ok") return source_default.yellow(l);
|
|
53
|
-
return source_default.green(l);
|
|
54
|
-
}
|
|
55
|
-
function parseBenchArgs(argv) {
|
|
56
|
-
let runs = 1;
|
|
57
|
-
let warmup = false;
|
|
58
|
-
let i = 0;
|
|
59
|
-
while (i < argv.length) {
|
|
60
|
-
const tok = argv[i];
|
|
61
|
-
if (tok === "--runs" && i + 1 < argv.length) {
|
|
62
|
-
runs = parseInt(argv[i + 1], 10);
|
|
63
|
-
i += 2;
|
|
64
|
-
} else if (tok.startsWith("--runs=")) {
|
|
65
|
-
runs = parseInt(tok.slice(7), 10);
|
|
66
|
-
i++;
|
|
67
|
-
} else if (tok === "--warmup") {
|
|
68
|
-
warmup = true;
|
|
69
|
-
i++;
|
|
70
|
-
} else {
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
const { key, sections, runeArgs } = parseSegment(argv.slice(i));
|
|
75
|
-
return { key, sections, runeArgs, runs, warmup };
|
|
76
|
-
}
|
|
77
|
-
async function handler({
|
|
78
|
-
key,
|
|
79
|
-
runeArgs = [],
|
|
80
|
-
runs = 1,
|
|
81
|
-
warmup = false,
|
|
82
|
-
plain = false,
|
|
83
|
-
projectRoot = process.cwd(),
|
|
84
|
-
configRoot = projectRoot
|
|
85
|
-
} = {}) {
|
|
86
|
-
if (!key) {
|
|
87
|
-
output.error("Missing required argument: <rune>");
|
|
88
|
-
process.exit(1);
|
|
89
|
-
}
|
|
90
|
-
if (!Number.isInteger(runs) || runs < 1) {
|
|
91
|
-
output.error("Invalid option: --runs must be a positive integer >= 1");
|
|
92
|
-
process.exit(1);
|
|
93
|
-
}
|
|
94
|
-
let config;
|
|
95
|
-
try {
|
|
96
|
-
config = loadConfig(configRoot);
|
|
97
|
-
} catch (err2) {
|
|
98
|
-
output.error(`Config unreadable: ${err2.message}`);
|
|
99
|
-
output.info("Run `crunes init` to create a config file.");
|
|
100
|
-
process.exit(1);
|
|
101
|
-
}
|
|
102
|
-
if (!plain) {
|
|
103
|
-
console.log(source_default.dim("\u2500".repeat(40)));
|
|
104
|
-
console.log(source_default.bold("crunes benchmark"));
|
|
105
|
-
console.log();
|
|
106
|
-
}
|
|
107
|
-
const times = [];
|
|
108
|
-
let err = null;
|
|
109
|
-
if (warmup) {
|
|
110
|
-
try {
|
|
111
|
-
await runRune(projectRoot, config, key, runeArgs, { configDir: configRoot });
|
|
112
|
-
} catch {
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
for (let i = 0; i < runs; i++) {
|
|
116
|
-
const t0 = performance.now();
|
|
117
|
-
try {
|
|
118
|
-
await runRune(projectRoot, config, key, runeArgs, { configDir: configRoot });
|
|
119
|
-
} catch (e) {
|
|
120
|
-
err = e;
|
|
121
|
-
break;
|
|
122
|
-
}
|
|
123
|
-
times.push(performance.now() - t0);
|
|
124
|
-
}
|
|
125
|
-
const maxKeyLen = key.length;
|
|
126
|
-
let total = 0;
|
|
127
|
-
let slowCount = 0;
|
|
128
|
-
if (err) {
|
|
129
|
-
if (plain) {
|
|
130
|
-
process.stdout.write(`${key} error ${err.message}
|
|
131
|
-
`);
|
|
132
|
-
} else {
|
|
133
|
-
console.log(` ${source_default.dim(key.padEnd(maxKeyLen))} ${source_default.red("error")} ${source_default.dim(err.message)}`);
|
|
134
|
-
}
|
|
135
|
-
} else {
|
|
136
|
-
const avg = Math.round(times.reduce((a, b) => a + b, 0) / times.length);
|
|
137
|
-
const l = label(avg);
|
|
138
|
-
if (l === "slow") slowCount++;
|
|
139
|
-
total += avg;
|
|
140
|
-
if (plain) {
|
|
141
|
-
process.stdout.write(`${key} ${avg} ${l}
|
|
142
|
-
`);
|
|
143
|
-
} else {
|
|
144
|
-
const k = key.padEnd(maxKeyLen);
|
|
145
|
-
const warn = l === "slow" ? ` ${source_default.yellow("\u26A0")}` : "";
|
|
146
|
-
console.log(` ${source_default.cyan(k)} ${String(avg).padStart(6)}ms ${bar(avg, plain)} ${labelColour(l, plain)}${warn}`);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
if (plain) {
|
|
150
|
-
process.stdout.write(`total ${total}
|
|
151
|
-
slow-count ${slowCount}
|
|
152
|
-
`);
|
|
153
|
-
} else {
|
|
154
|
-
console.log();
|
|
155
|
-
const slowMsg = slowCount > 0 ? ` ${source_default.yellow("\u26A0")} ${slowCount} slow rune${slowCount > 1 ? "s" : ""} (> ${SLOW_MS}ms)` : ` ${source_default.green("\u2713")} All runes within acceptable range`;
|
|
156
|
-
console.log(` ${source_default.dim("Total:")} ${total}ms${runs > 1 ? ` (avg of ${runs} runs)` : ""}`);
|
|
157
|
-
console.log(slowMsg);
|
|
158
|
-
console.log();
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
export {
|
|
162
|
-
handler,
|
|
163
|
-
parseBenchArgs
|
|
164
|
-
};
|