botanary 0.5.2 → 0.6.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.
Files changed (100) hide show
  1. package/dist/botanary.js +2 -0
  2. package/package.json +8 -6
  3. package/dist/bin/botanary.js +0 -25
  4. package/dist/bin/botanary.js.map +0 -1
  5. package/dist/src/app-url.js +0 -52
  6. package/dist/src/app-url.js.map +0 -1
  7. package/dist/src/cli.js +0 -195
  8. package/dist/src/cli.js.map +0 -1
  9. package/dist/src/commands/account.js +0 -171
  10. package/dist/src/commands/account.js.map +0 -1
  11. package/dist/src/commands/agent.js +0 -338
  12. package/dist/src/commands/agent.js.map +0 -1
  13. package/dist/src/commands/authority.js +0 -634
  14. package/dist/src/commands/authority.js.map +0 -1
  15. package/dist/src/commands/mcp.js +0 -163
  16. package/dist/src/commands/mcp.js.map +0 -1
  17. package/dist/src/commands/services.js +0 -460
  18. package/dist/src/commands/services.js.map +0 -1
  19. package/dist/src/commands/session-writes.js +0 -196
  20. package/dist/src/commands/session-writes.js.map +0 -1
  21. package/dist/src/commands/sign.js +0 -311
  22. package/dist/src/commands/sign.js.map +0 -1
  23. package/dist/src/commands/system.js +0 -135
  24. package/dist/src/commands/system.js.map +0 -1
  25. package/dist/src/commands/tokens.js +0 -36
  26. package/dist/src/commands/tokens.js.map +0 -1
  27. package/dist/src/commands/utilities.js +0 -119
  28. package/dist/src/commands/utilities.js.map +0 -1
  29. package/dist/src/commands/wallet.js +0 -1013
  30. package/dist/src/commands/wallet.js.map +0 -1
  31. package/dist/src/commands/watch.js +0 -259
  32. package/dist/src/commands/watch.js.map +0 -1
  33. package/dist/src/completion.js +0 -69
  34. package/dist/src/completion.js.map +0 -1
  35. package/dist/src/config-store.js +0 -52
  36. package/dist/src/config-store.js.map +0 -1
  37. package/dist/src/context.js +0 -19
  38. package/dist/src/context.js.map +0 -1
  39. package/dist/src/errors.js +0 -116
  40. package/dist/src/errors.js.map +0 -1
  41. package/dist/src/help/examples.js +0 -904
  42. package/dist/src/help/examples.js.map +0 -1
  43. package/dist/src/help/format.js +0 -144
  44. package/dist/src/help/format.js.map +0 -1
  45. package/dist/src/help/groups.js +0 -39
  46. package/dist/src/help/groups.js.map +0 -1
  47. package/dist/src/install-method.js +0 -50
  48. package/dist/src/install-method.js.map +0 -1
  49. package/dist/src/mcp-snippets.js +0 -27
  50. package/dist/src/mcp-snippets.js.map +0 -1
  51. package/dist/src/outcome.js +0 -63
  52. package/dist/src/outcome.js.map +0 -1
  53. package/dist/src/package-version.js +0 -53
  54. package/dist/src/package-version.js.map +0 -1
  55. package/dist/src/parser.js +0 -48
  56. package/dist/src/parser.js.map +0 -1
  57. package/dist/src/progress.js +0 -56
  58. package/dist/src/progress.js.map +0 -1
  59. package/dist/src/prompt-doc.js +0 -92
  60. package/dist/src/prompt-doc.js.map +0 -1
  61. package/dist/src/render/accounts.js +0 -21
  62. package/dist/src/render/accounts.js.map +0 -1
  63. package/dist/src/render/activity.js +0 -34
  64. package/dist/src/render/activity.js.map +0 -1
  65. package/dist/src/render/agents.js +0 -42
  66. package/dist/src/render/agents.js.map +0 -1
  67. package/dist/src/render/balance.js +0 -85
  68. package/dist/src/render/balance.js.map +0 -1
  69. package/dist/src/render/banner.js +0 -17
  70. package/dist/src/render/banner.js.map +0 -1
  71. package/dist/src/render/chains.js +0 -52
  72. package/dist/src/render/chains.js.map +0 -1
  73. package/dist/src/render/colors.js +0 -50
  74. package/dist/src/render/colors.js.map +0 -1
  75. package/dist/src/render/gas.js +0 -34
  76. package/dist/src/render/gas.js.map +0 -1
  77. package/dist/src/render/grant.js +0 -34
  78. package/dist/src/render/grant.js.map +0 -1
  79. package/dist/src/render/kv.js +0 -60
  80. package/dist/src/render/kv.js.map +0 -1
  81. package/dist/src/render/mandates.js +0 -111
  82. package/dist/src/render/mandates.js.map +0 -1
  83. package/dist/src/render/print.js +0 -18
  84. package/dist/src/render/print.js.map +0 -1
  85. package/dist/src/render/redact.js +0 -23
  86. package/dist/src/render/redact.js.map +0 -1
  87. package/dist/src/render/table.js +0 -16
  88. package/dist/src/render/table.js.map +0 -1
  89. package/dist/src/repl.js +0 -232
  90. package/dist/src/repl.js.map +0 -1
  91. package/dist/src/review.js +0 -52
  92. package/dist/src/review.js.map +0 -1
  93. package/dist/src/run-installer.js +0 -30
  94. package/dist/src/run-installer.js.map +0 -1
  95. package/dist/src/settings.js +0 -88
  96. package/dist/src/settings.js.map +0 -1
  97. package/dist/src/update-check.js +0 -91
  98. package/dist/src/update-check.js.map +0 -1
  99. package/dist/src/validate.js +0 -138
  100. package/dist/src/validate.js.map +0 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "botanary",
