@happytoolin/alur 0.0.3 → 0.0.5

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/README.md CHANGED
@@ -5,144 +5,246 @@
5
5
  [![CI](https://github.com/happytoolin/alur/actions/workflows/ci.yml/badge.svg)](https://github.com/happytoolin/alur/actions/workflows/ci.yml)
6
6
  [![License: GPLv3](https://img.shields.io/badge/License-GPLv3-4F46E5.svg)](https://www.gnu.org/licenses/gpl-3.0)
7
7
  [![npm](https://img.shields.io/npm/v/%40happytoolin%2Falur?logo=npm&logoColor=white)](https://www.npmjs.com/package/@happytoolin/alur)
8
+ [![JSR](https://img.shields.io/jsr/v/%40happytoolin/alur?logo=jsr&logoColor=white)](https://jsr.io/@happytoolin/alur)
9
+ [![crates.io](https://img.shields.io/crates/v/alur?logo=rust&logoColor=white)](https://crates.io/crates/alur)
10
+ [![GitHub release](https://img.shields.io/github/v/release/happytoolin/alur?logo=github&logoColor=white)](https://github.com/happytoolin/alur/releases)
11
+ [![Homebrew](https://img.shields.io/badge/homebrew-happytap-FBB040?logo=homebrew&logoColor=black)](https://github.com/happytoolin/homebrew-happytap)
8
12
  ![npm](https://img.shields.io/badge/npm-supported-CB3837?logo=npm&logoColor=white)
9
13
  ![yarn](https://img.shields.io/badge/yarn-supported-2C8EBB?logo=yarn&logoColor=white)
10
14
  ![pnpm](https://img.shields.io/badge/pnpm-supported-F69220?logo=pnpm&logoColor=white)
11
15
  ![bun](https://img.shields.io/badge/bun-supported-111111?logo=bun&logoColor=white)
12
16
  ![deno](https://img.shields.io/badge/deno-supported-000000?logo=deno&logoColor=white)
13
17
 
14
- Fast package manager routing for `npm`, `yarn`, `pnpm`, `bun`, and `deno`.
18
+ Website: [`alur.happytoolin.com`](https://alur.happytoolin.com)
15
19
 
16
- `alur` is inspired by Antfu's [`ni`](https://github.com/antfu-collective/ni#readme), but packaged as a single multicall binary with extra shell setup for a `node` shim.
20
+ `alur` is a native package-manager command router for `npm`, `yarn`, `pnpm`, `bun`, and `deno`.
17
21
 
18
- `alur` is still beta software and may have bugs.
19
- The supported interface is the CLI; the Rust crate modules are internal and do not carry a stable API guarantee.
22
+ It has three main jobs:
20
23
 
21
- One install gives you:
24
+ 1. Fast mode runs eligible scripts and local bins directly, skipping package-manager CLI startup.
25
+ 2. The `ni` command family gives you one set of commands across every package manager.
26
+ 3. The optional `node` shim lets you type `node install`, `node run`, and `node exec` like Node had Bun-style package commands.
22
27
 
23
- - `alur`
24
- - `ni`, `nr`, `nlx`, `nun`, `nci`, `np`, `ns`
25
- - `node` shim via `alur init <shell>` (managed launcher)
28
+ `alur` is beta software. The supported interface is the CLI; Rust crate modules are internal and do not carry a stable API guarantee.
26
29
 
27
- ## Install
30
+ ## Quick Start
28
31
 
29
- ### npm (global)
32
+ Install it on macOS / Linux:
30
33
 
31
34
  ```bash
32
- npm install -g @happytoolin/alur
35
+ curl -fsSL https://bin.happytoolin.com/alur | sh
33
36
  alur --version
34
37
  ```
35
38
 
36
- This installs `alur` and the `ni`-family aliases (`ni`, `nr`, `nlx`, `nun`, `nci`, `np`, `ns`) onto your global npm bin path.
37
- The `node` shim is only enabled through `alur init <shell>`.
38
- Under the hood, the npm postinstall downloads the matching native `alur` binary from the GitHub release.
39
+ Install it with PowerShell:
39
40
 
40
- ### Homebrew
41
+ ```powershell
42
+ irm https://bin.happytoolin.com/alur.ps1 | iex
43
+ alur --version
44
+ ```
45
+
46
+ Or install from npm:
41
47
 
42
48
  ```bash
43
- brew tap happytoolin/happytap
44
- brew install alur
49
+ npm install -g @happytoolin/alur
45
50
  alur --version
46
51
  ```
47
52
 
48
- ### Script install (macOS / Linux)
53
+ Or install globally from JSR with Deno:
49
54
 
50
55
  ```bash
51
- curl --proto '=https' --tlsv1.2 -LsSf https://github.com/happytoolin/alur/releases/latest/download/alur-installer.sh | sh
56
+ deno install --global -A -n alur jsr:@happytoolin/alur/alur
57
+ alur --version
52
58
  ```
53
59
 
54
- To pin a specific version:
60
+ Use the short commands:
55
61
 
56
62
  ```bash
57
- curl --proto '=https' --tlsv1.2 -LsSf https://github.com/happytoolin/alur/releases/download/v0.0.3/alur-installer.sh | sh
63
+ ni vite # add vite with the detected package manager
64
+ nr dev # run the dev script, using fast mode when safe
65
+ nlx eslint . # run a local bin directly when possible
66
+ nci # clean install from the lockfile
58
67
  ```
59
68
 
60
- ### Script install (PowerShell)
69
+ Or use the explicit `alur` commands:
61
70
 
62
- ```powershell
63
- powershell -ExecutionPolicy Bypass -c "irm https://github.com/happytoolin/alur/releases/latest/download/alur-installer.ps1 | iex"
71
+ ```bash
72
+ alur install vite
73
+ alur run dev
74
+ alur exec eslint .
75
+ alur ci
64
76
  ```
65
77
 
66
- ### CI / automation
78
+ Enable the optional `node` shim when you want Node to behave like an all-in-one package command:
67
79
 
68
80
  ```bash
69
- curl --proto '=https' --tlsv1.2 -LsSf https://github.com/happytoolin/alur/releases/download/v0.0.3/alur-installer.sh | sh
70
- echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> "$GITHUB_ENV"
81
+ eval "$(alur init zsh)"
82
+ node install vite
83
+ node run dev
84
+ node exec vitest
71
85
  ```
72
86
 
73
- Use the versioned release URL to pin. Use `releases/latest/download` to track the latest release.
87
+ ## Install
74
88
 
75
- ## Enable the `node` shim
89
+ ### npm
76
90
 
77
- Once `alur` is installed, run `alur init` for your shell to enable the `node` shim.
78
- This creates a managed `node` launcher (a symlink on Unix, copied executable on Windows) and outputs a PATH setup line for your shell config.
91
+ ```bash
92
+ npm install -g @happytoolin/alur
93
+ alur --version
94
+ ```
95
+
96
+ The npm package installs `alur` plus the multicall aliases: `ni`, `nr`, `nlx`, `nun`, `nci`, `np`, and `ns`.
79
97
 
80
- Add the output to the **end** of your shell rc file (after nvm / mise / asdf / fnm / volta init):
98
+ The `node` shim is not enabled by npm install. It is always opt-in through `alur init <shell>`.
81
99
 
82
- **zsh** (`~/.zshrc`):
100
+ Under the hood, npm postinstall downloads the matching native `alur` binary from the GitHub release.
101
+
102
+ ### Homebrew
83
103
 
84
104
  ```bash
85
- eval "$(alur init zsh)"
105
+ brew tap happytoolin/happytap
106
+ brew install alur
107
+ alur --version
86
108
  ```
87
109
 
88
- **bash** (`~/.bashrc`):
110
+ ### JSR
89
111
 
90
112
  ```bash
91
- eval "$(alur init bash)"
113
+ deno install --global -A -n alur jsr:@happytoolin/alur/alur
114
+ alur --version
92
115
  ```
93
116
 
94
- **fish** (`~/.config/fish/config.fish`):
117
+ ### Script Install
95
118
 
96
- ```fish
97
- alur init fish | source
119
+ macOS / Linux:
120
+
121
+ ```bash
122
+ curl -fsSL https://bin.happytoolin.com/alur | sh
123
+ ```
124
+
125
+ Shell script alias:
126
+
127
+ ```bash
128
+ curl -fsSL https://bin.happytoolin.com/alur.sh | sh
98
129
  ```
99
130
 
100
- **PowerShell** (`$PROFILE`):
131
+ PowerShell:
101
132
 
102
133
  ```powershell
103
- Invoke-Expression (& alur init powershell)
134
+ irm https://bin.happytoolin.com/alur.ps1 | iex
104
135
  ```
105
136
 
106
- **Nushell** (`~/.config/nushell/config.nu`):
137
+ Direct GitHub release URLs are available too:
107
138
 
108
- ```nu
109
- alur init nushell | save --force ~/.config/nushell/alur.nu
110
- source ~/.config/nushell/alur.nu
139
+ ```bash
140
+ curl --proto '=https' --tlsv1.2 -LsSf https://github.com/happytoolin/alur/releases/latest/download/alur-installer.sh | sh
111
141
  ```
112
142
 
113
- Once added, restart your shell. `node` will route known npm verbs through alur
114
- (`node install vite` → `ni vite`) and pass everything else through to the real Node.js.
143
+ Pin a specific version:
115
144
 
116
- ## Commands
145
+ ```bash
146
+ curl --proto '=https' --tlsv1.2 -LsSf https://github.com/happytoolin/alur/releases/download/v0.0.5/alur-installer.sh | sh
147
+ ```
117
148
 
118
- ### Canonical `alur` commands
149
+ CI example:
119
150
 
120
151
  ```bash
121
- alur install vite
122
- alur uninstall lodash
123
- alur run dev
124
- alur exec vitest
125
- alur ci
126
- alur parallel "pnpm dev" "pnpm test"
127
- alur sequential "pnpm lint" "pnpm test"
152
+ curl --proto '=https' --tlsv1.2 -LsSf https://github.com/happytoolin/alur/releases/download/v0.0.5/alur-installer.sh | sh
153
+ echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> "$GITHUB_ENV"
128
154
  ```
129
155
 
130
- ### `ni`
156
+ Use `releases/latest/download` to follow the latest release. Use a versioned release URL for repeatable automation.
157
+
158
+ ## Feature 1: Fast Mode
131
159
 
132
- Install dependencies or add new ones.
160
+ Fast mode is the default for eligible `nr`, `alur run`, `nlx`, `alur exec`, and matching `node` shim commands.
161
+
162
+ Instead of starting `npm run`, `pnpm exec`, or another package-manager CLI, `alur` resolves the script or local executable itself and launches it directly.
163
+
164
+ ```bash
165
+ nr dev
166
+ alur run test -- --watch
167
+ nlx eslint .
168
+ node run dev
169
+ node exec vitest
170
+ ```
171
+
172
+ Fast mode currently targets common local work:
173
+
174
+ - `package.json` scripts, including `pre<script>` and `post<script>` lifecycle hooks
175
+ - nearest `deno.json` / `deno.jsonc` tasks in Deno projects
176
+ - local bins in `node_modules/.bin`
177
+ - pnpm hoisted bins under `node_modules/.pnpm/node_modules/.bin`
178
+ - package-local `bin` entries
179
+
180
+ If `alur` cannot prove the fast path is correct, it falls back to package-manager mode.
181
+
182
+ Common fallback cases include Yarn Plug'n'Play, Deno workspaces, remote package exec, and scripts that depend on package-manager-specific env expansion.
183
+
184
+ Control it per command:
185
+
186
+ ```bash
187
+ nr --fast dev # prefer fast mode
188
+ nr --pm dev # force package-manager mode
189
+ nlx --pm create-vite@latest
190
+ node run --pm dev
191
+ ```
192
+
193
+ Inspect what happened:
194
+
195
+ ```bash
196
+ nr dev --print-command
197
+ nr dev --explain
198
+ alur doctor
199
+ ```
200
+
201
+ Latest tracked fast benchmark snapshot: fast mode averaged `4.59x` faster than package-manager mode, with local-bin exec cases like `nlx hello --flag` reaching `47.43x`.
202
+
203
+ See [`benchmark/LATEST.md`](benchmark/LATEST.md) for the current snapshot and [`docs/fast-compat.md`](docs/fast-compat.md) for the exact compatibility rules.
204
+
205
+ ## Feature 2: Short Commands
206
+
207
+ Use one command vocabulary and let `alur` pick the right package manager from the project.
208
+
209
+ | Task | Short command | Explicit command |
210
+ | ------------------------------------ | ------------- | ----------------- |
211
+ | Install dependencies or add packages | `ni` | `alur install` |
212
+ | Run scripts | `nr` | `alur run` |
213
+ | Execute package binaries | `nlx` | `alur exec` |
214
+ | Uninstall packages | `nun` | `alur uninstall` |
215
+ | Clean install | `nci` | `alur ci` |
216
+ | Run shell commands in parallel | `np` | `alur parallel` |
217
+ | Run shell commands sequentially | `ns` | `alur sequential` |
218
+
219
+ ### Install / Add
220
+
221
+ `ni` installs dependencies when called with no package names. It adds packages when package names are present.
133
222
 
134
223
  ```bash
135
224
  ni
136
225
  ni vite
226
+ ni react react-dom
137
227
  ni -D vitest
138
228
  ni -g eslint
139
229
  ni --frozen
140
230
  ni --frozen-if-present
141
231
  ```
142
232
 
143
- ### `nr`
233
+ Examples by detected package manager:
234
+
235
+ | Project | `ni` | `ni vite` |
236
+ | ------- | -------------- | --------------- |
237
+ | npm | `npm i` | `npm i vite` |
238
+ | yarn | `yarn install` | `yarn add vite` |
239
+ | pnpm | `pnpm i` | `pnpm add vite` |
240
+ | bun | `bun install` | `bun add vite` |
241
+ | deno | `deno install` | `deno add vite` |
242
+
243
+ Global installs use `global_package_manager`, which defaults to `npm`.
244
+
245
+ ### Run Scripts
144
246
 
145
- Run package scripts.
247
+ `nr` runs package scripts. With no script name, it runs `start`.
146
248
 
147
249
  ```bash
148
250
  nr
@@ -152,9 +254,11 @@ nr test -- --watch
152
254
  nr --if-present lint
153
255
  ```
154
256
 
155
- ### `nlx`
257
+ In fast mode, `nr` can skip the package manager and run the script directly. Use `--pm` when you need exact package-manager behavior.
156
258
 
157
- Execute binaries without adding them permanently to your project.
259
+ ### Execute Binaries
260
+
261
+ `nlx` runs package binaries.
158
262
 
159
263
  ```bash
160
264
  nlx vitest
@@ -162,83 +266,132 @@ nlx eslint .
162
266
  nlx create-vite@latest
163
267
  ```
164
268
 
165
- ### `nun`
269
+ When a local executable can be resolved confidently, `nlx` runs it directly. Remote or ambiguous cases fall back to the detected package manager.
166
270
 
167
- Uninstall dependencies.
271
+ ### Uninstall / Clean Install
168
272
 
169
273
  ```bash
170
274
  nun lodash
171
275
  nun react react-dom
172
276
  nun -g typescript
173
- ```
174
-
175
- ### `nci`
176
277
 
177
- Run a clean install. If a lockfile exists, `alur` uses the package-manager-specific frozen install command.
178
-
179
- ```bash
180
278
  nci
279
+ nci --prefer-offline
181
280
  ```
182
281
 
183
- ### `np` / `ns`
282
+ `nci` uses a package-manager-specific frozen install when a lockfile exists. Without a lockfile, it falls back to normal install behavior.
184
283
 
185
- Run shell commands in parallel or sequentially.
284
+ ### Parallel / Sequential Shell Commands
285
+
286
+ Each argument is a separate shell command.
186
287
 
187
288
  ```bash
188
289
  np "pnpm dev" "pnpm test"
189
290
  ns "pnpm lint" "pnpm test"
190
291
  ```
191
292
 
192
- ### `node`
293
+ `np` runs all commands concurrently and returns the first non-zero exit code. `ns` runs commands in order and stops on the first failure.
294
+
295
+ ## Feature 3: Node Shim
193
296
 
194
- `alur` can also act as a package-manager-aware `node` shim.
195
- Enable it by adding `alur init <shell>` to your shell config first.
297
+ The `node` shim is for people who want package commands to feel built into Node.
298
+
299
+ After init, these work:
196
300
 
197
301
  ```bash
302
+ node install
198
303
  node install vite
304
+ node add react
199
305
  node uninstall lodash
306
+ node remove lodash
200
307
  node run dev
201
308
  node exec vitest
309
+ node x eslint .
202
310
  node ci
203
311
  node p "echo one" "echo two"
312
+ node s "pnpm lint" "pnpm test"
204
313
  ```
205
314
 
206
- Regular Node.js usage still passes through:
315
+ That gives Node a Bun-like command surface, while still using your project's real package manager.
316
+
317
+ The shim routes known alur shim verbs and aliases:
318
+
319
+ | `node` input | Routes to |
320
+ | --------------------------------- | ------------------------- |
321
+ | `node install`, `node i` | install or add behavior |
322
+ | `node add` | add behavior |
323
+ | `node uninstall`, `node remove` | uninstall behavior |
324
+ | `node run` | script runner |
325
+ | `node exec`, `node x`, `node dlx` | binary executor |
326
+ | `node ci` | clean install |
327
+ | `node p` | parallel shell commands |
328
+ | `node s` | sequential shell commands |
329
+
330
+ Everything else passes through to the real Node.js binary:
207
331
 
208
332
  ```bash
209
333
  node script.js
210
334
  node -v
335
+ node --run dev
336
+ node --watch server.js
211
337
  node -- --trace-warnings
212
338
  ```
213
339
 
214
- ### Utilities
340
+ ### Enable It
341
+
342
+ Run `alur init` for your shell and put the output at the end of your shell config, after tools like `nvm`, `mise`, `asdf`, `fnm`, or `volta`.
343
+
344
+ zsh (`~/.zshrc`):
215
345
 
216
346
  ```bash
217
- alur help ni
218
- alur completion zsh
219
- alur init bash
220
- alur doctor
347
+ eval "$(alur init zsh)"
221
348
  ```
222
349
 
223
- ## Global Flags
224
-
225
- These work across `alur` and the multicall aliases:
350
+ bash (`~/.bashrc`):
226
351
 
227
352
  ```bash
228
- --print-command
229
- --explain
230
- -C <dir>
231
- -v --version
232
- -h --help
353
+ eval "$(alur init bash)"
233
354
  ```
234
355
 
235
- Use `--` to forward flags to the underlying package manager or script:
356
+ fish (`~/.config/fish/config.fish`):
236
357
 
237
- ```bash
238
- alur install -- --help
239
- nr test -- --watch
358
+ ```fish
359
+ alur init fish | source
360
+ ```
361
+
362
+ PowerShell (`$PROFILE`):
363
+
364
+ ```powershell
365
+ Invoke-Expression (& alur init powershell)
366
+ ```
367
+
368
+ Nushell (`~/.config/nushell/config.nu`):
369
+
370
+ ```nu
371
+ alur init nushell | save --force ~/.config/nushell/alur.nu
372
+ source ~/.config/nushell/alur.nu
240
373
  ```
241
374
 
375
+ Restart your shell after editing your config.
376
+
377
+ `alur init` creates a managed `node` launcher and prints shell-specific PATH setup. On routed commands, `alur` finds the real Node.js binary and keeps normal Node behavior available.
378
+
379
+ If real Node cannot be found, set `ALUR_REAL_NODE=/absolute/path/to/node`.
380
+
381
+ To disable the shim, remove the `alur init` line from your shell config and restart the shell.
382
+
383
+ ## Package Manager Detection
384
+
385
+ `alur` detects the package manager from:
386
+
387
+ 1. `packageManager` in `package.json`
388
+ 2. lockfiles such as `pnpm-lock.yaml`, `pnpm-workspace.yaml`, `yarn.lock`, `package-lock.json`, `bun.lockb`, or `deno.lock`
389
+ 3. `devEngines.packageManager` in `package.json`
390
+ 4. install metadata such as `.pnp.cjs`, `node_modules/.pnpm`, or `node_modules/.package-lock.json`
391
+ 5. config defaults if detection is unavailable
392
+
393
+ When detection fails, add a `packageManager` field, commit a lockfile, or set `default_package_manager`.
394
+
242
395
  ## Configuration
243
396
 
244
397
  Config file:
@@ -261,29 +414,52 @@ Environment overrides:
261
414
  - `ALUR_DEFAULT_PACKAGE_MANAGER`
262
415
  - `ALUR_GLOBAL_PACKAGE_MANAGER`
263
416
  - `ALUR_FAST_MODE`
417
+ - `ALUR_REAL_NODE`
264
418
 
265
- ## How It Works
419
+ ## Global Flags
266
420
 
267
- `alur` detects the package manager from:
421
+ These work across `alur`, the `ni` aliases, and routed `node` shim commands:
268
422
 
269
- 1. `packageManager` in `package.json`
270
- 2. lockfiles such as `pnpm-lock.yaml`, `pnpm-workspace.yaml`, `yarn.lock`, `package-lock.json`, `bun.lockb`, or `deno.lock`
271
- 3. `devEngines.packageManager` in `package.json`
272
- 4. install metadata such as `.pnp.cjs`, `node_modules/.pnpm`, or `node_modules/.package-lock.json`
273
- 5. config defaults if detection is unavailable
423
+ ```bash
424
+ --fast
425
+ --pm
426
+ --print-command
427
+ --explain
428
+ -C <dir>
429
+ -v --version
430
+ -h --help
431
+ ```
432
+
433
+ For the `node` shim, alur only parses these flags after a routed verb. Normal
434
+ Node.js flags and non-routed first arguments are passed through untouched:
435
+
436
+ ```bash
437
+ node run --pm dev --print-command
438
+ node --run dev --print-command
439
+ node --conditions=dev script.js
440
+ ```
441
+
442
+ Use `--` to forward flags to the underlying package manager or script:
443
+
444
+ ```bash
445
+ alur install -- --help
446
+ nr test -- --watch
447
+ node run test -- --watch
448
+ ```
274
449
 
275
- Then it maps the command family to the right underlying command:
450
+ ## Utilities
276
451
 
277
- - `ni` -> install or add
278
- - `nr` -> run or task
279
- - `nlx` -> `npx` / `pnpm dlx` / `yarn dlx` / `bun x`
280
- - `nun` -> uninstall or remove
281
- - `nci` -> frozen install when lockfiles exist
282
- - `np` / `ns` -> parallel or sequential shell commands
452
+ ```bash
453
+ alur help
454
+ alur help ni
455
+ alur completion zsh
456
+ alur init bash
457
+ alur doctor
458
+ ```
283
459
 
284
460
  ## Troubleshooting
285
461
 
286
- ### PowerShell `ni` alias conflict
462
+ ### PowerShell `ni` Alias Conflict
287
463
 
288
464
  PowerShell ships with a built-in `ni` alias for `New-Item`.
289
465
 
@@ -294,53 +470,41 @@ Remove-Item Alias:ni -ErrorAction SilentlyContinue
294
470
  Invoke-Expression (& alur init powershell)
295
471
  ```
296
472
 
297
- ### Check what `alur` resolved
473
+ ### Check What Will Run
474
+
475
+ Use `--print-command` for the resolved command and `--explain` for detection details:
298
476
 
299
477
  ```bash
300
478
  ni vite --print-command
301
479
  nr dev --explain
302
- alur doctor
480
+ node install vite --print-command
303
481
  ```
304
482
 
305
- ## Benchmarking
483
+ ### Skip Fast Mode For Exact PM Behavior
306
484
 
307
- The active benchmark suite lives in [`benchmark/`](benchmark/).
308
-
309
- If you use [`just`](https://github.com/casey/just), the common local commands are wrapped in [`justfile`](justfile):
310
-
311
- ```bash
312
- just build-release
313
- just test
314
- just test-fast
315
- just ci
316
- just bench
317
- ```
485
+ Fast mode intentionally does not emulate every package-manager edge case.
318
486
 
319
- Run the default local benchmark with:
487
+ Use `--pm` for Yarn PnP projects, Deno workspaces, package-manager-specific env expansion, or debugging exact package-manager behavior:
320
488
 
321
489
  ```bash
322
- npm ci
323
- npm run bench
324
- just bench
490
+ nr --pm build
491
+ nlx --pm create-vite@latest
492
+ node run --pm dev
325
493
  ```
326
494
 
327
- Pass options through either entrypoint:
495
+ ## Benchmarking
328
496
 
329
- ```bash
330
- npm run bench -- --track=compare
331
- npm run bench -- --track=fast
332
- npm run bench -- --track=runtime
333
- npm run bench -- --track=direct
334
- just bench --track=direct --runs=3 --warmups=1 --no-build
335
- ```
497
+ The benchmark suite lives in [`benchmark/`](benchmark/).
336
498
 
337
- Run the full release-style matrix with:
499
+ Common local commands:
338
500
 
339
501
  ```bash
340
- npm run bench -- --track=all --runs=500 --warmups=50
502
+ npm ci
503
+ npm run bench
504
+ npm run bench -- --track=all --runs=100 --warmups=10
341
505
  ```
342
506
 
343
- Generate flamegraphs with:
507
+ Generate flamegraphs:
344
508
 
345
509
  ```bash
346
510
  ./benchmark/profile.sh
@@ -350,91 +514,9 @@ Tracked benchmark docs:
350
514
 
351
515
  - current snapshot: [`benchmark/LATEST.md`](benchmark/LATEST.md)
352
516
  - lightweight history: [`benchmark/HISTORY.md`](benchmark/HISTORY.md)
517
+ - benchmark guide: [`benchmark/README.md`](benchmark/README.md)
353
518
  - fast-mode compatibility: [`docs/fast-compat.md`](docs/fast-compat.md)
354
519
 
355
- ### Representative Results
356
-
357
- All numbers below were measured on macOS (Apple Silicon) with the release binary, using `hyperfine` with 10 warmups and 100 measured runs per case. See [`benchmark/LATEST.md`](benchmark/LATEST.md) for the raw tracked snapshot.
358
-
359
- **Headline:** `alur --fast` is **7.4x faster** than running package managers directly, and **4.6x faster** than `alur` in its own PM fallback mode.
360
-
361
- #### 1. Fast mode vs PM mode (inside alur)
362
-
363
- Fast mode bypasses the package manager CLI entirely and runs scripts / local bins natively.
364
-
365
- | Case | PM mode | Fast mode | Speedup |
366
- | ------------------------ | ------: | --------: | --------: |
367
- | `nr noop (npm)` | 246 ms | 37 ms | **6.6x** |
368
- | `nr noop (pnpm)` | 799 ms | 49 ms | **16.4x** |
369
- | `nr noop (yarn)` | 348 ms | 38 ms | **9.3x** |
370
- | `node run noop (pnpm)` | 956 ms | 34 ms | **28.4x** |
371
- | `nlx hello --flag (npm)` | 288 ms | 17 ms | **17.0x** |
372
- | `nr noop (bun)` | 70 ms | 37 ms | **1.9x** |
373
- | `nr noop (deno)` | 80 ms | 35 ms | **2.2x** |
374
-
375
- _Geometric mean across all package managers: **4.6x**._
376
-
377
- pnpm and yarn see the biggest wins because their CLIs carry the most startup overhead. Bun and Deno are already fast, so the margin is smaller (but still consistently ahead).
378
-
379
- #### 2. alur fast vs direct package-manager usage
380
-
381
- This is the real-world comparison: what users actually type today versus using `alur`.
382
-
383
- | Case | Direct PM | alur --fast | Speedup |
384
- | ------------------------ | --------: | ---------: | --------: |
385
- | `npm run noop` | 320 ms | 53 ms | **6.1x** |
386
- | `pnpm run noop` | 749 ms | 41 ms | **18.2x** |
387
- | `yarn run noop` | 443 ms | 34 ms | **13.0x** |
388
- | `npx hello --flag` | 300 ms | 4.8 ms | **62.0x** |
389
- | `pnpm exec hello --flag` | 733 ms | 8.9 ms | **82.8x** |
390
- | `bun run noop` | 79 ms | 34 ms | **2.4x** |
391
- | `deno task noop` | 50 ms | 34 ms | **1.5x** |
392
-
393
- _Geometric mean: **7.4x**._
394
-
395
- Local bin execution is the standout feature: `npx` and `pnpm exec` spend hundreds of milliseconds resolving, validating, and bootstrapping before they even start your binary. `alur` resolves the bin once and runs it directly.
396
-
397
- #### 3. alur vs Antfu's `ni`
398
-
399
- For startup/version checks, `alur` is faster:
400
-
401
- | Case | antfu/ni | alur | Speedup |
402
- | -------------- | -------: | ----: | -------: |
403
- | `ni --version` | 149 ms | 92 ms | **1.6x** |
404
-
405
- _Current compare track keeps only version startup because `alur` no longer carries legacy `?` command-printing compatibility._
406
-
407
- #### 4. Runtime comparison vs Bun and Deno
408
-
409
- Even against native runtime task execution, `alur` holds its own:
410
-
411
- | Case | alur | bun | deno |
412
- | ------------ | ----: | -----: | ----: |
413
- | `task noop` | 33 ms | 78 ms | 49 ms |
414
- | `task hooks` | 90 ms | 210 ms | 77 ms |
415
-
416
- `alur` is **2.3x faster than bun** for task execution and slightly faster than Deno for simple scripts.
417
-
418
- ### Methodology
419
-
420
- The benchmark suite lives in [`benchmark/`](benchmark/) and uses `hyperfine` to time the release binary. It covers five angles:
421
-
422
- - **`direct`** — normal package-manager commands (`npm run`, `pnpm exec`, etc.) vs `alur --fast`
423
- - **`fast`** — `alur` PM mode vs `alur` fast mode (isolates the native-execution win)
424
- - **`compare`** — `alur` vs `@antfu/ni` on startup/version overhead
425
- - **`runtime`** — `alur` vs `bun` vs `deno` on actual task execution time
426
- - **`fixtures`** — real project fixtures from `tests/fixtures/` across all detection categories
427
-
428
- Run the full matrix locally:
429
-
430
- ```bash
431
- npm run bench -- --track=all --runs=100 --warmups=10
432
- ```
433
-
434
- Or generate flamegraphs:
435
-
436
- ```bash
437
- ./benchmark/profile.sh
438
- ```
520
+ ## Acknowledgement
439
521
 
440
- Tracked snapshots are kept in [`benchmark/LATEST.md`](benchmark/LATEST.md).
522
+ The short command family follows the spirit of Antfu's [`ni`](https://github.com/antfu-collective/ni#readme).
@@ -30,7 +30,7 @@
30
30
  "hasInstallScript": true,
31
31
  "license": "GPL-3.0-only",
32
32
  "name": "@happytoolin/alur",
33
- "version": "0.0.3"
33
+ "version": "0.0.5"
34
34
  },
35
35
  "node_modules/@isaacs/cliui": {
36
36
  "engines": {
@@ -549,5 +549,5 @@
549
549
  }
550
550
  },
551
551
  "requires": true,
552
- "version": "0.0.3"
552
+ "version": "0.0.5"
553
553
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "artifactDownloadUrls": [
3
- "https://github.com/happytoolin/alur/releases/download/v0.0.3"
3
+ "https://github.com/happytoolin/alur/releases/download/v0.0.5"
4
4
  ],
5
5
  "author": "Spark <helllo@kamran.sh>",
6
6
  "bin": {
@@ -20,7 +20,7 @@
20
20
  "detect-libc": "^2.1.2",
21
21
  "rimraf": "^6.1.3"
22
22
  },
23
- "description": "ni-compatible package manager command router with node shim",
23
+ "description": "Fast package-manager routing with short commands and an opt-in Node shim",
24
24
  "devDependencies": {
25
25
  "prettier": "^3.8.1"
26
26
  },
@@ -32,14 +32,14 @@
32
32
  "major": 2,
33
33
  "series": 31
34
34
  },
35
- "homepage": "https://github.com/happytoolin/alur",
35
+ "homepage": "https://alur.happytoolin.com",
36
36
  "keywords": [
37
37
  "command-line-utilities",
38
38
  "development-tools",
39
39
  "package-manager",
40
+ "task-runner",
41
+ "node-shim",
40
42
  "npm",
41
- "yarn",
42
- "pnpm",
43
43
  "cli"
44
44
  ],
45
45
  "license": "GPL-3.0-only",
@@ -137,7 +137,7 @@
137
137
  "zipExt": ".tar.xz"
138
138
  }
139
139
  },
140
- "version": "0.0.3",
140
+ "version": "0.0.5",
141
141
  "volta": {
142
142
  "node": "18.14.1",
143
143
  "npm": "9.5.0"