@cloudpftc/opencode-orchestrator 3.6.0 → 3.6.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/.opencode/helpers/auto-memory-hook.mjs +104 -0
- package/.opencode/helpers/hook-handler.cjs +223 -0
- package/.opencode/helpers/intelligence.cjs +197 -0
- package/.opencode/helpers/memory.js +83 -0
- package/.opencode/helpers/post-commit +16 -0
- package/.opencode/helpers/pre-commit +26 -0
- package/.opencode/helpers/router.js +66 -0
- package/.opencode/helpers/session.js +127 -0
- package/.opencode/helpers/statusline.cjs +774 -0
- package/.opencode/settings.json +319 -0
- package/package.json +1 -1
- package/v3/@claude-flow/cli/README.md +391 -534
- package/v3/@claude-flow/cli/dist/src/commands/benchmark.js +2 -2
- package/v3/@claude-flow/cli/dist/src/commands/claims.js +1 -1
- package/v3/@claude-flow/cli/dist/src/commands/config.js +1 -1
- package/v3/@claude-flow/cli/dist/src/commands/daemon.js +3 -3
- package/v3/@claude-flow/cli/dist/src/commands/deployment.js +1 -1
- package/v3/@claude-flow/cli/dist/src/commands/doctor.js +1 -1
- package/v3/@claude-flow/cli/dist/src/commands/embeddings.js +1 -1
- package/v3/@claude-flow/cli/dist/src/commands/hooks.js +1 -1
- package/v3/@claude-flow/cli/dist/src/commands/init.js +9 -9
- package/v3/@claude-flow/cli/dist/src/commands/neural.js +1 -1
- package/v3/@claude-flow/cli/dist/src/commands/performance.js +1 -1
- package/v3/@claude-flow/cli/dist/src/commands/plugins.js +1 -1
- package/v3/@claude-flow/cli/dist/src/commands/providers.js +1 -1
- package/v3/@claude-flow/cli/dist/src/commands/security.js +1 -1
- package/v3/@claude-flow/cli/dist/src/commands/start.js +10 -10
- package/v3/@claude-flow/cli/dist/src/commands/status.js +2 -2
- package/v3/@claude-flow/cli/dist/src/commands/transfer-store.js +1 -1
- package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.d.ts +1 -1
- package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.js +1 -1
- package/v3/@claude-flow/cli/dist/src/plugins/store/discovery.js +1 -1
- package/v3/@claude-flow/cli/dist/src/runtime/headless.js +3 -3
- package/v3/@claude-flow/cli/dist/src/services/claim-service.js +1 -1
- package/v3/@claude-flow/cli/dist/src/types.d.ts +1 -1
- package/v3/@claude-flow/cli/dist/src/types.js +1 -1
- package/v3/@claude-flow/cli/package.json +1 -1
- package/v3/@claude-flow/cli/dist/src/init/claudemd-generator.d.ts +0 -25
- package/v3/@claude-flow/cli/dist/src/init/claudemd-generator.js +0 -486
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Claude Flow Agent Router
|
|
4
|
+
* Routes tasks to optimal agents based on learned patterns
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const AGENT_CAPABILITIES = {
|
|
8
|
+
coder: ['code-generation', 'refactoring', 'debugging', 'implementation'],
|
|
9
|
+
tester: ['unit-testing', 'integration-testing', 'coverage', 'test-generation'],
|
|
10
|
+
reviewer: ['code-review', 'security-audit', 'quality-check', 'best-practices'],
|
|
11
|
+
researcher: ['web-search', 'documentation', 'analysis', 'summarization'],
|
|
12
|
+
architect: ['system-design', 'architecture', 'patterns', 'scalability'],
|
|
13
|
+
'backend-dev': ['api', 'database', 'server', 'authentication'],
|
|
14
|
+
'frontend-dev': ['ui', 'react', 'css', 'components'],
|
|
15
|
+
devops: ['ci-cd', 'docker', 'deployment', 'infrastructure'],
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const TASK_PATTERNS = {
|
|
19
|
+
// Code patterns
|
|
20
|
+
'implement|create|build|add|write code': 'coder',
|
|
21
|
+
'test|spec|coverage|unit test|integration': 'tester',
|
|
22
|
+
'review|audit|check|validate|security': 'reviewer',
|
|
23
|
+
'research|find|search|documentation|explore': 'researcher',
|
|
24
|
+
'design|architect|structure|plan': 'architect',
|
|
25
|
+
|
|
26
|
+
// Domain patterns
|
|
27
|
+
'api|endpoint|server|backend|database': 'backend-dev',
|
|
28
|
+
'ui|frontend|component|react|css|style': 'frontend-dev',
|
|
29
|
+
'deploy|docker|ci|cd|pipeline|infrastructure': 'devops',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
function routeTask(task) {
|
|
33
|
+
const taskLower = task.toLowerCase();
|
|
34
|
+
|
|
35
|
+
// Check patterns
|
|
36
|
+
for (const [pattern, agent] of Object.entries(TASK_PATTERNS)) {
|
|
37
|
+
const regex = new RegExp(pattern, 'i');
|
|
38
|
+
if (regex.test(taskLower)) {
|
|
39
|
+
return {
|
|
40
|
+
agent,
|
|
41
|
+
confidence: 0.8,
|
|
42
|
+
reason: `Matched pattern: ${pattern}`,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Default to coder for unknown tasks
|
|
48
|
+
return {
|
|
49
|
+
agent: 'coder',
|
|
50
|
+
confidence: 0.5,
|
|
51
|
+
reason: 'Default routing - no specific pattern matched',
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// CLI
|
|
56
|
+
const task = process.argv.slice(2).join(' ');
|
|
57
|
+
|
|
58
|
+
if (task) {
|
|
59
|
+
const result = routeTask(task);
|
|
60
|
+
console.log(JSON.stringify(result, null, 2));
|
|
61
|
+
} else {
|
|
62
|
+
console.log('Usage: router.js <task description>');
|
|
63
|
+
console.log('\nAvailable agents:', Object.keys(AGENT_CAPABILITIES).join(', '));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
module.exports = { routeTask, AGENT_CAPABILITIES, TASK_PATTERNS };
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Claude Flow Session Manager
|
|
4
|
+
* Handles session lifecycle: start, restore, end
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
|
|
10
|
+
const SESSION_DIR = path.join(process.cwd(), '.opencode', 'sessions');
|
|
11
|
+
const SESSION_FILE = path.join(SESSION_DIR, 'current.json');
|
|
12
|
+
|
|
13
|
+
const commands = {
|
|
14
|
+
start: () => {
|
|
15
|
+
const sessionId = `session-${Date.now()}`;
|
|
16
|
+
const session = {
|
|
17
|
+
id: sessionId,
|
|
18
|
+
startedAt: new Date().toISOString(),
|
|
19
|
+
cwd: process.cwd(),
|
|
20
|
+
context: {},
|
|
21
|
+
metrics: {
|
|
22
|
+
edits: 0,
|
|
23
|
+
commands: 0,
|
|
24
|
+
tasks: 0,
|
|
25
|
+
errors: 0,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
fs.mkdirSync(SESSION_DIR, { recursive: true });
|
|
30
|
+
fs.writeFileSync(SESSION_FILE, JSON.stringify(session, null, 2));
|
|
31
|
+
|
|
32
|
+
console.log(`Session started: ${sessionId}`);
|
|
33
|
+
return session;
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
restore: () => {
|
|
37
|
+
if (!fs.existsSync(SESSION_FILE)) {
|
|
38
|
+
console.log('No session to restore');
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const session = JSON.parse(fs.readFileSync(SESSION_FILE, 'utf-8'));
|
|
43
|
+
session.restoredAt = new Date().toISOString();
|
|
44
|
+
fs.writeFileSync(SESSION_FILE, JSON.stringify(session, null, 2));
|
|
45
|
+
|
|
46
|
+
console.log(`Session restored: ${session.id}`);
|
|
47
|
+
return session;
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
end: () => {
|
|
51
|
+
if (!fs.existsSync(SESSION_FILE)) {
|
|
52
|
+
console.log('No active session');
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const session = JSON.parse(fs.readFileSync(SESSION_FILE, 'utf-8'));
|
|
57
|
+
session.endedAt = new Date().toISOString();
|
|
58
|
+
session.duration = Date.now() - new Date(session.startedAt).getTime();
|
|
59
|
+
|
|
60
|
+
// Archive session
|
|
61
|
+
const archivePath = path.join(SESSION_DIR, `${session.id}.json`);
|
|
62
|
+
fs.writeFileSync(archivePath, JSON.stringify(session, null, 2));
|
|
63
|
+
fs.unlinkSync(SESSION_FILE);
|
|
64
|
+
|
|
65
|
+
console.log(`Session ended: ${session.id}`);
|
|
66
|
+
console.log(`Duration: ${Math.round(session.duration / 1000 / 60)} minutes`);
|
|
67
|
+
console.log(`Metrics: ${JSON.stringify(session.metrics)}`);
|
|
68
|
+
|
|
69
|
+
return session;
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
status: () => {
|
|
73
|
+
if (!fs.existsSync(SESSION_FILE)) {
|
|
74
|
+
console.log('No active session');
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const session = JSON.parse(fs.readFileSync(SESSION_FILE, 'utf-8'));
|
|
79
|
+
const duration = Date.now() - new Date(session.startedAt).getTime();
|
|
80
|
+
|
|
81
|
+
console.log(`Session: ${session.id}`);
|
|
82
|
+
console.log(`Started: ${session.startedAt}`);
|
|
83
|
+
console.log(`Duration: ${Math.round(duration / 1000 / 60)} minutes`);
|
|
84
|
+
console.log(`Metrics: ${JSON.stringify(session.metrics)}`);
|
|
85
|
+
|
|
86
|
+
return session;
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
update: (key, value) => {
|
|
90
|
+
if (!fs.existsSync(SESSION_FILE)) {
|
|
91
|
+
console.log('No active session');
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const session = JSON.parse(fs.readFileSync(SESSION_FILE, 'utf-8'));
|
|
96
|
+
session.context[key] = value;
|
|
97
|
+
session.updatedAt = new Date().toISOString();
|
|
98
|
+
fs.writeFileSync(SESSION_FILE, JSON.stringify(session, null, 2));
|
|
99
|
+
|
|
100
|
+
return session;
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
metric: (name) => {
|
|
104
|
+
if (!fs.existsSync(SESSION_FILE)) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const session = JSON.parse(fs.readFileSync(SESSION_FILE, 'utf-8'));
|
|
109
|
+
if (session.metrics[name] !== undefined) {
|
|
110
|
+
session.metrics[name]++;
|
|
111
|
+
fs.writeFileSync(SESSION_FILE, JSON.stringify(session, null, 2));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return session;
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
// CLI
|
|
119
|
+
const [,, command, ...args] = process.argv;
|
|
120
|
+
|
|
121
|
+
if (command && commands[command]) {
|
|
122
|
+
commands[command](...args);
|
|
123
|
+
} else {
|
|
124
|
+
console.log('Usage: session.js <start|restore|end|status|update|metric> [args]');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
module.exports = commands;
|