prizmkit 1.0.136 → 1.0.137
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/manifest.js +3 -0
- package/src/scaffold.js +36 -7
- package/src/upgrade.js +20 -0
package/bundled/VERSION.json
CHANGED
package/package.json
CHANGED
package/src/manifest.js
CHANGED
|
@@ -55,6 +55,7 @@ export async function writeManifest(projectRoot, data) {
|
|
|
55
55
|
* @param {boolean} params.team - whether team config was installed
|
|
56
56
|
* @param {string} [params.aiCli] - AI CLI command
|
|
57
57
|
* @param {string} [params.rulesPreset] - rules preset name
|
|
58
|
+
* @param {string[]} [params.extras] - installed extras (e.g. ['playwright-cli'])
|
|
58
59
|
* @returns {Object} manifest
|
|
59
60
|
*/
|
|
60
61
|
export function buildManifest({
|
|
@@ -68,6 +69,7 @@ export function buildManifest({
|
|
|
68
69
|
team,
|
|
69
70
|
aiCli,
|
|
70
71
|
rulesPreset,
|
|
72
|
+
extras,
|
|
71
73
|
}) {
|
|
72
74
|
const now = new Date().toISOString();
|
|
73
75
|
return {
|
|
@@ -87,6 +89,7 @@ export function buildManifest({
|
|
|
87
89
|
agents: [...agents],
|
|
88
90
|
rules: [...rules],
|
|
89
91
|
pipeline: pipeline ? [...pipeline] : [],
|
|
92
|
+
extras: extras ? [...extras] : [],
|
|
90
93
|
other: [platform === 'claude' ? 'CLAUDE.md' : platform === 'codebuddy' ? 'CODEBUDDY.md' : 'CLAUDE.md'],
|
|
91
94
|
},
|
|
92
95
|
};
|
package/src/scaffold.js
CHANGED
|
@@ -676,6 +676,7 @@ export async function installPipeline(projectRoot, dryRun, { forceOverwrite = fa
|
|
|
676
676
|
*/
|
|
677
677
|
export async function installGitignore(projectRoot, options, dryRun) {
|
|
678
678
|
const targetPath = path.join(projectRoot, '.gitignore');
|
|
679
|
+
const templateContent = generateGitignore({ pipeline: options.pipeline });
|
|
679
680
|
|
|
680
681
|
if (dryRun) {
|
|
681
682
|
console.log(chalk.gray(` [dry-run] .gitignore`));
|
|
@@ -683,12 +684,22 @@ export async function installGitignore(projectRoot, options, dryRun) {
|
|
|
683
684
|
}
|
|
684
685
|
|
|
685
686
|
if (await fs.pathExists(targetPath)) {
|
|
686
|
-
|
|
687
|
-
|
|
687
|
+
// 合并模式:追加缺失条目
|
|
688
|
+
const existing = await fs.readFile(targetPath, 'utf-8');
|
|
689
|
+
const existingLines = new Set(existing.split('\n').map(l => l.trim()));
|
|
690
|
+
const templateLines = templateContent.split('\n').map(l => l.trim()).filter(Boolean);
|
|
691
|
+
const missing = templateLines.filter(line => !existingLines.has(line) && !line.startsWith('#'));
|
|
692
|
+
|
|
693
|
+
if (missing.length > 0) {
|
|
694
|
+
const separator = existing.endsWith('\n') ? '' : '\n';
|
|
695
|
+
await fs.appendFile(targetPath, separator + '\n# PrizmKit\n' + missing.join('\n') + '\n');
|
|
696
|
+
console.log(chalk.green(` ✓ .gitignore (added ${missing.length} entries)`));
|
|
697
|
+
} else {
|
|
698
|
+
console.log(chalk.green(' ✓ .gitignore (up-to-date)'));
|
|
699
|
+
}
|
|
688
700
|
} else {
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
console.log(chalk.green(` ✓ .gitignore`));
|
|
701
|
+
await fs.writeFile(targetPath, templateContent);
|
|
702
|
+
console.log(chalk.green(' ✓ .gitignore'));
|
|
692
703
|
}
|
|
693
704
|
}
|
|
694
705
|
|
|
@@ -733,6 +744,21 @@ export async function installPlaywrightCli(projectRoot, dryRun) {
|
|
|
733
744
|
}
|
|
734
745
|
}
|
|
735
746
|
|
|
747
|
+
// ============================================================
|
|
748
|
+
// Extras 注册表
|
|
749
|
+
// ============================================================
|
|
750
|
+
|
|
751
|
+
/**
|
|
752
|
+
* 外部工具注册表。upgrade.js 遍历此表来安装/更新外部工具。
|
|
753
|
+
* 新增工具只需:1) 写 installXxx 函数 2) 加一行到此表
|
|
754
|
+
*/
|
|
755
|
+
export const EXTRAS_REGISTRY = {
|
|
756
|
+
'playwright-cli': {
|
|
757
|
+
label: '浏览器交互工具',
|
|
758
|
+
install: installPlaywrightCli,
|
|
759
|
+
},
|
|
760
|
+
};
|
|
761
|
+
|
|
736
762
|
// ============================================================
|
|
737
763
|
// 主安装函数
|
|
738
764
|
// ============================================================
|
|
@@ -846,9 +872,11 @@ export async function scaffold(config) {
|
|
|
846
872
|
}
|
|
847
873
|
}
|
|
848
874
|
|
|
849
|
-
// 10.
|
|
875
|
+
// 10. Extras (external tools via registry)
|
|
876
|
+
const activeExtras = [];
|
|
850
877
|
if (playwrightCli) {
|
|
851
|
-
|
|
878
|
+
activeExtras.push('playwright-cli');
|
|
879
|
+
console.log(chalk.blue(` ${EXTRAS_REGISTRY['playwright-cli'].label}:`));
|
|
852
880
|
await installPlaywrightCli(projectRoot, dryRun);
|
|
853
881
|
console.log('');
|
|
854
882
|
}
|
|
@@ -894,6 +922,7 @@ export async function scaffold(config) {
|
|
|
894
922
|
team,
|
|
895
923
|
aiCli,
|
|
896
924
|
rulesPreset: rulesPresetName,
|
|
925
|
+
extras: activeExtras,
|
|
897
926
|
});
|
|
898
927
|
await writeManifest(projectRoot, manifest);
|
|
899
928
|
console.log(chalk.green(' ✓ .prizmkit/manifest.json'));
|
package/src/upgrade.js
CHANGED
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
installGitignore,
|
|
31
31
|
installProjectMemory,
|
|
32
32
|
resolvePipelineFileList,
|
|
33
|
+
EXTRAS_REGISTRY,
|
|
33
34
|
} from './scaffold.js';
|
|
34
35
|
|
|
35
36
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
@@ -244,6 +245,13 @@ export async function runUpgrade(directory, options = {}) {
|
|
|
244
245
|
// Resolve pipeline file list from source (for manifest diff)
|
|
245
246
|
const newPipelineFiles = pipeline ? resolvePipelineFileList() : [];
|
|
246
247
|
|
|
248
|
+
// Resolve extras: merge old manifest extras + default extras for old manifests without the field
|
|
249
|
+
const extrasToInstall = [...new Set([
|
|
250
|
+
...(oldManifest?.files?.extras || []),
|
|
251
|
+
// Old manifests without extras field: default to all registered extras
|
|
252
|
+
...(!oldManifest?.files?.extras ? Object.keys(EXTRAS_REGISTRY) : []),
|
|
253
|
+
])].filter(name => EXTRAS_REGISTRY[name]); // only keep extras that still exist in registry
|
|
254
|
+
|
|
247
255
|
// 4. Build new manifest and compute diff
|
|
248
256
|
const newManifest = buildManifest({
|
|
249
257
|
version: pkg.version,
|
|
@@ -256,6 +264,7 @@ export async function runUpgrade(directory, options = {}) {
|
|
|
256
264
|
team,
|
|
257
265
|
aiCli,
|
|
258
266
|
rulesPreset,
|
|
267
|
+
extras: extrasToInstall,
|
|
259
268
|
});
|
|
260
269
|
|
|
261
270
|
// Preserve original installedAt
|
|
@@ -360,6 +369,17 @@ export async function runUpgrade(directory, options = {}) {
|
|
|
360
369
|
console.log('');
|
|
361
370
|
}
|
|
362
371
|
|
|
372
|
+
// Extras (external tools via registry)
|
|
373
|
+
if (extrasToInstall.length > 0) {
|
|
374
|
+
for (const extraName of extrasToInstall) {
|
|
375
|
+
const entry = EXTRAS_REGISTRY[extraName];
|
|
376
|
+
if (!entry) continue;
|
|
377
|
+
console.log(chalk.blue(` ${entry.label}:`));
|
|
378
|
+
await entry.install(projectRoot, dryRun);
|
|
379
|
+
console.log('');
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
363
383
|
// Git hook
|
|
364
384
|
console.log(chalk.blue(' Git Hook:'));
|
|
365
385
|
await installGitHook(projectRoot, dryRun);
|