@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/CHANGELOG.md +727 -723
- package/README.md +386 -385
- package/README.zh-CN.md +363 -362
- package/npm/bin/legna.cjs +117 -117
- package/npm/postinstall.cjs +82 -82
- package/package.json +154 -154
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
|
-
[](#platform-support)
|
|
9
|
-
[](./LICENSE)
|
|
10
|
-
[](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.
|
|
37
|
-
| **1.5.
|
|
38
|
-
| **1.5.
|
|
39
|
-
| **1.5.
|
|
40
|
-
| **1.
|
|
41
|
-
| **1.4.
|
|
42
|
-
| **1.4.
|
|
43
|
-
| **1.4.
|
|
44
|
-
| **1.4.
|
|
45
|
-
| **1.4.
|
|
46
|
-
| **1.4.
|
|
47
|
-
| **1.4.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
| 1.3.
|
|
56
|
-
| 1.3.
|
|
57
|
-
| 1.3.
|
|
58
|
-
| 1.3.
|
|
59
|
-
| 1.3.
|
|
60
|
-
| 1.3.
|
|
61
|
-
| 1.
|
|
62
|
-
| 1.2.
|
|
63
|
-
| 1.
|
|
64
|
-
| 1.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
-
|
|
86
|
-
-
|
|
87
|
-
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
-
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
-
|
|
120
|
-
-
|
|
121
|
-
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
-
|
|
128
|
-
-
|
|
129
|
-
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
</
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
|
142
|
-
|
|
|
143
|
-
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
bun
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
β βββ
|
|
221
|
-
β βββ
|
|
222
|
-
β βββ
|
|
223
|
-
β βββ
|
|
224
|
-
β βββ
|
|
225
|
-
β βββ
|
|
226
|
-
β
|
|
227
|
-
|
|
228
|
-
βββ
|
|
229
|
-
βββ
|
|
230
|
-
βββ
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
- `bun run
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
| Config
|
|
261
|
-
|
|
|
262
|
-
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
- `~/.legna
|
|
278
|
-
-
|
|
279
|
-
- `<project>/.legna/
|
|
280
|
-
- `<project>/.legna/
|
|
281
|
-
- `<project>/.legna/
|
|
282
|
-
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
| `
|
|
310
|
-
| `
|
|
311
|
-
| `
|
|
312
|
-
| `
|
|
313
|
-
| `
|
|
314
|
-
| `
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
export
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
legna
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
| `
|
|
342
|
-
| `
|
|
343
|
-
| `
|
|
344
|
-
| `
|
|
345
|
-
| `
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# LegnaCode CLI
|
|
4
|
+
|
|
5
|
+
**An AI-powered terminal programming assistant, supercharged.**
|
|
6
|
+
|
|
7
|
+
[](./CHANGELOG.md)
|
|
8
|
+
[](#platform-support)
|
|
9
|
+
[](./LICENSE)
|
|
10
|
+
[](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>
|