@dalehkx/quote-cli 0.3.8 → 0.3.10

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.8",
3
+ "version": "0.3.10",
4
4
  "description": "通用询报价 CLI 工具",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,15 +1,14 @@
1
1
  #!/usr/bin/env node
2
- // prepack: sync packages/skill/ → packages/cli/skill/
2
+ // prepack: sync skills/cass-quote/ → packages/cli/skill/
3
3
  // Runs from the monorepo root via `npm -w @dalehkx/quote-cli run prepack`
4
4
  // or from packages/cli/ directly during `npm pack` / `npm publish`.
5
5
 
6
6
  const fs = require('fs');
7
7
  const path = require('path');
8
8
 
9
- // packages/cli/ → find packages/skill/ relative to monorepo root
10
9
  const cliDir = path.join(__dirname, '..');
11
10
  const repoRoot = path.join(cliDir, '..', '..');
12
- const skillSrc = path.join(repoRoot, 'packages', 'skill');
11
+ const skillSrc = path.join(repoRoot, 'skills', 'cass-quote');
13
12
  const skillDest = path.join(cliDir, 'skill');
14
13
 
15
14
  if (!fs.existsSync(skillSrc)) {
@@ -20,21 +19,16 @@ if (!fs.existsSync(skillSrc)) {
20
19
  function copyDir(src, dest) {
21
20
  fs.mkdirSync(dest, { recursive: true });
22
21
  for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
23
- // 불필요한 파일 제외
24
22
  if (entry.name === 'node_modules' || entry.name === '.git') continue;
25
23
  const srcPath = path.join(src, entry.name);
26
24
  const destPath = path.join(dest, entry.name);
27
- if (entry.isDirectory()) {
28
- copyDir(srcPath, destPath);
29
- } else {
30
- fs.copyFileSync(srcPath, destPath);
31
- }
25
+ if (entry.isDirectory()) copyDir(srcPath, destPath);
26
+ else fs.copyFileSync(srcPath, destPath);
32
27
  }
33
28
  }
34
29
 
35
- // 기존 skill 디렉토리 초기화 후 복사
36
30
  if (fs.existsSync(skillDest)) {
37
31
  fs.rmSync(skillDest, { recursive: true });
38
32
  }
39
33
  copyDir(skillSrc, skillDest);
40
- console.log(`[prepack] synced packages/skill/ → packages/cli/skill/`);
34
+ console.log(`[prepack] synced skills/cass-quote/ → packages/cli/skill/`);
package/skill/SKILL.md CHANGED
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: cass-quote
3
- description: 汽配询报价管理技能,支持账号注册/登录、创建询价单(多配件/VIN解析)、监听报价、比价分析。Use when the user wants to create an inquiry (RFQ), manage quotations, compare prices from suppliers, or confirm purchase orders. Also use when the user mentions 询价、报价、比价、下单、刹车片、配件.
3
+ version: 0.3.8
4
+ description: "汽配询报价管理技能,支持账号注册/登录、创建询价单(多配件/VIN解析)、监听报价、比价分析。Use when the user wants to create an inquiry (RFQ), manage quotations, compare prices from suppliers, or confirm purchase orders. Also use when the user mentions 询价、报价、比价、下单、刹车片、配件."
4
5
  ---
5
6
 
6
7
  # Quote Skill
@@ -13,6 +13,10 @@ const require = createRequire(import.meta.url);
13
13
  const { version } = require('../../package.json');
14
14
 
15
15
  const PKG = '@dalehkx/quote-cli';
16
+ // 主:自托管 well-known 端点(GitHub Pages,不需要认证)
17
+ // 备:GitHub slug(公开仓库时可用,私有仓库需要登录)
18
+ const SKILL_URL = 'https://asdasas1212.github.io/agent-skills';
19
+ const SKILL_REPO_FALLBACK = 'asdasas1212/quote-skill';
16
20
  const isWindows = process.platform === 'win32';
17
21
 
18
22
  function execCmd(cmd, args, opts) {
@@ -84,41 +88,52 @@ async function stepInstallCli() {
84
88
  }
85
89
  }
86
90
 
91
+ function printAgentsLine(out) {
92
+ // 去掉 ANSI 控制码,找 "Installing to:" 那行
93
+ const clean = out.replace(/\x1b\[[0-9;]*[a-zA-Z]|\[?\?25[lh]/g, '');
94
+ const line = clean.split('\n').find(l => l.includes('Installing to:'));
95
+ if (line) console.log(' ', line.trim());
96
+ }
97
+
87
98
  async function stepInstallSkill() {
88
- // 找全局包内的 skill 目录
89
- let skillSrc;
99
+ process.stdout.write(' 正在安装 Skill...');
90
100
  try {
91
- const prefix = execFileSync('npm', ['prefix', '-g'], {
92
- stdio: ['ignore', 'pipe', 'pipe'],
93
- }).toString().trim();
94
- const candidates = [
95
- path.join(prefix, 'lib', 'node_modules', PKG, 'skill'),
96
- path.join(prefix, 'node_modules', PKG, 'skill'),
97
- ];
98
- skillSrc = candidates.find(p => fs.existsSync(p));
99
- } catch { /* ignore */ }
100
-
101
- if (!skillSrc) {
102
- console.log(' ✗ 未找到 skill 目录,跳过');
103
- return;
104
- }
105
-
106
- // playbooks 依赖 TTY(Ink 框架),非 TTY 环境直接跳过
107
- if (process.stdin.isTTY) {
101
+ // 优先尝试自托管 URL(无需认证)
102
+ const out = await runAsync('npx', ['-y', 'skills', 'add', SKILL_URL, '-y', '-g'], { timeout: 60000 });
103
+ console.log(' 完成');
104
+ printAgentsLine(out);
105
+ } catch {
108
106
  try {
109
- execCmd('npx', ['-y', 'playbooks', 'add', 'skill', skillSrc, '-g', '-y'], {
110
- stdio: 'inherit',
111
- timeout: 60000,
112
- });
113
- console.log(' ✓ Skill 已安装到所有支持的 agent');
114
- return;
115
- } catch { /* 回退到手动复制 */ }
107
+ // 回退到 GitHub slug(公开仓库)
108
+ const out = await runAsync('npx', ['-y', 'skills', 'add', SKILL_REPO_FALLBACK, '-y', '-g'], { timeout: 60000 });
109
+ console.log(' 完成');
110
+ printAgentsLine(out);
111
+ } catch {
112
+ // 网络不通时回退到从全局包复制到 Claude Code
113
+ console.log('');
114
+ process.stdout.write(' 网络不可用,回退到本地安装...');
115
+ let skillSrc;
116
+ try {
117
+ const prefix = execFileSync('npm', ['prefix', '-g'], {
118
+ stdio: ['ignore', 'pipe', 'pipe'],
119
+ }).toString().trim();
120
+ const candidates = [
121
+ path.join(prefix, 'lib', 'node_modules', PKG, 'skill'),
122
+ path.join(prefix, 'node_modules', PKG, 'skill'),
123
+ ];
124
+ skillSrc = candidates.find(p => fs.existsSync(p));
125
+ } catch { /* ignore */ }
126
+
127
+ if (skillSrc) {
128
+ const agentsDest = path.join(os.homedir(), '.agents', 'skills', 'cass-quote');
129
+ copyDir(skillSrc, agentsDest);
130
+ console.log(` 完成`);
131
+ } else {
132
+ console.log('');
133
+ console.error(` ✗ 安装失败,请手动执行: npx skills add ${SKILL_URL} -y -g`);
134
+ }
135
+ }
116
136
  }
117
-
118
- // 回退:直接复制到 Claude Code
119
- const claudeDest = path.join(os.homedir(), '.claude', 'skills', 'cass-quote');
120
- copyDir(skillSrc, claudeDest);
121
- console.log(` ✓ Skill 已安装到 Claude Code (${claudeDest})`);
122
137
  }
123
138
 
124
139
  function copyDir(src, dest) {