@darkrymit/crunes-cli 0.8.3 → 0.8.5
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/chunks/{apply-YC6JEPUN.js → apply-J4YICV6H.js} +6 -5
- package/dist/chunks/{benchmark-BJEAAFWG.js → benchmark-AKKV7G32.js} +4 -4
- package/dist/chunks/{chunk-DZJRYFOP.js → chunk-BTIPUR5S.js} +3 -3
- package/dist/chunks/{chunk-H3BVJCIL.js → chunk-GSA432UC.js} +12 -27
- package/dist/chunks/{chunk-65J65MAP.js → chunk-GTCPZ22N.js} +15 -1
- package/dist/chunks/{chunk-2PBPDTRD.js → chunk-KII6KW5Z.js} +1 -1
- package/dist/chunks/{chunk-NAEVMRNA.js → chunk-T53L5CJW.js} +90 -10
- package/dist/chunks/{chunk-JU6FKUBY.js → chunk-WJRZN7BR.js} +173 -91
- package/dist/chunks/{create-ZFFV3Z2P.js → create-L6DJN4ME.js} +2 -2
- package/dist/chunks/{create-OZACMPEU.js → create-VYZRWRGQ.js} +6 -2
- package/dist/chunks/disable-FGJ7VMPO.js +47 -0
- package/dist/chunks/{doctor-N43QEMAH.js → doctor-7NWBJAH7.js} +1 -1
- package/dist/chunks/{enable-327OMBPC.js → enable-ZL6QOC2I.js} +1 -1
- package/dist/chunks/{install-RRLUOYFO.js → install-FIYRMVLR.js} +2 -2
- package/dist/chunks/{intro-4CICBP2J.js → intro-36OLGNYN.js} +68 -40
- package/dist/chunks/{list-CK5X2YN3.js → list-2JYMBMZC.js} +2 -2
- package/dist/chunks/{list-FLAYJQKN.js → list-AIYNOPNZ.js} +1 -1
- package/dist/chunks/{list-WH7KESMV.js → list-NZ5DHXJF.js} +4 -4
- package/dist/chunks/{registry-3QIL5SVL.js → registry-RG34DPD7.js} +3 -1
- package/dist/chunks/{repl-VGC5FUJG.js → repl-BPEWARN7.js} +5 -5
- package/dist/chunks/{resolver-QMIY33FM.js → resolver-36V72VKR.js} +4 -2
- package/dist/chunks/{run-T33CMCFZ.js → run-IVL23SMW.js} +4 -4
- package/dist/chunks/{rune-UBRVWG5A.js → rune-XRREUL56.js} +63 -16
- package/dist/chunks/{uninstall-55YTHZRH.js → uninstall-G56DZRFG.js} +2 -2
- package/dist/chunks/{update-G6XO4RIM.js → update-KSC6VRMU.js} +2 -2
- package/dist/chunks/{utils-XOWJQWNR.js → utils-3SJFSUSV.js} +1 -1
- package/dist/chunks/{version-2W2M74UT.js → version-YG2M7HER.js} +3 -2
- package/dist/cli.js +22 -28
- package/package.json +3 -2
- package/dist/chunks/disable-TMG2K3BF.js +0 -47
|
@@ -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.8.
|
|
19
|
+
version: "0.8.5",
|
|
20
20
|
description: "CLI tool for querying crunes enrichers",
|
|
21
21
|
type: "module",
|
|
22
22
|
bin: {
|
|
@@ -31,6 +31,7 @@ var package_default = {
|
|
|
31
31
|
test: "vitest run"
|
|
32
32
|
},
|
|
33
33
|
dependencies: {
|
|
34
|
+
"comment-json": "^5.0.0",
|
|
34
35
|
esbuild: "^0.28.0",
|
|
35
36
|
"isolated-vm": "^6.1.2"
|
|
36
37
|
},
|
|
@@ -40,11 +41,11 @@ var package_default = {
|
|
|
40
41
|
devDependencies: {
|
|
41
42
|
"@clack/prompts": "^1.5.0",
|
|
42
43
|
archiver: "^8.0.0",
|
|
44
|
+
buffer: "^6.0.3",
|
|
43
45
|
chalk: "^5.6.2",
|
|
44
46
|
chokidar: "^5.0.0",
|
|
45
47
|
"cli-table3": "^0.6.5",
|
|
46
48
|
commander: "^15.0.0",
|
|
47
|
-
"comment-json": "^5.0.0",
|
|
48
49
|
"csv-parse": "^7.0.0",
|
|
49
50
|
"csv-stringify": "^6.8.0",
|
|
50
51
|
dotenv: "^17.4.2",
|
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.8.
|
|
3399
|
+
program3.name("crunes").description("CLI tool for managing context runes").version("0.8.5", "-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) {
|
|
@@ -3415,7 +3415,7 @@ function buildProgram() {
|
|
|
3415
3415
|
"after",
|
|
3416
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
3417
|
).allowUnknownOption().passThroughOptions().action(async (args, _opts, _command) => {
|
|
3418
|
-
const { handler, parseRunArgs } = await import("./chunks/run-
|
|
3418
|
+
const { handler, parseRunArgs } = await import("./chunks/run-IVL23SMW.js");
|
|
3419
3419
|
const { segments, format, failFast, isBatch } = parseRunArgs(args);
|
|
3420
3420
|
await handler({ segments, format, failFast, isBatch, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3421
3421
|
});
|
|
@@ -3423,32 +3423,26 @@ function buildProgram() {
|
|
|
3423
3423
|
"after",
|
|
3424
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
3425
|
).allowUnknownOption().passThroughOptions().action(async (args, _opts, _command) => {
|
|
3426
|
-
const { handler, parseReplArgs } = await import("./chunks/repl-
|
|
3426
|
+
const { handler, parseReplArgs } = await import("./chunks/repl-BPEWARN7.js");
|
|
3427
3427
|
const { key, runeArgs, sections, format } = parseReplArgs(args);
|
|
3428
3428
|
await handler({ key, runeArgs, sections, format, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3429
3429
|
});
|
|
3430
3430
|
const helpGroup = program3.command("docs").description("Show documentation for runes and other resources");
|
|
3431
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) => {
|
|
3432
|
-
const { handler } = await import("./chunks/rune-
|
|
3432
|
+
const { handler } = await import("./chunks/rune-XRREUL56.js");
|
|
3433
3433
|
await handler({ keys, format: opts.format, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3434
3434
|
});
|
|
3435
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) => {
|
|
3436
|
-
const { handler } = await import("./chunks/utils-
|
|
3436
|
+
const { handler } = await import("./chunks/utils-3SJFSUSV.js");
|
|
3437
3437
|
await handler({ namespaces, format: opts.format });
|
|
3438
3438
|
});
|
|
3439
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) => {
|
|
3440
3440
|
const { handler } = await import("./chunks/globals-H2WF344Y.js");
|
|
3441
3441
|
await handler({ format: opts.format });
|
|
3442
3442
|
});
|
|
3443
|
-
helpGroup.command("intro").description("Generate a comprehensive introduction and context document for Crunes and the active project").option("
|
|
3444
|
-
const { handler } = await import("./chunks/intro-
|
|
3445
|
-
await handler({
|
|
3446
|
-
global: !!opts.global,
|
|
3447
|
-
out: opts.out,
|
|
3448
|
-
format: opts.format,
|
|
3449
|
-
projectRoot: projectRoot(),
|
|
3450
|
-
configRoot: configRoot()
|
|
3451
|
-
});
|
|
3443
|
+
helpGroup.command("intro").description("Generate a comprehensive introduction and context document for Crunes and the active project").option("--out <path>", "output file path (defaults to stdout)").action(async (opts) => {
|
|
3444
|
+
const { handler } = await import("./chunks/intro-36OLGNYN.js");
|
|
3445
|
+
await handler({ out: opts.out });
|
|
3452
3446
|
});
|
|
3453
3447
|
helpGroup.command("args").description("Show detailed documentation, conventions, and examples for the args(builder) export").action(async () => {
|
|
3454
3448
|
const { handler } = await import("./chunks/args-KBPMNKBI.js");
|
|
@@ -3483,18 +3477,18 @@ function buildProgram() {
|
|
|
3483
3477
|
await handler();
|
|
3484
3478
|
});
|
|
3485
3479
|
program3.command("version").description("Print the installed version and check for updates").option("--no-check", "skip the npm update check").action(async (opts) => {
|
|
3486
|
-
const { handler } = await import("./chunks/version-
|
|
3480
|
+
const { handler } = await import("./chunks/version-YG2M7HER.js");
|
|
3487
3481
|
await handler({ check: opts.check, plain: !!program3.opts().plain });
|
|
3488
3482
|
});
|
|
3489
3483
|
program3.command("doctor").description("Verify environment and project setup").action(async () => {
|
|
3490
|
-
const { handler } = await import("./chunks/doctor-
|
|
3484
|
+
const { handler } = await import("./chunks/doctor-7NWBJAH7.js");
|
|
3491
3485
|
await handler({ projectRoot: projectRoot() });
|
|
3492
3486
|
});
|
|
3493
3487
|
program3.command("bench [args...]").description("Time rune execution and report fast, ok, or slow.").addHelpText(
|
|
3494
3488
|
"after",
|
|
3495
3489
|
'\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
3490
|
).allowUnknownOption().passThroughOptions().action(async (args, _opts, _command) => {
|
|
3497
|
-
const { handler, parseBenchArgs } = await import("./chunks/benchmark-
|
|
3491
|
+
const { handler, parseBenchArgs } = await import("./chunks/benchmark-AKKV7G32.js");
|
|
3498
3492
|
const parsed = parseBenchArgs(args);
|
|
3499
3493
|
if (!parsed.segments[0]?.key) {
|
|
3500
3494
|
const { output } = await import("./chunks/output-RJ6JSNY7.js");
|
|
@@ -3504,7 +3498,7 @@ function buildProgram() {
|
|
|
3504
3498
|
await handler({ ...parsed, plain: !!program3.opts().plain, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3505
3499
|
});
|
|
3506
3500
|
program3.command("list").description("List all registered runes").addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).action(async (opts) => {
|
|
3507
|
-
const { handler } = await import("./chunks/list-
|
|
3501
|
+
const { handler } = await import("./chunks/list-NZ5DHXJF.js");
|
|
3508
3502
|
await handler({ format: opts.format, plain: !!program3.opts().plain, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3509
3503
|
});
|
|
3510
3504
|
const jobs = program3.command("job").description("Manage background jobs");
|
|
@@ -3560,48 +3554,48 @@ function buildProgram() {
|
|
|
3560
3554
|
await handler({ yes: !!program3.opts().yes, projectRoot: projectRoot() });
|
|
3561
3555
|
});
|
|
3562
3556
|
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) => {
|
|
3563
|
-
const { handler } = await import("./chunks/create-
|
|
3557
|
+
const { handler } = await import("./chunks/create-VYZRWRGQ.js");
|
|
3564
3558
|
await handler({ key, format: opts.format, path: opts.path, name: opts.name, description: opts.description, yes: !!program3.opts().yes, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3565
3559
|
});
|
|
3566
3560
|
const plugin = program3.command("plugin").description("Manage rune plugins");
|
|
3567
3561
|
plugin.command("install <source>").description("Install a plugin from a configured marketplace in the format <marketplace>@<plugin>").action(async (source) => {
|
|
3568
|
-
const { handler } = await import("./chunks/install-
|
|
3562
|
+
const { handler } = await import("./chunks/install-FIYRMVLR.js");
|
|
3569
3563
|
await handler({ source, projectRoot: projectRoot(), configRoot: configRoot(), yes: !!program3.opts().yes });
|
|
3570
3564
|
});
|
|
3571
3565
|
plugin.command("uninstall <plugin>").description("Uninstall an installed plugin").action(async (name) => {
|
|
3572
|
-
const { handler } = await import("./chunks/uninstall-
|
|
3566
|
+
const { handler } = await import("./chunks/uninstall-G56DZRFG.js");
|
|
3573
3567
|
await handler({ name, yes: !!program3.opts().yes, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3574
3568
|
});
|
|
3575
3569
|
plugin.command("list").description("List installed plugins").addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).action(async (opts) => {
|
|
3576
|
-
const { handler } = await import("./chunks/list-
|
|
3570
|
+
const { handler } = await import("./chunks/list-AIYNOPNZ.js");
|
|
3577
3571
|
await handler({ format: opts.format });
|
|
3578
3572
|
});
|
|
3579
3573
|
plugin.command("update [plugin]").description("Update one or all installed plugins").action(async (name) => {
|
|
3580
|
-
const { handler } = await import("./chunks/update-
|
|
3574
|
+
const { handler } = await import("./chunks/update-KSC6VRMU.js");
|
|
3581
3575
|
await handler({ name, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3582
3576
|
});
|
|
3583
3577
|
plugin.command("enable <plugin>").description("Add a plugin to this project's enabled list").action(async (name) => {
|
|
3584
|
-
const { handler } = await import("./chunks/enable-
|
|
3578
|
+
const { handler } = await import("./chunks/enable-ZL6QOC2I.js");
|
|
3585
3579
|
await handler({ name, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3586
3580
|
});
|
|
3587
3581
|
plugin.command("disable <plugin>").description("Remove a plugin from this project's enabled list").action(async (name) => {
|
|
3588
|
-
const { handler } = await import("./chunks/disable-
|
|
3582
|
+
const { handler } = await import("./chunks/disable-FGJ7VMPO.js");
|
|
3589
3583
|
await handler({ name, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3590
3584
|
});
|
|
3591
3585
|
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) => {
|
|
3592
|
-
const { handler } = await import("./chunks/create-
|
|
3586
|
+
const { handler } = await import("./chunks/create-L6DJN4ME.js");
|
|
3593
3587
|
await handler({ name, description: opts.description, author: opts.author, license: opts.license, out: opts.out, yes: !!program3.opts().yes, projectRoot: projectRoot() });
|
|
3594
3588
|
});
|
|
3595
3589
|
const template = program3.command("template").description("Manage rune templates");
|
|
3596
3590
|
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) => {
|
|
3597
|
-
const { handler } = await import("./chunks/list-
|
|
3591
|
+
const { handler } = await import("./chunks/list-2JYMBMZC.js");
|
|
3598
3592
|
await handler({ source, format: opts.format, plain: !!program3.opts().plain, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3599
3593
|
});
|
|
3600
3594
|
template.command("apply <template>").description("Copy a template into the project as a new rune and register it in config.").addHelpText(
|
|
3601
3595
|
"after",
|
|
3602
3596
|
"\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"
|
|
3603
3597
|
).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) => {
|
|
3604
|
-
const { handler } = await import("./chunks/apply-
|
|
3598
|
+
const { handler } = await import("./chunks/apply-J4YICV6H.js");
|
|
3605
3599
|
await handler({ ref, key: opts.as, path: opts.path, name: opts.name, description: opts.description, yes: !!program3.opts().yes, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3606
3600
|
});
|
|
3607
3601
|
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) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@darkrymit/crunes-cli",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.5",
|
|
4
4
|
"description": "CLI tool for querying crunes enrichers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"test": "vitest run"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
+
"comment-json": "^5.0.0",
|
|
18
19
|
"esbuild": "^0.28.0",
|
|
19
20
|
"isolated-vm": "^6.1.2"
|
|
20
21
|
},
|
|
@@ -24,11 +25,11 @@
|
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"@clack/prompts": "^1.5.0",
|
|
26
27
|
"archiver": "^8.0.0",
|
|
28
|
+
"buffer": "^6.0.3",
|
|
27
29
|
"chalk": "^5.6.2",
|
|
28
30
|
"chokidar": "^5.0.0",
|
|
29
31
|
"cli-table3": "^0.6.5",
|
|
30
32
|
"commander": "^15.0.0",
|
|
31
|
-
"comment-json": "^5.0.0",
|
|
32
33
|
"csv-parse": "^7.0.0",
|
|
33
34
|
"csv-stringify": "^6.8.0",
|
|
34
35
|
"dotenv": "^17.4.2",
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
loadRegistry,
|
|
3
|
-
resolvePluginKey
|
|
4
|
-
} from "./chunk-65J65MAP.js";
|
|
5
|
-
import "./chunk-6MRZXASS.js";
|
|
6
|
-
import {
|
|
7
|
-
init_require_shim
|
|
8
|
-
} from "./chunk-TPK5AGRA.js";
|
|
9
|
-
|
|
10
|
-
// src/plugin/commands/disable.js
|
|
11
|
-
init_require_shim();
|
|
12
|
-
import fs from "node:fs/promises";
|
|
13
|
-
import path from "node:path";
|
|
14
|
-
async function handler({ name, projectRoot, configRoot }) {
|
|
15
|
-
try {
|
|
16
|
-
const registry = await loadRegistry();
|
|
17
|
-
const pluginKey = resolvePluginKey(name, registry);
|
|
18
|
-
if (!pluginKey) throw new Error(`Plugin "${name}" is not installed. Run: crunes plugin list`);
|
|
19
|
-
await setProjectPluginEnabled(configRoot ?? projectRoot, pluginKey, false);
|
|
20
|
-
console.log(`Plugin "${pluginKey}" disabled.`);
|
|
21
|
-
} catch (err) {
|
|
22
|
-
console.error(`Error: ${err.message}`);
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
async function setProjectPluginEnabled(configRoot, pluginKey, enabled) {
|
|
27
|
-
const configPath = path.join(configRoot, ".crunes", "config.json");
|
|
28
|
-
let config;
|
|
29
|
-
try {
|
|
30
|
-
config = JSON.parse(await fs.readFile(configPath, "utf8"));
|
|
31
|
-
} catch (err) {
|
|
32
|
-
if (err.code === "ENOENT") throw new Error("No .crunes/config.json found. Run: crunes init");
|
|
33
|
-
throw err;
|
|
34
|
-
}
|
|
35
|
-
const plugins = config.plugins ?? [];
|
|
36
|
-
if (enabled && !plugins.includes(pluginKey)) {
|
|
37
|
-
config.plugins = [...plugins, pluginKey];
|
|
38
|
-
} else if (!enabled) {
|
|
39
|
-
config.plugins = plugins.filter((p) => p !== pluginKey);
|
|
40
|
-
}
|
|
41
|
-
const tmp = configPath + ".tmp";
|
|
42
|
-
await fs.writeFile(tmp, JSON.stringify(config, null, 2), "utf8");
|
|
43
|
-
await fs.rename(tmp, configPath);
|
|
44
|
-
}
|
|
45
|
-
export {
|
|
46
|
-
handler
|
|
47
|
-
};
|