@legna-lnc/legnacode 1.5.3 β†’ 1.5.4

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,385 +1,386 @@
1
- <div align="center">
2
-
3
- # LegnaCode CLI
4
-
5
- **An AI-powered terminal programming assistant, supercharged.**
6
-
7
- [![version](https://img.shields.io/badge/version-1.5.3-blue)](./CHANGELOG.md)
8
- [![platforms](https://img.shields.io/badge/platforms-macOS%20%7C%20Linux%20%7C%20Windows-brightgreen)](#platform-support)
9
- [![license](https://img.shields.io/badge/license-MIT-yellow)](./LICENSE)
10
- [![Claude Code](https://img.shields.io/badge/based%20on-Claude%20Code-blueviolet)](https://github.com/anthropics/claude-code)
11
-
12
- 🌐 [δΈ­ζ–‡ζ–‡ζ‘£](./README.zh-CN.md) Β· πŸ“Š [vs Claude Code](./COMPARISON.md) Β· πŸ“‹ [Changelog](./CHANGELOG.md)
13
-
14
- <img width="1256" height="416" alt="LegnaCode banner" src="https://github.com/user-attachments/assets/5e4717e6-3404-4901-9f5c-1c6462fb1c1a" />
15
-
16
- </div>
17
-
18
- ---
19
-
20
- LegnaCode is built on top of [Claude Code CLI](https://github.com/anthropics/claude-code) with deep enhancements β€” fully compatible with the original, while adding multimodal tools, smarter memory, better UX, and more.
21
-
22
- ### Highlights
23
-
24
- 🧠 **88% less memory tokens** β€” 4-layer memory stack with vector search replaces flat MEMORY.md injection\
25
- 🎨 **6 multimodal tools** β€” Image, video, speech, music, vision, web search (MiniMax models)\
26
- ⚑ **Instant feedback** β€” Token counter from second 1, status in spinner line, no silent operations\
27
- πŸ”Œ **Pluggable memory** β€” DrawerStore (SQLite + TF-IDF), temporal knowledge graph, WAL audit\
28
- πŸ€– **Smarter agents** β€” RPC subprocess execution, autonomous skill detection, smart model routing
29
-
30
- ---
31
-
32
- ## Changelog
33
-
34
- | Version | Summary |
35
- |---------|---------|
36
- | **1.5.3** | Hermes self-evolution loop; Qwen adapter; WebUI chat viewer & live chat; auto skill creation |
37
- | **1.5.2** | Perf audit: async CodeGraph, undoTracker size guard, compacting i18n, TTL caches |
38
- | **1.5.1** | Proactive skill invocation (OML 1% rule); auto-inject frontend/design guidelines; enhanced designer agent |
39
- | **1.5.0** | Fix REPL startup deadlock; remove /undo static import; all AtomCode features fully wired |
40
- | **1.4.9** | Baseline (no-AVX) builds for older x64 CPUs (darwin-x64-baseline, linux-x64-baseline) |
41
- | **1.4.8** | AtomCode fusion (Pangu CJK spacing, frustration detection, loop guard, error file injection, first-read full) |
42
- | **1.4.7** | claude-mem fusion (content-hash dedup, token economics, relevance feedback, 90-day decay, privacy tags) |
43
- | **1.4.6** | OML skill crash fix; plans + memory β†’ project-local; compound engineering fusion |
44
- | **1.4.5** | OpenViking content tiering (L0/L1/L2 degradation + budget-capped injection) |
45
- | **1.4.4** | Status messages β†’ spinner line; comparison doc |
46
- | **1.4.3** | Mempalace memory fusion (DrawerStore + TF-IDF + 4-layer stack + knowledge graph) |
47
- | **1.4.2** | Progress feedback (8 silent paths fixed); verbose default on |
48
-
49
- <details>
50
- <summary>Older versions</summary>
51
-
52
- | Version | Summary |
53
- |---------|---------|
54
- | 1.3.6 | Windows path separator fix for Edit tool |
55
- | 1.3.5 | SessionStart hook fix; Windows alt-screen rendering |
56
- | 1.3.4 | OML Superpowers (11 skills); SessionStart guidance |
57
- | 1.3.3 | OML smart orchestration (19 agent skills) |
58
- | 1.3.2 | Disabled History Snip; Windows streaming fix |
59
- | 1.3.1 | 1M model snip threshold fix |
60
- | 1.3.0 | Project-local storage; `legna migrate` |
61
- | 1.2.1 | Model adapter layer (MiMo, GLM, DeepSeek, Kimi, MiniMax) |
62
- | 1.2.0 | Sessions grouped by project; native Windows compilation |
63
- | 1.1.5–1.1.9 | Windows install fixes; WebUI admin panel |
64
- | 1.0.0–1.0.9 | Initial release; feature flags; i18n; BUDDY pet |
65
-
66
- </details>
67
-
68
- Full details β†’ [CHANGELOG.md](./CHANGELOG.md)
69
-
70
- ---
71
-
72
- ## Acknowledgments
73
-
74
- Built on [Claude Code CLI](https://github.com/anthropics/claude-code) by Anthropic β€” the pioneering terminal AI programming tool. LegnaCode extends it with multimodal capabilities, smarter memory, and enhanced UX while maintaining full upstream compatibility. Thanks to the Anthropic team for open-sourcing this excellent foundation.
75
-
76
- ---
77
-
78
- ## Features
79
-
80
- <table>
81
- <tr><td>
82
-
83
- **🎨 Multimodal** (MiniMax)
84
- - Image / Video / Speech generation
85
- - Music generation / Vision / Web search
86
- - Auto-orchestrated pipelines
87
- - `/auth-minimax` configuration
88
-
89
- </td><td>
90
-
91
- **🧠 Memory**
92
- - 4-layer stack (~800 tokens/turn)
93
- - TF-IDF vector search (<5ms)
94
- - Temporal knowledge graph
95
- - PreCompact auto-save
96
-
97
- </td></tr>
98
- <tr><td>
99
-
100
- **⚑ Agent**
101
- - RPC subprocess tool execution
102
- - Smart model routing
103
- - Autonomous skill detection
104
- - Cross-session `/recall` search
105
-
106
- </td><td>
107
-
108
- **πŸ›‘οΈ Core**
109
- - 45+ built-in tools
110
- - Multi-cloud backends
111
- - MCP protocol support
112
- - Multi-agent collaboration
113
-
114
- </td></tr>
115
- <tr><td>
116
-
117
- **πŸ–₯️ UX**
118
- - Verbose on by default
119
- - Token counter from second 1
120
- - Status in spinner line
121
- - Interrupt reason visible
122
-
123
- </td><td>
124
-
125
- **πŸ”§ DevOps**
126
- - WebUI admin panel
127
- - `legna migrate` tool
128
- - Pure TS syntax highlighting
129
- - Cross-platform binaries
130
-
131
- </td></tr>
132
- </table>
133
-
134
- ---
135
-
136
- ## Requirements
137
-
138
- | Dependency | Version |
139
- |------------|---------|
140
- | [Bun](https://bun.sh) | >= 1.2.0 |
141
- | Node.js | >= 18 (optional) |
142
- | Git | >= 2.0 |
143
- | OS | macOS / Linux |
144
-
145
- ---
146
-
147
- ## Installation
148
-
149
- ### Option 1: npm Global Install (Recommended)
150
-
151
- ```bash
152
- npm install -g @legna-lnc/legnacode
153
- ```
154
-
155
- If using a mirror registry (e.g., cnpm, Taobao mirror) and the install fails or the version is out of sync, you can specify the official registry:
156
-
157
- ```bash
158
- npm install -g @legna-lnc/legnacode --registry=https://registry.npmjs.org
159
- ```
160
-
161
- Once installed, the `legna` command is available in any directory. It automatically downloads the precompiled binary for your platform (supports macOS arm64/x64, Linux x64/arm64, Windows x64).
162
-
163
- ### Older CPUs without AVX
164
-
165
- If you see `warn: CPU lacks AVX support, strange crashes may occur`, install the baseline build instead:
166
-
167
- ```bash
168
- # macOS Intel (pre-2011 or Hackintosh without AVX)
169
- npm i -g @legna-lnc/legnacode-darwin-x64-baseline
170
-
171
- # Linux x64 (older servers/VMs without AVX)
172
- npm i -g @legna-lnc/legnacode-linux-x64-baseline
173
- ```
174
-
175
- The baseline binary is in `node_modules/@legna-lnc/legnacode-<platform>-baseline/bin/legna`. Add it to your PATH or create an alias.
176
-
177
- ```bash
178
- # Verify installation
179
- legna --version
180
-
181
- # Update to the latest version
182
- npm update -g @legna-lnc/legnacode
183
- ```
184
-
185
- ### Option 2: Build from Source
186
-
187
- ```bash
188
- git clone https://github.com/LegnaOS/LegnaCode-cli.git
189
- cd LegnaCode-cli
190
- bun install
191
- bun run compile
192
- # The compiled binary is ./legna β€” move it to your PATH
193
- ```
194
-
195
- ---
196
-
197
- ## Quick Start
198
-
199
- ```bash
200
- # Interactive mode
201
- legna
202
-
203
- # Non-interactive mode (ask directly)
204
- legna -p "Explain what this code does"
205
-
206
- # Continue the last session
207
- legna --continue
208
-
209
- # Check version
210
- legna --version
211
- ```
212
-
213
- ---
214
-
215
- ## Project Structure
216
-
217
- ```
218
- β”œβ”€β”€ src/
219
- β”‚ β”œβ”€β”€ entrypoints/ # Entry point (cli.tsx)
220
- β”‚ β”œβ”€β”€ server/ # HTTP server (admin WebUI)
221
- β”‚ β”œβ”€β”€ components/ # React/Ink terminal UI components
222
- β”‚ β”œβ”€β”€ tools/ # Built-in tools (Bash, file ops, search, etc.)
223
- β”‚ β”œβ”€β”€ services/ # API calls, MCP client, analytics, etc.
224
- β”‚ β”œβ”€β”€ native-ts/ # Pure TS replacements for native modules (syntax highlighting, etc.)
225
- β”‚ β”œβ”€β”€ utils/ # Utility functions
226
- β”‚ └── hooks/ # React hooks
227
- β”œβ”€β”€ webui/ # Admin WebUI frontend (React + Vite + Tailwind)
228
- β”œβ”€β”€ stubs/ # Native module stubs (compile-time external dependency placeholders)
229
- β”œβ”€β”€ scripts/ # Build scripts
230
- β”œβ”€β”€ bunfig.toml # Bun build config (Feature Flags, macro definitions)
231
- └── package.json
232
- ```
233
-
234
- ---
235
-
236
- ## Build
237
-
238
- LegnaCode uses Bun's bundler for building, with two modes:
239
-
240
- - `bun run build` β€” Build to `dist/` directory, suitable for development and debugging
241
- - `bun run compile` β€” Compile to a standalone `legna` binary, no Bun runtime required
242
-
243
- ### Admin WebUI
244
-
245
- `legna admin` launches a browser-based admin panel that lets you manage all configuration through a web interface β€” no manual JSON editing needed.
246
-
247
- ```bash
248
- # Launch admin panel (default port 3456, auto-opens browser)
249
- legna admin
250
-
251
- # Custom port
252
- legna admin 8080
253
- ```
254
-
255
- Tabs at the top of the panel switch between management scopes: **Claude** (`~/.claude/`) and **LegnaCode** (`~/.legna/`). Each scope provides four panels:
256
-
257
- | Panel | Function |
258
- |-------|----------|
259
- | Config Editor | Visual editing of settings.json: API endpoint, API key, model mapping (Opus/Sonnet/Haiku), timeout, permission mode, language, etc. |
260
- | Config Profiles | Lists all settings*.json files, shows baseUrl/model, one-click to switch active profile |
261
- | Session History | Browse past sessions showing project path, slug, timestamp, prompt count; one-click copy `legna --resume` command |
262
- | Config Migration | Bidirectional Claude ↔ LegnaCode migration; supports full or selective field migration with pre-migration diff preview |
263
-
264
- > When running from source, build the frontend first: `cd webui && npm install && npm run build`, then `bun run src/server/admin.ts`. The npm global install version includes the pre-built WebUI.
265
-
266
- Build-time constants such as version numbers are injected via `[bundle.define]` in `bunfig.toml`. Feature Flags in `[bundle.features]` enable dead code elimination.
267
-
268
- Native modules (`color-diff-napi`, `modifiers-napi`, etc.) are marked as `external` and load placeholder implementations from `stubs/` at runtime. Syntax highlighting has been switched to a pure TypeScript implementation under `src/native-ts/color-diff/`, requiring no native compilation dependencies.
269
-
270
- ---
271
-
272
- ## Configuration
273
-
274
- LegnaCode uses `~/.legna/` as the global config directory, with project-level data stored in `<project>/.legna/`:
275
-
276
- - `~/.legna/settings.json` β€” Global user settings
277
- - `~/.legna/.credentials.json` β€” Authentication credentials
278
- - `<project>/.legna/sessions/` β€” Project session records (JSONL)
279
- - `<project>/.legna/skills/` β€” Project skills
280
- - `<project>/.legna/rules/` β€” Project rules
281
- - `<project>/.legna/settings.json` β€” Project-level settings
282
- - `LEGNA.md` β€” Project instruction file, automatically read and followed by the AI
283
-
284
- > On first launch, global data is automatically migrated one-way from `~/.claude/` to `~/.legna/` (existing files are not overwritten). Legacy sessions under `~/.claude/projects/` are read automatically via a fallback chain β€” no manual migration needed. Set `LEGNA_NO_CONFIG_SYNC=1` to disable automatic migration.
285
-
286
- ### legna migrate
287
-
288
- Manually migrate data:
289
-
290
- ```bash
291
- # Migrate everything (global + current project sessions)
292
- legna migrate
293
-
294
- # Migrate global data only: ~/.claude/ β†’ ~/.legna/
295
- legna migrate --global
296
-
297
- # Migrate current project sessions to local .legna/sessions/ only
298
- legna migrate --sessions
299
-
300
- # Dry run (no files are actually moved)
301
- legna migrate --dry-run
302
- ```
303
-
304
- ### Environment Variables
305
-
306
- | Variable | Description |
307
- |----------|-------------|
308
- | `ANTHROPIC_API_KEY` | Anthropic API key |
309
- | `CLAUDE_CODE_USE_BEDROCK` | Use AWS Bedrock backend |
310
- | `CLAUDE_CODE_USE_VERTEX` | Use GCP Vertex backend |
311
- | `CLAUDE_CODE_SYNTAX_HIGHLIGHT` | Set to `0` to disable syntax highlighting |
312
- | `MINIMAX_API_KEY` | MiniMax API key (enables multimodal tools) |
313
- | `MINIMAX_REGION` | MiniMax region: `global` (default) or `cn` |
314
- | `MINIMAX_BASE_URL` | Custom MiniMax API URL (overrides region default) |
315
-
316
- ---
317
-
318
- ## MiniMax Multimodal Integration
319
-
320
- When using a MiniMax model (`ANTHROPIC_BASE_URL` pointing to `api.minimax.io` or `api.minimaxi.com`) with `MINIMAX_API_KEY` configured, LegnaCode automatically registers 6 native multimodal tools that the AI can call directly.
321
-
322
- ### Configuration
323
-
324
- ```bash
325
- # Option 1: Environment variables
326
- export MINIMAX_API_KEY="your-api-key"
327
- export MINIMAX_REGION="global" # or "cn"
328
-
329
- # Option 2: Interactive configuration (persisted to ~/.legna/minimax-credentials.json)
330
- legna
331
- > /auth-minimax your-api-key
332
- ```
333
-
334
- Get your API key: [MiniMax Global](https://platform.minimax.io) or [MiniMax China](https://platform.minimaxi.com)
335
-
336
- ### Multimodal Tools
337
-
338
- | Tool | Function | Example |
339
- |------|----------|---------|
340
- | `MiniMaxImageGenerate` | Text-to-image generation | "Generate a cyberpunk cityscape at night" |
341
- | `MiniMaxVideoGenerate` | Text/image-to-video generation | "Turn this image into a 5-second animation" |
342
- | `MiniMaxSpeechSynthesize` | Text-to-speech | "Convert this text to spoken audio" |
343
- | `MiniMaxMusicGenerate` | Text-to-music generation | "Generate an upbeat piano background track" |
344
- | `MiniMaxVisionDescribe` | Image understanding and analysis | "Describe the contents of this image" |
345
- | `MiniMaxWebSearch` | Web search | "Search for the latest TypeScript 5.x features" |
346
-
347
- These tools are only enabled when using MiniMax models and do not affect the tool list for other models.
348
-
349
- ### Multimodal Workflow
350
-
351
- The AI can automatically orchestrate multiple tools to complete complex tasks:
352
-
353
- ```
354
- User: Help me create a promotional video for my project
355
-
356
- AI auto-orchestrates:
357
- 1. Analyze the project README, extract key selling points
358
- 2. MiniMaxImageGenerate β†’ Generate keyframe images
359
- 3. MiniMaxVideoGenerate β†’ Generate video from keyframes
360
- 4. MiniMaxSpeechSynthesize β†’ Generate narration voiceover
361
- 5. Return URLs for all generated assets
362
- ```
363
-
364
- ### Schema Export
365
-
366
- MiniMax tool schemas can be exported in Anthropic-compatible format for external integration:
367
-
368
- ```typescript
369
- import { exportMiniMaxToolSchemasJSON } from './src/tools/MiniMaxTools/schemaExport.js'
370
- console.log(exportMiniMaxToolSchemasJSON())
371
- ```
372
-
373
- ---
374
-
375
- ## License
376
-
377
- This project follows the open-source license of the upstream Claude Code CLI. See the [Claude Code CLI](https://github.com/anthropics/claude-code) original repository for details.
378
-
379
- ---
380
-
381
- <div align="center">
382
-
383
- **[Claude Code CLI](https://github.com/anthropics/claude-code)** Β· **[Anthropic](https://www.anthropic.com)** Β· **[Model Context Protocol](https://modelcontextprotocol.io)**
384
-
385
- </div>
1
+ <div align="center">
2
+
3
+ # LegnaCode CLI
4
+
5
+ **An AI-powered terminal programming assistant, supercharged.**
6
+
7
+ [![version](https://img.shields.io/badge/version-1.5.4-blue)](./CHANGELOG.md)
8
+ [![platforms](https://img.shields.io/badge/platforms-macOS%20%7C%20Linux%20%7C%20Windows-brightgreen)](#platform-support)
9
+ [![license](https://img.shields.io/badge/license-MIT-yellow)](./LICENSE)
10
+ [![Claude Code](https://img.shields.io/badge/based%20on-Claude%20Code-blueviolet)](https://github.com/anthropics/claude-code)
11
+
12
+ 🌐 [δΈ­ζ–‡ζ–‡ζ‘£](./README.zh-CN.md) Β· πŸ“Š [vs Claude Code](./COMPARISON.md) Β· πŸ“‹ [Changelog](./CHANGELOG.md)
13
+
14
+ <img width="1256" height="416" alt="LegnaCode banner" src="https://github.com/user-attachments/assets/5e4717e6-3404-4901-9f5c-1c6462fb1c1a" />
15
+
16
+ </div>
17
+
18
+ ---
19
+
20
+ LegnaCode is built on top of [Claude Code CLI](https://github.com/anthropics/claude-code) with deep enhancements β€” fully compatible with the original, while adding multimodal tools, smarter memory, better UX, and more.
21
+
22
+ ### Highlights
23
+
24
+ 🧠 **88% less memory tokens** β€” 4-layer memory stack with vector search replaces flat MEMORY.md injection\
25
+ 🎨 **6 multimodal tools** β€” Image, video, speech, music, vision, web search (MiniMax models)\
26
+ ⚑ **Instant feedback** β€” Token counter from second 1, status in spinner line, no silent operations\
27
+ πŸ”Œ **Pluggable memory** β€” DrawerStore (SQLite + TF-IDF), temporal knowledge graph, WAL audit\
28
+ πŸ€– **Smarter agents** β€” RPC subprocess execution, autonomous skill detection, smart model routing
29
+
30
+ ---
31
+
32
+ ## Changelog
33
+
34
+ | Version | Summary |
35
+ |---------|---------|
36
+ | **1.5.4** | Republish with all platform binaries in sync |
37
+ | **1.5.3** | Hermes self-evolution loop; Qwen adapter; WebUI chat viewer & live chat; auto skill creation |
38
+ | **1.5.2** | Perf audit: async CodeGraph, undoTracker size guard, compacting i18n, TTL caches |
39
+ | **1.5.1** | Proactive skill invocation (OML 1% rule); auto-inject frontend/design guidelines; enhanced designer agent |
40
+ | **1.5.0** | Fix REPL startup deadlock; remove /undo static import; all AtomCode features fully wired |
41
+ | **1.4.9** | Baseline (no-AVX) builds for older x64 CPUs (darwin-x64-baseline, linux-x64-baseline) |
42
+ | **1.4.8** | AtomCode fusion (Pangu CJK spacing, frustration detection, loop guard, error file injection, first-read full) |
43
+ | **1.4.7** | claude-mem fusion (content-hash dedup, token economics, relevance feedback, 90-day decay, privacy tags) |
44
+ | **1.4.6** | OML skill crash fix; plans + memory β†’ project-local; compound engineering fusion |
45
+ | **1.4.5** | OpenViking content tiering (L0/L1/L2 degradation + budget-capped injection) |
46
+ | **1.4.4** | Status messages β†’ spinner line; comparison doc |
47
+ | **1.4.3** | Mempalace memory fusion (DrawerStore + TF-IDF + 4-layer stack + knowledge graph) |
48
+ | **1.4.2** | Progress feedback (8 silent paths fixed); verbose default on |
49
+
50
+ <details>
51
+ <summary>Older versions</summary>
52
+
53
+ | Version | Summary |
54
+ |---------|---------|
55
+ | 1.3.6 | Windows path separator fix for Edit tool |
56
+ | 1.3.5 | SessionStart hook fix; Windows alt-screen rendering |
57
+ | 1.3.4 | OML Superpowers (11 skills); SessionStart guidance |
58
+ | 1.3.3 | OML smart orchestration (19 agent skills) |
59
+ | 1.3.2 | Disabled History Snip; Windows streaming fix |
60
+ | 1.3.1 | 1M model snip threshold fix |
61
+ | 1.3.0 | Project-local storage; `legna migrate` |
62
+ | 1.2.1 | Model adapter layer (MiMo, GLM, DeepSeek, Kimi, MiniMax) |
63
+ | 1.2.0 | Sessions grouped by project; native Windows compilation |
64
+ | 1.1.5–1.1.9 | Windows install fixes; WebUI admin panel |
65
+ | 1.0.0–1.0.9 | Initial release; feature flags; i18n; BUDDY pet |
66
+
67
+ </details>
68
+
69
+ Full details β†’ [CHANGELOG.md](./CHANGELOG.md)
70
+
71
+ ---
72
+
73
+ ## Acknowledgments
74
+
75
+ Built on [Claude Code CLI](https://github.com/anthropics/claude-code) by Anthropic β€” the pioneering terminal AI programming tool. LegnaCode extends it with multimodal capabilities, smarter memory, and enhanced UX while maintaining full upstream compatibility. Thanks to the Anthropic team for open-sourcing this excellent foundation.
76
+
77
+ ---
78
+
79
+ ## Features
80
+
81
+ <table>
82
+ <tr><td>
83
+
84
+ **🎨 Multimodal** (MiniMax)
85
+ - Image / Video / Speech generation
86
+ - Music generation / Vision / Web search
87
+ - Auto-orchestrated pipelines
88
+ - `/auth-minimax` configuration
89
+
90
+ </td><td>
91
+
92
+ **🧠 Memory**
93
+ - 4-layer stack (~800 tokens/turn)
94
+ - TF-IDF vector search (<5ms)
95
+ - Temporal knowledge graph
96
+ - PreCompact auto-save
97
+
98
+ </td></tr>
99
+ <tr><td>
100
+
101
+ **⚑ Agent**
102
+ - RPC subprocess tool execution
103
+ - Smart model routing
104
+ - Autonomous skill detection
105
+ - Cross-session `/recall` search
106
+
107
+ </td><td>
108
+
109
+ **πŸ›‘οΈ Core**
110
+ - 45+ built-in tools
111
+ - Multi-cloud backends
112
+ - MCP protocol support
113
+ - Multi-agent collaboration
114
+
115
+ </td></tr>
116
+ <tr><td>
117
+
118
+ **πŸ–₯️ UX**
119
+ - Verbose on by default
120
+ - Token counter from second 1
121
+ - Status in spinner line
122
+ - Interrupt reason visible
123
+
124
+ </td><td>
125
+
126
+ **πŸ”§ DevOps**
127
+ - WebUI admin panel
128
+ - `legna migrate` tool
129
+ - Pure TS syntax highlighting
130
+ - Cross-platform binaries
131
+
132
+ </td></tr>
133
+ </table>
134
+
135
+ ---
136
+
137
+ ## Requirements
138
+
139
+ | Dependency | Version |
140
+ |------------|---------|
141
+ | [Bun](https://bun.sh) | >= 1.2.0 |
142
+ | Node.js | >= 18 (optional) |
143
+ | Git | >= 2.0 |
144
+ | OS | macOS / Linux |
145
+
146
+ ---
147
+
148
+ ## Installation
149
+
150
+ ### Option 1: npm Global Install (Recommended)
151
+
152
+ ```bash
153
+ npm install -g @legna-lnc/legnacode
154
+ ```
155
+
156
+ If using a mirror registry (e.g., cnpm, Taobao mirror) and the install fails or the version is out of sync, you can specify the official registry:
157
+
158
+ ```bash
159
+ npm install -g @legna-lnc/legnacode --registry=https://registry.npmjs.org
160
+ ```
161
+
162
+ Once installed, the `legna` command is available in any directory. It automatically downloads the precompiled binary for your platform (supports macOS arm64/x64, Linux x64/arm64, Windows x64).
163
+
164
+ ### Older CPUs without AVX
165
+
166
+ If you see `warn: CPU lacks AVX support, strange crashes may occur`, install the baseline build instead:
167
+
168
+ ```bash
169
+ # macOS Intel (pre-2011 or Hackintosh without AVX)
170
+ npm i -g @legna-lnc/legnacode-darwin-x64-baseline
171
+
172
+ # Linux x64 (older servers/VMs without AVX)
173
+ npm i -g @legna-lnc/legnacode-linux-x64-baseline
174
+ ```
175
+
176
+ The baseline binary is in `node_modules/@legna-lnc/legnacode-<platform>-baseline/bin/legna`. Add it to your PATH or create an alias.
177
+
178
+ ```bash
179
+ # Verify installation
180
+ legna --version
181
+
182
+ # Update to the latest version
183
+ npm update -g @legna-lnc/legnacode
184
+ ```
185
+
186
+ ### Option 2: Build from Source
187
+
188
+ ```bash
189
+ git clone https://github.com/LegnaOS/LegnaCode-cli.git
190
+ cd LegnaCode-cli
191
+ bun install
192
+ bun run compile
193
+ # The compiled binary is ./legna β€” move it to your PATH
194
+ ```
195
+
196
+ ---
197
+
198
+ ## Quick Start
199
+
200
+ ```bash
201
+ # Interactive mode
202
+ legna
203
+
204
+ # Non-interactive mode (ask directly)
205
+ legna -p "Explain what this code does"
206
+
207
+ # Continue the last session
208
+ legna --continue
209
+
210
+ # Check version
211
+ legna --version
212
+ ```
213
+
214
+ ---
215
+
216
+ ## Project Structure
217
+
218
+ ```
219
+ β”œβ”€β”€ src/
220
+ β”‚ β”œβ”€β”€ entrypoints/ # Entry point (cli.tsx)
221
+ β”‚ β”œβ”€β”€ server/ # HTTP server (admin WebUI)
222
+ β”‚ β”œβ”€β”€ components/ # React/Ink terminal UI components
223
+ β”‚ β”œβ”€β”€ tools/ # Built-in tools (Bash, file ops, search, etc.)
224
+ β”‚ β”œβ”€β”€ services/ # API calls, MCP client, analytics, etc.
225
+ β”‚ β”œβ”€β”€ native-ts/ # Pure TS replacements for native modules (syntax highlighting, etc.)
226
+ β”‚ β”œβ”€β”€ utils/ # Utility functions
227
+ β”‚ └── hooks/ # React hooks
228
+ β”œβ”€β”€ webui/ # Admin WebUI frontend (React + Vite + Tailwind)
229
+ β”œβ”€β”€ stubs/ # Native module stubs (compile-time external dependency placeholders)
230
+ β”œβ”€β”€ scripts/ # Build scripts
231
+ β”œβ”€β”€ bunfig.toml # Bun build config (Feature Flags, macro definitions)
232
+ └── package.json
233
+ ```
234
+
235
+ ---
236
+
237
+ ## Build
238
+
239
+ LegnaCode uses Bun's bundler for building, with two modes:
240
+
241
+ - `bun run build` β€” Build to `dist/` directory, suitable for development and debugging
242
+ - `bun run compile` β€” Compile to a standalone `legna` binary, no Bun runtime required
243
+
244
+ ### Admin WebUI
245
+
246
+ `legna admin` launches a browser-based admin panel that lets you manage all configuration through a web interface β€” no manual JSON editing needed.
247
+
248
+ ```bash
249
+ # Launch admin panel (default port 3456, auto-opens browser)
250
+ legna admin
251
+
252
+ # Custom port
253
+ legna admin 8080
254
+ ```
255
+
256
+ Tabs at the top of the panel switch between management scopes: **Claude** (`~/.claude/`) and **LegnaCode** (`~/.legna/`). Each scope provides four panels:
257
+
258
+ | Panel | Function |
259
+ |-------|----------|
260
+ | Config Editor | Visual editing of settings.json: API endpoint, API key, model mapping (Opus/Sonnet/Haiku), timeout, permission mode, language, etc. |
261
+ | Config Profiles | Lists all settings*.json files, shows baseUrl/model, one-click to switch active profile |
262
+ | Session History | Browse past sessions showing project path, slug, timestamp, prompt count; one-click copy `legna --resume` command |
263
+ | Config Migration | Bidirectional Claude ↔ LegnaCode migration; supports full or selective field migration with pre-migration diff preview |
264
+
265
+ > When running from source, build the frontend first: `cd webui && npm install && npm run build`, then `bun run src/server/admin.ts`. The npm global install version includes the pre-built WebUI.
266
+
267
+ Build-time constants such as version numbers are injected via `[bundle.define]` in `bunfig.toml`. Feature Flags in `[bundle.features]` enable dead code elimination.
268
+
269
+ Native modules (`color-diff-napi`, `modifiers-napi`, etc.) are marked as `external` and load placeholder implementations from `stubs/` at runtime. Syntax highlighting has been switched to a pure TypeScript implementation under `src/native-ts/color-diff/`, requiring no native compilation dependencies.
270
+
271
+ ---
272
+
273
+ ## Configuration
274
+
275
+ LegnaCode uses `~/.legna/` as the global config directory, with project-level data stored in `<project>/.legna/`:
276
+
277
+ - `~/.legna/settings.json` β€” Global user settings
278
+ - `~/.legna/.credentials.json` β€” Authentication credentials
279
+ - `<project>/.legna/sessions/` β€” Project session records (JSONL)
280
+ - `<project>/.legna/skills/` β€” Project skills
281
+ - `<project>/.legna/rules/` β€” Project rules
282
+ - `<project>/.legna/settings.json` β€” Project-level settings
283
+ - `LEGNA.md` β€” Project instruction file, automatically read and followed by the AI
284
+
285
+ > On first launch, global data is automatically migrated one-way from `~/.claude/` to `~/.legna/` (existing files are not overwritten). Legacy sessions under `~/.claude/projects/` are read automatically via a fallback chain β€” no manual migration needed. Set `LEGNA_NO_CONFIG_SYNC=1` to disable automatic migration.
286
+
287
+ ### legna migrate
288
+
289
+ Manually migrate data:
290
+
291
+ ```bash
292
+ # Migrate everything (global + current project sessions)
293
+ legna migrate
294
+
295
+ # Migrate global data only: ~/.claude/ β†’ ~/.legna/
296
+ legna migrate --global
297
+
298
+ # Migrate current project sessions to local .legna/sessions/ only
299
+ legna migrate --sessions
300
+
301
+ # Dry run (no files are actually moved)
302
+ legna migrate --dry-run
303
+ ```
304
+
305
+ ### Environment Variables
306
+
307
+ | Variable | Description |
308
+ |----------|-------------|
309
+ | `ANTHROPIC_API_KEY` | Anthropic API key |
310
+ | `CLAUDE_CODE_USE_BEDROCK` | Use AWS Bedrock backend |
311
+ | `CLAUDE_CODE_USE_VERTEX` | Use GCP Vertex backend |
312
+ | `CLAUDE_CODE_SYNTAX_HIGHLIGHT` | Set to `0` to disable syntax highlighting |
313
+ | `MINIMAX_API_KEY` | MiniMax API key (enables multimodal tools) |
314
+ | `MINIMAX_REGION` | MiniMax region: `global` (default) or `cn` |
315
+ | `MINIMAX_BASE_URL` | Custom MiniMax API URL (overrides region default) |
316
+
317
+ ---
318
+
319
+ ## MiniMax Multimodal Integration
320
+
321
+ When using a MiniMax model (`ANTHROPIC_BASE_URL` pointing to `api.minimax.io` or `api.minimaxi.com`) with `MINIMAX_API_KEY` configured, LegnaCode automatically registers 6 native multimodal tools that the AI can call directly.
322
+
323
+ ### Configuration
324
+
325
+ ```bash
326
+ # Option 1: Environment variables
327
+ export MINIMAX_API_KEY="your-api-key"
328
+ export MINIMAX_REGION="global" # or "cn"
329
+
330
+ # Option 2: Interactive configuration (persisted to ~/.legna/minimax-credentials.json)
331
+ legna
332
+ > /auth-minimax your-api-key
333
+ ```
334
+
335
+ Get your API key: [MiniMax Global](https://platform.minimax.io) or [MiniMax China](https://platform.minimaxi.com)
336
+
337
+ ### Multimodal Tools
338
+
339
+ | Tool | Function | Example |
340
+ |------|----------|---------|
341
+ | `MiniMaxImageGenerate` | Text-to-image generation | "Generate a cyberpunk cityscape at night" |
342
+ | `MiniMaxVideoGenerate` | Text/image-to-video generation | "Turn this image into a 5-second animation" |
343
+ | `MiniMaxSpeechSynthesize` | Text-to-speech | "Convert this text to spoken audio" |
344
+ | `MiniMaxMusicGenerate` | Text-to-music generation | "Generate an upbeat piano background track" |
345
+ | `MiniMaxVisionDescribe` | Image understanding and analysis | "Describe the contents of this image" |
346
+ | `MiniMaxWebSearch` | Web search | "Search for the latest TypeScript 5.x features" |
347
+
348
+ These tools are only enabled when using MiniMax models and do not affect the tool list for other models.
349
+
350
+ ### Multimodal Workflow
351
+
352
+ The AI can automatically orchestrate multiple tools to complete complex tasks:
353
+
354
+ ```
355
+ User: Help me create a promotional video for my project
356
+
357
+ AI auto-orchestrates:
358
+ 1. Analyze the project README, extract key selling points
359
+ 2. MiniMaxImageGenerate β†’ Generate keyframe images
360
+ 3. MiniMaxVideoGenerate β†’ Generate video from keyframes
361
+ 4. MiniMaxSpeechSynthesize β†’ Generate narration voiceover
362
+ 5. Return URLs for all generated assets
363
+ ```
364
+
365
+ ### Schema Export
366
+
367
+ MiniMax tool schemas can be exported in Anthropic-compatible format for external integration:
368
+
369
+ ```typescript
370
+ import { exportMiniMaxToolSchemasJSON } from './src/tools/MiniMaxTools/schemaExport.js'
371
+ console.log(exportMiniMaxToolSchemasJSON())
372
+ ```
373
+
374
+ ---
375
+
376
+ ## License
377
+
378
+ This project follows the open-source license of the upstream Claude Code CLI. See the [Claude Code CLI](https://github.com/anthropics/claude-code) original repository for details.
379
+
380
+ ---
381
+
382
+ <div align="center">
383
+
384
+ **[Claude Code CLI](https://github.com/anthropics/claude-code)** Β· **[Anthropic](https://www.anthropic.com)** Β· **[Model Context Protocol](https://modelcontextprotocol.io)**
385
+
386
+ </div>