@darkrymit/crunes-cli 0.11.0 → 0.11.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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  addMarketplace
3
- } from "./chunk-YVN3VDRE.js";
3
+ } from "./chunk-GG7WMHV2.js";
4
4
  import "./chunk-2Q3KLBE6.js";
5
5
  import {
6
6
  init_require_shim
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  searchMarketplaces
3
- } from "./chunk-YVN3VDRE.js";
3
+ } from "./chunk-GG7WMHV2.js";
4
4
  import "./chunk-2Q3KLBE6.js";
5
5
  import {
6
6
  init_require_shim
@@ -222,9 +222,10 @@ function classifySource(source) {
222
222
  if (source.startsWith("https://") || source.startsWith("git+")) {
223
223
  return { type: "git", resolved: source };
224
224
  }
225
- if (/^[\w-]+\/[\w.-]+$/.test(source) || source.startsWith("github:")) {
226
- const repo = source.replace(/^github:/, "");
227
- return { type: "github", resolved: `https://github.com/${repo}` };
225
+ const [baseSource, subpath] = source.split("#");
226
+ if (/^[\w-]+\/[\w.-]+$/.test(baseSource) || baseSource.startsWith("github:")) {
227
+ const repo = baseSource.replace(/^github:/, "");
228
+ return { type: "github", resolved: `https://github.com/${repo}`, ...subpath && { subpath } };
228
229
  }
229
230
  return { type: "npm", resolved: source };
230
231
  }
@@ -261,17 +262,21 @@ async function installPlugin(source, projectDir, provenance = {}, options = {})
261
262
  throw new Error("Direct installs are not allowed. Use: crunes plugin install <marketplace>@<plugin>");
262
263
  }
263
264
  await ensureStoreDirs();
264
- const { type, resolved } = classifySource(source);
265
+ const { type, resolved, subpath } = classifySource(source);
266
+ let tempRoot = null;
265
267
  let stagingDir;
266
268
  if (type === "local") {
267
269
  stagingDir = path2.resolve(resolved);
268
270
  } else {
269
- stagingDir = path2.join(os.tmpdir(), `crunes-install-${Date.now()}`);
270
- await fs2.mkdir(stagingDir, { recursive: true });
271
+ tempRoot = path2.join(os.tmpdir(), `crunes-install-${Date.now()}`);
272
+ await fs2.mkdir(tempRoot, { recursive: true });
273
+ stagingDir = tempRoot;
271
274
  }
272
275
  try {
273
- if (type === "github") await downloadGitHub(resolved, stagingDir);
274
- else if (type === "git") await downloadGit(resolved, stagingDir);
276
+ if (type === "github") {
277
+ await downloadGitHub(resolved, tempRoot);
278
+ if (subpath) stagingDir = path2.join(tempRoot, subpath);
279
+ } else if (type === "git") await downloadGit(resolved, stagingDir);
275
280
  else if (type === "npm") await downloadNpm(resolved, stagingDir);
276
281
  const pluginJson = await loadPluginJson(stagingDir);
277
282
  const name = provenance.pluginName;
@@ -306,8 +311,8 @@ async function installPlugin(source, projectDir, provenance = {}, options = {})
306
311
  await setEnabled(projectDir, pluginKey, true, global);
307
312
  return { installed: true, name: pluginKey, version };
308
313
  } finally {
309
- if (type !== "local") {
310
- await fs2.rm(stagingDir, { recursive: true, force: true }).catch(() => {
314
+ if (tempRoot) {
315
+ await fs2.rm(tempRoot, { recursive: true, force: true }).catch(() => {
311
316
  });
312
317
  }
313
318
  }
@@ -102,7 +102,8 @@ async function fetchMarketplace(name, entry) {
102
102
  const cacheDir = getMarketplaceCacheDir(name);
103
103
  try {
104
104
  const data = JSON.parse(await fs.readFile(path.join(cacheDir, "marketplace.json"), "utf8"));
105
- return { data, resolvedPath: cacheDir };
105
+ const resolvedPath = classified.type === "github" ? `github:${classified.resolved}` : cacheDir;
106
+ return { data, resolvedPath };
106
107
  } catch (err) {
107
108
  if (err.code === "ENOENT") throw new Error(`Marketplace "${name}" not cached. Run: crunes marketplace update ${name}`);
108
109
  throw err;
@@ -209,6 +210,10 @@ async function resolveFromMarketplace(marketplaceName, pluginName) {
209
210
  }
210
211
  function resolvePluginSource(source, marketplaceResolvedPath) {
211
212
  if (!isLocalPath(source)) return source;
213
+ if (marketplaceResolvedPath.startsWith("github:")) {
214
+ const subpath = source.replace(/^\.?[\\/]+/, "").replace(/\\/g, "/");
215
+ return subpath ? `${marketplaceResolvedPath}#${subpath}` : marketplaceResolvedPath;
216
+ }
212
217
  if (marketplaceResolvedPath.startsWith("http://") || marketplaceResolvedPath.startsWith("https://")) {
213
218
  return new URL(source, marketplaceResolvedPath).href;
214
219
  }
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  resolveFromMarketplace
3
- } from "./chunk-YVN3VDRE.js";
3
+ } from "./chunk-GG7WMHV2.js";
4
4
  import {
5
5
  installPlugin
6
- } from "./chunk-NJVPLN5D.js";
6
+ } from "./chunk-AHRQS3S7.js";
7
7
  import "./chunk-E7CZPAM2.js";
8
8
  import {
9
9
  output
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  listMarketplaces
3
- } from "./chunk-YVN3VDRE.js";
3
+ } from "./chunk-GG7WMHV2.js";
4
4
  import "./chunk-2Q3KLBE6.js";
5
5
  import {
6
6
  init_require_shim
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  removeMarketplace
3
- } from "./chunk-YVN3VDRE.js";
3
+ } from "./chunk-GG7WMHV2.js";
4
4
  import "./chunk-2Q3KLBE6.js";
5
5
  import {
6
6
  init_require_shim
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  searchMarketplaces
3
- } from "./chunk-YVN3VDRE.js";
3
+ } from "./chunk-GG7WMHV2.js";
4
4
  import "./chunk-2Q3KLBE6.js";
5
5
  import {
6
6
  init_require_shim
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  uninstallPlugin
3
- } from "./chunk-NJVPLN5D.js";
3
+ } from "./chunk-AHRQS3S7.js";
4
4
  import "./chunk-E7CZPAM2.js";
