You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1effbca
Browse filesBrowse the repository at this point in the historyBrowse files
Install changes `package.json` and the lockfile, and a dev server can be reachable from other devices. So each install that the panel asks for needs the developer's permission. By default, the onboarding asks in the terminal that runs the dev server:
47
47
48
48
1. The user clicks Install. The panel shows "Confirm in your terminal..." and its request waits.
49
-
2. The terminal prints [DF9005](/errors/DF9005). The developer types `y` and presses Enter to allow the install. Any other answer refuses it.
49
+
2. The terminal prints [DF9005](/errors/DF9005). The developer types `y` and presses Enter within 5 minutes to allow the install. Any other answer refuses it. No answer in that time also refuses it ([DF9008](/errors/DF9008)).
50
50
3. The install runs. After a refusal, the panel says that the dev server did not allow the install.
51
51
52
-
When stdin is not a TTY (CI, a detached container, a task runner that pipes stdin), nobody can answer. The onboarding then refuses at once with [DF9006](/errors/DF9006). Only one question is open at a time: more clicks while it is open share its answer. A `POST` from another origin is refused with `403` before any question.
52
+
Only one question is open at a time: more clicks while it is open share its answer. A `POST` from another origin is refused with `403` before any question.
53
53
54
-
To ask in another way, pass `onConfirm`. It gets the `packages`, the exact `command`, and the panel's `request`, and returns `true` to allow the install. For example, a Nuxt module can ask through `consola`:
54
+
The default question needs a terminal that the dev server process reads line by line, as under `vite`. When nobody can answer, the onboarding refuses at once. It reports [DF9006](/errors/DF9006) when stdin is not a TTY, for example in CI, in a detached container, or under a task runner that pipes stdin. It reports [DF9007](/errors/DF9007) when another program holds stdin in raw mode to read single-key shortcuts. That program also captures the log, so the question does not show.
55
+
56
+
A CLI that owns the terminal takes the answer away from the dev server. `nuxi dev` is one: its interactive interface holds stdin in raw mode, it runs the dev server in a child process without stdin after a restart, and in plain mode it reads each line for its own shortcuts. A host that runs under such a CLI must pass `onConfirm` and ask through that CLI.
57
+
58
+
To ask in another way, pass `onConfirm`. It gets the `packages`, the exact `command`, and the panel's `request`, and returns `true` to allow the install. For example, a host that owns its terminal can ask through `consola`:
55
59
56
60
```ts
57
61
import { consola } from'consola'
@@ -131,7 +135,7 @@ function hubOnboarding(): Plugin {
131
135
132
136
### Nuxt
133
137
134
-
Nuxt runs Vite, so a module reuses the plugin above and adds the tag to `app.head`. Gate it on the dev server, and skip it when the user set your own devtools option.
138
+
Nuxt runs Vite, so a module reuses the plugin above and adds the tag to `app.head`. Gate it on the dev server, and skip it when the user set your own devtools option. The developer cannot answer the default terminal question under `nuxi dev`, so the module must pass its own `onConfirm`.
@@ -207,4 +211,4 @@ Frameworks with a `Request => Response` surface (Hono, Nitro, Deno) mount `onboa
207
211
208
212
## Errors
209
213
210
-
The Node side reports through `DF9000` to `DF9006`. An install failure or a throwing `onInstalled` also reaches the panel as `{ state: 'error', error: { code, message } }`, with a Retry button. See the [error reference](/errors).
214
+
The Node side reports through `DF9000` to `DF9008`. An install failure or a throwing `onInstalled` also reaches the panel as `{ state: 'error', error: { code, message } }`, with a Retry button. See the [error reference](/errors).
Copy file name to clipboardExpand all lines: docs/content/6.errors/DF9005.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,19 @@
1
1
---
2
2
title: 'DF9005: Confirm the Install'
3
-
description: 'A browser asked to run `{command}`. Type y and press Enter to allow it.'
3
+
description: 'A browser asked to run `{command}`. Type y and press Enter within {minutes} minutes to allow it.'
4
4
---
5
5
6
6
## Message
7
7
8
-
> A browser asked to run `{command}`. Type y and press Enter to allow it.
8
+
> A browser asked to run `{command}`. Type y and press Enter within `{minutes}` minutes to allow it.
9
9
10
10
## Cause
11
11
12
12
Install changes `package.json` and the lockfile, and a dev server can be reachable from other devices. So each install that the panel asks for needs the developer's permission. The panel's `POST <base>__onboard/install` waits until you answer. Without an `onConfirm` option, `createOnboarding()` asks in the terminal that runs the dev server.
13
13
14
14
## Fix
15
15
16
-
If you clicked Install, type `y` and press Enter. Any other answer refuses the install, and the panel tells the user. If you did not click Install, press Enter. Another device or page can reach this dev server, so bind it to `localhost`.
16
+
If you clicked Install, type `y` and press Enter within 5 minutes. Any other answer refuses the install, and the panel tells the user. Without an answer in that time, the install is refused with [DF9008](/errors/DF9008). If you did not click Install, press Enter. Another device or page can reach this dev server, so bind it to `localhost`.
17
17
18
18
To ask in another way, for example with your own logger, pass an `onConfirm` function to `createOnboarding()`.
Copy file name to clipboardExpand all lines: docs/content/6.errors/DF9006.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ description: 'A browser asked to run `{command}`, but no interactive terminal ca
9
9
10
10
## Cause
11
11
12
-
Each install that the panel asks for needs the developer's permission ([DF9005](/errors/DF9005)). Without an `onConfirm` option, `createOnboarding()` asks in the terminal. Here stdin is not a TTY, so nobody can answer. This happens in CI, in a detached container, or when a task runner pipes stdin. The install is refused at once, and the panel tells the user.
12
+
Each install that the panel asks for needs the developer's permission ([DF9005](/errors/DF9005)). Without an `onConfirm` option, `createOnboarding()` asks in the terminal. Here stdin is not a TTY, so nobody can answer. This happens in CI, in a detached container, when a task runner pipes stdin, or when a CLI starts the dev server in a child process without stdin. `nuxi dev` in its interactive interface does this after each restart. The install is refused at once, and the panel tells the user.
description: 'A browser asked to run `{command}`, but another program reads this terminal key by key, so it cannot show the question. The install was refused.'
4
+
---
5
+
6
+
## Message
7
+
8
+
> A browser asked to run `{command}`, but another program reads this terminal key by key, so it cannot show the question. The install was refused.
9
+
10
+
## Cause
11
+
12
+
Each install that the panel asks for needs the developer's permission ([DF9005](/errors/DF9005)). Without an `onConfirm` option, `createOnboarding()` asks in the terminal. Here stdin is in raw mode, so another program in the same process reads each key as it is typed. A full-screen CLI does this for its single-key shortcuts. The CLI also captures the log, so the question does not show, and the next key would answer it. The install is refused at once, and the panel tells the user.
13
+
14
+
The Nuxt CLI (`nuxi dev`) does this in its interactive interface, the default in a terminal of at least 40 by 10 characters.
15
+
16
+
## Fix
17
+
18
+
Run the command from the panel in a terminal yourself. If you maintain the host, pass an `onConfirm` function to `createOnboarding()` that asks through the CLI that owns the terminal.
19
+
20
+
## Source
21
+
22
+
-[`packages/hub-ui-onboard/src/terminal-confirm.ts`](https://github.com/devframes/devframe/blob/main/packages/hub-ui-onboard/src/terminal-confirm.ts): `confirmInTerminal()` reports this and returns `false` when stdin is a TTY in raw mode.
title: 'DF9008: No Answer to the Install Question'
3
+
description: 'Nobody allowed `{command}` within {minutes} minutes. The install was refused.'
4
+
---
5
+
6
+
## Message
7
+
8
+
> Nobody allowed `{command}` within `{minutes}` minutes. The install was refused.
9
+
10
+
## Cause
11
+
12
+
Each install that the panel asks for needs the developer's permission ([DF9005](/errors/DF9005)). Without an `onConfirm` option, `createOnboarding()` asks in the terminal and waits 5 minutes for an answer. Nobody answered in that time, so the install is refused, and the panel tells the user.
13
+
14
+
Sometimes the answer cannot arrive. Another process can read the same terminal before the dev server does. For example, `nuxi dev` in plain mode moves the dev server to a child process after a restart, and the parent process reads each line for its own shortcuts.
15
+
16
+
## Fix
17
+
18
+
Click Install again, then type `y` and press Enter in the terminal that runs the dev server. If the answer still does not arrive, run the command from the panel in a terminal yourself. If you maintain the host, pass an `onConfirm` function to `createOnboarding()` that asks through the CLI that owns the terminal.
19
+
20
+
## Source
21
+
22
+
-[`packages/hub-ui-onboard/src/terminal-confirm.ts`](https://github.com/devframes/devframe/blob/main/packages/hub-ui-onboard/src/terminal-confirm.ts): `confirmInTerminal()` reports this and returns `false` when no line arrives in time.
Copy file name to clipboardExpand all lines: docs/content/8.references/6.hub-api.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,7 +98,7 @@ What `createOnboarding()` from `@devframes/hub-ui-onboard` accepts and serves: [
98
98
|`branding`|`{}`|`productName` (default `Devframes`), `logo` (URL or `{ light, dark }`), `primaryColor`|
99
99
|`messages`| derived from `productName`| Overrides for `title`, `description`, `install`, `confirming`, `refused`, `hide`, `disable`, `installing`, `restart`, `retry`|
100
100
|`onInstalled`| none | Runs after a verified install, or on the first request when the packages already exist; a returned handler takes over `base`|
101
-
|`onConfirm`|`y/N` in the terminal | Gets `{ packages, command, request }` before each install the panel asks for; return `true` to allow it. Refuses when stdin is not a TTY |
101
+
|`onConfirm`|`y/N` in the terminal | Gets `{ packages, command, request }` before each install the panel asks for; return `true` to allow it. Refuses at once when stdin is not a TTY or is in raw mode, and after 5 minutes without an answer|
fix: 'Make sure that `stateDir` is writable, or point it at another directory.',
31
31
},
32
32
DF9005: {
33
-
why: (p: {command: string})=>`A browser asked to run \`${p.command}\`. Type y and press Enter to allow it.`,
33
+
why: (p: {command: string,minutes: number})=>`A browser asked to run \`${p.command}\`. Type y and press Enter within ${p.minutes} minutes to allow it.`,
34
34
fix: 'If you did not click Install, press Enter to refuse. Another device can reach this dev server, so bind it to localhost.',
35
35
},
36
36
DF9006: {
37
37
why: (p: {command: string})=>`A browser asked to run \`${p.command}\`, but no interactive terminal can confirm it. The install was refused.`,
38
38
fix: 'Run the command yourself, or pass an `onConfirm` function to `createOnboarding()`.',
39
39
},
40
+
DF9007: {
41
+
why: (p: {command: string})=>`A browser asked to run \`${p.command}\`, but another program reads this terminal key by key, so it cannot show the question. The install was refused.`,
42
+
fix: 'Run the command yourself. If a CLI owns the terminal, pass an `onConfirm` function to `createOnboarding()` that asks through that CLI.',
43
+
},
44
+
DF9008: {
45
+
why: (p: {command: string,minutes: number})=>`Nobody allowed \`${p.command}\` within ${p.minutes} minutes. The install was refused.`,
46
+
fix: 'Click Install again and answer in the terminal that runs the dev server. If the answer does not arrive, another program reads that terminal: pass an `onConfirm` function to `createOnboarding()`.',
0 commit comments