@alumbwe/anvil 1.0.9 → 1.0.12

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/README.md CHANGED
@@ -1,28 +1,39 @@
1
- # @anvil/cli
2
-
3
- A Terminal User Interface (TUI) package built with OpenTUI and React.
1
+ # Anvil CLI
2
+
3
+ Anvil is a free AI coding assistant for your terminal. It can inspect a
4
+ project, edit files, and run commands while keeping the public product name
5
+ and command as `anvil`.
4
6
 
5
7
  ## Installation
6
8
 
7
- ```bash
8
- bun install
9
- ```
9
+ ```bash
10
+ npm install -g @alumbwe/anvil
11
+ anvil
12
+ ```
13
+
14
+ Anvil runs its bundled application with [Bun](https://bun.sh). Install Bun
15
+ before running the command.
16
+
17
+ Publishing loads `.env` / `.env.local` and embeds every `NEXT_PUBLIC_*` value
18
+ into the npm bundle. These are client-safe settings such as the application
19
+ URL, telemetry endpoint, and public Stripe key. API keys, tokens, and every
20
+ other private environment value stay out of the public package.
10
21
 
11
22
  ## Development
12
23
 
13
24
  Run the TUI in development mode:
14
25
 
15
- ```bash
16
- bun run dev
17
- ```
26
+ ```bash
27
+ bun --cwd cli dev
28
+ ```
18
29
 
19
30
  ## Testing
20
31
 
21
32
  Run the test suite:
22
33
 
23
- ```bash
24
- bun test
25
- ```
34
+ ```bash
35
+ bun test cli/src/utils/__tests__/terminal-command-broker.test.ts
36
+ ```
26
37
 
27
38
  ### Interactive E2E Testing
28
39
 
@@ -59,23 +70,14 @@ See [tmux.knowledge.md](tmux.knowledge.md) for comprehensive tmux documentation
59
70
 
60
71
  Build the package:
61
72
 
62
- ```bash
63
- bun run build
64
- ```
73
+ ```bash
74
+ bun run --cwd cli typecheck
75
+ bun run --cwd cli build:npm
76
+ ```
65
77
 
66
- ## Run
67
-
68
- Run the built TUI:
69
-
70
- ```bash
71
- bun run start
72
- ```
73
-
74
- Or use the binary directly:
75
-
76
- ```bash
77
- anvil-tui
78
- ```
78
+ `prepack` rebuilds the npm bundle automatically. The published package includes
79
+ the CommonJS npm launcher, ESM bundle, tree-sitter asset, and vendored ripgrep
80
+ binaries.
79
81
 
80
82
  ## Features
81
83
 
package/bin/anvil.cjs CHANGED
@@ -6,37 +6,35 @@
6
6
  * with the bundled entry point. When the user has bun installed globally
7
7
  * (`npm i -g bun`) the CLI works out of the box.
8
8
  */
9
- const { execFileSync, spawnSync } = require('child_process');
10
- const path = require('path');
11
- const fs = require('fs');
9
+ const { spawnSync } = require('child_process')
10
+ const path = require('path')
11
+ const fs = require('fs')
12
12
 
13
- const bundledPath = path.join(__dirname, '..', 'dist', 'bundled.js');
13
+ const bundledPath = path.join(__dirname, '..', 'dist', 'bundled.js')
14
14
 
15
15
  if (!fs.existsSync(bundledPath)) {
16
16
  console.error(
17
- 'Error: bundled CLI not found at ' + bundledPath + '\n' +
18
- 'Try reinstalling: npm i -g @alumbwe/anvil',
19
- );
20
- process.exit(1);
17
+ 'Error: bundled CLI not found at ' +
18
+ bundledPath +
19
+ '\n' +
20
+ 'Try reinstalling: npm i -g @alumbwe/anvil',
21
+ )
22
+ process.exit(1)
21
23
  }
22
24
 
23
- // Try bun first (preferred), then fall back to node.
24
- function tryRun(cmd, args) {
25
- try {
26
- const child = spawnSync(cmd, args, { stdio: 'inherit' });
27
- if (child.error && child.error.code === 'ENOENT') return false;
28
- process.exit(child.status ?? 1);
29
- } catch {
30
- return false;
31
- }
25
+ // bundled.js targets Bun. Running it with Node produces misleading module
26
+ // loader errors, so fail clearly instead of attempting an unsupported fallback.
27
+ const child = spawnSync('bun', [bundledPath, ...process.argv.slice(2)], {
28
+ stdio: 'inherit',
29
+ })
30
+ if (child.error && child.error.code === 'ENOENT') {
31
+ console.error(
32
+ 'Error: Bun is required to run Anvil. Install it from https://bun.sh',
33
+ )
34
+ process.exit(1)
32
35
  }
33
-
34
- if (!tryRun('bun', [bundledPath, ...process.argv.slice(2)])) {
35
- if (!tryRun('node', [bundledPath, ...process.argv.slice(2)])) {
36
- console.error(
37
- 'Error: neither bun nor node found on PATH.\n' +
38
- 'Install bun: https://bun.sh',
39
- );
40
- process.exit(1);
41
- }
36
+ if (child.error) {
37
+ console.error(`Error: unable to start Bun: ${child.error.message}`)
38
+ process.exit(1)
42
39
  }
40
+ process.exit(child.status ?? 1)