braeburn 1.1.0 → 1.2.0

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.
@@ -5,7 +5,8 @@ import { captureYesNo } from "../ui/prompt.js";
5
5
  import { createInitialAppState } from "../ui/state.js";
6
6
  import { buildScreen, renderScreen } from "../ui/screen.js";
7
7
  export async function runUpdateCommand(options) {
8
- const { steps, autoYes, version } = options;
8
+ const { steps, version } = options;
9
+ let autoYes = options.autoYes;
9
10
  const state = createInitialAppState(steps, version);
10
11
  process.stdout.write("\x1b[?25l");
11
12
  process.on("exit", () => process.stdout.write("\x1b[?25h"));
@@ -34,7 +35,10 @@ export async function runUpdateCommand(options) {
34
35
  question: `Install ${step.name} via Homebrew? (brew install ${step.brewPackageToInstall})`,
35
36
  };
36
37
  renderScreen(buildScreen(state));
37
- const shouldInstall = autoYes || (await captureYesNo());
38
+ const installAnswer = autoYes ? "yes" : await captureYesNo();
39
+ if (installAnswer === "force")
40
+ autoYes = true;
41
+ const shouldInstall = installAnswer !== "no";
38
42
  state.currentPrompt = undefined;
39
43
  if (!shouldInstall) {
40
44
  state.currentPhase = "skipped";
@@ -68,7 +72,10 @@ export async function runUpdateCommand(options) {
68
72
  state.currentPhase = "prompting-to-run";
69
73
  state.currentPrompt = { question: `Run ${step.name} update?`, warning: pipWarning };
70
74
  renderScreen(buildScreen(state));
71
- const shouldRun = autoYes || (await captureYesNo());
75
+ const runAnswer = autoYes ? "yes" : await captureYesNo();
76
+ if (runAnswer === "force")
77
+ autoYes = true;
78
+ const shouldRun = runAnswer !== "no";
72
79
  state.currentPrompt = undefined;
73
80
  if (!shouldRun) {
74
81
  state.currentPhase = "skipped";
@@ -1,3 +1,4 @@
1
1
  import type { CurrentPrompt } from "./state.js";
2
- export declare function captureYesNo(): Promise<boolean>;
2
+ export type YesNoForceAnswer = "yes" | "no" | "force";
3
+ export declare function captureYesNo(): Promise<YesNoForceAnswer>;
3
4
  export declare function buildPromptLines(prompt: CurrentPrompt): string[];
package/dist/ui/prompt.js CHANGED
@@ -13,14 +13,20 @@ export function captureYesNo() {
13
13
  }
14
14
  const isConfirm = character === "y" || character === "Y" || key?.name === "return";
15
15
  const isDecline = character === "n" || character === "N";
16
- if (!isConfirm && !isDecline)
16
+ const isForce = character === "f" || character === "F";
17
+ if (!isConfirm && !isDecline && !isForce)
17
18
  return;
18
19
  process.stdin.removeListener("keypress", handleKeypress);
19
20
  if (process.stdin.isTTY) {
20
21
  process.stdin.setRawMode(false);
21
22
  }
22
23
  process.stdin.pause();
23
- resolve(isConfirm);
24
+ if (isForce)
25
+ resolve("force");
26
+ else if (isConfirm)
27
+ resolve("yes");
28
+ else
29
+ resolve("no");
24
30
  };
25
31
  process.stdin.on("keypress", handleKeypress);
26
32
  process.stdin.resume();
@@ -32,6 +38,6 @@ export function buildPromptLines(prompt) {
32
38
  lines.push(` ${chalk.yellow("⚠")} ${chalk.yellow(prompt.warning)}`);
33
39
  lines.push("");
34
40
  }
35
- lines.push(` ${chalk.cyan("?")} ${prompt.question} ${chalk.dim("[Y/n]")}`);
41
+ lines.push(` ${chalk.cyan("?")} ${prompt.question} ${chalk.dim("[Y/n/f]")}`);
36
42
  return lines;
37
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "braeburn",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "macOS system updater CLI",
5
5
  "type": "module",
6
6
  "bin": {