cognitive-modules-cli 2.2.1 → 2.2.7
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/CHANGELOG.md +11 -0
- package/LICENSE +21 -0
- package/README.md +35 -29
- package/dist/cli.js +519 -23
- package/dist/commands/add.d.ts +33 -14
- package/dist/commands/add.js +383 -16
- package/dist/commands/compose.js +60 -23
- package/dist/commands/index.d.ts +4 -0
- package/dist/commands/index.js +4 -0
- package/dist/commands/init.js +23 -1
- package/dist/commands/migrate.d.ts +30 -0
- package/dist/commands/migrate.js +650 -0
- package/dist/commands/pipe.d.ts +1 -0
- package/dist/commands/pipe.js +31 -11
- package/dist/commands/remove.js +33 -2
- package/dist/commands/run.d.ts +2 -0
- package/dist/commands/run.js +61 -28
- package/dist/commands/search.d.ts +28 -0
- package/dist/commands/search.js +143 -0
- package/dist/commands/test.d.ts +65 -0
- package/dist/commands/test.js +454 -0
- package/dist/commands/update.d.ts +1 -0
- package/dist/commands/update.js +106 -14
- package/dist/commands/validate.d.ts +36 -0
- package/dist/commands/validate.js +97 -0
- package/dist/errors/index.d.ts +225 -0
- package/dist/errors/index.js +420 -0
- package/dist/mcp/server.js +84 -79
- package/dist/modules/composition.js +97 -32
- package/dist/modules/loader.js +4 -2
- package/dist/modules/runner.d.ts +72 -5
- package/dist/modules/runner.js +306 -59
- package/dist/modules/subagent.d.ts +6 -1
- package/dist/modules/subagent.js +18 -13
- package/dist/modules/validator.js +14 -6
- package/dist/providers/anthropic.d.ts +15 -0
- package/dist/providers/anthropic.js +147 -5
- package/dist/providers/base.d.ts +11 -0
- package/dist/providers/base.js +18 -0
- package/dist/providers/gemini.d.ts +15 -0
- package/dist/providers/gemini.js +122 -5
- package/dist/providers/ollama.d.ts +15 -0
- package/dist/providers/ollama.js +111 -3
- package/dist/providers/openai.d.ts +11 -0
- package/dist/providers/openai.js +133 -0
- package/dist/registry/client.d.ts +212 -0
- package/dist/registry/client.js +359 -0
- package/dist/registry/index.d.ts +4 -0
- package/dist/registry/index.js +4 -0
- package/dist/registry/tar.d.ts +8 -0
- package/dist/registry/tar.js +353 -0
- package/dist/server/http.js +301 -45
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.js +1 -0
- package/dist/server/sse.d.ts +13 -0
- package/dist/server/sse.js +22 -0
- package/dist/types.d.ts +32 -1
- package/dist/types.js +4 -1
- package/dist/version.d.ts +1 -0
- package/dist/version.js +4 -0
- package/package.json +31 -7
- package/dist/modules/composition.test.d.ts +0 -11
- package/dist/modules/composition.test.js +0 -450
- package/dist/modules/policy.test.d.ts +0 -10
- package/dist/modules/policy.test.js +0 -369
- package/src/cli.ts +0 -471
- package/src/commands/add.ts +0 -315
- package/src/commands/compose.ts +0 -185
- package/src/commands/index.ts +0 -13
- package/src/commands/init.ts +0 -94
- package/src/commands/list.ts +0 -33
- package/src/commands/pipe.ts +0 -76
- package/src/commands/remove.ts +0 -57
- package/src/commands/run.ts +0 -80
- package/src/commands/update.ts +0 -130
- package/src/commands/versions.ts +0 -79
- package/src/index.ts +0 -90
- package/src/mcp/index.ts +0 -5
- package/src/mcp/server.ts +0 -403
- package/src/modules/composition.test.ts +0 -558
- package/src/modules/composition.ts +0 -1674
- package/src/modules/index.ts +0 -9
- package/src/modules/loader.ts +0 -508
- package/src/modules/policy.test.ts +0 -455
- package/src/modules/runner.ts +0 -1983
- package/src/modules/subagent.ts +0 -277
- package/src/modules/validator.ts +0 -700
- package/src/providers/anthropic.ts +0 -89
- package/src/providers/base.ts +0 -29
- package/src/providers/deepseek.ts +0 -83
- package/src/providers/gemini.ts +0 -117
- package/src/providers/index.ts +0 -78
- package/src/providers/minimax.ts +0 -81
- package/src/providers/moonshot.ts +0 -82
- package/src/providers/ollama.ts +0 -83
- package/src/providers/openai.ts +0 -84
- package/src/providers/qwen.ts +0 -82
- package/src/server/http.ts +0 -316
- package/src/server/index.ts +0 -6
- package/src/types.ts +0 -599
- package/tsconfig.json +0 -17
package/src/cli.ts
DELETED
|
@@ -1,471 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Cognitive Modules CLI
|
|
4
|
-
*
|
|
5
|
-
* cog run <module> --args "..." - Run a module
|
|
6
|
-
* cog add <url> -m <name> - Add module from GitHub
|
|
7
|
-
* cog update <module> - Update to latest version
|
|
8
|
-
* cog remove <module> - Remove installed module
|
|
9
|
-
* cog versions <url> - List available versions
|
|
10
|
-
* cog list - List available modules
|
|
11
|
-
* cog pipe --module <name> - Pipe mode (stdin/stdout)
|
|
12
|
-
* cog doctor - Check configuration
|
|
13
|
-
*
|
|
14
|
-
* npx cognitive-modules add ziel-io/cognitive-modules -m code-simplifier
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { parseArgs } from 'node:util';
|
|
18
|
-
import { getProvider, listProviders } from './providers/index.js';
|
|
19
|
-
import { run, list, pipe, init, add, update, remove, versions, compose, composeInfo } from './commands/index.js';
|
|
20
|
-
import type { CommandContext } from './types.js';
|
|
21
|
-
|
|
22
|
-
const VERSION = '1.3.0';
|
|
23
|
-
|
|
24
|
-
async function main() {
|
|
25
|
-
const args = process.argv.slice(2);
|
|
26
|
-
const command = args[0];
|
|
27
|
-
|
|
28
|
-
if (!command || command === '--help' || command === '-h') {
|
|
29
|
-
printHelp();
|
|
30
|
-
process.exit(0);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (command === '--version' || command === '-v') {
|
|
34
|
-
console.log(`Cognitive Runtime v${VERSION}`);
|
|
35
|
-
process.exit(0);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Parse common options
|
|
39
|
-
const { values } = parseArgs({
|
|
40
|
-
args: args.slice(1),
|
|
41
|
-
options: {
|
|
42
|
-
args: { type: 'string', short: 'a' },
|
|
43
|
-
input: { type: 'string', short: 'i' },
|
|
44
|
-
module: { type: 'string', short: 'm' },
|
|
45
|
-
model: { type: 'string', short: 'M' },
|
|
46
|
-
provider: { type: 'string', short: 'p' },
|
|
47
|
-
pretty: { type: 'boolean', default: false },
|
|
48
|
-
verbose: { type: 'boolean', short: 'V', default: false },
|
|
49
|
-
'no-validate': { type: 'boolean', default: false },
|
|
50
|
-
// Add/update options
|
|
51
|
-
name: { type: 'string', short: 'n' },
|
|
52
|
-
tag: { type: 'string', short: 't' },
|
|
53
|
-
branch: { type: 'string', short: 'b' },
|
|
54
|
-
limit: { type: 'string', short: 'l' },
|
|
55
|
-
// Server options
|
|
56
|
-
host: { type: 'string', short: 'H' },
|
|
57
|
-
port: { type: 'string', short: 'P' },
|
|
58
|
-
// Compose options
|
|
59
|
-
'max-depth': { type: 'string', short: 'd' },
|
|
60
|
-
timeout: { type: 'string', short: 'T' },
|
|
61
|
-
trace: { type: 'boolean', default: false },
|
|
62
|
-
},
|
|
63
|
-
allowPositionals: true,
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
// Get provider
|
|
67
|
-
let provider;
|
|
68
|
-
try {
|
|
69
|
-
provider = getProvider(values.provider, values.model);
|
|
70
|
-
} catch (e) {
|
|
71
|
-
console.error(`Error: ${e instanceof Error ? e.message : e}`);
|
|
72
|
-
process.exit(1);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const ctx: CommandContext = {
|
|
76
|
-
cwd: process.cwd(),
|
|
77
|
-
provider,
|
|
78
|
-
verbose: values.verbose,
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
try {
|
|
82
|
-
switch (command) {
|
|
83
|
-
case 'run': {
|
|
84
|
-
const moduleName = args[1];
|
|
85
|
-
if (!moduleName || moduleName.startsWith('-')) {
|
|
86
|
-
console.error('Usage: cog run <module> [--args "..."]');
|
|
87
|
-
process.exit(1);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const result = await run(moduleName, ctx, {
|
|
91
|
-
args: values.args,
|
|
92
|
-
input: values.input,
|
|
93
|
-
noValidate: values['no-validate'],
|
|
94
|
-
pretty: values.pretty,
|
|
95
|
-
verbose: values.verbose,
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
if (!result.success) {
|
|
99
|
-
console.error(`Error: ${result.error}`);
|
|
100
|
-
process.exit(1);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
console.log(JSON.stringify(result.data, null, values.pretty ? 2 : 0));
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
case 'list': {
|
|
108
|
-
const result = await list(ctx);
|
|
109
|
-
if (!result.success) {
|
|
110
|
-
console.error(`Error: ${result.error}`);
|
|
111
|
-
process.exit(1);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const data = result.data as { modules: Array<{ name: string; version: string; responsibility: string; location: string }> };
|
|
115
|
-
|
|
116
|
-
if (data.modules.length === 0) {
|
|
117
|
-
console.log('No modules found.');
|
|
118
|
-
} else {
|
|
119
|
-
console.log('Available Modules:');
|
|
120
|
-
console.log('');
|
|
121
|
-
for (const m of data.modules) {
|
|
122
|
-
console.log(` ${m.name} (v${m.version})`);
|
|
123
|
-
console.log(` ${m.responsibility}`);
|
|
124
|
-
console.log(` ${m.location}`);
|
|
125
|
-
console.log('');
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
break;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
case 'pipe': {
|
|
132
|
-
const moduleName = values.module || args[1];
|
|
133
|
-
if (!moduleName) {
|
|
134
|
-
console.error('Usage: cog pipe --module <name>');
|
|
135
|
-
process.exit(1);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
await pipe(ctx, {
|
|
139
|
-
module: moduleName,
|
|
140
|
-
noValidate: values['no-validate'],
|
|
141
|
-
});
|
|
142
|
-
break;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
case 'init': {
|
|
146
|
-
const moduleName = args[1];
|
|
147
|
-
const result = await init(ctx, moduleName);
|
|
148
|
-
|
|
149
|
-
if (!result.success) {
|
|
150
|
-
console.error(`Error: ${result.error}`);
|
|
151
|
-
process.exit(1);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const data = result.data as { message: string; location: string; files?: string[]; hint?: string };
|
|
155
|
-
console.log(data.message);
|
|
156
|
-
console.log(` Location: ${data.location}`);
|
|
157
|
-
if (data.files) {
|
|
158
|
-
console.log(` Files: ${data.files.join(', ')}`);
|
|
159
|
-
}
|
|
160
|
-
if (data.hint) {
|
|
161
|
-
console.log(` ${data.hint}`);
|
|
162
|
-
}
|
|
163
|
-
break;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
case 'doctor': {
|
|
167
|
-
console.log('Cognitive Runtime - Environment Check\n');
|
|
168
|
-
|
|
169
|
-
console.log('Providers:');
|
|
170
|
-
for (const p of listProviders()) {
|
|
171
|
-
const status = p.configured ? '✓ configured' : '– not configured';
|
|
172
|
-
console.log(` ${p.name}: ${status} (${p.model})`);
|
|
173
|
-
}
|
|
174
|
-
console.log('');
|
|
175
|
-
|
|
176
|
-
try {
|
|
177
|
-
const provider = getProvider();
|
|
178
|
-
console.log(`Active provider: ${provider.name}`);
|
|
179
|
-
} catch {
|
|
180
|
-
console.log('Active provider: none (set an API key)');
|
|
181
|
-
}
|
|
182
|
-
break;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
case 'add': {
|
|
186
|
-
const url = args[1];
|
|
187
|
-
if (!url || url.startsWith('-')) {
|
|
188
|
-
console.error('Usage: cog add <url> [--module <name>] [--tag <version>]');
|
|
189
|
-
console.error('');
|
|
190
|
-
console.error('Examples:');
|
|
191
|
-
console.error(' cog add ziel-io/cognitive-modules -m code-simplifier');
|
|
192
|
-
console.error(' cog add org/repo --module my-module --tag v1.0.0');
|
|
193
|
-
process.exit(1);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
console.log(`→ Adding module from: ${url}`);
|
|
197
|
-
if (values.module) console.log(` Module path: ${values.module}`);
|
|
198
|
-
if (values.tag) console.log(` Version: ${values.tag}`);
|
|
199
|
-
|
|
200
|
-
const result = await add(url, ctx, {
|
|
201
|
-
module: values.module,
|
|
202
|
-
name: values.name,
|
|
203
|
-
tag: values.tag,
|
|
204
|
-
branch: values.branch,
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
if (!result.success) {
|
|
208
|
-
console.error(`✗ Failed to add module: ${result.error}`);
|
|
209
|
-
process.exit(1);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
const data = result.data as { message: string; location: string; name: string };
|
|
213
|
-
console.log(`✓ ${data.message}`);
|
|
214
|
-
console.log(` Location: ${data.location}`);
|
|
215
|
-
console.log('');
|
|
216
|
-
console.log('Run with:');
|
|
217
|
-
console.log(` cog run ${data.name} --args "your input"`);
|
|
218
|
-
break;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
case 'update': {
|
|
222
|
-
const moduleName = args[1];
|
|
223
|
-
if (!moduleName || moduleName.startsWith('-')) {
|
|
224
|
-
console.error('Usage: cog update <module> [--tag <version>]');
|
|
225
|
-
process.exit(1);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
console.log(`→ Updating module: ${moduleName}`);
|
|
229
|
-
|
|
230
|
-
const result = await update(moduleName, ctx, {
|
|
231
|
-
tag: values.tag,
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
if (!result.success) {
|
|
235
|
-
console.error(`✗ ${result.error}`);
|
|
236
|
-
process.exit(1);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
const data = result.data as { message: string };
|
|
240
|
-
console.log(`✓ ${data.message}`);
|
|
241
|
-
break;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
case 'remove': {
|
|
245
|
-
const moduleName = args[1];
|
|
246
|
-
if (!moduleName || moduleName.startsWith('-')) {
|
|
247
|
-
console.error('Usage: cog remove <module>');
|
|
248
|
-
process.exit(1);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
const result = await remove(moduleName, ctx);
|
|
252
|
-
|
|
253
|
-
if (!result.success) {
|
|
254
|
-
console.error(`✗ ${result.error}`);
|
|
255
|
-
process.exit(1);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
const data = result.data as { message: string };
|
|
259
|
-
console.log(`✓ ${data.message}`);
|
|
260
|
-
break;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
case 'versions': {
|
|
264
|
-
const url = args[1];
|
|
265
|
-
if (!url || url.startsWith('-')) {
|
|
266
|
-
console.error('Usage: cog versions <url>');
|
|
267
|
-
console.error('');
|
|
268
|
-
console.error('Examples:');
|
|
269
|
-
console.error(' cog versions ziel-io/cognitive-modules');
|
|
270
|
-
process.exit(1);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
console.log(`→ Fetching versions from: ${url}\n`);
|
|
274
|
-
|
|
275
|
-
const limit = values.limit ? parseInt(values.limit, 10) : 10;
|
|
276
|
-
const result = await versions(url, ctx, { limit });
|
|
277
|
-
|
|
278
|
-
if (!result.success) {
|
|
279
|
-
console.error(`✗ ${result.error}`);
|
|
280
|
-
process.exit(1);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
const data = result.data as { tags: string[]; count: number };
|
|
284
|
-
|
|
285
|
-
if (data.tags.length === 0) {
|
|
286
|
-
console.log('No tags/versions found.');
|
|
287
|
-
} else {
|
|
288
|
-
console.log(`Available Versions (${data.count}):`);
|
|
289
|
-
console.log('');
|
|
290
|
-
for (const tag of data.tags) {
|
|
291
|
-
console.log(` ${tag}`);
|
|
292
|
-
console.log(` cog add ${url} --tag ${tag}`);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
break;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
case 'compose': {
|
|
299
|
-
const moduleName = args[1];
|
|
300
|
-
if (!moduleName || moduleName.startsWith('-')) {
|
|
301
|
-
console.error('Usage: cog compose <module> [--args "..."] [--timeout <ms>] [--max-depth <n>]');
|
|
302
|
-
process.exit(1);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
const result = await compose(moduleName, ctx, {
|
|
306
|
-
args: values.args,
|
|
307
|
-
input: values.input,
|
|
308
|
-
maxDepth: values['max-depth'] ? parseInt(values['max-depth'] as string, 10) : undefined,
|
|
309
|
-
timeout: values.timeout ? parseInt(values.timeout as string, 10) : undefined,
|
|
310
|
-
trace: values.trace,
|
|
311
|
-
pretty: values.pretty,
|
|
312
|
-
verbose: values.verbose,
|
|
313
|
-
});
|
|
314
|
-
|
|
315
|
-
if (!result.success) {
|
|
316
|
-
console.error(`Error: ${result.error}`);
|
|
317
|
-
if (result.data) {
|
|
318
|
-
console.error('Partial results:', JSON.stringify(result.data, null, 2));
|
|
319
|
-
}
|
|
320
|
-
process.exit(1);
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
console.log(JSON.stringify(result.data, null, values.pretty ? 2 : 0));
|
|
324
|
-
break;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
case 'compose-info': {
|
|
328
|
-
const moduleName = args[1];
|
|
329
|
-
if (!moduleName || moduleName.startsWith('-')) {
|
|
330
|
-
console.error('Usage: cog compose-info <module>');
|
|
331
|
-
process.exit(1);
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
const result = await composeInfo(moduleName, ctx);
|
|
335
|
-
|
|
336
|
-
if (!result.success) {
|
|
337
|
-
console.error(`Error: ${result.error}`);
|
|
338
|
-
process.exit(1);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
console.log(JSON.stringify(result.data, null, 2));
|
|
342
|
-
break;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
case 'serve': {
|
|
346
|
-
const { serve } = await import('./server/http.js');
|
|
347
|
-
const port = values.port ? parseInt(values.port as string, 10) : 8000;
|
|
348
|
-
const host = (values.host as string) || '0.0.0.0';
|
|
349
|
-
console.log('Starting Cognitive Modules HTTP Server...');
|
|
350
|
-
await serve({ host, port, cwd: ctx.cwd });
|
|
351
|
-
break;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
case 'mcp': {
|
|
355
|
-
try {
|
|
356
|
-
const { serve: serveMcp } = await import('./mcp/server.js');
|
|
357
|
-
await serveMcp();
|
|
358
|
-
} catch (e) {
|
|
359
|
-
if (e instanceof Error && e.message.includes('Cannot find module')) {
|
|
360
|
-
console.error('MCP dependencies not installed.');
|
|
361
|
-
console.error('Install with: npm install @modelcontextprotocol/sdk');
|
|
362
|
-
process.exit(1);
|
|
363
|
-
}
|
|
364
|
-
throw e;
|
|
365
|
-
}
|
|
366
|
-
break;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
default:
|
|
370
|
-
console.error(`Unknown command: ${command}`);
|
|
371
|
-
console.error('Run "cog --help" for usage.');
|
|
372
|
-
process.exit(1);
|
|
373
|
-
}
|
|
374
|
-
} catch (e) {
|
|
375
|
-
console.error(`Error: ${e instanceof Error ? e.message : e}`);
|
|
376
|
-
if (values.verbose && e instanceof Error) {
|
|
377
|
-
console.error(e.stack);
|
|
378
|
-
}
|
|
379
|
-
process.exit(1);
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
function printHelp() {
|
|
384
|
-
console.log(`
|
|
385
|
-
Cognitive Runtime v${VERSION}
|
|
386
|
-
Structured AI Task Execution
|
|
387
|
-
|
|
388
|
-
USAGE:
|
|
389
|
-
cog <command> [options]
|
|
390
|
-
|
|
391
|
-
COMMANDS:
|
|
392
|
-
run <module> Run a Cognitive Module
|
|
393
|
-
compose <module> Execute a composed module workflow
|
|
394
|
-
compose-info <mod> Show composition configuration
|
|
395
|
-
list List available modules
|
|
396
|
-
add <url> Add module from GitHub
|
|
397
|
-
update <module> Update module to latest version
|
|
398
|
-
remove <module> Remove installed module
|
|
399
|
-
versions <url> List available versions
|
|
400
|
-
pipe Pipe mode (stdin/stdout)
|
|
401
|
-
init [name] Initialize project or create module
|
|
402
|
-
serve Start HTTP API server
|
|
403
|
-
mcp Start MCP server (for Claude Code, Cursor)
|
|
404
|
-
doctor Check configuration
|
|
405
|
-
|
|
406
|
-
OPTIONS:
|
|
407
|
-
-a, --args <str> Arguments to pass to module
|
|
408
|
-
-i, --input <json> JSON input for module
|
|
409
|
-
-m, --module <name> Module path within repo (for add)
|
|
410
|
-
-n, --name <name> Override module name (for add)
|
|
411
|
-
-t, --tag <version> Git tag/version (for add/update)
|
|
412
|
-
-b, --branch <name> Git branch (for add)
|
|
413
|
-
-M, --model <name> LLM model (e.g., gpt-4o, gemini-2.0-flash)
|
|
414
|
-
-p, --provider <name> LLM provider (gemini, openai, anthropic, deepseek, minimax, moonshot, qwen, ollama)
|
|
415
|
-
--pretty Pretty-print JSON output
|
|
416
|
-
-V, --verbose Verbose output
|
|
417
|
-
--no-validate Skip schema validation
|
|
418
|
-
-H, --host <host> Server host (default: 0.0.0.0)
|
|
419
|
-
-P, --port <port> Server port (default: 8000)
|
|
420
|
-
-d, --max-depth <n> Max composition depth (default: 5)
|
|
421
|
-
-T, --timeout <ms> Composition timeout in milliseconds
|
|
422
|
-
--trace Include execution trace (for compose)
|
|
423
|
-
-v, --version Show version
|
|
424
|
-
-h, --help Show this help
|
|
425
|
-
|
|
426
|
-
EXAMPLES:
|
|
427
|
-
# Add modules from GitHub
|
|
428
|
-
npx cognitive-modules-cli add ziel-io/cognitive-modules -m code-simplifier
|
|
429
|
-
cog add org/repo --module my-module --tag v1.0.0
|
|
430
|
-
|
|
431
|
-
# Version management
|
|
432
|
-
cog update code-simplifier
|
|
433
|
-
cog versions ziel-io/cognitive-modules
|
|
434
|
-
cog remove code-simplifier
|
|
435
|
-
|
|
436
|
-
# Run modules
|
|
437
|
-
cog run code-reviewer --args "def foo(): pass"
|
|
438
|
-
cog run code-reviewer --provider openai --model gpt-4o --args "..."
|
|
439
|
-
cog list
|
|
440
|
-
|
|
441
|
-
# Compose modules (multi-step workflows)
|
|
442
|
-
cog compose code-review-pipeline --args "code to review"
|
|
443
|
-
cog compose smart-processor --args "input" --timeout 60000 --verbose
|
|
444
|
-
cog compose-info code-review-pipeline
|
|
445
|
-
|
|
446
|
-
# Servers
|
|
447
|
-
cog serve --port 8080
|
|
448
|
-
cog mcp
|
|
449
|
-
|
|
450
|
-
# Other
|
|
451
|
-
echo "review this code" | cog pipe --module code-reviewer
|
|
452
|
-
cog init my-module
|
|
453
|
-
cog doctor
|
|
454
|
-
|
|
455
|
-
ENVIRONMENT:
|
|
456
|
-
GEMINI_API_KEY Google Gemini
|
|
457
|
-
OPENAI_API_KEY OpenAI
|
|
458
|
-
ANTHROPIC_API_KEY Anthropic Claude
|
|
459
|
-
DEEPSEEK_API_KEY DeepSeek
|
|
460
|
-
MINIMAX_API_KEY MiniMax
|
|
461
|
-
MOONSHOT_API_KEY Moonshot (Kimi)
|
|
462
|
-
DASHSCOPE_API_KEY Alibaba Qwen (通义千问)
|
|
463
|
-
OLLAMA_HOST Ollama local (default: localhost:11434)
|
|
464
|
-
COG_MODEL Override default model for any provider
|
|
465
|
-
`);
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
main().catch(e => {
|
|
469
|
-
console.error('Fatal error:', e);
|
|
470
|
-
process.exit(1);
|
|
471
|
-
});
|