3
3
  "type": "module",
4
- "version": "0.5.2",
4
+ "version": "0.6.1",
5
5
  "packageManager": "pnpm@11.17.0",
6
6
  "description": "Botanary from your terminal - a guided CLI over the same wallet and agent lanes botanary-mcp exposes to a coding agent.",
7
7
  "license": "UNLICENSED",
@@ -12,7 +12,7 @@
12
12
  "wallet"
13
13
  ],
14
14
  "bin": {
15
- "botanary": "dist/bin/botanary.js"
15
+ "botanary": "dist/botanary.js"
16
16
  },
17
17
  "files": [
18
18
  "dist",
@@ -22,17 +22,17 @@
22
22
  "node": ">=22.0.0"
23
23
  },
24
24
  "scripts": {
25
- "build": "rm -rf dist && tsc -p tsconfig.build.json",
26
- "prepare": "rm -rf dist && tsc -p tsconfig.build.json",
25
+ "build": "node scripts/build.mjs",
26
+ "prepare": "node scripts/build.mjs",
27
27
  "dev": "node --watch -r @swc-node/register bin/botanary.ts",
28
- "start": "node dist/bin/botanary.js",
28
+ "start": "node dist/botanary.js",
29
29
  "typecheck": "tsc -p tsconfig.json --noEmit",
30
30
  "test": "vitest run",
31
31
  "test:watch": "vitest"
32
32
  },
33
33
  "dependencies": {
34
34
  "@clack/prompts": "^0.9.1",
35
- "botanary-mcp": "^0.9.4",
35
+ "botanary-mcp": "^0.10.4",
36
36
  "cli-table3": "^0.6.5",
37
37
  "commander": "^13.1.0",
38
38
  "figlet": "^1.7.0",
@@ -43,6 +43,8 @@
43
43
  "@swc-node/register": "^1.10.9",
44
44
  "@types/figlet": "^1.7.0",
45
45
  "@types/node": "^22.10.5",
46
+ "esbuild": "0.25.12",
47
+ "javascript-obfuscator": "4.1.1",
46
48
  "typescript": "^5.7.3",
47
49
  "vitest": "^2.1.8"
48
50
  }
