@alexgorbatchev/dotfiles 0.0.1
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 +397 -0
- package/cli-fj2hdbnx.js +5 -0
- package/cli-fj2hdbnx.js.map +9 -0
- package/cli-w822cqdk.js +4 -0
- package/cli-w822cqdk.js.map +10 -0
- package/cli.js +449 -0
- package/cli.js.map +283 -0
- package/dashboard-0ebz5sqb.js +159 -0
- package/dashboard-0ebz5sqb.js.map +102 -0
- package/dashboard-3axqywva.css +1 -0
- package/dashboard.js +13 -0
- package/package.json +63 -0
- package/prerender-kpxyx916.js +3 -0
- package/prerender-kpxyx916.js.map +11 -0
- package/schemas.d.ts +2730 -0
- package/skill/SKILL.md +74 -0
- package/skill/references/api-reference.md +614 -0
- package/skill/references/configuration.md +1154 -0
- package/skill/references/installation-methods/brew.md +62 -0
- package/skill/references/installation-methods/cargo.md +86 -0
- package/skill/references/installation-methods/curl-binary.md +73 -0
- package/skill/references/installation-methods/curl-script.md +132 -0
- package/skill/references/installation-methods/curl-tar.md +58 -0
- package/skill/references/installation-methods/dmg.md +113 -0
- package/skill/references/installation-methods/gitea-release.md +106 -0
- package/skill/references/installation-methods/github-release.md +97 -0
- package/skill/references/installation-methods/manual.md +74 -0
- package/skill/references/installation-methods/npm.md +75 -0
- package/skill/references/installation-methods/overview.md +293 -0
- package/skill/references/installation-methods/zsh-plugin.md +156 -0
- package/skill/references/make-tool.md +866 -0
- package/skill/references/shell-and-hooks.md +833 -0
- package/tool-types.d.ts +14 -0
- package/wasm-n3cagcre.js +3 -0
- package/wasm-n3cagcre.js.map +10 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# GitHub Release Installation
|
|
2
|
+
|
|
3
|
+
Download and install tools from GitHub releases with automatic platform asset selection.
|
|
4
|
+
|
|
5
|
+
## Basic Usage
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { defineTool } from '@alexgorbatchev/dotfiles';
|
|
9
|
+
|
|
10
|
+
export default defineTool((install) => install('github-release', { repo: 'junegunn/fzf' }).bin('fzf'));
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
| Parameter | Description |
|
|
16
|
+
| --------------- | --------------------------------------------------------- |
|
|
17
|
+
| `repo` | **Required**. GitHub repository in "owner/repo" format |
|
|
18
|
+
| `assetPattern` | Glob pattern to match release assets |
|
|
19
|
+
| `assetSelector` | Custom function to select the correct asset |
|
|
20
|
+
| `version` | Specific version (e.g., `'v1.2.3'`) |
|
|
21
|
+
| `prerelease` | Include prereleases when fetching latest (default: false) |
|
|
22
|
+
| `githubHost` | Custom GitHub API host for Enterprise |
|
|
23
|
+
| `ghCli` | Use `gh` CLI for API requests instead of fetch |
|
|
24
|
+
| `env` | Environment variables (static or dynamic function) |
|
|
25
|
+
|
|
26
|
+
## Examples
|
|
27
|
+
|
|
28
|
+
### With Asset Pattern
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
install('github-release', {
|
|
32
|
+
repo: 'sharkdp/bat',
|
|
33
|
+
assetPattern: '*linux_amd64.tar.gz',
|
|
34
|
+
}).bin('bat');
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Custom Asset Selector
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
install('github-release', {
|
|
41
|
+
repo: 'example/tool',
|
|
42
|
+
assetSelector: ({ assets, systemInfo }) => {
|
|
43
|
+
const platform = systemInfo.platform === 'darwin' ? 'macos' : systemInfo.platform;
|
|
44
|
+
return assets.find((a) => a.name.includes(platform));
|
|
45
|
+
},
|
|
46
|
+
}).bin('tool');
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Specific Version
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
install('github-release', {
|
|
53
|
+
repo: 'owner/tool',
|
|
54
|
+
version: 'v2.1.0',
|
|
55
|
+
}).bin('tool');
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Using gh CLI
|
|
59
|
+
|
|
60
|
+
Use the `gh` CLI for API requests instead of fetch. Useful when working behind proxies or leveraging existing `gh` authentication:
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
install('github-release', {
|
|
64
|
+
repo: 'owner/tool',
|
|
65
|
+
ghCli: true,
|
|
66
|
+
}).bin('tool');
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Including Prereleases
|
|
70
|
+
|
|
71
|
+
By default, GitHub's "latest" excludes prereleases. Use `prerelease: true` for repos that only publish prerelease versions:
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
install('github-release', {
|
|
75
|
+
repo: 'owner/nightly-only-tool',
|
|
76
|
+
prerelease: true,
|
|
77
|
+
}).bin('tool');
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Asset Pattern Matching
|
|
81
|
+
|
|
82
|
+
| Pattern | Matches |
|
|
83
|
+
| ---------------------- | ------------------- |
|
|
84
|
+
| `*linux*amd64*.tar.gz` | Linux x64 tarballs |
|
|
85
|
+
| `*darwin*arm64*.zip` | macOS ARM64 zips |
|
|
86
|
+
| `*windows*.exe` | Windows executables |
|
|
87
|
+
|
|
88
|
+
Glob syntax: `*` (any chars), `?` (single char), `[abc]` (char class), `{a,b}` (alternation)
|
|
89
|
+
|
|
90
|
+
## Platform Detection
|
|
91
|
+
|
|
92
|
+
Available in `assetSelector` as `systemInfo`:
|
|
93
|
+
|
|
94
|
+
| Property | Values |
|
|
95
|
+
| ---------- | -------------------------- |
|
|
96
|
+
| `platform` | `darwin`, `linux`, `win32` |
|
|
97
|
+
| `arch` | `x64`, `arm64` |
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Manual Installation
|
|
2
|
+
|
|
3
|
+
Installs files from your tool configuration directory (custom scripts, pre-built binaries) or registers configuration-only tools. The `manual` method can be called with or without params.
|
|
4
|
+
|
|
5
|
+
## Basic Usage
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { defineTool } from '@alexgorbatchev/dotfiles';
|
|
9
|
+
|
|
10
|
+
// Install a custom script
|
|
11
|
+
export default defineTool((install, ctx) =>
|
|
12
|
+
install('manual', {
|
|
13
|
+
binaryPath: './scripts/my-tool.sh',
|
|
14
|
+
}).bin('my-tool')
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
// Without params (shell-only or dependency wrapper)
|
|
18
|
+
export default defineTool((install) =>
|
|
19
|
+
install('manual')
|
|
20
|
+
.bin('tokscale')
|
|
21
|
+
.dependsOn('bun')
|
|
22
|
+
.zsh((shell) =>
|
|
23
|
+
shell.functions({
|
|
24
|
+
tokscale: `bun x tokscale@latest`,
|
|
25
|
+
})
|
|
26
|
+
)
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
// Configuration-only tool (no binary)
|
|
30
|
+
export default defineTool((install, ctx) => install().zsh((shell) => shell.aliases({ ll: 'ls -la' })));
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Parameters
|
|
34
|
+
|
|
35
|
+
| Parameter | Type | Required | Description |
|
|
36
|
+
| ------------ | ------------------------------------------------ | -------- | -------------------------------------------------- |
|
|
37
|
+
| `binaryPath` | `string` | No | Path to binary relative to `.tool.ts` file |
|
|
38
|
+
| `env` | `Record<string, string> \| (ctx) => Record<...>` | No | Environment variables (static or dynamic function) |
|
|
39
|
+
|
|
40
|
+
## Examples
|
|
41
|
+
|
|
42
|
+
### Pre-built Binary
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
export default defineTool((install, ctx) =>
|
|
46
|
+
install('manual', {
|
|
47
|
+
binaryPath: './binaries/linux/x64/custom-tool',
|
|
48
|
+
}).bin('custom-tool')
|
|
49
|
+
);
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Configuration-Only Tool
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
export default defineTool((install, ctx) => install().zsh((shell) => shell.aliases({ ll: 'ls -la', la: 'ls -A' })));
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### With Shell Configuration
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
export default defineTool((install, ctx) =>
|
|
62
|
+
install('manual', {
|
|
63
|
+
binaryPath: './bin/my-tool.sh',
|
|
64
|
+
})
|
|
65
|
+
.bin('my-tool')
|
|
66
|
+
.zsh((shell) => shell.aliases({ mt: 'my-tool' }).completions('./completions/_my-tool'))
|
|
67
|
+
);
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Notes:**
|
|
71
|
+
|
|
72
|
+
- Binary paths are relative to the tool configuration file location
|
|
73
|
+
- Files are copied to the managed installation directory with executable permissions
|
|
74
|
+
- Configuration-only tools use `install()` with no arguments and must not define `.bin()`
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# npm Installation
|
|
2
|
+
|
|
3
|
+
Install tools published as npm packages. Supports both `npm` and `bun` as package managers.
|
|
4
|
+
|
|
5
|
+
## Basic Usage
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { defineTool } from '@alexgorbatchev/dotfiles';
|
|
9
|
+
|
|
10
|
+
export default defineTool((install) => install('npm', { package: 'prettier' }).bin('prettier'));
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
| Parameter | Type | Required | Description |
|
|
16
|
+
| ---------------- | ------------------------------------------------ | -------- | ------------------------------------------------------------- |
|
|
17
|
+
| `package` | `string` | No | npm package name (defaults to tool name) |
|
|
18
|
+
| `version` | `string` | No | Version or version range (e.g., `3.0.0`, defaults to latest) |
|
|
19
|
+
| `packageManager` | `'npm' \| 'bun'` | No | Package manager to use for installation (defaults to `'npm'`) |
|
|
20
|
+
| `versionArgs` | `string[]` | No | Arguments for version check (e.g., `['--version']`) |
|
|
21
|
+
| `versionRegex` | `string` | No | Regex to extract version from output |
|
|
22
|
+
| `env` | `Record<string, string> \| (ctx) => Record<...>` | No | Environment variables (static or dynamic function) |
|
|
23
|
+
|
|
24
|
+
## Examples
|
|
25
|
+
|
|
26
|
+
### Specific Version
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
export default defineTool((install) =>
|
|
30
|
+
install('npm', {
|
|
31
|
+
package: 'prettier',
|
|
32
|
+
version: '3.0.0',
|
|
33
|
+
}).bin('prettier')
|
|
34
|
+
);
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Using Bun
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
export default defineTool((install) =>
|
|
41
|
+
install('npm', {
|
|
42
|
+
package: 'prettier',
|
|
43
|
+
packageManager: 'bun',
|
|
44
|
+
}).bin('prettier')
|
|
45
|
+
);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Scoped Package
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
export default defineTool((install) =>
|
|
52
|
+
install('npm', {
|
|
53
|
+
package: '@angular/cli',
|
|
54
|
+
}).bin('ng')
|
|
55
|
+
);
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Custom Version Detection
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
export default defineTool((install) =>
|
|
62
|
+
install('npm', {
|
|
63
|
+
package: 'typescript',
|
|
64
|
+
versionArgs: ['--version'],
|
|
65
|
+
versionRegex: '(\\d+\\.\\d+\\.\\d+)',
|
|
66
|
+
}).bin('tsc')
|
|
67
|
+
);
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## How It Works
|
|
71
|
+
|
|
72
|
+
1. **Install**: Runs `npm install --prefix <stagingDir> <package>[@version]` (or `bun add --cwd <stagingDir> <package>[@version]` when `packageManager: 'bun'`)
|
|
73
|
+
2. **Binaries**: Resolved from `node_modules/.bin/` in the install directory
|
|
74
|
+
3. **Version**: Detected via `npm ls --json` (npm), `node_modules/<package>/package.json` (bun), or custom `versionArgs`/`versionRegex`
|
|
75
|
+
4. **Updates**: Checked via `npm view <package> version` (regardless of package manager)
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
# Installation Methods Overview
|
|
2
|
+
|
|
3
|
+
The system supports multiple installation methods to accommodate different tool distribution patterns. Each method has its own parameters and use cases.
|
|
4
|
+
|
|
5
|
+
## Available Methods
|
|
6
|
+
|
|
7
|
+
### GitHub Release
|
|
8
|
+
|
|
9
|
+
Install tools from GitHub releases with automatic asset selection and extraction.
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { defineTool } from '@alexgorbatchev/dotfiles';
|
|
13
|
+
|
|
14
|
+
export default defineTool((install, ctx) =>
|
|
15
|
+
install('github-release', {
|
|
16
|
+
repo: 'owner/repository',
|
|
17
|
+
}).bin('tool')
|
|
18
|
+
);
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Gitea/Forgejo Release
|
|
22
|
+
|
|
23
|
+
Install tools from Gitea, Forgejo, or Codeberg releases with automatic asset selection.
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { defineTool } from '@alexgorbatchev/dotfiles';
|
|
27
|
+
|
|
28
|
+
export default defineTool((install, ctx) =>
|
|
29
|
+
install('gitea-release', {
|
|
30
|
+
instanceUrl: 'https://codeberg.org',
|
|
31
|
+
repo: 'owner/repository',
|
|
32
|
+
}).bin('tool')
|
|
33
|
+
);
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Homebrew
|
|
37
|
+
|
|
38
|
+
Install tools using Homebrew package manager (macOS and Linux).
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
import { defineTool } from '@alexgorbatchev/dotfiles';
|
|
42
|
+
|
|
43
|
+
export default defineTool((install, ctx) =>
|
|
44
|
+
install('brew', {
|
|
45
|
+
formula: 'ripgrep',
|
|
46
|
+
}).bin('rg')
|
|
47
|
+
);
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Cargo
|
|
51
|
+
|
|
52
|
+
Install Rust tools from crates.io with cargo-quickinstall for faster downloads.
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { defineTool } from '@alexgorbatchev/dotfiles';
|
|
56
|
+
|
|
57
|
+
export default defineTool((install, ctx) =>
|
|
58
|
+
install('cargo', {
|
|
59
|
+
crateName: 'ripgrep',
|
|
60
|
+
}).bin('rg')
|
|
61
|
+
);
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### npm
|
|
65
|
+
|
|
66
|
+
Install tools published as npm packages.
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
import { defineTool } from '@alexgorbatchev/dotfiles';
|
|
70
|
+
|
|
71
|
+
export default defineTool((install, ctx) =>
|
|
72
|
+
install('npm', {
|
|
73
|
+
package: 'prettier',
|
|
74
|
+
}).bin('prettier')
|
|
75
|
+
);
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Curl Script
|
|
79
|
+
|
|
80
|
+
Download and execute installation scripts.
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
import { defineTool } from '@alexgorbatchev/dotfiles';
|
|
84
|
+
|
|
85
|
+
export default defineTool((install, ctx) =>
|
|
86
|
+
install('curl-script', {
|
|
87
|
+
url: 'https://bun.sh/install',
|
|
88
|
+
shell: 'bash',
|
|
89
|
+
}).bin('bun')
|
|
90
|
+
);
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Curl Tar
|
|
94
|
+
|
|
95
|
+
Download and extract tarballs directly from URLs.
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
import { defineTool } from '@alexgorbatchev/dotfiles';
|
|
99
|
+
|
|
100
|
+
export default defineTool((install, ctx) =>
|
|
101
|
+
install('curl-tar', {
|
|
102
|
+
url: 'https://releases.example.com/tool-v1.0.0.tar.gz',
|
|
103
|
+
}).bin('tool')
|
|
104
|
+
);
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Curl Binary
|
|
108
|
+
|
|
109
|
+
Download standalone binary files directly from URLs (no archive extraction).
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
import { defineTool } from '@alexgorbatchev/dotfiles';
|
|
113
|
+
|
|
114
|
+
export default defineTool((install, ctx) =>
|
|
115
|
+
install('curl-binary', {
|
|
116
|
+
url: 'https://example.com/tool-v1.0.0-linux-amd64',
|
|
117
|
+
}).bin('tool')
|
|
118
|
+
);
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### DMG
|
|
122
|
+
|
|
123
|
+
Install macOS applications from DMG disk images into `/Applications` (silently skipped on other platforms).
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
import { defineTool } from '@alexgorbatchev/dotfiles';
|
|
127
|
+
|
|
128
|
+
export default defineTool((install, ctx) =>
|
|
129
|
+
install('dmg', {
|
|
130
|
+
source: {
|
|
131
|
+
type: 'url',
|
|
132
|
+
url: 'https://example.com/MyApp-1.0.0.dmg',
|
|
133
|
+
},
|
|
134
|
+
})
|
|
135
|
+
);
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
DMG also supports GitHub release sources:
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
install('dmg', {
|
|
142
|
+
source: {
|
|
143
|
+
type: 'github-release',
|
|
144
|
+
repo: 'manaflow-ai/cmux',
|
|
145
|
+
assetPattern: '*macos*.dmg',
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Manual
|
|
151
|
+
|
|
152
|
+
Install files from your dotfiles directory (custom scripts, pre-built binaries) or configuration-only tools. Can be called without params: `install('manual')`.
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
import { defineTool } from '@alexgorbatchev/dotfiles';
|
|
156
|
+
|
|
157
|
+
// With binary installation
|
|
158
|
+
export default defineTool((install, ctx) =>
|
|
159
|
+
install('manual', {
|
|
160
|
+
binaryPath: './bin/my-script.sh',
|
|
161
|
+
}).bin('my-script')
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
// Without params (shell-only or dependency wrapper)
|
|
165
|
+
export default defineTool((install) =>
|
|
166
|
+
install('manual')
|
|
167
|
+
.bin('tokscale')
|
|
168
|
+
.dependsOn('bun')
|
|
169
|
+
.zsh((shell) =>
|
|
170
|
+
shell.functions({
|
|
171
|
+
tokscale: `bun x tokscale@latest`,
|
|
172
|
+
})
|
|
173
|
+
)
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
// Configuration-only
|
|
177
|
+
export default defineTool((install, ctx) => install().zsh((shell) => shell.aliases({ ll: 'ls -la' })));
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Zsh Plugin
|
|
181
|
+
|
|
182
|
+
Clone Git repositories for zsh plugins.
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
import { defineTool } from '@alexgorbatchev/dotfiles';
|
|
186
|
+
|
|
187
|
+
export default defineTool((install, ctx) =>
|
|
188
|
+
install('zsh-plugin', {
|
|
189
|
+
repo: 'jeffreytse/zsh-vi-mode',
|
|
190
|
+
})
|
|
191
|
+
.zsh((shell) => shell.always(`source "${ctx.currentDir}/zsh-vi-mode.plugin.zsh"`))
|
|
192
|
+
);
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Choosing the Right Method
|
|
196
|
+
|
|
197
|
+
| Method | Best For | Pros | Cons |
|
|
198
|
+
| ------------------ | ----------------------------------- | -------------------------------------- | ------------------------------------ |
|
|
199
|
+
| **GitHub Release** | Most open source tools | Automatic updates, cross-platform | Requires GitHub hosting |
|
|
200
|
+
| **Gitea/Forgejo** | Codeberg / self-hosted Gitea tools | Supports any Gitea-compatible host | Requires instance URL |
|
|
201
|
+
| **Homebrew** | macOS/Linux tools | Simple, well-maintained | Platform-specific, requires Homebrew |
|
|
202
|
+
| **Cargo** | Rust tools | Fast pre-compiled binaries | Rust tools only |
|
|
203
|
+
| **npm** | Node.js tools | Simple, version management | Requires Node.js/npm |
|
|
204
|
+
| **Curl Script** | Custom installers | Flexible, handles complex setups | Less predictable, security concerns |
|
|
205
|
+
| **Curl Tar** | Archive downloads | Simple, no dependencies | Manual URL management |
|
|
206
|
+
| **Curl Binary** | Direct binary downloads | Simplest, no extraction needed | Manual URL management |
|
|
207
|
+
| **DMG** | macOS .app bundles | Handles mount/unmount, archive extract | macOS only |
|
|
208
|
+
| **Manual** | Custom scripts, configuration tools | Include files with dotfiles, flexible | Manual file management |
|
|
209
|
+
| **Zsh Plugin** | Zsh plugins from Git repos | Simple, automatic updates | Zsh plugins only |
|
|
210
|
+
|
|
211
|
+
## Manual Installation Guide
|
|
212
|
+
|
|
213
|
+
The `manual` method is the unified approach for binary installation from your dotfiles directory.
|
|
214
|
+
|
|
215
|
+
### Use **Manual** for Binary Installation:
|
|
216
|
+
|
|
217
|
+
- You have custom scripts or binaries to include with your dotfiles
|
|
218
|
+
- You want the system to manage and version your tool files
|
|
219
|
+
- You need shims generated for your custom tools
|
|
220
|
+
- You want to distribute pre-built binaries with your dotfiles
|
|
221
|
+
|
|
222
|
+
**Example:** Including a custom deployment script with your dotfiles.
|
|
223
|
+
|
|
224
|
+
```typescript
|
|
225
|
+
import { defineTool } from '@alexgorbatchev/dotfiles';
|
|
226
|
+
|
|
227
|
+
export default defineTool((install, ctx) =>
|
|
228
|
+
install('manual', {
|
|
229
|
+
binaryPath: './scripts/deploy.sh',
|
|
230
|
+
}).bin('deploy')
|
|
231
|
+
);
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Use `install()` for Configuration Only:
|
|
235
|
+
|
|
236
|
+
- You only need shell configuration (aliases, environment, symlinks)
|
|
237
|
+
- Tools are managed entirely outside the dotfiles system
|
|
238
|
+
- You don't want any binary installation or management
|
|
239
|
+
- Creating configuration-only "tools"
|
|
240
|
+
|
|
241
|
+
**Example:** Setting up shell aliases and environment variables.
|
|
242
|
+
|
|
243
|
+
```typescript
|
|
244
|
+
import { defineTool } from '@alexgorbatchev/dotfiles';
|
|
245
|
+
|
|
246
|
+
export default defineTool((install, ctx) =>
|
|
247
|
+
install().zsh((shell) =>
|
|
248
|
+
shell
|
|
249
|
+
.aliases({
|
|
250
|
+
ll: 'ls -la',
|
|
251
|
+
})
|
|
252
|
+
.env({
|
|
253
|
+
EDITOR: 'vim',
|
|
254
|
+
})
|
|
255
|
+
)
|
|
256
|
+
);
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## Common Parameters
|
|
260
|
+
|
|
261
|
+
Most installation methods support these common concepts:
|
|
262
|
+
|
|
263
|
+
- **Version Selection**: Specify exact versions or use constraints
|
|
264
|
+
- **Platform Detection**: Automatic selection of appropriate binaries
|
|
265
|
+
- **Binary Path**: Specify which file is the main executable
|
|
266
|
+
- **Asset Selection**: Choose the right download for your platform
|
|
267
|
+
- **Environment Variables**: Set `env` for installation (static or dynamic)
|
|
268
|
+
|
|
269
|
+
### Environment Variables (`env`)
|
|
270
|
+
|
|
271
|
+
All installation methods support an `env` parameter for setting environment variables during installation:
|
|
272
|
+
|
|
273
|
+
```typescript
|
|
274
|
+
// Static environment variables
|
|
275
|
+
install('github-release', {
|
|
276
|
+
repo: 'owner/tool',
|
|
277
|
+
env: { CUSTOM_FLAG: 'true' },
|
|
278
|
+
}).bin('tool');
|
|
279
|
+
|
|
280
|
+
// Dynamic environment variables
|
|
281
|
+
install('curl-script', {
|
|
282
|
+
url: 'https://example.com/install.sh',
|
|
283
|
+
shell: 'bash',
|
|
284
|
+
env: (ctx) => ({ INSTALL_DIR: ctx.stagingDir }),
|
|
285
|
+
}).bin('tool');
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
Dynamic `env` functions receive a context with:
|
|
289
|
+
|
|
290
|
+
- `projectConfig` - Full project configuration
|
|
291
|
+
- `stagingDir` - Temporary installation directory
|
|
292
|
+
|
|
293
|
+
For `curl-script`, the context also includes `scriptPath`.
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# Zsh Plugin Installation
|
|
2
|
+
|
|
3
|
+
The `zsh-plugin` installation method clones Git repositories for zsh plugins and automatically configures them to be sourced in your shell. This is useful for installing plugins that are not available via package managers.
|
|
4
|
+
|
|
5
|
+
## Configuration
|
|
6
|
+
|
|
7
|
+
### Basic Usage
|
|
8
|
+
|
|
9
|
+
#### GitHub Shorthand
|
|
10
|
+
|
|
11
|
+
The simplest way to install a plugin from GitHub:
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { defineTool } from '@alexgorbatchev/dotfiles';
|
|
15
|
+
|
|
16
|
+
export default defineTool((install) =>
|
|
17
|
+
install('zsh-plugin', {
|
|
18
|
+
repo: 'jeffreytse/zsh-vi-mode',
|
|
19
|
+
})
|
|
20
|
+
);
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The plugin is automatically sourced - no additional configuration needed!
|
|
24
|
+
|
|
25
|
+
#### Full Git URL
|
|
26
|
+
|
|
27
|
+
For plugins hosted elsewhere (GitLab, Bitbucket, private repos):
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { defineTool } from '@alexgorbatchev/dotfiles';
|
|
31
|
+
|
|
32
|
+
export default defineTool((install) =>
|
|
33
|
+
install('zsh-plugin', {
|
|
34
|
+
url: 'https://gitlab.com/user/custom-plugin.git',
|
|
35
|
+
})
|
|
36
|
+
);
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Install Parameters
|
|
40
|
+
|
|
41
|
+
| Parameter | Type | Required | Description |
|
|
42
|
+
| ------------ | ------- | -------- | ---------------------------------------------------------- |
|
|
43
|
+
| `repo` | string | No\* | GitHub repository shorthand (e.g., `user/repo`) |
|
|
44
|
+
| `url` | string | No\* | Full Git URL (e.g., `https://github.com/user/repo.git`) |
|
|
45
|
+
| `pluginName` | string | No | Custom plugin directory name (defaults to repository name) |
|
|
46
|
+
| `source` | string | No | Explicit source file path (auto-detected if not specified) |
|
|
47
|
+
| `auto` | boolean | No | Auto-install during `generate` command (default: `true`) |
|
|
48
|
+
|
|
49
|
+
\* Either `repo` or `url` must be provided.
|
|
50
|
+
|
|
51
|
+
### Auto-Install Behavior
|
|
52
|
+
|
|
53
|
+
By default (`auto: true`), zsh plugins are automatically installed during the `dotfiles generate` command. This means:
|
|
54
|
+
|
|
55
|
+
1. When you run `dotfiles generate`, plugins with `auto: true` are cloned/updated
|
|
56
|
+
2. The plugin's `source` command is automatically added to your shell init
|
|
57
|
+
3. No separate `dotfiles install` step is needed for these plugins
|
|
58
|
+
|
|
59
|
+
To disable auto-installation and require explicit `dotfiles install`:
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
import { defineTool } from '@alexgorbatchev/dotfiles';
|
|
63
|
+
|
|
64
|
+
export default defineTool((install) =>
|
|
65
|
+
install('zsh-plugin', {
|
|
66
|
+
repo: 'jeffreytse/zsh-vi-mode',
|
|
67
|
+
auto: false, // Requires explicit `dotfiles install`
|
|
68
|
+
})
|
|
69
|
+
);
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Custom Plugin Name
|
|
73
|
+
|
|
74
|
+
Use `pluginName` when you want the plugin directory name to differ from the repository name:
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import { defineTool } from '@alexgorbatchev/dotfiles';
|
|
78
|
+
|
|
79
|
+
export default defineTool((install) =>
|
|
80
|
+
install('zsh-plugin', {
|
|
81
|
+
repo: 'jeffreytse/zsh-vi-mode',
|
|
82
|
+
pluginName: 'vi-mode', // Cloned to plugins/vi-mode instead of plugins/zsh-vi-mode
|
|
83
|
+
})
|
|
84
|
+
);
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Explicit Source File
|
|
88
|
+
|
|
89
|
+
If the plugin's source file doesn't follow standard naming conventions, specify it explicitly:
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
import { defineTool } from '@alexgorbatchev/dotfiles';
|
|
93
|
+
|
|
94
|
+
export default defineTool((install) =>
|
|
95
|
+
install('zsh-plugin', {
|
|
96
|
+
repo: 'some-org/some-plugin',
|
|
97
|
+
source: 'custom-init.zsh', // Use this file instead of auto-detection
|
|
98
|
+
})
|
|
99
|
+
);
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## How It Works
|
|
103
|
+
|
|
104
|
+
1. **Clone**: The repository is cloned with `--depth 1` to minimize download size
|
|
105
|
+
2. **Detect**: The plugin's source file is auto-detected (e.g., `*.plugin.zsh`)
|
|
106
|
+
3. **Source**: A `source` command is automatically added to your shell init
|
|
107
|
+
4. **Update**: On subsequent runs, `git pull --ff-only` updates the plugin
|
|
108
|
+
5. **Version**: Version is determined from git tags (e.g., `v0.1.0`) or commit hash (e.g., `abc1234`)
|
|
109
|
+
|
|
110
|
+
### Auto-detected Source Files
|
|
111
|
+
|
|
112
|
+
The installer checks for these files in order:
|
|
113
|
+
|
|
114
|
+
- `{pluginName}.plugin.zsh`
|
|
115
|
+
- `{pluginName}.zsh`
|
|
116
|
+
- `init.zsh`
|
|
117
|
+
- `plugin.zsh`
|
|
118
|
+
- `{pluginName}.zsh-theme`
|
|
119
|
+
|
|
120
|
+
## Adding Environment Variables
|
|
121
|
+
|
|
122
|
+
Use `.zsh()` to add environment variables or other shell configuration:
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
import { defineTool } from '@alexgorbatchev/dotfiles';
|
|
126
|
+
|
|
127
|
+
export default defineTool((install) =>
|
|
128
|
+
install('zsh-plugin', {
|
|
129
|
+
repo: 'jeffreytse/zsh-vi-mode',
|
|
130
|
+
})
|
|
131
|
+
.zsh((shell) =>
|
|
132
|
+
shell.env({
|
|
133
|
+
ZVM_VI_INSERT_ESCAPE_BINDKEY: 'jj',
|
|
134
|
+
ZVM_CURSOR_STYLE_ENABLED: 'false',
|
|
135
|
+
})
|
|
136
|
+
)
|
|
137
|
+
);
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
The environment variables are set **before** the plugin is sourced, allowing you to configure the plugin's behavior.
|
|
141
|
+
|
|
142
|
+
## Troubleshooting
|
|
143
|
+
|
|
144
|
+
### Update fails
|
|
145
|
+
|
|
146
|
+
If `git pull --ff-only` fails, you may have local changes. Delete the plugin directory and reinstall, or manually reset it:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
cd ~/.dotfiles-generated/plugins/<plugin-name>
|
|
150
|
+
git reset --hard origin/HEAD
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Related
|
|
154
|
+
|
|
155
|
+
- Manual Installation - For plugins requiring custom setup
|
|
156
|
+
- Shell Integration - How shell configs are generated
|