agentic-qe 1.4.0 β†’ 1.4.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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,63 @@ All notable changes to the Agentic QE project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.4.1] - 2025-10-31
9
+
10
+ ### 🚨 CRITICAL FIX - Emergency Patch Release
11
+
12
+ This is an emergency patch release to fix a critical bug in v1.4.0 that prevented **all QE agents from spawning**.
13
+
14
+ ### Fixed
15
+
16
+ - **[CRITICAL]** Fixed duplicate MCP tool names error preventing all QE agents from spawning
17
+ - **Root Cause**: package.json contained self-dependency `"agentic-qe": "^1.3.3"` causing duplicate tool registration
18
+ - **Impact**: ALL 18 QE agents failed with `API Error 400: tools: Tool names must be unique`
19
+ - **Fix 1**: Removed self-dependency from package.json dependencies
20
+ - **Fix 2**: Updated package.json "files" array to explicitly include only `.claude/agents`, `.claude/skills`, `.claude/commands`
21
+ - **Fix 3**: Added `.claude/settings*.json` to .npmignore to prevent shipping development configuration
22
+ - Fixed package bundling to exclude development configuration files
23
+
24
+ ### Impact Assessment
25
+
26
+ - **Affected Users**: All users who installed v1.4.0 from npm
27
+ - **Severity**: CRITICAL - All agent spawning was broken in v1.4.0
28
+ - **Workaround**: Upgrade to v1.4.1 immediately: `npm install agentic-qe@latest`
29
+
30
+ ### Upgrade Instructions
31
+
32
+ ```bash
33
+ # If you installed v1.4.0, upgrade immediately:
34
+ npm install agentic-qe@latest
35
+
36
+ # Verify the fix:
37
+ aqe --version # Should show 1.4.1
38
+
39
+ # Test agent spawning (should now work):
40
+ # In Claude Code: Task("Test", "Generate a simple test", "qe-test-generator")
41
+ ```
42
+
43
+ ---
44
+
45
+ ## [1.4.0] - 2025-10-26
46
+
47
+ ### 🎯 Agent Memory & Learning Infrastructure Complete
48
+
49
+ Phase 2 development complete with agent memory, learning systems, and pattern reuse.
50
+
51
+ ### Added
52
+
53
+ - **Agent Memory Infrastructure**: AgentDB integration with SwarmMemoryManager
54
+ - **Learning System**: Q-learning with 9 RL algorithms for continuous improvement
55
+ - **Pattern Bank**: Reusable test patterns with vector search
56
+ - **Force Flag**: `aqe init --force` to reinitialize projects
57
+
58
+ ### Known Issues
59
+
60
+ - **v1.4.0 BROKEN**: All agents fail to spawn due to duplicate MCP tool names
61
+ - **Fixed in v1.4.1**: Upgrade immediately if you installed v1.4.0
62
+
63
+ ---
64
+
8
65
  ## [1.3.7] - 2025-10-30
9
66
 
