@gjermundgaraba/clankercreds 0.4.0 → 0.5.0
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as Name, c as SecretKind, d as scopes, f as CurrentPrincipal, i as LoginKind, l as UpstreamUnavailable, n as Conflict, o as NeedsSignIn, p as ProviderUnavailable, r as Host, s as NotFound } from "./shared-DyTG-WFI.mjs";
|
|
2
2
|
import { Config, Console, Effect, Option, Redacted, Schema } from "effect";
|
|
3
3
|
import * as Action from "@gjermundgaraba/effect-actions/Action";
|
|
4
4
|
import * as ActionHttp from "@gjermundgaraba/effect-actions/ActionHttp";
|
|
@@ -138,7 +138,8 @@ const Admin = [
|
|
|
138
138
|
input: Schema.Struct({
|
|
139
139
|
name: Name,
|
|
140
140
|
kind: SecretKind,
|
|
141
|
-
|
|
141
|
+
/** Surrounding whitespace, such as a pasted line ending, is not part of a secret: a value carrying any is refused, never altered. */
|
|
142
|
+
value: Schema.Trimmed.check(Schema.isMinLength(1), Schema.isMaxLength(16384)),
|
|
142
143
|
host: Schema.optionalKey(Host),
|
|
143
144
|
/** Any date string JavaScript parses; a typo is refused, so alerting never loses it. Left out, it does not expire. */
|
|
144
145
|
expiresAt: Schema.optionalKey(Schema.DateFromString)
|
|
@@ -243,7 +244,7 @@ const AdminHttp = ActionHttp.make(Admin, {
|
|
|
243
244
|
});
|
|
244
245
|
//#endregion
|
|
245
246
|
//#region package.json
|
|
246
|
-
var version = "0.
|
|
247
|
+
var version = "0.5.0";
|
|
247
248
|
//#endregion
|
|
248
249
|
//#region src/admin.ts
|
|
249
250
|
/** A refusal of this command's own, printed as its message on stderr, exiting 1. */
|
|
@@ -294,11 +295,11 @@ const operator = Effect.gen(function* () {
|
|
|
294
295
|
});
|
|
295
296
|
/**
|
|
296
297
|
* The secret's value, from stdin: a flag would leave it in the process list and the shell's
|
|
297
|
-
* history.
|
|
298
|
+
* history. Surrounding whitespace, such as the line ending `op read` adds, is not part of it.
|
|
298
299
|
*/
|
|
299
300
|
const valueFromStdin = Effect.gen(function* () {
|
|
300
301
|
if (process.stdin.isTTY) return yield* refused("Pipe the value in, such as `op read 'op://…' | clankercreds admin put-credential …`; it is never taken from a flag or the terminal.");
|
|
301
|
-
const value = (yield* Effect.promise(() => text(process.stdin))).
|
|
302
|
+
const value = (yield* Effect.promise(() => text(process.stdin))).trim();
|
|
302
303
|
if (value === "") return yield* refused("The value on stdin is empty.");
|
|
303
304
|
return value;
|
|
304
305
|
});
|
package/dist/main.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { a as Name, f as CurrentPrincipal, l as UpstreamUnavailable, o as NeedsSignIn, p as ProviderUnavailable, s as NotFound, t as ClientId, u as claimsOf } from "./shared-DyTG-WFI.mjs";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
5
5
|
import { Effect, Option, Predicate, Schema } from "effect";
|
|
@@ -57,12 +57,13 @@ const PiCredential = Schema.Struct({
|
|
|
57
57
|
});
|
|
58
58
|
/**
|
|
59
59
|
* A credential no machine places: an API key, or a Grok or Cursor login's access token, for
|
|
60
|
-
* a service such as clankerusage
|
|
61
|
-
*
|
|
60
|
+
* a service such as clankerusage. `kind` is the credential's own, and any string, so a kind
|
|
61
|
+
* newer than the caller's contract still decodes. The client skips one a config names.
|
|
62
62
|
*/
|
|
63
63
|
const TokenCredential = Schema.Struct({
|
|
64
64
|
type: Schema.Literal("token"),
|
|
65
65
|
...fromCredential,
|
|
66
|
+
kind: Schema.String,
|
|
66
67
|
token: Schema.String
|
|
67
68
|
});
|
|
68
69
|
/**
|
|
@@ -98,10 +99,13 @@ const UnknownCredential = Schema.Struct({ type: Schema.String.check(Schema.makeF
|
|
|
98
99
|
const Delivery = Schema.Struct({ credentials: Schema.Array(Schema.Union([TypedCredential, UnknownCredential])) });
|
|
99
100
|
//#endregion
|
|
100
101
|
//#region ../../packages/api/src/machine.ts
|
|
101
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* A credential the calling key may read, without its value. `kind` is any string, so a kind
|
|
104
|
+
* newer than the caller's contract does not fail the whole list.
|
|
105
|
+
*/
|
|
102
106
|
const Grant = Schema.Struct({
|
|
103
107
|
name: Name,
|
|
104
|
-
kind:
|
|
108
|
+
kind: Schema.String
|
|
105
109
|
});
|
|
106
110
|
/**
|
|
107
111
|
* What a machine key can do: read the credentials it is granted, by name, and nothing else.
|
|
@@ -741,7 +745,7 @@ const commandFor = (name) => {
|
|
|
741
745
|
};
|
|
742
746
|
const main = async () => {
|
|
743
747
|
if (process.argv[2] === "admin") {
|
|
744
|
-
(await import("./admin-
|
|
748
|
+
(await import("./admin-BcOFNDUc.mjs")).run(process.argv.slice(2));
|
|
745
749
|
return;
|
|
746
750
|
}
|
|
747
751
|
const command = commandFor(process.argv[2]);
|
|
@@ -90,7 +90,7 @@ const LoginKind = Schema.Literals([
|
|
|
90
90
|
"grok",
|
|
91
91
|
"cursor"
|
|
92
92
|
]);
|
|
93
|
-
|
|
93
|
+
Schema.Literals([...SecretKind.literals, ...LoginKind.literals]);
|
|
94
94
|
/** A GitHub host, lowercase: it is written into `gh`'s and git's configuration as is. */
|
|
95
95
|
const Host = Schema.String.check(Schema.isPattern(/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)*$/), Schema.isMaxLength(253));
|
|
96
96
|
/**
|
|
@@ -124,4 +124,4 @@ const claimsOf = (jwt) => {
|
|
|
124
124
|
});
|
|
125
125
|
};
|
|
126
126
|
//#endregion
|
|
127
|
-
export {
|
|
127
|
+
export { Name as a, SecretKind as c, scopes as d, CurrentPrincipal as f, LoginKind as i, UpstreamUnavailable as l, Conflict as n, NeedsSignIn as o, ProviderUnavailable as p, Host as r, NotFound as s, ClientId as t, claimsOf as u };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjermundgaraba/clankercreds",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "The clankercreds command: a machine client that fetches the credentials its config names and places each where its tool expects it, and the operator's admin commands.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@gjermundgaraba/clankerauth-sdk": "0.16.0",
|
|
30
|
-
"@gjermundgaraba/clankercreds-api": "0.
|
|
30
|
+
"@gjermundgaraba/clankercreds-api": "0.5.0",
|
|
31
31
|
"@types/node": "26.6.5",
|
|
32
32
|
"typescript": "7.0.2",
|
|
33
33
|
"vite": "npm:@voidzero-dev/vite-plus-core@1.1.0",
|