@theholocron/cli 5.0.0-alpha.263 → 5.0.0-alpha.264
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 +3 -1
- package/dist/cli.mjs +162 -7
- package/dist/cli.mjs.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -555,6 +555,8 @@ Channels fed by the error tracker add `feeds: { errors: true }` and a layout `re
|
|
|
555
555
|
|
|
556
556
|
`holocron secrets sync <env> --worker <script>` also sets every key of the vault environment on a deployed Worker as a secret, through the optional `Workers.setSecret(script, name, value)` (write-only; the Cloudflare plugin implements it). The Worker must already exist. Sync only adds and updates: it never removes a binding, because a Worker also holds secrets that are not in the vault (for Comlink, the `COMLINK_<SOURCE>_WEBHOOK` that `notifications setup` sets), so a key deleted from the vault must be deleted from the Worker separately. Keys are written one at a time and each is reported; if one fails, the exit code is 1 and re-running finishes the rest, since every write is idempotent.
|
|
557
557
|
|
|
558
|
+
`holocron secrets list [--scope repo|environment|organization] [--env <name>] [--json]` prints the names (never the values; GitHub does not return them) of the secrets at each scope, sorted, under a heading per scope. With no `--scope` it lists the repository, plus the organization (`--org`, `HOLOCRON_ORG` or the config's `org`) and the `--env` environment when they are known; `--scope` lists one. A scope that cannot be listed is reported under its heading and the rest are still listed; the exit code is 1 if any failed. `--json` prints `[{ scope, names, error? }]`. It is read-only, so `--dry-run` does not apply. Comparing the names with what the config expects is `doctor secrets`.
|
|
559
|
+
|
|
558
560
|
Pinned messages are declared under the provider's `layout` as `pinned: [{ channel, content }]` (`channel` is a channel in the layout, `content` up to 2000 characters); the layout is the whole set of messages the bot has pinned in those channels.
|
|
559
561
|
|
|
560
562
|
Config shape added for role sync and sign-in (all under the provider's `layout`):
|
|
@@ -762,7 +764,7 @@ the local override exists to exempt.
|
|
|
762
764
|
`astromech.reusableTemplates()` to `theholocron/.github` (a pure sync target —
|
|
763
765
|
never hand-edit its `.github/workflows/*`).
|
|
764
766
|
- `src/commands/` — `repo setup`, `repo sync`, `doctor`, `deploy`,
|
|
765
|
-
`monitoring check`, `secrets set`, `secrets sync`, `package publish`,
|
|
767
|
+
`monitoring check`, `secrets list`, `secrets set`, `secrets sync`, `package publish`,
|
|
766
768
|
`package bump-versions`, `sync github`, `repo upgrade node`,
|
|
767
769
|
`repo upgrade deps`, `new plugin`, `auth`, `notifications setup`,
|
|
768
770
|
`notifications channel add`, `notifications link`,
|
package/dist/cli.mjs
CHANGED
|
@@ -206,6 +206,7 @@ const COMMAND_CONTEXTS = {
|
|
|
206
206
|
"repo sync readme": "repo-aware",
|
|
207
207
|
doctor: "workspace",
|
|
208
208
|
"repo setup": "workspace",
|
|
209
|
+
"secrets list": "workspace",
|
|
209
210
|
"secrets set": "workspace",
|
|
210
211
|
"secrets sync": "workspace",
|
|
211
212
|
"notifications channel add": "workspace",
|
|
@@ -1602,6 +1603,12 @@ const COMMAND_REGISTRY = [
|
|
|
1602
1603
|
}],
|
|
1603
1604
|
supportsDryRun: true
|
|
1604
1605
|
},
|
|
1606
|
+
{
|
|
1607
|
+
name: "secrets list",
|
|
1608
|
+
description: "List the names of the secrets at each scope (never the values)",
|
|
1609
|
+
positionals: [],
|
|
1610
|
+
supportsDryRun: false
|
|
1611
|
+
},
|
|
1605
1612
|
{
|
|
1606
1613
|
name: "secrets sync",
|
|
1607
1614
|
description: "Read a vault environment + fan KEY=VALUEs out to secrets + deployment env vars",
|
|
@@ -15188,9 +15195,9 @@ async function runSecretSet(input) {
|
|
|
15188
15195
|
if (!loader.has("secrets")) throw new Error("`secrets` capability is not configured — add a `secrets` provider to holocron.config.json");
|
|
15189
15196
|
const value = await resolveValue(input);
|
|
15190
15197
|
if (!value) throw new Error(`no value for secret \`${input.name}\` — pass it positionally, via --from-stdin, --from-env <NAME>, or set $${input.name} in the environment`);
|
|
15191
|
-
print(`Holocron secret set — ${input.name} (${describeScope(scope)})${dryRun ? " (dry-run)" : ""}`);
|
|
15198
|
+
print(`Holocron secret set — ${input.name} (${describeScope$1(scope)})${dryRun ? " (dry-run)" : ""}`);
|
|
15192
15199
|
if (dryRun) {
|
|
15193
|
-
const message = `would: secrets.setSecret(${describeScope(scope)}, ${input.name}, <${value.length} chars>)`;
|
|
15200
|
+
const message = `would: secrets.setSecret(${describeScope$1(scope)}, ${input.name}, <${value.length} chars>)`;
|
|
15194
15201
|
print(` … ${message}`);
|
|
15195
15202
|
return {
|
|
15196
15203
|
status: "dry-run",
|
|
@@ -15205,7 +15212,7 @@ async function runSecretSet(input) {
|
|
|
15205
15212
|
print(` ✓ set ${input.name} via ${secrets.providerName}`);
|
|
15206
15213
|
logger.info({
|
|
15207
15214
|
key: input.name,
|
|
15208
|
-
scope: describeScope(scope),
|
|
15215
|
+
scope: describeScope$1(scope),
|
|
15209
15216
|
provider: secrets.providerName,
|
|
15210
15217
|
status: "ok"
|
|
15211
15218
|
}, `secret set: ${input.name}`);
|
|
@@ -15219,7 +15226,7 @@ async function runSecretSet(input) {
|
|
|
15219
15226
|
print(` ✗ ${message}`);
|
|
15220
15227
|
logger.warn({
|
|
15221
15228
|
key: input.name,
|
|
15222
|
-
scope: describeScope(scope),
|
|
15229
|
+
scope: describeScope$1(scope),
|
|
15223
15230
|
reason: message
|
|
15224
15231
|
}, `secret set: ${input.name}`);
|
|
15225
15232
|
return {
|
|
@@ -15244,7 +15251,7 @@ async function defaultReadStdin() {
|
|
|
15244
15251
|
process.stdin.on("error", reject);
|
|
15245
15252
|
});
|
|
15246
15253
|
}
|
|
15247
|
-
function describeScope(scope) {
|
|
15254
|
+
function describeScope$1(scope) {
|
|
15248
15255
|
if (scope.kind === "repo") return "scope=repo";
|
|
15249
15256
|
if (scope.kind === "environment") return `scope=environment:${scope.name}`;
|
|
15250
15257
|
return `scope=organization:${scope.name}`;
|
|
@@ -15297,6 +15304,154 @@ const secretSetCommand = {
|
|
|
15297
15304
|
})).status === "fail") process.exitCode = 1;
|
|
15298
15305
|
}
|
|
15299
15306
|
};
|
|
15307
|
+
// src/commands/secrets-list/secrets-list.ts
|
|
15308
|
+
/**
|
|
15309
|
+
* `holocron secrets list` — which secrets exist, by name, at each scope.
|
|
15310
|
+
*
|
|
15311
|
+
* Read-only: GitHub never returns a value, so only names are printed. A scope
|
|
15312
|
+
* that cannot be listed (a token without the scope, a missing environment) is
|
|
15313
|
+
* reported under its heading and counted, and the other scopes are still
|
|
15314
|
+
* listed; the command exits non-zero when any failed.
|
|
15315
|
+
*/
|
|
15316
|
+
async function runSecretsList(input) {
|
|
15317
|
+
const print = input.print ?? ((line) => console.log(line));
|
|
15318
|
+
const logger = input.logger ?? getLogger();
|
|
15319
|
+
const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
|
|
15320
|
+
await loader.load();
|
|
15321
|
+
assertPluginsResolvable(loader, "secrets list");
|
|
15322
|
+
if (!loader.has("secrets")) throw new Error("`secrets` capability is not configured — add a `secrets` provider to holocron.config.json");
|
|
15323
|
+
const secrets = loader.get("secrets");
|
|
15324
|
+
const groups = [];
|
|
15325
|
+
for (const scope of input.scopes) {
|
|
15326
|
+
const label = describeScope(scope);
|
|
15327
|
+
try {
|
|
15328
|
+
const names = [...await secrets.listSecrets(scope)].sort();
|
|
15329
|
+
groups.push({
|
|
15330
|
+
scope,
|
|
15331
|
+
label,
|
|
15332
|
+
names
|
|
15333
|
+
});
|
|
15334
|
+
logger.info({
|
|
15335
|
+
scope: label,
|
|
15336
|
+
count: names.length,
|
|
15337
|
+
provider: secrets.providerName
|
|
15338
|
+
}, `secrets list: ${label}`);
|
|
15339
|
+
} catch (err) {
|
|
15340
|
+
const error = errorMessage(err);
|
|
15341
|
+
groups.push({
|
|
15342
|
+
scope,
|
|
15343
|
+
label,
|
|
15344
|
+
names: [],
|
|
15345
|
+
error
|
|
15346
|
+
});
|
|
15347
|
+
logger.warn({
|
|
15348
|
+
scope: label,
|
|
15349
|
+
reason: error
|
|
15350
|
+
}, `secrets list: ${label}`);
|
|
15351
|
+
}
|
|
15352
|
+
}
|
|
15353
|
+
const report = {
|
|
15354
|
+
groups,
|
|
15355
|
+
failed: groups.filter((g) => g.error !== void 0).length
|
|
15356
|
+
};
|
|
15357
|
+
if (input.json) print(JSON.stringify(groups.map(({ label: _label, ...group }) => group), null, 2));
|
|
15358
|
+
else printGroups(groups, print);
|
|
15359
|
+
return report;
|
|
15360
|
+
}
|
|
15361
|
+
function printGroups(groups, print) {
|
|
15362
|
+
for (const [index, group] of groups.entries()) {
|
|
15363
|
+
if (index > 0) print("");
|
|
15364
|
+
print(group.label);
|
|
15365
|
+
if (group.error !== void 0) print(` ✗ ${group.error}`);
|
|
15366
|
+
else if (group.names.length === 0) print(" (none)");
|
|
15367
|
+
else for (const name of group.names) print(` ${name}`);
|
|
15368
|
+
}
|
|
15369
|
+
}
|
|
15370
|
+
function describeScope(scope) {
|
|
15371
|
+
if (scope.kind === "repo") return "repo";
|
|
15372
|
+
return `${scope.kind} ${scope.name}`;
|
|
15373
|
+
}
|
|
15374
|
+
// src/commands/secrets-list/secrets-list-scopes.ts
|
|
15375
|
+
/**
|
|
15376
|
+
* Turns `--scope`, `--env` and the resolved organization into the scopes to list.
|
|
15377
|
+
* With no `--scope` it lists the repository, then the organization and the
|
|
15378
|
+
* environment when one was named. Naming a scope whose name is missing throws.
|
|
15379
|
+
*/
|
|
15380
|
+
function secretsListScopes(input) {
|
|
15381
|
+
const { scope, env, org } = input;
|
|
15382
|
+
if (scope === "repo") return [{ kind: "repo" }];
|
|
15383
|
+
if (scope === "environment") {
|
|
15384
|
+
if (!env) throw new Error("`--scope environment` needs `--env <name>`");
|
|
15385
|
+
return [{
|
|
15386
|
+
kind: "environment",
|
|
15387
|
+
name: env
|
|
15388
|
+
}];
|
|
15389
|
+
}
|
|
15390
|
+
if (scope === "organization") {
|
|
15391
|
+
if (!org) throw new Error("`--scope organization` needs `--org <name>` or `org` in holocron.config.ts");
|
|
15392
|
+
return [{
|
|
15393
|
+
kind: "organization",
|
|
15394
|
+
name: org
|
|
15395
|
+
}];
|
|
15396
|
+
}
|
|
15397
|
+
return [
|
|
15398
|
+
{ kind: "repo" },
|
|
15399
|
+
...org ? [{
|
|
15400
|
+
kind: "organization",
|
|
15401
|
+
name: org
|
|
15402
|
+
}] : [],
|
|
15403
|
+
...env ? [{
|
|
15404
|
+
kind: "environment",
|
|
15405
|
+
name: env
|
|
15406
|
+
}] : []
|
|
15407
|
+
];
|
|
15408
|
+
}
|
|
15409
|
+
// src/commands/secrets-list/secrets-list.args.ts
|
|
15410
|
+
const secretsListArgs = (y) => y.option("scope", {
|
|
15411
|
+
type: "string",
|
|
15412
|
+
choices: [
|
|
15413
|
+
"repo",
|
|
15414
|
+
"environment",
|
|
15415
|
+
"organization"
|
|
15416
|
+
],
|
|
15417
|
+
describe: "List one scope. Omitted: the repository, plus the organization and the --env environment."
|
|
15418
|
+
}).option("env", {
|
|
15419
|
+
type: "string",
|
|
15420
|
+
describe: "The environment to list (adds it to the default scopes; required with --scope environment)."
|
|
15421
|
+
}).option("json", {
|
|
15422
|
+
type: "boolean",
|
|
15423
|
+
default: false,
|
|
15424
|
+
describe: "Print one JSON document: [{ scope, names, error? }]"
|
|
15425
|
+
});
|
|
15426
|
+
// src/commands/secrets-list/secrets-list.command.ts
|
|
15427
|
+
const secretsListCommand = {
|
|
15428
|
+
command: "list",
|
|
15429
|
+
describe: "List the names of the secrets at each scope (never the values)",
|
|
15430
|
+
builder: secretsListArgs,
|
|
15431
|
+
handler: async (argv) => {
|
|
15432
|
+
const tokens = tokenContext(argv.token);
|
|
15433
|
+
if (!tokens) return;
|
|
15434
|
+
const loaded = await loadConfig(argv.cwd);
|
|
15435
|
+
applyResolvedConfig(argv, loaded.resolved);
|
|
15436
|
+
const org = resolveOrg(argv, loaded.resolved);
|
|
15437
|
+
const scopes = secretsListScopes({
|
|
15438
|
+
...argv.scope ? { scope: argv.scope } : {},
|
|
15439
|
+
...argv.env ? { env: argv.env } : {},
|
|
15440
|
+
...org ? { org } : {}
|
|
15441
|
+
});
|
|
15442
|
+
if ((await runSecretsList({
|
|
15443
|
+
loaded,
|
|
15444
|
+
context: {
|
|
15445
|
+
repoRoot: argv.cwd,
|
|
15446
|
+
dryRun: false,
|
|
15447
|
+
...tokens,
|
|
15448
|
+
org
|
|
15449
|
+
},
|
|
15450
|
+
scopes,
|
|
15451
|
+
json: argv.json
|
|
15452
|
+
})).failed > 0) process.exitCode = 1;
|
|
15453
|
+
}
|
|
15454
|
+
};
|
|
15300
15455
|
// src/commands/secrets-sync/secrets-sync.ts
|
|
15301
15456
|
/**
|
|
15302
15457
|
* `holocron secrets sync` — vault → destinations.
|
|
@@ -15563,8 +15718,8 @@ const secretsSyncCommand = {
|
|
|
15563
15718
|
// src/commands/secrets/secrets.command.ts
|
|
15564
15719
|
const secretsCommand = {
|
|
15565
15720
|
command: "secrets",
|
|
15566
|
-
describe: "
|
|
15567
|
-
builder: (y) => y.command(secretSetCommand).command(secretsSyncCommand).command(groupMenu("secrets")),
|
|
15721
|
+
describe: "List and set secrets, and sync vault environments",
|
|
15722
|
+
builder: (y) => y.command(secretSetCommand).command(secretsListCommand).command(secretsSyncCommand).command(groupMenu("secrets")),
|
|
15568
15723
|
handler: () => {}
|
|
15569
15724
|
};
|
|
15570
15725
|
// src/commands/skills/skills.args.ts
|