super-opencode 1.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.opencode/agents/architect.md +54 -31
- package/.opencode/agents/backend.md +61 -34
- package/.opencode/agents/data-agent.md +422 -0
- package/.opencode/agents/devops-agent.md +331 -0
- package/.opencode/agents/frontend.md +63 -36
- package/.opencode/agents/mobile-agent.md +636 -0
- package/.opencode/agents/optimizer.md +25 -18
- package/.opencode/agents/pm-agent.md +114 -50
- package/.opencode/agents/quality.md +36 -29
- package/.opencode/agents/researcher.md +30 -21
- package/.opencode/agents/reviewer.md +39 -32
- package/.opencode/agents/security.md +42 -34
- package/.opencode/agents/writer.md +42 -31
- package/.opencode/commands/soc-analyze.md +55 -31
- package/.opencode/commands/soc-brainstorm.md +48 -26
- package/.opencode/commands/soc-cleanup.md +47 -25
- package/.opencode/commands/soc-deploy.md +271 -0
- package/.opencode/commands/soc-design.md +51 -26
- package/.opencode/commands/soc-explain.md +46 -23
- package/.opencode/commands/soc-git.md +47 -25
- package/.opencode/commands/soc-help.md +35 -14
- package/.opencode/commands/soc-implement.md +59 -29
- package/.opencode/commands/soc-improve.md +42 -20
- package/.opencode/commands/soc-onboard.md +329 -0
- package/.opencode/commands/soc-plan.md +215 -0
- package/.opencode/commands/soc-pm.md +40 -18
- package/.opencode/commands/soc-research.md +43 -20
- package/.opencode/commands/soc-review.md +39 -18
- package/.opencode/commands/soc-test.md +43 -21
- package/.opencode/commands/soc-validate.md +221 -0
- package/.opencode/commands/soc-workflow.md +38 -17
- package/.opencode/skills/confidence-check/SKILL.md +26 -19
- package/.opencode/skills/debug-protocol/SKILL.md +27 -17
- package/.opencode/skills/decision-log/SKILL.md +236 -0
- package/.opencode/skills/doc-sync/SKILL.md +345 -0
- package/.opencode/skills/package-manager/SKILL.md +502 -0
- package/.opencode/skills/package-manager/scripts/README.md +106 -0
- package/.opencode/skills/package-manager/scripts/detect-package-manager.sh +796 -0
- package/.opencode/skills/reflexion/SKILL.md +18 -11
- package/.opencode/skills/security-audit/SKILL.md +19 -14
- package/.opencode/skills/self-check/SKILL.md +30 -14
- package/.opencode/skills/simplification/SKILL.md +19 -5
- package/.opencode/skills/tech-debt/SKILL.md +245 -0
- package/LICENSE +1 -1
- package/README.md +126 -9
- package/dist/cli.js +143 -41
- package/package.json +27 -12
- package/.opencode/settings.json +0 -3
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: package-manager
|
|
3
|
+
description: Multi-language package manager detection, selection, and standardization for JavaScript, Python, Go, Rust, Java, Ruby, PHP, .NET, and more.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Package Manager Skill
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
To eliminate **package manager confusion** across all programming languages and ensure consistent, efficient dependency management. This skill automatically detects, recommends, and configures the optimal package manager for any project—preventing lockfile conflicts, install inconsistencies, and "works on my machine" issues.
|
|
11
|
+
|
|
12
|
+
**Supported Languages:** JavaScript/TypeScript, Python, Go, Rust, Java, Ruby, PHP, .NET, Elixir, Haskell, C/C++, Swift, Scala, Clojure, Julia, R
|
|
13
|
+
|
|
14
|
+
**ROI Metric**: Correct package manager selection saves 30-50% on CI build times and prevents entire classes of dependency resolution bugs.
|
|
15
|
+
|
|
16
|
+
## When to Use
|
|
17
|
+
|
|
18
|
+
- **Trigger**: **MANDATORY** at project onboarding (`/soc-onboard`).
|
|
19
|
+
- **Trigger**: Before any dependency installation in CI/CD pipelines.
|
|
20
|
+
- **Trigger**: When contributing to an existing project (detect existing choice).
|
|
21
|
+
- **Trigger**: When `devops-agent` sets up build pipelines.
|
|
22
|
+
- **Trigger**: When `backend`, `frontend`, `mobile-agent`, `data-agent`, or any other agent installs dependencies.
|
|
23
|
+
|
|
24
|
+
## Using the Detection Script (RECOMMENDED)
|
|
25
|
+
|
|
26
|
+
The detection script automates the entire detection process and provides structured output for **all supported languages**:
|
|
27
|
+
|
|
28
|
+
### Quick Detection
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Auto-detect all languages in project
|
|
32
|
+
.opencode/skills/package-manager/scripts/detect-package-manager.sh
|
|
33
|
+
|
|
34
|
+
# Detect specific language only
|
|
35
|
+
.opencode/skills/package-manager/scripts/detect-package-manager.sh python
|
|
36
|
+
.opencode/skills/package-manager/scripts/detect-package-manager.sh javascript
|
|
37
|
+
.opencode/skills/package-manager/scripts/detect-package-manager.sh go
|
|
38
|
+
|
|
39
|
+
# Get just the package manager name
|
|
40
|
+
PM=$(.opencode/skills/package-manager/scripts/detect-package-manager.sh --recommend)
|
|
41
|
+
echo "Use: $PM"
|
|
42
|
+
|
|
43
|
+
# For CI/CD or automation
|
|
44
|
+
PACKAGE_MANAGER=$(.opencode/skills/package-manager/scripts/detect-package-manager.sh --recommend)
|
|
45
|
+
$PACKAGE_MANAGER install
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### JSON Output for Scripts
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Get structured data for all detected languages
|
|
52
|
+
JSON_OUTPUT=$(.opencode/skills/package-manager/scripts/detect-package-manager.sh --json)
|
|
53
|
+
|
|
54
|
+
# Extract specific values
|
|
55
|
+
echo "$JSON_OUTPUT" | jq -r '.languages[0].package_manager'
|
|
56
|
+
echo "$JSON_OUTPUT" | jq -r '.languages[0].commands.install'
|
|
57
|
+
|
|
58
|
+
# Example output for multi-language project:
|
|
59
|
+
{
|
|
60
|
+
"project_root": "/path/to/project",
|
|
61
|
+
"languages": [
|
|
62
|
+
{
|
|
63
|
+
"language": "javascript",
|
|
64
|
+
"package_manager": "pnpm",
|
|
65
|
+
"version": "8.15.0",
|
|
66
|
+
"detection_method": "lockfile",
|
|
67
|
+
"confidence": 95,
|
|
68
|
+
"commands": {
|
|
69
|
+
"install": "pnpm install --frozen-lockfile",
|
|
70
|
+
"add": "pnpm add",
|
|
71
|
+
"add_dev": "pnpm add -D",
|
|
72
|
+
"run": "pnpm",
|
|
73
|
+
"exec": "pnpm dlx"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"language": "python",
|
|
78
|
+
"package_manager": "poetry",
|
|
79
|
+
"version": "1.7.0",
|
|
80
|
+
"detection_method": "lockfile",
|
|
81
|
+
"confidence": 95,
|
|
82
|
+
"commands": {
|
|
83
|
+
"install": "poetry install",
|
|
84
|
+
"add": "poetry add",
|
|
85
|
+
"add_dev": "poetry add --group dev",
|
|
86
|
+
"run": "poetry run"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Multi-Language Projects
|
|
94
|
+
|
|
95
|
+
For projects using multiple languages (e.g., full-stack with Python backend and JavaScript frontend):
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# Detect all languages automatically
|
|
99
|
+
.opencode/skills/package-manager/scripts/detect-package-manager.sh --all
|
|
100
|
+
|
|
101
|
+
# This will detect and report package managers for ALL languages found in the project
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Supported Languages & Package Managers
|
|
105
|
+
|
|
106
|
+
### JavaScript/TypeScript
|
|
107
|
+
|
|
108
|
+
| Package Manager | Detection Method | Files Checked |
|
|
109
|
+
|:----------------|:----------------|:-------------|
|
|
110
|
+
| **pnpm** | pnpm-lock.yaml, pnpm-workspace.yaml | pnpm-lock.yaml |
|
|
111
|
+
| **yarn** | yarn.lock | yarn.lock |
|
|
112
|
+
| **npm** | package-lock.json, package.json | package-lock.json |
|
|
113
|
+
| **bun** | bun.lockb | bun.lockb |
|
|
114
|
+
|
|
115
|
+
### Python
|
|
116
|
+
|
|
117
|
+
| Package Manager | Detection Method | Files Checked |
|
|
118
|
+
|:----------------|:----------------|:-------------|
|
|
119
|
+
| **uv** | uv.lock, pyproject.toml [tool.uv] | uv.lock |
|
|
120
|
+
| **poetry** | poetry.lock, pyproject.toml [tool.poetry] | poetry.lock |
|
|
121
|
+
| **pipenv** | Pipfile.lock | Pipfile.lock |
|
|
122
|
+
| **conda** | environment.yml, conda-lock.yml | environment.yml |
|
|
123
|
+
| **pip** | requirements.txt, setup.py, setup.cfg | requirements.txt |
|
|
124
|
+
|
|
125
|
+
### Go
|
|
126
|
+
|
|
127
|
+
| Package Manager | Detection Method | Files Checked |
|
|
128
|
+
|:----------------|:----------------|:-------------|
|
|
129
|
+
| **go modules** | go.mod, go.sum | go.mod |
|
|
130
|
+
|
|
131
|
+
### Rust
|
|
132
|
+
|
|
133
|
+
| Package Manager | Detection Method | Files Checked |
|
|
134
|
+
|:----------------|:----------------|:-------------|
|
|
135
|
+
| **cargo** | Cargo.toml, Cargo.lock | Cargo.toml |
|
|
136
|
+
|
|
137
|
+
### Java
|
|
138
|
+
|
|
139
|
+
| Package Manager | Detection Method | Files Checked |
|
|
140
|
+
|:----------------|:----------------|:-------------|
|
|
141
|
+
| **maven** | pom.xml | pom.xml |
|
|
142
|
+
| **gradle** | build.gradle, build.gradle.kts | build.gradle |
|
|
143
|
+
|
|
144
|
+
### Ruby
|
|
145
|
+
|
|
146
|
+
| Package Manager | Detection Method | Files Checked |
|
|
147
|
+
|:----------------|:----------------|:-------------|
|
|
148
|
+
| **bundler** | Gemfile, Gemfile.lock | Gemfile |
|
|
149
|
+
|
|
150
|
+
### PHP
|
|
151
|
+
|
|
152
|
+
| Package Manager | Detection Method | Files Checked |
|
|
153
|
+
|:----------------|:----------------|:-------------|
|
|
154
|
+
| **composer** | composer.json, composer.lock | composer.json |
|
|
155
|
+
|
|
156
|
+
### .NET
|
|
157
|
+
|
|
158
|
+
| Package Manager | Detection Method | Files Checked |
|
|
159
|
+
|:----------------|:----------------|:-------------|
|
|
160
|
+
| **nuget** | .csproj, .sln, packages.config | *.csproj |
|
|
161
|
+
|
|
162
|
+
### Elixir
|
|
163
|
+
|
|
164
|
+
| Package Manager | Detection Method | Files Checked |
|
|
165
|
+
|:----------------|:----------------|:-------------|
|
|
166
|
+
| **mix** | mix.exs, mix.lock | mix.exs |
|
|
167
|
+
|
|
168
|
+
### Haskell
|
|
169
|
+
|
|
170
|
+
| Package Manager | Detection Method | Files Checked |
|
|
171
|
+
|:----------------|:----------------|:-------------|
|
|
172
|
+
| **stack** | stack.yaml | stack.yaml |
|
|
173
|
+
| **cabal** | *.cabal | *.cabal |
|
|
174
|
+
|
|
175
|
+
### C/C++
|
|
176
|
+
|
|
177
|
+
| Package Manager | Detection Method | Files Checked |
|
|
178
|
+
|:----------------|:----------------|:-------------|
|
|
179
|
+
| **conan** | conanfile.txt, conanfile.py | conanfile.txt |
|
|
180
|
+
| **vcpkg** | vcpkg.json | vcpkg.json |
|
|
181
|
+
|
|
182
|
+
### Swift
|
|
183
|
+
|
|
184
|
+
| Package Manager | Detection Method | Files Checked |
|
|
185
|
+
|:----------------|:----------------|:-------------|
|
|
186
|
+
| **swift package manager** | Package.swift | Package.swift |
|
|
187
|
+
|
|
188
|
+
### Scala
|
|
189
|
+
|
|
190
|
+
| Package Manager | Detection Method | Files Checked |
|
|
191
|
+
|:----------------|:----------------|:-------------|
|
|
192
|
+
| **sbt** | build.sbt | build.sbt |
|
|
193
|
+
|
|
194
|
+
### Clojure
|
|
195
|
+
|
|
196
|
+
| Package Manager | Detection Method | Files Checked |
|
|
197
|
+
|:----------------|:----------------|:-------------|
|
|
198
|
+
| **leiningen** | project.clj | project.clj |
|
|
199
|
+
| **tools.deps** | deps.edn | deps.edn |
|
|
200
|
+
|
|
201
|
+
### Julia
|
|
202
|
+
|
|
203
|
+
| Package Manager | Detection Method | Files Checked |
|
|
204
|
+
|:----------------|:----------------|:-------------|
|
|
205
|
+
| **Pkg** | Project.toml, Manifest.toml | Project.toml |
|
|
206
|
+
|
|
207
|
+
### R
|
|
208
|
+
|
|
209
|
+
| Package Manager | Detection Method | Files Checked |
|
|
210
|
+
|:----------------|:----------------|:-------------|
|
|
211
|
+
| **renv** | renv.lock | renv.lock |
|
|
212
|
+
| **packrat** | packrat.lock | packrat.lock |
|
|
213
|
+
|
|
214
|
+
## The Detection Protocol
|
|
215
|
+
|
|
216
|
+
### 1. Lockfile Detection (Highest Confidence)
|
|
217
|
+
|
|
218
|
+
Lockfiles provide the strongest signal of which package manager is in use:
|
|
219
|
+
|
|
220
|
+
| Lockfile | Package Manager | Confidence |
|
|
221
|
+
|:---------|:----------------|:----------:|
|
|
222
|
+
| pnpm-lock.yaml | pnpm | 95% |
|
|
223
|
+
| bun.lockb | bun | 95% |
|
|
224
|
+
| poetry.lock | poetry | 95% |
|
|
225
|
+
| uv.lock | uv | 95% |
|
|
226
|
+
| yarn.lock | yarn | 90% |
|
|
227
|
+
| package-lock.json | npm | 90% |
|
|
228
|
+
| Cargo.lock | cargo | 95% |
|
|
229
|
+
| Gemfile.lock | bundler | 95% |
|
|
230
|
+
| composer.lock | composer | 95% |
|
|
231
|
+
| mix.lock | mix | 95% |
|
|
232
|
+
| go.sum | go modules | 95% |
|
|
233
|
+
|
|
234
|
+
### 2. Configuration File Detection
|
|
235
|
+
|
|
236
|
+
When no lockfile exists, configuration files provide the signal:
|
|
237
|
+
|
|
238
|
+
| Config File | Package Manager | Confidence |
|
|
239
|
+
|:------------|:----------------|:----------:|
|
|
240
|
+
| package.json + packageManager field | (as specified) | 100% |
|
|
241
|
+
| pyproject.toml [tool.poetry] | poetry | 90% |
|
|
242
|
+
| pyproject.toml [tool.uv] | uv | 90% |
|
|
243
|
+
| environment.yml | conda | 90% |
|
|
244
|
+
| requirements.txt | pip | 85% |
|
|
245
|
+
| pom.xml | maven | 95% |
|
|
246
|
+
| build.gradle | gradle | 95% |
|
|
247
|
+
|
|
248
|
+
### 3. Heuristic Detection (Lower Confidence)
|
|
249
|
+
|
|
250
|
+
When no explicit markers exist:
|
|
251
|
+
|
|
252
|
+
| Heuristic | Package Manager | Confidence |
|
|
253
|
+
|:----------|:----------------|:----------:|
|
|
254
|
+
| packages/ directory | pnpm | 80% |
|
|
255
|
+
| No indicators | npm (JS) / pip (Python) | 60% |
|
|
256
|
+
|
|
257
|
+
## Language-Specific Recommendations
|
|
258
|
+
|
|
259
|
+
### JavaScript/TypeScript Decision Matrix
|
|
260
|
+
|
|
261
|
+
| Factor | npm | yarn | pnpm | bun |
|
|
262
|
+
|:-------|:---:|:----:|:----:|:---:|
|
|
263
|
+
| **Disk Space** | High | Medium | Low | Low |
|
|
264
|
+
| **Install Speed** | Slow | Medium | Fast | Very Fast |
|
|
265
|
+
| **Monorepo Support** | Limited | Workspaces | Excellent | Limited |
|
|
266
|
+
| **Strictness** | Lenient | Moderate | Strict | Moderate |
|
|
267
|
+
| **CI/CD Compatibility** | Universal | Good | Good | Limited |
|
|
268
|
+
| **Recommendation** | Safe default | Reliable | **Preferred** | Experimental |
|
|
269
|
+
|
|
270
|
+
### Python Decision Matrix
|
|
271
|
+
|
|
272
|
+
| Factor | pip | poetry | uv | conda | pipenv |
|
|
273
|
+
|:-------|:---:|:------:|:--:|:-----:|:------:|
|
|
274
|
+
| **Speed** | Slow | Medium | Very Fast | Medium | Slow |
|
|
275
|
+
| **Virtual Env** | Manual | Built-in | Built-in | Built-in | Built-in |
|
|
276
|
+
| **Lock Files** | No | Yes | Yes | Yes | Yes |
|
|
277
|
+
| **Data Science** | Poor | Poor | Poor | **Excellent** | Poor |
|
|
278
|
+
| **Recommendation** | Legacy | Good | **Preferred** | Data Science | Avoid |
|
|
279
|
+
|
|
280
|
+
## CI/CD Integration
|
|
281
|
+
|
|
282
|
+
### GitHub Actions Example
|
|
283
|
+
|
|
284
|
+
```yaml
|
|
285
|
+
name: CI
|
|
286
|
+
|
|
287
|
+
on: [push, pull_request]
|
|
288
|
+
|
|
289
|
+
jobs:
|
|
290
|
+
build:
|
|
291
|
+
runs-on: ubuntu-latest
|
|
292
|
+
steps:
|
|
293
|
+
- uses: actions/checkout@v4
|
|
294
|
+
|
|
295
|
+
- name: Detect Package Manager
|
|
296
|
+
id: detect
|
|
297
|
+
run: |
|
|
298
|
+
PM=$(./.opencode/skills/package-manager/scripts/detect-package-manager.sh --recommend)
|
|
299
|
+
echo "package_manager=$PM" >> $GITHUB_OUTPUT
|
|
300
|
+
|
|
301
|
+
- name: Setup Node.js (if JS)
|
|
302
|
+
if: steps.detect.outputs.package_manager == 'npm' || steps.detect.outputs.package_manager == 'yarn' || steps.detect.outputs.package_manager == 'pnpm'
|
|
303
|
+
uses: actions/setup-node@v4
|
|
304
|
+
with:
|
|
305
|
+
node-version: '20'
|
|
306
|
+
|
|
307
|
+
- name: Setup Python (if Python)
|
|
308
|
+
if: steps.detect.outputs.package_manager == 'poetry' || steps.detect.outputs.package_manager == 'pip'
|
|
309
|
+
uses: actions/setup-python@v5
|
|
310
|
+
with:
|
|
311
|
+
python-version: '3.11'
|
|
312
|
+
|
|
313
|
+
- name: Install Dependencies
|
|
314
|
+
run: |
|
|
315
|
+
${{ steps.detect.outputs.package_manager }} install
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
## Command Reference
|
|
319
|
+
|
|
320
|
+
### JavaScript/TypeScript
|
|
321
|
+
|
|
322
|
+
```bash
|
|
323
|
+
# npm
|
|
324
|
+
npm ci # Clean install
|
|
325
|
+
npm install <package> # Add dependency
|
|
326
|
+
npm install --save-dev <package> # Add dev dependency
|
|
327
|
+
npm run <script> # Run script
|
|
328
|
+
npx <package> # Execute package
|
|
329
|
+
|
|
330
|
+
# yarn
|
|
331
|
+
yarn install --frozen-lockfile
|
|
332
|
+
yarn add <package>
|
|
333
|
+
yarn add --dev <package>
|
|
334
|
+
yarn <script>
|
|
335
|
+
yarn dlx <package>
|
|
336
|
+
|
|
337
|
+
# pnpm (Recommended)
|
|
338
|
+
pnpm install --frozen-lockfile
|
|
339
|
+
pnpm add <package>
|
|
340
|
+
pnpm add -D <package>
|
|
341
|
+
pnpm <script>
|
|
342
|
+
pnpm dlx <package>
|
|
343
|
+
|
|
344
|
+
# bun
|
|
345
|
+
bun install
|
|
346
|
+
bun add <package>
|
|
347
|
+
bun add -d <package>
|
|
348
|
+
bun run <script>
|
|
349
|
+
bunx <package>
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### Python
|
|
353
|
+
|
|
354
|
+
```bash
|
|
355
|
+
# pip
|
|
356
|
+
pip install -r requirements.txt
|
|
357
|
+
pip install <package>
|
|
358
|
+
pip install <package> --dev
|
|
359
|
+
python <script>
|
|
360
|
+
|
|
361
|
+
# poetry (Recommended)
|
|
362
|
+
poetry install
|
|
363
|
+
poetry add <package>
|
|
364
|
+
poetry add --group dev <package>
|
|
365
|
+
poetry run <command>
|
|
366
|
+
poetry run python <script>
|
|
367
|
+
|
|
368
|
+
# uv (Fastest)
|
|
369
|
+
uv sync
|
|
370
|
+
uv add <package>
|
|
371
|
+
uv add --dev <package>
|
|
372
|
+
uv run <command>
|
|
373
|
+
|
|
374
|
+
# conda (Data Science)
|
|
375
|
+
conda env create -f environment.yml
|
|
376
|
+
conda install <package>
|
|
377
|
+
conda run <command>
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
### Go
|
|
381
|
+
|
|
382
|
+
```bash
|
|
383
|
+
go mod download # Install dependencies
|
|
384
|
+
go get <package> # Add dependency
|
|
385
|
+
go run <file> # Run script
|
|
386
|
+
go build # Build
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### Rust
|
|
390
|
+
|
|
391
|
+
```bash
|
|
392
|
+
cargo fetch # Download dependencies
|
|
393
|
+
cargo add <package> # Add dependency
|
|
394
|
+
cargo add --dev <package> # Add dev dependency
|
|
395
|
+
cargo run # Run project
|
|
396
|
+
cargo build # Build
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
## Migration Guides
|
|
400
|
+
|
|
401
|
+
### JavaScript: npm → pnpm
|
|
402
|
+
|
|
403
|
+
```bash
|
|
404
|
+
# 1. Delete old lockfile
|
|
405
|
+
rm package-lock.json
|
|
406
|
+
|
|
407
|
+
# 2. Install with pnpm
|
|
408
|
+
pnpm install
|
|
409
|
+
|
|
410
|
+
# 3. Update package.json
|
|
411
|
+
echo '{"packageManager": "pnpm@8.15.0"}' >> package.json
|
|
412
|
+
|
|
413
|
+
# 4. Update CI/CD to use pnpm
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
### Python: pip → poetry
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
# 1. Initialize poetry
|
|
420
|
+
poetry init
|
|
421
|
+
|
|
422
|
+
# 2. Import requirements
|
|
423
|
+
poetry add $(cat requirements.txt)
|
|
424
|
+
|
|
425
|
+
# 3. Install
|
|
426
|
+
poetry install
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
## Execution Template
|
|
430
|
+
|
|
431
|
+
```markdown
|
|
432
|
+
## 📦 Package Manager Setup
|
|
433
|
+
|
|
434
|
+
### 1. Detection
|
|
435
|
+
**Script**: `.opencode/skills/package-manager/scripts/detect-package-manager.sh --json`
|
|
436
|
+
|
|
437
|
+
**Detected Languages**:
|
|
438
|
+
| Language | Package Manager | Confidence |
|
|
439
|
+
|:---------|:----------------|:----------:|
|
|
440
|
+
| JavaScript | pnpm | 95% |
|
|
441
|
+
| Python | poetry | 95% |
|
|
442
|
+
|
|
443
|
+
### 2. Installation Commands
|
|
444
|
+
**JavaScript**: `pnpm install --frozen-lockfile`
|
|
445
|
+
**Python**: `poetry install`
|
|
446
|
+
|
|
447
|
+
### 3. CI/CD Setup
|
|
448
|
+
- [ ] GitHub Actions workflow updated
|
|
449
|
+
- [ ] Cache configured correctly
|
|
450
|
+
- [ ] Multi-language support verified
|
|
451
|
+
|
|
452
|
+
### 4. Team Documentation
|
|
453
|
+
- [ ] README updated with setup instructions
|
|
454
|
+
- [ ] CONTRIBUTING.md updated
|
|
455
|
+
- [ ] Team notified of package manager choices
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
## Integration with Agents
|
|
459
|
+
|
|
460
|
+
- **`devops-agent`**: Uses this skill for all CI/CD pipeline setups.
|
|
461
|
+
- **`backend`**: Detects Python, Go, Rust, Java, etc.
|
|
462
|
+
- **`frontend`**: Detects JavaScript/TypeScript package managers.
|
|
463
|
+
- **`mobile-agent`**: Detects Swift (iOS), Gradle (Android).
|
|
464
|
+
- **`data-agent`**: Detects Python (data science), R, Julia.
|
|
465
|
+
- **`pm-agent`**: Ensures package manager consistency across team.
|
|
466
|
+
|
|
467
|
+
## Anti-Patterns (Avoid)
|
|
468
|
+
|
|
469
|
+
### ❌ Mixed Package Managers in Same Language
|
|
470
|
+
|
|
471
|
+
```
|
|
472
|
+
Developer A: Uses npm (creates package-lock.json)
|
|
473
|
+
Developer B: Uses yarn (creates yarn.lock)
|
|
474
|
+
Result: Inconsistent dependencies
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
**Fix**: Enforce single package manager via `packageManager` field.
|
|
478
|
+
|
|
479
|
+
### ❌ No Lockfiles in Version Control
|
|
480
|
+
|
|
481
|
+
```
|
|
482
|
+
Project: No lockfiles committed
|
|
483
|
+
Result: Non-reproducible builds
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
**Fix**: Always commit lockfiles (except for libraries).
|
|
487
|
+
|
|
488
|
+
### ❌ Wrong Package Manager for Use Case
|
|
489
|
+
|
|
490
|
+
```
|
|
491
|
+
Data Science project: Uses pip instead of conda
|
|
492
|
+
Result: Missing scientific libraries
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
**Fix**: Use conda for data science, poetry/uv for general Python.
|
|
496
|
+
|
|
497
|
+
## Script Files
|
|
498
|
+
|
|
499
|
+
- **Main Script**: `.opencode/skills/package-manager/scripts/detect-package-manager.sh`
|
|
500
|
+
- **Documentation**: `.opencode/skills/package-manager/scripts/README.md`
|
|
501
|
+
|
|
502
|
+
**Note**: The script is bash 3.2 compatible (macOS default) and requires no external dependencies.
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Package Manager Detection Scripts
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This folder contains the multi-language package manager detection system for OpenCode.
|
|
6
|
+
|
|
7
|
+
## Files
|
|
8
|
+
|
|
9
|
+
### `detect-package-manager.sh` (Main Script)
|
|
10
|
+
|
|
11
|
+
**Purpose**: Detect package managers for JavaScript, Python, Go, Rust, Java, Ruby, PHP, .NET, and more.
|
|
12
|
+
|
|
13
|
+
**Features**:
|
|
14
|
+
|
|
15
|
+
- Auto-detects package managers from lockfiles and config files
|
|
16
|
+
- Supports 16+ programming languages
|
|
17
|
+
- Outputs in human-readable or JSON format
|
|
18
|
+
- Bash 3.2+ compatible (works on macOS default bash)
|
|
19
|
+
|
|
20
|
+
**Usage**:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Detect all languages
|
|
24
|
+
./detect-package-manager.sh
|
|
25
|
+
|
|
26
|
+
# Detect specific language
|
|
27
|
+
./detect-package-manager.sh python
|
|
28
|
+
./detect-package-manager.sh javascript
|
|
29
|
+
|
|
30
|
+
# JSON output
|
|
31
|
+
./detect-package-manager.sh --json
|
|
32
|
+
|
|
33
|
+
# Just the recommendation
|
|
34
|
+
./detect-package-manager.sh --recommend
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### `README.md` (This File)
|
|
38
|
+
|
|
39
|
+
**Purpose**: Documentation for the scripts.
|
|
40
|
+
|
|
41
|
+
## Supported Languages
|
|
42
|
+
|
|
43
|
+
| Language | Package Managers | Detection Files |
|
|
44
|
+
|:---------|:----------------|:----------------|
|
|
45
|
+
| JavaScript/TypeScript | npm, yarn, pnpm, bun | package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb |
|
|
46
|
+
| Python | pip, poetry, uv, conda, pipenv | requirements.txt, poetry.lock, uv.lock, environment.yml, Pipfile.lock |
|
|
47
|
+
| Go | go modules | go.mod, go.sum |
|
|
48
|
+
| Rust | cargo | Cargo.toml, Cargo.lock |
|
|
49
|
+
| Java | maven, gradle | pom.xml, build.gradle |
|
|
50
|
+
| Ruby | bundler | Gemfile, Gemfile.lock |
|
|
51
|
+
| PHP | composer | composer.json, composer.lock |
|
|
52
|
+
| .NET | nuget | .csproj, .sln |
|
|
53
|
+
| Elixir | mix | mix.exs, mix.lock |
|
|
54
|
+
| Haskell | stack, cabal | stack.yaml, *.cabal |
|
|
55
|
+
| C/C++ | conan, vcpkg | conanfile.txt, vcpkg.json |
|
|
56
|
+
| Swift | swift package manager | Package.swift |
|
|
57
|
+
| Scala | sbt | build.sbt |
|
|
58
|
+
| Clojure | leiningen, tools.deps | project.clj, deps.edn |
|
|
59
|
+
| Julia | Pkg | Project.toml, Manifest.toml |
|
|
60
|
+
| R | renv, packrat | renv.lock, packrat.lock |
|
|
61
|
+
|
|
62
|
+
## Integration
|
|
63
|
+
|
|
64
|
+
### In OpenCode Agent Workflows
|
|
65
|
+
|
|
66
|
+
The skill automatically uses this script:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# From SKILL.md:
|
|
70
|
+
opencode/skills/package-manager/scripts/detect-package-manager.sh --json
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### In CI/CD
|
|
74
|
+
|
|
75
|
+
```yaml
|
|
76
|
+
- name: Detect Package Manager
|
|
77
|
+
run: |
|
|
78
|
+
PM=$(opencode/skills/package-manager/scripts/detect-package-manager.sh --recommend)
|
|
79
|
+
echo "PACKAGE_MANAGER=$PM" >> $GITHUB_ENV
|
|
80
|
+
|
|
81
|
+
- name: Install Dependencies
|
|
82
|
+
run: ${{ env.PACKAGE_MANAGER }} install
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Exit Codes
|
|
86
|
+
|
|
87
|
+
| Code | Meaning |
|
|
88
|
+
|:----:|:--------|
|
|
89
|
+
| 0 | Success - Package manager(s) detected |
|
|
90
|
+
| 1 | No package manager detected |
|
|
91
|
+
| 2 | Error (invalid arguments, file read error) |
|
|
92
|
+
|
|
93
|
+
## Adding New Languages
|
|
94
|
+
|
|
95
|
+
To add support for a new language:
|
|
96
|
+
|
|
97
|
+
1. Add a `detect_<language>()` function in `detect-package-manager.sh`
|
|
98
|
+
2. Output format: `language|pm|version|method|lockfile|confidence|config|field`
|
|
99
|
+
3. Add to `detect_all()` case statement
|
|
100
|
+
4. Add display name to `get_lang_display()`
|
|
101
|
+
5. Add recommendation to `get_recommendation()`
|
|
102
|
+
6. Add commands to `get_commands()`
|
|
103
|
+
|
|
104
|
+
## License
|
|
105
|
+
|
|
106
|
+
Part of OpenCode - Available under project license
|