@omnidev-ai/cli 0.10.1 → 0.11.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.
Files changed (2) hide show
  1. package/dist/index.js +62 -7
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -103,12 +103,12 @@ var InstructionsMdWriter = {
103
103
  omniMdContent = await readFile2(omniMdPath, "utf-8");
104
104
  }
105
105
  let content = omniMdContent;
106
- content += `
107
-
108
- ## OmniDev
106
+ if (bundle.instructionsContent) {
107
+ content += `
109
108
 
110
109
  ${bundle.instructionsContent}
111
110
  `;
111
+ }
112
112
  await writeFile3(outputFullPath, content, "utf-8");
113
113
  return {
114
114
  filesWritten: [ctx.outputPath]
@@ -365,7 +365,7 @@ async function runAddCap(flags, name) {
365
365
  console.log(` Inferred capability ID: ${capabilityId}`);
366
366
  }
367
367
  const config = await loadBaseConfig();
368
- const activeProfile = await getActiveProfile() ?? config.active_profile ?? "default";
368
+ const activeProfile = await getActiveProfile() ?? "default";
369
369
  if (config.capabilities?.sources?.[capabilityId]) {
370
370
  console.error(`✗ Capability source "${capabilityId}" already exists`);
371
371
  console.log(" Use a different name or remove the existing source first");
@@ -400,7 +400,7 @@ async function runAddMcp(flags, name) {
400
400
  process.exit(1);
401
401
  }
402
402
  const config = await loadBaseConfig();
403
- const activeProfile = await getActiveProfile() ?? config.active_profile ?? "default";
403
+ const activeProfile = await getActiveProfile() ?? "default";
404
404
  if (config.mcps?.[name]) {
405
405
  console.error(`✗ MCP "${name}" already exists`);
406
406
  console.log(" Use a different name or remove the existing MCP first");
@@ -1363,7 +1363,7 @@ async function runProfileList() {
1363
1363
  process.exit(1);
1364
1364
  }
1365
1365
  const config = await loadConfig2();
1366
- const activeProfile = await getActiveProfile2() ?? config.active_profile ?? "default";
1366
+ const activeProfile = await getActiveProfile2() ?? "default";
1367
1367
  const profiles = config.profiles ?? {};
1368
1368
  const profileNames = Object.keys(profiles);
1369
1369
  if (profileNames.length === 0) {
@@ -1573,7 +1573,7 @@ async function runSync() {
1573
1573
  console.log("");
1574
1574
  try {
1575
1575
  const config = await loadConfig3();
1576
- const activeProfile = await getActiveProfile3() ?? config.active_profile ?? "default";
1576
+ const activeProfile = await getActiveProfile3() ?? "default";
1577
1577
  let adapters = await getEnabledAdapters();
1578
1578
  if (!existsSync8(PROVIDERS_STATE_PATH) || adapters.length === 0) {
1579
1579
  console.log("No providers configured yet. Select your provider(s):");
@@ -1735,15 +1735,70 @@ async function loadCapabilityExport(capability) {
1735
1735
 
1736
1736
  // src/index.ts
1737
1737
  import { debug as debug2 } from "@omnidev-ai/core";
1738
+
1739
+ // src/lib/version-check.ts
1740
+ var NPM_REGISTRY_URL = "https://registry.npmjs.org/@omnidev-ai/cli/latest";
1741
+ var FETCH_TIMEOUT_MS = 3000;
1742
+ async function fetchLatestVersion() {
1743
+ try {
1744
+ const controller = new AbortController;
1745
+ const timeoutId = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
1746
+ const response = await fetch(NPM_REGISTRY_URL, {
1747
+ signal: controller.signal,
1748
+ headers: {
1749
+ Accept: "application/json"
1750
+ }
1751
+ });
1752
+ clearTimeout(timeoutId);
1753
+ if (!response.ok) {
1754
+ return null;
1755
+ }
1756
+ const data = await response.json();
1757
+ return data.version ?? null;
1758
+ } catch {
1759
+ return null;
1760
+ }
1761
+ }
1762
+ function isNewerVersion(currentVersion, latestVersion) {
1763
+ const current = currentVersion.split(".").map(Number);
1764
+ const latest = latestVersion.split(".").map(Number);
1765
+ for (let i = 0;i < Math.max(current.length, latest.length); i++) {
1766
+ const c = current[i] ?? 0;
1767
+ const l = latest[i] ?? 0;
1768
+ if (l > c)
1769
+ return true;
1770
+ if (l < c)
1771
+ return false;
1772
+ }
1773
+ return false;
1774
+ }
1775
+ async function checkForUpdates(currentVersion) {
1776
+ try {
1777
+ const latestVersion = await fetchLatestVersion();
1778
+ if (!latestVersion) {
1779
+ return;
1780
+ }
1781
+ if (isNewerVersion(currentVersion, latestVersion)) {
1782
+ console.log("");
1783
+ console.log(`\x1B[33m⚠️ A new version of OmniDev is available: ${latestVersion} (current: ${currentVersion})\x1B[0m`);
1784
+ console.log(` Run \x1B[36mnpm update -g @omnidev-ai/cli\x1B[0m to update`);
1785
+ console.log("");
1786
+ }
1787
+ } catch {}
1788
+ }
1789
+
1790
+ // src/index.ts
1738
1791
  var app = await buildDynamicApp();
1739
1792
  debug2("CLI startup", {
1740
1793
  arguments: process.argv.slice(2),
1741
1794
  cwd: process.cwd()
1742
1795
  });
1796
+ var versionCheckPromise = checkForUpdates(readCliVersion());
1743
1797
  try {
1744
1798
  run(app, process.argv.slice(2), {
1745
1799
  process
1746
1800
  });
1801
+ await versionCheckPromise;
1747
1802
  } catch (error) {
1748
1803
  if (error instanceof Error) {
1749
1804
  if (error.message.includes("getRoutingTargetForInput") || error.stack?.includes("@stricli/core")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnidev-ai/cli",
3
- "version": "0.10.1",
3
+ "version": "0.11.0",
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.1",
31
+ "@omnidev-ai/core": "0.11.0",
32
32
  "@stricli/core": "^1.2.5"
33
33
  },
34
34
  "devDependencies": {