@dalehkx/quote-cli 0.3.5 → 0.3.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalehkx/quote-cli",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "description": "通用询报价 CLI 工具",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,7 +1,7 @@
1
1
  interface:
2
2
  display_name: "询报价管理"
3
3
  short_description: "创建询价、管理报价、比价下单"
4
- default_prompt: "Use $quote-skill to create a new inquiry for auto parts."
4
+ default_prompt: "Use $cass-quote to create a new inquiry for auto parts."
5
5
 
6
6
  policy:
7
7
  allow_implicit_invocation: true
@@ -75,7 +75,7 @@ async function stepInstallCli() {
75
75
  }
76
76
 
77
77
  try {
78
- await runAsync('npm', ['install', '-g', '--ignore-scripts', PKG], { timeout: 120000 });
78
+ await runAsync('npm', ['install', '-g', '--prefer-online', '--ignore-scripts', PKG], { timeout: 120000 });
79
79
  console.log(' 完成');
80
80
  } catch {
81
81
  console.log('');
@@ -84,14 +84,13 @@ async function stepInstallCli() {
84
84
  }
85
85
  }
86
86
 
87
- function installSkill() {
88
- // 找到全局安装包内的 skill 目录(不同平台路径不同)
87
+ async function stepInstallSkill() {
88
+ // 找全局包内的 skill 目录
89
89
  let skillSrc;
90
90
  try {
91
91
  const prefix = execFileSync('npm', ['prefix', '-g'], {
92
92
  stdio: ['ignore', 'pipe', 'pipe'],
93
93
  }).toString().trim();
94
- // 尝试两种常见路径:标准 npm 和 Homebrew/nvm 等
95
94
  const candidates = [
96
95
  path.join(prefix, 'lib', 'node_modules', PKG, 'skill'),
97
96
  path.join(prefix, 'node_modules', PKG, 'skill'),
@@ -104,9 +103,16 @@ function installSkill() {
104
103
  return;
105
104
  }
106
105
 
107
- const skillDest = path.join(os.homedir(), '.claude', 'skills', 'cass-quote');
108
- copyDir(skillSrc, skillDest);
109
- console.log(` ✓ Skill 已安装到 ${skillDest}`);
106
+ // 优先用 playbooks 安装到所有 agent,失败则回退到仅复制 Claude Code
107
+ try {
108
+ execCmd('npx', ['-y', 'playbooks', 'add', 'skill', skillSrc, '-g', '-y'], { stdio: 'inherit', timeout: 60000 });
109
+ console.log(' ✓ Skill 已安装到所有支持的 agent');
110
+ } catch {
111
+ // playbooks 不可用,直接复制到 Claude Code
112
+ const claudeDest = path.join(os.homedir(), '.claude', 'skills', 'cass-quote');
113
+ copyDir(skillSrc, claudeDest);
114
+ console.log(` ✓ Skill 已安装到 Claude Code (${claudeDest})`);
115
+ }
110
116
  }
111
117
 
112
118
  function copyDir(src, dest) {
@@ -148,8 +154,8 @@ export function registerInstallCommand(program) {
148
154
  console.log('1/3 CLI');
149
155
  await stepInstallCli();
150
156
 
151
- console.log('\n2/3 Skill(Claude Code 集成)');
152
- installSkill();
157
+ console.log('\n2/3 Skill(多 agent 集成)');
158
+ await stepInstallSkill();
153
159
 
154
160
  if (!opts.skipLogin) {
155
161
  console.log('\n3/3 登录');
@@ -157,6 +163,6 @@ export function registerInstallCommand(program) {
157
163
  }
158
164
 
159
165
  console.log('\n安装完成!');
160
- console.log(' 现在可以对 Claude Code 说:「帮我创建一条询价单」\n');
166
+ console.log(' 现在可以对你的 AI 工具说:「帮我创建一条询价单」\n');
161
167
  });
162
168
  }