@omnidev-ai/cli 0.10.0 → 0.10.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.
Files changed (2) hide show
  1. package/dist/index.js +35 -13
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -22,7 +22,7 @@ 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 existsSync8 } from "node:fs";
25
+ import { existsSync as existsSync9 } from "node:fs";
26
26
  import { createRequire as createRequire2 } from "node:module";
27
27
  import { join as join9 } from "node:path";
28
28
  import { buildApplication, buildRouteMap as buildRouteMap5 } from "@stricli/core";
@@ -1205,13 +1205,7 @@ async function runInit(_flags, providerArg) {
1205
1205
  projectRoot: process.cwd(),
1206
1206
  config
1207
1207
  };
1208
- const allAdapters = getAllAdapters();
1209
- const selectedAdapters = allAdapters.filter((a) => providerIds.includes(a.id));
1210
- for (const adapter of selectedAdapters) {
1211
- if (adapter.init) {
1212
- await adapter.init(ctx);
1213
- }
1214
- }
1208
+ const selectedAdapters = await initializeAdaptersForProviders(providerIds, ctx);
1215
1209
  const enabledAdapters = await getEnabledAdapters();
1216
1210
  await syncAgentConfiguration3({ silent: true, adapters: enabledAdapters });
1217
1211
  console.log("");
@@ -1222,6 +1216,16 @@ async function runInit(_flags, providerArg) {
1222
1216
  console.log("");
1223
1217
  console.log("\uD83D\uDCA1 Run 'omnidev capability list' to see available capabilities.");
1224
1218
  }
1219
+ async function initializeAdaptersForProviders(providerIds, ctx) {
1220
+ const allAdapters = getAllAdapters();
1221
+ const selectedAdapters = allAdapters.filter((a) => providerIds.includes(a.id));
1222
+ for (const adapter of selectedAdapters) {
1223
+ if (adapter.init) {
1224
+ await adapter.init(ctx);
1225
+ }
1226
+ }
1227
+ return selectedAdapters;
1228
+ }
1225
1229
  var initCommand = buildCommand4({
1226
1230
  parameters: {
1227
1231
  flags: {},
@@ -1546,8 +1550,15 @@ var providerRoutes = buildRouteMap4({
1546
1550
  });
1547
1551
 
1548
1552
  // src/commands/sync.ts
1549
- import { getActiveProfile as getActiveProfile3, loadConfig as loadConfig3, syncAgentConfiguration as syncAgentConfiguration6 } from "@omnidev-ai/core";
1553
+ import { existsSync as existsSync8 } from "node:fs";
1554
+ import {
1555
+ getActiveProfile as getActiveProfile3,
1556
+ loadConfig as loadConfig3,
1557
+ syncAgentConfiguration as syncAgentConfiguration6,
1558
+ writeEnabledProviders as writeEnabledProviders2
1559
+ } from "@omnidev-ai/core";
1550
1560
  import { buildCommand as buildCommand7 } from "@stricli/core";
1561
+ var PROVIDERS_STATE_PATH = ".omni/state/providers.json";
1551
1562
  var syncCommand = buildCommand7({
1552
1563
  docs: {
1553
1564
  brief: "Manually sync all capabilities, roles, and instructions"
@@ -1563,7 +1574,18 @@ async function runSync() {
1563
1574
  try {
1564
1575
  const config = await loadConfig3();
1565
1576
  const activeProfile = await getActiveProfile3() ?? config.active_profile ?? "default";
1566
- const adapters = await getEnabledAdapters();
1577
+ let adapters = await getEnabledAdapters();
1578
+ if (!existsSync8(PROVIDERS_STATE_PATH) || adapters.length === 0) {
1579
+ console.log("No providers configured yet. Select your provider(s):");
1580
+ const providerIds = await promptForProviders();
1581
+ await writeEnabledProviders2(providerIds);
1582
+ const ctx = {
1583
+ projectRoot: process.cwd(),
1584
+ config
1585
+ };
1586
+ adapters = await initializeAdaptersForProviders(providerIds, ctx);
1587
+ console.log("");
1588
+ }
1567
1589
  const result = await syncAgentConfiguration6({ silent: false, adapters });
1568
1590
  console.log("");
1569
1591
  console.log("✓ Sync completed successfully!");
@@ -1610,7 +1632,7 @@ async function buildDynamicApp() {
1610
1632
  provider: providerRoutes
1611
1633
  };
1612
1634
  debug("Core routes registered", Object.keys(routes));
1613
- if (existsSync8(".omni/config.toml")) {
1635
+ if (existsSync9(".omni/config.toml")) {
1614
1636
  try {
1615
1637
  const capabilityCommands = await loadCapabilityCommands();
1616
1638
  debug("Capability commands loaded", {
@@ -1681,9 +1703,9 @@ async function loadCapabilityCommands() {
1681
1703
  async function loadCapabilityExport(capability) {
1682
1704
  const capabilityPath = join9(process.cwd(), capability.path);
1683
1705
  const indexPath = join9(capabilityPath, "index.ts");
1684
- if (!existsSync8(indexPath)) {
1706
+ if (!existsSync9(indexPath)) {
1685
1707
  const jsIndexPath = join9(capabilityPath, "index.js");
1686
- if (!existsSync8(jsIndexPath)) {
1708
+ if (!existsSync9(jsIndexPath)) {
1687
1709
  return null;
1688
1710
  }
1689
1711
  const module2 = await import(jsIndexPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnidev-ai/cli",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@inquirer/prompts": "^8.1.0",
31
- "@omnidev-ai/core": "0.10.0",
31
+ "@omnidev-ai/core": "0.10.1",
32
32
  "@stricli/core": "^1.2.5"
33
33
  },
34
34
  "devDependencies": {