@umbral/cli 0.0.6 → 0.0.7

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 +32 -45
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -855,9 +855,6 @@ function getTemplate(detection) {
855
855
 
856
856
  // src/claude-generate.ts
857
857
  import { spawn, spawnSync } from "child_process";
858
- import { writeFileSync, unlinkSync } from "fs";
859
- import { join as join12 } from "path";
860
- import { tmpdir } from "os";
861
858
  function isClaudeAvailable() {
862
859
  try {
863
860
  const r = spawnSync("claude", ["--version"], {
@@ -993,15 +990,11 @@ function generateWithClaude(detections) {
993
990
  if (detections.length === 0)
994
991
  return Promise.resolve({ edes: null, error: "Sin detecciones" });
995
992
  const prompt = buildPrompt(detections);
996
- const tmpFile = join12(tmpdir(), `umbral-prompt-${Date.now()}.txt`);
997
- writeFileSync(tmpFile, prompt, "utf-8");
998
- const readCmd = process.platform === "win32" ? `type "${tmpFile}"` : `cat "${tmpFile}"`;
999
993
  return new Promise((resolve) => {
1000
- const child = spawn(
1001
- process.platform === "win32" ? "cmd.exe" : "/bin/sh",
1002
- process.platform === "win32" ? ["/c", `${readCmd} | claude --print`] : ["-c", `${readCmd} | claude --print`],
1003
- { stdio: ["ignore", "pipe", "pipe"] }
1004
- );
994
+ const child = spawn("claude", ["--print"], {
995
+ shell: true,
996
+ stdio: ["pipe", "pipe", "pipe"]
997
+ });
1005
998
  let stdout2 = "";
1006
999
  let stderr = "";
1007
1000
  let timedOut = false;
@@ -1017,10 +1010,6 @@ function generateWithClaude(detections) {
1017
1010
  });
1018
1011
  child.on("close", (code) => {
1019
1012
  clearTimeout(timeout);
1020
- try {
1021
- unlinkSync(tmpFile);
1022
- } catch {
1023
- }
1024
1013
  if (timedOut) {
1025
1014
  resolve({ edes: null, error: "Timeout (>2min)" });
1026
1015
  return;
@@ -1046,12 +1035,10 @@ function generateWithClaude(detections) {
1046
1035
  });
1047
1036
  child.on("error", (err) => {
1048
1037
  clearTimeout(timeout);
1049
- try {
1050
- unlinkSync(tmpFile);
1051
- } catch {
1052
- }
1053
1038
  resolve({ edes: null, error: err.message });
1054
1039
  });
1040
+ child.stdin.write(prompt);
1041
+ child.stdin.end();
1055
1042
  });
1056
1043
  }
1057
1044
 
@@ -1416,12 +1403,12 @@ function setupDatabase(edes) {
1416
1403
  }
1417
1404
 
1418
1405
  // src/setup/hooks.ts
1419
- import { existsSync as existsSync10, readFileSync as readFileSync10, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "fs";
1420
- import { join as join13 } from "path";
1406
+ import { existsSync as existsSync10, readFileSync as readFileSync10, writeFileSync, mkdirSync as mkdirSync2 } from "fs";
1407
+ import { join as join12 } from "path";
1421
1408
  function setupHooks(projectPath) {
1422
- const claudeDir = join13(projectPath, ".claude");
1409
+ const claudeDir = join12(projectPath, ".claude");
1423
1410
  mkdirSync2(claudeDir, { recursive: true });
1424
- const settingsPath = join13(claudeDir, "settings.json");
1411
+ const settingsPath = join12(claudeDir, "settings.json");
1425
1412
  let existing = {};
1426
1413
  if (existsSync10(settingsPath)) {
1427
1414
  try {
@@ -1467,12 +1454,12 @@ function setupHooks(projectPath) {
1467
1454
  }
1468
1455
  }
1469
1456
  };
1470
- writeFileSync2(settingsPath, JSON.stringify(settings, null, 2) + "\n", "utf-8");
1457
+ writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n", "utf-8");
1471
1458
  }
1472
1459
 
1473
1460
  // src/setup/context.ts
1474
- import { writeFileSync as writeFileSync3, mkdirSync as mkdirSync3 } from "fs";
1475
- import { join as join14 } from "path";
1461
+ import { writeFileSync as writeFileSync2, mkdirSync as mkdirSync3 } from "fs";
1462
+ import { join as join13 } from "path";
1476
1463
 
1477
1464
  // ../orchestrator/src/claude-context.ts
1478
1465
  function assembleClaudeContext(edes) {
@@ -1575,9 +1562,9 @@ function setupContext(projectPath) {
1575
1562
  const edes = createEdeStore(db).getAll();
1576
1563
  db.close();
1577
1564
  const content = assembleClaudeContext(edes);
1578
- const claudeDir = join14(projectPath, ".claude");
1565
+ const claudeDir = join13(projectPath, ".claude");
1579
1566
  mkdirSync3(claudeDir, { recursive: true });
1580
- writeFileSync3(join14(claudeDir, "CLAUDE.md"), content, "utf-8");
1567
+ writeFileSync2(join13(claudeDir, "CLAUDE.md"), content, "utf-8");
1581
1568
  }
1582
1569
 
1583
1570
  // src/commands/init.ts
@@ -1719,28 +1706,28 @@ async function hookCommand(_event) {
1719
1706
 
1720
1707
  // src/commands/mcp.ts
1721
1708
  import { execFileSync } from "child_process";
1722
- import { join as join15, dirname as dirname2 } from "path";
1709
+ import { join as join14, dirname as dirname2 } from "path";
1723
1710
  import { fileURLToPath } from "url";
1724
1711
  async function mcpCommand() {
1725
1712
  const __dirname = dirname2(fileURLToPath(import.meta.url));
1726
- const mcpEntry = join15(__dirname, "mcp-entry.js");
1713
+ const mcpEntry = join14(__dirname, "mcp-entry.js");
1727
1714
  execFileSync(process.execPath, [mcpEntry], {
1728
1715
  stdio: "inherit"
1729
1716
  });
1730
1717
  }
1731
1718
 
1732
1719
  // src/commands/start.ts
1733
- import { execSync as execSync2, spawn as spawn2 } from "child_process";
1734
- import { writeFileSync as writeFileSync4, mkdirSync as mkdirSync4 } from "fs";
1735
- import { join as join16 } from "path";
1720
+ import { execSync, spawn as spawn2 } from "child_process";
1721
+ import { writeFileSync as writeFileSync3, mkdirSync as mkdirSync4 } from "fs";
1722
+ import { join as join15 } from "path";
1736
1723
  import { homedir as homedir3 } from "os";
1737
1724
  import { createServer } from "net";
1738
- var UMBRAL_DIR = join16(homedir3(), ".umbral");
1739
- var COMPOSE_PATH = join16(UMBRAL_DIR, "docker-compose.yml");
1725
+ var UMBRAL_DIR = join15(homedir3(), ".umbral");
1726
+ var COMPOSE_PATH = join15(UMBRAL_DIR, "docker-compose.yml");
1740
1727
  var DOCKER_IMAGE = process.env.UMBRAL_IMAGE ?? "ghcr.io/josephrobles23/umbral-web:latest";
1741
1728
  function dockerInstalled() {
1742
1729
  try {
1743
- execSync2("docker --version", { stdio: "ignore" });
1730
+ execSync("docker --version", { stdio: "ignore" });
1744
1731
  return true;
1745
1732
  } catch {
1746
1733
  return false;
@@ -1748,7 +1735,7 @@ function dockerInstalled() {
1748
1735
  }
1749
1736
  function composeInstalled() {
1750
1737
  try {
1751
- execSync2("docker compose version", { stdio: "ignore" });
1738
+ execSync("docker compose version", { stdio: "ignore" });
1752
1739
  return true;
1753
1740
  } catch {
1754
1741
  return false;
@@ -1769,7 +1756,7 @@ function findFreePort(start) {
1769
1756
  });
1770
1757
  }
1771
1758
  function generateCompose(webPort, wsPort) {
1772
- const dbPath = join16(UMBRAL_DIR, "umbral.db").replace(/\\/g, "/");
1759
+ const dbPath = join15(UMBRAL_DIR, "umbral.db").replace(/\\/g, "/");
1773
1760
  const dbDir = UMBRAL_DIR.replace(/\\/g, "/");
1774
1761
  return `# Auto-generated by Umbral CLI \u2014 do not edit manually
1775
1762
  name: umbral
@@ -1829,14 +1816,14 @@ async function startCommand(options) {
1829
1816
  const wsPort = await findFreePort(webPort + 99);
1830
1817
  mkdirSync4(UMBRAL_DIR, { recursive: true });
1831
1818
  const compose = generateCompose(webPort, wsPort);
1832
- writeFileSync4(COMPOSE_PATH, compose, "utf-8");
1819
+ writeFileSync3(COMPOSE_PATH, compose, "utf-8");
1833
1820
  w(` \u2713 docker-compose.yml generado
1834
1821
  `);
1835
1822
  w(" \u27F3 Descargando imagenes y levantando servicios...\n\n");
1836
1823
  const detach = options.detach !== false;
1837
1824
  try {
1838
1825
  if (detach) {
1839
- execSync2(`docker compose -f "${COMPOSE_PATH}" up -d`, {
1826
+ execSync(`docker compose -f "${COMPOSE_PATH}" up -d`, {
1840
1827
  stdio: "inherit"
1841
1828
  });
1842
1829
  } else {
@@ -1867,11 +1854,11 @@ async function startCommand(options) {
1867
1854
  }
1868
1855
 
1869
1856
  // src/commands/stop.ts
1870
- import { execSync as execSync3 } from "child_process";
1857
+ import { execSync as execSync2 } from "child_process";
1871
1858
  import { existsSync as existsSync12 } from "fs";
1872
- import { join as join17 } from "path";
1859
+ import { join as join16 } from "path";
1873
1860
  import { homedir as homedir4 } from "os";
1874
- var COMPOSE_PATH2 = join17(homedir4(), ".umbral", "docker-compose.yml");
1861
+ var COMPOSE_PATH2 = join16(homedir4(), ".umbral", "docker-compose.yml");
1875
1862
  function stopCommand() {
1876
1863
  const w = (s) => process.stdout.write(s);
1877
1864
  w("\n Umbral \u2014 Deteniendo plataforma\n\n");
@@ -1881,7 +1868,7 @@ function stopCommand() {
1881
1868
  process.exit(1);
1882
1869
  }
1883
1870
  try {
1884
- execSync3(`docker compose -f "${COMPOSE_PATH2}" down`, {
1871
+ execSync2(`docker compose -f "${COMPOSE_PATH2}" down`, {
1885
1872
  stdio: "inherit"
1886
1873
  });
1887
1874
  w("\n \u2713 Servicios detenidos.\n\n");
@@ -1893,7 +1880,7 @@ function stopCommand() {
1893
1880
 
1894
1881
  // src/index.ts
1895
1882
  var program = new Command();
1896
- program.name("umbral").description("Umbral \u2014 Framework de gobernanza para proyectos con Claude Code").version("0.0.6");
1883
+ program.name("umbral").description("Umbral \u2014 Framework de gobernanza para proyectos con Claude Code").version("0.0.7");
1897
1884
  program.command("init").description("Inicializar Umbral en el proyecto actual").option("--yes", "Aceptar todas las propuestas sin preguntar").option("--path <path>", "Ruta al proyecto (default: directorio actual)").action(initCommand);
1898
1885
  program.command("start").description("Levantar la plataforma Umbral (Neo4j + Dashboard web)").option("--port <port>", "Puerto para el dashboard (default: auto)").option("--no-detach", "Correr en primer plano (sin -d)").action(startCommand);
1899
1886
  program.command("stop").description("Detener la plataforma Umbral").action(stopCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umbral/cli",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {