6a-spec-install 1.0.1-dev.2 → 1.0.1-dev.20
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/.6aspec/rules/6A/6A_code_implementation_sop.md +65 -0
- package/.6aspec/rules/6A/6A_import_model_table_sop.md +96 -0
- package/.6aspec/rules/6A/6A_init_event_list_sop.md +62 -0
- package/.6aspec/rules/6A/6A_init_map_sop.md +79 -0
- package/.6aspec/rules/6A/6A_model_sop.md +139 -0
- package/.6aspec/rules/6A/6A_new_feature_sop.md +174 -0
- package/.6aspec/rules/6A/6A_task_sop.md +137 -0
- package/{.cursor → .6aspec}/rules/6A/6A_visual_logic_sop.md +2 -2
- package/.6aspec/rules/biz/c_user_system_rule.md +240 -0
- package/.6aspec/script/create_entities_from_markdown.py +688 -0
- package/.claude/commands/6A/6A-execute-task.md +20 -0
- package/.claude/commands/6A/6A-import-model-table.md +8 -0
- package/.claude/commands/6A/6A-init.md +14 -0
- package/.claude/commands/6A/6A-model.md +11 -0
- package/.claude/commands/6A/6A-new.md +7 -0
- package/.claude/commands/6A/6A-task.md +7 -0
- package/.claude/commands/6A/6A-visual-logic.md +9 -0
- package/.cursor/commands/6A-execute-task.md +21 -0
- package/.cursor/commands/6A-import-model-table.md +9 -0
- package/.cursor/commands/6A-init.md +15 -0
- package/.cursor/commands/6A-model.md +7 -3
- package/.cursor/commands/6A-new.md +1 -1
- package/.cursor/commands/6A-task.md +1 -1
- package/.cursor/commands/6A-visual-logic.md +1 -1
- package/lib/installer.js +96 -56
- package/package.json +3 -1
- package/.cursor/commands/6A-excel-table-gen.md +0 -9
- package/.cursor/commands/execute-task.md +0 -9
- package/.cursor/rules/6A/6A_export_table_to_excel_sop.md +0 -133
- package/.cursor/rules/6A/6A_model_sop.md +0 -91
- package/.cursor/rules/6A/6A_new_feature.md +0 -255
- package/.cursor/rules/6A/6A_new_feature_sop.md +0 -168
- package/.cursor/rules/6A/6A_task_sop.md +0 -106
- package/.cursor/rules/biz/event-list.md +0 -9742
- package/.cursor/rules/biz/functional-capability-Map.md +0 -12
- package/.cursor/script/md_to_excel.py +0 -376
- /package/{.cursor → .6aspec}/rules/biz/api_rule.md +0 -0
- /package/{.cursor → .6aspec}/rules/biz/background_job_rule.md +0 -0
- /package/{.cursor → .6aspec}/rules/biz/code.md +0 -0
- /package/{.cursor → .6aspec}/rules/biz/event_subscriber_rule.md +0 -0
- /package/{.cursor → .6aspec}/rules/biz/project-structure.md +0 -0
- /package/{.cursor → .6aspec}/rules/biz/scheduled_job_rule.md +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 6A-code: 执行开发任务 (Execute Task)
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# 执行开发任务指令
|
|
6
|
+
|
|
7
|
+
该指令用于触发标准化的代码实现流程。
|
|
8
|
+
|
|
9
|
+
## 触发动作
|
|
10
|
+
当用户提供一个任务文件路径(如 `@task_01_api_xxx.md`)并要求“执行任务”时:
|
|
11
|
+
|
|
12
|
+
1. **激活角色**:切换至 `Senior Developer` 角色。
|
|
13
|
+
2. **调用 SOP**:严格遵循 `.6aspec/rules/6A/6A_code_implementation_sop.md` 中的协议。
|
|
14
|
+
- **Step 0**: 上下文加载 (Task + TDD + Rules)
|
|
15
|
+
- **Step 1**: 自底向上编码 (DTO -> Repo -> Service -> API)
|
|
16
|
+
- **Step 2**: 质量检查 (Lint)
|
|
17
|
+
- **Step 3**: 状态更新 (Task File + README)
|
|
18
|
+
|
|
19
|
+
## 快捷指令参数
|
|
20
|
+
用户可以直接输入:`6A-exec @task_file`
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 6A-import-model-table workflow
|
|
3
|
+
---
|
|
4
|
+
1. Immediate response upon activation: 6A-import-model-table workflow has been activated
|
|
5
|
+
2. Read file: `.6aspec/rules/6A/6A_import_model_table_sop.md`
|
|
6
|
+
3. Strictly follow the "Import Model Table SOP" defined in that file
|
|
7
|
+
4. Execute the python script to import entities
|
|
8
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Init Project Artifacts (Functional Map & Event List)
|
|
3
|
+
---
|
|
4
|
+
Immediate response upon activation: Project Artifacts Initialization workflow has been activated.
|
|
5
|
+
|
|
6
|
+
Phase 1: Functional Capability Map
|
|
7
|
+
1. Read file: `.6aspec/rules/6A/6A_init_map_sop.md`
|
|
8
|
+
2. Strictly follow the "Init Functional Capability Map SOP" defined in that file.
|
|
9
|
+
3. Execute the codebase scan and update the artifact at `.6aspec/biz/functional-capability-Map.md`.
|
|
10
|
+
|
|
11
|
+
Phase 2: Event List
|
|
12
|
+
1. Read file: `.6aspec/rules/6A/6A_init_event_list_sop.md`
|
|
13
|
+
2. Strictly follow the "Event List Generation SOP" defined in that file.
|
|
14
|
+
3. Execute the codebase scan and update the artifact at `.6aspec/biz/event-list.md`.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 6A-model workflow
|
|
3
|
+
---
|
|
4
|
+
1. Immediate response upon activation: 6A-model workflow has been activated
|
|
5
|
+
2. **Context Restriction**:
|
|
6
|
+
- Do NOT perform `codebase_search`.
|
|
7
|
+
- Do NOT read any files unless they are explicitly provided by the user (via '@') or explicitly listed in the SOP steps.
|
|
8
|
+
- Stop and ask the user if you think you need more information.
|
|
9
|
+
3. Read file: `.6aspec/rules/6A/6A_model_sop.md`
|
|
10
|
+
4. Strictly follow the "Domain modeling and database design Architecture SOP" defined in that file
|
|
11
|
+
5. Output the Domain model and table design
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 6A-new workflow
|
|
3
|
+
---
|
|
4
|
+
1. Immediate response upon activation: 6A-new workflow has been activated.
|
|
5
|
+
2. Read file: `.6aspec/rules/6A/6A_new_feature_sop.md`
|
|
6
|
+
3. Strictly follow the "New Feature Architecture SOP" defined in that file.
|
|
7
|
+
4. Output the Technical Design Document (TDD).
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 6A-visual-logic workflow
|
|
3
|
+
---
|
|
4
|
+
1. Immediate response upon activation: 6A-visual-logic workflow has been activated.
|
|
5
|
+
2. Read file: `.6aspec/rules/6A/6A_visual_logic_sop.md`.
|
|
6
|
+
3. Strictly follow the "Visual Logic Diagrams SOP" defined in that file.
|
|
7
|
+
4. Output Mermaid diagrams as specified in the SOP.
|
|
8
|
+
|
|
9
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 6A-code: 执行开发任务 (Execute Task)
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 执行开发任务指令
|
|
7
|
+
|
|
8
|
+
该指令用于触发标准化的代码实现流程。
|
|
9
|
+
|
|
10
|
+
## 触发动作
|
|
11
|
+
当用户提供一个任务文件路径(如 `@task_01_api_xxx.md`)并要求“执行任务”时:
|
|
12
|
+
|
|
13
|
+
1. **激活角色**:切换至 `Senior Developer` 角色。
|
|
14
|
+
2. **调用 SOP**:严格遵循 `.6aspec/rules/6A/6A_code_implementation_sop.md` 中的协议。
|
|
15
|
+
- **Step 0**: 上下文加载 (Task + TDD + Rules)
|
|
16
|
+
- **Step 1**: 自底向上编码 (DTO -> Repo -> Service -> API)
|
|
17
|
+
- **Step 2**: 质量检查 (Lint)
|
|
18
|
+
- **Step 3**: 状态更新 (Task File + README)
|
|
19
|
+
|
|
20
|
+
## 快捷指令参数
|
|
21
|
+
用户可以直接输入:`6A-exec @task_file`
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 6A-import-model-table workflow
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
1. Immediate response upon activation: 6A-import-model-table workflow has been activated
|
|
6
|
+
2. Read file: `.6aspec/rules/6A/6A_import_model_table_sop.md`
|
|
7
|
+
3. Strictly follow the "Import Model Table SOP" defined in that file
|
|
8
|
+
4. Execute the python script to import entities
|
|
9
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Init Project Artifacts (Functional Map & Event List)
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
Immediate response upon activation: Project Artifacts Initialization workflow has been activated.
|
|
6
|
+
|
|
7
|
+
Phase 1: Functional Capability Map
|
|
8
|
+
1. Read file: `.6aspec/rules/6A/6A_init_map_sop.md`
|
|
9
|
+
2. Strictly follow the "Init Functional Capability Map SOP" defined in that file.
|
|
10
|
+
3. Execute the codebase scan and update the artifact at `.6aspec/biz/functional-capability-Map.md`.
|
|
11
|
+
|
|
12
|
+
Phase 2: Event List
|
|
13
|
+
1. Read file: `.6aspec/rules/6A/6A_init_event_list_sop.md`
|
|
14
|
+
2. Strictly follow the "Event List Generation SOP" defined in that file.
|
|
15
|
+
3. Execute the codebase scan and update the artifact at `.6aspec/biz/event-list.md`.
|
|
@@ -3,6 +3,10 @@ description: 6A-model workflow
|
|
|
3
3
|
alwaysApply: false
|
|
4
4
|
---
|
|
5
5
|
1. Immediate response upon activation: 6A-model workflow has been activated
|
|
6
|
-
2.
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
2. **Context Restriction**:
|
|
7
|
+
- Do NOT perform `codebase_search`.
|
|
8
|
+
- Do NOT read any files unless they are explicitly provided by the user (via '@') or explicitly listed in the SOP steps.
|
|
9
|
+
- Stop and ask the user if you think you need more information.
|
|
10
|
+
3. Read file: `.6aspec/rules/6A/6A_model_sop.md`
|
|
11
|
+
4. Strictly follow the "Domain modeling and database design Architecture SOP" defined in that file
|
|
12
|
+
5. Output the Domain model and table design
|
|
@@ -3,6 +3,6 @@ description: 6A-new workflow
|
|
|
3
3
|
alwaysApply: false
|
|
4
4
|
---
|
|
5
5
|
1. Immediate response upon activation: 6A-new workflow has been activated.
|
|
6
|
-
2. Read file: `.
|
|
6
|
+
2. Read file: `.6aspec/rules/6A/6A_new_feature_sop.md`
|
|
7
7
|
3. Strictly follow the "New Feature Architecture SOP" defined in that file.
|
|
8
8
|
4. Output the Technical Design Document (TDD).
|
|
@@ -3,6 +3,6 @@ description: 6A-task workflow
|
|
|
3
3
|
alwaysApply: false
|
|
4
4
|
---
|
|
5
5
|
1. Immediate response upon activation: 6A-task workflow has been activated
|
|
6
|
-
2. Read file: `.
|
|
6
|
+
2. Read file: `.6aspec/rules/6A/6A_task_sop.md`
|
|
7
7
|
3. Strictly follow the "Task Decomposition SOP" defined in that file
|
|
8
8
|
4. Output the task list
|
|
@@ -3,7 +3,7 @@ description: 6A-visual-logic workflow
|
|
|
3
3
|
alwaysApply: false
|
|
4
4
|
---
|
|
5
5
|
1. Immediate response upon activation: 6A-visual-logic workflow has been activated.
|
|
6
|
-
2. Read file: `.
|
|
6
|
+
2. Read file: `.6aspec/rules/6A/6A_visual_logic_sop.md`.
|
|
7
7
|
3. Strictly follow the "Visual Logic Diagrams SOP" defined in that file.
|
|
8
8
|
4. Output Mermaid diagrams as specified in the SOP.
|
|
9
9
|
|
package/lib/installer.js
CHANGED
|
@@ -12,21 +12,23 @@ class Installer {
|
|
|
12
12
|
// 查找包目录(支持本地开发和 npm 安装)
|
|
13
13
|
findPackageDir() {
|
|
14
14
|
// 如果是本地开发,直接使用当前目录
|
|
15
|
-
if (fs.existsSync(path.join(__dirname, '../.
|
|
15
|
+
if (fs.existsSync(path.join(__dirname, '../.6aspec')) ||
|
|
16
|
+
fs.existsSync(path.join(__dirname, '../.cursor'))) {
|
|
16
17
|
return path.join(__dirname, '..');
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
// 如果是 npm 安装,查找 node_modules
|
|
20
21
|
let current = __dirname;
|
|
21
22
|
while (current !== path.dirname(current)) {
|
|
23
|
+
const sixaspecPath = path.join(current, '.6aspec');
|
|
22
24
|
const cursorPath = path.join(current, '.cursor');
|
|
23
|
-
if (fs.existsSync(cursorPath)) {
|
|
25
|
+
if (fs.existsSync(sixaspecPath) || fs.existsSync(cursorPath)) {
|
|
24
26
|
return current;
|
|
25
27
|
}
|
|
26
28
|
current = path.dirname(current);
|
|
27
29
|
}
|
|
28
30
|
|
|
29
|
-
throw new Error('未找到 .cursor 目录,请确保包已正确安装');
|
|
31
|
+
throw new Error('未找到 .6aspec 或 .cursor 目录,请确保包已正确安装');
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
// 颜色输出
|
|
@@ -51,11 +53,31 @@ class Installer {
|
|
|
51
53
|
return null;
|
|
52
54
|
}
|
|
53
55
|
|
|
56
|
+
// 递归删除目录
|
|
57
|
+
removeDir(dirPath) {
|
|
58
|
+
if (fs.existsSync(dirPath)) {
|
|
59
|
+
const entries = fs.readdirSync(dirPath, { withFileTypes: true });
|
|
60
|
+
for (const entry of entries) {
|
|
61
|
+
const fullPath = path.join(dirPath, entry.name);
|
|
62
|
+
if (entry.isDirectory()) {
|
|
63
|
+
this.removeDir(fullPath);
|
|
64
|
+
} else {
|
|
65
|
+
fs.unlinkSync(fullPath);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
fs.rmdirSync(dirPath);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
54
72
|
// 递归复制目录(完全覆盖模式)
|
|
55
73
|
copyDir(src, dest) {
|
|
56
|
-
|
|
57
|
-
|
|
74
|
+
// 如果目标目录存在,先完全删除(确保完全覆盖)
|
|
75
|
+
if (fs.existsSync(dest)) {
|
|
76
|
+
this.removeDir(dest);
|
|
58
77
|
}
|
|
78
|
+
|
|
79
|
+
// 重新创建目录并复制
|
|
80
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
59
81
|
|
|
60
82
|
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
61
83
|
|
|
@@ -125,15 +147,16 @@ class Installer {
|
|
|
125
147
|
return files;
|
|
126
148
|
}
|
|
127
149
|
|
|
128
|
-
//
|
|
129
|
-
|
|
130
|
-
this.log('
|
|
150
|
+
// 安装公共配置 (.6aspec)
|
|
151
|
+
install6aspec() {
|
|
152
|
+
this.log('开始安装公共配置 (.6aspec)...');
|
|
131
153
|
|
|
132
|
-
const sourceDir = path.join(this.packageDir, '.
|
|
133
|
-
const targetDir = path.join(this.targetDir, '.
|
|
154
|
+
const sourceDir = path.join(this.packageDir, '.6aspec');
|
|
155
|
+
const targetDir = path.join(this.targetDir, '.6aspec');
|
|
134
156
|
|
|
135
157
|
if (!fs.existsSync(sourceDir)) {
|
|
136
|
-
|
|
158
|
+
this.log('未找到 .6aspec 源目录,跳过', 'warn');
|
|
159
|
+
return;
|
|
137
160
|
}
|
|
138
161
|
|
|
139
162
|
const targetExists = fs.existsSync(targetDir);
|
|
@@ -162,10 +185,57 @@ class Installer {
|
|
|
162
185
|
if (targetExists) {
|
|
163
186
|
this.backupDir(targetDir);
|
|
164
187
|
}
|
|
165
|
-
this.log('
|
|
188
|
+
this.log('复制公共配置文件...');
|
|
166
189
|
this.copyDir(sourceDir, targetDir);
|
|
167
190
|
}
|
|
168
191
|
|
|
192
|
+
this.log('✓ 公共配置安装完成!', 'success');
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// 安装 Cursor 配置
|
|
196
|
+
installCursor() {
|
|
197
|
+
this.log('开始安装 Cursor 配置...');
|
|
198
|
+
|
|
199
|
+
const sourceDir = path.join(this.packageDir, '.cursor');
|
|
200
|
+
const targetDir = path.join(this.targetDir, '.cursor');
|
|
201
|
+
|
|
202
|
+
if (!fs.existsSync(sourceDir)) {
|
|
203
|
+
throw new Error('未找到 .cursor 源目录');
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const targetExists = fs.existsSync(targetDir);
|
|
207
|
+
|
|
208
|
+
if (this.mergeMode && targetExists) {
|
|
209
|
+
// 智能合并模式
|
|
210
|
+
this.log('使用智能合并模式(保留用户自定义文件)...');
|
|
211
|
+
|
|
212
|
+
// 只复制 commands 目录
|
|
213
|
+
const commandsSourceDir = path.join(sourceDir, 'commands');
|
|
214
|
+
if (fs.existsSync(commandsSourceDir)) {
|
|
215
|
+
const commandsTargetDir = path.join(targetDir, 'commands');
|
|
216
|
+
const result = this.mergeDir(commandsSourceDir, commandsTargetDir);
|
|
217
|
+
this.log(`commands: 更新了 ${result.updated} 个文件,新增了 ${result.added} 个文件`, 'info');
|
|
218
|
+
}
|
|
219
|
+
} else {
|
|
220
|
+
// 完全覆盖模式
|
|
221
|
+
if (targetExists) {
|
|
222
|
+
this.backupDir(targetDir);
|
|
223
|
+
}
|
|
224
|
+
this.log('复制 Cursor 配置文件...');
|
|
225
|
+
|
|
226
|
+
// 创建目标目录
|
|
227
|
+
if (!fs.existsSync(targetDir)) {
|
|
228
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// 只复制 commands 目录
|
|
232
|
+
const commandsSourceDir = path.join(sourceDir, 'commands');
|
|
233
|
+
if (fs.existsSync(commandsSourceDir)) {
|
|
234
|
+
const commandsTargetDir = path.join(targetDir, 'commands');
|
|
235
|
+
this.copyDir(commandsSourceDir, commandsTargetDir);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
169
239
|
this.log('✓ Cursor 配置安装完成!', 'success');
|
|
170
240
|
}
|
|
171
241
|
|
|
@@ -173,11 +243,12 @@ class Installer {
|
|
|
173
243
|
installClaude() {
|
|
174
244
|
this.log('开始安装 Claude 配置...');
|
|
175
245
|
|
|
176
|
-
const sourceDir = path.join(this.packageDir, '.
|
|
246
|
+
const sourceDir = path.join(this.packageDir, '.claude');
|
|
177
247
|
const targetDir = path.join(this.targetDir, '.claude');
|
|
178
248
|
|
|
179
249
|
if (!fs.existsSync(sourceDir)) {
|
|
180
|
-
|
|
250
|
+
this.log('未找到 .claude 源目录,跳过', 'warn');
|
|
251
|
+
return;
|
|
181
252
|
}
|
|
182
253
|
|
|
183
254
|
const targetExists = fs.existsSync(targetDir);
|
|
@@ -191,33 +262,13 @@ class Installer {
|
|
|
191
262
|
// 智能合并模式
|
|
192
263
|
this.log('使用智能合并模式(保留用户自定义文件)...');
|
|
193
264
|
|
|
194
|
-
// 复制 commands
|
|
265
|
+
// 复制 commands
|
|
195
266
|
const commandsDir = path.join(sourceDir, 'commands');
|
|
196
267
|
if (fs.existsSync(commandsDir)) {
|
|
197
|
-
const
|
|
198
|
-
const result = this.mergeDir(commandsDir,
|
|
199
|
-
if (result.updated > 0 || result.added > 0) {
|
|
200
|
-
this.log(`prompts: 更新了 ${result.updated} 个文件,新增了 ${result.added} 个文件`, 'info');
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// 复制 rules
|
|
205
|
-
const rulesDir = path.join(sourceDir, 'rules');
|
|
206
|
-
if (fs.existsSync(rulesDir)) {
|
|
207
|
-
const targetRulesDir = path.join(targetDir, 'rules');
|
|
208
|
-
const result = this.mergeDir(rulesDir, targetRulesDir);
|
|
268
|
+
const targetCommandsDir = path.join(targetDir, 'commands');
|
|
269
|
+
const result = this.mergeDir(commandsDir, targetCommandsDir);
|
|
209
270
|
if (result.updated > 0 || result.added > 0) {
|
|
210
|
-
this.log(`
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
// 复制 scripts
|
|
215
|
-
const scriptDir = path.join(sourceDir, 'script');
|
|
216
|
-
if (fs.existsSync(scriptDir)) {
|
|
217
|
-
const targetScriptDir = path.join(targetDir, 'script');
|
|
218
|
-
const result = this.mergeDir(scriptDir, targetScriptDir);
|
|
219
|
-
if (result.updated > 0 || result.added > 0) {
|
|
220
|
-
this.log(`script: 更新了 ${result.updated} 个文件,新增了 ${result.added} 个文件`, 'info');
|
|
271
|
+
this.log(`commands: 更新了 ${result.updated} 个文件,新增了 ${result.added} 个文件`, 'info');
|
|
221
272
|
}
|
|
222
273
|
}
|
|
223
274
|
} else {
|
|
@@ -225,27 +276,13 @@ class Installer {
|
|
|
225
276
|
if (targetExists) {
|
|
226
277
|
this.backupDir(targetDir);
|
|
227
278
|
}
|
|
228
|
-
this.log('
|
|
279
|
+
this.log('复制 Claude 配置文件...');
|
|
229
280
|
|
|
230
|
-
// 复制 commands
|
|
281
|
+
// 复制 commands
|
|
231
282
|
const commandsDir = path.join(sourceDir, 'commands');
|
|
232
283
|
if (fs.existsSync(commandsDir)) {
|
|
233
|
-
const
|
|
234
|
-
this.copyDir(commandsDir,
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
// 复制 rules
|
|
238
|
-
const rulesDir = path.join(sourceDir, 'rules');
|
|
239
|
-
if (fs.existsSync(rulesDir)) {
|
|
240
|
-
const targetRulesDir = path.join(targetDir, 'rules');
|
|
241
|
-
this.copyDir(rulesDir, targetRulesDir);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// 复制 scripts
|
|
245
|
-
const scriptDir = path.join(sourceDir, 'script');
|
|
246
|
-
if (fs.existsSync(scriptDir)) {
|
|
247
|
-
const targetScriptDir = path.join(targetDir, 'script');
|
|
248
|
-
this.copyDir(scriptDir, targetScriptDir);
|
|
284
|
+
const targetCommandsDir = path.join(targetDir, 'commands');
|
|
285
|
+
this.copyDir(commandsDir, targetCommandsDir);
|
|
249
286
|
}
|
|
250
287
|
}
|
|
251
288
|
|
|
@@ -266,6 +303,9 @@ class Installer {
|
|
|
266
303
|
}
|
|
267
304
|
|
|
268
305
|
try {
|
|
306
|
+
// 无论安装哪个工具,都要先安装公共配置
|
|
307
|
+
this.install6aspec();
|
|
308
|
+
|
|
269
309
|
switch (tool.toLowerCase()) {
|
|
270
310
|
case 'cursor':
|
|
271
311
|
this.installCursor();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "6a-spec-install",
|
|
3
|
-
"version": "1.0.1-dev.
|
|
3
|
+
"version": "1.0.1-dev.20",
|
|
4
4
|
"description": "6A-spec 驱动开发提示词安装工具,支持 Cursor 和 Claude",
|
|
5
5
|
"main": "lib/installer.js",
|
|
6
6
|
"bin": {
|
|
@@ -48,6 +48,8 @@
|
|
|
48
48
|
"bin/",
|
|
49
49
|
"lib/",
|
|
50
50
|
".cursor/",
|
|
51
|
+
".claude/",
|
|
52
|
+
".6aspec/",
|
|
51
53
|
"README.md"
|
|
52
54
|
],
|
|
53
55
|
"engines": {
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: 6A-export-table workflow
|
|
3
|
-
alwaysApply: false
|
|
4
|
-
---
|
|
5
|
-
1. Immediate response upon activation: 6A-export-table workflow has been activated.
|
|
6
|
-
2. Read file: `.cursor/rules/6A/6A_export_table_to_excel_sop.md`.
|
|
7
|
-
3. Strictly and exclusively follow the "Excel file generation SOP" defined in that file.
|
|
8
|
-
4. Do not invent, infer, or supplement any rules beyond the SOP.
|
|
9
|
-
5. Output Excel files exactly as specified in the SOP.
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: 从Markdown文档提取表结构并生成Excel文件的标准操作流程 (Export table schema from Markdown to Excel SOP)
|
|
3
|
-
alwaysApply: false
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# 6A-export-table: 从Markdown文档提取表结构并生成Excel文件的标准操作流程
|
|
7
|
-
|
|
8
|
-
## 角色
|
|
9
|
-
你现在的角色是【文档处理专家 + 自动化工具执行者】,负责从Markdown文档中提取表结构设计信息,并自动生成标准化的Excel文件。
|
|
10
|
-
|
|
11
|
-
## 目标
|
|
12
|
-
从包含表结构设计的Markdown文档中提取所有表定义,为每个表生成一个格式化的Excel文件,便于后续的数据建模、开发参考和文档归档。
|
|
13
|
-
|
|
14
|
-
## 规则
|
|
15
|
-
1. **严格遵循脚本规范**:必须使用提供的Python脚本 `.cursor/script/md_to_excel.py`,不得自行编写或修改脚本逻辑
|
|
16
|
-
2. **输入验证**:执行前必须验证Markdown文件存在且可读
|
|
17
|
-
3. **输出验证**:执行后必须验证Excel文件是否成功生成
|
|
18
|
-
4. **错误处理**:如遇到错误,必须提供清晰的错误信息和解决建议
|
|
19
|
-
5. **路径处理**:所有文件路径必须使用绝对路径或相对于工作区根目录的路径
|
|
20
|
-
|
|
21
|
-
## 输入要求
|
|
22
|
-
- **必需输入**:
|
|
23
|
-
- Markdown文档路径(包含表结构设计的文档)
|
|
24
|
-
- 输出目录路径(可选,默认为当前目录)
|
|
25
|
-
- **Markdown文档格式要求**:
|
|
26
|
-
- 表定义必须以 `##### 数字. 表名 (表英文名)` 格式开头
|
|
27
|
-
- 必须包含表信息表格(表中文名称 | 表英文名称)
|
|
28
|
-
- 必须包含字段信息表格(字段中文名称 | 字段英文名称 | 字段类型 | 是否必填 | 字段说明)
|
|
29
|
-
|
|
30
|
-
## 标准操作流程 (SOP)
|
|
31
|
-
|
|
32
|
-
### 第一步:确认输入参数
|
|
33
|
-
1. **验证Markdown文件路径**
|
|
34
|
-
- 检查文件是否存在
|
|
35
|
-
- 确认文件路径格式正确(支持相对路径和绝对路径)
|
|
36
|
-
- 如果用户未提供完整路径,尝试在工作区中查找
|
|
37
|
-
|
|
38
|
-
2. **确认输出目录**
|
|
39
|
-
- 如果用户指定了输出目录,验证目录是否存在
|
|
40
|
-
- 如果目录不存在,提示是否创建
|
|
41
|
-
- 如果未指定,使用当前目录或Markdown文件所在目录
|
|
42
|
-
|
|
43
|
-
### 第二步:执行Python脚本
|
|
44
|
-
1. **构建命令**
|
|
45
|
-
```bash
|
|
46
|
-
python .cursor/script/md_to_excel.py <markdown_file_path> [output_dir]
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
2. **执行要求**
|
|
50
|
-
- 使用绝对路径执行脚本
|
|
51
|
-
- 确保Python环境可用(Python 3.x)
|
|
52
|
-
- 确保所需依赖已安装(openpyxl)
|
|
53
|
-
|
|
54
|
-
3. **执行脚本**
|
|
55
|
-
- 调用终端命令执行Python脚本
|
|
56
|
-
- 捕获并显示执行输出
|
|
57
|
-
- 检查返回码
|
|
58
|
-
|
|
59
|
-
### 第三步:验证输出结果
|
|
60
|
-
1. **检查执行状态**
|
|
61
|
-
- 验证脚本是否成功执行(返回码为0)
|
|
62
|
-
- 检查是否有错误输出
|
|
63
|
-
|
|
64
|
-
2. **验证生成的文件**
|
|
65
|
-
- 确认Excel文件已生成
|
|
66
|
-
- 验证文件数量是否与提取的表数量一致
|
|
67
|
-
- 检查文件是否可读
|
|
68
|
-
|
|
69
|
-
3. **输出结果摘要**
|
|
70
|
-
- 列出所有生成的Excel文件路径
|
|
71
|
-
- 显示每个文件对应的表名
|
|
72
|
-
|
|
73
|
-
### 第四步:错误处理
|
|
74
|
-
如果执行失败,按以下步骤处理:
|
|
75
|
-
|
|
76
|
-
1. **分析错误类型**
|
|
77
|
-
- 文件不存在错误:提示检查文件路径
|
|
78
|
-
- 格式错误:提示检查Markdown格式是否符合要求
|
|
79
|
-
- 依赖缺失:提示安装openpyxl库
|
|
80
|
-
- Python环境错误:提示检查Python版本
|
|
81
|
-
|
|
82
|
-
2. **提供解决建议**
|
|
83
|
-
- 针对具体错误提供修复建议
|
|
84
|
-
- 如果Markdown格式不符合要求,指出具体问题
|
|
85
|
-
|
|
86
|
-
## 输出要求
|
|
87
|
-
1. **执行过程输出**
|
|
88
|
-
- 显示读取的Markdown文件路径
|
|
89
|
-
- 显示提取到的表结构数量
|
|
90
|
-
- 显示每个Excel文件的生成状态
|
|
91
|
-
|
|
92
|
-
2. **最终结果输出**
|
|
93
|
-
- 列出所有成功生成的Excel文件路径
|
|
94
|
-
- 提供文件位置摘要
|
|
95
|
-
|
|
96
|
-
3. **格式要求**
|
|
97
|
-
- 使用清晰的中文提示信息
|
|
98
|
-
- 使用emoji图标增强可读性(✅、❌、📖、📊等)
|
|
99
|
-
|
|
100
|
-
## 示例用法
|
|
101
|
-
|
|
102
|
-
### 示例1:基本用法
|
|
103
|
-
```
|
|
104
|
-
用户输入:从 .docs/服务评价/MODEL_服务评价.md 生成Excel文件
|
|
105
|
-
执行:python .cursor/script/md_to_excel.py .docs/服务评价/MODEL_服务评价.md
|
|
106
|
-
输出:在 .docs/服务评价/ 目录下生成对应的Excel文件
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### 示例2:指定输出目录
|
|
110
|
-
```
|
|
111
|
-
用户输入:从 MODEL_服务评价.md 生成Excel到 ./excel_output 目录
|
|
112
|
-
执行:python .cursor/script/md_to_excel.py MODEL_服务评价.md ./excel_output
|
|
113
|
-
输出:在 ./excel_output 目录下生成对应的Excel文件
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
## 注意事项
|
|
117
|
-
1. **Python依赖**:确保已安装 `openpyxl` 库,可通过 `pip install openpyxl` 安装
|
|
118
|
-
2. **文件编码**:Markdown文件必须使用UTF-8编码
|
|
119
|
-
3. **表格式要求**:Markdown中的表必须严格按照脚本期望的格式编写
|
|
120
|
-
4. **文件命名**:生成的Excel文件以表英文名命名(如:`rental_ServiceEvaluation.xlsx`)
|
|
121
|
-
5. **覆盖行为**:如果输出目录中已存在同名Excel文件,脚本会覆盖该文件
|
|
122
|
-
|
|
123
|
-
## 脚本功能说明
|
|
124
|
-
Python脚本 `.cursor/script/md_to_excel.py` 的主要功能:
|
|
125
|
-
- **提取表结构**:从Markdown中识别以 `##### 数字. 表名` 开头的表定义
|
|
126
|
-
- **解析表信息**:提取表中文名、表英文名、表说明
|
|
127
|
-
- **解析字段信息**:提取每个字段的中文名、英文名、类型、是否必填、说明
|
|
128
|
-
- **生成Excel**:为每个表生成格式化的Excel文件,包含:
|
|
129
|
-
- 表基本信息(表中文名、表英文名、说明)
|
|
130
|
-
- 字段详情表格(字段中文名、字段英文名、字段类型、是否必填、字段说明)
|
|
131
|
-
- 格式化样式(表头背景色、边框、对齐方式等)
|
|
132
|
-
|
|
133
|
-
|