@merittdev/horus 0.1.5 → 0.1.6

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.cjs +42 -20
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -50314,7 +50314,7 @@ init_cjs_shims();
50314
50314
 
50315
50315
  // ../../packages/core/src/version.ts
50316
50316
  init_cjs_shims();
50317
- var HORUS_VERSION = true ? "0.1.5" : "dev";
50317
+ var HORUS_VERSION = true ? "0.1.6" : "dev";
50318
50318
  var PINNED_AXON_VERSION = "1.0.0";
50319
50319
  var PINNED_SOURCE_VERSION = PINNED_AXON_VERSION;
50320
50320
 
@@ -54494,6 +54494,19 @@ function ensureCredentialGitignore(root) {
54494
54494
  function readLocalConfig(path) {
54495
54495
  return JSON.parse((0, import_node_fs.readFileSync)(path, "utf8"));
54496
54496
  }
54497
+ function ensureProjectGitignore(root) {
54498
+ if (!(0, import_node_fs.existsSync)((0, import_node_path.join)(root, ".git"))) return;
54499
+ const gitignorePath = (0, import_node_path.join)(root, ".gitignore");
54500
+ const entry2 = ".horus/";
54501
+ if (!(0, import_node_fs.existsSync)(gitignorePath)) {
54502
+ (0, import_node_fs.writeFileSync)(gitignorePath, entry2 + "\n");
54503
+ return;
54504
+ }
54505
+ const existing = (0, import_node_fs.readFileSync)(gitignorePath, "utf8");
54506
+ const alreadyIgnored = existing.split("\n").map((l) => l.trim()).some((l) => l === ".horus" || l === ".horus/" || l === "/.horus" || l === "/.horus/");
54507
+ if (alreadyIgnored) return;
54508
+ (0, import_node_fs.writeFileSync)(gitignorePath, existing.trimEnd() + "\n" + entry2 + "\n");
54509
+ }
54497
54510
  function patchLocalConnector(configPath, connectorType, patch, envName) {
54498
54511
  const file = readLocalConfig(configPath);
54499
54512
  const project = file.project;
@@ -67290,6 +67303,7 @@ async function runIndex(opts) {
67290
67303
  };
67291
67304
  const configPath = writeLocalConfig(root, file);
67292
67305
  registerProject(name, root, configPath);
67306
+ ensureProjectGitignore(root);
67293
67307
  console.log(`${import_picocolors3.default.green("\u2713")} Indexed ${import_picocolors3.default.bold(name)} \u2014 host ${hostUrl}`);
67294
67308
  console.log(import_picocolors3.default.dim(` ${configPath}`));
67295
67309
  console.log(
@@ -67308,6 +67322,7 @@ async function runIndex(opts) {
67308
67322
  }
67309
67323
  writeLocalConfig(root, file);
67310
67324
  registerProject(label, root, existingPath);
67325
+ ensureProjectGitignore(root);
67311
67326
  console.log(`${import_picocolors3.default.green("\u2713")} Indexed ${import_picocolors3.default.bold(label)} \u2014 source host registered at ${hostUrl}`);
67312
67327
  console.log(import_picocolors3.default.dim(` ${existingPath}`));
67313
67328
  } else {
@@ -73410,10 +73425,21 @@ function formatDateTime(date2) {
73410
73425
  return `${y}-${m}-${day} ${h}:${min} (UTC${sign}${offsetHours}:${offsetMins})`;
73411
73426
  }
73412
73427
 
73428
+ // ../../packages/cli/src/lib/db-url.ts
73429
+ init_cjs_shims();
73430
+ var DEFAULT_DB_URL2 = "postgresql://horus:horus@localhost:5433/horus";
73431
+ async function resolveDbUrl(configPath) {
73432
+ try {
73433
+ const config = await loadConfig(configPath);
73434
+ return config.database.url;
73435
+ } catch {
73436
+ return process.env["DATABASE_URL"] ?? DEFAULT_DB_URL2;
73437
+ }
73438
+ }
73439
+
73413
73440
  // ../../packages/cli/src/commands/investigations.ts
73414
73441
  async function runInvestigations(opts) {
73415
- const config = await loadConfig(opts.config);
73416
- const { db, sql: sql2 } = createDb(config.database.url);
73442
+ const { db, sql: sql2 } = createDb(await resolveDbUrl(opts.config));
73417
73443
  try {
73418
73444
  const rows = await listInvestigations(db, opts.limit ?? 20);
73419
73445
  if (rows.length === 0) {
@@ -73435,8 +73461,7 @@ async function runInvestigations(opts) {
73435
73461
  init_cjs_shims();
73436
73462
  var import_picocolors13 = __toESM(require_picocolors(), 1);
73437
73463
  async function runReplay(id, opts) {
73438
- const config = await loadConfig(opts.config);
73439
- const { db, sql: sql2 } = createDb(config.database.url);
73464
+ const { db, sql: sql2 } = createDb(await resolveDbUrl(opts.config));
73440
73465
  try {
73441
73466
  const row = await getInvestigation(db, id);
73442
73467
  if (!row) {
@@ -73521,8 +73546,7 @@ async function runPostmortem(id, opts) {
73521
73546
  if (opts._report !== void 0) {
73522
73547
  report = opts._report;
73523
73548
  } else {
73524
- const config = await loadConfig(opts.config);
73525
- const conn = createDb(config.database.url);
73549
+ const conn = createDb(await resolveDbUrl(opts.config));
73526
73550
  sql2 = conn.sql;
73527
73551
  const { db } = conn;
73528
73552
  const row = await getInvestigation(db, id);
@@ -73642,8 +73666,7 @@ _AI summary unavailable: ${validationErrors?.[0] ?? "provider error"}_
73642
73666
  init_cjs_shims();
73643
73667
  var import_picocolors16 = __toESM(require_picocolors(), 1);
73644
73668
  async function runScore(id, opts) {
73645
- const config = await loadConfig(opts.config);
73646
- const { db, sql: sql2 } = createDb(config.database.url);
73669
+ const { db, sql: sql2 } = createDb(await resolveDbUrl(opts.config));
73647
73670
  try {
73648
73671
  const row = await getInvestigation(db, id);
73649
73672
  if (!row) {
@@ -73662,8 +73685,7 @@ async function runScore(id, opts) {
73662
73685
  return 0;
73663
73686
  }
73664
73687
  async function runScores(opts) {
73665
- const config = await loadConfig(opts.config);
73666
- const { db, sql: sql2 } = createDb(config.database.url);
73688
+ const { db, sql: sql2 } = createDb(await resolveDbUrl(opts.config));
73667
73689
  try {
73668
73690
  const rows = await listInvestigationsWithReports(db, opts.limit ?? 15);
73669
73691
  const scored = rows.filter((r) => r.report).map((r) => ({
@@ -73695,8 +73717,7 @@ async function runScores(opts) {
73695
73717
  init_cjs_shims();
73696
73718
  var import_picocolors17 = __toESM(require_picocolors(), 1);
73697
73719
  async function runAsk(id, directive, opts) {
73698
- const config = await loadConfig(opts.config);
73699
- const { db, sql: sql2 } = createDb(config.database.url);
73720
+ const { db, sql: sql2 } = createDb(await resolveDbUrl(opts.config));
73700
73721
  try {
73701
73722
  const row = await getInvestigation(db, id);
73702
73723
  if (!row) {
@@ -74233,6 +74254,7 @@ async function runInit(opts) {
74233
74254
  };
74234
74255
  const configPath = writeLocalConfig(root, file);
74235
74256
  registerProject(name, root, configPath);
74257
+ ensureProjectGitignore(root);
74236
74258
  console.log(`${import_picocolors23.default.green("\u2713")} Initialized Horus project ${import_picocolors23.default.bold(name)}`);
74237
74259
  console.log(import_picocolors23.default.dim(` config: ${configPath}`));
74238
74260
  console.log(import_picocolors23.default.dim(` registered: horus investigate --name ${name} "<hint>"`));
@@ -74245,7 +74267,7 @@ async function runInit(opts) {
74245
74267
  import_picocolors23.default.dim(" add runtime connectors (elasticsearch/mongodb/grafana) to .horus/config.json")
74246
74268
  );
74247
74269
  console.log(
74248
- import_picocolors23.default.dim(" safe to commit .horus/config.json \u2014 no secrets stored (keep credentials in environment variables)")
74270
+ import_picocolors23.default.dim(" .horus/ is gitignored \u2014 local config and runtime state stay out of version control")
74249
74271
  );
74250
74272
  return 0;
74251
74273
  } catch (err) {
@@ -74281,7 +74303,7 @@ async function runProjects() {
74281
74303
  // ../../packages/cli/src/commands/setup.ts
74282
74304
  init_cjs_shims();
74283
74305
  var import_picocolors25 = __toESM(require_picocolors(), 1);
74284
- var DEFAULT_DB_URL2 = "postgresql://horus:horus@localhost:5433/horus";
74306
+ var DEFAULT_DB_URL3 = "postgresql://horus:horus@localhost:5433/horus";
74285
74307
  async function runSetup(opts) {
74286
74308
  const write = opts.write ?? ((line2) => console.log(line2));
74287
74309
  let ok = true;
@@ -74313,7 +74335,7 @@ async function runSetup(opts) {
74313
74335
  ` ${import_picocolors25.default.green("\u25CF")} Horus source-intelligence backend ` + import_picocolors25.default.dim(`(${backendVersion})`)
74314
74336
  );
74315
74337
  }
74316
- let dbUrl = process.env["DATABASE_URL"] ?? DEFAULT_DB_URL2;
74338
+ let dbUrl = process.env["DATABASE_URL"] ?? DEFAULT_DB_URL3;
74317
74339
  let config = null;
74318
74340
  try {
74319
74341
  config = await loadConfig(opts.config);
@@ -75372,7 +75394,7 @@ function extractPort2(hostUrl) {
75372
75394
  // ../../packages/cli/src/commands/doctor.ts
75373
75395
  init_cjs_shims();
75374
75396
  var import_picocolors30 = __toESM(require_picocolors(), 1);
75375
- var DEFAULT_DB_URL3 = "postgresql://horus:horus@localhost:5433/horus";
75397
+ var DEFAULT_DB_URL4 = "postgresql://horus:horus@localhost:5433/horus";
75376
75398
  function mark2(status) {
75377
75399
  if (status === "pass") return import_picocolors30.default.green("\u2713");
75378
75400
  if (status === "warn") return import_picocolors30.default.yellow("~");
@@ -75442,7 +75464,7 @@ async function runDoctor(opts) {
75442
75464
  }
75443
75465
  {
75444
75466
  const dbChecker = opts?._dbCheck ?? checkDatabase;
75445
- let dbUrl = process.env["DATABASE_URL"] ?? DEFAULT_DB_URL3;
75467
+ let dbUrl = process.env["DATABASE_URL"] ?? DEFAULT_DB_URL4;
75446
75468
  let globalConfig = null;
75447
75469
  try {
75448
75470
  globalConfig = await loadConfig(opts?.config, { cwd });
@@ -75758,7 +75780,7 @@ async function runGenerateConfig(opts) {
75758
75780
  // ../../packages/cli/src/commands/readiness.ts
75759
75781
  init_cjs_shims();
75760
75782
  var import_picocolors33 = __toESM(require_picocolors(), 1);
75761
- var DEFAULT_DB_URL4 = "postgresql://horus:horus@localhost:5433/horus";
75783
+ var DEFAULT_DB_URL5 = "postgresql://horus:horus@localhost:5433/horus";
75762
75784
  function mark3(status) {
75763
75785
  if (status === "pass") return import_picocolors33.default.green("\u2713");
75764
75786
  if (status === "warn") return import_picocolors33.default.yellow("~");
@@ -75782,7 +75804,7 @@ async function runReadiness(opts) {
75782
75804
  globalConfig = await configLoader(opts?.config, { cwd });
75783
75805
  } catch {
75784
75806
  }
75785
- const dbUrl = globalConfig?.database.url ?? process.env["DATABASE_URL"] ?? DEFAULT_DB_URL4;
75807
+ const dbUrl = globalConfig?.database.url ?? process.env["DATABASE_URL"] ?? DEFAULT_DB_URL5;
75786
75808
  const db = await dbChecker(dbUrl);
75787
75809
  if (!db.reachable) {
75788
75810
  checks.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@merittdev/horus",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Local-first, source-aware production-incident investigation engine",
5
5
  "type": "module",
6
6
  "bin": {