prizmkit 1.1.58 → 1.1.61

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.
Files changed (205) hide show
  1. package/bin/create-prizmkit.js +8 -6
  2. package/bundled/VERSION.json +3 -3
  3. package/bundled/adapters/codex/agent-adapter.js +38 -0
  4. package/bundled/adapters/codex/paths.js +27 -0
  5. package/bundled/adapters/codex/rules-adapter.js +30 -0
  6. package/bundled/adapters/codex/settings-adapter.js +27 -0
  7. package/bundled/adapters/codex/skill-adapter.js +65 -0
  8. package/bundled/adapters/codex/team-adapter.js +37 -0
  9. package/bundled/agents/prizm-dev-team-dev.md +6 -5
  10. package/bundled/dev-pipeline/.env.example +2 -1
  11. package/bundled/dev-pipeline/README.md +10 -7
  12. package/bundled/dev-pipeline/lib/common.sh +278 -37
  13. package/bundled/dev-pipeline/run-bugfix.sh +10 -61
  14. package/bundled/dev-pipeline/run-feature.sh +10 -78
  15. package/bundled/dev-pipeline/run-recovery.sh +10 -46
  16. package/bundled/dev-pipeline/run-refactor.sh +10 -61
  17. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +17 -7
  18. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +9 -3
  19. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +9 -3
  20. package/bundled/dev-pipeline/scripts/utils.py +6 -4
  21. package/bundled/dev-pipeline-windows/.env.example +28 -0
  22. package/bundled/dev-pipeline-windows/README.md +30 -0
  23. package/bundled/dev-pipeline-windows/SCHEMA_ANALYSIS.md +525 -0
  24. package/bundled/dev-pipeline-windows/assets/feature-list-example.json +146 -0
  25. package/bundled/dev-pipeline-windows/assets/prizm-dev-team-integration.md +138 -0
  26. package/bundled/dev-pipeline-windows/launch-bugfix-daemon.ps1 +9 -0
  27. package/bundled/dev-pipeline-windows/launch-feature-daemon.ps1 +9 -0
  28. package/bundled/dev-pipeline-windows/launch-refactor-daemon.ps1 +9 -0
  29. package/bundled/dev-pipeline-windows/lib/common.ps1 +432 -0
  30. package/bundled/dev-pipeline-windows/lib/daemon.ps1 +140 -0
  31. package/bundled/dev-pipeline-windows/lib/pipeline.ps1 +446 -0
  32. package/bundled/dev-pipeline-windows/lib/reset.ps1 +87 -0
  33. package/bundled/dev-pipeline-windows/reset-bug.ps1 +9 -0
  34. package/bundled/dev-pipeline-windows/reset-feature.ps1 +9 -0
  35. package/bundled/dev-pipeline-windows/reset-refactor.ps1 +9 -0
  36. package/bundled/dev-pipeline-windows/run-bugfix.ps1 +9 -0
  37. package/bundled/dev-pipeline-windows/run-feature.ps1 +9 -0
  38. package/bundled/dev-pipeline-windows/run-recovery.ps1 +76 -0
  39. package/bundled/dev-pipeline-windows/run-refactor.ps1 +9 -0
  40. package/bundled/dev-pipeline-windows/scripts/check-session-status.py +228 -0
  41. package/bundled/dev-pipeline-windows/scripts/cleanup-logs.py +192 -0
  42. package/bundled/dev-pipeline-windows/scripts/detect-stuck.py +530 -0
  43. package/bundled/dev-pipeline-windows/scripts/generate-bootstrap-prompt.py +1737 -0
  44. package/bundled/dev-pipeline-windows/scripts/generate-bugfix-prompt.py +685 -0
  45. package/bundled/dev-pipeline-windows/scripts/generate-recovery-prompt.py +805 -0
  46. package/bundled/dev-pipeline-windows/scripts/generate-refactor-prompt.py +763 -0
  47. package/bundled/dev-pipeline-windows/scripts/init-bugfix-pipeline.py +316 -0
  48. package/bundled/dev-pipeline-windows/scripts/init-dev-team.py +134 -0
  49. package/bundled/dev-pipeline-windows/scripts/init-pipeline.py +380 -0
  50. package/bundled/dev-pipeline-windows/scripts/init-refactor-pipeline.py +399 -0
  51. package/bundled/dev-pipeline-windows/scripts/parse-stream-progress.py +388 -0
  52. package/bundled/dev-pipeline-windows/scripts/patch-completion-notes.py +191 -0
  53. package/bundled/dev-pipeline-windows/scripts/update-bug-status.py +864 -0
  54. package/bundled/dev-pipeline-windows/scripts/update-checkpoint.py +173 -0
  55. package/bundled/dev-pipeline-windows/scripts/update-feature-status.py +1501 -0
  56. package/bundled/dev-pipeline-windows/scripts/update-refactor-status.py +1073 -0
  57. package/bundled/dev-pipeline-windows/scripts/utils.py +542 -0
  58. package/bundled/dev-pipeline-windows/templates/agent-prompts/critic-plan-challenge.md +7 -0
  59. package/bundled/dev-pipeline-windows/templates/agent-prompts/dev-fix.md +7 -0
  60. package/bundled/dev-pipeline-windows/templates/agent-prompts/dev-implement.md +30 -0
  61. package/bundled/dev-pipeline-windows/templates/agent-prompts/dev-resume.md +5 -0
  62. package/bundled/dev-pipeline-windows/templates/agent-prompts/reviewer-review.md +7 -0
  63. package/bundled/dev-pipeline-windows/templates/bootstrap-prompt.md +46 -0
  64. package/bundled/dev-pipeline-windows/templates/bootstrap-tier1.md +43 -0
  65. package/bundled/dev-pipeline-windows/templates/bootstrap-tier2.md +43 -0
  66. package/bundled/dev-pipeline-windows/templates/bootstrap-tier3.md +43 -0
  67. package/bundled/dev-pipeline-windows/templates/bug-fix-list-schema.json +263 -0
  68. package/bundled/dev-pipeline-windows/templates/bugfix-bootstrap-prompt.md +320 -0
  69. package/bundled/dev-pipeline-windows/templates/feature-list-schema.json +237 -0
  70. package/bundled/dev-pipeline-windows/templates/refactor-bootstrap-prompt.md +331 -0
  71. package/bundled/dev-pipeline-windows/templates/refactor-list-schema.json +270 -0
  72. package/bundled/dev-pipeline-windows/templates/sections/ac-verification-checklist.md +13 -0
  73. package/bundled/dev-pipeline-windows/templates/sections/checkpoint-system.md +91 -0
  74. package/bundled/dev-pipeline-windows/templates/sections/context-budget-rules.md +33 -0
  75. package/bundled/dev-pipeline-windows/templates/sections/critical-paths-agent.md +10 -0
  76. package/bundled/dev-pipeline-windows/templates/sections/critical-paths-full.md +12 -0
  77. package/bundled/dev-pipeline-windows/templates/sections/critical-paths-lite.md +7 -0
  78. package/bundled/dev-pipeline-windows/templates/sections/directory-convention-agent.md +8 -0
  79. package/bundled/dev-pipeline-windows/templates/sections/directory-convention-full.md +9 -0
  80. package/bundled/dev-pipeline-windows/templates/sections/directory-convention-lite.md +6 -0
  81. package/bundled/dev-pipeline-windows/templates/sections/failure-capture.md +21 -0
  82. package/bundled/dev-pipeline-windows/templates/sections/feature-context.md +31 -0
  83. package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification-auto.md +72 -0
  84. package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification-opencli.md +63 -0
  85. package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification.md +62 -0
  86. package/bundled/dev-pipeline-windows/templates/sections/phase-commit-full.md +71 -0
  87. package/bundled/dev-pipeline-windows/templates/sections/phase-commit.md +64 -0
  88. package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-agent-suffix.md +23 -0
  89. package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-base.md +24 -0
  90. package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-lite-suffix.md +12 -0
  91. package/bundled/dev-pipeline-windows/templates/sections/phase-critic-plan-full.md +53 -0
  92. package/bundled/dev-pipeline-windows/templates/sections/phase-critic-plan.md +32 -0
  93. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-agent.md +37 -0
  94. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-full.md +50 -0
  95. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-lite.md +52 -0
  96. package/bundled/dev-pipeline-windows/templates/sections/phase-plan-agent.md +27 -0
  97. package/bundled/dev-pipeline-windows/templates/sections/phase-plan-lite.md +27 -0
  98. package/bundled/dev-pipeline-windows/templates/sections/phase-review-agent.md +27 -0
  99. package/bundled/dev-pipeline-windows/templates/sections/phase-review-full.md +29 -0
  100. package/bundled/dev-pipeline-windows/templates/sections/phase-specify-plan-full.md +77 -0
  101. package/bundled/dev-pipeline-windows/templates/sections/phase0-init.md +13 -0
  102. package/bundled/dev-pipeline-windows/templates/sections/phase0-test-baseline.md +23 -0
  103. package/bundled/dev-pipeline-windows/templates/sections/session-context.md +5 -0
  104. package/bundled/dev-pipeline-windows/templates/sections/subagent-timeout-recovery.md +6 -0
  105. package/bundled/dev-pipeline-windows/templates/sections/test-failure-recovery-agent.md +67 -0
  106. package/bundled/dev-pipeline-windows/templates/sections/test-failure-recovery-lite.md +58 -0
  107. package/bundled/dev-pipeline-windows/templates/session-status-schema.json +83 -0
  108. package/bundled/rules/prizm/prizm-documentation.md +2 -4
  109. package/bundled/rules/prizm/prizm-progressive-loading.md +2 -1
  110. package/bundled/skills/_metadata.json +1 -1
  111. package/bundled/skills/app-planner/SKILL.md +24 -16
  112. package/bundled/skills/app-planner/references/architecture-decisions.md +9 -5
  113. package/bundled/skills/app-planner/references/frontend-design-guide.md +1 -1
  114. package/bundled/skills/feature-planner/SKILL.md +9 -2
  115. package/bundled/skills/prizmkit-implement/SKILL.md +1 -0
  116. package/bundled/skills/prizmkit-init/SKILL.md +8 -7
  117. package/bundled/skills/prizmkit-init/references/config-schema.md +3 -1
  118. package/bundled/skills/prizmkit-plan/SKILL.md +2 -0
  119. package/bundled/skills/prizmkit-prizm-docs/assets/prizm-docs-format.md +6 -1
  120. package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +2 -2
  121. package/bundled/skills/prizmkit-prizm-docs/references/op-update.md +2 -1
  122. package/bundled/skills/prizmkit-prizm-docs/references/op-validate.md +2 -2
  123. package/bundled/skills/prizmkit-retrospective/SKILL.md +2 -0
  124. package/bundled/skills/prizmkit-retrospective/references/knowledge-injection-steps.md +2 -0
  125. package/bundled/skills/prizmkit-retrospective/references/structural-sync-steps.md +2 -0
  126. package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +2 -0
  127. package/bundled/skills-windows/app-planner/SKILL.md +639 -0
  128. package/bundled/skills-windows/app-planner/assets/app-design-guide.md +101 -0
  129. package/bundled/skills-windows/app-planner/references/architecture-decisions.md +52 -0
  130. package/bundled/skills-windows/app-planner/references/brainstorm-guide.md +101 -0
  131. package/bundled/skills-windows/app-planner/references/frontend-design-guide.md +71 -0
  132. package/bundled/skills-windows/app-planner/references/project-brief-guide.md +82 -0
  133. package/bundled/skills-windows/app-planner/references/red-team-checklist.md +40 -0
  134. package/bundled/skills-windows/app-planner/references/rules/backend/derivation-rules.md +609 -0
  135. package/bundled/skills-windows/app-planner/references/rules/backend/fixed-rules.md +285 -0
  136. package/bundled/skills-windows/app-planner/references/rules/backend/question-bank.md +249 -0
  137. package/bundled/skills-windows/app-planner/references/rules/backend/template.md +173 -0
  138. package/bundled/skills-windows/app-planner/references/rules/database/derivation-rules.md +373 -0
  139. package/bundled/skills-windows/app-planner/references/rules/database/fixed-rules.md +211 -0
  140. package/bundled/skills-windows/app-planner/references/rules/database/question-bank.md +184 -0
  141. package/bundled/skills-windows/app-planner/references/rules/database/template.md +158 -0
  142. package/bundled/skills-windows/app-planner/references/rules/frontend/derivation-rules.md +810 -0
  143. package/bundled/skills-windows/app-planner/references/rules/frontend/fixed-rules.md +188 -0
  144. package/bundled/skills-windows/app-planner/references/rules/frontend/question-bank.md +302 -0
  145. package/bundled/skills-windows/app-planner/references/rules/frontend/template.md +320 -0
  146. package/bundled/skills-windows/app-planner/references/rules/mobile/derivation-rules.md +639 -0
  147. package/bundled/skills-windows/app-planner/references/rules/mobile/fixed-rules.md +290 -0
  148. package/bundled/skills-windows/app-planner/references/rules/mobile/question-bank.md +232 -0
  149. package/bundled/skills-windows/app-planner/references/rules/mobile/template.md +175 -0
  150. package/bundled/skills-windows/bug-fix-workflow/SKILL.md +415 -0
  151. package/bundled/skills-windows/bug-planner/SKILL.md +395 -0
  152. package/bundled/skills-windows/bug-planner/assets/bug-confirmation-template.md +43 -0
  153. package/bundled/skills-windows/bug-planner/references/critic-and-verification.md +44 -0
  154. package/bundled/skills-windows/bug-planner/references/error-recovery.md +73 -0
  155. package/bundled/skills-windows/bug-planner/references/input-formats.md +53 -0
  156. package/bundled/skills-windows/bug-planner/references/schema-validation.md +25 -0
  157. package/bundled/skills-windows/bug-planner/references/severity-rules.md +16 -0
  158. package/bundled/skills-windows/bug-planner/scripts/validate-bug-list.py +322 -0
  159. package/bundled/skills-windows/bugfix-pipeline-launcher/SKILL.md +380 -0
  160. package/bundled/skills-windows/feature-pipeline-launcher/SKILL.md +441 -0
  161. package/bundled/skills-windows/feature-pipeline-launcher/scripts/preflight-check.py +462 -0
  162. package/bundled/skills-windows/feature-planner/SKILL.md +401 -0
  163. package/bundled/skills-windows/feature-planner/assets/evaluation-guide.md +64 -0
  164. package/bundled/skills-windows/feature-planner/assets/planning-guide.md +214 -0
  165. package/bundled/skills-windows/feature-planner/references/browser-interaction.md +59 -0
  166. package/bundled/skills-windows/feature-planner/references/completeness-review.md +57 -0
  167. package/bundled/skills-windows/feature-planner/references/decomposition-patterns.md +75 -0
  168. package/bundled/skills-windows/feature-planner/references/error-recovery.md +90 -0
  169. package/bundled/skills-windows/feature-planner/references/incremental-feature-planning.md +112 -0
  170. package/bundled/skills-windows/feature-planner/references/new-project-planning.md +85 -0
  171. package/bundled/skills-windows/feature-planner/scripts/validate-and-generate.py +1029 -0
  172. package/bundled/skills-windows/feature-workflow/SKILL.md +531 -0
  173. package/bundled/skills-windows/prizmkit-init/SKILL.md +356 -0
  174. package/bundled/skills-windows/prizmkit-init/assets/project-brief-template.md +82 -0
  175. package/bundled/skills-windows/prizmkit-init/references/config-schema.md +70 -0
  176. package/bundled/skills-windows/prizmkit-init/references/rules/layer-detection.md +41 -0
  177. package/bundled/skills-windows/prizmkit-init/references/tech-stack-catalog.md +13 -0
  178. package/bundled/skills-windows/prizmkit-init/references/update-supplement.md +9 -0
  179. package/bundled/skills-windows/recovery-workflow/SKILL.md +456 -0
  180. package/bundled/skills-windows/recovery-workflow/evals/evals.json +46 -0
  181. package/bundled/skills-windows/recovery-workflow/scripts/detect-recovery-state.py +544 -0
  182. package/bundled/skills-windows/refactor-pipeline-launcher/SKILL.md +406 -0
  183. package/bundled/skills-windows/refactor-planner/SKILL.md +540 -0
  184. package/bundled/skills-windows/refactor-planner/assets/planning-guide.md +292 -0
  185. package/bundled/skills-windows/refactor-planner/references/behavior-preservation.md +301 -0
  186. package/bundled/skills-windows/refactor-planner/references/refactor-scoping-guide.md +221 -0
  187. package/bundled/skills-windows/refactor-planner/scripts/validate-and-generate-refactor.py +858 -0
  188. package/bundled/skills-windows/refactor-workflow/SKILL.md +503 -0
  189. package/bundled/templates/hooks/diff-prizm-docs.sh +1 -1
  190. package/bundled/templates/hooks/prizm-pre-commit.sh +53 -4
  191. package/bundled/templates/hooks/validate-prizm-docs.sh +62 -7
  192. package/bundled/templates/project-memory-template.md +2 -1
  193. package/package.json +3 -2
  194. package/src/clean.js +73 -2
  195. package/src/config.js +167 -50
  196. package/src/detect-platform.js +15 -9
  197. package/src/external-skills.js +26 -19
  198. package/src/index.js +28 -10
  199. package/src/manifest.js +6 -2
  200. package/src/metadata.js +43 -5
  201. package/src/platforms.js +38 -0
  202. package/src/prompts.js +50 -9
  203. package/src/runtimes.js +20 -0
  204. package/src/scaffold.js +447 -114
  205. package/src/upgrade.js +87 -44
