agileflow 2.51.0 → 2.56.0

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 (90) hide show
  1. package/README.md +80 -460
  2. package/package.json +18 -3
  3. package/scripts/agileflow-configure.js +134 -63
  4. package/scripts/agileflow-welcome.js +161 -31
  5. package/scripts/generators/agent-registry.js +45 -57
  6. package/scripts/generators/command-registry.js +48 -32
  7. package/scripts/generators/index.js +2 -6
  8. package/scripts/generators/inject-babysit.js +9 -2
  9. package/scripts/generators/inject-help.js +3 -1
  10. package/scripts/generators/inject-readme.js +7 -3
  11. package/scripts/generators/skill-registry.js +60 -33
  12. package/scripts/get-env.js +13 -12
  13. package/scripts/lib/frontmatter-parser.js +82 -0
  14. package/scripts/obtain-context.js +79 -26
  15. package/scripts/session-coordinator.sh +232 -0
  16. package/scripts/session-manager.js +512 -0
  17. package/src/core/agents/orchestrator.md +275 -0
  18. package/src/core/commands/adr.md +38 -16
  19. package/src/core/commands/agent.md +39 -22
  20. package/src/core/commands/assign.md +17 -0
  21. package/src/core/commands/auto.md +60 -46
  22. package/src/core/commands/babysit.md +302 -637
  23. package/src/core/commands/baseline.md +20 -0
  24. package/src/core/commands/blockers.md +33 -48
  25. package/src/core/commands/board.md +19 -0
  26. package/src/core/commands/changelog.md +20 -0
  27. package/src/core/commands/ci.md +17 -0
  28. package/src/core/commands/context.md +43 -40
  29. package/src/core/commands/debt.md +76 -45
  30. package/src/core/commands/deploy.md +20 -0
  31. package/src/core/commands/deps.md +40 -46
  32. package/src/core/commands/diagnose.md +24 -18
  33. package/src/core/commands/docs.md +18 -0
  34. package/src/core/commands/epic.md +31 -0
  35. package/src/core/commands/feedback.md +33 -21
  36. package/src/core/commands/handoff.md +29 -0
  37. package/src/core/commands/help.md +16 -7
  38. package/src/core/commands/impact.md +31 -61
  39. package/src/core/commands/metrics.md +17 -35
  40. package/src/core/commands/packages.md +21 -0
  41. package/src/core/commands/pr.md +15 -0
  42. package/src/core/commands/readme-sync.md +42 -9
  43. package/src/core/commands/research.md +58 -11
  44. package/src/core/commands/retro.md +42 -50
  45. package/src/core/commands/review.md +22 -27
  46. package/src/core/commands/session/end.md +53 -297
  47. package/src/core/commands/session/history.md +38 -257
  48. package/src/core/commands/session/init.md +44 -446
  49. package/src/core/commands/session/new.md +152 -0
  50. package/src/core/commands/session/resume.md +51 -447
  51. package/src/core/commands/session/status.md +32 -244
  52. package/src/core/commands/sprint.md +33 -0
  53. package/src/core/commands/status.md +18 -0
  54. package/src/core/commands/story-validate.md +32 -0
  55. package/src/core/commands/story.md +21 -6
  56. package/src/core/commands/template.md +18 -0
  57. package/src/core/commands/tests.md +22 -0
  58. package/src/core/commands/update.md +72 -58
  59. package/src/core/commands/validate-expertise.md +25 -37
  60. package/src/core/commands/velocity.md +33 -74
  61. package/src/core/commands/verify.md +16 -0
  62. package/src/core/experts/documentation/expertise.yaml +16 -2
  63. package/src/core/skills/agileflow-retro-facilitator/SKILL.md +57 -219
  64. package/src/core/skills/agileflow-retro-facilitator/cookbook/4ls.md +86 -0
  65. package/src/core/skills/agileflow-retro-facilitator/cookbook/glad-sad-mad.md +79 -0
  66. package/src/core/skills/agileflow-retro-facilitator/cookbook/start-stop-continue.md +142 -0
  67. package/src/core/skills/agileflow-retro-facilitator/prompts/action-items.md +83 -0
  68. package/src/core/skills/writing-skills/SKILL.md +352 -0
  69. package/src/core/skills/writing-skills/testing-skills-with-subagents.md +232 -0
  70. package/tools/cli/agileflow-cli.js +4 -2
  71. package/tools/cli/commands/config.js +20 -13
  72. package/tools/cli/commands/doctor.js +25 -9
  73. package/tools/cli/commands/list.js +10 -6
  74. package/tools/cli/commands/setup.js +54 -3
  75. package/tools/cli/commands/status.js +6 -8
  76. package/tools/cli/commands/uninstall.js +5 -5
  77. package/tools/cli/commands/update.js +51 -7
  78. package/tools/cli/installers/core/installer.js +8 -4
  79. package/tools/cli/installers/ide/_base-ide.js +58 -1
  80. package/tools/cli/installers/ide/claude-code.js +3 -61
  81. package/tools/cli/installers/ide/codex.js +440 -0
  82. package/tools/cli/installers/ide/cursor.js +21 -51
  83. package/tools/cli/installers/ide/manager.js +2 -6
  84. package/tools/cli/installers/ide/windsurf.js +20 -50
  85. package/tools/cli/lib/content-injector.js +26 -49
  86. package/tools/cli/lib/docs-setup.js +3 -2
  87. package/tools/cli/lib/npm-utils.js +39 -12
  88. package/tools/cli/lib/ui.js +31 -10
  89. package/tools/cli/lib/version-checker.js +3 -3
  90. package/tools/postinstall.js +2 -3
