@lunora/cli 1.0.0-alpha.8 → 1.0.0-alpha.80
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/LICENSE.md +6 -0
- package/__assets__/package-og.svg +1 -1
- package/dist/bin.mjs +1 -1
- package/dist/index.d.mts +290 -117
- package/dist/index.d.ts +290 -117
- package/dist/index.mjs +8 -8
- package/dist/packem_chunks/handler.mjs +87 -6
- package/dist/packem_chunks/handler10.mjs +8 -14
- package/dist/packem_chunks/handler11.mjs +19 -189
- package/dist/packem_chunks/handler12.mjs +176 -115
- package/dist/packem_chunks/handler13.mjs +118 -52
- package/dist/packem_chunks/handler14.mjs +50 -43
- package/dist/packem_chunks/handler15.mjs +48 -67
- package/dist/packem_chunks/handler16.mjs +85 -37
- package/dist/packem_chunks/handler17.mjs +39 -100
- package/dist/packem_chunks/handler18.mjs +87 -152
- package/dist/packem_chunks/handler19.mjs +148 -67
- package/dist/packem_chunks/handler2.mjs +6 -4
- package/dist/packem_chunks/handler20.mjs +77 -75
- package/dist/packem_chunks/handler21.mjs +71 -288
- package/dist/packem_chunks/handler3.mjs +6 -3
- package/dist/packem_chunks/handler4.mjs +2 -2
- package/dist/packem_chunks/handler5.mjs +7 -4
- package/dist/packem_chunks/handler6.mjs +10 -7
- package/dist/packem_chunks/handler7.mjs +2 -2
- package/dist/packem_chunks/handler8.mjs +1 -1
- package/dist/packem_chunks/handler9.mjs +315 -12
- package/dist/packem_chunks/planDevCommand.mjs +758 -81
- package/dist/packem_chunks/runCodegenCommand.mjs +5 -4
- package/dist/packem_chunks/runDeployCommand.mjs +126 -20
- package/dist/packem_chunks/runInitCommand.mjs +1661 -179
- package/dist/packem_chunks/runMigrateGenerateCommand.mjs +5 -4
- package/dist/packem_chunks/runResetCommand.mjs +2 -2
- package/dist/packem_chunks/runRpcCommand.mjs +3 -2
- package/dist/packem_shared/{COMMANDS-Bn8luojF.mjs → COMMANDS-DW8lQmuW.mjs} +85 -23
- package/dist/packem_shared/{DEFAULT_IMPORT_BATCH_SIZE-Ck-2bU08.mjs → DEFAULT_IMPORT_BATCH_SIZE-CRQmmBZM.mjs} +3 -2
- package/dist/packem_shared/{api-spec-CtA6ilu4.mjs → api-spec-Bx0iKbxA.mjs} +3 -1
- package/dist/packem_shared/{buildRegistryIndex-BcYe607_.mjs → buildRegistryIndex-BS5ig822.mjs} +1 -1
- package/dist/packem_shared/codegen-error-DJG-ghs_.mjs +31 -0
- package/dist/packem_shared/{command-BDXcJCCJ.mjs → command-lYnl4QyF.mjs} +6 -1
- package/dist/packem_shared/{commands-DqsEzojt.mjs → commands-ClEvcz3V.mjs} +224 -18
- package/dist/packem_shared/{createLogger-CHPNjFw2.mjs → createLogger-CIWSHrTL.mjs} +40 -8
- package/dist/packem_shared/{createRecordingSpawner-DxI3mebw.mjs → createRecordingSpawner-Cw5Iu73G.mjs} +12 -2
- package/dist/packem_shared/{detect-package-manager-DYp7n3mJ.mjs → detect-package-manager-DvEthdCw.mjs} +26 -30
- package/dist/packem_shared/{insertSchemaExtension-BuzF6-t2.mjs → insertSchemaExtension-DAqbfr9Z.mjs} +15 -10
- package/dist/packem_shared/{open-url-Dfq6fAyT.mjs → open-url-4PBLY9X0.mjs} +3 -2
- package/dist/packem_shared/{output-format-7gyGR3h8.mjs → output-format-B4642rjE.mjs} +1 -1
- package/dist/packem_shared/{parseManifest--vZf2FY1.mjs → parseManifest-Dbp-Q2q3.mjs} +36 -9
- package/dist/packem_shared/prompt-cancelled-APzX1Im-.mjs +9 -0
- package/dist/packem_shared/runAddCommand-DGjFXGqa.mjs +4 -0
- package/dist/packem_shared/storage-DEXpJkXh.mjs +84 -0
- package/dist/packem_shared/tui-prompts-BjEN8XgP.mjs +658 -0
- package/dist/packem_shared/wrangler-secrets-Dq_Fkbm-.mjs +49 -0
- package/package.json +16 -13
- package/skills/lunora-quickstart/SKILL.md +25 -5
- package/skills/lunora-setup-storage/SKILL.md +7 -3
- package/dist/packem_shared/features-ocSSpZtS.mjs +0 -24
- package/dist/packem_shared/runAddCommand-G544_v6e.mjs +0 -4
- package/dist/packem_shared/tui-prompts-XHFxlOg5.mjs +0 -269
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/cli",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.80",
|
|
4
4
|
"description": "The Lunora CLI: init, dev, deploy, codegen, run, reset, and migrate commands",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent-skills",
|
|
@@ -51,18 +51,21 @@
|
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@bomb.sh/tab": "0.0.
|
|
55
|
-
"@lunora/codegen": "1.0.0-alpha.
|
|
56
|
-
"@lunora/config": "1.0.0-alpha.
|
|
57
|
-
"@lunora/container": "1.0.0-alpha.
|
|
58
|
-
"@lunora/d1": "1.0.0-alpha.
|
|
59
|
-
"@lunora/
|
|
60
|
-
"@
|
|
61
|
-
"@visulima/
|
|
62
|
-
"@visulima/
|
|
63
|
-
"@visulima/
|
|
64
|
-
"@visulima/
|
|
65
|
-
"@visulima/
|
|
54
|
+
"@bomb.sh/tab": "0.0.18",
|
|
55
|
+
"@lunora/codegen": "1.0.0-alpha.39",
|
|
56
|
+
"@lunora/config": "1.0.0-alpha.61",
|
|
57
|
+
"@lunora/container": "1.0.0-alpha.8",
|
|
58
|
+
"@lunora/d1": "1.0.0-alpha.25",
|
|
59
|
+
"@lunora/errors": "1.0.0-alpha.3",
|
|
60
|
+
"@lunora/seed": "1.0.0-alpha.21",
|
|
61
|
+
"@visulima/cerebro": "3.0.0",
|
|
62
|
+
"@visulima/error": "6.0.0",
|
|
63
|
+
"@visulima/fs": "5.0.0",
|
|
64
|
+
"@visulima/package": "5.0.0",
|
|
65
|
+
"@visulima/pail": "4.0.0",
|
|
66
|
+
"@visulima/path": "3.0.0",
|
|
67
|
+
"@visulima/spinner": "1.0.0",
|
|
68
|
+
"@visulima/tui": "1.0.0",
|
|
66
69
|
"cfonts": "^3.3.1",
|
|
67
70
|
"giget": "3.3.0",
|
|
68
71
|
"jsonc-parser": "^3.3.1",
|
|
@@ -31,9 +31,12 @@ Set up a working Lunora project as fast as possible.
|
|
|
31
31
|
Lunora into the current project.
|
|
32
32
|
4. Run `lunora codegen` to generate `lunora/_generated/` and typecheck the
|
|
33
33
|
schema + functions. This is the agent's feedback loop.
|
|
34
|
-
5. Start the dev loop
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
5. Start the dev loop. As an agent, run `lunora dev --background` — it starts
|
|
35
|
+
the server as a managed detached process, blocks until it accepts requests,
|
|
36
|
+
prints the URL + PID, and returns (under a detected AI agent, plain
|
|
37
|
+
`lunora dev` does this automatically, with JSON logs). Never leave a bare
|
|
38
|
+
`lunora dev` running in your own shell — it is long-running and does not
|
|
39
|
+
exit.
|
|
37
40
|
6. Verify a query/mutation round-trip works end to end.
|
|
38
41
|
|
|
39
42
|
## Path 1: New Project (Recommended)
|
|
@@ -87,7 +90,23 @@ not exit, so:
|
|
|
87
90
|
|
|
88
91
|
- **Local development (user at the keyboard):** ask the user to run `lunora dev`
|
|
89
92
|
in a terminal.
|
|
90
|
-
- **
|
|
93
|
+
- **Agents:** run `lunora dev --background`. It detaches the server, waits until
|
|
94
|
+
it answers HTTP, prints `Dev server running at <url> (pid <n>)`, and exits —
|
|
95
|
+
no orphaned shell, no PID bookkeeping. When Lunora detects an AI agent
|
|
96
|
+
(Claude Code, Cursor, Codex, …), plain `lunora dev` flips into this mode
|
|
97
|
+
automatically with JSON logs; `LUNORA_AGENT_MODE=0` opts out.
|
|
98
|
+
|
|
99
|
+
Manage the running server afterwards:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
lunora dev status --json # machine-readable: url, pid, uptime, logFile
|
|
103
|
+
lunora dev logs --lines 50 # tail the captured output (.lunora/dev.log)
|
|
104
|
+
lunora dev stop # idempotent — succeeds even if nothing runs
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
A second `lunora dev` never double-starts: it reports the existing instance
|
|
108
|
+
(`.lunora/dev.json` is the lockfile). Probe readiness or liveness at
|
|
109
|
+
`GET /_lunora/status` (`{"ok":true}`).
|
|
91
110
|
|
|
92
111
|
Vite serves on `http://localhost:5173` by default; the Worker is served on the
|
|
93
112
|
same origin via `@cloudflare/vite-plugin`.
|
|
@@ -236,5 +255,6 @@ ids, `.dev.vars` secrets, and container exports.
|
|
|
236
255
|
- [ ] New project: scaffolded with `lunora init --template <t>`.
|
|
237
256
|
- [ ] Existing app: ran `lunora init --here` and wired `LunoraProvider`.
|
|
238
257
|
- [ ] Ran `lunora codegen`: `lunora/_generated/` exists and typecheck is clean.
|
|
239
|
-
- [ ]
|
|
258
|
+
- [ ] Dev server is running — user terminal, or `lunora dev --background`
|
|
259
|
+
(check with `lunora dev status`).
|
|
240
260
|
- [ ] Verified a query/mutation round-trip re-renders the client live.
|
|
@@ -41,7 +41,7 @@ This:
|
|
|
41
41
|
1. Adds `@lunora/storage` and `@lunora/server` to `package.json` (run
|
|
42
42
|
`pnpm install` afterwards).
|
|
43
43
|
2. Adds an R2 bucket binding to `wrangler.jsonc` (`r2_buckets`, binding
|
|
44
|
-
**`UPLOADS`**, `bucket_name: "
|
|
44
|
+
**`UPLOADS`**, `bucket_name: "replace-me-uploads"` — rename it to a real
|
|
45
45
|
bucket). It **merges** into any existing `r2_buckets`.
|
|
46
46
|
3. Scaffolds `STORAGE_SIGNING_SECRET` (a secret) and `STORAGE_PUBLIC_BASE_URL`
|
|
47
47
|
into `.dev.vars`.
|
|
@@ -137,8 +137,12 @@ persist that, and pass the bare key back in — the component re-scopes it.
|
|
|
137
137
|
|
|
138
138
|
1. **Skipping `verifySignedUrl` on the download route.** Without it, anyone can
|
|
139
139
|
read any key. Always verify before streaming.
|
|
140
|
-
2. **Placeholder bucket name.** `
|
|
141
|
-
|
|
140
|
+
2. **Placeholder bucket name.** `lunora init` and `lunora add storage` prompt for
|
|
141
|
+
the bucket name (or take `--bucket <name>`), but the low-level
|
|
142
|
+
`lunora registry add storage` writes the placeholder
|
|
143
|
+
`bucket_name: "replace-me-uploads"` — rename it to a real R2 bucket. (R2 names
|
|
144
|
+
are lowercase alphanumeric + hyphens, 3–63 chars; wrangler rejects anything
|
|
145
|
+
else on `dev`/`deploy`.)
|
|
142
146
|
3. **Short / shared signing secret.** Use ≥32 chars and a distinct secret per
|
|
143
147
|
bucket; reusing it lets one bucket's URLs sign for another.
|
|
144
148
|
4. **Proxying bytes through the Worker.** The design uploads/downloads directly
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const AUTH_PROVIDER_OPTIONS = [
|
|
2
|
-
{ description: "Email + password on better-auth (default)", label: "Email & password", value: "auth" },
|
|
3
|
-
{ description: "Clerk-hosted auth", label: "Clerk", value: "auth-clerk" },
|
|
4
|
-
{ description: "Auth0 (OIDC)", label: "Auth0", value: "auth-auth0" }
|
|
5
|
-
];
|
|
6
|
-
const DEFAULT_AUTH_ITEM = "auth";
|
|
7
|
-
const promptAuthProvider = async (select) => await select("Which auth provider?", AUTH_PROVIDER_OPTIONS, { default: DEFAULT_AUTH_ITEM }) ?? DEFAULT_AUTH_ITEM;
|
|
8
|
-
const EMAIL_ITEM = "mail";
|
|
9
|
-
const normalizeFeature = (raw) => {
|
|
10
|
-
const value = raw.trim();
|
|
11
|
-
if (value === "") {
|
|
12
|
-
return void 0;
|
|
13
|
-
}
|
|
14
|
-
const lower = value.toLowerCase();
|
|
15
|
-
if (lower === "auth") {
|
|
16
|
-
return { kind: "auth" };
|
|
17
|
-
}
|
|
18
|
-
if (lower === "email" || lower === "mail") {
|
|
19
|
-
return { kind: "email" };
|
|
20
|
-
}
|
|
21
|
-
return { item: lower, kind: "item" };
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export { AUTH_PROVIDER_OPTIONS as A, DEFAULT_AUTH_ITEM as D, EMAIL_ITEM as E, normalizeFeature as n, promptAuthProvider as p };
|
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { isInteractive } from '@lunora/config';
|
|
3
|
-
import { render } from '@visulima/tui';
|
|
4
|
-
import { BigText } from '@visulima/tui/components/big-text';
|
|
5
|
-
import { Box } from '@visulima/tui/components/box';
|
|
6
|
-
import { CommandPalette } from '@visulima/tui/components/command-palette';
|
|
7
|
-
import { ConfirmInput } from '@visulima/tui/components/confirm-input';
|
|
8
|
-
import { MultiSelect } from '@visulima/tui/components/multi-select';
|
|
9
|
-
import { SelectInput } from '@visulima/tui/components/select-input';
|
|
10
|
-
import { Spinner } from '@visulima/tui/components/spinner';
|
|
11
|
-
import { Text } from '@visulima/tui/components/text';
|
|
12
|
-
import { TextInput } from '@visulima/tui/components/text-input';
|
|
13
|
-
import { useApp } from '@visulima/tui/hooks/use-app';
|
|
14
|
-
import { useInput } from '@visulima/tui/hooks/use-input';
|
|
15
|
-
import { useEffect } from 'react';
|
|
16
|
-
|
|
17
|
-
const ACCENT = "#a855f7";
|
|
18
|
-
const SCROLL_LIMIT = 10;
|
|
19
|
-
const FILTER_THRESHOLD = 8;
|
|
20
|
-
const PromptFrame = ({ children }) => jsx(Box, { borderColor: ACCENT, borderStyle: "round", flexDirection: "column", paddingX: 1, children });
|
|
21
|
-
const runInkPrompt = async (build, fallback) => {
|
|
22
|
-
let result = fallback;
|
|
23
|
-
const instance = render(
|
|
24
|
-
build((value) => {
|
|
25
|
-
result = value;
|
|
26
|
-
}),
|
|
27
|
-
{ exitOnCtrlC: true }
|
|
28
|
-
);
|
|
29
|
-
try {
|
|
30
|
-
await instance.waitUntilExit();
|
|
31
|
-
} catch {
|
|
32
|
-
} finally {
|
|
33
|
-
instance.unmount();
|
|
34
|
-
}
|
|
35
|
-
return result;
|
|
36
|
-
};
|
|
37
|
-
const itemLabel = (option) => option.description === void 0 ? option.label : `${option.label} — ${option.description}`;
|
|
38
|
-
const useCommit = (finish) => {
|
|
39
|
-
const { exit } = useApp();
|
|
40
|
-
return (result) => {
|
|
41
|
-
finish(result);
|
|
42
|
-
exit();
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
const useEscapeToExit = () => {
|
|
46
|
-
const { exit } = useApp();
|
|
47
|
-
useInput((_input, key) => {
|
|
48
|
-
if (key.escape) {
|
|
49
|
-
exit();
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
const SelectView = ({ finish, initialIndex, message, options }) => {
|
|
54
|
-
const commit = useCommit(finish);
|
|
55
|
-
useEscapeToExit();
|
|
56
|
-
return jsxs(PromptFrame, { children: [
|
|
57
|
-
jsx(Text, { bold: true, children: message }),
|
|
58
|
-
jsx(
|
|
59
|
-
SelectInput,
|
|
60
|
-
{
|
|
61
|
-
accentColor: ACCENT,
|
|
62
|
-
initialIndex,
|
|
63
|
-
items: options.map((option) => {
|
|
64
|
-
return { key: option.value, label: itemLabel(option), value: option.value };
|
|
65
|
-
}),
|
|
66
|
-
limit: SCROLL_LIMIT,
|
|
67
|
-
onSelect: (item) => {
|
|
68
|
-
commit(item.value);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
)
|
|
72
|
-
] });
|
|
73
|
-
};
|
|
74
|
-
const PaletteView = ({ finish, message, options }) => {
|
|
75
|
-
const { exit } = useApp();
|
|
76
|
-
const commit = useCommit(finish);
|
|
77
|
-
return jsxs(Box, { flexDirection: "column", children: [
|
|
78
|
-
jsx(Text, { bold: true, children: message }),
|
|
79
|
-
jsx(
|
|
80
|
-
CommandPalette,
|
|
81
|
-
{
|
|
82
|
-
accentColor: ACCENT,
|
|
83
|
-
autoFocus: true,
|
|
84
|
-
commands: options.map((option) => {
|
|
85
|
-
return { description: option.description, id: option.value, label: option.label };
|
|
86
|
-
}),
|
|
87
|
-
limit: SCROLL_LIMIT,
|
|
88
|
-
onCancel: () => {
|
|
89
|
-
exit();
|
|
90
|
-
},
|
|
91
|
-
onSelect: (id) => {
|
|
92
|
-
commit(id);
|
|
93
|
-
},
|
|
94
|
-
placeholder: "Type to filter…"
|
|
95
|
-
}
|
|
96
|
-
)
|
|
97
|
-
] });
|
|
98
|
-
};
|
|
99
|
-
const tuiSelect = async (message, options, settings) => {
|
|
100
|
-
if (!isInteractive() || options.length === 0) {
|
|
101
|
-
return settings?.default;
|
|
102
|
-
}
|
|
103
|
-
if (options.length > FILTER_THRESHOLD) {
|
|
104
|
-
return runInkPrompt((finish) => jsx(PaletteView, { finish, message, options }), settings?.default);
|
|
105
|
-
}
|
|
106
|
-
const defaultIndex = settings?.default === void 0 ? -1 : options.findIndex((option) => option.value === settings.default);
|
|
107
|
-
return runInkPrompt(
|
|
108
|
-
(finish) => jsx(SelectView, { finish, initialIndex: defaultIndex >= 0 ? defaultIndex : void 0, message, options }),
|
|
109
|
-
settings?.default
|
|
110
|
-
);
|
|
111
|
-
};
|
|
112
|
-
const TextView = ({ defaultValue, finish, message, placeholder }) => {
|
|
113
|
-
const commit = useCommit(finish);
|
|
114
|
-
useEscapeToExit();
|
|
115
|
-
return jsxs(PromptFrame, { children: [
|
|
116
|
-
jsx(Text, { bold: true, children: message }),
|
|
117
|
-
jsx(
|
|
118
|
-
TextInput,
|
|
119
|
-
{
|
|
120
|
-
defaultValue,
|
|
121
|
-
onSubmit: (value) => {
|
|
122
|
-
commit(value.trim() === "" ? defaultValue : value.trim());
|
|
123
|
-
},
|
|
124
|
-
placeholder
|
|
125
|
-
}
|
|
126
|
-
)
|
|
127
|
-
] });
|
|
128
|
-
};
|
|
129
|
-
const tuiText = async (message, settings) => {
|
|
130
|
-
const fallback = settings?.default ?? "";
|
|
131
|
-
if (!isInteractive()) {
|
|
132
|
-
return fallback;
|
|
133
|
-
}
|
|
134
|
-
return runInkPrompt(
|
|
135
|
-
(finish) => jsx(TextView, { defaultValue: fallback, finish, message, placeholder: settings?.placeholder }),
|
|
136
|
-
fallback
|
|
137
|
-
);
|
|
138
|
-
};
|
|
139
|
-
const MultiSelectView = ({ defaults, finish, message, options }) => {
|
|
140
|
-
const commit = useCommit(finish);
|
|
141
|
-
useEscapeToExit();
|
|
142
|
-
return jsxs(PromptFrame, { children: [
|
|
143
|
-
jsx(Text, { bold: true, children: message }),
|
|
144
|
-
jsx(Text, { dimColor: true, children: "space toggles · enter confirms · esc cancels" }),
|
|
145
|
-
jsx(
|
|
146
|
-
MultiSelect,
|
|
147
|
-
{
|
|
148
|
-
accentColor: ACCENT,
|
|
149
|
-
defaultValue: [...defaults],
|
|
150
|
-
limit: SCROLL_LIMIT,
|
|
151
|
-
onSubmit: (values) => {
|
|
152
|
-
const chosen = new Set(values);
|
|
153
|
-
commit(options.filter((option) => chosen.has(option.value)).map((option) => option.value));
|
|
154
|
-
},
|
|
155
|
-
options: options.map((option) => {
|
|
156
|
-
return { key: option.value, label: itemLabel(option), value: option.value };
|
|
157
|
-
})
|
|
158
|
-
}
|
|
159
|
-
)
|
|
160
|
-
] });
|
|
161
|
-
};
|
|
162
|
-
const tuiMultiSelect = async (message, options, settings) => {
|
|
163
|
-
const defaults = settings?.defaults ?? [];
|
|
164
|
-
if (!isInteractive() || options.length === 0) {
|
|
165
|
-
return [...defaults];
|
|
166
|
-
}
|
|
167
|
-
return runInkPrompt((finish) => jsx(MultiSelectView, { defaults, finish, message, options }), [...defaults]);
|
|
168
|
-
};
|
|
169
|
-
const ConfirmView = ({ defaultYes, finish, message }) => {
|
|
170
|
-
const commit = useCommit(finish);
|
|
171
|
-
return jsx(PromptFrame, { children: jsxs(Box, { children: [
|
|
172
|
-
jsxs(Text, { bold: true, children: [
|
|
173
|
-
message,
|
|
174
|
-
" "
|
|
175
|
-
] }),
|
|
176
|
-
jsx(
|
|
177
|
-
ConfirmInput,
|
|
178
|
-
{
|
|
179
|
-
defaultChoice: defaultYes ? "confirm" : "cancel",
|
|
180
|
-
onCancel: () => {
|
|
181
|
-
commit(false);
|
|
182
|
-
},
|
|
183
|
-
onConfirm: () => {
|
|
184
|
-
commit(true);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
)
|
|
188
|
-
] }) });
|
|
189
|
-
};
|
|
190
|
-
const tuiConfirm = async (message, options) => {
|
|
191
|
-
const defaultYes = options?.defaultYes === true;
|
|
192
|
-
if (!isInteractive()) {
|
|
193
|
-
return defaultYes;
|
|
194
|
-
}
|
|
195
|
-
return runInkPrompt((finish) => jsx(ConfirmView, { defaultYes, finish, message }), false);
|
|
196
|
-
};
|
|
197
|
-
const createTuiConfirm = () => isInteractive() ? (message) => tuiConfirm(message, { defaultYes: true }) : () => Promise.resolve(false);
|
|
198
|
-
const SelfExit = ({ children }) => {
|
|
199
|
-
const { exit } = useApp();
|
|
200
|
-
useEffect(() => {
|
|
201
|
-
exit();
|
|
202
|
-
}, [exit]);
|
|
203
|
-
return children;
|
|
204
|
-
};
|
|
205
|
-
const printFrame = async (element) => {
|
|
206
|
-
const instance = render(jsx(SelfExit, { children: element }));
|
|
207
|
-
try {
|
|
208
|
-
await instance.waitUntilExit();
|
|
209
|
-
} catch {
|
|
210
|
-
} finally {
|
|
211
|
-
instance.unmount();
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
const tuiIntro = async (message) => {
|
|
215
|
-
if (!isInteractive()) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
await printFrame(
|
|
219
|
-
jsxs(Box, { borderColor: ACCENT, borderStyle: "round", paddingX: 1, children: [
|
|
220
|
-
jsxs(Text, { bold: true, color: ACCENT, children: [
|
|
221
|
-
"◆ Lunora",
|
|
222
|
-
" "
|
|
223
|
-
] }),
|
|
224
|
-
jsx(Text, { children: message })
|
|
225
|
-
] })
|
|
226
|
-
);
|
|
227
|
-
};
|
|
228
|
-
const tuiOutro = async (message) => {
|
|
229
|
-
if (!isInteractive()) {
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
await printFrame(
|
|
233
|
-
jsxs(Box, { paddingX: 1, children: [
|
|
234
|
-
jsx(Text, { color: "green", children: "✔ " }),
|
|
235
|
-
jsx(Text, { children: message })
|
|
236
|
-
] })
|
|
237
|
-
);
|
|
238
|
-
};
|
|
239
|
-
const tuiBanner = async (subtitle) => {
|
|
240
|
-
if (!isInteractive()) {
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
await printFrame(
|
|
244
|
-
jsxs(Box, { flexDirection: "column", paddingX: 1, children: [
|
|
245
|
-
jsx(BigText, { colors: [ACCENT], font: "tiny", space: false, text: "LUNORA" }),
|
|
246
|
-
jsx(Text, { dimColor: true, children: subtitle })
|
|
247
|
-
] })
|
|
248
|
-
);
|
|
249
|
-
};
|
|
250
|
-
const SpinnerView = ({ label }) => jsxs(Box, { children: [
|
|
251
|
-
jsx(Text, { color: ACCENT, children: jsx(Spinner, { type: "dots" }) }),
|
|
252
|
-
jsxs(Text, { children: [
|
|
253
|
-
" ",
|
|
254
|
-
label
|
|
255
|
-
] })
|
|
256
|
-
] });
|
|
257
|
-
const withTuiSpinner = async (label, task) => {
|
|
258
|
-
if (!isInteractive()) {
|
|
259
|
-
return task();
|
|
260
|
-
}
|
|
261
|
-
const instance = render(jsx(SpinnerView, { label }));
|
|
262
|
-
try {
|
|
263
|
-
return await task();
|
|
264
|
-
} finally {
|
|
265
|
-
instance.unmount();
|
|
266
|
-
}
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
export { tuiConfirm as a, tuiOutro as b, createTuiConfirm as c, tuiBanner as d, tuiText as e, tuiIntro as f, tuiMultiSelect as g, tuiSelect as t, withTuiSpinner as w };
|