@nexusbloom/cli 0.9.4 → 0.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexusbloom/cli",
3
- "version": "0.9.4",
3
+ "version": "0.9.5",
4
4
  "description": "NexusBloom CLI — run tools and workflows from your terminal",
5
5
  "type": "module",
6
6
  "bin": {
package/src/abbr.js CHANGED
@@ -1,13 +1,7 @@
1
1
  /**
2
2
  * abbr.js — `nxb abbr` command.
3
3
  *
4
- * Paginated abbreviation view.
5
- *
6
- * nxb abbr — interactive pagination (20/page)
7
- * nxb abbr ip — filter by query (matches slug, abbr, or name)
8
- * nxb abbr -s ip — same, explicit flag
9
- * nxb abbr --json — raw JSON
10
- * nxb abbr --no-interactive— single dump
4
+ * Paginated abbreviation view. Flags are declared in index.js.
11
5
  */
12
6
 
13
7
  import chalk from "chalk";
package/src/index.js CHANGED
@@ -1,27 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /**
4
- * NexusBloom CLI (nxb)
4
+ * NexusBloom CLI (nxb) — command wiring.
5
5
  *
6
- * Usage:
7
- * nxb list — List available tools (interactive pagination)
8
- * nxb list -s <query> — Filter + paginate
9
- * nxb search <query> — Search tools
10
- * nxb run <slug> [args...] — Execute a tool (remote API)
11
- * nxb run <slug> --input '{}' — Execute with inline JSON input
12
- * nxb run <slug> --file input.json — Execute with file input
13
- * nxb run <slug> --local — Execute coreLogic locally (cached)
14
- * nxb run — Interactive: select tool → pick inputs → auto-build command
15
- * nxb run -s <query> — Filter the tool picker (non-TTY: print the list)
16
- * nxb info <slug> — Show tool schema
17
- * nxb abbr [-s <query>] — Show tool abbreviations (paginated)
18
- * nxb transform <slug> — Pipe stdin through a tool
19
- * nxb config set <key> [value] — Set config (interactive if value omitted)
20
- * nxb config get [key] — Get config (secrets redacted)
21
- * nxb cache clear — Clear local tool cache
22
- * nxb cache list — List cached tools
23
- * nxb cache path — Print where config/cache live
24
- * nxb json --template <slug> — Create JSON input for tools
6
+ * Commands are declared with commander below, and `--help` is generated from
7
+ * those declarations. A hand-maintained usage list in this header was always
8
+ * going to drift from the code, so there isn't one; README.md carries the
9
+ * task-oriented examples.
25
10
  */
26
11
 
27
12
  import { program } from "commander";
package/src/list.js CHANGED
@@ -1,12 +1,9 @@
1
1
  /**
2
2
  * list.js — `nxb list` command.
3
3
  *
4
- * Paginated tool listing. Long lists are always paired with a search option.
5
- *
6
- * nxb list — interactive pagination (20/page)
7
- * nxb list -s ssl — filter + paginate
8
- * nxb list --json — raw JSON
9
- * nxb list --no-interactive — single dump
4
+ * Paginated tool listing. Long lists are always paired with a search option;
5
+ * `--json` and the other flags are declared in index.js, which is also where
6
+ * `--help` reads them from.
10
7
  */
11
8
 
12
9
  import chalk from "chalk";
package/src/run.js CHANGED
@@ -2,11 +2,11 @@
2
2
  * run.js — `nxb run` command.
3
3
  *
4
4
  * Two modes:
5
- * 1. Direct: nxb run <slug> [key=value ...] [--input json] [--file path] [--local]
6
- * 2. Interactive: nxb run (no slug) → select tool → pick inputs → auto-build & execute
5
+ * 1. Direct: nxb run <slug> [key=value ...] [--input json] [--file path] [--local]
6
+ * 2. Interactive: nxb run → select tool → pick inputs → auto-build & execute
7
7
  *
8
- * Imports execution logic from the original monolithic index.js but adds
9
- * inquirer-driven field prompting for the interactive path.
8
+ * The interactive path is only entered when no slug and no input were supplied,
9
+ * otherwise a scripted call would block on a prompt it never sees.
10
10
  */
11
11
 
12
12
  import fs from "fs";
package/src/tools.js CHANGED
@@ -1,29 +1,16 @@
1
1
  /**
2
- * tools.js — Centralised tool catalogue for the nxb CLI.
2
+ * tools.js — Tool catalogue resolution and config access.
3
3
  *
4
4
  * Resolution order for the *tool list*:
5
- * 1. Cached snapshot (`.cache/tools-list.json`) — always written on a
6
- * successful fetch so subsequent `list` / `abbr` calls are offline-fast.
7
- * 2. Live API (`/api/tools`)
5
+ * 1. Cached snapshot (`$XDG_CACHE_HOME/nexusbloom/tools-list.json`) — written
6
+ * on every successful fetch, so `list` / `abbr` stay fast and work offline
7
+ * 2. Live API (`/api/tools`)
8
8
  * 3. Supabase fallback (`/rest/v1/tools` + `/rest/v1/community_tools`)
9
- * 4. Local filesystem scan (`src/tools/<slug>/v2.js`)
9
+ * 4. Local filesystem scan — see `LOCAL_TOOL_DIRS` for the search roots
10
10
  *
11
- * Resolution order for a *single tool's source* (for `--local` execution):
12
- * 1. Local filesystem → 2. cache (`tools/<slug>.json`) → 3. API/Supabase
13
- *
14
- * Exports:
15
- * loadConfig / saveConfig / configGet / configSet / redactedConfig
16
- * fetchTools() — resolves list (cache-first on network failure)
17
- * refreshTools() — force a fresh fetch + persist to cache
18
- * fetchToolSource(slug) — { manifest, coreLogicSource }
19
- * filterTools / rankTools — shared search used by list / search / abbr / run
20
- * isValidSlug / normalizeSlug
21
- * scanLocalTools()
22
- * findLocalTool(slug)
23
- * generateAbbreviations(slugs)
24
- * resolveToolSlug(slug, tools?)
25
- * getSupabaseKey / getSupabaseUrl / supabaseHeaders
26
- * API_BASE
11
+ * Resolution order for a *single tool's source* (for `--local` execution) is
12
+ * the mirror image: local filesystem, then cache, then API/Supabase. Local wins
13
+ * because a developer running `--local` is iterating on that file right now.
27
14
  */
28
15
 
29
16
  import fs from "fs";
@@ -446,7 +433,6 @@ export async function fetchToolSource(rawSlug) {
446
433
  const source = fs.readFileSync(localPath, "utf-8");
447
434
  const manifest = extractManifest(source, { trusted: true });
448
435
  if (manifest) {
449
- // Refresh cache from local source
450
436
  fs.writeFileSync(cacheFile, JSON.stringify({ manifest, coreLogicSource: source, cachedAt: new Date().toISOString() }), "utf-8");
451
437
  return { manifest, coreLogicSource: source, source: "local" };
452
438
  }