flavor-code 1.2.7 → 1.2.9
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 +405 -369
- package/README.zh-CN.md +387 -356
- package/dist/agent/loop.d.ts +4 -0
- package/dist/agent/types.d.ts +10 -0
- package/dist/{app-R3SDG2OH.js → app-USAFQVSX.js} +379 -12
- package/dist/{chunk-NVLYFU6P.js → chunk-F2HMO5Q2.js} +28 -11
- package/dist/{chunk-WN2EZV3Y.js → chunk-G32MCAZA.js} +1 -1
- package/dist/{chunk-N2S7USST.js → chunk-RQTYHUMK.js} +2 -1
- package/dist/{chunk-5RHJ3PQN.js → chunk-WGYNTR4Q.js} +1834 -495
- package/dist/{chunk-HFR2WS6T.js → chunk-XFCJXRJ2.js} +18 -5
- package/dist/{claude-ink-WPWPEL5A.js → claude-ink-ORUA7GWG.js} +2 -2
- package/dist/cli.js +9 -8
- package/dist/config/protected-file.d.ts +6 -0
- package/dist/config/schema.d.ts +2 -0
- package/dist/context/manager.d.ts +2 -0
- package/dist/context/workspace-instructions.d.ts +10 -0
- package/dist/desktop/main.js +12736 -5178
- package/dist/desktop/pixel-worker.js +73 -0
- package/dist/desktop/preload.cjs +80 -2
- package/dist/desktop-renderer/assets/index-D-s27J39.js +151 -0
- package/dist/desktop-renderer/assets/index-DMZBSGrp.css +1 -0
- package/dist/desktop-renderer/index.html +3 -4
- package/dist/harness/local.d.ts +4 -1
- package/dist/jobs/registry.d.ts +48 -0
- package/dist/{load-XC5JYYBQ.js → load-6ZMEBHSG.js} +1 -1
- package/dist/models/anthropic.d.ts +4 -0
- package/dist/permissions/engine.d.ts +7 -0
- package/dist/production.d.ts +13 -1
- package/dist/sdk/index.js +4 -4
- package/dist/terminal/service.d.ts +57 -0
- package/dist/tools/files.d.ts +10 -0
- package/dist/tools/jobs.d.ts +4 -0
- package/dist/tools/runtime.d.ts +2 -0
- package/dist/tools/shell.d.ts +13 -3
- package/dist/tools/terminal.d.ts +3 -0
- package/dist/tools/types.d.ts +76 -4
- package/dist/tools/web.d.ts +53 -0
- package/package.json +13 -2
- package//346/212/200/346/234/257/346/226/271/346/241/210/346/212/245/345/221/212.md +752 -1
- package/dist/desktop-renderer/assets/index-CLrVaR9H.js +0 -143
- package/dist/desktop-renderer/assets/index-Cm_ktmXm.css +0 -1
package/README.md
CHANGED
|
@@ -1,369 +1,405 @@
|
|
|
1
|
-
<p align="center"><b><a href="./README.md">English</a></b> | <a href="./README.zh-CN.md">简体中文</a></p>
|
|
2
|
-
|
|
3
|
-
<div align="center">
|
|
4
|
-
<img src="./assets/icon-transparent-512.png" alt="Flavor Code Logo" width="168" />
|
|
5
|
-
<h1>Flavor Code</h1>
|
|
6
|
-
<p><strong>Local-first, auditable, resumable AI coding assistant</strong></p>
|
|
7
|
-
<p>Read code, edit files, run commands, and complete complex tasks in the terminal, Electron desktop, and VS Code.</p>
|
|
8
|
-
|
|
9
|
-
<p>
|
|
10
|
-
<a href="https://www.npmjs.com/package/flavor-code"><img alt="npm version" src="https://img.shields.io/npm/v/flavor-code?color=cb3837&logo=npm" /></a>
|
|
11
|
-
<a href="https://github.com/YachuanWzh/flavor-code/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/YachuanWzh/flavor-code/actions/workflows/ci.yml/badge.svg?branch=main" /></a>
|
|
12
|
-
<img alt="Node.js 20+" src="https://img.shields.io/badge/Node.js-20%2B-339933?logo=nodedotjs&logoColor=white" />
|
|
13
|
-
<a href="./LICENSE"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-blue.svg" /></a>
|
|
14
|
-
</p>
|
|
15
|
-
|
|
16
|
-
<p>
|
|
17
|
-
<a href="#quick-start">Quick Start</a> ·
|
|
18
|
-
<a href="#features">Features</a> ·
|
|
19
|
-
<a href="#entry-points">Entry Points</a> ·
|
|
20
|
-
<a href="#permissions--sandbox">Security</a> ·
|
|
21
|
-
<a href="#development">Development</a>
|
|
22
|
-
|
|
23
|
-
</
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
|
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
**
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
**
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
The
|
|
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
|
-
npm run desktop:
|
|
164
|
-
npm run
|
|
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
|
-
|
|
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
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
##
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
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
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
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
|
-
|
|
1
|
+
<p align="center"><b><a href="./README.md">English</a></b> | <a href="./README.zh-CN.md">简体中文</a></p>
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
<img src="./assets/icon-transparent-512.png" alt="Flavor Code Logo" width="168" />
|
|
5
|
+
<h1>Flavor Code</h1>
|
|
6
|
+
<p><strong>Local-first, auditable, resumable AI coding assistant</strong></p>
|
|
7
|
+
<p>Read code, edit files, run commands, and complete complex tasks in the terminal, Electron desktop, and VS Code.</p>
|
|
8
|
+
|
|
9
|
+
<p>
|
|
10
|
+
<a href="https://www.npmjs.com/package/flavor-code"><img alt="npm version" src="https://img.shields.io/npm/v/flavor-code?color=cb3837&logo=npm" /></a>
|
|
11
|
+
<a href="https://github.com/YachuanWzh/flavor-code/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/YachuanWzh/flavor-code/actions/workflows/ci.yml/badge.svg?branch=main" /></a>
|
|
12
|
+
<img alt="Node.js 20+" src="https://img.shields.io/badge/Node.js-20%2B-339933?logo=nodedotjs&logoColor=white" />
|
|
13
|
+
<a href="./LICENSE"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-blue.svg" /></a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<p>
|
|
17
|
+
<a href="#quick-start">Quick Start</a> ·
|
|
18
|
+
<a href="#features">Features</a> ·
|
|
19
|
+
<a href="#entry-points">Entry Points</a> ·
|
|
20
|
+
<a href="#permissions--sandbox">Security</a> ·
|
|
21
|
+
<a href="#development">Development</a> ·
|
|
22
|
+
<a href="./CHANGELOG.md">Changelog</a>
|
|
23
|
+
</p>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
Flavor Code connects to OpenAI, Anthropic, or compatible services and works with file, search, Shell, MCP, and custom tools inside a controlled workspace. Complex tasks can be broken into plans and parallel sub-tasks; sessions, diffs, tool calls, checkpoints, and audit records are all stored locally so you can resume, review, and continue at any time.
|
|
29
|
+
|
|
30
|
+
## Features
|
|
31
|
+
|
|
32
|
+
| | Capability | What you get |
|
|
33
|
+
| --- | --- | --- |
|
|
34
|
+
| 🖥️ | **One runtime, three entry points** | CLI, Electron, and VS Code share model configuration, sessions, and tooling |
|
|
35
|
+
| 🧭 | **Controlled progress on complex tasks** | Task plans, sub-agents, steering, follow-ups, `/loop`, and `/goal` |
|
|
36
|
+
| ⏪ | **Traceable, resumable results** | Full timeline, checkpoints, rewind, traces, diffs, and failure audits |
|
|
37
|
+
| 🧠 | **Local long-term context** | Memory, Skills, plugins, and project guides stored on your machine |
|
|
38
|
+
| 🎨 | **D2C design-to-code** | Import Pixso exports; the agent generates Vue/React implementations with automatic pixel-level visual evaluation (Electron only) |
|
|
39
|
+
| 🛡️ | **Clear permission boundaries** | Independent control over read, write, Shell, network, and destructive actions; Docker supported |
|
|
40
|
+
|
|
41
|
+
## 1.2.9 Runtime Productivity
|
|
42
|
+
|
|
43
|
+
1.2.9 adds layered project instructions, safe writes, background jobs, persistent terminals, and native web tools. Usually you can just describe the goal in natural language and the agent picks the right tool; when you need precise control, name the tool and its parameters explicitly in the prompt.
|
|
44
|
+
|
|
45
|
+
| Feature | How to use |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| **Layered project instructions** | Put `AGENTS.md` / `CLAUDE.md` in the project root or subdirectories; use `AGENTS.local.md` / `CLAUDE.local.md` for local additions in the same directory. Root rules load at startup; subdirectory rules load automatically when the agent touches files there. |
|
|
48
|
+
| **Per-turn change summary** | No configuration needed. After a successful `Write`, `Edit`, or `ApplyPatch`, the turn shows a color-coded `CHANGESET` receipt with workspace-relative paths, `CREATE` / `UPDATE` / `DELETE` operations, per-file line counts, and a total. At most 8 files are shown, with an explicit shown/total footer when more changed. |
|
|
49
|
+
| **File version protection** | No configuration needed. If the IDE, a formatter, or another process modifies a file after the agent read it, the next write fails with `Stale file`; ask the agent to re-read before editing. |
|
|
50
|
+
| **Standard tool presentation protocol** | Tool authors can declare `outputSchema`, `renderForModel`, `presentCall`, and `presentResult`, so the same result can use an appropriate form in the model context, CLI, and desktop. The CLI visually separates file diffs, web evidence, job receipts, foreground `COMMAND` output, and persistent `TERMINAL` output from the final answer. |
|
|
51
|
+
| **Background Shell / Jobs** | Say "start the dev server in the background" and the agent calls `Shell` with `background: true`. Use `JobList` to view jobs, `JobRead` for incremental output, `JobWait` to wait, and `JobKill` to stop. The CLI shows a color-bordered `JOB` receipt separating job metadata, logs, and the final answer; logs show at most the latest 12 lines and lists at most 8 items. Windows prefers UTF-8 and falls back automatically on GBK/GB18030 system diagnostics. |
|
|
52
|
+
| **Foreground command results** | Foreground `Shell` calls render as state-colored `COMMAND` receipts with separate command, stdout, stderr, and exit regions. Long output keeps the first and last 8 lines and explicitly folds the middle; persistent PTY output uses the distinct `TERMINAL` label. |
|
|
53
|
+
| **Desktop background status** | Electron automatically shows the number of running jobs in the session title bar, updated live on start, output, exit, or cancel. |
|
|
54
|
+
| **Persistent PTY** | Say "open a persistent terminal and keep interacting". The agent uses `TerminalOpen` to create a terminal, `TerminalWrite` for input, `TerminalRead` for incremental output, and `TerminalClose` to close it. |
|
|
55
|
+
| **Unified D2C/E2E process lifecycle** | No usage change. Preview and backend services still start/stop from the E2E/D2C workbench, but the underlying layer unifies output limits, process-tree termination, and idempotent cleanup. |
|
|
56
|
+
| **Native WebSearch** | Say "search the web for ...", or explicitly ask for `WebSearch`. It uses keyless DuckDuckGo Lite by default and degrades to Bing on connection failure, HTTP rejection, or no parseable results; up to 20 results per call. The CLI puts the top 5 into a bordered `WEB SEARCH` evidence block with titles and compact sources in search order. |
|
|
57
|
+
| **Native WebFetch** | Say "read this page: `https://...`", or explicitly ask for `WebFetch`. Supports HTTP(S), redirects, HTML-to-text, timeouts, and response size limits, and is compatible with Clash/TUN Fake-IP DNS. Direct access to Fake-IP, intranet, or cloud metadata addresses is still blocked; network operations still follow Flavor permission approval. |
|
|
58
|
+
|
|
59
|
+
Common precise usage:
|
|
60
|
+
|
|
61
|
+
```text
|
|
62
|
+
Start npm run dev with Shell in background mode, then use JobRead to inspect the startup logs.
|
|
63
|
+
Open a persistent terminal, run a Python REPL in it, execute two snippets, then close the terminal.
|
|
64
|
+
Use WebSearch to find the official TypeScript 7 migration notes, then WebFetch the most relevant official page.
|
|
65
|
+
This directory has its own conventions; follow src/payments/AGENTS.md before modifying code here.
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
See [Technical Design Report §38](./技术方案报告.md#38-129-运行时生产力与原生-web-能力) for tool parameters, state machines, security boundaries, and extension interfaces; acceptance criteria are in the [Runtime productivity spec](./docs/specs/2026-08-13-runtime-productivity-waves.md).
|
|
69
|
+
|
|
70
|
+
## Quick Start
|
|
71
|
+
|
|
72
|
+
> [!IMPORTANT]
|
|
73
|
+
> The CLI requires Node.js 20 or later. Windows desktop builds can also be downloaded directly from [Releases](https://github.com/YachuanWzh/flavor-code/releases).
|
|
74
|
+
|
|
75
|
+
**1. Install**
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npm install -g flavor-code
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**2. Start in your project**
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
cd your-project
|
|
85
|
+
flavor
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**3. Initialize project context**
|
|
89
|
+
|
|
90
|
+
Run `/init` the first time you enter a project. Flavor analyzes the language, package manager, source directories, and verification commands, then generates a `FLAVOR.md` project guide.
|
|
91
|
+
|
|
92
|
+
You can also run one-off tasks directly:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
flavor --print "Analyze this project and list the top three issues worth fixing"
|
|
96
|
+
flavor --resume
|
|
97
|
+
flavor --resume -p "Continue the remaining work"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Non-interactive mode refuses actions that require human approval and never hangs waiting for input.
|
|
101
|
+
|
|
102
|
+
## Configuring Models
|
|
103
|
+
|
|
104
|
+
The fastest way is to set environment variables:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# macOS / Linux
|
|
108
|
+
export OPENAI_API_KEY="sk-..."
|
|
109
|
+
|
|
110
|
+
# Windows PowerShell
|
|
111
|
+
$env:OPENAI_API_KEY = "sk-..."
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
You can also put the key in a `.env` file at the project root.
|
|
115
|
+
|
|
116
|
+
<details>
|
|
117
|
+
<summary><strong>Configure multiple providers with <code>.flavor/flavor.json</code></strong></summary>
|
|
118
|
+
|
|
119
|
+
Example project configuration:
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"providers": {
|
|
124
|
+
"openai": {
|
|
125
|
+
"type": "openai",
|
|
126
|
+
"apiKey": "${OPENAI_API_KEY}",
|
|
127
|
+
"defaultModel": "gpt-5",
|
|
128
|
+
"cheapModel": "gpt-5-mini"
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"agents": {
|
|
132
|
+
"main": { "model": "openai:gpt-5" },
|
|
133
|
+
"subagent": { "model": "openai:gpt-5-mini" }
|
|
134
|
+
},
|
|
135
|
+
"permissionMode": "default",
|
|
136
|
+
"maxSubagents": 3,
|
|
137
|
+
"language": "zh-CN"
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Configuration is merged in the following order, with later sources taking precedence:
|
|
142
|
+
|
|
143
|
+
1. Global `~/.flavor-code/flavor.json`
|
|
144
|
+
2. Project `.flavor/flavor.json`
|
|
145
|
+
3. `.env`
|
|
146
|
+
4. Process environment variables
|
|
147
|
+
|
|
148
|
+
Commonly supported provider types:
|
|
149
|
+
|
|
150
|
+
- `openai`: OpenAI's official API
|
|
151
|
+
- `anthropic`: Anthropic's official API
|
|
152
|
+
- `openai-compatible`: Services compatible with the OpenAI protocol
|
|
153
|
+
|
|
154
|
+
</details>
|
|
155
|
+
|
|
156
|
+
Runtime behavior and configuration conventions for OAuth PKCE are described in the [PKCE spec](./docs/specs/pkce-runtime-config.md). The [config schema](./src/config/schema.ts) is the source of truth for all fields.
|
|
157
|
+
|
|
158
|
+
## Entry Points
|
|
159
|
+
|
|
160
|
+
| Entry point | Best for | How to start |
|
|
161
|
+
| --- | --- | --- |
|
|
162
|
+
| **CLI** | Daily development, remote environments, scripting, and CI | `flavor` |
|
|
163
|
+
| **Electron** | Visual sessions, diffs, permissions, and resource management | `npm run desktop:start` |
|
|
164
|
+
| **VS Code / Qoder** | Editor context, diagnostic fixes, and a task control plane | `npm run ide:install` |
|
|
165
|
+
|
|
166
|
+
### CLI
|
|
167
|
+
|
|
168
|
+
Run `flavor` and type natural language. Typing `/` shows built-in commands, plugin commands, and Skills.
|
|
169
|
+
|
|
170
|
+
Common commands:
|
|
171
|
+
|
|
172
|
+
| Command | Purpose |
|
|
173
|
+
| --- | --- |
|
|
174
|
+
| `/init` | Generate or update `FLAVOR.md` |
|
|
175
|
+
| `/model` | View or switch main/sub-agent models |
|
|
176
|
+
| `/permissions` | Switch permission modes |
|
|
177
|
+
| `/tasks` | View task plans and sub-agent status |
|
|
178
|
+
| `/compact` | Manually compact long session context |
|
|
179
|
+
| `/checkpoint`, `/tree` | Save state, view the session tree |
|
|
180
|
+
| `/rewind`, `/unrevert`, `/fork` | Resume or fork sessions |
|
|
181
|
+
| `/memory`, `/remember`, `/forget`, `/forget-cold` | Manage long-term memory; `/forget-cold` purges cold entries and their files |
|
|
182
|
+
| `/mcp` | View and manage MCP servers |
|
|
183
|
+
| `/loop <goal>` | Run an autonomous loop with verification |
|
|
184
|
+
| `/goal <objective>` | Run the plan, execute, adversarial-review workflow |
|
|
185
|
+
| `/audit` | View tool failure audits |
|
|
186
|
+
|
|
187
|
+
You can submit steering or queue follow-ups while a run is in progress; once the current model response finishes, the task picks up new instructions at safe boundaries.
|
|
188
|
+
|
|
189
|
+
### Electron Desktop
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
npm run desktop:dev # dev mode
|
|
193
|
+
npm run desktop:start # build and start
|
|
194
|
+
npm run desktop:pack # Windows portable directory
|
|
195
|
+
npm run desktop:dist # Windows NSIS installer
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
The desktop app provides project and session switching, streaming Markdown, tool and diff views, permission confirmations, task status, and management of Skills, MCP, memory, and models.
|
|
199
|
+
|
|
200
|
+
The **D2C** module in the sidebar supports a complete design-to-code loop: import a Pixso-exported HTML directory, choose a target framework (Vue 3 / React), and submit the generation task to the current session. The agent implements it under `src/d2c-output/<task>/` following the `d2c-pixso` skill (SOP); a Vite dev server then starts automatically for pixel-level comparison, producing a visual-fidelity score and a structured diff report (region offsets, color deviations, font differences). The results workbench offers overlay, curtain, flicker, and heatmap comparison modes, an SVG annotation layer, and a severity-sorted issue list, so each diff can be accepted or rejected individually and trigger module-level fixes. Once visual review passes, you can import a Swagger/OpenAPI document to auto-generate Axios wrappers and an Express mock server, moving into API integration and interactive acceptance.
|
|
201
|
+
|
|
202
|
+
### VS Code / Qoder
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
npm run vscode:install # install into VS Code
|
|
206
|
+
npm run qoder:install # install into Qoder
|
|
207
|
+
npm run ide:install # auto-select the installed IDE
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
The extension includes the `@flavor` Chat Participant, Mission Control, Changes & Health, Time Machine, diagnostic fixes, CodeLens, checkpoints, and rewind. If `flavor` is not on your `PATH`, set `flavorCode.executable`.
|
|
211
|
+
|
|
212
|
+
## MCP, Skills & Plugins
|
|
213
|
+
|
|
214
|
+
Flavor can connect to stdio or Streamable HTTP MCP servers. Example project configuration:
|
|
215
|
+
|
|
216
|
+
<details>
|
|
217
|
+
<summary><strong>MCP configuration and CLI examples</strong></summary>
|
|
218
|
+
|
|
219
|
+
```json
|
|
220
|
+
{
|
|
221
|
+
"mcpServers": {
|
|
222
|
+
"docs": {
|
|
223
|
+
"url": "https://example.com/mcp",
|
|
224
|
+
"headers": {
|
|
225
|
+
"Authorization": "Bearer ${MCP_TOKEN}"
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
MCP configuration can also be managed from the CLI:
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
flavor mcp list
|
|
236
|
+
flavor mcp add docs --url https://example.com/mcp
|
|
237
|
+
flavor mcp disable docs
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
</details>
|
|
241
|
+
|
|
242
|
+
A Skill is a `SKILL.md` with YAML frontmatter, placed in `.flavor/skills/<name>/` or `~/.flavor-code/skills/<name>/`. Flavor loads skills progressively based on the task, and you can invoke one explicitly with `/<skill-name>`.
|
|
243
|
+
|
|
244
|
+
Plugins live in `.flavor/plugins/` and can register commands, tools, hooks, Skill roots, and model adapters.
|
|
245
|
+
|
|
246
|
+
> [!WARNING]
|
|
247
|
+
> Plugins and agent self-registered tools are in-process JavaScript, not a security sandbox. Only install, enable, and approve code you trust.
|
|
248
|
+
|
|
249
|
+
## Sessions, Memory & Execution Records
|
|
250
|
+
|
|
251
|
+
Project runtime data lives under `.flavor/`:
|
|
252
|
+
|
|
253
|
+
```text
|
|
254
|
+
.flavor/
|
|
255
|
+
├── flavor.json # Project config
|
|
256
|
+
├── sessions/ # Session timelines
|
|
257
|
+
├── session-assets/ # Image attachments
|
|
258
|
+
├── session-trees/ # Session branches
|
|
259
|
+
├── checkpoints/ # Workspace snapshots
|
|
260
|
+
├── memory/ # Long-term memory
|
|
261
|
+
├── traces/ # Optional execution traces
|
|
262
|
+
├── audit.jsonl # Tool failure audits
|
|
263
|
+
├── skills/ # Project skills
|
|
264
|
+
└── plugins/ # Project plugins
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Long-term memory distinguishes user preferences, behavioral feedback, project conventions, and external references. Automatic extraction only keeps high-confidence candidates and provides confirm, ignore, and delete actions; secrets, tokens, raw tool output, and model guesses are rejected.
|
|
268
|
+
|
|
269
|
+
Image prompts support PNG, JPEG, and WebP, with a 5 MiB per-image maximum and up to 5 images per prompt. The desktop app supports picking or drag-and-drop; CLI clipboard images currently work on Windows and macOS.
|
|
270
|
+
|
|
271
|
+
## Permissions & Sandbox
|
|
272
|
+
|
|
273
|
+
| Mode | Behavior |
|
|
274
|
+
| --- | --- |
|
|
275
|
+
| `default` | Reads are auto-approved; writes, Shell, network, and destructive actions are confirmed on demand |
|
|
276
|
+
| `acceptEdits` | Workspace writes and routine verification are auto-approved |
|
|
277
|
+
| `plan` | Read-only planning; no modifications or execution |
|
|
278
|
+
| `bypassPermissions` | The main agent executes as much as possible after hard safety checks |
|
|
279
|
+
| `auto` | A classifier decides, falling back to human approval when uncertain |
|
|
280
|
+
| `bubble` | Uncertain operations bubble up to the main session for approval |
|
|
281
|
+
|
|
282
|
+
> [!CAUTION]
|
|
283
|
+
> Local Shell still runs as your current user. Consider enabling Docker when working with untrusted projects.
|
|
284
|
+
|
|
285
|
+
<details>
|
|
286
|
+
<summary><strong>Docker execution environment example</strong></summary>
|
|
287
|
+
|
|
288
|
+
```json
|
|
289
|
+
{
|
|
290
|
+
"execution": {
|
|
291
|
+
"mode": "docker",
|
|
292
|
+
"image": "node:24-bookworm-slim",
|
|
293
|
+
"network": false,
|
|
294
|
+
"memory": "2g",
|
|
295
|
+
"cpus": 2
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
If Docker is unavailable, tasks fail rather than silently falling back to the host. Sensitive fields in config files and OAuth tokens are encrypted at rest with AES-256-GCM using a local configuration key.
|
|
301
|
+
|
|
302
|
+
</details>
|
|
303
|
+
|
|
304
|
+
## SDK, RPC & Evaluation
|
|
305
|
+
|
|
306
|
+
<details>
|
|
307
|
+
<summary><strong>Node.js SDK example</strong></summary>
|
|
308
|
+
|
|
309
|
+
```ts
|
|
310
|
+
import { createFlavorRuntime } from "flavor-code/sdk";
|
|
311
|
+
|
|
312
|
+
const runtime = await createFlavorRuntime({
|
|
313
|
+
workspace: process.cwd(),
|
|
314
|
+
approvalPolicy: "deny",
|
|
315
|
+
output: console.log,
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
await runtime.session.start();
|
|
319
|
+
await runtime.session.submit("fix the failing tests");
|
|
320
|
+
await runtime.dispose();
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
</details>
|
|
324
|
+
|
|
325
|
+
Other IDEs or languages can integrate over JSONL RPC:
|
|
326
|
+
|
|
327
|
+
```bash
|
|
328
|
+
flavor --mode rpc --workspace . --trace .flavor/traces/run.jsonl
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
Run evaluations:
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
flavor eval eval.json --output report.json
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
Design constraints for RPC, traces, replay, eval, session trees, and Docker are in the [control-plane spec](./docs/specs/2026-07-29-control-plane-sandbox-vscode.md).
|
|
338
|
+
|
|
339
|
+
## Development
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
npm ci
|
|
343
|
+
npm test
|
|
344
|
+
npm run typecheck
|
|
345
|
+
npm run vscode:typecheck
|
|
346
|
+
npm run build
|
|
347
|
+
npm run smoke:install
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
- TypeScript strict, targeting ES2022, Node.js 20+
|
|
351
|
+
- Vitest for unit and integration tests
|
|
352
|
+
- tsup builds the CLI, SDK, Electron main process, and VS Code extension
|
|
353
|
+
- Vite builds the Electron renderer
|
|
354
|
+
- CI covers Windows/macOS with Node 20/24
|
|
355
|
+
|
|
356
|
+
Release builds do not generate or package source maps by default. For a local debugging build, enable them explicitly:
|
|
357
|
+
|
|
358
|
+
```bash
|
|
359
|
+
# macOS / Linux
|
|
360
|
+
FLAVOR_SOURCEMAP=1 npm run build
|
|
361
|
+
|
|
362
|
+
# Windows PowerShell
|
|
363
|
+
$env:FLAVOR_SOURCEMAP = "1"
|
|
364
|
+
npm run build
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
## Documentation
|
|
368
|
+
|
|
369
|
+
- [Technical Design Report](./技术方案报告.md): overall architecture, agent loop, context, permissions, plugins, and security model
|
|
370
|
+
- [Runtime reliability spec](./docs/specs/2026-07-26-runtime-reliability.md)
|
|
371
|
+
- [Control plane, sandbox & VS Code spec](./docs/specs/2026-07-29-control-plane-sandbox-vscode.md)
|
|
372
|
+
- [Multimodal image attachments spec](./docs/specs/2026-07-30-multimodal-image-attachments.md)
|
|
373
|
+
- [D2C design-to-code spec](./docs/specs/2026-08-09-d2c-design-to-code.md)
|
|
374
|
+
- [D2C review & integration spec](./docs/specs/2026-08-10-d2c-review-and-integration.md)
|
|
375
|
+
- [1.2.9 runtime productivity spec](./docs/specs/2026-08-13-runtime-productivity-waves.md)
|
|
376
|
+
- [VS Code next steps](./docs/specs/2026-08-01-flavor-code-vscode-next.md)
|
|
377
|
+
|
|
378
|
+
## Security Notes
|
|
379
|
+
|
|
380
|
+
- Review model-generated code and commands, especially dependency installs, scripts, and deletions.
|
|
381
|
+
- Do not treat `.flavor/sessions/`, traces, or long-term memory as secret stores.
|
|
382
|
+
- Use least-privilege API keys and never commit `.env`.
|
|
383
|
+
- Skill content can influence model behavior; plugins and self-registered tools also have in-process Node.js permissions.
|
|
384
|
+
- Work under version control and create checkpoints before high-risk tasks.
|
|
385
|
+
|
|
386
|
+
## Contributing
|
|
387
|
+
|
|
388
|
+
Issues and Pull Requests are welcome. Please at least run the following before submitting:
|
|
389
|
+
|
|
390
|
+
```bash
|
|
391
|
+
npm test
|
|
392
|
+
npm run typecheck
|
|
393
|
+
npm run vscode:typecheck
|
|
394
|
+
npm run build
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
For architecture changes, read the [Technical Design Report](./技术方案报告.md) and the relevant [design specs](./docs/specs/) first.
|
|
398
|
+
|
|
399
|
+
## License
|
|
400
|
+
|
|
401
|
+
[MIT](./LICENSE)
|
|
402
|
+
|
|
403
|
+
<p align="center">
|
|
404
|
+
Made with 🌶️ by Flavor Code contributors.
|
|
405
|
+
</p>
|