@bike4mind/cli 4.0.0 → 4.6.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 (51) hide show
  1. package/README.md +86 -4
  2. package/bin/bike4mind-cli.mjs +249 -40
  3. package/bin/envFlags.d.mts +17 -0
  4. package/bin/envFlags.mjs +89 -0
  5. package/dist/{AgentHistoryStore-DgqmcVLN.mjs → AgentHistoryStore--J3sgO_-.mjs} +3794 -1368
  6. package/dist/{ApiClient-_JrM_xWw.mjs → ApiClient-CdO4Gamg.mjs} +22 -3
  7. package/dist/BubblewrapRuntime-3jAbC60G.mjs +157 -0
  8. package/dist/ConfigStore-CausUCzY.mjs +2 -0
  9. package/dist/ConfigStore-Dusy6glb.mjs +3364 -0
  10. package/dist/{ConfigStore-BwqsQ0U9.mjs → Logger-C1Wj6xla.mjs} +32672 -21643
  11. package/dist/{ProxyManager-B0-RuR2w.mjs → ProxyManager-TxEKlgdO.mjs} +88 -3
  12. package/dist/{SandboxOrchestrator-BcUv9fQ3.mjs → SandboxOrchestrator-CQwYq_uy.mjs} +26 -7
  13. package/dist/SandboxRuntimeAdapter-BsT2iLky.mjs +190 -0
  14. package/dist/SandboxRuntimeAdapter-Zg_0th7V.mjs +2 -0
  15. package/dist/SeatbeltRuntime-C2DEkrjy.mjs +194 -0
  16. package/dist/{WorkItemsClient-CERTDrhT.mjs → WorkItemsClient-CxNZaOmc.mjs} +1 -1
  17. package/dist/agents/defaults/review.md +8 -1
  18. package/dist/agents/defaults/test.md +8 -1
  19. package/dist/buildToolSearch-DOb7mx6F.mjs +417 -0
  20. package/dist/commands/acpCommand.mjs +25 -19
  21. package/dist/commands/apiCommand.mjs +3 -5
  22. package/dist/commands/doctorCommand.mjs +2 -2
  23. package/dist/commands/envCommand.mjs +1 -1
  24. package/dist/commands/headlessCommand.mjs +117 -36
  25. package/dist/commands/hostCommand.mjs +2344 -0
  26. package/dist/commands/mcpCommand.mjs +45 -30
  27. package/dist/commands/mirrorCommand.mjs +279 -0
  28. package/dist/commands/modelsCommand.mjs +1117 -0
  29. package/dist/commands/pluginCommand.mjs +9 -9
  30. package/dist/commands/skillsCommand.mjs +174 -29
  31. package/dist/commands/updateCommand.mjs +2 -2
  32. package/dist/curated-build.json +1 -0
  33. package/dist/dist-CbViwiS9.mjs +4739 -0
  34. package/dist/dist-Citbv0y0.mjs +7864 -0
  35. package/dist/fit-CVWDiavv.mjs +200 -0
  36. package/dist/index.mjs +853 -417
  37. package/dist/modelHub-BSB6qRFP.mjs +1963 -0
  38. package/dist/modelServers-BaegigV-.mjs +2465 -0
  39. package/dist/{package-CQaam4Dq.mjs → package-C9pfAdGF.mjs} +1 -1
  40. package/dist/{serve-CFxUhjml.mjs → serve-8wyGb8of.mjs} +595 -26
  41. package/dist/types-BFIvwByC.mjs +2 -0
  42. package/dist/{types-F61_hxmG.mjs → types-CxrzVXel.mjs} +9 -5
  43. package/dist/{updateChecker-CCLVVdH0.mjs → updateChecker-BAKb8KWP.mjs} +7 -29
  44. package/package.json +16 -13
  45. package/dist/BubblewrapRuntime-5bLPTwEC.mjs +0 -72
  46. package/dist/SandboxRuntimeAdapter-BgLUVTJL.mjs +0 -57
  47. package/dist/SandboxRuntimeAdapter-Bt1wPpld.mjs +0 -2
  48. package/dist/SeatbeltRuntime-C_Y8q8Mr.mjs +0 -124
  49. package/dist/buildToolSearch-D9GEK91u.mjs +0 -2351
  50. package/dist/dist-Ul2qwn5x.mjs +0 -624
  51. package/dist/types-I45lMh7Q.mjs +0 -2
