skill-linker 4.1.3 → 4.2.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/CHANGELOG.md ADDED
@@ -0,0 +1,106 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [4.2.0] - 2026-06-02
11
+
12
+ ### Added
13
+
14
+ - `list --skills` flag: flat-lists every individual skill across the whole
15
+ library (supports `--json`).
16
+
17
+ ### Changed
18
+
19
+ - Agent auto-detection (when `--agent` is omitted) now also detects agents by
20
+ their project skills directory in the current folder, not just the global
21
+ directory.
22
+
23
+ ## [4.1.4] - 2026-06-02
24
+
25
+ ### Fixed
26
+
27
+ - `--skill` with a relative path (e.g. `./my-skill`) no longer creates a
28
+ broken, self-referential symlink; the source is resolved to an absolute
29
+ path before linking.
30
+ - `--from` with a `/tree/<branch>/<path>` URL now actually clones that
31
+ branch instead of silently cloning the default branch.
32
+
33
+ ## [4.1.3] - 2026-06-02
34
+
35
+ ### Changed
36
+
37
+ - Rewrote the README to be newcomer-friendly: explains what a Skill is,
38
+ adds a copy-paste "golden" example, documents `--agent` auto-detection,
39
+ multi-skill subpath installs, and manual uninstall.
40
+
41
+ ### Fixed
42
+
43
+ - Corrected stale `install` usage docs that still marked `--skill` as
44
+ required and used the wrong `list --repo` name format.
45
+
46
+ ## [4.1.2] - 2026-06-02
47
+
48
+ ### Added
49
+
50
+ - Unit tests (`node --test`) for GitHub URL parsing and file-system utils.
51
+
52
+ ### Changed
53
+
54
+ - `--skill` is now optional: provide either `--skill <path>` or
55
+ `--from <url>` (at least one required).
56
+ - `install` exits with a non-zero status when one or more links fail, so
57
+ automation can detect partial failures.
58
+
59
+ ### Fixed
60
+
61
+ - `createSymlink` refuses to overwrite a real (non-symlink) file or
62
+ directory, preventing silent data loss on `--yes` overwrite.
63
+
64
+ ### Removed
65
+
66
+ - Deleted the obsolete `legacy-link-skill.sh` and a stale duplicate
67
+ `SKILL.md` at the repo root.
68
+
69
+ ## [4.1.1] - 2026-02-26
70
+
71
+ ### Added
72
+
73
+ - Agent skill definition so the tool can install itself.
74
+
75
+ ## [4.1.0] - 2026-02-26
76
+
77
+ ### Added
78
+
79
+ - Release SOP document and `release.sh` helper script.
80
+
81
+ ## [4.0.4] - 2025
82
+
83
+ ### Fixed
84
+
85
+ - Corrected the OpenCode global skills path to `~/.config/opencode/skills/`.
86
+
87
+ ## [4.0.0] - 2025
88
+
89
+ ### Changed
90
+
91
+ - **Breaking:** removed interactive mode; the tool is now CLI-only.
92
+
93
+ ### Added
94
+
95
+ - Agent alias support for common names (e.g. `claude`, `gh-copilot`).
96
+ - Shallow clone and rebase for faster git operations.
97
+
98
+ [Unreleased]: https://github.com/raybird/skill-linker/compare/v4.2.0...HEAD
99
+ [4.2.0]: https://github.com/raybird/skill-linker/compare/v4.1.4...v4.2.0
100
+ [4.1.4]: https://github.com/raybird/skill-linker/compare/v4.1.3...v4.1.4
101
+ [4.1.3]: https://github.com/raybird/skill-linker/compare/v4.1.2...v4.1.3
102
+ [4.1.2]: https://github.com/raybird/skill-linker/compare/v4.1.1...v4.1.2
103
+ [4.1.1]: https://github.com/raybird/skill-linker/compare/v4.1.0...v4.1.1
104
+ [4.1.0]: https://github.com/raybird/skill-linker/compare/v4.0.4...v4.1.0
105
+ [4.0.4]: https://github.com/raybird/skill-linker/compare/v4.0.0...v4.0.4
106
+ [4.0.0]: https://github.com/raybird/skill-linker/compare/v3.0.8...v4.0.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Raybird
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -82,7 +82,7 @@ Options:
82
82
 
