@cortexkit/opencode-claustrum-auth 0.0.0 → 0.1.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 +25 -0
- package/dist/index.js +9 -0
- package/dist/server.js +9 -0
- package/dist/setup-bin.js +15 -3
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# @cortexkit/opencode-claustrum-auth
|
|
2
|
+
|
|
3
|
+
The OpenCode 1 and OpenCode 2 package of [CortexKit Claustrum Auth](https://github.com/cortexkit/claustrum-auth). It serves provider keys from a [Claustrum](https://github.com/cortexkit/claustrum) vault for providers that need no special request handling. It is vault-only, with no local sign-in or API-key store. The Pi package is [`@cortexkit/pi-claustrum-auth`](https://www.npmjs.com/package/@cortexkit/pi-claustrum-auth).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
Quit the hosts, then run:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npx @cortexkit/opencode-claustrum-auth setup
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Setup detects OpenCode and Pi. Approve enrollment and grant access in `ck auth`, then follow the printed activation commands. Use `--host opencode` to select only OpenCode.
|
|
14
|
+
|
|
15
|
+
## Documentation
|
|
16
|
+
|
|
17
|
+
- [Supported providers and host availability](https://github.com/cortexkit/claustrum-auth#supported-providers)
|
|
18
|
+
- [Setup and activation](https://github.com/cortexkit/claustrum-auth/blob/main/docs/setup.md)
|
|
19
|
+
- [The /claustrum menu](https://github.com/cortexkit/claustrum-auth/blob/main/docs/commands.md)
|
|
20
|
+
- [Security](https://github.com/cortexkit/claustrum-auth/blob/main/docs/security.md)
|
|
21
|
+
- [Troubleshooting](https://github.com/cortexkit/claustrum-auth/blob/main/docs/troubleshooting.md)
|
|
22
|
+
|
|
23
|
+
## License
|
|
24
|
+
|
|
25
|
+
MIT
|
package/dist/index.js
CHANGED
|
@@ -7456,12 +7456,21 @@ function configIdentity(configDir) {
|
|
|
7456
7456
|
}
|
|
7457
7457
|
}
|
|
7458
7458
|
function resolveOpencodeStateDir(env = process.env, home = homedir()) {
|
|
7459
|
+
const override = env.OPENCODE_CLAUSTRUM_AUTH_STATE_DIR?.trim();
|
|
7460
|
+
if (override)
|
|
7461
|
+
return path.resolve(override);
|
|
7459
7462
|
const configDir = opencodeConfigDir(env, home);
|
|
7460
7463
|
const identity = configIdentity(configDir);
|
|
7461
7464
|
const key = identity === configIdentity(path.resolve(home, ".config", "opencode")) ? "opencode" : `opencode-${createHash3("sha256").update(identity).digest("hex").slice(0, 16)}`;
|
|
7462
7465
|
return path.resolve(env.XDG_STATE_HOME || path.join(home, ".local", "state"), "cortexkit", "claustrum-auth", key);
|
|
7463
7466
|
}
|
|
7464
7467
|
async function opencodeStateDir(env = process.env, home = homedir()) {
|
|
7468
|
+
if (env.OPENCODE_CLAUSTRUM_AUTH_STATE_DIR?.trim()) {
|
|
7469
|
+
const stateDir = resolveOpencodeStateDir(env, home);
|
|
7470
|
+
if (!stateDir || !path.isAbsolute(stateDir))
|
|
7471
|
+
throw startupRefusal("opencode-start");
|
|
7472
|
+
return stateDir;
|
|
7473
|
+
}
|
|
7465
7474
|
const identity = configIdentity(opencodeConfigDir(env, home));
|
|
7466
7475
|
const stateDir = resolveOpencodeStateDir(env, home);
|
|
7467
7476
|
const manifest = path.join(stateDir, "config-dir.json");
|
package/dist/server.js
CHANGED
|
@@ -7490,12 +7490,21 @@ function configIdentity(configDir) {
|
|
|
7490
7490
|
}
|
|
7491
7491
|
}
|
|
7492
7492
|
function resolveOpencodeStateDir(env = process.env, home = homedir()) {
|
|
7493
|
+
const override = env.OPENCODE_CLAUSTRUM_AUTH_STATE_DIR?.trim();
|
|
7494
|
+
if (override)
|
|
7495
|
+
return path.resolve(override);
|
|
7493
7496
|
const configDir = opencodeConfigDir(env, home);
|
|
7494
7497
|
const identity = configIdentity(configDir);
|
|
7495
7498
|
const key = identity === configIdentity(path.resolve(home, ".config", "opencode")) ? "opencode" : `opencode-${createHash3("sha256").update(identity).digest("hex").slice(0, 16)}`;
|
|
7496
7499
|
return path.resolve(env.XDG_STATE_HOME || path.join(home, ".local", "state"), "cortexkit", "claustrum-auth", key);
|
|
7497
7500
|
}
|
|
7498
7501
|
async function opencodeStateDir(env = process.env, home = homedir()) {
|
|
7502
|
+
if (env.OPENCODE_CLAUSTRUM_AUTH_STATE_DIR?.trim()) {
|
|
7503
|
+
const stateDir = resolveOpencodeStateDir(env, home);
|
|
7504
|
+
if (!stateDir || !path.isAbsolute(stateDir))
|
|
7505
|
+
throw startupRefusal("opencode-start");
|
|
7506
|
+
return stateDir;
|
|
7507
|
+
}
|
|
7499
7508
|
const identity = configIdentity(opencodeConfigDir(env, home));
|
|
7500
7509
|
const stateDir = resolveOpencodeStateDir(env, home);
|
|
7501
7510
|
const manifest = path.join(stateDir, "config-dir.json");
|
package/dist/setup-bin.js
CHANGED
|
@@ -6014,7 +6014,7 @@ import {
|
|
|
6014
6014
|
// ../pi/package.json
|
|
6015
6015
|
var package_default = {
|
|
6016
6016
|
name: "@cortexkit/pi-claustrum-auth",
|
|
6017
|
-
version: "0.
|
|
6017
|
+
version: "0.1.1",
|
|
6018
6018
|
description: "Claustrum vault credentials for Pi",
|
|
6019
6019
|
type: "module",
|
|
6020
6020
|
license: "MIT",
|
|
@@ -6063,7 +6063,7 @@ var package_default = {
|
|
|
6063
6063
|
// package.json
|
|
6064
6064
|
var package_default2 = {
|
|
6065
6065
|
name: "@cortexkit/opencode-claustrum-auth",
|
|
6066
|
-
version: "0.
|
|
6066
|
+
version: "0.1.1",
|
|
6067
6067
|
description: "Claustrum vault credentials for OpenCode 1 and OpenCode 2",
|
|
6068
6068
|
type: "module",
|
|
6069
6069
|
license: "MIT",
|
|
@@ -6143,12 +6143,21 @@ function configIdentity(configDir) {
|
|
|
6143
6143
|
}
|
|
6144
6144
|
}
|
|
6145
6145
|
function resolveOpencodeStateDir(env = process.env, home = homedir()) {
|
|
6146
|
+
const override = env.OPENCODE_CLAUSTRUM_AUTH_STATE_DIR?.trim();
|
|
6147
|
+
if (override)
|
|
6148
|
+
return path.resolve(override);
|
|
6146
6149
|
const configDir = opencodeConfigDir(env, home);
|
|
6147
6150
|
const identity = configIdentity(configDir);
|
|
6148
6151
|
const key = identity === configIdentity(path.resolve(home, ".config", "opencode")) ? "opencode" : `opencode-${createHash3("sha256").update(identity).digest("hex").slice(0, 16)}`;
|
|
6149
6152
|
return path.resolve(env.XDG_STATE_HOME || path.join(home, ".local", "state"), "cortexkit", "claustrum-auth", key);
|
|
6150
6153
|
}
|
|
6151
6154
|
async function opencodeStateDir(env = process.env, home = homedir()) {
|
|
6155
|
+
if (env.OPENCODE_CLAUSTRUM_AUTH_STATE_DIR?.trim()) {
|
|
6156
|
+
const stateDir = resolveOpencodeStateDir(env, home);
|
|
6157
|
+
if (!stateDir || !path.isAbsolute(stateDir))
|
|
6158
|
+
throw startupRefusal("opencode-start");
|
|
6159
|
+
return stateDir;
|
|
6160
|
+
}
|
|
6152
6161
|
const identity = configIdentity(opencodeConfigDir(env, home));
|
|
6153
6162
|
const stateDir = resolveOpencodeStateDir(env, home);
|
|
6154
6163
|
const manifest = path.join(stateDir, "config-dir.json");
|
|
@@ -6234,8 +6243,11 @@ async function runClaustrumSetup(rawArgv = [], io = {}, options = { table: suppo
|
|
|
6234
6243
|
beforeSignIn: async (host, context) => {
|
|
6235
6244
|
if (context.mode !== "claustrum")
|
|
6236
6245
|
throw new Error(vaultOnlyMessage);
|
|
6237
|
-
if (host === "opencode")
|
|
6246
|
+
if (host === "opencode") {
|
|
6238
6247
|
await opencodeStateDir(env, home);
|
|
6248
|
+
if (env.OPENCODE_CLAUSTRUM_AUTH_STATE_DIR?.trim() && argv.includes("--enroll-only"))
|
|
6249
|
+
print(`State directory: ${states.opencode}`);
|
|
6250
|
+
}
|
|
6239
6251
|
},
|
|
6240
6252
|
signInLocal: async () => {
|
|
6241
6253
|
throw new Error(vaultOnlyMessage);
|