moflo 4.7.8 โ†’ 4.8.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 (47) hide show
  1. package/bin/hooks.mjs +23 -20
  2. package/bin/session-start-launcher.mjs +88 -3
  3. package/package.json +1 -1
  4. package/src/@claude-flow/cli/dist/src/commands/daemon.js +42 -95
  5. package/src/@claude-flow/cli/dist/src/commands/doctor.js +11 -5
  6. package/src/@claude-flow/cli/dist/src/config/moflo-config.d.ts +5 -0
  7. package/src/@claude-flow/cli/dist/src/config/moflo-config.js +16 -0
  8. package/src/@claude-flow/cli/dist/src/init/executor.js +74 -0
  9. package/src/@claude-flow/cli/dist/src/services/daemon-lock.d.ts +39 -0
  10. package/src/@claude-flow/cli/dist/src/services/daemon-lock.js +213 -0
  11. package/src/@claude-flow/cli/package.json +1 -1
  12. package/.claude/helpers/README.md +0 -97
  13. package/.claude/helpers/adr-compliance.sh +0 -186
  14. package/.claude/helpers/aggressive-microcompact.mjs +0 -36
  15. package/.claude/helpers/auto-commit.sh +0 -178
  16. package/.claude/helpers/checkpoint-manager.sh +0 -251
  17. package/.claude/helpers/context-persistence-hook.mjs +0 -1979
  18. package/.claude/helpers/daemon-manager.sh +0 -252
  19. package/.claude/helpers/ddd-tracker.sh +0 -144
  20. package/.claude/helpers/github-safe.js +0 -106
  21. package/.claude/helpers/github-setup.sh +0 -28
  22. package/.claude/helpers/guidance-hook.sh +0 -13
  23. package/.claude/helpers/guidance-hooks.sh +0 -102
  24. package/.claude/helpers/health-monitor.sh +0 -108
  25. package/.claude/helpers/learning-hooks.sh +0 -329
  26. package/.claude/helpers/learning-optimizer.sh +0 -127
  27. package/.claude/helpers/learning-service.mjs +0 -1211
  28. package/.claude/helpers/memory.cjs +0 -84
  29. package/.claude/helpers/metrics-db.mjs +0 -492
  30. package/.claude/helpers/patch-aggressive-prune.mjs +0 -184
  31. package/.claude/helpers/pattern-consolidator.sh +0 -86
  32. package/.claude/helpers/perf-worker.sh +0 -160
  33. package/.claude/helpers/quick-start.sh +0 -19
  34. package/.claude/helpers/router.cjs +0 -62
  35. package/.claude/helpers/security-scanner.sh +0 -127
  36. package/.claude/helpers/session.cjs +0 -125
  37. package/.claude/helpers/setup-mcp.sh +0 -18
  38. package/.claude/helpers/standard-checkpoint-hooks.sh +0 -189
  39. package/.claude/helpers/swarm-comms.sh +0 -353
  40. package/.claude/helpers/swarm-hooks.sh +0 -761
  41. package/.claude/helpers/swarm-monitor.sh +0 -211
  42. package/.claude/helpers/sync-v3-metrics.sh +0 -245
  43. package/.claude/helpers/update-v3-progress.sh +0 -166
  44. package/.claude/helpers/v3-quick-status.sh +0 -58
  45. package/.claude/helpers/v3.sh +0 -111
  46. package/.claude/helpers/validate-v3-config.sh +0 -216
  47. package/.claude/helpers/worker-manager.sh +0 -170
