skillshop 2.2.0 → 4.1.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Skillshop
2
2
 
3
- Skillshop installs and manages agent skills. Its CLI includes a bundled skill registry, with the same named install, update, and agent configuration commands as the earlier `skillz` CLI. It also lets project owners export skills from their own npm packages. A skill is a directory containing `SKILL.md` and any supporting files.
3
+ Skillshop installs and manages agent skills. For user-authored skills, a plain folder library is the source of truth. Download individual skills from GitHub, install them into project or global destinations, and sync later source edits across recorded copies. The bundled registry and npm package-library APIs remain available for compatibility. A skill is a directory containing `SKILL.md` and any supporting files.
4
4
 
5
5
  The command is `skillshop`; `sk` runs the same CLI. The previous `skillz` command is no longer an executable alias. Existing `.skillz-lock` and `~/.skillz` state remain readable.
6
6
 
@@ -15,26 +15,65 @@ skillshop init
15
15
 
16
16
  `skillshop init` asks which agents you use and saves their destinations in `~/.skillshop/config.json`. It is optional for project skill installs: without saved agent selection, Skillshop uses the nearest existing `.agents`, `.github`, or `.codex` directory and falls back to project-root `.agents/skills`. Run `skillshop init` to choose system-wide defaults; change that selection later with `skillshop config agents`. Codex and OpenCode use `.agents/skills` inside projects and `~/.agents/skills` for user-level installs. Copilot and Claude use their own skill directories. Shared destinations get one copy.
17
17
 
18
- ### Install a named skill
18
+ ### Use a personal folder library
19
19
 
20
- List the skills bundled with Skillshop, then install one:
20
+ ```bash
21
+ skillshop library init # selects ~/skillshop-library
22
+ skillshop library init ./my-skills # selects or adopts an existing folder
23
+ skillshop library list
24
+ skillshop download @alice/review # adds source only
25
+ skillshop install @alice/review # downloads if absent, then installs locally
26
+ skillshop install @alice/review --global
27
+ skillshop install review # installs an existing selected source
28
+ skillshop sync # updates all recorded project and global copies
29
+ ```
30
+
31
+ `library init` can create a missing folder or select an existing library. It preserves existing skill directories and config; no `package.json`, npm metadata, or version field is required. Without an explicit directory it selects the visible `~/skillshop-library` folder. The library config is `skillshop-library.json`; the default source directory is `skills/`. A skill can contain any regular files and nested folders, including hidden references and executable scripts.
32
+
33
+ `download @owner/skill` reads `https://github.com/owner/skillshop-library.git` and copies only `skills/skill` into the selected personal library. The `@` marks a remote owner/skill reference; it is not part of the GitHub owner or repository URL. Download does not install the skill. `install @owner/skill` downloads when that source is absent, then installs from the library. If the same repository source is already present, local edits are reused without an upstream fetch. `install name` installs a matching skill from the selected library. Once a library is selected, named installs and `skillshop list` use that library; they do not fall back to bundled skills or add bundled guidance. Add `--global` to install into configured user directories. Unprefixed `owner/skill` inputs are rejected; use `@owner/skill` for remote references.
34
+
35
+ `download @owner/skill --force` explicitly replaces the personal source directory after validation. A same-name authored or different-source skill otherwise fails safely. `skillshop sync` copies the current full directory from each recorded personal source to its Skillshop-managed project and global copies. It includes file additions, edits, removals, hidden files, binary contents, and modes; stale extras inside those owned copies are removed. Sync never fetches GitHub and changing the selected library does not redirect existing copies.
36
+
37
+ `sync` is also the explicit migration step for older tracked bundled installs. `library init` does not migrate them. If a selected library already has a skill, that source wins and tracked bundle copies are synchronized from it. Otherwise, Skillshop imports a missing source only when every surviving tracked project and global copy agrees across full paths, bytes, and modes. Divergent copies and unreadable ownership state are reported. Unknown source kinds, unmanaged directories, and imported snapshots are left untouched; if they prevent a complete consensus decision, sync reports that conflict. Missing recorded destinations are pruned, never recreated. Keep durable edits in the personal source; sync intentionally replaces local edits inside an owned installed copy.
38
+
39
+ ### Installation ownership and project dependencies
40
+
41
+ Every installed skills directory has its own `.skillshop-lock`. This is a local ownership manifest, not a project dependency lockfile. It records which installer owns each named directory and its source. Personal-library, bundled, package, package-import, and dependency workflows preserve one another's entries. An existing unmanaged or foreign-owned directory is never implicitly adopted, including with package import `--force`.
42
+
43
+ For reproducible project requirements, opt into a separate dependency workflow:
21
44
 
22
45
  ```bash
23
- skillshop list
24
- skillshop one-shot
25
- # Equivalent: skillshop install one-shot
46
+ skillshop dependency add @alice/review@v1.2.0
47
+ skillshop dependency add @alice/triage@0123456789abcdef0123456789abcdef01234567
48
+ skillshop install # restore declared dependencies
49
+ skillshop ci # restore with a frozen lock
50
+ skillshop dependency remove review
26
51
  ```
27
52
 
