prizmkit 1.0.22 → 1.0.24
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/bundled/VERSION.json +3 -3
- package/bundled/skills/_metadata.json +1 -1
- package/package.json +1 -1
- package/src/index.js +13 -1
- package/src/scaffold.js +15 -24
package/bundled/VERSION.json
CHANGED
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -7,11 +7,17 @@
|
|
|
7
7
|
|
|
8
8
|
import { select, confirm, input } from '@inquirer/prompts';
|
|
9
9
|
import chalk from 'chalk';
|
|
10
|
+
import { readFileSync } from 'fs';
|
|
11
|
+
import { dirname, join } from 'path';
|
|
12
|
+
import { fileURLToPath } from 'url';
|
|
10
13
|
import path from 'path';
|
|
11
14
|
import { detectPlatform } from './detect-platform.js';
|
|
12
15
|
import { scaffold } from './scaffold.js';
|
|
13
16
|
import { loadMetadata } from './metadata.js';
|
|
14
17
|
|
|
18
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
19
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf-8'));
|
|
20
|
+
|
|
15
21
|
/**
|
|
16
22
|
* 主入口:交互式脚手架流程
|
|
17
23
|
* @param {string} directory - 目标目录
|
|
@@ -22,8 +28,14 @@ export async function runScaffold(directory, options) {
|
|
|
22
28
|
|
|
23
29
|
// 打印欢迎 banner
|
|
24
30
|
console.log('');
|
|
31
|
+
const versionTag = `v${pkg.version}`;
|
|
32
|
+
const titleText = ` PrizmKit ${versionTag} — 自演化自主开发框架`;
|
|
33
|
+
// Box inner width = 56 visible columns. CJK chars occupy 2 columns each in terminal.
|
|
34
|
+
const BOX_INNER = 56;
|
|
35
|
+
const cjkCount = (titleText.match(/[\u4e00-\u9fff\u3400-\u4dbf\uf900-\ufaff]/g) || []).length;
|
|
36
|
+
const titlePad = ' '.repeat(Math.max(0, BOX_INNER - titleText.length - cjkCount));
|
|
25
37
|
console.log(chalk.bold('╔════════════════════════════════════════════════════════╗'));
|
|
26
|
-
console.log(chalk.bold('║') + chalk.bold.cyan(' PrizmKit') + chalk.bold(
|
|
38
|
+
console.log(chalk.bold('║') + chalk.bold.cyan(' PrizmKit ') + chalk.bold(`${versionTag} — 自演化自主开发框架${titlePad}`) + chalk.bold('║'));
|
|
27
39
|
console.log(chalk.bold('║') + ' Create a clean, focused project environment ' + chalk.bold('║'));
|
|
28
40
|
console.log(chalk.bold('╚════════════════════════════════════════════════════════╝'));
|
|
29
41
|
console.log('');
|
package/src/scaffold.js
CHANGED
|
@@ -165,37 +165,28 @@ async function installSkills(platform, skills, projectRoot, dryRun) {
|
|
|
165
165
|
const hasAssets = await fs.pathExists(path.join(corePath, 'assets'));
|
|
166
166
|
const hasScripts = await fs.pathExists(path.join(corePath, 'scripts'));
|
|
167
167
|
|
|
168
|
+
// Always write the command file at the flat level (.claude/commands/skillName.md)
|
|
169
|
+
// so Claude Code shows it as /skillName (not /skillName:skillName).
|
|
170
|
+
// Assets/scripts are copied into a subdirectory for reference.
|
|
171
|
+
const commandsDir = path.join(projectRoot, '.claude', 'commands');
|
|
172
|
+
if (dryRun) {
|
|
173
|
+
console.log(chalk.gray(` [dry-run] .claude/commands/${skillName}.md`));
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
await fs.ensureDir(commandsDir);
|
|
177
|
+
await fs.writeFile(path.join(commandsDir, `${skillName}.md`), converted);
|
|
178
|
+
|
|
168
179
|
if (hasAssets || hasScripts) {
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
console.log(chalk.gray(` [dry-run] .claude/commands/${skillName}/`));
|
|
172
|
-
continue;
|
|
173
|
-
}
|
|
174
|
-
await fs.ensureDir(targetDir);
|
|
175
|
-
await fs.writeFile(
|
|
176
|
-
path.join(targetDir, `${skillName}.md`),
|
|
177
|
-
converted
|
|
178
|
-
);
|
|
180
|
+
const assetTargetDir = path.join(commandsDir, skillName);
|
|
181
|
+
await fs.ensureDir(assetTargetDir);
|
|
179
182
|
for (const subdir of ['assets', 'scripts']) {
|
|
180
183
|
const srcSubdir = path.join(corePath, subdir);
|
|
181
184
|
if (await fs.pathExists(srcSubdir)) {
|
|
182
|
-
await fs.copy(srcSubdir, path.join(
|
|
185
|
+
await fs.copy(srcSubdir, path.join(assetTargetDir, subdir));
|
|
183
186
|
}
|
|
184
187
|
}
|
|
185
|
-
console.log(chalk.green(` ✓ .claude/commands/${skillName}/`));
|
|
186
|
-
} else {
|
|
187
|
-
const targetDir = path.join(projectRoot, '.claude', 'commands');
|
|
188
|
-
if (dryRun) {
|
|
189
|
-
console.log(chalk.gray(` [dry-run] .claude/commands/${skillName}.md`));
|
|
190
|
-
continue;
|
|
191
|
-
}
|
|
192
|
-
await fs.ensureDir(targetDir);
|
|
193
|
-
await fs.writeFile(
|
|
194
|
-
path.join(targetDir, `${skillName}.md`),
|
|
195
|
-
converted
|
|
196
|
-
);
|
|
197
|
-
console.log(chalk.green(` ✓ .claude/commands/${skillName}.md`));
|
|
198
188
|
}
|
|
189
|
+
console.log(chalk.green(` ✓ .claude/commands/${skillName}.md`));
|
|
199
190
|
}
|
|
200
191
|
}
|
|
201
192
|
}
|