@laivc/laicode 0.0.1 → 0.2.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 CHANGED
@@ -1,11 +1,149 @@
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 --help
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
+ Network and model calls use TTY-aware loading animations. JSON output and non-interactive shell usage stay clean.
13
+
14
+ ## Commands
15
+
16
+ ```bash
17
+ laicode # interactive console
18
+ laicode --fancy # arrow-key console where supported
19
+ laicode brand # brand mark and palette preview
20
+ laicode status # live cockpit snapshot
21
+ laicode status --refresh # bypass the short dashboard cache
22
+ laicode commands # command catalog
23
+ laicode completion bash # print shell completion script
24
+ laicode tools # inspect local AI tools
25
+ laicode init --tool codex # preview a one-click Codex profile
26
+ laicode init --tool codex --apply
27
+ laicode rollback # undo the latest Laicode config write
28
+ laicode login
29
+ laicode models --online
30
+ laicode chat --model gpt-5.5 --message "Say hello"
31
+ laicode bench --model gpt-5.5 --count 3
32
+ laicode bench --model gpt-5.5 --count 3 --json
33
+ laicode doctor
34
+ laicode doctor --json
35
+ laicode keys
36
+ laicode config
37
+ laicode logout
38
+ ```
39
+
40
+ 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.
41
+ 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.
42
+
43
+ ## First Run
44
+
45
+ ```bash
46
+ laicode status
47
+ laicode login
48
+ laicode models --online
49
+ laicode doctor
50
+ laicode tools
51
+ laicode init --tool codex
52
+ ```
53
+
54
+ `status` shows the next recommended actions when the local state is empty.
55
+
56
+ ## Radar and Benchmark
57
+
58
+ `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.
59
+
60
+ `laicode bench` uses streaming requests and reports per-run first-token latency, total latency bars, success rate, P50/P95, jitter, and estimated throughput.
61
+
62
+ 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.
63
+
64
+ 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.
65
+
66
+ ## Local Tool Onboarding
67
+
68
+ Phase 1 focuses on checking local AI tools and safely connecting them to Lai.vc.
69
+
70
+ ```bash
71
+ laicode tools
72
+ laicode init --tool codex
73
+ laicode init --tool codex --apply
74
+ codex --profile laicode
75
+ laicode rollback
76
+ ```
77
+
78
+ `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.
79
+
80
+ The first automatic adapter creates `~/.codex/laicode.config.toml` instead of modifying the main Codex config. Continue can create a fresh `~/.continue/config.yaml` when no existing Continue config is present. Cursor and Cline are currently inspected with guided setup to avoid unsafe writes into app-managed secure storage.
81
+
82
+ 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.
83
+
84
+ 完整 API Key 默认不会显示。若确实需要查看,使用:
85
+
86
+ ```bash
87
+ laicode keys --show
88
+ ```
89
+
90
+ 非交互环境需要显式确认:
91
+
92
+ ```bash
93
+ laicode keys --show --yes
94
+ ```
95
+
96
+ `keys --json` 默认不输出任何 key 片段;需要完整 key 时必须显式使用 `--show --yes`。
97
+
98
+ ## Terminal Options
99
+
100
+ ```bash
101
+ laicode --plain # disable color styling
102
+ laicode --color # force color even when NO_COLOR is set
103
+ laicode --fancy # experimental arrow-key menu
104
+ laicode --color brand # preview the Lai.vc terminal palette
105
+ laicode status --json # script-friendly status output without secret fragments
106
+ laicode doctor --json # script-friendly diagnostics
107
+ laicode config --json # script-friendly local config summary
108
+ laicode commands --json # machine-readable command catalog
109
+ ```
110
+
111
+ ## Shell Completion
112
+
113
+ ```bash
114
+ laicode completion bash
115
+ laicode completion zsh
116
+ laicode completion fish
117
+ laicode completion powershell
118
+ ```
119
+
120
+ The command prints a completion script to stdout and does not modify your shell profile.
121
+
122
+ Environment variables:
123
+
124
+ ```bash
125
+ LAICODE_HOME=/path/to/state # default: ~/.laicode
126
+ LAICODE_SITE_URL=https://lai.vc
127
+ LAICODE_PLAIN=1 # disable styling
128
+ LAICODE_COLOR=1 # force color preview/output
129
+ LAICODE_NO_SPINNER=1 # disable loading animations
130
+ ```
131
+
132
+ ## Manual API Key Mode
133
+
134
+ If you already have a Lai.vc key:
135
+
136
+ ```bash
137
+ laicode config set api-key sk-...
138
+ laicode config set base-url https://api.lai.vc/v1
139
+ laicode chat --model gpt-5.5 --message "Test Lai.vc"
8
140
  ```
9
141
 
10
- This first package reserves the official CLI name while the full cross-platform configurator is being built.
142
+ ## Maintainers
143
+
144
+ ```bash
145
+ npm run release:check
146
+ npm publish
147
+ ```
11
148
 
149
+ `release:check` runs syntax checks, smoke tests, and an npm publish dry-run.