minicode-ai 0.27.0 → 0.30.0
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 +1 -1
- package/cli/args.ts +184 -57
- package/cli/bootstrap/presentation-bridge.ts +383 -0
- package/cli/commands/acp.ts +45 -29
- package/cli/commands/auth.ts +17 -17
- package/cli/commands/config.ts +65 -66
- package/cli/commands/daemon.ts +44 -16
- package/cli/commands/doctor.ts +18 -15
- package/cli/commands/exec.ts +41 -89
- package/cli/commands/mcp.ts +25 -8
- package/cli/commands/memory.ts +16 -24
- package/cli/commands/openwork.ts +6 -2
- package/cli/commands/pricing.ts +14 -12
- package/cli/commands/providers.ts +36 -57
- package/cli/commands/sessions.ts +24 -18
- package/cli/commands/skills.ts +33 -18
- package/cli/commands/stats.ts +15 -30
- package/cli/commands.ts +73 -44
- package/cli/context-command-run.ts +30 -18
- package/cli/index.ts +51 -100
- package/cli/model-manager.ts +7 -2
- package/cli/provider-manager.ts +33 -18
- package/cli/router.ts +41 -12
- package/cli/setup.ts +241 -485
- package/cli/tui.ts +303 -100
- package/docs/TERMINAL_CONTRACT.md +258 -73
- package/docs/UI_RENDER_PIPELINE.md +9 -1
- package/docs/agents.md +2 -2
- package/docs/architecture.md +17 -32
- package/docs/choosing-mode.md +7 -9
- package/docs/cli.md +3 -5
- package/docs/environment.md +1 -2
- package/docs/policy-sandbox.md +3 -3
- package/docs/repl.md +2 -2
- package/docs/tools.md +1 -1
- package/package.json +1 -1
- package/src/app/mentions.ts +60 -13
- package/src/app/rag-layer.ts +17 -20
- package/src/app/session.ts +144 -68
- package/src/app/tool-layer.ts +38 -16
- package/src/config.ts +64 -104
- package/src/constants.ts +4 -6
- package/src/daemon/capability.ts +8 -1
- package/src/daemon/control.ts +3 -2
- package/src/daemon/server.ts +57 -0
- package/src/hooks/run.ts +73 -41
- package/src/lib/atomic-write.ts +31 -59
- package/src/lib/db-path.ts +47 -0
- package/src/lib/process-tree.ts +62 -0
- package/src/lib/public-http.ts +88 -23
- package/src/lib/trusted-exec.ts +48 -1
- package/src/lsp/client.ts +62 -17
- package/src/mcp/client.ts +85 -38
- package/src/mcp/http-transport.ts +28 -16
- package/src/mcp/transport.ts +42 -6
- package/src/memory/files.ts +164 -134
- package/src/memory/vector.ts +371 -420
- package/src/policy/approval-binding.ts +122 -45
- package/src/policy/bash-guard.ts +18 -7
- package/src/policy/compaction.ts +51 -18
- package/src/policy/context-window.ts +31 -8
- package/src/policy/context.ts +62 -36
- package/src/policy/executor.ts +17 -7
- package/src/policy/jail.ts +6 -8
- package/src/policy/microcompact.ts +4 -3
- package/src/policy/no-progress.ts +103 -22
- package/src/policy/permission.ts +36 -12
- package/src/policy/tool-contract.ts +74 -416
- package/src/policy/usage.ts +24 -2
- package/src/policy/verifier.ts +50 -2
- package/src/policy/work-mode.ts +28 -54
- package/src/presentation/adapter.ts +24 -16
- package/src/providers/anthropic.ts +16 -5
- package/src/providers/provision.ts +6 -56
- package/src/providers/responses.ts +38 -7
- package/src/providers/sse-bounds.ts +6 -4
- package/src/runtime/execution-journal.ts +4 -29
- package/src/sandbox/docker.ts +58 -34
- package/src/sandbox/mask.ts +157 -0
- package/src/sandbox/os.ts +107 -73
- package/src/session/authority.ts +29 -10
- package/src/session/context-projection.ts +6 -5
- package/src/session/db/runs.ts +397 -0
- package/src/session/db/schema.ts +358 -0
- package/src/session/open-work.ts +26 -3
- package/src/session/persistence.ts +74 -998
- package/src/session/verification.ts +170 -20
- package/src/skills/loader.ts +31 -16
- package/src/task/db/schema.ts +325 -0
- package/src/task/db/types.ts +269 -0
- package/src/task/production-scheduler.ts +13 -1
- package/src/task/store.ts +92 -1021
- package/src/telemetry/trace.ts +27 -0
- package/src/tools/ask_user.ts +1 -13
- package/src/tools/bash.ts +27 -92
- package/src/tools/code_run.ts +1 -1
- package/src/tools/context.ts +133 -0
- package/src/tools/delete_file.ts +3 -2
- package/src/tools/edit.ts +37 -72
- package/src/tools/git.ts +86 -9
- package/src/tools/glob.ts +26 -51
- package/src/tools/grep.ts +67 -57
- package/src/tools/hashline.ts +4 -0
- package/src/tools/lsp.ts +11 -8
- package/src/tools/mcp_call.ts +9 -6
- package/src/tools/memory.ts +56 -33
- package/src/tools/move_file.ts +36 -10
- package/src/tools/patch.ts +13 -21
- package/src/tools/read_file.ts +18 -25
- package/src/tools/read_image.ts +35 -33
- package/src/tools/submit_result.ts +29 -8
- package/src/tools/task.ts +74 -17
- package/src/tools/todo.ts +181 -74
- package/src/tools/web_fetch.ts +42 -2
- package/src/tools/web_search.ts +47 -8
- package/src/ui/approval/prompt.ts +206 -47
- package/src/ui/assistant/turn-status.ts +14 -5
- package/src/ui/footer.ts +4 -4
- package/src/ui/i18n/en.ts +47 -23
- package/src/ui/i18n/id.ts +76 -51
- package/src/ui/input/input.ts +4 -3
- package/src/ui/input/prompt-engine.ts +35 -5
- package/src/ui/render/activity-panel.ts +4 -2
- package/src/ui/render/hint.ts +7 -4
- package/src/ui/render/list.ts +32 -0
- package/src/ui/render/markdown.ts +6 -3
- package/src/ui/render/notice.ts +19 -0
- package/src/ui/render/table-grid.ts +7 -8
- package/src/ui/render/theme.ts +113 -39
- package/src/ui/runtime/screen.ts +74 -10
- package/src/ui/runtime/spinner.ts +19 -6
- package/src/ui/screens/dialog.ts +19 -1
- package/src/ui/screens/form.ts +80 -35
- package/src/ui/screens/model-manager.ts +82 -61
- package/src/ui/screens/output-window.ts +263 -0
- package/src/ui/screens/picker.ts +94 -81
- package/src/ui/screens/provider-manager.ts +100 -69
- package/src/ui/screens/wizard.ts +117 -28
- package/src/ui/tui/app.ts +196 -33
- package/src/ui/tui/transcript.ts +158 -25
- package/vendor/minicore/src/core/executor.ts +2 -0
- package/vendor/minicore/src/core/loop.ts +17 -6
- package/vendor/minicore/src/core/session.ts +3 -0
- package/vendor/minicore/src/core/tool.ts +1 -0
- package/vendor/minicore/src/providers/openai-compat.ts +35 -19
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ minicode providers # inspect configured providers
|
|
|
34
34
|
minicode exec "task" --json # machine-readable event stream
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
WorkMode controls how the agent works (`DISCUSS
|
|
37
|
+
WorkMode controls how the agent works (`DISCUSS` or `BUILD`); permission settings and tool access policy control which actions require approval or are available. Read [Choosing a mode](docs/choosing-mode.md) before granting write or execution access. `--sandbox docker` requests an isolated container for shell execution; the [security guide](docs/security.md) explains the remaining boundaries.
|
|
38
38
|
|
|
39
39
|
## Documentation
|
|
40
40
|
|
package/cli/args.ts
CHANGED
|
@@ -1,62 +1,110 @@
|
|
|
1
1
|
// Pure arg-parsing helpers - dipisah dari cli/index.ts agar mudah diuji.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
import { sanitizeAnsiLine } from "../src/ui/render/sanitize.ts"
|
|
3
|
+
|
|
4
|
+
export type CliFlagKind = "boolean" | "value" | "meta"
|
|
5
|
+
|
|
6
|
+
export interface CliFlagSpec {
|
|
7
|
+
readonly kind: CliFlagKind
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// Tabel deklaratif tunggal seluruh flag CLI yang dikenal parser — BOOLEAN_FLAGS,
|
|
11
|
+
// VALUE_FLAGS, dan KNOWN_FLAGS diturunkan darinya agar tidak menyimpang.
|
|
12
|
+
export const CLI_FLAG_SPECS: Readonly<Record<string, CliFlagSpec>> = {
|
|
13
|
+
// ── Flag meta ─────────────────────────────────────────────────────────────
|
|
14
|
+
"-h": { kind: "meta" },
|
|
15
|
+
"--help": { kind: "meta" },
|
|
16
|
+
"-v": { kind: "meta" },
|
|
17
|
+
"--version": { kind: "meta" },
|
|
18
|
+
|
|
19
|
+
// ── Flag boolean ──────────────────────────────────────────────────────────
|
|
20
|
+
"--verbose": { kind: "boolean" },
|
|
21
|
+
"--allow-all": { kind: "boolean" },
|
|
22
|
+
"-y": { kind: "boolean" }, // alias ringkas untuk --allow-all
|
|
23
|
+
"--ask": { kind: "boolean" },
|
|
24
|
+
"--interactive": { kind: "boolean" },
|
|
25
|
+
"--tui": { kind: "boolean" }, // alias usang: TUI fullscreen kini satu-satunya tampilan interaktif
|
|
26
|
+
"--verify": { kind: "boolean" },
|
|
27
|
+
"--allowlist": { kind: "boolean" },
|
|
28
|
+
"--json": { kind: "boolean" }, // dipakai `exec --json` dan `--help --json`
|
|
29
|
+
"--budget-strict": { kind: "boolean" }, // penegasan eksplisit fail-closed (kini juga default --budget)
|
|
30
|
+
"--allow-local-config": { kind: "boolean" }, // opt-in: baca .minicode/config.json + allowlist lokal (default mati)
|
|
31
|
+
// flag boolean subcommand — harus di sini agar router tidak memakan token berikutnya sebagai nilai
|
|
32
|
+
"--allow-private": { kind: "boolean" },
|
|
33
|
+
"--jsonl": { kind: "boolean" },
|
|
34
|
+
"--all-tools": { kind: "boolean" },
|
|
35
|
+
"--global": { kind: "boolean" },
|
|
36
|
+
"--local": { kind: "boolean" },
|
|
37
|
+
"--auto-continue": { kind: "boolean" },
|
|
38
|
+
"--blocked": { kind: "boolean" },
|
|
39
|
+
"--closed": { kind: "boolean" },
|
|
40
|
+
"--force": { kind: "boolean" },
|
|
14
41
|
// [PHASE 6U] Experimental. Opt-in gate for autonomous Scheduler execution.
|
|
15
42
|
// DEFAULT OFF. A CLI flag and not a config key or env var on purpose: env is
|
|
16
43
|
// inherited by sub-agents and MCP servers, and config is inherited globally or
|
|
17
44
|
// per-repo — both would let autonomous execution switch on without the person
|
|
18
45
|
// running the process asking for it. See src/task/production-scheduler.ts.
|
|
19
|
-
"--enable-scheduler",
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"--cwd",
|
|
23
|
-
"--resume",
|
|
24
|
-
"--model",
|
|
25
|
-
"--provider",
|
|
26
|
-
"--session",
|
|
27
|
-
"--max-steps",
|
|
28
|
-
"--context-window",
|
|
29
|
-
"--timeout",
|
|
30
|
-
"--sandbox",
|
|
31
|
-
"--ratelimit",
|
|
32
|
-
"--budget",
|
|
33
|
-
"--tool-scope", // full | explore (read-only) — tanpa ini jadi kata prompt!
|
|
34
|
-
"--work-mode", // DISCUSS |
|
|
46
|
+
"--enable-scheduler": { kind: "boolean" },
|
|
47
|
+
|
|
48
|
+
// ── Flag bernilai ─────────────────────────────────────────────────────────
|
|
49
|
+
"--cwd": { kind: "value" },
|
|
50
|
+
"--resume": { kind: "value" },
|
|
51
|
+
"--model": { kind: "value" },
|
|
52
|
+
"--provider": { kind: "value" },
|
|
53
|
+
"--session": { kind: "value" },
|
|
54
|
+
"--max-steps": { kind: "value" },
|
|
55
|
+
"--context-window": { kind: "value" },
|
|
56
|
+
"--timeout": { kind: "value" },
|
|
57
|
+
"--sandbox": { kind: "value" },
|
|
58
|
+
"--ratelimit": { kind: "value" },
|
|
59
|
+
"--budget": { kind: "value" },
|
|
60
|
+
"--tool-scope": { kind: "value" }, // full | explore (read-only) — tanpa ini jadi kata prompt!
|
|
61
|
+
"--work-mode": { kind: "value" }, // DISCUSS | BUILD — HARUS dikenal agar tak bocor ke prompt.
|
|
62
|
+
"--mode": { kind: "value" }, // alias ringkas untuk --work-mode (DISCUSS | BUILD)
|
|
35
63
|
// [P1 M15] Mode runtime produksi (off | constructed | owned). HARUS terdaftar:
|
|
36
64
|
// flag tak dikenal menghentikan scan `hasFlag`/`getArg` (dianggap prompt
|
|
37
65
|
// boundary), sehingga flag yang diletakkan SETELAH `--runtime` akan hilang
|
|
38
66
|
// diam-diam — tepat kebocoran semantik yang ingin dicegah audit flag.
|
|
39
|
-
"--runtime",
|
|
40
|
-
"--output-format", // `exec --output-format=json`
|
|
41
|
-
"--prompt",
|
|
67
|
+
"--runtime": { kind: "value" },
|
|
68
|
+
"--output-format": { kind: "value" }, // `exec --output-format=json`
|
|
69
|
+
"--prompt": { kind: "value" },
|
|
42
70
|
// subcommand flags — harus dikenal agar tidak bocor ke prompt one-shot
|
|
43
|
-
"--baseUrl",
|
|
44
|
-
"--apiKey",
|
|
45
|
-
"--id",
|
|
46
|
-
"--command",
|
|
47
|
-
"--args",
|
|
48
|
-
"--env",
|
|
49
|
-
"--header",
|
|
50
|
-
"--
|
|
51
|
-
"--
|
|
52
|
-
"--
|
|
53
|
-
"--
|
|
54
|
-
"--
|
|
55
|
-
"--
|
|
56
|
-
"--
|
|
57
|
-
|
|
71
|
+
"--baseUrl": { kind: "value" },
|
|
72
|
+
"--apiKey": { kind: "value" },
|
|
73
|
+
"--id": { kind: "value" },
|
|
74
|
+
"--command": { kind: "value" },
|
|
75
|
+
"--args": { kind: "value" },
|
|
76
|
+
"--env": { kind: "value" },
|
|
77
|
+
"--header": { kind: "value" },
|
|
78
|
+
"--url": { kind: "value" },
|
|
79
|
+
"--match": { kind: "value" },
|
|
80
|
+
"--adopt-task": { kind: "value" },
|
|
81
|
+
"--max-turns": { kind: "value" },
|
|
82
|
+
"--port": { kind: "value" },
|
|
83
|
+
"--who": { kind: "value" },
|
|
84
|
+
"--scopes": { kind: "value" },
|
|
85
|
+
"--ttl": { kind: "value" },
|
|
86
|
+
"--hash": { kind: "value" },
|
|
87
|
+
"--status": { kind: "value" },
|
|
88
|
+
"--state": { kind: "value" },
|
|
89
|
+
"--priority": { kind: "value" },
|
|
90
|
+
"--min-age-days": { kind: "value" },
|
|
91
|
+
"--depends-on": { kind: "value" },
|
|
92
|
+
"--stale-days": { kind: "value" },
|
|
93
|
+
"--keep": { kind: "value" },
|
|
94
|
+
"--drop": { kind: "value" },
|
|
95
|
+
"--evidence": { kind: "value" },
|
|
96
|
+
"--task": { kind: "value" },
|
|
97
|
+
"--format": { kind: "value" },
|
|
98
|
+
"--out": { kind: "value" },
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const VALUE_FLAGS = new Set(
|
|
102
|
+
Object.entries(CLI_FLAG_SPECS)
|
|
103
|
+
.filter(([, spec]) => spec.kind === "value")
|
|
104
|
+
.map(([name]) => name),
|
|
105
|
+
)
|
|
58
106
|
export const valueFlags = VALUE_FLAGS
|
|
59
|
-
const KNOWN_FLAGS = new Set(
|
|
107
|
+
const KNOWN_FLAGS = new Set(Object.keys(CLI_FLAG_SPECS))
|
|
60
108
|
|
|
61
109
|
/** `--flag` atau `--flag=value` -> normalisasi ke nama flag murni. */
|
|
62
110
|
export function flagNameOf(token: string): string | null {
|
|
@@ -95,21 +143,100 @@ export function hasFlag(argv: string[], name: string): boolean {
|
|
|
95
143
|
|
|
96
144
|
/** Opt-in config lokal untuk alur sesi utama (index/exec): flag eksplisit
|
|
97
145
|
* operator ATAU env (keduanya default mati). Memakai hasFlag yang
|
|
98
|
-
* boundary-aware: flag di DALAM teks prompt tidak dihitung (anti-injeksi).
|
|
99
|
-
* Handler subcommand (config/providers/…) memakai args.includes langsung
|
|
100
|
-
* karena argv-nya selalu diawali positional subcommand. */
|
|
146
|
+
* boundary-aware: flag di DALAM teks prompt tidak dihitung (anti-injeksi). */
|
|
101
147
|
export function allowLocalConfig(argv: string[]): boolean {
|
|
102
148
|
return hasFlag(argv, "--allow-local-config") || process.env.MINICODE_ALLOW_LOCAL_CONFIG === "1"
|
|
103
149
|
}
|
|
104
150
|
|
|
105
|
-
|
|
151
|
+
/** Cek --allow-local-config / env pada argv subcommand. */
|
|
152
|
+
export function allowLocalSubcommand(argv: readonly string[]): boolean {
|
|
153
|
+
return argv.includes("--allow-local-config") || process.env.MINICODE_ALLOW_LOCAL_CONFIG === "1"
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** Ambil positional ke-`index` dari argv subcommand (tolak `-*`). */
|
|
157
|
+
export function positionalSubArg(argv: readonly string[], index: number): string | undefined {
|
|
158
|
+
const v = argv[index]
|
|
159
|
+
return v && !v.startsWith("-") ? v : undefined
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** Cek apakah argv subcommand meminta `--help` / `-h`. */
|
|
163
|
+
export function hasHelpFlag(argv: readonly string[]): boolean {
|
|
164
|
+
return argv.includes("--help") || argv.includes("-h")
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** Tangani `--help`/`-h` (exit 0) dan positional tak terduga (exit 2) secara seragam. */
|
|
168
|
+
export function guardSubcommand(
|
|
169
|
+
args: readonly string[],
|
|
170
|
+
cmd: string,
|
|
171
|
+
help: string,
|
|
172
|
+
out: (s: string) => void,
|
|
173
|
+
err: (s: string) => void,
|
|
174
|
+
extraIndex = 1,
|
|
175
|
+
): void {
|
|
176
|
+
if (hasHelpFlag(args)) {
|
|
177
|
+
out(help)
|
|
178
|
+
process.exit(0)
|
|
179
|
+
}
|
|
180
|
+
if (extraIndex >= 0) {
|
|
181
|
+
const extra = positionalSubArg(args, extraIndex)
|
|
182
|
+
if (extra) {
|
|
183
|
+
err(`unknown ${cmd} subcommand: ${sanitizeAnsiLine(extra)}\n${help}`)
|
|
184
|
+
process.exit(2)
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** Parse argumen toggle (`/compact`, `/thinking`, `/fold`, `/minimize`, `/unrestric`). */
|
|
190
|
+
export function parseToggleArg(raw: string): boolean | undefined | "invalid" {
|
|
191
|
+
const norm = raw.trim().toLowerCase()
|
|
192
|
+
if (norm === "") return undefined
|
|
193
|
+
if (norm === "on" || norm === "1") return true
|
|
194
|
+
if (norm === "off" || norm === "0") return false
|
|
195
|
+
return "invalid"
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** Parse flag numerik runtime + peringatan seragam untuk CLI utama & `exec`. */
|
|
199
|
+
export function parseNumericFlag(
|
|
200
|
+
getArg: (name: string) => string | undefined,
|
|
201
|
+
flag: string,
|
|
202
|
+
kind: "positive" | "non-negative" | "usd",
|
|
203
|
+
warn: (msg: string) => void,
|
|
204
|
+
): number | undefined {
|
|
205
|
+
const raw = getArg(flag)
|
|
206
|
+
if (!raw) return undefined
|
|
207
|
+
const n = Number(raw)
|
|
208
|
+
if (Number.isFinite(n) && (kind === "positive" ? n > 0 : n >= 0)) return n
|
|
209
|
+
const label = kind === "usd" ? "USD number" : `${kind} number`
|
|
210
|
+
warn(`[warn] ${flag} requires a ${label}, ignoring "${raw}"\n`)
|
|
211
|
+
return undefined
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export function parseRuntimeNumericFlags(
|
|
215
|
+
getArg: (name: string) => string | undefined,
|
|
216
|
+
warn: (msg: string) => void,
|
|
217
|
+
) {
|
|
218
|
+
return {
|
|
219
|
+
maxSteps: parseNumericFlag(getArg, "--max-steps", "positive", warn),
|
|
220
|
+
contextWindowTokens: parseNumericFlag(getArg, "--context-window", "positive", warn),
|
|
221
|
+
timeoutMs: parseNumericFlag(getArg, "--timeout", "non-negative", warn),
|
|
222
|
+
budget: parseNumericFlag(getArg, "--budget", "usd", warn),
|
|
223
|
+
ratelimitRpm: parseNumericFlag(getArg, "--ratelimit", "positive", warn),
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export function resolveToolScope(getArg: (name: string) => string | undefined): "explore" | "full" {
|
|
228
|
+
const raw = (getArg("--tool-scope") ?? process.env.MINICODE_TOOL_SCOPE ?? "").toLowerCase()
|
|
229
|
+
return raw === "explore" ? "explore" : "full"
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export type CliWorkMode = "DISCUSS" | "EXECUTE"
|
|
106
233
|
|
|
107
|
-
/** Parse
|
|
234
|
+
/** Parse dua nilai Work Mode yang ditampilkan ke operator (DISCUSS | BUILD). */
|
|
108
235
|
export function parseWorkModeValue(raw: string): CliWorkMode | undefined {
|
|
109
236
|
const norm = raw.trim().toUpperCase()
|
|
110
237
|
// BUILD adalah nama produk untuk identitas runtime EXECUTE.
|
|
111
238
|
if (norm === "BUILD") return "EXECUTE"
|
|
112
|
-
if (norm === "DISCUSS"
|
|
239
|
+
if (norm === "DISCUSS") return norm
|
|
113
240
|
return undefined
|
|
114
241
|
}
|
|
115
242
|
|
|
@@ -118,7 +245,7 @@ export function parseWorkModeValue(raw: string): CliWorkMode | undefined {
|
|
|
118
245
|
* ditampilkan sebagai `BUILD`. Dipakai footer, /status, help, dan i18n agar
|
|
119
246
|
* semua permukaan konsisten, tanpa mengubah identitas runtime/persistence.
|
|
120
247
|
*/
|
|
121
|
-
export function displayWorkMode(workMode: CliWorkMode): "DISCUSS" | "
|
|
248
|
+
export function displayWorkMode(workMode: CliWorkMode): "DISCUSS" | "BUILD" {
|
|
122
249
|
return workMode === "EXECUTE" ? "BUILD" : workMode
|
|
123
250
|
}
|
|
124
251
|
|
|
@@ -136,14 +263,14 @@ export function resolveWorkModeFlag(getArg: (n: string) => string | undefined):
|
|
|
136
263
|
explicit: boolean
|
|
137
264
|
warning?: string
|
|
138
265
|
} {
|
|
139
|
-
const raw = getArg("--work-mode") ?? process.env.MINICODE_WORK_MODE
|
|
266
|
+
const raw = getArg("--work-mode") ?? getArg("--mode") ?? process.env.MINICODE_WORK_MODE
|
|
140
267
|
if (raw === undefined) return { workMode: "DISCUSS", explicit: false }
|
|
141
268
|
const parsed = parseWorkModeValue(raw)
|
|
142
269
|
if (parsed) return { workMode: parsed, explicit: true }
|
|
143
270
|
return {
|
|
144
271
|
workMode: "DISCUSS",
|
|
145
272
|
explicit: true,
|
|
146
|
-
warning: `--work-mode requires DISCUSS|
|
|
273
|
+
warning: `--work-mode requires DISCUSS|BUILD, ignoring "${raw}" (using DISCUSS)`,
|
|
147
274
|
}
|
|
148
275
|
}
|
|
149
276
|
|
|
@@ -217,7 +344,7 @@ export function promptFromArgs(argv: string[]): string {
|
|
|
217
344
|
}
|
|
218
345
|
continue
|
|
219
346
|
}
|
|
220
|
-
if (
|
|
347
|
+
if (!VALUE_FLAGS.has(fname)) continue
|
|
221
348
|
// value flag sebelum prompt: lewati flag + nilainya
|
|
222
349
|
if (!a.includes("=")) i++
|
|
223
350
|
}
|