feat: add gitlink-cli-install-skills command for cross-platform skills installation

- New bin/install-skills.js: resolves local skills path automatically
- Users just run `gitlink-cli-install-skills` on any platform
- No more bash-specific $(npm root -g) syntax that breaks on Windows
- Update README installation docs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
wbtiger 2026-04-07 16:27:22 +08:00
parent df8937316a
commit 5975c0759c
3 changed files with 30 additions and 6 deletions

View File

@ -59,8 +59,8 @@ Choose **one** of the following methods:
# Install CLI
npm install -g @gitlink-ai/cli
# Install CLI SKILL (required)
npx skills add "$(npm root -g)/@gitlink-ai/cli/skills" -y -g
# Install CLI SKILL (required, works on all platforms)
gitlink-cli-install-skills
```
**Option 2 — From source:**
@ -101,8 +101,8 @@ gitlink-cli repo +list
# Install CLI
npm install -g @gitlink-ai/cli
# Install CLI SKILL (required)
npx skills add "$(npm root -g)/@gitlink-ai/cli/skills" -y -g
# Install CLI SKILL (required, works on all platforms)
gitlink-cli-install-skills
```
**Step 2 — Configure**

22
npm/bin/install-skills.js Normal file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env node
"use strict";
const path = require("path");
const { execSync } = require("child_process");
const skillsDir = path.join(__dirname, "..", "skills");
console.log(`Installing gitlink-cli skills from ${skillsDir}...`);
try {
execSync(`npx skills add "${skillsDir}" -y -g`, { stdio: "inherit" });
} catch (err) {
if (err.status !== undefined) {
process.exit(err.status);
}
console.error(`Failed to install skills: ${err.message}`);
console.error(`\nYou can install manually:`);
console.error(` npx skills add "${skillsDir}" -y -g`);
process.exit(1);
}

View File

@ -1,9 +1,10 @@
{
"name": "@gitlink-ai/cli",
"version": "0.1.6",
"version": "0.1.7",
"description": "GitLink 平台官方命令行工具 — 代码托管、协作开发和自动化",
"bin": {
"gitlink-cli": "bin/cli.js"
"gitlink-cli": "bin/cli.js",
"gitlink-cli-install-skills": "bin/install-skills.js"
},
"scripts": {
"postinstall": "node scripts/install.js"
@ -33,6 +34,7 @@
],
"files": [
"bin/cli.js",
"bin/install-skills.js",
"scripts/",
"skills/",
"README.md"