@bike4mind/cli 0.9.2 → 0.10.0

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.
Files changed (41) hide show
  1. package/README.md +13 -3
  2. package/bin/bike4mind-cli.mjs +44 -1
  3. package/dist/{BubblewrapRuntime-CUD3bsgG.mjs → BubblewrapRuntime-CkL9-gnG.mjs} +1 -1
  4. package/dist/{ConfigStore-CAKSUXCi.mjs → ConfigStore-DPWN3-0c.mjs} +1948 -1186
  5. package/dist/ProxyManager-ByuAHFMq.mjs +3 -0
  6. package/dist/{SandboxOrchestrator-C4oDqltp.mjs → SandboxOrchestrator-BS6gALNq.mjs} +1 -1
  7. package/dist/{SandboxOrchestrator-B4GcZdBc.mjs → SandboxOrchestrator-BoINxbX4.mjs} +1 -1
  8. package/dist/{SandboxRuntimeAdapter-DXa3nFOw.mjs → SandboxRuntimeAdapter-CKelGICD.mjs} +1 -1
  9. package/dist/{SandboxRuntimeAdapter-D1RUReNL.mjs → SandboxRuntimeAdapter-ChGlxSGQ.mjs} +2 -2
  10. package/dist/{SeatbeltRuntime-CTElMR9Q.mjs → SeatbeltRuntime-Qqt19cAN.mjs} +1 -1
  11. package/dist/{bashExecute-pYljpfPn-BZXHMQEl.mjs → bashExecute-B1N1lMOS-TZVDbcQ4.mjs} +1 -1
  12. package/dist/commands/apiCommand.mjs +45 -0
  13. package/dist/commands/doctorCommand.mjs +2 -2
  14. package/dist/commands/headlessCommand.mjs +6 -6
  15. package/dist/commands/mcpCommand.mjs +1 -1
  16. package/dist/commands/updateCommand.mjs +2 -2
  17. package/dist/{createFile-C1JoeuYh-metInFKd.mjs → createFile-DPv180yF-BnWFIxey.mjs} +2 -2
  18. package/dist/{deleteFile-BTberNGj-CW922hRM.mjs → deleteFile-BdjUwUQF-B3XOJmg3.mjs} +2 -2
  19. package/dist/{globFiles-Bez8QCbS-DZb6McbJ.mjs → globFiles-DjfDGaUK-CNR8pMRC.mjs} +2 -2
  20. package/dist/{grepSearch-BxucZWO8-lPRv6R6F.mjs → grepSearch-DJs-cubo-Bm0Y8oS3.mjs} +2 -2
  21. package/dist/index.mjs +19 -18
  22. package/dist/{pathValidation-CIytuhr3-Dt5dntLx.mjs → pathValidation-D8tjkQXE-1HwvsuYT.mjs} +1 -1
  23. package/dist/store-DgzCTRkN.mjs +3 -0
  24. package/dist/{tools-AWSBVqG5.mjs → tools-_X4rUM4L.mjs} +14941 -3277
  25. package/dist/types-CqscS34o.mjs +3 -0
  26. package/dist/{updateChecker-Bml_XTCM.mjs → updateChecker-C3DYG0Gn.mjs} +1 -1
  27. package/dist/utils-BGtSXfce.mjs +3 -0
  28. package/dist/utils-PpNti-tY.mjs +146 -0
  29. package/package.json +32 -32
  30. package/dist/ProxyManager-DIAAw902.mjs +0 -3
  31. package/dist/store-YhSkjsW4.mjs +0 -3
  32. package/dist/types-DK3P88Px.mjs +0 -3
  33. /package/dist/{ImageStore-BFp_d12J.mjs → ImageStore-BVmEG1xc.mjs} +0 -0
  34. /package/dist/{ProxyManager-BsCoxpns.mjs → ProxyManager-CV94yZUW.mjs} +0 -0
  35. /package/dist/{StderrViolationParser-BFP4bo7I.mjs → StderrViolationParser-CS43a-TP.mjs} +0 -0
  36. /package/dist/{ViolationLogStore-Dp6HF0nz.mjs → ViolationLogStore-B-plqJfn.mjs} +0 -0
  37. /package/dist/{ripgrepCheck-DIu4apVE.mjs → ripgrepCheck-BmkyTK2i.mjs} +0 -0
  38. /package/dist/{store-DLduYYGR.mjs → store-DV5s-qni.mjs} +0 -0
  39. /package/dist/{terminalSetup-DxloCowq.mjs → terminalSetup-BbJt04ZG.mjs} +0 -0
  40. /package/dist/{treeSitterEngine-Cw2LbVZT.mjs → treeSitterEngine-BRbQ9b7I.mjs} +0 -0
  41. /package/dist/{types-DBEjF9YS.mjs → types-LyRNHOiS.mjs} +0 -0
package/README.md CHANGED
@@ -386,6 +386,11 @@ tail -f ~/.bike4mind/debug/[session-id].txt
386
386
 
