@model-go/cli 0.1.2-rc.1 → 0.1.2
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 +65 -7
- package/checksums.txt +6 -6
- package/package.json +2 -2
- package/scripts/install-wizard.js +2 -2
- package/scripts/install.js +2 -2
- package/scripts/run.js +4 -4
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The official CLI for modelgo. Pairs with AI agent skills (Claude Code, Codex, Gemini CLI, etc.) so AI agents can operate modelgo on your behalf.
|
|
4
4
|
|
|
5
|
-
> **v0 framework stage.**
|
|
5
|
+
> **v0 framework stage.** The demo `hello` command and device-flow `auth` commands are available. API key, usage, and model gateway commands are not wired up yet.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -12,23 +12,81 @@ npx @model-go/cli@latest install
|
|
|
12
12
|
|
|
13
13
|
This runs an interactive wizard that:
|
|
14
14
|
|
|
15
|
-
1. Installs `@model-go/cli` globally via npm (which downloads the Go binary from GitHub Releases).
|
|
15
|
+
1. Installs `@model-go/cli` globally via npm (which downloads the Go binary from GitHub Releases as `modelgo`).
|
|
16
16
|
2. Distributes `modelgo-*` skills to every AI agent installed on your machine (Claude Code, Trae, Trae CN, and other agents in the [skills](https://www.npmjs.com/package/skills) ecosystem).
|
|
17
17
|
|
|
18
18
|
After install, restart your AI agent (open a new chat / session) and try:
|
|
19
19
|
|
|
20
|
-
> "Have modelgo
|
|
20
|
+
> "Have modelgo say hello to me."
|
|
21
21
|
|
|
22
|
-
Your AI should find the `modelgo-hello` skill and run `modelgo
|
|
22
|
+
Your AI should find the `modelgo-hello` skill and run `modelgo hello`.
|
|
23
23
|
|
|
24
24
|
## Direct commands
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
modelgo
|
|
28
|
-
modelgo
|
|
29
|
-
modelgo
|
|
27
|
+
modelgo --version
|
|
28
|
+
modelgo auth login
|
|
29
|
+
modelgo auth status
|
|
30
|
+
modelgo auth logout
|
|
31
|
+
modelgo hello [--name NAME]
|
|
32
|
+
modelgo --help
|
|
30
33
|
```
|
|
31
34
|
|
|
35
|
+
`modelgo auth login` without `--no-wait` is a blocking command: it prints the
|
|
36
|
+
authorization URL, then keeps polling until the browser approval completes or
|
|
37
|
+
the device code expires.
|
|
38
|
+
|
|
39
|
+
### Environments
|
|
40
|
+
|
|
41
|
+
The CLI talks to a named environment. Two are built in:
|
|
42
|
+
|
|
43
|
+
| Env | Base URL |
|
|
44
|
+
| ------ | ---------------------------- |
|
|
45
|
+
| `cn` | `https://api.modelgo.com` |
|
|
46
|
+
| `intl` | `https://api.modelgo.global` |
|
|
47
|
+
|
|
48
|
+
The active environment defaults to `cn`. Switch it, or register your own:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
modelgo env list # show built-in + custom envs (active marked with *)
|
|
52
|
+
modelgo env current # print the active env
|
|
53
|
+
modelgo env use intl # switch the active env
|
|
54
|
+
modelgo env add <name> --base-url https://... # register or override an env URL
|
|
55
|
+
modelgo env remove <name> # remove a custom env or override
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Environment definitions and the active selection live in `~/.modelgo/config.json`.
|
|
59
|
+
Credentials are stored per-env in `~/.modelgo/auth.json`, so switching environments
|
|
60
|
+
preserves each login. There are no environment variables to set.
|
|
61
|
+
|
|
62
|
+
Auth commands operate on the active env; pass `--env <name>` to target a different one:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
modelgo auth login --env intl
|
|
66
|
+
modelgo auth status --env intl
|
|
67
|
+
modelgo auth logout --all # clear every env
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Non-streaming agent flows
|
|
71
|
+
|
|
72
|
+
For AI-agent harnesses that cannot stream intermediate output to the user, use:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
modelgo auth login --no-wait --json
|
|
76
|
+
modelgo auth login --device-code <DEVICE_CODE>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Do not show the URL and then immediately block on `--device-code` in the same
|
|
80
|
+
turn. In final-message-only harnesses, that pattern prevents the user from ever
|
|
81
|
+
seeing the URL before the agent starts waiting.
|
|
82
|
+
|
|
83
|
+
> **`--json` emits newline-delimited JSON (NDJSON).** In the default waiting
|
|
84
|
+
> flow (`modelgo auth login --json` without `--no-wait`), stdout receives two
|
|
85
|
+
> JSON objects: first the device-code object (with `verification_url`), then
|
|
86
|
+
> the authenticated object once approved. Parse line by line — don't
|
|
87
|
+
> `JSON.parse` the whole stream. With `--no-wait`, only the device-code object
|
|
88
|
+
> is printed.
|
|
89
|
+
|
|
32
90
|
## Upgrade
|
|
33
91
|
|
|
34
92
|
Re-run the installer; it detects an out-of-date install and upgrades in place:
|
package/checksums.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
818fc80cdbb471fe9abd2373c30795f4a138f4be4c812cdb3d25148b71a131ed modelgo-0.1.2-darwin-amd64.tar.gz
|
|
2
|
+
cb981e35d3652d2b0e3d50c0f0eadfd8ee1497887d1e529f7630581c8cfb29e5 modelgo-0.1.2-darwin-arm64.tar.gz
|
|
3
|
+
974822455dd0b423e91a096b00fb6d28750f42ceb982185a434d14d6396974dd modelgo-0.1.2-linux-amd64.tar.gz
|
|
4
|
+
f388c0e1d23df86a24650b7bcbd2424b5a232b81a0a3f7bb426ad31781fa1217 modelgo-0.1.2-linux-arm64.tar.gz
|
|
5
|
+
5d96a2409132650dd4a98dcc8d1d0f44d519fde5de816550e53db7aba6ae629a modelgo-0.1.2-windows-amd64.zip
|
|
6
|
+
ea37a1341c87afd2f3cddfe5027a3e8203532cf5432b329c6caa8b4ce506cc05 modelgo-0.1.2-windows-arm64.zip
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@model-go/cli",
|
|
3
|
-
"version": "0.1.2
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "The official CLI for modelgo. Pairs with AI agent skills so AI agents can operate modelgo on your behalf.",
|
|
5
5
|
"bin": {
|
|
6
|
-
"modelgo
|
|
6
|
+
"modelgo": "scripts/run.js"
|
|
7
7
|
},
|
|
8
8
|
"scripts": {
|
|
9
9
|
"postinstall": "node scripts/install.js",
|
|
@@ -31,7 +31,7 @@ const messages = {
|
|
|
31
31
|
step2Spinner: "正在安装 Skills...",
|
|
32
32
|
step2Done: "Skills 已安装",
|
|
33
33
|
step2Fail: "Skills 安装失败。运行以下命令重试: npx skills add %s -y -g",
|
|
34
|
-
done: "安装完成!\n试试跟你的 AI 工具(Claude Code、Codex 等)说:\"用 modelgo
|
|
34
|
+
done: "安装完成!\n试试跟你的 AI 工具(Claude Code、Codex 等)说:\"用 modelgo 跟我打个招呼\"",
|
|
35
35
|
cancelled: "安装已取消",
|
|
36
36
|
nonTtyHint: "非交互模式,已完成 npm 全局安装 + skills 安装。",
|
|
37
37
|
},
|
|
@@ -46,7 +46,7 @@ const messages = {
|
|
|
46
46
|
step2Spinner: "Installing skills...",
|
|
47
47
|
step2Done: "Skills installed",
|
|
48
48
|
step2Fail: "Failed to install skills. Run manually: npx skills add %s -y -g",
|
|
49
|
-
done: "You are all set!\nTry asking your AI tool (Claude Code, Codex, etc.): \"Have modelgo
|
|
49
|
+
done: "You are all set!\nTry asking your AI tool (Claude Code, Codex, etc.): \"Have modelgo say hello to me\"",
|
|
50
50
|
cancelled: "Installation cancelled",
|
|
51
51
|
nonTtyHint: "Non-interactive mode. Completed global install + skills install.",
|
|
52
52
|
},
|
package/scripts/install.js
CHANGED
|
@@ -9,7 +9,7 @@ const crypto = require("crypto");
|
|
|
9
9
|
|
|
10
10
|
const VERSION = require("../package.json").version;
|
|
11
11
|
const REPO = "modelgo/modelgo-cli";
|
|
12
|
-
const NAME = "modelgo
|
|
12
|
+
const NAME = "modelgo";
|
|
13
13
|
const DEFAULT_MIRROR_HOST = "https://registry.npmmirror.com";
|
|
14
14
|
|
|
15
15
|
// Allowlist gates the initial request host. curl --location follows redirects
|
|
@@ -224,7 +224,7 @@ function install() {
|
|
|
224
224
|
const downloadUrls = [GITHUB_URL, ...mirrorUrls];
|
|
225
225
|
|
|
226
226
|
fs.mkdirSync(binDir, { recursive: true });
|
|
227
|
-
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "modelgo-
|
|
227
|
+
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "modelgo-"));
|
|
228
228
|
const archivePath = path.join(tmpDir, archiveName);
|
|
229
229
|
|
|
230
230
|
try {
|
package/scripts/run.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// SPDX-License-Identifier: MIT
|
|
4
4
|
//
|
|
5
5
|
// npm bin entrypoint. Routes:
|
|
6
|
-
// - `modelgo
|
|
7
|
-
// - everything else
|
|
6
|
+
// - `modelgo install` → install-wizard.js (interactive setup)
|
|
7
|
+
// - everything else → exec bin/modelgo (the downloaded Go binary)
|
|
8
8
|
|
|
9
9
|
const { execFileSync } = require("child_process");
|
|
10
10
|
const path = require("path");
|
|
@@ -16,12 +16,12 @@ if (args[0] === "install") {
|
|
|
16
16
|
require("./install-wizard.js");
|
|
17
17
|
} else {
|
|
18
18
|
const isWindows = process.platform === "win32";
|
|
19
|
-
const binName = "modelgo
|
|
19
|
+
const binName = "modelgo" + (isWindows ? ".exe" : "");
|
|
20
20
|
const binPath = path.join(__dirname, "..", "bin", binName);
|
|
21
21
|
|
|
22
22
|
if (!fs.existsSync(binPath)) {
|
|
23
23
|
console.error(
|
|
24
|
-
`modelgo
|
|
24
|
+
`modelgo binary not found at ${binPath}\n` +
|
|
25
25
|
`Please reinstall: npm install -g @model-go/cli`
|
|
26
26
|
);
|
|
27
27
|
process.exit(1);
|