minicode-ai 0.9.26
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 +935 -0
- package/LICENSE +21 -0
- package/README.md +200 -0
- package/cli/args.ts +195 -0
- package/cli/auto-update.ts +108 -0
- package/cli/commands/auth.ts +166 -0
- package/cli/commands/config.ts +382 -0
- package/cli/commands/doctor.ts +128 -0
- package/cli/commands/exec.ts +179 -0
- package/cli/commands/mcp.ts +35 -0
- package/cli/commands/memory.ts +107 -0
- package/cli/commands/pricing.ts +100 -0
- package/cli/commands/providers.ts +162 -0
- package/cli/commands/sessions.ts +128 -0
- package/cli/commands/skills.ts +61 -0
- package/cli/commands/stats.ts +82 -0
- package/cli/commands.ts +317 -0
- package/cli/index.ts +539 -0
- package/cli/model-manager.ts +112 -0
- package/cli/provider-manager.ts +111 -0
- package/cli/repl.ts +734 -0
- package/cli/router.ts +124 -0
- package/cli/setup.ts +780 -0
- package/cli/wizard.ts +21 -0
- package/docs/ARCHITECTURE.html +1222 -0
- package/docs/README.md +109 -0
- package/docs/architecture.md +44 -0
- package/docs/changelog.md +3 -0
- package/package.json +91 -0
- package/src/agents/pool.ts +43 -0
- package/src/app/mentions.ts +50 -0
- package/src/app/provider-layer.ts +118 -0
- package/src/app/rag-layer.ts +105 -0
- package/src/app/session.ts +154 -0
- package/src/app/tool-layer.ts +56 -0
- package/src/config.ts +372 -0
- package/src/constants.ts +119 -0
- package/src/hooks/run.ts +89 -0
- package/src/lib/atomic-write.ts +88 -0
- package/src/lib/db-path.ts +36 -0
- package/src/lib/git-hardening.ts +91 -0
- package/src/lib/ignore.ts +58 -0
- package/src/lib/keystore.ts +202 -0
- package/src/lib/net.ts +70 -0
- package/src/lib/safe-open.ts +138 -0
- package/src/lib/session-id.ts +23 -0
- package/src/lib/trash.ts +38 -0
- package/src/lib/trusted-exec.ts +81 -0
- package/src/lsp/client.ts +395 -0
- package/src/mcp/client.ts +400 -0
- package/src/mcp/http-transport.ts +344 -0
- package/src/mcp/server.ts +538 -0
- package/src/mcp/transport.ts +150 -0
- package/src/memory/files.ts +159 -0
- package/src/memory/vector.ts +775 -0
- package/src/policy/allowlist.ts +67 -0
- package/src/policy/bash-guard.ts +465 -0
- package/src/policy/compaction.ts +271 -0
- package/src/policy/context.ts +161 -0
- package/src/policy/executor.ts +199 -0
- package/src/policy/jail.ts +127 -0
- package/src/policy/permission.ts +517 -0
- package/src/policy/pricing.ts +336 -0
- package/src/policy/ratelimit.ts +54 -0
- package/src/policy/sandbox-policy.ts +157 -0
- package/src/policy/scrub.ts +138 -0
- package/src/policy/update-check.ts +200 -0
- package/src/policy/usage.ts +292 -0
- package/src/policy/verifier.ts +181 -0
- package/src/providers/anthropic.ts +401 -0
- package/src/providers/auth-store.ts +139 -0
- package/src/providers/build.ts +136 -0
- package/src/providers/detect.ts +126 -0
- package/src/providers/effort.ts +165 -0
- package/src/providers/guards.ts +107 -0
- package/src/providers/oauth.ts +326 -0
- package/src/providers/presets.ts +122 -0
- package/src/providers/provision.ts +298 -0
- package/src/providers/responses.ts +371 -0
- package/src/providers/router.ts +247 -0
- package/src/repo/repomap.ts +470 -0
- package/src/sandbox/docker.ts +129 -0
- package/src/sandbox/os.ts +193 -0
- package/src/session/checkpoint.ts +543 -0
- package/src/session/journal.ts +1347 -0
- package/src/session/persistence.ts +446 -0
- package/src/session/shadow-git.ts +351 -0
- package/src/session/turn-marker.ts +118 -0
- package/src/skills/loader.ts +117 -0
- package/src/telemetry/trace.ts +283 -0
- package/src/tools/ask_user.ts +54 -0
- package/src/tools/bash.ts +400 -0
- package/src/tools/code_run.ts +96 -0
- package/src/tools/delete_file.ts +31 -0
- package/src/tools/edit.ts +204 -0
- package/src/tools/git.ts +301 -0
- package/src/tools/glob.ts +90 -0
- package/src/tools/grep.ts +281 -0
- package/src/tools/hashline.ts +66 -0
- package/src/tools/index.ts +103 -0
- package/src/tools/lsp.ts +346 -0
- package/src/tools/mcp_call.ts +163 -0
- package/src/tools/memory.ts +144 -0
- package/src/tools/move_file.ts +47 -0
- package/src/tools/patch.ts +86 -0
- package/src/tools/read_file.ts +130 -0
- package/src/tools/read_image.ts +80 -0
- package/src/tools/submit_result.ts +49 -0
- package/src/tools/task.ts +346 -0
- package/src/tools/todo.ts +201 -0
- package/src/tools/web_fetch.ts +161 -0
- package/src/tools/web_search.ts +156 -0
- package/src/tools/write_file.ts +42 -0
- package/src/ui/approval/prompt.ts +76 -0
- package/src/ui/assistant/simple.ts +568 -0
- package/src/ui/assistant/turn-status.ts +303 -0
- package/src/ui/contract.ts +55 -0
- package/src/ui/footer.ts +105 -0
- package/src/ui/input/input.ts +805 -0
- package/src/ui/input/prompt-engine.ts +606 -0
- package/src/ui/render/collapse.ts +84 -0
- package/src/ui/render/detail.ts +24 -0
- package/src/ui/render/diff.ts +181 -0
- package/src/ui/render/errors.ts +239 -0
- package/src/ui/render/format.ts +54 -0
- package/src/ui/render/highlight.ts +294 -0
- package/src/ui/render/markdown.ts +120 -0
- package/src/ui/render/money.ts +12 -0
- package/src/ui/render/reasoning.ts +20 -0
- package/src/ui/render/sanitize.ts +80 -0
- package/src/ui/render/table.ts +88 -0
- package/src/ui/render/theme.ts +339 -0
- package/src/ui/render/width.ts +256 -0
- package/src/ui/render/wrap.ts +120 -0
- package/src/ui/runtime/bus-debug.ts +83 -0
- package/src/ui/runtime/chrome.ts +301 -0
- package/src/ui/runtime/spinner.ts +77 -0
- package/src/ui/runtime/statusline.ts +227 -0
- package/src/ui/screens/model-manager.ts +434 -0
- package/src/ui/screens/overlay.ts +61 -0
- package/src/ui/screens/picker.ts +307 -0
- package/src/ui/screens/provider-manager.ts +450 -0
- package/src/ui/screens/wizard.ts +132 -0
- package/vendor/minicore/VENDOR.md +29 -0
- package/vendor/minicore/package.json +21 -0
- package/vendor/minicore/src/core/budget.ts +26 -0
- package/vendor/minicore/src/core/compact.ts +76 -0
- package/vendor/minicore/src/core/errors.ts +60 -0
- package/vendor/minicore/src/core/events.ts +74 -0
- package/vendor/minicore/src/core/executor.ts +139 -0
- package/vendor/minicore/src/core/history.ts +32 -0
- package/vendor/minicore/src/core/index.ts +42 -0
- package/vendor/minicore/src/core/loop.ts +344 -0
- package/vendor/minicore/src/core/permission.ts +24 -0
- package/vendor/minicore/src/core/provider.ts +39 -0
- package/vendor/minicore/src/core/recovery.ts +34 -0
- package/vendor/minicore/src/core/session.ts +327 -0
- package/vendor/minicore/src/core/snapshot.ts +142 -0
- package/vendor/minicore/src/core/tokens.ts +111 -0
- package/vendor/minicore/src/core/tool.ts +118 -0
- package/vendor/minicore/src/core/types.ts +50 -0
- package/vendor/minicore/src/providers/openai-compat.ts +366 -0
package/cli/router.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { flagNameOf, valueFlags } from "./args.ts"
|
|
2
|
+
|
|
3
|
+
export async function dispatch(
|
|
4
|
+
args: string[],
|
|
5
|
+
_getArg: (name: string) => string | undefined,
|
|
6
|
+
HELP: string,
|
|
7
|
+
): Promise<boolean> {
|
|
8
|
+
let cmdIndex = -1
|
|
9
|
+
for (let i = 0; i < args.length; i++) {
|
|
10
|
+
const token = args[i]
|
|
11
|
+
if (!token) continue
|
|
12
|
+
if (token === "--") break
|
|
13
|
+
const flag = flagNameOf(token)
|
|
14
|
+
if (flag) {
|
|
15
|
+
if (valueFlags.has(flag) && !token.includes("=")) i++
|
|
16
|
+
continue
|
|
17
|
+
}
|
|
18
|
+
if (!token.startsWith("-")) {
|
|
19
|
+
cmdIndex = i
|
|
20
|
+
break
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const cmd = cmdIndex >= 0 ? args[cmdIndex] : undefined
|
|
24
|
+
if (!cmd) return false
|
|
25
|
+
|
|
26
|
+
// P10 P0.1 — scoped argv agar --cwd/--json setelah subcommand tetap terbaca.
|
|
27
|
+
// getArg global berhenti di token subcommand (boundary anti-injeksi P8),
|
|
28
|
+
// sehingga `minicode sessions list --cwd /tmp` mengembalikan undefined.
|
|
29
|
+
// Bangun subArgv = [flag global sebelum cmd + args dari cmd] dan getArg
|
|
30
|
+
// yang beroperasi di atasnya; teruskan sebagai getArg kedua ke handler.
|
|
31
|
+
const subArgv: string[] = []
|
|
32
|
+
for (let i = 0; i < cmdIndex; i++) {
|
|
33
|
+
const t = args[i]
|
|
34
|
+
if (!t) continue
|
|
35
|
+
const flag = flagNameOf(t)
|
|
36
|
+
if (flag) {
|
|
37
|
+
subArgv.push(t)
|
|
38
|
+
if (valueFlags.has(flag) && !t.includes("=") && i + 1 < cmdIndex) {
|
|
39
|
+
const v = args[i + 1]
|
|
40
|
+
if (v !== undefined) {
|
|
41
|
+
subArgv.push(v)
|
|
42
|
+
i++
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
subArgv.push(...args.slice(cmdIndex))
|
|
48
|
+
// subGetArg untuk handler: cari flag di subArgv TANPA boundary prompt,
|
|
49
|
+
// karena token subcommand ("sessions") sendiri akan memicu early-return di
|
|
50
|
+
// getArg global. Scan sederhana last-wins.
|
|
51
|
+
const subGetArg = (name: string): string | undefined => {
|
|
52
|
+
let found: string | undefined
|
|
53
|
+
for (let i = 0; i < subArgv.length; i++) {
|
|
54
|
+
const a = subArgv[i]
|
|
55
|
+
if (a === undefined) continue
|
|
56
|
+
if (a === name) {
|
|
57
|
+
const v = subArgv[i + 1]
|
|
58
|
+
if (v !== undefined && (v === "-" || !v.startsWith("-") || /^-?\d+(\.\d+)?$/.test(v)))
|
|
59
|
+
found = v
|
|
60
|
+
} else if (a.startsWith(`${name}=`)) {
|
|
61
|
+
const v = a.slice(name.length + 1)
|
|
62
|
+
if (v !== "") found = v
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return found
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (cmd === "stats") {
|
|
69
|
+
const { handleStats } = await import("./commands/stats.ts")
|
|
70
|
+
await handleStats(subGetArg)
|
|
71
|
+
return true
|
|
72
|
+
}
|
|
73
|
+
if (cmd === "sessions") {
|
|
74
|
+
const { handleSessions } = await import("./commands/sessions.ts")
|
|
75
|
+
await handleSessions(args, subGetArg)
|
|
76
|
+
return true
|
|
77
|
+
}
|
|
78
|
+
if (cmd === "mcp") {
|
|
79
|
+
const { handleMcp } = await import("./commands/mcp.ts")
|
|
80
|
+
await handleMcp(args, subGetArg, HELP)
|
|
81
|
+
return true
|
|
82
|
+
}
|
|
83
|
+
if (cmd === "config") {
|
|
84
|
+
const { handleConfig } = await import("./commands/config.ts")
|
|
85
|
+
await handleConfig(args, subGetArg, HELP)
|
|
86
|
+
return true
|
|
87
|
+
}
|
|
88
|
+
if (cmd === "skills") {
|
|
89
|
+
const { handleSkills } = await import("./commands/skills.ts")
|
|
90
|
+
await handleSkills(args, subGetArg)
|
|
91
|
+
return true
|
|
92
|
+
}
|
|
93
|
+
if (cmd === "providers" || cmd === "models" || cmd === "sync") {
|
|
94
|
+
const { handleProviders } = await import("./commands/providers.ts")
|
|
95
|
+
await handleProviders(args, subGetArg)
|
|
96
|
+
return true
|
|
97
|
+
}
|
|
98
|
+
if (cmd === "auth") {
|
|
99
|
+
const { handleAuth } = await import("./commands/auth.ts")
|
|
100
|
+
await handleAuth(args)
|
|
101
|
+
return true
|
|
102
|
+
}
|
|
103
|
+
if (cmd === "pricing") {
|
|
104
|
+
const { handlePricing } = await import("./commands/pricing.ts")
|
|
105
|
+
await handlePricing(args)
|
|
106
|
+
return true
|
|
107
|
+
}
|
|
108
|
+
if (cmd === "exec") {
|
|
109
|
+
const { handleExec } = await import("./commands/exec.ts")
|
|
110
|
+
await handleExec(args, subGetArg)
|
|
111
|
+
return true
|
|
112
|
+
}
|
|
113
|
+
if (cmd === "memory") {
|
|
114
|
+
const { handleMemory } = await import("./commands/memory.ts")
|
|
115
|
+
await handleMemory(args, subGetArg)
|
|
116
|
+
return true
|
|
117
|
+
}
|
|
118
|
+
if (cmd === "doctor") {
|
|
119
|
+
const { handleDoctor } = await import("./commands/doctor.ts")
|
|
120
|
+
await handleDoctor(args, subGetArg)
|
|
121
|
+
return true
|
|
122
|
+
}
|
|
123
|
+
return false
|
|
124
|
+
}
|