prizmkit 1.1.7 → 1.1.9

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 (132) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/adapters/codebuddy/skill-adapter.js +21 -7
  3. package/bundled/agents/prizm-dev-team-reviewer.md +53 -173
  4. package/bundled/dev-pipeline/.env.example +45 -0
  5. package/bundled/dev-pipeline/README.md +64 -64
  6. package/bundled/dev-pipeline/SCHEMA_ANALYSIS.md +535 -0
  7. package/bundled/dev-pipeline/assets/feature-list-example.json +0 -1
  8. package/bundled/dev-pipeline/launch-bugfix-daemon.sh +64 -18
  9. package/bundled/dev-pipeline/launch-feature-daemon.sh +15 -12
  10. package/bundled/dev-pipeline/launch-refactor-daemon.sh +64 -18
  11. package/bundled/dev-pipeline/lib/branch.sh +6 -1
  12. package/bundled/dev-pipeline/lib/common.sh +71 -0
  13. package/bundled/dev-pipeline/lib/heartbeat.sh +2 -2
  14. package/bundled/dev-pipeline/reset-bug.sh +10 -9
  15. package/bundled/dev-pipeline/reset-feature.sh +9 -8
  16. package/bundled/dev-pipeline/reset-refactor.sh +10 -9
  17. package/bundled/dev-pipeline/retry-bugfix.sh +67 -29
  18. package/bundled/dev-pipeline/retry-feature.sh +54 -18
  19. package/bundled/dev-pipeline/retry-refactor.sh +112 -29
  20. package/bundled/dev-pipeline/run-bugfix.sh +281 -59
  21. package/bundled/dev-pipeline/run-feature.sh +53 -18
  22. package/bundled/dev-pipeline/run-refactor.sh +392 -66
  23. package/bundled/dev-pipeline/scripts/check-session-status.py +24 -1
  24. package/bundled/dev-pipeline/scripts/cleanup-logs.py +2 -2
  25. package/bundled/dev-pipeline/scripts/detect-stuck.py +195 -85
  26. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +57 -33
  27. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +25 -9
  28. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +104 -17
  29. package/bundled/dev-pipeline/scripts/init-bugfix-pipeline.py +34 -9
  30. package/bundled/dev-pipeline/scripts/init-pipeline.py +10 -10
  31. package/bundled/dev-pipeline/scripts/init-refactor-pipeline.py +19 -8
  32. package/bundled/dev-pipeline/scripts/parse-stream-progress.py +1 -5
  33. package/bundled/dev-pipeline/scripts/patch-completion-notes.py +191 -0
  34. package/bundled/dev-pipeline/scripts/update-bug-status.py +167 -22
  35. package/bundled/dev-pipeline/scripts/update-feature-status.py +104 -62
  36. package/bundled/dev-pipeline/scripts/update-refactor-status.py +351 -21
  37. package/bundled/dev-pipeline/templates/agent-prompts/dev-fix.md +1 -1
  38. package/bundled/dev-pipeline/templates/agent-prompts/reviewer-review.md +7 -11
  39. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +41 -7
  40. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +27 -3
  41. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +43 -19
  42. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +54 -26
  43. package/bundled/dev-pipeline/templates/bug-fix-list-schema.json +6 -15
  44. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +36 -25
  45. package/bundled/dev-pipeline/templates/feature-list-schema.json +109 -31
  46. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +270 -0
  47. package/bundled/dev-pipeline/templates/refactor-list-schema.json +11 -3
  48. package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +3 -1
  49. package/bundled/dev-pipeline/templates/sections/critical-paths-agent.md +1 -0
  50. package/bundled/dev-pipeline/templates/sections/feature-context.md +2 -0
  51. package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +29 -2
  52. package/bundled/dev-pipeline/templates/sections/phase-commit.md +22 -0
  53. package/bundled/dev-pipeline/templates/sections/phase-deploy-verification.md +2 -2
  54. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +8 -6
  55. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +7 -5
  56. package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +3 -3
  57. package/bundled/skills/_metadata.json +5 -22
  58. package/bundled/skills/app-planner/SKILL.md +98 -72
  59. package/bundled/skills/app-planner/assets/app-design-guide.md +1 -1
  60. package/bundled/skills/app-planner/references/architecture-decisions.md +1 -1
  61. package/bundled/skills/app-planner/references/project-brief-guide.md +69 -66
  62. package/bundled/skills/bug-fix-workflow/SKILL.md +52 -9
  63. package/bundled/skills/bug-planner/SKILL.md +139 -197
  64. package/bundled/skills/bug-planner/assets/bug-confirmation-template.md +43 -0
  65. package/bundled/skills/bug-planner/references/critic-and-verification.md +44 -0
  66. package/bundled/skills/bug-planner/references/error-recovery.md +73 -0
  67. package/bundled/skills/bug-planner/references/input-formats.md +53 -0
  68. package/bundled/skills/bug-planner/references/schema-validation.md +25 -0
  69. package/bundled/skills/bug-planner/references/severity-rules.md +16 -0
  70. package/bundled/skills/bug-planner/scripts/validate-bug-list.py +4 -8
  71. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +34 -39
  72. package/bundled/skills/feature-pipeline-launcher/SKILL.md +49 -36
  73. package/bundled/skills/feature-pipeline-launcher/scripts/preflight-check.py +3 -3
  74. package/bundled/skills/feature-planner/SKILL.md +53 -142
  75. package/bundled/skills/feature-planner/assets/evaluation-guide.md +1 -1
  76. package/bundled/skills/feature-planner/assets/planning-guide.md +21 -5
  77. package/bundled/skills/feature-planner/references/browser-interaction.md +2 -4
  78. package/bundled/skills/feature-planner/references/completeness-review.md +57 -0
  79. package/bundled/skills/feature-planner/references/error-recovery.md +16 -35
  80. package/bundled/skills/feature-planner/references/incremental-feature-planning.md +1 -1
  81. package/bundled/skills/feature-planner/references/new-project-planning.md +2 -2
  82. package/bundled/skills/feature-planner/scripts/validate-and-generate.py +19 -20
  83. package/bundled/skills/feature-workflow/SKILL.md +24 -25
  84. package/bundled/skills/prizm-kit/SKILL.md +39 -49
  85. package/bundled/skills/prizmkit-code-review/SKILL.md +51 -64
  86. package/bundled/skills/prizmkit-code-review/rules/dimensions.md +85 -0
  87. package/bundled/skills/prizmkit-code-review/rules/fix-strategy.md +11 -11
  88. package/bundled/skills/prizmkit-committer/SKILL.md +3 -31
  89. package/bundled/skills/prizmkit-deploy/SKILL.md +34 -31
  90. package/bundled/skills/prizmkit-deploy/assets/deploy-template.md +1 -1
  91. package/bundled/skills/prizmkit-implement/SKILL.md +35 -68
  92. package/bundled/skills/prizmkit-init/SKILL.md +112 -65
  93. package/bundled/skills/prizmkit-init/assets/project-brief-template.md +82 -0
  94. package/bundled/skills/prizmkit-plan/SKILL.md +120 -79
  95. package/bundled/skills/prizmkit-plan/assets/plan-template.md +28 -18
  96. package/bundled/skills/prizmkit-plan/assets/spec-template.md +28 -11
  97. package/bundled/skills/prizmkit-plan/references/clarify-guide.md +3 -3
  98. package/bundled/skills/prizmkit-plan/references/verification-checklist.md +60 -0
  99. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +10 -81
  100. package/bundled/skills/prizmkit-prizm-docs/assets/{PRIZM-SPEC.md → prizm-docs-format.md} +41 -526
  101. package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +46 -0
  102. package/bundled/skills/prizmkit-prizm-docs/references/op-rebuild.md +16 -0
  103. package/bundled/skills/prizmkit-prizm-docs/references/op-status.md +14 -0
  104. package/bundled/skills/prizmkit-prizm-docs/references/op-update.md +19 -0
  105. package/bundled/skills/prizmkit-prizm-docs/references/op-validate.md +17 -0
  106. package/bundled/skills/prizmkit-retrospective/SKILL.md +27 -65
  107. package/bundled/skills/prizmkit-retrospective/references/knowledge-injection-steps.md +3 -4
  108. package/bundled/skills/prizmkit-retrospective/references/structural-sync-steps.md +7 -25
  109. package/bundled/skills/recovery-workflow/SKILL.md +22 -22
  110. package/bundled/skills/recovery-workflow/evals/evals.json +5 -5
  111. package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +43 -10
  112. package/bundled/skills/refactor-pipeline-launcher/SKILL.md +48 -40
  113. package/bundled/skills/refactor-planner/SKILL.md +43 -61
  114. package/bundled/skills/refactor-planner/scripts/validate-and-generate-refactor.py +17 -17
  115. package/bundled/skills/refactor-workflow/SKILL.md +23 -24
  116. package/bundled/team/prizm-dev-team.json +1 -1
  117. package/bundled/{skills/prizm-kit/assets → templates}/project-memory-template.md +1 -1
  118. package/package.json +1 -1
  119. package/src/clean.js +3 -4
  120. package/src/gitignore-template.js +7 -9
  121. package/src/scaffold.js +14 -5
  122. package/bundled/dev-pipeline/templates/agent-prompts/reviewer-analyze.md +0 -5
  123. package/bundled/dev-pipeline/templates/sections/phase-analyze-agent.md +0 -19
  124. package/bundled/dev-pipeline/templates/sections/phase-analyze-full.md +0 -19
  125. package/bundled/skills/app-planner/references/project-conventions.md +0 -93
  126. package/bundled/skills/prizmkit-analyze/SKILL.md +0 -207
  127. package/bundled/skills/prizmkit-code-review/rules/dimensions-bugfix.md +0 -25
  128. package/bundled/skills/prizmkit-code-review/rules/dimensions-feature.md +0 -43
  129. package/bundled/skills/prizmkit-code-review/rules/dimensions-refactor.md +0 -25
  130. package/bundled/skills/prizmkit-implement/references/deploy-guide-protocol.md +0 -69
  131. package/bundled/skills/prizmkit-verify/SKILL.md +0 -281
  132. package/bundled/skills/prizmkit-verify/scripts/verify-light.py +0 -402
