@oked/claude-code 0.6.20 → 0.6.21

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/README.md +40 -32
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # @oked/claude-code
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@oked/claude-code.svg)](https://www.npmjs.com/package/@oked/claude-code)
4
- [![License: Apache-2.0](https://img.shields.io/badge/License-Apache--2.0-blue.svg)](./LICENSE)
4
+ [![License: Apache-2.0](https://img.shields.io/npm/l/@oked/claude-code.svg)](./LICENSE)
5
5
 
6
- Zero-code integration for Claude Code. Installs a `PreToolUse` hook that routes sensitive actions (destructive Bash commands, payment MCP tools, etc.) through the OKed backend and waits for a human decision before Claude Code proceeds.
6
+ Claude Code hook. Sensitive actions wait for a person in Telegram or on the [web dashboard](https://oked.ai/dashboard) before Claude Code continues. The iPhone app is coming soon.
7
7
 
8
- Non-dangerous actions are left to Claude's normal permission flow - OKed only intervenes when it matters.
8
+ Safe actions are allowed by the hook, with no notification. Warning actions are allowed and logged. OKed asks only for `review` and `high_stakes`.
9
9
 
10
10
  ## Install
11
11
 
@@ -14,66 +14,74 @@ npm install -g @oked/claude-code
14
14
  oked init
15
15
  ```
16
16
 
17
- `oked init` writes a `PreToolUse` hook entry into the current project's `.claude/settings.json`, opens OKed's device-pairing flow in your browser, and stores the paired API key in `~/.oked/config.json`. Open a new Claude Code session in that project to activate the hook.
17
+ `oked init` writes a `PreToolUse` hook into the current project's `.claude/settings.json`, opens the device-pairing page in your browser, and stores the API key in `~/.oked/config.json`. Open a new Claude Code session in that project.
18
+
19
+ On a TTY, unless `NO_COLOR` is set, init also prints a QR code of the pairing link. The QR opens that link in the phone's browser.
20
+
21
+ The approval window is 10 minutes. The hook process is allowed 690 seconds, and the SDK client waits 630 seconds, so a timeout becomes a deny instead of Claude killing the hook first.
18
22
 
19
23
  ## Commands
20
24
 
21
25
  | Command | What it does |
22
26
  |---|---|
23
- | `oked init` | Install or update the project hook and pair this device. It also updates an existing `oked-hook` entry in your user settings (`~/.claude/settings.json`), for example to a new timeout. Run it again after you update the package. |
24
- | `oked init --key-only` | Only create or show your OKed API key (saved in `~/.oked/config.json`). It adds or changes no hook. Use it for tools that only need the key, such as the OpenShell middleware. |
25
- | `oked init --no-browser` | Print the pairing link instead of opening a browser, and leave the clipboard alone. Useful on a server or over SSH. Works with `--key-only`. |
26
- | `oked status` | Show install state and ping the backend. |
27
- | `oked receipts verify [file]` | Check this machine's copy of approval receipts (default `~/.oked/receipts.jsonl`): every signature, and the chain links between neighbouring receipts. |
28
- | `oked uninstall` | Remove the project hook entry (other hooks are preserved). |
27
+ | `oked init` | Install or update the project hook and pair this device. It also updates an existing `oked-hook` entry in user settings (`~/.claude/settings.json`), for example to raise an old timeout. Run it again after you update the package. |
28
+ | `oked init --key-only` | Create or show the API key in `~/.oked/config.json`. It does not add or change a hook. Use it for tools that only need the key, such as the [OpenShell](https://github.com/oked-ai/oked-openshell) middleware. The paired client type is `sdk`. |
29
+ | `oked init --no-browser` | Print the pairing link. Do not open a browser, and do not touch the clipboard. Works with `--key-only`. |
30
+ | `oked init --yes` (or `-y`) | Skip the "press Enter to open the browser" prompt. For a non-interactive shell. |
31
+ | `oked status` | Show install state and ping `GET /health` on the backend. |
32
+ | `oked receipts verify [file]` | Check this machine's receipts (default `~/.oked/receipts.jsonl`): every signature, and the chain links between neighbouring receipts. |
33
+ | `oked uninstall` | Remove the project hook entry. Other hooks are kept. |
29
34
 
30
35
  ## What gets intercepted
31
36
 
32
- The hook uses a four-tier classifier. Classification is **effect-based**: it
33
- detects the *kind of effect* an action has rather than matching specific command
34
- names, and **defaults to no prompt**. Only destructive, irreversible, or
35
- outward-facing operations put a human in the loop.
37
+ The hook uses a four-tier classifier. Classification is effect-based: it detects the kind of effect, not a list of command names, and it defaults to no prompt. Only destructive, irreversible, or outward-facing operations ask a person.
36
38
 
37
39
  | Tier | Behavior | Examples |
38
40
  |---|---|---|
39
- | `safe` | Auto-allow, no notification | Reads & queries, a DB `SELECT`, and any command with no detected side effect — `ls`, `grep`, `jq`, `node`, `npx`, plain `curl` GET (the default) |
40
- | `warning` | Terminal log only, no push | A reversible local mutation: file create / `cp` / `mv`, a `/tmp` delete, local git (`add`/`commit`), `npm install`, SQL `INSERT`/`CREATE` |
41
- | `review` | Push notification, tap to approve | Sensitive-path writes (`~/.ssh`, shell rc, system dirs, OKed config), `sudo`, outward message/email sends, `curl` POST/PUT/PATCH with an inline body, MCP `create_*` / `send_*` / `update_*` |
42
- | `high_stakes` | Push notification with confirmation | Destructive / irreversible / external: `rm` of non-temp data, `DROP TABLE` / `DELETE FROM`, `git push` / `reset --hard` / `branch -D`, `mkfs` / `dd`-to-device / `shutdown`, `curl` DELETE / file upload / pay-or-send API, `ssh`/`scp`, `npm publish`, `kill` |
41
+ | `safe` | Allow, no notification | Reads and queries, a DB `SELECT`, and any Bash command with no detected side effect: `ls`, `grep`, `jq`, `node`, `npx`, plain `curl` GET |
42
+ | `warning` | Terminal log only, no approval | A reversible local change: file create, `cp`, `mv`, a `/tmp` delete, local git (`add`, `commit`), `npm install`, SQL `INSERT` or `CREATE` |
43
+ | `review` | Wait for approval | Sensitive-path writes (`~/.ssh`, shell rc, system dirs, OKed config), `sudo`, outward message or email sends, `curl` POST/PUT/PATCH with an inline body, other cloud CLI writes (`aws s3 cp` to a bucket, `kubectl apply`, `helm upgrade`, a preview deploy), MCP tools named `create_*`, `send_*`, or `update_*` |
44
+ | `high_stakes` | Wait for approval, with confirmation | Destructive or hard to undo: `rm` of non-temp data, `DROP TABLE` or `DELETE FROM`, `git push` / `reset --hard` / `branch -D`, `mkfs`, `dd` to a device, `shutdown`, `curl` DELETE, file upload, pay or send APIs, `ssh` / `scp`, `npm publish`, `kill`, cloud and cluster deletes (`aws s3 rm`, `kubectl delete`), `terraform apply` / `destroy`, production deploys (`vercel --prod`, `fly deploy`), Stripe CLI writes |
43
45
 
44
- A Bash command that matches none of the prompt-worthy effect categories defaults
45
- to `safe` — running a command is not, by itself, something we interrupt you for.
46
- (Unknown non-Bash *tools* still default to `review`.)
46
+ A Bash command that matches none of those effect categories defaults to `safe`. Cloud CLI reads (`aws s3 ls`, `kubectl get`, `terraform plan`), `--help`, and dry runs are `safe`. Running a command is not, by itself, a reason to interrupt you. Unknown tools that are not Bash default to `review`. MCP tools named `delete_*`, `drop_*`, or `remove_*` are `high_stakes`.
47
47
 
48
48
  ## How it works
49
49
 
50
- 1. Claude Code fires the `PreToolUse` hook before every tool call.
51
- 2. The hook classifies the action locally (no network call for safe actions).
52
- 3. If it's high-stakes, it sends an approval request to the OKed backend.
53
- 4. You get a notification (Telegram, web push, or dashboard).
54
- 5. Approve or deny - Claude waits for your decision.
50
+ 1. Claude Code runs the `PreToolUse` hook (`oked-hook`) before the tool call. The hook is a separate process.
51
+ 2. The hook classifies the action locally. `safe` and `warning` do not wait on the network, unless a cached user rule matches and the action has to be sent to the backend.
52
+ 3. For `review` and `high_stakes`, it sends an approval request.
53
+ 4. You decide in Telegram or on the web dashboard. Web push is optional.
54
+ 5. Approve, and Claude continues. Deny or time out, and the tool call is denied.
55
+
56
+ If this device is not paired, the hook returns `ask`, so Claude Code's own permission prompt can decide.
55
57
 
56
58
  ## Environment
57
59
 
58
60
  | Var | Required | Description |
59
61
  |---|---|---|
60
- | `OKED_API_KEY` | no, after pairing | Optional override. `oked init` normally stores the paired key in `~/.oked/config.json`. |
62
+ | `OKED_API_KEY` | no, after pairing | Optional override. `oked init` stores the paired key in `~/.oked/config.json`. |
61
63
  | `OKED_BACKEND_URL` | no | Override the hosted backend URL. |
62
- | `OKED_STRICT_FAIL_CLOSED` | no | Set to `1` or `true` to deny every sensitive action when the backend is unreachable. |
64
+ | `OKED_STRICT_FAIL_CLOSED` | no | `1` or `true` denies every sensitive action when the backend is unreachable. |
65
+ | `OKED_REQUIRE_RECEIPT` | no | `0` allows an approval with no receipt. On by default since 0.6.0. |
66
+ | `OKED_HOOK_LOG` | no | Decision log path. Default `~/.oked/hook.log`. |
63
67
 
64
68
  ## Receipts
65
69
 
66
- Every decision comes with a receipt signed by OKed (who decided, how they were verified, the exact command, when). The hook verifies it before allowing the action, shows its short id (`Approved via OKed (receipt rcpt_7Q2FABCD)`), and keeps your own copy in `~/.oked/receipts.jsonl`. Check that file any time with `oked receipts verify`. Since 0.6.0 the hook denies any approval that comes without a valid receipt. Set `OKED_REQUIRE_RECEIPT=0` only for a backend that does not sign receipts. See [docs/receipts.md](../../docs/receipts.md).
70
+ Every decision comes with a receipt signed by OKed (who decided, how they were verified, the exact command, when). The hook verifies it before allowing the action, shows its short id (`Approved via OKed (receipt rcpt_7Q2FABCD)`), and keeps a copy in `~/.oked/receipts.jsonl`. Check that file with `oked receipts verify`. Since 0.6.0 the hook denies an approval that has no valid receipt. Set `OKED_REQUIRE_RECEIPT=0` only for a backend that does not sign receipts.
71
+
72
+ You can also paste one receipt at [oked.ai/docs/#verify](https://oked.ai/docs/#verify), or check an export with `npx @oked/verify`. See [docs/receipts.md](../../docs/receipts.md).
67
73
 
68
74
  ## Degraded-mode behavior
69
75
 
70
- Explicit denials, invalid API keys and approval receipts that do not verify deny the action. If the backend is unreachable, OKed denies `high_stakes` actions and, by default, allows lower tiers so a temporary outage does not stop every Claude Code workflow. If no API key is configured, the hook returns `ask` so Claude Code's native permission flow can handle the decision. Set `OKED_STRICT_FAIL_CLOSED=1` to deny every sensitive action during backend outages.
76
+ Explicit denials, invalid API keys, and receipts that do not verify deny the action. If the backend is unreachable, OKed denies `high_stakes` and, by default, allows lower tiers, so a short outage does not stop every workflow. Set `OKED_STRICT_FAIL_CLOSED=1` to deny every sensitive action during an outage.
77
+
78
+ The backend counts as unreachable when the connection fails, when it answers with HTTP 5xx, when the hosting platform answers in its place (for example Railway "Application not found"), or when the reply is not JSON. "Too many pending approvals" (HTTP 429) is not an outage: the hook denies the action and asks you to decide the waiting approvals first. Deny reasons include the error and its HTTP status.
71
79
 
72
- The backend counts as unreachable when the connection fails, when it answers with HTTP 5xx, when the hosting platform answers in its place (for example Railway "Application not found"), or when the reply is not JSON. "Too many pending approvals" (HTTP 429) is not an outage: the hook denies the action and asks you to decide the waiting approvals first. Every deny reason shows the real error and its HTTP status.
80
+ If the hook cannot parse its stdin, it allows the call, so a bad payload does not crash Claude. Every other unexpected error denies.
73
81
 
74
82
  ## Decision log
75
83
 
76
- The hook writes one JSON line to `~/.oked/hook.log` (mode 600) for each deny and ask, and for each degraded allow (`"degraded": true`: an action that ran without a person's decision because the backend was unreachable). Each line has the time, decision, tool, tier, reason, approval ID, receipt ID and error (name, message, HTTP status). The log never holds the tool input or the command. Above 1 MB, it moves to `hook.log.1`. Set `OKED_HOOK_LOG` to use another file.
84
+ The hook writes one JSON line to `~/.oked/hook.log` (mode 600) for each deny and ask, and for each degraded allow (`"degraded": true`: an action that ran without a person's decision because the backend was unreachable). Each line has the time, decision, tool, tier, reason, client, approval id, receipt id, and error (name, message, HTTP status). The log never holds the tool input or the command. Above 1 MB, the file moves to `hook.log.1`. Set `OKED_HOOK_LOG` to use another path.
77
85
 
78
86
  ## License
79
87
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oked/claude-code",
3
- "version": "0.6.20",
3
+ "version": "0.6.21",
4
4
  "description": "OKed for Claude Code - zero-code human approval for sensitive actions",
5
5
  "type": "module",
6
6
  "bin": {
@@ -44,7 +44,7 @@
44
44
  "access": "public"
45
45
  },
46
46
  "dependencies": {
47
- "@oked/sdk": "0.6.20"
47
+ "@oked/sdk": "0.6.21"
48
48
  },
49
49
  "devDependencies": {
50
50
  "typescript": "^5.6.0"