prizmkit 1.0.76 → 1.0.78

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.
@@ -65,6 +65,20 @@ LLM context is frozen at prompt time. Modifying a skill source file during this
65
65
  **When you modify any file in `dev-pipeline/scripts/`, `dev-pipeline/templates/`, or `core/skills/` that this pipeline actively uses**: set `reload_needed: true` in `session-status.json`. The pipeline runner will warn the operator after session completion.
66
66
  {{END_IF_MODE_SELF_EVOLVE}}
67
67
 
68
+ ## ⚠️ Context Budget Rules (CRITICAL — read before any phase)
69
+
70
+ You are running in headless mode with a FINITE context window. Exceeding it will crash the session and lose all work. Follow these rules strictly:
71
+
72
+ 1. **context-snapshot.md is your single source of truth** — After Phase 1-2 builds it, ALWAYS read context-snapshot.md instead of re-reading individual source files
73
+ 2. **Never re-read your own writes** — After you create/modify a file, do NOT read it back to verify. Trust your write was correct.
74
+ 3. **Stay focused** — Do NOT explore code unrelated to this feature. No curiosity-driven reads.
75
+ 4. **One task at a time** — In Phase 4 (implement), complete and test one task before starting the next.
76
+ 5. **Minimize tool output** — When running commands, use `| head -20` or `| tail -20` to limit output. Never dump entire test suites or logs.
77
+ 6. **Write session-status.json early** — Write a preliminary status file at the START of Phase 4, not just at the end.
78
+ 7. **Incremental commits when possible** — If a feature has multiple independent tasks, commit after each completed task rather than one big commit at the end.
79
+
80
+ ---
81
+
68
82
  ## PrizmKit Directory Convention
69
83
 
70
84
  ```
@@ -224,6 +238,18 @@ Wait for Reviewer to return.
224
238
 
225
239
  ### Phase 4: Implement — Dev Agent
226
240
 
241
+ **Before spawning Dev**, write a preliminary session-status.json to `{{SESSION_STATUS_PATH}}`:
242
+ ```json
243
+ {
244
+ "status": "partial",
245
+ "current_phase": 4,
246
+ "feature_id": "{{FEATURE_ID}}",
247
+ "session_id": "{{SESSION_ID}}",
248
+ "started_at": "<current ISO timestamp>"
249
+ }
250
+ ```
251
+ This ensures the pipeline sees a "partial" status even if the session crashes mid-implementation.
252
+
227
253
  Before spawning Dev, check plan.md Tasks section:
228
254
  ```bash
229
255
  grep -c '^\- \[ \]' .prizmkit/specs/{{FEATURE_SLUG}}/plan.md 2>/dev/null || echo 0
@@ -96,6 +96,10 @@
96
96
  }
97
97
  }
98
98
  }
99
+ },
100
+ "model": {
101
+ "type": "string",
102
+ "description": "AI model ID for this feature. Overrides $MODEL env var. See .prizmkit/available-models.json for valid IDs."
99
103
  }
100
104
  }
101
105
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.76",
2
+ "version": "1.0.78",
3
3
  "skills": {
4
4
  "prizm-kit": {
5
5
  "description": "Full-lifecycle dev toolkit. Covers spec-driven development, Prizm context docs, code quality, debugging, deployment, and knowledge management.",
@@ -0,0 +1,6 @@
1
+ #!/bin/sh
2
+ # PrizmKit post-merge hook — auto-detect available AI models after git pull
3
+ PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null) || exit 0
4
+ DETECT="$PROJECT_ROOT/dev-pipeline/scripts/detect-models.sh"
5
+ [ -f "$DETECT" ] && sh "$DETECT" --quiet &
6
+ exit 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prizmkit",
3
- "version": "1.0.76",
3
+ "version": "1.0.78",
4
4
  "description": "Create a new PrizmKit-powered project with clean initialization — no framework dev files, just what you need.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/scaffold.js CHANGED
@@ -471,6 +471,40 @@ export async function installGitHook(projectRoot, dryRun) {
471
471
  console.log(chalk.green(' ✓ .git/hooks/pre-commit (prizm format check)'));
472
472
  }
473
473
 
474
+ /**
475
+ * 安装 git post-merge hook(模型自动探测)
476
+ */
477
+ export async function installPostMergeHook(projectRoot, dryRun) {
478
+ const gitDir = path.join(projectRoot, '.git');
479
+
480
+ if (dryRun) {
481
+ console.log(chalk.gray(' [dry-run] .git/hooks/post-merge (model auto-detect)'));
482
+ return;
483
+ }
484
+
485
+ if (!fs.existsSync(gitDir)) return;
486
+
487
+ const templatePath = path.join(getTemplatesDir(), 'hooks', 'prizm-post-merge.sh');
488
+ if (!fs.existsSync(templatePath)) return;
489
+
490
+ const hooksDir = path.join(gitDir, 'hooks');
491
+ const postMergePath = path.join(hooksDir, 'post-merge');
492
+
493
+ fs.mkdirSync(hooksDir, { recursive: true });
494
+
495
+ if (fs.existsSync(postMergePath)) {
496
+ const existing = fs.readFileSync(postMergePath, 'utf8');
497
+ if (existing.includes('PrizmKit') || existing.includes('detect-models')) return;
498
+ const hookContent = fs.readFileSync(templatePath, 'utf8');
499
+ fs.writeFileSync(postMergePath, existing + '\n\n' + hookContent);
500
+ } else {
501
+ await fs.copy(templatePath, postMergePath);
502
+ fs.chmodSync(postMergePath, 0o755);
503
+ }
504
+
505
+ console.log(chalk.green(' ✓ .git/hooks/post-merge (model auto-detect)'));
506
+ }
507
+
474
508
  /**
475
509
  * 安装 PrizmKit 脚本到 .prizmkit/scripts/(始终安装)
476
510
  */
@@ -799,6 +833,7 @@ export async function scaffold(config) {
799
833
  // 11. Git pre-commit hook
800
834
  console.log(chalk.blue(' Git Hook:'));
801
835
  await installGitHook(projectRoot, dryRun);
836
+ await installPostMergeHook(projectRoot, dryRun);
802
837
 
803
838
  // 12. PrizmKit scripts (always installed)
804
839
  console.log(chalk.blue(' PrizmKit 脚本:'));
package/src/upgrade.js CHANGED
@@ -27,6 +27,7 @@ import {
27
27
  installPipeline,
28
28
  installPrizmkitScripts,
29
29
  installGitHook,
30
+ installPostMergeHook,
30
31
  resolvePipelineFileList,
31
32
  } from './scaffold.js';
32
33
 
@@ -361,6 +362,7 @@ export async function runUpgrade(directory, options = {}) {
361
362
  // Git hook
362
363
  console.log(chalk.blue(' Git Hook:'));
363
364
  await installGitHook(projectRoot, dryRun);
365
+ await installPostMergeHook(projectRoot, dryRun);
364
366
 
365
367
  // PrizmKit scripts
366
368
  console.log(chalk.blue(' PrizmKit Scripts:'));