@cloudpftc/opencode-orchestrator 3.5.15 → 3.6.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/opencode.json +35 -78
- package/package.json +2 -6
- package/v3/@claude-flow/cli/dist/src/commands/init.js +7 -7
- package/v3/@claude-flow/cli/dist/src/init/executor.js +181 -133
- package/v3/@claude-flow/cli/dist/src/init/helpers-generator.d.ts +1 -1
- package/v3/@claude-flow/cli/dist/src/init/helpers-generator.js +20 -20
- package/v3/@claude-flow/cli/dist/src/init/index.d.ts +1 -1
- package/v3/@claude-flow/cli/dist/src/init/index.js +1 -1
- package/v3/@claude-flow/cli/dist/src/init/mcp-generator.d.ts +2 -2
- package/v3/@claude-flow/cli/dist/src/init/mcp-generator.js +15 -15
- package/v3/@claude-flow/cli/dist/src/init/opencode-generator.d.ts +42 -0
- package/v3/@claude-flow/cli/dist/src/init/opencode-generator.js +107 -0
- package/v3/@claude-flow/cli/dist/src/init/settings-generator.d.ts +1 -1
- package/v3/@claude-flow/cli/dist/src/init/settings-generator.js +18 -18
- package/v3/@claude-flow/cli/dist/src/init/skillmd-generator.d.ts +25 -0
- package/v3/@claude-flow/cli/dist/src/init/skillmd-generator.js +486 -0
- package/v3/@claude-flow/cli/dist/src/init/statusline-generator.d.ts +1 -1
- package/v3/@claude-flow/cli/dist/src/init/statusline-generator.js +39 -23
- package/v3/@claude-flow/cli/dist/src/init/types.d.ts +14 -10
- package/v3/@claude-flow/cli/dist/src/init/types.js +3 -3
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
/**
|
|
13
13
|
* Generate optimized statusline script
|
|
14
14
|
* Output format:
|
|
15
|
-
* ▊
|
|
15
|
+
* ▊ OpenCode Orchestrator ● user │ ⎇ branch │ Opus 4.6
|
|
16
16
|
* ─────────────────────────────────────────────────────
|
|
17
17
|
* 🏗️ DDD Domains [●●○○○] 2/5 ⚡ HNSW 150x
|
|
18
18
|
* 🤖 Swarm ◉ [ 5/15] 👥 2 🪝 10/17 🟢 CVE 3/3 💾 4MB 🧠 63%
|
|
@@ -23,7 +23,7 @@ export function generateStatuslineScript(options) {
|
|
|
23
23
|
const maxAgents = options.runtime.maxAgents;
|
|
24
24
|
return `#!/usr/bin/env node
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* OpenCode Orchestrator Statusline Generator (Optimized)
|
|
27
27
|
* Displays real-time V3 implementation progress and system status
|
|
28
28
|
*
|
|
29
29
|
* Usage: node statusline.cjs [--json] [--compact]
|
|
@@ -104,7 +104,9 @@ function safeStat(filePath) {
|
|
|
104
104
|
let _settingsCache = undefined;
|
|
105
105
|
function getSettings() {
|
|
106
106
|
if (_settingsCache !== undefined) return _settingsCache;
|
|
107
|
-
_settingsCache = readJSON(path.join(CWD, '.
|
|
107
|
+
_settingsCache = readJSON(path.join(CWD, 'opencode.json'))
|
|
108
|
+
|| readJSON(path.join(CWD, '.opencode', 'settings.json'))
|
|
109
|
+
|| readJSON(path.join(CWD, '.claude', 'settings.json'))
|
|
108
110
|
|| readJSON(path.join(CWD, '.claude', 'settings.local.json'))
|
|
109
111
|
|| null;
|
|
110
112
|
return _settingsCache;
|
|
@@ -202,6 +204,7 @@ function getModelName() {
|
|
|
202
204
|
function getLearningStats() {
|
|
203
205
|
const memoryPaths = [
|
|
204
206
|
path.join(CWD, '.swarm', 'memory.db'),
|
|
207
|
+
path.join(CWD, '.opencode', 'memory.db'),
|
|
205
208
|
path.join(CWD, '.claude-flow', 'memory.db'),
|
|
206
209
|
path.join(CWD, '.claude', 'memory.db'),
|
|
207
210
|
path.join(CWD, 'data', 'memory.db'),
|
|
@@ -237,7 +240,8 @@ function getV3Progress() {
|
|
|
237
240
|
const learning = getLearningStats();
|
|
238
241
|
const totalDomains = 5;
|
|
239
242
|
|
|
240
|
-
const dddData = readJSON(path.join(CWD, '.
|
|
243
|
+
const dddData = readJSON(path.join(CWD, '.opencode', 'metrics', 'ddd-progress.json'))
|
|
244
|
+
|| readJSON(path.join(CWD, '.claude-flow', 'metrics', 'ddd-progress.json'));
|
|
241
245
|
let dddProgress = dddData ? (dddData.progress || 0) : 0;
|
|
242
246
|
let domainsCompleted = Math.min(5, Math.floor(dddProgress / 20));
|
|
243
247
|
|
|
@@ -260,7 +264,8 @@ function getV3Progress() {
|
|
|
260
264
|
// Security status (pure file reads)
|
|
261
265
|
function getSecurityStatus() {
|
|
262
266
|
const totalCves = 3;
|
|
263
|
-
const auditData = readJSON(path.join(CWD, '.
|
|
267
|
+
const auditData = readJSON(path.join(CWD, '.opencode', 'security', 'audit-status.json'))
|
|
268
|
+
|| readJSON(path.join(CWD, '.claude-flow', 'security', 'audit-status.json'));
|
|
264
269
|
if (auditData) {
|
|
265
270
|
return {
|
|
266
271
|
status: auditData.status || 'PENDING',
|
|
@@ -286,7 +291,8 @@ function getSecurityStatus() {
|
|
|
286
291
|
|
|
287
292
|
// Swarm status (pure file reads, NO ps aux)
|
|
288
293
|
function getSwarmStatus() {
|
|
289
|
-
const activityData = readJSON(path.join(CWD, '.
|
|
294
|
+
const activityData = readJSON(path.join(CWD, '.opencode', 'metrics', 'swarm-activity.json'))
|
|
295
|
+
|| readJSON(path.join(CWD, '.claude-flow', 'metrics', 'swarm-activity.json'));
|
|
290
296
|
if (activityData && activityData.swarm) {
|
|
291
297
|
return {
|
|
292
298
|
activeAgents: activityData.swarm.agent_count || 0,
|
|
@@ -295,7 +301,8 @@ function getSwarmStatus() {
|
|
|
295
301
|
};
|
|
296
302
|
}
|
|
297
303
|
|
|
298
|
-
const progressData = readJSON(path.join(CWD, '.
|
|
304
|
+
const progressData = readJSON(path.join(CWD, '.opencode', 'metrics', 'v3-progress.json'))
|
|
305
|
+
|| readJSON(path.join(CWD, '.claude-flow', 'metrics', 'v3-progress.json'));
|
|
299
306
|
if (progressData && progressData.swarm) {
|
|
300
307
|
return {
|
|
301
308
|
activeAgents: progressData.swarm.activeAgents || progressData.swarm.agent_count || 0,
|
|
@@ -314,7 +321,8 @@ function getSystemMetrics() {
|
|
|
314
321
|
const agentdb = getAgentDBStats();
|
|
315
322
|
|
|
316
323
|
// Intelligence from learning.json
|
|
317
|
-
const learningData = readJSON(path.join(CWD, '.
|
|
324
|
+
const learningData = readJSON(path.join(CWD, '.opencode', 'metrics', 'learning.json'))
|
|
325
|
+
|| readJSON(path.join(CWD, '.claude-flow', 'metrics', 'learning.json'));
|
|
318
326
|
let intelligencePct = 0;
|
|
319
327
|
let contextPct = 0;
|
|
320
328
|
|
|
@@ -347,7 +355,8 @@ function getSystemMetrics() {
|
|
|
347
355
|
|
|
348
356
|
// Sub-agents from file metrics (no ps aux)
|
|
349
357
|
let subAgents = 0;
|
|
350
|
-
const activityData = readJSON(path.join(CWD, '.
|
|
358
|
+
const activityData = readJSON(path.join(CWD, '.opencode', 'metrics', 'swarm-activity.json'))
|
|
359
|
+
|| readJSON(path.join(CWD, '.claude-flow', 'metrics', 'swarm-activity.json'));
|
|
351
360
|
if (activityData && activityData.processes && activityData.processes.estimated_agents) {
|
|
352
361
|
subAgents = activityData.processes.estimated_agents;
|
|
353
362
|
}
|
|
@@ -357,7 +366,8 @@ function getSystemMetrics() {
|
|
|
357
366
|
|
|
358
367
|
// ADR status (count files only — don't read contents)
|
|
359
368
|
function getADRStatus() {
|
|
360
|
-
const complianceData = readJSON(path.join(CWD, '.
|
|
369
|
+
const complianceData = readJSON(path.join(CWD, '.opencode', 'metrics', 'adr-compliance.json'))
|
|
370
|
+
|| readJSON(path.join(CWD, '.claude-flow', 'metrics', 'adr-compliance.json'));
|
|
361
371
|
if (complianceData) {
|
|
362
372
|
const checks = complianceData.checks || {};
|
|
363
373
|
const total = Object.keys(checks).length;
|
|
@@ -369,6 +379,7 @@ function getADRStatus() {
|
|
|
369
379
|
const adrPaths = [
|
|
370
380
|
path.join(CWD, 'v3', 'implementation', 'adrs'),
|
|
371
381
|
path.join(CWD, 'docs', 'adrs'),
|
|
382
|
+
path.join(CWD, '.opencode', 'adrs'),
|
|
372
383
|
path.join(CWD, '.claude-flow', 'adrs'),
|
|
373
384
|
];
|
|
374
385
|
|
|
@@ -402,7 +413,7 @@ function getHooksStatus() {
|
|
|
402
413
|
}
|
|
403
414
|
|
|
404
415
|
try {
|
|
405
|
-
const hooksDir = path.join(CWD, '.
|
|
416
|
+
const hooksDir = path.join(CWD, '.opencode', 'hooks');
|
|
406
417
|
if (fs.existsSync(hooksDir)) {
|
|
407
418
|
const hookFiles = fs.readdirSync(hooksDir).filter(f => f.endsWith('.js') || f.endsWith('.sh')).length;
|
|
408
419
|
enabled = Math.max(enabled, hookFiles);
|
|
@@ -421,6 +432,7 @@ function getAgentDBStats() {
|
|
|
421
432
|
|
|
422
433
|
const dbFiles = [
|
|
423
434
|
path.join(CWD, '.swarm', 'memory.db'),
|
|
435
|
+
path.join(CWD, '.opencode', 'memory.db'),
|
|
424
436
|
path.join(CWD, '.claude-flow', 'memory.db'),
|
|
425
437
|
path.join(CWD, '.claude', 'memory.db'),
|
|
426
438
|
path.join(CWD, 'data', 'memory.db'),
|
|
@@ -438,6 +450,7 @@ function getAgentDBStats() {
|
|
|
438
450
|
|
|
439
451
|
if (vectorCount === 0) {
|
|
440
452
|
const dbDirs = [
|
|
453
|
+
path.join(CWD, '.opencode', 'agentdb'),
|
|
441
454
|
path.join(CWD, '.claude-flow', 'agentdb'),
|
|
442
455
|
path.join(CWD, '.swarm', 'agentdb'),
|
|
443
456
|
path.join(CWD, '.agentdb'),
|
|
@@ -459,6 +472,7 @@ function getAgentDBStats() {
|
|
|
459
472
|
}
|
|
460
473
|
|
|
461
474
|
const hnswPaths = [
|
|
475
|
+
path.join(CWD, '.opencode', 'hnsw.index'),
|
|
462
476
|
path.join(CWD, '.swarm', 'hnsw.index'),
|
|
463
477
|
path.join(CWD, '.claude-flow', 'hnsw.index'),
|
|
464
478
|
];
|
|
@@ -520,7 +534,9 @@ function getIntegrationStatus() {
|
|
|
520
534
|
}
|
|
521
535
|
|
|
522
536
|
if (mcpServers.total === 0) {
|
|
523
|
-
const mcpConfig = readJSON(path.join(CWD, '.
|
|
537
|
+
const mcpConfig = readJSON(path.join(CWD, 'opencode.json'))
|
|
538
|
+
|| readJSON(path.join(CWD, '.mcp.json'))
|
|
539
|
+
|| readJSON(path.join(os.homedir(), '.opencode', 'mcp.json'))
|
|
524
540
|
|| readJSON(path.join(os.homedir(), '.claude', 'mcp.json'));
|
|
525
541
|
if (mcpConfig && mcpConfig.mcpServers) {
|
|
526
542
|
const s = Object.keys(mcpConfig.mcpServers);
|
|
@@ -529,7 +545,7 @@ function getIntegrationStatus() {
|
|
|
529
545
|
}
|
|
530
546
|
}
|
|
531
547
|
|
|
532
|
-
const hasDatabase = ['.swarm/memory.db', '.claude-flow/memory.db', 'data/memory.db']
|
|
548
|
+
const hasDatabase = ['.opencode/memory.db', '.swarm/memory.db', '.claude-flow/memory.db', 'data/memory.db']
|
|
533
549
|
.some(p => fs.existsSync(path.join(CWD, p)));
|
|
534
550
|
const hasApi = !!(process.env.ANTHROPIC_API_KEY || process.env.OPENAI_API_KEY);
|
|
535
551
|
|
|
@@ -538,7 +554,7 @@ function getIntegrationStatus() {
|
|
|
538
554
|
|
|
539
555
|
// Session stats (pure file reads)
|
|
540
556
|
function getSessionStats() {
|
|
541
|
-
var sessionPaths = ['.claude-flow/session.json', '.claude/session.json'];
|
|
557
|
+
var sessionPaths = ['.opencode/session.json', '.claude-flow/session.json', '.claude/session.json'];
|
|
542
558
|
for (var i = 0; i < sessionPaths.length; i++) {
|
|
543
559
|
const data = readJSON(path.join(CWD, sessionPaths[i]));
|
|
544
560
|
if (data && data.startTime) {
|
|
@@ -578,7 +594,7 @@ function generateStatusline() {
|
|
|
578
594
|
const lines = [];
|
|
579
595
|
|
|
580
596
|
// Header
|
|
581
|
-
let header = c.bold + c.brightPurple + '\\u258A
|
|
597
|
+
let header = c.bold + c.brightPurple + '\\u258A OpenCode V3 ' + c.reset;
|
|
582
598
|
header += (swarm.coordinationActive ? c.brightCyan : c.dim) + '\\u25CF ' + c.brightCyan + git.name + c.reset;
|
|
583
599
|
if (git.gitBranch) {
|
|
584
600
|
header += ' ' + c.dim + '\\u2502' + c.reset + ' ' + c.brightBlue + '\\u23C7 ' + git.gitBranch + c.reset;
|
|
@@ -789,28 +805,28 @@ export function generateStatuslineHook(options) {
|
|
|
789
805
|
return '#!/bin/bash\n# Statusline disabled\n';
|
|
790
806
|
}
|
|
791
807
|
return `#!/bin/bash
|
|
792
|
-
#
|
|
808
|
+
# OpenCode Orchestrator V3 Statusline Hook
|
|
793
809
|
# Source this in your .bashrc/.zshrc for terminal statusline
|
|
794
810
|
|
|
795
811
|
# Function to get statusline
|
|
796
|
-
|
|
797
|
-
local statusline_script="\${
|
|
812
|
+
opencode_statusline() {
|
|
813
|
+
local statusline_script="\${OPENCODE_DIR:-.opencode}/helpers/statusline.cjs"
|
|
798
814
|
if [ -f "$statusline_script" ]; then
|
|
799
815
|
node "$statusline_script" 2>/dev/null || echo ""
|
|
800
816
|
fi
|
|
801
817
|
}
|
|
802
818
|
|
|
803
819
|
# Bash: Add to PS1
|
|
804
|
-
# export PS1='$(
|
|
820
|
+
# export PS1='$(opencode_statusline) \\n\\$ '
|
|
805
821
|
|
|
806
822
|
# Zsh: Add to RPROMPT
|
|
807
|
-
# export RPROMPT='$(
|
|
823
|
+
# export RPROMPT='$(opencode_statusline)'
|
|
808
824
|
|
|
809
|
-
#
|
|
825
|
+
# OpenCode: Add to opencode.json
|
|
810
826
|
# "statusLine": {
|
|
811
827
|
# "type": "command",
|
|
812
|
-
# "command": "node .
|
|
813
|
-
# "when": "test -f .
|
|
828
|
+
# "command": "node .opencode/helpers/statusline.cjs 2>/dev/null"
|
|
829
|
+
# "when": "test -f .opencode/helpers/statusline.cjs"
|
|
814
830
|
# }
|
|
815
831
|
`;
|
|
816
832
|
}
|
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
* Components that can be initialized
|
|
7
7
|
*/
|
|
8
8
|
export interface InitComponents {
|
|
9
|
-
/** Create .
|
|
9
|
+
/** Create .opencode/settings.json with hooks */
|
|
10
10
|
settings: boolean;
|
|
11
|
-
/** Copy skills to .
|
|
11
|
+
/** Copy skills to .opencode/skills/ */
|
|
12
12
|
skills: boolean;
|
|
13
|
-
/** Copy commands to .
|
|
13
|
+
/** Copy commands to .opencode/commands/ */
|
|
14
14
|
commands: boolean;
|
|
15
|
-
/** Copy agents to .
|
|
15
|
+
/** Copy agents to .opencode/agents/ */
|
|
16
16
|
agents: boolean;
|
|
17
|
-
/** Create helper scripts in .
|
|
17
|
+
/** Create helper scripts in .opencode/helpers/ */
|
|
18
18
|
helpers: boolean;
|
|
19
19
|
/** Configure statusline */
|
|
20
20
|
statusline: boolean;
|
|
@@ -22,8 +22,8 @@ export interface InitComponents {
|
|
|
22
22
|
mcp: boolean;
|
|
23
23
|
/** Create .claude-flow/ directory (V3 runtime) */
|
|
24
24
|
runtime: boolean;
|
|
25
|
-
/** Create
|
|
26
|
-
|
|
25
|
+
/** Create SKILL.md with swarm guidance */
|
|
26
|
+
opencodeMd: boolean;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Hook configuration options
|
|
@@ -173,11 +173,15 @@ export interface RuntimeConfig {
|
|
|
173
173
|
enableMemoryGraph?: boolean;
|
|
174
174
|
/** Enable AgentMemoryScope (ADR-049) - 3-scope agent memory */
|
|
175
175
|
enableAgentScopes?: boolean;
|
|
176
|
-
/**
|
|
177
|
-
|
|
176
|
+
/** SKILL.md template variant */
|
|
177
|
+
opencodeMdTemplate?: SkillMdTemplate;
|
|
178
|
+
/** Enable ruv-swarm MCP server */
|
|
179
|
+
swarm?: boolean;
|
|
180
|
+
/** Enable flow-nexus MCP server */
|
|
181
|
+
flowNexus?: boolean;
|
|
178
182
|
}
|
|
179
183
|
/** Template variants for generated CLAUDE.md files */
|
|
180
|
-
export type
|
|
184
|
+
export type SkillMdTemplate = 'minimal' | 'standard' | 'full' | 'security' | 'performance' | 'solo';
|
|
181
185
|
/**
|
|
182
186
|
* Embeddings configuration
|
|
183
187
|
*/
|
|
@@ -55,7 +55,7 @@ export const DEFAULT_INIT_OPTIONS = {
|
|
|
55
55
|
statusline: true,
|
|
56
56
|
mcp: true,
|
|
57
57
|
runtime: true,
|
|
58
|
-
|
|
58
|
+
opencodeMd: true,
|
|
59
59
|
},
|
|
60
60
|
hooks: {
|
|
61
61
|
preToolUse: true,
|
|
@@ -151,7 +151,7 @@ export const MINIMAL_INIT_OPTIONS = {
|
|
|
151
151
|
statusline: false,
|
|
152
152
|
mcp: true,
|
|
153
153
|
runtime: true,
|
|
154
|
-
|
|
154
|
+
opencodeMd: true,
|
|
155
155
|
},
|
|
156
156
|
hooks: {
|
|
157
157
|
...DEFAULT_INIT_OPTIONS.hooks,
|
|
@@ -215,7 +215,7 @@ export const FULL_INIT_OPTIONS = {
|
|
|
215
215
|
statusline: true,
|
|
216
216
|
mcp: true,
|
|
217
217
|
runtime: true,
|
|
218
|
-
|
|
218
|
+
opencodeMd: true,
|
|
219
219
|
},
|
|
220
220
|
skills: {
|
|
221
221
|
core: true,
|