@ory/claude-code 0.2.0 → 0.3.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.
- package/dist/cli/main.js +10 -4
- package/dist/cli/setup.d.ts +21 -12
- package/dist/cli/setup.js +137 -54
- package/dist/handlers.js +16 -8
- package/package.json +2 -2
package/dist/cli/main.js
CHANGED
|
@@ -111,12 +111,18 @@ function status() {
|
|
|
111
111
|
console.log("");
|
|
112
112
|
(0, argus_1.printOryConfig)();
|
|
113
113
|
(0, argus_1.printEnvironment)();
|
|
114
|
-
// Plugin-specific status
|
|
114
|
+
// Plugin-specific status. The default install path delegates plugin
|
|
115
|
+
// assembly to the public `ory/claude-plugins` marketplace, so the persistent
|
|
116
|
+
// dir below is only populated for `--from-source` installs (the dev launcher
|
|
117
|
+
// and local iteration). Run `claude plugin list` for an authoritative view
|
|
118
|
+
// of what the `claude` CLI has registered.
|
|
115
119
|
console.log("");
|
|
116
120
|
console.log("Plugin:");
|
|
117
121
|
const assembled = fs.existsSync(PERSISTENT_DIR);
|
|
118
|
-
console.log(`
|
|
119
|
-
|
|
122
|
+
console.log(` Local --from-source dir: ${assembled ? PERSISTENT_DIR : "(none — production installs use the ory/claude-plugins marketplace; run 'claude plugin list' to see registered plugins)"}`);
|
|
123
|
+
if (assembled) {
|
|
124
|
+
console.log(` Skills: ${fs.existsSync(path.join(PERSISTENT_DIR, "skills")) ? "installed" : "not installed"}`);
|
|
125
|
+
}
|
|
120
126
|
console.log(` Hook script: ${fs.existsSync(path.join(PACKAGE_ROOT, "dist", "hook.js")) ? "built" : "NOT BUILT (run pnpm build)"}`);
|
|
121
127
|
(0, argus_1.printLogTail)();
|
|
122
128
|
}
|
|
@@ -132,7 +138,7 @@ Commands:
|
|
|
132
138
|
install [--global] Install Ory plugin via claude CLI marketplace
|
|
133
139
|
uninstall [--global] Remove Ory plugin and marketplace
|
|
134
140
|
configure Set or view Ory project URL and API key
|
|
135
|
-
permissions <cmd> Manage permission mode and tool
|
|
141
|
+
permissions <cmd> Manage permission mode and tool permissions (status, bootstrap, observe, enforce)
|
|
136
142
|
status Show plugin status and configuration
|
|
137
143
|
local <cmd> Manage local Ory dev environment (up, down, status, seed, ...)
|
|
138
144
|
|
package/dist/cli/setup.d.ts
CHANGED
|
@@ -3,26 +3,35 @@
|
|
|
3
3
|
* Setup CLI for the Ory Claude Code plugin.
|
|
4
4
|
*
|
|
5
5
|
* Uses the `claude` CLI to manage plugin installation via the marketplace:
|
|
6
|
-
* npx ory-claude-setup
|
|
7
|
-
* npx ory-claude-setup --global
|
|
8
|
-
* npx ory-claude-setup --
|
|
6
|
+
* npx ory-claude-setup # Install plugin (project scope)
|
|
7
|
+
* npx ory-claude-setup --global # Install plugin (user scope)
|
|
8
|
+
* npx ory-claude-setup --from-source # Install from the local source tree (dev only)
|
|
9
|
+
* npx ory-claude-setup --uninstall # Remove plugin
|
|
9
10
|
*/
|
|
10
11
|
/**
|
|
11
12
|
* Install the Ory plugin via the `claude` CLI.
|
|
12
13
|
*
|
|
13
|
-
*
|
|
14
|
-
* 2. Adds the Ory marketplace (pointing to that directory)
|
|
15
|
-
* 3. Installs the plugin from that marketplace
|
|
14
|
+
* Two paths exist:
|
|
16
15
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* 1. Default (production) — point the `claude` CLI at the public
|
|
17
|
+
* `ory/claude-plugins` GitHub marketplace and install from there. The
|
|
18
|
+
* release workflow keeps that repo's plugin subtree pinned to the latest
|
|
19
|
+
* `@ory/claude-code` version, so the hook commands, skills, commands,
|
|
20
|
+
* and MCP config all come from the published artifact. The install CLI
|
|
21
|
+
* writes nothing to the persistent data dir on this path.
|
|
22
|
+
*
|
|
23
|
+
* 2. `--from-source` (dev only) — assemble the plugin directory from this
|
|
24
|
+
* checkout's `.claude-plugin/`, register it as a local-file marketplace,
|
|
25
|
+
* and install from there. The dev launcher uses this so changes in the
|
|
26
|
+
* monorepo are exercised end-to-end without going through the release
|
|
27
|
+
* mirror. End users should never need this flag.
|
|
19
28
|
*/
|
|
20
29
|
export declare function install(args: string[]): void;
|
|
21
30
|
/**
|
|
22
|
-
* Uninstall the Ory plugin via the `claude` CLI.
|
|
31
|
+
* Uninstall the Ory plugin via the `claude` CLI. Mirrors `install`:
|
|
23
32
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
33
|
+
* - Default: uninstall `ory-agent-plugin`, remove the production marketplace.
|
|
34
|
+
* - `--from-source`: uninstall the locally-assembled plugin, remove its
|
|
35
|
+
* marketplace entry, and clean up the assembled directory.
|
|
27
36
|
*/
|
|
28
37
|
export declare function uninstall(args: string[]): void;
|
package/dist/cli/setup.js
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* Setup CLI for the Ory Claude Code plugin.
|
|
5
5
|
*
|
|
6
6
|
* Uses the `claude` CLI to manage plugin installation via the marketplace:
|
|
7
|
-
* npx ory-claude-setup
|
|
8
|
-
* npx ory-claude-setup --global
|
|
9
|
-
* npx ory-claude-setup --
|
|
7
|
+
* npx ory-claude-setup # Install plugin (project scope)
|
|
8
|
+
* npx ory-claude-setup --global # Install plugin (user scope)
|
|
9
|
+
* npx ory-claude-setup --from-source # Install from the local source tree (dev only)
|
|
10
|
+
* npx ory-claude-setup --uninstall # Remove plugin
|
|
10
11
|
*/
|
|
11
12
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
13
|
if (k2 === undefined) k2 = k;
|
|
@@ -50,25 +51,35 @@ const path = __importStar(require("node:path"));
|
|
|
50
51
|
const argus_1 = require("@ory/argus");
|
|
51
52
|
const PACKAGE_ROOT = path.resolve(__dirname, "..", "..");
|
|
52
53
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
54
|
+
* Production marketplace published by the release workflow as the read-only
|
|
55
|
+
* mirror of this monorepo's Claude Code plugin. The `name` field below is the
|
|
56
|
+
* short identifier declared by that repo's top-level
|
|
57
|
+
* `.claude-plugin/marketplace.json` — that's what the `claude` CLI registers
|
|
58
|
+
* the marketplace under, and what `claude plugin install <plugin>@<name>`
|
|
59
|
+
* dereferences. The plugin name matches the local `.claude-plugin/plugin.json`
|
|
60
|
+
* because the sync script preserves it.
|
|
55
61
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
* Keep these in sync with whatever the production marketplace declares — if
|
|
63
|
+
* the repo's marketplace.json `name` changes, update `PROD_MARKETPLACE_NAME`
|
|
64
|
+
* here too.
|
|
65
|
+
*/
|
|
66
|
+
const PROD_MARKETPLACE_REPO = "ory/claude-plugins";
|
|
67
|
+
const PROD_MARKETPLACE_NAME = "ory";
|
|
68
|
+
const PROD_PLUGIN_NAME = "ory-agent-plugin";
|
|
69
|
+
/**
|
|
70
|
+
* For `--from-source` installs, resolve the marketplace and plugin names from
|
|
71
|
+
* the local `.claude-plugin/` JSON files instead of hardcoding them.
|
|
63
72
|
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
73
|
+
* Source of truth is `packages/claude-code/.claude-plugin/marketplace.json`
|
|
74
|
+
* (marketplace name) and `.claude-plugin/plugin.json` (plugin name). The local
|
|
75
|
+
* marketplace uses intentionally dev-flavored names — e.g.
|
|
76
|
+
* `ory-plugins-local-development` — so a developer can see at a glance the
|
|
77
|
+
* install came from this monorepo and not the production
|
|
78
|
+
* `ory/claude-plugins` repo. The default install path (no `--from-source`)
|
|
79
|
+
* bypasses these entirely and points the `claude` CLI at the production
|
|
80
|
+
* GitHub marketplace.
|
|
70
81
|
*/
|
|
71
|
-
function
|
|
82
|
+
function readLocalMarketplaceName() {
|
|
72
83
|
const mfPath = path.join(PACKAGE_ROOT, ".claude-plugin", "marketplace.json");
|
|
73
84
|
const data = JSON.parse(fs.readFileSync(mfPath, "utf-8"));
|
|
74
85
|
if (!data.name) {
|
|
@@ -76,7 +87,7 @@ function readMarketplaceName() {
|
|
|
76
87
|
}
|
|
77
88
|
return data.name;
|
|
78
89
|
}
|
|
79
|
-
function
|
|
90
|
+
function readLocalPluginName() {
|
|
80
91
|
const pjPath = path.join(PACKAGE_ROOT, ".claude-plugin", "plugin.json");
|
|
81
92
|
const data = JSON.parse(fs.readFileSync(pjPath, "utf-8"));
|
|
82
93
|
if (!data.name) {
|
|
@@ -89,18 +100,19 @@ const RENDER_OPTS = {
|
|
|
89
100
|
packageName: "@ory/claude-code",
|
|
90
101
|
};
|
|
91
102
|
/**
|
|
92
|
-
* Persistent install location used as the marketplace root
|
|
93
|
-
* shared OS-agnostic data dir so all plugin state —
|
|
94
|
-
* assets — sits in one place per platform. The
|
|
95
|
-
*
|
|
96
|
-
*
|
|
103
|
+
* Persistent install location used as the marketplace root for `--from-source`
|
|
104
|
+
* installs. Lives under the shared OS-agnostic data dir so all plugin state —
|
|
105
|
+
* config, DCR creds, harness assets — sits in one place per platform. The
|
|
106
|
+
* production install path never touches this directory: the `claude` CLI
|
|
107
|
+
* fetches everything directly from the GitHub marketplace.
|
|
97
108
|
*/
|
|
98
109
|
const PERSISTENT_DIR = (0, argus_1.getHarnessDataDir)("claude-code");
|
|
99
110
|
/** Hook command that resolves the binary via the npm registry. */
|
|
100
111
|
const HOOK_CMD_REMOTE = "npx -y -p @ory/claude-code ory-claude-hook";
|
|
101
112
|
/**
|
|
102
113
|
* Detect if we're running from a temporary npx/pnpm-dlx cache directory
|
|
103
|
-
* rather than a proper local or global npm installation.
|
|
114
|
+
* rather than a proper local or global npm installation. Only consulted on
|
|
115
|
+
* the `--from-source` path to pick the right hook command.
|
|
104
116
|
*/
|
|
105
117
|
function isRemoteContext() {
|
|
106
118
|
const normalized = PACKAGE_ROOT.replace(/\\/g, "/");
|
|
@@ -112,7 +124,7 @@ function localHookCommand() {
|
|
|
112
124
|
}
|
|
113
125
|
/**
|
|
114
126
|
* Assemble the Claude Code plugin directory in the persistent location and
|
|
115
|
-
* return its path (used as the marketplace root).
|
|
127
|
+
* return its path (used as the marketplace root for `--from-source`).
|
|
116
128
|
*
|
|
117
129
|
* The plugin manifest (`.claude-plugin/`) and MCP config (`.mcp.json`) are
|
|
118
130
|
* copied from the package; the skills, commands, and hooks are generated:
|
|
@@ -196,30 +208,100 @@ function checkClaudeCli() {
|
|
|
196
208
|
/**
|
|
197
209
|
* Install the Ory plugin via the `claude` CLI.
|
|
198
210
|
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
211
|
+
* Two paths exist:
|
|
212
|
+
*
|
|
213
|
+
* 1. Default (production) — point the `claude` CLI at the public
|
|
214
|
+
* `ory/claude-plugins` GitHub marketplace and install from there. The
|
|
215
|
+
* release workflow keeps that repo's plugin subtree pinned to the latest
|
|
216
|
+
* `@ory/claude-code` version, so the hook commands, skills, commands,
|
|
217
|
+
* and MCP config all come from the published artifact. The install CLI
|
|
218
|
+
* writes nothing to the persistent data dir on this path.
|
|
202
219
|
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
220
|
+
* 2. `--from-source` (dev only) — assemble the plugin directory from this
|
|
221
|
+
* checkout's `.claude-plugin/`, register it as a local-file marketplace,
|
|
222
|
+
* and install from there. The dev launcher uses this so changes in the
|
|
223
|
+
* monorepo are exercised end-to-end without going through the release
|
|
224
|
+
* mirror. End users should never need this flag.
|
|
205
225
|
*/
|
|
206
226
|
function install(args) {
|
|
207
227
|
const isGlobal = args.includes("--global");
|
|
228
|
+
const fromSource = args.includes("--from-source");
|
|
208
229
|
const scope = claudeScope(isGlobal);
|
|
209
230
|
if (!checkClaudeCli()) {
|
|
210
231
|
console.error("Error: 'claude' CLI not found in PATH.");
|
|
211
232
|
console.error("Install Claude Code first: https://docs.anthropic.com/en/docs/claude-code");
|
|
212
233
|
process.exit(1);
|
|
213
234
|
}
|
|
235
|
+
if (fromSource) {
|
|
236
|
+
installFromSource(scope);
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
installFromProductionMarketplace(scope);
|
|
240
|
+
}
|
|
241
|
+
(0, argus_1.printNextSteps)("Claude Code", fromSource
|
|
242
|
+
? "npx ory-claude uninstall --from-source"
|
|
243
|
+
: isRemoteContext()
|
|
244
|
+
? "npx @ory/claude-code uninstall"
|
|
245
|
+
: "npx ory-claude uninstall");
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Default production install path: register the `ory/claude-plugins` GitHub
|
|
249
|
+
* marketplace and install `ory-agent-plugin` from it. Nothing is assembled
|
|
250
|
+
* locally — the marketplace and the plugin tree both live in the GitHub repo,
|
|
251
|
+
* and the `claude` CLI fetches them on demand.
|
|
252
|
+
*/
|
|
253
|
+
function installFromProductionMarketplace(scope) {
|
|
254
|
+
console.log(`Registering Ory plugin marketplace from ${PROD_MARKETPLACE_REPO}...`);
|
|
255
|
+
const addResult = runClaude([
|
|
256
|
+
"plugin",
|
|
257
|
+
"marketplace",
|
|
258
|
+
"add",
|
|
259
|
+
PROD_MARKETPLACE_REPO,
|
|
260
|
+
"--scope",
|
|
261
|
+
scope,
|
|
262
|
+
]);
|
|
263
|
+
if (!addResult.ok) {
|
|
264
|
+
if (addResult.output.toLowerCase().includes("already")) {
|
|
265
|
+
console.log(" Marketplace already registered, updating...");
|
|
266
|
+
runClaude(["plugin", "marketplace", "update", PROD_MARKETPLACE_NAME]);
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
console.error(`Failed to add marketplace: ${addResult.output}`);
|
|
270
|
+
process.exit(1);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
console.log(" Marketplace added.");
|
|
275
|
+
}
|
|
276
|
+
console.log(`Installing ${PROD_PLUGIN_NAME}@${PROD_MARKETPLACE_NAME} plugin...`);
|
|
277
|
+
const installResult = runClaude([
|
|
278
|
+
"plugin",
|
|
279
|
+
"install",
|
|
280
|
+
`${PROD_PLUGIN_NAME}@${PROD_MARKETPLACE_NAME}`,
|
|
281
|
+
"--scope",
|
|
282
|
+
scope,
|
|
283
|
+
]);
|
|
284
|
+
if (!installResult.ok) {
|
|
285
|
+
console.error(`Failed to install plugin: ${installResult.output}`);
|
|
286
|
+
process.exit(1);
|
|
287
|
+
}
|
|
288
|
+
console.log(" Plugin installed.");
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Dev-only install path: assemble the plugin from this checkout and register
|
|
292
|
+
* it as a local-file marketplace. Used by the dev launcher (which publishes
|
|
293
|
+
* the monorepo packages to a local Verdaccio registry and then calls this CLI
|
|
294
|
+
* with `--from-source`) and by anyone hand-iterating on plugin code locally.
|
|
295
|
+
*/
|
|
296
|
+
function installFromSource(scope) {
|
|
214
297
|
const remote = isRemoteContext();
|
|
215
298
|
console.log("Assembling Ory plugin (skills, commands, hooks, MCP) at:");
|
|
216
299
|
console.log(` ${PERSISTENT_DIR}`);
|
|
217
300
|
const pluginRoot = assemblePluginDir(remote ? HOOK_CMD_REMOTE : localHookCommand());
|
|
218
|
-
const marketplaceName =
|
|
219
|
-
const pluginName =
|
|
301
|
+
const marketplaceName = readLocalMarketplaceName();
|
|
302
|
+
const pluginName = readLocalPluginName();
|
|
220
303
|
console.log(`Source: ${pluginName}@${marketplaceName} (from ${pluginRoot})`);
|
|
221
|
-
|
|
222
|
-
console.log("Adding Ory plugin marketplace...");
|
|
304
|
+
console.log("Adding local Ory plugin marketplace...");
|
|
223
305
|
const addResult = runClaude([
|
|
224
306
|
"plugin",
|
|
225
307
|
"marketplace",
|
|
@@ -241,7 +323,6 @@ function install(args) {
|
|
|
241
323
|
else {
|
|
242
324
|
console.log(" Marketplace added.");
|
|
243
325
|
}
|
|
244
|
-
// Step 2: Install the plugin from the marketplace
|
|
245
326
|
console.log(`Installing ${pluginName} plugin...`);
|
|
246
327
|
const installResult = runClaude([
|
|
247
328
|
"plugin",
|
|
@@ -255,25 +336,26 @@ function install(args) {
|
|
|
255
336
|
process.exit(1);
|
|
256
337
|
}
|
|
257
338
|
console.log(" Plugin installed.");
|
|
258
|
-
(0, argus_1.printNextSteps)("Claude Code", remote ? "npx @ory/claude-code uninstall" : "npx ory-claude uninstall");
|
|
259
339
|
}
|
|
260
340
|
/**
|
|
261
|
-
* Uninstall the Ory plugin via the `claude` CLI.
|
|
341
|
+
* Uninstall the Ory plugin via the `claude` CLI. Mirrors `install`:
|
|
262
342
|
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
343
|
+
* - Default: uninstall `ory-agent-plugin`, remove the production marketplace.
|
|
344
|
+
* - `--from-source`: uninstall the locally-assembled plugin, remove its
|
|
345
|
+
* marketplace entry, and clean up the assembled directory.
|
|
266
346
|
*/
|
|
267
347
|
function uninstall(args) {
|
|
268
348
|
const isGlobal = args.includes("--global");
|
|
349
|
+
const fromSource = args.includes("--from-source");
|
|
269
350
|
const scope = claudeScope(isGlobal);
|
|
270
351
|
if (!checkClaudeCli()) {
|
|
271
352
|
console.error("Error: 'claude' CLI not found in PATH.");
|
|
272
353
|
process.exit(1);
|
|
273
354
|
}
|
|
274
|
-
const
|
|
275
|
-
const
|
|
276
|
-
|
|
355
|
+
const pluginName = fromSource ? readLocalPluginName() : PROD_PLUGIN_NAME;
|
|
356
|
+
const marketplaceName = fromSource
|
|
357
|
+
? readLocalMarketplaceName()
|
|
358
|
+
: PROD_MARKETPLACE_NAME;
|
|
277
359
|
console.log(`Uninstalling ${pluginName} plugin...`);
|
|
278
360
|
const uninstallResult = runClaude([
|
|
279
361
|
"plugin",
|
|
@@ -288,7 +370,6 @@ function uninstall(args) {
|
|
|
288
370
|
else {
|
|
289
371
|
console.log(" Plugin uninstalled.");
|
|
290
372
|
}
|
|
291
|
-
// Step 2: Remove the marketplace
|
|
292
373
|
console.log("Removing Ory plugin marketplace...");
|
|
293
374
|
const removeResult = runClaude([
|
|
294
375
|
"plugin",
|
|
@@ -302,8 +383,9 @@ function uninstall(args) {
|
|
|
302
383
|
else {
|
|
303
384
|
console.log(" Marketplace removed.");
|
|
304
385
|
}
|
|
305
|
-
|
|
306
|
-
|
|
386
|
+
if (fromSource) {
|
|
387
|
+
cleanPersistentDir();
|
|
388
|
+
}
|
|
307
389
|
}
|
|
308
390
|
// --- Standalone binary entry point (ory-claude-setup) ---
|
|
309
391
|
if (require.main === module) {
|
|
@@ -315,13 +397,14 @@ Usage:
|
|
|
315
397
|
npx ory-claude-setup [options]
|
|
316
398
|
|
|
317
399
|
Options:
|
|
318
|
-
--global
|
|
319
|
-
--
|
|
320
|
-
|
|
400
|
+
--global Install to user scope (default: project scope)
|
|
401
|
+
--from-source Install from this checkout's local marketplace (dev only)
|
|
402
|
+
--uninstall Remove the Ory plugin and marketplace
|
|
403
|
+
-h, --help Show this help
|
|
321
404
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
405
|
+
By default, points the 'claude' CLI at the public ory/claude-plugins
|
|
406
|
+
marketplace and installs ory-agent-plugin from it. Pass --from-source to
|
|
407
|
+
install from the local monorepo checkout instead (used by the dev launcher).
|
|
325
408
|
`);
|
|
326
409
|
process.exit(0);
|
|
327
410
|
}
|
package/dist/handlers.js
CHANGED
|
@@ -198,23 +198,27 @@ async function handlePreToolUse(input, client, deps = {}) {
|
|
|
198
198
|
object: mcpTool.serverName,
|
|
199
199
|
relation: "use",
|
|
200
200
|
subjectId,
|
|
201
|
+
...("subjectSet" in subject ? { subjectSet: subject.subjectSet } : {}),
|
|
201
202
|
spanAttributes: mcpAttrs,
|
|
202
203
|
});
|
|
204
|
+
const decisionAttrs = decision.spanAttributes;
|
|
203
205
|
if (decision.kind === "allow") {
|
|
204
|
-
client.tracer.record("tool.invoke", "ok", {
|
|
206
|
+
client.tracer.record("tool.invoke", "ok", {
|
|
207
|
+
attributes: { ...mcpAttrs, ...decisionAttrs },
|
|
208
|
+
});
|
|
205
209
|
return {};
|
|
206
210
|
}
|
|
207
211
|
if (decision.kind === "observe") {
|
|
208
212
|
client.tracer.record("tool.block", "denied", {
|
|
209
|
-
attributes: { ...mcpAttrs, allowed: false, ...(0, argus_1.alertAttributes)(false) },
|
|
213
|
+
attributes: { ...mcpAttrs, ...decisionAttrs, allowed: false, ...(0, argus_1.alertAttributes)(false) },
|
|
210
214
|
});
|
|
211
215
|
client.tracer.record("tool.invoke", "ok", {
|
|
212
|
-
attributes: { ...mcpAttrs, allowed: false, observed: true },
|
|
216
|
+
attributes: { ...mcpAttrs, ...decisionAttrs, allowed: false, observed: true },
|
|
213
217
|
});
|
|
214
218
|
return {};
|
|
215
219
|
}
|
|
216
220
|
client.tracer.record("tool.block", "denied", {
|
|
217
|
-
attributes: { ...mcpAttrs, allowed: false, ...(0, argus_1.alertAttributes)(true) },
|
|
221
|
+
attributes: { ...mcpAttrs, ...decisionAttrs, allowed: false, ...(0, argus_1.alertAttributes)(true) },
|
|
218
222
|
});
|
|
219
223
|
return {
|
|
220
224
|
decision: "block",
|
|
@@ -227,21 +231,24 @@ async function handlePreToolUse(input, client, deps = {}) {
|
|
|
227
231
|
return handlePermissionError(decision.error, toolName, client);
|
|
228
232
|
}
|
|
229
233
|
const attrs = { toolName, ...inputSummary };
|
|
234
|
+
const decisionAttrs = decision.spanAttributes;
|
|
230
235
|
if (decision.kind === "allow") {
|
|
231
|
-
client.tracer.record("tool.invoke", "ok", {
|
|
236
|
+
client.tracer.record("tool.invoke", "ok", {
|
|
237
|
+
attributes: { ...attrs, ...decisionAttrs, allowed: true },
|
|
238
|
+
});
|
|
232
239
|
return {};
|
|
233
240
|
}
|
|
234
241
|
if (decision.kind === "observe") {
|
|
235
242
|
client.tracer.record("tool.block", "denied", {
|
|
236
|
-
attributes: { ...attrs, allowed: false, ...(0, argus_1.alertAttributes)(false) },
|
|
243
|
+
attributes: { ...attrs, ...decisionAttrs, allowed: false, ...(0, argus_1.alertAttributes)(false) },
|
|
237
244
|
});
|
|
238
245
|
client.tracer.record("tool.invoke", "ok", {
|
|
239
|
-
attributes: { ...attrs, allowed: false, observed: true },
|
|
246
|
+
attributes: { ...attrs, ...decisionAttrs, allowed: false, observed: true },
|
|
240
247
|
});
|
|
241
248
|
return {};
|
|
242
249
|
}
|
|
243
250
|
client.tracer.record("tool.block", "denied", {
|
|
244
|
-
attributes: { ...attrs, allowed: false, ...(0, argus_1.alertAttributes)(true) },
|
|
251
|
+
attributes: { ...attrs, ...decisionAttrs, allowed: false, ...(0, argus_1.alertAttributes)(true) },
|
|
245
252
|
});
|
|
246
253
|
return {
|
|
247
254
|
decision: "block",
|
|
@@ -383,6 +390,7 @@ async function handlePermissionRequest(input, client) {
|
|
|
383
390
|
object: mcpTool.serverName,
|
|
384
391
|
relation: "use",
|
|
385
392
|
subjectId,
|
|
393
|
+
...("subjectSet" in subject ? { subjectSet: subject.subjectSet } : {}),
|
|
386
394
|
spanAttributes: { toolName, mcpServer: mcpTool.serverName, mcpTool: mcpTool.toolName },
|
|
387
395
|
});
|
|
388
396
|
if (decision.kind === "deny") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ory/claude-code",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Ory plugin for Claude Code: scaffolding skills, a local Ory instance, and authentication, authorization, and audit for every tool call",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://ory.com",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"!dist/**/*.tsbuildinfo"
|
|
73
73
|
],
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@ory/argus": "0.
|
|
75
|
+
"@ory/argus": "0.3.0"
|
|
76
76
|
},
|
|
77
77
|
"engines": {
|
|
78
78
|
"node": ">=24"
|