@oked/claude-code 0.1.0 → 0.1.4

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 OKed
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 OKed
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,62 +1,62 @@
1
- # @oked/claude-code
2
-
3
- [![npm version](https://img.shields.io/npm/v/@oked/claude-code.svg)](https://www.npmjs.com/package/@oked/claude-code)
4
- [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](./LICENSE)
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.
7
-
8
- Non-dangerous actions are left to Claude's normal permission flow - OKed only intervenes when it matters.
9
-
10
- ## Install
11
-
12
- ```bash
13
- npm install -g @oked/claude-code
14
- oked init
15
- ```
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.
18
-
19
- ## Commands
20
-
21
- | Command | What it does |
22
- |---|---|
23
- | `oked init` | Install or update the project hook and pair this device. |
24
- | `oked status` | Show install state and ping the backend. |
25
- | `oked uninstall` | Remove the project hook entry (other hooks are preserved). |
26
-
27
- ## What gets intercepted
28
-
29
- The hook uses a four-tier classifier:
30
-
31
- | Tier | Behavior | Examples |
32
- |---|---|---|
33
- | `safe` | Auto-allow, no notification | `Read`, `Glob`, read-only Bash (`ls`, `git status`, plain `curl` GET) |
34
- | `warning` | Terminal log only, no push | `Write` / `Edit` / `NotebookEdit` on a file inside the project |
35
- | `review` | Push notification, tap to approve | `Write` / `Edit` on a file outside the project, MCP `create_*` / `send_*` / `update_*` |
36
- | `high_stakes` | Push notification with confirmation | `rm -rf`, `git push --force`, `DROP TABLE`, `delete_*` MCP tools |
37
-
38
- Everything not matched by the classifier defaults to `review`.
39
-
40
- ## How it works
41
-
42
- 1. Claude Code fires the `PreToolUse` hook before every tool call.
43
- 2. The hook classifies the action locally (no network call for safe actions).
44
- 3. If it's high-stakes, it sends an approval request to the OKed backend.
45
- 4. You get a notification (Telegram, web push, or dashboard).
46
- 5. Approve or deny - Claude waits for your decision.
47
-
48
- ## Environment
49
-
50
- | Var | Required | Description |
51
- |---|---|---|
52
- | `OKED_API_KEY` | no, after pairing | Optional override. `oked init` normally stores the paired key in `~/.oked/config.json`. |
53
- | `OKED_BACKEND_URL` | no | Override the hosted backend URL. |
54
- | `OKED_STRICT_FAIL_CLOSED` | no | Set to `1` or `true` to deny every sensitive action when the backend is unreachable. |
55
-
56
- ## Degraded-mode behavior
57
-
58
- Explicit denials and invalid API keys 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.
59
-
60
- ## License
61
-
62
- [MIT](./LICENSE)
1
+ # @oked/claude-code
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@oked/claude-code.svg)](https://www.npmjs.com/package/@oked/claude-code)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](./LICENSE)
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.
7
+
8
+ Non-dangerous actions are left to Claude's normal permission flow - OKed only intervenes when it matters.
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ npm install -g @oked/claude-code
14
+ oked init
15
+ ```
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.
18
+
19
+ ## Commands
20
+
21
+ | Command | What it does |
22
+ |---|---|
23
+ | `oked init` | Install or update the project hook and pair this device. |
24
+ | `oked status` | Show install state and ping the backend. |
25
+ | `oked uninstall` | Remove the project hook entry (other hooks are preserved). |
26
+
27
+ ## What gets intercepted
28
+
29
+ The hook uses a four-tier classifier:
30
+
31
+ | Tier | Behavior | Examples |
32
+ |---|---|---|
33
+ | `safe` | Auto-allow, no notification | `Read`, `Glob`, read-only Bash (`ls`, `git status`, plain `curl` GET) |
34
+ | `warning` | Terminal log only, no push | `Write` / `Edit` / `NotebookEdit` on a file inside the project |
35
+ | `review` | Push notification, tap to approve | `Write` / `Edit` on a file outside the project, MCP `create_*` / `send_*` / `update_*` |
36
+ | `high_stakes` | Push notification with confirmation | `rm -rf`, `git push --force`, `DROP TABLE`, `delete_*` MCP tools |
37
+
38
+ Everything not matched by the classifier defaults to `review`.
39
+
40
+ ## How it works
41
+
42
+ 1. Claude Code fires the `PreToolUse` hook before every tool call.
43
+ 2. The hook classifies the action locally (no network call for safe actions).
44
+ 3. If it's high-stakes, it sends an approval request to the OKed backend.
45
+ 4. You get a notification (Telegram, web push, or dashboard).
46
+ 5. Approve or deny - Claude waits for your decision.
47
+
48
+ ## Environment
49
+
50
+ | Var | Required | Description |
51
+ |---|---|---|
52
+ | `OKED_API_KEY` | no, after pairing | Optional override. `oked init` normally stores the paired key in `~/.oked/config.json`. |
53
+ | `OKED_BACKEND_URL` | no | Override the hosted backend URL. |
54
+ | `OKED_STRICT_FAIL_CLOSED` | no | Set to `1` or `true` to deny every sensitive action when the backend is unreachable. |
55
+
56
+ ## Degraded-mode behavior
57
+
58
+ Explicit denials and invalid API keys 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.
59
+
60
+ ## License
61
+
62
+ [MIT](./LICENSE)
package/bin/oked-hook.js CHANGED
@@ -1,2 +1,2 @@
1
- #!/usr/bin/env node
2
- import "../dist/hook.js";
1
+ #!/usr/bin/env node
2
+ import "../dist/hook.js";
package/bin/oked.js CHANGED
@@ -1,2 +1,2 @@
1
- #!/usr/bin/env node
2
- import "../dist/cli.js";
1
+ #!/usr/bin/env node
2
+ import "../dist/cli.js";
package/dist/cli.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import { readFileSync, writeFileSync, existsSync, mkdirSync, chmodSync } from "fs";
3
3
  import { hostname } from "os";
4
4
  import { join, dirname } from "path";
5
+ import { fileURLToPath } from "url";
5
6
  import { spawn } from "child_process";
6
7
  import { OKedClient, loadOKedConfig, OKED_CONFIG_PATH } from "@oked/sdk";
7
8
  const MCP_TOOL_MATCHER = "mcp__.*";
@@ -17,7 +18,18 @@ const HOOK_CONFIG = {
17
18
  ],
18
19
  };
19
20
  const DEFAULT_BACKEND_URL = process.env.OKED_BACKEND_URL || "https://api.oked.ai";
20
- const CLIENT_VERSION = "0.1.0";
21
+ // Derived from this package's package.json at runtime so the version the
22
+ // backend sees (client_version) can never drift from what's actually shipped.
23
+ // From dist/cli.js, package.json sits one dir up at the package root.
24
+ const CLIENT_VERSION = (() => {
25
+ try {
26
+ const pkgPath = join(dirname(fileURLToPath(import.meta.url)), "..", "package.json");
27
+ return JSON.parse(readFileSync(pkgPath, "utf-8")).version ?? "0.0.0";
28
+ }
29
+ catch {
30
+ return "0.0.0";
31
+ }
32
+ })();
21
33
  function getSettingsPath() {
22
34
  return join(process.cwd(), ".claude", "settings.json");
23
35
  }
package/package.json CHANGED
@@ -1,51 +1,51 @@
1
- {
2
- "name": "@oked/claude-code",
3
- "version": "0.1.0",
4
- "description": "OKed for Claude Code - zero-code human approval for sensitive actions",
5
- "type": "module",
6
- "bin": {
7
- "oked": "./bin/oked.js",
8
- "oked-hook": "./bin/oked-hook.js"
9
- },
10
- "scripts": {
11
- "prebuild": "npm run build --workspace=@oked/sdk",
12
- "build": "tsc",
13
- "prepublishOnly": "npm run build"
14
- },
15
- "files": [
16
- "dist",
17
- "bin",
18
- "README.md",
19
- "LICENSE"
20
- ],
21
- "keywords": [
22
- "claude-code",
23
- "claude",
24
- "approval",
25
- "hook",
26
- "agents",
27
- "oked"
28
- ],
29
- "repository": {
30
- "type": "git",
31
- "url": "git+https://github.com/oked-ai/oked-sdk.git",
32
- "directory": "packages/claude-code"
33
- },
34
- "bugs": {
35
- "url": "https://github.com/oked-ai/oked-sdk/issues"
36
- },
37
- "homepage": "https://github.com/oked-ai/oked-sdk#readme",
38
- "license": "MIT",
39
- "engines": {
40
- "node": ">=18"
41
- },
42
- "publishConfig": {
43
- "access": "public"
44
- },
45
- "dependencies": {
46
- "@oked/sdk": "0.1.0"
47
- },
48
- "devDependencies": {
49
- "typescript": "^5.6.0"
50
- }
51
- }
1
+ {
2
+ "name": "@oked/claude-code",
3
+ "version": "0.1.4",
4
+ "description": "OKed for Claude Code - zero-code human approval for sensitive actions",
5
+ "type": "module",
6
+ "bin": {
7
+ "oked": "./bin/oked.js",
8
+ "oked-hook": "./bin/oked-hook.js"
9
+ },
10
+ "scripts": {
11
+ "prebuild": "npm run build --workspace=@oked/sdk",
12
+ "build": "tsc",
13
+ "prepublishOnly": "npm run build"
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "bin",
18
+ "README.md",
19
+ "LICENSE"
20
+ ],
21
+ "keywords": [
22
+ "claude-code",
23
+ "claude",
24
+ "approval",
25
+ "hook",
26
+ "agents",
27
+ "oked"
28
+ ],
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/oked-ai/oked-sdk.git",
32
+ "directory": "packages/claude-code"
33
+ },
34
+ "bugs": {
35
+ "url": "https://github.com/oked-ai/oked-sdk/issues"
36
+ },
37
+ "homepage": "https://github.com/oked-ai/oked-sdk#readme",
38
+ "license": "MIT",
39
+ "engines": {
40
+ "node": ">=18"
41
+ },
42
+ "publishConfig": {
43
+ "access": "public"
44
+ },
45
+ "dependencies": {
46
+ "@oked/sdk": "0.1.4"
47
+ },
48
+ "devDependencies": {
49
+ "typescript": "^5.6.0"
50
+ }
51
+ }