@theholocron/cli 5.0.0-alpha.206 → 5.0.0-alpha.208
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 +13 -6
- package/dist/cli.mjs.map +1 -1
- package/dist/plugin/capabilities.d.mts +8 -0
- package/package.json +3 -3
package/dist/cli.mjs
CHANGED
|
@@ -4757,7 +4757,8 @@ async function lockConfig(filepath) {
|
|
|
4757
4757
|
* permission, then a retry; and afterwards the link that takes it away, then a check that it really is gone. The
|
|
4758
4758
|
* consent clicks stay theirs; the ordering and the "forgot to take it away" mistake do not.
|
|
4759
4759
|
*
|
|
4760
|
-
*
|
|
4760
|
+
* A permission the bot is meant to keep ({@link ElevationRequiredError} `keep`) is only given: there is no take-away.
|
|
4761
|
+
* Otherwise taking it away is attempted whatever the retry does, and anything that stops it being done or proven is a `todo`
|
|
4761
4762
|
* (reported as a failure) or, when the retry itself failed, a printed failure beside the error.
|
|
4762
4763
|
*
|
|
4763
4764
|
* Without someone to answer (`pause` absent) the error is passed on unchanged, so a script still gets the
|
|
@@ -4769,11 +4770,12 @@ async function withElevation(run, deps) {
|
|
|
4769
4770
|
} catch (err) {
|
|
4770
4771
|
const { notifications, pause, print } = deps;
|
|
4771
4772
|
if (!(err instanceof ElevationRequiredError) || !pause || !err.elevation.grantUrl) throw err;
|
|
4772
|
-
const { permission, grantUrl, revokeUrl, applied } = err.elevation;
|
|
4773
|
+
const { permission, grantUrl, revokeUrl, applied, keep } = err.elevation;
|
|
4774
|
+
const name = err.elevation.label ?? permission;
|
|
4773
4775
|
if (await notifications.holdsPermission?.(permission).catch(() => false)) throw err;
|
|
4774
|
-
print(` ${style.skip(`${deps.label} needs ${
|
|
4776
|
+
print(` ${style.skip(`${deps.label} needs ${name}${keep ? "" : " for this one edit"}`)}`);
|
|
4775
4777
|
print(` 1. approve it: ${grantUrl}`);
|
|
4776
|
-
await pause(`Press Enter once ${
|
|
4778
|
+
await pause(`Press Enter once ${name} is approved to try again`);
|
|
4777
4779
|
let result;
|
|
4778
4780
|
let failure;
|
|
4779
4781
|
try {
|
|
@@ -4782,7 +4784,7 @@ async function withElevation(run, deps) {
|
|
|
4782
4784
|
failure = retryErr;
|
|
4783
4785
|
}
|
|
4784
4786
|
let leftover;
|
|
4785
|
-
if (!revokeUrl) leftover = `no link could be built to take ${permission} away; remove it from ${notifications.providerName}'s role by hand, then run \`holocron doctor notifications\``;
|
|
4787
|
+
if (keep) {} else if (!revokeUrl) leftover = `no link could be built to take ${permission} away; remove it from ${notifications.providerName}'s role by hand, then run \`holocron doctor notifications\``;
|
|
4786
4788
|
else {
|
|
4787
4789
|
print(` 2. take it away again: ${revokeUrl}`);
|
|
4788
4790
|
await pause(`Press Enter once ${permission} is taken away to check it`);
|
|
@@ -5144,7 +5146,12 @@ async function runNotificationsSetup(input$1) {
|
|
|
5144
5146
|
print
|
|
5145
5147
|
}));
|
|
5146
5148
|
await apply("welcome screen", !!layout.welcome, () => notifications.ensureWelcome(layout.welcome));
|
|
5147
|
-
await apply("pinned messages", (layout.pinned?.length ?? 0) > 0, () => notifications.ensurePinned(layout.pinned)
|
|
5149
|
+
await apply("pinned messages", (layout.pinned?.length ?? 0) > 0, () => withElevation(() => notifications.ensurePinned(layout.pinned), {
|
|
5150
|
+
label: "pinned messages",
|
|
5151
|
+
notifications,
|
|
5152
|
+
...pause ? { pause } : {},
|
|
5153
|
+
print
|
|
5154
|
+
}));
|
|
5148
5155
|
await apply("onboarding", !!layout.onboarding, () => notifications.ensureOnboarding(layout.onboarding));
|
|
5149
5156
|
await apply("bot application", !!layout.application, () => notifications.ensureApplication(layout.application));
|
|
5150
5157
|
}
|