@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/src/suggest.ts
DELETED
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* V3 CLI Smart Error Suggestions
|
|
3
|
-
* Levenshtein distance and command suggestions
|
|
4
|
-
*
|
|
5
|
-
* Created with ruv.io
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Calculate Levenshtein distance between two strings
|
|
10
|
-
*/
|
|
11
|
-
export function levenshteinDistance(a: string, b: string): number {
|
|
12
|
-
const m = a.length;
|
|
13
|
-
const n = b.length;
|
|
14
|
-
|
|
15
|
-
// Early termination for empty strings
|
|
16
|
-
if (m === 0) return n;
|
|
17
|
-
if (n === 0) return m;
|
|
18
|
-
|
|
19
|
-
// Create distance matrix
|
|
20
|
-
const d: number[][] = Array(m + 1).fill(null).map(() => Array(n + 1).fill(0));
|
|
21
|
-
|
|
22
|
-
// Initialize first column
|
|
23
|
-
for (let i = 0; i <= m; i++) {
|
|
24
|
-
d[i][0] = i;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Initialize first row
|
|
28
|
-
for (let j = 0; j <= n; j++) {
|
|
29
|
-
d[0][j] = j;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Fill in the rest of the matrix
|
|
33
|
-
for (let j = 1; j <= n; j++) {
|
|
34
|
-
for (let i = 1; i <= m; i++) {
|
|
35
|
-
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
36
|
-
d[i][j] = Math.min(
|
|
37
|
-
d[i - 1][j] + 1, // deletion
|
|
38
|
-
d[i][j - 1] + 1, // insertion
|
|
39
|
-
d[i - 1][j - 1] + cost // substitution
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return d[m][n];
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Calculate similarity score (0-1) between two strings
|
|
49
|
-
*/
|
|
50
|
-
export function similarityScore(a: string, b: string): number {
|
|
51
|
-
const maxLen = Math.max(a.length, b.length);
|
|
52
|
-
if (maxLen === 0) return 1;
|
|
53
|
-
const distance = levenshteinDistance(a.toLowerCase(), b.toLowerCase());
|
|
54
|
-
return 1 - distance / maxLen;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Find similar strings from a list
|
|
59
|
-
*/
|
|
60
|
-
export function findSimilar(
|
|
61
|
-
input: string,
|
|
62
|
-
candidates: string[],
|
|
63
|
-
options: {
|
|
64
|
-
maxSuggestions?: number;
|
|
65
|
-
minSimilarity?: number;
|
|
66
|
-
maxDistance?: number;
|
|
67
|
-
} = {}
|
|
68
|
-
): string[] {
|
|
69
|
-
const {
|
|
70
|
-
maxSuggestions = 3,
|
|
71
|
-
minSimilarity = 0.4,
|
|
72
|
-
maxDistance = 3
|
|
73
|
-
} = options;
|
|
74
|
-
|
|
75
|
-
const inputLower = input.toLowerCase();
|
|
76
|
-
|
|
77
|
-
// Score all candidates
|
|
78
|
-
const scored = candidates
|
|
79
|
-
.map(candidate => ({
|
|
80
|
-
candidate,
|
|
81
|
-
distance: levenshteinDistance(inputLower, candidate.toLowerCase()),
|
|
82
|
-
similarity: similarityScore(inputLower, candidate),
|
|
83
|
-
// Boost prefix matches
|
|
84
|
-
prefixBoost: candidate.toLowerCase().startsWith(inputLower) ? 0.3 : 0
|
|
85
|
-
}))
|
|
86
|
-
.filter(s => s.distance <= maxDistance || s.similarity >= minSimilarity)
|
|
87
|
-
.map(s => ({
|
|
88
|
-
...s,
|
|
89
|
-
score: s.similarity + s.prefixBoost
|
|
90
|
-
}))
|
|
91
|
-
.sort((a, b) => b.score - a.score)
|
|
92
|
-
.slice(0, maxSuggestions);
|
|
93
|
-
|
|
94
|
-
return scored.map(s => s.candidate);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Format suggestion message for CLI errors
|
|
99
|
-
*/
|
|
100
|
-
export function formatSuggestion(
|
|
101
|
-
invalidInput: string,
|
|
102
|
-
suggestions: string[],
|
|
103
|
-
context: 'command' | 'subcommand' | 'option' | 'value' = 'command'
|
|
104
|
-
): string {
|
|
105
|
-
if (suggestions.length === 0) {
|
|
106
|
-
return '';
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const contextMap = {
|
|
110
|
-
command: 'Did you mean',
|
|
111
|
-
subcommand: 'Available subcommands',
|
|
112
|
-
option: 'Did you mean',
|
|
113
|
-
value: 'Valid values'
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
const prefix = contextMap[context];
|
|
117
|
-
|
|
118
|
-
if (suggestions.length === 1) {
|
|
119
|
-
return `\n ${prefix}: ${suggestions[0]}`;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return `\n ${prefix}:\n${suggestions.map(s => ` - ${s}`).join('\n')}`;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Common typos and their corrections
|
|
127
|
-
*/
|
|
128
|
-
export const COMMON_TYPOS: Record<string, string> = {
|
|
129
|
-
'init': 'init',
|
|
130
|
-
'initi': 'init',
|
|
131
|
-
'inizialize': 'init',
|
|
132
|
-
'staus': 'status',
|
|
133
|
-
'stauts': 'status',
|
|
134
|
-
'stats': 'stats',
|
|
135
|
-
'stat': 'status',
|
|
136
|
-
'swarrm': 'swarm',
|
|
137
|
-
'swarn': 'swarm',
|
|
138
|
-
'agnet': 'agent',
|
|
139
|
-
'agen': 'agent',
|
|
140
|
-
'memroy': 'memory',
|
|
141
|
-
'mem': 'memory',
|
|
142
|
-
'memmory': 'memory',
|
|
143
|
-
'confg': 'config',
|
|
144
|
-
'conf': 'config',
|
|
145
|
-
'configu': 'config',
|
|
146
|
-
'hook': 'hooks',
|
|
147
|
-
'hoks': 'hooks',
|
|
148
|
-
'hive': 'hive-mind',
|
|
149
|
-
'hivemind': 'hive-mind',
|
|
150
|
-
'hive_mind': 'hive-mind',
|
|
151
|
-
'neurl': 'neural',
|
|
152
|
-
'nueral': 'neural',
|
|
153
|
-
'securty': 'security',
|
|
154
|
-
'sec': 'security',
|
|
155
|
-
'perf': 'performance',
|
|
156
|
-
'performace': 'performance',
|
|
157
|
-
'provider': 'providers',
|
|
158
|
-
'plugin': 'plugins',
|
|
159
|
-
'dep': 'deployment',
|
|
160
|
-
'depoly': 'deployment',
|
|
161
|
-
'deploy': 'deployment',
|
|
162
|
-
'claim': 'claims',
|
|
163
|
-
'embed': 'embeddings',
|
|
164
|
-
'embeding': 'embeddings',
|
|
165
|
-
'daemon': 'daemon',
|
|
166
|
-
'deamon': 'daemon',
|
|
167
|
-
'doc': 'doctor',
|
|
168
|
-
'docter': 'doctor',
|
|
169
|
-
'complete': 'completions',
|
|
170
|
-
'completion': 'completions',
|
|
171
|
-
'comp': 'completions',
|
|
172
|
-
'task': 'task',
|
|
173
|
-
'taks': 'task',
|
|
174
|
-
'sessio': 'session',
|
|
175
|
-
'sess': 'session',
|
|
176
|
-
'sesssion': 'session',
|
|
177
|
-
'workflow': 'workflow',
|
|
178
|
-
'wf': 'workflow',
|
|
179
|
-
'wokflow': 'workflow'
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Get corrected command if it's a common typo
|
|
184
|
-
*/
|
|
185
|
-
export function getTypoCorrection(input: string): string | undefined {
|
|
186
|
-
return COMMON_TYPOS[input.toLowerCase()];
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Smart command suggestion for unknown commands
|
|
191
|
-
*/
|
|
192
|
-
export function suggestCommand(
|
|
193
|
-
unknownCommand: string,
|
|
194
|
-
availableCommands: string[]
|
|
195
|
-
): {
|
|
196
|
-
correction?: string;
|
|
197
|
-
suggestions: string[];
|
|
198
|
-
message: string;
|
|
199
|
-
} {
|
|
200
|
-
// Check for common typo first
|
|
201
|
-
const correction = getTypoCorrection(unknownCommand);
|
|
202
|
-
if (correction && availableCommands.includes(correction)) {
|
|
203
|
-
return {
|
|
204
|
-
correction,
|
|
205
|
-
suggestions: [correction],
|
|
206
|
-
message: `Did you mean "${correction}"?`
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// Find similar commands
|
|
211
|
-
const suggestions = findSimilar(unknownCommand, availableCommands, {
|
|
212
|
-
maxSuggestions: 3,
|
|
213
|
-
minSimilarity: 0.3,
|
|
214
|
-
maxDistance: 4
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
if (suggestions.length === 0) {
|
|
218
|
-
return {
|
|
219
|
-
suggestions: [],
|
|
220
|
-
message: 'Run "claude-flow --help" to see available commands.'
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
if (suggestions.length === 1) {
|
|
225
|
-
return {
|
|
226
|
-
suggestions,
|
|
227
|
-
message: `Did you mean "${suggestions[0]}"?`
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
return {
|
|
232
|
-
suggestions,
|
|
233
|
-
message: `Did you mean one of these?\n${suggestions.map(s => ` - ${s}`).join('\n')}`
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
export default {
|
|
238
|
-
levenshteinDistance,
|
|
239
|
-
similarityScore,
|
|
240
|
-
findSimilar,
|
|
241
|
-
formatSuggestion,
|
|
242
|
-
suggestCommand,
|
|
243
|
-
getTypoCorrection,
|
|
244
|
-
COMMON_TYPOS
|
|
245
|
-
};
|
package/src/types.ts
DELETED
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* V3 CLI Type Definitions
|
|
3
|
-
* Modernized type system for the Claude Flow V3 CLI
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// ============================================
|
|
7
|
-
// Core Command Types
|
|
8
|
-
// ============================================
|
|
9
|
-
|
|
10
|
-
export interface CommandContext {
|
|
11
|
-
args: string[];
|
|
12
|
-
flags: ParsedFlags;
|
|
13
|
-
config?: V3Config;
|
|
14
|
-
cwd: string;
|
|
15
|
-
interactive: boolean;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface ParsedFlags {
|
|
19
|
-
[key: string]: string | boolean | number | string[];
|
|
20
|
-
_: string[];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface Command {
|
|
24
|
-
name: string;
|
|
25
|
-
description: string;
|
|
26
|
-
aliases?: string[];
|
|
27
|
-
subcommands?: Command[];
|
|
28
|
-
options?: CommandOption[];
|
|
29
|
-
examples?: CommandExample[];
|
|
30
|
-
action?: CommandAction;
|
|
31
|
-
hidden?: boolean;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface CommandOption {
|
|
35
|
-
name: string;
|
|
36
|
-
short?: string;
|
|
37
|
-
description: string;
|
|
38
|
-
type: 'string' | 'boolean' | 'number' | 'array';
|
|
39
|
-
default?: unknown;
|
|
40
|
-
required?: boolean;
|
|
41
|
-
choices?: string[];
|
|
42
|
-
validate?: (value: unknown) => boolean | string;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface CommandExample {
|
|
46
|
-
command: string;
|
|
47
|
-
description: string;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export type CommandAction = (ctx: CommandContext) => Promise<CommandResult | void>;
|
|
51
|
-
|
|
52
|
-
export interface CommandResult {
|
|
53
|
-
success: boolean;
|
|
54
|
-
message?: string;
|
|
55
|
-
data?: unknown;
|
|
56
|
-
exitCode?: number;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// ============================================
|
|
60
|
-
// Configuration Types
|
|
61
|
-
// ============================================
|
|
62
|
-
|
|
63
|
-
export interface V3Config {
|
|
64
|
-
version: string;
|
|
65
|
-
projectRoot: string;
|
|
66
|
-
|
|
67
|
-
// Agent configuration
|
|
68
|
-
agents: AgentConfig;
|
|
69
|
-
|
|
70
|
-
// Swarm configuration
|
|
71
|
-
swarm: SwarmConfig;
|
|
72
|
-
|
|
73
|
-
// Memory configuration
|
|
74
|
-
memory: MemoryConfig;
|
|
75
|
-
|
|
76
|
-
// MCP configuration
|
|
77
|
-
mcp: MCPConfig;
|
|
78
|
-
|
|
79
|
-
// CLI preferences
|
|
80
|
-
cli: CLIPreferences;
|
|
81
|
-
|
|
82
|
-
// Hooks configuration
|
|
83
|
-
hooks: HooksConfig;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export interface AgentConfig {
|
|
87
|
-
defaultType: string;
|
|
88
|
-
autoSpawn: boolean;
|
|
89
|
-
maxConcurrent: number;
|
|
90
|
-
timeout: number;
|
|
91
|
-
providers: ProviderConfig[];
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export interface ProviderConfig {
|
|
95
|
-
name: string;
|
|
96
|
-
apiKey?: string;
|
|
97
|
-
baseUrl?: string;
|
|
98
|
-
model?: string;
|
|
99
|
-
priority: number;
|
|
100
|
-
enabled: boolean;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export interface SwarmConfig {
|
|
104
|
-
topology: 'hierarchical' | 'mesh' | 'ring' | 'star' | 'hybrid';
|
|
105
|
-
maxAgents: number;
|
|
106
|
-
autoScale: boolean;
|
|
107
|
-
coordinationStrategy: 'consensus' | 'leader' | 'distributed';
|
|
108
|
-
healthCheckInterval: number;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export interface MemoryConfig {
|
|
112
|
-
backend: 'agentdb' | 'sqlite' | 'memory' | 'hybrid';
|
|
113
|
-
persistPath: string;
|
|
114
|
-
cacheSize: number;
|
|
115
|
-
enableHNSW: boolean;
|
|
116
|
-
vectorDimension: number;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export interface MCPConfig {
|
|
120
|
-
serverHost: string;
|
|
121
|
-
serverPort: number;
|
|
122
|
-
autoStart: boolean;
|
|
123
|
-
transportType: 'stdio' | 'http' | 'websocket';
|
|
124
|
-
tools: string[];
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export interface CLIPreferences {
|
|
128
|
-
colorOutput: boolean;
|
|
129
|
-
interactive: boolean;
|
|
130
|
-
verbosity: 'quiet' | 'normal' | 'verbose' | 'debug';
|
|
131
|
-
outputFormat: 'text' | 'json' | 'table';
|
|
132
|
-
progressStyle: 'bar' | 'spinner' | 'dots' | 'none';
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export interface HooksConfig {
|
|
136
|
-
enabled: boolean;
|
|
137
|
-
autoExecute: boolean;
|
|
138
|
-
hooks: HookDefinition[];
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export interface HookDefinition {
|
|
142
|
-
name: string;
|
|
143
|
-
event: string;
|
|
144
|
-
handler: string;
|
|
145
|
-
priority: number;
|
|
146
|
-
enabled: boolean;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// ============================================
|
|
150
|
-
// Output Types
|
|
151
|
-
// ============================================
|
|
152
|
-
|
|
153
|
-
export interface TableColumn {
|
|
154
|
-
key: string;
|
|
155
|
-
header: string;
|
|
156
|
-
width?: number;
|
|
157
|
-
align?: 'left' | 'center' | 'right';
|
|
158
|
-
format?: (value: unknown) => string;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export interface TableOptions {
|
|
162
|
-
columns: TableColumn[];
|
|
163
|
-
data: Record<string, unknown>[];
|
|
164
|
-
border?: boolean;
|
|
165
|
-
header?: boolean;
|
|
166
|
-
padding?: number;
|
|
167
|
-
maxWidth?: number;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
export interface ProgressOptions {
|
|
171
|
-
total: number;
|
|
172
|
-
current?: number;
|
|
173
|
-
width?: number;
|
|
174
|
-
format?: string;
|
|
175
|
-
showPercentage?: boolean;
|
|
176
|
-
showETA?: boolean;
|
|
177
|
-
showSpeed?: boolean;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
export interface SpinnerOptions {
|
|
181
|
-
text: string;
|
|
182
|
-
spinner?: 'dots' | 'line' | 'arc' | 'circle' | 'arrows';
|
|
183
|
-
color?: string;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
// ============================================
|
|
187
|
-
// Prompt Types
|
|
188
|
-
// ============================================
|
|
189
|
-
|
|
190
|
-
export interface SelectOption<T = string> {
|
|
191
|
-
value: T;
|
|
192
|
-
label: string;
|
|
193
|
-
hint?: string;
|
|
194
|
-
disabled?: boolean;
|
|
195
|
-
/** For multiselect: whether this option is selected by default */
|
|
196
|
-
selected?: boolean;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
export interface SelectPromptOptions<T = string> {
|
|
200
|
-
message: string;
|
|
201
|
-
options: SelectOption<T>[];
|
|
202
|
-
default?: T;
|
|
203
|
-
searchable?: boolean;
|
|
204
|
-
pageSize?: number;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
export interface ConfirmPromptOptions {
|
|
208
|
-
message: string;
|
|
209
|
-
default?: boolean;
|
|
210
|
-
active?: string;
|
|
211
|
-
inactive?: string;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
export interface InputPromptOptions {
|
|
215
|
-
message: string;
|
|
216
|
-
default?: string;
|
|
217
|
-
placeholder?: string;
|
|
218
|
-
validate?: (value: string) => boolean | string;
|
|
219
|
-
mask?: boolean;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
export interface MultiSelectPromptOptions<T = string> {
|
|
223
|
-
message: string;
|
|
224
|
-
options: SelectOption<T>[];
|
|
225
|
-
default?: T[];
|
|
226
|
-
required?: boolean;
|
|
227
|
-
min?: number;
|
|
228
|
-
max?: number;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// ============================================
|
|
232
|
-
// Event Types
|
|
233
|
-
// ============================================
|
|
234
|
-
|
|
235
|
-
export type CLIEventType =
|
|
236
|
-
| 'command:start'
|
|
237
|
-
| 'command:end'
|
|
238
|
-
| 'command:error'
|
|
239
|
-
| 'prompt:start'
|
|
240
|
-
| 'prompt:complete'
|
|
241
|
-
| 'output:write'
|
|
242
|
-
| 'progress:update'
|
|
243
|
-
| 'spinner:start'
|
|
244
|
-
| 'spinner:stop';
|
|
245
|
-
|
|
246
|
-
export interface CLIEvent {
|
|
247
|
-
type: CLIEventType;
|
|
248
|
-
timestamp: number;
|
|
249
|
-
data?: unknown;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
// ============================================
|
|
253
|
-
// Error Types
|
|
254
|
-
// ============================================
|
|
255
|
-
|
|
256
|
-
export class CLIError extends Error {
|
|
257
|
-
constructor(
|
|
258
|
-
message: string,
|
|
259
|
-
public code: string,
|
|
260
|
-
public exitCode: number = 1,
|
|
261
|
-
public details?: unknown
|
|
262
|
-
) {
|
|
263
|
-
super(message);
|
|
264
|
-
this.name = 'CLIError';
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
export class ValidationError extends CLIError {
|
|
269
|
-
constructor(message: string, details?: unknown) {
|
|
270
|
-
super(message, 'VALIDATION_ERROR', 1, details);
|
|
271
|
-
this.name = 'ValidationError';
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
export class ConfigError extends CLIError {
|
|
276
|
-
constructor(message: string, details?: unknown) {
|
|
277
|
-
super(message, 'CONFIG_ERROR', 1, details);
|
|
278
|
-
this.name = 'ConfigError';
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
export class CommandNotFoundError extends CLIError {
|
|
283
|
-
constructor(commandName: string) {
|
|
284
|
-
super(`Unknown command: ${commandName}`, 'COMMAND_NOT_FOUND', 127);
|
|
285
|
-
this.name = 'CommandNotFoundError';
|
|
286
|
-
}
|
|
287
|
-
}
|
package/tmp.json
DELETED
|
File without changes
|
package/tsconfig.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "./dist",
|
|
5
|
-
"rootDir": ".",
|
|
6
|
-
"composite": true,
|
|
7
|
-
"declaration": true,
|
|
8
|
-
"declarationMap": true
|
|
9
|
-
},
|
|
10
|
-
"include": ["src/**/*"],
|
|
11
|
-
"exclude": ["node_modules", "dist"],
|
|
12
|
-
"references": [
|
|
13
|
-
{ "path": "../shared" },
|
|
14
|
-
{ "path": "../swarm" }
|
|
15
|
-
]
|
|
16
|
-
}
|