@seanyao/roll 2026.505.2 → 2026.505.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/bin/roll CHANGED
@@ -4,7 +4,7 @@ set -euo pipefail
4
4
  # Roll — AI Agent Convention Manager
5
5
  # Single source of truth for how all AI coding agents behave.
6
6
 
7
- VERSION="2026.505.2"
7
+ VERSION="2026.505.3"
8
8
  ROLL_HOME="${ROLL_HOME:-${HOME}/.roll}"
9
9
  ROLL_CONFIG="${ROLL_HOME}/config.yaml"
10
10
  ROLL_GLOBAL="${ROLL_HOME}/conventions/global"
@@ -572,25 +572,49 @@ _merge_global_to_project() {
572
572
 
573
573
  [[ -f "$src" ]] || { warn "Global AGENTS.md not found at ${src/#$HOME/~}"; return; }
574
574
 
575
+ # Detect project type — controls which sections are included
576
+ local project_type skip_frontend=false
577
+ project_type="$(scan_project_type_from_files "$project_dir")"
578
+ case "$project_type" in
579
+ cli|backend-service|unknown) skip_frontend=true ;;
580
+ esac
581
+
575
582
  if [[ ! -f "$dst" ]]; then
576
- cp "$src" "$dst"
583
+ # Fresh create: write sections filtered by project type
584
+ local fc_h="" fc_b="" fc_pre=true fc_want=true
585
+ while IFS= read -r fc_line; do
586
+ if [[ "$fc_line" =~ ^##\ ]]; then
587
+ if [[ -n "$fc_h" && "$fc_want" == "true" ]]; then
588
+ printf '%s\n%s' "$fc_h" "$fc_b" >> "$dst"
589
+ fi
590
+ fc_h="$fc_line"; fc_b=""; fc_pre=false
591
+ fc_want=true
592
+ [[ "$skip_frontend" == "true" && "$fc_h" == "## 7. Frontend Default Stack" ]] && fc_want=false
593
+ elif [[ "$fc_pre" == "true" ]]; then
594
+ printf '%s\n' "$fc_line" >> "$dst"
595
+ else
596
+ fc_b+="$fc_line"$'\n'
597
+ fi
598
+ done < "$src"
599
+ if [[ -n "$fc_h" && "$fc_want" == "true" ]]; then
600
+ printf '%s\n%s' "$fc_h" "$fc_b" >> "$dst"
601
+ fi
577
602
  ok "Created: AGENTS.md"
578
603
  _ROLL_MERGE_SUMMARY+=("created|AGENTS.md")
579
604
  return
580
605
  fi
581
606
 
582
- if diff -q "$src" "$dst" &>/dev/null; then
583
- _ROLL_MERGE_SUMMARY+=("unchanged|AGENTS.md")
584
- return
585
- fi
586
-
587
607
  # Section-merge: append any ## sections from global missing in project
588
608
  local added=0 cur_h="" cur_b=""
589
609
  while IFS= read -r line; do
590
610
  if [[ "$line" =~ ^##\ ]]; then
591
611
  if [[ -n "$cur_h" ]] && ! grep -qF "$cur_h" "$dst" 2>/dev/null; then
592
- printf '\n%s\n%s' "$cur_h" "$cur_b" >> "$dst"
593
- added=$((added + 1))
612
+ local skip_sec=false
613
+ [[ "$skip_frontend" == "true" && "$cur_h" == "## 7. Frontend Default Stack" ]] && skip_sec=true
614
+ if [[ "$skip_sec" == "false" ]]; then
615
+ printf '\n%s\n%s' "$cur_h" "$cur_b" >> "$dst"
616
+ added=$((added + 1))
617
+ fi
594
618
  fi
595
619
  cur_h="$line"; cur_b=""
596
620
  elif [[ -n "$cur_h" ]]; then
@@ -598,8 +622,12 @@ _merge_global_to_project() {
598
622
  fi
599
623
  done < "$src"
600
624
  if [[ -n "$cur_h" ]] && ! grep -qF "$cur_h" "$dst" 2>/dev/null; then
601
- printf '\n%s\n%s' "$cur_h" "$cur_b" >> "$dst"
602
- added=$((added + 1))
625
+ local skip_sec=false
626
+ [[ "$skip_frontend" == "true" && "$cur_h" == "## 7. Frontend Default Stack" ]] && skip_sec=true
627
+ if [[ "$skip_sec" == "false" ]]; then
628
+ printf '\n%s\n%s' "$cur_h" "$cur_b" >> "$dst"
629
+ added=$((added + 1))
630
+ fi
603
631
  fi
604
632
 
605
633
  if [[ $added -gt 0 ]]; then
@@ -610,6 +638,52 @@ _merge_global_to_project() {
610
638
  fi
611
639
  }
612
640
 
641
+ _merge_claude_to_project() {
642
+ local project_dir="$1"
643
+ local project_type
644
+ project_type="$(scan_project_type_from_files "$project_dir")"
645
+
646
+ local tpl_file="$ROLL_TEMPLATES/$project_type/CLAUDE.md"
647
+ [[ -f "$tpl_file" ]] || return 0 # No template for this project type
648
+
649
+ local claude_dir="$project_dir/.claude"
650
+ local out_file="$claude_dir/CLAUDE.md"
651
+
652
+ mkdir -p "$claude_dir"
653
+
654
+ if [[ ! -f "$out_file" ]]; then
655
+ cp "$tpl_file" "$out_file"
656
+ ok "Created: .claude/CLAUDE.md"
657
+ _ROLL_MERGE_SUMMARY+=("created|.claude/CLAUDE.md")
658
+ return
659
+ fi
660
+
661
+ # Append any ## sections from template missing in project file
662
+ local added=0 cur_h="" cur_b=""
663
+ while IFS= read -r line; do
664
+ if [[ "$line" =~ ^##\ ]]; then
665
+ if [[ -n "$cur_h" ]] && ! grep -qF "$cur_h" "$out_file" 2>/dev/null; then
666
+ printf '\n%s\n%s' "$cur_h" "$cur_b" >> "$out_file"
667
+ added=$((added + 1))
668
+ fi
669
+ cur_h="$line"; cur_b=""
670
+ elif [[ -n "$cur_h" ]]; then
671
+ cur_b+="$line"$'\n'
672
+ fi
673
+ done < "$tpl_file"
674
+ if [[ -n "$cur_h" ]] && ! grep -qF "$cur_h" "$out_file" 2>/dev/null; then
675
+ printf '\n%s\n%s' "$cur_h" "$cur_b" >> "$out_file"
676
+ added=$((added + 1))
677
+ fi
678
+
679
+ if [[ $added -gt 0 ]]; then
680
+ ok "Merged: .claude/CLAUDE.md ($added new sections)"
681
+ _ROLL_MERGE_SUMMARY+=("merged|.claude/CLAUDE.md")
682
+ else
683
+ _ROLL_MERGE_SUMMARY+=("unchanged|.claude/CLAUDE.md")
684
+ fi
685
+ }
686
+
613
687
  # ═══════════════════════════════════════════════════════════════════════════════
614
688
  # COMMAND: init
615
689
  # Initialize or re-merge a project. Always operates on the current directory.
@@ -633,6 +707,7 @@ cmd_init() {
633
707
  fi
634
708
 
635
709
  _merge_global_to_project "$project_dir"
710
+ _merge_claude_to_project "$project_dir"
636
711
  _write_backlog "$project_dir/BACKLOG.md"
637
712
  _ensure_features_dir "$project_dir/docs/features"
638
713
  print_merge_summary
@@ -4,10 +4,9 @@
4
4
 
5
5
  ## Stack
6
6
 
7
- - Node.js / TypeScript
8
- - CLI framework: commander or citty
9
- - Testing: Vitest + execa (CLI integration tests)
10
- - Distribution: npm package with bin entry
7
+ - Runtime / Language: {e.g. Node.js / TypeScript, Go, Python, Bash}
8
+ - Test framework: {e.g. Vitest, pytest, bats}
9
+ - Distribution: {e.g. npm, Homebrew, binary release}
11
10
 
12
11
  ## Claude Code Notes
13
12
 
@@ -15,4 +14,3 @@
15
14
  - Test commands by running them in Bash, not just unit tests.
16
15
  - Use `$roll-design` to plan command structure and options before implementation.
17
16
  - Verify `--help` output is clear and complete for each command.
18
- - Run `npm run build && node dist/index.js --help` before pushing.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seanyao/roll",
3
- "version": "2026.505.2",
3
+ "version": "2026.505.3",
4
4
  "description": "Roll — Roll out features with AI agents",
5
5
  "scripts": {
6
6
  "test": "find tests/unit tests/integration -name '*.bats' | sort | xargs ./tests/helpers/bats-core/bin/bats"