@nomad-e/bluma-cli 0.1.34 → 0.1.36

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/main.js +43 -27
  2. package/package.json +2 -1
package/dist/main.js CHANGED
@@ -333,7 +333,7 @@ import { render } from "ink";
333
333
  import { EventEmitter as EventEmitter3 } from "events";
334
334
  import fs17 from "fs";
335
335
  import path21 from "path";
336
- import { fileURLToPath as fileURLToPath4 } from "url";
336
+ import { fileURLToPath as fileURLToPath5 } from "url";
337
337
  import { v4 as uuidv46 } from "uuid";
338
338
 
339
339
  // src/app/ui/App.tsx
@@ -4558,8 +4558,8 @@ var ToolInvoker = class {
4558
4558
  async initialize() {
4559
4559
  try {
4560
4560
  const __filename = fileURLToPath(import.meta.url);
4561
- const __dirname2 = path13.dirname(__filename);
4562
- const configPath = path13.resolve(__dirname2, "config", "native_tools.json");
4561
+ const __dirname = path13.dirname(__filename);
4562
+ const configPath = path13.resolve(__dirname, "config", "native_tools.json");
4563
4563
  const fileContent = await fs11.readFile(configPath, "utf-8");
4564
4564
  const config2 = JSON.parse(fileContent);
4565
4565
  this.toolDefinitions = config2.nativeTools;
@@ -4650,8 +4650,8 @@ var MCPClient = class {
4650
4650
  });
4651
4651
  }
4652
4652
  const __filename = fileURLToPath2(import.meta.url);
4653
- const __dirname2 = path14.dirname(__filename);
4654
- const defaultConfigPath = path14.resolve(__dirname2, "config", "bluma-mcp.json");
4653
+ const __dirname = path14.dirname(__filename);
4654
+ const defaultConfigPath = path14.resolve(__dirname, "config", "bluma-mcp.json");
4655
4655
  const userConfigPath = path14.join(os8.homedir(), ".bluma", "bluma-mcp.json");
4656
4656
  const defaultConfig = await this.loadMcpConfig(defaultConfigPath, "Default");
4657
4657
  const userConfig = await this.loadMcpConfig(userConfigPath, "User");
@@ -5020,6 +5020,7 @@ import { execSync } from "child_process";
5020
5020
  import fs14 from "fs";
5021
5021
  import path16 from "path";
5022
5022
  import os10 from "os";
5023
+ import { fileURLToPath as fileURLToPath3 } from "node:url";
5023
5024
  var SkillLoader = class _SkillLoader {
5024
5025
  bundledSkillsDir;
5025
5026
  projectSkillsDir;
@@ -5032,39 +5033,54 @@ var SkillLoader = class _SkillLoader {
5032
5033
  this.bundledSkillsDir = bundledDir || _SkillLoader.resolveBundledDir();
5033
5034
  }
5034
5035
  /**
5035
- * Resolve o diretório de skills nativas relativo ao binário (dist/config/skills).
5036
- * Funciona tanto em ESM como quando executado a partir de dist/.
5036
+ * Resolve o diretório de skills nativas: relativas ao binário/pacote BluMa em execução.
5037
+ * Nunca usa cwd/dist ou cwd/node_modules isso misturava "nativas" com pastas do projeto.
5037
5038
  */
5038
5039
  static resolveBundledDir() {
5039
5040
  if (process.env.JEST_WORKER_ID !== void 0 || process.env.NODE_ENV === "test") {
5040
5041
  return path16.join(process.cwd(), "dist", "config", "skills");
5041
5042
  }
5042
5043
  const candidates = [];
5044
+ const push = (p) => {
5045
+ const abs = path16.resolve(p);
5046
+ if (!candidates.includes(abs)) {
5047
+ candidates.push(abs);
5048
+ }
5049
+ };
5050
+ let argvBundled = null;
5051
+ try {
5052
+ const bundleDir = path16.dirname(fileURLToPath3(import.meta.url));
5053
+ push(path16.join(bundleDir, "config", "skills"));
5054
+ } catch {
5055
+ }
5043
5056
  const argv1 = process.argv[1];
5044
5057
  if (argv1 && !argv1.startsWith("-")) {
5045
5058
  try {
5046
- const scriptDir = path16.dirname(path16.resolve(argv1));
5047
- candidates.push(path16.join(scriptDir, "config", "skills"));
5059
+ let resolved = argv1;
5060
+ if (path16.isAbsolute(argv1) && fs14.existsSync(argv1)) {
5061
+ resolved = fs14.realpathSync(argv1);
5062
+ } else if (!path16.isAbsolute(argv1)) {
5063
+ resolved = path16.resolve(process.cwd(), argv1);
5064
+ }
5065
+ const scriptDir = path16.dirname(resolved);
5066
+ argvBundled = path16.join(scriptDir, "config", "skills");
5067
+ push(argvBundled);
5048
5068
  } catch {
5049
5069
  }
5050
5070
  }
5051
- candidates.push(
5052
- path16.join(process.cwd(), "dist", "config", "skills"),
5053
- path16.join(process.cwd(), "node_modules", "@nomad-e", "bluma-cli", "dist", "config", "skills")
5054
- );
5055
- if (typeof __dirname !== "undefined") {
5056
- candidates.push(
5057
- path16.join(__dirname, "config", "skills"),
5058
- path16.join(__dirname, "..", "..", "..", "config", "skills")
5059
- );
5060
- }
5061
- for (const c of candidates) {
5062
- const abs = path16.resolve(c);
5071
+ for (const abs of candidates) {
5063
5072
  if (fs14.existsSync(abs)) {
5064
5073
  return abs;
5065
5074
  }
5066
5075
  }
5067
- return path16.join(process.cwd(), "dist", "config", "skills");
5076
+ try {
5077
+ return path16.join(path16.dirname(fileURLToPath3(import.meta.url)), "config", "skills");
5078
+ } catch {
5079
+ if (argvBundled) {
5080
+ return argvBundled;
5081
+ }
5082
+ return path16.join(os10.homedir(), ".bluma", "__bundled_skills_unresolved__");
5083
+ }
5068
5084
  }
5069
5085
  /**
5070
5086
  * Lista skills disponíveis de todas as fontes.
@@ -8980,7 +8996,7 @@ var SlashCommands_default = SlashCommands;
8980
8996
 
8981
8997
  // src/app/agent/utils/update_check.ts
8982
8998
  import updateNotifier from "update-notifier";
8983
- import { fileURLToPath as fileURLToPath3 } from "url";
8999
+ import { fileURLToPath as fileURLToPath4 } from "url";
8984
9000
  import path20 from "path";
8985
9001
  import fs16 from "fs";
8986
9002
  var BLUMA_PACKAGE_NAME = "@nomad-e/bluma-cli";
@@ -9015,9 +9031,9 @@ async function checkForUpdates() {
9015
9031
  pkg = findBlumaPackageJson(path20.dirname(binPath));
9016
9032
  }
9017
9033
  if (!pkg) {
9018
- const __filename = fileURLToPath3(import.meta.url);
9019
- const __dirname2 = path20.dirname(__filename);
9020
- pkg = findBlumaPackageJson(__dirname2);
9034
+ const __filename = fileURLToPath4(import.meta.url);
9035
+ const __dirname = path20.dirname(__filename);
9036
+ pkg = findBlumaPackageJson(__dirname);
9021
9037
  }
9022
9038
  if (!pkg) {
9023
9039
  return null;
@@ -10014,7 +10030,7 @@ async function runAgentMode() {
10014
10030
  }
10015
10031
  function readCliPackageVersion() {
10016
10032
  try {
10017
- const base = path21.dirname(fileURLToPath4(import.meta.url));
10033
+ const base = path21.dirname(fileURLToPath5(import.meta.url));
10018
10034
  const pkgPath = path21.join(base, "..", "package.json");
10019
10035
  const j = JSON.parse(fs17.readFileSync(pkgPath, "utf8"));
10020
10036
  return String(j.version || "0.0.0");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nomad-e/bluma-cli",
3
- "version": "0.1.34",
3
+ "version": "0.1.36",
4
4
  "description": "BluMa independent agent for automation and advanced software engineering.",
5
5
  "author": "Alex Fonseca",
6
6
  "license": "Apache-2.0",
@@ -18,6 +18,7 @@
18
18
  "@types/update-notifier": "^6.0.8",
19
19
  "@types/uuid": "^9.0.8",
20
20
  "babel-jest": "^30.0.5",
21
+ "babel-plugin-transform-import-meta": "^2.3.3",
21
22
  "esbuild": "^0.27.2",
22
23
  "esbuild-plugin-node-externals": "^1.0.1",
23
24
  "ink-testing-library": "^4.0.0",