10
67
  ### πŸ“š Documentation Updates
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue.svg)](https://www.typescriptlang.org/)
8
8
  [![Node.js](https://img.shields.io/badge/Node.js-20+-green.svg)](https://nodejs.org/)
9
9
 
10
- **Version 1.4.0** | [Changelog](CHANGELOG.md) | [Issues](https://github.com/proffesor-for-testing/agentic-qe/issues) | [Discussions](https://github.com/proffesor-for-testing/agentic-qe/discussions)
10
+ **Version 1.4.1** | [Changelog](CHANGELOG.md) | [Issues](https://github.com/proffesor-for-testing/agentic-qe/issues) | [Discussions](https://github.com/proffesor-for-testing/agentic-qe/discussions)
11
11
 
12
12
  > Enterprise-grade test automation with AI learning, comprehensive skills library (34 QE skills), and 85.7% cost savings through intelligent model routing.
13
13
 
@@ -506,8 +506,22 @@ Model Usage:
506
506
 
507
507
  ## πŸ“ Recent Changes
508
508
 
509
- ### v1.4.0 (2025-10-31)
510
- **Agent Memory & Learning Infrastructure Complete**
509
+ ### v1.4.1 (2025-10-31)
510
+ **🚨 CRITICAL FIX - Emergency Patch Release**
511
+
512
+ - πŸ”΄ **CRITICAL**: Fixed duplicate MCP tool names preventing all QE agents from spawning
513
+ - Root Cause: package.json self-dependency `"agentic-qe": "^1.3.3"`
514
+ - Impact: ALL 18 agents failed with API Error 400 in v1.4.0
515
+ - Fixed: Removed self-dependency, updated package bundling
516
+ - βœ… Agents now spawn correctly via Claude Code Task tool
517
+ - βœ… Package no longer includes development configuration files
518
+
519
+ **If you installed v1.4.0, upgrade immediately**: `npm install agentic-qe@latest`
520
+
521
+ ---
522
+
523
+ ### v1.4.0 (2025-10-31) ⚠️ BROKEN - DO NOT USE
524
+ **Agent Memory & Learning Infrastructure Complete** (but all agents fail to spawn)
511
525
 
512
526
  - βœ… **Fixed 11 agents with lifecycle hooks** - Proper memoryStore API usage (retrieve/store signatures)
513
527
  - βœ… **Comprehensive learning validation** - All 16 agents inherit BaseAgent learning (89% coverage)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-qe",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Agentic Quality Engineering Fleet System - AI-driven quality management platform with 34 QE skills, learning, pattern reuse, ML-based flaky detection, Multi-Model Router (70-81% cost savings), streaming progress updates, 54 MCP tools, and native TypeScript hooks",
5
5
  "main": "dist/cli/index.js",
6
6
  "types": "dist/cli/index.d.ts",
@@ -116,7 +116,6 @@
116
116
  "@xenova/transformers": "^2.6.0",
117
117
  "agentdb": "^1.0.0",
118
118
  "agentic-flow": "^1.7.3",
119
- "agentic-qe": "^1.3.3",
120
119
  "ajv": "^8.17.1",
121
120
  "ajv-formats": "^3.0.1",
122
121
  "better-sqlite3": "^12.4.1",
@@ -191,7 +190,9 @@
191
190
  "files": [
192
191
  "dist",
193
192
  "bin",
194
- ".claude",
193
+ ".claude/agents",
194
+ ".claude/skills",
195
+ ".claude/commands",
195
196
  "config",
196
197
  "LICENSE",
197
198
  "README.md",
@@ -1,47 +0,0 @@
1
- {
2
- "fleetId": "aqe-fleet-1759773240987",
3
- "version": "2.0.0",
4
- "topology": "hierarchical",
5
- "maxAgents": 6,
6
- "agents": [
7
- "qe-test-generator",
8
- "qe-test-executor",
9
- "qe-coverage-analyzer",
10
- "qe-quality-gate",
11
- "qe-performance-tester",
12
- "qe-security-scanner",
13
- "qe-fleet-commander",
14
- "qe-chaos-engineer",
15
- "qe-visual-tester",
16
- "qe-requirements-validator",
17
- "qe-deployment-readiness",
18
- "qe-production-intelligence",
19
- "qe-regression-risk-analyzer",
20
- "qe-test-data-architect",
21
- "qe-api-contract-validator",
22
- "qe-flaky-test-hunter"
23
- ],
24
- "created": "2025-10-06T17:54:00.987Z",
25
- "status": "active",
26
- "configuration": {
27
- "coordination": {
28
- "memoryNamespace": "aqe",
29
- "hooksEnabled": true,
30
- "neuralLearning": true
31
- },
32
- "testing": {
33
- "defaultFramework": "jest",
34
- "coverageThreshold": 95,
35
- "parallelWorkers": "auto"
36
- },
37
- "optimization": {
38
- "algorithm": "sublinear",
39
- "targetCoveragePerTest": "maximize"
40
- }
41
- },
42
- "metadata": {
43
- "packageVersion": "2.0.0",
44
- "claudeFlowVersion": "alpha",
45
- "initDate": "2025-10-06T17:54:00.987Z"
46
- }
47
- }
@@ -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
@@ -1,106 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Safe GitHub CLI Helper
5
- * Prevents timeout issues when using gh commands with special characters
6
- *
7
- * Usage:
8
- * ./github-safe.js issue comment 123 "Message with `backticks`"
9
- * ./github-safe.js pr create --title "Title" --body "Complex body"
10
- */
11
-
12
- import { execSync } from 'child_process';
13
- import { writeFileSync, unlinkSync } from 'fs';
14
- import { tmpdir } from 'os';
15
- import { join } from 'path';
16
- import { randomBytes } from 'crypto';
17
-
18
- const args = process.argv.slice(2);
19
-
20
- if (args.length < 2) {
21
- console.log(`
22
- Safe GitHub CLI Helper
23
-
24
- Usage:
25
- ./github-safe.js issue comment <number> <body>
26
- ./github-safe.js pr comment <number> <body>
27
- ./github-safe.js issue create --title <title> --body <body>
28
- ./github-safe.js pr create --title <title> --body <body>
29
-
30
- This helper prevents timeout issues with special characters like:
31
- - Backticks in code examples
32
- - Command substitution \$(...)
33
- - Directory paths
34
- - Special shell characters
35
- `);
36
- process.exit(1);
37
- }
38
-
39
- const [command, subcommand, ...restArgs] = args;
40
-
41
- // Handle commands that need body content
42
- if ((command === 'issue' || command === 'pr') &&
43
- (subcommand === 'comment' || subcommand === 'create')) {
44
-
45
- let bodyIndex = -1;
46
- let body = '';
47
-
48
- if (subcommand === 'comment' && restArgs.length >= 2) {
49
- // Simple format: github-safe.js issue comment 123 "body"
50
- body = restArgs[1];
51
- bodyIndex = 1;
52
- } else {
53
- // Flag format: --body "content"
54
- bodyIndex = restArgs.indexOf('--body');
55
- if (bodyIndex !== -1 && bodyIndex < restArgs.length - 1) {
56
- body = restArgs[bodyIndex + 1];
57
- }
58
- }
59
-
60
- if (body) {
61
- // Use temporary file for body content
62
- const tmpFile = join(tmpdir(), `gh-body-${randomBytes(8).toString('hex')}.tmp`);
63
-
64
- try {
65
- writeFileSync(tmpFile, body, 'utf8');
66
-
67
- // Build new command with --body-file
68
- const newArgs = [...restArgs];
69
- if (subcommand === 'comment' && bodyIndex === 1) {
70
- // Replace body with --body-file
71
- newArgs[1] = '--body-file';
72
- newArgs.push(tmpFile);
73
- } else if (bodyIndex !== -1) {
74
- // Replace --body with --body-file
75
- newArgs[bodyIndex] = '--body-file';
76
- newArgs[bodyIndex + 1] = tmpFile;
77
- }
78
-
79
- // Execute safely
80
- const ghCommand = `gh ${command} ${subcommand} ${newArgs.join(' ')}`;
81
- console.log(`Executing: ${ghCommand}`);
82
-
83
- const result = execSync(ghCommand, {
84
- stdio: 'inherit',
85
- timeout: 30000 // 30 second timeout
86
- });
87
-
88
- } catch (error) {
89
- console.error('Error:', error.message);
90
- process.exit(1);
91
- } finally {
92
- // Clean up
93
- try {
94
- unlinkSync(tmpFile);
95
- } catch (e) {
96
- // Ignore cleanup errors
97
- }
98
- }
99
- } else {
100
- // No body content, execute normally
101
- execSync(`gh ${args.join(' ')}`, { stdio: 'inherit' });
102
- }
103
- } else {
104
- // Other commands, execute normally
105
- execSync(`gh ${args.join(' ')}`, { stdio: 'inherit' });
106
- }
@@ -1,28 +0,0 @@
1
- #!/bin/bash
2
- # Setup GitHub integration for Claude Flow
3
-
4
- echo "πŸ”— Setting up GitHub integration..."
5
-
6
- # Check for gh CLI
7
- if ! command -v gh &> /dev/null; then
8
- echo "⚠️ GitHub CLI (gh) not found"
9
- echo "Install from: https://cli.github.com/"
10
- echo "Continuing without GitHub features..."
11
- else
12
- echo "βœ… GitHub CLI found"
13
-
14
- # Check auth status
15
- if gh auth status &> /dev/null; then
16
- echo "βœ… GitHub authentication active"
17
- else
18
- echo "⚠️ Not authenticated with GitHub"
19
- echo "Run: gh auth login"
20
- fi
21
- fi
22
-
23
- echo ""
24
- echo "πŸ“¦ GitHub swarm commands available:"
25
- echo " - npx claude-flow github swarm"
26
- echo " - npx claude-flow repo analyze"
27
- echo " - npx claude-flow pr enhance"
28
- echo " - npx claude-flow issue triage"
@@ -1,19 +0,0 @@
1
- #!/bin/bash
2
- # Quick start guide for Claude Flow
3
-
4
- echo "πŸš€ Claude Flow Quick Start"
5
- echo "=========================="
6
- echo ""
7
- echo "1. Initialize a swarm:"
8
- echo " npx claude-flow swarm init --topology hierarchical"
9
- echo ""
10
- echo "2. Spawn agents:"
11
- echo " npx claude-flow agent spawn --type coder --name "API Developer""
12
- echo ""
13
- echo "3. Orchestrate tasks:"
14
- echo " npx claude-flow task orchestrate --task "Build REST API""
15
- echo ""
16
- echo "4. Monitor progress:"
17
- echo " npx claude-flow swarm monitor"
18
- echo ""
19
- echo "πŸ“š For more examples, see .claude/commands/"
@@ -1,18 +0,0 @@
1
- #!/bin/bash
2
- # Setup MCP server for Claude Flow
3
-
4
- echo "πŸš€ Setting up Claude Flow MCP server..."
5
-
6
- # Check if claude command exists
7
- if ! command -v claude &> /dev/null; then
8
- echo "❌ Error: Claude Code CLI not found"
9
- echo "Please install Claude Code first"
10
- exit 1
11
- fi
12
-
13
- # Add MCP server
14
- echo "πŸ“¦ Adding Claude Flow MCP server..."
15
- claude mcp add claude-flow npx claude-flow mcp start
16
-
17
- echo "βœ… MCP server setup complete!"
18
- echo "🎯 You can now use mcp__claude-flow__ tools in Claude Code"
@@ -1,179 +0,0 @@
1
- #!/bin/bash
2
- # Standard checkpoint hook functions for Claude settings.json (without GitHub features)
3
-
4
- # Function to handle pre-edit checkpoints
5
- pre_edit_checkpoint() {
6
- local tool_input="$1"
7
- local file=$(echo "$tool_input" | jq -r '.file_path // empty')
8
-
9
- if [ -n "$file" ]; then
10
- local checkpoint_branch="checkpoint/pre-edit-$(date +%Y%m%d-%H%M%S)"
11
- local current_branch=$(git branch --show-current)
12
-
13
- # Create checkpoint
14
- git add -A
15
- git stash push -m "Pre-edit checkpoint for $file" >/dev/null 2>&1
16
- git branch "$checkpoint_branch"
17
-
18
- # Store metadata
19
- mkdir -p .claude/checkpoints
20
- cat > ".claude/checkpoints/$(date +%s).json" <<EOF
21
- {
22
- "branch": "$checkpoint_branch",
23
- "file": "$file",
24
- "timestamp": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
25
- "type": "pre-edit",
26
- "original_branch": "$current_branch"
27
- }
28
- EOF
29
-
30
- # Restore working directory
31
- git stash pop --quiet >/dev/null 2>&1 || true
32
-
33
- echo "βœ… Created checkpoint: $checkpoint_branch for $file"
34
- fi
35
- }
36
-
37
- # Function to handle post-edit checkpoints
38
- post_edit_checkpoint() {
39
- local tool_input="$1"
40
- local file=$(echo "$tool_input" | jq -r '.file_path // empty')
41
-
42
- if [ -n "$file" ] && [ -f "$file" ]; then
43
- # Check if file was modified - first check if file is tracked
44
- if ! git ls-files --error-unmatch "$file" >/dev/null 2>&1; then
45
- # File is not tracked, add it first
46
- git add "$file"
47
- fi
48
-
49
- # Now check if there are changes
50
- if git diff --cached --quiet "$file" 2>/dev/null && git diff --quiet "$file" 2>/dev/null; then
51
- echo "ℹ️ No changes to checkpoint for $file"
52
- else
53
- local tag_name="checkpoint-$(date +%Y%m%d-%H%M%S)"
54
- local current_branch=$(git branch --show-current)
55
-
56
- # Create commit
57
- git add "$file"
58
- if git commit -m "πŸ”– Checkpoint: Edit $file
59
-
60
- Automatic checkpoint created by Claude
61
- - File: $file
62
- - Branch: $current_branch
63
- - Timestamp: $(date -u +%Y-%m-%dT%H:%M:%SZ)
64
-
65
- [Auto-checkpoint]" --quiet; then
66
- # Create tag only if commit succeeded
67
- git tag -a "$tag_name" -m "Checkpoint after editing $file"
68
-
69
- # Store metadata
70
- mkdir -p .claude/checkpoints
71
- local diff_stats=$(git diff HEAD~1 --stat | tr '\n' ' ' | sed 's/"/\"/g')
72
- cat > ".claude/checkpoints/$(date +%s).json" <<EOF
73
- {
74
- "tag": "$tag_name",
75
- "file": "$file",
76
- "timestamp": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
77
- "type": "post-edit",
78
- "branch": "$current_branch",
79
- "diff_summary": "$diff_stats"
80
- }
81
- EOF
82
-
83
- echo "βœ… Created checkpoint: $tag_name for $file"
84
- else
85
- echo "ℹ️ No commit created (no changes or commit failed)"
86
- fi
87
- fi
88
- fi
89
- }
90
-
91
- # Function to handle task checkpoints
92
- task_checkpoint() {
93
- local user_prompt="$1"
94
- local task=$(echo "$user_prompt" | head -c 100 | tr '\n' ' ')
95
-
96
- if [ -n "$task" ]; then
97
- local checkpoint_name="task-$(date +%Y%m%d-%H%M%S)"
98
-
99
- # Commit current state
100
- git add -A
101
- git commit -m "πŸ”– Task checkpoint: $task..." --quiet || true
102
-
103
- # Store metadata
104
- mkdir -p .claude/checkpoints
105
- cat > ".claude/checkpoints/task-$(date +%s).json" <<EOF
106
- {
107
- "checkpoint": "$checkpoint_name",
108
- "task": "$task",
109
- "timestamp": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
110
- "commit": "$(git rev-parse HEAD)"
111
- }
112
- EOF
113
-
114
- echo "βœ… Created task checkpoint: $checkpoint_name"
115
- fi
116
- }
117
-
118
- # Function to handle session end
119
- session_end_checkpoint() {
120
- local session_id="session-$(date +%Y%m%d-%H%M%S)"
121
- local summary_file=".claude/checkpoints/summary-$session_id.md"
122
-
123
- mkdir -p .claude/checkpoints
124
-
125
- # Create summary
126
- cat > "$summary_file" <<EOF
127
- # Session Summary - $(date +'%Y-%m-%d %H:%M:%S')
128
-
129
- ## Checkpoints Created
130
- $(find .claude/checkpoints -name '*.json' -mtime -1 -exec basename {} \; | sort)
131
-
132
- ## Files Modified
133
- $(git diff --name-only $(git log --format=%H -n 1 --before="1 hour ago" 2>/dev/null) 2>/dev/null || echo "No files tracked")
134
-
135
- ## Recent Commits
136
- $(git log --oneline -10 --grep="Checkpoint" || echo "No checkpoint commits")
137
-
138
- ## Rollback Instructions
139
- To rollback to a specific checkpoint:
140
- \`\`\`bash
141
- # List all checkpoints
142
- git tag -l 'checkpoint-*' | sort -r
143
-
144
- # Rollback to a checkpoint
145
- git checkout checkpoint-YYYYMMDD-HHMMSS
146
-
147
- # Or reset to a checkpoint (destructive)
148
- git reset --hard checkpoint-YYYYMMDD-HHMMSS
149
- \`\`\`
150
- EOF
151
-
152
- # Create final checkpoint
153
- git add -A
154
- git commit -m "🏁 Session end checkpoint: $session_id" --quiet || true
155
- git tag -a "session-end-$session_id" -m "End of Claude session"
156
-
157
- echo "βœ… Session summary saved to: $summary_file"
158
- echo "πŸ“Œ Final checkpoint: session-end-$session_id"
159
- }
160
-
161
- # Main entry point
162
- case "$1" in
163
- pre-edit)
164
- pre_edit_checkpoint "$2"
165
- ;;
166
- post-edit)
167
- post_edit_checkpoint "$2"
168
- ;;
169
- task)
170
- task_checkpoint "$2"
171
- ;;
172
- session-end)
173
- session_end_checkpoint
174
- ;;
175
- *)
176
- echo "Usage: $0 {pre-edit|post-edit|task|session-end} [input]"
177
- exit 1
178
- ;;
179
- esac
@@ -1,153 +0,0 @@
1
-
2
- {
3
- "env": {
4
- "CLAUDE_FLOW_AUTO_COMMIT": "false",
5
- "CLAUDE_FLOW_AUTO_PUSH": "false",
6
- "CLAUDE_FLOW_HOOKS_ENABLED": "true",
7
- "CLAUDE_FLOW_TELEMETRY_ENABLED": "true",
8
- "CLAUDE_FLOW_REMOTE_EXECUTION": "true",
9
- "CLAUDE_FLOW_CHECKPOINTS_ENABLED": "true",
10
- "AGENTDB_LEARNING_ENABLED": "true",
11
- "AGENTDB_REASONING_ENABLED": "true",
12
- "AGENTDB_AUTO_TRAIN": "true"
13
- },
14
- "permissions": {
15
- "allow": [
16
- "Bash(npx claude-flow:*)",
17
- "Bash(npx agentdb:*)",
18
- "Bash(npm run lint)",
19
- "Bash(npm run test:*)",
20
- "Bash(npm test:*)",
21
- "Bash(git status)",
22
- "Bash(git diff:*)",
23
- "Bash(git log:*)",
24
- "Bash(git add:*)",
25
- "Bash(git commit:*)",
26
- "Bash(git push)",
27
- "Bash(git config:*)",
28
- "Bash(git tag:*)",
29
- "Bash(git branch:*)",
30
- "Bash(git checkout:*)",
31
- "Bash(git stash:*)",
32
- "Bash(jq:*)",
33
- "Bash(node:*)",
34
- "Bash(which:*)",
35
- "Bash(pwd)",
36
- "Bash(ls:*)"
37
- ],
38
- "deny": [
39
- "Bash(rm -rf /)"
40
- ]
41
- },
42
- "hooks": {
43
- "PreToolUse": [
44
- {
45
- "matcher": "Bash",
46
- "hooks": [
47
- {
48
- "type": "command",
49
- "command": "cat | jq -r '.tool_input.command // empty' | tr '\\n' '\\0' | xargs -0 -I {} npx claude-flow@alpha hooks pre-command --command '{}' --validate-safety true --prepare-resources true"
50
- }
51
- ]
52
- },
53
- {
54
- "matcher": "Write|Edit|MultiEdit",
55
- "hooks": [
56
- {
57
- "type": "command",
58
- "description": "3. Semantic Search Memory - Query similar successful past edits",
59
- "command": "cat | jq -r '.tool_input.file_path // .tool_input.path // empty' | tr '\\n' '\\0' | xargs -0 -I {} bash -c 'FILE=\"{}\"; echo \"πŸ” Semantic Search: Querying similar successful edits for $FILE...\"; npx agentdb@latest query --domain \"successful-edits\" --query \"file:$FILE\" --k 5 --min-confidence 0.8 --format json 2>/dev/null || echo \"{}\" | jq -r \".memories[]? | \\\"πŸ’‘ Past Success: \\(.pattern.summary // \\\"No similar patterns found\\\")\\\" \" 2>/dev/null; npx claude-flow@alpha hooks pre-edit --file \"$FILE\" --auto-assign-agents true --load-context true'"
60
- },
61
- {
62
- "type": "command",
63
- "description": "5. Failure Pattern Recognition - Warn about known failure patterns",
64
- "command": "cat | jq -r '.tool_input.file_path // .tool_input.path // empty' | tr '\\n' '\\0' | xargs -0 -I {} bash -c 'FILE=\"{}\"; echo \"⚠️ Failure Detection: Checking for known failure patterns...\"; npx agentdb@latest query --domain \"failed-edits\" --query \"file:$FILE\" --k 3 --min-confidence 0.7 --format json 2>/dev/null | jq -r \".memories[]? | \\\"🚨 Warning: Similar edit failed - \\(.pattern.reason // \\\"unknown\\\")\\\" \" 2>/dev/null || true'"
65
- }
66
- ]
67
- },
68
- {
69
- "matcher": "Task",
70
- "hooks": [
71
- {
72
- "type": "command",
73
- "description": "4. Trajectory Prediction - Predict optimal task sequence",
74
- "command": "cat | jq -r '.tool_input.prompt // .tool_input.task // empty' | tr '\\n' '\\0' | xargs -0 -I {} bash -c 'TASK=\"{}\"; echo \"🎯 Trajectory Prediction: Analyzing optimal workflow for task...\"; npx agentdb@latest query --domain \"task-trajectories\" --query \"task:$TASK\" --k 3 --min-confidence 0.75 --format json 2>/dev/null | jq -r \".memories[]? | \\\"πŸ“‹ Predicted Steps: \\(.pattern.trajectory // \\\"No trajectory data\\\") (Success Rate: \\(.confidence // 0))\\\" \" 2>/dev/null || echo \"πŸ“‹ No historical trajectory data - learning from this task...\"; npx claude-flow@alpha hooks pre-task --description \"$TASK\" --auto-spawn-agents true --load-memory true'"
75
- }
76
- ]
77
- }
78
- ],
79
- "PostToolUse": [
80
- {
81
- "matcher": "Bash",
82
- "hooks": [
83
- {
84
- "type": "command",
85
- "command": "cat | jq -r '.tool_input.command // empty' | tr '\\n' '\\0' | xargs -0 -I {} npx claude-flow@alpha hooks post-command --command '{}' --track-metrics true --store-results true"
86
- }
87
- ]
88
- },
89
- {
90
- "matcher": "Write|Edit|MultiEdit",
91
- "hooks": [
92
- {
93
- "type": "command",
94
- "description": "1. Experience Replay Developer - Capture edit as RL experience",
95
- "command": "cat | jq -r '.tool_input.file_path // .tool_input.path // empty' | tr '\\n' '\\0' | xargs -0 -I {} bash -c 'FILE=\"{}\"; echo \"πŸ’Ύ Experience Replay: Storing edit experience for $FILE...\"; TIMESTAMP=$(date +%s); npx agentdb@latest store-pattern --type \"experience\" --domain \"code-edits\" --pattern \"{\\\"file\\\":\\\"$FILE\\\",\\\"timestamp\\\":$TIMESTAMP,\\\"action\\\":\\\"edit\\\",\\\"state\\\":\\\"pre-test\\\"}\" --confidence 0.5 2>/dev/null || true; npx claude-flow@alpha hooks post-edit --file \"$FILE\" --format true --update-memory true --train-patterns true'"
96
- },
97
- {
98
- "type": "command",
99
- "description": "2. Verdict-Based Quality - Async verdict assignment after tests",
100
- "command": "cat | jq -r '.tool_input.file_path // .tool_input.path // empty' | tr '\\n' '\\0' | xargs -0 -I {} bash -c 'FILE=\"{}\"; (sleep 2; TEST_RESULT=$(npm test --silent 2>&1 | grep -q \"pass\" && echo \"ACCEPT\" || echo \"REJECT\"); REWARD=$([ \"$TEST_RESULT\" = \"ACCEPT\" ] && echo \"1.0\" || echo \"-1.0\"); echo \"βš–οΈ Verdict: $TEST_RESULT (reward: $REWARD) for $FILE\"; npx agentdb@latest store-pattern --type \"verdict\" --domain \"code-quality\" --pattern \"{\\\"file\\\":\\\"$FILE\\\",\\\"verdict\\\":\\\"$TEST_RESULT\\\",\\\"reward\\\":$REWARD}\" --confidence $([ \"$TEST_RESULT\" = \"ACCEPT\" ] && echo \"0.95\" || echo \"0.3\") 2>/dev/null; if [ \"$TEST_RESULT\" = \"ACCEPT\" ]; then npx agentdb@latest store-pattern --type \"success\" --domain \"successful-edits\" --pattern \"{\\\"file\\\":\\\"$FILE\\\",\\\"summary\\\":\\\"Edit passed tests\\\"}\" --confidence 0.9 2>/dev/null; else npx agentdb@latest store-pattern --type \"failure\" --domain \"failed-edits\" --pattern \"{\\\"file\\\":\\\"$FILE\\\",\\\"reason\\\":\\\"Tests failed\\\"}\" --confidence 0.8 2>/dev/null; fi) &'"
101
- }
102
- ]
103
- },
104
- {
105
- "matcher": "Task",
106
- "hooks": [
107
- {
108
- "type": "command",
109
- "description": "4. Trajectory Storage - Record task trajectory for learning",
110
- "command": "cat | jq -r '.tool_input.prompt // .tool_input.task // empty, .result.success // \"unknown\"' | tr '\\n' '\\0' | xargs -0 bash -c 'TASK=\"$1\"; SUCCESS=\"$2\"; echo \"πŸ“Š Trajectory Storage: Recording task workflow...\"; CONFIDENCE=$([ \"$SUCCESS\" = \"true\" ] && echo \"0.95\" || echo \"0.5\"); npx agentdb@latest store-pattern --type \"trajectory\" --domain \"task-trajectories\" --pattern \"{\\\"task\\\":\\\"$TASK\\\",\\\"success\\\":$SUCCESS,\\\"trajectory\\\":\\\"searchβ†’scaffoldβ†’testβ†’refine\\\"}\" --confidence \"$CONFIDENCE\" 2>/dev/null || true; npx claude-flow@alpha hooks post-task --analyze-performance true --store-decisions true --export-learnings true' _"
111
- }
112
- ]
113
- }
114
- ],
115
- "PreCompact": [
116
- {
117
- "matcher": "manual",
118
- "hooks": [
119
- {
120
- "type": "command",
121
- "command": "/bin/bash -c 'INPUT=$(cat); CUSTOM=$(echo \"$INPUT\" | jq -r \".custom_instructions // \\\"\\\"\"); echo \"πŸ”„ PreCompact Guidance:\"; echo \"πŸ“‹ IMPORTANT: Review CLAUDE.md in project root for:\"; echo \" β€’ 54 available agents and concurrent usage patterns\"; echo \" β€’ Swarm coordination strategies (hierarchical, mesh, adaptive)\"; echo \" β€’ SPARC methodology workflows with batchtools optimization\"; echo \" β€’ Critical concurrent execution rules (GOLDEN RULE: 1 MESSAGE = ALL OPERATIONS)\"; if [ -n \"$CUSTOM\" ]; then echo \"🎯 Custom compact instructions: $CUSTOM\"; fi; echo \"βœ… Ready for compact operation\"'"
122
- }
123
- ]
124
- },
125
- {
126
- "matcher": "auto",
127
- "hooks": [
128
- {
129
- "type": "command",
130
- "command": "/bin/bash -c 'echo \"πŸ”„ Auto-Compact Guidance (Context Window Full):\"; echo \"πŸ“‹ CRITICAL: Before compacting, ensure you understand:\"; echo \" β€’ All 54 agents available in .claude/agents/ directory\"; echo \" β€’ Concurrent execution patterns from CLAUDE.md\"; echo \" β€’ Batchtools optimization for 300% performance gains\"; echo \" β€’ Swarm coordination strategies for complex tasks\"; echo \"⚑ Apply GOLDEN RULE: Always batch operations in single messages\"; echo \"βœ… Auto-compact proceeding with full agent context\"'"
131
- }
132
- ]
133
- }
134
- ],
135
- "Stop": [
136
- {
137
- "hooks": [
138
- {
139
- "type": "command",
140
- "description": "Session end - Train models and compress learnings",
141
- "command": "bash -c 'echo \"πŸŽ“ Session End: Training models on accumulated experiences...\"; npx agentdb@latest train --domain \"code-edits\" --epochs 10 --batch-size 32 2>/dev/null || echo \"⚠️ Training skipped (insufficient data)\"; echo \"🧠 Memory Distillation: Compressing session learnings...\"; npx agentdb@latest optimize-memory --compress true --consolidate-patterns true 2>/dev/null || true; npx claude-flow@alpha hooks session-end --generate-summary true --persist-state true --export-metrics true'"
142
- }
143
- ]
144
- }
145
- ]
146
- },
147
- "includeCoAuthoredBy": true,
148
- "enabledMcpjsonServers": ["claude-flow", "ruv-swarm", "agentic-qe"],
149
- "statusLine": {
150
- "type": "command",
151
- "command": ".claude/statusline-command.sh"
152
- }
153
- }
@@ -1,10 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "mcp__ruv-swarm",
5
- "mcp__claude-flow@alpha",
6
- "mcp__flow-nexus"
7
- ],
8
- "deny": []
9
- }
10
- }
@@ -1,176 +0,0 @@
1
-
2
- #!/bin/bash
3
-
4
- # Read JSON input from stdin
5
- INPUT=$(cat)
6
- MODEL=$(echo "$INPUT" | jq -r '.model.display_name // "Claude"')
7
- CWD=$(echo "$INPUT" | jq -r '.workspace.current_dir // .cwd')
8
- DIR=$(basename "$CWD")
9
-
10
- # Replace claude-code-flow with branded name
11
- if [ "$DIR" = "claude-code-flow" ]; then
12
- DIR="🌊 Claude Flow"
13
- fi
14
-
15
- # Get git branch
16
- BRANCH=$(cd "$CWD" 2>/dev/null && git branch --show-current 2>/dev/null)
17
-
18
- # Start building statusline
19
- printf "\033[1m$MODEL\033[0m in \033[36m$DIR\033[0m"
20
- [ -n "$BRANCH" ] && printf " on \033[33mβŽ‡ $BRANCH\033[0m"
21
-
22
- # Claude-Flow integration
23
- FLOW_DIR="$CWD/.claude-flow"
24
-
25
- if [ -d "$FLOW_DIR" ]; then
26
- printf " β”‚"
27
-
28
- # 1. Swarm Configuration & Topology
29
- if [ -f "$FLOW_DIR/swarm-config.json" ]; then
30
- STRATEGY=$(jq -r '.defaultStrategy // empty' "$FLOW_DIR/swarm-config.json" 2>/dev/null)
31
- if [ -n "$STRATEGY" ]; then
32
- # Map strategy to topology icon
33
- case "$STRATEGY" in
34
- "balanced") TOPO_ICON="⚑mesh" ;;
35
- "conservative") TOPO_ICON="⚑hier" ;;
36
- "aggressive") TOPO_ICON="⚑ring" ;;
37
- *) TOPO_ICON="⚑$STRATEGY" ;;
38
- esac
39
- printf " \033[35m$TOPO_ICON\033[0m"
40
-
41
- # Count agent profiles as "configured agents"
42
- AGENT_COUNT=$(jq -r '.agentProfiles | length' "$FLOW_DIR/swarm-config.json" 2>/dev/null)
43
- if [ -n "$AGENT_COUNT" ] && [ "$AGENT_COUNT" != "null" ] && [ "$AGENT_COUNT" -gt 0 ]; then
44
- printf " \033[35mπŸ€– $AGENT_COUNT\033[0m"
45
- fi
46
- fi
47
- fi
48
-
49
- # 2. Real-time System Metrics
50
- if [ -f "$FLOW_DIR/metrics/system-metrics.json" ]; then
51
- # Get latest metrics (last entry in array)
52
- LATEST=$(jq -r '.[-1]' "$FLOW_DIR/metrics/system-metrics.json" 2>/dev/null)
53
-
54
- if [ -n "$LATEST" ] && [ "$LATEST" != "null" ]; then
55
- # Memory usage
56
- MEM_PERCENT=$(echo "$LATEST" | jq -r '.memoryUsagePercent // 0' | awk '{printf "%.0f", $1}')
57
- if [ -n "$MEM_PERCENT" ] && [ "$MEM_PERCENT" != "null" ]; then
58
- # Color-coded memory (green <60%, yellow 60-80%, red >80%)
59
- if [ "$MEM_PERCENT" -lt 60 ]; then
60
- MEM_COLOR="\033[32m" # Green
61
- elif [ "$MEM_PERCENT" -lt 80 ]; then
62
- MEM_COLOR="\033[33m" # Yellow
63
- else
64
- MEM_COLOR="\033[31m" # Red
65
- fi
66
- printf " ${MEM_COLOR}πŸ’Ύ ${MEM_PERCENT}%\033[0m"
67
- fi
68
-
69
- # CPU load
70
- CPU_LOAD=$(echo "$LATEST" | jq -r '.cpuLoad // 0' | awk '{printf "%.0f", $1 * 100}')
71
- if [ -n "$CPU_LOAD" ] && [ "$CPU_LOAD" != "null" ]; then
72
- # Color-coded CPU (green <50%, yellow 50-75%, red >75%)
73
- if [ "$CPU_LOAD" -lt 50 ]; then
74
- CPU_COLOR="\033[32m" # Green
75
- elif [ "$CPU_LOAD" -lt 75 ]; then
76
- CPU_COLOR="\033[33m" # Yellow
77
- else
78
- CPU_COLOR="\033[31m" # Red
79
- fi
80
- printf " ${CPU_COLOR}βš™ ${CPU_LOAD}%\033[0m"
81
- fi
82
- fi
83
- fi
84
-
85
- # 3. Session State
86
- if [ -f "$FLOW_DIR/session-state.json" ]; then
87
- SESSION_ID=$(jq -r '.sessionId // empty' "$FLOW_DIR/session-state.json" 2>/dev/null)
88
- ACTIVE=$(jq -r '.active // false' "$FLOW_DIR/session-state.json" 2>/dev/null)
89
-
90
- if [ "$ACTIVE" = "true" ] && [ -n "$SESSION_ID" ]; then
91
- # Show abbreviated session ID
92
- SHORT_ID=$(echo "$SESSION_ID" | cut -d'-' -f1)
93
- printf " \033[34mπŸ”„ $SHORT_ID\033[0m"
94
- fi
95
- fi
96
-
97
- # 4. Performance Metrics from task-metrics.json
98
- if [ -f "$FLOW_DIR/metrics/task-metrics.json" ]; then
99
- # Parse task metrics for success rate, avg time, and streak
100
- METRICS=$(jq -r '
101
- # Calculate metrics
102
- (map(select(.success == true)) | length) as $successful |
103
- (length) as $total |
104
- (if $total > 0 then ($successful / $total * 100) else 0 end) as $success_rate |
105
- (map(.duration // 0) | add / length) as $avg_duration |
106
- # Calculate streak (consecutive successes from end)
107
- (reverse |
108
- reduce .[] as $task (0;
109
- if $task.success == true then . + 1 else 0 end
110
- )
111
- ) as $streak |
112
- {
113
- success_rate: $success_rate,
114
- avg_duration: $avg_duration,
115
- streak: $streak,
116
- total: $total
117
- } | @json
118
- ' "$FLOW_DIR/metrics/task-metrics.json" 2>/dev/null)
119
-
120
- if [ -n "$METRICS" ] && [ "$METRICS" != "null" ]; then
121
- # Success Rate
122
- SUCCESS_RATE=$(echo "$METRICS" | jq -r '.success_rate // 0' | awk '{printf "%.0f", $1}')
123
- TOTAL_TASKS=$(echo "$METRICS" | jq -r '.total // 0')
124
-
125
- if [ -n "$SUCCESS_RATE" ] && [ "$TOTAL_TASKS" -gt 0 ]; then
126
- # Color-code: Green (>80%), Yellow (60-80%), Red (<60%)
127
- if [ "$SUCCESS_RATE" -gt 80 ]; then
128
- SUCCESS_COLOR="\033[32m" # Green
129
- elif [ "$SUCCESS_RATE" -ge 60 ]; then
130
- SUCCESS_COLOR="\033[33m" # Yellow
131
- else
132
- SUCCESS_COLOR="\033[31m" # Red
133
- fi
134
- printf " ${SUCCESS_COLOR}🎯 ${SUCCESS_RATE}%\033[0m"
135
- fi
136
-
137
- # Average Time
138
- AVG_TIME=$(echo "$METRICS" | jq -r '.avg_duration // 0')
139
- if [ -n "$AVG_TIME" ] && [ "$TOTAL_TASKS" -gt 0 ]; then
140
- # Format smartly: seconds, minutes, or hours
141
- if [ $(echo "$AVG_TIME < 60" | bc -l 2>/dev/null || echo 0) -eq 1 ]; then
142
- TIME_STR=$(echo "$AVG_TIME" | awk '{printf "%.1fs", $1}')
143
- elif [ $(echo "$AVG_TIME < 3600" | bc -l 2>/dev/null || echo 0) -eq 1 ]; then
144
- TIME_STR=$(echo "$AVG_TIME" | awk '{printf "%.1fm", $1/60}')
145
- else
146
- TIME_STR=$(echo "$AVG_TIME" | awk '{printf "%.1fh", $1/3600}')
147
- fi
148
- printf " \033[36m⏱️ $TIME_STR\033[0m"
149
- fi
150
-
151
- # Streak (only show if > 0)
152
- STREAK=$(echo "$METRICS" | jq -r '.streak // 0')
153
- if [ -n "$STREAK" ] && [ "$STREAK" -gt 0 ]; then
154
- printf " \033[91mπŸ”₯ $STREAK\033[0m"
155
- fi
156
- fi
157
- fi
158
-
159
- # 5. Active Tasks (check for task files)
160
- if [ -d "$FLOW_DIR/tasks" ]; then
161
- TASK_COUNT=$(find "$FLOW_DIR/tasks" -name "*.json" -type f 2>/dev/null | wc -l)
162
- if [ "$TASK_COUNT" -gt 0 ]; then
163
- printf " \033[36mπŸ“‹ $TASK_COUNT\033[0m"
164
- fi
165
- fi
166
-
167
- # 6. Check for hooks activity
168
- if [ -f "$FLOW_DIR/hooks-state.json" ]; then
169
- HOOKS_ACTIVE=$(jq -r '.enabled // false' "$FLOW_DIR/hooks-state.json" 2>/dev/null)
170
- if [ "$HOOKS_ACTIVE" = "true" ]; then
171
- printf " \033[35mπŸ”—\033[0m"
172
- fi
173
- fi
174
- fi
175
-
176
- echo