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.
Files changed (68) hide show
  1. package/README.md +75 -12
  2. package/bin/skills-package-manager.js +11 -0
  3. package/bin/spm.js +11 -0
  4. package/dist/index.js +1431 -1
  5. package/package.json +12 -3
  6. package/dist/113.js +0 -355
  7. package/dist/bin/skills-pm.js +0 -6
  8. package/dist/bin/skills.js +0 -6
  9. package/dist/src/bin/skills-pm.d.ts +0 -2
  10. package/dist/src/bin/skills.d.ts +0 -2
  11. package/dist/src/cli/runCli.d.ts +0 -16
  12. package/dist/src/commands/add.d.ts +0 -5
  13. package/dist/src/commands/install.d.ts +0 -15
  14. package/dist/src/config/readSkillsLock.d.ts +0 -2
  15. package/dist/src/config/readSkillsManifest.d.ts +0 -2
  16. package/dist/src/config/syncSkillsLock.d.ts +0 -2
  17. package/dist/src/config/types.d.ts +0 -43
  18. package/dist/src/config/writeSkillsLock.d.ts +0 -2
  19. package/dist/src/config/writeSkillsManifest.d.ts +0 -2
  20. package/dist/src/index.d.ts +0 -3
  21. package/dist/src/install/installSkills.d.ts +0 -13
  22. package/dist/src/install/installState.d.ts +0 -2
  23. package/dist/src/install/links.d.ts +0 -1
  24. package/dist/src/install/materializeGitSkill.d.ts +0 -1
  25. package/dist/src/install/materializeLocalSkill.d.ts +0 -1
  26. package/dist/src/install/pruneManagedSkills.d.ts +0 -1
  27. package/dist/src/specifiers/normalizeSpecifier.d.ts +0 -2
  28. package/dist/src/specifiers/parseSpecifier.d.ts +0 -5
  29. package/dist/src/utils/fs.d.ts +0 -4
  30. package/dist/src/utils/hash.d.ts +0 -1
  31. package/dist/test/add.test.d.ts +0 -1
  32. package/dist/test/install.test.d.ts +0 -1
  33. package/dist/test/manifest.test.d.ts +0 -1
  34. package/dist/test/specifiers.test.d.ts +0 -1
  35. package/rslib.config.ts +0 -21
  36. package/src/bin/skills-pm.ts +0 -7
  37. package/src/bin/skills.ts +0 -7
  38. package/src/cli/prompt.ts +0 -36
  39. package/src/cli/runCli.ts +0 -45
  40. package/src/commands/add.ts +0 -110
  41. package/src/commands/install.ts +0 -5
  42. package/src/config/readSkillsLock.ts +0 -18
  43. package/src/config/readSkillsManifest.ts +0 -22
  44. package/src/config/syncSkillsLock.ts +0 -75
  45. package/src/config/types.ts +0 -37
  46. package/src/config/writeSkillsLock.ts +0 -9
  47. package/src/config/writeSkillsManifest.ts +0 -14
  48. package/src/github/listSkills.ts +0 -170
  49. package/src/github/types.ts +0 -5
  50. package/src/index.ts +0 -5
  51. package/src/install/installSkills.ts +0 -78
  52. package/src/install/installState.ts +0 -20
  53. package/src/install/links.ts +0 -9
  54. package/src/install/materializeGitSkill.ts +0 -33
  55. package/src/install/materializeLocalSkill.ts +0 -35
  56. package/src/install/pruneManagedSkills.ts +0 -50
  57. package/src/specifiers/normalizeSpecifier.ts +0 -29
  58. package/src/specifiers/parseSpecifier.ts +0 -45
  59. package/src/utils/fs.ts +0 -19
  60. package/src/utils/hash.ts +0 -5
  61. package/test/add.test.ts +0 -75
  62. package/test/fixtures/local-source/skills/hello-skill/SKILL.md +0 -3
  63. package/test/fixtures/local-source/skills/hello-skill/references/example.md +0 -1
  64. package/test/github.test.ts +0 -120
  65. package/test/install.test.ts +0 -169
  66. package/test/manifest.test.ts +0 -19
  67. package/test/specifiers.test.ts +0 -43
  68. package/tsconfig.json +0 -8
package/README.md CHANGED
@@ -1,26 +1,41 @@
1
- # skills-pm
1
+ # spm
2
2
 
3
3
  Core library and CLI for managing agent skills.
4
4
 
5
5
  ## CLI Usage
6
6
 
7
- ### `skills add`
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
- skills add owner/repo
14
- skills add https://github.com/owner/repo
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
- skills add owner/repo --skill find-skills
30
+ spm add owner/repo --skill find-skills
18
31
 
19
32
  # Direct specifier — skip discovery
20
- skills add https://github.com/owner/repo.git#path:/skills/my-skill
21
- skills add file:./local-source#path:/skills/my-skill
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
- ### `skills install`
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
- skills install
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-pm'
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 (skills-pm, skills)
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
+ })