@theholocron/cli 5.0.0-alpha.221 → 5.0.0-alpha.222
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 +29 -2
- package/dist/cli.mjs.map +1 -1
- package/package.json +3 -3
package/dist/cli.mjs
CHANGED
|
@@ -7771,6 +7771,12 @@ function describeScope(scope) {
|
|
|
7771
7771
|
* If it doesn't, the command errors with a hint to populate the keys
|
|
7772
7772
|
* individually via `holocron secrets set` (also planned for v5.1).
|
|
7773
7773
|
*/
|
|
7774
|
+
/** Why there is no `workers` provider: the plugin's own load error when it failed to load (e.g. a missing account id). */
|
|
7775
|
+
function workersMissing(loader) {
|
|
7776
|
+
const base = "--worker needs a `workers` provider in holocron.config.ts";
|
|
7777
|
+
const failure = loader.loadFailures().find((f) => f.key === "workers");
|
|
7778
|
+
return failure ? `${base} (\`${failure.provider}\` failed to load: ${describeProviderError(failure.error)})` : base;
|
|
7779
|
+
}
|
|
7774
7780
|
async function runSecretsSync(input) {
|
|
7775
7781
|
const print = input.print ?? ((line) => console.log(line));
|
|
7776
7782
|
const logger = input.logger ?? getLogger();
|
|
@@ -7788,7 +7794,24 @@ async function runSecretsSync(input) {
|
|
|
7788
7794
|
print("");
|
|
7789
7795
|
const vault = loader.get("vault");
|
|
7790
7796
|
if (!vault.readEnvironment) throw new Error(`vault provider (${vault.providerName}) does not implement readEnvironment — sync needs bulk env reads`);
|
|
7791
|
-
|
|
7797
|
+
let envVars;
|
|
7798
|
+
try {
|
|
7799
|
+
envVars = await withSpinner(`Reading vault environment ${input.environmentId}…`, () => vault.readEnvironment(input.environmentId));
|
|
7800
|
+
} catch (err) {
|
|
7801
|
+
const message = describeProviderError(err);
|
|
7802
|
+
print(` ${style.fail(`could not read vault environment ${input.environmentId}: ${message}`)}`);
|
|
7803
|
+
logger.warn({
|
|
7804
|
+
environment: input.environmentId,
|
|
7805
|
+
reason: logReason(err)
|
|
7806
|
+
}, "secrets sync: vault read failed");
|
|
7807
|
+
return summarise([{
|
|
7808
|
+
destination: `vault:${vault.providerName}`,
|
|
7809
|
+
scope: `environment=${input.environmentId}`,
|
|
7810
|
+
key: "(all)",
|
|
7811
|
+
status: "fail",
|
|
7812
|
+
message
|
|
7813
|
+
}], logger, print, dryRun);
|
|
7814
|
+
}
|
|
7792
7815
|
const keys = Object.keys(envVars).sort();
|
|
7793
7816
|
print(style.step(`read ${keys.length} keys from vault`));
|
|
7794
7817
|
print("");
|
|
@@ -7839,7 +7862,7 @@ async function runSecretsSync(input) {
|
|
|
7839
7862
|
scope: `script=${script}`,
|
|
7840
7863
|
key: "(all)",
|
|
7841
7864
|
status: "fail",
|
|
7842
|
-
message: workers ? `workers provider (${workers.providerName}) cannot set secrets` :
|
|
7865
|
+
message: workers ? `workers provider (${workers.providerName}) cannot set secrets` : workersMissing(loader)
|
|
7843
7866
|
};
|
|
7844
7867
|
rows.push(row);
|
|
7845
7868
|
print(formatRow(row));
|
|
@@ -7850,6 +7873,10 @@ async function runSecretsSync(input) {
|
|
|
7850
7873
|
print(formatRow(rows[rows.length - 1]));
|
|
7851
7874
|
}
|
|
7852
7875
|
}
|
|
7876
|
+
return summarise(rows, logger, print, dryRun);
|
|
7877
|
+
}
|
|
7878
|
+
/** Log every row, then print and log the summary. Shared by a finished run and one that stopped at the vault. */
|
|
7879
|
+
function summarise(rows, logger, print, dryRun) {
|
|
7853
7880
|
for (const r of rows) logger[r.status === "fail" ? "warn" : "info"]({
|
|
7854
7881
|
destination: r.destination,
|
|
7855
7882
|
scope: r.scope,
|