@vincent119/go-copilot-rules 1.0.0 → 1.1.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/.agent_agy/QUICK_START.md +223 -0
- package/cli/install.js +70 -3
- package/package.json +1 -1
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# 快速開始指南
|
|
2
|
+
|
|
3
|
+
## ⚠️ 重要提醒
|
|
4
|
+
|
|
5
|
+
**NPM Package 尚未發布**,目前無法直接使用 `npx @vincent119/go-copilot-rules`。
|
|
6
|
+
|
|
7
|
+
請使用以下替代方案:
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 🚀 方案 1:使用安裝腳本(推薦)
|
|
12
|
+
|
|
13
|
+
### 從 GitHub 直接安裝
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# 一鍵安裝到當前專案(自動偵測 VS Code/Cursor/Kiro)
|
|
17
|
+
bash <(curl -s https://raw.githubusercontent.com/vincent119/copilot-rules-kit/main/scripts/quick-install.sh)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### 手動執行腳本
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Clone 專案
|
|
24
|
+
git clone https://github.com/vincent119/copilot-rules-kit.git /tmp/copilot-rules-kit
|
|
25
|
+
|
|
26
|
+
# 執行安裝腳本
|
|
27
|
+
cd /tmp/copilot-rules-kit
|
|
28
|
+
|
|
29
|
+
# 自動偵測
|
|
30
|
+
./scripts/install-skills.sh
|
|
31
|
+
|
|
32
|
+
# 或指定 IDE
|
|
33
|
+
./scripts/install-skills.sh --vscode
|
|
34
|
+
./scripts/install-skills.sh --cursor
|
|
35
|
+
./scripts/install-skills.sh --kiro
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 🚀 方案 2:本地 CLI 測試
|
|
41
|
+
|
|
42
|
+
如果你已經 clone 了此專案:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# 在專案根目錄
|
|
46
|
+
cd /path/to/copilot-rules-kit
|
|
47
|
+
|
|
48
|
+
# 執行安裝到特定目錄
|
|
49
|
+
node cli/install.js --path /path/to/your/project/.kiro/skills
|
|
50
|
+
|
|
51
|
+
# 或使用相對路徑(需要在目標專案目錄執行)
|
|
52
|
+
cd /path/to/your/project
|
|
53
|
+
node /path/to/copilot-rules-kit/cli/install.js --kiro
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 🚀 方案 3:Git Submodule(適合團隊)
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
cd /path/to/your/project
|
|
62
|
+
|
|
63
|
+
# 加入 submodule
|
|
64
|
+
git submodule add https://github.com/vincent119/copilot-rules-kit .copilot-rules
|
|
65
|
+
|
|
66
|
+
# 複製到目標位置
|
|
67
|
+
# VS Code
|
|
68
|
+
cp -r .copilot-rules/.agent_agy .
|
|
69
|
+
|
|
70
|
+
# Cursor
|
|
71
|
+
mkdir -p .cursor/skills
|
|
72
|
+
cp -r .copilot-rules/.agent_agy/skills/* .cursor/skills/
|
|
73
|
+
|
|
74
|
+
# Kiro
|
|
75
|
+
mkdir -p .kiro/skills
|
|
76
|
+
cp -r .copilot-rules/.agent_agy/skills/* .kiro/skills/
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## 🚀 方案 4:直接手動複製
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Clone 到暫存目錄
|
|
85
|
+
git clone https://github.com/vincent119/copilot-rules-kit.git /tmp/copilot-rules-kit
|
|
86
|
+
|
|
87
|
+
cd /path/to/your/project
|
|
88
|
+
|
|
89
|
+
# 複製到 Kiro
|
|
90
|
+
mkdir -p .kiro/skills
|
|
91
|
+
cp -r /tmp/copilot-rules-kit/.agent_agy/skills/* .kiro/skills/
|
|
92
|
+
cp /tmp/copilot-rules-kit/.agent_agy/INSTALLATION.md .kiro/skills/
|
|
93
|
+
cp /tmp/copilot-rules-kit/.agent_agy/SKILLS_INDEX.md .kiro/skills/
|
|
94
|
+
|
|
95
|
+
# 複製核心規範(可選)
|
|
96
|
+
mkdir -p .kiro/rules
|
|
97
|
+
cp -r /tmp/copilot-rules-kit/.agent_agy/rules/* .kiro/rules/
|
|
98
|
+
|
|
99
|
+
# 清理
|
|
100
|
+
rm -rf /tmp/copilot-rules-kit
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## ✅ 驗證安裝
|
|
106
|
+
|
|
107
|
+
### 檢查檔案是否存在
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Kiro
|
|
111
|
+
ls -la .kiro/skills/
|
|
112
|
+
tree .kiro/skills/
|
|
113
|
+
|
|
114
|
+
# 應該看到:
|
|
115
|
+
# go-ddd/
|
|
116
|
+
# go-grpc/
|
|
117
|
+
# go-testing-advanced/
|
|
118
|
+
# ... (共 13 個 Skills)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 測試 Skills 是否可用
|
|
122
|
+
|
|
123
|
+
#### Kiro IDE
|
|
124
|
+
|
|
125
|
+
1. 打開 Kiro IDE
|
|
126
|
+
2. 按 `ctrl+e` 啟動 Wraith
|
|
127
|
+
3. 輸入:「列出所有可用的 Go Skills」
|
|
128
|
+
4. 應該會看到 13 個 Skills 列表
|
|
129
|
+
|
|
130
|
+
#### VS Code / Cursor
|
|
131
|
+
|
|
132
|
+
1. 打開專案
|
|
133
|
+
2. 在 Copilot Chat 輸入:「這個專案有哪些 Skills?」
|
|
134
|
+
3. 測試觸發:「如何實作 DDD Aggregate Root?」
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## 🐛 故障排除
|
|
139
|
+
|
|
140
|
+
### 問題 1:安裝後看不到檔案
|
|
141
|
+
|
|
142
|
+
**可能原因**:
|
|
143
|
+
- CLI 找不到 `.agent_agy` 目錄
|
|
144
|
+
- 路徑計算錯誤
|
|
145
|
+
|
|
146
|
+
**解決方案**:
|
|
147
|
+
使用**方案 4**(直接手動複製),這是最可靠的方式。
|
|
148
|
+
|
|
149
|
+
### 問題 2:Skills 沒有被觸發
|
|
150
|
+
|
|
151
|
+
**檢查清單**:
|
|
152
|
+
1. 檔案是否在正確位置?
|
|
153
|
+
- Kiro: `.kiro/skills/go-xxx/SKILL.md`
|
|
154
|
+
- VS Code: `.agent_agy/skills/go-xxx/SKILL.md`
|
|
155
|
+
- Cursor: `.cursor/skills/go-xxx/SKILL.md`
|
|
156
|
+
|
|
157
|
+
2. YAML frontmatter 是否正確?
|
|
158
|
+
```bash
|
|
159
|
+
head -n 5 .kiro/skills/go-ddd/SKILL.md
|
|
160
|
+
# 應該看到:
|
|
161
|
+
# ---
|
|
162
|
+
# name: go-ddd
|
|
163
|
+
# description: ...
|
|
164
|
+
# ---
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
3. 重新啟動 IDE
|
|
168
|
+
|
|
169
|
+
### 問題 3:本地 CLI 執行失敗
|
|
170
|
+
|
|
171
|
+
**錯誤訊息**:找不到 `.agent_agy` 目錄
|
|
172
|
+
|
|
173
|
+
**解決方案**:
|
|
174
|
+
```bash
|
|
175
|
+
# 必須在 copilot-rules-kit 專案根目錄執行
|
|
176
|
+
cd /path/to/copilot-rules-kit
|
|
177
|
+
node cli/install.js --help
|
|
178
|
+
|
|
179
|
+
# 或使用絕對路徑
|
|
180
|
+
node /path/to/copilot-rules-kit/cli/install.js --kiro
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## 📦 NPM 發布後的使用方式
|
|
186
|
+
|
|
187
|
+
待 `@vincent119/go-copilot-rules` 發布後,可使用:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
# 自動偵測
|
|
191
|
+
npx @vincent119/go-copilot-rules
|
|
192
|
+
|
|
193
|
+
# Kiro 專案
|
|
194
|
+
npx @vincent119/go-copilot-rules --kiro
|
|
195
|
+
|
|
196
|
+
# Kiro 全域
|
|
197
|
+
npx @vincent119/go-copilot-rules --kiro-global
|
|
198
|
+
|
|
199
|
+
# VS Code
|
|
200
|
+
npx @vincent119/go-copilot-rules --vscode
|
|
201
|
+
|
|
202
|
+
# Cursor
|
|
203
|
+
npx @vincent119/go-copilot-rules --cursor
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## 📚 完整文件
|
|
209
|
+
|
|
210
|
+
- [完整安裝指南](INSTALLATION.md)
|
|
211
|
+
- [Skills 索引](SKILLS_INDEX.md)
|
|
212
|
+
- [README](README.md)
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## 💡 推薦方式(依使用情境)
|
|
217
|
+
|
|
218
|
+
| 情境 | 推薦方案 | 原因 |
|
|
219
|
+
|------|---------|------|
|
|
220
|
+
| **快速測試** | 方案 4(手動複製) | 最簡單、最可靠 |
|
|
221
|
+
| **個人使用** | 方案 1(安裝腳本) | 一鍵安裝,自動備份 |
|
|
222
|
+
| **團隊協作** | 方案 3(Git Submodule) | 版本控制、易於更新 |
|
|
223
|
+
| **本地開發** | 方案 2(本地 CLI) | 適合測試 CLI 功能 |
|
package/cli/install.js
CHANGED
|
@@ -51,7 +51,8 @@ function parseArgs() {
|
|
|
51
51
|
mode: 'full', // full, core-only, skills-only
|
|
52
52
|
skills: null,
|
|
53
53
|
ide: null,
|
|
54
|
-
help: false
|
|
54
|
+
help: false,
|
|
55
|
+
debug: false
|
|
55
56
|
};
|
|
56
57
|
|
|
57
58
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -62,6 +63,9 @@ function parseArgs() {
|
|
|
62
63
|
case '-h':
|
|
63
64
|
options.help = true;
|
|
64
65
|
break;
|
|
66
|
+
case '--debug':
|
|
67
|
+
options.debug = true;
|
|
68
|
+
break;
|
|
65
69
|
case '--vscode':
|
|
66
70
|
options.ide = 'vscode';
|
|
67
71
|
options.path = '.agent_agy';
|
|
@@ -116,6 +120,7 @@ ${colors.yellow}選項:${colors.reset}
|
|
|
116
120
|
--core-only 只安裝核心規範(不包含 Skills)
|
|
117
121
|
--skills-only 只安裝 Skills(不包含核心規範)
|
|
118
122
|
--skills <list> 只安裝特定 Skills(逗號分隔)
|
|
123
|
+
--debug 顯示詳細的除錯資訊
|
|
119
124
|
--help, -h 顯示此幫助訊息
|
|
120
125
|
|
|
121
126
|
${colors.yellow}範例:${colors.reset}
|
|
@@ -180,9 +185,71 @@ function copyRecursive(src, dest) {
|
|
|
180
185
|
}
|
|
181
186
|
}
|
|
182
187
|
|
|
188
|
+
function findSourceDir() {
|
|
189
|
+
// 嘗試多種路徑來找到 .agent_agy 目錄
|
|
190
|
+
const candidates = [
|
|
191
|
+
// 1. 相對於 cli/ 目錄(本地開發)
|
|
192
|
+
path.join(__dirname, '..', '.agent_agy'),
|
|
193
|
+
// 2. 相對於執行目錄(npm link)
|
|
194
|
+
path.join(process.cwd(), '.agent_agy'),
|
|
195
|
+
// 3. 相對於腳本路徑的上層(npx 可能的位置)
|
|
196
|
+
path.join(path.dirname(__dirname), '.agent_agy'),
|
|
197
|
+
// 4. node_modules 內(npx 安裝後)
|
|
198
|
+
path.join(__dirname, '..', '..', '@vincent119', 'go-copilot-rules', '.agent_agy'),
|
|
199
|
+
// 5. 檢查是否在 package 根目錄
|
|
200
|
+
path.join(__dirname, '.agent_agy'),
|
|
201
|
+
];
|
|
202
|
+
|
|
203
|
+
for (const candidate of candidates) {
|
|
204
|
+
if (fs.existsSync(candidate)) {
|
|
205
|
+
// 確認是否包含 skills 目錄
|
|
206
|
+
const skillsDir = path.join(candidate, 'skills');
|
|
207
|
+
if (fs.existsSync(skillsDir)) {
|
|
208
|
+
return candidate;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
|
|
183
216
|
function install(options) {
|
|
184
|
-
const
|
|
185
|
-
|
|
217
|
+
const sourceDir = findSourceDir();
|
|
218
|
+
|
|
219
|
+
if (options.debug) {
|
|
220
|
+
log('', 'reset');
|
|
221
|
+
log('🔍 Debug 資訊:', 'cyan');
|
|
222
|
+
log(` __dirname: ${__dirname}`, 'reset');
|
|
223
|
+
log(` __filename: ${__filename}`, 'reset');
|
|
224
|
+
log(` process.cwd(): ${process.cwd()}`, 'reset');
|
|
225
|
+
log(` sourceDir: ${sourceDir || '(未找到)'}`, 'reset');
|
|
226
|
+
log('', 'reset');
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// 檢查來源目錄是否存在
|
|
230
|
+
if (!sourceDir) {
|
|
231
|
+
log('', 'reset');
|
|
232
|
+
log('❌ 錯誤:找不到 .agent_agy 目錄', 'red');
|
|
233
|
+
log('', 'reset');
|
|
234
|
+
log('🔍 嘗試過的位置:', 'yellow');
|
|
235
|
+
log(` 1. ${path.join(__dirname, '..', '.agent_agy')}`, 'reset');
|
|
236
|
+
log(` 2. ${path.join(process.cwd(), '.agent_agy')}`, 'reset');
|
|
237
|
+
log(` 3. ${path.join(path.dirname(__dirname), '.agent_agy')}`, 'reset');
|
|
238
|
+
log('', 'reset');
|
|
239
|
+
log('💡 可能的原因:', 'cyan');
|
|
240
|
+
log(' 1. Package 尚未正確安裝', 'reset');
|
|
241
|
+
log(' 2. 檔案結構不完整', 'reset');
|
|
242
|
+
log('', 'reset');
|
|
243
|
+
log('🔧 解決方案:', 'cyan');
|
|
244
|
+
log(' 使用手動安裝方式:', 'reset');
|
|
245
|
+
log(' git clone https://github.com/vincent119/copilot-rules-kit.git /tmp/copilot-rules-kit', 'blue');
|
|
246
|
+
log(' mkdir -p .kiro/skills', 'blue');
|
|
247
|
+
log(' cp -r /tmp/copilot-rules-kit/.agent_agy/skills/* .kiro/skills/', 'blue');
|
|
248
|
+
log('', 'reset');
|
|
249
|
+
log('📖 完整安裝指南:', 'cyan');
|
|
250
|
+
log(' https://github.com/vincent119/copilot-rules-kit/blob/main/.agent_agy/INSTALLATION.md', 'blue');
|
|
251
|
+
process.exit(1);
|
|
252
|
+
}
|
|
186
253
|
|
|
187
254
|
// 如果沒有指定路徑,自動偵測
|
|
188
255
|
if (!options.path) {
|
package/package.json
CHANGED