@claude-flow/codex 3.0.0-alpha.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/README.md +301 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +649 -0
- package/dist/cli.js.map +1 -0
- package/dist/generators/agents-md.d.ts +12 -0
- package/dist/generators/agents-md.d.ts.map +1 -0
- package/dist/generators/agents-md.js +641 -0
- package/dist/generators/agents-md.js.map +1 -0
- package/dist/generators/config-toml.d.ts +74 -0
- package/dist/generators/config-toml.d.ts.map +1 -0
- package/dist/generators/config-toml.js +910 -0
- package/dist/generators/config-toml.js.map +1 -0
- package/dist/generators/index.d.ts +9 -0
- package/dist/generators/index.d.ts.map +1 -0
- package/dist/generators/index.js +9 -0
- package/dist/generators/index.js.map +1 -0
- package/dist/generators/skill-md.d.ts +20 -0
- package/dist/generators/skill-md.d.ts.map +1 -0
- package/dist/generators/skill-md.js +946 -0
- package/dist/generators/skill-md.js.map +1 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -0
- package/dist/initializer.d.ts +87 -0
- package/dist/initializer.d.ts.map +1 -0
- package/dist/initializer.js +666 -0
- package/dist/initializer.js.map +1 -0
- package/dist/migrations/index.d.ts +114 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +856 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/templates/index.d.ts +92 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +284 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/types.d.ts +218 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/dist/validators/index.d.ts +42 -0
- package/dist/validators/index.d.ts.map +1 -0
- package/dist/validators/index.js +929 -0
- package/dist/validators/index.js.map +1 -0
- package/package.json +88 -0
|
@@ -0,0 +1,910 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @claude-flow/codex - config.toml Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates Codex CLI configuration files in TOML format
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Generate a config.toml file based on the provided options
|
|
8
|
+
*/
|
|
9
|
+
export async function generateConfigToml(options = {}) {
|
|
10
|
+
const { model = 'gpt-5.3-codex', approvalPolicy = 'on-request', sandboxMode = 'workspace-write', webSearch = 'cached', projectDocMaxBytes = 65536, features = {}, mcpServers = [], skills = [], profiles = {}, historyPersistence = 'save-all', security = {}, performance = {}, logging = {}, } = options;
|
|
11
|
+
const lines = [];
|
|
12
|
+
// Header
|
|
13
|
+
lines.push('# =============================================================================');
|
|
14
|
+
lines.push('# Claude Flow V3 - Codex Configuration');
|
|
15
|
+
lines.push('# =============================================================================');
|
|
16
|
+
lines.push('# Generated by: @claude-flow/codex');
|
|
17
|
+
lines.push('# Documentation: https://github.com/ruvnet/claude-flow');
|
|
18
|
+
lines.push('# ');
|
|
19
|
+
lines.push('# This file configures the Codex CLI for Claude Flow integration.');
|
|
20
|
+
lines.push('# Place in .agents/config.toml (project) or .codex/config.toml (user).');
|
|
21
|
+
lines.push('# =============================================================================');
|
|
22
|
+
lines.push('');
|
|
23
|
+
lines.push('# =============================================================================');
|
|
24
|
+
lines.push('# Core Settings');
|
|
25
|
+
lines.push('# =============================================================================');
|
|
26
|
+
lines.push('');
|
|
27
|
+
lines.push('# Model selection - the AI model to use for code generation');
|
|
28
|
+
lines.push('# Options: gpt-5.3-codex, gpt-4o, claude-sonnet, claude-opus');
|
|
29
|
+
lines.push(`model = "${model}"`);
|
|
30
|
+
lines.push('');
|
|
31
|
+
lines.push('# Approval policy determines when human approval is required');
|
|
32
|
+
lines.push('# - untrusted: Always require approval');
|
|
33
|
+
lines.push('# - on-failure: Require approval only after failures');
|
|
34
|
+
lines.push('# - on-request: Require approval for significant changes');
|
|
35
|
+
lines.push('# - never: Auto-approve all actions (use with caution)');
|
|
36
|
+
lines.push(`approval_policy = "${approvalPolicy}"`);
|
|
37
|
+
lines.push('');
|
|
38
|
+
lines.push('# Sandbox mode controls file system access');
|
|
39
|
+
lines.push('# - read-only: Can only read files, no modifications');
|
|
40
|
+
lines.push('# - workspace-write: Can write within workspace directory');
|
|
41
|
+
lines.push('# - danger-full-access: Full file system access (dangerous)');
|
|
42
|
+
lines.push(`sandbox_mode = "${sandboxMode}"`);
|
|
43
|
+
lines.push('');
|
|
44
|
+
lines.push('# Web search enables internet access for research');
|
|
45
|
+
lines.push('# - disabled: No web access');
|
|
46
|
+
lines.push('# - cached: Use cached results when available');
|
|
47
|
+
lines.push('# - live: Always fetch fresh results');
|
|
48
|
+
lines.push(`web_search = "${webSearch}"`);
|
|
49
|
+
lines.push('');
|
|
50
|
+
// Project Documentation
|
|
51
|
+
lines.push('# =============================================================================');
|
|
52
|
+
lines.push('# Project Documentation');
|
|
53
|
+
lines.push('# =============================================================================');
|
|
54
|
+
lines.push('');
|
|
55
|
+
lines.push('# Maximum bytes to read from AGENTS.md files');
|
|
56
|
+
lines.push(`project_doc_max_bytes = ${projectDocMaxBytes}`);
|
|
57
|
+
lines.push('');
|
|
58
|
+
lines.push('# Fallback filenames if AGENTS.md not found');
|
|
59
|
+
lines.push('project_doc_fallback_filenames = [');
|
|
60
|
+
lines.push(' "AGENTS.md",');
|
|
61
|
+
lines.push(' "TEAM_GUIDE.md",');
|
|
62
|
+
lines.push(' ".agents.md"');
|
|
63
|
+
lines.push(']');
|
|
64
|
+
lines.push('');
|
|
65
|
+
// Features
|
|
66
|
+
lines.push('# =============================================================================');
|
|
67
|
+
lines.push('# Features');
|
|
68
|
+
lines.push('# =============================================================================');
|
|
69
|
+
lines.push('');
|
|
70
|
+
lines.push('[features]');
|
|
71
|
+
lines.push('# Enable child AGENTS.md guidance');
|
|
72
|
+
lines.push(`child_agents_md = ${features.childAgentsMd ?? true}`);
|
|
73
|
+
lines.push('');
|
|
74
|
+
lines.push('# Cache shell environment for faster repeated commands');
|
|
75
|
+
lines.push(`shell_snapshot = ${features.shellSnapshot ?? true}`);
|
|
76
|
+
lines.push('');
|
|
77
|
+
lines.push('# Smart approvals based on request context');
|
|
78
|
+
lines.push(`request_rule = ${features.requestRule ?? true}`);
|
|
79
|
+
lines.push('');
|
|
80
|
+
lines.push('# Enable remote compaction for large histories');
|
|
81
|
+
lines.push(`remote_compaction = ${features.remoteCompaction ?? true}`);
|
|
82
|
+
lines.push('');
|
|
83
|
+
// MCP Servers
|
|
84
|
+
if (mcpServers.length > 0 || true) { // Always include claude-flow by default
|
|
85
|
+
lines.push('# =============================================================================');
|
|
86
|
+
lines.push('# MCP Servers');
|
|
87
|
+
lines.push('# =============================================================================');
|
|
88
|
+
lines.push('');
|
|
89
|
+
// Default claude-flow server
|
|
90
|
+
const hasClaudeFlow = mcpServers.some(s => s.name === 'claude-flow');
|
|
91
|
+
if (!hasClaudeFlow) {
|
|
92
|
+
lines.push(...generateMcpServer({
|
|
93
|
+
name: 'claude-flow',
|
|
94
|
+
command: 'npx',
|
|
95
|
+
args: ['-y', '@claude-flow/cli@latest'],
|
|
96
|
+
enabled: true,
|
|
97
|
+
toolTimeout: 120,
|
|
98
|
+
}));
|
|
99
|
+
lines.push('');
|
|
100
|
+
}
|
|
101
|
+
for (const server of mcpServers) {
|
|
102
|
+
lines.push(...generateMcpServer(server));
|
|
103
|
+
lines.push('');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// Skills Configuration
|
|
107
|
+
if (skills.length > 0) {
|
|
108
|
+
lines.push('# =============================================================================');
|
|
109
|
+
lines.push('# Skills Configuration');
|
|
110
|
+
lines.push('# =============================================================================');
|
|
111
|
+
lines.push('');
|
|
112
|
+
for (const skill of skills) {
|
|
113
|
+
lines.push(...generateSkillConfig(skill));
|
|
114
|
+
lines.push('');
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// Profiles
|
|
118
|
+
lines.push('# =============================================================================');
|
|
119
|
+
lines.push('# Profiles');
|
|
120
|
+
lines.push('# =============================================================================');
|
|
121
|
+
lines.push('');
|
|
122
|
+
// Default profiles
|
|
123
|
+
const defaultProfiles = {
|
|
124
|
+
dev: {
|
|
125
|
+
approvalPolicy: 'never',
|
|
126
|
+
sandboxMode: 'danger-full-access',
|
|
127
|
+
webSearch: 'live',
|
|
128
|
+
},
|
|
129
|
+
safe: {
|
|
130
|
+
approvalPolicy: 'untrusted',
|
|
131
|
+
sandboxMode: 'read-only',
|
|
132
|
+
webSearch: 'disabled',
|
|
133
|
+
},
|
|
134
|
+
ci: {
|
|
135
|
+
approvalPolicy: 'never',
|
|
136
|
+
sandboxMode: 'workspace-write',
|
|
137
|
+
webSearch: 'cached',
|
|
138
|
+
},
|
|
139
|
+
...profiles,
|
|
140
|
+
};
|
|
141
|
+
for (const [name, profile] of Object.entries(defaultProfiles)) {
|
|
142
|
+
lines.push(...generateProfile(name, profile));
|
|
143
|
+
lines.push('');
|
|
144
|
+
}
|
|
145
|
+
// History
|
|
146
|
+
lines.push('# =============================================================================');
|
|
147
|
+
lines.push('# History');
|
|
148
|
+
lines.push('# =============================================================================');
|
|
149
|
+
lines.push('');
|
|
150
|
+
lines.push('[history]');
|
|
151
|
+
lines.push('# Save all session transcripts');
|
|
152
|
+
lines.push(`persistence = "${historyPersistence}"`);
|
|
153
|
+
lines.push('');
|
|
154
|
+
// Shell Environment Policy
|
|
155
|
+
lines.push('# =============================================================================');
|
|
156
|
+
lines.push('# Shell Environment');
|
|
157
|
+
lines.push('# =============================================================================');
|
|
158
|
+
lines.push('');
|
|
159
|
+
lines.push('[shell_environment_policy]');
|
|
160
|
+
lines.push('# Inherit environment variables');
|
|
161
|
+
lines.push('inherit = "core"');
|
|
162
|
+
lines.push('');
|
|
163
|
+
lines.push('# Exclude sensitive variables');
|
|
164
|
+
lines.push('exclude = ["*_KEY", "*_SECRET", "*_TOKEN", "*_PASSWORD"]');
|
|
165
|
+
lines.push('');
|
|
166
|
+
// Sandbox Workspace Write Settings
|
|
167
|
+
lines.push('# =============================================================================');
|
|
168
|
+
lines.push('# Sandbox Workspace Write Settings');
|
|
169
|
+
lines.push('# =============================================================================');
|
|
170
|
+
lines.push('');
|
|
171
|
+
lines.push('[sandbox_workspace_write]');
|
|
172
|
+
lines.push('# Additional writable paths beyond workspace');
|
|
173
|
+
lines.push('writable_roots = []');
|
|
174
|
+
lines.push('');
|
|
175
|
+
lines.push('# Allow network access');
|
|
176
|
+
lines.push('network_access = true');
|
|
177
|
+
lines.push('');
|
|
178
|
+
lines.push('# Exclude temp directories');
|
|
179
|
+
lines.push('exclude_slash_tmp = false');
|
|
180
|
+
lines.push('');
|
|
181
|
+
// Security Settings
|
|
182
|
+
lines.push('# =============================================================================');
|
|
183
|
+
lines.push('# Security Settings');
|
|
184
|
+
lines.push('# =============================================================================');
|
|
185
|
+
lines.push('');
|
|
186
|
+
lines.push('[security]');
|
|
187
|
+
lines.push('# Enable input validation for all user inputs');
|
|
188
|
+
lines.push(`input_validation = ${security.inputValidation ?? true}`);
|
|
189
|
+
lines.push('');
|
|
190
|
+
lines.push('# Prevent directory traversal attacks');
|
|
191
|
+
lines.push(`path_traversal_prevention = ${security.pathTraversal ?? true}`);
|
|
192
|
+
lines.push('');
|
|
193
|
+
lines.push('# Scan for hardcoded secrets');
|
|
194
|
+
lines.push(`secret_scanning = ${security.secretScanning ?? true}`);
|
|
195
|
+
lines.push('');
|
|
196
|
+
lines.push('# Scan dependencies for known CVEs');
|
|
197
|
+
lines.push(`cve_scanning = ${security.cveScanning ?? true}`);
|
|
198
|
+
lines.push('');
|
|
199
|
+
lines.push('# Maximum file size for operations (bytes)');
|
|
200
|
+
lines.push(`max_file_size = ${security.maxFileSize ?? 10485760}`);
|
|
201
|
+
lines.push('');
|
|
202
|
+
lines.push('# Allowed file extensions (empty = allow all)');
|
|
203
|
+
const allowedExts = security.allowedExtensions ?? [];
|
|
204
|
+
if (allowedExts.length > 0) {
|
|
205
|
+
lines.push(`allowed_extensions = [${allowedExts.map((e) => `"${e}"`).join(', ')}]`);
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
lines.push('allowed_extensions = []');
|
|
209
|
+
}
|
|
210
|
+
lines.push('');
|
|
211
|
+
lines.push('# Blocked file patterns (regex)');
|
|
212
|
+
const blockedPatterns = security.blockedPatterns ?? ['\\.env$', 'credentials\\.json$', '\\.pem$', '\\.key$'];
|
|
213
|
+
lines.push(`blocked_patterns = [${blockedPatterns.map((p) => `"${escapeTomlString(p)}"`).join(', ')}]`);
|
|
214
|
+
lines.push('');
|
|
215
|
+
// Performance Settings
|
|
216
|
+
lines.push('# =============================================================================');
|
|
217
|
+
lines.push('# Performance Settings');
|
|
218
|
+
lines.push('# =============================================================================');
|
|
219
|
+
lines.push('');
|
|
220
|
+
lines.push('[performance]');
|
|
221
|
+
lines.push('# Maximum concurrent agents');
|
|
222
|
+
lines.push(`max_agents = ${performance.maxAgents ?? 8}`);
|
|
223
|
+
lines.push('');
|
|
224
|
+
lines.push('# Task timeout in seconds');
|
|
225
|
+
lines.push(`task_timeout = ${performance.taskTimeout ?? 300}`);
|
|
226
|
+
lines.push('');
|
|
227
|
+
lines.push('# Memory limit per agent');
|
|
228
|
+
lines.push(`memory_limit = "${performance.memoryLimit ?? '512MB'}"`);
|
|
229
|
+
lines.push('');
|
|
230
|
+
lines.push('# Enable response caching');
|
|
231
|
+
lines.push(`cache_enabled = ${performance.cacheEnabled ?? true}`);
|
|
232
|
+
lines.push('');
|
|
233
|
+
lines.push('# Cache TTL in seconds');
|
|
234
|
+
lines.push(`cache_ttl = ${performance.cacheTtl ?? 3600}`);
|
|
235
|
+
lines.push('');
|
|
236
|
+
lines.push('# Enable parallel task execution');
|
|
237
|
+
lines.push(`parallel_execution = ${performance.parallelExecution ?? true}`);
|
|
238
|
+
lines.push('');
|
|
239
|
+
// Logging Settings
|
|
240
|
+
lines.push('# =============================================================================');
|
|
241
|
+
lines.push('# Logging Settings');
|
|
242
|
+
lines.push('# =============================================================================');
|
|
243
|
+
lines.push('');
|
|
244
|
+
lines.push('[logging]');
|
|
245
|
+
lines.push('# Log level: debug, info, warn, error');
|
|
246
|
+
lines.push(`level = "${logging.level ?? 'info'}"`);
|
|
247
|
+
lines.push('');
|
|
248
|
+
lines.push('# Log format: json, text, pretty');
|
|
249
|
+
lines.push(`format = "${logging.format ?? 'pretty'}"`);
|
|
250
|
+
lines.push('');
|
|
251
|
+
lines.push('# Log destination: stdout, file, both');
|
|
252
|
+
lines.push(`destination = "${logging.destination ?? 'stdout'}"`);
|
|
253
|
+
lines.push('');
|
|
254
|
+
if (logging.filePath || logging.destination === 'file' || logging.destination === 'both') {
|
|
255
|
+
lines.push('# Log file path');
|
|
256
|
+
lines.push(`file_path = "${logging.filePath ?? './logs/claude-flow.log'}"`);
|
|
257
|
+
lines.push('');
|
|
258
|
+
lines.push('# Maximum number of log files to retain');
|
|
259
|
+
lines.push(`max_files = ${logging.maxFiles ?? 10}`);
|
|
260
|
+
lines.push('');
|
|
261
|
+
lines.push('# Maximum size per log file');
|
|
262
|
+
lines.push(`max_size = "${logging.maxSize ?? '10MB'}"`);
|
|
263
|
+
lines.push('');
|
|
264
|
+
}
|
|
265
|
+
// Neural/Intelligence Settings
|
|
266
|
+
lines.push('# =============================================================================');
|
|
267
|
+
lines.push('# Neural Intelligence Settings');
|
|
268
|
+
lines.push('# =============================================================================');
|
|
269
|
+
lines.push('');
|
|
270
|
+
lines.push('[neural]');
|
|
271
|
+
lines.push('# Enable SONA (Self-Optimizing Neural Architecture)');
|
|
272
|
+
lines.push('sona_enabled = true');
|
|
273
|
+
lines.push('');
|
|
274
|
+
lines.push('# Enable HNSW vector search');
|
|
275
|
+
lines.push('hnsw_enabled = true');
|
|
276
|
+
lines.push('');
|
|
277
|
+
lines.push('# HNSW index parameters');
|
|
278
|
+
lines.push('hnsw_m = 16');
|
|
279
|
+
lines.push('hnsw_ef_construction = 200');
|
|
280
|
+
lines.push('hnsw_ef_search = 100');
|
|
281
|
+
lines.push('');
|
|
282
|
+
lines.push('# Enable pattern learning');
|
|
283
|
+
lines.push('pattern_learning = true');
|
|
284
|
+
lines.push('');
|
|
285
|
+
lines.push('# Learning rate for neural adaptation');
|
|
286
|
+
lines.push('learning_rate = 0.01');
|
|
287
|
+
lines.push('');
|
|
288
|
+
// Swarm Settings
|
|
289
|
+
lines.push('# =============================================================================');
|
|
290
|
+
lines.push('# Swarm Orchestration Settings');
|
|
291
|
+
lines.push('# =============================================================================');
|
|
292
|
+
lines.push('');
|
|
293
|
+
lines.push('[swarm]');
|
|
294
|
+
lines.push('# Default topology: hierarchical, mesh, ring, star');
|
|
295
|
+
lines.push('default_topology = "hierarchical"');
|
|
296
|
+
lines.push('');
|
|
297
|
+
lines.push('# Default strategy: balanced, specialized, adaptive');
|
|
298
|
+
lines.push('default_strategy = "specialized"');
|
|
299
|
+
lines.push('');
|
|
300
|
+
lines.push('# Consensus algorithm: raft, byzantine, gossip');
|
|
301
|
+
lines.push('consensus = "raft"');
|
|
302
|
+
lines.push('');
|
|
303
|
+
lines.push('# Enable anti-drift measures');
|
|
304
|
+
lines.push('anti_drift = true');
|
|
305
|
+
lines.push('');
|
|
306
|
+
lines.push('# Checkpoint interval (tasks)');
|
|
307
|
+
lines.push('checkpoint_interval = 10');
|
|
308
|
+
lines.push('');
|
|
309
|
+
// Hooks Settings
|
|
310
|
+
lines.push('# =============================================================================');
|
|
311
|
+
lines.push('# Hooks Configuration');
|
|
312
|
+
lines.push('# =============================================================================');
|
|
313
|
+
lines.push('');
|
|
314
|
+
lines.push('[hooks]');
|
|
315
|
+
lines.push('# Enable lifecycle hooks');
|
|
316
|
+
lines.push('enabled = true');
|
|
317
|
+
lines.push('');
|
|
318
|
+
lines.push('# Pre-task hook');
|
|
319
|
+
lines.push('pre_task = true');
|
|
320
|
+
lines.push('');
|
|
321
|
+
lines.push('# Post-task hook (for learning)');
|
|
322
|
+
lines.push('post_task = true');
|
|
323
|
+
lines.push('');
|
|
324
|
+
lines.push('# Enable neural training on post-edit');
|
|
325
|
+
lines.push('train_on_edit = true');
|
|
326
|
+
lines.push('');
|
|
327
|
+
// Background Workers
|
|
328
|
+
lines.push('# =============================================================================');
|
|
329
|
+
lines.push('# Background Workers');
|
|
330
|
+
lines.push('# =============================================================================');
|
|
331
|
+
lines.push('');
|
|
332
|
+
lines.push('[workers]');
|
|
333
|
+
lines.push('# Enable background workers');
|
|
334
|
+
lines.push('enabled = true');
|
|
335
|
+
lines.push('');
|
|
336
|
+
lines.push('# Worker configuration');
|
|
337
|
+
lines.push('[workers.audit]');
|
|
338
|
+
lines.push('enabled = true');
|
|
339
|
+
lines.push('priority = "critical"');
|
|
340
|
+
lines.push('interval = 300');
|
|
341
|
+
lines.push('');
|
|
342
|
+
lines.push('[workers.optimize]');
|
|
343
|
+
lines.push('enabled = true');
|
|
344
|
+
lines.push('priority = "high"');
|
|
345
|
+
lines.push('interval = 600');
|
|
346
|
+
lines.push('');
|
|
347
|
+
lines.push('[workers.consolidate]');
|
|
348
|
+
lines.push('enabled = true');
|
|
349
|
+
lines.push('priority = "low"');
|
|
350
|
+
lines.push('interval = 1800');
|
|
351
|
+
lines.push('');
|
|
352
|
+
return lines.join('\n');
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Escape special characters in TOML strings
|
|
356
|
+
*/
|
|
357
|
+
function escapeTomlString(str) {
|
|
358
|
+
return str
|
|
359
|
+
.replace(/\\/g, '\\\\')
|
|
360
|
+
.replace(/"/g, '\\"')
|
|
361
|
+
.replace(/\n/g, '\\n')
|
|
362
|
+
.replace(/\r/g, '\\r')
|
|
363
|
+
.replace(/\t/g, '\\t');
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Generate MCP server configuration lines
|
|
367
|
+
*/
|
|
368
|
+
function generateMcpServer(server) {
|
|
369
|
+
const lines = [];
|
|
370
|
+
lines.push(`[mcp_servers.${server.name}]`);
|
|
371
|
+
lines.push(`command = "${server.command}"`);
|
|
372
|
+
if (server.args && server.args.length > 0) {
|
|
373
|
+
const argsStr = server.args.map(a => `"${a}"`).join(', ');
|
|
374
|
+
lines.push(`args = [${argsStr}]`);
|
|
375
|
+
}
|
|
376
|
+
lines.push(`enabled = ${server.enabled ?? true}`);
|
|
377
|
+
if (server.toolTimeout) {
|
|
378
|
+
lines.push(`tool_timeout_sec = ${server.toolTimeout}`);
|
|
379
|
+
}
|
|
380
|
+
if (server.env && Object.keys(server.env).length > 0) {
|
|
381
|
+
lines.push('');
|
|
382
|
+
lines.push(`[mcp_servers.${server.name}.env]`);
|
|
383
|
+
for (const [key, value] of Object.entries(server.env)) {
|
|
384
|
+
lines.push(`${key} = "${value}"`);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
return lines;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Generate skill configuration lines
|
|
391
|
+
*/
|
|
392
|
+
function generateSkillConfig(skill) {
|
|
393
|
+
const lines = [];
|
|
394
|
+
lines.push('[[skills.config]]');
|
|
395
|
+
lines.push(`path = "${skill.path}"`);
|
|
396
|
+
lines.push(`enabled = ${skill.enabled ?? true}`);
|
|
397
|
+
return lines;
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Generate profile configuration lines
|
|
401
|
+
*/
|
|
402
|
+
function generateProfile(name, profile) {
|
|
403
|
+
const lines = [];
|
|
404
|
+
const comment = name === 'dev' ? 'Development profile - more permissive for local work'
|
|
405
|
+
: name === 'safe' ? 'Safe profile - maximum restrictions'
|
|
406
|
+
: name === 'ci' ? 'CI profile - for automated pipelines'
|
|
407
|
+
: `${name} profile`;
|
|
408
|
+
lines.push(`# ${comment}`);
|
|
409
|
+
lines.push(`[profiles.${name}]`);
|
|
410
|
+
if (profile.approvalPolicy) {
|
|
411
|
+
lines.push(`approval_policy = "${profile.approvalPolicy}"`);
|
|
412
|
+
}
|
|
413
|
+
if (profile.sandboxMode) {
|
|
414
|
+
lines.push(`sandbox_mode = "${profile.sandboxMode}"`);
|
|
415
|
+
}
|
|
416
|
+
if (profile.webSearch) {
|
|
417
|
+
lines.push(`web_search = "${profile.webSearch}"`);
|
|
418
|
+
}
|
|
419
|
+
return lines;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Generate minimal config.toml
|
|
423
|
+
*/
|
|
424
|
+
export async function generateMinimalConfigToml(options = {}) {
|
|
425
|
+
const { model = 'gpt-5.3-codex', approvalPolicy = 'on-request', sandboxMode = 'workspace-write', } = options;
|
|
426
|
+
return `# Claude Flow V3 - Minimal Codex Configuration
|
|
427
|
+
|
|
428
|
+
model = "${model}"
|
|
429
|
+
approval_policy = "${approvalPolicy}"
|
|
430
|
+
sandbox_mode = "${sandboxMode}"
|
|
431
|
+
|
|
432
|
+
[mcp_servers.claude-flow]
|
|
433
|
+
command = "npx"
|
|
434
|
+
args = ["-y", "@claude-flow/cli@latest"]
|
|
435
|
+
enabled = true
|
|
436
|
+
`;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Generate CI/CD config.toml
|
|
440
|
+
*/
|
|
441
|
+
export async function generateCIConfigToml() {
|
|
442
|
+
return `# =============================================================================
|
|
443
|
+
# Claude Flow V3 - CI/CD Pipeline Configuration
|
|
444
|
+
# =============================================================================
|
|
445
|
+
# Optimized for automated CI/CD environments
|
|
446
|
+
# No interactive approvals, ephemeral history, minimal overhead
|
|
447
|
+
# =============================================================================
|
|
448
|
+
|
|
449
|
+
model = "gpt-5.3-codex"
|
|
450
|
+
approval_policy = "never"
|
|
451
|
+
sandbox_mode = "workspace-write"
|
|
452
|
+
web_search = "disabled"
|
|
453
|
+
|
|
454
|
+
# Project documentation
|
|
455
|
+
project_doc_max_bytes = 65536
|
|
456
|
+
|
|
457
|
+
[features]
|
|
458
|
+
# Disable interactive features for CI
|
|
459
|
+
shell_snapshot = false
|
|
460
|
+
remote_compaction = false
|
|
461
|
+
child_agents_md = true
|
|
462
|
+
request_rule = false
|
|
463
|
+
|
|
464
|
+
[mcp_servers.claude-flow]
|
|
465
|
+
command = "npx"
|
|
466
|
+
args = ["-y", "@claude-flow/cli@latest"]
|
|
467
|
+
enabled = true
|
|
468
|
+
tool_timeout_sec = 300
|
|
469
|
+
|
|
470
|
+
[history]
|
|
471
|
+
persistence = "none"
|
|
472
|
+
|
|
473
|
+
[shell_environment_policy]
|
|
474
|
+
inherit = "core"
|
|
475
|
+
exclude = ["*_KEY", "*_SECRET", "*_TOKEN", "*_PASSWORD", "CI_*"]
|
|
476
|
+
|
|
477
|
+
[security]
|
|
478
|
+
input_validation = true
|
|
479
|
+
path_traversal_prevention = true
|
|
480
|
+
secret_scanning = true
|
|
481
|
+
cve_scanning = true
|
|
482
|
+
|
|
483
|
+
[performance]
|
|
484
|
+
max_agents = 4
|
|
485
|
+
task_timeout = 600
|
|
486
|
+
cache_enabled = false
|
|
487
|
+
parallel_execution = true
|
|
488
|
+
|
|
489
|
+
[logging]
|
|
490
|
+
level = "info"
|
|
491
|
+
format = "json"
|
|
492
|
+
destination = "stdout"
|
|
493
|
+
|
|
494
|
+
[swarm]
|
|
495
|
+
default_topology = "hierarchical"
|
|
496
|
+
default_strategy = "specialized"
|
|
497
|
+
anti_drift = true
|
|
498
|
+
|
|
499
|
+
[hooks]
|
|
500
|
+
enabled = true
|
|
501
|
+
pre_task = true
|
|
502
|
+
post_task = false
|
|
503
|
+
train_on_edit = false
|
|
504
|
+
`;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Generate enterprise config.toml with full governance
|
|
508
|
+
*/
|
|
509
|
+
export async function generateEnterpriseConfigToml() {
|
|
510
|
+
return `# =============================================================================
|
|
511
|
+
# Claude Flow V3 - Enterprise Configuration
|
|
512
|
+
# =============================================================================
|
|
513
|
+
# Full governance, audit logging, and compliance features enabled
|
|
514
|
+
# Suitable for enterprise environments with strict security requirements
|
|
515
|
+
# =============================================================================
|
|
516
|
+
|
|
517
|
+
model = "gpt-5.3-codex"
|
|
518
|
+
approval_policy = "on-request"
|
|
519
|
+
sandbox_mode = "workspace-write"
|
|
520
|
+
web_search = "cached"
|
|
521
|
+
|
|
522
|
+
# Project documentation
|
|
523
|
+
project_doc_max_bytes = 131072
|
|
524
|
+
project_doc_fallback_filenames = [
|
|
525
|
+
"AGENTS.md",
|
|
526
|
+
"TEAM_GUIDE.md",
|
|
527
|
+
".agents.md",
|
|
528
|
+
"CONTRIBUTING.md"
|
|
529
|
+
]
|
|
530
|
+
|
|
531
|
+
[features]
|
|
532
|
+
child_agents_md = true
|
|
533
|
+
shell_snapshot = true
|
|
534
|
+
request_rule = true
|
|
535
|
+
remote_compaction = true
|
|
536
|
+
|
|
537
|
+
# =============================================================================
|
|
538
|
+
# MCP Servers
|
|
539
|
+
# =============================================================================
|
|
540
|
+
|
|
541
|
+
[mcp_servers.claude-flow]
|
|
542
|
+
command = "npx"
|
|
543
|
+
args = ["-y", "@claude-flow/cli@latest"]
|
|
544
|
+
enabled = true
|
|
545
|
+
tool_timeout_sec = 120
|
|
546
|
+
|
|
547
|
+
[mcp_servers.claude-flow.env]
|
|
548
|
+
CLAUDE_FLOW_LOG_LEVEL = "info"
|
|
549
|
+
|
|
550
|
+
# =============================================================================
|
|
551
|
+
# Profiles
|
|
552
|
+
# =============================================================================
|
|
553
|
+
|
|
554
|
+
# Development profile - more permissive for local work
|
|
555
|
+
[profiles.dev]
|
|
556
|
+
approval_policy = "never"
|
|
557
|
+
sandbox_mode = "danger-full-access"
|
|
558
|
+
web_search = "live"
|
|
559
|
+
|
|
560
|
+
# Safe profile - maximum restrictions
|
|
561
|
+
[profiles.safe]
|
|
562
|
+
approval_policy = "untrusted"
|
|
563
|
+
sandbox_mode = "read-only"
|
|
564
|
+
web_search = "disabled"
|
|
565
|
+
|
|
566
|
+
# CI profile - for automated pipelines
|
|
567
|
+
[profiles.ci]
|
|
568
|
+
approval_policy = "never"
|
|
569
|
+
sandbox_mode = "workspace-write"
|
|
570
|
+
web_search = "disabled"
|
|
571
|
+
|
|
572
|
+
# Production profile - careful changes only
|
|
573
|
+
[profiles.production]
|
|
574
|
+
approval_policy = "untrusted"
|
|
575
|
+
sandbox_mode = "workspace-write"
|
|
576
|
+
web_search = "cached"
|
|
577
|
+
|
|
578
|
+
# =============================================================================
|
|
579
|
+
# History
|
|
580
|
+
# =============================================================================
|
|
581
|
+
|
|
582
|
+
[history]
|
|
583
|
+
persistence = "save-all"
|
|
584
|
+
retention_days = 90
|
|
585
|
+
audit_log = true
|
|
586
|
+
|
|
587
|
+
# =============================================================================
|
|
588
|
+
# Shell Environment
|
|
589
|
+
# =============================================================================
|
|
590
|
+
|
|
591
|
+
[shell_environment_policy]
|
|
592
|
+
inherit = "core"
|
|
593
|
+
exclude = ["*_KEY", "*_SECRET", "*_TOKEN", "*_PASSWORD", "AWS_*", "AZURE_*"]
|
|
594
|
+
|
|
595
|
+
[sandbox_workspace_write]
|
|
596
|
+
writable_roots = []
|
|
597
|
+
network_access = true
|
|
598
|
+
exclude_slash_tmp = false
|
|
599
|
+
|
|
600
|
+
# =============================================================================
|
|
601
|
+
# Security (Enterprise)
|
|
602
|
+
# =============================================================================
|
|
603
|
+
|
|
604
|
+
[security]
|
|
605
|
+
input_validation = true
|
|
606
|
+
path_traversal_prevention = true
|
|
607
|
+
secret_scanning = true
|
|
608
|
+
cve_scanning = true
|
|
609
|
+
max_file_size = 10485760
|
|
610
|
+
blocked_patterns = ["\\\\.env$", "credentials\\\\.json$", "\\\\.pem$", "\\\\.key$", "secrets\\\\.yaml$"]
|
|
611
|
+
|
|
612
|
+
# RBAC configuration
|
|
613
|
+
[security.rbac]
|
|
614
|
+
enabled = true
|
|
615
|
+
default_role = "developer"
|
|
616
|
+
|
|
617
|
+
# Audit configuration
|
|
618
|
+
[security.audit]
|
|
619
|
+
enabled = true
|
|
620
|
+
destination = "file"
|
|
621
|
+
file_path = "./logs/audit.json"
|
|
622
|
+
retention_days = 90
|
|
623
|
+
|
|
624
|
+
# =============================================================================
|
|
625
|
+
# Performance
|
|
626
|
+
# =============================================================================
|
|
627
|
+
|
|
628
|
+
[performance]
|
|
629
|
+
max_agents = 8
|
|
630
|
+
task_timeout = 300
|
|
631
|
+
memory_limit = "1GB"
|
|
632
|
+
cache_enabled = true
|
|
633
|
+
cache_ttl = 3600
|
|
634
|
+
parallel_execution = true
|
|
635
|
+
|
|
636
|
+
# =============================================================================
|
|
637
|
+
# Logging (Enterprise)
|
|
638
|
+
# =============================================================================
|
|
639
|
+
|
|
640
|
+
[logging]
|
|
641
|
+
level = "info"
|
|
642
|
+
format = "json"
|
|
643
|
+
destination = "both"
|
|
644
|
+
file_path = "./logs/claude-flow.log"
|
|
645
|
+
max_files = 30
|
|
646
|
+
max_size = "50MB"
|
|
647
|
+
|
|
648
|
+
# =============================================================================
|
|
649
|
+
# Neural Intelligence
|
|
650
|
+
# =============================================================================
|
|
651
|
+
|
|
652
|
+
[neural]
|
|
653
|
+
sona_enabled = true
|
|
654
|
+
hnsw_enabled = true
|
|
655
|
+
hnsw_m = 16
|
|
656
|
+
hnsw_ef_construction = 200
|
|
657
|
+
hnsw_ef_search = 100
|
|
658
|
+
pattern_learning = true
|
|
659
|
+
learning_rate = 0.01
|
|
660
|
+
|
|
661
|
+
# =============================================================================
|
|
662
|
+
# Swarm Orchestration
|
|
663
|
+
# =============================================================================
|
|
664
|
+
|
|
665
|
+
[swarm]
|
|
666
|
+
default_topology = "hierarchical"
|
|
667
|
+
default_strategy = "specialized"
|
|
668
|
+
consensus = "raft"
|
|
669
|
+
anti_drift = true
|
|
670
|
+
checkpoint_interval = 10
|
|
671
|
+
|
|
672
|
+
# =============================================================================
|
|
673
|
+
# Hooks
|
|
674
|
+
# =============================================================================
|
|
675
|
+
|
|
676
|
+
[hooks]
|
|
677
|
+
enabled = true
|
|
678
|
+
pre_task = true
|
|
679
|
+
post_task = true
|
|
680
|
+
train_on_edit = true
|
|
681
|
+
|
|
682
|
+
# =============================================================================
|
|
683
|
+
# Background Workers
|
|
684
|
+
# =============================================================================
|
|
685
|
+
|
|
686
|
+
[workers]
|
|
687
|
+
enabled = true
|
|
688
|
+
|
|
689
|
+
[workers.audit]
|
|
690
|
+
enabled = true
|
|
691
|
+
priority = "critical"
|
|
692
|
+
interval = 300
|
|
693
|
+
|
|
694
|
+
[workers.optimize]
|
|
695
|
+
enabled = true
|
|
696
|
+
priority = "high"
|
|
697
|
+
interval = 600
|
|
698
|
+
|
|
699
|
+
[workers.consolidate]
|
|
700
|
+
enabled = true
|
|
701
|
+
priority = "low"
|
|
702
|
+
interval = 1800
|
|
703
|
+
|
|
704
|
+
[workers.testgaps]
|
|
705
|
+
enabled = true
|
|
706
|
+
priority = "normal"
|
|
707
|
+
interval = 3600
|
|
708
|
+
|
|
709
|
+
# =============================================================================
|
|
710
|
+
# Compliance
|
|
711
|
+
# =============================================================================
|
|
712
|
+
|
|
713
|
+
[compliance]
|
|
714
|
+
soc2 = true
|
|
715
|
+
gdpr = true
|
|
716
|
+
pci_dss = false
|
|
717
|
+
hipaa = false
|
|
718
|
+
`;
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Generate development config.toml with permissive settings
|
|
722
|
+
*/
|
|
723
|
+
export async function generateDevConfigToml() {
|
|
724
|
+
return `# =============================================================================
|
|
725
|
+
# Claude Flow V3 - Development Configuration
|
|
726
|
+
# =============================================================================
|
|
727
|
+
# Permissive settings for local development
|
|
728
|
+
# Auto-approve most actions, full access, live web search
|
|
729
|
+
# =============================================================================
|
|
730
|
+
|
|
731
|
+
model = "gpt-5.3-codex"
|
|
732
|
+
approval_policy = "never"
|
|
733
|
+
sandbox_mode = "danger-full-access"
|
|
734
|
+
web_search = "live"
|
|
735
|
+
|
|
736
|
+
# Project documentation
|
|
737
|
+
project_doc_max_bytes = 65536
|
|
738
|
+
|
|
739
|
+
[features]
|
|
740
|
+
child_agents_md = true
|
|
741
|
+
shell_snapshot = true
|
|
742
|
+
request_rule = false
|
|
743
|
+
remote_compaction = true
|
|
744
|
+
|
|
745
|
+
[mcp_servers.claude-flow]
|
|
746
|
+
command = "npx"
|
|
747
|
+
args = ["-y", "@claude-flow/cli@latest"]
|
|
748
|
+
enabled = true
|
|
749
|
+
tool_timeout_sec = 120
|
|
750
|
+
|
|
751
|
+
[history]
|
|
752
|
+
persistence = "save-all"
|
|
753
|
+
|
|
754
|
+
[shell_environment_policy]
|
|
755
|
+
inherit = "all"
|
|
756
|
+
exclude = []
|
|
757
|
+
|
|
758
|
+
[sandbox_workspace_write]
|
|
759
|
+
writable_roots = ["/tmp", "~/.cache"]
|
|
760
|
+
network_access = true
|
|
761
|
+
exclude_slash_tmp = false
|
|
762
|
+
|
|
763
|
+
[security]
|
|
764
|
+
input_validation = true
|
|
765
|
+
path_traversal_prevention = true
|
|
766
|
+
secret_scanning = true
|
|
767
|
+
cve_scanning = false
|
|
768
|
+
|
|
769
|
+
[performance]
|
|
770
|
+
max_agents = 8
|
|
771
|
+
task_timeout = 600
|
|
772
|
+
cache_enabled = true
|
|
773
|
+
parallel_execution = true
|
|
774
|
+
|
|
775
|
+
[logging]
|
|
776
|
+
level = "debug"
|
|
777
|
+
format = "pretty"
|
|
778
|
+
destination = "stdout"
|
|
779
|
+
|
|
780
|
+
[neural]
|
|
781
|
+
sona_enabled = true
|
|
782
|
+
hnsw_enabled = true
|
|
783
|
+
pattern_learning = true
|
|
784
|
+
|
|
785
|
+
[swarm]
|
|
786
|
+
default_topology = "hierarchical"
|
|
787
|
+
default_strategy = "specialized"
|
|
788
|
+
anti_drift = true
|
|
789
|
+
|
|
790
|
+
[hooks]
|
|
791
|
+
enabled = true
|
|
792
|
+
pre_task = true
|
|
793
|
+
post_task = true
|
|
794
|
+
train_on_edit = true
|
|
795
|
+
|
|
796
|
+
[workers]
|
|
797
|
+
enabled = true
|
|
798
|
+
`;
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* Generate security-focused config.toml
|
|
802
|
+
*/
|
|
803
|
+
export async function generateSecureConfigToml() {
|
|
804
|
+
return `# =============================================================================
|
|
805
|
+
# Claude Flow V3 - Security-Focused Configuration
|
|
806
|
+
# =============================================================================
|
|
807
|
+
# Maximum security restrictions for sensitive environments
|
|
808
|
+
# All actions require approval, read-only access, no web search
|
|
809
|
+
# =============================================================================
|
|
810
|
+
|
|
811
|
+
model = "gpt-5.3-codex"
|
|
812
|
+
approval_policy = "untrusted"
|
|
813
|
+
sandbox_mode = "read-only"
|
|
814
|
+
web_search = "disabled"
|
|
815
|
+
|
|
816
|
+
# Project documentation
|
|
817
|
+
project_doc_max_bytes = 32768
|
|
818
|
+
|
|
819
|
+
[features]
|
|
820
|
+
child_agents_md = true
|
|
821
|
+
shell_snapshot = false
|
|
822
|
+
request_rule = true
|
|
823
|
+
remote_compaction = false
|
|
824
|
+
|
|
825
|
+
[mcp_servers.claude-flow]
|
|
826
|
+
command = "npx"
|
|
827
|
+
args = ["-y", "@claude-flow/cli@latest"]
|
|
828
|
+
enabled = true
|
|
829
|
+
tool_timeout_sec = 60
|
|
830
|
+
|
|
831
|
+
[history]
|
|
832
|
+
persistence = "save-all"
|
|
833
|
+
retention_days = 365
|
|
834
|
+
|
|
835
|
+
[shell_environment_policy]
|
|
836
|
+
inherit = "none"
|
|
837
|
+
exclude = ["*"]
|
|
838
|
+
|
|
839
|
+
[sandbox_workspace_write]
|
|
840
|
+
writable_roots = []
|
|
841
|
+
network_access = false
|
|
842
|
+
exclude_slash_tmp = true
|
|
843
|
+
|
|
844
|
+
[security]
|
|
845
|
+
input_validation = true
|
|
846
|
+
path_traversal_prevention = true
|
|
847
|
+
secret_scanning = true
|
|
848
|
+
cve_scanning = true
|
|
849
|
+
max_file_size = 1048576
|
|
850
|
+
allowed_extensions = [".ts", ".js", ".json", ".md", ".yaml", ".yml"]
|
|
851
|
+
blocked_patterns = ["\\\\.env", "secret", "credential", "password", "key", "token", "\\\\.pem", "\\\\.p12"]
|
|
852
|
+
|
|
853
|
+
[security.rbac]
|
|
854
|
+
enabled = true
|
|
855
|
+
default_role = "observer"
|
|
856
|
+
|
|
857
|
+
[security.audit]
|
|
858
|
+
enabled = true
|
|
859
|
+
destination = "both"
|
|
860
|
+
file_path = "./logs/security-audit.json"
|
|
861
|
+
retention_days = 365
|
|
862
|
+
|
|
863
|
+
[performance]
|
|
864
|
+
max_agents = 4
|
|
865
|
+
task_timeout = 120
|
|
866
|
+
cache_enabled = false
|
|
867
|
+
parallel_execution = false
|
|
868
|
+
|
|
869
|
+
[logging]
|
|
870
|
+
level = "info"
|
|
871
|
+
format = "json"
|
|
872
|
+
destination = "both"
|
|
873
|
+
file_path = "./logs/claude-flow.log"
|
|
874
|
+
max_files = 100
|
|
875
|
+
max_size = "10MB"
|
|
876
|
+
|
|
877
|
+
[neural]
|
|
878
|
+
sona_enabled = false
|
|
879
|
+
hnsw_enabled = true
|
|
880
|
+
pattern_learning = false
|
|
881
|
+
|
|
882
|
+
[swarm]
|
|
883
|
+
default_topology = "hierarchical"
|
|
884
|
+
default_strategy = "specialized"
|
|
885
|
+
consensus = "byzantine"
|
|
886
|
+
anti_drift = true
|
|
887
|
+
checkpoint_interval = 5
|
|
888
|
+
|
|
889
|
+
[hooks]
|
|
890
|
+
enabled = true
|
|
891
|
+
pre_task = true
|
|
892
|
+
post_task = true
|
|
893
|
+
train_on_edit = false
|
|
894
|
+
|
|
895
|
+
[workers]
|
|
896
|
+
enabled = true
|
|
897
|
+
|
|
898
|
+
[workers.audit]
|
|
899
|
+
enabled = true
|
|
900
|
+
priority = "critical"
|
|
901
|
+
interval = 60
|
|
902
|
+
|
|
903
|
+
[workers.optimize]
|
|
904
|
+
enabled = false
|
|
905
|
+
|
|
906
|
+
[workers.consolidate]
|
|
907
|
+
enabled = false
|
|
908
|
+
`;
|
|
909
|
+
}
|
|
910
|
+
//# sourceMappingURL=config-toml.js.map
|