@seanyao/roll 2026.505.3 → 2026.506.1

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 (2) hide show
  1. package/bin/roll +35 -1
  2. package/package.json +1 -1
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.3"
7
+ VERSION="2026.506.1"
8
8
  ROLL_HOME="${ROLL_HOME:-${HOME}/.roll}"
9
9
  ROLL_CONFIG="${ROLL_HOME}/config.yaml"
10
10
  ROLL_GLOBAL="${ROLL_HOME}/conventions/global"
@@ -64,6 +64,29 @@ lower_name() {
64
64
  echo "$1" | tr '[:upper:]' '[:lower:]'
65
65
  }
66
66
 
67
+ # Detect AI client by walking the process tree (innermost match wins).
68
+ # Returns empty string if no known AI client is found.
69
+ _detect_ai_client() {
70
+ local pid=$$ depth=0 cmd
71
+ while [[ "$pid" -gt 1 ]] && [[ "$depth" -lt 15 ]]; do
72
+ cmd=$(ps -p "$pid" -o comm= 2>/dev/null | tr '[:upper:]' '[:lower:]' || true)
73
+ case "$cmd" in
74
+ *opencode*) echo "opencode"; return ;;
75
+ *claude*) echo "claude code"; return ;;
76
+ *kimi*) echo "kimi cli"; return ;;
77
+ *gemini*) echo "gemini cli"; return ;;
78
+ *codex*) echo "codex"; return ;;
79
+ *cursor*) echo "cursor"; return ;;
80
+ esac
81
+ local ppid
82
+ ppid=$(ps -p "$pid" -o ppid= 2>/dev/null | tr -d ' ' || true)
83
+ [[ "$ppid" == "$pid" ]] && break
84
+ pid=$ppid
85
+ depth=$((depth + 1))
86
+ done
87
+ echo ""
88
+ }
89
+
67
90
  # Check if an AI tool is actually installed.
68
91
  # Most tools create their own config dir; Trae on macOS uses Library/Application Support
69
92
  # and expects roll to manage ~/.trae/ — so we detect via the app directory instead.
@@ -78,6 +101,10 @@ _is_ai_installed() {
78
101
  [[ -d "$HOME/.config/Trae" ]]
79
102
  return
80
103
  ;;
104
+ opencode)
105
+ [[ -x "$HOME/.opencode/bin/opencode" ]]
106
+ return
107
+ ;;
81
108
  esac
82
109
  return 1
83
110
  }
@@ -117,6 +144,7 @@ _ensure_config_entries() {
117
144
  "ai_codex:~/.codex|AGENTS.md|AGENTS.md"
118
145
  "ai_cursor:~/.cursor|.cursor-rules|.cursor-rules"
119
146
  "ai_trae:~/.trae|user_rules.md|project_rules.md"
147
+ "ai_opencode:~/.config/opencode|AGENTS.md|AGENTS.md"
120
148
  "ai_openclaw:~/.openclaw/workspace|AGENTS.md|AGENTS.md"
121
149
  )
122
150
 
@@ -328,6 +356,7 @@ ai_kimi: ~/.kimi|AGENTS.md|AGENTS.md
328
356
  ai_codex: ~/.codex|AGENTS.md|AGENTS.md
329
357
  ai_cursor: ~/.cursor|.cursor-rules|.cursor-rules
330
358
  ai_trae: ~/.trae|user_rules.md|project_rules.md
359
+ ai_opencode: ~/.config/opencode|AGENTS.md|AGENTS.md
331
360
  ai_openclaw: ~/.openclaw/workspace|AGENTS.md|AGENTS.md
332
361
 
333
362
  # User preferences
@@ -711,6 +740,10 @@ cmd_init() {
711
740
  _write_backlog "$project_dir/BACKLOG.md"
712
741
  _ensure_features_dir "$project_dir/docs/features"
713
742
  print_merge_summary
743
+
744
+ echo ""
745
+ info "Syncing conventions to AI tools... 正在同步约定到 AI 工具..."
746
+ _sync_conventions
714
747
  echo ""
715
748
 
716
749
  if [[ "$has_agents" == "true" ]]; then
@@ -720,6 +753,7 @@ cmd_init() {
720
753
  fi
721
754
  }
722
755
 
756
+
723
757
  # ─── Helper: merge global preamble + template into output ────────────────────
724
758
  merge_convention() {
725
759
  local filename="$1"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seanyao/roll",
3
- "version": "2026.505.3",
3
+ "version": "2026.506.1",
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"