specrails-core 1.7.1 → 1.7.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.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { execSync } = require("child_process");
3
+ const { spawnSync } = require("child_process");
4
4
  const { resolve } = require("path");
5
5
 
6
6
  const ROOT = resolve(__dirname, "..");
@@ -33,11 +33,28 @@ if (!script) {
33
33
  process.exit(1);
34
34
  }
35
35
 
36
- const forwarded = args.slice(1).join(" ");
37
- const cmd = `bash "${resolve(ROOT, script)}" ${forwarded}`.trim();
36
+ // Allowlisted flags per subcommand (defense-in-depth — spawnSync already
37
+ // prevents shell injection, but an explicit allowlist rejects unknown flags
38
+ // before the shell script is ever invoked).
39
+ const ALLOWED_FLAGS = {
40
+ init: ["--root-dir", "--yes", "-y"],
41
+ update: ["--only"],
42
+ doctor: [],
43
+ };
44
+
45
+ const subargs = args.slice(1);
46
+ const allowed = ALLOWED_FLAGS[subcommand] ?? [];
38
47
 
39
- try {
40
- execSync(cmd, { stdio: "inherit", cwd: process.cwd() });
41
- } catch (err) {
42
- process.exit(err.status || 1);
48
+ for (const arg of subargs) {
49
+ if (arg.startsWith("-") && !allowed.includes(arg)) {
50
+ console.error(`Unknown flag: ${arg}`);
51
+ process.exit(1);
52
+ }
43
53
  }
54
+
55
+ const result = spawnSync("bash", [resolve(ROOT, script), ...subargs], {
56
+ stdio: "inherit",
57
+ cwd: process.cwd(),
58
+ });
59
+
60
+ process.exit(result.status ?? (result.error ? 1 : 0));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specrails-core",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "description": "AI agent workflow system for Claude Code — installs 12 specialized agents, orchestration commands, and persona-driven product discovery into any repository",
5
5
  "bin": {
6
6
  "specrails-core": "bin/specrails-core.js"
package/update.sh CHANGED
@@ -390,7 +390,7 @@ do_migrate_sr_prefix() {
390
390
  if [[ -f "$src" ]] && [[ ! -f "$dst" ]]; then
391
391
  mv "$src" "$dst"
392
392
  info "Renamed: agents/${agent}.md → agents/sr-${agent}.md"
393
- ((migrated_agents++))
393
+ migrated_agents=$(( migrated_agents + 1 ))
394
394
  fi
395
395
  done
396
396
 
@@ -408,7 +408,7 @@ do_migrate_sr_prefix() {
408
408
  if [[ ! -f "$persona_dst" ]]; then
409
409
  mv "$persona_file" "$persona_dst"
410
410
  info "Renamed: personas/${persona_basename} → personas/sr-${persona_basename}"
411
- ((migrated_agents++))
411
+ migrated_agents=$(( migrated_agents + 1 ))
412
412
  fi
413
413
  done < <(find "$personas_dir" -maxdepth 1 -name "*.md" -not -name "sr-*.md" -print0 2>/dev/null)
414
414
  fi
@@ -433,7 +433,7 @@ do_migrate_sr_prefix() {
433
433
  if [[ -f "$src" ]] && [[ ! -f "$dst" ]]; then
434
434
  mv "$src" "$dst"
435
435
  info "Moved: commands/${cmd}.md → commands/sr/${cmd}.md"
436
- ((migrated_commands++))
436
+ migrated_commands=$(( migrated_commands + 1 ))
437
437
  fi
438
438
  done
439
439
  fi
@@ -446,7 +446,7 @@ do_migrate_sr_prefix() {
446
446
  if [[ -d "$src" ]] && [[ ! -d "$dst" ]]; then
447
447
  mv "$src" "$dst"
448
448
  info "Renamed: agent-memory/${agent}/ → agent-memory/sr-${agent}/"
449
- ((migrated_memory++))
449
+ migrated_memory=$(( migrated_memory + 1 ))
450
450
  fi
451
451
  done
452
452
  fi
@@ -501,7 +501,7 @@ except Exception:
501
501
  if _file_changed "$SCRIPT_DIR/commands/setup.md" "commands/setup.md"; then
502
502
  cp "$SCRIPT_DIR/commands/setup.md" "$REPO_ROOT/.claude/commands/setup.md"
503
503
  ok "Updated /setup command"
504
- ((updated_count++))
504
+ updated_count=$(( updated_count + 1 ))
505
505
  fi
506
506
 
507
507
  # Update setup templates (selective — only copy changed/new files)
@@ -526,10 +526,10 @@ except Exception:
526
526
  " "$manifest_file" "$relpath" 2>/dev/null || echo "")"
527
527
  if [[ -z "$manifest_checksum" ]]; then
528
528
  info "New: $relpath"
529
- ((added_count++))
529
+ added_count=$(( added_count + 1 ))
530
530
  else
531
531
  info "Changed: $relpath"
532
- ((updated_count++))
532
+ updated_count=$(( updated_count + 1 ))
533
533
  fi
534
534
  fi
535
535
  done < <(find "$SCRIPT_DIR/templates" -type f -not -path '*/node_modules/*' -not -name 'package-lock.json' -print0 | sort -z)
@@ -556,10 +556,10 @@ except Exception:
556
556
  " "$manifest_file" "$relpath" 2>/dev/null || echo "")"
557
557
  if [[ -z "$manifest_checksum" ]]; then
558
558
  info "New: $relpath"
559
- ((added_count++))
559
+ added_count=$(( added_count + 1 ))
560
560
  else
561
561
  info "Changed: $relpath"
562
- ((updated_count++))
562
+ updated_count=$(( updated_count + 1 ))
563
563
  fi
564
564
  fi
565
565
  done < <(find "$SCRIPT_DIR/prompts" -type f -print0 | sort -z)
@@ -587,10 +587,10 @@ except Exception:
587
587
  " "$manifest_file" "$relpath" 2>/dev/null || echo "")"
588
588
  if [[ -z "$manifest_checksum" ]]; then
589
589
  info "New: $relpath"
590
- ((added_count++))
590
+ added_count=$(( added_count + 1 ))
591
591
  else
592
592
  info "Changed: $relpath"
593
- ((updated_count++))
593
+ updated_count=$(( updated_count + 1 ))
594
594
  fi
595
595
  fi
596
596
  done < <(find "$SCRIPT_DIR/.claude/skills" -type f -print0 | sort -z)