dimcode 0.0.20 → 0.0.21

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,473 +1,132 @@
1
- <img src="https://storage-static.fazhiplus.com/zmchat-avatar/0752d736887697a3284138d013052e53+MjI1ZWM1YTAtNmE4Zi00ZWRkLWI0NjktZjNlNzM4N2U0M2M3LjBkZDI2ODc1LWYxMGYtNDBhNC05NWQ1LWJiZGY2ZmEwM2M0OXgxNzY5NzQ4MDM4MTcyNDEwNzYw" alt="Brand Logo" height="100">
1
+ <img src="https://storage-static.fazhiplus.com/zmchat-avatar/0752d736887697a3284138d013052e53+MjI1ZWM1YTAtNmE4Zi00ZWRkLWI0NjktZjNlNzM4N2U0M2M3LjBkZDI2ODc1LWYxMGYtNDBhNC05NWQ1LWJiZGY2ZmEwM2M0OXgxNzY5NzQ4MDM4MTcyNDEwNzYw" alt="Dimcode" height="100">
2
2
 
3
- # Dimcode CLI
4
-
5
- > An AI coding agent CLI and terminal coding assistant with a beautiful interactive TUI
3
+ # Dimcode
6
4
 
7
5
  [![npm version](https://badge.fury.io/js/dimcode.svg)](https://badge.fury.io/js/dimcode)
6
+ [![npm downloads (week)](https://img.shields.io/npm/dw/dimcode)](https://www.npmjs.com/package/dimcode)
7
+ [![npm downloads (total)](https://img.shields.io/npm/dt/dimcode)](https://www.npmjs.com/package/dimcode)
8
8
 
9
- Dimcode is an AI coding CLI for terminal-first developers who want fast code generation, refactoring, repo search, code review, and agent-style workflows directly in the shell.
10
-
11
- If you are searching for a CLI coding tool similar to Claude Code, Codex, OpenCode, or Cursor's terminal workflow, Dimcode is built for the same terminal-native use case while adding a polished multi-session TUI, tool approvals, MCP support, and flexible provider setup.
12
-
13
- Dimcode helps you move fast with:
14
-
15
- - 🎨 **Beautiful TUI** - Modern terminal interface built with Vue 3
16
-
17
- <img src="https://storage-static.fazhiplus.com/zmchat-avatar/7b06958a80a23e038609f65f6c39d1f4+MjI1ZWM1YTAtNmE4Zi00ZWRkLWI0NjktZjNlNzM4N2U0M2M3LjEyOTVhYTU1LWI4YTgtNDA3YS1hNDliLTExMTgxOTU0YTM1NngxNzcwMTkzMzEwOTY2NjM5NjY0" alt="UI" height="300">
18
-
19
- - 💬 **Multi-session Management** - Organize multiple AI conversations
20
- - 🔧 **Built-in Tools** - File ops, web search, code analysis, and more
21
- - ⚡ **Streaming Responses** - See AI outputs in real time
22
- - 🎯 **Tool Approvals** - Granular control over tool execution
23
- - 🌈 **Themes** - Flexible, customizable color schemes
24
-
25
- ## 📈 Download Stats
26
-
27
- | Metric | Live Badge |
28
- | ---------------- | -------------------------------------------------------------------------------------------------------- |
29
- | Weekly downloads | [![npm downloads (week)](https://img.shields.io/npm/dw/dimcode)](https://www.npmjs.com/package/dimcode) |
30
- | Total downloads | [![npm downloads (total)](https://img.shields.io/npm/dt/dimcode)](https://www.npmjs.com/package/dimcode) |
31
-
32
- ## Why Developers Search for Dimcode
33
-
34
- Dimcode is designed for developers looking for:
35
-
36
- - An **AI coding CLI** for daily programming tasks
37
- - A **terminal coding assistant** for large codebases
38
- - A **Claude Code alternative** with a richer TUI
39
- - A **Codex CLI alternative** for multi-session work
40
- - An **OpenCode alternative** with built-in tool approvals
41
- - A **Cursor alternative for terminal users** who prefer staying in the shell
42
- - A **CLI AI agent** for refactors, debugging, repo Q&A, and web research
43
-
44
- ## ⚡ Get Started in 30 Seconds
45
-
46
- 1. Install the CLI
47
-
48
- ```bash
49
- npm install -g dimcode
50
- ```
51
-
52
- 2. Run it
53
-
54
- ```bash
55
- dim
56
- ```
57
-
58
- 3. Ask for help
9
+ AI coding agent for the terminal. Multi-session TUI, 24+ LLM providers, built-in tools, MCP/ACP support.
59
10
 
60
- ```text
61
- Create a React component for a todo list
62
- ```
11
+ <img src="https://storage-static.fazhiplus.com/zmchat-avatar/7b06958a80a23e038609f65f6c39d1f4+MjI1ZWM1YTAtNmE4Zi00ZWRkLWI0NjktZjNlNzM4N2U0M2M3LjEyOTVhYTU1LWI4YTgtNDA3YS1hNDliLTExMTgxOTU0YTM1NngxNzcwMTkzMzEwOTY2NjM5NjY0" alt="Dimcode TUI" height="300">
63
12
 
64
- ## 📦 Installation
13
+ ## Quick Start
65
14
 
66
- Install Dimcode as your AI coding assistant CLI:
67
-
68
- ### Global Installation (Recommended)
15
+ ## 安装
69
16
 
70
17
  ```bash
71
- npm install -g dimcode
72
- ```
73
-
74
- Or using other package managers:
75
-
76
- ```bash
77
- # Using pnpm
78
- pnpm add -g dimcode
79
-
80
- # Using yarn
81
- yarn global add dimcode
82
-
83
- # Using bun
84
- bun add -g dimcode
18
+ npm install -g @dimcode/cli
85
19
  ```
86
20
 
87
- ### Using npx (No Installation)
21
+ ## 快速开始
88
22
 
89
- Run directly without installation:
90
-
91
- ```bash
92
- npx dimcode
93
- ```
94
-
95
- ## 🎮 Usage
96
-
97
- ### Command Palette
98
-
99
- Press `Ctrl+P` to open the command palette, which provides quick access to:
100
-
101
- - **Sessions** - View and switch between conversations
102
- - **New Session** - Start a fresh conversation
103
- - **Settings** - Configure API keys and model settings
104
- - **Tool Approvals** - Manage tool execution permissions
105
- - **Theme** - Customize the UI appearance (in Chat view)
106
-
107
- ### Slash Commands
108
-
109
- Type slash commands directly in the input field:
110
-
111
- | Command | Description |
112
- | -------------------- | ---------------------------------------------- |
113
- | `/settings` | Open settings dialog (custom providers) |
114
- | `/config` | Alternative for `/settings` |
115
- | `/approvals` | Manage tool approvals (auto/all) |
116
- | `/approval` | Alternative for `/approvals` |
117
- | `/connect` | Connect a provider |
118
- | `/models` | Select a model |
119
- | `/sessions` | List all sessions |
120
- | `/new` | Create a new session |
121
- | `/redo` | Redo last interaction |
122
- | `/rename <title>` | Rename current session |
123
- | `/timeline` | Jump to a user message |
124
- | `/tl` | Alternative for `/timeline` |
125
- | `/review` | Review code changes |
126
- | `/debug` | Open debug dialog (node mode only) |
127
- | `/compact` | Compact session context |
128
- | `/init` | Initialize/improve AGENTS.md |
129
- | `/exit` | Exit the application |
130
- | `/longrunning` | Toggle long-running mode |
131
- | `/tool-settings` | Configure tool-specific settings |
132
- | `/toolsettings` | Alternative for `/tool-settings` |
133
- | `/mcp` | Open MCP settings |
134
- | `/mcphub` | Alternative for `/mcp` |
135
- | `/mcp-settings` | Alternative for `/mcp` |
136
- | `/codexlogin` | Login with Codex OAuth |
137
- | `/codex-login` | Alternative for `/codexlogin` |
138
- | `/language` | Switch UI language |
139
- | `/lang` | Alternative for `/language` |
140
- | `/locale` | Alternative for `/language` |
141
- | `/theme` | Toggle light/dark theme |
142
-
143
- ### Keyboard Shortcuts
144
-
145
- | Shortcut | Action |
146
- | ------------- | ------------------------------------------- |
147
- | `Ctrl+P` | Open command palette |
148
- | `F1` | Open help dialog |
149
- | `Ctrl+O` | Expand/collapse all tool calls & thinking |
150
- | `Ctrl+K` | Open settings (custom providers) |
151
- | `Ctrl+C` | Clear input (if non-empty); otherwise exit |
152
- | `Ctrl+W` | Clear input (alternative) |
153
- | `Enter` | Send message |
154
- | `Shift+Enter` | New line in input |
155
- | `Ctrl+J` | New line in input (alternative) |
156
- | `Tab` | Switch mode (Agent/Plan/Debug) |
157
- | `Esc` | Cancel/close dialog or interrupt response |
158
-
159
- ### Input Tips
160
-
161
- - Drag to select text, then release to auto-copy (when enabled)
162
- - In the input area, use `Shift+Option` for rectangular selection
163
- - Triple-click in the input area to select all
164
- - `Tab` moves focus to the next input field; `Shift+Tab` moves to the previous
165
- - The CLI is mouse-friendly for selection, scrolling, and clicking buttons/controls
166
-
167
- ## Dimcode vs Other AI Coding Tools
168
-
169
- If you are comparing Dimcode with Claude Code, Codex, OpenCode, or Cursor, the main difference is that Dimcode focuses on a terminal-first agent experience with:
170
-
171
- - **Interactive TUI workflows** instead of a minimal chat-only shell
172
- - **Multi-session conversation management** for parallel coding tasks
173
- - **Tool approvals and built-in tools** for safer repo operations
174
- - **Flexible provider and model configuration** for custom setups
175
- - **ACP / MCP connectivity** for editor and tool integrations
176
-
177
- That makes it a good fit for developers who want an AI code assistant in the terminal, but need more control and visibility than a basic CLI chat loop.
178
-
179
- ## ⚙️ Configuration
180
-
181
- ### Connect a Provider
182
-
183
- Use one of these flows:
184
-
185
- 1. Launch the CLI:
23
+ ### 启动交互式会话
186
24
 
187
25
  ```bash
188
26
  dim
189
27
  ```
190
28
 
191
- 2. Open provider setup:
192
-
193
- ```text
194
- /connect
195
- ```
196
-
197
- 3. Choose your provider and model, then start chatting.
198
-
199
- You can also open settings any time with:
200
-
201
- ```text
202
- /settings
203
- ```
204
-
205
- or press `Ctrl+K`.
206
-
207
- ### First-time Setup
208
-
209
- On first launch, Dimcode will guide you through:
210
-
211
- 1. **API Key Setup** - Enter your OpenAI API key
212
- 2. **Model Selection** - Choose your preferred AI model
213
- 3. **Tool Approvals** - Configure which tools can run automatically
214
-
215
- ### Codex OAuth
29
+ 进入交互模式后,你可以直接输入问题或任务,DimCode 会帮你完成。
216
30
 
217
- If you want to use Codex OAuth, you can sign in from the CLI:
31
+ ### 执行单次命令
218
32
 
219
33
  ```bash
220
- dim auth codex
34
+ dim "帮我创建一个 React 组件"
221
35
  ```
222
36
 
223
- Inside the app, `/codexlogin` opens the same login flow.
37
+ 适合快速完成单个任务,执行完后自动退出。
224
38
 
225
- ### Common CLI Setup Tasks
39
+ ## 交互命令
226
40
 
227
- - Use `/connect` to add or switch a provider
228
- - Use `/settings` to manage custom provider settings
229
- - Use `/models` to change the active model
230
- - Use `/approvals` to control tool execution permissions
231
- - Use `/tool-settings` to configure tool-specific settings such as WebSearch
232
- - Use `/mcp` to manage MCP integrations
41
+ 在交互模式下,你可以使用以下命令:
233
42
 
234
- Settings and local session data are stored in `~/.dimcode/dimcode/` by default.
43
+ | 命令 | 说明 |
44
+ | ------------------- | ------------------ |
45
+ | `/help` | 显示帮助信息 |
46
+ | `/model` | 查看或切换当前模型 |
47
+ | `/history` | 显示对话历史 |
48
+ | `/clear` | 清空当前对话 |
49
+ | `/exit` 或 `Ctrl+C` | 退出程序 |
235
50
 
236
- ### Active Session Runtime
51
+ ## 使用示例
237
52
 
238
- Dimcode also publishes a small runtime record that external tools can read for live context handoff (for example voice input tools, desktop automations, or editor helpers).
53
+ ### 代码相关
239
54
 
240
- By default the files live under:
241
-
242
- ```text
243
- ~/.dimcode/dimcode/runtime/
244
55
  ```
245
-
246
- The main files are:
247
-
248
- - `active-session.json` - the single live runtime record for the current Dimcode context
249
-
250
- The runtime record includes fields such as:
251
-
252
- - `sessionId`
253
- - `cwd`
254
- - `title`
255
- - `mode`
256
- - `providerId`
257
- - `providerName`
258
- - `modelId`
259
- - `focused`
260
- - `visibility`
261
- - `updatedAt`
262
-
263
- The file is updated in-place as focus changes:
264
-
265
- - `focused` - Dimcode is the active terminal and the record contains the current chat session
266
- - `blurred` / `suspended` - Dimcode keeps the last session context, but it is not the active terminal
267
- - `inactive` - no chat session should be treated as active (for example on the home page)
268
-
269
- Current behavior:
270
-
271
- - Home screen clears the active session record so external tools do not pick up stale chat context
272
- - Chat screen publishes the current session and workspace
273
- - Terminal focus reporting is used when the terminal emulator supports xterm focus events
274
- - Suspend / resume (`Ctrl+Z` / `fg`) also updates visibility
275
-
276
- Dimcode also mirrors the core active context into process env for child-process integrations:
277
-
278
- - `DIMCODE_ACTIVE_SESSION_ID`
279
- - `DIMCODE_ACTIVE_SESSION_FOLDER`
280
- - `GOATCHAIN_ACTIVE_SESSION_ID`
281
- - `GOATCHAIN_ACTIVE_SESSION_FOLDER`
282
-
283
- These env vars are best for Dimcode-spawned tools and hooks. For cross-app integrations, prefer reading the runtime JSON files.
284
-
285
- ### Skills Directory
286
-
287
- Dimcode automatically discovers skills from both global and project-local directories:
288
-
289
- - Global: `~/.agents/skills/`
290
- - Project-local: `<your-project>/.agents/skills/`
291
- - Compatibility paths also supported: `~/.claude/skills/` and `<your-project>/.claude/skills/`
292
-
293
- Each skill should live in its own folder with a `SKILL.md` file:
294
-
295
- ```text
296
- ~/.agents/skills/my-skill/SKILL.md
297
- <your-project>/.agents/skills/my-skill/SKILL.md
56
+ > 帮我写一个 Python 函数,计算斐波那契数列
57
+ > 把这个函数改成递归实现
58
+ > 给这个函数加上类型注解
59
+ > 写个单元测试
298
60
  ```
299
61
 
300
- If the same skill name exists in multiple places, project-local skills override global skills, and `.agents/skills` takes priority over `.claude/skills`.
301
-
302
- ### Web Search Key
62
+ ### 文件操作
303
63
 
304
- To enable web search in the CLI, open:
305
-
306
- ```text
307
- /tool-settings
308
64
  ```
309
-
310
- Then paste your WebSearch / Serper API key into the `WebSearch API Key` field and save.
311
-
312
- By default, Dimcode stores tool settings in:
313
-
314
- ```text
315
- ~/.dimcode/tools.json
65
+ > 读取 src/utils.js 文件
66
+ > main.py 10 行后面添加日志
67
+ > 搜索项目中所有使用 axios 的地方
316
68
  ```
317
69
 
318
- If you prefer environment variables for advanced setups, Dimcode also checks:
70
+ ### 命令执行
319
71
 
320
- - `DIMCODE_WEBSEARCH_KEY`
321
- - `SERPER_API_KEY`
322
-
323
- ### MCP Configuration
324
-
325
- To configure MCP servers from the CLI, open:
326
-
327
- ```text
328
- /mcp
329
72
  ```
330
-
331
- Paste MCP JSON into the editor, then use the built-in format / test actions before saving. Example:
332
-
333
- ```json
334
- {
335
- "mcpServers": {
336
- "context7": {
337
- "url": "https://mcp.context7.com/mcp",
338
- "headers": {
339
- "CONTEXT7_API_KEY": "YOUR_API_KEY"
340
- }
341
- }
342
- }
343
- }
344
- ```
345
-
346
- For Context7, this is the recommended hosted HTTP setup. If your MCP client supports MCP OAuth, Context7's official OAuth endpoint is:
347
-
348
- ```text
349
- https://mcp.context7.com/mcp/oauth
350
- ```
351
-
352
- In Dimcode, use the standard remote HTTP endpoint plus auth headers unless native MCP OAuth support is added for remote servers.
353
-
354
- CLI MCP settings are stored locally in:
355
-
356
- ```text
357
- ~/.dimcode/tools.json
73
+ > 运行 npm test
74
+ > 查看当前目录下的文件
75
+ > 检查 git 状态
358
76
  ```
359
77
 
360
- If you use `DIMCODE_HOME`, replace `~/.dimcode` with that directory.
78
+ ## 配置
361
79
 
362
- You can also skip `/mcp` and edit that file directly. The file format is:
80
+ 配置文件位于 `~/.dimcode/config.json`:
363
81
 
364
82
  ```json
365
83
  {
366
- "version": 1,
367
- "updatedAt": 1735689600000,
368
- "settings": {
369
- "mcpServers": [
370
- {
371
- "id": "mcp_context7",
372
- "name": "context7",
373
- "transport": "http",
374
- "url": "https://mcp.context7.com/mcp",
375
- "headers": {
376
- "CONTEXT7_API_KEY": "YOUR_API_KEY"
377
- }
378
- }
379
- ]
380
- }
84
+ "model": "gpt-4",
85
+ "apiKey": "your-api-key",
86
+ "theme": "dark"
381
87
  }
382
88
  ```
383
89
 
384
- Use `/mcp` when you want the friendlier editor and connection test UI. Edit `~/.dimcode/tools.json` directly when you want to script, sync, or manage MCP config as a file.
385
-
386
- ## ACP Server
90
+ 也可以通过环境变量配置:
387
91
 
388
- Dimcode can run as an ACP server for editors and tools such as Zed or OpenClaw `acpx`.
92
+ | 变量 | 说明 |
93
+ | ------------------ | ------------ |
94
+ | `DIMCODE_MODEL` | 默认模型 |
95
+ | `DIMCODE_API_KEY` | API 密钥 |
96
+ | `DIMCODE_BASE_URL` | API 基础 URL |
389
97
 
390
- Preferred commands:
98
+ ## 选项
391
99
 
392
100
  ```bash
393
- dim acp
394
- ```
395
-
396
- ```bash
397
- node /absolute/path/to/repo/scripts/acpx-agent.mjs
398
- ```
399
-
400
- For GUI launchers, prefer absolute paths instead of relying on shell `PATH`.
401
- Do not configure `bun run acp-server` in `acpx` or editor settings; it only works when the cwd is the repository root.
402
- If you use Codex OAuth, run `dim auth codex` once first. If you use a custom provider, make sure `~/.dimcode/config.json` already contains a valid provider setup.
101
+ dim [选项] [命令]
403
102
 
404
- ## 🔧 Built-in Tools
405
-
406
- Dimcode comes with powerful built-in tools:
407
-
408
- ### File Operations
409
-
410
- - **Read** - Read file contents
411
- - **Write** - Create or overwrite files
412
- - **Edit** - Make precise edits to existing files
413
-
414
- ### Code Analysis
415
-
416
- - **Grep** - Search content using patterns
417
- - **Glob** - Find files by pattern
418
-
419
- ### Web & Research
420
-
421
- - **WebSearch** - Search the web using Serper API
422
- - **WebFetch** - Fetch web page content
423
-
424
- ### Task Management
425
-
426
- - **TodoWrite** - Create and manage TODO lists
427
-
428
- ### System
429
-
430
- - **Bash** - Execute shell commands (requires approval)
431
- - **AskUser** - Request input from user
432
-
433
- ### Skills
434
-
435
- Skills are specialized capabilities that can be activated to extend Dimcode's functionality. Built-in skills include:
436
-
437
- - **skill-installer** - Install Codex skills from curated list or GitHub repos
438
- - **skill-creator** - Guide for creating effective skills
439
-
440
- ## 📚 Examples
441
-
442
- ### Basic Coding Assistant
443
-
444
- ```bash
445
- dim
446
- # Then type: "Create a React component for a todo list"
103
+ 选项:
104
+ -m, --model <model> 指定使用的模型
105
+ -c, --config <path> 指定配置文件路径
106
+ -v, --version 显示版本号
107
+ -h, --help 显示帮助信息
447
108
  ```
448
109
 
449
- ### Multi-file Refactoring
450
-
451
- ```bash
452
- dim
453
- # Then type: "Rename all instances of 'oldName' to 'newName' across the project"
454
- ```
110
+ ## 特性
455
111
 
456
- ### Web Research
112
+ - **交互式对话**:支持多轮对话,保留上下文
113
+ - **代码编辑**:读取、修改、创建文件
114
+ - **命令执行**:运行 shell 命令
115
+ - **流式输出**:实时显示响应
116
+ - **历史记录**:自动保存对话历史
457
117
 
458
- ```bash
459
- dim
460
- # Then type: "Search for the latest best practices in TypeScript 5.3"
461
- ```
118
+ ## 快捷键
462
119
 
463
- ### Compare CLI Coding Agents
120
+ | 快捷键 | 功能 |
121
+ | -------- | ------------------- |
122
+ | `Ctrl+C` | 取消当前操作 / 退出 |
123
+ | `Tab` | 自动补全 |
124
+ | `↑/↓` | 浏览历史输入 |
464
125
 
465
- ```bash
466
- dim
467
- # Then type: "Compare Dimcode with Claude Code, Codex, OpenCode, and Cursor for terminal-first development"
468
- ```
126
+ ## 获取帮助
469
127
 
470
- ## 🔐 Security & Privacy
128
+ 遇到问题?
471
129
 
472
- - **Tool Approvals**: By default, sensitive operations (file writes, shell commands) require user approval
473
- - **Local Storage**: All session data is stored locally in `~/.dimcode/dimcode/` (customizable via `DIMCODE_HOME`)
130
+ - 在交互模式下输入 `/help`
131
+ - 查看文档:https://docs.dimcode.dev
132
+ - 提交 Issue:https://github.com/dimcode/cli/issues
package/cli.mjs CHANGED
@@ -1,8 +1,71 @@
1
1
  #!/usr/bin/env node
2
+
3
+ import { spawn, spawnSync } from 'node:child_process'
4
+ import { existsSync } from 'node:fs'
5
+ import path from 'node:path'
6
+ import process from 'node:process'
7
+ import { fileURLToPath } from 'node:url'
8
+
9
+ const cliPath = fileURLToPath(import.meta.url)
10
+ const cliDir = path.dirname(cliPath)
11
+ const sourceEntry = path.join(cliDir, 'src', 'cli.ts')
12
+ const bundledEntry = path.join(cliDir, 'dist', 'cli.mjs')
13
+ const sourceEntryUrl = new URL('./src/cli.ts', import.meta.url).href
14
+ const bundledEntryUrl = new URL('./dist/cli.mjs', import.meta.url).href
15
+
16
+ function resolveBunCommand() {
17
+ return process.env.BUN_BIN?.trim() || 'bun'
18
+ }
19
+
20
+ function canRelayToBunSource() {
21
+ if (typeof globalThis.Bun !== 'undefined')
22
+ return false
23
+ if (!existsSync(sourceEntry))
24
+ return false
25
+
26
+ const probe = spawnSync(resolveBunCommand(), ['--version'], { stdio: 'ignore' })
27
+ return probe.status === 0
28
+ }
29
+
30
+ async function relayToBunSource() {
31
+ const child = spawn(resolveBunCommand(), [cliPath, ...process.argv.slice(2)], {
32
+ stdio: 'inherit',
33
+ env: process.env,
34
+ })
35
+
36
+ const forwardSignal = (signal) => {
37
+ if (!child.killed)
38
+ child.kill(signal)
39
+ }
40
+
41
+ for (const signal of ['SIGINT', 'SIGTERM', 'SIGHUP'])
42
+ process.on(signal, () => forwardSignal(signal))
43
+
44
+ child.on('error', (error) => {
45
+ console.error(error)
46
+ process.exit(1)
47
+ })
48
+
49
+ await new Promise((resolve) => {
50
+ child.on('exit', (code) => {
51
+ process.exit(code ?? 1)
52
+ })
53
+ child.on('close', () => resolve())
54
+ })
55
+ }
56
+
2
57
  if (typeof globalThis.Bun !== 'undefined') {
3
- const { main } = await import('./src/cli.ts')
4
- await main()
58
+ if (existsSync(bundledEntry))
59
+ await import(bundledEntryUrl)
60
+ else {
61
+ const { main } = await import(sourceEntryUrl)
62
+ await main()
63
+ }
64
+ }
65
+ else if (canRelayToBunSource()) {
66
+ // In source checkouts, prefer Bun so `node .../cli.mjs` uses the current TS sources.
67
+ await relayToBunSource()
5
68
  }
6
69
  else {
7
- await import('./dist/cli.mjs')
70
+ await import(bundledEntryUrl)
8
71
  }