@theholocron/cli 5.0.0-alpha.433 → 5.0.0-alpha.434
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 +35 -2
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +32 -1
- package/dist/index.mjs +88 -2
- package/package.json +9 -9
package/dist/cli.mjs
CHANGED
|
@@ -12288,6 +12288,26 @@ function matrixRows(matrix, manual, strict) {
|
|
|
12288
12288
|
}
|
|
12289
12289
|
return rows;
|
|
12290
12290
|
}
|
|
12291
|
+
// src/commands/doctor-secrets/matrix-summary.ts
|
|
12292
|
+
/**
|
|
12293
|
+
* The line under the table: how many names it lists and how its cells came out, in the words of the legend, so it
|
|
12294
|
+
* counts what the reader sees and not the rows below. `n/a` is not counted; `?` is shown only when a place could not be
|
|
12295
|
+
* read. Checks that failed (the rows with a ✗, for what the table does not show) are added at the end.
|
|
12296
|
+
*
|
|
12297
|
+
* @param matrix - The matrix that was printed.
|
|
12298
|
+
* @param failed - How many rows failed.
|
|
12299
|
+
*/
|
|
12300
|
+
function matrixSummary(matrix, failed) {
|
|
12301
|
+
const rows = [...matrix.secrets, ...matrix.variables];
|
|
12302
|
+
const names = new Set(rows.map((row) => row.name.toUpperCase())).size;
|
|
12303
|
+
const count = (cell) => rows.reduce((total, row) => total + Object.values(row.cells).filter((c) => c === cell).length, 0);
|
|
12304
|
+
const unread = count("?");
|
|
12305
|
+
return [
|
|
12306
|
+
`${names} ${names === 1 ? "name" : "names"}: ${count("ok")} ok, ${count("MISSING")} MISSING, ${count("extra")} extra`,
|
|
12307
|
+
...unread > 0 ? [`, ${unread} not read`] : [],
|
|
12308
|
+
...failed > 0 ? [`; ${failed} ${failed === 1 ? "check" : "checks"} failed`] : []
|
|
12309
|
+
].join("");
|
|
12310
|
+
}
|
|
12291
12311
|
// src/commands/doctor-secrets/memo-vault.ts
|
|
12292
12312
|
/**
|
|
12293
12313
|
* A vault that reads each Environment once. `doctor secrets` asks about the same Environment for several rows and for
|
|
@@ -13018,7 +13038,10 @@ async function runDoctorSecrets(input) {
|
|
|
13018
13038
|
printCheckRows(rows, print);
|
|
13019
13039
|
for (const note of notes) print(note);
|
|
13020
13040
|
const summary = summariseChecks(rows);
|
|
13021
|
-
|
|
13041
|
+
if (matrix && matrix.places.length > 0) {
|
|
13042
|
+
print("");
|
|
13043
|
+
print(style.header(matrixSummary(matrix, summary.fail)));
|
|
13044
|
+
} else printCheckSummary(summary, print);
|
|
13022
13045
|
const status = summary.fail > 0 ? "fail" : summary.ok === 0 ? "skip" : "ok";
|
|
13023
13046
|
logger.info({
|
|
13024
13047
|
...summary,
|
|
@@ -20040,6 +20063,12 @@ function ownerEnvironments(config) {
|
|
|
20040
20063
|
instances
|
|
20041
20064
|
};
|
|
20042
20065
|
}
|
|
20066
|
+
// src/commands/token-rotation/token-rotation.ts
|
|
20067
|
+
/** The rotation policy of a token that declares none: a token is due after 90 days, and an expiry is flagged 14 days ahead. */
|
|
20068
|
+
const DEFAULT_TOKEN_ROTATION = {
|
|
20069
|
+
maxAgeDays: 90,
|
|
20070
|
+
warnDays: 14
|
|
20071
|
+
};
|
|
20043
20072
|
// src/commands/token-expectations/token-expectations.ts
|
|
20044
20073
|
/**
|
|
20045
20074
|
* Reads what a plugin's tokens declare (`PluginToken.expect`) as one entry per token and layer that holds it, in the
|
|
@@ -20061,7 +20090,11 @@ function tokenExpectations(tokens, filter = {}) {
|
|
|
20061
20090
|
layer,
|
|
20062
20091
|
rules: rules ?? {},
|
|
20063
20092
|
required: entries.filter(([, rule]) => rule === "required").map(([name]) => name),
|
|
20064
|
-
absent: entries.filter(([, rule]) => rule === "absent").map(([name]) => name)
|
|
20093
|
+
absent: entries.filter(([, rule]) => rule === "absent").map(([name]) => name),
|
|
20094
|
+
rotation: {
|
|
20095
|
+
...DEFAULT_TOKEN_ROTATION,
|
|
20096
|
+
...token.expect.rotation
|
|
20097
|
+
}
|
|
20065
20098
|
});
|
|
20066
20099
|
}
|
|
20067
20100
|
}
|