28
- Run a project install inside a Git repository. Skillshop copies the skill into each configured project destination and records managed copies in `.skillshop-lock`. It also installs the `skillshop` guidance skill. The lockfile and managed skill directories go into the repository's local Git exclude file, leaving unrelated skill directories alone.
53
+ `dependency add` writes `skillshop.json` and `skillshop-lock.json` at the project root and installs the skill. Commit both files. A reference can select a Git tag, branch, or full commit; omitting it resolves the current default branch. The lock records the exact resolved Git commit and SHA-256 integrity of the complete skill tree. It never follows a moved tag or branch during restore. These refs select repository revisions, not semver ranges or the version field in `SKILL.md`.
29
54
 
30
- To install a named skill for your user account instead:
55
+ The project manifest declares `skillsDirectory` (default `.agents/skills`), independently of personal agent settings. Dependency installs use upstream sources directly; they do not create or modify your personal library. `skillshop sync`, ordinary named updates, and Skillshop upgrades leave dependency-owned content alone. Use `skillshop dependency update [name]` to re-resolve upstream refs, or add a different ref; ordinary installs reuse matching lock entries. `skillshop ci` or `skillshop install --frozen-lockfile` fails before installation if the dependency declaration and lock disagree.
56
+
57
+ Use `skillshop dependency install` as an explicit alias for restore. For skills distributed through npm application packages, continue using npm's dependency declarations and package lock to pin the package; the destination `.skillshop-lock` records installation ownership only.
58
+
59
+ `skillshop upgrade` automatically migrates legacy project-root `.skillshop-lock` / `.skillz-lock` files and `~/.skillshop/global-skills.json` (or the legacy state home) within its upgrade scope. Replacements are validated and saved before old records are removed, even when skill versions have not changed. Invalid/conflicting ownership or unsafe paths are preserved and reported as an incomplete migration. Unregistered repositories can be discovered with `skillshop migrate ~/workspace`. Installing the CLI directly with npm does not run migration hooks; use `skillshop migrate` or subsequent ownership-reconciling commands.
60
+
61
+ See [installation and dependency state](docs/installation-and-dependency-state.md) for schemas, migration boundaries, and ownership rules.
62
+
63
+ ### Install a bundled registry skill (compatibility mode)
64
+
65
+ When no personal library is selected, the bundled registry remains available:
31
66
 
32
67
  ```bash
68
+ skillshop list
69
+ skillshop one-shot
70
+ # Equivalent: skillshop install one-shot
33
71
  skillshop one-shot --global
34
- # Equivalent: sk install one-shot --global
35
72
  ```
36
73
 
37
- For Codex or OpenCode, this writes `~/.agents/skills/one-shot`. A global install replaces an existing skill directory with that name, including local edits and extra files. Global installs use `~/.skillshop/global-skills.json` for bookkeeping. Except for `skillshop upgrade`, ordinary non-agent-instruction CLI runs reconcile recorded installations. Upgrade skips reconciliation in the old process and refreshes changed copies from the newly installed package in a fresh process. Agent instruction commands also bypass reconciliation and do not install the bundled registry.
74
+ Run project installs inside a Git repository. Skillshop records ownership in `.skillshop-lock` inside each destination skills directory, for example `.agents/skills/.skillshop-lock`. It adds its local manifests and managed skill paths to the repository's local Git exclude file. In this compatibility mode it also installs bundled `skillshop` guidance. Global installs use the same directory-local format, for example `~/.agents/skills/.skillshop-lock`.
75
+
76
+ In bundled compatibility mode, most ordinary commands reconcile recorded bundled installations. When a personal library is selected, `list` and named installs join library, download, qualified install, sync, upgrade, and agent instruction commands in bypassing that legacy reconciliation. Upgrade refreshes changed-version bundled copies from the newly installed package in a fresh process. Same-version bundled copies keep local edits; a changed-version replacement overwrites edits in that managed copy. To keep durable local changes, initialize a personal library, use `skillshop sync` to adopt tracked bundled copies where their contents agree, edit the library source, then sync it to owned copies. Personal-library copies are excluded from bundled refresh.
38
77
 
39
78
  ### Update or remove skills
40
79
 
@@ -46,7 +85,7 @@ skillshop uninstall one-shot
46
85
  skillshop uninstall one-shot --global