@@ -1,25 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createDefaultRuntime } from 'botanary-mcp';
3
- import { runCli } from '../src/cli.js';
4
- import { EXIT } from '../src/errors.js';
5
- // Read from package.json with `fs` at runtime, NOT `import('../package.json')`: that import made tsc
6
- // copy the manifest into outDir, publishing a stray nested `dist/package.json`. See the header of
7
- // src/package-version.ts.
8
- import { CLI_VERSION } from '../src/package-version.js';
9
- // Deliberately the only file in this package that is not unit tested directly - it wires the real runtime
10
- // factory into runCli and traps SIGINT, and nothing else.
11
- // @clack/prompts leaves the cursor hidden and the terminal in raw mode if a prompt is interrupted, so a
12
- // bare Ctrl-C would hand back an unusable shell. Restore both, then exit with the conventional 130.
13
- process.on('SIGINT', () => {
14
- process.stdout.write('\x1b[?25h');
15
- if (process.stdin.isTTY)
16
- process.stdin.setRawMode(false);
17
- process.stdout.write('\n');
18
- process.exit(EXIT.interrupted);
19
- });
20
- const exitCode = await runCli(process.argv.slice(2), {
21
- createRuntime: (options) => createDefaultRuntime(options),
22
- cliVersion: CLI_VERSION,
23
- });
24
- process.exit(exitCode);
25
- //# sourceMappingURL=botanary.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"botanary.js","sourceRoot":"","sources":["../../bin/botanary.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,qGAAqG;AACrG,kGAAkG;AAClG,0BAA0B;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,0GAA0G;AAC1G,0DAA0D;AAE1D,wGAAwG;AACxG,oGAAoG;AACpG,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;IACxB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAClC,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK;QAAE,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACzD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACjC,CAAC,CAAC,CAAC;AAEH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IACnD,aAAa,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,oBAAoB,CAAC,OAAO,CAAC;IACzD,UAAU,EAAE,WAAW;CACxB,CAAC,CAAC;AACH,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC"}
@@ -1,52 +0,0 @@
1
- import { invalidArgs } from './errors.js';
2
- /** Surfaces `botanary open <target>` knows about. Each is a real route in the app - see
3
- * `botanary-fe/src/app` for the current route list (`find src/app -name page.tsx` there is the source
4
- * of truth). `/delegations`, `/rules` and `/earn` retired; `/activity` permanently redirects to
5
- * `/history`, so it is never listed here on its own. */
6
- export const APP_TARGETS = [
7
- // `/mandates` now redirects to `/agents` (query string forwarded) - kept so existing scripts keep working.
8
- 'mandates',
9
- 'agents',
10
- // The Virtuals agent wallets, formerly at `/agents`; hidden from the app nav but a real route.
11
- 'agent-wallets',
12
- 'history',
13
- 'yield',
14
- 'markets',
15
- 'settings',
16
- 'grant',
17
- 'recovery',
18
- 'apis',
19
- 'copilot',
20
- 'stocks',
21
- 'marketplace',
22
- 'launchpad',
23
- ];
24
- /**
25
- * The app origin for an API base URL, by dropping a leading `api.` label: `api.app.botanary.xyz` is served
26
- * by Caddy in front of the same deployment as `app.botanary.xyz`.
27
- *
28
- * A host WITHOUT that label is returned unchanged rather than rewritten - guessing where someone's local
29
- * or staging front end lives would open the wrong page silently, and a local stack can always pass
30
- * `--api-url`.
31
- */
32
- export function appOrigin(apiBaseUrl) {
33
- try {
34
- const url = new URL(apiBaseUrl);
35
- if (url.hostname.startsWith('api.'))
36
- url.hostname = url.hostname.slice('api.'.length);
37
- return url.origin;
38
- }
39
- catch {
40
- return apiBaseUrl;
41
- }
42
- }
43
- export function appUrl(apiBaseUrl, target) {
44
- const origin = appOrigin(apiBaseUrl);
45
- if (!target)
46
- return origin;
47
- if (!APP_TARGETS.includes(target)) {
48
- throw invalidArgs(`Unknown target "${target}". Try one of: ${APP_TARGETS.join(', ')}.`, 'Run `botanary open` with no argument to open the app root.');
49
- }
50
- return `${origin}/${target}`;
51
- }
52
- //# sourceMappingURL=app-url.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app-url.js","sourceRoot":"","sources":["../../src/app-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C;;;yDAGyD;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,2GAA2G;IAC3G,UAAU;IACV,QAAQ;IACR,+FAA+F;IAC/F,eAAe;IACf,SAAS;IACT,OAAO;IACP,SAAS;IACT,UAAU;IACV,OAAO;IACP,UAAU;IACV,MAAM;IACN,SAAS;IACT,QAAQ;IACR,aAAa;IACb,WAAW;CACH,CAAC;AAEX;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CAAC,UAAkB;IAC1C,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;QAChC,IAAI,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC;YAAE,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACtF,OAAO,GAAG,CAAC,MAAM,CAAC;IACpB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,UAAU,CAAC;IACpB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,UAAkB,EAAE,MAAe;IACxD,MAAM,MAAM,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IACrC,IAAI,CAAC,MAAM;QAAE,OAAO,MAAM,CAAC;IAC3B,IAAI,CAAE,WAAiC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACzD,MAAM,WAAW,CACf,mBAAmB,MAAM,kBAAkB,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EACpE,4DAA4D,CAC7D,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAC/B,CAAC"}
package/dist/src/cli.js DELETED
@@ -1,195 +0,0 @@
1
- import { createDefaultRuntime } from 'botanary-mcp';
2
- import { CommanderError } from 'commander';
3
- import { createContext } from './context.js';
4
- import { createProgram } from './parser.js';
5
- import { registerWalletCommands } from './commands/wallet.js';
6
- import { registerSignCommands } from './commands/sign.js';
7
- import { registerTokenCommands } from './commands/tokens.js';
8
- import { registerAgentCommands } from './commands/agent.js';
9
- import { registerMcpCommands } from './commands/mcp.js';
10
- import { registerSystemCommands } from './commands/system.js';
11
- import { registerUtilityCommands } from './commands/utilities.js';
12
- import { registerAccountCommands } from './commands/account.js';
13
- import { registerWatchCommands } from './commands/watch.js';
14
- import { registerAuthorityCommands } from './commands/authority.js';
15
- import { registerSessionWriteCommands } from './commands/session-writes.js';
16
- import { registerServiceCommands } from './commands/services.js';
17
- import { runRepl } from './repl.js';
18
- import { colors, setColorEnabled } from './render/colors.js';
19
- import { readConfig } from './config-store.js';
20
- import { resolveSettings } from './settings.js';
21
- import { EXIT, CliError, errorEnvelope, errorLines, toCliError } from './errors.js';
22
- import { checkForUpdate, nagSuppressed, nagLine } from './update-check.js';
23
- import { detectInstall } from './install-method.js';
24
- /**
25
- * Wrap fetch when, and only when, a global flag asks for it. `--timeout` needs an AbortController per
26
- * request; `--debug` needs a line per request. Returns undefined otherwise so the ordinary path keeps
27
- * using the platform fetch untouched.
28
- *
29
- * The debug line carries method, path and status only. No Botanary URL carries a credential in its query
30
- * (botanary-mcp's test/no-leak.spec.ts pins that), and the bearer lives in a header this never reads.
31
- */
32
- function wrapFetch(settings, stderr) {
33
- if (settings.timeoutMs === null && !settings.debug)
34
- return undefined;
35
- return (async (input, init) => {
36
- const started = Date.now();
37
- const controller = new AbortController();
38
- const timer = settings.timeoutMs === null ? null : setTimeout(() => controller.abort(), settings.timeoutMs);
39
- try {
40
- const response = await fetch(input, { ...init, signal: controller.signal });
41
- if (settings.debug) {
42
- const url = new URL(String(input instanceof Request ? input.url : input));
43
- stderr(`[debug] ${init?.method ?? 'GET'} ${url.pathname}${url.search} ${response.status} ${Date.now() - started}ms`);
44
- }
45
- return response;
46
- }
47
- finally {
48
- if (timer)
49
- clearTimeout(timer);
50
- }
51
- });
52
- }
53
- /** Commands that already answer "is there an update" in more detail, on stdout. A nag right after either
54
- * one is either an immediate contradiction (`update` just ran the install) or pure noise (`update-check`
55
- * just printed the same fact). */
56
- const NAG_EXEMPT_COMMANDS = new Set(['update', 'update-check']);
57
- /**
58
- * A courtesy line, on stderr so it can never corrupt piped output, and only where a human can act on it.
59
- * The refresh is capped at 1.5s and runs at most once a day; every failure is silent. This must never be
60
- * able to slow down or break a command.
61
- *
62
- * `commandName` comes from the `preAction` hook rather than argv[0], so it stays correct no matter where a
63
- * global flag lands (`botanary --json update --yes`, `botanary update --yes`) and cannot be defeated by
64
- * one.
65
- */
66
- async function maybeNag(ctx, cliVersion, stderr, commandName) {
67
- if (ctx.json || ctx.quiet || !ctx.interactive || nagSuppressed(process.env))
68
- return;
69
- if (commandName !== null && NAG_EXEMPT_COMMANDS.has(commandName))
70
- return;
71
- try {
72
- const result = await checkForUpdate(cliVersion, { fetchImpl: fetch, now: () => Date.now() });
73
- if (result.newer && result.latest) {
74
- stderr(colors.dim(nagLine(result.latest, cliVersion, detectInstall(process.env))));
75
- }
76
- }
77
- catch {
78
- // Never let a courtesy check affect the command's outcome.
79
- }
80
- }
81
- export async function runCli(argv, deps) {
82
- const stderr = deps.stderr ?? ((line) => process.stderr.write(`${line}\n`));
83
- // Detect JSON mode early, before option parsing can throw, so an error envelope is always available.
84
- // Check for explicit --json flag or non-TTY stdout (piped mode auto-enables JSON).
85
- const jsonModeFromArgv = argv.includes('--json');
86
- const jsonModeFromPipe = !process.stdout.isTTY;
87
- const jsonModeEarly = jsonModeFromArgv || jsonModeFromPipe;
88
- const program = createProgram();
89
- program.version(deps.cliVersion, '-v, --version', 'Print the installed botanary CLI version');
90
- registerWalletCommands(program);
91
- registerSignCommands(program);
92
- registerTokenCommands(program);
93
- registerAgentCommands(program);
94
- registerMcpCommands(program);
95
- registerSystemCommands(program, deps.cliVersion);
96
- registerUtilityCommands(program, deps.cliVersion);
97
- // Order matters from here down: later modules (authority, session-writes, services) look up an
98
- // existing top-level Command (`account`, `agents`, `mandates`) by name to attach subcommands onto,
99
- // rather than creating a second command of the same name - see each module's own doc comment for why.
100
- registerAccountCommands(program);
101
- registerWatchCommands(program);
102
- registerAuthorityCommands(program);
103
- registerSessionWriteCommands(program);
104
- registerServiceCommands(program);
105
- program.exitOverride();
106
- // Recorded here, rather than sniffed from argv, because a global flag (`--json`, `--yes`, ...) can sit
107
- // before OR after the command name - `preAction` fires with the actual leaf command about to run,
108
- // regardless of where those flags landed.
109
- let invokedCommand = null;
110
- program.hook('preAction', (_rootCommand, actionCommand) => {
111
- invokedCommand = actionCommand.name();
112
- });
113
- let ctx = null;
114
- try {
115
- program.parseOptions(argv);
116
- const opts = program.opts();
117
- // `-V` is the hidden alias for `-v` (commander allows one short flag per option), answered before
118
- // any dispatch.
119
- if (opts.V) {
120
- process.stdout.write(`${deps.cliVersion}\n`);
121
- return EXIT.ok;
122
- }
123
- // --home must land in the environment BEFORE anything resolves a path: the config file, the identity
124
- // keystore and the session store all read botanaryMcpHome() at call time.
125
- if (typeof opts.home === 'string' && opts.home) {
126
- process.env.BOTANARY_MCP_HOME = opts.home;
127
- }
128
- // --profile, same reasoning as --home directly above: it must land in the environment before the
129
- // runtime is constructed, because `createDefaultRuntime` validates it there and the identity store
130
- // derives its keychain item names and file paths from it.
131
- //
132
- // The CLI reports no client name of its own, so an explicit profile here is a BARE agent slug -
133
- // `--profile trading` addresses `trading`, not `cli.trading`. That is deliberate: attributing an
134
- // identity to a tool that never reported itself would be inventing provenance, and the CLI's
135
- // agent lane is a way to inspect and manage identities a coding tool created, not a separate tool
136
- // needing a namespace of its own.
137
- if (typeof opts.profile === 'string' && opts.profile) {
138
- process.env.BOTANARY_AGENT_PROFILE = opts.profile;
139
- }
140
- const settings = resolveSettings({
141
- opts,
142
- env: process.env,
143
- file: await readConfig(),
144
- stdout: process.stdout,
145
- stdin: process.stdin,
146
- });
147
- setColorEnabled(settings.color);
148
- const runtime = deps.runtime ??
149
- (deps.createRuntime ?? ((o) => createDefaultRuntime(o)))({
150
- ...(settings.apiUrl ? { baseUrl: settings.apiUrl } : {}),
151
- ...(() => {
152
- const wrapped = wrapFetch(settings, stderr);
153
- return wrapped ? { fetch: wrapped } : {};
154
- })(),
155
- });
156
- ctx = createContext(runtime, settings);
157
- program.opts = () => ({ ...opts, __ctx: ctx });
158
- if (argv.length === 0 && process.stdout.isTTY && ctx.interactive) {
159
- const session = await runtime.walletSession();
160
- const hasAgent = await runtime.store.hasIdentity();
161
- await runRepl(program, { loggedIn: !!session, hasAgent });
162
- return EXIT.ok;
163
- }
164
- await program.parseAsync(argv, { from: 'user' });
165
- await maybeNag(ctx, deps.cliVersion, stderr, invokedCommand);
166
- return ctx.outcome.exit;
167
- }
168
- catch (e) {
169
- if (e instanceof CommanderError) {
170
- // Map usage errors (unknown command, unknown option, missing argument) to exit 2.
171
- // Keep exit 0 for --help and --version (commander reports those as errors too).
172
- const isUsageError = e.code === 'commander.unknownCommand' || e.code === 'commander.unknownOption' || e.code === 'commander.missingMandatoryOptionValue';
173
- if (isUsageError) {
174
- if (jsonModeEarly) {
175
- console.log(JSON.stringify(errorEnvelope(new CliError(e.message, 'invalid_args', EXIT.invalidArgs))));
176
- }
177
- return EXIT.invalidArgs;
178
- }
179
- // Help and version are exit 0
180
- if (e.code === 'commander.help' || e.code === 'commander.version') {
181
- return EXIT.ok;
182
- }
183
- // Fallback for any other CommanderError
184
- return e.exitCode;
185
- }
186
- const err = toCliError(e);
187
- if (ctx?.json || jsonModeEarly) {
188
- console.log(JSON.stringify(errorEnvelope(err)));
189
- }
190
- for (const line of errorLines(err))
191
- stderr(line);
192
- return err.exit;
193
- }
194
- }
195
- //# sourceMappingURL=cli.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAmB,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,u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AAC;QACD,MAAM,GAAG,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QAC1B,IAAI,GAAG,EAAE,IAAI,IAAI,aAAa,EAAE,CAAC;YAC/B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAClD,CAAC;QACD,KAAK,MAAM,IAAI,IAAI,UAAU,CAAC,GAAG,CAAC;YAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QACjD,OAAO,GAAG,CAAC,IAAI,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -1,171 +0,0 @@
1
- import { submitIntent, describeSignOutcome } from './sign.js';
2
- import { group } from '../help/groups.js';
3
- import { printResult } from '../render/print.js';
4
- import { step } from '../progress.js';
5
- import { confirmOrThrow, dryRunPayload, renderReview } from '../review.js';
6
- import { assertTierAllows, findChain } from '../validate.js';
7
- import { invalidArgs, notLoggedIn } from '../errors.js';
8
- /** Mirrors `wallet.ts`'s/`sign.ts`'s own `requireWalletToken` - duplicated for the same reason
9
- * `tokens.ts` duplicates it: every write here funnels through `submitIntent` (sign.ts), so importing a
10
- * shared helper FROM sign.ts back into a file sign.ts might one day need to import from is exactly the
11
- * circular-dependency shape sign.ts's own comment warns against. */
12
- async function requireWalletToken(ctx) {
13
- const session = await ctx.runtime.walletSession();
14
- if (!session)
15
- throw notLoggedIn();
16
- return session.sessionToken;
17
- }
18
- /** Parse `--op-count`, shared by `account setup` and `account migrate` - both DTOs (`CliAccountSetupIntentDto`,
19
- * `CliAccountMigrateIntentDto`) declare it optional-positive-integer, defaulting server-side to 1 when
20
- * omitted (see `sign-request.dto.ts`'s own doc comments on each). */
21
- function parseOpCount(raw) {
22
- if (raw === undefined)
23
- return undefined;
24
- const value = Number(raw);
25
- if (!Number.isInteger(value) || value <= 0) {
26
- throw invalidArgs(`--op-count must be a positive integer, got ${JSON.stringify(raw)}.`);
27
- }
28
- return value;
29
- }
30
- /** Review, confirm (or dry-run), park the intent, and print the outcome - the same four steps every
31
- * `submitIntent` caller in `wallet.ts` already repeats for `swap`/`yield deposit`/`yield withdraw`. */
32
- async function reviewAndSubmit(ctx, title, rows, warnings, kind, params) {
33
- if (ctx.dryRun) {
34
- printResult(ctx, dryRunPayload(title, rows, warnings), () => renderReview('Dry run - nothing will be sent', rows, warnings));
35
- return;
36
- }
37
- await confirmOrThrow(ctx, title, rows, warnings);
38
- const outcome = await submitIntent(ctx, kind, params);
39
- printResult(ctx, outcome.data, () => describeSignOutcome(outcome));
40
- }
41
- /**
42
- * `account` (singular) - owner-signed lifecycle actions on the account itself: deploy a new one, install
43
- * missing modules, top up on testnet, freeze/unfreeze the kill-switch, and migrate to today's address.
44
- * Every action here is a `submitIntent` write; there is no read half beyond what `accounts list` (the
45
- * PLURAL group in wallet.ts) already gives.
46
- *
47
- * `account rename` is deliberately NOT here - it is a plain session write (`PATCH /accounts/{id}`, no
48
- * signature involved), wired onto this same Command object by `session-writes.ts` (Task 19). Registration
49
- * order in cli.ts matters: this module must run first so that command exists to attach to.
50
- */
51
- export function registerAccountCommands(program) {
52
- const account = group(program.command('account').description("Deploy, set up, fund, freeze/unfreeze and migrate this account"), 'Wallet');
53
- account
54
- .command('deploy')
55
- .description('Mint a new account with its own address (always the next CREATE2 index)')
56
- .action(async () => {
57
- const ctx = program.opts().__ctx;
58
- await requireWalletToken(ctx);
59
- const rows = [{ label: 'action', value: 'deploy a new account' }, { label: 'signed by', value: 'you, in your browser' }];
60
- await reviewAndSubmit(ctx, 'Review this account deploy', rows, [], 'account.deploy', {});
61
- });
62
- account
63
- .command('setup')
64
- .description('Install every account module this chain is missing')
65
- .requiredOption('--chain-id <chainId>', 'Chain to set up - see `botanary chains`')
66
- .option('--op-count <n>', 'How many ops this setup will produce - omit to let the backend size it (usually 1)')
67
- .action(async (opts) => {
68
- const ctx = program.opts().__ctx;
69
- const token = await requireWalletToken(ctx);
70
- const chains = await step(ctx, 'Reading chains', () => ctx.runtime.api.get('/v1/chains', token));
71
- const chain = findChain(chains, opts.chainId);
72
- assertTierAllows(chain, 'send');
73
- if (chain.chainId === null) {
74
- throw invalidArgs(`${chain.name} (${chain.key}) has no EVM chain id - account setup is EVM-only today.`, 'Pick an EVM chain - see `botanary chains`.');
75
- }
76
- const opCount = parseOpCount(opts.opCount);
77
- const rows = [
78
- { label: 'action', value: 'install missing account modules' },
79
- { label: 'chain', value: `${chain.name} (${chain.key}, ${chain.tier})` },
80
- { label: 'signed by', value: 'you, in your browser' },
81
- ];
82
- const warnings = chain.testnet ? ['This is a testnet chain.'] : [];
83
- await reviewAndSubmit(ctx, 'Review this account setup', rows, warnings, 'account.setup', {
84
- chainId: chain.chainId,
85
- ...(opCount !== undefined ? { opCount } : {}),
86
- });
87
- });
88
- account
89
- .command('fund')
90
- .description('Mint testnet USDC into this account (testnet faucet top-up, never a real transfer)')
91
- .option('--account-id <accountId>', 'Specific account of yours - omit for your default')
92
- .action(async (opts) => {
93
- const ctx = program.opts().__ctx;
94
- await requireWalletToken(ctx);
95
- const rows = [
96
- { label: 'action', value: 'mint testnet USDC into this account' },
97
- { label: 'signed by', value: 'you, in your browser' },
98
- ];
99
- const warnings = ['Testnet faucet only - this never moves real funds.'];
100
- await reviewAndSubmit(ctx, 'Review this account fund', rows, warnings, 'account.fund', {
101
- ...(opts.accountId ? { accountId: opts.accountId } : {}),
102
- });
103
- });
104
- account
105
- .command('freeze')
106
- .description('Freeze this account (kill-switch) - no further transfers are authorized until unfrozen')
107
- .option('--account-id <accountId>', 'Specific account of yours - omit for your default')
108
- .option('--lane <lane>', 'owner or panic - which frozen-flag lane to set, omit for the default')
109
- .action(async (opts) => {
110
- const ctx = program.opts().__ctx;
111
- await requireWalletToken(ctx);
112
- if (opts.lane !== undefined && opts.lane !== 'owner' && opts.lane !== 'panic') {
113
- throw invalidArgs(`--lane must be "owner" or "panic", got ${JSON.stringify(opts.lane)}.`);
114
- }
115
- const rows = [
116
- { label: 'action', value: 'freeze this account' },
117
- ...(opts.lane ? [{ label: 'lane', value: opts.lane }] : []),
118
- { label: 'signed by', value: 'you, in your browser' },
119
- ];
120
- const warnings = ['This is the kill-switch. No further transfers will be authorized until you unfreeze.'];
121
- await reviewAndSubmit(ctx, 'Review this account freeze', rows, warnings, 'account.freeze', {
122
- ...(opts.accountId ? { accountId: opts.accountId } : {}),
123
- ...(opts.lane ? { lane: opts.lane } : {}),
124
- });
125
- });
126
- account
127
- .command('unfreeze')
128
- .description('Unfreeze this account, restoring its ability to authorize transfers')
129
- .option('--account-id <accountId>', 'Specific account of yours - omit for your default')
130
- .action(async (opts) => {
131
- const ctx = program.opts().__ctx;
132
- await requireWalletToken(ctx);
133
- const rows = [
134
- { label: 'action', value: 'unfreeze this account' },
135
- { label: 'signed by', value: 'you, in your browser' },
136
- ];
137
- await reviewAndSubmit(ctx, 'Review this account unfreeze', rows, [], 'account.unfreeze', {
138
- ...(opts.accountId ? { accountId: opts.accountId } : {}),
139
- });
140
- });
141
- account
142
- .command('migrate')
143
- .description("Migrate this account to today's address (zero, one or two ops, depending on its current phase)")
144
- .requiredOption('--chain-id <chainId>', 'Chain to migrate on - see `botanary chains`')
145
- .option('--account-id <accountId>', 'Specific account of yours - omit for your default')
146
- .option('--op-count <n>', 'How many ops this migration will produce - omit to let the backend size it (usually 1)')
147
- .action(async (opts) => {
148
- const ctx = program.opts().__ctx;
149
- const token = await requireWalletToken(ctx);
150
- const chains = await step(ctx, 'Reading chains', () => ctx.runtime.api.get('/v1/chains', token));
151
- const chain = findChain(chains, opts.chainId);
152
- assertTierAllows(chain, 'send');
153
- if (chain.chainId === null) {
154
- throw invalidArgs(`${chain.name} (${chain.key}) has no EVM chain id - account migration is EVM-only today.`, 'Pick an EVM chain - see `botanary chains`.');
155
- }
156
- const opCount = parseOpCount(opts.opCount);
157
- const rows = [
158
- { label: 'action', value: "migrate this account to today's address" },
159
- { label: 'chain', value: `${chain.name} (${chain.key}, ${chain.tier})` },
160
- { label: 'signed by', value: 'you, in your browser' },
161
- ];
162
- const warnings = chain.testnet ? ['This is a testnet chain.'] : [];
163
- await reviewAndSubmit(ctx, 'Review this account migration', rows, warnings, 'account.migrate', {
164
- chainId: chain.chainId,
165
- ...(opts.accountId ? { accountId: opts.accountId } : {}),
166
- ...(opCount !== undefined ? { opCount } : {}),
167
- });
168
- });
169
- return account;
170
- }
171
- //# sourceMappingURL=account.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"account.js","sourceRoot":"","sources":["../../../src/commands/account.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAE9D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAkB,MAAM,cAAc,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAExD;;;qEAGqE;AACrE,KAAK,UAAU,kBAAkB,CAAC,GAAe;IAC/C,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IAClD,IAAI,CAAC,OAAO;QAAE,MAAM,WAAW,EAAE,CAAC;IAClC,OAAO,OAAO,CAAC,YAAY,CAAC;AAC9B,CAAC;AAED;;sEAEsE;AACtE,SAAS,YAAY,CAAC,GAAuB;IAC3C,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACxC,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QAC3C,MAAM,WAAW,CA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