spec-and-loop 3.0.1 → 3.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-and-loop",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "OpenSpec + Ralph Loop integration for iterative development with opencode",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -333,6 +333,42 @@ validate_dependencies() {
333
333
  log_verbose "All dependencies validated"
334
334
  }
335
335
 
336
+ ensure_artifacts_present() {
337
+ local change_dir="$1"
338
+ local change_name="$2"
339
+
340
+ local required_files=(
341
+ "proposal.md"
342
+ "tasks.md"
343
+ "design.md"
344
+ )
345
+
346
+ local missing=()
347
+ for file in "${required_files[@]}"; do
348
+ if [[ ! -f "$change_dir/$file" ]]; then
349
+ missing+=("$file")
350
+ fi
351
+ done
352
+
353
+ if [[ ${#missing[@]} -eq 0 ]]; then
354
+ return 0
355
+ fi
356
+
357
+ log_info "Missing artifacts: ${missing[*]}"
358
+ log_info "Invoking opencode to complete missing artifacts..."
359
+
360
+ opencode run "/opsx-ff $change_name" || true
361
+
362
+ for file in "${required_files[@]}"; do
363
+ if [[ ! -f "$change_dir/$file" ]]; then
364
+ log_error "Required artifact still not found after /opsx-ff: $file"
365
+ exit 1
366
+ fi
367
+ done
368
+
369
+ log_info "All missing artifacts generated"
370
+ }
371
+
336
372
  validate_openspec_artifacts() {
337
373
  local change_dir="$1"
338
374
 
@@ -1311,7 +1347,7 @@ WARNING_BOX
1311
1347
  fi
1312
1348
 
1313
1349
  log_info "Invoking opencode to regenerate proposal and tasks with Ralph Wiggum best practices..."
1314
- opencode run "/opsx-continue $change_name${ralph_guidance}" || true
1350
+ opencode run "/opsx-ff $change_name${ralph_guidance}" || true
1315
1351
  local proposal_ok=false
1316
1352
  if [[ -f "$change_dir/proposal.md" ]]; then
1317
1353
  proposal_ok=true
@@ -1334,10 +1370,11 @@ WARNING_BOX
1334
1370
  mv "$proposal_backup" "$change_dir/proposal.md"
1335
1371
  log_info "Restored original proposal.md"
1336
1372
  fi
1337
- if [[ -n "$tasks_backup" && -f "$tasks_backup" ]]; then
1338
- mv "$tasks_backup" "$change_dir/tasks.md"
1339
- log_info "Restored original tasks.md"
1340
- fi
1373
+ fi
1374
+
1375
+ if [[ ! -f "$change_dir/tasks.md" && -n "$tasks_backup" && -f "$tasks_backup" ]]; then
1376
+ mv "$tasks_backup" "$change_dir/tasks.md"
1377
+ log_info "Restored original tasks.md (regeneration did not produce new tasks)"
1341
1378
  fi
1342
1379
 
1343
1380
  log_info "Returning to loop execution..."
@@ -1434,6 +1471,9 @@ main() {
1434
1471
  fi
1435
1472
 
1436
1473
  local change_dir="openspec/changes/$CHANGE_NAME"
1474
+
1475
+ ensure_artifacts_present "$change_dir" "$CHANGE_NAME"
1476
+
1437
1477
  validate_openspec_artifacts "$change_dir"
1438
1478
  validate_script_state "$change_dir"
1439
1479
  local ralph_dir=$(setup_ralph_directory "$change_dir")