specrails-core 3.5.1 → 3.5.3

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/update.sh CHANGED
@@ -149,7 +149,7 @@ generate_manifest() {
149
149
  updated_at="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
150
150
 
151
151
  # Write version file
152
- printf '%s\n' "$version" > "$REPO_ROOT/.specrails-version"
152
+ printf '%s\n' "$version" > "$REPO_ROOT/.specrails/specrails-version"
153
153
 
154
154
  # Build artifact checksums for all files under templates/
155
155
  local artifacts_json=""
@@ -201,7 +201,7 @@ generate_manifest() {
201
201
  done < <(find "$SCRIPT_DIR/.claude/skills" -type f -print0 | sort -z)
202
202
  fi
203
203
 
204
- cat > "$REPO_ROOT/.specrails-manifest.json" << EOF
204
+ cat > "$REPO_ROOT/.specrails/specrails-manifest.json" << EOF
205
205
  {
206
206
  "version": "${version}",
207
207
  "installed_at": "${updated_at}",
@@ -223,9 +223,33 @@ if [[ -z "$REPO_ROOT" ]]; then
223
223
  exit 1
224
224
  fi
225
225
 
226
- VERSION_FILE="$REPO_ROOT/.specrails-version"
226
+ VERSION_FILE="$REPO_ROOT/.specrails/specrails-version"
227
227
  AGENTS_DIR="$REPO_ROOT/.claude/agents"
228
228
 
229
+ # Migrate old root-level metadata files to .specrails/ (path change introduced in v3.6.0)
230
+ if [[ ! -f "$VERSION_FILE" ]] && [[ -f "$REPO_ROOT/.specrails-version" ]]; then
231
+ mkdir -p "$REPO_ROOT/.specrails"
232
+ mv "$REPO_ROOT/.specrails-version" "$REPO_ROOT/.specrails/specrails-version"
233
+ ok "Migrated .specrails-version → .specrails/specrails-version"
234
+ fi
235
+ if [[ -f "$REPO_ROOT/.specrails-manifest.json" ]]; then
236
+ mkdir -p "$REPO_ROOT/.specrails"
237
+ mv "$REPO_ROOT/.specrails-manifest.json" "$REPO_ROOT/.specrails/specrails-manifest.json"
238
+ ok "Migrated .specrails-manifest.json → .specrails/specrails-manifest.json"
239
+ fi
240
+ # Migrate old provider-specific setup-templates to .specrails/setup-templates/
241
+ _MIGRATED_SETUP_TEMPLATES=false
242
+ for _old_templates in "$REPO_ROOT/.claude/setup-templates" "$REPO_ROOT/.codex/setup-templates"; do
243
+ if [[ -d "$_old_templates" ]]; then
244
+ mkdir -p "$REPO_ROOT/.specrails/setup-templates"
245
+ cp -r "$_old_templates/." "$REPO_ROOT/.specrails/setup-templates/"
246
+ rm -rf "$_old_templates"
247
+ ok "Migrated ${_old_templates#"$REPO_ROOT/"} → .specrails/setup-templates/"
248
+ _MIGRATED_SETUP_TEMPLATES=true
249
+ fi
250
+ done
251
+ unset _old_templates
252
+
229
253
  # Detect installation state
230
254
  INSTALLED_VERSION=""
231
255
  IS_LEGACY=false
@@ -253,7 +277,7 @@ fi
253
277
  # Content-aware up-to-date check (skip for legacy migrations and agent-only runs)
254
278
  if [[ "$INSTALLED_VERSION" == "$AVAILABLE_VERSION" ]] && [[ "$IS_LEGACY" == false ]] && [[ "$UPDATE_COMPONENT" != "agents" ]] && [[ "$FORCE_UPDATE" == false ]]; then
255
279
  # Same version — check if any template content has actually changed
256
- local_manifest="$REPO_ROOT/.specrails-manifest.json"
280
+ local_manifest="$REPO_ROOT/.specrails/specrails-manifest.json"
257
281
  HAS_CHANGES=false
258
282
 
259
283
  if [[ -f "$local_manifest" ]]; then
@@ -310,13 +334,13 @@ fi
310
334
 
311
335
  if [[ "$IS_LEGACY" == true ]]; then
312
336
  step "Phase 2: Legacy migration"
313
- warn "No .specrails-version found — assuming v0.1.0 (pre-versioning install)"
337
+ warn "No .specrails/specrails-version found — assuming v0.1.0 (pre-versioning install)"
314
338
  info "Generating baseline manifest from current specrails templates..."
315
339
  generate_manifest
316
340
  # Overwrite with legacy version so the update flow sees "0.1.0 → current"
317
341
  printf '0.1.0\n' > "$VERSION_FILE"
318
- ok "Written .specrails-version as 0.1.0"
319
- ok "Written .specrails-manifest.json"
342
+ ok "Written .specrails/specrails-version as 0.1.0"
343
+ ok "Written .specrails/specrails-manifest.json"
320
344
  fi
321
345
 
322
346
  # ─────────────────────────────────────────────
@@ -348,6 +372,9 @@ ok "Backed up .claude/ to .claude.specrails.backup/ (excluding node_modules)"
348
372
  # ─────────────────────────────────────────────
349
373
 
350
374
  NEEDS_SETUP_UPDATE=false
375
+ if [[ "$_MIGRATED_SETUP_TEMPLATES" == true ]]; then
376
+ NEEDS_SETUP_UPDATE=true
377
+ fi
351
378
  FORCE_AGENTS=false
352
379
 
353
380
  do_migrate_sr_prefix() {
@@ -461,7 +488,7 @@ do_migrate_sr_prefix() {
461
488
  do_core() {
462
489
  step "Updating core artifacts (commands, skills, setup-templates)"
463
490
 
464
- local manifest_file="$REPO_ROOT/.specrails-manifest.json"
491
+ local manifest_file="$REPO_ROOT/.specrails/specrails-manifest.json"
465
492
  local updated_count=0
466
493
  local added_count=0
467
494
 
@@ -509,7 +536,7 @@ except Exception:
509
536
  relpath="templates/${filepath#"$SCRIPT_DIR/templates/"}"
510
537
 
511
538
  if _file_changed "$filepath" "$relpath"; then
512
- local dest="$REPO_ROOT/.claude/setup-templates/${filepath#"$SCRIPT_DIR/templates/"}"
539
+ local dest="$REPO_ROOT/.specrails/setup-templates/${filepath#"$SCRIPT_DIR/templates/"}"
513
540
  mkdir -p "$(dirname "$dest")"
514
541
  cp "$filepath" "$dest"
515
542
 
@@ -540,7 +567,7 @@ except Exception:
540
567
  relpath="prompts/${filepath#"$SCRIPT_DIR/prompts/"}"
541
568
 
542
569
  if _file_changed "$filepath" "$relpath"; then
543
- local dest="$REPO_ROOT/.claude/setup-templates/prompts/${filepath#"$SCRIPT_DIR/prompts/"}"
570
+ local dest="$REPO_ROOT/.specrails/setup-templates/prompts/${filepath#"$SCRIPT_DIR/prompts/"}"
544
571
  mkdir -p "$(dirname "$dest")"
545
572
  cp "$filepath" "$dest"
546
573
 
@@ -605,10 +632,10 @@ except Exception:
605
632
  do_agents() {
606
633
  step "Checking adapted artifacts (agents, rules)"
607
634
 
608
- local manifest_file="$REPO_ROOT/.specrails-manifest.json"
635
+ local manifest_file="$REPO_ROOT/.specrails/specrails-manifest.json"
609
636
 
610
637
  if [[ ! -f "$manifest_file" ]]; then
611
- warn "No .specrails-manifest.json found — cannot detect template changes."
638
+ warn "No .specrails/specrails-manifest.json found — cannot detect template changes."
612
639
  warn "Run update.sh without --only to regenerate the manifest."
613
640
  return
614
641
  fi
@@ -748,8 +775,8 @@ with open(user_path, 'w') as f:
748
775
  do_stamp() {
749
776
  step "Writing version stamp and manifest"
750
777
  generate_manifest
751
- ok "Updated .specrails-version to v${AVAILABLE_VERSION}"
752
- ok "Updated .specrails-manifest.json"
778
+ ok "Updated .specrails/specrails-version to v${AVAILABLE_VERSION}"
779
+ ok "Updated .specrails/specrails-manifest.json"
753
780
  }
754
781
 
755
782
  # ─────────────────────────────────────────────
@@ -795,9 +822,9 @@ rm -rf "$BACKUP_DIR"
795
822
  ok "Backup removed"
796
823
 
797
824
  # Clean up setup-templates if no /specrails:setup re-run is needed
798
- if [[ "$NEEDS_SETUP_UPDATE" != true ]] && [[ -d "$REPO_ROOT/.claude/setup-templates" ]]; then
799
- rm -rf "$REPO_ROOT/.claude/setup-templates"
800
- ok "Cleaned up setup-templates (no /specrails:setup re-run needed)"
825
+ if [[ "$NEEDS_SETUP_UPDATE" != true ]] && [[ -d "$REPO_ROOT/.specrails/setup-templates" ]]; then
826
+ rm -rf "$REPO_ROOT/.specrails/setup-templates"
827
+ ok "Cleaned up .specrails/setup-templates (no /specrails:setup re-run needed)"
801
828
  fi
802
829
 
803
830
  echo ""