@theholocron/cli 5.0.0-alpha.433 → 5.0.0-alpha.435
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/dist/cli.mjs +73 -26
- package/dist/cli.mjs.map +1 -1
- package/dist/{index-BFrWaQ3Y.d.mts → index-CyVE6Imb.d.mts} +5 -0
- package/dist/index.d.mts +33 -2
- package/dist/index.mjs +88 -2
- package/dist/plugin/capabilities.d.mts +1 -1
- package/dist/presets.d.mts +1 -1
- package/package.json +9 -9
package/dist/cli.mjs
CHANGED
|
@@ -11715,7 +11715,7 @@ async function credentialsRows(input) {
|
|
|
11715
11715
|
repoRoot: input.context.repoRoot,
|
|
11716
11716
|
env: { HOLOCRON_ENVIRONMENT: "local" },
|
|
11717
11717
|
...input.gitExec ? { gitExec: input.gitExec } : {}
|
|
11718
|
-
}), expected);
|
|
11718
|
+
}), expected, variableKeys(resolved));
|
|
11719
11719
|
rows.push(...checked.rows);
|
|
11720
11720
|
places.push(...checked.places);
|
|
11721
11721
|
} catch (err) {
|
|
@@ -11732,7 +11732,7 @@ async function credentialsRows(input) {
|
|
|
11732
11732
|
* Environment found holds it (the first found wins, as in the credential store). A required Environment that does not
|
|
11733
11733
|
* exist is a failing row of its own, by name, and an unreadable place for the matrix; a missing `- local` is not mentioned.
|
|
11734
11734
|
*/
|
|
11735
|
-
async function checkProvider(impl, candidates, expected) {
|
|
11735
|
+
async function checkProvider(impl, candidates, expected, synced) {
|
|
11736
11736
|
const provider = impl.providerName;
|
|
11737
11737
|
if (!impl.inspect) return {
|
|
11738
11738
|
rows: [row$5(provider, "skip", "cannot list the variables without reading their values")],
|
|
@@ -11775,20 +11775,33 @@ async function checkProvider(impl, candidates, expected) {
|
|
|
11775
11775
|
const places = [];
|
|
11776
11776
|
const missingRequired = expected.filter((e) => !e.optional && !have(e.name)).map((e) => e.name);
|
|
11777
11777
|
found.forEach(({ name, result }, index) => {
|
|
11778
|
+
const column = {
|
|
11779
|
+
id: `vault:${name}`,
|
|
11780
|
+
group,
|
|
11781
|
+
label: labelOf(name),
|
|
11782
|
+
env: layerFor(name),
|
|
11783
|
+
reportedElsewhere: true,
|
|
11784
|
+
unreadReported: true
|
|
11785
|
+
};
|
|
11786
|
+
const visible = result.visible === void 0 ? void 0 : new Set(result.visible);
|
|
11787
|
+
const secretNames = visible ? result.names.filter((n) => !visible.has(n)) : result.names;
|
|
11778
11788
|
places.push({
|
|
11779
|
-
column
|
|
11780
|
-
id: `vault:${name}`,
|
|
11781
|
-
group,
|
|
11782
|
-
label: labelOf(name),
|
|
11783
|
-
env: layerFor(name),
|
|
11784
|
-
reportedElsewhere: true,
|
|
11785
|
-
unreadReported: true
|
|
11786
|
-
},
|
|
11789
|
+
column,
|
|
11787
11790
|
kind: "secret",
|
|
11788
|
-
needed: [...
|
|
11789
|
-
present:
|
|
11791
|
+
needed: [...secretNames.filter((n) => names.has(n)), ...index === found.length - 1 ? missingRequired : []],
|
|
11792
|
+
present: secretNames,
|
|
11790
11793
|
reasons: Object.fromEntries(expected.map((e) => [e.name.toUpperCase(), `a token the configured plugins take${e.optional ? " (optional)" : ""}`]))
|
|
11791
11794
|
});
|
|
11795
|
+
if (visible) {
|
|
11796
|
+
const wanted = column.env === "dev" ? synced : [];
|
|
11797
|
+
places.push({
|
|
11798
|
+
column,
|
|
11799
|
+
kind: "variable",
|
|
11800
|
+
needed: wanted,
|
|
11801
|
+
present: result.names.filter((n) => visible.has(n)),
|
|
11802
|
+
reasons: Object.fromEntries(wanted.map((n) => [n.toUpperCase(), "a variable repo.variables.sync writes to GitHub; dev holds its own copy"]))
|
|
11803
|
+
});
|
|
11804
|
+
}
|
|
11792
11805
|
});
|
|
11793
11806
|
return {
|
|
11794
11807
|
rows,
|
|
@@ -11805,6 +11818,10 @@ async function checkProvider(impl, candidates, expected) {
|
|
|
11805
11818
|
function layerFor(name) {
|
|
11806
11819
|
return layerOf(name, "local") === "dev" ? "dev" : "local";
|
|
11807
11820
|
}
|
|
11821
|
+
/** The names `repo.variables.sync` writes as variables, in any scope, without repeats. */
|
|
11822
|
+
function variableKeys(resolved) {
|
|
11823
|
+
return [...new Set((resolved.repo?.variables?.sync ?? []).flatMap((entry) => entry.keys))];
|
|
11824
|
+
}
|
|
11808
11825
|
// src/commands/secrets-sync/deploy-filter/deploy-filter.ts
|
|
11809
11826
|
/**
|
|
11810
11827
|
* What `repo.secrets.deploy` lets one vault environment send to a deployment or a Worker: every entry naming it adds
|
|
@@ -12242,7 +12259,7 @@ function namesWith(place, cell, manual) {
|
|
|
12242
12259
|
/**
|
|
12243
12260
|
* The rows the matrix adds to `doctor secrets`, from the places it was built from:
|
|
12244
12261
|
*
|
|
12245
|
-
* - `extra` names are
|
|
12262
|
+
* - `extra` names are in the matrix and make no row, except with `strict`, where each place that has some fails.
|
|
12246
12263
|
* - `MISSING` names fail, one row per place, except in a place another check already reports on (GitHub).
|
|
12247
12264
|
* - A place that could not be read is a skipped row that names it and why, again except where another check says so.
|
|
12248
12265
|
*
|
|
@@ -12274,20 +12291,37 @@ function matrixRows(matrix, manual, strict) {
|
|
|
12274
12291
|
detail: `${missing.length} problem(s)`,
|
|
12275
12292
|
problems: missing.map((name) => `missing ${place.kind} ${name}`)
|
|
12276
12293
|
});
|
|
12277
|
-
const extra = namesWith(place, "extra", skip);
|
|
12278
|
-
if (extra.length > 0) {
|
|
12279
|
-
|
|
12280
|
-
|
|
12281
|
-
|
|
12282
|
-
|
|
12283
|
-
|
|
12284
|
-
|
|
12285
|
-
problems: []
|
|
12286
|
-
});
|
|
12287
|
-
}
|
|
12294
|
+
const extra = strict ? namesWith(place, "extra", skip) : [];
|
|
12295
|
+
if (extra.length > 0) rows.push({
|
|
12296
|
+
id: `extra:${id}`,
|
|
12297
|
+
title,
|
|
12298
|
+
status: "fail",
|
|
12299
|
+
detail: `${extra.length} extra in ${where(place)}, nothing feeds ${extra.length === 1 ? "it" : "them"}: ${extra.join(", ")}`,
|
|
12300
|
+
problems: []
|
|
12301
|
+
});
|
|
12288
12302
|
}
|
|
12289
12303
|
return rows;
|
|
12290
12304
|
}
|
|
12305
|
+
// src/commands/doctor-secrets/matrix-summary.ts
|
|
12306
|
+
/**
|
|
12307
|
+
* The line under the table: how many names it lists and how its cells came out, in the words of the legend, so it
|
|
12308
|
+
* counts what the reader sees and not the rows below. `n/a` is not counted; `?` is shown only when a place could not be
|
|
12309
|
+
* read. Checks that failed (the rows with a ✗, for what the table does not show) are added at the end.
|
|
12310
|
+
*
|
|
12311
|
+
* @param matrix - The matrix that was printed.
|
|
12312
|
+
* @param failed - How many rows failed.
|
|
12313
|
+
*/
|
|
12314
|
+
function matrixSummary(matrix, failed) {
|
|
12315
|
+
const rows = [...matrix.secrets, ...matrix.variables];
|
|
12316
|
+
const names = new Set(rows.map((row) => row.name.toUpperCase())).size;
|
|
12317
|
+
const count = (cell) => rows.reduce((total, row) => total + Object.values(row.cells).filter((c) => c === cell).length, 0);
|
|
12318
|
+
const unread = count("?");
|
|
12319
|
+
return [
|
|
12320
|
+
`${names} ${names === 1 ? "name" : "names"}: ${count("ok")} ok, ${count("MISSING")} MISSING, ${count("extra")} extra`,
|
|
12321
|
+
...unread > 0 ? [`, ${unread} not read`] : [],
|
|
12322
|
+
...failed > 0 ? [`; ${failed} ${failed === 1 ? "check" : "checks"} failed`] : []
|
|
12323
|
+
].join("");
|
|
12324
|
+
}
|
|
12291
12325
|
// src/commands/doctor-secrets/memo-vault.ts
|
|
12292
12326
|
/**
|
|
12293
12327
|
* A vault that reads each Environment once. `doctor secrets` asks about the same Environment for several rows and for
|
|
@@ -13018,7 +13052,10 @@ async function runDoctorSecrets(input) {
|
|
|
13018
13052
|
printCheckRows(rows, print);
|
|
13019
13053
|
for (const note of notes) print(note);
|
|
13020
13054
|
const summary = summariseChecks(rows);
|
|
13021
|
-
|
|
13055
|
+
if (matrix && matrix.places.length > 0) {
|
|
13056
|
+
print("");
|
|
13057
|
+
print(style.header(matrixSummary(matrix, summary.fail)));
|
|
13058
|
+
} else printCheckSummary(summary, print);
|
|
13022
13059
|
const status = summary.fail > 0 ? "fail" : summary.ok === 0 ? "skip" : "ok";
|
|
13023
13060
|
logger.info({
|
|
13024
13061
|
...summary,
|
|
@@ -20040,6 +20077,12 @@ function ownerEnvironments(config) {
|
|
|
20040
20077
|
instances
|
|
20041
20078
|
};
|
|
20042
20079
|
}
|
|
20080
|
+
// src/commands/token-rotation/token-rotation.ts
|
|
20081
|
+
/** The rotation policy of a token that declares none: a token is due after 90 days, and an expiry is flagged 14 days ahead. */
|
|
20082
|
+
const DEFAULT_TOKEN_ROTATION = {
|
|
20083
|
+
maxAgeDays: 90,
|
|
20084
|
+
warnDays: 14
|
|
20085
|
+
};
|
|
20043
20086
|
// src/commands/token-expectations/token-expectations.ts
|
|
20044
20087
|
/**
|
|
20045
20088
|
* Reads what a plugin's tokens declare (`PluginToken.expect`) as one entry per token and layer that holds it, in the
|
|
@@ -20061,7 +20104,11 @@ function tokenExpectations(tokens, filter = {}) {
|
|
|
20061
20104
|
layer,
|
|
20062
20105
|
rules: rules ?? {},
|
|
20063
20106
|
required: entries.filter(([, rule]) => rule === "required").map(([name]) => name),
|
|
20064
|
-
absent: entries.filter(([, rule]) => rule === "absent").map(([name]) => name)
|
|
20107
|
+
absent: entries.filter(([, rule]) => rule === "absent").map(([name]) => name),
|
|
20108
|
+
rotation: {
|
|
20109
|
+
...DEFAULT_TOKEN_ROTATION,
|
|
20110
|
+
...token.expect.rotation
|
|
20111
|
+
}
|
|
20065
20112
|
});
|
|
20066
20113
|
}
|
|
20067
20114
|
}
|