@@ -9,20 +9,23 @@ set -euo pipefail
9
9
  # the full refactor pipeline.
10
10
  #
11
11
  # Usage:
12
- # ./retry-refactor.sh <refactor-id> [refactor-list.json]
12
+ # ./retry-refactor.sh <refactor-id> [.prizmkit/plans/refactor-list.json]
13
13
  #
14
14
  # Examples:
15
15
  # ./retry-refactor.sh R-001
16
- # ./retry-refactor.sh R-001 refactor-list.json
16
+ # ./retry-refactor.sh R-001 .prizmkit/plans/refactor-list.json
17
17
  # SESSION_TIMEOUT=3600 ./retry-refactor.sh R-001
18
18
  # ============================================================
19
19
 
20
20
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
21
- STATE_DIR="$SCRIPT_DIR/refactor-state"
21
+ PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
22
+ STATE_DIR="${PROJECT_ROOT}/.prizmkit/state/refactor"
22
23
  SCRIPTS_DIR="$SCRIPT_DIR/scripts"
23
24
 
24
25
  SESSION_TIMEOUT=${SESSION_TIMEOUT:-0}
25
26
  HEARTBEAT_INTERVAL=${HEARTBEAT_INTERVAL:-30}
27
+ AUTO_PUSH=${AUTO_PUSH:-0}
28
+ DEV_BRANCH=${DEV_BRANCH:-""}
26
29
 
