code-abyss 2.0.4 → 2.0.5
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/adapters/claude.js
CHANGED
package/bin/adapters/codex.js
CHANGED
package/bin/install.js
CHANGED
|
@@ -300,25 +300,33 @@ function installGeneratedArtifacts(skillsSrcDir, targetDir, backupDir, manifest,
|
|
|
300
300
|
const installDir = path.join(targetDir, targetCfg.dir);
|
|
301
301
|
fs.mkdirSync(installDir, { recursive: true });
|
|
302
302
|
|
|
303
|
+
let totalFiles = 0;
|
|
304
|
+
|
|
303
305
|
skills.forEach((skill) => {
|
|
304
|
-
|
|
305
|
-
const
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
const
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
306
|
+
// 主命令 + aliases 都生成文件
|
|
307
|
+
const names = [skill.name, ...(skill.aliases || [])];
|
|
308
|
+
|
|
309
|
+
names.forEach((cmdName) => {
|
|
310
|
+
const fileName = `${cmdName}.md`;
|
|
311
|
+
const destFile = path.join(installDir, fileName);
|
|
312
|
+
const relFile = path.posix.join(targetCfg.dir, fileName);
|
|
313
|
+
|
|
314
|
+
if (fs.existsSync(destFile)) {
|
|
315
|
+
const backupSubdir = path.join(backupDir, targetCfg.dir);
|
|
316
|
+
fs.mkdirSync(backupSubdir, { recursive: true });
|
|
317
|
+
fs.copyFileSync(destFile, path.join(backupSubdir, fileName));
|
|
318
|
+
manifest.backups.push(relFile);
|
|
319
|
+
info(`备份: ${c.d(relFile)}`);
|
|
320
|
+
}
|
|
315
321
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
322
|
+
const content = generateInvocableContent(skill, targetName);
|
|
323
|
+
fs.writeFileSync(destFile, content);
|
|
324
|
+
manifest.installed.push(relFile);
|
|
325
|
+
totalFiles++;
|
|
326
|
+
});
|
|
319
327
|
});
|
|
320
328
|
|
|
321
|
-
ok(`${targetCfg.dir}/ ${c.d(`(自动生成 ${
|
|
329
|
+
ok(`${targetCfg.dir}/ ${c.d(`(自动生成 ${totalFiles} 个 ${targetCfg.label})`)}`);
|
|
322
330
|
return skills.length;
|
|
323
331
|
}
|
|
324
332
|
|
|
@@ -97,12 +97,17 @@ function normalizeSkillRecord(skillsDir, skillDir, meta) {
|
|
|
97
97
|
const scriptPath = scriptEntries[0] || null;
|
|
98
98
|
const skillPath = path.join(skillDir, 'SKILL.md');
|
|
99
99
|
|
|
100
|
+
const aliases = normalizedMeta.aliases
|
|
101
|
+
? String(normalizedMeta.aliases).split(',').map(a => a.trim()).filter(Boolean)
|
|
102
|
+
: [];
|
|
103
|
+
|
|
100
104
|
return {
|
|
101
105
|
name,
|
|
102
106
|
description,
|
|
103
107
|
userInvocable,
|
|
104
108
|
allowedTools,
|
|
105
109
|
argumentHint,
|
|
110
|
+
aliases,
|
|
106
111
|
relPath,
|
|
107
112
|
category,
|
|
108
113
|
runtimeType,
|
package/package.json
CHANGED
|
@@ -80,6 +80,15 @@ function parseArgs(argv) {
|
|
|
80
80
|
return { last, dryRun };
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
// ─── 跨平台 slug ─────────────────────────────────────────
|
|
84
|
+
|
|
85
|
+
function cwdToSlug(cwd) {
|
|
86
|
+
// Claude 项目目录 slug:所有路径分隔符替换为 -,保留前导 -
|
|
87
|
+
// Windows: C:\Users\foo → -C--Users-foo
|
|
88
|
+
// Linux/Mac: /home/foo → -home-foo
|
|
89
|
+
return cwd.replace(/[\\/]/g, '-');
|
|
90
|
+
}
|
|
91
|
+
|
|
83
92
|
// ─── 环境检测 ─────────────────────────────────────────────
|
|
84
93
|
|
|
85
94
|
function detectRuntime() {
|
|
@@ -94,8 +103,7 @@ function detectRuntime() {
|
|
|
94
103
|
const claudeProjects = path.join(home, '.claude', 'projects');
|
|
95
104
|
|
|
96
105
|
// 优先检测当前 cwd 是否有对应的 claude project
|
|
97
|
-
const
|
|
98
|
-
const slug = cwd.replace(/\//g, '-').replace(/^-/, '');
|
|
106
|
+
const slug = cwdToSlug(process.cwd());
|
|
99
107
|
const claudeProjectDir = path.join(claudeProjects, slug);
|
|
100
108
|
if (fs.existsSync(claudeProjectDir)) return 'claude';
|
|
101
109
|
if (fs.existsSync(codexSessions)) return 'codex';
|
|
@@ -106,8 +114,7 @@ function detectRuntime() {
|
|
|
106
114
|
// ─── Claude 会话定位 ─────────────────────────────────────
|
|
107
115
|
|
|
108
116
|
function findClaudeSessionJsonl() {
|
|
109
|
-
const
|
|
110
|
-
const slug = cwd.replace(/\//g, '-').replace(/^-/, '');
|
|
117
|
+
const slug = cwdToSlug(process.cwd());
|
|
111
118
|
const projectDir = path.join(os.homedir(), '.claude', 'projects', slug);
|
|
112
119
|
|
|
113
120
|
if (!fs.existsSync(projectDir)) {
|