@omnidev-ai/cli 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +380 -54
- package/package.json +36 -36
package/dist/index.js
CHANGED
|
@@ -22,10 +22,13 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
|
22
22
|
import { run } from "@stricli/core";
|
|
23
23
|
|
|
24
24
|
// src/lib/dynamic-app.ts
|
|
25
|
-
import { existsSync as
|
|
25
|
+
import { existsSync as existsSync8 } from "node:fs";
|
|
26
26
|
import { createRequire as createRequire2 } from "node:module";
|
|
27
27
|
import { join as join5 } from "node:path";
|
|
28
|
-
import { buildApplication, buildRouteMap as
|
|
28
|
+
import { buildApplication, buildRouteMap as buildRouteMap5 } from "@stricli/core";
|
|
29
|
+
|
|
30
|
+
// src/commands/add.ts
|
|
31
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
29
32
|
|
|
30
33
|
// ../adapters/src/claude-code/index.ts
|
|
31
34
|
import { existsSync, mkdirSync } from "node:fs";
|
|
@@ -201,6 +204,328 @@ async function getEnabledAdapters() {
|
|
|
201
204
|
const enabledIds = await readEnabledProviders();
|
|
202
205
|
return enabledIds.map((id) => adapterMap.get(id)).filter((a) => a != null);
|
|
203
206
|
}
|
|
207
|
+
// src/commands/add.ts
|
|
208
|
+
import {
|
|
209
|
+
getActiveProfile,
|
|
210
|
+
loadBaseConfig,
|
|
211
|
+
syncAgentConfiguration,
|
|
212
|
+
writeConfig
|
|
213
|
+
} from "@omnidev-ai/core";
|
|
214
|
+
import { buildCommand, buildRouteMap } from "@stricli/core";
|
|
215
|
+
function addToActiveProfile(config, activeProfile, capabilityName) {
|
|
216
|
+
if (!config.profiles) {
|
|
217
|
+
config.profiles = {};
|
|
218
|
+
}
|
|
219
|
+
if (!config.profiles[activeProfile]) {
|
|
220
|
+
config.profiles[activeProfile] = { capabilities: [] };
|
|
221
|
+
}
|
|
222
|
+
if (!config.profiles[activeProfile].capabilities) {
|
|
223
|
+
config.profiles[activeProfile].capabilities = [];
|
|
224
|
+
}
|
|
225
|
+
if (!config.profiles[activeProfile].capabilities.includes(capabilityName)) {
|
|
226
|
+
config.profiles[activeProfile].capabilities.push(capabilityName);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
async function runAddCap(flags, name) {
|
|
230
|
+
try {
|
|
231
|
+
if (!existsSync4("omni.toml")) {
|
|
232
|
+
console.log("✗ No config file found");
|
|
233
|
+
console.log(" Run: omnidev init");
|
|
234
|
+
process.exit(1);
|
|
235
|
+
}
|
|
236
|
+
if (!flags.github.includes("/")) {
|
|
237
|
+
console.error("✗ Invalid GitHub repository format");
|
|
238
|
+
console.log(" Expected format: user/repo");
|
|
239
|
+
console.log(" Example: omnidev add cap my-cap --github expo/skills");
|
|
240
|
+
process.exit(1);
|
|
241
|
+
}
|
|
242
|
+
const config = await loadBaseConfig();
|
|
243
|
+
const activeProfile = await getActiveProfile() ?? config.active_profile ?? "default";
|
|
244
|
+
if (!config.capabilities) {
|
|
245
|
+
config.capabilities = {};
|
|
246
|
+
}
|
|
247
|
+
if (!config.capabilities.sources) {
|
|
248
|
+
config.capabilities.sources = {};
|
|
249
|
+
}
|
|
250
|
+
if (config.capabilities.sources[name]) {
|
|
251
|
+
console.error(`✗ Capability source "${name}" already exists`);
|
|
252
|
+
console.log(" Use a different name or remove the existing source first");
|
|
253
|
+
process.exit(1);
|
|
254
|
+
}
|
|
255
|
+
const source = `github:${flags.github}`;
|
|
256
|
+
if (flags.path) {
|
|
257
|
+
config.capabilities.sources[name] = { source, path: flags.path };
|
|
258
|
+
} else {
|
|
259
|
+
config.capabilities.sources[name] = source;
|
|
260
|
+
}
|
|
261
|
+
addToActiveProfile(config, activeProfile, name);
|
|
262
|
+
await writeConfig(config);
|
|
263
|
+
console.log(`✓ Added capability source: ${name}`);
|
|
264
|
+
console.log(` Source: ${source}`);
|
|
265
|
+
if (flags.path) {
|
|
266
|
+
console.log(` Path: ${flags.path}`);
|
|
267
|
+
}
|
|
268
|
+
console.log(` Enabled in profile: ${activeProfile}`);
|
|
269
|
+
console.log("");
|
|
270
|
+
const adapters = await getEnabledAdapters();
|
|
271
|
+
await syncAgentConfiguration({ adapters });
|
|
272
|
+
console.log("✓ Sync completed");
|
|
273
|
+
} catch (error) {
|
|
274
|
+
console.error("✗ Error adding capability:", error);
|
|
275
|
+
process.exit(1);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
async function runAddMcp(flags, name) {
|
|
279
|
+
try {
|
|
280
|
+
if (!existsSync4("omni.toml")) {
|
|
281
|
+
console.log("✗ No config file found");
|
|
282
|
+
console.log(" Run: omnidev init");
|
|
283
|
+
process.exit(1);
|
|
284
|
+
}
|
|
285
|
+
const config = await loadBaseConfig();
|
|
286
|
+
const activeProfile = await getActiveProfile() ?? config.active_profile ?? "default";
|
|
287
|
+
if (!config.mcps) {
|
|
288
|
+
config.mcps = {};
|
|
289
|
+
}
|
|
290
|
+
if (config.mcps[name]) {
|
|
291
|
+
console.error(`✗ MCP "${name}" already exists`);
|
|
292
|
+
console.log(" Use a different name or remove the existing MCP first");
|
|
293
|
+
process.exit(1);
|
|
294
|
+
}
|
|
295
|
+
const transport = flags.transport ?? "stdio";
|
|
296
|
+
const mcpConfig = {};
|
|
297
|
+
if (transport === "http" || transport === "sse") {
|
|
298
|
+
if (!flags.url) {
|
|
299
|
+
console.error("✗ --url is required for http/sse transport");
|
|
300
|
+
console.log(" Example: omnidev add mcp notion --transport http --url https://mcp.notion.com/mcp");
|
|
301
|
+
process.exit(1);
|
|
302
|
+
}
|
|
303
|
+
mcpConfig.transport = transport;
|
|
304
|
+
mcpConfig.url = flags.url;
|
|
305
|
+
if (flags.header && flags.header.length > 0) {
|
|
306
|
+
mcpConfig.headers = {};
|
|
307
|
+
for (const header of flags.header) {
|
|
308
|
+
const colonIndex = header.indexOf(":");
|
|
309
|
+
if (colonIndex === -1) {
|
|
310
|
+
console.error(`✗ Invalid header format: ${header}`);
|
|
311
|
+
console.log(" Expected format: Name: Value");
|
|
312
|
+
process.exit(1);
|
|
313
|
+
}
|
|
314
|
+
const headerName = header.slice(0, colonIndex).trim();
|
|
315
|
+
const headerValue = header.slice(colonIndex + 1).trim();
|
|
316
|
+
mcpConfig.headers[headerName] = headerValue;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
} else {
|
|
320
|
+
if (!flags.command) {
|
|
321
|
+
console.error("✗ --command is required for stdio transport");
|
|
322
|
+
console.log(" Example: omnidev add mcp filesystem --command npx --args '-y @modelcontextprotocol/server-filesystem /path'");
|
|
323
|
+
process.exit(1);
|
|
324
|
+
}
|
|
325
|
+
mcpConfig.command = flags.command;
|
|
326
|
+
if (flags.args) {
|
|
327
|
+
mcpConfig.args = parseArgs(flags.args);
|
|
328
|
+
}
|
|
329
|
+
if (flags.env && flags.env.length > 0) {
|
|
330
|
+
mcpConfig.env = {};
|
|
331
|
+
for (const envVar of flags.env) {
|
|
332
|
+
const eqIndex = envVar.indexOf("=");
|
|
333
|
+
if (eqIndex === -1) {
|
|
334
|
+
console.error(`✗ Invalid env format: ${envVar}`);
|
|
335
|
+
console.log(" Expected format: KEY=value");
|
|
336
|
+
process.exit(1);
|
|
337
|
+
}
|
|
338
|
+
const key = envVar.slice(0, eqIndex);
|
|
339
|
+
const value = envVar.slice(eqIndex + 1);
|
|
340
|
+
mcpConfig.env[key] = value;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
config.mcps[name] = mcpConfig;
|
|
345
|
+
addToActiveProfile(config, activeProfile, name);
|
|
346
|
+
await writeConfig(config);
|
|
347
|
+
console.log(`✓ Added MCP: ${name}`);
|
|
348
|
+
console.log(` Transport: ${transport}`);
|
|
349
|
+
if (mcpConfig.url) {
|
|
350
|
+
console.log(` URL: ${mcpConfig.url}`);
|
|
351
|
+
}
|
|
352
|
+
if (mcpConfig.command) {
|
|
353
|
+
console.log(` Command: ${mcpConfig.command}`);
|
|
354
|
+
if (mcpConfig.args) {
|
|
355
|
+
console.log(` Args: ${mcpConfig.args.join(" ")}`);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
console.log(` Enabled in profile: ${activeProfile}`);
|
|
359
|
+
console.log("");
|
|
360
|
+
const adapters = await getEnabledAdapters();
|
|
361
|
+
await syncAgentConfiguration({ adapters });
|
|
362
|
+
console.log("✓ Sync completed");
|
|
363
|
+
} catch (error) {
|
|
364
|
+
console.error("✗ Error adding MCP:", error);
|
|
365
|
+
process.exit(1);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
function parseArgs(argsString) {
|
|
369
|
+
const args = [];
|
|
370
|
+
let current = "";
|
|
371
|
+
let inQuote = false;
|
|
372
|
+
let quoteChar = "";
|
|
373
|
+
for (let i = 0;i < argsString.length; i++) {
|
|
374
|
+
const char = argsString[i];
|
|
375
|
+
if ((char === '"' || char === "'") && !inQuote) {
|
|
376
|
+
inQuote = true;
|
|
377
|
+
quoteChar = char;
|
|
378
|
+
} else if (char === quoteChar && inQuote) {
|
|
379
|
+
inQuote = false;
|
|
380
|
+
quoteChar = "";
|
|
381
|
+
} else if (char === " " && !inQuote) {
|
|
382
|
+
if (current) {
|
|
383
|
+
args.push(current);
|
|
384
|
+
current = "";
|
|
385
|
+
}
|
|
386
|
+
} else {
|
|
387
|
+
current += char;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
if (current) {
|
|
391
|
+
args.push(current);
|
|
392
|
+
}
|
|
393
|
+
return args;
|
|
394
|
+
}
|
|
395
|
+
async function runAddCapWrapper(flags, name) {
|
|
396
|
+
await runAddCap({ github: flags.github, path: flags.path }, name);
|
|
397
|
+
}
|
|
398
|
+
var addCapCommand = buildCommand({
|
|
399
|
+
docs: {
|
|
400
|
+
brief: "Add a capability source from GitHub",
|
|
401
|
+
fullDescription: "Add a capability source from a GitHub repository. The capability will be auto-enabled in the active profile."
|
|
402
|
+
},
|
|
403
|
+
parameters: {
|
|
404
|
+
flags: {
|
|
405
|
+
github: {
|
|
406
|
+
kind: "parsed",
|
|
407
|
+
brief: "GitHub repository in user/repo format",
|
|
408
|
+
parse: String
|
|
409
|
+
},
|
|
410
|
+
path: {
|
|
411
|
+
kind: "parsed",
|
|
412
|
+
brief: "Subdirectory within the repo containing the capability",
|
|
413
|
+
parse: String,
|
|
414
|
+
optional: true
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
positional: {
|
|
418
|
+
kind: "tuple",
|
|
419
|
+
parameters: [
|
|
420
|
+
{
|
|
421
|
+
brief: "Capability name",
|
|
422
|
+
parse: String
|
|
423
|
+
}
|
|
424
|
+
]
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
func: runAddCapWrapper
|
|
428
|
+
});
|
|
429
|
+
async function runAddMcpWrapper(flags, name) {
|
|
430
|
+
await runAddMcp({
|
|
431
|
+
transport: flags.transport,
|
|
432
|
+
url: flags.url,
|
|
433
|
+
command: flags.command,
|
|
434
|
+
args: flags.args,
|
|
435
|
+
header: flags.header,
|
|
436
|
+
env: flags.env
|
|
437
|
+
}, name);
|
|
438
|
+
}
|
|
439
|
+
var addMcpCommand = buildCommand({
|
|
440
|
+
docs: {
|
|
441
|
+
brief: "Add an MCP server",
|
|
442
|
+
fullDescription: `Add an MCP server to the configuration. Supports three transport types:
|
|
443
|
+
|
|
444
|
+
HTTP remote server:
|
|
445
|
+
omnidev add mcp <name> --transport http --url <url> [--header "Header: value"]
|
|
446
|
+
|
|
447
|
+
SSE remote server (deprecated):
|
|
448
|
+
omnidev add mcp <name> --transport sse --url <url> [--header "Header: value"]
|
|
449
|
+
|
|
450
|
+
Stdio local process (default):
|
|
451
|
+
omnidev add mcp <name> --command <cmd> [--args "arg1 arg2"] [--env KEY=value]
|
|
452
|
+
|
|
453
|
+
Examples:
|
|
454
|
+
omnidev add mcp notion --transport http --url https://mcp.notion.com/mcp
|
|
455
|
+
omnidev add mcp secure-api --transport http --url https://api.example.com/mcp --header "Authorization: Bearer token"
|
|
456
|
+
omnidev add mcp filesystem --command npx --args "-y @modelcontextprotocol/server-filesystem /path"
|
|
457
|
+
omnidev add mcp database --command node --args "./servers/db.js" --env DB_URL=postgres://localhost`
|
|
458
|
+
},
|
|
459
|
+
parameters: {
|
|
460
|
+
flags: {
|
|
461
|
+
transport: {
|
|
462
|
+
kind: "parsed",
|
|
463
|
+
brief: "Transport type: stdio (default), http, or sse",
|
|
464
|
+
parse: String,
|
|
465
|
+
optional: true
|
|
466
|
+
},
|
|
467
|
+
url: {
|
|
468
|
+
kind: "parsed",
|
|
469
|
+
brief: "URL for http/sse transport",
|
|
470
|
+
parse: String,
|
|
471
|
+
optional: true
|
|
472
|
+
},
|
|
473
|
+
command: {
|
|
474
|
+
kind: "parsed",
|
|
475
|
+
brief: "Command to run for stdio transport",
|
|
476
|
+
parse: String,
|
|
477
|
+
optional: true
|
|
478
|
+
},
|
|
479
|
+
args: {
|
|
480
|
+
kind: "parsed",
|
|
481
|
+
brief: "Arguments for the command (space-separated, use quotes for args with spaces)",
|
|
482
|
+
parse: String,
|
|
483
|
+
optional: true
|
|
484
|
+
},
|
|
485
|
+
header: {
|
|
486
|
+
kind: "parsed",
|
|
487
|
+
brief: "HTTP header in 'Name: Value' format (repeatable)",
|
|
488
|
+
parse: String,
|
|
489
|
+
optional: true,
|
|
490
|
+
variadic: true
|
|
491
|
+
},
|
|
492
|
+
env: {
|
|
493
|
+
kind: "parsed",
|
|
494
|
+
brief: "Environment variable in KEY=value format (repeatable)",
|
|
495
|
+
parse: String,
|
|
496
|
+
optional: true,
|
|
497
|
+
variadic: true
|
|
498
|
+
}
|
|
499
|
+
},
|
|
500
|
+
positional: {
|
|
501
|
+
kind: "tuple",
|
|
502
|
+
parameters: [
|
|
503
|
+
{
|
|
504
|
+
brief: "MCP name",
|
|
505
|
+
parse: String
|
|
506
|
+
}
|
|
507
|
+
]
|
|
508
|
+
},
|
|
509
|
+
aliases: {
|
|
510
|
+
t: "transport",
|
|
511
|
+
u: "url",
|
|
512
|
+
c: "command",
|
|
513
|
+
a: "args",
|
|
514
|
+
e: "env"
|
|
515
|
+
}
|
|
516
|
+
},
|
|
517
|
+
func: runAddMcpWrapper
|
|
518
|
+
});
|
|
519
|
+
var addRoutes = buildRouteMap({
|
|
520
|
+
routes: {
|
|
521
|
+
cap: addCapCommand,
|
|
522
|
+
mcp: addMcpCommand
|
|
523
|
+
},
|
|
524
|
+
docs: {
|
|
525
|
+
brief: "Add capabilities or MCP servers"
|
|
526
|
+
}
|
|
527
|
+
});
|
|
528
|
+
|
|
204
529
|
// src/commands/capability.ts
|
|
205
530
|
import {
|
|
206
531
|
disableCapability,
|
|
@@ -208,9 +533,9 @@ import {
|
|
|
208
533
|
enableCapability,
|
|
209
534
|
getEnabledCapabilities,
|
|
210
535
|
loadCapabilityConfig,
|
|
211
|
-
syncAgentConfiguration
|
|
536
|
+
syncAgentConfiguration as syncAgentConfiguration2
|
|
212
537
|
} from "@omnidev-ai/core";
|
|
213
|
-
import { buildCommand, buildRouteMap } from "@stricli/core";
|
|
538
|
+
import { buildCommand as buildCommand2, buildRouteMap as buildRouteMap2 } from "@stricli/core";
|
|
214
539
|
async function runCapabilityList() {
|
|
215
540
|
try {
|
|
216
541
|
const enabledIds = await getEnabledCapabilities();
|
|
@@ -261,7 +586,7 @@ async function runCapabilityEnable(_flags, name) {
|
|
|
261
586
|
console.log(`✓ Enabled capability: ${name}`);
|
|
262
587
|
console.log("");
|
|
263
588
|
const adapters = await getEnabledAdapters();
|
|
264
|
-
await
|
|
589
|
+
await syncAgentConfiguration2({ adapters });
|
|
265
590
|
} catch (error) {
|
|
266
591
|
console.error("Error enabling capability:", error);
|
|
267
592
|
process.exit(1);
|
|
@@ -273,13 +598,13 @@ async function runCapabilityDisable(_flags, name) {
|
|
|
273
598
|
console.log(`✓ Disabled capability: ${name}`);
|
|
274
599
|
console.log("");
|
|
275
600
|
const adapters = await getEnabledAdapters();
|
|
276
|
-
await
|
|
601
|
+
await syncAgentConfiguration2({ adapters });
|
|
277
602
|
} catch (error) {
|
|
278
603
|
console.error("Error disabling capability:", error);
|
|
279
604
|
process.exit(1);
|
|
280
605
|
}
|
|
281
606
|
}
|
|
282
|
-
var listCommand =
|
|
607
|
+
var listCommand = buildCommand2({
|
|
283
608
|
docs: {
|
|
284
609
|
brief: "List all discovered capabilities"
|
|
285
610
|
},
|
|
@@ -288,7 +613,7 @@ var listCommand = buildCommand({
|
|
|
288
613
|
await runCapabilityList();
|
|
289
614
|
}
|
|
290
615
|
});
|
|
291
|
-
var enableCommand =
|
|
616
|
+
var enableCommand = buildCommand2({
|
|
292
617
|
docs: {
|
|
293
618
|
brief: "Enable a capability"
|
|
294
619
|
},
|
|
@@ -306,7 +631,7 @@ var enableCommand = buildCommand({
|
|
|
306
631
|
},
|
|
307
632
|
func: runCapabilityEnable
|
|
308
633
|
});
|
|
309
|
-
var disableCommand =
|
|
634
|
+
var disableCommand = buildCommand2({
|
|
310
635
|
docs: {
|
|
311
636
|
brief: "Disable a capability"
|
|
312
637
|
},
|
|
@@ -324,7 +649,7 @@ var disableCommand = buildCommand({
|
|
|
324
649
|
},
|
|
325
650
|
func: runCapabilityDisable
|
|
326
651
|
});
|
|
327
|
-
var capabilityRoutes =
|
|
652
|
+
var capabilityRoutes = buildRouteMap2({
|
|
328
653
|
routes: {
|
|
329
654
|
list: listCommand,
|
|
330
655
|
enable: enableCommand,
|
|
@@ -336,12 +661,12 @@ var capabilityRoutes = buildRouteMap({
|
|
|
336
661
|
});
|
|
337
662
|
|
|
338
663
|
// src/commands/doctor.ts
|
|
339
|
-
import { existsSync as
|
|
664
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
340
665
|
import { execFile } from "node:child_process";
|
|
341
666
|
import { readFile } from "node:fs/promises";
|
|
342
667
|
import { promisify } from "node:util";
|
|
343
|
-
import { buildCommand as
|
|
344
|
-
var doctorCommand =
|
|
668
|
+
import { buildCommand as buildCommand3 } from "@stricli/core";
|
|
669
|
+
var doctorCommand = buildCommand3({
|
|
345
670
|
docs: {
|
|
346
671
|
brief: "Check OmniDev setup and dependencies"
|
|
347
672
|
},
|
|
@@ -426,7 +751,7 @@ async function checkPackageManager() {
|
|
|
426
751
|
}
|
|
427
752
|
}
|
|
428
753
|
async function checkOmniLocalDir() {
|
|
429
|
-
const exists =
|
|
754
|
+
const exists = existsSync5(".omni");
|
|
430
755
|
if (!exists) {
|
|
431
756
|
return {
|
|
432
757
|
name: ".omni/ directory",
|
|
@@ -443,7 +768,7 @@ async function checkOmniLocalDir() {
|
|
|
443
768
|
}
|
|
444
769
|
async function checkConfig() {
|
|
445
770
|
const configPath = "omni.toml";
|
|
446
|
-
if (!
|
|
771
|
+
if (!existsSync5(configPath)) {
|
|
447
772
|
return {
|
|
448
773
|
name: "Configuration",
|
|
449
774
|
passed: false,
|
|
@@ -470,7 +795,7 @@ async function checkConfig() {
|
|
|
470
795
|
}
|
|
471
796
|
async function checkRootGitignore() {
|
|
472
797
|
const gitignorePath = ".gitignore";
|
|
473
|
-
if (!
|
|
798
|
+
if (!existsSync5(gitignorePath)) {
|
|
474
799
|
return {
|
|
475
800
|
name: "Root .gitignore",
|
|
476
801
|
passed: false,
|
|
@@ -504,7 +829,7 @@ async function checkRootGitignore() {
|
|
|
504
829
|
}
|
|
505
830
|
async function checkCapabilitiesDir() {
|
|
506
831
|
const capabilitiesDirPath = ".omni/capabilities";
|
|
507
|
-
if (!
|
|
832
|
+
if (!existsSync5(capabilitiesDirPath)) {
|
|
508
833
|
return {
|
|
509
834
|
name: "Capabilities Directory",
|
|
510
835
|
passed: true,
|
|
@@ -519,17 +844,17 @@ async function checkCapabilitiesDir() {
|
|
|
519
844
|
}
|
|
520
845
|
|
|
521
846
|
// src/commands/init.ts
|
|
522
|
-
import { existsSync as
|
|
847
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync4 } from "node:fs";
|
|
523
848
|
import { readFile as readFile2, writeFile as writeFile5 } from "node:fs/promises";
|
|
524
849
|
import {
|
|
525
850
|
generateInstructionsTemplate,
|
|
526
851
|
loadConfig,
|
|
527
852
|
setActiveProfile,
|
|
528
|
-
syncAgentConfiguration as
|
|
529
|
-
writeConfig,
|
|
853
|
+
syncAgentConfiguration as syncAgentConfiguration3,
|
|
854
|
+
writeConfig as writeConfig2,
|
|
530
855
|
writeEnabledProviders
|
|
531
856
|
} from "@omnidev-ai/core";
|
|
532
|
-
import { buildCommand as
|
|
857
|
+
import { buildCommand as buildCommand4 } from "@stricli/core";
|
|
533
858
|
|
|
534
859
|
// src/prompts/provider.ts
|
|
535
860
|
import { checkbox } from "@inquirer/prompts";
|
|
@@ -561,8 +886,8 @@ async function runInit(_flags, providerArg) {
|
|
|
561
886
|
providerIds = await promptForProviders();
|
|
562
887
|
}
|
|
563
888
|
await writeEnabledProviders(providerIds);
|
|
564
|
-
if (!
|
|
565
|
-
await
|
|
889
|
+
if (!existsSync6("omni.toml")) {
|
|
890
|
+
await writeConfig2({
|
|
566
891
|
project: "my-project",
|
|
567
892
|
profiles: {
|
|
568
893
|
default: {
|
|
@@ -578,7 +903,7 @@ async function runInit(_flags, providerArg) {
|
|
|
578
903
|
});
|
|
579
904
|
await setActiveProfile("default");
|
|
580
905
|
}
|
|
581
|
-
if (!
|
|
906
|
+
if (!existsSync6(".omni/instructions.md")) {
|
|
582
907
|
await writeFile5(".omni/instructions.md", generateInstructionsTemplate(), "utf-8");
|
|
583
908
|
}
|
|
584
909
|
const config = await loadConfig();
|
|
@@ -599,7 +924,7 @@ async function runInit(_flags, providerArg) {
|
|
|
599
924
|
}
|
|
600
925
|
}
|
|
601
926
|
const enabledAdapters = await getEnabledAdapters();
|
|
602
|
-
await
|
|
927
|
+
await syncAgentConfiguration3({ silent: true, adapters: enabledAdapters });
|
|
603
928
|
console.log("");
|
|
604
929
|
console.log(`✓ OmniDev initialized for ${selectedAdapters.map((a) => a.displayName).join(" and ")}!`);
|
|
605
930
|
console.log("");
|
|
@@ -620,7 +945,7 @@ async function runInit(_flags, providerArg) {
|
|
|
620
945
|
console.log("");
|
|
621
946
|
console.log(" Run 'omnidev capability list' to see available capabilities.");
|
|
622
947
|
}
|
|
623
|
-
var initCommand =
|
|
948
|
+
var initCommand = buildCommand4({
|
|
624
949
|
parameters: {
|
|
625
950
|
flags: {},
|
|
626
951
|
positional: {
|
|
@@ -663,7 +988,7 @@ async function updateRootGitignore() {
|
|
|
663
988
|
const gitignorePath = ".gitignore";
|
|
664
989
|
const entriesToAdd = [".omni/", "omni.local.toml"];
|
|
665
990
|
let content = "";
|
|
666
|
-
if (
|
|
991
|
+
if (existsSync6(gitignorePath)) {
|
|
667
992
|
content = await readFile2(gitignorePath, "utf-8");
|
|
668
993
|
}
|
|
669
994
|
const lines = content.split(`
|
|
@@ -683,16 +1008,16 @@ ${missingEntries.join(`
|
|
|
683
1008
|
}
|
|
684
1009
|
|
|
685
1010
|
// src/commands/profile.ts
|
|
686
|
-
import { existsSync as
|
|
1011
|
+
import { existsSync as existsSync7 } from "node:fs";
|
|
687
1012
|
import {
|
|
688
|
-
getActiveProfile,
|
|
1013
|
+
getActiveProfile as getActiveProfile2,
|
|
689
1014
|
loadConfig as loadConfig2,
|
|
690
1015
|
resolveEnabledCapabilities,
|
|
691
1016
|
setActiveProfile as setActiveProfile2,
|
|
692
|
-
syncAgentConfiguration as
|
|
1017
|
+
syncAgentConfiguration as syncAgentConfiguration4
|
|
693
1018
|
} from "@omnidev-ai/core";
|
|
694
|
-
import { buildCommand as
|
|
695
|
-
var listCommand2 =
|
|
1019
|
+
import { buildCommand as buildCommand5, buildRouteMap as buildRouteMap3 } from "@stricli/core";
|
|
1020
|
+
var listCommand2 = buildCommand5({
|
|
696
1021
|
docs: {
|
|
697
1022
|
brief: "List available profiles"
|
|
698
1023
|
},
|
|
@@ -704,7 +1029,7 @@ var listCommand2 = buildCommand4({
|
|
|
704
1029
|
async function runSetCommand(_flags, profileName) {
|
|
705
1030
|
await runProfileSet(profileName);
|
|
706
1031
|
}
|
|
707
|
-
var setCommand =
|
|
1032
|
+
var setCommand = buildCommand5({
|
|
708
1033
|
docs: {
|
|
709
1034
|
brief: "Set the active profile"
|
|
710
1035
|
},
|
|
@@ -722,7 +1047,7 @@ var setCommand = buildCommand4({
|
|
|
722
1047
|
},
|
|
723
1048
|
func: runSetCommand
|
|
724
1049
|
});
|
|
725
|
-
var profileRoutes =
|
|
1050
|
+
var profileRoutes = buildRouteMap3({
|
|
726
1051
|
routes: {
|
|
727
1052
|
list: listCommand2,
|
|
728
1053
|
set: setCommand
|
|
@@ -733,13 +1058,13 @@ var profileRoutes = buildRouteMap2({
|
|
|
733
1058
|
});
|
|
734
1059
|
async function runProfileList() {
|
|
735
1060
|
try {
|
|
736
|
-
if (!
|
|
1061
|
+
if (!existsSync7("omni.toml")) {
|
|
737
1062
|
console.log("✗ No config file found");
|
|
738
1063
|
console.log(" Run: omnidev init");
|
|
739
1064
|
process.exit(1);
|
|
740
1065
|
}
|
|
741
1066
|
const config = await loadConfig2();
|
|
742
|
-
const activeProfile = await
|
|
1067
|
+
const activeProfile = await getActiveProfile2() ?? config.active_profile ?? "default";
|
|
743
1068
|
const profiles = config.profiles ?? {};
|
|
744
1069
|
const profileNames = Object.keys(profiles);
|
|
745
1070
|
if (profileNames.length === 0) {
|
|
@@ -773,7 +1098,7 @@ async function runProfileList() {
|
|
|
773
1098
|
}
|
|
774
1099
|
async function runProfileSet(profileName) {
|
|
775
1100
|
try {
|
|
776
|
-
if (!
|
|
1101
|
+
if (!existsSync7("omni.toml")) {
|
|
777
1102
|
console.log("✗ No config file found");
|
|
778
1103
|
console.log(" Run: omnidev init");
|
|
779
1104
|
process.exit(1);
|
|
@@ -798,7 +1123,7 @@ async function runProfileSet(profileName) {
|
|
|
798
1123
|
console.log(`✓ Active profile set to: ${profileName}`);
|
|
799
1124
|
console.log("");
|
|
800
1125
|
const adapters = await getEnabledAdapters();
|
|
801
|
-
await
|
|
1126
|
+
await syncAgentConfiguration4({ adapters });
|
|
802
1127
|
} catch (error) {
|
|
803
1128
|
console.error("✗ Error setting profile:", error);
|
|
804
1129
|
process.exit(1);
|
|
@@ -810,9 +1135,9 @@ import {
|
|
|
810
1135
|
disableProvider,
|
|
811
1136
|
enableProvider,
|
|
812
1137
|
readEnabledProviders as readEnabledProviders2,
|
|
813
|
-
syncAgentConfiguration as
|
|
1138
|
+
syncAgentConfiguration as syncAgentConfiguration5
|
|
814
1139
|
} from "@omnidev-ai/core";
|
|
815
|
-
import { buildCommand as
|
|
1140
|
+
import { buildCommand as buildCommand6, buildRouteMap as buildRouteMap4 } from "@stricli/core";
|
|
816
1141
|
async function runProviderList() {
|
|
817
1142
|
const enabled = await readEnabledProviders2();
|
|
818
1143
|
const allAdapters = getAllAdapters();
|
|
@@ -845,7 +1170,7 @@ async function runProviderEnable(_flags, providerId) {
|
|
|
845
1170
|
await enableProvider(providerId);
|
|
846
1171
|
console.log(`✓ Enabled provider: ${adapter.displayName}`);
|
|
847
1172
|
const enabledAdapters = await getEnabledAdapters();
|
|
848
|
-
await
|
|
1173
|
+
await syncAgentConfiguration5({ silent: false, adapters: enabledAdapters });
|
|
849
1174
|
}
|
|
850
1175
|
async function runProviderDisable(_flags, providerId) {
|
|
851
1176
|
if (!providerId) {
|
|
@@ -866,7 +1191,7 @@ async function runProviderDisable(_flags, providerId) {
|
|
|
866
1191
|
await disableProvider(providerId);
|
|
867
1192
|
console.log(`✓ Disabled provider: ${adapter.displayName}`);
|
|
868
1193
|
}
|
|
869
|
-
var listCommand3 =
|
|
1194
|
+
var listCommand3 = buildCommand6({
|
|
870
1195
|
parameters: {
|
|
871
1196
|
flags: {},
|
|
872
1197
|
positional: { kind: "tuple", parameters: [] }
|
|
@@ -876,7 +1201,7 @@ var listCommand3 = buildCommand5({
|
|
|
876
1201
|
},
|
|
877
1202
|
func: runProviderList
|
|
878
1203
|
});
|
|
879
|
-
var enableCommand2 =
|
|
1204
|
+
var enableCommand2 = buildCommand6({
|
|
880
1205
|
parameters: {
|
|
881
1206
|
flags: {},
|
|
882
1207
|
positional: {
|
|
@@ -895,7 +1220,7 @@ var enableCommand2 = buildCommand5({
|
|
|
895
1220
|
},
|
|
896
1221
|
func: runProviderEnable
|
|
897
1222
|
});
|
|
898
|
-
var disableCommand2 =
|
|
1223
|
+
var disableCommand2 = buildCommand6({
|
|
899
1224
|
parameters: {
|
|
900
1225
|
flags: {},
|
|
901
1226
|
positional: {
|
|
@@ -914,7 +1239,7 @@ var disableCommand2 = buildCommand5({
|
|
|
914
1239
|
},
|
|
915
1240
|
func: runProviderDisable
|
|
916
1241
|
});
|
|
917
|
-
var providerRoutes =
|
|
1242
|
+
var providerRoutes = buildRouteMap4({
|
|
918
1243
|
routes: {
|
|
919
1244
|
list: listCommand3,
|
|
920
1245
|
enable: enableCommand2,
|
|
@@ -926,9 +1251,9 @@ var providerRoutes = buildRouteMap3({
|
|
|
926
1251
|
});
|
|
927
1252
|
|
|
928
1253
|
// src/commands/sync.ts
|
|
929
|
-
import { getActiveProfile as
|
|
930
|
-
import { buildCommand as
|
|
931
|
-
var syncCommand =
|
|
1254
|
+
import { getActiveProfile as getActiveProfile3, loadConfig as loadConfig3, syncAgentConfiguration as syncAgentConfiguration6 } from "@omnidev-ai/core";
|
|
1255
|
+
import { buildCommand as buildCommand7 } from "@stricli/core";
|
|
1256
|
+
var syncCommand = buildCommand7({
|
|
932
1257
|
docs: {
|
|
933
1258
|
brief: "Manually sync all capabilities, roles, and instructions"
|
|
934
1259
|
},
|
|
@@ -942,9 +1267,9 @@ async function runSync() {
|
|
|
942
1267
|
console.log("");
|
|
943
1268
|
try {
|
|
944
1269
|
const config = await loadConfig3();
|
|
945
|
-
const activeProfile = await
|
|
1270
|
+
const activeProfile = await getActiveProfile3() ?? config.active_profile ?? "default";
|
|
946
1271
|
const adapters = await getEnabledAdapters();
|
|
947
|
-
const result = await
|
|
1272
|
+
const result = await syncAgentConfiguration6({ silent: false, adapters });
|
|
948
1273
|
console.log("");
|
|
949
1274
|
console.log("✓ Sync completed successfully!");
|
|
950
1275
|
console.log("");
|
|
@@ -985,12 +1310,13 @@ async function buildDynamicApp() {
|
|
|
985
1310
|
init: initCommand,
|
|
986
1311
|
doctor: doctorCommand,
|
|
987
1312
|
sync: syncCommand,
|
|
1313
|
+
add: addRoutes,
|
|
988
1314
|
capability: capabilityRoutes,
|
|
989
1315
|
profile: profileRoutes,
|
|
990
1316
|
provider: providerRoutes
|
|
991
1317
|
};
|
|
992
1318
|
debug("Core routes registered", Object.keys(routes));
|
|
993
|
-
if (
|
|
1319
|
+
if (existsSync8(".omni/config.toml")) {
|
|
994
1320
|
try {
|
|
995
1321
|
const capabilityCommands = await loadCapabilityCommands();
|
|
996
1322
|
debug("Capability commands loaded", {
|
|
@@ -1011,7 +1337,7 @@ async function buildDynamicApp() {
|
|
|
1011
1337
|
}
|
|
1012
1338
|
}
|
|
1013
1339
|
debug("Final routes", Object.keys(routes));
|
|
1014
|
-
const app = buildApplication(
|
|
1340
|
+
const app = buildApplication(buildRouteMap5({
|
|
1015
1341
|
routes,
|
|
1016
1342
|
docs: {
|
|
1017
1343
|
brief: "OmniDev commands"
|
|
@@ -1061,9 +1387,9 @@ async function loadCapabilityCommands() {
|
|
|
1061
1387
|
async function loadCapabilityExport(capability) {
|
|
1062
1388
|
const capabilityPath = join5(process.cwd(), capability.path);
|
|
1063
1389
|
const indexPath = join5(capabilityPath, "index.ts");
|
|
1064
|
-
if (!
|
|
1390
|
+
if (!existsSync8(indexPath)) {
|
|
1065
1391
|
const jsIndexPath = join5(capabilityPath, "index.js");
|
|
1066
|
-
if (!
|
|
1392
|
+
if (!existsSync8(jsIndexPath)) {
|
|
1067
1393
|
return null;
|
|
1068
1394
|
}
|
|
1069
1395
|
const module2 = await import(jsIndexPath);
|
package/package.json
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
2
|
+
"name": "@omnidev-ai/cli",
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/Nikola-Milovic/omnidev.git",
|
|
9
|
+
"directory": "packages/cli"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"bin": {
|
|
15
|
+
"omnidev": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public",
|
|
23
|
+
"registry": "https://registry.npmjs.org"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"typecheck": "tsc --noEmit",
|
|
27
|
+
"build": "bunup"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@inquirer/prompts": "^8.1.0",
|
|
31
|
+
"@omnidev-ai/core": "0.7.0",
|
|
32
|
+
"@stricli/core": "^1.2.5"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@omnidev-ai/adapters": "0.0.1",
|
|
36
|
+
"bunup": "^0.16.20"
|
|
37
|
+
}
|
|
38
38
|
}
|