387
387
  This section covers the contributor workflow for hacking on the CLI from a checkout of the monorepo. For end-user installation see [Installation](#installation) above.
388
388
 
389
+ ### Prerequisites
390
+
391
+ - **Node.js 24+** and **pnpm 10+** — the repo's `engines` field requires these versions. If you use [corepack](https://nodejs.org/api/corepack.html) (bundled with Node), run `corepack enable` from the repo root and it will activate the exact pnpm version pinned in the root `package.json`.
392
+ - Native-module build tools (Python 3 + a C++ compiler) for `better-sqlite3` and `sharp` — see [Build Requirements](#build-requirements) above.
393
+
389
394
  ### How the bin resolves source vs. built code
390
395
 
391
396
  `apps/cli/bin/bike4mind-cli.mjs` auto-detects which mode to run in:
@@ -406,16 +411,21 @@ pnpm install
406
411
  # 2. Build the @bike4mind/* core packages so the CLI can import their dist/ outputs
407
412
  pnpm turbo:core:build
408
413
 
409
- # 3. Make the `b4m` and `bike4mind` commands point at this checkout
414
+ # 3. Ensure pnpm has a global bin directory (once per machine). Without this,
415
+ # `pnpm link --global` fails with ERR_PNPM_NO_GLOBAL_BIN_DIR. `pnpm setup`
416
+ # appends PNPM_HOME to your shell profile — open a new shell afterward.
417
+ pnpm setup
418
+
419
+ # 4. Make the `b4m` and `bike4mind` commands point at this checkout
410
420
  cd apps/cli
411
421
  pnpm link --global
412
422
 
413
- # 4. Verify
423
+ # 5. Verify
414
424
  which b4m
415
425
  b4m --version
416
426
  ```
417
427
 
418
- After step 3, running `b4m` anywhere on your system executes this working tree. Re-run `pnpm link --global` if you move or rename the repo.
428
+ After step 4, running `b4m` anywhere on your system executes this working tree. Re-run `pnpm link --global` if you move or rename the repo.
419
429
 
420
430
  ### Editing CLI source (`apps/cli/src/`)
421
431
 
@@ -28,6 +28,11 @@ const __filename = fileURLToPath(import.meta.url);
28
28
  const __dirname = dirname(__filename);
29
29
  const require = createRequire(import.meta.url);
30
30
 
31
+ // Read our own package.json so `--version` reports the CLI's version.
32
+ // Without an explicit argument, yargs .version() resolves the version from
33
+ // whichever package.json it discovers first, which is not necessarily ours.
34
+ const { version: cliVersion } = require('../package.json');
35
+
31
36
  // Parse CLI arguments
32
37
  const argv = await yargs(hideBin(process.argv))
33
38
  .option('verbose', {
@@ -71,6 +76,15 @@ const argv = await yargs(hideBin(process.argv))
71
76
  type: 'string',
72
77
  description: 'Add local Ollama models to the model picker (e.g. http://localhost:11434)',
73
78
  })
79
+ .option('api-url', {
80
+ type: 'string',
81
+ description: 'Set a custom API URL (self-hosted instance) and clear auth tokens, then exit',
82
+ })
83
+ .option('reset-api', {
84
+ type: 'boolean',
85
+ description: 'Reset the API URL to the Bike4Mind default and clear auth tokens, then exit',
86
+ default: false,
87
+ })
74
88
  .command('mcp', 'Manage MCP (Model Context Protocol) servers', (yargs) => {
75
89
  return yargs
76
90
  .command('list', 'List configured MCP servers', {}, async () => {
@@ -117,7 +131,7 @@ const argv = await yargs(hideBin(process.argv))
117
131
  .command('doctor', 'Run diagnostic checks on CLI installation')
118
132
  .help()
119
133
  .alias('help', 'h')
120
- .version()
134
+ .version(cliVersion)
121
135
  .alias('version', 'V')
122
136
  .parse();
123
137
 
@@ -161,6 +175,35 @@ const hasDist = existsSync(distPath);
161
175
  const isDev = process.env.NODE_ENV === 'development' ||
162
176
  (!hasDist && hasSource);
163
177
 
178
+ // Handle --api-url / --reset-api flags
179
+ // These mutate ~/.bike4mind/config.json and exit before any auth flow runs,
180
+ // so devs can recover from a misconfigured customUrl without editing JSON.
181
+ if (argv['reset-api'] || argv['api-url'] !== undefined) {
182
+ try {
183
+ let handleApiCommand;
184
+
185
+ if (isDev) {
186
+ const { register } = require('tsx/esm/api');
187
+ register();
188
+ const module = await import('../src/commands/apiCommand.ts');
189
+ handleApiCommand = module.handleApiCommand;
190
+ } else {
191
+ const module = await import('../dist/commands/apiCommand.mjs');
192
+ handleApiCommand = module.handleApiCommand;
193
+ }
194
+
195
+ if (argv['reset-api']) {
196
+ await handleApiCommand({ mode: 'reset' });
197
+ } else {
198
+ await handleApiCommand({ mode: 'set', url: argv['api-url'] });
199
+ }
200
+ process.exit(0);
201
+ } catch (error) {
202
+ console.error('Error:', error.message);
203
+ process.exit(1);
204
+ }
205
+ }
206
+
164
207
  // Handle headless mode (-p / --prompt flag)
165
208
  // Must be done after isDev detection to use correct import path
166
209
  if (argv.prompt !== undefined) {
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { i as isBinaryAvailable, r as expandPath } from "./SandboxRuntimeAdapter-D1RUReNL.mjs";
2
+ import { i as isBinaryAvailable, r as expandPath } from "./SandboxRuntimeAdapter-ChGlxSGQ.mjs";
3
3
  import os from "os";
4
4
  //#region src/sandbox/runtime/BubblewrapRuntime.ts
5
5
  /**