@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.
- package/README.md +40 -32
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# @oked/claude-code
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@oked/claude-code)
|
|
4
|
-
[](./LICENSE)
|
|
5
5
|
|
|
6
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
24
|
-
| `oked init --key-only` |
|
|
25
|
-
| `oked init --no-browser` | Print the pairing link
|
|
26
|
-
| `oked
|
|
27
|
-
| `oked
|
|
28
|
-
| `oked
|
|
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
|
|
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` |
|
|
40
|
-
| `warning` | Terminal log only, no
|
|
41
|
-
| `review` |
|
|
42
|
-
| `high_stakes` |
|
|
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
|
|
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
|
|
51
|
-
2. The hook classifies the action locally
|
|
52
|
-
3.
|
|
53
|
-
4. You
|
|
54
|
-
5. Approve or
|
|
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`
|
|
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 |
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
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.
|
|
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.
|
|
47
|
+
"@oked/sdk": "0.6.21"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"typescript": "^5.6.0"
|