27
30
  # Source shared common helpers (CLI/platform detection + logs + deps)
28
31
  source "$SCRIPT_DIR/lib/common.sh"
@@ -31,6 +34,9 @@ prizm_detect_cli_and_platform
31
34
  # Source shared heartbeat library
32
35
  source "$SCRIPT_DIR/lib/heartbeat.sh"
33
36
 
37
+ # Source shared branch library
38
+ source "$SCRIPT_DIR/lib/branch.sh"
39
+
34
40
  # Detect stream-json support
35
41
  detect_stream_json_support "$CLI_CMD"
36
42
 
@@ -39,10 +45,10 @@ detect_stream_json_support "$CLI_CMD"
39
45
  # ============================================================
40
46
 
41
47
  if [[ $# -lt 1 ]]; then
42
- echo "Usage: $0 <refactor-id> [refactor-list.json]"
48
+ echo "Usage: $0 <refactor-id> [.prizmkit/plans/refactor-list.json]"
43
49
  echo ""
44
50
  echo " refactor-id Refactor to retry (e.g. R-001)"
45
- echo " refactor-list.json Path to refactor list (default: refactor-list.json)"
51
+ echo " refactor-list.json Path to refactor list (default: .prizmkit/plans/refactor-list.json)"
46
52
  echo ""
47
53
  echo "Environment Variables:"
48
54
  echo " SESSION_TIMEOUT Timeout in seconds (default: 0 = no limit)"
@@ -51,7 +57,7 @@ if [[ $# -lt 1 ]]; then
51
57
  fi
52
58
 
53
59
  REFACTOR_ID="$1"
54
- REFACTOR_LIST="${2:-refactor-list.json}"
60
+ REFACTOR_LIST="${2:-.prizmkit/plans/refactor-list.json}"
55
61
 
56
62
  if [[ ! "$REFACTOR_LIST" = /* ]]; then
57
63
  REFACTOR_LIST="$(pwd)/$REFACTOR_LIST"
@@ -115,15 +121,31 @@ sys.exit(1)
115
121
  PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
116
122
  ORIGINAL_BRANCH=$(git -C "$PROJECT_ROOT" rev-parse --abbrev-ref HEAD 2>/dev/null || echo "main")
117
123
 
118
- log_info "Cleaning $REFACTOR_ID artifacts for full restart..."
119
- python3 "$SCRIPTS_DIR/update-refactor-status.py" \
120
- --refactor-list "$REFACTOR_LIST" \
121
- --state-dir "$STATE_DIR" \
122
- --refactor-id "$REFACTOR_ID" \
123
- --project-root "$PROJECT_ROOT" \
124
- --action clean >/dev/null 2>&1 || {
125
- log_warn "Failed to clean refactor artifacts (continuing with fresh session only)"
126
- }
124
+ # Branch tracking (for cleanup on interrupt)
125
+ _DEV_BRANCH_NAME=""
126
+
127
+ log_info "Reading retry state for $REFACTOR_ID..."
128
+ RETRY_COUNT=$(python3 -c "
129
+ import json, os
130
+ status_path = os.path.join('$STATE_DIR', 'refactors', '$REFACTOR_ID', 'status.json')
131
+ if os.path.isfile(status_path):
132
+ with open(status_path) as f:
133
+ d = json.load(f)
134
+ print(d.get('retry_count', 0))
135
+ else:
136
+ print(0)
137
+ " 2>/dev/null || echo "0")
138
+ RESUME_PHASE=$(python3 -c "
139
+ import json, os
140
+ status_path = os.path.join('$STATE_DIR', 'refactors', '$REFACTOR_ID', 'status.json')
141
+ if os.path.isfile(status_path):
142
+ with open(status_path) as f:
143
+ d = json.load(f)
144
+ print(d.get('resume_from_phase') or 'null')
145
+ else:
146
+ print('null')
147
+ " 2>/dev/null || echo "null")
148
+ log_info "Retry count: $RETRY_COUNT, Resume phase: $RESUME_PHASE"
127
149
 
128
150
  # ============================================================
129
151
  # Generate bootstrap prompt
@@ -137,28 +159,57 @@ mkdir -p "$SESSION_DIR/logs"
137
159
  BOOTSTRAP_PROMPT="$SESSION_DIR/bootstrap-prompt.md"
138
160
 
139
161
  log_info "Generating refactor bootstrap prompt..."
140
- python3 "$SCRIPTS_DIR/generate-refactor-prompt.py" \
141
- --refactor-list "$REFACTOR_LIST" \
142
- --refactor-id "$REFACTOR_ID" \
143
- --session-id "$SESSION_ID" \
144
- --run-id "$RUN_ID" \
145
- --retry-count 0 \
146
- --resume-phase "null" \
147
- --state-dir "$STATE_DIR" \
148
- --output "$BOOTSTRAP_PROMPT" >/dev/null 2>&1
162
+ GEN_ARGS=(
163
+ --refactor-list "$REFACTOR_LIST"
164
+ --refactor-id "$REFACTOR_ID"
165
+ --session-id "$SESSION_ID"
166
+ --run-id "$RUN_ID"
167
+ --retry-count "$RETRY_COUNT"
168
+ --resume-phase "$RESUME_PHASE"
169
+ --state-dir "$STATE_DIR"
170
+ --output "$BOOTSTRAP_PROMPT"
171
+ )
172
+
173
+ # Support PIPELINE_MODE env var
174
+ if [[ -n "${PIPELINE_MODE:-}" ]]; then
175
+ GEN_ARGS+=(--mode "$PIPELINE_MODE")
176
+ fi
177
+
178
+ # Support ENABLE_CRITIC env var
179
+ if [[ "${ENABLE_CRITIC:-}" == "true" || "${ENABLE_CRITIC:-}" == "1" ]]; then
180
+ GEN_ARGS+=(--critic "true")
181
+ elif [[ "${ENABLE_CRITIC:-}" == "false" || "${ENABLE_CRITIC:-}" == "0" ]]; then
182
+ GEN_ARGS+=(--critic "false")
183
+ fi
184
+
185
+ GEN_OUTPUT=$(python3 "$SCRIPTS_DIR/generate-refactor-prompt.py" "${GEN_ARGS[@]}" 2>/dev/null) || {
186
+ log_error "Failed to generate bootstrap prompt"
187
+ exit 1
188
+ }
189
+ REFACTOR_MODEL=$(echo "$GEN_OUTPUT" | python3 -c "import json,sys; print(json.load(sys.stdin).get('model',''))" 2>/dev/null || echo "")
149
190
 
150
191
  # ============================================================
151
192
  # Run single AI CLI session
152
193
  # ============================================================
153
194
 
195
+ # Branch lifecycle: create and checkout refactor branch
196
+ _branch_name="${DEV_BRANCH:-refactor/${REFACTOR_ID}-$(date +%s)}"
197
+ if branch_create "$PROJECT_ROOT" "$_branch_name" "$ORIGINAL_BRANCH"; then
198
+ _DEV_BRANCH_NAME="$_branch_name"
199
+ log_info "Dev branch: $_branch_name"
200
+ else
201
+ log_warn "Failed to create branch; running session on current branch"
202
+ fi
203
+
154
204
  echo ""
155
205
  echo -e "${BOLD}════════════════════════════════════════════════════${NC}"
156
206
  echo -e "${BOLD} Retry Refactor: $REFACTOR_ID — $REFACTOR_TITLE${NC}"
157
207
  echo -e "${BOLD} Complexity: $REFACTOR_COMPLEXITY${NC}"
158
208
  echo -e "${BOLD}════════════════════════════════════════════════════${NC}"
159
209
  log_info "CLI: $CLI_CMD (platform: $PLATFORM)"
160
- if [[ -n "${MODEL:-}" ]]; then
161
- log_info "Model: $MODEL"
210
+ EFFECTIVE_MODEL="${REFACTOR_MODEL:-${MODEL:-}}"
211
+ if [[ -n "$EFFECTIVE_MODEL" ]]; then
212
+ log_info "Model: $EFFECTIVE_MODEL"
162
213
  else
163
214
  log_info "Model: (CLI default)"
164
215
  fi
@@ -187,14 +238,18 @@ if [[ "$USE_STREAM_JSON" == "true" ]]; then
187
238
  VERBOSE_FLAG="--verbose"
188
239
  fi
189
240
 
190
- # Spawn AI CLI session
241
+ # Spawn AI CLI session — model priority: refactor.model > $MODEL env > none
242
+ EFFECTIVE_MODEL="${REFACTOR_MODEL:-${MODEL:-}}"
191
243
  MODEL_FLAG=""
192
- if [[ -n "${MODEL:-}" ]]; then
193
- MODEL_FLAG="--model $MODEL"
244
+ if [[ -n "$EFFECTIVE_MODEL" ]]; then
245
+ MODEL_FLAG="--model $EFFECTIVE_MODEL"
194
246
  fi
195
247
 
196
248
  unset CLAUDECODE 2>/dev/null || true
197
249
 
250
+ # Log bootstrap prompt in test mode
251
+ prizm_log_bootstrap_prompt "$BOOTSTRAP_PROMPT" "$REFACTOR_ID"
252
+
198
253
  case "$CLI_CMD" in
199
254
  *claude*)
200
255
  # Claude Code: prompt via -p argument, --dangerously-skip-permissions for auto-accept
@@ -244,6 +299,10 @@ cleanup() {
244
299
  stop_progress_parser "$PARSER_PID"
245
300
  wait "$CLI_PID" 2>/dev/null || true
246
301
  [[ -n "$WATCHER_PID" ]] && wait "$WATCHER_PID" 2>/dev/null || true
302
+ if [[ -n "$_DEV_BRANCH_NAME" ]]; then
303
+ log_info "Development was on branch: $_DEV_BRANCH_NAME"
304
+ log_info "Original branch was: $ORIGINAL_BRANCH"
305
+ fi
247
306
  log_info "Session log: $SESSION_LOG"
248
307
  exit 130
249
308
  }
@@ -329,6 +388,30 @@ if [[ "$SESSION_STATUS" == "success" ]]; then
329
388
  fi
330
389
  fi
331
390
 
391
+ # ── Propagate completion notes for dependency context ─────────────────
392
+ if [[ "$SESSION_STATUS" == "success" ]]; then
393
+ SUMMARY_PATH="$PROJECT_ROOT/.prizmkit/refactor/$REFACTOR_ID/completion-summary.json"
394
+ if [[ -f "$SUMMARY_PATH" ]]; then
395
+ python3 "$SCRIPTS_DIR/patch-completion-notes.py" \
396
+ --refactor-list "$REFACTOR_LIST" \
397
+ --refactor-id "$REFACTOR_ID" \
398
+ --summary "$SUMMARY_PATH" >/dev/null 2>&1 && {
399
+ log_info "Propagated completion notes for $REFACTOR_ID"
400
+ } || {
401
+ log_warn "Failed to propagate completion notes for $REFACTOR_ID"
402
+ }
403
+ fi
404
+ fi
405
+
406
+ # ── Merge dev branch back to original on success ────────────────────
407
+ if [[ "$SESSION_STATUS" == "success" && -n "$_DEV_BRANCH_NAME" ]]; then
408
+ if branch_merge "$PROJECT_ROOT" "$_DEV_BRANCH_NAME" "$ORIGINAL_BRANCH" "$AUTO_PUSH"; then
409
+ _DEV_BRANCH_NAME=""
410
+ else
411
+ log_warn "Auto-merge failed — dev branch preserved: $_DEV_BRANCH_NAME"
412
+ fi
413
+ fi
414
+
332
415
  # Update refactor status
333
416
  python3 "$SCRIPTS_DIR/update-refactor-status.py" \
334
417
  --refactor-list "$REFACTOR_LIST" \