@ory/cline 0.11.1 → 0.12.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.
- package/README.md +88 -64
- package/dist/cli/main.js +15 -12
- package/dist/cli/setup.js +13 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,112 +1,136 @@
|
|
|
1
1
|
# Ory Agent Plugin: Cline
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Security and developer experience for [Cline](https://github.com/cline/cline), powered by [Ory](https://ory.com).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**Security.** Cline 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; Cline 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.
|
|
6
6
|
|
|
7
|
-
|
|
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.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## What you'll need
|
|
10
10
|
|
|
11
|
-
[
|
|
11
|
+
- [Cline](https://github.com/cline/cline), installed (verified against cline@3.0.29)
|
|
12
|
+
- Node.js **22 or newer**
|
|
13
|
+
- [Docker](https://docs.docker.com/get-docker/) — only if you want to run Ory locally
|
|
14
|
+
- macOS or Linux (Windows works via WSL2)
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
- **The local Ory stack** is a complete Ory running on your laptop in Docker — no account, no signup, no API key.
|
|
16
|
+
## Get started
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
Run one command. It installs the plugin and walks you through connecting:
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
2. **Govern the agent itself.** Authenticate Cline's own session and authorize every tool it runs against Ory Permissions, with a full audit trail. See [Agent security](#agent-security).
|
|
20
|
+
```bash
|
|
21
|
+
npx -y -p @ory/cline ory-cline install
|
|
22
|
+
```
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
You'll be asked how you want to connect — **press Enter for the default**:
|
|
24
25
|
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
- macOS or Linux. Windows works via WSL2.
|
|
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 Cline does.
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
That's it. Confirm everything landed with:
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
|
-
npx -y -p @ory/cline ory-cline
|
|
33
|
+
npx -y -p @ory/cline ory-cline status
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
`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)`.
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
npx -y -p @ory/cline ory-cline install --global # install for all projects
|
|
40
|
-
npx -y -p @ory/cline ory-cline status # confirm what landed
|
|
41
|
-
npx -y -p @ory/cline ory-cline uninstall # remove only the Ory shims + skills
|
|
42
|
-
```
|
|
38
|
+
> Re-run install with `--reconfigure` to change your connection later, or `--no-configure` to skip the wizard and configure by hand. Add `--global` to install for every project (`~/.cline/hooks/`) instead of just this one.
|
|
43
39
|
|
|
44
|
-
|
|
40
|
+
## What you get
|
|
45
41
|
|
|
46
|
-
|
|
42
|
+
Once connected, every task and tool call Cline runs is governed by Ory — three things happen automatically:
|
|
47
43
|
|
|
48
|
-
|
|
44
|
+
- **Who's driving.** You sign in once in your browser; Cline gets its own identity too, and registers it automatically on first run — no tokens to copy around. The "who acted on whose behalf" trail stays queryable later.
|
|
45
|
+
- **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.
|
|
46
|
+
- **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.
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
2. **Scaffold Ory into your project.** Ask Cline *"add Ory auth to this app"* (the `ory-auth-setup` skill). It installs Ory Elements, wires the SDK, and generates the login / registration / recovery / settings pages, all targeting the local stack.
|
|
52
|
-
3. **Sign in.** Start your app, visit the login page, and sign in with the seeded credentials. You now have a real Ory session backed by a real Ory stack — locally, offline, zero configuration.
|
|
48
|
+
If Ory is ever unreachable, the plugin gets out of the way and lets Cline keep working — so it can't lock you out.
|
|
53
49
|
|
|
54
|
-
|
|
50
|
+
### See what's happening
|
|
55
51
|
|
|
56
|
-
|
|
52
|
+
Everything the plugin does is observable out of the box — no configuration required:
|
|
57
53
|
|
|
58
|
-
|
|
54
|
+
- **Status at a glance.** `npx -y -p @ory/cline ory-cline status` shows what's configured, who's signed in, how many built-in tools your permissions cover, and the most recent tool-call activity.
|
|
55
|
+
- **Live traces.** Every tool call is recorded as an OpenTelemetry-style span. Watch them stream as the agent works:
|
|
59
56
|
|
|
60
|
-
|
|
57
|
+
```bash
|
|
58
|
+
npx -y -p @ory/cline ory-cline watch
|
|
59
|
+
```
|
|
61
60
|
|
|
62
|
-
-
|
|
63
|
-
- **
|
|
64
|
-
- **PostToolUse / TaskComplete / TaskCancel / TaskError / UserPromptSubmit / PreCompact / SessionShutdown** — trace-only audit spans.
|
|
61
|
+
Spans are also written to `~/.config/ory-agent-plugins/cline/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.
|
|
62
|
+
- **Debug log.** For a verbose play-by-play, set `ORY_AGENT_DEBUG=true`; structured logs land in `~/.config/ory-agent-plugins/cline/ory-agent-debug.log`.
|
|
65
63
|
|
|
66
|
-
|
|
64
|
+
### Ready to enforce?
|
|
67
65
|
|
|
68
|
-
|
|
66
|
+
When the watch-mode logs look right, turn on blocking with one command (setup already granted you the built-in tools):
|
|
69
67
|
|
|
70
|
-
|
|
68
|
+
```bash
|
|
69
|
+
npx -y -p @ory/cline ory-cline permissions enforce
|
|
70
|
+
```
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
- **Authorization.** Before any tool runs, the plugin checks [Ory Permissions](https://www.ory.com/docs/keto) (Zanzibar-style relations) against the user's subject and blocks on `deny`.
|
|
74
|
-
- **Audit.** Every decision is recorded as a structured trace span (NDJSON file and/or OTLP export).
|
|
72
|
+
Now a denied tool is actually blocked and Cline shows why. Go back to watch mode anytime with `permissions observe`. Use `permissions status` to see what's covered and `permissions bootstrap` to (re-)grant the built-in tools.
|
|
75
73
|
|
|
76
|
-
|
|
74
|
+
## Also: add login to your own app
|
|
77
75
|
|
|
78
|
-
|
|
76
|
+
Beyond securing Cline, the plugin helps you build Ory into whatever you're working on. Ask Cline *"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. These are **skills**: just ask in plain language and the matching one takes over.
|
|
79
77
|
|
|
80
|
-
|
|
81
|
-
# Grant the current user `use` on every built-in tool (idempotent):
|
|
82
|
-
npx -y -p @ory/cline ory-cline permissions bootstrap
|
|
78
|
+
Start that local Ory with the `ory-local-up` skill (it prints a test email + password to sign in with) and tear it down with `ory-local-down`. It runs the Ory APIs at `http://localhost:4000`, a login UI on `:4455` (not :3000, to avoid Next.js port conflicts), the Ory Console on `:4100`, and Jaeger on `:16686`. More bundled skills cover login flows, social sign-in (Google, GitHub, Apple…), permissions onboarding, and playbooks for wiring Ory into your own agents, E2B sandboxes, or Temporal workers.
|
|
83
79
|
|
|
84
|
-
|
|
85
|
-
npx -y -p @ory/cline ory-cline permissions status
|
|
80
|
+
## Configure by hand (CI / advanced)
|
|
86
81
|
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
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.
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
npx -y -p @ory/cline ory-cline configure \
|
|
86
|
+
--project-url https://<slug>.projects.oryapis.com \
|
|
87
|
+
--oauth2-client-id <sign-in client id> \
|
|
88
|
+
--user-login
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
Cline's own identity registers itself automatically on first run — nothing to create. The `--oauth2-client-id` is the one piece browser sign-in needs (a **public sign-in client** registered with the loopback URLs `http://127.0.0.1:47823..47826/callback`); the guided setup makes it for you. For logging-only with no checks, use `--audit-only`. Enable browser sign-in persistently with `--user-login`, or per-session with `ORY_USER_LOGIN=true` (the env var overrides the saved config).
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
With nothing configured, the plugin still loads and runs in **pass-through mode**: skills and logging work, but no checks run and nothing is blocked. Perfectly fine if you only want the app-building features.
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
<details>
|
|
96
|
+
<summary>How the integration works</summary>
|
|
96
97
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
Cline discovers hooks by directory — the presence of an executable script named after the event *is* the registration. `install` writes one thin shell shim per event into the workspace hooks directory `<project>/.clinerules/hooks/` (or `~/.cline/hooks/` with `--global`), makes each executable, and materializes the Ory skills. Each shim execs the published hook binary via `npx`. Install and uninstall respect hook scripts you authored: if an event name is already taken by a script Ory didn't write, install skips it and prints a warning; uninstall removes only the scripts Ory wrote.
|
|
99
|
+
|
|
100
|
+
Cline runs each hook as a **subprocess**, passing the event as JSON on stdin and reading a JSON decision on stdout. A hook blocks a tool call by returning `{"cancel":true}`. Cline does **not** expose a separate approval-ask hook, so the plugin gates at the tool-call event. Hooks have a 30-second timeout.
|
|
101
|
+
|
|
102
|
+
The hook filenames are PascalCase (`TaskStart`, `PreToolUse`, …); the payload Cline delivers carries the matching snake_case event name (`agent_start`, `tool_call`, …) the plugin acts on. The shims wire into these phases:
|
|
103
|
+
|
|
104
|
+
- **TaskStart** (`agent_start`) — signs the user in and gives Cline its identity.
|
|
105
|
+
- **PreToolUse** (`tool_call`) — checks the tool against your permissions; a deny blocks the call in enforce mode.
|
|
106
|
+
- **PostToolUse / TaskComplete / TaskCancel / TaskError / UserPromptSubmit / PreCompact / SessionShutdown** — audit-only trace spans.
|
|
107
|
+
|
|
108
|
+
</details>
|
|
109
|
+
|
|
110
|
+
## Commands
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
ory-cline install | uninstall Install/remove; --global for all projects, --reconfigure re-runs setup, --no-configure skips it
|
|
114
|
+
ory-cline status Show configuration, identities, permission coverage, recent activity
|
|
115
|
+
ory-cline watch Tail the live trace stream (OTel spans)
|
|
116
|
+
ory-cline permissions <cmd> status | bootstrap | observe (watch) | enforce (block)
|
|
117
|
+
ory-cline configure <flags> Point at a project by hand (--project-url, --oauth2-client-id, --user-login, --audit-only)
|
|
118
|
+
ory-cline agent <status|unregister> Manage Cline's own auto-created identity
|
|
101
119
|
```
|
|
102
120
|
|
|
103
|
-
|
|
121
|
+
All prefixed with `npx -y -p @ory/cline`.
|
|
122
|
+
|
|
123
|
+
## Troubleshooting
|
|
104
124
|
|
|
105
|
-
|
|
125
|
+
- **Local Ory fails to start** — make sure Docker is running and ports `4000`, `4100`, `4455`, and `16686` are free.
|
|
126
|
+
- **Browser sign-in loops** — reset with `ory-cline agent unregister` and try again.
|
|
127
|
+
- **`npx` grabbed an old version** — force the latest: `npx -y -p @ory/cline@latest ory-cline …`.
|
|
128
|
+
- **A hook didn't install** — check the install output for a skipped-event warning; move or remove your own script at that event name and re-run install.
|
|
129
|
+
- **Want to see what's happening** — `npx -y -p @ory/cline ory-cline status` for a snapshot, `npx -y -p @ory/cline ory-cline 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/cline/` (see [See what's happening](#see-whats-happening)).
|
|
106
130
|
|
|
107
|
-
##
|
|
131
|
+
## Learn more
|
|
108
132
|
|
|
109
|
-
- [Ory documentation](https://www.ory.com/docs/)
|
|
133
|
+
- [Ory documentation](https://www.ory.com/docs/) · [Ory Console](https://console.ory.sh) · [Ory Elements](https://github.com/ory/elements)
|
|
110
134
|
- [Cline repository](https://github.com/cline/cline)
|
|
111
135
|
- [Repo README](../../README.md) and [AGENTS.md](../../AGENTS.md) — full env-var and permission-mode reference
|
|
112
136
|
|
package/dist/cli/main.js
CHANGED
|
@@ -56,14 +56,19 @@ function main() {
|
|
|
56
56
|
const [command, ...args] = process.argv.slice(2);
|
|
57
57
|
switch (command) {
|
|
58
58
|
case "install":
|
|
59
|
+
(0, argus_1.beginDeferNextSteps)();
|
|
59
60
|
install(args);
|
|
60
|
-
|
|
61
|
+
(0, argus_1.runPostInstall)("ory-cline", "cline", args).then(() => process.exit(0), (err) => {
|
|
61
62
|
console.error(err.message ?? err);
|
|
62
63
|
process.exit(1);
|
|
63
64
|
});
|
|
64
65
|
break;
|
|
65
66
|
case "uninstall":
|
|
66
67
|
uninstall(args);
|
|
68
|
+
(0, argus_1.clearCredentialsForUninstall)().then(() => process.exit(0), (err) => {
|
|
69
|
+
console.error(err.message ?? err);
|
|
70
|
+
process.exit(1);
|
|
71
|
+
});
|
|
67
72
|
break;
|
|
68
73
|
case "configure":
|
|
69
74
|
(0, argus_1.runConfigureCommand)("ory-cline", args);
|
|
@@ -95,6 +100,9 @@ function main() {
|
|
|
95
100
|
process.exit(1);
|
|
96
101
|
});
|
|
97
102
|
break;
|
|
103
|
+
case "watch":
|
|
104
|
+
(0, argus_1.runWatchCommand)("cline", args);
|
|
105
|
+
break;
|
|
98
106
|
case "help":
|
|
99
107
|
case "--help":
|
|
100
108
|
case "-h":
|
|
@@ -125,12 +133,6 @@ function runSetup(args) {
|
|
|
125
133
|
process.argv = ["node", "setup.js", ...args];
|
|
126
134
|
require("./setup.js");
|
|
127
135
|
}
|
|
128
|
-
async function postInstallPermissions(binName, harness) {
|
|
129
|
-
const bootstrapped = await (0, argus_1.maybeAutoBootstrap)(binName, harness);
|
|
130
|
-
(0, argus_1.printPermissionsOnboardingHelp)(binName, harness, {
|
|
131
|
-
bootstrappedAutomatically: bootstrapped,
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
136
|
async function status() {
|
|
135
137
|
await (0, argus_1.runStatusCommand)("ory-cline", "cline", {
|
|
136
138
|
title: "Cline",
|
|
@@ -149,7 +151,7 @@ function help() {
|
|
|
149
151
|
ory-cline — Ory plugin for Cline
|
|
150
152
|
|
|
151
153
|
Usage:
|
|
152
|
-
npx ory-cline <command> [options]
|
|
154
|
+
npx -y -p @ory/cline ory-cline <command> [options]
|
|
153
155
|
|
|
154
156
|
Commands:
|
|
155
157
|
install [--global] Install the Ory hook scripts into Cline
|
|
@@ -159,6 +161,7 @@ Commands:
|
|
|
159
161
|
permissions <cmd> Manage permission mode and tool permissions (status, bootstrap, observe, enforce)
|
|
160
162
|
setup [options] Write hook scripts directly to the hooks directory (fallback)
|
|
161
163
|
status Show plugin status and configuration
|
|
164
|
+
watch [trace-file] Tail the trace stream (OTel spans) live
|
|
162
165
|
local <cmd> Manage local Ory dev environment (up, down, status, seed, ...)
|
|
163
166
|
|
|
164
167
|
After installing, the per-event hook scripts wire into these Cline lifecycle events:
|
|
@@ -167,10 +170,10 @@ After installing, the per-event hook scripts wire into these Cline lifecycle eve
|
|
|
167
170
|
PostToolUse Audit log tool executions
|
|
168
171
|
|
|
169
172
|
Examples:
|
|
170
|
-
npx ory-cline install # Install hook scripts into ./.clinerules/hooks
|
|
171
|
-
npx ory-cline install --global # Install into ~/.cline/hooks
|
|
172
|
-
npx ory-cline status # Check configuration
|
|
173
|
-
npx ory-cline uninstall # Remove hook scripts
|
|
173
|
+
npx -y -p @ory/cline ory-cline install # Install hook scripts into ./.clinerules/hooks
|
|
174
|
+
npx -y -p @ory/cline ory-cline install --global # Install into ~/.cline/hooks
|
|
175
|
+
npx -y -p @ory/cline ory-cline status # Check configuration
|
|
176
|
+
npx -y -p @ory/cline ory-cline uninstall # Remove hook scripts
|
|
174
177
|
`);
|
|
175
178
|
}
|
|
176
179
|
main();
|
package/dist/cli/setup.js
CHANGED
|
@@ -170,6 +170,18 @@ function main() {
|
|
|
170
170
|
console.warn("");
|
|
171
171
|
}
|
|
172
172
|
console.log(`Ory skills installed to ${path.join(rulesRoot, "skills")}`);
|
|
173
|
-
(0, argus_1.printNextSteps)("Cline", "npx ory-cline-setup --uninstall"
|
|
173
|
+
(0, argus_1.printNextSteps)("Cline", "npx -y -p @ory/cline ory-cline-setup --uninstall", {
|
|
174
|
+
binName: "ory-cline",
|
|
175
|
+
harness: "cline",
|
|
176
|
+
});
|
|
174
177
|
}
|
|
175
178
|
main();
|
|
179
|
+
// When invoked directly as the `-setup` bin with `--uninstall`, also clear
|
|
180
|
+
// stored Ory credentials. When required by the plugin's main CLI, that
|
|
181
|
+
// command owns the purge, so the `require.main` guard prevents a double run.
|
|
182
|
+
if (require.main === module && process.argv.includes("--uninstall")) {
|
|
183
|
+
(0, argus_1.clearCredentialsForUninstall)().then(() => process.exit(0), (err) => {
|
|
184
|
+
console.error(err.message ?? err);
|
|
185
|
+
process.exit(1);
|
|
186
|
+
});
|
|
187
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ory/cline",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "Ory plugin for Cline: 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",
|
|
@@ -66,7 +66,8 @@
|
|
|
66
66
|
"!dist/**/*.tsbuildinfo"
|
|
67
67
|
],
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"
|
|
69
|
+
"reo-census": "^1.2.8",
|
|
70
|
+
"@ory/argus": "0.12.1"
|
|
70
71
|
},
|
|
71
72
|
"devDependencies": {
|
|
72
73
|
"typescript": "^6.0.2",
|