47
86
  ```
48
87
 
49
- `update` replaces skills managed in the current project's lockfile. `update --push` updates registered projects. Neither command updates global copies; reinstall a global skill by name with `--global`. Project uninstall removes only a skill recorded in `.skillshop-lock`. Global uninstall removes the named skill from configured user directories.
88
+ `update` refreshes Skillshop-owned personal or bundled skills in the current project from their recorded source. `update --push` updates registered projects. Use `skillshop sync` to propagate personal-library changes to recorded local and global copies. Project and global uninstall remove only Skillshop CLI-owned copies recorded in the destination manifests. They refuse unmanaged skills and copies owned by packages or project dependencies.
50
89
 
51
90
  ### Upgrade Skillshop
52
91
 
@@ -56,7 +95,7 @@ skillshop upgrade
56
95
 
57
96
  The command upgrades the npm installation that supplied the invoked CLI. A project-local installation updates Skillshop in the owning npm project and preserves the dependency section where it is already declared. It refreshes only that project's recorded Skillshop-managed skill copies. A global installation updates its npm prefix, then refreshes recorded global copies and copies in registered projects; it does not update those projects' package manifests. Running from a source checkout keeps the historical global-install behavior and does not edit the checkout's package manifest.
58
97
 
59
- After npm succeeds, the newly installed CLI runs in a fresh process and refreshes only existing copies recorded in `.skillshop-lock` or `~/.skillshop/global-skills.json` whose bundled skill version changed. Same-version copies retain their local bodies. A changed-version replacement overwrites local edits in that managed copy; make durable edits in the bundled source. Deleted paths are pruned from ownership records instead of recreated. Unmanaged directories and package-import snapshots are not adopted. An npm install failure stops before copy refresh; a later refresh failure reports that Skillshop was upgraded and gives a nonzero result with the partial-refresh summary.
98
+ After npm succeeds, the newly installed CLI runs in a fresh process. It migrates legacy ownership records, then refreshes only existing CLI-owned copies whose bundled skill version changed. Same-version copies retain local edits. A changed-version replacement overwrites local edits in that managed copy. For durable local changes, initialize a personal library, explicitly sync to adopt tracked bundled copies when their surviving copies agree, then edit the library source and sync. Deleted paths are pruned from ownership records instead of recreated. Unmanaged directories and package-import snapshots are not adopted. An npm install failure stops before copy refresh; a later refresh failure reports that Skillshop was upgraded and gives a nonzero result with the partial-refresh summary.
60
99
 
61
100
  `skillshop init` is optional. It configures agent destinations and is not required to upgrade Skillshop. The upgrade command never initializes, renders, or rewrites project `AGENTS.md` files or instruction templates.
62
101
 
@@ -125,7 +164,7 @@ A distributor can declare which exported skills a global npm install should plac
125
164
  npm install --global @example/skill-library
126
165
  ```
127
166
 
128
- Those declared skills are copied during the package's install script. This package installer targets `~/.agents/skills` by default, independently of the agents selected with `skillshop init`. Updating the package replaces the same named user skills. If scripts are disabled, run `skillshop install-user /path/to/installed-package` manually.
167
+ Those declared skills are copied during the package's install script. This package installer targets `~/.agents/skills` by default, independently of the agents selected with `skillshop init`. Updating the package replaces its own recorded user skills, refuses unmanaged or foreign-owned collisions, and removes its own copies when their declarations are removed. If scripts are disabled, run `skillshop install-user /path/to/installed-package` manually.
129
168
 
130
169
  To copy one exported skill into a project instead:
131
170
 
@@ -147,195 +186,37 @@ cd ~/work/sample-app
147
186
  skillshop changelog
148
187
  ```
149
188
 
150
- The global command writes `~/.agents/skills/one-shot/SKILL.md`. The project command writes `.agents/skills/changelog/SKILL.md` and `.agents/skills/skillshop/SKILL.md` inside `sample-app`, then records both managed skills in `.skillshop-lock`. It does not copy `one-shot` into the project. Running `skillshop update` in `sample-app` refreshes the locked project skills; run `skillshop one-shot --global` again to replace the global copy.
189
+ The global command writes `~/.agents/skills/one-shot/SKILL.md`. The project command writes `.agents/skills/changelog/SKILL.md` and `.agents/skills/skillshop/SKILL.md` inside `sample-app`, then records both managed skills in `.agents/skills/.skillshop-lock`. It does not copy `one-shot` into the project. Running `skillshop update` in `sample-app` refreshes the locked project skills; run `skillshop one-shot --global` again to replace the global copy.
151
190
 
152
- Package imports are separate from this lockfile workflow. `import` copies a snapshot from another package; `skillshop update` does not refresh that snapshot. `export` names a skill for consumers of a package and does not install it anywhere.
191
+ Package imports record package-import ownership in the destination manifest and remain separate from personal-library sync and project dependency locking. `import` copies a snapshot from another package; `skillshop update` does not refresh that snapshot. `export` names a skill for consumers of a package and does not install it anywhere.
153
192
 
154
193
  ## For project owners: distribute skills
155
194
 
156
- ### 1. Export the skills
195
+ ### Personal skills: share a folder through GitHub
157
196
 
158
- In an npm package, put each skill in a directory with a `SKILL.md`. For example:
197
+ The recommended authoring format is a normal folder. Fork the bundled template at [`templates/skillshop-library`](templates/skillshop-library) or create the same layout in a GitHub repository named `skillshop-library`:
159
198
 
160
199
  ```text
