@theholocron/cli 5.0.0-alpha.326 → 5.0.0-alpha.327
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 +8 -8
- package/dist/cli.mjs +63 -13
- package/dist/cli.mjs.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -188,14 +188,14 @@ A minimal config — for repos with a `package.json` and a GitHub remote
|
|
|
188
188
|
|
|
189
189
|
Additional `repo` fields recognised by `holocron repo setup`:
|
|
190
190
|
|
|
191
|
-
| Field | Type | Description
|
|
192
|
-
| ----------------- | --------------------------------------- |
|
|
193
|
-
| `repo.teams` | `Array<string \| { slug, permission }>` | GitHub teams granted repo access. String shorthand defaults to `push` (Write). `holocron repo setup` also writes `.github/CODEOWNERS` for teams with `push`/`maintain`/`admin`.
|
|
194
|
-
| `repo.topics` | `string[]` | GitHub topics set on the repository.
|
|
195
|
-
| `repo.protection` | `"balanced" \| "strict" \| "none"` | Branch-protection preset applied by `holocron repo setup`. For `"strict"`, the required status checks are derived from the task manifest — see below.
|
|
196
|
-
| `repo.properties` | `RepoProperties` | Org-level custom property values synced to the GitHub dashboard.
|
|
197
|
-
| `repo.variables` | `{ repo?, org?, prune? }` | GitHub Actions variables created and updated by `holocron repo setup`. Undeclared ones are left alone unless `prune` is on.
|
|
198
|
-
| `repo.secrets` | `{ repo?, org?, environments?, sync? }` | Names of the secrets that must exist, checked (never written) by `holocron doctor secrets`. Names only. The notification layout's secrets and a Chromatic project token are expected without being listed. `sync: [{ environment, keys?, scope? }]` declares the vault environments `secrets sync` fills from; the doctor expects their keys (every key the `vault` provider lists when `keys` is omitted, names only) at the `scope` (`repo`, `env=<name>`, `org=<name>`). |
|
|
191
|
+
| Field | Type | Description |
|
|
192
|
+
| ----------------- | --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
193
|
+
| `repo.teams` | `Array<string \| { slug, permission }>` | GitHub teams granted repo access. String shorthand defaults to `push` (Write). `holocron repo setup` also writes `.github/CODEOWNERS` for teams with `push`/`maintain`/`admin`. |
|
|
194
|
+
| `repo.topics` | `string[]` | GitHub topics set on the repository. |
|
|
195
|
+
| `repo.protection` | `"balanced" \| "strict" \| "none"` | Branch-protection preset applied by `holocron repo setup`. For `"strict"`, the required status checks are derived from the task manifest — see below. |
|
|
196
|
+
| `repo.properties` | `RepoProperties` | Org-level custom property values synced to the GitHub dashboard. |
|
|
197
|
+
| `repo.variables` | `{ repo?, org?, prune? }` | GitHub Actions variables created and updated by `holocron repo setup`. Undeclared ones are left alone unless `prune` is on. |
|
|
198
|
+
| `repo.secrets` | `{ repo?, org?, environments?, sync? }` | Names of the secrets that must exist, checked (never written) by `holocron doctor secrets`. Names only. The notification layout's secrets and a Chromatic project token are expected without being listed. `sync: [{ environment, keys?, scope? }]` declares the vault environments `secrets sync` fills from (it follows these entries, one step per scope, unless `--github-secret` is given; a blank value is skipped); the doctor expects their keys (every key the `vault` provider lists when `keys` is omitted, names only) at the `scope` (`repo`, `env=<name>`, `org=<name>`). |
|
|
199
199
|
|
|
200
200
|
### Custom properties synced to GitHub
|
|
201
201
|
|
package/dist/cli.mjs
CHANGED
|
@@ -21060,6 +21060,22 @@ const secretsListCommand = {
|
|
|
21060
21060
|
})).failed > 0) process.exitCode = 1;
|
|
21061
21061
|
}
|
|
21062
21062
|
};
|
|
21063
|
+
// src/commands/secrets-sync/secret-routes.ts
|
|
21064
|
+
/**
|
|
21065
|
+
* The routes into `secrets` that `repo.secrets.sync` declares for one vault environment: every entry naming it gives
|
|
21066
|
+
* its keys (all of them when omitted) and the scope they land at (`repo` when omitted). An environment no entry names
|
|
21067
|
+
* has no routes, which leaves `secrets sync` to its own flags.
|
|
21068
|
+
*
|
|
21069
|
+
* @param entries - `repo.secrets.sync`, if the config has it.
|
|
21070
|
+
* @param environmentId - The vault environment being synced.
|
|
21071
|
+
* @throws When an entry's `scope` is not `repo`, `env=<name>` or `org=<name>`.
|
|
21072
|
+
*/
|
|
21073
|
+
function secretRoutes(entries, environmentId) {
|
|
21074
|
+
return (entries ?? []).filter((entry) => entry.environment === environmentId).map((entry) => ({
|
|
21075
|
+
scope: parseScope(entry.scope ?? "repo"),
|
|
21076
|
+
...entry.keys ? { keys: entry.keys } : {}
|
|
21077
|
+
}));
|
|
21078
|
+
}
|
|
21063
21079
|
// src/commands/secrets-sync/secrets-sync.ts
|
|
21064
21080
|
/**
|
|
21065
21081
|
* `holocron secrets sync` — vault → destinations.
|
|
@@ -21088,6 +21104,12 @@ const secretsListCommand = {
|
|
|
21088
21104
|
* CI-consumed, org-wide secret (holocron#781's Sentinel case: 4
|
|
21089
21105
|
* Vercel-only keys + one org-scoped Axiom ingest token
|
|
21090
21106
|
* `theholocron/.github`'s dispatched-check workflow also reads).
|
|
21107
|
+
* - With no `--github-secret`, the routes come from `repo.secrets.sync`: every
|
|
21108
|
+
* entry for this environment gives `secrets` its own keys and scope, one
|
|
21109
|
+
* step per scope, so one environment can fill organization and repository
|
|
21110
|
+
* secrets in one run.
|
|
21111
|
+
* - A key that is blank in the vault is skipped in every destination, and a
|
|
21112
|
+
* listed key the vault does not hold is a skipped row.
|
|
21091
21113
|
*
|
|
21092
21114
|
* The vault MUST implement `readEnvironment(envId)` (optional method).
|
|
21093
21115
|
* If it doesn't, the command errors with a hint to populate the keys
|
|
@@ -21140,15 +21162,18 @@ async function runSecretsSync(input) {
|
|
|
21140
21162
|
const rows = [];
|
|
21141
21163
|
if (loader.has("secrets")) {
|
|
21142
21164
|
const secrets = loader.get("secrets");
|
|
21143
|
-
const
|
|
21144
|
-
|
|
21145
|
-
|
|
21146
|
-
|
|
21147
|
-
|
|
21148
|
-
|
|
21149
|
-
|
|
21150
|
-
|
|
21151
|
-
|
|
21165
|
+
const routes = input.secretRoutes ?? [{
|
|
21166
|
+
scope: input.githubSecretScope ?? { kind: "repo" },
|
|
21167
|
+
...input.githubSecretKeys ? { keys: input.githubSecretKeys } : {}
|
|
21168
|
+
}];
|
|
21169
|
+
for (const route of routes) {
|
|
21170
|
+
print(style.step(routes.length > 1 ? `secrets (${scopeLabel(route.scope)})` : "secrets"));
|
|
21171
|
+
for (const key of route.keys ?? keys) {
|
|
21172
|
+
rows.push(await pushRow(`secrets:${secrets.providerName}`, scopeLabel(route.scope), key, envVars, dryRun, async (value) => {
|
|
21173
|
+
await secrets.setSecret(route.scope, key, value);
|
|
21174
|
+
}));
|
|
21175
|
+
print(formatRow(rows[rows.length - 1]));
|
|
21176
|
+
}
|
|
21152
21177
|
}
|
|
21153
21178
|
}
|
|
21154
21179
|
if (loader.has("deployment")) {
|
|
@@ -21167,8 +21192,8 @@ async function runSecretsSync(input) {
|
|
|
21167
21192
|
} else for (const target of targets) {
|
|
21168
21193
|
print(style.step(`deployment (target=${target})`));
|
|
21169
21194
|
for (const key of keys) {
|
|
21170
|
-
rows.push(await
|
|
21171
|
-
await deploy.setEnvVar(input.projectId, target, key,
|
|
21195
|
+
rows.push(await pushRow(`deployment:${deploy.providerName}`, `target=${target}`, key, envVars, dryRun, async (value) => {
|
|
21196
|
+
await deploy.setEnvVar(input.projectId, target, key, value);
|
|
21172
21197
|
}));
|
|
21173
21198
|
print(formatRow(rows[rows.length - 1]));
|
|
21174
21199
|
}
|
|
@@ -21189,8 +21214,8 @@ async function runSecretsSync(input) {
|
|
|
21189
21214
|
rows.push(row);
|
|
21190
21215
|
print(formatRow(row));
|
|
21191
21216
|
} else for (const key of keys) {
|
|
21192
|
-
rows.push(await
|
|
21193
|
-
await workers.setSecret(script, key,
|
|
21217
|
+
rows.push(await pushRow(`workers:${workers.providerName}`, `script=${script}`, key, envVars, dryRun, async (value) => {
|
|
21218
|
+
await workers.setSecret(script, key, value);
|
|
21194
21219
|
}));
|
|
21195
21220
|
print(formatRow(rows[rows.length - 1]));
|
|
21196
21221
|
}
|
|
@@ -21230,6 +21255,29 @@ function summarise(rows, logger, print, dryRun) {
|
|
|
21230
21255
|
summary
|
|
21231
21256
|
};
|
|
21232
21257
|
}
|
|
21258
|
+
/**
|
|
21259
|
+
* One key to one destination. A key the vault does not hold, or holds blank, is a skipped row: a blank is a placeholder
|
|
21260
|
+
* for a value still to be found, and pushing it would overwrite a working secret with nothing (which no provider can
|
|
21261
|
+
* read back to undo). Everything else goes through {@link runRow}.
|
|
21262
|
+
*/
|
|
21263
|
+
async function pushRow(destination, scope, key, envVars, dryRun, body) {
|
|
21264
|
+
const value = Object.hasOwn(envVars, key) ? envVars[key] : void 0;
|
|
21265
|
+
if (value === void 0) return {
|
|
21266
|
+
destination,
|
|
21267
|
+
scope,
|
|
21268
|
+
key,
|
|
21269
|
+
status: "skip",
|
|
21270
|
+
message: "not in the vault environment"
|
|
21271
|
+
};
|
|
21272
|
+
if (value.trim() === "") return {
|
|
21273
|
+
destination,
|
|
21274
|
+
scope,
|
|
21275
|
+
key,
|
|
21276
|
+
status: "skip",
|
|
21277
|
+
message: "blank in the vault environment"
|
|
21278
|
+
};
|
|
21279
|
+
return runRow(destination, scope, key, dryRun, () => body(value));
|
|
21280
|
+
}
|
|
21233
21281
|
async function runRow(destination, scope, key, dryRun, body) {
|
|
21234
21282
|
if (dryRun) return {
|
|
21235
21283
|
destination,
|
|
@@ -21306,6 +21354,7 @@ const secretsSyncCommand = {
|
|
|
21306
21354
|
const [environmentId] = await promptForPositionals(getEntry("secrets sync"), argv);
|
|
21307
21355
|
const loaded = await loadConfig(argv.cwd);
|
|
21308
21356
|
applyResolvedConfig(argv, loaded.resolved);
|
|
21357
|
+
const routes = argv.githubSecret?.length ? [] : secretRoutes(loaded.resolved.repo?.secrets?.sync, environmentId);
|
|
21309
21358
|
if ((await runSecretsSync({
|
|
21310
21359
|
loaded,
|
|
21311
21360
|
context: {
|
|
@@ -21319,6 +21368,7 @@ const secretsSyncCommand = {
|
|
|
21319
21368
|
...argv.worker ? { workerScript: argv.worker } : {},
|
|
21320
21369
|
...argv.githubSecret?.length ? { githubSecretKeys: argv.githubSecret } : {},
|
|
21321
21370
|
githubSecretScope,
|
|
21371
|
+
...routes.length ? { secretRoutes: routes } : {},
|
|
21322
21372
|
targets: argv.target
|
|
21323
21373
|
})).summary.fail > 0) process.exitCode = 1;
|
|
21324
21374
|
}
|