package/src/upgrade.js CHANGED
@@ -15,10 +15,8 @@ import { confirm } from '@inquirer/prompts';
15
15
 
16
16
  import { readManifest, writeManifest, buildManifest, diffManifest } from './manifest.js';
17
17
  import {
18
- loadMetadata,
19
18
  loadRulesMetadata,
20
19
  getAgentsDir,
21
- getRulesDir,
22
20
  } from './metadata.js';
23
21
  import {
24
22
  installSkills,
@@ -30,9 +28,12 @@ import {
30
28
  installGitignore,
31
29
  installProjectMemory,
32
30
  resolvePipelineFileList,
31
+ resolveRuleNamesForRuntime,
33
32
  resolveSkillList,
34
33
  EXTRAS_REGISTRY,
35
34
  } from './scaffold.js';
35
+ import { expandPlatforms, platformLabel } from './platforms.js';
36
+ import { normalizeRuntime, runtimeLabel } from './runtimes.js';
36
37
 
37
38
  const __dirname = dirname(fileURLToPath(import.meta.url));
38
39
  const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf-8'));
@@ -71,6 +72,16 @@ export async function removeSkillFiles(platform, projectRoot, skillNames, dryRun
71
72
  console.log(chalk.red(` ✗ removed .codebuddy/skills/${skillName}/`));
72
73
  }
73
74
  }
