prizmkit 1.1.161 → 1.1.164
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/create-prizmkit.js +4 -4
- package/bundled/VERSION.json +3 -3
- package/bundled/adapters/cursor/assets/prizmkit-hook.cjs +65 -0
- package/bundled/adapters/cursor/hooks-adapter.js +139 -0
- package/bundled/adapters/cursor/paths.js +11 -0
- package/bundled/adapters/cursor/rules-adapter.js +49 -0
- package/bundled/adapters/cursor/skill-adapter.js +27 -0
- package/bundled/dev-pipeline/README.md +21 -6
- package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +3 -25
- package/bundled/dev-pipeline/prizmkit_runtime/config.py +71 -14
- package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +28 -4
- package/bundled/dev-pipeline/prizmkit_runtime/heartbeat.py +5 -2
- package/bundled/dev-pipeline/prizmkit_runtime/platform_detection.py +21 -3
- package/bundled/dev-pipeline/prizmkit_runtime/runners.py +82 -9
- package/bundled/dev-pipeline/prizmkit_runtime/runtime_commit.py +123 -0
- package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +123 -28
- package/bundled/dev-pipeline/prizmkit_runtime/status.py +2 -0
- package/bundled/dev-pipeline/prizmkit_runtime/test_result.py +1 -42
- package/bundled/dev-pipeline/scripts/init-bugfix-pipeline.py +43 -6
- package/bundled/dev-pipeline/scripts/init-pipeline.py +46 -8
- package/bundled/dev-pipeline/scripts/init-refactor-pipeline.py +41 -6
- package/bundled/dev-pipeline/scripts/parse-stream-progress.py +143 -27
- package/bundled/dev-pipeline/scripts/update-bug-status.py +8 -4
- package/bundled/dev-pipeline/scripts/update-feature-status.py +12 -8
- package/bundled/dev-pipeline/scripts/update-refactor-status.py +8 -4
- package/bundled/dev-pipeline/scripts/utils.py +3 -12
- package/bundled/dev-pipeline/templates/bug-fix-list-schema.json +4 -2
- package/bundled/dev-pipeline/templates/feature-list-schema.json +4 -2
- package/bundled/dev-pipeline/templates/refactor-list-schema.json +4 -2
- package/bundled/dev-pipeline/tests/live_ai_cli_log_smoke.py +2 -1
- package/bundled/dev-pipeline/tests/test_checkpoint_state.py +5 -23
- package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +2 -2
- package/bundled/dev-pipeline/tests/test_python_runner_parity.py +452 -6
- package/bundled/dev-pipeline/tests/test_runtime_commit.py +138 -1
- package/bundled/dev-pipeline/tests/test_unified_cli.py +406 -30
- package/bundled/dev-pipeline/tests/test_utils.py +23 -0
- package/bundled/rules/USAGE.md +3 -0
- package/bundled/skills/_metadata.json +1 -1
- package/bundled/skills/bug-planner/SKILL.md +0 -1
- package/bundled/skills/bug-planner/references/verification.md +0 -2
- package/bundled/skills/bug-planner/scripts/validate-bug-list.py +37 -7
- package/bundled/skills/feature-planner/SKILL.md +5 -8
- package/bundled/skills/feature-planner/scripts/validate-and-generate.py +43 -19
- package/bundled/skills/prizmkit-init/SKILL.md +1 -1
- package/bundled/skills/prizmkit-init/references/config-schema.md +2 -2
- package/bundled/skills/prizmkit-plan/references/review-plan-spec-loop.md +2 -3
- package/bundled/skills/prizmkit-prizm-docs/assets/prizm-docs-format.md +1 -1
- package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +1 -1
- package/bundled/skills/refactor-planner/SKILL.md +1 -3
- package/bundled/skills/refactor-planner/scripts/validate-and-generate-refactor.py +38 -9
- package/package.json +4 -2
- package/src/ai-cli-launch.js +9 -2
- package/src/clean.js +42 -6
- package/src/config.js +51 -10
- package/src/detect-platform.js +30 -8
- package/src/external-skills.js +33 -99
- package/src/index.js +5 -0
- package/src/manifest.js +30 -4
- package/src/platforms.js +11 -4
- package/src/prompts.js +12 -4
- package/src/scaffold.js +75 -4
- package/src/upgrade.js +15 -14
package/src/scaffold.js
CHANGED
|
@@ -97,7 +97,7 @@ async function removeEmptyDirectory(dirPath) {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
export async function removeRetiredAgentTeamArtifacts(platform, projectRoot, dryRun) {
|
|
100
|
-
if (platform === 'pi') return;
|
|
100
|
+
if (platform === 'pi' || platform === 'cursor') return;
|
|
101
101
|
const agentDir = platform === 'claude'
|
|
102
102
|
? path.join(projectRoot, '.claude', 'agents')
|
|
103
103
|
: platform === 'codex'
|
|
@@ -234,6 +234,7 @@ export async function installSkills(platform, skills, projectRoot, dryRun, runti
|
|
|
234
234
|
let convertSkillToCommand;
|
|
235
235
|
let convertSkillToCodex;
|
|
236
236
|
let convertSkillToPi;
|
|
237
|
+
let convertSkillToCursor;
|
|
237
238
|
if (platform === 'claude') {
|
|
238
239
|
const commandAdapter = await loadAdapter('claude', 'command-adapter.js');
|
|
239
240
|
convertSkillToCommand = commandAdapter.convertSkillToCommand;
|
|
@@ -243,6 +244,9 @@ export async function installSkills(platform, skills, projectRoot, dryRun, runti
|
|
|
243
244
|
} else if (platform === 'pi') {
|
|
244
245
|
const piSkillAdapter = await loadAdapter('pi', 'skill-adapter.js');
|
|
245
246
|
convertSkillToPi = piSkillAdapter.convertSkill;
|
|
247
|
+
} else if (platform === 'cursor') {
|
|
248
|
+
const cursorSkillAdapter = await loadAdapter('cursor', 'skill-adapter.js');
|
|
249
|
+
convertSkillToCursor = cursorSkillAdapter.convertSkill;
|
|
246
250
|
}
|
|
247
251
|
|
|
248
252
|
for (const skillName of skills) {
|
|
@@ -372,6 +376,25 @@ export async function installSkills(platform, skills, projectRoot, dryRun, runti
|
|
|
372
376
|
}
|
|
373
377
|
}
|
|
374
378
|
console.log(chalk.green(` ✓ .pi/skills/${skillName}/`));
|
|
379
|
+
} else if (platform === 'cursor') {
|
|
380
|
+
const content = await fs.readFile(skillMdPath, 'utf8');
|
|
381
|
+
const converted = convertSkillToCursor(content, skillName);
|
|
382
|
+
const targetDir = path.join(projectRoot, '.cursor', 'skills', skillName);
|
|
383
|
+
|
|
384
|
+
if (dryRun) {
|
|
385
|
+
console.log(chalk.gray(` [dry-run] .cursor/skills/${skillName}/`));
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
await fs.remove(targetDir);
|
|
390
|
+
await fs.ensureDir(targetDir);
|
|
391
|
+
await fs.writeFile(path.join(targetDir, 'SKILL.md'), converted);
|
|
392
|
+
for (const entry of await fs.readdir(corePath, { withFileTypes: true })) {
|
|
393
|
+
if (entry.isDirectory()) {
|
|
394
|
+
await fs.copy(path.join(corePath, entry.name), path.join(targetDir, entry.name));
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
console.log(chalk.green(` ✓ .cursor/skills/${skillName}/`));
|
|
375
398
|
}
|
|
376
399
|
}
|
|
377
400
|
}
|
|
@@ -607,6 +630,20 @@ job_max_runtime_seconds = 3300
|
|
|
607
630
|
await installRules(projectRoot, ruleFiles);
|
|
608
631
|
console.log(chalk.green(' ✓ .pi/settings.json'));
|
|
609
632
|
console.log(chalk.green(` ✓ .pi/rules/ (${ruleFiles.length} 条规则)`));
|
|
633
|
+
} else if (platform === 'cursor') {
|
|
634
|
+
if (dryRun) {
|
|
635
|
+
console.log(chalk.gray(' [dry-run] .cursor/hooks.json'));
|
|
636
|
+
console.log(chalk.gray(' [dry-run] .cursor/hooks/prizmkit-hook.cjs'));
|
|
637
|
+
console.log(chalk.gray(` [dry-run] .cursor/rules/ (${ruleFiles.length} 条规则)`));
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
const { installHooks } = await loadAdapter('cursor', 'hooks-adapter.js');
|
|
641
|
+
const { installRules } = await loadAdapter('cursor', 'rules-adapter.js');
|
|
642
|
+
await installHooks(projectRoot);
|
|
643
|
+
await installRules(projectRoot, ruleFiles);
|
|
644
|
+
console.log(chalk.green(' ✓ .cursor/hooks.json'));
|
|
645
|
+
console.log(chalk.green(' ✓ .cursor/hooks/prizmkit-hook.cjs'));
|
|
646
|
+
console.log(chalk.green(` ✓ .cursor/rules/ (${ruleFiles.length} 条规则)`));
|
|
610
647
|
}
|
|
611
648
|
}
|
|
612
649
|
|
|
@@ -1012,6 +1049,23 @@ export async function installProjectMemory(platform, projectRoot, dryRun) {
|
|
|
1012
1049
|
const templateName = 'project-memory-template.md';
|
|
1013
1050
|
const mainName = projectMemoryFile(platform);
|
|
1014
1051
|
const privateName = privateProjectMemoryFile(platform);
|
|
1052
|
+
|
|
1053
|
+
if (platform === 'cursor') {
|
|
1054
|
+
const templatePath = path.join(templatesDir, templateName);
|
|
1055
|
+
if (!await fs.pathExists(templatePath)) {
|
|
1056
|
+
console.log(chalk.yellow(` ⚠ 模板文件不存在: ${templateName},跳过`));
|
|
1057
|
+
return;
|
|
1058
|
+
}
|
|
1059
|
+
if (dryRun) {
|
|
1060
|
+
console.log(chalk.gray(' [dry-run] .cursor/rules/prizmkit-framework.mdc'));
|
|
1061
|
+
return;
|
|
1062
|
+
}
|
|
1063
|
+
const { installFrameworkGuidance } = await loadAdapter('cursor', 'rules-adapter.js');
|
|
1064
|
+
await installFrameworkGuidance(projectRoot, (await fs.readFile(templatePath, 'utf8')).trimEnd());
|
|
1065
|
+
console.log(chalk.green(' ✓ .cursor/rules/prizmkit-framework.mdc'));
|
|
1066
|
+
return;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1015
1069
|
if (!privateName) return;
|
|
1016
1070
|
|
|
1017
1071
|
const mainPath = mainName ? path.join(projectRoot, mainName) : null;
|
|
@@ -1589,10 +1643,16 @@ export const EXTRAS_REGISTRY = {
|
|
|
1589
1643
|
// 主安装函数
|
|
1590
1644
|
// ============================================================
|
|
1591
1645
|
|
|
1646
|
+
const SCAFFOLD_CONFIG_FIELDS = new Set([
|
|
1647
|
+
'platform', 'runtime', 'skills', 'pipeline', 'rules', 'aiCli', 'aiCliLaunch',
|
|
1648
|
+
'externalSkills', 'playwrightCli', 'openCli', 'openCliAutoDownload',
|
|
1649
|
+
'projectRoot', 'dryRun',
|
|
1650
|
+
]);
|
|
1651
|
+
|
|
1592
1652
|
/**
|
|
1593
1653
|
* 执行纯净安装
|
|
1594
1654
|
* @param {Object} config
|
|
1595
|
-
* @param {string} config.platform - 'codebuddy' | 'claude' | 'codex' | 'pi' | 'all'
|
|
1655
|
+
* @param {string} config.platform - 'codebuddy' | 'claude' | 'codex' | 'pi' | 'cursor' | 'all'
|
|
1596
1656
|
* @param {string} [config.runtime] - 'python' (legacy aliases accepted: 'unix' | 'windows')
|
|
1597
1657
|
* @param {string} config.skills - 'core' | 'minimal' | 'recommended:<type>'
|
|
1598
1658
|
* @param {boolean} config.pipeline - 是否安装 dev-pipeline
|
|
@@ -1606,6 +1666,15 @@ export const EXTRAS_REGISTRY = {
|
|
|
1606
1666
|
* @param {boolean} config.dryRun - 是否为预览模式
|
|
1607
1667
|
*/
|
|
1608
1668
|
export async function scaffold(config) {
|
|
1669
|
+
if (config === null || Array.isArray(config) || typeof config !== 'object') {
|
|
1670
|
+
throw new TypeError('scaffold config must be an object');
|
|
1671
|
+
}
|
|
1672
|
+
const unknownFields = Object.keys(config)
|
|
1673
|
+
.filter(key => !SCAFFOLD_CONFIG_FIELDS.has(key))
|
|
1674
|
+
.sort();
|
|
1675
|
+
if (unknownFields.length) {
|
|
1676
|
+
throw new TypeError(`scaffold config has unknown fields: ${unknownFields.join(', ')}`);
|
|
1677
|
+
}
|
|
1609
1678
|
const { platform, skills, pipeline, rules, aiCli, aiCliLaunch, externalSkills, playwrightCli, openCli, openCliAutoDownload, projectRoot, dryRun } = config;
|
|
1610
1679
|
const runtime = normalizeRuntime(config.runtime);
|
|
1611
1680
|
const launchSelection = resolveAiCliLaunchSelection(aiCli || '', {
|
|
@@ -1614,7 +1683,7 @@ export async function scaffold(config) {
|
|
|
1614
1683
|
});
|
|
1615
1684
|
const resolvedAiCli = launchSelection.aiCli;
|
|
1616
1685
|
if (!isKnownPlatform(platform)) {
|
|
1617
|
-
throw new Error(`Unknown platform "${platform}". Expected codebuddy, claude, codex, pi, or all.`);
|
|
1686
|
+
throw new Error(`Unknown platform "${platform}". Expected codebuddy, claude, codex, pi, cursor, or all.`);
|
|
1618
1687
|
}
|
|
1619
1688
|
const platforms = expandPlatforms(platform);
|
|
1620
1689
|
const payloadPlatforms = resolvePayloadPlatforms(platform, resolvedAiCli);
|
|
@@ -1796,7 +1865,9 @@ export async function scaffold(config) {
|
|
|
1796
1865
|
? '说 "运行 prizmkit-init"'
|
|
1797
1866
|
: mainPlatform === 'pi'
|
|
1798
1867
|
? '输入 "/skill:prizmkit-init"'
|
|
1799
|
-
:
|
|
1868
|
+
: mainPlatform === 'cursor'
|
|
1869
|
+
? '输入 "/prizmkit-init"'
|
|
1870
|
+
: '说 "/prizmkit-init"';
|
|
1800
1871
|
console.log(` 3. ${chalk.cyan(initInstruction)} ${chalk.gray('# 初始化项目上下文')}`);
|
|
1801
1872
|
|
|
1802
1873
|
if (pipeline) {
|
package/src/upgrade.js
CHANGED
|
@@ -73,10 +73,12 @@ export async function removeSkillFiles(platform, projectRoot, skillNames, dryRun
|
|
|
73
73
|
console.log(chalk.red(` ✗ removed .codebuddy/skills/${skillName}/`));
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
} else if (platform === 'codex' || platform === 'pi') {
|
|
76
|
+
} else if (platform === 'codex' || platform === 'pi' || platform === 'cursor') {
|
|
77
77
|
const skillDir = platform === 'pi'
|
|
78
78
|
? path.join(projectRoot, '.pi', 'skills', skillName)
|
|
79
|
-
:
|
|
79
|
+
: platform === 'cursor'
|
|
80
|
+
? path.join(projectRoot, '.cursor', 'skills', skillName)
|
|
81
|
+
: path.join(projectRoot, '.agents', 'skills', skillName);
|
|
80
82
|
if (await fs.pathExists(skillDir)) {
|
|
81
83
|
if (dryRun) {
|
|
82
84
|
console.log(chalk.gray(` [dry-run] remove ${path.relative(projectRoot, skillDir)}/`));
|
|
@@ -93,7 +95,7 @@ export async function removeSkillFiles(platform, projectRoot, skillNames, dryRun
|
|
|
93
95
|
* Remove agent files for a specific platform.
|
|
94
96
|
*/
|
|
95
97
|
export async function removeAgentFiles(platform, projectRoot, agentFileNames, dryRun) {
|
|
96
|
-
if (platform === 'pi') return;
|
|
98
|
+
if (platform === 'pi' || platform === 'cursor') return;
|
|
97
99
|
for (const fileName of agentFileNames) {
|
|
98
100
|
const dir = platform === 'claude'
|
|
99
101
|
? path.join(projectRoot, '.claude', 'agents')
|
|
@@ -129,9 +131,11 @@ export async function removeRuleFiles(platform, projectRoot, ruleFileNames, dryR
|
|
|
129
131
|
? path.join(projectRoot, '.agents', 'rules')
|
|
130
132
|
: platform === 'pi'
|
|
131
133
|
? path.join(projectRoot, '.pi', 'rules')
|
|
132
|
-
:
|
|
133
|
-
|
|
134
|
-
|
|
134
|
+
: platform === 'cursor'
|
|
135
|
+
? path.join(projectRoot, '.cursor', 'rules')
|
|
136
|
+
: path.join(projectRoot, '.codebuddy', 'rules');
|
|
137
|
+
// Cursor and CodeBuddy use .mdc; Claude/Codex/Pi use Markdown.
|
|
138
|
+
const targetName = platform === 'codebuddy' || platform === 'cursor'
|
|
135
139
|
? baseName.replace(/\.md$/, '.mdc')
|
|
136
140
|
: baseName;
|
|
137
141
|
const filePaths = platform === 'codex'
|
|
@@ -249,12 +253,14 @@ export async function runUpgrade(directory, options = {}) {
|
|
|
249
253
|
const hasCodeBuddy = await hasPlatformFiles(path.join(projectRoot, '.codebuddy', 'skills'));
|
|
250
254
|
const hasCodex = await hasPlatformFiles(path.join(projectRoot, '.agents', 'skills'));
|
|
251
255
|
const hasPi = await hasPlatformFiles(path.join(projectRoot, '.pi', 'skills'));
|
|
256
|
+
const hasCursor = await hasPlatformFiles(path.join(projectRoot, '.cursor', 'skills'));
|
|
252
257
|
|
|
253
258
|
const detectedPlatforms = [
|
|
254
259
|
hasCodeBuddy && 'codebuddy',
|
|
255
260
|
hasClaude && 'claude',
|
|
256
261
|
hasCodex && 'codex',
|
|
257
262
|
hasPi && 'pi',
|
|
263
|
+
hasCursor && 'cursor',
|
|
258
264
|
].filter(Boolean);
|
|
259
265
|
|
|
260
266
|
if (detectedPlatforms.length > 1) platform = 'all';
|
|
@@ -298,7 +304,7 @@ export async function runUpgrade(directory, options = {}) {
|
|
|
298
304
|
newManifest.installedAt = oldManifest.installedAt;
|
|
299
305
|
}
|
|
300
306
|
|
|
301
|
-
const diff = oldManifest ? diffManifest(oldManifest, newManifest) : { skills: { added: [], removed: [] }, rules: { added: [], removed: [] }, pipeline: { added: [], removed: [] }, extras: { added: [], removed: [] }
|
|
307
|
+
const diff = oldManifest ? diffManifest(oldManifest, newManifest) : { skills: { added: [], removed: [] }, rules: { added: [], removed: [] }, pipeline: { added: [], removed: [] }, extras: { added: [], removed: [] } };
|
|
302
308
|
const removedPipelineSet = new Set(diff.pipeline.removed);
|
|
303
309
|
const staleManagedPipelineFiles = pipeline
|
|
304
310
|
? (await findStaleManagedPipelineFiles(projectRoot, runtime))
|
|
@@ -315,12 +321,11 @@ export async function runUpgrade(directory, options = {}) {
|
|
|
315
321
|
console.log('');
|
|
316
322
|
|
|
317
323
|
const totalAdded = diff.skills.added.length + diff.rules.added.length + diff.pipeline.added.length + diff.extras.added.length;
|
|
318
|
-
const totalRemoved = diff.skills.removed.length + diff.rules.removed.length + diff.pipeline.removed.length + diff.extras.removed.length +
|
|
324
|
+
const totalRemoved = diff.skills.removed.length + diff.rules.removed.length + diff.pipeline.removed.length + diff.extras.removed.length + staleManagedPipelineFiles.length;
|
|
319
325
|
const totalUpdated = newSkillList.length + newRuleFiles.length;
|
|
320
326
|
|
|
321
327
|
if (diff.skills.added.length) console.log(chalk.green(` + Skills added: ${diff.skills.added.join(', ')}`));
|
|
322
328
|
if (diff.skills.removed.length) console.log(chalk.red(` - Skills removed: ${diff.skills.removed.join(', ')}`));
|
|
323
|
-
if (diff.legacyAgents.removed.length) console.log(chalk.red(` - Legacy agents removed: ${diff.legacyAgents.removed.join(', ')}`));
|
|
324
329
|
if (diff.rules.added.length) console.log(chalk.green(` + Rules added: ${diff.rules.added.join(', ')}`));
|
|
325
330
|
if (diff.rules.removed.length) console.log(chalk.red(` - Rules removed: ${diff.rules.removed.join(', ')}`));
|
|
326
331
|
if (diff.pipeline.added.length) console.log(chalk.green(` + Pipeline files added: ${diff.pipeline.added.length} file(s)`));
|
|
@@ -352,17 +357,13 @@ export async function runUpgrade(directory, options = {}) {
|
|
|
352
357
|
const platforms = payloadPlatforms;
|
|
353
358
|
|
|
354
359
|
// 7a. Remove orphaned files
|
|
355
|
-
if (diff.skills.removed.length || diff.
|
|
360
|
+
if (diff.skills.removed.length || diff.rules.removed.length || diff.pipeline.removed.length || staleManagedPipelineFiles.length) {
|
|
356
361
|
console.log(chalk.bold('\n Removing orphaned files...'));
|
|
357
362
|
for (const p of platforms) {
|
|
358
363
|
if (diff.skills.removed.length) {
|
|
359
364
|
console.log(chalk.blue(`\n Removed skills (${p}):`));
|
|
360
365
|
await removeSkillFiles(p, projectRoot, diff.skills.removed, dryRun);
|
|
361
366
|
}
|
|
362
|
-
if (diff.legacyAgents.removed.length) {
|
|
363
|
-
console.log(chalk.blue(`\n Removed legacy agents (${p}):`));
|
|
364
|
-
await removeAgentFiles(p, projectRoot, diff.legacyAgents.removed, dryRun);
|
|
365
|
-
}
|
|
366
367
|
console.log(chalk.blue(`\n Removed retired agent/team artifacts (${p}):`));
|
|
367
368
|
await removeRetiredAgentTeamArtifacts(p, projectRoot, dryRun);
|
|
368
369
|
if (diff.rules.removed.length) {
|