@laivc/laicode 0.0.1 → 0.1.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 +117 -5
- package/bin/laicode.js +2047 -25
- package/package.json +12 -3
- package/scripts/release-check.js +20 -0
- package/scripts/smoke-test.js +116 -0
package/README.md
CHANGED
|
@@ -1,11 +1,123 @@
|
|
|
1
|
-
# LaiCode
|
|
2
|
-
|
|
3
|
-
LaiCode is the official CLI for configuring local developer tools to use the Lai.vc API gateway.
|
|
1
|
+
# LaiCode CLI
|
|
4
2
|
|
|
5
3
|
```bash
|
|
6
4
|
npm install -g @laivc/laicode
|
|
7
|
-
laicode
|
|
5
|
+
laicode
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
LaiCode is the official CLI testbench for the Lai.vc API gateway.
|
|
9
|
+
|
|
10
|
+
The interface defaults to Chinese and uses terminal panels/tables that handle CJK alignment correctly.
|
|
11
|
+
Its terminal cockpit follows the Lai.vc brand palette: plum, coral, persimmon, ivory, and gold.
|
|
12
|
+
|
|
13
|
+
## Commands
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
laicode # interactive console
|
|
17
|
+
laicode --fancy # arrow-key console where supported
|
|
18
|
+
laicode brand # brand mark and palette preview
|
|
19
|
+
laicode status # live cockpit snapshot
|
|
20
|
+
laicode status --refresh # bypass the short dashboard cache
|
|
21
|
+
laicode commands # command catalog
|
|
22
|
+
laicode completion bash # print shell completion script
|
|
23
|
+
laicode login
|
|
24
|
+
laicode models --online
|
|
25
|
+
laicode chat --model gpt-5.5 --message "Say hello"
|
|
26
|
+
laicode bench --model gpt-5.5 --count 3
|
|
27
|
+
laicode bench --model gpt-5.5 --count 3 --json
|
|
28
|
+
laicode doctor
|
|
29
|
+
laicode doctor --json
|
|
30
|
+
laicode keys
|
|
31
|
+
laicode config
|
|
32
|
+
laicode logout
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Local state is stored in `~/.laicode` by default. LaiCode does not modify your existing Claude, ChatGPT, Cursor, Codex, Cline, or Continue configuration in this phase.
|
|
36
|
+
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
|
+
|
|
38
|
+
## First Run
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
laicode status
|
|
42
|
+
laicode login
|
|
43
|
+
laicode models --online
|
|
44
|
+
laicode doctor
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`status` shows the next recommended actions when the local state is empty.
|
|
48
|
+
|
|
49
|
+
## Radar and Benchmark
|
|
50
|
+
|
|
51
|
+
`laicode models --online` shows a radar summary before the model table: online coverage, vendor count, available tiers, recommended default model, cheapest input tier, and fastest reported latency.
|
|
52
|
+
|
|
53
|
+
`laicode bench` uses streaming requests and reports per-run first-token latency, total latency bars, success rate, P50/P95, jitter, and estimated throughput.
|
|
54
|
+
|
|
55
|
+
Use `laicode bench --json` for script-friendly health checks. The JSON output includes model, timing summary, per-run result rows, timestamps, and prompt length, but no local token or API key.
|
|
56
|
+
|
|
57
|
+
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
|
+
|
|
59
|
+
完整 API Key 默认不会显示。若确实需要查看,使用:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
laicode keys --show
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
非交互环境需要显式确认:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
laicode keys --show --yes
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`keys --json` 默认不输出任何 key 片段;需要完整 key 时必须显式使用 `--show --yes`。
|
|
72
|
+
|
|
73
|
+
## Terminal Options
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
laicode --plain # disable color styling
|
|
77
|
+
laicode --color # force color even when NO_COLOR is set
|
|
78
|
+
laicode --fancy # experimental arrow-key menu
|
|
79
|
+
laicode --color brand # preview the Lai.vc terminal palette
|
|
80
|
+
laicode status --json # script-friendly status output without secret fragments
|
|
81
|
+
laicode doctor --json # script-friendly diagnostics
|
|
82
|
+
laicode config --json # script-friendly local config summary
|
|
83
|
+
laicode commands --json # machine-readable command catalog
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Shell Completion
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
laicode completion bash
|
|
90
|
+
laicode completion zsh
|
|
91
|
+
laicode completion fish
|
|
92
|
+
laicode completion powershell
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The command prints a completion script to stdout and does not modify your shell profile.
|
|
96
|
+
|
|
97
|
+
Environment variables:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
LAICODE_HOME=/path/to/state # default: ~/.laicode
|
|
101
|
+
LAICODE_SITE_URL=https://lai.vc
|
|
102
|
+
LAICODE_PLAIN=1 # disable styling
|
|
103
|
+
LAICODE_COLOR=1 # force color preview/output
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Manual API Key Mode
|
|
107
|
+
|
|
108
|
+
If you already have a Lai.vc key:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
laicode config set api-key sk-...
|
|
112
|
+
laicode config set base-url https://api.lai.vc/v1
|
|
113
|
+
laicode chat --model gpt-5.5 --message "Test Lai.vc"
|
|
8
114
|
```
|
|
9
115
|
|
|
10
|
-
|
|
116
|
+
## Maintainers
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
npm run release:check
|
|
120
|
+
npm publish
|
|
121
|
+
```
|
|
11
122
|
|
|
123
|
+
`release:check` runs syntax checks, smoke tests, and an npm publish dry-run.
|