161
- my-library/
162
- package.json
163
- .agents/skills/review/SKILL.md
164
- .agents/skills/triage/SKILL.md
200
+ skillshop-library/
201
+ skillshop-library.json
202
+ skills/
203
+ review/
204
+ SKILL.md
205
+ references/
206
+ scripts/
165
207
  ```
166
208
 
167
- For example, `.agents/skills/review/SKILL.md` could contain:
168
-
169
- ```markdown
170
- ---
171
- name: review
172
- description: Review a proposed code change
173
- ---
174
-
175
- # Review
176
-
177
- Read the diff, identify concrete defects, and cite the affected files.
178
- ```
179
-
180
- Keep any references or scripts needed by the skill beside its `SKILL.md`; Skillshop copies the whole directory.
181
-
182
- Add Skillshop, initialize the export list, and name the skill you want to publish:
209
+ The config declares the relative source directory. Each skill needs a standard `SKILL.md` with `name` and `description`; author/version metadata is optional. Put references, scripts, and other assets beside it. Skillshop downloads the complete directory and preserves executable modes.
183
210
 
184
211
  ```bash
185
- npm install skillshop
186
- npx skillshop library init
187
- npx skillshop export skill:review ./.agents/skills/review
188
- npx skillshop export skill:triage ./.agents/skills/triage
189
- ```
190
-
191
- This writes `skillshop.library.json`:
192
-
193
- ```json
194
- {
195
- "schemaVersion": 1,
196
- "exports": {
197
- "skill:review": "./.agents/skills/review",
198
- "skill:triage": "./.agents/skills/triage"
199
- }
200
- }
201
- ```
202
-
203
- The `exports` map is an explicit allowlist. Skillshop does not scan your repository for other skills. `skillshop export` also builds the library; run `skillshop build` after editing the JSON by hand. The build generates `skillshop.manifest.mjs`, adds the package's `./skillshop` export, and includes declared local skill directories in `package.json#files` when that field exists. Commit the resulting package files with your source.
204
-
205
- ### 2. Declare user-level installation, if needed
206
-
207
- To copy selected skills during a global npm install, add `skillshop.userInstall` and the generic lifecycle command to the distributor's `package.json`:
208
-
209
- ```json
210
- {
211
- "name": "@example/skill-library",
212
- "version": "1.0.0",
213
- "dependencies": {
214
- "skillshop": "^2.1.0"
215
- },
216
- "files": [],
217
- "scripts": {
218
- "prepack": "skillshop build",
219
- "postinstall": "skillshop install-user . --if-global"
220
- },
221
- "skillshop": {
222
- "userInstall": ["skill:review"]
223
- }
224
- }
212
+ skillshop download @alice/review
213
+ skillshop install @alice/review
214
+ skillshop install @alice/review --global
215
+ skillshop sync
225
216
  ```
226
217
 
227
- Every `userInstall` entry must be unique and appear in `skillshop.library.json`. In this example, `skill:review` installs for the user on a global npm install. `skill:triage` remains available for explicit project imports. The runtime dependency makes the `skillshop` command available to npm's `postinstall` script. `--if-global` skips the user copy on a project-local install. npm's `--ignore-scripts` skips `postinstall` entirely.
228
-
229
- An install replaces each declared destination directory. If a later release removes a name from `userInstall`, Skillshop does not delete a copy previously installed in a user's directory.
230
-
231
- ### 3. Check and pack the package
232
-
233
- ```bash
234
- npx skillshop library list
235
- npx skillshop validate
236
- npx skillshop build
237
- npm pack --dry-run
238
- ```
239
-
240
- Check that the npm package contains `skillshop.manifest.mjs`, every exported `SKILL.md`, and any assets those skills need. The export list controls what Skillshop can resolve; it does not prevent your own broad `files` patterns from publishing other files. A real `npm pack` and global install from its tarball are useful checks before a release.
241
-
242
- After checking the tarball, publish the package with `npm publish`. Use `npm publish --access public` for a public scoped package.
243
-
244
- ### Example: what happens after publication
245
-
246
- With the two-skill package above published as `@example/skill-library`, a global install copies only the declared `skill:review` to the user's skill directory:
247
-
248
- ```bash
249
- npm install --global @example/skill-library
250
- # ~/.agents/skills/review/SKILL.md now comes from the package
251
- ```
252
-
253
- An application that needs `skill:triage` can install the package locally and copy that exported skill into its own repository:
254
-
255
- ```bash
256
- cd ~/work/sample-app
257
- npm install @example/skill-library skillshop
258
- npx skillshop import @example/skill-library:triage
259
- ```
260
-
261
- After the distributor publishes an update, reinstalling the package globally replaces the user's `review` directory. The application's `triage` snapshot stays as it was until the application updates the package and imports again with `--force`. The two installation paths are independent.
262
-
263
- ### Re-export a skill from another library
264
-
265
- A package can expose a selected upstream skill under its own name:
266
-
267
- ```bash
268
- npm install @example/upstream
269
- npx skillshop export skill:review --from @example/upstream --skill skill:review
270
- ```
271
-
272
- The resulting export in `skillshop.library.json` is:
273
-
274
- ```json
275
- {
276
- "skill:review": {
277
- "from": "@example/upstream",
278
- "skill": "skill:review"
279
- }
280
- }
281
- ```
282
-
283
- That object is one entry inside the manifest's `exports` map. The upstream package must be a runtime dependency or a non-optional peer dependency. Re-exporting is explicit; depending on another library does not expose all of its skills.
284
-
285
- ## CLI and JavaScript API
286
-
287
- ```text
288
- skillshop init
289
- skillshop config agents
290
- skillshop list
291
- skillshop <name> [--global]
292
- skillshop install <name> [--global]
293
- skillshop update [name]
294
- skillshop update --push
295
- skillshop uninstall <name> [--global]
296
- skillshop agents init [--project <directory>]
297
- skillshop agents [--project <directory>] [--check]
298
- skillshop agents --global
299
- skillshop migrate [root ...]
300
- skillshop library init
301
- skillshop library list
302
- skillshop export skill:<name> <directory>
303
- skillshop export skill:<name> --from <package> [--skill skill:<source-name>]
304
- skillshop unexport skill:<name>
305
- skillshop validate
306
- skillshop build
307
- skillshop resolve <library>:<skill>
308
- skillshop import <library>:<skill> [--global] [--to <directory>] [--force]
309
- skillshop install-user [package-dir] [--if-global] [--to <skills-dir>]
310
- ```
311
-
312
- `init` and `list` keep their bundled-registry meanings. `library init`, `library list`, `validate`, and `build` operate on the package library in the current directory. In a `library:skill` reference, `library` can be an installed package name or a local package directory. `import` defaults to `.agents/skills/<skill>`; `--global` replaces `~/.agents/skills/<skill>`. `unexport` changes the package's public skill list; it does not delete the source directory. Remove a skill from `userInstall` before unexporting it.
313
-
314
- Applications can use the same operations without invoking the CLI:
315
-
316
- ```js
317
- import { exportSkill, reexportSkill, buildSkillLibrary } from 'skillshop/export';
318
- import { resolveSkill, importSkill } from 'skillshop/import';
319
- import { installDeclaredUserSkills } from 'skillshop/user-install';
320
- ```
321
-
322
- For example, an application can read an exported skill directly from an installed package, or copy it into a workspace it manages:
323
-
324
- ```js
325
- import { readFile } from 'node:fs/promises';
326
- import { resolveSkill, importSkill } from 'skillshop/import';
327
-
328
- const reference = '@example/skill-library:triage';
329
- const { manifestPath } = await resolveSkill({ reference });
330
- const instructions = await readFile(manifestPath, 'utf8');
331
- // Pass instructions to your agent runtime.
332
-
333
- await importSkill({
334
- reference,
335
- overwrite: true,
336
- });
337
- ```
218
+ `download @owner/skill` adds a source to the personal folder library without installing it. `install @owner/skill` downloads if needed and installs from that source; subsequent local edits are reused. `install name` uses a bare name for an existing library source. `sync` updates recorded local and global copies from the saved source roots. It never fetches upstream. See [the forkable library template](templates/skillshop-library/README.md) for its full layout and command details.
338
219
 
