@claude-flow/cli 3.0.0-alpha.13 → 3.0.0-alpha.15
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/dist/src/commands/doctor.d.ts.map +1 -1
- package/dist/src/commands/doctor.js +75 -2
- package/dist/src/commands/doctor.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -4
- package/.agentic-flow/intelligence.json +0 -17
- package/.claude-flow/agents/store.json +0 -16
- package/.claude-flow/daemon-state.json +0 -123
- package/.claude-flow/daemon-test.log +0 -0
- package/.claude-flow/daemon.log +0 -0
- package/.claude-flow/daemon2.log +0 -0
- package/.claude-flow/daemon3.log +0 -0
- package/.claude-flow/hive-mind/state.json +0 -51
- package/.claude-flow/metrics/agent-metrics.json +0 -1
- package/.claude-flow/metrics/codebase-map.json +0 -11
- package/.claude-flow/metrics/consolidation.json +0 -6
- package/.claude-flow/metrics/performance.json +0 -87
- package/.claude-flow/metrics/security-audit.json +0 -10
- package/.claude-flow/metrics/task-metrics.json +0 -10
- package/.claude-flow/metrics/test-gaps.json +0 -6
- package/__tests__/README.md +0 -140
- package/__tests__/TEST_SUMMARY.md +0 -144
- package/__tests__/cli.test.ts +0 -558
- package/__tests__/commands.test.ts +0 -726
- package/__tests__/config-adapter.test.ts +0 -362
- package/__tests__/config-loading.test.ts +0 -106
- package/__tests__/coverage/.tmp/coverage-0.json +0 -1
- package/__tests__/coverage/.tmp/coverage-1.json +0 -1
- package/__tests__/coverage/.tmp/coverage-2.json +0 -1
- package/__tests__/coverage/.tmp/coverage-3.json +0 -1
- package/__tests__/coverage/.tmp/coverage-4.json +0 -1
- package/__tests__/coverage/.tmp/coverage-5.json +0 -1
- package/__tests__/mcp-client.test.ts +0 -480
- package/__tests__/p1-commands.test.ts +0 -1064
- package/agents/architect.yaml +0 -11
- package/agents/coder.yaml +0 -11
- package/agents/reviewer.yaml +0 -10
- package/agents/security-architect.yaml +0 -10
- package/agents/tester.yaml +0 -10
- package/docs/CONFIG_LOADING.md +0 -236
- package/docs/IMPLEMENTATION_COMPLETE.md +0 -421
- package/docs/MCP_CLIENT_GUIDE.md +0 -620
- package/docs/REFACTORING_SUMMARY.md +0 -247
- package/scripts/publish.sh +0 -46
- package/src/commands/agent.ts +0 -955
- package/src/commands/claims.ts +0 -317
- package/src/commands/completions.ts +0 -558
- package/src/commands/config.ts +0 -452
- package/src/commands/daemon.ts +0 -621
- package/src/commands/deployment.ts +0 -323
- package/src/commands/doctor.ts +0 -382
- package/src/commands/embeddings.ts +0 -686
- package/src/commands/hive-mind.ts +0 -928
- package/src/commands/hooks.ts +0 -2603
- package/src/commands/index.ts +0 -154
- package/src/commands/init.ts +0 -597
- package/src/commands/mcp.ts +0 -753
- package/src/commands/memory.ts +0 -1161
- package/src/commands/migrate.ts +0 -447
- package/src/commands/neural.ts +0 -253
- package/src/commands/performance.ts +0 -292
- package/src/commands/plugins.ts +0 -316
- package/src/commands/process.ts +0 -695
- package/src/commands/providers.ts +0 -259
- package/src/commands/security.ts +0 -288
- package/src/commands/session.ts +0 -891
- package/src/commands/start.ts +0 -457
- package/src/commands/status.ts +0 -736
- package/src/commands/swarm.ts +0 -648
- package/src/commands/task.ts +0 -792
- package/src/commands/workflow.ts +0 -742
- package/src/config-adapter.ts +0 -210
- package/src/index.ts +0 -443
- package/src/infrastructure/in-memory-repositories.ts +0 -310
- package/src/init/claudemd-generator.ts +0 -631
- package/src/init/executor.ts +0 -762
- package/src/init/helpers-generator.ts +0 -628
- package/src/init/index.ts +0 -60
- package/src/init/mcp-generator.ts +0 -83
- package/src/init/settings-generator.ts +0 -284
- package/src/init/statusline-generator.ts +0 -211
- package/src/init/types.ts +0 -447
- package/src/mcp-client.ts +0 -241
- package/src/mcp-server.ts +0 -577
- package/src/mcp-tools/agent-tools.ts +0 -466
- package/src/mcp-tools/config-tools.ts +0 -370
- package/src/mcp-tools/hive-mind-tools.ts +0 -521
- package/src/mcp-tools/hooks-tools.ts +0 -1888
- package/src/mcp-tools/index.ts +0 -16
- package/src/mcp-tools/memory-tools.ts +0 -270
- package/src/mcp-tools/session-tools.ts +0 -359
- package/src/mcp-tools/swarm-tools.ts +0 -105
- package/src/mcp-tools/task-tools.ts +0 -347
- package/src/mcp-tools/types.ts +0 -33
- package/src/mcp-tools/workflow-tools.ts +0 -573
- package/src/output.ts +0 -639
- package/src/parser.ts +0 -417
- package/src/prompt.ts +0 -619
- package/src/services/index.ts +0 -15
- package/src/services/worker-daemon.ts +0 -726
- package/src/suggest.ts +0 -245
- package/src/types.ts +0 -287
- package/tmp.json +0 -0
- package/tsconfig.json +0 -16
- package/tsconfig.tsbuildinfo +0 -1
- package/vitest.config.ts +0 -13
package/agents/architect.yaml
DELETED
package/agents/coder.yaml
DELETED
package/agents/reviewer.yaml
DELETED
package/agents/tester.yaml
DELETED
package/docs/CONFIG_LOADING.md
DELETED
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
# CLI Configuration Loading
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
The CLI module now supports loading configuration from multiple sources with proper validation and type conversion.
|
|
6
|
-
|
|
7
|
-
## Implementation
|
|
8
|
-
|
|
9
|
-
### Files Added/Modified
|
|
10
|
-
|
|
11
|
-
1. **`src/config-adapter.ts`** (NEW)
|
|
12
|
-
- Converts between `SystemConfig` (from `@claude-flow/shared`) and `V3Config` (CLI-specific format)
|
|
13
|
-
- Provides bidirectional conversion functions:
|
|
14
|
-
- `systemConfigToV3Config()` - Convert SystemConfig to V3Config
|
|
15
|
-
- `v3ConfigToSystemConfig()` - Convert V3Config to SystemConfig
|
|
16
|
-
|
|
17
|
-
2. **`src/index.ts`** (MODIFIED)
|
|
18
|
-
- Implemented `loadConfig()` method (previously TODO)
|
|
19
|
-
- Loads configuration from file or default search paths
|
|
20
|
-
- Handles errors gracefully (config loading is optional)
|
|
21
|
-
- Displays warnings when config validation fails
|
|
22
|
-
|
|
23
|
-
3. **`__tests__/config-adapter.test.ts`** (NEW)
|
|
24
|
-
- Unit tests for config conversion functions
|
|
25
|
-
- Tests minimal configs, missing fields, and round-trip conversion
|
|
26
|
-
- Verifies different coordination strategies
|
|
27
|
-
|
|
28
|
-
4. **`__tests__/config-loading.test.ts`** (NEW)
|
|
29
|
-
- Integration tests for config loading
|
|
30
|
-
- Tests file loading, missing files, and invalid JSON
|
|
31
|
-
|
|
32
|
-
## Configuration Sources
|
|
33
|
-
|
|
34
|
-
The CLI loads configuration in the following priority order:
|
|
35
|
-
|
|
36
|
-
1. **Explicit file path** - When `--config` flag is provided
|
|
37
|
-
2. **Auto-discovery** - Searches for config files in:
|
|
38
|
-
- Current working directory
|
|
39
|
-
- Parent directory
|
|
40
|
-
- `~/.claude-flow/`
|
|
41
|
-
|
|
42
|
-
### Supported Config Files
|
|
43
|
-
|
|
44
|
-
- `claude-flow.config.json`
|
|
45
|
-
- `claude-flow.config.js`
|
|
46
|
-
- `claude-flow.json`
|
|
47
|
-
- `.claude-flow.json`
|
|
48
|
-
|
|
49
|
-
## Environment Variables
|
|
50
|
-
|
|
51
|
-
Configuration can also be overridden via environment variables:
|
|
52
|
-
|
|
53
|
-
- `CLAUDE_FLOW_MAX_AGENTS` - Maximum concurrent agents
|
|
54
|
-
- `CLAUDE_FLOW_DATA_DIR` - Data directory path
|
|
55
|
-
- `CLAUDE_FLOW_MEMORY_TYPE` - Memory backend type
|
|
56
|
-
- `CLAUDE_FLOW_MCP_TRANSPORT` - MCP transport type
|
|
57
|
-
- `CLAUDE_FLOW_MCP_PORT` - MCP server port
|
|
58
|
-
- `CLAUDE_FLOW_SWARM_TOPOLOGY` - Swarm topology type
|
|
59
|
-
|
|
60
|
-
## Configuration Schema
|
|
61
|
-
|
|
62
|
-
### V3Config (CLI Format)
|
|
63
|
-
|
|
64
|
-
```typescript
|
|
65
|
-
interface V3Config {
|
|
66
|
-
version: string;
|
|
67
|
-
projectRoot: string;
|
|
68
|
-
|
|
69
|
-
agents: {
|
|
70
|
-
defaultType: string;
|
|
71
|
-
autoSpawn: boolean;
|
|
72
|
-
maxConcurrent: number;
|
|
73
|
-
timeout: number;
|
|
74
|
-
providers: ProviderConfig[];
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
swarm: {
|
|
78
|
-
topology: 'hierarchical' | 'mesh' | 'ring' | 'star' | 'hybrid';
|
|
79
|
-
maxAgents: number;
|
|
80
|
-
autoScale: boolean;
|
|
81
|
-
coordinationStrategy: 'consensus' | 'leader' | 'distributed';
|
|
82
|
-
healthCheckInterval: number;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
memory: {
|
|
86
|
-
backend: 'agentdb' | 'sqlite' | 'memory' | 'hybrid';
|
|
87
|
-
persistPath: string;
|
|
88
|
-
cacheSize: number;
|
|
89
|
-
enableHNSW: boolean;
|
|
90
|
-
vectorDimension: number;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
mcp: {
|
|
94
|
-
serverHost: string;
|
|
95
|
-
serverPort: number;
|
|
96
|
-
autoStart: boolean;
|
|
97
|
-
transportType: 'stdio' | 'http' | 'websocket';
|
|
98
|
-
tools: string[];
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
cli: {
|
|
102
|
-
colorOutput: boolean;
|
|
103
|
-
interactive: boolean;
|
|
104
|
-
verbosity: 'quiet' | 'normal' | 'verbose' | 'debug';
|
|
105
|
-
outputFormat: 'text' | 'json' | 'table';
|
|
106
|
-
progressStyle: 'bar' | 'spinner' | 'dots' | 'none';
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
hooks: {
|
|
110
|
-
enabled: boolean;
|
|
111
|
-
autoExecute: boolean;
|
|
112
|
-
hooks: HookDefinition[];
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
## Usage Examples
|
|
118
|
-
|
|
119
|
-
### Command Line
|
|
120
|
-
|
|
121
|
-
```bash
|
|
122
|
-
# Use default config search paths
|
|
123
|
-
claude-flow agent spawn -t coder
|
|
124
|
-
|
|
125
|
-
# Use specific config file
|
|
126
|
-
claude-flow agent spawn -t coder --config ./custom-config.json
|
|
127
|
-
|
|
128
|
-
# Override with environment variables
|
|
129
|
-
CLAUDE_FLOW_MAX_AGENTS=20 claude-flow swarm init
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### Example Config File
|
|
133
|
-
|
|
134
|
-
```json
|
|
135
|
-
{
|
|
136
|
-
"orchestrator": {
|
|
137
|
-
"lifecycle": {
|
|
138
|
-
"autoStart": true,
|
|
139
|
-
"maxConcurrentAgents": 15,
|
|
140
|
-
"shutdownTimeoutMs": 30000,
|
|
141
|
-
"cleanupOrphanedAgents": true
|
|
142
|
-
},
|
|
143
|
-
"session": {
|
|
144
|
-
"dataDir": "./data",
|
|
145
|
-
"persistState": true,
|
|
146
|
-
"stateFile": "session.json"
|
|
147
|
-
},
|
|
148
|
-
"monitoring": {
|
|
149
|
-
"enabled": true,
|
|
150
|
-
"metricsIntervalMs": 5000,
|
|
151
|
-
"healthCheckIntervalMs": 10000
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
"swarm": {
|
|
155
|
-
"topology": "hierarchical-mesh",
|
|
156
|
-
"maxAgents": 15
|
|
157
|
-
},
|
|
158
|
-
"memory": {
|
|
159
|
-
"type": "hybrid",
|
|
160
|
-
"agentdb": {
|
|
161
|
-
"dimensions": 1536,
|
|
162
|
-
"indexType": "hnsw"
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
"mcp": {
|
|
166
|
-
"enabled": true,
|
|
167
|
-
"transport": {
|
|
168
|
-
"type": "stdio",
|
|
169
|
-
"host": "localhost",
|
|
170
|
-
"port": 3000
|
|
171
|
-
},
|
|
172
|
-
"enabledTools": ["agent/*", "swarm/*", "memory/*"]
|
|
173
|
-
},
|
|
174
|
-
"logging": {
|
|
175
|
-
"level": "info",
|
|
176
|
-
"pretty": true,
|
|
177
|
-
"destination": "console",
|
|
178
|
-
"format": "text"
|
|
179
|
-
},
|
|
180
|
-
"hooks": {
|
|
181
|
-
"enabled": true,
|
|
182
|
-
"autoExecute": false,
|
|
183
|
-
"definitions": []
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
## Error Handling
|
|
189
|
-
|
|
190
|
-
The config loading implementation handles errors gracefully:
|
|
191
|
-
|
|
192
|
-
1. **File not found** - Falls back to default configuration
|
|
193
|
-
2. **Invalid JSON** - Logs warning and uses defaults
|
|
194
|
-
3. **Validation errors** - Displays warnings for invalid fields
|
|
195
|
-
4. **Missing required fields** - Merges with default values
|
|
196
|
-
|
|
197
|
-
Debug mode (`DEBUG=1`) provides additional error details.
|
|
198
|
-
|
|
199
|
-
## Testing
|
|
200
|
-
|
|
201
|
-
All tests pass successfully:
|
|
202
|
-
|
|
203
|
-
```bash
|
|
204
|
-
# Run config adapter unit tests
|
|
205
|
-
npx vitest run __tests__/config-adapter.test.ts
|
|
206
|
-
|
|
207
|
-
# Run config loading integration tests
|
|
208
|
-
npx vitest run __tests__/config-loading.test.ts
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
### Test Coverage
|
|
212
|
-
|
|
213
|
-
- ✅ SystemConfig to V3Config conversion
|
|
214
|
-
- ✅ V3Config to SystemConfig conversion
|
|
215
|
-
- ✅ Round-trip conversion preserves values
|
|
216
|
-
- ✅ Handles missing optional fields
|
|
217
|
-
- ✅ Different coordination strategies
|
|
218
|
-
- ✅ File loading
|
|
219
|
-
- ✅ Missing file handling
|
|
220
|
-
- ✅ Invalid JSON handling
|
|
221
|
-
|
|
222
|
-
## Architecture Decisions
|
|
223
|
-
|
|
224
|
-
1. **Adapter Pattern** - Separates SystemConfig (shared) from V3Config (CLI-specific)
|
|
225
|
-
2. **Optional Loading** - Config files are optional, failures don't crash CLI
|
|
226
|
-
3. **Validation** - Uses existing Zod schemas from `@claude-flow/shared`
|
|
227
|
-
4. **Merge Strategy** - Merges loaded config with defaults
|
|
228
|
-
5. **Environment Priority** - Environment variables override file config
|
|
229
|
-
|
|
230
|
-
## Future Enhancements
|
|
231
|
-
|
|
232
|
-
- [ ] TypeScript config support (`.ts` files)
|
|
233
|
-
- [ ] Config validation command (`claude-flow config validate`)
|
|
234
|
-
- [ ] Config migration tool (v2 → v3)
|
|
235
|
-
- [ ] Interactive config setup wizard
|
|
236
|
-
- [ ] Schema documentation generation
|