5
5
  import {
6
6
  output
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  listMarketplaces,
3
3
  updateMarketplace
4
- } from "./chunk-YVN3VDRE.js";
4
+ } from "./chunk-GG7WMHV2.js";
5
5
  import "./chunk-2Q3KLBE6.js";
6
6
  import {
7
7
  init_require_shim
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  resolveFromMarketplace
3
- } from "./chunk-YVN3VDRE.js";
3
+ } from "./chunk-GG7WMHV2.js";
4
4
  import {
5
5
  installPlugin
6
- } from "./chunk-NJVPLN5D.js";
6
+ } from "./chunk-AHRQS3S7.js";
7
7
  import "./chunk-E7CZPAM2.js";
8
8
  import {
9
9
  output
@@ -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.11.0",
19
+ version: "0.11.1",
20
20
  description: "CLI tool for querying crunes enrichers",
21
21
  type: "module",
22
22
  bin: {
package/dist/cli.js CHANGED
@@ -3397,7 +3397,7 @@ var program = new Command();
3397
3397
  // src/cli/program.js
3398
3398
  function buildProgram() {
3399
3399
  const program3 = new Command();
3400
- program3.name("crunes").description("CLI tool for managing context runes").version("0.11.0", "-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
+ program3.name("crunes").description("CLI tool for managing context runes").version("0.11.1", "-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");
3401
3401
  program3.hook("preAction", (_thisCommand, actionCommand) => {
3402
3402
  const opts = { ...program3.opts(), ...actionCommand.opts() };
3403
3403
  configure({ plain: !!opts.plain, verbose: !!opts.verbose });
@@ -3482,7 +3482,7 @@ function buildProgram() {
3482
3482
  await handler();
3483
3483
  });
3484
3484
  program3.command("version").description("Print the installed version and check for updates").option("--no-check", "skip the npm update check").action(async (opts) => {
3485
- const { handler } = await import("./chunks/version-IDG3M56C.js");
3485
+ const { handler } = await import("./chunks/version-7QMI3NLU.js");
3486
3486
  await handler({ check: opts.check, plain: !!program3.opts().plain });
3487
3487
  });
3488
3488
  program3.command("doctor").description("Verify environment and project setup").option("-p, --plain", "plain output: no colors, no box-drawing, plain symbols \u2014 optimised for AI/pipe use").action(async () => {
@@ -3573,11 +3573,11 @@ function buildProgram() {
3573
3573
  });
3574
3574
  const plugin = program3.command("plugin").description("Manage rune plugins");
3575
3575
  plugin.command("install <source>").description("Install a plugin from a configured marketplace in the format <marketplace>@<plugin>").option("-g, --global", "enable in the global config (~/.crunes/config.json) instead of the project").action(async (source, opts) => {
3576
- const { handler } = await import("./chunks/install-3G7U5ZIO.js");
3576
+ const { handler } = await import("./chunks/install-IPMIOKVT.js");
3577
3577
  await handler({ source, projectRoot: projectRoot(), configRoot: configRoot(), yes: !!program3.opts().yes, global: !!opts.global });
3578
3578
  });
3579
3579
  plugin.command("uninstall <plugin>").description("Uninstall an installed plugin").option("-g, --global", "also drop the plugin from the global config (~/.crunes/config.json)").action(async (name, opts) => {
3580
- const { handler } = await import("./chunks/uninstall-J7JUYETA.js");
3580
+ const { handler } = await import("./chunks/uninstall-IAJFZSJE.js");
3581
3581
  await handler({ name, yes: !!program3.opts().yes, projectRoot: projectRoot(), configRoot: configRoot(), global: !!opts.global });
3582
3582
  });
3583
3583
  plugin.command("list").description("List installed plugins").addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).option("-p, --plain", "plain output: no colors, no box-drawing, plain symbols \u2014 optimised for AI/pipe use").action(async (opts) => {
@@ -3585,7 +3585,7 @@ function buildProgram() {
3585
3585
  await handler({ format: opts.format, projectRoot: projectRoot() });
3586
3586
  });
3587
3587
  plugin.command("update [plugin]").description("Update one or all installed plugins").action(async (name) => {
3588
- const { handler } = await import("./chunks/update-ZJRLDCUT.js");
3588
+ const { handler } = await import("./chunks/update-T46VHMQ6.js");
3589
3589
  await handler({ name, projectRoot: projectRoot(), configRoot: configRoot() });
3590
3590
  });
3591
3591
  plugin.command("trust <plugin> [rune]").description("Review a plugin's native runes \u2014 scripts that run outside the sandbox \u2014 and trust them to run").action(async (name, rune) => {
@@ -3622,27 +3622,27 @@ function buildProgram() {
3622
3622
  });
3623
3623
  const marketplace = program3.command("marketplace").description("Manage plugin marketplace sources");
3624
3624
  marketplace.command("add <url>").description("Add a marketplace source URL").action(async (url) => {
3625
- const { handler } = await import("./chunks/add-IT3IHBPO.js");
3625
+ const { handler } = await import("./chunks/add-WVWJDYT2.js");
3626
3626
  await handler({ url });
3627
3627
  });
3628
3628
  marketplace.command("remove <url>").description("Remove a marketplace source URL").action(async (url) => {
3629
- const { handler } = await import("./chunks/remove-BCFTF23J.js");
3629
+ const { handler } = await import("./chunks/remove-HQMV5TFN.js");
3630
3630
  await handler({ url });
3631
3631
  });
3632
3632
  marketplace.command("list").description("List configured marketplace sources").option("-p, --plain", "plain output: no colors, no box-drawing, plain symbols \u2014 optimised for AI/pipe use").action(async () => {
3633
- const { handler } = await import("./chunks/list-U4EMHQZT.js");
3633
+ const { handler } = await import("./chunks/list-LI3R43WC.js");
3634
3634
  await handler();
3635
3635
  });
3636
3636
  marketplace.command("search <query>").description("Search for plugins across configured marketplace sources").action(async (query) => {
3637
- const { handler } = await import("./chunks/search-B7IM7JRJ.js");
3637
+ const { handler } = await import("./chunks/search-TEEB4NTP.js");
3638
3638
  await handler({ query });
3639
3639
  });
3640
3640
  marketplace.command("update [url]").description("Refresh cached marketplace data (all sources if no URL given)").action(async (url) => {
3641
- const { handler } = await import("./chunks/update-WXT7CHYA.js");
3641
+ const { handler } = await import("./chunks/update-HCSCUYDY.js");
3642
3642
  await handler({ url });
3643
3643
  });
3644
3644
  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) => {
3645
- const { handler } = await import("./chunks/browse-PHMBDREQ.js");
3645
+ const { handler } = await import("./chunks/browse-CUH7Q6NG.js");
3646
3646
  await handler({ format: opts.format });
3647
3647
  });
3648
3648
  const completions = program3.command("completions").description("Manage shell tab-completions");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darkrymit/crunes-cli",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "CLI tool for querying crunes enrichers",
5
5
  "type": "module",
6
6
  "bin": {