feat(coding-agent): add packages array with filtering support

- Add PackageSource type for npm/git sources with optional filtering
- Migrate npm:/git: sources from extensions to packages array
- Add getPackages(), setPackages(), setProjectPackages() methods
- Update package-manager to resolve from packages array
- Support selective loading: extensions, skills, prompts, themes per package
- Update pi list to show packages
- Add migration tests for settings

closes #645
This commit is contained in:
Mario Zechner 2026-01-23 19:51:23 +01:00
parent dd838d0fe0
commit ef1fc3103e
8 changed files with 434 additions and 63 deletions

View file

@ -115,22 +115,49 @@ Additional paths via `settings.json`:
```json
{
"extensions": [
"packages": [
"npm:@foo/bar@1.0.0",
"git:github.com/user/repo@v1",
"/path/to/extension.ts",
"/path/to/extension/dir"
"git:github.com/user/repo@v1"
],
"extensions": [
"/path/to/local/extension.ts",
"/path/to/local/extension/dir"
]
}
```
Use `pi install` and `pi remove` to manage extension sources in settings:
Use `pi install`, `pi remove`, `pi list`, and `pi update` to manage packages:
```bash
pi install npm:@foo/bar@1.0.0
pi install git:github.com/user/repo@v1
pi install https://github.com/user/repo # raw URLs work too
pi remove npm:@foo/bar
pi list # show installed packages
pi update # update all non-pinned packages
```
**Package filtering:** By default, packages load all resources (extensions, skills, prompts, themes). To selectively load only certain resources:
```json
{
"packages": [
"npm:simple-pkg",
{
"source": "npm:shitty-extensions",
"extensions": ["extensions/oracle.ts", "extensions/memory-mode.ts"],
"skills": ["skills/a-nach-b"],
"themes": [],
"prompts": []
}
]
}
```
- Omit a key to load all of that type from the package
- Use empty array `[]` to load none of that type
- Paths are relative to package root
**Discovery rules:**
1. **Direct files:** `extensions/*.ts` or `*.js` → loaded directly