@ory/claude-code 0.14.0 → 1.0.1

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.
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "ory-plugins-local-development",
2
+ "name": "ory-agent-plugins",
3
3
  "owner": {
4
- "name": "Ory (Local Development)"
4
+ "name": "Ory"
5
5
  },
6
6
  "plugins": [
7
7
  {
package/README.md CHANGED
@@ -2,9 +2,12 @@
2
2
 
3
3
  Security and developer experience for [Claude Code](https://docs.anthropic.com/en/docs/claude-code), powered by [Ory](https://ory.com).
4
4
 
5
- **Security.** Claude runs real actions on your machine — editing files, running shell commands, calling APIs. The plugin gives every session a verifiable identity (you sign in once; Claude and any sub-agents it spawns each get their own), checks every tool call against permissions you control, and records each decision as an audit trace you can ship to your observability stack. It starts in watch mode so nothing is blocked on day one, and if Ory is ever unreachable it steps aside rather than locking you out.
5
+ Claude runs real actions on your machine — editing files, running shell commands, calling APIs. This plugin gives those actions an identity, a permission check, and an audit trail.
6
6
 
7
- **Developer experience.** A single command installs the plugin and walks you through connecting — choose Ory Network, a local Docker stack, or audit-only, and it wires up the project, sign-in client, login, and permissions for you. It also helps you build Ory into your own app: ask in plain language to scaffold login, registration, and recovery pages, run a local Ory, or manage identities and permissions through the bundled MCP server.
7
+ One command installs two independent halves:
8
+
9
+ - **Developer experience** — the Ory skill catalog, slash commands, the local Ory dev stack, an MCP server, and activity logging. No account, no keys, nothing to configure: it works the moment it's installed.
10
+ - **Ory Agent Security** — browser sign-in, brokered permission checks before tool calls, and the delegation trail. Opt-in connection details from the [Ory Console](https://console.ory.sh) switch it on, and it takes nothing away from the half above. See [Connect to Ory Agent Security](#connect-to-ory-agent-security).
8
11
 
9
12
  ## What you'll need
10
13
 
@@ -15,129 +18,133 @@ Security and developer experience for [Claude Code](https://docs.anthropic.com/e
15
18
 
16
19
  ## Get started
17
20
 
18
- Run one command. It installs the plugin and walks you through connecting:
21
+ Run one command:
19
22
 
20
23
  ```bash
21
24
  npx -y -p @ory/claude-code ory-claude install
22
25
  ```
23
26
 
24
- It opens a guided setup **in your browser** where you pick how to connect — the default takes just a click:
25
-
26
- - **Ory Network** *(default)* — sign in, or create a free account, in your browser. The project, keys, permissions, and login are all set up for you. Nothing to configure by hand.
27
- - **Local** — run a complete Ory on your laptop with Docker. No account, no signup, no keys. Great for trying it out.
28
- - **Audit-only** — skip Ory entirely and just log what Claude does.
29
-
30
- > No browser available (CI, SSH, headless)? The same walkthrough runs right in your terminal instead — or force it with `--no-web`.
31
-
32
- That's it. Confirm everything landed with:
27
+ Confirm everything landed with:
33
28
 
34
29
  ```bash
35
30
  npx -y -p @ory/claude-code ory-claude status
36
31
  ```
37
32
 
38
- `status` is your one-stop check: what's configured, who's signed in, which tools are covered by permissions, and recent activity. Anything not set up yet shows as `(unset)`.
33
+ `status` is your one-stop check: what's configured, who's signed in, which tools are covered by permissions, and recent activity. Until you connect Agent Security, the identity and permission rows say so and name what's missing.
34
+
35
+ > Prefer to install from inside Claude Code? Run `/plugin marketplace add ory/claude-plugins` then `/plugin install ory-agent-plugin@ory`. That registers the plugin the same way, with Agent Security not connected.
36
+
37
+ ## Skills and commands
38
+
39
+ Installing the plugin drops the full Ory playbook catalog into Claude Code. **Skills** are model-invoked — just say what you want in plain language and the matching one takes over (or name it directly, e.g. `/project:ory-auth-setup`).
40
+
41
+ | Skill | What it does for you |
42
+ |---|---|
43
+ | `ory-auth-setup` | Adds a complete auth system to your app — login, registration, recovery, verification, settings — on [Ory Elements](https://github.com/ory/elements) |
44
+ | `ory-login-flow` | Builds just the pages, wired to Ory's self-service flows |
45
+ | `ory-social-login` | "Sign in with…" for Google, GitHub, Apple, Microsoft, Discord, Slack, GitLab, Facebook |
46
+ | `ory-local-dev` | Develops and tests login/permission flows against a local Ory — no project, no account, offline |
47
+ | `ory-permissions-onboarding` | Walks a fresh install from observe mode to enforced per-tool permissions without getting blocked |
48
+ | `ory-build-agent` | Drops `@ory/argus` into an agent *you* own — Claude Agent SDK, OpenAI Agents, Mastra, Vercel AI, LangGraph/PydanticAI |
49
+ | `ory-build-integration` | Wires Ory into your app: Action webhooks, JWT validation at a gateway, live event streams |
50
+ | `ory-contribute-integration` | Authors and submits an integration to the public `ory/integrates` registry |
51
+ | `ory-e2b-sandbox` | Scaffolds an E2B sandbox template that boots with this plugin preinstalled |
52
+ | `ory-temporal-worker` | Scaffolds a Temporal TypeScript worker where every Activity is authenticated, authorized, and audited |
53
+
54
+ **Slash commands** run the local stack directly:
55
+
56
+ | Command | What it does |
57
+ |---|---|
58
+ | `/ory-agent-plugin:local-up` | Starts a local Ory (Identities, OAuth2, Permissions) in Docker and seeds a test user — it prints the email + password to sign in with |
59
+ | `/ory-agent-plugin:local-down` | Stops it, keeping your data volumes |
60
+ | `/ory-agent-plugin:temporal-up` | Starts a local Temporal dev server for the `ory-temporal-worker` scaffold |
39
61
 
40
- > Prefer to install from inside Claude Code? Run `/plugin marketplace add ory/claude-plugins` then `/plugin install ory-agent-plugin@ory`. That registers the plugin but skips the guided setup — run `ory-claude install` (or `configure`) in a terminal afterwards to connect. Re-run install with `--reconfigure` to change your connection later, or `--no-configure` to skip the wizard.
62
+ The local stack runs entirely on your laptop: Ory APIs at `http://localhost:4000`, a login UI on `:4455` (not `:3000`, to dodge Next.js port clashes), and the Ory Console on `:4100`.
63
+
64
+ A built-in **Ory MCP server** rounds it out — Claude can manage identities, projects, and permissions straight from chat.
65
+
66
+ So: ask Claude *"add Ory login to this app"* and it scaffolds the pages, starts a local Ory, and wires them together.
41
67
 
42
68
  ## What you get
43
69
 
44
- Once connected, every tool Claude runs is governed by Ory three things happen automatically:
70
+ Out of the box, every tool Claude runs produces a privacy-safe structured activity event in the unified local log.
71
+
72
+ Once you connect to Ory Agent Security, two more things happen automatically:
45
73
 
46
74
  - **Who's driving.** You sign in once in your browser; Claude (and any sub-agents it spawns) each get their own identity. No tokens to copy around, and the "who acted on whose behalf" trail stays queryable later.
47
- - **What it's allowed to do.** Before a tool runs, Ory checks whether it's permitted. It starts in **watch mode** — nothing is blocked, you just *see* what would be — so it never gets in your way on day one.
48
- - **A record of everything.** Every decision (allowed, denied, skipped) is logged as a trace you can send to Jaeger, Honeycomb, Grafana, or just a file.
75
+ - **What it's allowed to do.** Before a tool runs, Ory checks whether it's permitted. It starts in **observe mode** — nothing is blocked, you just *see* what would be — so it never gets in your way on day one.
49
76
 
50
77
  If Ory is ever unreachable, the plugin gets out of the way and lets Claude keep working — so it can't lock you out.
51
78
 
52
79
  ### See what's happening
53
80
 
54
- Everything the plugin does is observable out of the box — no configuration required:
81
+ Everything the plugin does is observable out of the box:
55
82
 
56
- - **Status at a glance.** `npx -y -p @ory/claude-code ory-claude status` shows what's configured, who's signed in, how many built-in tools your permissions cover, and the most recent tool-call activity.
57
- - **Live dashboard.** `npx -y -p @ory/claude-code ory-claude dashboard` opens the same picture in your browser — configuration, identities, permission coverage, Ory service health, and the latest tool-call activity, all refreshing live. From there you can flip **enforcement** on or off, toggle **user login**, and use **Change stack** to reconnect to a different Ory — no CLI required.
58
- - **Live traces.** Every tool call is recorded as an OpenTelemetry-style span. Watch them stream as the agent works:
83
+ - **Activity log.** Privacy-safe activity is always appended to `~/.config/ory-agent-plugins/claude-code/ory-agent-debug.log`. View events, decisions, and errors live with:
59
84
 
60
85
  ```bash
61
86
  npx -y -p @ory/claude-code ory-claude watch
62
87
  ```
63
88
 
64
- Spans are also written to `~/.config/ory-agent-plugins/claude-code/ory-agent-trace.ndjson` (NDJSON, one span per line) — tail that file, or point `OTEL_EXPORTER_OTLP_ENDPOINT` at a collector to ship them straight to Jaeger, Honeycomb, or Grafana.
65
- - **Debug log.** For a verbose play-by-play, set `ORY_AGENT_DEBUG=true`; structured logs land in `~/.config/ory-agent-plugins/claude-code/ory-agent-debug.log`.
89
+ Set `ORY_AGENT_LOG_FILE` to override the path; set it empty to disable file persistence.
90
+ - **Live debug.** Launch Claude Code with `ORY_AGENT_DEBUG=true` to add verbose local diagnostics, including raw shell commands, to the watched log and stderr. Secrets are recursively redacted; pass `watch --json` for NDJSON.
66
91
 
67
92
  ### Ready to enforce?
68
93
 
69
- When the watch-mode logs look right, turn on blocking with one command (setup already granted you the built-in tools):
94
+ Once connected, the deny posture lives on the Ory project: when the observe-mode activity looks right, an admin promotes it to **enforce** in the **Ory Console** (Agent Security). Every session reads that posture live, so nothing has to be reinstalled.
70
95
 
71
96
  ```bash
72
- npx -y -p @ory/claude-code ory-claude permissions enforce
97
+ npx -y -p @ory/claude-code ory-claude permissions # what the project grants, and the live mode
73
98
  ```
74
99
 
75
- Now a denied tool is actually blocked and Claude shows why. Go back to watch mode anytime with `permissions observe`. Prefer clicking? The dashboard has the same **Enforce** switch — flip it on, or back to watch mode, without touching the CLI. Use `permissions status` to see what's covered and `permissions bootstrap` to (re-)grant the built-in tools — or just ask Claude in chat, e.g. *"grant me use of the Bash tool."*
76
-
77
- ## Also: add login to your own app
78
-
79
- Beyond securing Claude, the plugin helps you build Ory into whatever you're working on. Ask Claude *"add Ory login to this app"* and it scaffolds the login, registration, recovery, and settings pages (using [Ory Elements](https://github.com/ory/elements)) wired to a local Ory — no signup or keys needed. Start that local Ory with `/ory-agent-plugin:local-up` (it prints a test email + password to sign in with) and tear it down with `/ory-agent-plugin:local-down`.
100
+ Then a denied tool is actually blocked and Claude shows why.
80
101
 
81
- Bundled **skills** (just ask in plain language) cover more: `ory-auth-setup`, `ory-login-flow`, `ory-social-login` (Google, GitHub, Apple…), `ory-permissions-onboarding`, and playbooks for wiring Ory into your own agents, E2B sandboxes, or Temporal workers. A built-in **Ory MCP server** lets Claude manage identities, projects, and permissions straight from chat.
102
+ ## Connect to Ory Agent Security
82
103
 
83
- ## Configure by hand (CI / advanced)
104
+ Copy the connection details from the [Ory Console](https://console.ory.sh) under **Agent Security**:
84
105
 
85
- The guided setup covers most people. For scripted or CI setups, or to point at an existing Ory Network project, configure directly. Settings are saved to `~/.config/ory-agent-plugins/config.json` and shared across all your Ory agent plugins; environment variables win when both are set.
106
+ | Value | Flag | Environment variable |
107
+ |---|---|---|
108
+ | Project URL | `--project-url` | `ORY_PROJECT_URL` |
109
+ | Agent Security URL | `--agent-security-url` | `ORY_AGENT_SECURITY_URL` |
110
+ | Sign-in client id override (default `ory-agent-security-login`) | `--oauth2-client-id` | `ORY_OAUTH2_CLIENT_ID` |
86
111
 
87
112
  ```bash
88
113
  npx -y -p @ory/claude-code ory-claude configure \
89
114
  --project-url https://<slug>.projects.oryapis.com \
90
- --oauth2-client-id <login client id>
115
+ --agent-security-url https://agents.console.ory.com
91
116
  ```
92
117
 
93
- Claude's own identity registers itself automatically on first run nothing to create. The `--oauth2-client-id` is the one piece browser sign-in needs; the guided setup makes it for you, or see below to do it by hand. For logging-only with no checks, use `--audit-only`.
118
+ `install` accepts the same flags, so you can register the plugin **and** connect in one shot (`install --project-url <URL> --agent-security-url <URL>`). The login client defaults to `ory-agent-security-login`; custom deployments can override it with `--oauth2-client-id`. Existing configurations fall back to the project URL when the Agent Security URL is unset. To turn sign-in and checks back off later, use `configure --disconnect`.
94
119
 
95
- <details>
96
- <summary>Create the sign-in client by hand</summary>
97
-
98
- The guided setup normally does this. To do it yourself, create a **public** OAuth2 client (no secret) listing all four loopback URLs — the plugin tries each in turn so sign-in survives a busy port:
99
-
100
- ```bash
101
- ory create oauth2-client --project <project-id> \
102
- --name "Ory Agent Security · user login (PKCE)" \
103
- --grant-type authorization_code,refresh_token \
104
- --response-type code \
105
- --scope openid,offline_access \
106
- --token-endpoint-auth-method none \
107
- --redirect-uri http://127.0.0.1:47823/callback \
108
- --redirect-uri http://127.0.0.1:47824/callback \
109
- --redirect-uri http://127.0.0.1:47825/callback \
110
- --redirect-uri http://127.0.0.1:47826/callback
111
- ```
120
+ **Ory Network or OEL.** Either works. For an Ory Network project the URL is `https://<slug>.projects.oryapis.com`; for a self-hosted **Ory Enterprise License** deployment, point `--project-url` at that deployment's base URL and use the sign-in client id from its Agent Security configuration. Everything downstream — sign-in, checks, delegation — is identical.
112
121
 
113
- Pass the resulting id to `configure --oauth2-client-id`. Running headless with a session token already? Set `ORY_USER_SESSION_TOKEN` and skip the browser step entirely.
122
+ **There is nothing else for you to create.** The sign-in client, the permission model, the per-tool grants and blocks, and the observe/enforce posture are all provisioned in the Console by someone with project access. At runtime the plugin only *reads* permissions — it has no write path into your project, which is why installing it needs no workspace privilege. Each Claude session registers its own identity automatically on first use.
114
123
 
115
- </details>
124
+ Sign-in runs at the start of every session and never blocks — a declined, skipped, or timed-out login simply leaves that session without a user identity.
116
125
 
117
- With nothing configured, the plugin still loads and runs in **pass-through mode**: skills, commands, and logging work, but no checks run and nothing is blocked. Perfectly fine if you only want the app-building features.
126
+ Settings are saved to `~/.config/ory-agent-plugins/config.json` and shared across all your Ory agent plugins; environment variables win when both are set. Running headless with an OAuth2 access token already? Set `ORY_USER_OAUTH2_TOKEN` and the browser step is skipped entirely.
118
127
 
119
128
  ## Commands
120
129
 
121
130
  ```
122
- ory-claude install | uninstall Install/remove; --reconfigure re-runs setup, --no-web forces the terminal wizard, --no-configure skips it
131
+ ory-claude install | uninstall Install (add --project-url to also connect Agent Security) / remove
123
132
  ory-claude status Show configuration, identities, permission coverage, recent activity
124
- ory-claude dashboard Open the live browser dashboard (status + service health + Change stack)
125
- ory-claude watch Tail the live trace stream (OTel spans)
126
- ory-claude permissions <cmd> status | bootstrap | observe (watch) | enforce (block)
127
- ory-claude configure <flags> Point at a project by hand (--project-url, --oauth2-client-id, --audit-only)
133
+ ory-claude permissions <cmd> status (read-only; grants + posture live in the Ory Console)
134
+ ory-claude configure <flags> Connect a project (--project-url) or --disconnect
128
135
  ory-claude agent <status|unregister> Manage Claude's own auto-created identity
129
136
  ory-claude local <up|down|status|…> Run / manage a local Ory in Docker
137
+ ory-claude version Print plugin, core, and Node versions (--json for machine-readable)
130
138
  ```
131
139
 
132
140
  All prefixed with `npx -y -p @ory/claude-code`.
133
141
 
134
142
  ## Troubleshooting
135
143
 
136
- - **`local-up` fails** — make sure Docker is running and ports `4000`, `4100`, `4455`, and `16686` are free.
137
- - **Browser sign-in loops** — reset with `ory-claude agent unregister` and try again.
138
- - **Install ran but never asked how to connect** — you're almost certainly on a stale `npx` cache. `npx -p @ory/claude-code` (no version pin) reuses a previously-downloaded copy instead of re-resolving to the latest, so an older CLI — one whose install predates the setup wizard — can run while `claude plugin` still installs current plugin content. The install banner prints the running version; confirm it with `npx -y -p @ory/claude-code ory-claude version`. To force the current release, clear the cache and reinstall: `rm -rf ~/.npm/_npx` then `npx -y -p @ory/claude-code ory-claude install`. Pinning an exact version (`@ory/claude-code@<version>`) also bypasses the cached copy.
144
+ - **`local-up` fails** — make sure Docker is running and ports `4000`, `4100`, and `4455` are free.
145
+ - **Browser sign-in loops** (after connecting) — reset with `ory-claude agent unregister` and try again.
146
+ - **Running an older CLI than expected** — `npx -p @ory/claude-code` (no version pin) reuses a previously-downloaded copy instead of re-resolving to the latest. The install banner prints the running version; confirm it with `npx -y -p @ory/claude-code ory-claude version`. To force the current release, clear the cache and reinstall: `rm -rf ~/.npm/_npx` then `npx -y -p @ory/claude-code ory-claude install`. Pinning an exact version (`@ory/claude-code@<version>`) also bypasses the cached copy.
139
147
  - **Hooks stuck on an old version** — run `/plugin marketplace update ory` inside Claude Code, or re-run the installer.
140
- - **Want to see what's happening** — `npx -y -p @ory/claude-code ory-claude status` for a snapshot, `npx -y -p @ory/claude-code ory-claude watch` for the live trace stream, or set `ORY_AGENT_DEBUG=true` for a verbose log. Traces and logs live under `~/.config/ory-agent-plugins/claude-code/` (see [See what's happening](#see-whats-happening)).
141
148
 
142
149
  ## Learn more
143
150
 
package/dist/cli/main.js CHANGED
@@ -49,11 +49,23 @@ const fs = __importStar(require("node:fs"));
49
49
  const argus_1 = require("@ory/argus");
50
50
  const setup_js_1 = require("./setup.js");
51
51
  const PACKAGE_ROOT = path.resolve(__dirname, "..", "..");
52
- const PERSISTENT_DIR = (0, argus_1.getHarnessDataDir)("claude-code");
52
+ /** Resolved per call: see the note on `persistentDir()` in ./setup.ts. */
53
+ function persistentDir() {
54
+ return (0, argus_1.getHarnessDataDir)("claude-code");
55
+ }
53
56
  function main() {
54
57
  const [command, ...args] = process.argv.slice(2);
58
+ // `--help` after a matched subcommand: print usage, do nothing else.
59
+ // Without this the switch below ignores the flag and `install --help`
60
+ // performs a real install (#221).
61
+ if ((0, argus_1.shouldPrintHelp)(command, args))
62
+ return help();
55
63
  switch (command) {
56
64
  case "install":
65
+ if (args.includes("--print")) {
66
+ (0, setup_js_1.printInstallPlan)(args);
67
+ break;
68
+ }
57
69
  (0, argus_1.beginDeferNextSteps)();
58
70
  (0, setup_js_1.install)(args);
59
71
  (0, argus_1.runPostInstall)("ory-claude", "claude-code", args).then(() => process.exit(0), (err) => {
@@ -63,7 +75,10 @@ function main() {
63
75
  break;
64
76
  case "uninstall":
65
77
  (0, setup_js_1.uninstall)(args);
66
- (0, argus_1.clearCredentialsForUninstall)().then(() => process.exit(0), (err) => {
78
+ (0, argus_1.clearCredentialsForUninstall)({
79
+ harness: "claude-code",
80
+ purge: args.includes("--purge"),
81
+ }).then(() => process.exit(0), (err) => {
67
82
  console.error(err.message ?? err);
68
83
  process.exit(1);
69
84
  });
@@ -72,7 +87,7 @@ function main() {
72
87
  (0, argus_1.runConfigureCommand)("ory-claude", args);
73
88
  break;
74
89
  case "agent":
75
- (0, argus_1.runAgentCommand)("ory-claude", args).then((code) => process.exit(code), (err) => {
90
+ (0, argus_1.runAgentCommand)("ory-claude", "claude-code", args).then((code) => process.exit(code), (err) => {
76
91
  console.error(err.message ?? err);
77
92
  process.exit(1);
78
93
  });
@@ -89,17 +104,11 @@ function main() {
89
104
  process.exit(1);
90
105
  });
91
106
  break;
92
- case "local":
93
- (0, argus_1.runLocalCommand)("ory-claude", args).catch((err) => {
94
- console.error(err.message ?? err);
95
- process.exit(1);
96
- });
97
- break;
98
107
  case "watch":
99
- (0, argus_1.runWatchCommand)("claude-code", args);
108
+ (0, argus_1.runWatchCommand)("ory-claude", "claude-code", args).then((code) => process.exit(code), (err) => { console.error(err.message ?? err); process.exit(1); });
100
109
  break;
101
- case "dashboard":
102
- (0, argus_1.runDashboardCommand)("ory-claude", "claude-code", args).then((code) => process.exit(code), (err) => {
110
+ case "local":
111
+ (0, argus_1.runLocalCommand)("ory-claude", args).catch((err) => {
103
112
  console.error(err.message ?? err);
104
113
  process.exit(1);
105
114
  });
@@ -125,24 +134,30 @@ async function status() {
125
134
  await (0, argus_1.runStatusCommand)("ory-claude", "claude-code", {
126
135
  title: "Claude Code",
127
136
  printPluginSection: () => {
128
- // The default install path delegates plugin assembly to the public
129
- // `ory/claude-plugins` marketplace, so the persistent dir below is
130
- // only populated for `--from-source` installs (the dev launcher and
131
- // local iteration). Run `claude plugin list` for an authoritative
132
- // view of what the `claude` CLI has registered.
137
+ // A wiped data dir leaves the harness pointing at a marketplace root
138
+ // that no longer exists, and its plugin surface then fails with an error
139
+ // that never mentions Ory. Say so here, with the repair (#206).
140
+ const dangling = (0, argus_1.findDanglingRegistration)("claude-code");
141
+ if (dangling) {
142
+ console.log("");
143
+ console.log(` ! ${(0, argus_1.describeDanglingRegistration)(dangling)}`);
144
+ console.log("");
145
+ }
133
146
  console.log("Hooks & plugin:");
134
- // The data dir doubles as the default trace/debug-log home, so it exists
135
- // after any session regardless of install path its mere presence does
136
- // NOT mean a plugin was assembled here. `isAssembledFromSource` keys off
137
- // the `.claude-plugin` manifest, which only the `--from-source` path
138
- // writes. Production installs delegate to the ory/claude-plugins
139
- // marketplace and assemble nothing locally.
140
- const assembled = (0, setup_js_1.isAssembledFromSource)(PERSISTENT_DIR);
141
- 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)"}`);
147
+ // What the harness will actually load. The runtime is resolved at
148
+ // install time, so the wired code and this CLI's own version can
149
+ // legitimately differ report the runtime, not our own version. Run
150
+ // `claude plugin list` for the `claude` CLI's view of registrations.
151
+ console.log(` Runtime: ${(0, argus_1.describeRuntimeHealth)((0, argus_1.checkRuntimeHealth)("claude-code"))}`);
152
+ // The data dir doubles as the default activity/debug-log home, so it exists
153
+ // after any session regardless of install state — its mere presence does
154
+ // NOT mean a plugin was assembled here. `isPluginAssembled` keys off the
155
+ // `.claude-plugin` manifest, which only `install` writes.
156
+ const assembled = (0, setup_js_1.isPluginAssembled)(persistentDir());
157
+ console.log(` Plugin dir: ${assembled ? persistentDir() : "(none — run 'ory-claude install')"}`);
142
158
  if (assembled) {
143
- console.log(` Skills: ${fs.existsSync(path.join(PERSISTENT_DIR, "skills")) ? "installed" : "not installed"}`);
159
+ console.log(` Skills: ${fs.existsSync(path.join(persistentDir(), "skills")) ? "installed" : "not installed"}`);
144
160
  }
145
- console.log(` Hook script: ${fs.existsSync(path.join(PACKAGE_ROOT, "dist", "hook.js")) ? "built" : "NOT BUILT (run pnpm build)"}`);
146
161
  },
147
162
  });
148
163
  }
@@ -159,10 +174,10 @@ Commands:
159
174
  uninstall [--global] Remove Ory plugin and marketplace
160
175
  configure Set or view Ory project URL and API key
161
176
  agent <cmd> Manage the agent's OAuth2 (DCR) identity (status, unregister)
162
- permissions <cmd> Manage permission mode and tool permissions (status, bootstrap, observe, enforce)
177
+ permissions Show the live permission mode and per-tool coverage
163
178
  status Show plugin status and configuration
164
- dashboard Open a live web dashboard (stack health + configuration)
165
- watch [trace-file] Tail the trace stream (OTel spans) live
179
+ watch [--json] [--lines <count>]
180
+ Follow the live activity/debug log
166
181
  version Show version and the ory-agent-plugins build commit
167
182
  local <cmd> Manage local Ory dev environment (up, down, status, seed, ...)
168
183
 
@@ -170,7 +185,7 @@ Examples:
170
185
  npx @ory/claude-code install # Install remotely (no prior npm install needed)
171
186
  npx @ory/claude-code install --global # Install globally (user scope)
172
187
  npx -y -p @ory/claude-code ory-claude install # Install from local/global npm installation
173
- npx -y -p @ory/claude-code ory-claude configure --project-url https://your-project.projects.oryapis.com --api-key ory_pat_...
188
+ npx -y -p @ory/claude-code ory-claude configure --project-url https://your-project.projects.oryapis.com --agent-security-url https://agents.console.ory.com
174
189
  npx -y -p @ory/claude-code ory-claude status # Check configuration
175
190
  npx -y -p @ory/claude-code ory-claude uninstall # Remove plugin
176
191
  `);
@@ -2,47 +2,57 @@
2
2
  /**
3
3
  * Setup CLI for the Ory Claude Code plugin.
4
4
  *
5
- * Uses the `claude` CLI to manage plugin installation via the marketplace:
5
+ * Assembles the plugin locally and hands it to the `claude` CLI as a
6
+ * local-file marketplace:
6
7
  * npx ory-claude-setup # Install plugin (project scope)
7
8
  * 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 --runtime-dir <d> # Wire a workspace build (dev only)
9
10
  * npx ory-claude-setup --uninstall # Remove plugin
11
+ *
12
+ * The plugin's runtime is resolved **once, here** — materialized into the
13
+ * shared runtime store (or linked to a workspace build) and wired through a
14
+ * stable shim, so no package resolution happens on the tool-call path. That is
15
+ * why the install always assembles: the generated `hooks.json` / `.mcp.json`
16
+ * carry this machine's shim paths, which a marketplace fetched from GitHub
17
+ * cannot. The public `ory/claude-plugins` mirror stays a valid install route
18
+ * on its own terms (it ships a bootstrap keyed off `${CLAUDE_PLUGIN_ROOT}`).
10
19
  */
20
+ import { type PreparedRuntime } from "@ory/argus";
11
21
  /**
12
- * Whether a `--from-source` plugin was assembled into `dir`.
22
+ * Assemble the Claude Code plugin directory in the persistent location and
23
+ * return its path (the marketplace root).
13
24
  *
14
- * The data dir doubles as the default trace/debug-log home (`fromEnv` writes
15
- * `ory-agent-trace.ndjson` / `ory-agent-debug.log` there on every session), so
16
- * its mere existence does NOT indicate a local assembly a production
17
- * marketplace install that has run once already creates it. The plugin
18
- * manifest (`.claude-plugin`) is written only by {@link assemblePluginDir}, so
19
- * it's the reliable signal that this dir holds a from-source plugin.
25
+ * The plugin manifest (`.claude-plugin/`) is copied from the package; the
26
+ * skills, commands, hooks, and MCP config are generated: skills/commands come
27
+ * from the shared `@ory/argus` templates (the single source of truth across
28
+ * every harness), and `hooks.json` / `.mcp.json` are written with the shim
29
+ * paths this machine's runtime resolved to.
20
30
  */
21
- export declare function isAssembledFromSource(dir: string): boolean;
31
+ export declare function assemblePluginDir(runtime: PreparedRuntime): string;
22
32
  /**
23
- * Install the Ory plugin via the `claude` CLI.
33
+ * Whether an Ory plugin tree was assembled into `dir`.
24
34
  *
25
- * Two paths exist:
26
- *
27
- * 1. Default (production) point the `claude` CLI at the public
28
- * `ory/claude-plugins` GitHub marketplace and install from there. The
29
- * release workflow keeps that repo's plugin subtree pinned to the latest
30
- * `@ory/claude-code` version, so the hook commands, skills, commands,
31
- * and MCP config all come from the published artifact. The install CLI
32
- * writes nothing to the persistent data dir on this path.
35
+ * The data dir doubles as the default activity/debug-log home (`fromEnv` writes
36
+ * `ory-agent-debug.log` there on every session), so
37
+ * its mere existence does NOT indicate an install. The plugin manifest
38
+ * (`.claude-plugin`) is written only by {@link assemblePluginDir}, so it's the
39
+ * reliable signal that this dir holds an assembled plugin.
40
+ */
41
+ export declare function isPluginAssembled(dir: string): boolean;
42
+ /**
43
+ * Install the Ory plugin via the `claude` CLI.
33
44
  *
34
- * 2. `--from-source` (dev only) assemble the plugin directory from this
35
- * checkout's `.claude-plugin/`, register it as a local-file marketplace,
36
- * and install from there. The dev launcher uses this so changes in the
37
- * monorepo are exercised end-to-end without going through the release
38
- * mirror. End users should never need this flag.
45
+ * The runtime is resolved here, once: materialized into the shared runtime
46
+ * store from npm (or linked to a workspace build with `--link`), then wired
47
+ * through a stable shim that the generated `hooks.json` / `.mcp.json` point
48
+ * at. Because those files carry machine-specific shim paths, the plugin tree
49
+ * is always assembled locally and registered as a local-file marketplace.
39
50
  */
40
51
  export declare function install(args: string[]): void;
52
+ export declare function printInstallPlan(args: string[]): void;
41
53
  /**
42
- * Uninstall the Ory plugin via the `claude` CLI. Mirrors `install`:
43
- *
44
- * - Default: uninstall `ory-agent-plugin`, remove the production marketplace.
45
- * - `--from-source`: uninstall the locally-assembled plugin, remove its
46
- * marketplace entry, and clean up the assembled directory.
54
+ * Uninstall the Ory plugin via the `claude` CLI: remove the plugin and its
55
+ * marketplace entry, delete the assembled plugin tree, and drop the runtime
56
+ * wiring (shim + any store no other harness still references).
47
57
  */
48
58
  export declare function uninstall(args: string[]): void;