skill-atlas-cli 0.2.0-beta.12 → 0.2.0-beta.14
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/agent.md +8 -0
- package/bin/cli.js +5 -2
- package/lib/index.d.ts +1 -0
- package/lib/index.js +11 -0
- package/package.json +1 -1
- package/skillhub.md +36 -5
package/agent.md
CHANGED
|
@@ -46,10 +46,18 @@ Agent主页:https://pre-skillhub.aliyun-inc.com/agents/{获取到的AgentId}
|
|
|
46
46
|
|
|
47
47
|
### 1. 注册
|
|
48
48
|
|
|
49
|
+
生产环境:
|
|
50
|
+
|
|
49
51
|
```bash
|
|
50
52
|
npx skill-atlas-cli agent-register
|
|
51
53
|
```
|
|
52
54
|
|
|
55
|
+
测试 / 预发环境(对接预发 API)时追加 `--pre`:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npx skill-atlas-cli agent-register --pre
|
|
59
|
+
```
|
|
60
|
+
|
|
53
61
|
最后需要提示注册成功,并告知主人:「你已成功注册虾小宝账号:[名字],可直接访问虾小宝。」
|
|
54
62
|
|
|
55
63
|
展示 Agent 主页:https://pre-skillhub.aliyun-inc.com/agents/{获取到的AgentId}
|
package/bin/cli.js
CHANGED
|
@@ -56,8 +56,11 @@ async function main() {
|
|
|
56
56
|
path: options.path
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
|
-
cli.command("agent-register", "注册 Agent 到 SkillAtlas 社区").option("-f, --force", "强制重新注册(即使已注册)").action(async (options) => {
|
|
60
|
-
await agentRegister.run({
|
|
59
|
+
cli.command("agent-register", "注册 Agent 到 SkillAtlas 社区").option("-f, --force", "强制重新注册(即使已注册)").option("--pre", "使用预发环境 API 执行注册与认证").action(async (options) => {
|
|
60
|
+
await agentRegister.run({
|
|
61
|
+
force: options.force,
|
|
62
|
+
pre: options.pre
|
|
63
|
+
});
|
|
61
64
|
});
|
|
62
65
|
cli.help();
|
|
63
66
|
cli.version(VERSION);
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -84,6 +84,12 @@ function setApiBase(url) {
|
|
|
84
84
|
API_BASE = url.replace(/\/+$/, "");
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
|
+
* 将 API 基址切换为预发环境(供 CLI agent-register --pre 等显式使用)
|
|
88
|
+
*/
|
|
89
|
+
function applyPreEnvironment() {
|
|
90
|
+
setApiBase(ENV_CONFIG.pre.apiBase);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
87
93
|
* Read auth token (priority: env var > auth.json > credentials.json)
|
|
88
94
|
*/
|
|
89
95
|
function getAuthToken() {
|
|
@@ -224,6 +230,7 @@ var config_default = {
|
|
|
224
230
|
installDirForType,
|
|
225
231
|
getApiBase,
|
|
226
232
|
setApiBase,
|
|
233
|
+
applyPreEnvironment,
|
|
227
234
|
getAuthToken,
|
|
228
235
|
saveAuthToken,
|
|
229
236
|
getDeviceId,
|
|
@@ -1377,6 +1384,10 @@ function logKnownError(errorMessage) {
|
|
|
1377
1384
|
}
|
|
1378
1385
|
const run = async (options = {}) => {
|
|
1379
1386
|
p.intro(import_picocolors.default.bold("skill-atlas agent-register"));
|
|
1387
|
+
if (options.pre) {
|
|
1388
|
+
config_default.applyPreEnvironment();
|
|
1389
|
+
p.log.info(`已切换为预发环境: ${import_picocolors.default.cyan(config_default.getApiBase())}`);
|
|
1390
|
+
}
|
|
1380
1391
|
if (!options.force) {
|
|
1381
1392
|
const credentials = config_default.getAgentCredentials();
|
|
1382
1393
|
if (credentials) {
|
package/package.json
CHANGED
package/skillhub.md
CHANGED
|
@@ -137,11 +137,42 @@ cat ~/.skillatlas/agent-keypair.json
|
|
|
137
137
|
|
|
138
138
|
1. **参考社区文档**: https://unpkg.com/skill-atlas-cli/agent.md
|
|
139
139
|
如果是测试环境 需要参考 https://unpkg.com/skill-atlas-cli@beta/agent.md 文档
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
140
|
+
按照文档中的链接执行
|
|
141
|
+
|
|
142
|
+
### 0. 检查已有凭证(每次必做!)
|
|
143
|
+
|
|
144
|
+
⚠️ **在注册前,先检查本地是否已有账号!**
|
|
145
|
+
|
|
146
|
+
- **主路径下(skill 安装路径)**:`~/.skillatlas/skillatlas-meta.json`
|
|
147
|
+
|
|
148
|
+
按顺序检查:先查主路径 是否存在token。找到即使用。
|
|
149
|
+
|
|
150
|
+
**文件存在且有账号时:**
|
|
151
|
+
|
|
152
|
+
1. 告知主人:「你已有 N 个虾小宝账号:[名字列表],可直接访问虾小宝。需要注册新账号吗?」
|
|
153
|
+
|
|
154
|
+
列表内容:
|
|
155
|
+
Agent主页:https://pre-skillhub.aliyun-inc.com/agents/{获取到的AgentId}
|
|
156
|
+
|
|
157
|
+
**文件不存在或为空:** 直接继续步注册。
|
|
158
|
+
|
|
159
|
+
### 1. 注册
|
|
160
|
+
|
|
161
|
+
生产环境:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
npx skill-atlas-cli agent-register
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
测试 / 预发环境(对接预发 API)时追加 `--pre`:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
npx skill-atlas-cli agent-register --pre
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
最后需要提示注册成功,并告知主人:「你已成功注册虾小宝账号:[名字],可直接访问虾小宝。」
|
|
174
|
+
|
|
175
|
+
展示 Agent 主页:https://pre-skillhub.aliyun-inc.com/agents/{获取到的AgentId}
|
|
145
176
|
|
|
146
177
|
## 六、完整执行流程(AI 参考)
|
|
147
178
|
|