@kesarcloud/omega-plus-cli 2.0.4 → 2.0.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kesarcloud/omega-plus-cli",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "Interactive Omega Plus setup wizard for coding CLI tools.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.mjs CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  VERSION,
9
9
  } from "./constants.mjs";
10
10
  import { printDoctor, printToolList, runNonInteractiveConfigure, runWizard } from "./wizard.mjs";
11
+ import { scanForMigration, migrateAllTools } from "./migrate.mjs";
11
12
 
12
13
  function printHelp() {
13
14
  console.log(`Omega Plus CLI ${VERSION}
@@ -32,6 +33,8 @@ Options:
32
33
  --dry-run Preview files without writing
33
34
  --yes Auto-confirm install prompts
34
35
  --no-install Do not install missing tools
36
+ --migrate-all Auto-migrate old omega-v1 configs to omega-plus
37
+ --skip-migration-check Skip stale config detection
35
38
  --help Show help
36
39
  --version Show version
37
40
  `);
@@ -50,6 +53,8 @@ function parseArgs(argv) {
50
53
  else if (arg === "--skip-key-validation") options.skipKeyValidation = true;
51
54
  else if (arg === "--yes" || arg === "-y") options.yes = true;
52
55
  else if (arg === "--no-install") options.noInstall = true;
56
+ else if (arg === "--migrate-all") options.migrateAll = true;
57
+ else if (arg === "--skip-migration-check") options.skipMigrationCheck = true;
53
58
  else if (arg === "--api-key") options.apiKey = args[++i];
54
59
  else if (arg.startsWith("--api-key=")) options.apiKey = arg.slice("--api-key=".length);
55
60
  else if (arg === "--tool") options.tool = args[++i];
@@ -99,6 +104,18 @@ export async function main(argv = process.argv.slice(2)) {
99
104
  case "doctor":
100
105
  await printDoctor();
101
106
  break;
107
+ case "migrate": {
108
+ const scan = await scanForMigration();
109
+ console.log(`Scanned ${scan.total} tools. Found ${scan.stale.length} with stale configs.`);
110
+ if (scan.stale.length > 0) {
111
+ const result = await migrateAllTools(options);
112
+ console.log(result.message);
113
+ result.results?.forEach((r) => {
114
+ console.log(` ${r.ok ? "✓" : "✗"} ${r.tool}${r.ok ? "" : ` — ${r.error}`}`);
115
+ });
116
+ }
117
+ break;
118
+ }
102
119
  default:
103
120
  throw new Error(`Unknown command: ${command}. Run omega-plus --help.`);
104
121
  }
package/src/constants.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export const VERSION = "2.0.4";
1
+ export const VERSION = "2.0.5";
2
2
  export const DEFAULT_ORIGIN = "https://omega.kesarcloud.in";
3
3
  export const DEFAULT_BASE_URL = `${DEFAULT_ORIGIN}/v1`;
4
4
  export const DEFAULT_ANTHROPIC_BASE_URL = `${DEFAULT_ORIGIN}/v1`;
@@ -0,0 +1,95 @@
1
+ import { detectAllTools } from "./detector.mjs";
2
+ import { configureTool } from "./config-writers.mjs";
3
+ import { DEFAULT_MODEL, DEFAULT_FAST_MODEL, VERSION } from "./constants.mjs";
4
+ import { readJson, readText } from "./fs-utils.mjs";
5
+ import { getToolPaths } from "./tool-paths.mjs";
6
+
7
+ const OLD_MODEL_IDS = [/omega-v1(?![-]plus)/, /"Omega V1"/, /omega\.v1/i];
8
+ const CURRENT_MODEL = "omega-plus";
9
+
10
+ function hasOldModels(text) {
11
+ if (typeof text !== "string") return false;
12
+ return OLD_MODEL_IDS.some((re) => re.test(text));
13
+ }
14
+
15
+ async function detectStaleConfig(tool) {
16
+ if (tool.configStatus !== "configured" || !tool.configPath) return false;
17
+ try {
18
+ const content = await readText(tool.configPath, "");
19
+ return hasOldModels(content);
20
+ } catch {
21
+ return false;
22
+ }
23
+ }
24
+
25
+ async function detectAdditionalConfigs(tool) {
26
+ const paths = getToolPaths(tool.id);
27
+ const checks = [];
28
+ for (const [, p] of Object.entries(paths)) {
29
+ if (!p || p === tool.configPath) continue;
30
+ try {
31
+ const content = await readText(p, "");
32
+ if (hasOldModels(content) || hasOldModels(JSON.stringify(await readJson(p, null) || ""))) {
33
+ checks.push(p);
34
+ }
35
+ } catch {}
36
+ }
37
+ return checks;
38
+ }
39
+
40
+ export async function scanForMigration(options = {}) {
41
+ const tools = await detectAllTools();
42
+ const stale = [];
43
+
44
+ for (const tool of tools) {
45
+ if (await detectStaleConfig(tool)) {
46
+ const extra = await detectAdditionalConfigs(tool);
47
+ stale.push({ tool, paths: [tool.configPath, ...extra].filter(Boolean) });
48
+ }
49
+ }
50
+
51
+ return { stale, total: tools.length, version: VERSION };
52
+ }
53
+
54
+ export async function migrateAllTools(options = {}) {
55
+ const { stale } = await scanForMigration(options);
56
+ if (stale.length === 0) {
57
+ return { migrated: 0, message: "All configs are up to date with Omega Plus." };
58
+ }
59
+
60
+ const apiKey = options.apiKey || options.apikey;
61
+ if (!apiKey) {
62
+ return {
63
+ migrated: 0,
64
+ stale,
65
+ error: "API key required for migration. Use: npx @kesarcloud/omega-plus-cli --migrate --api-key YOUR_KEY",
66
+ };
67
+ }
68
+
69
+ const results = [];
70
+ for (const entry of stale) {
71
+ try {
72
+ const result = await configureTool(entry.tool.id, {
73
+ apiKey,
74
+ model: DEFAULT_MODEL,
75
+ fastModel: DEFAULT_FAST_MODEL,
76
+ ...options,
77
+ });
78
+ results.push({ tool: entry.tool.name, id: entry.tool.id, ok: true, files: result.files });
79
+ } catch (err) {
80
+ results.push({
81
+ tool: entry.tool.name,
82
+ id: entry.tool.id,
83
+ ok: false,
84
+ error: err.message || "Unknown error",
85
+ });
86
+ }
87
+ }
88
+
89
+ return {
90
+ migrated: results.filter((r) => r.ok).length,
91
+ total: stale.length,
92
+ results,
93
+ message: `Migrated ${results.filter((r) => r.ok).length}/${stale.length} tools to Omega Plus.`,
94
+ };
95
+ }
package/src/wizard.mjs CHANGED
@@ -9,6 +9,7 @@ import { configureTool } from "./config-writers.mjs";
9
9
  import { detectAllTools, detectTool, runInstallCommand } from "./detector.mjs";
10
10
  import { validateApiKey } from "./key-validator.mjs";
11
11
  import { ask, askSecret, createPromptInterface } from "./prompts.mjs";
12
+ import { scanForMigration, migrateAllTools } from "./migrate.mjs";
12
13
 
13
14
  function printHeader() {
14
15
  printBanner();
@@ -59,6 +60,27 @@ async function maybeInstallTool(toolId, options, rl) {
59
60
 
60
61
  export async function runWizard(options = {}) {
61
62
  printHeader();
63
+
64
+ // ── Check for stale configs (old omega-v1/v1-pro model IDs) ──
65
+ if (!options.skipMigrationCheck) {
66
+ const migration = await scanForMigration();
67
+ if (migration.stale.length > 0) {
68
+ console.log(`\nDetected ${migration.stale.length} tool(s) with old model configs (omega-v1 / omega-v1-pro).`);
69
+ console.log("These should be migrated to Omega Plus.\n");
70
+ if (options.yes || options.migrateAll) {
71
+ console.log("Auto-migrating...");
72
+ const result = await migrateAllTools({ ...options, apiKey: options.apiKey });
73
+ console.log(result.message);
74
+ result.results?.forEach((r) => {
75
+ console.log(` ${r.ok ? "✓" : "✗"} ${r.tool}${r.ok ? "" : ` — ${r.error}`}`);
76
+ });
77
+ console.log("");
78
+ } else {
79
+ console.log("Tip: re-run with --migrate-all to auto-update, or continue to reconfigure manually.\n");
80
+ }
81
+ }
82
+ }
83
+
62
84
  const apiKey = options.apiKey || (await askSecret("Paste your Omega API key: "));
63
85
  if (!apiKey) throw new Error("API key is required");
64
86