@laivc/laicode 0.1.0 → 0.2.1
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 +48 -1
- package/bin/laicode.js +626 -62
- package/lib/adapters.js +666 -0
- package/package.json +2 -1
- package/scripts/smoke-test.js +153 -5
package/README.md
CHANGED
|
@@ -9,12 +9,23 @@ LaiCode is the official CLI testbench for the Lai.vc API gateway.
|
|
|
9
9
|
|
|
10
10
|
The interface defaults to Chinese and uses terminal panels/tables that handle CJK alignment correctly.
|
|
11
11
|
Its terminal cockpit follows the Lai.vc brand palette: plum, coral, persimmon, ivory, and gold.
|
|
12
|
+
Network and model calls use TTY-aware loading animations. JSON output and non-interactive shell usage stay clean.
|
|
12
13
|
|
|
13
14
|
## Commands
|
|
14
15
|
|
|
15
16
|
```bash
|
|
16
17
|
laicode # interactive console
|
|
17
18
|
laicode --fancy # arrow-key console where supported
|
|
19
|
+
laicode tools # AI tool scan, install, configure, uninstall, reinstall
|
|
20
|
+
laicode tools install --tool codex
|
|
21
|
+
laicode tools install --tool opencode
|
|
22
|
+
laicode tools reinstall --tool claude
|
|
23
|
+
laicode tools configure --tool codex --apply
|
|
24
|
+
laicode init --tool codex # preview a one-click Codex profile
|
|
25
|
+
laicode init --tool codex --apply
|
|
26
|
+
laicode init --tool opencode
|
|
27
|
+
laicode init --tool vscode # guide VS Code extension routes
|
|
28
|
+
laicode rollback # undo the latest Laicode config write
|
|
18
29
|
laicode brand # brand mark and palette preview
|
|
19
30
|
laicode status # live cockpit snapshot
|
|
20
31
|
laicode status --refresh # bypass the short dashboard cache
|
|
@@ -32,7 +43,7 @@ laicode config
|
|
|
32
43
|
laicode logout
|
|
33
44
|
```
|
|
34
45
|
|
|
35
|
-
Local state is stored in `~/.laicode` by default. LaiCode
|
|
46
|
+
Local state is stored in `~/.laicode` by default. LaiCode previews every AI tool change before applying it, backs up Laicode-managed writes, and can roll them back.
|
|
36
47
|
When logged in, the interactive cockpit shows live account status, online model count, balance, request count, gateway URL, and npm release status. Cockpit snapshots use a short local cache so returning to the menu stays fast.
|
|
37
48
|
|
|
38
49
|
## First Run
|
|
@@ -42,6 +53,11 @@ laicode status
|
|
|
42
53
|
laicode login
|
|
43
54
|
laicode models --online
|
|
44
55
|
laicode doctor
|
|
56
|
+
laicode tools
|
|
57
|
+
laicode init --tool codex
|
|
58
|
+
laicode init --tool opencode
|
|
59
|
+
laicode init --tool vscode
|
|
60
|
+
laicode tools install --tool codex
|
|
45
61
|
```
|
|
46
62
|
|
|
47
63
|
`status` shows the next recommended actions when the local state is empty.
|
|
@@ -56,6 +72,36 @@ Use `laicode bench --json` for script-friendly health checks. The JSON output in
|
|
|
56
72
|
|
|
57
73
|
Use `laicode doctor --json` for CI-friendly diagnostics across local state, catalog reachability, npm version status, CLI session, API key, and a real chat completion check.
|
|
58
74
|
|
|
75
|
+
## Local Tool Onboarding
|
|
76
|
+
|
|
77
|
+
Phase 1 focuses on checking local AI tools and safely connecting them to Lai.vc.
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
laicode tools
|
|
81
|
+
laicode tools install --tool codex
|
|
82
|
+
laicode tools install --tool opencode
|
|
83
|
+
laicode init --tool codex
|
|
84
|
+
laicode init --tool codex --apply
|
|
85
|
+
codex --profile laicode
|
|
86
|
+
laicode init --tool opencode
|
|
87
|
+
laicode init --tool opencode --apply
|
|
88
|
+
opencode
|
|
89
|
+
laicode tools reinstall --tool codex
|
|
90
|
+
laicode rollback
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The interactive menu puts "AI 工具一键配置" first. Inside it you can scan all tools, pick one tool, preview/apply configuration, install, uninstall, reinstall, and rollback from a nested menu instead of typing separate commands.
|
|
94
|
+
|
|
95
|
+
`tools install|uninstall|reinstall` preview shell commands by default. `--apply` executes the command. `init` previews the files it would write by default. `--apply` creates a backup under `~/.laicode/backups` before writing, and `rollback` restores the latest Laicode-managed write.
|
|
96
|
+
|
|
97
|
+
The high-priority scan order follows common AI developer tool usage: Claude Code, Codex CLI, VS Code, Cursor, OpenCode, Continue, and Cline.
|
|
98
|
+
|
|
99
|
+
Codex creates `~/.codex/laicode.config.toml` instead of modifying the main Codex config. OpenCode can create or merge `~/.config/opencode/opencode.json` with a Lai.vc OpenAI-compatible provider. Continue can create a fresh `~/.continue/config.yaml` when no existing Continue config is present.
|
|
100
|
+
|
|
101
|
+
VS Code is treated as an editor host, not a single API client: LaiCode guides users into Codex, Continue, or Cline routes instead of writing editor secure storage directly. Claude Code is detected and installable, but Lai.vc connection is blocked until the gateway exposes Anthropic Messages compatibility. Cursor and Cline are currently inspected with guided setup to avoid unsafe writes into app-managed secure storage.
|
|
102
|
+
|
|
103
|
+
The Codex profile uses Codex's command-backed auth to call `laicode credential api-key`, so the Lai.vc key stays in `~/.laicode` instead of being copied into Codex config.
|
|
104
|
+
|
|
59
105
|
完整 API Key 默认不会显示。若确实需要查看,使用:
|
|
60
106
|
|
|
61
107
|
```bash
|
|
@@ -101,6 +147,7 @@ LAICODE_HOME=/path/to/state # default: ~/.laicode
|
|
|
101
147
|
LAICODE_SITE_URL=https://lai.vc
|
|
102
148
|
LAICODE_PLAIN=1 # disable styling
|
|
103
149
|
LAICODE_COLOR=1 # force color preview/output
|
|
150
|
+
LAICODE_NO_SPINNER=1 # disable loading animations
|
|
104
151
|
```
|
|
105
152
|
|
|
106
153
|
## Manual API Key Mode
|