@nikelyh/metamorph 2.0.6 → 2.0.8

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.
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  detectTechnologies
3
3
  } from "./chunk-3QN2Q75J.js";
4
- import "./chunk-3RG5ZIWI.js";
5
4
  export {
6
5
  detectTechnologies
7
6
  };
package/dist/index.js CHANGED
@@ -11,9 +11,6 @@ import {
11
11
  runLoop,
12
12
  sendEvent
13
13
  } from "./chunk-GNWRSZXT.js";
14
- import {
15
- __require
16
- } from "./chunk-3RG5ZIWI.js";
17
14
 
18
15
  // src/index.ts
19
16
  import { Command } from "commander";
@@ -992,7 +989,7 @@ async function createApiServer(store, migrationRunner) {
992
989
  });
993
990
  app.get("/api/detect", async (req, res) => {
994
991
  try {
995
- const { detectTechnologies: detectTechnologies2 } = await import("./TechDetector-TKTX5YAM.js");
992
+ const { detectTechnologies: detectTechnologies2 } = await import("./TechDetector-5YP44RVR.js");
996
993
  const targetPath = req.query.path ? String(req.query.path) : ".";
997
994
  const detected = detectTechnologies2(targetPath);
998
995
  res.json({
@@ -1590,7 +1587,7 @@ var reviewFileProcessor = {
1590
1587
  }
1591
1588
  };
1592
1589
  const { createAgent: createMozaikAgent } = await import("@mozaik-ai/core");
1593
- const { sendEvent: sendEvent3 } = await import("./runtime-MOEIRP73.js");
1590
+ const { sendEvent: sendEvent3 } = await import("./runtime-5OVGH2Y7.js");
1594
1591
  const reviewerId = `Reviewer-${Date.now()}-${Math.floor(Math.random() * 1e3)}`;
1595
1592
  const tempAgent = createMozaikAgent({
1596
1593
  name: reviewerId,
@@ -1697,7 +1694,7 @@ var reviewFileProcessor = {
1697
1694
  const syntaxErrors = diagnostics.filter((d) => d.getCode() >= 1e3 && d.getCode() < 2e3);
1698
1695
  if (syntaxErrors.length > 0) {
1699
1696
  console.error(`[ReviewerAgent:${reviewerId}] Syntax Error in ${payload.filePath}. Rejecting immediately.`);
1700
- const { sendEvent: sendEvent4 } = await import("./runtime-MOEIRP73.js");
1697
+ const { sendEvent: sendEvent4 } = await import("./runtime-5OVGH2Y7.js");
1701
1698
  sendEvent4({
1702
1699
  type: "file.rejected" /* FILE_REJECTED */,
1703
1700
  producerId: tempAgent.getId(),
@@ -1760,7 +1757,7 @@ Does it meet the criteria? You MUST respond in JSON.`;
1760
1757
  setTimeout(async () => {
1761
1758
  if (!isDone) {
1762
1759
  console.error(`[ReviewerAgent:${reviewerId}] \u23F0 TIMEOUT after 45s for ${payload.filePath}. Model never responded.`);
1763
- const { resolveRuntime: resolveRuntime2 } = await import("./runtime-MOEIRP73.js");
1760
+ const { resolveRuntime: resolveRuntime2 } = await import("./runtime-5OVGH2Y7.js");
1764
1761
  const runtime2 = resolveRuntime2();
1765
1762
  await runtime2.state.repository.updateTaskStatus(payload.planId, payload.filePath, "failed", "Inference timed out after 45s");
1766
1763
  leave(tempAgent);
@@ -1770,7 +1767,7 @@ Does it meet the criteria? You MUST respond in JSON.`;
1770
1767
  } catch (error) {
1771
1768
  console.error(`[ReviewerAgent:${reviewerId}] Sync error:`, error);
1772
1769
  if (!isDone) {
1773
- const { resolveRuntime: resolveRuntime2 } = await import("./runtime-MOEIRP73.js");
1770
+ const { resolveRuntime: resolveRuntime2 } = await import("./runtime-5OVGH2Y7.js");
1774
1771
  const runtime2 = resolveRuntime2();
1775
1772
  const errorMessage = error instanceof Error ? error.message : String(error);
1776
1773
  await runtime2.state.repository.updateTaskStatus(payload.planId, payload.filePath, "failed", errorMessage || "Sync error");
@@ -1840,25 +1837,34 @@ var managePackagesProcessor = {
1840
1837
  }
1841
1838
  const packageJsonPath = path4.join(shadowDir, "package.json");
1842
1839
  if (fs5.existsSync(packageJsonPath)) {
1843
- const { execSync: execSync2 } = __require("child_process");
1844
- const execOpts = { cwd: shadowDir, stdio: "inherit" };
1840
+ const { spawn } = await import("child_process");
1841
+ const runCommandAsync = (cmd, args) => {
1842
+ return new Promise((resolve3, reject) => {
1843
+ const proc = spawn(cmd, args, { cwd: shadowDir, stdio: "inherit", shell: true });
1844
+ proc.on("close", (code) => {
1845
+ if (code === 0) resolve3();
1846
+ else reject(new Error(`Command ${cmd} ${args.join(" ")} failed with code ${code}`));
1847
+ });
1848
+ proc.on("error", reject);
1849
+ });
1850
+ };
1845
1851
  try {
1846
1852
  let toRemove = [];
1847
1853
  if (catalogEntry.dependenciesToRemove) toRemove.push(...catalogEntry.dependenciesToRemove);
1848
1854
  if (catalogEntry.devDependenciesToRemove) toRemove.push(...catalogEntry.devDependenciesToRemove);
1849
1855
  if (toRemove.length > 0) {
1850
1856
  console.log(`[PackageManagerAgent] Uninstalling: ${toRemove.join(" ")}`);
1851
- execSync2(`npm uninstall ${toRemove.join(" ")}`, execOpts);
1857
+ await runCommandAsync("npm", ["uninstall", ...toRemove]);
1852
1858
  }
1853
1859
  if (catalogEntry.dependenciesToAdd && Object.keys(catalogEntry.dependenciesToAdd).length > 0) {
1854
1860
  const deps = Object.entries(catalogEntry.dependenciesToAdd).map(([pkg, ver]) => `${pkg}@${ver}`);
1855
1861
  console.log(`[PackageManagerAgent] Installing dependencies: ${deps.join(" ")}`);
1856
- execSync2(`npm install ${deps.join(" ")}`, execOpts);
1862
+ await runCommandAsync("npm", ["install", ...deps]);
1857
1863
  }
1858
1864
  if (catalogEntry.devDependenciesToAdd && Object.keys(catalogEntry.devDependenciesToAdd).length > 0) {
1859
1865
  const devDeps = Object.entries(catalogEntry.devDependenciesToAdd).map(([pkg, ver]) => `${pkg}@${ver}`);
1860
1866
  console.log(`[PackageManagerAgent] Installing devDependencies: ${devDeps.join(" ")}`);
1861
- execSync2(`npm install -D ${devDeps.join(" ")}`, execOpts);
1867
+ await runCommandAsync("npm", ["install", "-D", ...devDeps]);
1862
1868
  }
1863
1869
  console.log(`[PackageManagerAgent] Successfully updated dependencies via npm.`);
1864
1870
  } catch (err) {
@@ -1951,7 +1957,7 @@ var startedProcessor = {
1951
1957
  var migratedProcessor = {
1952
1958
  async apply({ event }) {
1953
1959
  const p = event.payload;
1954
- const { resolveRuntime: resolveRuntime2 } = await import("./runtime-MOEIRP73.js");
1960
+ const { resolveRuntime: resolveRuntime2 } = await import("./runtime-5OVGH2Y7.js");
1955
1961
  const runtime = resolveRuntime2();
1956
1962
  const plan = await runtime.state.repository.getPlan(p.planId);
1957
1963
  if (!plan) return;
@@ -1962,7 +1968,7 @@ var migratedProcessor = {
1962
1968
  var reviewedProcessor = {
1963
1969
  async apply({ event }) {
1964
1970
  const p = event.payload;
1965
- const { resolveRuntime: resolveRuntime2 } = await import("./runtime-MOEIRP73.js");
1971
+ const { resolveRuntime: resolveRuntime2 } = await import("./runtime-5OVGH2Y7.js");
1966
1972
  const runtime = resolveRuntime2();
1967
1973
  const plan = await runtime.state.repository.getPlan(p.planId);
1968
1974
  if (!plan) return;
@@ -1972,7 +1978,7 @@ var reviewedProcessor = {
1972
1978
  var rejectedProcessor = {
1973
1979
  async apply({ event }) {
1974
1980
  const p = event.payload;
1975
- const { resolveRuntime: resolveRuntime2 } = await import("./runtime-MOEIRP73.js");
1981
+ const { resolveRuntime: resolveRuntime2 } = await import("./runtime-5OVGH2Y7.js");
1976
1982
  const runtime = resolveRuntime2();
1977
1983
  const plan = await runtime.state.repository.getPlan(p.planId);
1978
1984
  if (!plan) return;
@@ -1983,7 +1989,7 @@ var rejectedProcessor = {
1983
1989
  var fatalProcessor = {
1984
1990
  async apply({ event }) {
1985
1991
  const p = event.payload;
1986
- const { resolveRuntime: resolveRuntime2 } = await import("./runtime-MOEIRP73.js");
1992
+ const { resolveRuntime: resolveRuntime2 } = await import("./runtime-5OVGH2Y7.js");
1987
1993
  const runtime = resolveRuntime2();
1988
1994
  const plan = await runtime.state.repository.getPlan(p.planId);
1989
1995
  if (!plan) return;
@@ -1994,7 +2000,7 @@ var fatalProcessor = {
1994
2000
  var completedProcessor = {
1995
2001
  async apply({ event }) {
1996
2002
  const p = event.payload;
1997
- const { resolveRuntime: resolveRuntime2 } = await import("./runtime-MOEIRP73.js");
2003
+ const { resolveRuntime: resolveRuntime2 } = await import("./runtime-5OVGH2Y7.js");
1998
2004
  const runtime = resolveRuntime2();
1999
2005
  const plan = await runtime.state.repository.getPlan(p.planId);
2000
2006
  if (!plan) return;
@@ -2122,7 +2128,7 @@ function bootstrapMetamorph(repository, tools = []) {
2122
2128
  specification: new AllEventsSpecification(),
2123
2129
  processor: {
2124
2130
  async apply({ event }) {
2125
- const { resolveRuntime: resolveRuntime2 } = await import("./runtime-MOEIRP73.js");
2131
+ const { resolveRuntime: resolveRuntime2 } = await import("./runtime-5OVGH2Y7.js");
2126
2132
  const runtime = resolveRuntime2();
2127
2133
  const repository2 = runtime.state.repository;
2128
2134
  if (event.type.includes("migration") || event.type.includes("file")) {
@@ -2203,7 +2209,12 @@ program.command("run [path]").description("Run a migration on the specified dire
2203
2209
  console.log(chalk.gray(`Target: ${targetPath} | ${from} -> ${to}
2204
2210
  `));
2205
2211
  if (!process.env.OPENAI_API_KEY && !process.env.ANTHROPIC_API_KEY) {
2206
- console.log(chalk.yellow(`\u26A0\uFE0F WARNING: No LLM API key detected.
2212
+ console.log(chalk.yellow(`
2213
+ \u26A0\uFE0F WARNING: No LLM API key detected (OPENAI_API_KEY or ANTHROPIC_API_KEY).`));
2214
+ console.log(chalk.yellow(`AI Worker agents will fail if you don't configure a valid key before starting the migration.`));
2215
+ console.log(chalk.yellow(`Please set your API key as an environment variable in your terminal. For example:`));
2216
+ console.log(chalk.yellow(` Linux/macOS: export OPENAI_API_KEY="sk-..."`));
2217
+ console.log(chalk.yellow(` Windows (PowerShell): $env:OPENAI_API_KEY="sk-..."
2207
2218
  `));
2208
2219
  }
2209
2220
  const spinner = ora("Initializing...").start();
@@ -2308,6 +2319,15 @@ program.command("ui").description("Start the Metamorph Dashboard API server").op
2308
2319
  const getPort = (await import("get-port")).default;
2309
2320
  const open = (await import("open")).default;
2310
2321
  const port = await getPort({ port: desiredPort });
2322
+ if (!process.env.OPENAI_API_KEY && !process.env.ANTHROPIC_API_KEY) {
2323
+ console.log(chalk.yellow(`
2324
+ \u26A0\uFE0F WARNING: No LLM API key detected (OPENAI_API_KEY or ANTHROPIC_API_KEY).`));
2325
+ console.log(chalk.yellow(`AI Worker agents will fail if you don't configure a valid key before starting the migration.`));
2326
+ console.log(chalk.yellow(`Please set your API key as an environment variable in your terminal. For example:`));
2327
+ console.log(chalk.yellow(` Linux/macOS: export OPENAI_API_KEY="sk-..."`));
2328
+ console.log(chalk.yellow(` Windows (PowerShell): $env:OPENAI_API_KEY="sk-..."
2329
+ `));
2330
+ }
2311
2331
  const store = new SQLiteStateStore(".metamorph");
2312
2332
  const tools = [
2313
2333
  createReadFileTool(),
@@ -9,7 +9,6 @@ import {
9
9
  sendEvent,
10
10
  sendMessage
11
11
  } from "./chunk-GNWRSZXT.js";
12
- import "./chunk-3RG5ZIWI.js";
13
12
  export {
14
13
  MetamorphState,
15
14
  initializeRuntime,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nikelyh/metamorph",
3
- "version": "2.0.6",
3
+ "version": "2.0.8",
4
4
  "main": "dist/index.js",
5
5
  "bin": {
6
6
  "metamorph": "./bin/metamorph.js"
@@ -1,10 +0,0 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined") return require.apply(this, arguments);
5
- throw Error('Dynamic require of "' + x + '" is not supported');
6
- });
7
-
8
- export {
9
- __require
10
- };