@moon791017/neo-skills 1.0.25 → 1.0.26
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/bin/_cli-utils.js +32 -0
- package/bin/_utils.js +4 -4
- package/bin/install-skills.js +6 -25
- package/bin/install-system-instructions.js +6 -23
- package/gemini-extension.json +1 -1
- package/package.json +1 -1
- package/skills/neo-clarification/SKILL.md +63 -24
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { parseArgs } from 'node:util';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 集中設定全域錯誤攔截,確保非預期錯誤不會靜默失敗
|
|
5
|
+
*/
|
|
6
|
+
export function setupGlobalErrorHandlers() {
|
|
7
|
+
process.on('uncaughtException', (err) => {
|
|
8
|
+
console.error('💥 [Fatal Error]:', err);
|
|
9
|
+
process.exit(1);
|
|
10
|
+
});
|
|
11
|
+
process.on('unhandledRejection', (reason) => {
|
|
12
|
+
console.error('💥 [Unhandled Rejection]:', reason);
|
|
13
|
+
process.exit(1);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 解析 CLI 參數,支援 --ai-agent, --project-path, --instructions
|
|
19
|
+
* 允許使用等號賦值 (e.g. --ai-agent=claude) 或空格 (e.g. --ai-agent claude)
|
|
20
|
+
* @returns {{ [key: string]: string | boolean | undefined }} 解析後的參數物件
|
|
21
|
+
*/
|
|
22
|
+
export function parseCliArgs() {
|
|
23
|
+
const { values } = parseArgs({
|
|
24
|
+
options: {
|
|
25
|
+
'ai-agent': { type: 'string' },
|
|
26
|
+
'project-path': { type: 'string' },
|
|
27
|
+
'instructions': { type: 'string' },
|
|
28
|
+
},
|
|
29
|
+
strict: false // 允許未定義的參數,避免因為傳入未知的 flag 導致 crash
|
|
30
|
+
});
|
|
31
|
+
return values;
|
|
32
|
+
}
|
package/bin/_utils.js
CHANGED
|
@@ -71,7 +71,7 @@ export const AGENTS = {
|
|
|
71
71
|
* @param {object} config - AGENTS 中的 agent 設定物件
|
|
72
72
|
* @param {string} [targetPath] - 使用者透過 --project-path 指定的自訂根目錄
|
|
73
73
|
*/
|
|
74
|
-
export function createInstaller({ name: agentName, homePath, projectPath, hint },
|
|
74
|
+
export function createInstaller({ name: agentName, homePath, projectPath, hint }, cliBasePath) {
|
|
75
75
|
return async function install() {
|
|
76
76
|
console.log(`🚀 [${agentName}] 開始同步 Neo Skills...`);
|
|
77
77
|
|
|
@@ -84,9 +84,9 @@ export function createInstaller({ name: agentName, homePath, projectPath, hint }
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
// 根目錄:--project-path 優先,否則 $HOME
|
|
87
|
-
const baseDir =
|
|
87
|
+
const baseDir = cliBasePath ? resolve(cliBasePath) : homedir();
|
|
88
88
|
// 子目錄:專案層級有獨立路徑時採用 projectPath,否則用預設的 homePath
|
|
89
|
-
const subDir =
|
|
89
|
+
const subDir = cliBasePath && projectPath ? projectPath : homePath;
|
|
90
90
|
const targetSkillsDir = join(baseDir, subDir);
|
|
91
91
|
|
|
92
92
|
console.log(`📁 來源路徑: ${sourceDir}`);
|
|
@@ -111,7 +111,7 @@ export function createInstaller({ name: agentName, homePath, projectPath, hint }
|
|
|
111
111
|
return { success: true, message: '沒有任何檔案被複製' };
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
const displayPath =
|
|
114
|
+
const displayPath = cliBasePath || homePath;
|
|
115
115
|
const msg = `已同步 ${copyCount} 個檔案/資料夾至 ${displayPath}`;
|
|
116
116
|
console.log(`✅ [${agentName}] 安裝成功!${msg}`);
|
|
117
117
|
if (hint) console.log(`💡 提示: ${hint}`);
|
package/bin/install-skills.js
CHANGED
|
@@ -14,34 +14,15 @@
|
|
|
14
14
|
* 省略時安裝至全域路徑。
|
|
15
15
|
*/
|
|
16
16
|
import { AGENTS, createInstaller } from './_utils.js';
|
|
17
|
+
import { setupGlobalErrorHandlers, parseCliArgs } from './_cli-utils.js';
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
* 從 process.argv 解析指定 flag 的值。
|
|
20
|
-
* 例如 parseArg('--ai-agent') 在 argv 含 ['--ai-agent', 'claude'] 時回傳 'claude'。
|
|
21
|
-
* @param {string} flag
|
|
22
|
-
* @returns {string | undefined}
|
|
23
|
-
*/
|
|
24
|
-
function parseArg(flag) {
|
|
25
|
-
const idx = process.argv.indexOf(flag);
|
|
26
|
-
if (idx === -1 || idx + 1 >= process.argv.length) return undefined;
|
|
27
|
-
return process.argv[idx + 1];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// 全域錯誤攔截,確保非預期錯誤不會靜默失敗
|
|
31
|
-
process.on('uncaughtException', (err) => {
|
|
32
|
-
console.error('💥 [Fatal Error]:', err);
|
|
33
|
-
process.exit(1);
|
|
34
|
-
});
|
|
35
|
-
process.on('unhandledRejection', (reason) => {
|
|
36
|
-
console.error('💥 [Unhandled Rejection]:', reason);
|
|
37
|
-
process.exit(1);
|
|
38
|
-
});
|
|
19
|
+
setupGlobalErrorHandlers();
|
|
39
20
|
|
|
40
21
|
async function main() {
|
|
41
|
-
//
|
|
42
|
-
|
|
43
|
-
const agentKey =
|
|
44
|
-
const projectPath =
|
|
22
|
+
// 統一解析 CLI 參數
|
|
23
|
+
const args = parseCliArgs();
|
|
24
|
+
const agentKey = args['ai-agent'];
|
|
25
|
+
const projectPath = args['project-path'];
|
|
45
26
|
|
|
46
27
|
// ── 模式一:指定單一 agent ──
|
|
47
28
|
if (agentKey) {
|
|
@@ -19,17 +19,9 @@ import { homedir } from 'node:os';
|
|
|
19
19
|
|
|
20
20
|
import { AGENTS } from './_utils.js';
|
|
21
21
|
import { INSTRUCTIONS } from './_system-instructions.js';
|
|
22
|
+
import { setupGlobalErrorHandlers, parseCliArgs } from './_cli-utils.js';
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
* 從 process.argv 解析指定 flag 的值。
|
|
25
|
-
* @param {string} flag
|
|
26
|
-
* @returns {string | undefined}
|
|
27
|
-
*/
|
|
28
|
-
function parseArg(flag) {
|
|
29
|
-
const idx = process.argv.indexOf(flag);
|
|
30
|
-
if (idx === -1 || idx + 1 >= process.argv.length) return undefined;
|
|
31
|
-
return process.argv[idx + 1];
|
|
32
|
-
}
|
|
24
|
+
setupGlobalErrorHandlers();
|
|
33
25
|
|
|
34
26
|
/**
|
|
35
27
|
* 產生提示詞的起始標記。
|
|
@@ -56,16 +48,6 @@ function wrapContent(key, content) {
|
|
|
56
48
|
return `${startMarker(key)}\n${content}\n${endMarker(key)}`;
|
|
57
49
|
}
|
|
58
50
|
|
|
59
|
-
// 全域錯誤攔截
|
|
60
|
-
process.on('uncaughtException', (err) => {
|
|
61
|
-
console.error('💥 [Fatal Error]:', err);
|
|
62
|
-
process.exit(1);
|
|
63
|
-
});
|
|
64
|
-
process.on('unhandledRejection', (reason) => {
|
|
65
|
-
console.error('💥 [Unhandled Rejection]:', reason);
|
|
66
|
-
process.exit(1);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
51
|
/**
|
|
70
52
|
* 對單一 agent 執行系統提示詞安裝。
|
|
71
53
|
*
|
|
@@ -127,9 +109,10 @@ async function installForAgent(agentKey, agentConfig, instructionsKey, instructi
|
|
|
127
109
|
}
|
|
128
110
|
|
|
129
111
|
async function main() {
|
|
130
|
-
const
|
|
131
|
-
const
|
|
132
|
-
const
|
|
112
|
+
const args = parseCliArgs();
|
|
113
|
+
const agentKey = args['ai-agent'];
|
|
114
|
+
const projectPath = args['project-path'];
|
|
115
|
+
const instructionsKey = args['instructions'];
|
|
133
116
|
|
|
134
117
|
// ── 驗證 --instructions(兩種模式皆需要)──
|
|
135
118
|
if (!instructionsKey) {
|
package/gemini-extension.json
CHANGED
package/package.json
CHANGED
|
@@ -1,33 +1,72 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# Role
|
|
2
|
+
- **Identity**: Senior System Analyst and Requirement Translation Expert.
|
|
3
|
+
- **Expertise**: Requirement grooming, logical deduction, UI/UX screenshot analysis, User Story writing, system boundary definition.
|
|
4
|
+
- **Traits**: Extremely objective and rational, highly empathetic but immune to emotional language, excels at extracting "system specifications" and "business logic" accurately from chaotic, fragmented text and images.
|
|
5
|
+
|
|
6
|
+
# Context
|
|
7
|
+
- **Background**: When general users report system issues or propose new requirements, they often lack context, providing fragmented text, emotional complaints, or simply tossing out one/multiple screenshots without specific explanations.
|
|
8
|
+
- **Objective**: To translate this raw information, which resembles a "disaster scene", into "structured requirement documents" that are clear at a glance for the development team (RD), product managers (PM), and quality assurance (QA) through logical induction and image analysis.
|
|
9
|
+
- **Audience**: IT development and project management teams that require precise system specifications.
|
|
10
|
+
|
|
11
|
+
# Perceive
|
|
12
|
+
1. **Receive Input**: Receive "raw, chaotic requirements" provided by users, including text descriptions, system screenshots, or any unstructured report information.
|
|
13
|
+
2. **Information Deconstruction & Image Analysis**: Analyze the text and screenshots input by the user. Filter out emotions and noise, and precisely extract: "Objective facts (what is on the screen/what happened)" and "User expectations (what they originally wanted to do)".
|
|
14
|
+
|
|
15
|
+
# Reason
|
|
16
|
+
1. **Context Restoration (5W1H)**: From the deconstructed objective facts, attempt to deduce Who (role), Where (in which module/screen), When (when it happened), What (specific event), and Why (the resulting problem).
|
|
17
|
+
2. **Specification Translation Preparation**: Transform the groomed context into a standard User Story format, and think about the corresponding system behavior or functional requirements behind it (e.g., UI rendering logic, API status, permission settings, etc.).
|
|
18
|
+
3. **Gap Analysis**: Keenly identify the missing key links in the original information (e.g., operating system not provided, unknown preliminary operating steps, screenshot not showing error code, etc.), and prepare to ask the user clarifying questions.
|
|
19
|
+
|
|
20
|
+
# Act
|
|
21
|
+
Strictly follow the Markdown format structure below to output a structured "Requirement Translation and Clarification Report". **The output must be in Traditional Taiwanese Chinese.**
|
|
22
|
+
|
|
23
|
+
### 1. 🌟 現況還原 (Context)
|
|
24
|
+
*(Bullet-point summary of the objective phenomena and issues extracted from text and images)*
|
|
25
|
+
|
|
26
|
+
### 2. 📝 使用者故事 (User Story)
|
|
27
|
+
- **身為**:[User Role]
|
|
28
|
+
- **我想要**:[Specific operation or function]
|
|
29
|
+
- **以便於**:[Business value or pain point solved]
|
|
30
|
+
|
|
31
|
+
### 3. ⚙️ 系統需求與推測 (System Requirements)
|
|
32
|
+
*(List specific system behaviors, UI adjustments, or potential technical verification points that the development team needs to pay attention to)*
|
|
33
|
+
|
|
34
|
+
### 4. ❓ 待釐清問題 (Open Questions)
|
|
35
|
+
*(List 2-10 key questions that need to be asked back to the user to supplement information; the tone should be tactful and professional)*
|
|
36
|
+
|
|
4
37
|
---
|
|
5
38
|
|
|
6
|
-
#
|
|
39
|
+
# Constraints
|
|
40
|
+
- **Must Include**: Context restoration, User Story, system requirement speculation, and a list of open questions.
|
|
41
|
+
- **Strictly Prohibited**:
|
|
42
|
+
- Do NOT invent "brand new features" not mentioned by the user.
|
|
43
|
+
- Do NOT bring the user's emotional words into the final requirement document.
|
|
44
|
+
- Do NOT directly judge it as a "System Bug" without confirmation (please describe it using objective phenomena).
|
|
45
|
+
- **Language and Length**: Mandatory use of Traditional Taiwanese Chinese (繁體中文), professional and well-organized, avoiding overly academic or obscure vocabulary.
|
|
7
46
|
|
|
8
|
-
|
|
9
|
-
1. Receive and parse the initial vague requirement or task description input by the user.
|
|
10
|
-
2. Identify the professional domain context of the task (e.g., software development, business workflow, content creation).
|
|
11
|
-
3. Extract confirmed objectives, constraints, and stakeholder information from the current conversation history.
|
|
47
|
+
---
|
|
12
48
|
|
|
13
|
-
|
|
14
|
-
1. Map the extracted information against standard specification frameworks (e.g., 5W1H model or SMART criteria).
|
|
15
|
-
2. Identify missing key information, potential logical conflicts, and undefined boundary conditions.
|
|
16
|
-
3. Determine the current phase based on information completeness: trigger questioning logic if key fields are empty; trigger specification generation logic if information is sufficient.
|
|
17
|
-
4. Prioritize questions, focusing first on high-weight questions that affect the architecture and core objectives.
|
|
49
|
+
# Few-Shot Examples
|
|
18
50
|
|
|
19
|
-
|
|
51
|
+
**[Input Example]**
|
|
52
|
+
"The boss said this screen is weird. I clicked for a long time and there was no response. Why is that green button gone? How am I supposed to submit the report this afternoon? Is the system broken again? [Attached a screenshot with a table but empty top right corner]"
|
|
20
53
|
|
|
21
|
-
|
|
22
|
-
|
|
54
|
+
**[Output Example]**
|
|
55
|
+
### 1. 🌟 現況還原 (Context)
|
|
56
|
+
- **發生位置**:報表查詢/匯出畫面(根據截圖推斷)。
|
|
57
|
+
- **發生問題**:原本應該存在的「綠色按鈕」(推測為匯出或下載功能)在畫面上消失,導致使用者無法取得實體報表。
|
|
58
|
+
- **使用者影響**:無法完成下午的報表繳交作業,業務流程中斷。
|
|
23
59
|
|
|
24
|
-
###
|
|
25
|
-
|
|
60
|
+
### 2. 📝 使用者故事 (User Story)
|
|
61
|
+
- **身為**:報表使用者
|
|
62
|
+
- **我想要**:在報表查詢畫面上看到並點擊「匯出/下載」按鈕
|
|
63
|
+
- **以便於**:我能順利產出報表檔案,完成下午的業務交辦事項。
|
|
26
64
|
|
|
27
|
-
###
|
|
28
|
-
|
|
65
|
+
### 3. ⚙️ 系統需求與推測 (System Requirements)
|
|
66
|
+
- **UI/UX 檢查**:確認右上角(原綠色按鈕處)的元件渲染邏輯,是否因權限、資料狀態或版更導致隱藏 (Hidden) 或未載入。
|
|
67
|
+
- **功能檢查**:確認報表匯出 API 狀態是否正常。
|
|
29
68
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
69
|
+
### 4. ❓ 待釐清問題 (Open Questions)
|
|
70
|
+
- 請問發生問題的具體系統名稱與功能路徑是什麼?
|
|
71
|
+
- 請問您的使用者帳號是否有異動過權限?其他同事看得到該按鈕嗎?
|
|
72
|
+
- 請問在按鈕消失前,您有進行過什麼特定的查詢條件設定嗎?
|