@skillsmanager/cli 0.0.5 → 0.0.6

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/dist/index.js CHANGED
@@ -118,7 +118,7 @@ collection
118
118
  .description("Create a new collection (defaults to SKILLS_MY_SKILLS)")
119
119
  .option("--backend <backend>", "gdrive (default) or github", "gdrive")
120
120
  .option("--repo <owner/repo>", "GitHub repo to use (required for --backend github)")
121
- .option("--skills-repo <owner/repo>", "GitHub repo where skills live (github backend only; defaults to --repo)")
121
+ .option("--skills-repo <owner/repo>", "GitHub repo where skills live; collection YAML stays in the declared backend")
122
122
  .action((name, options) => collectionCreateCommand(name, options));
123
123
  // ── Registry ─────────────────────────────────────────────────────────────────
124
124
  const registry = program
package/dist/registry.js CHANGED
@@ -15,6 +15,8 @@ export function parseCollection(content) {
15
15
  description: s.description ?? "",
16
16
  })),
17
17
  };
18
+ if (data.type)
19
+ col.type = data.type;
18
20
  if (data.metadata && typeof data.metadata === "object") {
19
21
  col.metadata = data.metadata;
20
22
  }
@@ -24,12 +26,14 @@ export function serializeCollection(collection) {
24
26
  const obj = {
25
27
  name: collection.name,
26
28
  owner: collection.owner,
27
- skills: collection.skills.map((s) => ({
28
- name: s.name,
29
- path: s.path,
30
- description: s.description,
31
- })),
32
29
  };
30
+ if (collection.type)
31
+ obj.type = collection.type;
32
+ obj.skills = collection.skills.map((s) => ({
33
+ name: s.name,
34
+ path: s.path,
35
+ description: s.description,
36
+ }));
33
37
  if (collection.metadata && Object.keys(collection.metadata).length > 0) {
34
38
  obj.metadata = collection.metadata;
35
39
  }
package/dist/types.d.ts CHANGED
@@ -6,6 +6,7 @@ export interface SkillEntry {
6
6
  export interface CollectionFile {
7
7
  name: string;
8
8
  owner: string;
9
+ type?: string;
9
10
  skills: SkillEntry[];
10
11
  metadata?: Record<string, unknown>;
11
12
  }
@@ -0,0 +1,10 @@
1
+ export interface GitRepoContext {
2
+ repo: string;
3
+ repoRoot: string;
4
+ relPath: string;
5
+ }
6
+ /**
7
+ * Returns git repo context for a path if it belongs to a GitHub-tracked repo,
8
+ * or null otherwise.
9
+ */
10
+ export declare function detectRepoContext(absPath: string): GitRepoContext | null;
@@ -0,0 +1,27 @@
1
+ import { spawnSync } from "child_process";
2
+ import path from "path";
3
+ /**
4
+ * Returns git repo context for a path if it belongs to a GitHub-tracked repo,
5
+ * or null otherwise.
6
+ */
7
+ export function detectRepoContext(absPath) {
8
+ const rootResult = spawnSync("git", ["-C", absPath, "rev-parse", "--show-toplevel"], {
9
+ encoding: "utf-8", stdio: "pipe",
10
+ });
11
+ if (rootResult.status !== 0)
12
+ return null;
13
+ const repoRoot = rootResult.stdout.trim();
14
+ const remoteResult = spawnSync("git", ["-C", repoRoot, "remote", "get-url", "origin"], {
15
+ encoding: "utf-8", stdio: "pipe",
16
+ });
17
+ if (remoteResult.status !== 0)
18
+ return null;
19
+ const remoteUrl = remoteResult.stdout.trim();
20
+ const match = remoteUrl.match(/github\.com[/:]([^/]+\/[^/]+?)(?:\.git)?$/) ??
21
+ remoteUrl.match(/github\.com\/([^/]+\/[^/]+)/);
22
+ if (!match)
23
+ return null;
24
+ const repo = match[1].replace(/\.git$/, "");
25
+ const relPath = path.relative(repoRoot, absPath).replace(/\\/g, "/");
26
+ return { repo, repoRoot, relPath };
27
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skillsmanager/cli",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Discover, fetch, and manage agent skills from local or remote storage",
5
5
  "type": "module",
6
6
  "bin": {
@@ -5,7 +5,7 @@ description: Discover, fetch, add, and update agent skills from local or remote
5
5
 
6
6
  # Skills Manager
7
7
 
8
- Skills Manager is a CLI tool for managing agent skills stored locally or in remote storage (Google Drive). Use it to find, install, share, and update skills. Works offline by default — no setup needed for local use.
8
+ Skills Manager is a CLI tool for managing agent skills stored locally or in remote storage (Google Drive, GitHub). Use it to find, install, share, and update skills. Works offline by default — no setup needed for local use.
9
9
 
10
10
  ## Prerequisites
11
11
 
@@ -34,7 +34,7 @@ skillsmanager list
34
34
 
35
35
  Supported agents: `claude`, `codex`, `agents`, `cursor`, `windsurf`, `copilot`, `gemini`, `roo`, `openclaw`, `antigravity`
36
36
 
37
- ### Share a skill
37
+ ### Share a skill you own
38
38
 
39
39
  ```bash
40
40
  # Upload a local skill directory to a collection
@@ -45,6 +45,18 @@ skillsmanager add <path>
45
45
  skillsmanager add <path> --collection <name>
46
46
  ```
47
47
 
48
+ ### Register a skill path without uploading files (cross-repo / curated collections)
49
+
50
+ Use `--remote-path` when the skill files already exist in a remote backend and you just want to register a pointer to them. You cannot `add` local files to a cross-backend collection — you must use this flag instead.
51
+
52
+ ```bash
53
+ # Register a skill entry by path — no file upload
54
+ skillsmanager add --remote-path <backend-path> --name <skill-name> --description "<description>" --collection <name>
55
+
56
+ # Example: register a skill that lives in a GitHub repo
57
+ skillsmanager add --remote-path skills/write-tests/ --name write-tests --description "Generate unit tests" --collection my-col
58
+ ```
59
+
48
60
  ### Update a skill
49
61
 
50
62
  ```bash
@@ -105,9 +117,16 @@ skillsmanager registry remove-collection <name> --delete
105
117
  # Create a new collection (local by default)
106
118
  skillsmanager collection create [name]
107
119
 
108
- # Create a collection in a GitHub repo
120
+ # Create a collection in a GitHub repo (skills stored in that repo)
109
121
  skillsmanager collection create [name] --backend github --repo <owner/repo>
110
122
 
123
+ # Create a collection in Google Drive
124
+ skillsmanager collection create [name] --backend gdrive
125
+
126
+ # Create a collection whose skills live in a specific GitHub repo (cross-backend)
127
+ skillsmanager collection create [name] --backend gdrive --skills-repo <owner/repo>
128
+ skillsmanager collection create [name] --backend github --repo <owner/registry-repo> --skills-repo <owner/skills-repo>
129
+
111
130
  # Re-discover collections from storage
112
131
  skillsmanager refresh
113
132
  ```
@@ -128,13 +147,32 @@ skillsmanager install --path <dir>
128
147
  skillsmanager uninstall
129
148
  ```
130
149
 
150
+ ## Cross-backend collections (curated skill libraries)
151
+
152
+ A collection can declare that its skill files live in a different GitHub repo than the collection YAML. This is indicated by `type: github` in `SKILLS_COLLECTION.yaml`.
153
+
154
+ **When you encounter a cross-backend collection:**
155
+ - `skillsmanager add <local-path> --collection <name>` → **will fail** with an error like `skills source type is "github"`. This is expected — you cannot upload local files to a foreign repo.
156
+ - **Do this instead:** `skillsmanager add --remote-path <path-in-repo> --name <n> --description "<d>" --collection <name>`
157
+ - `skillsmanager fetch <skill> --agent claude` → **works normally** — files are automatically pulled from the declared GitHub repo
158
+
159
+ **How to identify a cross-backend collection:**
160
+ - `skillsmanager registry list` — collections with a `--skills-repo` are shown with their skills repo
161
+ - Reading the `SKILLS_COLLECTION.yaml` directly — look for `type: github` + `metadata.repo`
162
+
163
+ **Quick rule:**
164
+ - Own the skill files? → `skillsmanager add <path>`
165
+ - Files already in a GitHub repo? → `skillsmanager add --remote-path <path> --name <n> --description "<d>"`
166
+
167
+ ---
168
+
131
169
  ## Common Workflows
132
170
 
133
171
  **User asks to find a skill:**
134
172
  1. `skillsmanager search <relevant terms>`
135
173
  2. `skillsmanager fetch <skill-name> --agent claude`
136
174
 
137
- **User asks to share a skill they created:**
175
+ **User asks to share a skill they created locally:**
138
176
  1. Ensure the skill directory has a `SKILL.md` with `name` and `description` in YAML frontmatter
139
177
  2. `skillsmanager add <path-to-skill-directory>`
140
178
  3. Fetch the skill to make it immediately available to the agent:
@@ -153,9 +191,25 @@ skillsmanager uninstall
153
191
  2. `skillsmanager registry push --backend gdrive`
154
192
 
155
193
  **User wants to store skills in a GitHub repo:**
156
- 1. `skillsmanager collection create <name> --backend github --repo <owner/repo>` — creates the GitHub repo if needed, and auto-registers the collection in the existing registry (or creates a local registry if none exists)
194
+ 1. `skillsmanager collection create <name> --backend github --repo <owner/repo>` — creates the GitHub repo if needed, and auto-registers the collection
157
195
  2. `skillsmanager add <path> --collection <name>` — upload the skill into that collection
158
196
 
197
+ **User wants to create a curated collection of skills from a public GitHub repo (cross-backend):**
198
+
199
+ Use this when you want to expose skills from an external GitHub repo (e.g. `anthropics/skills`) via a collection the user can fetch from, without copying the files.
200
+
201
+ 1. `skillsmanager collection create <name> --backend gdrive --skills-repo <owner/skills-repo>`
202
+ - This creates the collection YAML in the user's Google Drive with `type: github` + `metadata.repo` pointing to the skills repo
203
+ 2. Register each skill by its path in the skills repo (no file upload needed):
204
+ ```bash
205
+ skillsmanager add --remote-path skills/write-tests/ --name write-tests --description "Generate unit tests" --collection <name>
206
+ ```
207
+ 3. Users fetch skills normally — `skillsmanager fetch write-tests --agent claude` — and the files are pulled from the skills repo
208
+
209
+ **User wants to add a skill from a public GitHub repo without uploading files:**
210
+ 1. Create or identify a collection with `--skills-repo <owner/repo>`
211
+ 2. `skillsmanager add --remote-path <path-in-repo> --name <skill-name> --description "<desc>" --collection <name>`
212
+
159
213
  **User wants to discover GitHub-hosted collections:**
160
214
  1. `skillsmanager registry discover --backend github`
161
215
 
@@ -170,6 +224,19 @@ skillsmanager uninstall
170
224
  1. `skillsmanager registry remove-collection <name>` (removes reference only, data is kept)
171
225
  2. `skillsmanager registry remove-collection <name> --delete` (permanently deletes collection and skills)
172
226
 
227
+ ## Collection types
228
+
229
+ Most collections store skill files directly in their backend. But a collection can also declare that skill files live in a different GitHub repo — this is useful for curating public skills or pointing to a shared library repo.
230
+
231
+ | Collection backend | Skills repo | What `add` does | What `fetch` does |
232
+ |---|---|---|---|
233
+ | `gdrive` or `local` | (none) | Uploads files to Drive/local | Downloads from Drive/local |
234
+ | `github` | (same repo as collection) | Commits files to the repo | Clones/pulls from repo |
235
+ | `gdrive` or `local` | `--skills-repo owner/repo` | **Requires `--remote-path`** — registers a path pointer only | Downloads files from the GitHub repo |
236
+ | `github` (registry repo) | `--skills-repo owner/skills-repo` | **Requires `--remote-path`** — registers a path pointer only | Downloads files from the skills repo |
237
+
238
+ When you try to `skillsmanager add <local-path>` to a collection with a cross-backend skills repo, the command will fail with a clear error pointing you to `--remote-path`.
239
+
173
240
  ## Architecture
174
241
 
175
242
  - **Registry** (`SKILLS_REGISTRY.yaml`): root index pointing to all collections across backends
@@ -177,6 +244,7 @@ skillsmanager uninstall
177
244
  - **Backends**: `local` (default, `~/.skillsmanager/`), `gdrive` (Google Drive), and `github` (GitHub repo via `gh` CLI)
178
245
  - **Cache**: skills are cached at `~/.skillsmanager/cache/<uuid>/` and symlinked to agent directories
179
246
  - **Symlinks**: all agents share one cached copy — updating the cache updates all agents
247
+ - **RoutingBackend**: transparent middleware that intercepts skill-file operations and dispatches to the right backend based on the collection's declared `type` field
180
248
 
181
249
  ## Scope
182
250