@osd-project/osd-cli 0.0.0 → 0.8.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/LICENSE +202 -0
- package/README.md +585 -4
- package/THIRD_PARTY_NOTICES.md +96 -0
- package/dist/auth-store.d.ts +38 -0
- package/dist/auth-store.js +239 -0
- package/dist/brand-catalog.d.ts +65 -0
- package/dist/brand-catalog.js +175 -0
- package/dist/connect-gate.d.ts +31 -0
- package/dist/connect-gate.js +82 -0
- package/dist/contracts.d.ts +61 -0
- package/dist/contracts.js +145 -0
- package/dist/exit-codes.d.ts +32 -0
- package/dist/exit-codes.js +40 -0
- package/dist/format.d.ts +71 -0
- package/dist/format.js +99 -0
- package/dist/generated/schemas.d.ts +2 -0
- package/dist/generated/schemas.js +1781 -0
- package/dist/guarded-fetch.d.ts +28 -0
- package/dist/guarded-fetch.js +252 -0
- package/dist/help.d.ts +27 -0
- package/dist/help.js +32 -0
- package/dist/http-fetch.d.ts +1 -0
- package/dist/http-fetch.js +17 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +821 -0
- package/dist/logout.d.ts +16 -0
- package/dist/logout.js +82 -0
- package/dist/mcp-auth.d.ts +70 -0
- package/dist/mcp-auth.js +603 -0
- package/dist/mcp-card.d.ts +23 -0
- package/dist/mcp-card.js +18 -0
- package/dist/mcp-client.d.ts +77 -0
- package/dist/mcp-client.js +193 -0
- package/dist/net-guard.d.ts +66 -0
- package/dist/net-guard.js +152 -0
- package/dist/proxy-config.d.ts +51 -0
- package/dist/proxy-config.js +147 -0
- package/dist/request.d.ts +32 -0
- package/dist/request.js +62 -0
- package/dist/resolve-endpoint.d.ts +62 -0
- package/dist/resolve-endpoint.js +172 -0
- package/dist/search.d.ts +39 -0
- package/dist/search.js +69 -0
- package/dist/skill.d.ts +155 -0
- package/dist/skill.js +320 -0
- package/dist/updates.d.ts +101 -0
- package/dist/updates.js +541 -0
- package/dist/verify.d.ts +92 -0
- package/dist/verify.js +379 -0
- package/package.json +51 -3
- package/skill/osd/SKILL.md +400 -0
- package/skill/osd/references/connect-mcp.md +48 -0
package/README.md
CHANGED
|
@@ -1,5 +1,586 @@
|
|
|
1
|
-
#
|
|
1
|
+
# OSD CLI
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
A command-line client for OSD discovery. It searches registries and resolvers,
|
|
4
|
+
verifies candidates against the brand's domain, and uses discovered MCP
|
|
5
|
+
endpoints directly.
|
|
6
|
+
|
|
7
|
+
The package is distributed through the public npm registry. It does
|
|
8
|
+
not yet have a public bootstrap installer, prebuilt binary, or code signing.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
The package is published to the public npm registry as
|
|
13
|
+
`@osd-project/osd-cli`. Install it globally:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g @osd-project/osd-cli
|
|
17
|
+
osd search "<query>" --target <url>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
> **Just-released versions:** if your `~/.npmrc` sets `min-release-age`
|
|
21
|
+
> (npm's supply-chain guard that refuses versions published in the last N
|
|
22
|
+
> days), a fresh release will fail to install until it ages past that
|
|
23
|
+
> window. To install a version newer than your window deliberately:
|
|
24
|
+
>
|
|
25
|
+
> ```bash
|
|
26
|
+
> npm install -g @osd-project/osd-cli --min-release-age=0
|
|
27
|
+
> ```
|
|
28
|
+
|
|
29
|
+
## Agent skill
|
|
30
|
+
|
|
31
|
+
The CLI ships its agent skill in the same package, so a single npx
|
|
32
|
+
command installs it — no global install, no checkout, nothing else to
|
|
33
|
+
configure:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npx -y @osd-project/osd-cli@latest skill install
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`skill install` copies the bundled skill to `<skills-dir>/osd/` and prints the
|
|
40
|
+
absolute path and version. With no `--dir` it resolves the directory itself:
|
|
41
|
+
|
|
42
|
+
- the one well-known skills directory that already exists on the machine
|
|
43
|
+
(`~/.claude/skills`, `~/.codex/skills`, `~/.cursor/skills`,
|
|
44
|
+
`~/.config/opencode/skills`, `~/.pi/agent/skills`) — the CLI holds no
|
|
45
|
+
per-harness table beyond that evidence-gated list;
|
|
46
|
+
- `~/.agents/skills` on a machine with none of them (fresh machines,
|
|
47
|
+
personal agents);
|
|
48
|
+
- an error listing the candidates when several exist — never a silent
|
|
49
|
+
choice.
|
|
50
|
+
|
|
51
|
+
`OSD_SKILL_DIR` overrides detection (the env var is the whole mechanism,
|
|
52
|
+
like `OSD_REGISTRY_URL`). Every command in the installed `SKILL.md` invokes
|
|
53
|
+
the CLI through a version pin stamped at build time
|
|
54
|
+
(`npx -y @osd-project/osd-cli@<version> ...`), so the skill's instructions and
|
|
55
|
+
the CLI's behaviour cannot diverge. Uninstall removes only what this
|
|
56
|
+
package wrote (`metadata.source` ownership marker); `skill status` exits 1
|
|
57
|
+
when the installed skill is out of date; `skill install --print` writes the
|
|
58
|
+
`SKILL.md` to stdout for any layout the CLI does not know about.
|
|
59
|
+
|
|
60
|
+
To work on the CLI itself, build it from a checkout instead:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# From the repository root
|
|
64
|
+
pnpm install
|
|
65
|
+
pnpm build
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
That builds `dist/index.js`. Run it directly with Node:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
node dist/index.js search "<query>" --target <url>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Or make the `osd` command available on your `PATH` for the current shell
|
|
75
|
+
session:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pnpm link --global
|
|
79
|
+
osd search "<query>" --target <url>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`pnpm link --global` symlinks this package into your global
|
|
83
|
+
`pnpm` bin directory, so `osd` keeps running the workspace's built output. To
|
|
84
|
+
remove it later, run `pnpm uninstall --global @osd-project/osd-cli`.
|
|
85
|
+
|
|
86
|
+
A Skill that wants to install the CLI automatically (rather than assuming a
|
|
87
|
+
contributor already ran the steps above) can shell out to:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
pnpm --dir <path-to-osd-cli> install
|
|
91
|
+
pnpm --dir <path-to-osd-cli> build
|
|
92
|
+
pnpm --dir <path-to-osd-cli> link --global
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Prefer the published install (`npm install -g @osd-project/osd-cli`) when you
|
|
96
|
+
just want the CLI; the from-source path is for developing it. A
|
|
97
|
+
checksum-verified install script would replace both for external
|
|
98
|
+
distribution.
|
|
99
|
+
|
|
100
|
+
## Usage
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
osd search "<query>" --target <url> [options]
|
|
104
|
+
osd verify [--candidate <file>] [options]
|
|
105
|
+
osd mcp "<server-card-or-endpoint-url>" [--call <tool> [--args <json>]] [options]
|
|
106
|
+
osd update [--check] [--json]
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Search options
|
|
110
|
+
|
|
111
|
+
| Option | Description | Default |
|
|
112
|
+
| --- | --- | --- |
|
|
113
|
+
| `-t, --target <url>` | Base URL of the registry or resolver to query. Can also be set via `OSD_REGISTRY_URL`. | `https://directory.zendesk.com` |
|
|
114
|
+
| `--json` | Print the raw JSON response instead of a human-readable summary. | `false` |
|
|
115
|
+
| `--contract-version <version>` | Exact OSD contract version to request (sent as `OSD-Accept-Contract-Version`). Pass `0.1.0` for registries that still serve it. | `0.3.0` |
|
|
116
|
+
| `--federation <mode>` | `auto`, `referrals`, or `none`. | `auto` |
|
|
117
|
+
| `--page-size <n>` | Maximum number of results to return. | *(registry default)* |
|
|
118
|
+
| `--page-token <token>` | Pagination token from a previous response. | — |
|
|
119
|
+
| `--verify` | Verify every result against its brand domain's published catalog and annotate each with a `verification` object. The exit code reflects the worst verdict. | `false` |
|
|
120
|
+
| `--filter <key=value>` | Structured filter, repeatable. Repeated keys become an array. | — |
|
|
121
|
+
|
|
122
|
+
### Examples
|
|
123
|
+
|
|
124
|
+
Search a locally running registry:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
osd search "airline baggage support" --target http://localhost:4000
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Same query, machine-readable output for scripting or CI:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
osd search "airline baggage support" --target http://localhost:4000 --json
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Filter by brand domain (the OSD `0.3.0` brand term):
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
osd search "invoice help" \
|
|
140
|
+
--target http://localhost:4000 \
|
|
141
|
+
--filter "osd:brandDomain=brand.example.com"
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Point at a target without repeating `--target` on every call:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
export OSD_REGISTRY_URL=http://localhost:4000
|
|
148
|
+
osd search "invoice help"
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Run against the built-in default (the production OSD directory) with no flags:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
osd search "northstar devices"
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
List the tools a verified candidate's server offers:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
osd mcp "https://support.example.com/server-card.json"
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Call a tool directly:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
osd mcp "https://support.example.com/server-card.json" \
|
|
167
|
+
--call get_rebooking_options --args '{"destination":"Singapore"}'
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
MCP options:
|
|
171
|
+
|
|
172
|
+
| Option | Description |
|
|
173
|
+
| --- | --- |
|
|
174
|
+
| `-t, --target <url>` | Base URL of the OSD directory the target is verified against with `--verify`. Can also be set via `OSD_REGISTRY_URL`. Defaults to `https://directory.zendesk.com`. |
|
|
175
|
+
| `--verify` | Verify the target against the directory and the brand's own manifest before connecting; connect only if verification passes, or if you explicitly confirm in an interactive run. |
|
|
176
|
+
| `--call <tool>` | Call the named tool instead of listing the server's tools. |
|
|
177
|
+
| `--args <json>` | Tool arguments as a JSON object (only meaningful with `--call`). |
|
|
178
|
+
| `--json` | Print the result as a JSON object for scripting. |
|
|
179
|
+
| `--no-auth` | Never start a sign-in flow; report auth-required and stop. Cached credentials are still used. |
|
|
180
|
+
| `--login` | Start a fresh sign-in, preferring device authorization when the server advertises it. Also works from a non-interactive shell and when credentials are cached or the server permits anonymous access. |
|
|
181
|
+
|
|
182
|
+
With `--verify`, `osd mcp` verifies the target before connecting
|
|
183
|
+
(verify-before-connect): the target must be listed in the directory under
|
|
184
|
+
its exact URL and that listing must match the brand domain's own published
|
|
185
|
+
manifest. Unlisted, ambiguous, or unverifiable targets are refused; an
|
|
186
|
+
interactive run can override the refusal with an explicit confirmation, a
|
|
187
|
+
non-interactive run never can. The gate covers every connection path,
|
|
188
|
+
including `--resolve-only`. Without `--verify`, `osd mcp` connects as
|
|
189
|
+
before, with no directory lookup.
|
|
190
|
+
|
|
191
|
+
`osd mcp` resolves the card at call time and writes no client
|
|
192
|
+
configuration. If the server requires authorization, an interactive run
|
|
193
|
+
prefers OAuth device authorization when advertised and caches credentials
|
|
194
|
+
for later runs. Servers without device-flow support use the existing
|
|
195
|
+
browser-callback authorization-code/PKCE flow.
|
|
196
|
+
The requested OAuth scopes come from the server's own
|
|
197
|
+
`scopes_supported` advertisement and are printed to stderr before the
|
|
198
|
+
sign-in starts. A non-interactive shell does not start human interaction
|
|
199
|
+
automatically; use `--login` once to sign in and warm the cache.
|
|
200
|
+
|
|
201
|
+
To explicitly start a fresh sign-in, including for an assistant or CLI
|
|
202
|
+
that cannot receive a browser callback:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
osd mcp "https://support.example.com/api/mcp" --login --json
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
For servers advertising device authorization, the CLI prints the
|
|
209
|
+
verification URL and user code to stderr. Open that URL
|
|
210
|
+
in your own browser, sign in, and approve the request you started. Keep the
|
|
211
|
+
command running: it polls the discovered token endpoint at the server's
|
|
212
|
+
interval, backs off on `slow_down`, and stops on denial or expiry. After
|
|
213
|
+
approval it caches the tokens using the existing credential store, connects
|
|
214
|
+
to MCP, and lists tools (or runs the requested `--call`). The private device
|
|
215
|
+
code and issued tokens are never printed. JSON results stay on stdout.
|
|
216
|
+
|
|
217
|
+
`--login` deliberately starts a new sign-in even when a token is
|
|
218
|
+
cached. Later runs without it reuse cached credentials. It cannot be
|
|
219
|
+
combined with `--no-auth` or `--resolve-only`. The CLI chooses the flow from
|
|
220
|
+
the server's advertised capabilities; there is no device-specific option.
|
|
221
|
+
Device authorization must also be permitted by the registration response.
|
|
222
|
+
Once a device flow is selected, denial, expiry or server errors are
|
|
223
|
+
reported without silently switching to browser login.
|
|
224
|
+
A failed device sign-in preserves the previously cached client/token pair.
|
|
225
|
+
|
|
226
|
+
### Testing device authorization
|
|
227
|
+
|
|
228
|
+
For development or staging, run the built checkout directly. From the
|
|
229
|
+
repository root:
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
pnpm install --frozen-lockfile
|
|
233
|
+
pnpm build
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Use an environment where the MCP integration and authorization server's
|
|
237
|
+
device-flow implementation are enabled, with a test user who can sign in.
|
|
238
|
+
Discovery must advertise `device_authorization_endpoint` and the device
|
|
239
|
+
grant, and registration must permit that grant for a public OAuth client.
|
|
240
|
+
The returned client ID must be accepted by both device initiation and the
|
|
241
|
+
MCP token endpoint. Device registration requires no browser callback;
|
|
242
|
+
refresh-token support is requested only when the server advertises it.
|
|
243
|
+
|
|
244
|
+
Set the endpoint to the chosen test account's normal HTTPS hostname. The
|
|
245
|
+
example below is a placeholder; replace it with your staging/test endpoint:
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
export MCP_ENDPOINT="https://support.example.com/api/mcp"
|
|
249
|
+
node dist/index.js mcp "$MCP_ENDPOINT" --login --json
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Keep the command running. Open its printed verification URL in a private
|
|
253
|
+
browser session, sign in as the test end user, check the displayed request
|
|
254
|
+
and approve. The CLI should complete sign-in and print JSON containing the
|
|
255
|
+
MCP server information and available tools. That verifies the token works
|
|
256
|
+
with MCP, rather than only verifying token issuance. The private device
|
|
257
|
+
code and issued tokens stay inside the client.
|
|
258
|
+
|
|
259
|
+
Next, check that the cached credential works without another sign-in:
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
node dist/index.js mcp "$MCP_ENDPOINT" --no-auth --json
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Repeat with `--login` when you want a fresh authorization, including
|
|
266
|
+
denial and expiry cases. For a multi-brand account, test the default tenant
|
|
267
|
+
hostname and a supported additional-brand hostname separately, following
|
|
268
|
+
each returned verification URL through sign-in and approval. A tunnel that
|
|
269
|
+
forwards only to MCP is a different routing setup from the normal tenant
|
|
270
|
+
hostname and needs its own endpoint-reachability check.
|
|
271
|
+
|
|
272
|
+
Useful failure signals:
|
|
273
|
+
|
|
274
|
+
- **Device authorization not advertised:** check the deployed server build
|
|
275
|
+
and account enablement. The CLI does not guess the device endpoint.
|
|
276
|
+
- **Registration did not allow the device grant:** align the registration
|
|
277
|
+
response with discovery before testing initiation and polling.
|
|
278
|
+
- **Device initiation returns 404/4xx:** check the returned endpoint's
|
|
279
|
+
routing, account flag and public client configuration.
|
|
280
|
+
- **Token request rejected:** verify the same client ID is accepted at both
|
|
281
|
+
endpoints, and expected pending/slow-down responses pass through the MCP
|
|
282
|
+
token proxy.
|
|
283
|
+
- **MCP returns 403 after sign-in:** check access to the selected resource
|
|
284
|
+
or brand. A valid OAuth token does not enable a disabled MCP entry point.
|
|
285
|
+
- **Sign-in lands on the wrong page:** check the verification URL's hostname
|
|
286
|
+
and the brand/default-tenant login return path.
|
|
287
|
+
|
|
288
|
+
For a trusted private-network test host refused by the address guard, use
|
|
289
|
+
the existing `--allow-private-addresses` flag (or `OSD_ALLOW_PRIVATE=1`)
|
|
290
|
+
opt-in. Keep TLS verification enabled.
|
|
291
|
+
`OSD_AUTH_DIR` relocates cache files/markers; the OS vault still keys its
|
|
292
|
+
credentials by endpoint, so a different directory does not isolate vault
|
|
293
|
+
entries. Avoid sharing or committing tokens, passwords or cache contents.
|
|
294
|
+
|
|
295
|
+
Credentials use the OS vault when available: macOS Keychain (`security`),
|
|
296
|
+
Linux Secret Service (`secret-tool`), or Windows Credential Locker
|
|
297
|
+
(`PasswordVault` via PowerShell). Only a marker is written under
|
|
298
|
+
`~/.osd/auth/<endpoint-hash>.json`; existing plaintext caches migrate into
|
|
299
|
+
the vault on read. If the vault tool is unavailable, the fallback is a
|
|
300
|
+
**plaintext** JSON file restricted to this user (directory `0700`, file
|
|
301
|
+
`0600`, or checked Windows ACLs). Unsafe caches are not read, and writes
|
|
302
|
+
fail if these restrictions cannot be enforced. `OSD_AUTH_DIR` relocates
|
|
303
|
+
this directory; it must be a directory this user can restrict to `0700`,
|
|
304
|
+
not a shared directory such as `/tmp`.
|
|
305
|
+
|
|
306
|
+
Neither option stops a malicious process running as the same OS user:
|
|
307
|
+
an unlocked keychain or Windows user-protected vault can still be accessed
|
|
308
|
+
by that user. The plaintext fallback only protects against other users.
|
|
309
|
+
On macOS, the `security -w` argument briefly exposes the credential in the process list.
|
|
310
|
+
If the auth directory cannot be made private, a vault save still succeeds
|
|
311
|
+
without a marker; use logout with a target to remove that vault entry.
|
|
312
|
+
|
|
313
|
+
Run `osd mcp logout <server-card-or-endpoint-url>` to delete that target's
|
|
314
|
+
cached credentials and attempt server-side revocation of its refresh and
|
|
315
|
+
access tokens. Revocation is best-effort; network or discovery failures
|
|
316
|
+
print a warning but do not prevent local deletion. `osd mcp logout` without a
|
|
317
|
+
target deletes all local cache entries without attempting revocation.
|
|
318
|
+
If the host is down, the cache is removed for the URL you typed. A server-card
|
|
319
|
+
URL that cannot be fetched or answers HTTP 401 or 403 will not match the stored endpoint, so run
|
|
320
|
+
`osd mcp logout` with no argument to clear every local entry.
|
|
321
|
+
|
|
322
|
+
Private and reserved targets are refused by default for server cards,
|
|
323
|
+
brand catalogs, MCP, and OAuth. Use a public HTTPS endpoint. For trusted
|
|
324
|
+
targets on a private network only, pass `--allow-private-addresses` (or set
|
|
325
|
+
`OSD_ALLOW_PRIVATE=1`/`true`). Plain HTTP is allowed only on loopback, even with that opt-out;
|
|
326
|
+
loopback MCP/OAuth stubs also need the opt-out.
|
|
327
|
+
|
|
328
|
+
### Proxies
|
|
329
|
+
|
|
330
|
+
Guarded fetches (server cards, brand catalogs, MCP, OAuth) honor
|
|
331
|
+
`HTTPS_PROXY`/`https_proxy` for HTTPS targets, falling back to
|
|
332
|
+
`HTTP_PROXY`/`http_proxy`, and respect `NO_PROXY`/`no_proxy` (comma- or
|
|
333
|
+
whitespace-separated host or domain-suffix entries, optional `:port`, a
|
|
334
|
+
bare `*` matches everything). Only `http:`/`https:` proxy URLs are
|
|
335
|
+
supported; a malformed or unsupported proxy URL fails the request loudly
|
|
336
|
+
rather than silently connecting directly. To use an authenticated proxy,
|
|
337
|
+
put the username and password in the proxy URL itself, as the userinfo part
|
|
338
|
+
(`username:password@`) between the `http://` or `https://` scheme and the
|
|
339
|
+
host. Percent-encode any reserved character in either value (for example `@`
|
|
340
|
+
as `%40`); a username cannot contain a colon, because Basic authentication
|
|
341
|
+
splits at the first one. The CLI sends them as a `Proxy-Authorization` Basic
|
|
342
|
+
header and they never appear in errors or diagnostics.
|
|
343
|
+
|
|
344
|
+
No OSD-specific configuration is needed: proxy settings come only from the
|
|
345
|
+
process environment, and a configured proxy is treated as authorization to
|
|
346
|
+
use it -- wherever it resolves, private or reserved addresses included (a
|
|
347
|
+
loopback sidecar, or a hosted assistant's egress proxy).
|
|
348
|
+
|
|
349
|
+
**Security boundary:** when a proxy applies, the origin's address is never
|
|
350
|
+
resolved locally -- the CLI issues `CONNECT <origin>:443` to the proxy and
|
|
351
|
+
runs TLS to the origin end-to-end through the tunnel, so certificate
|
|
352
|
+
verification is unchanged and destination network restrictions are
|
|
353
|
+
enforced by the proxy, not the CLI. Direct connections -- every request
|
|
354
|
+
when no proxy is configured, and every `NO_PROXY` request -- keep the
|
|
355
|
+
CLI's address guard: private and reserved destinations stay blocked, and
|
|
356
|
+
`--allow-private-addresses` remains the opt-out for trusted private-network
|
|
357
|
+
targets.
|
|
358
|
+
|
|
359
|
+
Verification failures say which stage failed: `blocked by network policy`
|
|
360
|
+
(guard refusal), `proxy connection failed` (CONNECT rejected or tunnel
|
|
361
|
+
setup failed), `TLS connection failed` (certificate or handshake), or
|
|
362
|
+
`connection failed` (DNS/refused/timeout). All remain `unreachable` -- a
|
|
363
|
+
network failure is never reported as verified.
|
|
364
|
+
|
|
365
|
+
Human-readable search output against a running registry:
|
|
366
|
+
|
|
367
|
+
```text
|
|
368
|
+
$ osd search "device repair"
|
|
369
|
+
1 result(s):
|
|
370
|
+
|
|
371
|
+
Acme Devices Repair Support (urn:air:acme-electronics.example:electronics:repair)
|
|
372
|
+
score: 28
|
|
373
|
+
source: http://localhost:4000/search
|
|
374
|
+
url: https://support.acme-electronics.example/electronics/repair.json
|
|
375
|
+
capabilities: osd.ask
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
Verify every result against its brand domain while searching:
|
|
379
|
+
|
|
380
|
+
```bash
|
|
381
|
+
osd search "shoe repair" --verify
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
Re-verify one saved candidate (a single catalog entry, not the whole search
|
|
385
|
+
response):
|
|
386
|
+
|
|
387
|
+
```bash
|
|
388
|
+
osd search "shoe repair" --json | jq '.results[0]' | osd verify
|
|
389
|
+
osd verify --candidate candidate.json --json
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
## `osd verify`
|
|
393
|
+
|
|
394
|
+
```bash
|
|
395
|
+
osd verify [--candidate <file>] [--json] [--contract-version <version>]
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
Reads a single candidate catalog entry from stdin or `--candidate <file>`
|
|
399
|
+
(exactly one of the two), fetches the brand-domain catalog from the
|
|
400
|
+
brand's own domain, and applies an exact structural match: every
|
|
401
|
+
field of the entry must agree, with resolver annotations (`score`, `source`,
|
|
402
|
+
`provenance`, `warnings`, `conflicts`, `verification`) excluded.
|
|
403
|
+
|
|
404
|
+
A verdict means the bytes agree (or not) with what the brand's domain
|
|
405
|
+
publishes. It is a structural match only -- no cryptographic validation of
|
|
406
|
+
`trustManifest` is performed in v1.
|
|
407
|
+
|
|
408
|
+
The fetch is hardened because `brandDomain` is registry-controlled input:
|
|
409
|
+
strict RFC 1123 hostname validation, a private/reserved IP blocklist after
|
|
410
|
+
DNS resolution, https-only, no redirects followed, a ~1 MiB body cap, and an
|
|
411
|
+
~8s total budget.
|
|
412
|
+
|
|
413
|
+
### Verify exit codes
|
|
414
|
+
|
|
415
|
+
| Code | Verdict | Meaning |
|
|
416
|
+
| --- | --- | --- |
|
|
417
|
+
| `0` | verified | The candidate structurally matches an entry in the brand's catalog. |
|
|
418
|
+
| `1` | malformed catalog | The brand's catalog could not be parsed or failed validation. Treat the candidate as unverified. |
|
|
419
|
+
| `2` | invalid candidate | The candidate input itself is bad (not JSON, schema-invalid, bad brandDomain). Not a verdict. |
|
|
420
|
+
| `4` | unreachable | Inconclusive and retryable: DNS failure, timeout, 404, non-2xx, redirect, over-size or non-JSON body. Expected while a brand has not published its catalog yet. |
|
|
421
|
+
| `5` | no_match | Definitive: no catalog entry shares the candidate's identifier. The brand does not endorse this candidate. |
|
|
422
|
+
| `6` | mismatch | Definitive conflict: the brand's entry for this identifier differs structurally. The diff lists the differing fields; a mismatch can be an unpropagated update, not necessarily fraud. |
|
|
423
|
+
| `64` | usage | Bad command-line input (e.g. both stdin and `--candidate`, or neither). |
|
|
424
|
+
|
|
425
|
+
With `--json`, the verdict kinds print a verdict object on stdout:
|
|
426
|
+
`{verdict, brandDomain, catalogUrl, detail, diff[]}`. `detail` carries the
|
|
427
|
+
failure reason for `unreachable` (DNS failure, HTTP status, redirect, etc.)
|
|
428
|
+
and is `null` for the other verdicts.
|
|
429
|
+
|
|
430
|
+
## Behavior
|
|
431
|
+
|
|
432
|
+
- The CLI sends `POST <target>/search` with a JSON body conformant to
|
|
433
|
+
`contracts/schemas/registry-search-request`.
|
|
434
|
+
- It never chooses a candidate on the caller's behalf: every result and every
|
|
435
|
+
referral the target returns is printed, in the order received.
|
|
436
|
+
- A successful JSON response is validated against the pinned
|
|
437
|
+
`contracts/schemas/registry-search-response` schema before being printed;
|
|
438
|
+
a mismatch is reported as a warning on stderr and exits nonzero so scripts
|
|
439
|
+
can distinguish it from a conformant success.
|
|
440
|
+
- An error response is validated against `contracts/schemas/error-response`
|
|
441
|
+
and printed as `Error: <errorCode> (HTTP <status>): <message>` -- no stack
|
|
442
|
+
trace, no raw JSON dump (unless `--json` is set, in which case the raw
|
|
443
|
+
error body is printed to stdout).
|
|
444
|
+
- With `--verify`, every result is checked against its brand domain's
|
|
445
|
+
published catalog (exact structural match) and annotated with a
|
|
446
|
+
`verification` object (`verified`, `mismatch`, `no_match`, `unreachable`,
|
|
447
|
+
`invalid`, `malformed`). The exit code then reflects the worst verdict on
|
|
448
|
+
the page: `mismatch` exits `6`, `no_match` exits `5`, and the inconclusive
|
|
449
|
+
verdicts (`unreachable`, `invalid`, `malformed`) exit `1`. Results are
|
|
450
|
+
always printed, whatever the exit code.
|
|
451
|
+
|
|
452
|
+
## Updates
|
|
453
|
+
|
|
454
|
+
`osd` keeps itself up to date. At most once a day, a background process
|
|
455
|
+
checks the registry and, if a newer version is published, installs it. The
|
|
456
|
+
next command tells you once, on stderr:
|
|
457
|
+
|
|
458
|
+
```
|
|
459
|
+
osd: auto-updated 0.4.0 -> 0.4.1 (set OSD_NO_AUTO_UPDATE=1 to opt out).
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
- The check and the install run in a detached process using your own
|
|
463
|
+
`~/.npmrc` (`npm view`, then `npm install -g @osd-project/osd-cli@<version>`).
|
|
464
|
+
A command never waits on them, and stdout (including `--json`) is never
|
|
465
|
+
touched.
|
|
466
|
+
- Installs are pinned to the exact version that was checked and serialized
|
|
467
|
+
by a lockfile, so parallel runs don't collide.
|
|
468
|
+
- The new version is installed into a staging directory next to the live
|
|
469
|
+
copy, checked there (its `osd --version` must run and report that
|
|
470
|
+
version), and only then swapped in with two renames. The live copy is
|
|
471
|
+
never half-written: a command that starts mid-update still runs, and an
|
|
472
|
+
update that is killed partway leaves the old version working. A failed
|
|
473
|
+
check just discards the staged copy.
|
|
474
|
+
- **Rollback:** if the installed version is deprecated (`npm deprecate`), it
|
|
475
|
+
moves to `latest` on its next check, even if that is an older version.
|
|
476
|
+
To pull a bad release, deprecate it and move `latest` back.
|
|
477
|
+
- If the install can't happen (npm refuses a version younger than your
|
|
478
|
+
`min-release-age`, the global prefix isn't writable, or you are offline),
|
|
479
|
+
nothing changes and it retries on the next daily check. Meanwhile each
|
|
480
|
+
command prints:
|
|
481
|
+
|
|
482
|
+
```
|
|
483
|
+
osd: update available 0.4.0 -> 0.4.1. Run `osd update` to upgrade now (set OSD_NO_UPDATE_CHECK=1 to silence).
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
- `osd update` installs the newest version immediately and shows npm's
|
|
487
|
+
output. `osd update --check` only reports. Both accept `--json`.
|
|
488
|
+
- Only global npm installs on Linux and macOS are checked and updated;
|
|
489
|
+
anything else gets no notice and no update:
|
|
490
|
+
|
|
491
|
+
| How osd was installed | Notice | Updates itself |
|
|
492
|
+
| --- | --- | --- |
|
|
493
|
+
| `npm install -g @osd-project/osd-cli` | Yes | Yes |
|
|
494
|
+
| `npm install -g ./osd-project-osd-cli-<v>.tgz` (from `npm pack`) | Yes | Yes, if the machine can reach the npm registry |
|
|
495
|
+
| `npm install -g ./folder` or `pnpm link` (symlink to a checkout) | No | No |
|
|
496
|
+
| A project's local `node_modules` | No | No |
|
|
497
|
+
| Unpacked zip, or `node dist/index.js` | No | No |
|
|
498
|
+
| Any platform other than Linux or macOS (e.g. Windows) | No | No |
|
|
499
|
+
| No npm registry access | No (the check fails and records the error) | No |
|
|
500
|
+
|
|
501
|
+
To share a build, send the `npm pack` tarball, not a zip or a folder.
|
|
502
|
+
|
|
503
|
+
| Variable | Effect |
|
|
504
|
+
| --- | --- |
|
|
505
|
+
| `OSD_NO_AUTO_UPDATE=1` | Check and print the notice, but never install in the background. |
|
|
506
|
+
| `OSD_NO_UPDATE_CHECK=1` or `CI` | No check, no notice, no install. |
|
|
507
|
+
| `OSD_UPDATE_TAG=<tag>` | Follow a dist-tag other than `latest` (for testing prereleases). |
|
|
508
|
+
| `OSD_NPM=<path>` | The npm to use (default: the one next to the running `node`). |
|
|
509
|
+
|
|
510
|
+
State lives in `$XDG_CONFIG_HOME/osd/` (default `~/.config/osd/`):
|
|
511
|
+
`update-check.json` records the last check and any error, and `update.lock`
|
|
512
|
+
exists only while an install is running.
|
|
513
|
+
|
|
514
|
+
## Exit codes
|
|
515
|
+
|
|
516
|
+
Codes `0`, `1`, `2`, `4` and `64` are shared with `osd verify` (verify never
|
|
517
|
+
exits `3`: an unsupported local contract version is a usage error, `64`),
|
|
518
|
+
which adds verdict codes `5` and `6` (see the verify table above for the full
|
|
519
|
+
verdict semantics). With `osd search --verify`, the worst per-result verdict
|
|
520
|
+
maps onto these same codes (`mismatch` → `6`, `no_match` → `5`, inconclusive
|
|
521
|
+
verdicts → `1`); the annotated results are still printed.
|
|
522
|
+
|
|
523
|
+
| Code | Meaning |
|
|
524
|
+
| --- | --- |
|
|
525
|
+
| `0` | Success (including zero search results). For `osd verify`: verdict `verified`. |
|
|
526
|
+
| `1` | The target returned an unmapped or invalid response, contract validation failed, or an MCP server did not speak MCP correctly or (with `--no-auth`) required authorization. For `osd verify`: the fetched brand catalog was malformed. Also used when the CLI installation is broken. |
|
|
527
|
+
| `2` | The target rejected the request as invalid (`INVALID_ARGUMENT`, HTTP 400). For `osd verify`: the candidate input was invalid. |
|
|
528
|
+
| `3` | The target does not support the requested contract version (`UNSUPPORTED_CONTRACT_VERSION`, HTTP 406). |
|
|
529
|
+
| `4` | The CLI could not reach the target at all (DNS, connection refused, timeout, etc.). For `osd verify`: verdict `unreachable` -- inconclusive, safe to retry. For `osd update`: the npm registry could not be queried. |
|
|
530
|
+
| `5` | `osd verify` verdict `no_match`: no catalog entry shares the candidate's identifier. For `osd search --verify`: the worst verdict on the page was `no_match`. |
|
|
531
|
+
| `6` | `osd verify` verdict `mismatch`: the brand's entry for this identifier differs structurally. For `osd search --verify`: the worst verdict on the page was `mismatch`. |
|
|
532
|
+
| `64` | The command-line arguments themselves were invalid. |
|
|
533
|
+
|
|
534
|
+
## Development
|
|
535
|
+
|
|
536
|
+
```bash
|
|
537
|
+
pnpm build # compile TypeScript to dist/
|
|
538
|
+
pnpm typecheck # type-check without emitting
|
|
539
|
+
pnpm test # run unit tests
|
|
540
|
+
pnpm e2e # pack + install the CLI, run it against a local OSD stack (see e2e/README.md)
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
Tests validate CLI behavior against the repository's own pinned contract
|
|
544
|
+
schemas and fixtures under `contracts/`, so they only pass when this
|
|
545
|
+
package's request/response handling stays conformant with the current
|
|
546
|
+
contract set.
|
|
547
|
+
|
|
548
|
+
## Known limitations
|
|
549
|
+
|
|
550
|
+
- Targets on a private network require the explicit
|
|
551
|
+
`--allow-private-addresses` flag (or `OSD_ALLOW_PRIVATE=1`) opt-out. Without it, mixed public/private HTTPS DNS answers connect via
|
|
552
|
+
the public subset. HTTP names must resolve only to loopback. Registry search
|
|
553
|
+
rejects non-loopback HTTP targets but does not enforce private-address checks
|
|
554
|
+
or a response-size cap.
|
|
555
|
+
- Only direct registry mode has been exercised end to end. Resolver-mode
|
|
556
|
+
behaviors (exact contract-version negotiation across multiple
|
|
557
|
+
registries, combined provenance) are not yet covered by dedicated tests.
|
|
558
|
+
- Verification fetches `https://{osd:brandDomain}/.well-known/ard.json`
|
|
559
|
+
for contract `0.3.0`, and the app route `/api/mcp/ai-catalog.json` for
|
|
560
|
+
contract `0.1.0` (its `/.well-known/` route is not available on every
|
|
561
|
+
server yet). Brands on old server builds without the well-known route
|
|
562
|
+
verdict `unreachable` (exit 4 from `osd verify`).
|
|
563
|
+
- Verification is a structural match only: `trustManifest` is compared as
|
|
564
|
+
data when present, but no did:web resolution or signature validation is
|
|
565
|
+
performed.
|
|
566
|
+
- There is no install script, no checksums manifest, no prebuilt binaries,
|
|
567
|
+
and no code signing. Distribution and packaging remain open decisions.
|
|
568
|
+
|
|
569
|
+
## Contributing
|
|
570
|
+
|
|
571
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
572
|
+
|
|
573
|
+
## Security
|
|
574
|
+
|
|
575
|
+
To report a vulnerability, see [SECURITY.md](SECURITY.md).
|
|
576
|
+
|
|
577
|
+
## Copyright and license
|
|
578
|
+
|
|
579
|
+
Copyright 2026 Zendesk, Inc.
|
|
580
|
+
|
|
581
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
|
|
582
|
+
You may obtain a copy of the License at
|
|
583
|
+
|
|
584
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
585
|
+
|
|
586
|
+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|