@@ -0,0 +1,232 @@
1
+ #!/bin/bash
2
+ # session-coordinator.sh - Automatic multi-session coordination
3
+ # Detects concurrent Claude Code sessions and handles conflicts
4
+
5
+ set -e
6
+
7
+ SESSIONS_DIR=".agileflow/sessions"
8
+ LOCK_TIMEOUT=3600 # 1 hour - stale session threshold
9
+
10
+ # Colors
11
+ RED='\033[0;31m'
12
+ GREEN='\033[0;32m'
13
+ YELLOW='\033[1;33m'
14
+ BLUE='\033[0;34m'
15
+ CYAN='\033[0;36m'
16
+ DIM='\033[2m'
17
+ RESET='\033[0m'
18
+
19
+ # Get current session ID (PID + timestamp for uniqueness)
20
+ SESSION_ID="$$-$(date +%s)"
21
+ SESSION_FILE="$SESSIONS_DIR/session-$SESSION_ID.lock"
22
+
23
+ # Ensure sessions directory exists
24
+ mkdir -p "$SESSIONS_DIR"
25
+
26
+ # Function: Check if a PID is still running
27
+ is_pid_alive() {
28
+ local pid=$1
29
+ if [[ -z "$pid" ]]; then
30
+ return 1
31
+ fi
32
+ kill -0 "$pid" 2>/dev/null
33
+ }
34
+
35
+ # Function: Clean up stale sessions
36
+ cleanup_stale_sessions() {
37
+ local now=$(date +%s)
38
+
39
+ for lockfile in "$SESSIONS_DIR"/session-*.lock 2>/dev/null; do
40
+ [[ -f "$lockfile" ]] || continue
41
+
42
+ # Read lock file
43
+ local lock_pid=$(grep "^pid=" "$lockfile" 2>/dev/null | cut -d= -f2)
44
+ local lock_time=$(grep "^started=" "$lockfile" 2>/dev/null | cut -d= -f2)
45
+
46
+ # Check if stale (PID dead or too old)
47
+ if ! is_pid_alive "$lock_pid"; then
48
+ rm -f "$lockfile"
49
+ continue
50
+ fi
51
+
52
+ # Check if expired
53
+ if [[ -n "$lock_time" ]]; then
54
+ local age=$((now - lock_time))
55
+ if [[ $age -gt $LOCK_TIMEOUT ]]; then
56
+ rm -f "$lockfile"
57
+ fi
58
+ fi
59
+ done
60
+ }
61
+
62
+ # Function: Get list of active sessions
63
+ get_active_sessions() {
64
+ local sessions=()
65
+
66
+ for lockfile in "$SESSIONS_DIR"/session-*.lock 2>/dev/null; do
67
+ [[ -f "$lockfile" ]] || continue
68
+
69
+ local lock_pid=$(grep "^pid=" "$lockfile" 2>/dev/null | cut -d= -f2)
70
+
71
+ if is_pid_alive "$lock_pid"; then
72
+ local branch=$(grep "^branch=" "$lockfile" 2>/dev/null | cut -d= -f2)
73
+ local worktree=$(grep "^worktree=" "$lockfile" 2>/dev/null | cut -d= -f2)
74
+ local story=$(grep "^story=" "$lockfile" 2>/dev/null | cut -d= -f2)
75
+ sessions+=("$lock_pid:$branch:$worktree:$story")
76
+ fi
77
+ done
78
+
79
+ printf '%s\n' "${sessions[@]}"
80
+ }
81
+
82
+ # Function: Register this session
83
+ register_session() {
84
+ local branch=$(git branch --show-current 2>/dev/null || echo "unknown")
85
+ local worktree=$(pwd)
86
+ local story=""
87
+
88
+ # Try to get current story from status.json
89
+ if [[ -f "docs/09-agents/status.json" ]]; then
90
+ story=$(grep -o '"current_story"[[:space:]]*:[[:space:]]*"[^"]*"' docs/09-agents/status.json 2>/dev/null | cut -d'"' -f4 || echo "")
91
+ fi
92
+
93
+ cat > "$SESSION_FILE" << EOF
94
+ pid=$$
95
+ started=$(date +%s)
96
+ branch=$branch
97
+ worktree=$worktree
98
+ story=$story
99
+ user=$(whoami)
100
+ EOF
101
+ }
102
+
103
+ # Function: Unregister session (called on exit)
104
+ unregister_session() {
105
+ rm -f "$SESSION_FILE"
106
+ }
107
+
108
+ # Function: Create worktree for parallel work
109
+ create_worktree() {
110
+ local branch_name=$1
111
+ local worktree_path="../$(basename $(pwd))-$branch_name"
112
+
113
+ echo -e "${BLUE}Creating worktree at $worktree_path...${RESET}"
114
+
115
+ # Create branch if it doesn't exist
116
+ if ! git show-ref --verify --quiet "refs/heads/$branch_name"; then
117
+ git branch "$branch_name"
118
+ fi
119
+
120
+ # Create worktree
121
+ git worktree add "$worktree_path" "$branch_name" 2>/dev/null || {
122
+ echo -e "${RED}Failed to create worktree${RESET}"
123
+ return 1
124
+ }
125
+
126
+ echo -e "${GREEN}✓ Worktree created: $worktree_path${RESET}"
127
+ echo -e "${CYAN}Run: cd $worktree_path && claude${RESET}"
128
+
129
+ echo "$worktree_path"
130
+ }
131
+
132
+ # Function: Display session status
133
+ show_session_status() {
134
+ local active_sessions=($(get_active_sessions))
135
+ local count=${#active_sessions[@]}
136
+
137
+ if [[ $count -eq 0 ]]; then
138
+ echo -e "${GREEN}✓ No other active sessions${RESET}"
139
+ return 0
140
+ fi
141
+
142
+ echo -e "${YELLOW}⚠ $count other session(s) active:${RESET}"
143
+ echo ""
144
+
145
+ for session in "${active_sessions[@]}"; do
146
+ IFS=':' read -r pid branch worktree story <<< "$session"
147
+ echo -e " ${DIM}PID${RESET} $pid"
148
+ echo -e " ${DIM}Branch${RESET} $branch"
149
+ [[ -n "$story" ]] && echo -e " ${DIM}Story${RESET} $story"
150
+ echo -e " ${DIM}Path${RESET} $worktree"
151
+ echo ""
152
+ done
153
+
154
+ return 1
155
+ }
156
+
157
+ # Function: Suggest worktree with command
158
+ suggest_worktree() {
159
+ local suggested_branch="session-$(date +%Y%m%d-%H%M%S)"
160
+
161
+ echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
162
+ echo -e "${YELLOW}To work in parallel without conflicts:${RESET}"
163
+ echo ""
164
+ echo -e " ${GREEN}Option 1: Create isolated worktree (recommended)${RESET}"
165
+ echo -e " ${DIM}git worktree add ../${PWD##*/}-parallel $suggested_branch${RESET}"
166
+ echo -e " ${DIM}cd ../${PWD##*/}-parallel && claude${RESET}"
167
+ echo ""
168
+ echo -e " ${GREEN}Option 2: Work on different branch${RESET}"
169
+ echo -e " ${DIM}git checkout -b $suggested_branch${RESET}"
170
+ echo ""
171
+ echo -e " ${GREEN}Option 3: Continue anyway (risk conflicts)${RESET}"
172
+ echo -e " ${DIM}Touch different files than other session${RESET}"
173
+ echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
174
+ }
175
+
176
+ # Main execution
177
+ main() {
178
+ local mode="${1:-check}"
179
+
180
+ case "$mode" in
181
+ "check")
182
+ # Clean up stale sessions first
183
+ cleanup_stale_sessions
184
+
185
+ # Check for active sessions
186
+ if show_session_status; then
187
+ # No conflicts - register and continue
188
+ register_session
189
+ trap unregister_session EXIT
190
+ else
191
+ # Conflicts detected - show options
192
+ suggest_worktree
193
+
194
+ # Still register (user may proceed anyway)
195
+ register_session
196
+ trap unregister_session EXIT
197
+ fi
198
+ ;;
199
+
200
+ "register")
201
+ register_session
202
+ echo -e "${GREEN}✓ Session registered${RESET}"
203
+ ;;
204
+
205
+ "unregister")
206
+ unregister_session
207
+ echo -e "${GREEN}✓ Session unregistered${RESET}"
208
+ ;;
209
+
210
+ "status")
211
+ cleanup_stale_sessions
212
+ show_session_status
213
+ ;;
214
+
215
+ "worktree")
216
+ local branch="${2:-session-$(date +%Y%m%d-%H%M%S)}"
217
+ create_worktree "$branch"
218
+ ;;
219
+
220
+ "cleanup")
221
+ cleanup_stale_sessions
222
+ echo -e "${GREEN}✓ Stale sessions cleaned${RESET}"
223
+ ;;
224
+
225
+ *)
226
+ echo "Usage: session-coordinator.sh [check|register|unregister|status|worktree|cleanup]"
227
+ exit 1
228
+ ;;
229
+ esac
230
+ }
231
+
232
+ main "$@"