@qcplay/cli 1.0.1 → 1.0.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/bin/qcplay.js CHANGED
@@ -22,9 +22,21 @@ 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(QCPLAY_DIR, "skills");
28
+
29
+ function getSkillsDir() {
30
+ const agentsSkillsDir = path.join(AGENTS_DIR, "skills");
31
+
32
+ if (fs.existsSync(agentsSkillsDir) || fs.existsSync(AGENTS_DIR)) {
33
+ return agentsSkillsDir;
34
+ }
35
+
36
+ return path.join(QCPLAY_DIR, "skills");
37
+ }
38
+
39
+ const SKILLS_DIR = getSkillsDir();
28
40
 
29
41
  const colorsEnabled = process.stdout.isTTY && process.env.NO_COLOR !== "1";
30
42
 
@@ -95,9 +107,34 @@ function getVendorDir() {
95
107
  throw new Error(`Unsupported platform: ${process.platform}`);
96
108
  }
97
109
 
110
+ function getExeCandidates(name) {
111
+ if (process.platform === "win32") {
112
+ return [`${name}.exe`, name];
113
+ }
114
+
115
+ if (process.platform === "darwin") {
116
+ return [`${name}-darwin-${process.arch}`, name];
117
+ }
118
+
119
+ if (process.platform === "linux") {
120
+ return [`${name}-linux-${process.arch}`, name];
121
+ }
122
+
123
+ return [name];
124
+ }
125
+
98
126
  function getExePath(name) {
99
127
  const vendorDir = getVendorDir();
100
- return process.platform === "win32" ? path.join(vendorDir, `${name}.exe`) : path.join(vendorDir, name);
128
+ const candidates = getExeCandidates(name);
129
+
130
+ for (const candidate of candidates) {
131
+ const exePath = path.join(vendorDir, candidate);
132
+ if (fs.existsSync(exePath)) {
133
+ return exePath;
134
+ }
135
+ }
136
+
137
+ return path.join(vendorDir, candidates[0]);
101
138
  }
102
139
 
103
140
  function runNative(name, args = []) {
@@ -341,6 +378,7 @@ async function installCommand() {
341
378
  const skillsInstalled = await installSkills();
342
379
  if (skillsInstalled) {
343
380
  console.log(chalk.green("✔ Skills 已安装"));
381
+ console.log(`Skills 目录: ${chalk.gray(SKILLS_DIR)}`);
344
382
  } else {
345
383
  console.log(chalk.yellow("! 未找到 Skills 模板,已跳过"));
346
384
  }
@@ -360,10 +398,6 @@ async function installCommand() {
360
398
  throw new Error(`登录流程结束,但未检测到有效认证文件。\n原因: ${loginStatus.reason}`);
361
399
  }
362
400
 
363
- console.log("");
364
- console.log(chalk.green("✔ 登录成功"));
365
- console.log(`认证文件: ${chalk.gray(AUTH_FILE)}`);
366
-
367
401
  console.log("");
368
402
  console.log(chalk.green("✔ QCPlay CLI 安装完成"));
369
403
 
@@ -383,9 +417,6 @@ async function authCommand(action, args = []) {
383
417
  throw new Error(`登录失败。\n原因: ${loginStatus.reason}`);
384
418
  }
385
419
 
386
- console.log("");
387
- console.log(chalk.green("✔ 登录成功"));
388
- console.log(`认证文件: ${chalk.gray(AUTH_FILE)}`);
389
420
  return;
390
421
  }
391
422
 
@@ -402,7 +433,6 @@ async function authCommand(action, args = []) {
402
433
  }
403
434
 
404
435
  console.log(chalk.green("已登录"));
405
- console.log(`认证文件: ${AUTH_FILE}`);
406
436
  return;
407
437
  }
408
438
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qcplay/cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
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 <17",
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
+ ```