prizmkit 1.0.113 → 1.0.115

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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "frameworkVersion": "1.0.113",
3
- "bundledAt": "2026-03-26T06:56:50.821Z",
4
- "bundledFrom": "fca917f"
2
+ "frameworkVersion": "1.0.115",
3
+ "bundledAt": "2026-03-26T08:40:28.718Z",
4
+ "bundledFrom": "0e9b475"
5
5
  }
@@ -76,6 +76,7 @@ spawn_and_wait_session() {
76
76
  local bootstrap_prompt="$4"
77
77
  local session_dir="$5"
78
78
  local max_retries="$6"
79
+ local base_branch="${7:-main}"
79
80
 
80
81
  local session_log="$session_dir/logs/session.log"
81
82
  local progress_json="$session_dir/logs/progress.json"
@@ -169,10 +170,7 @@ spawn_and_wait_session() {
169
170
  local session_status
170
171
  local project_root
171
172
  project_root="$(cd "$SCRIPT_DIR/.." && pwd)"
172
- local default_branch
173
- default_branch=$(git -C "$project_root" symbolic-ref refs/remotes/origin/HEAD 2>/dev/null \
174
- | sed 's@^refs/remotes/origin/@@') \
175
- || default_branch=$(git -C "$project_root" rev-parse --abbrev-ref HEAD 2>/dev/null | grep -E '^(main|master)$' || echo "main")
173
+ local default_branch="$base_branch"
176
174
 
177
175
  if [[ $exit_code -eq 124 ]]; then
178
176
  log_warn "Session timed out after ${SESSION_TIMEOUT}s"
@@ -463,7 +461,7 @@ sys.exit(1)
463
461
 
464
462
  spawn_and_wait_session \
465
463
  "$bug_id" "$bug_list" "$session_id" \
466
- "$bootstrap_prompt" "$session_dir" 999
464
+ "$bootstrap_prompt" "$session_dir" 999 "$_ORIGINAL_BRANCH"
467
465
  local session_status="$_SPAWN_RESULT"
468
466
 
469
467
  # Merge dev branch back to original on success
@@ -650,7 +648,7 @@ main() {
650
648
 
651
649
  spawn_and_wait_session \
652
650
  "$bug_id" "$bug_list" "$session_id" \
653
- "$bootstrap_prompt" "$session_dir" "$MAX_RETRIES"
651
+ "$bootstrap_prompt" "$session_dir" "$MAX_RETRIES" "$_ORIGINAL_BRANCH"
654
652
 
655
653
  session_count=$((session_count + 1))
656
654
 
@@ -91,6 +91,7 @@ spawn_and_wait_session() {
91
91
  local session_dir="$5"
92
92
  local max_retries="$6"
93
93
  local feature_model="${7:-}"
94
+ local base_branch="${8:-main}"
94
95
 
95
96
  local session_log="$session_dir/logs/session.log"
96
97
  local progress_json="$session_dir/logs/progress.json"
@@ -191,10 +192,7 @@ spawn_and_wait_session() {
191
192
  local session_status
192
193
  local project_root
193
194
  project_root="$(cd "$SCRIPT_DIR/.." && pwd)"
194
- local default_branch
195
- default_branch=$(git -C "$project_root" symbolic-ref refs/remotes/origin/HEAD 2>/dev/null \
196
- | sed 's@^refs/remotes/origin/@@') \
197
- || default_branch=$(git -C "$project_root" rev-parse --abbrev-ref HEAD 2>/dev/null | grep -E '^(main|master)$' || echo "main")
195
+ local default_branch="$base_branch"
198
196
 
199
197
  if [[ $exit_code -eq 124 ]]; then
200
198
  log_warn "Session timed out after ${SESSION_TIMEOUT}s"
@@ -739,7 +737,7 @@ sys.exit(1)
739
737
 
740
738
  spawn_and_wait_session \
741
739
  "$feature_id" "$feature_list" "$session_id" \
742
- "$bootstrap_prompt" "$session_dir" 999 "$feature_model"
740
+ "$bootstrap_prompt" "$session_dir" 999 "$feature_model" "$_ORIGINAL_BRANCH"
743
741
  local session_status="$_SPAWN_RESULT"
744
742
 
745
743
  # Merge dev branch back to original on success
@@ -1028,7 +1026,7 @@ for f in data.get('stuck_features', []):
1028
1026
 
1029
1027
  spawn_and_wait_session \
1030
1028
  "$feature_id" "$feature_list" "$session_id" \
1031
- "$bootstrap_prompt" "$session_dir" "$MAX_RETRIES" "$feature_model"
1029
+ "$bootstrap_prompt" "$session_dir" "$MAX_RETRIES" "$feature_model" "$_ORIGINAL_BRANCH"
1032
1030
  local session_status="$_SPAWN_RESULT"
1033
1031
 
1034
1032
  # Merge per-feature dev branch back to original on success
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.113",
2
+ "version": "1.0.115",
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.",
@@ -1,3 +1,4 @@
1
+ <!-- PRIZMKIT:START — managed by PrizmKit, do not edit manually -->
1
2
  ## PrizmKit Documentation Framework
2
3
 
3
4
  This project uses PrizmKit with the Prizm documentation system for AI-optimized progressive context loading.
@@ -36,3 +37,4 @@ Not every change needs the full spec -> plan workflow. Use fast path for:
36
37
 
37
38
  Use the full workflow (/prizmkit-specify -> /prizmkit-plan -> /prizmkit-analyze -> /prizmkit-implement) for:
38
39
  - New features, multi-file coordinated changes, architectural decisions, data model or API changes
40
+ <!-- PRIZMKIT:END -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prizmkit",
3
- "version": "1.0.113",
3
+ "version": "1.0.115",
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
@@ -502,10 +502,16 @@ export async function installPrizmkitScripts(projectRoot, dryRun) {
502
502
  }
503
503
  }
504
504
 
505
+ const PRIZMKIT_MARKER_START = '<!-- PRIZMKIT:START';
506
+ const PRIZMKIT_MARKER_END = '<!-- PRIZMKIT:END -->';
507
+
505
508
  /**
506
- * 安装项目记忆文件(CODEBUDDY.md / CLAUDE.md
509
+ * Merge PrizmKit template content into a project memory file (CLAUDE.md / CODEBUDDY.md).
510
+ * - File missing → create with template content
511
+ * - File exists with markers → replace content between markers
512
+ * - File exists without markers → append template content
507
513
  */
508
- async function installProjectMemory(platform, projectRoot, dryRun) {
514
+ export async function installProjectMemory(platform, projectRoot, dryRun) {
509
515
  const templatesDir = getTemplatesDir();
510
516
  const skillsDir = getSkillsDir();
511
517
  const templateName = 'project-memory-template.md';
@@ -520,21 +526,42 @@ async function installProjectMemory(platform, projectRoot, dryRun) {
520
526
  ];
521
527
  const templatePath = templateCandidates.find(candidate => fs.pathExistsSync(candidate));
522
528
 
523
- if (await fs.pathExists(targetPath)) {
524
- console.log(chalk.yellow(` ⚠ ${targetName} 已存在,跳过`));
529
+ if (!templatePath || !await fs.pathExists(templatePath)) {
530
+ console.log(chalk.yellow(` ⚠ 模板文件不存在: ${templateName},跳过`));
525
531
  return;
526
532
  }
527
533
 
534
+ const templateContent = (await fs.readFile(templatePath, 'utf-8')).trimEnd();
535
+
528
536
  if (dryRun) {
529
537
  console.log(chalk.gray(` [dry-run] ${targetName}`));
530
538
  return;
531
539
  }
532
540
 
533
- if (templatePath && await fs.pathExists(templatePath)) {
534
- await fs.copy(templatePath, targetPath);
535
- console.log(chalk.green(` ✓ ${targetName}`));
541
+ if (!await fs.pathExists(targetPath)) {
542
+ // File doesn't exist — create with template content
543
+ await fs.writeFile(targetPath, templateContent + '\n', 'utf-8');
544
+ console.log(chalk.green(` ✓ ${targetName} (created)`));
545
+ return;
546
+ }
547
+
548
+ // File exists — merge via markers
549
+ const existing = await fs.readFile(targetPath, 'utf-8');
550
+ const startIdx = existing.indexOf(PRIZMKIT_MARKER_START);
551
+ const endIdx = existing.indexOf(PRIZMKIT_MARKER_END);
552
+
553
+ if (startIdx !== -1 && endIdx !== -1 && endIdx > startIdx) {
554
+ // Replace content between markers (inclusive)
555
+ const before = existing.substring(0, startIdx);
556
+ const after = existing.substring(endIdx + PRIZMKIT_MARKER_END.length);
557
+ const merged = before + templateContent + after;
558
+ await fs.writeFile(targetPath, merged, 'utf-8');
559
+ console.log(chalk.green(` ✓ ${targetName} (updated PrizmKit section)`));
536
560
  } else {
537
- console.log(chalk.yellow(` ⚠ 模板文件不存在: ${templateName},跳过`));
561
+ // No markers found — append template content
562
+ const separator = existing.endsWith('\n') ? '\n' : '\n\n';
563
+ await fs.writeFile(targetPath, existing + separator + templateContent + '\n', 'utf-8');
564
+ console.log(chalk.green(` ✓ ${targetName} (appended PrizmKit section)`));
538
565
  }
539
566
  }
540
567
 
package/src/upgrade.js CHANGED
@@ -28,6 +28,7 @@ import {
28
28
  installPrizmkitScripts,
29
29
  installGitHook,
30
30
  installGitignore,
31
+ installProjectMemory,
31
32
  resolvePipelineFileList,
32
33
  } from './scaffold.js';
33
34
 
@@ -371,20 +372,9 @@ export async function runUpgrade(directory, options = {}) {
371
372
  console.log(chalk.blue(' PrizmKit Scripts:'));
372
373
  await installPrizmkitScripts(projectRoot, dryRun);
373
374
 
374
- // 7c. Project memory — skip unless --force
375
- if (force) {
376
- console.log(chalk.blue('\n Project Memory (forced):'));
377
- const memoryFile = platform === 'claude' ? 'CLAUDE.md' : 'CODEBUDDY.md';
378
- console.log(chalk.yellow(` ⚠ --force: ${memoryFile} will be overwritten if template exists`));
379
- // Force overwrite by removing first, then let scaffold write fresh
380
- const memoryPath = path.join(projectRoot, memoryFile);
381
- if (!dryRun && await fs.pathExists(memoryPath)) {
382
- await fs.remove(memoryPath);
383
- }
384
- // installProjectMemory is not exported, but the template logic is in scaffold
385
- // For force mode, we just warn; the file was already there from initial install
386
- console.log(chalk.gray(` (project memory files are user-customizable, skipped by default)`));
387
- }
375
+ // 7c. Project memory — smart merge via markers
376
+ console.log(chalk.blue('\n Project Memory:'));
377
+ await installProjectMemory(platform, projectRoot, dryRun);
388
378
 
389
379
  // 8. Write new manifest
390
380
  if (!dryRun) {