@alexgorbatchev/dotfiles 0.0.6 → 0.0.10
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 +45 -47
- package/cli.js +157 -157
- package/cli.js.map +274 -274
- package/dashboard-vf1askzj.js +159 -0
- package/{dashboard-0ebz5sqb.js.map → dashboard-vf1askzj.js.map} +33 -33
- package/dashboard.js +11 -11
- package/package.json +1 -1
- package/schemas.d.ts +106 -100
- package/skill/SKILL.md +7 -5
- package/skill/references/api-reference.md +49 -49
- package/skill/references/configuration.md +184 -174
- package/skill/references/installation-methods/brew.md +18 -18
- package/skill/references/installation-methods/cargo.md +19 -19
- package/skill/references/installation-methods/curl-binary.md +29 -27
- package/skill/references/installation-methods/curl-script.md +28 -28
- package/skill/references/installation-methods/curl-tar.md +27 -19
- package/skill/references/installation-methods/dmg.md +24 -24
- package/skill/references/installation-methods/gitea-release.md +24 -24
- package/skill/references/installation-methods/github-release.md +20 -20
- package/skill/references/installation-methods/manual.md +18 -18
- package/skill/references/installation-methods/npm.md +19 -19
- package/skill/references/installation-methods/overview.md +74 -75
- package/skill/references/installation-methods/zsh-plugin.md +31 -32
- package/skill/references/make-tool.md +168 -167
- package/skill/references/shell-and-hooks.md +78 -77
- package/dashboard-0ebz5sqb.js +0 -159
|
@@ -88,28 +88,28 @@ Files must be named `{tool-name}.tool.ts` and export a default using `defineTool
|
|
|
88
88
|
## Minimal Configuration
|
|
89
89
|
|
|
90
90
|
```typescript
|
|
91
|
-
import { defineTool } from
|
|
91
|
+
import { defineTool } from "@alexgorbatchev/dotfiles";
|
|
92
92
|
|
|
93
93
|
export default defineTool((install, ctx) =>
|
|
94
|
-
install(
|
|
95
|
-
repo:
|
|
96
|
-
}).bin(
|
|
94
|
+
install("github-release", {
|
|
95
|
+
repo: "junegunn/fzf",
|
|
96
|
+
}).bin("fzf"),
|
|
97
97
|
);
|
|
98
98
|
```
|
|
99
99
|
|
|
100
100
|
## Complete Example
|
|
101
101
|
|
|
102
102
|
```typescript
|
|
103
|
-
import { defineTool } from
|
|
103
|
+
import { defineTool } from "@alexgorbatchev/dotfiles";
|
|
104
104
|
|
|
105
105
|
export default defineTool((install, ctx) =>
|
|
106
|
-
install(
|
|
107
|
-
repo:
|
|
106
|
+
install("github-release", {
|
|
107
|
+
repo: "BurntSushi/ripgrep",
|
|
108
108
|
})
|
|
109
|
-
.bin(
|
|
110
|
-
.dependsOn(
|
|
111
|
-
.symlink(
|
|
112
|
-
.zsh((shell) => shell.env({ RIPGREP_CONFIG_PATH:
|
|
109
|
+
.bin("rg")
|
|
110
|
+
.dependsOn("pcre2")
|
|
111
|
+
.symlink("./ripgreprc", "~/.ripgreprc")
|
|
112
|
+
.zsh((shell) => shell.env({ RIPGREP_CONFIG_PATH: "~/.ripgreprc" }).aliases({ rgi: "rg -i" })),
|
|
113
113
|
);
|
|
114
114
|
```
|
|
115
115
|
|
|
@@ -134,7 +134,7 @@ After calling `install()`, these methods are available:
|
|
|
134
134
|
### Imports
|
|
135
135
|
|
|
136
136
|
```typescript
|
|
137
|
-
import { Architecture, defineTool, Platform } from
|
|
137
|
+
import { Architecture, defineTool, Platform } from "@alexgorbatchev/dotfiles";
|
|
138
138
|
```
|
|
139
139
|
|
|
140
140
|
| Export | Description |
|
|
@@ -148,7 +148,7 @@ import { Architecture, defineTool, Platform } from '@alexgorbatchev/dotfiles';
|
|
|
148
148
|
Tools that only contribute shell configuration (no binary installation):
|
|
149
149
|
|
|
150
150
|
```typescript
|
|
151
|
-
export default defineTool((install) => install().zsh((shell) => shell.env({ FOO:
|
|
151
|
+
export default defineTool((install) => install().zsh((shell) => shell.env({ FOO: "bar" })));
|
|
152
152
|
```
|
|
153
153
|
|
|
154
154
|
### Orphaned Artifact Cleanup
|
|
@@ -189,14 +189,14 @@ The project configuration file defines paths, features, and API settings for you
|
|
|
189
189
|
## Basic Configuration
|
|
190
190
|
|
|
191
191
|
```typescript
|
|
192
|
-
import { defineConfig } from
|
|
192
|
+
import { defineConfig } from "@alexgorbatchev/dotfiles";
|
|
193
193
|
|
|
194
194
|
export default defineConfig(() => ({
|
|
195
195
|
paths: {
|
|
196
|
-
dotfilesDir:
|
|
197
|
-
toolConfigsDir:
|
|
198
|
-
generatedDir:
|
|
199
|
-
targetDir:
|
|
196
|
+
dotfilesDir: "~/.dotfiles",
|
|
197
|
+
toolConfigsDir: "~/.dotfiles/tools",
|
|
198
|
+
generatedDir: "~/.dotfiles/.generated",
|
|
199
|
+
targetDir: "~/.local/bin",
|
|
200
200
|
},
|
|
201
201
|
}));
|
|
202
202
|
```
|
|
@@ -209,7 +209,7 @@ export default defineConfig(() => ({
|
|
|
209
209
|
export default defineConfig(async () => {
|
|
210
210
|
const token = await loadTokenFromVault();
|
|
211
211
|
return {
|
|
212
|
-
paths: { dotfilesDir:
|
|
212
|
+
paths: { dotfilesDir: "~/.dotfiles" },
|
|
213
213
|
github: { token },
|
|
214
214
|
};
|
|
215
215
|
});
|
|
@@ -339,13 +339,13 @@ updates: {
|
|
|
339
339
|
```typescript
|
|
340
340
|
export default defineConfig(() => ({
|
|
341
341
|
paths: {
|
|
342
|
-
targetDir:
|
|
342
|
+
targetDir: "~/.local/bin",
|
|
343
343
|
},
|
|
344
344
|
platform: [
|
|
345
345
|
{
|
|
346
|
-
match: [{ platform:
|
|
346
|
+
match: [{ platform: "darwin", arch: "arm64" }],
|
|
347
347
|
config: {
|
|
348
|
-
paths: { targetDir:
|
|
348
|
+
paths: { targetDir: "/opt/homebrew/bin" },
|
|
349
349
|
},
|
|
350
350
|
},
|
|
351
351
|
],
|
|
@@ -355,15 +355,15 @@ export default defineConfig(() => ({
|
|
|
355
355
|
## CLI Usage
|
|
356
356
|
|
|
357
357
|
```bash
|
|
358
|
-
dotfiles --config ~/.dotfiles/config.ts install
|
|
359
|
-
dotfiles install # Uses config.ts in current directory
|
|
358
|
+
dotfiles --config ~/.dotfiles/dotfiles.config.ts install
|
|
359
|
+
dotfiles install # Uses dotfiles.config.ts in current directory
|
|
360
360
|
```
|
|
361
361
|
|
|
362
362
|
## Directory Structure
|
|
363
363
|
|
|
364
364
|
```
|
|
365
365
|
~/.dotfiles/
|
|
366
|
-
├── config.ts
|
|
366
|
+
├── dotfiles.config.ts # Project configuration
|
|
367
367
|
├── tools/ # Tool definitions (*.tool.ts)
|
|
368
368
|
├── CATALOG.md # Auto-generated
|
|
369
369
|
└── .generated/ # Not version controlled
|
|
@@ -381,7 +381,7 @@ Use `.platform()` for cross-platform tool configurations.
|
|
|
381
381
|
## Platform and Architecture Enums
|
|
382
382
|
|
|
383
383
|
```typescript
|
|
384
|
-
import { Architecture, Platform } from
|
|
384
|
+
import { Architecture, Platform } from "@alexgorbatchev/dotfiles";
|
|
385
385
|
|
|
386
386
|
// Platforms (bitwise flags)
|
|
387
387
|
Platform.Linux; // 1
|
|
@@ -399,44 +399,48 @@ Architecture.All; // Both (3)
|
|
|
399
399
|
## Basic Usage
|
|
400
400
|
|
|
401
401
|
```typescript
|
|
402
|
-
import { defineTool, Platform } from
|
|
402
|
+
import { defineTool, Platform } from "@alexgorbatchev/dotfiles";
|
|
403
403
|
|
|
404
404
|
export default defineTool((install) =>
|
|
405
405
|
install()
|
|
406
|
-
.bin(
|
|
407
|
-
.platform(Platform.MacOS, (install) => install(
|
|
406
|
+
.bin("tool")
|
|
407
|
+
.platform(Platform.MacOS, (install) => install("brew", { formula: "tool" }))
|
|
408
408
|
.platform(Platform.Linux, (install) =>
|
|
409
|
-
install(
|
|
410
|
-
repo:
|
|
411
|
-
assetPattern:
|
|
412
|
-
})
|
|
409
|
+
install("github-release", {
|
|
410
|
+
repo: "owner/tool",
|
|
411
|
+
assetPattern: "*linux*.tar.gz",
|
|
412
|
+
}),
|
|
413
|
+
)
|
|
413
414
|
.platform(Platform.Windows, (install) =>
|
|
414
|
-
install(
|
|
415
|
-
repo:
|
|
416
|
-
assetPattern:
|
|
417
|
-
})
|
|
415
|
+
install("github-release", {
|
|
416
|
+
repo: "owner/tool",
|
|
417
|
+
assetPattern: "*windows*.zip",
|
|
418
|
+
}),
|
|
419
|
+
),
|
|
418
420
|
);
|
|
419
421
|
```
|
|
420
422
|
|
|
421
423
|
## With Architecture
|
|
422
424
|
|
|
423
425
|
```typescript
|
|
424
|
-
import { Architecture, defineTool, Platform } from
|
|
426
|
+
import { Architecture, defineTool, Platform } from "@alexgorbatchev/dotfiles";
|
|
425
427
|
|
|
426
428
|
export default defineTool((install) =>
|
|
427
429
|
install()
|
|
428
|
-
.bin(
|
|
430
|
+
.bin("tool")
|
|
429
431
|
.platform(Platform.Linux, Architecture.X86_64, (install) =>
|
|
430
|
-
install(
|
|
431
|
-
repo:
|
|
432
|
-
assetPattern:
|
|
433
|
-
})
|
|
432
|
+
install("github-release", {
|
|
433
|
+
repo: "owner/tool",
|
|
434
|
+
assetPattern: "*linux-amd64*.tar.gz",
|
|
435
|
+
}),
|
|
436
|
+
)
|
|
434
437
|
.platform(Platform.Linux, Architecture.Arm64, (install) =>
|
|
435
|
-
install(
|
|
436
|
-
repo:
|
|
437
|
-
assetPattern:
|
|
438
|
-
})
|
|
439
|
-
|
|
438
|
+
install("github-release", {
|
|
439
|
+
repo: "owner/tool",
|
|
440
|
+
assetPattern: "*linux-arm64*.tar.gz",
|
|
441
|
+
}),
|
|
442
|
+
)
|
|
443
|
+
.platform(Platform.MacOS, Architecture.All, (install) => install("brew", { formula: "tool" })),
|
|
440
444
|
);
|
|
441
445
|
```
|
|
442
446
|
|
|
@@ -447,17 +451,19 @@ Use `Platform.Unix` for shared Linux/macOS configuration:
|
|
|
447
451
|
```typescript
|
|
448
452
|
export default defineTool((install) =>
|
|
449
453
|
install()
|
|
450
|
-
.bin(
|
|
454
|
+
.bin("tool")
|
|
451
455
|
.platform(Platform.Unix, (install) =>
|
|
452
|
-
install(
|
|
453
|
-
repo:
|
|
454
|
-
assetPattern:
|
|
455
|
-
})
|
|
456
|
+
install("github-release", {
|
|
457
|
+
repo: "owner/tool",
|
|
458
|
+
assetPattern: "*unix*.tar.gz",
|
|
459
|
+
}),
|
|
460
|
+
)
|
|
456
461
|
.platform(Platform.Windows, (install) =>
|
|
457
|
-
install(
|
|
458
|
-
repo:
|
|
459
|
-
assetPattern:
|
|
460
|
-
})
|
|
462
|
+
install("github-release", {
|
|
463
|
+
repo: "owner/tool",
|
|
464
|
+
assetPattern: "*windows*.zip",
|
|
465
|
+
}),
|
|
466
|
+
),
|
|
461
467
|
);
|
|
462
468
|
```
|
|
463
469
|
|
|
@@ -465,20 +471,22 @@ export default defineTool((install) =>
|
|
|
465
471
|
|
|
466
472
|
```typescript
|
|
467
473
|
export default defineTool((install) =>
|
|
468
|
-
install(
|
|
469
|
-
.bin(
|
|
474
|
+
install("github-release", { repo: "owner/tool" })
|
|
475
|
+
.bin("tool")
|
|
470
476
|
.platform(Platform.Unix, (install) =>
|
|
471
477
|
install().zsh((shell) =>
|
|
472
478
|
shell.env({
|
|
473
|
-
TOOL_CONFIG:
|
|
474
|
-
})
|
|
475
|
-
)
|
|
479
|
+
TOOL_CONFIG: "~/.config/tool",
|
|
480
|
+
}),
|
|
481
|
+
),
|
|
482
|
+
)
|
|
476
483
|
.platform(Platform.Windows, (install) =>
|
|
477
484
|
install().powershell((shell) =>
|
|
478
485
|
shell.env({
|
|
479
|
-
TOOL_CONFIG:
|
|
480
|
-
})
|
|
481
|
-
)
|
|
486
|
+
TOOL_CONFIG: "~\\.config\\tool",
|
|
487
|
+
}),
|
|
488
|
+
),
|
|
489
|
+
),
|
|
482
490
|
);
|
|
483
491
|
```
|
|
484
492
|
|
|
@@ -486,19 +494,19 @@ export default defineTool((install) =>
|
|
|
486
494
|
|
|
487
495
|
```typescript
|
|
488
496
|
export default defineTool((install) =>
|
|
489
|
-
install(
|
|
490
|
-
.bin(
|
|
491
|
-
.hook(
|
|
492
|
-
if (systemInfo.platform ===
|
|
497
|
+
install("github-release", { repo: "owner/tool" })
|
|
498
|
+
.bin("tool")
|
|
499
|
+
.hook("after-install", async ({ systemInfo, $ }) => {
|
|
500
|
+
if (systemInfo.platform === "darwin") {
|
|
493
501
|
await $`./setup-macos.sh`;
|
|
494
|
-
} else if (systemInfo.platform ===
|
|
502
|
+
} else if (systemInfo.platform === "linux") {
|
|
495
503
|
await $`./setup-linux.sh`;
|
|
496
504
|
}
|
|
497
505
|
|
|
498
|
-
if (systemInfo.arch ===
|
|
506
|
+
if (systemInfo.arch === "arm64") {
|
|
499
507
|
await $`./configure-arm64.sh`;
|
|
500
508
|
}
|
|
501
|
-
})
|
|
509
|
+
}),
|
|
502
510
|
);
|
|
503
511
|
```
|
|
504
512
|
|
|
@@ -544,11 +552,11 @@ This creates:
|
|
|
544
552
|
|
|
545
553
|
```
|
|
546
554
|
env/
|
|
547
|
-
├── source
|
|
548
|
-
├── source.ps1
|
|
549
|
-
├── config.ts
|
|
550
|
-
├── .config/
|
|
551
|
-
└── tools/
|
|
555
|
+
├── source # POSIX shell activation script
|
|
556
|
+
├── source.ps1 # PowerShell activation script
|
|
557
|
+
├── dotfiles.config.ts # Dotfiles configuration
|
|
558
|
+
├── .config/ # XDG_CONFIG_HOME for tool configs
|
|
559
|
+
└── tools/ # Tool configuration directory
|
|
552
560
|
```
|
|
553
561
|
|
|
554
562
|
## Activating an Environment
|
|
@@ -581,13 +589,13 @@ Once activated, all dotfiles commands use the environment's configuration automa
|
|
|
581
589
|
```bash
|
|
582
590
|
source env/source
|
|
583
591
|
|
|
584
|
-
# These all use env/config.ts automatically
|
|
592
|
+
# These all use env/dotfiles.config.ts automatically
|
|
585
593
|
dotfiles generate
|
|
586
594
|
dotfiles install
|
|
587
595
|
dotfiles update fd
|
|
588
596
|
```
|
|
589
597
|
|
|
590
|
-
No need to pass `--config` - the CLI detects `DOTFILES_ENV_DIR` and uses its `config.ts`.
|
|
598
|
+
No need to pass `--config` - the CLI detects `DOTFILES_ENV_DIR` and uses its `dotfiles.config.ts`.
|
|
591
599
|
|
|
592
600
|
## Adding Tools
|
|
593
601
|
|
|
@@ -669,7 +677,7 @@ dotfiles env create .devenv
|
|
|
669
677
|
|
|
670
678
|
# Add to version control
|
|
671
679
|
echo ".devenv/.generated" >> .gitignore
|
|
672
|
-
git add .devenv/config.ts .devenv/tools/ .devenv/source .devenv/source.ps1
|
|
680
|
+
git add .devenv/dotfiles.config.ts .devenv/tools/ .devenv/source .devenv/source.ps1
|
|
673
681
|
git commit -m "Add development environment"
|
|
674
682
|
```
|
|
675
683
|
|
|
@@ -732,7 +740,7 @@ env/
|
|
|
732
740
|
│ └── <installed tools>
|
|
733
741
|
├── source
|
|
734
742
|
├── source.ps1
|
|
735
|
-
├── config.ts
|
|
743
|
+
├── dotfiles.config.ts
|
|
736
744
|
├── .config/
|
|
737
745
|
└── tools/
|
|
738
746
|
```
|
|
@@ -748,13 +756,13 @@ Real-world examples for common tool configuration scenarios.
|
|
|
748
756
|
## GitHub Tool with Shell Integration
|
|
749
757
|
|
|
750
758
|
```typescript
|
|
751
|
-
import { defineTool } from
|
|
759
|
+
import { defineTool } from "@alexgorbatchev/dotfiles";
|
|
752
760
|
|
|
753
761
|
export default defineTool((install, ctx) =>
|
|
754
|
-
install(
|
|
755
|
-
.bin(
|
|
756
|
-
.zsh((shell) => shell.completions(
|
|
757
|
-
.bash((shell) => shell.completions(
|
|
762
|
+
install("github-release", { repo: "BurntSushi/ripgrep" })
|
|
763
|
+
.bin("rg")
|
|
764
|
+
.zsh((shell) => shell.completions("complete/_rg").aliases({ rg: "ripgrep" }))
|
|
765
|
+
.bash((shell) => shell.completions("complete/rg.bash")),
|
|
758
766
|
);
|
|
759
767
|
```
|
|
760
768
|
|
|
@@ -764,29 +772,29 @@ Use `.dependsOn()` when a tool needs other binaries to exist first:
|
|
|
764
772
|
|
|
765
773
|
```typescript
|
|
766
774
|
// provider.tool.ts
|
|
767
|
-
export default defineTool((install) => install(
|
|
775
|
+
export default defineTool((install) => install("manual", { binaryPath: "./bin/provider" }).bin("provider"));
|
|
768
776
|
|
|
769
777
|
// consumer.tool.ts
|
|
770
778
|
export default defineTool((install) =>
|
|
771
|
-
install(
|
|
779
|
+
install("github-release", { repo: "owner/consumer" }).bin("consumer").dependsOn("provider"),
|
|
772
780
|
);
|
|
773
781
|
```
|
|
774
782
|
|
|
775
783
|
## Complex Shell Integration
|
|
776
784
|
|
|
777
785
|
```typescript
|
|
778
|
-
import { defineTool } from
|
|
786
|
+
import { defineTool } from "@alexgorbatchev/dotfiles";
|
|
779
787
|
|
|
780
788
|
export default defineTool((install, ctx) =>
|
|
781
|
-
install(
|
|
782
|
-
.bin(
|
|
789
|
+
install("github-release", { repo: "junegunn/fzf" })
|
|
790
|
+
.bin("fzf")
|
|
783
791
|
.zsh((shell) =>
|
|
784
|
-
shell.env({ FZF_DEFAULT_OPTS:
|
|
792
|
+
shell.env({ FZF_DEFAULT_OPTS: "--color=fg+:cyan" }).completions("shell/completion.zsh").always(/* zsh */ `
|
|
785
793
|
if [[ -f "${ctx.currentDir}/shell/key-bindings.zsh" ]]; then
|
|
786
794
|
source "${ctx.currentDir}/shell/key-bindings.zsh"
|
|
787
795
|
fi
|
|
788
|
-
`)
|
|
789
|
-
)
|
|
796
|
+
`),
|
|
797
|
+
),
|
|
790
798
|
);
|
|
791
799
|
```
|
|
792
800
|
|
|
@@ -794,51 +802,53 @@ export default defineTool((install, ctx) =>
|
|
|
794
802
|
|
|
795
803
|
```typescript
|
|
796
804
|
export default defineTool((install) =>
|
|
797
|
-
install(
|
|
798
|
-
.bin(
|
|
805
|
+
install("github-release", { repo: "owner/tool" })
|
|
806
|
+
.bin("tool")
|
|
799
807
|
.zsh((shell) =>
|
|
800
|
-
shell.completions(
|
|
808
|
+
shell.completions("completions/_tool").env({ TOOL_CONFIG: "~/.config/tool" }).aliases({ t: "tool" }),
|
|
801
809
|
)
|
|
802
810
|
.bash((shell) =>
|
|
803
|
-
shell.completions(
|
|
804
|
-
)
|
|
811
|
+
shell.completions("completions/tool.bash").env({ TOOL_CONFIG: "~/.config/tool" }).aliases({ t: "tool" }),
|
|
812
|
+
),
|
|
805
813
|
);
|
|
806
814
|
```
|
|
807
815
|
|
|
808
816
|
## With Hooks
|
|
809
817
|
|
|
810
818
|
```typescript
|
|
811
|
-
import { defineTool } from
|
|
819
|
+
import { defineTool } from "@alexgorbatchev/dotfiles";
|
|
812
820
|
|
|
813
821
|
export default defineTool((install) =>
|
|
814
|
-
install(
|
|
815
|
-
.bin(
|
|
816
|
-
.symlink(
|
|
817
|
-
.hook(
|
|
822
|
+
install("github-release", { repo: "owner/tool" })
|
|
823
|
+
.bin("tool")
|
|
824
|
+
.symlink("./config.yml", "~/.config/tool/config.yml")
|
|
825
|
+
.hook("after-install", async ({ installedDir, fileSystem, $ }) => {
|
|
818
826
|
await $`${installedDir}/tool init`;
|
|
819
|
-
})
|
|
827
|
+
}),
|
|
820
828
|
);
|
|
821
829
|
```
|
|
822
830
|
|
|
823
831
|
## Platform-Specific Installation
|
|
824
832
|
|
|
825
833
|
```typescript
|
|
826
|
-
import { Architecture, defineTool, Platform } from
|
|
834
|
+
import { Architecture, defineTool, Platform } from "@alexgorbatchev/dotfiles";
|
|
827
835
|
|
|
828
836
|
export default defineTool((install, ctx) =>
|
|
829
|
-
install(
|
|
830
|
-
.bin(
|
|
831
|
-
.platform(Platform.MacOS, (installMac) => installMac(
|
|
837
|
+
install("github-release", { repo: "owner/tool" })
|
|
838
|
+
.bin("tool")
|
|
839
|
+
.platform(Platform.MacOS, (installMac) => installMac("brew", { formula: "tool" }))
|
|
832
840
|
.platform(Platform.Linux, (installLinux) =>
|
|
833
|
-
installLinux(
|
|
834
|
-
repo:
|
|
835
|
-
assetPattern:
|
|
836
|
-
})
|
|
841
|
+
installLinux("github-release", {
|
|
842
|
+
repo: "owner/tool",
|
|
843
|
+
assetPattern: "*linux*.tar.gz",
|
|
844
|
+
}),
|
|
845
|
+
)
|
|
837
846
|
.platform(Platform.Windows, Architecture.Arm64, (installWin) =>
|
|
838
|
-
installWin(
|
|
839
|
-
repo:
|
|
840
|
-
assetPattern:
|
|
841
|
-
})
|
|
847
|
+
installWin("github-release", {
|
|
848
|
+
repo: "owner/tool",
|
|
849
|
+
assetPattern: "*windows-arm64.zip",
|
|
850
|
+
}),
|
|
851
|
+
),
|
|
842
852
|
);
|
|
843
853
|
```
|
|
844
854
|
|
|
@@ -846,12 +856,12 @@ export default defineTool((install, ctx) =>
|
|
|
846
856
|
|
|
847
857
|
```typescript
|
|
848
858
|
export default defineTool((install) =>
|
|
849
|
-
install(
|
|
850
|
-
crateName:
|
|
851
|
-
githubRepo:
|
|
859
|
+
install("cargo", {
|
|
860
|
+
crateName: "eza",
|
|
861
|
+
githubRepo: "eza-community/eza",
|
|
852
862
|
})
|
|
853
|
-
.bin(
|
|
854
|
-
.zsh((shell) => shell.completions(
|
|
863
|
+
.bin("eza")
|
|
864
|
+
.zsh((shell) => shell.completions("completions/eza.zsh").aliases({ ls: "eza", ll: "eza -l", la: "eza -la" })),
|
|
855
865
|
);
|
|
856
866
|
```
|
|
857
867
|
|
|
@@ -859,15 +869,15 @@ export default defineTool((install) =>
|
|
|
859
869
|
|
|
860
870
|
```typescript
|
|
861
871
|
export default defineTool((install) =>
|
|
862
|
-
install(
|
|
863
|
-
.bin(
|
|
864
|
-
.symlink(
|
|
872
|
+
install("manual", { binaryPath: "./scripts/deploy.sh" })
|
|
873
|
+
.bin("deploy")
|
|
874
|
+
.symlink("./deploy.config.yaml", "~/.config/deploy/config.yaml")
|
|
865
875
|
.zsh((shell) =>
|
|
866
876
|
shell.aliases({
|
|
867
|
-
dp:
|
|
868
|
-
|
|
869
|
-
})
|
|
870
|
-
)
|
|
877
|
+
dp: "deploy",
|
|
878
|
+
"deploy-prod": "deploy --env production",
|
|
879
|
+
}),
|
|
880
|
+
),
|
|
871
881
|
);
|
|
872
882
|
```
|
|
873
883
|
|
|
@@ -876,8 +886,8 @@ export default defineTool((install) =>
|
|
|
876
886
|
```typescript
|
|
877
887
|
export default defineTool((install) =>
|
|
878
888
|
install()
|
|
879
|
-
.symlink(
|
|
880
|
-
.zsh((shell) => shell.aliases({ g:
|
|
889
|
+
.symlink("./gitconfig", "~/.gitconfig")
|
|
890
|
+
.zsh((shell) => shell.aliases({ g: "git", gs: "git status", ga: "git add" }).env({ GIT_EDITOR: "nvim" })),
|
|
881
891
|
);
|
|
882
892
|
```
|
|
883
893
|
|
|
@@ -885,16 +895,16 @@ export default defineTool((install) =>
|
|
|
885
895
|
|
|
886
896
|
```typescript
|
|
887
897
|
export default defineTool((install) =>
|
|
888
|
-
install(
|
|
889
|
-
repo:
|
|
898
|
+
install("github-release", {
|
|
899
|
+
repo: "owner/tool",
|
|
890
900
|
assetSelector: ({ assets, systemInfo }) => {
|
|
891
|
-
const platformMap: Record<string, string> = { darwin:
|
|
892
|
-
const archMap: Record<string, string> = { x64:
|
|
901
|
+
const platformMap: Record<string, string> = { darwin: "macos", linux: "linux" };
|
|
902
|
+
const archMap: Record<string, string> = { x64: "amd64", arm64: "arm64" };
|
|
893
903
|
const platform = platformMap[systemInfo.platform];
|
|
894
904
|
const arch = archMap[systemInfo.arch];
|
|
895
|
-
return assets.find((a) => a.name.includes(platform) && a.name.includes(arch) && a.name.endsWith(
|
|
905
|
+
return assets.find((a) => a.name.includes(platform) && a.name.includes(arch) && a.name.endsWith(".tar.gz"));
|
|
896
906
|
},
|
|
897
|
-
}).bin(
|
|
907
|
+
}).bin("tool"),
|
|
898
908
|
);
|
|
899
909
|
```
|
|
900
910
|
|
|
@@ -924,20 +934,20 @@ For non-standard release naming, use `assetSelector`:
|
|
|
924
934
|
|
|
925
935
|
```typescript
|
|
926
936
|
export default defineTool((install) =>
|
|
927
|
-
install(
|
|
928
|
-
repo:
|
|
937
|
+
install("github-release", {
|
|
938
|
+
repo: "owner/tool",
|
|
929
939
|
assetSelector: ({ assets, systemInfo, release, log }) => {
|
|
930
|
-
const osMap: Record<string, string> = { darwin:
|
|
931
|
-
const archMap: Record<string, string> = { x64:
|
|
940
|
+
const osMap: Record<string, string> = { darwin: "macos", linux: "linux" };
|
|
941
|
+
const archMap: Record<string, string> = { x64: "amd64", arm64: "arm64" };
|
|
932
942
|
|
|
933
943
|
return assets.find(
|
|
934
944
|
(a) =>
|
|
935
945
|
a.name.includes(osMap[systemInfo.platform]) &&
|
|
936
946
|
a.name.includes(archMap[systemInfo.arch]) &&
|
|
937
|
-
a.name.endsWith(
|
|
947
|
+
a.name.endsWith(".tar.gz"),
|
|
938
948
|
);
|
|
939
949
|
},
|
|
940
|
-
}).bin(
|
|
950
|
+
}).bin("tool"),
|
|
941
951
|
);
|
|
942
952
|
```
|
|
943
953
|
|
|
@@ -946,13 +956,13 @@ export default defineTool((install) =>
|
|
|
946
956
|
Use environment variables for runtime configuration:
|
|
947
957
|
|
|
948
958
|
```typescript
|
|
949
|
-
const isDev = process.env.NODE_ENV ===
|
|
959
|
+
const isDev = process.env.NODE_ENV === "development";
|
|
950
960
|
|
|
951
961
|
export default defineTool((install) =>
|
|
952
|
-
install(
|
|
953
|
-
.bin(
|
|
954
|
-
.version(isDev ?
|
|
955
|
-
.zsh((shell) => shell.env({ TOOL_LOG_LEVEL: isDev ?
|
|
962
|
+
install("github-release", { repo: "owner/tool" })
|
|
963
|
+
.bin("tool")
|
|
964
|
+
.version(isDev ? "latest" : "v1.2.3")
|
|
965
|
+
.zsh((shell) => shell.env({ TOOL_LOG_LEVEL: isDev ? "debug" : "info" })),
|
|
956
966
|
);
|
|
957
967
|
```
|
|
958
968
|
|
|
@@ -962,10 +972,10 @@ Choose methods based on system capabilities:
|
|
|
962
972
|
|
|
963
973
|
```typescript
|
|
964
974
|
export default defineTool((install) => {
|
|
965
|
-
if (process.platform ===
|
|
966
|
-
return install(
|
|
975
|
+
if (process.platform === "darwin" && process.env.HOMEBREW_PREFIX) {
|
|
976
|
+
return install("brew", { formula: "tool" }).bin("tool");
|
|
967
977
|
}
|
|
968
|
-
return install(
|
|
978
|
+
return install("github-release", { repo: "owner/tool" }).bin("tool");
|
|
969
979
|
});
|
|
970
980
|
```
|
|
971
981
|
|
|
@@ -973,15 +983,15 @@ export default defineTool((install) => {
|
|
|
973
983
|
|
|
974
984
|
```typescript
|
|
975
985
|
export default defineTool((install) =>
|
|
976
|
-
install(
|
|
977
|
-
.bin(
|
|
978
|
-
.hook(
|
|
986
|
+
install("github-release", { repo: "owner/tool" })
|
|
987
|
+
.bin("tool")
|
|
988
|
+
.hook("after-extract", async ({ extractDir, stagingDir, $ }) => {
|
|
979
989
|
if (extractDir && stagingDir) {
|
|
980
990
|
await $`cd ${extractDir} && ./configure --prefix=${stagingDir}`;
|
|
981
991
|
await $`cd ${extractDir} && make -j$(nproc)`;
|
|
982
992
|
await $`cd ${extractDir} && make install`;
|
|
983
993
|
}
|
|
984
|
-
})
|
|
994
|
+
}),
|
|
985
995
|
);
|
|
986
996
|
```
|
|
987
997
|
|
|
@@ -991,16 +1001,16 @@ Combine `.dependsOn()` with hooks for version checks:
|
|
|
991
1001
|
|
|
992
1002
|
```typescript
|
|
993
1003
|
export default defineTool((install) =>
|
|
994
|
-
install(
|
|
995
|
-
.bin(
|
|
996
|
-
.dependsOn(
|
|
997
|
-
.hook(
|
|
1004
|
+
install("github-release", { repo: "owner/tool" })
|
|
1005
|
+
.bin("tool")
|
|
1006
|
+
.dependsOn("node")
|
|
1007
|
+
.hook("before-install", async ({ log, $ }) => {
|
|
998
1008
|
const result = await $`node --version`.nothrow();
|
|
999
1009
|
if (result.exitCode !== 0) {
|
|
1000
|
-
throw new Error(
|
|
1010
|
+
throw new Error("Node is required but not available");
|
|
1001
1011
|
}
|
|
1002
1012
|
log.info(`Using Node ${result.stdout.toString().trim()}`);
|
|
1003
|
-
})
|
|
1013
|
+
}),
|
|
1004
1014
|
);
|
|
1005
1015
|
```
|
|
1006
1016
|
|
|
@@ -1008,8 +1018,8 @@ export default defineTool((install) =>
|
|
|
1008
1018
|
|
|
1009
1019
|
```typescript
|
|
1010
1020
|
export default defineTool((install, ctx) =>
|
|
1011
|
-
install(
|
|
1012
|
-
.bin(
|
|
1021
|
+
install("github-release", { repo: "owner/tool" })
|
|
1022
|
+
.bin("tool")
|
|
1013
1023
|
.zsh((shell) =>
|
|
1014
1024
|
shell.always(`
|
|
1015
1025
|
function expensive-fn() {
|
|
@@ -1017,8 +1027,8 @@ export default defineTool((install, ctx) =>
|
|
|
1017
1027
|
source "${ctx.currentDir}/expensive.zsh"
|
|
1018
1028
|
expensive-fn "$@"
|
|
1019
1029
|
}
|
|
1020
|
-
`)
|
|
1021
|
-
)
|
|
1030
|
+
`),
|
|
1031
|
+
),
|
|
1022
1032
|
);
|
|
1023
1033
|
```
|
|
1024
1034
|
|
|
@@ -1026,8 +1036,8 @@ export default defineTool((install, ctx) =>
|
|
|
1026
1036
|
|
|
1027
1037
|
```typescript
|
|
1028
1038
|
export default defineTool((install, ctx) =>
|
|
1029
|
-
install(
|
|
1030
|
-
.bin(
|
|
1039
|
+
install("github-release", { repo: "owner/tool" })
|
|
1040
|
+
.bin("tool")
|
|
1031
1041
|
.zsh((shell) =>
|
|
1032
1042
|
shell
|
|
1033
1043
|
.once(
|
|
@@ -1035,8 +1045,8 @@ export default defineTool((install, ctx) =>
|
|
|
1035
1045
|
tool completion zsh > "${ctx.projectConfig.paths.generatedDir}/completions/_tool"
|
|
1036
1046
|
`,
|
|
1037
1047
|
)
|
|
1038
|
-
.completions(`${ctx.projectConfig.paths.generatedDir}/completions/_tool`)
|
|
1039
|
-
)
|
|
1048
|
+
.completions(`${ctx.projectConfig.paths.generatedDir}/completions/_tool`),
|
|
1049
|
+
),
|
|
1040
1050
|
);
|
|
1041
1051
|
```
|
|
1042
1052
|
|
|
@@ -1044,12 +1054,12 @@ export default defineTool((install, ctx) =>
|
|
|
1044
1054
|
|
|
1045
1055
|
```typescript
|
|
1046
1056
|
export default defineTool((install) =>
|
|
1047
|
-
install(
|
|
1048
|
-
.bin(
|
|
1049
|
-
.hook(
|
|
1057
|
+
install("github-release", { repo: "owner/tool" })
|
|
1058
|
+
.bin("tool")
|
|
1059
|
+
.hook("after-install", async ({ $, log }) => {
|
|
1050
1060
|
await Promise.all([$`tool setup-task-1`, $`tool setup-task-2`, $`tool setup-task-3`]);
|
|
1051
|
-
log.info(
|
|
1052
|
-
})
|
|
1061
|
+
log.info("All setup tasks completed");
|
|
1062
|
+
}),
|
|
1053
1063
|
);
|
|
1054
1064
|
```
|
|
1055
1065
|
|