agentinel 0.0.10 → 1.0.0

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 (3) hide show
  1. package/README.md +52 -19
  2. package/dist/asen.js +36 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -4,6 +4,7 @@
4
4
  [![npm version](https://img.shields.io/npm/v/agentinel.svg?style=flat-square)](https://www.npmjs.com/package/agentinel)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](LICENSE)
6
6
  [![Node.js CI](https://img.shields.io/github/actions/workflow/status/aman-janwani/agentinel/publish.yml?style=flat-square)](https://github.com/aman-janwani/agentinel/actions)
7
+ [![Tested On](https://img.shields.io/badge/Tested_On-macOS_%7C_Linux_%7C_Windows-success?style=flat-square)](#)
7
8
  </div>
8
9
 
9
10
  <br />
@@ -34,6 +35,7 @@ Every other tool in this space guards your terminal. **Agentinel guards your age
34
35
  - **Known Malware:** Bundles a local OSV database of 216,000+ confirmed malicious packages.
35
36
  - **Zero False Positives on Popular Packages:** Tested against the top 100 npm packages.
36
37
  - **Heuristic Scanning:** Flags npm takedowns, packages under 30 days old with < 1k downloads (slopsquatting), publisher drift, and non-existent hallucinated names.
38
+ - **Cross-Platform Compatibility:** Fully tested and natively supported across macOS, Linux, and Windows.
37
39
  - **Fails Open:** Designed so that if it crashes or can't reach the registry, it fails open. It will never permanently wedge your terminal or block your work.
38
40
 
39
41
  ---
@@ -119,17 +121,31 @@ How do we stack up against traditional commercial security scanners?
119
121
 
120
122
  ---
121
123
 
122
- ## ⚙️ Configuration (Warn vs. Block)
124
+ ## ⚙️ Modes: warn vs strict
123
125
 
124
- By default, Agentinel runs in **Warn Mode**. It alerts you (and the agent) but gets out of the way.
125
- To strictly block bad packages, change your `.agentinel.json` file to strict mode:
126
+ Agentinel supports two operating modes, controlled by the `mode` field. You can switch between them using `npx asen mode <warn|strict>`.
126
127
 
128
+ ### warn (default)
129
+ Agentinel surfaces a warning in the agent output but does not block the install. The agent decides whether to proceed.
130
+
131
+ `.agentinel.json`
127
132
  ```json
128
133
  {
129
- "mode": "strict",
130
- "allowlist": {}
134
+ "mode": "warn"
131
135
  }
132
136
  ```
137
+ *Best for teams migrating to Agentinel gradually or using agents in read-heavy workflows.*
138
+
139
+ ### strict
140
+ Agentinel hard-blocks the install and returns an error payload to the agent. The install never reaches npm.
141
+
142
+ `.agentinel.json`
143
+ ```json
144
+ {
145
+ "mode": "strict"
146
+ }
147
+ ```
148
+ *Recommended for production repos, CI pipelines, and any project with autonomous agentic access.*
133
149
 
134
150
  ---
135
151
 
@@ -137,31 +153,40 @@ To strictly block bad packages, change your `.agentinel.json` file to strict mod
137
153
 
138
154
  Here are all the commands you can run via `npx asen <command>`:
139
155
 
140
- ### `npx asen init`
156
+ ### `npx asen init [--shim]`
141
157
  Wires up agent hooks and git hooks in the current repo.
142
158
  ```bash
143
159
  $ npx asen init
144
- Wired up pre-commit git hook.
145
- Wired up Claude Code PreToolUse hook.
160
+ wrote .agentinel.json
161
+ registered the Claude Code PreToolUse hook in .claude/settings.json
162
+ installed the git pre-commit hook in .git/hooks
163
+
164
+ agentinel is set up. New npm packages will be checked before they land.
165
+ Default mode is warn. Set "mode": "strict" in .agentinel.json to block instead.
146
166
  ```
147
167
 
148
- ### `npx asen init --shim`
149
- Wires up hooks AND installs the global PATH shim for human terminal protection.
168
+ When used with `--shim`, it wires up hooks AND installs the global PATH shim for human terminal protection.
150
169
  ```bash
151
170
  $ npx asen init --shim
152
- Shim installed. Native terminal npm commands are now guarded.
153
- Wired up pre-commit git hook.
171
+ wrote .agentinel.json
172
+ registered the Claude Code PreToolUse hook in .claude/settings.json
173
+ installed the git pre-commit hook in .git/hooks
174
+ wrote shims for npm, npx, pnpm, yarn, bun in /Users/user/.agentinel/bin
175
+ added the shims to PATH in /Users/user/.zshrc
176
+ Mode is warn, so a risky package typed at the terminal will be reported, not blocked.
177
+ Open a new terminal, or run \`asen unshim\` to undo this.
178
+
179
+ agentinel is set up. New npm packages will be checked before they land.
180
+ Default mode is warn. Set "mode": "strict" in .agentinel.json to block instead.
154
181
  ```
155
182
 
156
- ### `npx asen check`
183
+ ### `npx asen check [pkg...]`
157
184
  Scans the currently staged dependencies in your lockfile. Exits non-zero if flagged (great for CI/CD pipelines).
158
185
  ```bash
159
186
  $ npx asen check
160
- Scanning staged dependencies...
161
- ✅ All 142 staged packages passed security checks.
187
+ checked 142 package(s), nothing suspicious
162
188
  ```
163
189
 
164
- ### `npx asen check <package-name>`
165
190
  Scans a specific package instantly without installing it.
166
191
  ```bash
167
192
  $ npx asen check react-router-v7-fake
@@ -169,18 +194,26 @@ $ npx asen check react-router-v7-fake
169
194
  This matches the profile of a slopsquatting or malicious package.
170
195
  ```
171
196
 
172
- ### `npx asen allow <package-name> --reason "why"`
197
+ ### `npx asen allow <pkg> --reason "..."`
173
198
  Adds a package to the allowlist in `.agentinel.json` with a required reason. This provides an audited trail for your team.
174
199
  ```bash
175
200
  $ npx asen allow my-internal-pkg --reason "Internal company package not on public npm"
176
- Added my-internal-pkg to .agentinel.json allowlist.
201
+ allowlisted my-internal-pkg in .agentinel.json
202
+ ```
203
+
204
+ ### `npx asen mode <warn|strict>`
205
+ Switches Agentinel's operating mode in the `.agentinel.json` file.
206
+ ```bash
207
+ $ npx asen mode strict
208
+ set mode to strict in .agentinel.json
177
209
  ```
178
210
 
179
211
  ### `npx asen unshim`
180
212
  Removes the global PATH shim.
181
213
  ```bash
182
214
  $ npx asen unshim
183
- ✅ Shim removed. Normal npm path restored.
215
+ removed /Users/user/.agentinel/bin
216
+ removed the PATH line from /Users/user/.zshrc
184
217
  ```
185
218
 
186
219
  ---
package/dist/asen.js CHANGED
@@ -102,7 +102,21 @@ import { join } from "path";
102
102
  // src/config/schema.ts
103
103
  var CONFIG_FILENAME = ".agentinel.json";
104
104
  function defaultConfig() {
105
- return { mode: "warn", allow: [] };
105
+ return {
106
+ mode: "warn",
107
+ allow: [
108
+ {
109
+ name: "asen",
110
+ reason: "Agentinel CLI tool",
111
+ date: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10)
112
+ },
113
+ {
114
+ name: "agentinel",
115
+ reason: "Agentinel package",
116
+ date: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10)
117
+ }
118
+ ]
119
+ };
106
120
  }
107
121
  function parseConfig(raw, warn2 = () => {
108
122
  }) {
@@ -1464,6 +1478,24 @@ function asRecord2(value) {
1464
1478
  return typeof value === "object" && value !== null ? value : null;
1465
1479
  }
1466
1480
 
1481
+ // src/commands/mode.ts
1482
+ function runMode(targetMode) {
1483
+ if (targetMode !== "warn" && targetMode !== "strict") {
1484
+ console.error("usage: asen mode <warn|strict>");
1485
+ return 1;
1486
+ }
1487
+ const repoRoot = repoRootOrCwd();
1488
+ const config = loadConfig(repoRoot);
1489
+ if (config.mode === targetMode) {
1490
+ console.log(`mode is already ${targetMode}`);
1491
+ return 0;
1492
+ }
1493
+ config.mode = targetMode;
1494
+ saveConfig(repoRoot, config);
1495
+ console.log(`set mode to ${targetMode} in .agentinel.json`);
1496
+ return 0;
1497
+ }
1498
+
1467
1499
  // src/hooks/claude-code.ts
1468
1500
  import { existsSync as existsSync6 } from "fs";
1469
1501
  import { join as join6 } from "path";
@@ -1769,6 +1801,7 @@ var USAGE = `asen, a guard for AI coding agent workflows
1769
1801
  asen init [--shim] set up the hooks and config in this repo
1770
1802
  asen check [pkg...] check staged dependencies, or specific packages
1771
1803
  asen allow <pkg> --reason "..." allowlist a flagged package, with a logged reason
1804
+ asen mode <warn|strict> switch Agentinel's operating mode
1772
1805
  asen unshim remove the PATH shims that --shim installed
1773
1806
  `;
1774
1807
  async function main(argv2) {
@@ -1780,6 +1813,8 @@ async function main(argv2) {
1780
1813
  return runCheck(positionals(rest));
1781
1814
  case "allow":
1782
1815
  return runAllow(positionals(rest)[0], readFlag(rest, "--reason"));
1816
+ case "mode":
1817
+ return runMode(positionals(rest)[0]);
1783
1818
  case "unshim":
1784
1819
  return removeShim();
1785
1820
  // Not documented in the usage text on purpose. These are what the installed hooks call.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentinel",
3
- "version": "0.0.10",
3
+ "version": "1.0.0",
4
4
  "description": "Catches AI hallucinated npm packages before an agent installs them",
5
5
  "license": "MIT",
6
6
  "author": "Aman Janwani",