339
- `resolveSkill` leaves the skill inside the installed package. `importSkill` copies its complete directory, including files alongside `SKILL.md`. Set `overwrite: true` only when the application intends to replace an existing destination.
220
+ ### Existing package API compatibility
340
221
 
341
- `importSkill({ overwrite: true })` replaces a destination. Its optional `merge: true` mode overlays packaged files and preserves unrelated destination files. User-level installation always uses replacement, even when called through `installDeclaredUserSkills`.
222
+ The published npm export/import APIs remain supported for existing consumers. Their authoring, lifecycle, and JavaScript API guide is in [Package library compatibility](docs/package-library-compatibility.md). New user-authored libraries can use the folder and GitHub workflow above without npm packaging.
@@ -0,0 +1,76 @@
1
+ # Installed ownership and project dependency locks
2
+
3
+ Skillshop separates editable source libraries, installed ownership, and reproducible project requirements. Installing a personal skill does not make it a project dependency. Applications distributed through npm continue to use npm's own dependency declarations and package lock.
4
+
5
+ ## Destination ownership
6
+
7
+ Every destination skills directory has one `.skillshop-lock`. The destination itself identifies installed paths; entries do not repeat absolute destination paths or point to a second authoritative registry.
8
+
9
+ ```json
10
+ {
11
+ "manifestVersion": 1,
12
+ "skills": {
13
+ "review": {
14
+ "owner": { "kind": "skillshop", "id": "project" },
15
+ "source": {
16
+ "kind": "personal-library",
17
+ "root": "/Users/example/skillshop-library",
18
+ "skill": "review",
19
+ "skillDirectory": "skills/review"
20
+ }
21
+ }
22
+ }
23
+ }
24
+ ```
25
+
26
+ CLI-owned copies use owner kind `skillshop` and id `project` or `global`. Project dependency copies use kind `dependency`, id `project`. These local ids survive moving an entire project directory. Package lifecycle installers use kind `package` and the package name as id; explicit snapshot imports use kind `package-import`. Package ids remain stable across versions and npm installation paths. Anonymous manifest-object imports use their source directory as id and should supply a package name for stable ownership.
27
+
28
+ Each installer reads the destination manifest, checks ownership, and preserves entries belonging to other installers. Matching ownership permits updates. Existing directories without ownership records and records belonging to other owners are rejected. `import --force` permits replacing an existing matching package-import copy; it does not adopt unrelated directories. Global CLI uninstall checks ownership too. Package declaration updates prune only that package's obsolete copies; `uninstallUserSkill` provides explicit same-owner removal.
29
+
30
+ The files `~/.skillshop/installations.json` and `repositories.json` are discovery indexes, not ownership authorities. Deleting or editing an index does not grant ownership. Known standard installation directories can still be discovered from the project or home directory. `sync` uses the source roots recorded in destination manifests, independently of the currently selected library.
31
+
32
+ Ownership manifests are local machine state. Personal/bundled installation commands locally exclude their manifests and owned directories through Git's `info/exclude`. Dependency commands maintain a separate bounded exclude block for generated dependency content and destination manifests. Unrelated installed skill directories are not blanket-excluded. Project declarations and dependency locks remain commit candidates.
33
+
34
+ ## Project declarations and immutable resolution
35
+
36
+ Add a dependency explicitly:
37
+
38
+ ```sh
39
+ skillshop dependency add @alice/review@v1.2.0
40
+ ```
41
+
42
+ This writes a project-owned `skillshop.json`:
43
+
44
+ ```json
45
+ {
46
+ "schemaVersion": 1,
47
+ "skillsDirectory": ".agents/skills",
48
+ "dependencies": {
49
+ "review": "@alice/review@v1.2.0"
50
+ }
51
+ }
52
+ ```
53
+
54
+ A corresponding `skillshop-lock.json` records each requested reference, conventional GitHub repository URL, exact resolved commit, and `sha256-` integrity. It also records the project installation directory, so a frozen restore detects destination configuration changes. It contains no personal-library paths or machine-specific destination paths.
55
+
56
+ Refs can select a Git tag, branch, or full commit hash. An omitted ref resolves the repository's default branch. These are Git revisions; there is no semver-range solver or historical registry of `SKILL.md` version fields. A moved upstream tag cannot change an existing lock entry. The complete directory is fetched from the locked commit, and integrity covers ordered paths, file bytes, and executable bits, including hidden files, scripts and binary references. Repository code is never executed while fetching.
57
+
58
+ `skillshop install` and `skillshop dependency install` restore declared dependencies. Unchanged entries reuse their locked commit; a new or changed declaration resolves its ref. Already correct owned copies are left in place without upstream requests. Missing copies are restored and edited copies are repaired against the lock. Restoration requires upstream access when the required content is not already installed correctly.
59
+
60
+ `skillshop ci`, `skillshop install --frozen-lockfile`, and `skillshop dependency install --frozen-lockfile` refuse a missing or stale lock before changing output. Use `skillshop dependency update [name]` to re-resolve selected or all upstream refs, or add a different ref. `skillshop dependency remove review` removes the declaration, locked resolution and matching owned copy while preserving other owners. Ordinary personal sync/update and CLI upgrade never refresh dependency copies.
61
+
62
+ All required downloads, integrity checks and ownership checks finish before dependency content changes. Replacement/removal uses temporary directories and backups. A failed content or metadata write restores prior content, ownership and project declarations. Manifest writes use atomic rename. These records are ownership and reproducibility data, not process mutexes; concurrent writers targeting the same directory are not supported.
63
+
64
+ Dependency APIs are exported from `skillshop/dependencies`: `addDependency`, `installDependencies`, `updateDependencies`, and `removeDependency`. They accept `cwd`; install accepts `frozen`. For CLI commands, the nearest project manifest takes precedence while ascending to the nearest Git root. Outside Git, an existing ancestor manifest is used; otherwise the working directory is the project boundary.
65
+
66
+ ## Migration and upgrade boundaries
67
+
68
+ The new CLI reads legacy project-root `.skillshop-lock` / `.skillz-lock` files and the old state-home `global-skills.json`. It validates their schemas, owned paths and any existing destination claims before repair or migration. Divergent simultaneous legacy root files are rejected. Only explicit ownership records are migrated; scanning directories does not adopt arbitrary skills.
69
+
70
+ Replacement manifests are saved beside installed skills before legacy records are removed. Retry is safe when a prior attempt saved only part of the replacement state. Malformed JSON, conflicting source/ownership records, and symlinked paths are preserved and reported rather than silently discarded. Upgrading does not merge or overwrite application-owned directories.
71
+
72
+ `skillshop upgrade` installs the new npm package first and uses its fresh CLI for migration and version-based bundled refresh. A project-local npm installation migrates only its owning project's state. A global installation migrates global state and registered projects. Migration runs even for unchanged-version and personal-library copies. Same-version bundled edits survive; changed-version bundled refresh retains its existing replacement behavior. Missing copies are not recreated by ownership migration.
73
+
74
+ Direct `npm install --global skillshop` replaces the CLI but does not run migration hooks. The next ownership-reconciling command can migrate its current project and global state; `skillshop migrate ~/workspace` discovers additional repositories. Personal-library initialization, downloading, listing and instruction-rendering commands retain their existing isolation from legacy reconciliation.
75
+
76
+ Using an old CLI after migration is unsupported: old versions do not understand directory-local manifests. Reinstalling skills with an old package installer can also bypass the new ownership protections. Keep application integrations on the updated Skillshop API.
@@ -0,0 +1,194 @@
1
+ # Package library compatibility
2
+
3
+ This guide documents the existing npm package export/import APIs. It is retained for consumers of those published APIs. It is not required for personal folder libraries or GitHub skill sharing.
4
+
5
+ ### Package API compatibility: export skills from npm packages
6
+
7
+ The npm export/import API remains supported for existing package-based libraries. It is not required for personal skill authoring.
8
+
9
+ #### 1. Export the skills
10
+
11
+ In an npm package, put each skill in a directory with a `SKILL.md`. For example:
12
+
13
+ ```text
14
+ my-library/
15
+ package.json
16
+ .agents/skills/review/SKILL.md
17
+ .agents/skills/triage/SKILL.md
18
+ ```
19
+
20
+ For example, `.agents/skills/review/SKILL.md` could contain:
21
+
22
+ ```markdown
23
+ ---
24
+ name: review
25
+ description: Review a proposed code change
26
+ ---
27
+
28
+ # Review
29
+
30
+ Read the diff, identify concrete defects, and cite the affected files.
31
+ ```
32
+
33
+ Keep any references or scripts needed by the skill beside its `SKILL.md`; Skillshop copies the whole directory.
34
+
35
+ Add Skillshop, initialize the export list, and name the skill you want to publish:
36
+
37
+ ```bash
38
+ npm install skillshop
39
+ npx skillshop library init
40
+ npx skillshop export skill:review ./.agents/skills/review
41
+ npx skillshop export skill:triage ./.agents/skills/triage
42
+ ```
43
+
44
+ This writes `skillshop.library.json`:
45
+
46
+ ```json
47
+ {
48
+ "schemaVersion": 1,
49
+ "exports": {
50
+ "skill:review": "./.agents/skills/review",
51
+ "skill:triage": "./.agents/skills/triage"
52
+ }
53
+ }
54
+ ```
55
+
56
+ The `exports` map is an explicit allowlist. Skillshop does not scan your repository for other skills. `skillshop export` also builds the library; run `skillshop build` after editing the JSON by hand. The build generates `skillshop.manifest.mjs`, adds the package's `./skillshop` export, and includes declared local skill directories in `package.json#files` when that field exists. Commit the resulting package files with your source.
57
+
58
+ ### 2. Declare user-level installation, if needed
59
+
60
+ To copy selected skills during a global npm install, add `skillshop.userInstall` and the generic lifecycle command to the distributor's `package.json`:
61
+
62
+ ```json
63
+ {
64
+ "name": "@example/skill-library",
65
+ "version": "1.0.0",
66
+ "dependencies": {
67
+ "skillshop": "^2.1.0"
68
+ },
69
+ "files": [],
70
+ "scripts": {
71
+ "prepack": "skillshop build",
72
+ "postinstall": "skillshop install-user . --if-global"
73
+ },
74
+ "skillshop": {
75
+ "userInstall": ["skill:review"]
76
+ }
77
+ }
78
+ ```
79
+
80
+ Every `userInstall` entry must be unique and appear in `skillshop.library.json`. In this example, `skill:review` installs for the user on a global npm install. `skill:triage` remains available for explicit project imports. The runtime dependency makes the `skillshop` command available to npm's `postinstall` script. `--if-global` skips the user copy on a project-local install. npm's `--ignore-scripts` skips `postinstall` entirely.
81
+
82
+ An install records package ownership in `.skillshop-lock` inside the destination skills directory. It replaces only copies already owned by the same package and rejects unmanaged or foreign-owned destinations. A later install removes copies owned by that package when their names are removed from `userInstall`; other owners remain untouched. Package names identify owners across versions and installation paths. Applications can explicitly remove an owned skill with `uninstallUserSkill` from `skillshop/user-install`.
83
+
84
+ ### 3. Check and pack the package
85
+
86
+ ```bash
87
+ npx skillshop library list
88
+ npx skillshop validate
89
+ npx skillshop build
90
+ npm pack --dry-run
91
+ ```
92
+
93
+ Check that the npm package contains `skillshop.manifest.mjs`, every exported `SKILL.md`, and any assets those skills need. The export list controls what Skillshop can resolve; it does not prevent your own broad `files` patterns from publishing other files. A real `npm pack` and global install from its tarball are useful checks before a release.
94
+
95
+ After checking the tarball, publish the package with `npm publish`. Use `npm publish --access public` for a public scoped package.
96
+
97
+ ### Example: what happens after publication
98
+
99
+ With the two-skill package above published as `@example/skill-library`, a global install copies only the declared `skill:review` to the user's skill directory:
100
+
101
+ ```bash
102
+ npm install --global @example/skill-library
103
+ # ~/.agents/skills/review/SKILL.md now comes from the package
104
+ ```
105
+
106
+ An application that needs `skill:triage` can install the package locally and copy that exported skill into its own repository:
107
+
108
+ ```bash
109
+ cd ~/work/sample-app
110
+ npm install @example/skill-library skillshop
111
+ npx skillshop import @example/skill-library:triage
112
+ ```
113
+
114
+ After the distributor publishes an update, reinstalling the package globally replaces the user's `review` directory. The application's `triage` snapshot stays as it was until the application updates the package and imports again with `--force`. The two installation paths are independent.
115
+
116
+ ### Re-export a skill from another library
117
+
118
+ A package can expose a selected upstream skill under its own name:
119
+
120
+ ```bash
121
+ npm install @example/upstream
122
+ npx skillshop export skill:review --from @example/upstream --skill skill:review
123
+ ```
124
+
125
+ The resulting export in `skillshop.library.json` is:
126
+
127
+ ```json
128
+ {
129
+ "skill:review": {
130
+ "from": "@example/upstream",
131
+ "skill": "skill:review"
132
+ }
133
+ }
134
+ ```
135
+
136
+ That object is one entry inside the manifest's `exports` map. The upstream package must be a runtime dependency or a non-optional peer dependency. Re-exporting is explicit; depending on another library does not expose all of its skills.
137
+
138
+ ## CLI and JavaScript API
139
+
140
+ ```text
141
+ skillshop init
142
+ skillshop config agents
143
+ skillshop list
144
+ skillshop <name> [--global]
145
+ skillshop install <name> [--global]
146
+ skillshop update [name]
147
+ skillshop update --push
148
+ skillshop uninstall <name> [--global]
149
+ skillshop agents init [--project <directory>]
150
+ skillshop agents [--project <directory>] [--check]
151
+ skillshop agents --global
152
+ skillshop migrate [root ...]
153
+ skillshop library init
154
+ skillshop library list
155
+ skillshop export skill:<name> <directory>
156
+ skillshop export skill:<name> --from <package> [--skill skill:<source-name>]
157
+ skillshop unexport skill:<name>
158
+ skillshop validate
159
+ skillshop build
160
+ skillshop resolve <library>:<skill>
161
+ skillshop import <library>:<skill> [--global] [--to <directory>] [--force]
162
+ skillshop install-user [package-dir] [--if-global] [--to <skills-dir>]
163
+ ```
164
+
165
+ `init` and `list` keep their bundled-registry meanings. `library init`, `library list`, `validate`, and `build` operate on the package library in the current directory. In a `library:skill` reference, `library` can be an installed package name or a local package directory. `import` defaults to `.agents/skills/<skill>`; `--global` targets `~/.agents/skills/<skill>` and replaces only a matching package-import-owned copy. `unexport` changes the package's public skill list; it does not delete the source directory. Remove a skill from `userInstall` before unexporting it.
166
+
167
+ Applications can use the same operations without invoking the CLI:
168
+
169
+ ```js
170
+ import { exportSkill, reexportSkill, buildSkillLibrary } from 'skillshop/export';
171
+ import { resolveSkill, importSkill } from 'skillshop/import';
172
+ import { installDeclaredUserSkills } from 'skillshop/user-install';
173
+ ```
174
+
175
+ For example, an application can read an exported skill directly from an installed package, or copy it into a workspace it manages:
176
+
177
+ ```js
178
+ import { readFile } from 'node:fs/promises';
179
+ import { resolveSkill, importSkill } from 'skillshop/import';
180
+
181
+ const reference = '@example/skill-library:triage';
182
+ const { manifestPath } = await resolveSkill({ reference });
183
+ const instructions = await readFile(manifestPath, 'utf8');
184
+ // Pass instructions to your agent runtime.
185
+
186
+ await importSkill({
187
+ reference,
188
+ overwrite: true,
189
+ });
190
+ ```
191
+
192
+ `resolveSkill` leaves the skill inside the installed package. `importSkill` copies its complete directory, including files alongside `SKILL.md`. Set `overwrite: true` only when the application intends to replace an existing destination.
193
+
194
+ `importSkill({ overwrite: true })` replaces a destination only when that copy is already owned by the same package-import source; it does not authorize taking ownership of unrelated content. Its optional `merge: true` mode overlays packaged files and preserves unrelated destination files. User-level installation always uses replacement of matching package-owned copies, even when called through `installDeclaredUserSkills`. Merge mode also requires matching ownership for existing targets.
@@ -0,0 +1,12 @@
1
+ # Skillshop 4.1.0
2
+
3
+ Separate installed skill ownership from reproducible project dependencies.
4
+
5
+ - Store ownership in `.skillshop-lock` beside installed skills, with automatic migration of tracked legacy project/global records during `skillshop upgrade`.
6
+ - Add committed `skillshop.json` declarations and `skillshop-lock.json` resolutions that pin exact Git commits and complete-tree SHA-256 integrity.
7
+ - Add `skillshop dependency add/install/update/remove`, dependency restore through `skillshop install`, and frozen restore through `skillshop ci`.
8
+ - Reject unmanaged and foreign-owned collisions, protect global uninstall, and prune removed application declarations only for their recorded package owner.
9
+
10
+ Migration preserves unmanaged skills and same-version bundled edits. Invalid ownership records and unsafe paths are preserved and reported. Direct npm installation replaces the CLI without migration hooks; run `skillshop migrate ~/workspace` to discover and migrate additional repositories. Older CLI versions cannot read the new ownership format.
11
+
12
+ Validated with the full automated suite, isolated local/global upgrade fixtures, and packed CLI installation/dependency smoke tests.