@zuke-build/cli 0.0.0-stage → 2.7.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.
- package/LICENSE +21 -0
- package/README.md +353 -2
- package/mod.d.ts +102 -0
- package/mod.js +931 -0
- package/package.json +35 -4
- package/src/binary_launcher.d.ts +49 -0
- package/src/binary_launcher.js +325 -0
- package/src/binary_pin.d.ts +47 -0
- package/src/binary_pin.js +117 -0
- package/src/build_file.d.ts +25 -0
- package/src/build_file.js +58 -0
- package/src/cache.d.ts +23 -0
- package/src/cache.js +26 -0
- package/src/deno_isolated.d.ts +14 -0
- package/src/deno_isolated.js +70 -0
- package/src/deno_path.d.ts +115 -0
- package/src/deno_path.js +205 -0
- package/src/deno_pin.d.ts +37 -0
- package/src/deno_pin.js +32 -0
- package/src/dependencies.d.ts +48 -0
- package/src/dependencies.js +80 -0
- package/src/dispatch.d.ts +229 -0
- package/src/dispatch.js +549 -0
- package/src/embedded_engine.d.ts +28 -0
- package/src/embedded_engine.js +21 -0
- package/src/engine_pin.d.ts +56 -0
- package/src/engine_pin.js +196 -0
- package/src/fs.d.ts +14 -0
- package/src/fs.js +25 -0
- package/src/import.d.ts +132 -0
- package/src/import.js +289 -0
- package/src/install_source.d.ts +79 -0
- package/src/install_source.js +104 -0
- package/src/launcher.d.ts +37 -0
- package/src/launcher.js +405 -0
- package/src/launcher_shared.d.ts +25 -0
- package/src/launcher_shared.js +91 -0
- package/src/mcp_config.d.ts +71 -0
- package/src/mcp_config.js +96 -0
- package/src/node_launcher.d.ts +19 -0
- package/src/node_launcher.js +416 -0
- package/src/node_pin.d.ts +25 -0
- package/src/node_pin.js +30 -0
- package/src/output.d.ts +38 -0
- package/src/output.js +43 -0
- package/src/paint.d.ts +42 -0
- package/src/paint.js +38 -0
- package/src/project.d.ts +69 -0
- package/src/project.js +132 -0
- package/src/pyproject.d.ts +30 -0
- package/src/pyproject.js +156 -0
- package/src/python_build.d.ts +27 -0
- package/src/python_build.js +197 -0
- package/src/records.d.ts +18 -0
- package/src/records.js +31 -0
- package/src/relock.d.ts +11 -0
- package/src/relock.js +182 -0
- package/src/runtime_field.d.ts +15 -0
- package/src/runtime_field.js +29 -0
- package/src/setup.d.ts +259 -0
- package/src/setup.js +693 -0
- package/src/star.d.ts +44 -0
- package/src/star.js +100 -0
- package/src/starter.d.ts +64 -0
- package/src/starter.js +138 -0
- package/src/toml.d.ts +32 -0
- package/src/toml.js +354 -0
- package/src/translate.d.ts +69 -0
- package/src/translate.js +198 -0
- package/src/upgrade.d.ts +113 -0
- package/src/upgrade.js +344 -0
- package/src/version.d.ts +11 -0
- package/src/version.js +13 -0
- package/src/version_report.d.ts +55 -0
- package/src/version_report.js +187 -0
- package/zuke.js +8 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Zuke contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,354 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @zuke/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The `zuke` command-line tool — scaffold
|
|
4
|
+
[Zuke](https://github.com/zuke-build/zuke#readme) into any project.
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
deno install -A -g -n zuke jsr:@zuke/cli
|
|
8
|
+
zuke setup
|
|
9
|
+
zuke setup --runtime node # a Node project: package.json and Node launchers, no Deno
|
|
10
|
+
zuke setup --sdk python # a build.py, with launchers that run the zuke binary: no Deno
|
|
11
|
+
zuke upgrade # later: move the installed CLI to the latest release
|
|
12
|
+
zuke upgrade --engine # or move a Python project to the latest zuke release
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The same CLI also ships as a standalone binary that needs no Deno up front:
|
|
16
|
+
`brew install zuke-build/tap/zuke` on macOS and Linux, and `choco install zuke`
|
|
17
|
+
on Windows (not Authenticode-signed yet). Update those with `brew upgrade zuke`
|
|
18
|
+
or `choco upgrade zuke`. See
|
|
19
|
+
[installing](https://github.com/zuke-build/zuke/blob/master/docs/install.md). A
|
|
20
|
+
Python project runs on that binary alone: its launchers download the pinned
|
|
21
|
+
release, checksum-verified, so neither it nor its CI ever needs Deno.
|
|
22
|
+
|
|
23
|
+
<!-- ZUKE:API:START -->
|
|
24
|
+
|
|
25
|
+
## API
|
|
26
|
+
|
|
27
|
+
<details>
|
|
28
|
+
<summary>Full typed API — generated from <code>deno doc</code></summary>
|
|
29
|
+
|
|
30
|
+
````text
|
|
31
|
+
`@zuke/cli` — the `zuke` command. Install it globally with
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
deno install -A -g -n zuke jsr:@zuke/cli
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
scaffold Zuke into any project with `zuke setup`, then run its build from
|
|
38
|
+
anywhere inside the project with `zuke <target>`: every command that is not
|
|
39
|
+
the CLI's own (`setup`, `import`, `doc`, `upgrade`, and the project
|
|
40
|
+
commands `add`, `remove`, `cache` and `relock`) is forwarded to the
|
|
41
|
+
nearest `zuke.ts`, exactly as the `./zuke` launcher would run it. Update the
|
|
42
|
+
installed CLI itself with `zuke upgrade`, and manage a project's
|
|
43
|
+
dependencies and lock with `zuke add`, `remove`, `cache` and `relock`.
|
|
44
|
+
@module
|
|
45
|
+
|
|
46
|
+
function binaryMain(args: string[], engine: EmbeddedEngine): Promise<number>
|
|
47
|
+
The compiled `zuke` binary's entry point: {@link main} with every default
|
|
48
|
+
and the `engine` the binary carries, so a project with no `zuke.ts` runs on
|
|
49
|
+
it with no Deno installed.
|
|
50
|
+
|
|
51
|
+
async function main(args: string[], host: SetupHost, prompter: Prompter, docRunner: DocRunner, starActions: StarActions, buildRunner: BuildRunner, buildProbe: BuildProbe, upgradeHost: UpgradeHost, projectHost: ProjectHost, engine?: EmbeddedEngine): Promise<number>
|
|
52
|
+
The CLI entry point. Returns a process exit code; `host`, `prompter`,
|
|
53
|
+
`docRunner`, `starActions`, `buildRunner`, `buildProbe`, `upgradeHost` and
|
|
54
|
+
`projectHost` are injectable for testing. `engine` is the engine the
|
|
55
|
+
compiled binary carries, absent under `deno run`: see {@link binaryMain}.
|
|
56
|
+
|
|
57
|
+
function parseImportFlags(args: string[]): ImportFlags
|
|
58
|
+
Parse the argument list following `zuke import`.
|
|
59
|
+
|
|
60
|
+
function parseSetupFlags(args: string[]): SetupFlags
|
|
61
|
+
Parse the argument list following `zuke setup`.
|
|
62
|
+
|
|
63
|
+
const EMBEDDED_ENGINE_ENV: "ZUKE_EMBEDDED_ENGINE"
|
|
64
|
+
Set to `1` in the environment of the process that runs a hosted build on
|
|
65
|
+
the binary's own engine: the compiled entry reads it, before the CLI does,
|
|
66
|
+
and removes it, so nothing the build starts inherits it.
|
|
67
|
+
|
|
68
|
+
const FORWARDED_ENV: "ZUKE_FORWARDED"
|
|
69
|
+
Set to `1` in a launcher's environment, so a launcher that itself calls the
|
|
70
|
+
global `zuke` gets the bare `deno run` instead of itself again, endlessly.
|
|
71
|
+
|
|
72
|
+
const defaultPrompter: Prompter
|
|
73
|
+
The real {@link Prompter}, backed by Deno's `prompt`/`confirm`.
|
|
74
|
+
|
|
75
|
+
interface BinaryPin
|
|
76
|
+
The pinned `zuke` release, the engine inside it, and each archive's digest.
|
|
77
|
+
|
|
78
|
+
readonly version: string
|
|
79
|
+
The release, without the tag's `cli-v` prefix, e.g. `"2.4.0"`.
|
|
80
|
+
readonly engine: string
|
|
81
|
+
The `@zuke/engine` release compiled into it.
|
|
82
|
+
readonly checksums: Readonly<Record<BinaryTarget, string>>
|
|
83
|
+
Lowercase hex SHA-256 of each target's archive.
|
|
84
|
+
|
|
85
|
+
interface BuildLocation
|
|
86
|
+
Where a forwarded command runs, and how.
|
|
87
|
+
|
|
88
|
+
root: string
|
|
89
|
+
The absolute repository root: the directory holding `zuke.json`.
|
|
90
|
+
frozen: boolean
|
|
91
|
+
Whether a `deno.lock` sits at the root, so the run passes `--frozen`.
|
|
92
|
+
launcher: string | null
|
|
93
|
+
The absolute path of the executable `zuke` launcher at the root, run in
|
|
94
|
+
place of `deno run` — or `null` when there is none, or the platform
|
|
95
|
+
reports no file mode to tell (Windows).
|
|
96
|
+
build: string
|
|
97
|
+
The build file's name: the one the root's `zuke.json` names in its
|
|
98
|
+
`build` field, `zuke.ts` when it names none.
|
|
99
|
+
runtime: ProjectRuntime
|
|
100
|
+
The runtime the build file runs on: the `runtime` field of the root's
|
|
101
|
+
`zuke.json`, `deno` when it names none.
|
|
102
|
+
engine: string | null
|
|
103
|
+
The `@zuke/engine` release that runs the build when the root has no
|
|
104
|
+
build file: the `engine` field of its `zuke.json`, which then describes a
|
|
105
|
+
build another SDK hosts. `null` when the root has its own build file.
|
|
106
|
+
|
|
107
|
+
interface BuildProbe
|
|
108
|
+
The filesystem questions discovery asks, injectable so the walk and its
|
|
109
|
+
trust gate are testable without a filesystem or a second user.
|
|
110
|
+
|
|
111
|
+
exists(path: string): Promise<boolean>
|
|
112
|
+
Whether a path exists (the link itself, not its target).
|
|
113
|
+
ownership(path: string): Promise<Ownership | null>
|
|
114
|
+
The owner and mode of what a path resolves to, or `null` when nothing is
|
|
115
|
+
there.
|
|
116
|
+
realPath(path: string): Promise<string>
|
|
117
|
+
The path with every link resolved.
|
|
118
|
+
readLink(path: string): Promise<string | null>
|
|
119
|
+
The target a symlink names, exactly as written in the link (possibly
|
|
120
|
+
relative to the link's directory), or `null` when `path` is not a link.
|
|
121
|
+
uid(): number | null
|
|
122
|
+
The current user's numeric id, or `null` where the platform has none.
|
|
123
|
+
readText(path: string): Promise<string>
|
|
124
|
+
The text of a file.
|
|
125
|
+
|
|
126
|
+
interface EmbeddedEngine
|
|
127
|
+
The engine a compiled `zuke` carries, as its entry point describes it.
|
|
128
|
+
|
|
129
|
+
readonly version: string
|
|
130
|
+
The `@zuke/engine` release compiled in, such as `1.3.0`.
|
|
131
|
+
readonly program: string
|
|
132
|
+
The executable to start in engine mode: the binary itself.
|
|
133
|
+
serves(pin: string): boolean
|
|
134
|
+
Whether the compiled-in release serves the one `zuke.json` pins.
|
|
135
|
+
|
|
136
|
+
interface EnginePinHost
|
|
137
|
+
What moving the pin reaches outside the process, injectable for tests.
|
|
138
|
+
|
|
139
|
+
entry(path: string): Promise<"file" | "missing" | "other">
|
|
140
|
+
What is at `path`, not following a link: a regular `file`, nothing
|
|
141
|
+
(`missing`), or `other` — a directory, or a link, which a write would
|
|
142
|
+
follow out of the project.
|
|
143
|
+
readText(path: string): Promise<string>
|
|
144
|
+
Read a regular text file.
|
|
145
|
+
writeText(path: string, text: string): Promise<void>
|
|
146
|
+
Write a text file, replacing what is there.
|
|
147
|
+
cliMeta(): Promise<unknown>
|
|
148
|
+
Fetch and parse `@zuke/cli`'s JSR `meta.json`, whose latest is the newest zuke.
|
|
149
|
+
binaryPin(version: string): Promise<BinaryPin>
|
|
150
|
+
Resolve the pin of a `zuke` release.
|
|
151
|
+
|
|
152
|
+
interface ImportFlags extends SetupFlags
|
|
153
|
+
Flags accepted by `zuke import` — the setup flags plus `--from`.
|
|
154
|
+
|
|
155
|
+
from?: ImportSource
|
|
156
|
+
Force a source (`package.json`, `makefile` or `pyproject`); auto-detected
|
|
157
|
+
when unset.
|
|
158
|
+
|
|
159
|
+
interface InstallHost
|
|
160
|
+
The process facts {@link installSource} reads, injectable so each install
|
|
161
|
+
kind is testable from a single process.
|
|
162
|
+
|
|
163
|
+
standalone(): boolean
|
|
164
|
+
Whether this process is a `deno compile` binary (`Deno.build.standalone`).
|
|
165
|
+
mainModule(): string
|
|
166
|
+
The running CLI's main module (`Deno.mainModule`). Deno reports a JSR
|
|
167
|
+
program by its specifier, `jsr:@zuke/cli` or `jsr:@zuke/cli@<version>`.
|
|
168
|
+
execPath(): string
|
|
169
|
+
The running executable's path (`Deno.execPath()`).
|
|
170
|
+
realPath(path: string): Promise<string>
|
|
171
|
+
`path` with every symbolic link resolved (`Deno.realPath`).
|
|
172
|
+
|
|
173
|
+
interface Ownership
|
|
174
|
+
What the trust gate needs to know about a filesystem entry.
|
|
175
|
+
|
|
176
|
+
uid: number | null
|
|
177
|
+
The numeric owner, or `null` where the platform reports none (Windows).
|
|
178
|
+
mode: number | null
|
|
179
|
+
The permission bits, or `null` where the platform reports none.
|
|
180
|
+
|
|
181
|
+
interface ProjectHost
|
|
182
|
+
What the project commands reach outside the process, injectable so they
|
|
183
|
+
are testable without a real `deno`.
|
|
184
|
+
|
|
185
|
+
entry(path: string): Promise<"file" | "missing" | "other">
|
|
186
|
+
What is at `path`, not following a link: a regular `file`, nothing
|
|
187
|
+
(`missing`), or `other` — a directory, or a link, which a write would
|
|
188
|
+
follow out of the project.
|
|
189
|
+
readText(path: string): Promise<string>
|
|
190
|
+
Read a text file, rejecting when it cannot be read.
|
|
191
|
+
writeText(path: string, text: string): Promise<void>
|
|
192
|
+
Write a text file, replacing what is there.
|
|
193
|
+
remove(path: string): Promise<void>
|
|
194
|
+
Remove a file.
|
|
195
|
+
deno(denoArgs: string[], cwd: string): Promise<number>
|
|
196
|
+
Run `deno <denoArgs>` in `cwd`, returning its exit code.
|
|
197
|
+
denoVersion(): string
|
|
198
|
+
The version of the Deno that runs the command.
|
|
199
|
+
|
|
200
|
+
interface Prompter
|
|
201
|
+
The interactive surface, injectable so the wizard is testable without a TTY.
|
|
202
|
+
|
|
203
|
+
interactive(): boolean
|
|
204
|
+
Whether prompts should be shown (i.e. stdin is a terminal).
|
|
205
|
+
ask(question: string, fallback: string): string
|
|
206
|
+
Ask a free-text question, returning `fallback` if unanswered.
|
|
207
|
+
confirm(question: string): boolean
|
|
208
|
+
Ask a yes/no question.
|
|
209
|
+
|
|
210
|
+
interface SdkSetupOptions
|
|
211
|
+
What `--sdk python` scaffolds against.
|
|
212
|
+
|
|
213
|
+
pin: BinaryPin
|
|
214
|
+
The `zuke` release the launchers run; `zuke.json` pins the engine it
|
|
215
|
+
carries.
|
|
216
|
+
|
|
217
|
+
interface SetupFlags
|
|
218
|
+
Flags accepted by `zuke setup`.
|
|
219
|
+
|
|
220
|
+
force: boolean
|
|
221
|
+
Overwrite existing files.
|
|
222
|
+
yes: boolean
|
|
223
|
+
Skip prompts and accept defaults.
|
|
224
|
+
name?: string
|
|
225
|
+
Build class name for the starter build file.
|
|
226
|
+
buildFile?: string
|
|
227
|
+
The TypeScript build file's name (`--build-file`). Unset: ask, else `build.ts`.
|
|
228
|
+
dir?: string
|
|
229
|
+
Directory to scaffold into (defaults to the current directory).
|
|
230
|
+
launcherName?: string
|
|
231
|
+
Base name for the launcher scripts, when `zuke` is taken by a directory.
|
|
232
|
+
mcp: boolean
|
|
233
|
+
Also write `.mcp.json`, registering the build's MCP server for agent clients.
|
|
234
|
+
allowRun: boolean
|
|
235
|
+
Register that server with `--allow-run`, so the agent may execute targets. Implies `mcp`.
|
|
236
|
+
bootstrapDeno?: boolean
|
|
237
|
+
Which launchers to scaffold: `true` (`--bootstrap`) for ones that
|
|
238
|
+
download their pinned, checksum-verified runtime when it is missing —
|
|
239
|
+
Deno for a `zuke.ts` build, the `zuke` binary for a hosted one — `false`
|
|
240
|
+
(`--no-bootstrap`) for ones that require it on `PATH` and fail closed.
|
|
241
|
+
Unset: ask when interactive, else take the default (bootstrap).
|
|
242
|
+
sdk?: string
|
|
243
|
+
The SDK whose build to scaffold (`--sdk python`): a `build.py` the engine
|
|
244
|
+
runs, in place of a `zuke.ts`. Unset: a TypeScript build.
|
|
245
|
+
runtime?: string
|
|
246
|
+
The runtime of a TypeScript build (`--runtime deno|node`). Unset: Deno, asked when interactive.
|
|
247
|
+
zuke?: string
|
|
248
|
+
The `zuke` release an SDK build's launchers run (`--zuke`), whose engine
|
|
249
|
+
`zuke.json` pins. Unset: this zuke's own release.
|
|
250
|
+
|
|
251
|
+
interface SetupHost
|
|
252
|
+
Injected side effects, so {@link runSetup} is unit-testable.
|
|
253
|
+
|
|
254
|
+
exists(path: string): Promise<boolean>
|
|
255
|
+
Whether a path exists.
|
|
256
|
+
isDirectory(path: string): Promise<boolean>
|
|
257
|
+
Whether a path exists and is a directory (a reserved-name collision).
|
|
258
|
+
isSymlink(path: string): Promise<boolean>
|
|
259
|
+
Whether a path is a symbolic link, without following it. Scaffolding
|
|
260
|
+
refuses to write through one: the writes below follow links, so a link
|
|
261
|
+
planted at a scaffold name by the very repository being set up would
|
|
262
|
+
redirect them outside the target directory.
|
|
263
|
+
|
|
264
|
+
The guard covers the names scaffolding chooses, which is where the hazard
|
|
265
|
+
is — the caller never asked for `.gitignore` to be written, so a repository
|
|
266
|
+
redirecting it is a decision nobody made. It reports what is there when it
|
|
267
|
+
runs, and a link planted after it would escape it; that is why
|
|
268
|
+
{@link SetupHost.writeText} does not write through a link either, so the
|
|
269
|
+
refusal is the friendly answer rather than the only defence.
|
|
270
|
+
|
|
271
|
+
Two things stay out of scope. The directory the caller names with `--dir`
|
|
272
|
+
is the caller's to name, symlink or not. And a hard link is
|
|
273
|
+
indistinguishable from the file it shares, so no probe can see one; git
|
|
274
|
+
cannot check one out either, which is what keeps it out of the threat this
|
|
275
|
+
guards.
|
|
276
|
+
readText(path: string): Promise<string>
|
|
277
|
+
Read a file as UTF-8 text.
|
|
278
|
+
isTerminal?(): boolean
|
|
279
|
+
Whether stdout is an interactive terminal, which decides whether the
|
|
280
|
+
CLI's own output is rich. Optional: an implementation without it is
|
|
281
|
+
asked through Deno, the way every other process decides.
|
|
282
|
+
writeText(path: string, content: string): Promise<void>
|
|
283
|
+
Write UTF-8 text to a file, creating or replacing it.
|
|
284
|
+
|
|
285
|
+
An implementation must not write through a symbolic link standing at
|
|
286
|
+
`path`: the scaffolder's confinement to its target directory rests on this,
|
|
287
|
+
and the pre-write {@link SetupHost.isSymlink} check alone cannot carry it,
|
|
288
|
+
since a link can appear after the check.
|
|
289
|
+
chmod(path: string, mode: number): Promise<void>
|
|
290
|
+
Set a file's permission bits (may be unsupported on some platforms).
|
|
291
|
+
log(message: string): void
|
|
292
|
+
Emit a line of progress output.
|
|
293
|
+
|
|
294
|
+
interface StarActions
|
|
295
|
+
The side effects behind {@link promptStar}, injectable so tests never spawn
|
|
296
|
+
`gh` or a browser.
|
|
297
|
+
|
|
298
|
+
ghAuthenticated(): Promise<boolean>
|
|
299
|
+
Whether the `gh` CLI is installed and holds a login.
|
|
300
|
+
starWithGh(): Promise<void>
|
|
301
|
+
Star the Zuke repository through `gh api`.
|
|
302
|
+
openBrowser(url: string): Promise<boolean>
|
|
303
|
+
Open `url` in the default browser; `false` when it could not launch.
|
|
304
|
+
|
|
305
|
+
interface UpgradeHost extends InstallHost
|
|
306
|
+
What `zuke upgrade` reaches outside the process, injectable so the
|
|
307
|
+
command is testable without the network or a real reinstall.
|
|
308
|
+
|
|
309
|
+
binDir(): string | undefined
|
|
310
|
+
The directory `deno install -g` installs into (`<root>/bin`):
|
|
311
|
+
`DENO_INSTALL_ROOT`, else `~/.deno`, as Deno resolves it. `undefined`
|
|
312
|
+
when the environment names neither as an absolute path.
|
|
313
|
+
exists(path: string): Promise<boolean>
|
|
314
|
+
Whether `path` exists.
|
|
315
|
+
windows(): boolean
|
|
316
|
+
Whether this is Windows, where the running shim is a `.cmd` file.
|
|
317
|
+
meta(): Promise<unknown>
|
|
318
|
+
Fetch and parse `@zuke/cli`'s JSR `meta.json`.
|
|
319
|
+
binaryPin(version: string): Promise<BinaryPin>
|
|
320
|
+
Resolve the pin of `zuke` release `version`, which `zuke setup --sdk`
|
|
321
|
+
scaffolds a hosted build's launchers with and `zuke upgrade --engine`
|
|
322
|
+
moves them to: its archives' digests and the engine it carries.
|
|
323
|
+
install(denoArgs: string[]): Promise<number>
|
|
324
|
+
Run `deno <denoArgs>` to reinstall, returning its exit code.
|
|
325
|
+
denoVersion(): string
|
|
326
|
+
The version of the Deno that runs the reinstall: the one running this
|
|
327
|
+
CLI, since `zuke upgrade` only ever runs from a JSR install under Deno.
|
|
328
|
+
readText(path: string): Promise<string>
|
|
329
|
+
Read a text file, rejecting when it cannot be read.
|
|
330
|
+
|
|
331
|
+
type BinaryTarget = "aarch64-apple-darwin" | "x86_64-apple-darwin" | "aarch64-unknown-linux-gnu" | "x86_64-unknown-linux-gnu" | "x86_64-pc-windows-msvc"
|
|
332
|
+
A platform a `zuke` release ships a binary for, as its archive names it.
|
|
333
|
+
|
|
334
|
+
type BuildRunner = (root: string, args: string[], program?: string, env?: Readonly<Record<string, string>>) => Promise<number>
|
|
335
|
+
Runs `program <args>` from `root` — Deno when `program` is omitted, else the
|
|
336
|
+
project's launcher at that path, or {@link NODE} for a build file on Node —
|
|
337
|
+
and resolves to its exit code: the
|
|
338
|
+
injectable subprocess seam, so the forwarding is testable without a build.
|
|
339
|
+
`env` adds variables to the environment the child inherits.
|
|
340
|
+
|
|
341
|
+
type DocRunner = (denoArgs: string[]) => Promise<number>
|
|
342
|
+
Runs `deno doc <args>` — the injectable subprocess seam for
|
|
343
|
+
{@link commandDoc}, so the command is testable without spawning `deno`.
|
|
344
|
+
|
|
345
|
+
type ImportSource = "package.json" | "Makefile" | "pyproject.toml"
|
|
346
|
+
The kinds of project `zuke import` can read.
|
|
347
|
+
|
|
348
|
+
type ProjectRuntime = "deno" | "node"
|
|
349
|
+
A runtime a project's build file can run on.
|
|
350
|
+
````
|
|
351
|
+
|
|
352
|
+
</details>
|
|
353
|
+
|
|
354
|
+
<!-- ZUKE:API:END -->
|
package/mod.d.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { type SetupHost } from "./src/setup.ts";
|
|
2
|
+
import { type ImportSource } from "./src/import.ts";
|
|
3
|
+
import { type StarActions } from "./src/star.ts";
|
|
4
|
+
import { type BuildProbe, type BuildRunner } from "./src/dispatch.ts";
|
|
5
|
+
import type { EmbeddedEngine } from "./src/embedded_engine.ts";
|
|
6
|
+
import { type UpgradeHost } from "./src/upgrade.ts";
|
|
7
|
+
import { type ProjectHost } from "./src/project.ts";
|
|
8
|
+
export type { SetupHost } from "./src/setup.ts";
|
|
9
|
+
export { EMBEDDED_ENGINE_ENV, type EmbeddedEngine, } from "./src/embedded_engine.ts";
|
|
10
|
+
export type { ImportSource } from "./src/import.ts";
|
|
11
|
+
export type { StarActions } from "./src/star.ts";
|
|
12
|
+
export type { InstallHost } from "./src/install_source.ts";
|
|
13
|
+
export type { UpgradeHost } from "./src/upgrade.ts";
|
|
14
|
+
export type { EnginePinHost } from "./src/engine_pin.ts";
|
|
15
|
+
export type { SdkSetupOptions } from "./src/setup.ts";
|
|
16
|
+
export type { BinaryPin, BinaryTarget } from "./src/binary_pin.ts";
|
|
17
|
+
export type { ProjectHost } from "./src/project.ts";
|
|
18
|
+
export type { ProjectRuntime } from "./src/runtime_field.ts";
|
|
19
|
+
export type { BuildLocation, BuildProbe, BuildRunner, Ownership, } from "./src/dispatch.ts";
|
|
20
|
+
export { FORWARDED_ENV } from "./src/dispatch.ts";
|
|
21
|
+
/**
|
|
22
|
+
* The interactive surface, injectable so the wizard is testable without a TTY.
|
|
23
|
+
*/
|
|
24
|
+
export interface Prompter {
|
|
25
|
+
/** Whether prompts should be shown (i.e. stdin is a terminal). */
|
|
26
|
+
interactive(): boolean;
|
|
27
|
+
/** Ask a free-text question, returning `fallback` if unanswered. */
|
|
28
|
+
ask(question: string, fallback: string): string;
|
|
29
|
+
/** Ask a yes/no question. */
|
|
30
|
+
confirm(question: string): boolean;
|
|
31
|
+
}
|
|
32
|
+
/** The real {@link Prompter}, backed by Deno's `prompt`/`confirm`. */
|
|
33
|
+
export declare const defaultPrompter: Prompter;
|
|
34
|
+
/** Flags accepted by `zuke setup`. */
|
|
35
|
+
export interface SetupFlags {
|
|
36
|
+
/** Overwrite existing files. */
|
|
37
|
+
force: boolean;
|
|
38
|
+
/** Skip prompts and accept defaults. */
|
|
39
|
+
yes: boolean;
|
|
40
|
+
/** Build class name for the starter build file. */
|
|
41
|
+
name?: string;
|
|
42
|
+
/** The TypeScript build file's name (`--build-file`). Unset: ask, else `build.ts`. */
|
|
43
|
+
buildFile?: string;
|
|
44
|
+
/** Directory to scaffold into (defaults to the current directory). */
|
|
45
|
+
dir?: string;
|
|
46
|
+
/** Base name for the launcher scripts, when `zuke` is taken by a directory. */
|
|
47
|
+
launcherName?: string;
|
|
48
|
+
/** Also write `.mcp.json`, registering the build's MCP server for agent clients. */
|
|
49
|
+
mcp: boolean;
|
|
50
|
+
/** Register that server with `--allow-run`, so the agent may execute targets. Implies `mcp`. */
|
|
51
|
+
allowRun: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Which launchers to scaffold: `true` (`--bootstrap`) for ones that
|
|
54
|
+
* download their pinned, checksum-verified runtime when it is missing —
|
|
55
|
+
* Deno for a `zuke.ts` build, the `zuke` binary for a hosted one — `false`
|
|
56
|
+
* (`--no-bootstrap`) for ones that require it on `PATH` and fail closed.
|
|
57
|
+
* Unset: ask when interactive, else take the default (bootstrap).
|
|
58
|
+
*/
|
|
59
|
+
bootstrapDeno?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* The SDK whose build to scaffold (`--sdk python`): a `build.py` the engine
|
|
62
|
+
* runs, in place of a `zuke.ts`. Unset: a TypeScript build.
|
|
63
|
+
*/
|
|
64
|
+
sdk?: string;
|
|
65
|
+
/** The runtime of a TypeScript build (`--runtime deno|node`). Unset: Deno, asked when interactive. */
|
|
66
|
+
runtime?: string;
|
|
67
|
+
/**
|
|
68
|
+
* The `zuke` release an SDK build's launchers run (`--zuke`), whose engine
|
|
69
|
+
* `zuke.json` pins. Unset: this zuke's own release.
|
|
70
|
+
*/
|
|
71
|
+
zuke?: string;
|
|
72
|
+
}
|
|
73
|
+
/** Parse the argument list following `zuke setup`. */
|
|
74
|
+
export declare function parseSetupFlags(args: string[]): SetupFlags;
|
|
75
|
+
/** Flags accepted by `zuke import` — the setup flags plus `--from`. */
|
|
76
|
+
export interface ImportFlags extends SetupFlags {
|
|
77
|
+
/**
|
|
78
|
+
* Force a source (`package.json`, `makefile` or `pyproject`); auto-detected
|
|
79
|
+
* when unset.
|
|
80
|
+
*/
|
|
81
|
+
from?: ImportSource;
|
|
82
|
+
}
|
|
83
|
+
/** Parse the argument list following `zuke import`. */
|
|
84
|
+
export declare function parseImportFlags(args: string[]): ImportFlags;
|
|
85
|
+
/**
|
|
86
|
+
* Runs `deno doc <args>` — the injectable subprocess seam for
|
|
87
|
+
* {@link commandDoc}, so the command is testable without spawning `deno`.
|
|
88
|
+
*/
|
|
89
|
+
export type DocRunner = (denoArgs: string[]) => Promise<number>;
|
|
90
|
+
/**
|
|
91
|
+
* The CLI entry point. Returns a process exit code; `host`, `prompter`,
|
|
92
|
+
* `docRunner`, `starActions`, `buildRunner`, `buildProbe`, `upgradeHost` and
|
|
93
|
+
* `projectHost` are injectable for testing. `engine` is the engine the
|
|
94
|
+
* compiled binary carries, absent under `deno run`: see {@link binaryMain}.
|
|
95
|
+
*/
|
|
96
|
+
export declare function main(args: string[], host?: SetupHost, prompter?: Prompter, docRunner?: DocRunner, starActions?: StarActions, buildRunner?: BuildRunner, buildProbe?: BuildProbe, upgradeHost?: UpgradeHost, projectHost?: ProjectHost, engine?: EmbeddedEngine): Promise<number>;
|
|
97
|
+
/**
|
|
98
|
+
* The compiled `zuke` binary's entry point: {@link main} with every default
|
|
99
|
+
* and the `engine` the binary carries, so a project with no `zuke.ts` runs on
|
|
100
|
+
* it with no Deno installed.
|
|
101
|
+
*/
|
|
102
|
+
export declare function binaryMain(args: string[], engine: EmbeddedEngine): Promise<number>;
|