@moon791017/neo-skills 1.0.18 → 1.0.19
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 +7 -7
- package/bin/_utils.js +41 -15
- package/gemini-extension.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -92,22 +92,22 @@ npx -p @moon791017/neo-skills install-copilot-skills
|
|
|
92
92
|
npx -p @moon791017/neo-skills install-codex-skills
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
###
|
|
95
|
+
### 安裝至指定專案
|
|
96
96
|
|
|
97
|
-
Claude Code、Copilot CLI、Codex CLI 三種安裝指令皆支援 `--
|
|
97
|
+
Claude Code、Copilot CLI、Codex CLI 三種安裝指令皆支援 `--project-path` 參數,可將技能安裝至指定專案目錄。技能子目錄會自動附加:
|
|
98
98
|
|
|
99
99
|
```bash
|
|
100
100
|
# 安裝至 /my/project/.claude/skills
|
|
101
|
-
npx -p @moon791017/neo-skills install-claude-skills --
|
|
101
|
+
npx -p @moon791017/neo-skills install-claude-skills --project-path /my/project
|
|
102
102
|
|
|
103
|
-
# 安裝至 /my/project/.
|
|
104
|
-
npx -p @moon791017/neo-skills install-copilot-skills --
|
|
103
|
+
# 安裝至 /my/project/.github/skills
|
|
104
|
+
npx -p @moon791017/neo-skills install-copilot-skills --project-path /my/project
|
|
105
105
|
|
|
106
106
|
# 安裝至 /my/project/.codex/skills
|
|
107
|
-
npx -p @moon791017/neo-skills install-codex-skills --
|
|
107
|
+
npx -p @moon791017/neo-skills install-codex-skills --project-path /my/project
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
-
若未指定 `--
|
|
110
|
+
若未指定 `--project-path`,則安裝至全域路徑(`~/.claude/skills`、`~/.copilot/skills`、`~/.codex/skills`)。
|
|
111
111
|
|
|
112
112
|
### 安裝全部AI Agent技能
|
|
113
113
|
|
package/bin/_utils.js
CHANGED
|
@@ -19,36 +19,45 @@ const sourceDir = join(packageRoot, 'skills');
|
|
|
19
19
|
/**
|
|
20
20
|
* Agent 設定中心 — 所有 agent 的安裝參數集中管理於此。
|
|
21
21
|
* key 須與檔名 install-{key}-skills.js 一致。
|
|
22
|
+
*
|
|
23
|
+
* 各欄位說明:
|
|
24
|
+
* name — 顯示用名稱,用於 CLI 輸出的 log 標籤。
|
|
25
|
+
* homePath — 全域安裝路徑(相對於 $HOME)。未指定 --project-path 時使用。
|
|
26
|
+
* projectPath — (選填)專案安裝路徑(相對於 --project-path)。
|
|
27
|
+
* 指定 --project-path 且此欄位有值時,優先使用此路徑取代 homePath。
|
|
28
|
+
* 例如 Copilot:全域 ~/.copilot/skills,專案 <project>/.github/skills。
|
|
29
|
+
* hint — 安裝成功後顯示的提示訊息。
|
|
22
30
|
*/
|
|
23
31
|
export const AGENTS = {
|
|
24
32
|
claude: {
|
|
25
33
|
name: 'Claude',
|
|
26
|
-
|
|
34
|
+
homePath: '.claude/skills',
|
|
27
35
|
hint: '請確保您的 Claude Desktop 或相關插件已指向此目錄。',
|
|
28
36
|
},
|
|
29
37
|
copilot: {
|
|
30
38
|
name: 'Copilot',
|
|
31
|
-
|
|
39
|
+
homePath: '.copilot/skills',
|
|
40
|
+
projectPath: '.github/skills',
|
|
32
41
|
hint: '請確保您的 GitHub Copilot CLI 已指向此目錄。',
|
|
33
42
|
},
|
|
34
43
|
codex: {
|
|
35
44
|
name: 'Codex',
|
|
36
|
-
|
|
45
|
+
homePath: '.codex/skills',
|
|
37
46
|
hint: '請確保您的 Codex CLI 已指向此目錄。',
|
|
38
47
|
},
|
|
39
48
|
// gemini: {
|
|
40
49
|
// name: 'Gemini',
|
|
41
|
-
//
|
|
50
|
+
// homePath: '.gemini/skills/neo-skills',
|
|
42
51
|
// hint: '請確保您的 Gemini CLI 已指向此目錄。',
|
|
43
52
|
// },
|
|
44
53
|
};
|
|
45
54
|
|
|
46
55
|
/**
|
|
47
|
-
* 從 CLI 參數解析 --
|
|
56
|
+
* 從 CLI 參數解析 --project-path 值
|
|
48
57
|
* @returns {string | undefined}
|
|
49
58
|
*/
|
|
50
|
-
function
|
|
51
|
-
const idx = process.argv.indexOf('--
|
|
59
|
+
function parseProjectPath() {
|
|
60
|
+
const idx = process.argv.indexOf('--project-path');
|
|
52
61
|
if (idx === -1 || idx + 1 >= process.argv.length) return undefined;
|
|
53
62
|
return process.argv[idx + 1];
|
|
54
63
|
}
|
|
@@ -64,11 +73,25 @@ function extractAgentKey(importMetaUrl) {
|
|
|
64
73
|
}
|
|
65
74
|
|
|
66
75
|
/**
|
|
67
|
-
* 根據 agent config 建立 installer
|
|
68
|
-
*
|
|
69
|
-
*
|
|
76
|
+
* 根據 agent config 建立 installer 函式。
|
|
77
|
+
*
|
|
78
|
+
* 路徑解析邏輯:
|
|
79
|
+
* 1. 決定根目錄 (baseDir):
|
|
80
|
+
* - 有 --project-path → 使用者指定的絕對路徑
|
|
81
|
+
* - 無 --project-path → $HOME
|
|
82
|
+
* 2. 決定子目錄 (subDir):
|
|
83
|
+
* - 有 --project-path 且 config 定義了 projectPath → 使用 projectPath
|
|
84
|
+
* - 其餘情況 → 使用 homePath
|
|
85
|
+
* 3. 最終安裝路徑 = baseDir + subDir
|
|
86
|
+
*
|
|
87
|
+
* 範例(以 Copilot 為例):
|
|
88
|
+
* 預設: ~/.copilot/skills (homedir + homePath)
|
|
89
|
+
* --project-path /my/project: /my/project/.github/skills (targetPath + projectPath)
|
|
90
|
+
*
|
|
91
|
+
* @param {object} config - AGENTS 中的 agent 設定物件
|
|
92
|
+
* @param {string} [targetPath] - 使用者透過 --project-path 指定的自訂根目錄
|
|
70
93
|
*/
|
|
71
|
-
export function createInstaller({ name: agentName,
|
|
94
|
+
export function createInstaller({ name: agentName, homePath, projectPath, hint }, targetPath) {
|
|
72
95
|
return async function install() {
|
|
73
96
|
console.log(`🚀 [${agentName}] 開始同步 Neo Skills...`);
|
|
74
97
|
|
|
@@ -80,8 +103,11 @@ export function createInstaller({ name: agentName, targetSubDir, hint }, targetP
|
|
|
80
103
|
return { success: false, message: msg };
|
|
81
104
|
}
|
|
82
105
|
|
|
106
|
+
// 根目錄:--project-path 優先,否則 $HOME
|
|
83
107
|
const baseDir = targetPath ? resolve(targetPath) : homedir();
|
|
84
|
-
|
|
108
|
+
// 子目錄:專案層級有獨立路徑時採用 projectPath,否則用預設的 homePath
|
|
109
|
+
const subDir = targetPath && projectPath ? projectPath : homePath;
|
|
110
|
+
const targetSkillsDir = join(baseDir, subDir);
|
|
85
111
|
|
|
86
112
|
console.log(`📁 來源路徑: ${sourceDir}`);
|
|
87
113
|
console.log(`🎯 目標路徑: ${targetSkillsDir}`);
|
|
@@ -105,7 +131,7 @@ export function createInstaller({ name: agentName, targetSubDir, hint }, targetP
|
|
|
105
131
|
return { success: true, message: '沒有任何檔案被複製' };
|
|
106
132
|
}
|
|
107
133
|
|
|
108
|
-
const displayPath = targetPath ||
|
|
134
|
+
const displayPath = targetPath || homePath;
|
|
109
135
|
const msg = `已同步 ${copyCount} 個檔案/資料夾至 ${displayPath}`;
|
|
110
136
|
console.log(`✅ [${agentName}] 安裝成功!${msg}`);
|
|
111
137
|
if (hint) console.log(`💡 提示: ${hint}`);
|
|
@@ -116,7 +142,7 @@ export function createInstaller({ name: agentName, targetSubDir, hint }, targetP
|
|
|
116
142
|
/**
|
|
117
143
|
* 從呼叫端的檔名自動解析 agent,建立對應的 installer。
|
|
118
144
|
* @param {string} importMetaUrl - 呼叫端的 import.meta.url
|
|
119
|
-
* @param {string} [targetPath] - 使用者透過 --
|
|
145
|
+
* @param {string} [targetPath] - 使用者透過 --project-path 指定的自訂路徑
|
|
120
146
|
*/
|
|
121
147
|
export function createInstallerFromFile(importMetaUrl, targetPath) {
|
|
122
148
|
const key = extractAgentKey(importMetaUrl);
|
|
@@ -152,7 +178,7 @@ export function runAsMain(installFn, callerUrl) {
|
|
|
152
178
|
process.exit(1);
|
|
153
179
|
});
|
|
154
180
|
|
|
155
|
-
const targetPath =
|
|
181
|
+
const targetPath = parseProjectPath();
|
|
156
182
|
const actualInstallFn = targetPath
|
|
157
183
|
? createInstallerFromFile(callerUrl, targetPath)
|
|
158
184
|
: installFn;
|
package/gemini-extension.json
CHANGED