|
1
|
--- |
|
2
|
name: package-management |
|
3
|
description: Install and manage language packages, system dependencies, and programming language runtimes. |
|
4
|
--- |
|
5
|
|
|
6
|
# Package Management Skill |
|
7
|
|
|
8
|
Manage project dependencies and programming language runtimes. Use this skill instead of running shell commands like `npm install`, `pip install`, or `apt install`. |
|
9
|
|
|
10
|
## When to Use |
|
11
|
|
|
12
|
Use this skill when you need to: |
|
13
|
|
|
14
|
- Install language-specific packages (npm, pip, cargo, etc.) |
|
15
|
- Install system-level dependencies (ffmpeg, jq, imagemagick, etc.) |
|
16
|
- Install programming language runtimes (Python, Node.js, etc.) |
|
17
|
- Remove packages from the project |
|
18
|
- Check available versions of a programming language |
|
19
|
|
|
20
|
## When NOT to Use |
|
21
|
|
|
22
|
- Searching for available packages (use web search instead) |
|
23
|
- Configuring package settings (edit config files directly) |
|
24
|
- Running package scripts (use bash tool) |
|
25
|
|
|
26
|
## Modules (Replit Terminology) |
|
27
|
|
|
28
|
"Modules" is a Replit-specific term for language toolchains that can be installed into the NixOS environment. Use `listAvailableModules()` to see what's available. |
|
29
|
|
|
30
|
**Installation priority order:** |
|
31
|
|
|
32
|
1. Modules via this skill (preferred) |
|
33
|
2. Nix system dependencies via `installSystemDependencies()` |
|
34
|
3. Language package managers (pip, npm, cargo, etc.) via `installLanguagePackages()` |
|
35
|
|
|
36
|
If confused about package installation in Nix or language package managers, use web search. |
|
37
|
|
|
38
|
If a package install fails with HTTP 403 from `package-firewall.replit.local`, treat it as a likely security block and do not retry the same install. |
|
39
|
|
|
40
|
**After installing a module:** |
|
41
|
|
|
42
|
- Update `.gitignore` with the language's standard ignore patterns |
|
43
|
- Never add Replit config files to `.gitignore` |
|
44
|
|
|
45
|
**After removing a module:** |
|
46
|
|
|
47
|
- Consider removing any corresponding workflows that depend on it |
|
48
|
|
|
49
|
## Available Functions |
|
50
|
|
|
51
|
### listAvailableModules(langName=None) |
|
52
|
|
|
53
|
List available language toolchains that can be installed. |
|
54
|
|
|
55
|
**Parameters:** |
|
56
|
|
|
57
|
- `langName` (str, optional): Language name to filter by (e.g., "python", "nodejs", "rust"). If not provided, returns all available modules. |
|
58
|
|
|
59
|
**Returns:** Dict with `success`, `message`, `langName`, and `modules` list |
|
60
|
|
|
61
|
Each module contains: id, name, version, description |
|
62
|
|
|
63
|
**Example:** |
|
64
|
|
|
65
|
```javascript |
|
66
|
// List all available modules |
|
67
|
const modules = await listAvailableModules(); |
|
68
|
// Returns: {modules: [{id: "python-3.11", ...}, {id: "nodejs-20", ...}, ...]} |
|
69
|
|
|
70
|
// Find available Python versions |
|
71
|
const pythonModules = await listAvailableModules({ langName: "python" }); |
|
72
|
// Returns: {modules: [{id: "python-3.11", name: "Python", version: "3.11", ...}, ...]} |
|
73
|
|
|
74
|
// Find available Node.js versions |
|
75
|
const nodeModules = await listAvailableModules({ langName: "nodejs" }); |
|
76
|
``` |
|
77
|
|
|
78
|
### installProgrammingLanguage(language) |
|
79
|
|
|
80
|
Install a programming language runtime and its package manager. |
|
81
|
|
|
82
|
**Parameters:** |
|
83
|
|
|
84
|
- `language` (str, required): Language identifier like "python-3.11", "nodejs-20" |
|
85
|
|
|
86
|
**Returns:** Dict with `success`, `message`, `language`, and `installedModuleId` keys |
|
87
|
|
|
88
|
**Example:** |
|
89
|
|
|
90
|
```javascript |
|
91
|
// First, check available versions |
|
92
|
const modules = await listAvailableModules({ langName: "python" }); |
|
93
|
console.log(modules); // See available Python versions |
|
94
|
|
|
95
|
// Install specific version |
|
96
|
const result = await installProgrammingLanguage({ language: "python-3.11" }); |
|
97
|
|
|
98
|
// Install Node.js 20 |
|
99
|
const result2 = await installProgrammingLanguage({ language: "nodejs-20" }); |
|
100
|
``` |
|
101
|
|
|
102
|
### uninstallProgrammingLanguage(moduleId) |
|
103
|
|
|
104
|
Remove an installed programming language runtime. |
|
105
|
|
|
106
|
**Parameters:** |
|
107
|
|
|
108
|
- `moduleId` (str, required): Module ID from `listAvailableModules` |
|
109
|
|
|
110
|
**Returns:** Dict with `success`, `message`, `moduleId`, and `wasInstalled` |
|
111
|
|
|
112
|
**Example:** |
|
113
|
|
|
114
|
```javascript |
|
115
|
// Remove Python 3.10 |
|
116
|
const result = await uninstallProgrammingLanguage({ moduleId: "python-3.10" }); |
|
117
|
``` |
|
118
|
|
|
119
|
### installLanguagePackages(language, packages) |
|
120
|
|
|
121
|
Install language-specific packages like npm, pip, or cargo packages. |
|
122
|
|
|
123
|
**Parameters:** |
|
124
|
|
|
125
|
- `language` (str, required): Programming language: "nodejs", "python", "bun", "go", "rust" |
|
126
|
- `packages` (list[str], required): List of packages to install |
|
127
|
|
|
128
|
**Returns:** Dict with `success`, `message`, `packages`, and `output` keys |
|
129
|
|
|
130
|
**Example:** |
|
131
|
|
|
132
|
```javascript |
|
133
|
// Install npm packages |
|
134
|
const result = await installLanguagePackages({ |
|
135
|
language: "nodejs", |
|
136
|
packages: ["express", "lodash"] |
|
137
|
}); |
|
138
|
console.log(result.message); |
|
139
|
|
|
140
|
// Install pip packages |
|
141
|
const result2 = await installLanguagePackages({ |
|
142
|
language: "python", |
|
143
|
packages: ["requests", "flask"] |
|
144
|
}); |
|
145
|
``` |
|
146
|
|
|
147
|
**IMPORTANT — required parameter rules:** |
|
148
|
|
|
149
|
- `language` is **required** — you must always include it |
|
150
|
- Valid language values: `"nodejs"`, `"python"`, `"bun"`, `"go"`, `"rust"` |
|
151
|
- Use `"nodejs"` for JavaScript/TypeScript projects — NEVER use `"js"`, `"node"`, or `"javascript"` |
|
152
|
- Use `"python"` for Python projects — NEVER use `"py"` or `"pip"` |
|
153
|
- `packages` must be an **array of strings** — NEVER a single string, NEVER an array of objects |
|
154
|
- Correct: `packages: ["express"]` |
|
155
|
- Wrong: `packages: "express"` |
|
156
|
- Wrong: `packages: [{name: "express"}]` |
|
157
|
|
|
158
|
### uninstallLanguagePackages(language, packages) |
|
159
|
|
|
160
|
Remove language-specific packages. |
|
161
|
|
|
162
|
**Parameters:** |
|
163
|
|
|
164
|
- `language` (str, required): Programming language |
|
165
|
- `packages` (list[str], required): List of packages to uninstall |
|
166
|
|
|
167
|
**Returns:** Dict with `success`, `message`, and `packages` keys |
|
168
|
|
|
169
|
**Example:** |
|
170
|
|
|
171
|
```javascript |
|
172
|
const result = await uninstallLanguagePackages({ |
|
173
|
language: "nodejs", |
|
174
|
packages: ["lodash"] |
|
175
|
}); |
|
176
|
``` |
|
177
|
|
|
178
|
### installSystemDependencies(packages) |
|
179
|
|
|
180
|
Install system-level dependencies via Nix. |
|
181
|
|
|
182
|
**Parameters:** |
|
183
|
|
|
184
|
- `packages` (list[str], required): Nixpkgs attribute paths (NOT apt package names) |
|
185
|
|
|
186
|
**Returns:** Dict with `success`, `message`, and `packages` keys |
|
187
|
|
|
188
|
**Important:** Use Nix package names, not apt/debian names: |
|
189
|
|
|
190
|
- X11 libraries need 'xorg.' prefix: `xorg.libxcb`, `xorg.libX11` |
|
191
|
- `ca-certificates` is `cacert` in Nix |
|
192
|
- `libxcb` is `xorg.libxcb` in Nix |
|
193
|
|
|
194
|
**Example:** |
|
195
|
|
|
196
|
```javascript |
|
197
|
// Install system dependencies |
|
198
|
const result = await installSystemDependencies({ |
|
199
|
packages: ["jq", "ffmpeg", "imagemagick"] |
|
200
|
}); |
|
201
|
|
|
202
|
// Install X11 libraries (note the xorg. prefix) |
|
203
|
const result2 = await installSystemDependencies({ |
|
204
|
packages: ["xorg.libxcb", "xorg.libX11"] |
|
205
|
}); |
|
206
|
``` |
|
207
|
|
|
208
|
### uninstallSystemDependencies(packages) |
|
209
|
|
|
210
|
Remove system-level dependencies. |
|
211
|
|
|
212
|
**Parameters:** |
|
213
|
|
|
214
|
- `packages` (list[str], required): Nixpkgs attribute paths to uninstall |
|
215
|
|
|
216
|
**Returns:** Dict with `success`, `message`, and `packages` keys |
|
217
|
|
|
218
|
**Example:** |
|
219
|
|
|
220
|
```javascript |
|
221
|
const result = await uninstallSystemDependencies({ packages: ["jq"] }); |
|
222
|
``` |
|
223
|
|
|
224
|
## Best Practices |
|
225
|
|
|
226
|
1. **Use language packages for project dependencies**: These are tracked in package files (package.json, requirements.txt) |
|
227
|
2. **Use system dependencies for OS-level tools**: Things like ffmpeg, imagemagick, or native libraries |
|
228
|
3. **Use Nix package names**: Not apt/debian names. Check nixpkgs for correct names |
|
229
|
4. **Install language runtimes when needed**: If `python` or `node` commands fail, install the runtime first |
|
230
|
5. **Check versions first**: Use `listAvailableModules` before `installProgrammingLanguage` |
|
231
|
|
|
232
|
## Example Workflow |
|
233
|
|
|
234
|
```javascript |
|
235
|
// Check available Python versions |
|
236
|
const modules = await listAvailableModules({ langName: "python" }); |
|
237
|
console.log(modules); |
|
238
|
|
|
239
|
// Set up a Python Flask project |
|
240
|
await installProgrammingLanguage({ language: "python-3.11" }); |
|
241
|
await installLanguagePackages({ |
|
242
|
language: "python", |
|
243
|
packages: ["flask", "gunicorn", "sqlalchemy"] |
|
244
|
}); |
|
245
|
|
|
246
|
// Set up a Node.js project with native dependencies |
|
247
|
await installProgrammingLanguage({ language: "nodejs-20" }); |
|
248
|
await installLanguagePackages({ |
|
249
|
language: "nodejs", |
|
250
|
packages: ["sharp", "canvas"] |
|
251
|
}); |
|
252
|
await installSystemDependencies({ |
|
253
|
packages: ["pkg-config", "cairo", "pango", "libjpeg"] |
|
254
|
}); |
|
255
|
|
|
256
|
// Clean up old language version |
|
257
|
await uninstallProgrammingLanguage({ moduleId: "python-3.10" }); |
|
258
|
``` |
|
259
|
|
|
260
|
## Automatic Behaviors |
|
261
|
|
|
262
|
- Installing packages automatically creates/updates project files (package.json, requirements.txt, etc.) |
|
263
|
- Package installations reboot all workflows to pick up new dependencies |
|
264
|
- Language runtime installations include popular package managers (pip, npm, etc.) |