skill-atlas-cli 0.2.0-beta.12 → 0.2.0-beta.13
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/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) {
|