@claude-flow/cli 3.1.0-alpha.22 → 3.1.0-alpha.24
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.
|
@@ -45,6 +45,7 @@ function safeRequire(modulePath) {
|
|
|
45
45
|
const router = safeRequire(path.join(helpersDir, 'router.js'));
|
|
46
46
|
const session = safeRequire(path.join(helpersDir, 'session.js'));
|
|
47
47
|
const memory = safeRequire(path.join(helpersDir, 'memory.js'));
|
|
48
|
+
const intelligence = safeRequire(path.join(helpersDir, 'intelligence.cjs'));
|
|
48
49
|
|
|
49
50
|
// Get the command from argv
|
|
50
51
|
const [,, command, ...args] = process.argv;
|
|
@@ -54,11 +55,18 @@ const prompt = process.env.PROMPT || process.env.TOOL_INPUT_command || args.join
|
|
|
54
55
|
|
|
55
56
|
const handlers = {
|
|
56
57
|
'route': () => {
|
|
58
|
+
// Inject ranked intelligence context before routing
|
|
59
|
+
if (intelligence && intelligence.getContext) {
|
|
60
|
+
try {
|
|
61
|
+
const ctx = intelligence.getContext(prompt);
|
|
62
|
+
if (ctx) console.log(ctx);
|
|
63
|
+
} catch (e) { /* non-fatal */ }
|
|
64
|
+
}
|
|
57
65
|
if (router && router.routeTask) {
|
|
58
66
|
const result = router.routeTask(prompt);
|
|
59
67
|
// Format output for Claude Code hook consumption
|
|
60
68
|
const output = [
|
|
61
|
-
|
|
69
|
+
`[INFO] Routing task: ${prompt.substring(0, 80) || '(no prompt)'}`,
|
|
62
70
|
'',
|
|
63
71
|
'Routing Method',
|
|
64
72
|
' - Method: keyword',
|
|
@@ -114,6 +122,13 @@ const handlers = {
|
|
|
114
122
|
if (session && session.metric) {
|
|
115
123
|
session.metric('edits');
|
|
116
124
|
}
|
|
125
|
+
// Record edit for intelligence consolidation
|
|
126
|
+
if (intelligence && intelligence.recordEdit) {
|
|
127
|
+
try {
|
|
128
|
+
const file = process.env.TOOL_INPUT_file_path || args[0] || '';
|
|
129
|
+
intelligence.recordEdit(file);
|
|
130
|
+
} catch (e) { /* non-fatal */ }
|
|
131
|
+
}
|
|
117
132
|
console.log('[OK] Edit recorded');
|
|
118
133
|
},
|
|
119
134
|
|
|
@@ -141,9 +156,27 @@ const handlers = {
|
|
|
141
156
|
console.log('| Memory Entries | 0 |');
|
|
142
157
|
console.log('+----------------+-------+');
|
|
143
158
|
}
|
|
159
|
+
// Initialize intelligence graph after session restore
|
|
160
|
+
if (intelligence && intelligence.init) {
|
|
161
|
+
try {
|
|
162
|
+
const result = intelligence.init();
|
|
163
|
+
if (result && result.nodes > 0) {
|
|
164
|
+
console.log(`[INTELLIGENCE] Loaded ${result.nodes} patterns, ${result.edges} edges`);
|
|
165
|
+
}
|
|
166
|
+
} catch (e) { /* non-fatal */ }
|
|
167
|
+
}
|
|
144
168
|
},
|
|
145
169
|
|
|
146
170
|
'session-end': () => {
|
|
171
|
+
// Consolidate intelligence before ending session
|
|
172
|
+
if (intelligence && intelligence.consolidate) {
|
|
173
|
+
try {
|
|
174
|
+
const result = intelligence.consolidate();
|
|
175
|
+
if (result && result.entries > 0) {
|
|
176
|
+
console.log(`[INTELLIGENCE] Consolidated: ${result.entries} entries, ${result.edges} edges${result.newEntries > 0 ? `, ${result.newEntries} new` : ''}, PageRank recomputed`);
|
|
177
|
+
}
|
|
178
|
+
} catch (e) { /* non-fatal */ }
|
|
179
|
+
}
|
|
147
180
|
if (session && session.end) {
|
|
148
181
|
session.end();
|
|
149
182
|
} else {
|
|
@@ -165,6 +198,12 @@ const handlers = {
|
|
|
165
198
|
},
|
|
166
199
|
|
|
167
200
|
'post-task': () => {
|
|
201
|
+
// Implicit success feedback for intelligence
|
|
202
|
+
if (intelligence && intelligence.feedback) {
|
|
203
|
+
try {
|
|
204
|
+
intelligence.feedback(true);
|
|
205
|
+
} catch (e) { /* non-fatal */ }
|
|
206
|
+
}
|
|
168
207
|
console.log('[OK] Task completed');
|
|
169
208
|
},
|
|
170
209
|
};
|