You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 97b950a
Browse filesBrowse the repository at this point in the historyBrowse files
feat(cli): find accounts.pwd.yaml in the working directory
- look for accounts.pwd.yaml in the CWD when no credential file is set
- skip the lookup when OSW_USERNAME or OSW_PASSWORD is configured
- ignore a discovered file with no entry for the configured domain
- report the credential file and where its path came from
- no parent-directory walk, and the MCP server never searches
Copy file name to clipboardExpand all lines: docs/cli-and-mcp.md
+32-3Lines changed: 32 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -224,11 +224,40 @@ in a file.
224
224
the MCP client, so an implicit search would tie the credentials it loads to
225
225
how the client happened to be launched.
226
226
227
-
Both print the sources they resolved to stderr before connecting:
227
+
The credential file is looked up separately, in this order:
228
+
229
+
1. An explicit `OSW_CRED_FILEPATH` (or its aliases), whether it came from the
230
+
real environment or from a `.env` file, always wins. If this file has no
231
+
entry for the configured domain, that is an error. This check does not
232
+
apply when `OSW_USERNAME` and `OSW_PASSWORD` are both set, because osw
233
+
then builds credentials for any instance from those two variables.
234
+
2. Otherwise, an `accounts.pwd.yaml` file in the working directory, if one
235
+
exists there. This lookup does not walk up to parent directories, and it
236
+
runs for the CLI only, never for the MCP server, for the same reason the
237
+
`.env` search does not: the server's working directory belongs to the
238
+
client, not to the operator. If this file has no entry for the configured
239
+
domain, it is ignored rather than treated as an error, since it was only
240
+
discovered, not configured.
241
+
3. Otherwise, no credential file is used.
242
+
243
+
The working-directory lookup is skipped entirely when either `OSW_USERNAME`
244
+
or `OSW_PASSWORD` is already set, including their `OSL_USERNAME` /
245
+
`OSL_PASSWORD` aliases, so it never displaces credentials configured
246
+
explicitly.
247
+
248
+
Both print the source they resolved to stderr before connecting, in one of
249
+
these forms:
250
+
251
+
-`(from the OSW_CRED_FILEPATH environment variable)`
252
+
-`(from OSW_CRED_FILEPATH in the env file)`
253
+
-`(accounts.pwd.yaml found in the working directory)`
254
+
-`(accounts.pwd.yaml found in the working directory, ignored: no entry for domain '<domain>')`, when the discovered file is rejected for the reason given in step 2 above.
255
+
256
+
For example, a verbose CLI run or the MCP server prints:
228
257
229
258
```text
259
+
[osw] credential file: /home/me/project/accounts.pwd.yaml (accounts.pwd.yaml found in the working directory)
230
260
[osw] env file : /home/me/project/.env (found from the working directory upward)
| `OSW_CRED_FILEPATH` | `OSW_MCP_CRED_FILEPATH`, `OSL_CRED_FILEPATH` | YAML credential file, keyed by iri |
310
+
| `OSW_CRED_FILEPATH` | `OSW_MCP_CRED_FILEPATH`, `OSL_CRED_FILEPATH` | YAML credential file, keyed by iri (falls back to `accounts.pwd.yaml` in the working directory, CLI only) |
282
311
| `OSW_ENV_FILE` | `OSW_MCP_ENV_FILE` | `.env` file to load |
283
312
| `OSW_READ_ONLY` | `OSW_MCP_READ_ONLY` | `true` refuses every write |
284
313
| `OSW_SPARQL_ENDPOINT` | | Endpoint for `sparql` queries |
0 commit comments