@@ -0,0 +1,89 @@
1
+ // API environment flags (--dev / --prod), split out of argv before yargs parses it.
2
+ // They're accepted with either a single or double dash (e.g. `b4m -prod` and
3
+ // `b4m --prod` both work), but single-dash multi-char tokens would otherwise be
4
+ // split into clustered short flags by yargs (`-prod` -> `-p -r -o -d`, colliding
5
+ // with -p/--prompt), so they are removed here and recorded as the target.
6
+ export const ENV_FLAG_MAP = {
7
+ '--dev': 'dev',
8
+ '-dev': 'dev',
9
+ '--local': 'dev',
10
+ '-local': 'dev',
11
+ '--prod': 'prod',
12
+ '-prod': 'prod',
13
+ '--production': 'prod',
14
+ '-production': 'prod',
15
+ };
16
+
17
+ const LOCAL_TOKENS = new Set(['--local', '-local']);
18
+
19
+ // Top-level options that take the next token as their value, so that token is not a positional
20
+ // (`b4m --ollama-host <url> mcp serve --local`). Array options take every following non-flag token,
21
+ // as yargs parses them. Must stay in sync with the global options in bike4mind-cli.mjs;
22
+ // envFlags.test.ts checks it.
23
+ export const VALUE_OPTIONS = new Set([
24
+ '--prompt',
25
+ '-p',
26
+ '--output-format',
27
+ '--permission-policy',
28
+ '--ollama-host',
29
+ '--mcp-config',
30
+ '--append-system-prompt',
31
+ '--settings',
32
+ '--session-id',
33
+ '--resume',
34
+ '--api-url',
35
+ ]);
36
+ export const ARRAY_OPTIONS = new Set(['--add-dir', '--allowedTools', '--allowed-tools']);
37
+
38
+ function positionalIndexes(args) {
39
+ const positionals = [];
40
+ let takesNext = false;
41
+ let inArray = false;
42
+ args.forEach((token, index) => {
43
+ if (takesNext) {
44
+ takesNext = false;
45
+ } else if (Object.prototype.hasOwnProperty.call(ENV_FLAG_MAP, token)) {
46
+ // Stripped before yargs sees argv, so it neither ends an array option nor is a positional.
47
+ } else if (token.startsWith('-')) {
48
+ takesNext = VALUE_OPTIONS.has(token);
49
+ inArray = ARRAY_OPTIONS.has(token);
50
+ } else if (!inArray) {
51
+ positionals.push(index);
52
+ }
53
+ });
54
+ return positionals;
55
+ }
56
+
57
+ /**
58
+ * Split the environment flags out of `args` (argv without node and the script).
59
+ *
60
+ * `mcpServe` is true when `mcp` is the first positional and `serve` the next one. Only then, and only
61
+ * after `serve`, is `--local` serve's own flag (local model tools only), kept as `--local` and reported
62
+ * as `serveLocal`; everywhere else it is the --dev alias. `envFlags` lists the env tokens removed.
63
+ */
64
+ export function splitEnvFlags(args) {
65
+ const positionals = positionalIndexes(args);
66
+ const mcpServe = args[positionals[0]] === 'mcp' && args[positionals[1]] === 'serve';
67
+ const serveIndex = mcpServe ? positionals[1] : Infinity;
68
+
69
+ const cleaned = [];
70
+ const envFlags = [];
71
+ let envTarget = null;
72
+ let serveLocal = false;
73
+ args.forEach((token, index) => {
74
+ if (index > serveIndex && LOCAL_TOKENS.has(token)) {
75
+ cleaned.push('--local');
76
+ serveLocal = true;
77
+ } else if (index > serveIndex && /^--?local=/.test(token)) {
78
+ const value = token.slice(token.indexOf('=') + 1);
79
+ cleaned.push(`--local=${value}`);
80
+ serveLocal = value !== 'false';
81
+ } else if (Object.prototype.hasOwnProperty.call(ENV_FLAG_MAP, token)) {
82
+ envTarget = ENV_FLAG_MAP[token]; // last one wins
83
+ envFlags.push(token);
84
+ } else {
85
+ cleaned.push(token);
86
+ }
87
+ });
88
+ return { cleaned, envTarget, envFlags, mcpServe, serveLocal };
89
+ }