@merittdev/horus 0.1.17 → 0.1.18

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 +196 -16
  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.17" : "dev";
50317
+ var HORUS_VERSION = true ? "0.1.18" : "dev";
50318
50318
  var PINNED_AXON_VERSION = "1.0.7";
50319
50319
  var PINNED_SOURCE_VERSION = PINNED_AXON_VERSION;
50320
50320
 
@@ -59087,7 +59087,7 @@ function sql(strings, ...params) {
59087
59087
  return new SQL([new StringChunk(str)]);
59088
59088
  }
59089
59089
  sql2.raw = raw;
59090
- function join6(chunks, separator) {
59090
+ function join7(chunks, separator) {
59091
59091
  const result = [];
59092
59092
  for (const [i, chunk] of chunks.entries()) {
59093
59093
  if (i > 0 && separator !== void 0) {
@@ -59097,7 +59097,7 @@ function sql(strings, ...params) {
59097
59097
  }
59098
59098
  return new SQL(result);
59099
59099
  }
59100
- sql2.join = join6;
59100
+ sql2.join = join7;
59101
59101
  function identifier(value) {
59102
59102
  return new Name(value);
59103
59103
  }
@@ -62688,7 +62688,7 @@ var PgSelectQueryBuilderBase = class extends TypedQueryBuilder {
62688
62688
  return (table, on) => {
62689
62689
  const baseTableName = this.tableName;
62690
62690
  const tableName = getTableLikeName(table);
62691
- if (typeof tableName === "string" && this.config.joins?.some((join6) => join6.alias === tableName)) {
62691
+ if (typeof tableName === "string" && this.config.joins?.some((join7) => join7.alias === tableName)) {
62692
62692
  throw new Error(`Alias "${tableName}" is already used in this query`);
62693
62693
  }
62694
62694
  if (!this.isPartialSelect) {
@@ -63700,7 +63700,7 @@ var PgUpdateBase = class extends QueryPromise {
63700
63700
  createJoin(joinType) {
63701
63701
  return (table, on) => {
63702
63702
  const tableName = getTableLikeName(table);
63703
- if (typeof tableName === "string" && this.config.joins.some((join6) => join6.alias === tableName)) {
63703
+ if (typeof tableName === "string" && this.config.joins.some((join7) => join7.alias === tableName)) {
63704
63704
  throw new Error(`Alias "${tableName}" is already used in this query`);
63705
63705
  }
63706
63706
  if (typeof on === "function") {
@@ -63796,10 +63796,10 @@ var PgUpdateBase = class extends QueryPromise {
63796
63796
  const fromFields = this.getTableLikeFields(this.config.from);
63797
63797
  fields[tableName] = fromFields;
63798
63798
  }
63799
- for (const join6 of this.config.joins) {
63800
- const tableName2 = getTableLikeName(join6.table);
63801
- if (typeof tableName2 === "string" && !is(join6.table, SQL)) {
63802
- const fromFields = this.getTableLikeFields(join6.table);
63799
+ for (const join7 of this.config.joins) {
63800
+ const tableName2 = getTableLikeName(join7.table);
63801
+ if (typeof tableName2 === "string" && !is(join7.table, SQL)) {
63802
+ const fromFields = this.getTableLikeFields(join7.table);
63803
63803
  fields[tableName2] = fromFields;
63804
63804
  }
63805
63805
  }
@@ -72938,22 +72938,22 @@ function extractQueueGraph(input) {
72938
72938
  }
72939
72939
  }
72940
72940
  const producers = [];
72941
- for (const pc36 of input.producerClasses) {
72942
- for (const m of pc36.content.matchAll(INJECT_QUEUE_RE)) {
72941
+ for (const pc37 of input.producerClasses) {
72942
+ for (const m of pc37.content.matchAll(INJECT_QUEUE_RE)) {
72943
72943
  const queue = m[1] ?? "";
72944
- if (queue) producers.push({ queue, symbol: pc36.name, file: pc36.filePath });
72944
+ if (queue) producers.push({ queue, symbol: pc37.name, file: pc37.filePath });
72945
72945
  }
72946
- for (const m of pc36.content.matchAll(NEW_BULL_RE)) {
72946
+ for (const m of pc37.content.matchAll(NEW_BULL_RE)) {
72947
72947
  if (m[2] !== "Queue") continue;
72948
72948
  const queue = resolveArg(m[3] ?? "", constMap);
72949
72949
  if (queue) {
72950
- producers.push({ queue, symbol: (m[1] ?? pc36.name) || baseName(pc36.filePath), file: pc36.filePath });
72950
+ producers.push({ queue, symbol: (m[1] ?? pc37.name) || baseName(pc37.filePath), file: pc37.filePath });
72951
72951
  }
72952
72952
  }
72953
- for (const m of pc36.content.matchAll(QUEUE_NAME_CONST_RE)) {
72953
+ for (const m of pc37.content.matchAll(QUEUE_NAME_CONST_RE)) {
72954
72954
  const ident = m[1] ?? "";
72955
72955
  const queue = m[2] ?? "";
72956
- if (queue) producers.push({ queue, symbol: ident || baseName(pc36.filePath), file: pc36.filePath });
72956
+ if (queue) producers.push({ queue, symbol: ident || baseName(pc37.filePath), file: pc37.filePath });
72957
72957
  }
72958
72958
  }
72959
72959
  const workers = [];
@@ -78046,6 +78046,178 @@ async function runSkillPath(target, opts) {
78046
78046
  return 0;
78047
78047
  }
78048
78048
 
78049
+ // ../../packages/cli/src/commands/update.ts
78050
+ init_cjs_shims();
78051
+ var import_node_fs10 = require("fs");
78052
+ var import_node_path12 = require("path");
78053
+ var import_node_os3 = require("os");
78054
+ var import_node_crypto2 = require("crypto");
78055
+ var import_picocolors36 = __toESM(require_picocolors(), 1);
78056
+ var RELEASES_API = "https://api.github.com/repos/meritt-dev/horus/releases/latest";
78057
+ function parseVersion(v) {
78058
+ const m = v.replace(/^v/, "").match(/^(\d+)\.(\d+)\.(\d+)/);
78059
+ if (!m) throw new Error(`Cannot parse version: ${v}`);
78060
+ return [+m[1], +m[2], +m[3]];
78061
+ }
78062
+ function isNewer(candidate, current) {
78063
+ const [cam, can, cap] = parseVersion(candidate);
78064
+ const [cum, cun, cup] = parseVersion(current);
78065
+ if (cam !== cum) return cam > cum;
78066
+ if (can !== cun) return can > cun;
78067
+ return cap > cup;
78068
+ }
78069
+ async function fetchLatestRelease(_fetch = fetch) {
78070
+ const res = await _fetch(RELEASES_API, {
78071
+ headers: {
78072
+ "User-Agent": `horus/${HORUS_VERSION}`,
78073
+ Accept: "application/vnd.github.v3+json"
78074
+ }
78075
+ });
78076
+ if (!res.ok) throw new Error(`GitHub API responded ${res.status}`);
78077
+ return res.json();
78078
+ }
78079
+ function sha256hex(buf) {
78080
+ return (0, import_node_crypto2.createHash)("sha256").update(buf).digest("hex");
78081
+ }
78082
+ function resolveBinaryPath() {
78083
+ const raw = process.argv[1];
78084
+ if (!raw) throw new Error("Cannot determine binary path from process.argv[1]");
78085
+ try {
78086
+ return (0, import_node_fs10.realpathSync)(raw);
78087
+ } catch {
78088
+ return raw;
78089
+ }
78090
+ }
78091
+ async function runUpdate(opts) {
78092
+ const write = opts.write ?? ((l) => console.log(l));
78093
+ const _fetch = opts._fetch ?? fetch;
78094
+ const currentVersion = opts._currentVersion ?? HORUS_VERSION;
78095
+ write(`
78096
+ ${import_picocolors36.default.bold("Horus update")}
78097
+ `);
78098
+ write(` Current version: ${import_picocolors36.default.cyan(currentVersion)}`);
78099
+ let release;
78100
+ try {
78101
+ release = await fetchLatestRelease(_fetch);
78102
+ } catch (e) {
78103
+ write(` ${import_picocolors36.default.red("\u2717")} Could not reach GitHub: ${e.message}`);
78104
+ return 1;
78105
+ }
78106
+ const latest = release.tag_name.replace(/^v/, "");
78107
+ write(` Latest version: ${import_picocolors36.default.cyan(latest)}`);
78108
+ const newer = isNewer(latest, currentVersion);
78109
+ if (opts.check) {
78110
+ if (newer) {
78111
+ write(`
78112
+ ${import_picocolors36.default.yellow("\u2192")} ${import_picocolors36.default.bold(latest)} is available.`);
78113
+ write(` Run ${import_picocolors36.default.bold("horus update")} to upgrade.`);
78114
+ } else {
78115
+ write(`
78116
+ ${import_picocolors36.default.green("\u2713")} Already on the latest version.`);
78117
+ }
78118
+ return 0;
78119
+ }
78120
+ if (!newer && !opts.force) {
78121
+ write(`
78122
+ ${import_picocolors36.default.green("\u2713")} Already on the latest version.`);
78123
+ return 0;
78124
+ }
78125
+ const tag = release.tag_name;
78126
+ const assetName = `horus-${tag}`;
78127
+ const checksumName = `${assetName}.sha256`;
78128
+ const binaryAsset = release.assets.find((a) => a.name === assetName);
78129
+ const checksumAsset = release.assets.find((a) => a.name === checksumName);
78130
+ if (!binaryAsset) {
78131
+ write(` ${import_picocolors36.default.red("\u2717")} Release ${tag} has no binary asset named '${assetName}'.`);
78132
+ write(` Fallback: ${import_picocolors36.default.dim("curl -fsSL https://horus.sh/install.sh | bash")}`);
78133
+ return 1;
78134
+ }
78135
+ write(`
78136
+ Downloading ${assetName}...`);
78137
+ const binRes = await _fetch(binaryAsset.browser_download_url, {
78138
+ headers: { "User-Agent": `horus/${HORUS_VERSION}` },
78139
+ redirect: "follow"
78140
+ });
78141
+ if (!binRes.ok || !binRes.body) {
78142
+ write(` ${import_picocolors36.default.red("\u2717")} Download failed: ${binRes.status}`);
78143
+ return 1;
78144
+ }
78145
+ const binBuf = Buffer.from(await binRes.arrayBuffer());
78146
+ if (checksumAsset) {
78147
+ const csRes = await _fetch(checksumAsset.browser_download_url, {
78148
+ headers: { "User-Agent": `horus/${HORUS_VERSION}` },
78149
+ redirect: "follow"
78150
+ });
78151
+ if (csRes.ok) {
78152
+ const csText = await csRes.text();
78153
+ const expectedHash = csText.trim().split(/\s+/)[0];
78154
+ const actualHash = sha256hex(binBuf);
78155
+ if (expectedHash !== actualHash) {
78156
+ write(` ${import_picocolors36.default.red("\u2717")} Checksum mismatch \u2014 download may be corrupt.`);
78157
+ write(` Expected: ${expectedHash}`);
78158
+ write(` Got: ${actualHash}`);
78159
+ return 1;
78160
+ }
78161
+ write(` ${import_picocolors36.default.green("\u2713")} Checksum verified.`);
78162
+ }
78163
+ }
78164
+ let binaryPath;
78165
+ try {
78166
+ binaryPath = resolveBinaryPath();
78167
+ } catch (e) {
78168
+ write(` ${import_picocolors36.default.red("\u2717")} ${e.message}`);
78169
+ return 1;
78170
+ }
78171
+ if (!(0, import_node_fs10.existsSync)(binaryPath)) {
78172
+ write(` ${import_picocolors36.default.red("\u2717")} Binary not found at ${binaryPath}`);
78173
+ return 1;
78174
+ }
78175
+ const tmpPath = (0, import_node_path12.join)((0, import_node_os3.tmpdir)(), `horus-update-${tag}-${process.pid}`);
78176
+ const backupPath = `${binaryPath}.bak`;
78177
+ try {
78178
+ (0, import_node_fs10.writeFileSync)(tmpPath, binBuf, { mode: 493 });
78179
+ } catch (e) {
78180
+ write(` ${import_picocolors36.default.red("\u2717")} Could not write to temp dir: ${e.message}`);
78181
+ return 1;
78182
+ }
78183
+ try {
78184
+ (0, import_node_fs10.renameSync)(binaryPath, backupPath);
78185
+ try {
78186
+ (0, import_node_fs10.renameSync)(tmpPath, binaryPath);
78187
+ (0, import_node_fs10.chmodSync)(binaryPath, 493);
78188
+ } catch (e) {
78189
+ try {
78190
+ (0, import_node_fs10.renameSync)(backupPath, binaryPath);
78191
+ } catch {
78192
+ }
78193
+ throw e;
78194
+ }
78195
+ try {
78196
+ (0, import_node_fs10.unlinkSync)(backupPath);
78197
+ } catch {
78198
+ }
78199
+ } catch (e) {
78200
+ try {
78201
+ (0, import_node_fs10.unlinkSync)(tmpPath);
78202
+ } catch {
78203
+ }
78204
+ const msg = e.message ?? String(e);
78205
+ const needsSudo = e.code === "EACCES" || e.code === "EPERM";
78206
+ write(` ${import_picocolors36.default.red("\u2717")} Could not replace binary at ${binaryPath}: ${msg}`);
78207
+ if (needsSudo) {
78208
+ write(`
78209
+ Try with sudo:`);
78210
+ write(
78211
+ ` ${import_picocolors36.default.dim(`sudo curl -fsSL https://github.com/meritt-dev/horus/releases/download/${tag}/${assetName} -o ${binaryPath} && sudo chmod +x ${binaryPath}`)}`
78212
+ );
78213
+ }
78214
+ return 1;
78215
+ }
78216
+ write(` ${import_picocolors36.default.green("\u2713")} Updated: ${import_picocolors36.default.bold(currentVersion)} \u2192 ${import_picocolors36.default.bold(latest)}`);
78217
+ write(` ${import_picocolors36.default.dim(binaryPath)}`);
78218
+ return 0;
78219
+ }
78220
+
78049
78221
  // ../../packages/cli/src/index.ts
78050
78222
  function buildProgram() {
78051
78223
  const program2 = new Command();
@@ -78387,6 +78559,14 @@ Examples:
78387
78559
  Examples:
78388
78560
  horus skill path claude
78389
78561
  horus skill path generic --global
78562
+ `);
78563
+ program2.command("update").description("Update Horus to the latest release from GitHub").option("--check", "check for a newer version without downloading").option("--force", "re-download even if already on the latest version").action(async (opts) => {
78564
+ process.exitCode = await runUpdate({ check: opts.check, force: opts.force });
78565
+ }).addHelpText("after", `
78566
+ Examples:
78567
+ horus update # update to latest
78568
+ horus update --check # check without installing
78569
+ horus update --force # re-download current version
78390
78570
  `);
78391
78571
  return program2;
78392
78572
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@merittdev/horus",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "Local-first, source-aware production-incident investigation engine",
5
5
  "type": "module",
6
6
  "bin": {