75
+ } else if (platform === 'codex') {
76
+ const skillDir = path.join(projectRoot, '.agents', 'skills', skillName);
77
+ if (await fs.pathExists(skillDir)) {
78
+ if (dryRun) {
79
+ console.log(chalk.gray(` [dry-run] remove .agents/skills/${skillName}/`));
80
+ } else {
81
+ await fs.remove(skillDir);
82
+ console.log(chalk.red(` ✗ removed .agents/skills/${skillName}/`));
83
+ }
84
+ }
74
85
  }
75
86
  }
76
87
  }
@@ -82,14 +93,21 @@ export async function removeAgentFiles(platform, projectRoot, agentFileNames, dr
82
93
  for (const fileName of agentFileNames) {
83
94
  const dir = platform === 'claude'
84
95
  ? path.join(projectRoot, '.claude', 'agents')
85
- : path.join(projectRoot, '.codebuddy', 'agents');
86
- const filePath = path.join(dir, fileName);
87
- if (await fs.pathExists(filePath)) {
88
- if (dryRun) {
89
- console.log(chalk.gray(` [dry-run] remove ${path.relative(projectRoot, filePath)}`));
90
- } else {
91
- await fs.remove(filePath);
92
- console.log(chalk.red(` removed ${path.relative(projectRoot, filePath)}`));
96
+ : platform === 'codex'
97
+ ? path.join(projectRoot, '.codex', 'agents')
98
+ : path.join(projectRoot, '.codebuddy', 'agents');
99
+ const targetNames = platform === 'codex'
100
+ ? [...new Set([fileName.replace(/\.md$/, '.toml'), fileName])]
101
+ : [fileName];
102
+ for (const targetName of targetNames) {
103
+ const filePath = path.join(dir, targetName);
104
+ if (await fs.pathExists(filePath)) {
105
+ if (dryRun) {
106
+ console.log(chalk.gray(` [dry-run] remove ${path.relative(projectRoot, filePath)}`));
107
+ } else {
108
+ await fs.remove(filePath);
109
+ console.log(chalk.red(` ✗ removed ${path.relative(projectRoot, filePath)}`));
110
+ }
93
111
  }
94
112
  }
95
113
  }
@@ -100,21 +118,30 @@ export async function removeAgentFiles(platform, projectRoot, agentFileNames, dr
100
118
  */
101
119
  export async function removeRuleFiles(platform, projectRoot, ruleFileNames, dryRun) {
102
120
  for (const fileName of ruleFileNames) {
103
- const ext = platform === 'claude' ? '' : '';
121
+ const baseName = path.basename(fileName);
104
122
  const dir = platform === 'claude'
105
123
  ? path.join(projectRoot, '.claude', 'rules')
106
- : path.join(projectRoot, '.codebuddy', 'rules');
124
+ : platform === 'codex'
125
+ ? path.join(projectRoot, '.agents', 'rules')
126
+ : path.join(projectRoot, '.codebuddy', 'rules');
107
127
  // Rules are stored as .md for claude, .mdc for codebuddy
108
128
  const targetName = platform === 'codebuddy'
109
- ? fileName.replace(/\.md$/, '.mdc')
110
- : fileName;
111
- const filePath = path.join(dir, targetName);
112
- if (await fs.pathExists(filePath)) {
113
- if (dryRun) {
114
- console.log(chalk.gray(` [dry-run] remove ${path.relative(projectRoot, filePath)}`));
115
- } else {
116
- await fs.remove(filePath);
117
- console.log(chalk.red(` ✗ removed ${path.relative(projectRoot, filePath)}`));
129
+ ? baseName.replace(/\.md$/, '.mdc')
130
+ : baseName;
131
+ const filePaths = platform === 'codex'
132
+ ? [
133
+ path.join(dir, targetName),
134
+ path.join(projectRoot, '.codex', 'rules', targetName),
135
+ ]
136
+ : [path.join(dir, targetName)];
137
+ for (const filePath of filePaths) {
138
+ if (await fs.pathExists(filePath)) {
139
+ if (dryRun) {
140
+ console.log(chalk.gray(` [dry-run] remove ${path.relative(projectRoot, filePath)}`));
141
+ } else {
142
+ await fs.remove(filePath);
143
+ console.log(chalk.red(` ✗ removed ${path.relative(projectRoot, filePath)}`));
144
+ }
118
145
  }
119
146
  }
120
147
  }
@@ -149,7 +176,6 @@ export async function runUpgrade(directory, options = {}) {
149
176
  const projectRoot = path.resolve(directory || '.');
150
177
  const dryRun = Boolean(options.dryRun);
151
178
  const nonInteractive = Boolean(options.nonInteractive);
152
- const force = Boolean(options.force);
153
179
 
154
180
  console.log('');
155
181
  console.log(chalk.bold(' PrizmKit Upgrade'));
@@ -191,8 +217,8 @@ export async function runUpgrade(directory, options = {}) {
191
217
  }
192
218
 
193
219
  // 3. Resolve new skill list using old manifest's suite + platform (or defaults)
194
- const oldManifestPlatform = oldManifest?.platform || 'claude';
195
220
  const suite = oldManifest?.suite || 'core';
221
+ const runtime = normalizeRuntime(oldManifest?.runtime || 'unix');
196
222
  const team = oldManifest?.options?.team ?? true;
197
223
  const pipeline = oldManifest?.options?.pipeline ?? true;
198
224
  const rulesPreset = oldManifest?.options?.rules || 'recommended';
@@ -203,17 +229,32 @@ export async function runUpgrade(directory, options = {}) {
203
229
  // (e.g. legacy installs before manifest tracked platform).
204
230
  let platform;
205
231
  if (oldManifest?.platform) {
206
- platform = oldManifest.platform;
232
+ platform = oldManifest.platform === 'both' ? 'all' : oldManifest.platform;
207
233
  } else {
208
234
  // Fallback: detect from filesystem for legacy manifests without platform field
209
- const hasClaude = await fs.pathExists(path.join(projectRoot, '.claude', 'commands'))
210
- || await fs.pathExists(path.join(projectRoot, '.claude', 'agents'));
211
- const hasCodeBuddy = await fs.pathExists(path.join(projectRoot, '.codebuddy', 'skills'))
212
- || await fs.pathExists(path.join(projectRoot, '.codebuddy', 'agents'));
213
-
214
- if (hasClaude && hasCodeBuddy) platform = 'both';
215
- else if (hasCodeBuddy) platform = 'codebuddy';
216
- else if (hasClaude) platform = 'claude';
235
+ const hasPlatformFiles = async (dir) => {
236
+ if (!await fs.pathExists(dir)) return false;
237
+ try {
238
+ return (await fs.readdir(dir)).length > 0;
239
+ } catch {
240
+ return false;
241
+ }
242
+ };
243
+ const hasClaude = await hasPlatformFiles(path.join(projectRoot, '.claude', 'commands'))
244
+ || await hasPlatformFiles(path.join(projectRoot, '.claude', 'agents'));
245
+ const hasCodeBuddy = await hasPlatformFiles(path.join(projectRoot, '.codebuddy', 'skills'))
246
+ || await hasPlatformFiles(path.join(projectRoot, '.codebuddy', 'agents'));
247
+ const hasCodex = await hasPlatformFiles(path.join(projectRoot, '.agents', 'skills'))
248
+ || await hasPlatformFiles(path.join(projectRoot, '.codex', 'agents'));
249
+
250
+ const detectedPlatforms = [
251
+ hasCodeBuddy && 'codebuddy',
252
+ hasClaude && 'claude',
253
+ hasCodex && 'codex',
254
+ ].filter(Boolean);
255
+
256
+ if (detectedPlatforms.length > 1) platform = 'all';
257
+ else if (detectedPlatforms.length === 1) platform = detectedPlatforms[0];
217
258
  else platform = 'claude'; // ultimate fallback
218
259
  }
219
260
 
@@ -221,11 +262,10 @@ export async function runUpgrade(directory, options = {}) {
221
262
  const agentsDir = getAgentsDir();
222
263
  const newAgentFiles = (await fs.readdir(agentsDir)).filter(f => f.endsWith('.md'));
223
264
  const rulesMeta = await loadRulesMetadata();
224
- const rulesPresetDef = rulesMeta.presets[rulesPreset] || rulesMeta.presets.recommended;
225
- const newRuleFiles = (rulesPresetDef?.rules || []).map(name => `${name}.md`);
265
+ const newRuleFiles = resolveRuleNamesForRuntime(rulesMeta, rulesPreset, runtime).map(name => `${name}.md`);
226
266
 
227
267
  // Resolve pipeline file list from source (for manifest diff)
228
- const newPipelineFiles = pipeline ? resolvePipelineFileList() : [];
268
+ const newPipelineFiles = pipeline ? resolvePipelineFileList(runtime) : [];
229
269
 
230
270
  // Resolve extras: merge old manifest extras + default extras for old manifests without the field
231
271
  const extrasToInstall = [...new Set([
@@ -238,6 +278,7 @@ export async function runUpgrade(directory, options = {}) {
238
278
  const newManifest = buildManifest({
239
279
  version: pkg.version,
240
280
  platform,
281
+ runtime,
241
282
  suite,
242
283
  skills: newSkillList,
243
284
  agents: newAgentFiles,
@@ -261,6 +302,7 @@ export async function runUpgrade(directory, options = {}) {
261
302
  console.log(chalk.bold(' Upgrade Summary:'));
262
303
  console.log(` Version: ${chalk.gray(oldVersion)} → ${chalk.cyan(pkg.version)}`);
263
304
  console.log(` Platform: ${platform}${!oldManifest?.platform ? chalk.yellow(' (detected from filesystem — no platform in manifest)') : ''}`);
305
+ console.log(` Runtime: ${runtimeLabel(runtime)}${!oldManifest?.runtime ? chalk.yellow(' (defaulted)') : ''}`);
264
306
  console.log(` Suite: ${suite}`);
265
307
  console.log('');
266
308
 
@@ -299,7 +341,7 @@ export async function runUpgrade(directory, options = {}) {
299
341
  }
300
342
 
301
343
  // 7. Execute
302
- const platforms = platform === 'both' ? ['codebuddy', 'claude'] : [platform];
344
+ const platforms = expandPlatforms(platform);
303
345
 
304
346
  // 7a. Remove orphaned files
305
347
  if (diff.skills.removed.length || diff.agents.removed.length || diff.rules.removed.length || diff.pipeline.removed.length) {
@@ -328,12 +370,11 @@ export async function runUpgrade(directory, options = {}) {
328
370
  console.log(chalk.bold('\n Updating files...\n'));
329
371
 
330
372
  for (const p of platforms) {
331
- const platformLabel = p === 'codebuddy' ? 'CodeBuddy' : 'Claude Code';
332
- console.log(chalk.bold(` Installing ${platformLabel} environment...\n`));
373
+ console.log(chalk.bold(` Installing ${platformLabel(p)} environment...\n`));
333
374
 
334
375
  // Skills
335
376
  console.log(chalk.blue(' Skills:'));
336
- await installSkills(p, newSkillList, projectRoot, dryRun);
377
+ await installSkills(p, newSkillList, projectRoot, dryRun, runtime);
337
378
 
338
379
  // Agents
339
380
  console.log(chalk.blue('\n Agents:'));
@@ -341,7 +382,7 @@ export async function runUpgrade(directory, options = {}) {
341
382
 
342
383
  // Settings/Rules
343
384
  console.log(chalk.blue('\n Settings & Rules:'));
344
- await installSettings(p, projectRoot, { pipeline, rules: rulesPreset }, dryRun);
385
+ await installSettings(p, projectRoot, { pipeline, rules: rulesPreset }, dryRun, runtime);
345
386
 
346
387
  console.log('');
347
388
  }
@@ -349,7 +390,7 @@ export async function runUpgrade(directory, options = {}) {
349
390
  // Pipeline (with forceOverwrite)
350
391
  if (pipeline) {
351
392
  console.log(chalk.blue(' Pipeline:'));
352
- await installPipeline(projectRoot, dryRun, { forceOverwrite: true });
393
+ await installPipeline(projectRoot, dryRun, { forceOverwrite: true, runtime });
353
394
  console.log('');
354
395
  }
355
396
 
@@ -366,7 +407,7 @@ export async function runUpgrade(directory, options = {}) {
366
407
 
367
408
  // Git hook
368
409
  console.log(chalk.blue(' Git Hook:'));
369
- await installGitHook(projectRoot, dryRun);
410
+ await installGitHook(projectRoot, dryRun, runtime);
370
411
 
371
412
  // .gitignore
372
413
  console.log(chalk.blue(' Gitignore:'));
@@ -374,11 +415,13 @@ export async function runUpgrade(directory, options = {}) {
374
415
 
375
416
  // PrizmKit scripts
376
417
  console.log(chalk.blue(' PrizmKit Scripts:'));
377
- await installPrizmkitScripts(projectRoot, dryRun);
418
+ await installPrizmkitScripts(projectRoot, dryRun, runtime);
378
419
 
379
420
  // 7c. Project memory — smart merge via markers
380
421
  console.log(chalk.blue('\n Project Memory:'));
381
- await installProjectMemory(platform, projectRoot, dryRun);
422
+ for (const p of platforms) {
423
+ await installProjectMemory(p, projectRoot, dryRun);
424
+ }
382
425
 
383
426
  // 8. Write new manifest
384
427
  if (!dryRun) {