@itz4blitz/agentful 1.4.0 → 1.5.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.
- package/bin/hooks/context-awareness.js +1 -1
- package/lib/parallel-execution.js +26 -2
- package/package.json +1 -1
- package/template/.claude/agents/backend.md +56 -1
- package/template/.claude/agents/fixer.md +31 -5
- package/template/.claude/agents/frontend.md +61 -1
- package/template/.claude/agents/orchestrator.md +126 -10
- package/template/.claude/agents/tester.md +32 -1
- package/template/.claude/commands/agentful.md +17 -8
- package/template/CLAUDE.md +31 -8
- package/template/bin/hooks/architect-drift-detector.js +195 -28
- package/template/bin/hooks/context-awareness.js +369 -0
- package/template/bin/hooks/health-check.js +1 -1
- package/template/bin/hooks/mcp-health-check.js +51 -0
- package/template/bin/hooks/post-action-suggestions.js +75 -0
- package/template/bin/hooks/session-start.js +93 -0
- package/version.json +1 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Post-Action Suggestions Hook
|
|
5
|
+
*
|
|
6
|
+
* Runs after specific slash commands complete.
|
|
7
|
+
* Provides smart suggestions for what to do next.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import fs from 'fs';
|
|
11
|
+
import path from 'path';
|
|
12
|
+
import { fileURLToPath } from 'url';
|
|
13
|
+
|
|
14
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
15
|
+
const __dirname = path.dirname(__filename);
|
|
16
|
+
|
|
17
|
+
// Try to import context-awareness module
|
|
18
|
+
let contextModule = null;
|
|
19
|
+
try {
|
|
20
|
+
const modulePath = path.join(__dirname, './context-awareness.js');
|
|
21
|
+
if (fs.existsSync(modulePath)) {
|
|
22
|
+
contextModule = await import(modulePath);
|
|
23
|
+
}
|
|
24
|
+
} catch (error) {
|
|
25
|
+
// Silently fail
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Detect which action was just completed
|
|
29
|
+
const lastAction = process.env.LAST_COMMAND || '';
|
|
30
|
+
|
|
31
|
+
// Map of slash commands to action names
|
|
32
|
+
const actionMap = {
|
|
33
|
+
'agentful-generate': 'agentful-generate',
|
|
34
|
+
'agentful-start': 'agentful-start',
|
|
35
|
+
'agentful-decide': 'agentful-decide',
|
|
36
|
+
'agentful-validate': 'agentful-validate',
|
|
37
|
+
'agentful-status': 'agentful-status',
|
|
38
|
+
'agentful-product': 'agentful-product'
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// Find matching action
|
|
42
|
+
let detectedAction = null;
|
|
43
|
+
for (const [cmd, action] of Object.entries(actionMap)) {
|
|
44
|
+
if (lastAction.includes(cmd)) {
|
|
45
|
+
detectedAction = action;
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Show suggestions if we have context module and detected action
|
|
51
|
+
if (contextModule && contextModule.generatePostActionSuggestions && detectedAction) {
|
|
52
|
+
try {
|
|
53
|
+
const suggestions = contextModule.generatePostActionSuggestions(
|
|
54
|
+
detectedAction,
|
|
55
|
+
process.cwd()
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
if (suggestions.length > 0) {
|
|
59
|
+
const formatted = contextModule.formatSuggestions(suggestions, {
|
|
60
|
+
maxSuggestions: 3,
|
|
61
|
+
includeNumbers: true
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
console.log('');
|
|
65
|
+
console.log('─'.repeat(60));
|
|
66
|
+
console.log(formatted);
|
|
67
|
+
console.log('─'.repeat(60));
|
|
68
|
+
}
|
|
69
|
+
} catch (error) {
|
|
70
|
+
// Silently fail - don't disrupt user experience
|
|
71
|
+
if (process.env.VERBOSE) {
|
|
72
|
+
console.log(`Post-action suggestion error: ${error.message}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Session Start Hook
|
|
5
|
+
*
|
|
6
|
+
* Runs when Claude Code session starts.
|
|
7
|
+
* Provides intelligent context awareness and suggests next actions.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import fs from 'fs';
|
|
11
|
+
import path from 'path';
|
|
12
|
+
import { execSync } from 'child_process';
|
|
13
|
+
import { fileURLToPath } from 'url';
|
|
14
|
+
|
|
15
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
+
const __dirname = path.dirname(__filename);
|
|
17
|
+
|
|
18
|
+
// Try to import context-awareness module from agentful package
|
|
19
|
+
let contextModule = null;
|
|
20
|
+
try {
|
|
21
|
+
// Import from same directory (bin/hooks/)
|
|
22
|
+
const modulePath = path.join(__dirname, './context-awareness.js');
|
|
23
|
+
if (fs.existsSync(modulePath)) {
|
|
24
|
+
contextModule = await import(modulePath);
|
|
25
|
+
}
|
|
26
|
+
} catch (error) {
|
|
27
|
+
// Silently fail - we'll show basic status instead
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Detect if TeammateTool (parallel execution) is enabled
|
|
32
|
+
*/
|
|
33
|
+
function detectParallelExecution() {
|
|
34
|
+
try {
|
|
35
|
+
// Find Claude Code binary
|
|
36
|
+
const npmRoot = execSync('npm root -g', { encoding: 'utf8' }).trim();
|
|
37
|
+
const cliPath = path.join(npmRoot, '@anthropic-ai', 'claude-code', 'cli.js');
|
|
38
|
+
|
|
39
|
+
if (!fs.existsSync(cliPath)) {
|
|
40
|
+
return { enabled: false, reason: 'Claude Code binary not found' };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Check for TeammateTool pattern
|
|
44
|
+
const content = fs.readFileSync(cliPath, 'utf8');
|
|
45
|
+
const hasTeammateTool = /TeammateTool|teammate_mailbox|launchSwarm/.test(content);
|
|
46
|
+
|
|
47
|
+
if (!hasTeammateTool) {
|
|
48
|
+
return { enabled: false, reason: 'Claude Code version too old' };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Check if gate is disabled (means it's patched/enabled)
|
|
52
|
+
const SWARM_GATE_MARKER = /tengu_brass_pebble/;
|
|
53
|
+
const gateExists = SWARM_GATE_MARKER.test(content);
|
|
54
|
+
|
|
55
|
+
if (!gateExists) {
|
|
56
|
+
return { enabled: true, method: 'patched' };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return { enabled: false, reason: 'TeammateTool not enabled' };
|
|
60
|
+
} catch (error) {
|
|
61
|
+
return { enabled: false, reason: error.message };
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Main execution
|
|
66
|
+
const detection = detectParallelExecution();
|
|
67
|
+
|
|
68
|
+
// Basic parallel execution status
|
|
69
|
+
const parallelStatus = detection.enabled
|
|
70
|
+
? '✅ Agentful ready (parallel execution: ON)'
|
|
71
|
+
: '⚠️ Agentful ready (parallel execution: OFF - agents will run sequentially)';
|
|
72
|
+
|
|
73
|
+
// Try to show intelligent context awareness
|
|
74
|
+
if (contextModule && contextModule.generateSessionStartMessage) {
|
|
75
|
+
try {
|
|
76
|
+
const message = contextModule.generateSessionStartMessage(process.cwd());
|
|
77
|
+
console.log(parallelStatus);
|
|
78
|
+
console.log('');
|
|
79
|
+
console.log(message);
|
|
80
|
+
} catch (error) {
|
|
81
|
+
// Fall back to basic status
|
|
82
|
+
console.log(parallelStatus);
|
|
83
|
+
if (process.env.VERBOSE) {
|
|
84
|
+
console.log(` Context awareness error: ${error.message}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
} else {
|
|
88
|
+
// No context module - show basic status
|
|
89
|
+
console.log(parallelStatus);
|
|
90
|
+
if (process.env.VERBOSE && !detection.enabled) {
|
|
91
|
+
console.log(` Reason: ${detection.reason}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
package/version.json
CHANGED