@dalehkx/quote-cli 0.3.8 → 0.3.9
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 +1 -1
- package/scripts/prepack.cjs +5 -11
- package/skill/SKILL.md +2 -1
- package/src/commands/install.mjs +28 -31
package/package.json
CHANGED
package/scripts/prepack.cjs
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// prepack: sync
|
|
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, '
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
package/src/commands/install.mjs
CHANGED
|
@@ -13,6 +13,7 @@ const require = createRequire(import.meta.url);
|
|
|
13
13
|
const { version } = require('../../package.json');
|
|
14
14
|
|
|
15
15
|
const PKG = '@dalehkx/quote-cli';
|
|
16
|
+
const SKILL_REPO = 'asdasas1212/quote-skill';
|
|
16
17
|
const isWindows = process.platform === 'win32';
|
|
17
18
|
|
|
18
19
|
function execCmd(cmd, args, opts) {
|
|
@@ -85,40 +86,36 @@ async function stepInstallCli() {
|
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
async function stepInstallSkill() {
|
|
88
|
-
|
|
89
|
-
let skillSrc;
|
|
89
|
+
process.stdout.write(' 正在安装 Skill...');
|
|
90
90
|
try {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
skillSrc
|
|
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) {
|
|
91
|
+
// skills CLI 静默运行,不需要 TTY,跨平台支持所有 agent
|
|
92
|
+
await runAsync('npx', ['-y', 'skills', 'add', SKILL_REPO, '-y', '-g'], { timeout: 60000 });
|
|
93
|
+
console.log(' 完成');
|
|
94
|
+
} catch {
|
|
95
|
+
// 网络不通时回退到从全局包复制到 Claude Code
|
|
96
|
+
console.log('');
|
|
97
|
+
process.stdout.write(' 网络不可用,回退到本地安装...');
|
|
98
|
+
let skillSrc;
|
|
108
99
|
try {
|
|
109
|
-
|
|
110
|
-
stdio: '
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
100
|
+
const prefix = execFileSync('npm', ['prefix', '-g'], {
|
|
101
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
102
|
+
}).toString().trim();
|
|
103
|
+
const candidates = [
|
|
104
|
+
path.join(prefix, 'lib', 'node_modules', PKG, 'skill'),
|
|
105
|
+
path.join(prefix, 'node_modules', PKG, 'skill'),
|
|
106
|
+
];
|
|
107
|
+
skillSrc = candidates.find(p => fs.existsSync(p));
|
|
108
|
+
} catch { /* ignore */ }
|
|
109
|
+
|
|
110
|
+
if (skillSrc) {
|
|
111
|
+
const claudeDest = path.join(os.homedir(), '.claude', 'skills', 'cass-quote');
|
|
112
|
+
copyDir(skillSrc, claudeDest);
|
|
113
|
+
console.log(` 完成 (仅 Claude Code)`);
|
|
114
|
+
} else {
|
|
115
|
+
console.log('');
|
|
116
|
+
console.error(fmt(' ✗ 安装失败,请手动执行: npx skills add %s -y -g', SKILL_REPO));
|
|
117
|
+
}
|
|
116
118
|
}
|
|
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
119
|
}
|
|
123
120
|
|
|
124
121
|
function copyDir(src, dest) {
|