@moon791017/neo-skills 1.0.17 → 1.0.18
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 +17 -2
- package/bin/_utils.js +26 -6
- package/gemini-extension.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -92,13 +92,29 @@ npx -p @moon791017/neo-skills install-copilot-skills
|
|
|
92
92
|
npx -p @moon791017/neo-skills install-codex-skills
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
+
### 自訂安裝根目錄
|
|
96
|
+
|
|
97
|
+
Claude Code、Copilot CLI、Codex CLI 三種安裝指令皆支援 `--target-path` 參數,可指定安裝的根目錄(取代預設的 `$HOME`)。技能子目錄(如 `.claude/skills`)會自動附加:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# 安裝至 /my/project/.claude/skills
|
|
101
|
+
npx -p @moon791017/neo-skills install-claude-skills --target-path /my/project
|
|
102
|
+
|
|
103
|
+
# 安裝至 /my/project/.copilot/skills
|
|
104
|
+
npx -p @moon791017/neo-skills install-copilot-skills --target-path /my/project
|
|
105
|
+
|
|
106
|
+
# 安裝至 /my/project/.codex/skills
|
|
107
|
+
npx -p @moon791017/neo-skills install-codex-skills --target-path /my/project
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
若未指定 `--target-path`,則使用預設根目錄 `$HOME`(即 `~/.claude/skills`、`~/.copilot/skills`、`~/.codex/skills`)。
|
|
111
|
+
|
|
95
112
|
### 安裝全部AI Agent技能
|
|
96
113
|
|
|
97
114
|
```bash
|
|
98
115
|
npx -p @moon791017/neo-skills install-skills
|
|
99
116
|
```
|
|
100
117
|
|
|
101
|
-
|
|
102
118
|
## 💡 常用指令範例
|
|
103
119
|
|
|
104
120
|
您可以直接對 AI 代理下達以下指令或在對話中描述需求:
|
|
@@ -113,7 +129,6 @@ npx -p @moon791017/neo-skills install-skills
|
|
|
113
129
|
| **生成 C# Interface** | `幫我針對這個 class 產生介面` 或 `/neo:dotnet-gen-interface` |
|
|
114
130
|
| **技術解析與架構洞察** | `分析這個專案的架構` 或 `/neo:explain` |
|
|
115
131
|
|
|
116
|
-
|
|
117
132
|
## 🛠 開發指南
|
|
118
133
|
|
|
119
134
|
本專案使用 **Bun** 進行開發與建置。
|
package/bin/_utils.js
CHANGED
|
@@ -43,6 +43,16 @@ export const AGENTS = {
|
|
|
43
43
|
// },
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* 從 CLI 參數解析 --target-path 值
|
|
48
|
+
* @returns {string | undefined}
|
|
49
|
+
*/
|
|
50
|
+
function parseTargetPath() {
|
|
51
|
+
const idx = process.argv.indexOf('--target-path');
|
|
52
|
+
if (idx === -1 || idx + 1 >= process.argv.length) return undefined;
|
|
53
|
+
return process.argv[idx + 1];
|
|
54
|
+
}
|
|
55
|
+
|
|
46
56
|
/**
|
|
47
57
|
* 從檔名解析 agent key: install-{key}-skills.js → key
|
|
48
58
|
*/
|
|
@@ -55,8 +65,10 @@ function extractAgentKey(importMetaUrl) {
|
|
|
55
65
|
|
|
56
66
|
/**
|
|
57
67
|
* 根據 agent config 建立 installer 函式
|
|
68
|
+
* @param {object} config - agent 設定
|
|
69
|
+
* @param {string} [targetPath] - 使用者透過 --target-path 指定的自訂路徑
|
|
58
70
|
*/
|
|
59
|
-
export function createInstaller({ name: agentName, targetSubDir, hint }) {
|
|
71
|
+
export function createInstaller({ name: agentName, targetSubDir, hint }, targetPath) {
|
|
60
72
|
return async function install() {
|
|
61
73
|
console.log(`🚀 [${agentName}] 開始同步 Neo Skills...`);
|
|
62
74
|
|
|
@@ -68,7 +80,8 @@ export function createInstaller({ name: agentName, targetSubDir, hint }) {
|
|
|
68
80
|
return { success: false, message: msg };
|
|
69
81
|
}
|
|
70
82
|
|
|
71
|
-
const
|
|
83
|
+
const baseDir = targetPath ? resolve(targetPath) : homedir();
|
|
84
|
+
const targetSkillsDir = join(baseDir, targetSubDir);
|
|
72
85
|
|
|
73
86
|
console.log(`📁 來源路徑: ${sourceDir}`);
|
|
74
87
|
console.log(`🎯 目標路徑: ${targetSkillsDir}`);
|
|
@@ -92,7 +105,8 @@ export function createInstaller({ name: agentName, targetSubDir, hint }) {
|
|
|
92
105
|
return { success: true, message: '沒有任何檔案被複製' };
|
|
93
106
|
}
|
|
94
107
|
|
|
95
|
-
const
|
|
108
|
+
const displayPath = targetPath || targetSubDir;
|
|
109
|
+
const msg = `已同步 ${copyCount} 個檔案/資料夾至 ${displayPath}`;
|
|
96
110
|
console.log(`✅ [${agentName}] 安裝成功!${msg}`);
|
|
97
111
|
if (hint) console.log(`💡 提示: ${hint}`);
|
|
98
112
|
return { success: true, message: msg };
|
|
@@ -102,12 +116,13 @@ export function createInstaller({ name: agentName, targetSubDir, hint }) {
|
|
|
102
116
|
/**
|
|
103
117
|
* 從呼叫端的檔名自動解析 agent,建立對應的 installer。
|
|
104
118
|
* @param {string} importMetaUrl - 呼叫端的 import.meta.url
|
|
119
|
+
* @param {string} [targetPath] - 使用者透過 --target-path 指定的自訂路徑
|
|
105
120
|
*/
|
|
106
|
-
export function createInstallerFromFile(importMetaUrl) {
|
|
121
|
+
export function createInstallerFromFile(importMetaUrl, targetPath) {
|
|
107
122
|
const key = extractAgentKey(importMetaUrl);
|
|
108
123
|
const config = AGENTS[key];
|
|
109
124
|
if (!config) throw new Error(`未知的 agent: "${key}"。請在 _utils.js 的 AGENTS 中註冊。`);
|
|
110
|
-
return createInstaller(config);
|
|
125
|
+
return createInstaller(config, targetPath);
|
|
111
126
|
}
|
|
112
127
|
|
|
113
128
|
/**
|
|
@@ -137,7 +152,12 @@ export function runAsMain(installFn, callerUrl) {
|
|
|
137
152
|
process.exit(1);
|
|
138
153
|
});
|
|
139
154
|
|
|
140
|
-
|
|
155
|
+
const targetPath = parseTargetPath();
|
|
156
|
+
const actualInstallFn = targetPath
|
|
157
|
+
? createInstallerFromFile(callerUrl, targetPath)
|
|
158
|
+
: installFn;
|
|
159
|
+
|
|
160
|
+
actualInstallFn().then((result) => {
|
|
141
161
|
if (!result.success) process.exit(1);
|
|
142
162
|
}).catch((error) => {
|
|
143
163
|
console.error(`❌ [${agentName}] 安裝失敗:`, error.message || error);
|
package/gemini-extension.json
CHANGED