83
83
  > `--skill` 與 `--from` 至少要提供一個(兩者皆可省略其一)。
84
84
  >
85
- > **`--agent` 省略時**:會自動安裝到所有「已偵測到」的 Agent —— 也就是那些全域目錄(如 `~/.claude`、`~/.cursor`)已存在於你系統上的工具。
85
+ > **`--agent` 省略時**:會自動安裝到所有「已偵測到」的 Agent —— 也就是其**全域目錄**(如 `~/.claude/skills`)或**當前專案目錄**(如 `./.cursor/skills`)已存在的工具。
86
86
 
87
87
  範例:
88
88
 
@@ -107,6 +107,7 @@ Usage: skill-linker list [options]
107
107
 
108
108
  Options:
109
109
  -r, --repo <name> 指定 Repository 名稱(格式為 owner/repo)
110
+ --skills 平鋪列出整個 Library 中的每一個 skill
110
111
  --json JSON 輸出格式
111
112
  ```
112
113
 
@@ -116,6 +117,9 @@ Options:
116
117
  # 列出 Library 中所有 Repos
117
118
  npx skill-linker list
118
119
 
120
+ # 平鋪列出所有 repo 底下的每一個 skill(owner/repo/skill)
121
+ npx skill-linker list --skills
122
+
119
123
  # 列出特定 Repo 的 Skills(名稱為 owner/repo)
120
124
  npx skill-linker list --repo anthropics/skills
121
125
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skill-linker",
3
- "version": "4.1.3",
3
+ "version": "4.2.0",
4
4
  "description": "CLI to link AI Agent Skills to various agents (Claude, Copilot, Antigravity, Cursor, etc.)",
5
5
  "main": "bin/cli.js",
6
6
  "bin": {
@@ -41,6 +41,8 @@
41
41
  "bin/",
42
42
  "src/",
43
43
  "skills/",
44
- "README.md"
44
+ "README.md",
45
+ "CHANGELOG.md",
46
+ "LICENSE"
45
47
  ]
46
48
  }
package/src/cli.js CHANGED
@@ -42,10 +42,12 @@ program
42
42
  .command("list")
43
43
  .description("List available skills in library")
44
44
  .option("-r, --repo <name>", "Repository name to list skills from")
45
+ .option("--skills", "List every individual skill across the whole library")
45
46
  .option("--json", "Output as JSON")
46
47
  .action(async (options) => {
47
48
  await list({
48
49
  repo: options.repo,
50
+ skills: options.skills || false,
49
51
  json: options.json || false,
50
52
  });
51
53
  });
@@ -2,6 +2,7 @@ const chalk = require("chalk");
2
2
  const path = require("path");
3
3
  const {
4
4
  findRepos,
5
+ findSkills,
5
6
  listDirectories,
6
7
  dirExists,
7
8
  } = require("../utils/file-system");
@@ -11,16 +12,19 @@ const { DEFAULT_LIB_PATH } = require("../utils/git");
11
12
  * List command - shows repos and skills (CLI mode only)
12
13
  * @param {Object} options - Command options
13
14
  * @param {string} [options.repo] - Repository name to list
15
+ * @param {boolean} [options.skills] - List individual skills across the library
14
16
  * @param {boolean} [options.json] - Output as JSON
17
+ * @param {string} [options.libPath] - Library root (defaults to DEFAULT_LIB_PATH)
15
18
  */
16
19
  async function list(options = {}) {
17
20
  const repoName = options.repo;
18
21
  const outputJson = options.json || false;
22
+ const libPath = options.libPath || DEFAULT_LIB_PATH;
19
23
 
20
- if (!dirExists(DEFAULT_LIB_PATH)) {
24
+ if (!dirExists(libPath)) {
21
25
  console.error(
22
26
  chalk.red("[ERROR]"),
23
- `Skill library not found: ${DEFAULT_LIB_PATH}`,
27
+ `Skill library not found: ${libPath}`,
24
28
  );
25
29
  console.log(
26
30
  chalk.blue("[INFO]"),
@@ -29,12 +33,12 @@ async function list(options = {}) {
29
33
  process.exit(1);
30
34
  }
31
35
 
32
- const repos = findRepos(DEFAULT_LIB_PATH);
36
+ const repos = findRepos(libPath);
33
37
 
34
38
  if (repos.length === 0) {
35
39
  console.log(
36
40
  chalk.yellow("[WARNING]"),
37
- `No repos found in ${DEFAULT_LIB_PATH}`,
41
+ `No repos found in ${libPath}`,
38
42
  );
39
43
  console.log(
40
44
  chalk.blue("[INFO]"),
@@ -43,6 +47,36 @@ async function list(options = {}) {
43
47
  return;
44
48
  }
45
49
 
50
+ // Flat listing: every individual skill across the whole library.
51
+ // Only applies when no specific --repo was requested.
52
+ if (options.skills && !repoName) {
53
+ const skills = findSkills(libPath);
54
+
55
+ if (outputJson) {
56
+ console.log(
57
+ JSON.stringify(
58
+ skills.map((s) => ({ name: s.name, path: s.path })),
59
+ null,
60
+ 2,
61
+ ),
62
+ );
63
+ return;
64
+ }
65
+
66
+ console.log("");
67
+ console.log(
68
+ chalk.blue("[INFO]"),
69
+ `Skills in library (${libPath}):`,
70
+ );
71
+ console.log("");
72
+ skills.forEach((skill, index) => {
73
+ console.log(` ${index + 1}. ${chalk.cyan(skill.name)}`);
74
+ console.log(` ${chalk.dim(skill.path)}`);
75
+ });
76
+ console.log("");
77
+ return;
78
+ }
79
+
46
80
  // CLI mode: use provided repo name
47
81
  if (repoName) {
48
82
  const selectedRepo = repos.find(
@@ -134,7 +168,7 @@ async function list(options = {}) {
134
168
  console.log("");
135
169
  console.log(
136
170
  chalk.blue("[INFO]"),
137
- `Repositories in library (${DEFAULT_LIB_PATH}):`,
171
+ `Repositories in library (${libPath}):`,
138
172
  );
139
173
  console.log("");
140
174
 
@@ -74,15 +74,22 @@ function findAgentIndex(nameOrAlias) {
74
74
  }
75
75
 
76
76
  /**
77
- * Detect which agents are installed on the system
77
+ * Detect which agents are installed / in use.
78
+ *
79
+ * An agent counts as detected if EITHER its global skills directory exists,
80
+ * OR its project skills directory exists under the given working directory.
81
+ * The latter lets project-only setups be auto-detected when --agent is omitted.
82
+ *
83
+ * @param {string} [cwd] - Working directory to check project dirs against
78
84
  * @returns {Array} List of detected agent indices
79
85
  */
80
- function detectInstalledAgents() {
86
+ function detectInstalledAgents(cwd = process.cwd()) {
81
87
  const installed = [];
82
88
 
83
89
  AGENTS.forEach((agent, index) => {
84
- // Check if global directory exists
85
- if (fs.existsSync(agent.globalDir)) {
90
+ const globalExists = fs.existsSync(agent.globalDir);
91
+ const projectExists = fs.existsSync(path.join(cwd, agent.projectDir));
92
+ if (globalExists || projectExists) {
86
93
  installed.push(index);
87
94
  }
88
95
  });
@@ -32,6 +32,11 @@ function ensureDir(dirPath) {
32
32
  */
33
33
  function createSymlink(source, target) {
34
34
  try {
35
+ // Resolve the source to an absolute path. A relative source (e.g.
36
+ // "./my-skill") would otherwise be stored verbatim and resolved
37
+ // relative to the link's own directory, producing a broken link.
38
+ const resolvedSource = path.resolve(source);
39
+
35
40
  // Ensure parent directory exists
36
41
  ensureDir(path.dirname(target));
37
42
 
@@ -57,7 +62,7 @@ function createSymlink(source, target) {
57
62
  }
58
63
  }
59
64
 
60
- fs.symlinkSync(source, target, 'dir');
65
+ fs.symlinkSync(resolvedSource, target, 'dir');
61
66
  return true;
62
67
  } catch (error) {
63
68
  console.error(`Failed to create symlink: ${error.message}`);
package/src/utils/git.js CHANGED
@@ -13,7 +13,8 @@ const DEFAULT_LIB_PATH = path.join(os.homedir(), "Documents/AgentSkills");
13
13
  function parseGitHubUrl(url) {
14
14
  let cleanUrl = url;
15
15
  let subpath = "";
16
- let branch = "main";
16
+ // null means "no explicit branch" — let git use the remote default.
17
+ let branch = null;
17
18
 
18
19
  // Check for /tree/branch/path format
19
20
  const treeMatch = url.match(/(.+)\/tree\/([^/]+)\/(.+)$/);
@@ -39,19 +40,38 @@ function parseGitHubUrl(url) {
39
40
  };
40
41
  }
41
42
 
43
+ /**
44
+ * Build the argument list for `git clone`.
45
+ * @param {string} url - GitHub URL
46
+ * @param {string} targetPath - Target directory
47
+ * @param {Object} [opts]
48
+ * @param {boolean} [opts.shallow] - Use shallow clone (default true)
49
+ * @param {string|null} [opts.branch] - Branch to check out, or null for default
50
+ * @returns {string[]} git arguments
51
+ */
52
+ function buildCloneArgs(url, targetPath, { shallow = true, branch = null } = {}) {
53
+ const args = ["clone"];
54
+ if (shallow) {
55
+ args.push("--depth", "1");
56
+ }
57
+ if (branch) {
58
+ args.push("--branch", branch);
59
+ }
60
+ args.push(url, targetPath);
61
+ return args;
62
+ }
63
+
42
64
  /**
43
65
  * Clone a GitHub repository
44
66
  * @param {string} url - GitHub URL
45
67
  * @param {string} targetPath - Target directory
46
68
  * @param {boolean} shallow - Use shallow clone (default true)
69
+ * @param {string|null} branch - Branch to check out, or null for default
47
70
  * @returns {Promise<void>}
48
71
  */
49
- async function cloneRepo(url, targetPath, shallow = true) {
72
+ async function cloneRepo(url, targetPath, shallow = true, branch = null) {
50
73
  try {
51
- const args = shallow
52
- ? ["clone", "--depth", "1", url, targetPath]
53
- : ["clone", url, targetPath];
54
- await execa("git", args);
74
+ await execa("git", buildCloneArgs(url, targetPath, { shallow, branch }));
55
75
  } catch (error) {
56
76
  throw new Error(`Failed to clone repository: ${error.message}`);
57
77
  }
@@ -85,8 +105,8 @@ async function cloneOrUpdateRepo(url) {
85
105
  // Repo exists, ask if user wants to update
86
106
  needsUpdate = true;
87
107
  } else {
88
- // Clone new repo
89
- await cloneRepo(parsed.cleanUrl, targetPath);
108
+ // Clone new repo (honour an explicit branch from /tree/<branch>/ URLs)
109
+ await cloneRepo(parsed.cleanUrl, targetPath, true, parsed.branch);
90
110
  }
91
111
 
92
112
  // Determine final skill path
@@ -106,6 +126,7 @@ async function cloneOrUpdateRepo(url) {
106
126
  module.exports = {
107
127
  DEFAULT_LIB_PATH,
108
128
  parseGitHubUrl,
129
+ buildCloneArgs,
109
130
  cloneRepo,
110
131
  pullRepo,
111
132
  cloneOrUpdateRepo,