@qcplay/cli 1.0.1 → 1.0.3
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/bin/qcplay.js
CHANGED
|
@@ -22,9 +22,10 @@ function readPackageVersion() {
|
|
|
22
22
|
const PACKAGE_VERSION = readPackageVersion();
|
|
23
23
|
|
|
24
24
|
const QCPLAY_DIR = path.join(os.homedir(), ".qcplay");
|
|
25
|
+
const AGENTS_DIR = path.join(os.homedir(), ".agents");
|
|
25
26
|
const AUTH_FILE = path.join(QCPLAY_DIR, "auth.json");
|
|
26
27
|
const CONFIG_FILE = path.join(QCPLAY_DIR, "config.json");
|
|
27
|
-
const SKILLS_DIR = path.join(
|
|
28
|
+
const SKILLS_DIR = path.join(AGENTS_DIR, "skills");
|
|
28
29
|
|
|
29
30
|
const colorsEnabled = process.stdout.isTTY && process.env.NO_COLOR !== "1";
|
|
30
31
|
|
|
@@ -95,9 +96,34 @@ function getVendorDir() {
|
|
|
95
96
|
throw new Error(`Unsupported platform: ${process.platform}`);
|
|
96
97
|
}
|
|
97
98
|
|
|
99
|
+
function getExeCandidates(name) {
|
|
100
|
+
if (process.platform === "win32") {
|
|
101
|
+
return [`${name}.exe`, name];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (process.platform === "darwin") {
|
|
105
|
+
return [`${name}-darwin-${process.arch}`, name];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (process.platform === "linux") {
|
|
109
|
+
return [`${name}-linux-${process.arch}`, name];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return [name];
|
|
113
|
+
}
|
|
114
|
+
|
|
98
115
|
function getExePath(name) {
|
|
99
116
|
const vendorDir = getVendorDir();
|
|
100
|
-
|
|
117
|
+
const candidates = getExeCandidates(name);
|
|
118
|
+
|
|
119
|
+
for (const candidate of candidates) {
|
|
120
|
+
const exePath = path.join(vendorDir, candidate);
|
|
121
|
+
if (fs.existsSync(exePath)) {
|
|
122
|
+
return exePath;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return path.join(vendorDir, candidates[0]);
|
|
101
127
|
}
|
|
102
128
|
|
|
103
129
|
function runNative(name, args = []) {
|
|
@@ -341,6 +367,7 @@ async function installCommand() {
|
|
|
341
367
|
const skillsInstalled = await installSkills();
|
|
342
368
|
if (skillsInstalled) {
|
|
343
369
|
console.log(chalk.green("✔ Skills 已安装"));
|
|
370
|
+
console.log(`Skills 目录: ${chalk.gray(SKILLS_DIR)}`);
|
|
344
371
|
} else {
|
|
345
372
|
console.log(chalk.yellow("! 未找到 Skills 模板,已跳过"));
|
|
346
373
|
}
|
|
@@ -360,10 +387,6 @@ async function installCommand() {
|
|
|
360
387
|
throw new Error(`登录流程结束,但未检测到有效认证文件。\n原因: ${loginStatus.reason}`);
|
|
361
388
|
}
|
|
362
389
|
|
|
363
|
-
console.log("");
|
|
364
|
-
console.log(chalk.green("✔ 登录成功"));
|
|
365
|
-
console.log(`认证文件: ${chalk.gray(AUTH_FILE)}`);
|
|
366
|
-
|
|
367
390
|
console.log("");
|
|
368
391
|
console.log(chalk.green("✔ QCPlay CLI 安装完成"));
|
|
369
392
|
|
|
@@ -383,9 +406,6 @@ async function authCommand(action, args = []) {
|
|
|
383
406
|
throw new Error(`登录失败。\n原因: ${loginStatus.reason}`);
|
|
384
407
|
}
|
|
385
408
|
|
|
386
|
-
console.log("");
|
|
387
|
-
console.log(chalk.green("✔ 登录成功"));
|
|
388
|
-
console.log(`认证文件: ${chalk.gray(AUTH_FILE)}`);
|
|
389
409
|
return;
|
|
390
410
|
}
|
|
391
411
|
|
|
@@ -402,7 +422,6 @@ async function authCommand(action, args = []) {
|
|
|
402
422
|
}
|
|
403
423
|
|
|
404
424
|
console.log(chalk.green("已登录"));
|
|
405
|
-
console.log(`认证文件: ${AUTH_FILE}`);
|
|
406
425
|
return;
|
|
407
426
|
}
|
|
408
427
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qcplay/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "QCPlay CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"registry": "https://registry.npmjs.org/"
|
|
19
19
|
},
|
|
20
20
|
"engines": {
|
|
21
|
-
"node": ">=16
|
|
21
|
+
"node": ">=16",
|
|
22
22
|
"npm": ">=8"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
@@ -204,6 +204,12 @@ Windows 示例:
|
|
|
204
204
|
C:\Users\Administrator\.qcplay\auth.json
|
|
205
205
|
```
|
|
206
206
|
|
|
207
|
+
macOS 示例:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
/Users/<your-name>/.qcplay/auth.json
|
|
211
|
+
```
|
|
212
|
+
|
|
207
213
|
认证文件格式:
|
|
208
214
|
|
|
209
215
|
```json
|
|
@@ -1158,4 +1164,4 @@ Node 只做路由。
|
|
|
1158
1164
|
Go 负责发布。
|
|
1159
1165
|
默认参数程序内部补齐。
|
|
1160
1166
|
发布失败不得伪造成成功。
|
|
1161
|
-
```
|
|
1167
|
+
```
|
|
Binary file
|
|
Binary file
|