skills-package-manager 0.1.1 → 0.3.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/README.md +75 -12
- package/bin/skills-package-manager.js +11 -0
- package/bin/spm.js +11 -0
- package/dist/index.js +1431 -1
- package/package.json +12 -3
- package/dist/113.js +0 -355
- package/dist/bin/skills-pm.js +0 -6
- package/dist/bin/skills.js +0 -6
- package/dist/src/bin/skills-pm.d.ts +0 -2
- package/dist/src/bin/skills.d.ts +0 -2
- package/dist/src/cli/runCli.d.ts +0 -16
- package/dist/src/commands/add.d.ts +0 -5
- package/dist/src/commands/install.d.ts +0 -15
- package/dist/src/config/readSkillsLock.d.ts +0 -2
- package/dist/src/config/readSkillsManifest.d.ts +0 -2
- package/dist/src/config/syncSkillsLock.d.ts +0 -2
- package/dist/src/config/types.d.ts +0 -43
- package/dist/src/config/writeSkillsLock.d.ts +0 -2
- package/dist/src/config/writeSkillsManifest.d.ts +0 -2
- package/dist/src/index.d.ts +0 -3
- package/dist/src/install/installSkills.d.ts +0 -13
- package/dist/src/install/installState.d.ts +0 -2
- package/dist/src/install/links.d.ts +0 -1
- package/dist/src/install/materializeGitSkill.d.ts +0 -1
- package/dist/src/install/materializeLocalSkill.d.ts +0 -1
- package/dist/src/install/pruneManagedSkills.d.ts +0 -1
- package/dist/src/specifiers/normalizeSpecifier.d.ts +0 -2
- package/dist/src/specifiers/parseSpecifier.d.ts +0 -5
- package/dist/src/utils/fs.d.ts +0 -4
- package/dist/src/utils/hash.d.ts +0 -1
- package/dist/test/add.test.d.ts +0 -1
- package/dist/test/install.test.d.ts +0 -1
- package/dist/test/manifest.test.d.ts +0 -1
- package/dist/test/specifiers.test.d.ts +0 -1
- package/rslib.config.ts +0 -21
- package/src/bin/skills-pm.ts +0 -7
- package/src/bin/skills.ts +0 -7
- package/src/cli/prompt.ts +0 -36
- package/src/cli/runCli.ts +0 -45
- package/src/commands/add.ts +0 -110
- package/src/commands/install.ts +0 -5
- package/src/config/readSkillsLock.ts +0 -18
- package/src/config/readSkillsManifest.ts +0 -22
- package/src/config/syncSkillsLock.ts +0 -75
- package/src/config/types.ts +0 -37
- package/src/config/writeSkillsLock.ts +0 -9
- package/src/config/writeSkillsManifest.ts +0 -14
- package/src/github/listSkills.ts +0 -170
- package/src/github/types.ts +0 -5
- package/src/index.ts +0 -5
- package/src/install/installSkills.ts +0 -78
- package/src/install/installState.ts +0 -20
- package/src/install/links.ts +0 -9
- package/src/install/materializeGitSkill.ts +0 -33
- package/src/install/materializeLocalSkill.ts +0 -35
- package/src/install/pruneManagedSkills.ts +0 -50
- package/src/specifiers/normalizeSpecifier.ts +0 -29
- package/src/specifiers/parseSpecifier.ts +0 -45
- package/src/utils/fs.ts +0 -19
- package/src/utils/hash.ts +0 -5
- package/test/add.test.ts +0 -75
- package/test/fixtures/local-source/skills/hello-skill/SKILL.md +0 -3
- package/test/fixtures/local-source/skills/hello-skill/references/example.md +0 -1
- package/test/github.test.ts +0 -120
- package/test/install.test.ts +0 -169
- package/test/manifest.test.ts +0 -19
- package/test/specifiers.test.ts +0 -43
- package/tsconfig.json +0 -8
package/README.md
CHANGED
|
@@ -1,26 +1,41 @@
|
|
|
1
|
-
#
|
|
1
|
+
# spm
|
|
2
2
|
|
|
3
3
|
Core library and CLI for managing agent skills.
|
|
4
4
|
|
|
5
5
|
## CLI Usage
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```bash
|
|
8
|
+
spm --help
|
|
9
|
+
spm --version
|
|
10
|
+
spm add <specifier> [--skill <name>]
|
|
11
|
+
spm install
|
|
12
|
+
spm update [skill...]
|
|
13
|
+
spm init [--yes]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
- `spm` with no command shows top-level help
|
|
17
|
+
- `spm --help` prints top-level help
|
|
18
|
+
- `spm --version` prints the package version
|
|
19
|
+
|
|
20
|
+
### `spm add`
|
|
8
21
|
|
|
9
22
|
Add skills to your project.
|
|
10
23
|
|
|
11
24
|
```bash
|
|
12
25
|
# Interactive — clone repo, discover skills, select via multiselect prompt
|
|
13
|
-
|
|
14
|
-
|
|
26
|
+
spm add owner/repo
|
|
27
|
+
spm add https://github.com/owner/repo
|
|
15
28
|
|
|
16
29
|
# Non-interactive — add a specific skill by name
|
|
17
|
-
|
|
30
|
+
spm add owner/repo --skill find-skills
|
|
18
31
|
|
|
19
32
|
# Direct specifier — skip discovery
|
|
20
|
-
|
|
21
|
-
|
|
33
|
+
spm add https://github.com/owner/repo.git#path:/skills/my-skill
|
|
34
|
+
spm add file:./local-source#path:/skills/my-skill
|
|
22
35
|
```
|
|
23
36
|
|
|
37
|
+
After `spm add`, the newly added skills are resolved, materialized into `installDir`, and linked to each configured `linkTarget` immediately.
|
|
38
|
+
|
|
24
39
|
#### How it works
|
|
25
40
|
|
|
26
41
|
When given `owner/repo` or a GitHub URL:
|
|
@@ -31,20 +46,65 @@ When given `owner/repo` or a GitHub URL:
|
|
|
31
46
|
4. Writes selected skills to `skills.json` and resolves `skills-lock.yaml`
|
|
32
47
|
5. Cleans up the temp directory
|
|
33
48
|
|
|
34
|
-
### `
|
|
49
|
+
### `spm init`
|
|
50
|
+
|
|
51
|
+
Create a new `skills.json` manifest in the current directory.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Interactive — prompt for installDir and linkTargets
|
|
55
|
+
spm init
|
|
56
|
+
|
|
57
|
+
# Non-interactive — write the default manifest immediately
|
|
58
|
+
spm init --yes
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Behavior:
|
|
62
|
+
|
|
63
|
+
- `spm init` prompts for `installDir` and `linkTargets`, then writes `skills.json`
|
|
64
|
+
- `spm init --yes` skips prompts and writes the default manifest
|
|
65
|
+
- If `skills.json` already exists, the command fails and does not overwrite it
|
|
66
|
+
|
|
67
|
+
Default `skills.json` written by `spm init --yes`:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"installDir": ".agents/skills",
|
|
72
|
+
"linkTargets": [],
|
|
73
|
+
"skills": {}
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### `spm install`
|
|
35
78
|
|
|
36
79
|
Install all skills declared in `skills.json`:
|
|
37
80
|
|
|
38
81
|
```bash
|
|
39
|
-
|
|
82
|
+
spm install
|
|
40
83
|
```
|
|
41
84
|
|
|
42
85
|
This resolves each skill from its specifier, materializes it into `installDir` (default `.agents/skills/`), and creates symlinks for each `linkTarget`.
|
|
43
86
|
|
|
87
|
+
### `spm update`
|
|
88
|
+
|
|
89
|
+
Refresh git-based skills declared in `skills.json` without changing the manifest:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
spm update
|
|
93
|
+
spm update find-skills rspress-custom-theme
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Behavior:
|
|
97
|
+
|
|
98
|
+
- Uses `skills.json` as the source of truth
|
|
99
|
+
- Re-resolves git refs to the latest commit
|
|
100
|
+
- Skips `file:` skills
|
|
101
|
+
- Fails immediately for unknown skill names
|
|
102
|
+
- Writes `skills-lock.yaml` only after fetch and link succeed
|
|
103
|
+
|
|
44
104
|
## Programmatic API
|
|
45
105
|
|
|
46
106
|
```typescript
|
|
47
|
-
import { addCommand, installCommand, listRepoSkills } from 'skills-
|
|
107
|
+
import { addCommand, installCommand, listRepoSkills } from 'skills-package-manager'
|
|
48
108
|
|
|
49
109
|
// Add a skill
|
|
50
110
|
await addCommand({
|
|
@@ -70,9 +130,11 @@ const skills = await listRepoSkills('vercel-labs', 'skills')
|
|
|
70
130
|
| Part | Description | Example |
|
|
71
131
|
|------|-------------|---------|
|
|
72
132
|
| `source` | Git URL or `file:` path | `https://github.com/o/r.git`, `file:./local` |
|
|
73
|
-
| `ref` | Optional git ref | `main`, `v1.0.0`, `HEAD` |
|
|
133
|
+
| `ref` | Optional git ref | `main`, `v1.0.0`, `HEAD`, `6cb0992`, `6cb0992a176f2ca142e19f64dca8ac12025b035e` |
|
|
74
134
|
| `path` | Path to skill directory within source | `/skills/my-skill` |
|
|
75
135
|
|
|
136
|
+
`ref` can point to a branch, tag, full commit SHA, or short commit SHA.
|
|
137
|
+
|
|
76
138
|
### Resolution Types
|
|
77
139
|
|
|
78
140
|
- **`git`** — Clones the repo, resolves commit hash, copies skill files
|
|
@@ -82,7 +144,7 @@ const skills = await listRepoSkills('vercel-labs', 'skills')
|
|
|
82
144
|
|
|
83
145
|
```
|
|
84
146
|
src/
|
|
85
|
-
├── bin/ # CLI entry points (
|
|
147
|
+
├── bin/ # CLI entry points (spm, skills)
|
|
86
148
|
├── cli/ # CLI runner and interactive prompts
|
|
87
149
|
├── commands/ # add, install command implementations
|
|
88
150
|
├── config/ # skills.json / skills-lock.yaml read/write
|
|
@@ -103,3 +165,4 @@ pnpm build # Builds with Rslib (ESM output + DTS)
|
|
|
103
165
|
```bash
|
|
104
166
|
pnpm test # Runs tests with Rstest
|
|
105
167
|
```
|
|
168
|
+
``
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { formatErrorForDisplay, getExitCode, isSpmError, runCli } from '../dist/index.js'
|
|
3
|
+
|
|
4
|
+
runCli(process.argv).catch((error) => {
|
|
5
|
+
if (isSpmError(error)) {
|
|
6
|
+
console.error(formatErrorForDisplay(error))
|
|
7
|
+
process.exit(getExitCode(error))
|
|
8
|
+
}
|
|
9
|
+
console.error(error instanceof Error ? error.message : error)
|
|
10
|
+
process.exit(1)
|
|
11
|
+
})
|
package/bin/spm.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { formatErrorForDisplay, getExitCode, isSpmError, runCli } from '../dist/index.js'
|
|
3
|
+
|
|
4
|
+
runCli(process.argv).catch((error) => {
|
|
5
|
+
if (isSpmError(error)) {
|
|
6
|
+
console.error(formatErrorForDisplay(error))
|
|
7
|
+
process.exit(getExitCode(error))
|
|
8
|
+
}
|
|
9
|
+
console.error(error instanceof Error ? error.message : error)
|
|
10
|
+
process.exit(1)
|
|
11
|
+
})
|