@iliasalmerekov/aegis 0.5.8 → 0.5.9

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.
package/README.md CHANGED
@@ -10,11 +10,27 @@ The package downloads the correct Aegis GitHub Release binary for the current
10
10
  Linux/macOS x64/arm64 host during `postinstall`, verifies SHA256, and exposes
11
11
  the `aegis` command.
12
12
 
13
- NPM installs the binary only. It does not edit `.bashrc`, `.zshrc`, Codex
14
- configuration, or Claude configuration. After installation, run
15
- `aegis install-hooks --all` if you want supported agent hooks, or run
16
- `aegis setup-shell` to opt in to shell-proxy mode for tools that launch commands
17
- through `$SHELL -c`.
13
+ NPM installs the binary and never edits `.bashrc` or `.zshrc`. As a
14
+ convenience, `postinstall` performs **best-effort** agent-hook setup: if a
15
+ `~/.claude` or `~/.codex` directory already exists, it runs
16
+ `aegis install-hooks --all`. It never creates those directories, and a hook-setup
17
+ failure never fails the npm install. Set `AEGIS_NPM_SKIP_HOOKS=1` to opt out.
18
+
19
+ If no agent directory exists yet, install one of the agents and then run:
20
+
21
+ ```bash
22
+ aegis install-hooks --all
23
+ ```
24
+
25
+ Claude Code and Codex command execution is protected through these `PreToolUse`
26
+ hooks, not through `setup-shell` — those agents ignore a non-bash/zsh `$SHELL`
27
+ in their Bash tool, so only the hook intercepts their commands.
28
+
29
+ To opt in to shell-proxy mode for tools that launch commands through `$SHELL -c`:
30
+
31
+ ```bash
32
+ aegis setup-shell
33
+ ```
18
34
 
19
35
  To undo shell-proxy setup later:
20
36
 
package/checksums.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
- "release": "v0.5.8",
2
+ "release": "v0.5.9",
3
3
  "repo": "IliasAlmerekov/aegis",
4
4
  "assets": {
5
- "aegis-linux-x86_64": "74128d3c210deddd0f28611f8ecd8aa0846f8d8d0d1651236458ccc4b1379abe",
6
- "aegis-linux-aarch64": "40c9e31e7c3378594128d88dbbfb6ee9670e16421e8814b0c387be765b511835",
7
- "aegis-macos-x86_64": "f1ae66b27530eac1a4cf92d5faa6e41f49ba22354864ec65636e1cf74a92c7a3",
8
- "aegis-macos-aarch64": "1438f71229df288d8108465a1ca5871a77fa7b872158f7fea41a3abf0ade4546"
5
+ "aegis-linux-x86_64": "088cb3c1c927e69b9fdcda852677f08d1e620e87e3e8fa8f7f6019e0d26d8d39",
6
+ "aegis-linux-aarch64": "2c96a5c880101e046e307a0a83a2d24f1fdc438dbe547cfb43df84eecf8b823b",
7
+ "aegis-macos-x86_64": "ef64b9af6067ee0343153d87fcf2f210f48219d139d3ad846c139615772a7485",
8
+ "aegis-macos-aarch64": "c8337ead145038ef25ccbcfa53fbc57cfe841cfed6322de31c77efd8a33576a1"
9
9
  }
10
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iliasalmerekov/aegis",
3
- "version": "0.5.8",
3
+ "version": "0.5.9",
4
4
  "description": "Terminal proxy that intercepts AI agent shell commands and requires human confirmation before destructive operations",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/IliasAlmerekov/aegis",
@@ -3,7 +3,9 @@
3
3
  const crypto = require("node:crypto");
4
4
  const fs = require("node:fs");
5
5
  const https = require("node:https");
6
+ const os = require("node:os");
6
7
  const path = require("node:path");
8
+ const { spawnSync } = require("node:child_process");
7
9
 
8
10
  const packageRoot = path.join(__dirname, "..");
9
11
  const vendorDir = path.join(packageRoot, "vendor");
@@ -41,6 +43,48 @@ function printNextSteps() {
41
43
  console.log(" aegis setup-shell --remove");
42
44
  }
43
45
 
46
+ // Best-effort agent hook setup. Only runs `aegis install-hooks --all` when a
47
+ // supported agent config directory already exists; never creates one. Failures
48
+ // here must not fail the npm install — the binary is already in place and the
49
+ // user can run `aegis install-hooks --all` manually. Set AEGIS_NPM_SKIP_HOOKS=1
50
+ // to opt out (used by deterministic packaging tests).
51
+ function maybeInstallAgentHooks() {
52
+ if (process.env.AEGIS_NPM_SKIP_HOOKS === "1") {
53
+ return;
54
+ }
55
+
56
+ const home = os.homedir();
57
+ if (!home) {
58
+ return;
59
+ }
60
+
61
+ const claudeDir = path.join(home, ".claude");
62
+ const codexDir = path.join(home, ".codex");
63
+ const hasAgentDir = fs.existsSync(claudeDir) || fs.existsSync(codexDir);
64
+
65
+ if (!hasAgentDir) {
66
+ console.log("");
67
+ console.log("If you install Claude Code or Codex later, run:");
68
+ console.log(" aegis install-hooks --all");
69
+ return;
70
+ }
71
+
72
+ try {
73
+ const result = spawnSync(binaryPath, ["install-hooks", "--all"], {
74
+ stdio: "inherit"
75
+ });
76
+ if (result.error) {
77
+ console.log("");
78
+ console.log("Could not auto-install agent hooks; run manually with:");
79
+ console.log(" aegis install-hooks --all");
80
+ }
81
+ } catch (_error) {
82
+ console.log("");
83
+ console.log("Could not auto-install agent hooks; run manually with:");
84
+ console.log(" aegis install-hooks --all");
85
+ }
86
+ }
87
+
44
88
  function readChecksums() {
45
89
  const raw = fs.readFileSync(checksumsPath, "utf8");
46
90
  return JSON.parse(raw);
@@ -128,6 +172,7 @@ async function main() {
128
172
  if (process.env.AEGIS_NPM_SKIP_DOWNLOAD === "1") {
129
173
  fs.writeFileSync(binaryPath, "#!/bin/sh\nprintf 'aegis test binary\\n'\n", { mode: 0o755 });
130
174
  printNextSteps();
175
+ maybeInstallAgentHooks();
131
176
  return;
132
177
  }
133
178
 
@@ -143,6 +188,7 @@ async function main() {
143
188
  fs.renameSync(tmpPath, binaryPath);
144
189
  fs.chmodSync(binaryPath, 0o755);
145
190
  printNextSteps();
191
+ maybeInstallAgentHooks();
146
192
  }
147
193
 
148
194
  main().catch(error => {