@@ -1,178 +0,0 @@
1
- #!/bin/bash
2
- # Auto-commit helper for Claude Code hooks
3
- # Handles git add, commit, and push in a robust way
4
-
5
- set -e
6
-
7
- # Colors
8
- GREEN='\033[0;32m'
9
- YELLOW='\033[1;33m'
10
- RED='\033[0;31m'
11
- NC='\033[0m'
12
-
13
- # Configuration
14
- MIN_CHANGES=${MIN_CHANGES:-1}
15
- COMMIT_PREFIX=${COMMIT_PREFIX:-"checkpoint"}
16
- AUTO_PUSH=${AUTO_PUSH:-true}
17
-
18
- log() {
19
- echo -e "${GREEN}[auto-commit]${NC} $1"
20
- }
21
-
22
- warn() {
23
- echo -e "${YELLOW}[auto-commit]${NC} $1"
24
- }
25
-
26
- error() {
27
- echo -e "${RED}[auto-commit]${NC} $1"
28
- }
29
-
30
- # Check if there are changes to commit
31
- has_changes() {
32
- ! git diff --quiet HEAD 2>/dev/null || ! git diff --cached --quiet 2>/dev/null || [ -n "$(git ls-files --others --exclude-standard)" ]
33
- }
34
-
35
- # Count changes
36
- count_changes() {
37
- local staged=$(git diff --cached --numstat | wc -l)
38
- local unstaged=$(git diff --numstat | wc -l)
39
- local untracked=$(git ls-files --others --exclude-standard | wc -l)
40
- echo $((staged + unstaged + untracked))
41
- }
42
-
43
- # Main auto-commit function
44
- auto_commit() {
45
- local message="$1"
46
- local file="$2" # Optional specific file
47
-
48
- # Check if in a git repo
49
- if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
50
- error "Not in a git repository"
51
- return 1
52
- fi
53
-
54
- # Check for changes
55
- if ! has_changes; then
56
- log "No changes to commit"
57
- return 0
58
- fi
59
-
60
- local change_count=$(count_changes)
61
- if [ "$change_count" -lt "$MIN_CHANGES" ]; then
62
- log "Only $change_count change(s), skipping (min: $MIN_CHANGES)"
63
- return 0
64
- fi
65
-
66
- # Stage changes
67
- if [ -n "$file" ] && [ -f "$file" ]; then
68
- git add "$file"
69
- log "Staged: $file"
70
- else
71
- git add -A
72
- log "Staged all changes ($change_count files)"
73
- fi
74
-
75
- # Create commit message
76
- local branch=$(git branch --show-current)
77
- local timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)
78
-
79
- if [ -z "$message" ]; then
80
- message="$COMMIT_PREFIX: Auto-commit from Claude Code"
81
- fi
82
-
83
- # Commit
84
- if git commit -m "$message
85
-
86
- Automatic checkpoint created by Claude Code
87
- - Branch: $branch
88
- - Timestamp: $timestamp
89
- - Changes: $change_count file(s)
90
-
91
- ๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code)
92
-
93
- Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>" --quiet 2>/dev/null; then
94
- log "Created commit: $message"
95
-
96
- # Push if enabled
97
- if [ "$AUTO_PUSH" = "true" ]; then
98
- if git push origin "$branch" --quiet 2>/dev/null; then
99
- log "Pushed to origin/$branch"
100
- else
101
- warn "Push failed (will retry later)"
102
- fi
103
- fi
104
-
105
- return 0
106
- else
107
- warn "Commit failed (possibly nothing to commit)"
108
- return 1
109
- fi
110
- }
111
-
112
- # Batch commit (commits all changes together)
113
- batch_commit() {
114
- local message="${1:-Batch checkpoint}"
115
- auto_commit "$message"
116
- }
117
-
118
- # Single file commit
119
- file_commit() {
120
- local file="$1"
121
- local message="${2:-Checkpoint: $file}"
122
-
123
- if [ -z "$file" ]; then
124
- error "No file specified"
125
- return 1
126
- fi
127
-
128
- if [ ! -f "$file" ]; then
129
- error "File not found: $file"
130
- return 1
131
- fi
132
-
133
- auto_commit "$message" "$file"
134
- }
135
-
136
- # Push only (no commit)
137
- push_only() {
138
- local branch=$(git branch --show-current)
139
-
140
- if git push origin "$branch" 2>/dev/null; then
141
- log "Pushed to origin/$branch"
142
- else
143
- warn "Push failed"
144
- return 1
145
- fi
146
- }
147
-
148
- # Entry point
149
- case "${1:-batch}" in
150
- batch)
151
- batch_commit "$2"
152
- ;;
153
- file)
154
- file_commit "$2" "$3"
155
- ;;
156
- push)
157
- push_only
158
- ;;
159
- check)
160
- if has_changes; then
161
- echo "Changes detected: $(count_changes) files"
162
- exit 0
163
- else
164
- echo "No changes"
165
- exit 1
166
- fi
167
- ;;
168
- *)
169
- echo "Usage: $0 {batch|file|push|check} [args]"
170
- echo ""
171
- echo "Commands:"
172
- echo " batch [message] Commit all changes with optional message"
173
- echo " file <path> [msg] Commit specific file"
174
- echo " push Push without committing"
175
- echo " check Check if there are uncommitted changes"
176
- exit 1
177
- ;;
178
- esac
@@ -1,251 +0,0 @@
1
- #!/bin/bash
2
- # Claude Checkpoint Manager
3
- # Provides easy rollback and management of Claude Code checkpoints
4
-
5
- set -e
6
-
7
- # Colors
8
- RED='\033[0;31m'
9
- GREEN='\033[0;32m'
10
- YELLOW='\033[1;33m'
11
- BLUE='\033[0;34m'
12
- NC='\033[0m' # No Color
13
-
14
- # Configuration
15
- CHECKPOINT_DIR=".claude/checkpoints"
16
- BACKUP_DIR=".claude/backups"
17
-
18
- # Help function
19
- show_help() {
20
- cat << EOF
21
- Claude Checkpoint Manager
22
- ========================
23
-
24
- Usage: $0 <command> [options]
25
-
26
- Commands:
27
- list List all checkpoints
28
- show <id> Show details of a specific checkpoint
29
- rollback <id> Rollback to a specific checkpoint
30
- diff <id> Show diff since checkpoint
31
- clean Clean old checkpoints (older than 7 days)
32
- summary Show session summary
33
-
34
- Options:
35
- --hard For rollback: use git reset --hard (destructive)
36
- --soft For rollback: use git reset --soft (default)
37
- --branch For rollback: create new branch from checkpoint
38
-
39
- Examples:
40
- $0 list
41
- $0 show checkpoint-20240130-143022
42
- $0 rollback checkpoint-20240130-143022 --branch
43
- $0 diff session-end-session-20240130-150000
44
- EOF
45
- }
46
-
47
- # List all checkpoints
48
- function list_checkpoints() {
49
- echo -e "${BLUE}๐Ÿ“‹ Available Checkpoints:${NC}"
50
- echo ""
51
-
52
- # List checkpoint tags
53
- echo -e "${YELLOW}Git Tags:${NC}"
54
- local tags=$(git tag -l 'checkpoint-*' -l 'session-end-*' -l 'task-*' --sort=-creatordate | head -20)
55
- if [ -n "$tags" ]; then
56
- echo "$tags"
57
- else
58
- echo "No checkpoint tags found"
59
- fi
60
-
61
- echo ""
62
-
63
- # List checkpoint branches
64
- echo -e "${YELLOW}Checkpoint Branches:${NC}"
65
- local branches=$(git branch -a | grep "checkpoint/" | sed 's/^[ *]*//')
66
- if [ -n "$branches" ]; then
67
- echo "$branches"
68
- else
69
- echo "No checkpoint branches found"
70
- fi
71
-
72
- echo ""
73
-
74
- # List checkpoint files
75
- if [ -d "$CHECKPOINT_DIR" ]; then
76
- echo -e "${YELLOW}Recent Checkpoint Files:${NC}"
77
- find "$CHECKPOINT_DIR" -name "*.json" -type f -printf "%T@ %p\n" | \
78
- sort -rn | head -10 | cut -d' ' -f2- | xargs -I {} basename {}
79
- fi
80
- }
81
-
82
- # Show checkpoint details
83
- function show_checkpoint() {
84
- local checkpoint_id="$1"
85
-
86
- echo -e "${BLUE}๐Ÿ“ Checkpoint Details: $checkpoint_id${NC}"
87
- echo ""
88
-
89
- # Check if it's a tag
90
- if git tag -l "$checkpoint_id" | grep -q "$checkpoint_id"; then
91
- echo -e "${YELLOW}Type:${NC} Git Tag"
92
- echo -e "${YELLOW}Commit:${NC} $(git rev-list -n 1 "$checkpoint_id")"
93
- echo -e "${YELLOW}Date:${NC} $(git log -1 --format=%ai "$checkpoint_id")"
94
- echo -e "${YELLOW}Message:${NC}"
95
- git log -1 --format=%B "$checkpoint_id" | sed 's/^/ /'
96
- echo ""
97
- echo -e "${YELLOW}Files changed:${NC}"
98
- git diff-tree --no-commit-id --name-status -r "$checkpoint_id" | sed 's/^/ /'
99
- # Check if it's a branch
100
- elif git branch -a | grep -q "$checkpoint_id"; then
101
- echo -e "${YELLOW}Type:${NC} Git Branch"
102
- echo -e "${YELLOW}Latest commit:${NC}"
103
- git log -1 --oneline "$checkpoint_id"
104
- else
105
- echo -e "${RED}โŒ Checkpoint not found: $checkpoint_id${NC}"
106
- exit 1
107
- fi
108
- }
109
-
110
- # Rollback to checkpoint
111
- function rollback_checkpoint() {
112
- local checkpoint_id="$1"
113
- local mode="$2"
114
-
115
- echo -e "${YELLOW}๐Ÿ”„ Rolling back to checkpoint: $checkpoint_id${NC}"
116
- echo ""
117
-
118
- # Verify checkpoint exists
119
- if ! git tag -l "$checkpoint_id" | grep -q "$checkpoint_id" && \
120
- ! git branch -a | grep -q "$checkpoint_id"; then
121
- echo -e "${RED}โŒ Checkpoint not found: $checkpoint_id${NC}"
122
- exit 1
123
- fi
124
-
125
- # Create backup before rollback
126
- local backup_name="backup-$(date +%Y%m%d-%H%M%S)"
127
- echo "Creating backup: $backup_name"
128
- git tag "$backup_name" -m "Backup before rollback to $checkpoint_id"
129
-
130
- case "$mode" in
131
- "--hard")
132
- echo -e "${RED}โš ๏ธ Performing hard reset (destructive)${NC}"
133
- git reset --hard "$checkpoint_id"
134
- echo -e "${GREEN}โœ… Rolled back to $checkpoint_id (hard reset)${NC}"
135
- ;;
136
- "--branch")
137
- local branch_name="rollback-$checkpoint_id-$(date +%Y%m%d-%H%M%S)"
138
- echo "Creating new branch: $branch_name"
139
- git checkout -b "$branch_name" "$checkpoint_id"
140
- echo -e "${GREEN}โœ… Created branch $branch_name from $checkpoint_id${NC}"
141
- ;;
142
- "--stash"|*)
143
- echo "Stashing current changes..."
144
- git stash push -m "Stash before rollback to $checkpoint_id"
145
- git reset --soft "$checkpoint_id"
146
- echo -e "${GREEN}โœ… Rolled back to $checkpoint_id (soft reset)${NC}"
147
- echo "Your changes are stashed. Use 'git stash pop' to restore them."
148
- ;;
149
- esac
150
- }
151
-
152
- # Show diff since checkpoint
153
- function diff_checkpoint() {
154
- local checkpoint_id="$1"
155
-
156
- echo -e "${BLUE}๐Ÿ“Š Changes since checkpoint: $checkpoint_id${NC}"
157
- echo ""
158
-
159
- if git tag -l "$checkpoint_id" | grep -q "$checkpoint_id"; then
160
- git diff "$checkpoint_id"
161
- elif git branch -a | grep -q "$checkpoint_id"; then
162
- git diff "$checkpoint_id"
163
- else
164
- echo -e "${RED}โŒ Checkpoint not found: $checkpoint_id${NC}"
165
- exit 1
166
- fi
167
- }
168
-
169
- # Clean old checkpoints
170
- function clean_checkpoints() {
171
- local days=${1:-7}
172
-
173
- echo -e "${YELLOW}๐Ÿงน Cleaning checkpoints older than $days days...${NC}"
174
- echo ""
175
-
176
- # Clean old checkpoint files
177
- if [ -d "$CHECKPOINT_DIR" ]; then
178
- find "$CHECKPOINT_DIR" -name "*.json" -type f -mtime +$days -delete
179
- echo "โœ… Cleaned old checkpoint files"
180
- fi
181
-
182
- # List old tags (but don't delete automatically)
183
- echo ""
184
- echo "Old checkpoint tags (manual deletion required):"
185
- git tag -l 'checkpoint-*' --sort=-creatordate | tail -n +50 || echo "No old tags found"
186
- }
187
-
188
- # Show session summary
189
- function show_summary() {
190
- echo -e "${BLUE}๐Ÿ“Š Session Summary${NC}"
191
- echo ""
192
-
193
- # Find most recent session summary
194
- if [ -d "$CHECKPOINT_DIR" ]; then
195
- local latest_summary=$(find "$CHECKPOINT_DIR" -name "summary-*.md" -type f -printf "%T@ %p\n" | \
196
- sort -rn | head -1 | cut -d' ' -f2-)
197
-
198
- if [ -n "$latest_summary" ]; then
199
- echo -e "${YELLOW}Latest session summary:${NC}"
200
- cat "$latest_summary"
201
- else
202
- echo "No session summaries found"
203
- fi
204
- fi
205
- }
206
-
207
- # Main command handling
208
- case "$1" in
209
- list)
210
- list_checkpoints
211
- ;;
212
- show)
213
- if [ -z "$2" ]; then
214
- echo -e "${RED}Error: Please specify a checkpoint ID${NC}"
215
- show_help
216
- exit 1
217
- fi
218
- show_checkpoint "$2"
219
- ;;
220
- rollback)
221
- if [ -z "$2" ]; then
222
- echo -e "${RED}Error: Please specify a checkpoint ID${NC}"
223
- show_help
224
- exit 1
225
- fi
226
- rollback_checkpoint "$2" "$3"
227
- ;;
228
- diff)
229
- if [ -z "$2" ]; then
230
- echo -e "${RED}Error: Please specify a checkpoint ID${NC}"
231
- show_help
232
- exit 1
233
- fi
234
- diff_checkpoint "$2"
235
- ;;
236
- clean)
237
- clean_checkpoints "$2"
238
- ;;
239
- summary)
240
- show_summary
241
- ;;
242
- help|--help|-h)
243
- show_help
244
- ;;
245
- *)
246
- echo -e "${RED}Error: Unknown command: $1${NC}"
247
- echo ""
248
- show_help
249
- exit 1
250
- ;;
251
- esac