@alumbwe/anvil 1.0.9 → 1.0.10

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,38 @@
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
+ Use your own process environment or a `.env` / `.env.local` file in the
18
+ project you open with Anvil. Environment files are deliberately not embedded
19
+ in the public npm package, so API keys and other secrets stay on your machine.
10
20
 
11
21
  ## Development
12
22
 
13
23
  Run the TUI in development mode:
14
24
 
15
- ```bash
16
- bun run dev
17
- ```
25
+ ```bash
26
+ bun --cwd cli dev
27
+ ```
18
28
 
19
29
  ## Testing
20
30
 
21
31
  Run the test suite:
22
32
 
23
- ```bash
24
- bun test
25
- ```
33
+ ```bash
34
+ bun test cli/src/utils/__tests__/terminal-command-broker.test.ts
35
+ ```
26
36
 
27
37
  ### Interactive E2E Testing
28
38
 
@@ -59,23 +69,14 @@ See [tmux.knowledge.md](tmux.knowledge.md) for comprehensive tmux documentation
59
69
 
60
70
  Build the package:
61
71
 
62
- ```bash
63
- bun run build
64
- ```
72
+ ```bash
73
+ bun run --cwd cli typecheck
74
+ bun run --cwd cli build:npm
75
+ ```
65
76
 
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
- ```
77
+ `prepack` rebuilds the npm bundle automatically. The published package includes
78
+ the CommonJS npm launcher, ESM bundle, tree-sitter asset, and vendored ripgrep
79
+ binaries.
79
80
 
80
81
  ## Features
81
82
 
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)