@ory/gemini-cli 0.1.2 → 0.1.3
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 +106 -32
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,85 +2,143 @@
|
|
|
2
2
|
|
|
3
3
|
[Ory](https://ory.com) bundled into [Gemini CLI](https://github.com/google-gemini/gemini-cli): skills and TOML slash commands that scaffold Ory authentication into your codebase, a local Ory stack you can spin up in one command, and (when pointed at an Ory project) authentication, authorization, and audit for every tool Gemini runs.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
You don't need an Ory account or any prior Ory experience to start.
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
- [Gemini CLI](https://github.com/google-gemini/gemini-cli) installed and signed in
|
|
10
|
+
- Node.js **≥ 24**
|
|
11
|
+
- [Docker](https://docs.docker.com/get-docker/) (only needed for the local Ory stack)
|
|
12
|
+
- macOS or Linux. Windows works via WSL2.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
8
15
|
|
|
9
|
-
|
|
16
|
+
In your shell:
|
|
10
17
|
|
|
11
18
|
```bash
|
|
12
19
|
gemini extensions install ory-agent-extension
|
|
13
20
|
```
|
|
14
21
|
|
|
15
|
-
|
|
22
|
+
That's it — skills, TOML slash commands, hooks, and the Ory MCP server are now registered.
|
|
23
|
+
|
|
24
|
+
<details>
|
|
25
|
+
<summary>Alternative install paths</summary>
|
|
26
|
+
|
|
27
|
+
If the public extension registry isn't available, either of these registers the same extension:
|
|
16
28
|
|
|
17
29
|
```bash
|
|
30
|
+
# Ory-hosted extension source
|
|
18
31
|
gemini extensions install https://github.com/ory/gemini-cli-extension
|
|
19
32
|
```
|
|
20
33
|
|
|
21
|
-
**3. The Ory installer.** No prior `npm install` required:
|
|
22
|
-
|
|
23
34
|
```bash
|
|
35
|
+
# Direct installer, no prior npm install required
|
|
24
36
|
npx @ory/gemini-cli install
|
|
25
37
|
npx @ory/gemini-cli uninstall
|
|
26
38
|
```
|
|
27
39
|
|
|
28
|
-
|
|
40
|
+
If the `gemini` binary isn't on your `PATH`, `npx -y -p @ory/gemini-cli ory-gemini-setup` writes the extension config directly.
|
|
29
41
|
|
|
30
|
-
|
|
42
|
+
</details>
|
|
31
43
|
|
|
32
|
-
|
|
44
|
+
## Quickstart (≈ 3 minutes)
|
|
33
45
|
|
|
34
|
-
|
|
46
|
+
From any project where you'd like Ory authentication, inside Gemini CLI:
|
|
47
|
+
|
|
48
|
+
1. **Start a local Ory instance.** Ask Gemini *"start the local Ory stack"* or run:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
/ory:local-up
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
A banner prints the seeded test user's email and password. Note them — you'll log in with them in step 3.
|
|
55
|
+
|
|
56
|
+
2. **Scaffold Ory into your project.** Ask Gemini *"add Ory auth to this app"* or invoke the `ory-auth-setup` skill.
|
|
57
|
+
|
|
58
|
+
Gemini installs Ory Elements, wires the SDK, generates the login / registration / recovery / verification / settings pages, and sets up session middleware. It targets the local stack from step 1, so no signup or API key is needed.
|
|
59
|
+
|
|
60
|
+
3. **Sign in.** Start your app, visit the login page Gemini added, and sign in with the seeded credentials. You now have a real Ory session backed by a real Ory stack — locally, offline, with zero configuration.
|
|
61
|
+
|
|
62
|
+
That's the full Ory DX path. Stop here if you're just evaluating the extension. Continue to [Agent security](#agent-security) when you're ready to enforce.
|
|
35
63
|
|
|
36
|
-
|
|
64
|
+
## What's included
|
|
37
65
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
- **`ory-local-dev`**: drive the local Ory stack (below) from within Gemini to prototype and test against without a remote project.
|
|
66
|
+
### Skills for scaffolding Ory into your application
|
|
67
|
+
|
|
68
|
+
The extension bundles four skills that Gemini auto-invokes by description. Ask Gemini in natural language or invoke a skill directly:
|
|
42
69
|
|
|
43
|
-
|
|
70
|
+
- **`ory-auth-setup`** — full project setup. Install the Ory CLI, create an Ory Network project (or use the local one), add Ory Elements, configure the SDK, build the auth pages, wire session middleware.
|
|
71
|
+
- **`ory-login-flow`** — login, registration, recovery, verification, and settings pages with Ory Elements. Next.js App Router and React SPA variants.
|
|
72
|
+
- **`ory-social-login`** — Google, GitHub, Apple, Microsoft, Discord, and other OIDC providers with Jsonnet data mappers.
|
|
73
|
+
- **`ory-local-dev`** — drive the local Ory stack from within Gemini to prototype and test without a remote project.
|
|
44
74
|
|
|
45
75
|
### Ory MCP server
|
|
46
76
|
|
|
47
|
-
Bundled and registered automatically.
|
|
77
|
+
Bundled and registered automatically. Exposes the Ory CLI and the Ory Network REST API as MCP tools so Gemini can manage identities, OAuth2 clients, projects, permission tuples, and configuration without ever leaving the chat. Useful for seeding test data, verifying a scaffolded integration, or running one-off admin tasks.
|
|
48
78
|
|
|
49
|
-
### Local Ory stack
|
|
79
|
+
### Local Ory stack
|
|
50
80
|
|
|
51
81
|
```
|
|
52
82
|
/ory:local-up # start a local Ory instance in Docker
|
|
53
83
|
/ory:local-down # tear it all down
|
|
54
84
|
```
|
|
55
85
|
|
|
56
|
-
`local
|
|
86
|
+
`local-up` brings up Ory Identities, OAuth2, and Permissions, plus a login UI on `:3000` and Jaeger on `:16686`, all reachable through `http://localhost:4000`. A test user identity is seeded and the credentials are printed for you. Use it to:
|
|
57
87
|
|
|
58
88
|
- **Learn Ory hands-on** without signing up for a hosted project.
|
|
59
|
-
- **Prototype** flows (login, social, MFA, recovery, permission tuples) against a real Ory backend
|
|
89
|
+
- **Prototype** flows (login, social, MFA, recovery, permission tuples) against a real Ory backend.
|
|
60
90
|
- **Test** an auth integration end-to-end before pushing anything to a real environment.
|
|
61
91
|
- **Develop** your application against the same identity, OAuth2, and permission surfaces you'll ship with.
|
|
62
92
|
|
|
63
|
-
|
|
93
|
+
## Pointing at a real Ory project
|
|
64
94
|
|
|
65
|
-
|
|
95
|
+
The Quickstart uses the local stack. If you have a hosted [Ory Network](https://console.ory.sh) project, point the extension at it:
|
|
66
96
|
|
|
67
97
|
```bash
|
|
68
|
-
npx -y -p @ory/gemini-cli ory-gemini configure
|
|
98
|
+
npx -y -p @ory/gemini-cli ory-gemini configure \
|
|
99
|
+
--project-url https://<id>.projects.oryapis.com \
|
|
100
|
+
--api-key ory_pat_...
|
|
69
101
|
```
|
|
70
102
|
|
|
71
|
-
Config is saved to `~/.config/ory-agent-plugins/config.json` and shared across every Ory agent plugin or extension on the machine.
|
|
103
|
+
Config is saved to `~/.config/ory-agent-plugins/config.json` and shared across every Ory agent plugin or extension on the machine.
|
|
104
|
+
|
|
105
|
+
Without configuration the extension still loads cleanly and runs in **pass-through mode**: skills and commands work, but nothing is blocked. You can stay in pass-through mode indefinitely if you only want the DX features.
|
|
106
|
+
|
|
107
|
+
## Agent security
|
|
108
|
+
|
|
109
|
+
Once the extension is pointed at an Ory project (local or hosted), Gemini's session and every tool call can be governed by Ory.
|
|
110
|
+
|
|
111
|
+
- **Authentication.** Two identities. The human at the keyboard (the **user**) authenticates interactively via Ory Identities when `ORY_AUTH_GATE=1` is set. The Gemini process (the **agent**) gets its own OAuth2 identity, self-registered via [Dynamic Client Registration (RFC 7591)](https://datatracker.ietf.org/doc/html/rfc7591) on first run.
|
|
112
|
+
- **Authorization.** Before any tool runs, the extension checks [Ory Permissions](https://www.ory.com/docs/keto) (Zanzibar-style relation tuples) against the user's subject and blocks the call on `deny`. MCP tool calls additionally get a server-level check.
|
|
113
|
+
- **Audit.** Every decision (allow, deny, fallback) is recorded as a structured trace span: NDJSON file output and/or OTLP/HTTP export to Jaeger, Honeycomb, Grafana, and similar collectors. The user → agent delegation is written to Ory as a relation tuple so *"agent X acting on behalf of user Y"* stays queryable after tokens expire.
|
|
114
|
+
|
|
115
|
+
The extension is **fail-open** on its own infrastructure failures (network errors, rate limits, missing config), so enforcement is only as strong as your tuples — grant explicit `invoke` relations for the tools each user should be able to run.
|
|
116
|
+
|
|
117
|
+
### Enable enforcement
|
|
72
118
|
|
|
73
|
-
|
|
119
|
+
1. **Turn on the user gate.** In your shell:
|
|
74
120
|
|
|
75
|
-
|
|
121
|
+
```bash
|
|
122
|
+
export ORY_AUTH_GATE=1
|
|
123
|
+
```
|
|
76
124
|
|
|
77
|
-
|
|
78
|
-
- **Authorization.** Before any tool runs, the extension checks Ory Permissions against the user's subject and blocks the call on `deny`. MCP tool calls additionally get a server-level check.
|
|
79
|
-
- **Audit.** Every decision (allow, deny, fallback) is recorded as a structured trace span: NDJSON file output and/or OTLP/HTTP export to Jaeger, Honeycomb, Grafana, and similar collectors. The user-to-agent delegation is written to Ory as a Zanzibar tuple so "agent X acting on behalf of user Y" stays queryable after tokens expire.
|
|
125
|
+
The next Gemini session opens a browser for PKCE login. Subsequent sessions reuse the persisted token until it expires.
|
|
80
126
|
|
|
81
|
-
|
|
127
|
+
2. **Grant yourself permission to use a tool.** Use the Ory MCP server from inside Gemini (*"grant me invoke on the Bash tool"*) or the CLI directly:
|
|
82
128
|
|
|
83
|
-
|
|
129
|
+
```bash
|
|
130
|
+
ory create relationship \
|
|
131
|
+
--namespace AgentTools \
|
|
132
|
+
--object Bash \
|
|
133
|
+
--relation invoke \
|
|
134
|
+
--subject-id <your-user-subject-id>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Your subject id is printed at the start of every Gemini session when `ORY_AGENT_DEBUG=true`.
|
|
138
|
+
|
|
139
|
+
3. **See a denial.** Pick a tool you didn't grant (or remove the tuple) and ask Gemini to use it. The hook blocks the call and Gemini shows the denial reason. The decision is recorded as a `tool.block` trace span.
|
|
140
|
+
|
|
141
|
+
## CLI reference
|
|
84
142
|
|
|
85
143
|
```
|
|
86
144
|
npx -y -p @ory/gemini-cli ory-gemini install [--link]
|
|
@@ -91,9 +149,25 @@ npx -y -p @ory/gemini-cli ory-gemini local <up|down|status|seed|logs|env|configu
|
|
|
91
149
|
npx -y -p @ory/gemini-cli ory-gemini status
|
|
92
150
|
```
|
|
93
151
|
|
|
152
|
+
Highlights:
|
|
153
|
+
|
|
154
|
+
- `agent status` — show the current persisted DCR identity for the agent.
|
|
155
|
+
- `configure --audit-only` — record decisions without blocking; useful for a phased rollout.
|
|
156
|
+
- `local seed` / `local env` — reseed the test user, or print env vars for pointing other tools at the local stack.
|
|
157
|
+
|
|
158
|
+
## Troubleshooting
|
|
159
|
+
|
|
160
|
+
- **`/ory:local-up` fails.** Make sure Docker is running and ports `3000`, `4000`, `4100`, and `16686` are free.
|
|
161
|
+
- **PKCE login loops.** Clear persisted state with `npx -y -p @ory/gemini-cli ory-gemini agent unregister` and retry.
|
|
162
|
+
- **`npx` fetches an old version.** Force a fresh fetch: `npx -y -p @ory/gemini-cli@latest ory-gemini …`.
|
|
163
|
+
- **Need more signal.** Set `ORY_AGENT_DEBUG=true` and `ORY_AGENT_LOG_FILE=/tmp/ory.log` to capture structured logs.
|
|
164
|
+
|
|
94
165
|
## Links
|
|
95
166
|
|
|
96
|
-
- [
|
|
167
|
+
- [Ory documentation](https://www.ory.com/docs/)
|
|
168
|
+
- [Ory Network console](https://console.ory.sh)
|
|
169
|
+
- [Ory Elements](https://github.com/ory/elements)
|
|
170
|
+
- [Gemini CLI documentation](https://github.com/google-gemini/gemini-cli)
|
|
97
171
|
|
|
98
172
|
## License
|
|
99
173
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ory/gemini-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Ory extension for Gemini CLI: 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",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"gemini-extension"
|
|
70
70
|
],
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@ory/argus": "0.1.
|
|
72
|
+
"@ory/argus": "0.1.3"
|
|
73
73
|
},
|
|
74
74
|
"engines": {
|
|
75
75
|
"node": ">=24"
|