speccrew 0.6.68 → 0.7.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/.speccrew/agents/speccrew-task-worker.md +1 -1
- package/.speccrew/agents/speccrew-team-leader.md +336 -189
- package/.speccrew/skills/speccrew-agentflow-manager/SKILL.md +161 -0
- package/.speccrew/skills/speccrew-agentflow-manager/workflow.agentflow.xml +347 -0
- package/.speccrew/skills/speccrew-deploy-build/SKILL.md +3 -56
- package/.speccrew/skills/speccrew-deploy-build/workflow.agentflow.xml +125 -0
- package/.speccrew/skills/speccrew-deploy-migrate/SKILL.md +3 -64
- package/.speccrew/skills/speccrew-deploy-migrate/workflow.agentflow.xml +135 -0
- package/.speccrew/skills/speccrew-deploy-smoke-test/SKILL.md +4 -156
- package/.speccrew/skills/speccrew-deploy-smoke-test/workflow.agentflow.xml +178 -0
- package/.speccrew/skills/speccrew-deploy-startup/SKILL.md +3 -135
- package/.speccrew/skills/speccrew-deploy-startup/workflow.agentflow.xml +223 -0
- package/.speccrew/skills/speccrew-dev-backend/SKILL.md +10 -2
- package/.speccrew/skills/speccrew-dev-backend/workflow.agentflow.xml +254 -0
- package/.speccrew/skills/speccrew-dev-desktop-electron/SKILL.md +10 -2
- package/.speccrew/skills/speccrew-dev-desktop-electron/workflow.agentflow.xml +259 -0
- package/.speccrew/skills/speccrew-dev-desktop-tauri/SKILL.md +10 -2
- package/.speccrew/skills/speccrew-dev-desktop-tauri/workflow.agentflow.xml +245 -0
- package/.speccrew/skills/speccrew-dev-frontend/SKILL.md +10 -2
- package/.speccrew/skills/speccrew-dev-frontend/workflow.agentflow.xml +262 -0
- package/.speccrew/skills/speccrew-dev-mobile/SKILL.md +10 -2
- package/.speccrew/skills/speccrew-dev-mobile/workflow.agentflow.xml +244 -0
- package/.speccrew/skills/speccrew-dev-review-backend/SKILL.md +10 -2
- package/.speccrew/skills/speccrew-dev-review-backend/workflow.agentflow.xml +251 -0
- package/.speccrew/skills/speccrew-dev-review-desktop/SKILL.md +10 -2
- package/.speccrew/skills/speccrew-dev-review-desktop/workflow.agentflow.xml +214 -0
- package/.speccrew/skills/speccrew-dev-review-frontend/SKILL.md +10 -2
- package/.speccrew/skills/speccrew-dev-review-frontend/workflow.agentflow.xml +213 -0
- package/.speccrew/skills/speccrew-dev-review-mobile/SKILL.md +10 -2
- package/.speccrew/skills/speccrew-dev-review-mobile/workflow.agentflow.xml +214 -0
- package/.speccrew/skills/speccrew-fd-api-contract/SKILL.md +7 -1
- package/.speccrew/skills/speccrew-fd-api-contract/workflow.agentflow.xml +222 -0
- package/.speccrew/skills/speccrew-fd-feature-analyze/SKILL.md +7 -1
- package/.speccrew/skills/speccrew-fd-feature-analyze/workflow.agentflow.xml +223 -0
- package/.speccrew/skills/speccrew-fd-feature-design/SKILL.md +7 -1
- package/.speccrew/skills/speccrew-fd-feature-design/workflow.agentflow.xml +322 -0
- package/.speccrew/skills/speccrew-get-timestamp/SKILL.md +3 -39
- package/.speccrew/skills/speccrew-get-timestamp/workflow.agentflow.xml +43 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-api-analyze/SKILL.md +57 -508
- package/.speccrew/skills/{speccrew-knowledge-bizs-api-analyze-xml/SKILL.md → speccrew-knowledge-bizs-api-analyze/workflow.agentflow.xml} +1 -154
- package/.speccrew/skills/speccrew-knowledge-bizs-api-graph/SKILL.md +73 -283
- package/.speccrew/skills/{speccrew-knowledge-bizs-api-graph-xml/SKILL.md → speccrew-knowledge-bizs-api-graph/workflow.agentflow.xml} +0 -298
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/SKILL.md +931 -801
- package/.speccrew/skills/{speccrew-knowledge-bizs-dispatch-xml/SKILL.md → speccrew-knowledge-bizs-dispatch/workflow.agentflow.xml} +42 -272
- package/.speccrew/skills/speccrew-knowledge-bizs-identify-entries/SKILL.md +263 -71
- package/.speccrew/skills/{speccrew-knowledge-bizs-identify-entries-xml/SKILL.md → speccrew-knowledge-bizs-identify-entries/workflow.agentflow.xml} +8 -184
- package/.speccrew/skills/speccrew-knowledge-bizs-init-features/SKILL.md +200 -181
- package/.speccrew/skills/{speccrew-knowledge-bizs-init-features-xml/SKILL.md → speccrew-knowledge-bizs-init-features/workflow.agentflow.xml} +7 -134
- package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/SKILL.md +5 -89
- package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/workflow.agentflow.xml +129 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-ui-analyze/SKILL.md +454 -326
- package/.speccrew/skills/{speccrew-knowledge-bizs-ui-analyze-xml/SKILL.md → speccrew-knowledge-bizs-ui-analyze/workflow.agentflow.xml} +8 -128
- package/.speccrew/skills/speccrew-knowledge-bizs-ui-graph/SKILL.md +302 -247
- package/.speccrew/skills/{speccrew-knowledge-bizs-ui-graph-xml/SKILL.md → speccrew-knowledge-bizs-ui-graph/workflow.agentflow.xml} +7 -199
- package/.speccrew/skills/speccrew-knowledge-bizs-ui-style-extract/SKILL.md +267 -156
- package/.speccrew/skills/{speccrew-knowledge-bizs-ui-style-extract-xml/SKILL.md → speccrew-knowledge-bizs-ui-style-extract/workflow.agentflow.xml} +7 -151
- package/.speccrew/skills/speccrew-knowledge-graph-query/SKILL.md +3 -122
- package/.speccrew/skills/speccrew-knowledge-graph-query/workflow.agentflow.xml +106 -0
- package/.speccrew/skills/speccrew-knowledge-graph-write/SKILL.md +3 -80
- package/.speccrew/skills/speccrew-knowledge-graph-write/workflow.agentflow.xml +152 -0
- package/.speccrew/skills/speccrew-knowledge-module-summarize/SKILL.md +371 -265
- package/.speccrew/skills/{speccrew-knowledge-module-summarize-xml/SKILL.md → speccrew-knowledge-module-summarize/workflow.agentflow.xml} +7 -197
- package/.speccrew/skills/speccrew-knowledge-system-summarize/SKILL.md +45 -333
- package/.speccrew/skills/{speccrew-knowledge-system-summarize-xml/SKILL.md → speccrew-knowledge-system-summarize/workflow.agentflow.xml} +0 -177
- package/.speccrew/skills/speccrew-knowledge-techs-dispatch/SKILL.md +174 -727
- package/.speccrew/skills/{speccrew-knowledge-techs-dispatch-xml/SKILL.md → speccrew-knowledge-techs-dispatch/workflow.agentflow.xml} +10 -351
- package/.speccrew/skills/speccrew-knowledge-techs-generate/SKILL.md +20 -150
- package/.speccrew/skills/{speccrew-knowledge-techs-generate-xml/SKILL.md → speccrew-knowledge-techs-generate/workflow.agentflow.xml} +0 -169
- package/.speccrew/skills/speccrew-knowledge-techs-generate-conventions/SKILL.md +75 -587
- package/.speccrew/skills/{speccrew-knowledge-techs-generate-conventions-xml/SKILL.md → speccrew-knowledge-techs-generate-conventions/workflow.agentflow.xml} +0 -153
- package/.speccrew/skills/speccrew-knowledge-techs-generate-quality/SKILL.md +463 -297
- package/.speccrew/skills/{speccrew-knowledge-techs-generate-quality-xml/SKILL.md → speccrew-knowledge-techs-generate-quality/workflow.agentflow.xml} +0 -164
- package/.speccrew/skills/speccrew-knowledge-techs-generate-ui-style/SKILL.md +57 -292
- package/.speccrew/skills/{speccrew-knowledge-techs-generate-ui-style-xml/SKILL.md → speccrew-knowledge-techs-generate-ui-style/workflow.agentflow.xml} +2 -193
- package/.speccrew/skills/speccrew-knowledge-techs-index/SKILL.md +49 -335
- package/.speccrew/skills/{speccrew-knowledge-techs-index-xml/SKILL.md → speccrew-knowledge-techs-index/workflow.agentflow.xml} +0 -167
- package/.speccrew/skills/speccrew-knowledge-techs-init/SKILL.md +28 -109
- package/.speccrew/skills/{speccrew-knowledge-techs-init-xml/SKILL.md → speccrew-knowledge-techs-init/workflow.agentflow.xml} +0 -189
- package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/SKILL.md +3 -487
- package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/workflow.agentflow.xml +278 -0
- package/.speccrew/skills/speccrew-pm-knowledge-detector/SKILL.md +3 -71
- package/.speccrew/skills/speccrew-pm-knowledge-detector/workflow.agentflow.xml +108 -0
- package/.speccrew/skills/speccrew-pm-module-initializer/SKILL.md +3 -107
- package/.speccrew/skills/speccrew-pm-module-initializer/workflow.agentflow.xml +139 -0
- package/.speccrew/skills/speccrew-pm-module-matcher/SKILL.md +3 -115
- package/.speccrew/skills/speccrew-pm-module-matcher/workflow.agentflow.xml +146 -0
- package/.speccrew/skills/speccrew-pm-requirement-analysis/SKILL.md +3 -343
- package/.speccrew/skills/speccrew-pm-requirement-analysis/workflow.agentflow.xml +174 -0
- package/.speccrew/skills/speccrew-pm-requirement-assess/SKILL.md +3 -91
- package/.speccrew/skills/speccrew-pm-requirement-assess/workflow.agentflow.xml +173 -0
- package/.speccrew/skills/speccrew-pm-requirement-clarify/SKILL.md +3 -224
- package/.speccrew/skills/speccrew-pm-requirement-clarify/workflow.agentflow.xml +159 -0
- package/.speccrew/skills/speccrew-pm-requirement-model/SKILL.md +3 -275
- package/.speccrew/skills/speccrew-pm-requirement-model/workflow.agentflow.xml +210 -0
- package/.speccrew/skills/speccrew-pm-requirement-simple/SKILL.md +3 -76
- package/.speccrew/skills/speccrew-pm-requirement-simple/workflow.agentflow.xml +120 -0
- package/.speccrew/skills/speccrew-pm-sub-prd-generate/SKILL.md +7 -1
- package/.speccrew/skills/speccrew-pm-sub-prd-generate/workflow.agentflow.xml +218 -0
- package/.speccrew/skills/speccrew-sd-backend/SKILL.md +7 -1
- package/.speccrew/skills/speccrew-sd-backend/workflow.agentflow.xml +264 -0
- package/.speccrew/skills/speccrew-sd-desktop/SKILL.md +7 -1
- package/.speccrew/skills/speccrew-sd-desktop/workflow.agentflow.xml +288 -0
- package/.speccrew/skills/speccrew-sd-framework-evaluate/SKILL.md +7 -1
- package/.speccrew/skills/speccrew-sd-framework-evaluate/workflow.agentflow.xml +235 -0
- package/.speccrew/skills/speccrew-sd-frontend/SKILL.md +7 -1
- package/.speccrew/skills/speccrew-sd-frontend/workflow.agentflow.xml +299 -0
- package/.speccrew/skills/speccrew-sd-mobile/SKILL.md +7 -1
- package/.speccrew/skills/speccrew-sd-mobile/workflow.agentflow.xml +301 -0
- package/.speccrew/skills/speccrew-test-case-design/SKILL.md +165 -284
- package/.speccrew/skills/speccrew-test-case-design/workflow.agentflow.xml +210 -0
- package/.speccrew/skills/speccrew-test-code-gen/SKILL.md +204 -324
- package/.speccrew/skills/speccrew-test-code-gen/workflow.agentflow.xml +265 -0
- package/.speccrew/skills/speccrew-test-reporter/SKILL.md +205 -184
- package/.speccrew/skills/speccrew-test-reporter/workflow.agentflow.xml +284 -0
- package/.speccrew/skills/speccrew-test-runner/SKILL.md +242 -241
- package/.speccrew/skills/speccrew-test-runner/workflow.agentflow.xml +314 -0
- package/bin/cli.js +8 -1
- package/lib/commands/validate.js +565 -0
- package/package.json +1 -1
- package/workspace-template/docs/rules/{xml-workflow-spec.md → agentflow-spec.md} +5 -5
- package/workspace-template/scripts/validate-agentflow.js +637 -0
- package/.speccrew/agents/speccrew-team-leader-xml.md +0 -480
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/STATUS-FORMATS.md +0 -99
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js +0 -176
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/get-next-batch.js +0 -150
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/get-pending-features.js +0 -106
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/mark-stale.js +0 -249
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/merge-features.js +0 -300
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/process-batch-results.js +0 -915
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/update-feature-status.js +0 -226
- package/.speccrew/skills/speccrew-knowledge-bizs-init-features/examples/features.json +0 -34
- package/.speccrew/skills/speccrew-knowledge-bizs-init-features/scripts/generate-inventory.js +0 -1071
- package/.speccrew/skills/speccrew-knowledge-bizs-init-features/scripts/test-inventory.js +0 -26
- package/.speccrew/skills/speccrew-knowledge-techs-dispatch/STATUS-FORMATS.md +0 -550
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<workflow id="get-timestamp" status="pending" version="1.0" desc="Get current timestamp in specified format">
|
|
3
|
+
|
|
4
|
+
<!-- ============================================================
|
|
5
|
+
Input Parameters Definition
|
|
6
|
+
============================================================ -->
|
|
7
|
+
<block type="input" id="I1" desc="Workflow input parameters">
|
|
8
|
+
<field name="format" required="false" type="string" default="YYYY-MM-DD-HHmmss" desc="Timestamp format: YYYY-MM-DD-HHmmss, YYYY-MM-DD, HHmm, ISO"/>
|
|
9
|
+
<field name="skill_path" required="true" type="string" desc="Path to this skill directory"/>
|
|
10
|
+
</block>
|
|
11
|
+
|
|
12
|
+
<!-- ============================================================
|
|
13
|
+
Supported Formats
|
|
14
|
+
============================================================ -->
|
|
15
|
+
<block type="rule" id="R1" level="note" desc="Supported formats">
|
|
16
|
+
<field name="text">YYYY-MM-DD-HHmmss: Full datetime for filenames (e.g., 2026-03-17-132645)</field>
|
|
17
|
+
<field name="text">YYYY-MM-DD: Date only (e.g., 2026-03-17)</field>
|
|
18
|
+
<field name="text">HHmm: Time only 24h format (e.g., 1326)</field>
|
|
19
|
+
<field name="text">ISO: ISO 8601 format (e.g., 2026-03-17T13:26:45+08:00)</field>
|
|
20
|
+
</block>
|
|
21
|
+
|
|
22
|
+
<!-- ============================================================
|
|
23
|
+
Main Processing
|
|
24
|
+
============================================================ -->
|
|
25
|
+
<sequence id="S1" name="Get Timestamp" status="pending" desc="Execute script to get formatted timestamp">
|
|
26
|
+
|
|
27
|
+
<block type="task" id="B1" action="run-script" desc="Execute get-timestamp.js script">
|
|
28
|
+
<field name="command">node "${skill_path}/scripts/get-timestamp.js" "${format}"</field>
|
|
29
|
+
<field name="note">If format parameter is empty, defaults to YYYY-MM-DD-HHmmss</field>
|
|
30
|
+
<field name="output" var="timestamp"/>
|
|
31
|
+
</block>
|
|
32
|
+
|
|
33
|
+
</sequence>
|
|
34
|
+
|
|
35
|
+
<!-- ============================================================
|
|
36
|
+
Output Results
|
|
37
|
+
============================================================ -->
|
|
38
|
+
<block type="output" id="O1" desc="Workflow output results">
|
|
39
|
+
<field name="timestamp" from="${timestamp}" type="string" desc="Formatted timestamp string"/>
|
|
40
|
+
<field name="format" from="${format}" type="string" desc="Format used"/>
|
|
41
|
+
</block>
|
|
42
|
+
|
|
43
|
+
</workflow>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: speccrew-knowledge-bizs-api-analyze
|
|
3
|
-
description: Analyze a single API controller from source code to extract business features and generate API documentation. Used by Worker Agent in parallel execution during knowledge base initialization Stage 2. Each worker analyzes one API controller file.
|
|
3
|
+
description: Analyze a single API controller from source code to extract business features and generate API documentation using XML Block workflow. Used by Worker Agent in parallel execution during knowledge base initialization Stage 2. Each worker analyzes one API controller file.
|
|
4
4
|
tools: Read, Write, Edit, Glob, Grep, Bash
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# API Feature Analysis - Single Controller
|
|
7
|
+
# API Feature Analysis - Single Controller (XML Block Workflow)
|
|
8
8
|
|
|
9
9
|
> **CRITICAL CONSTRAINT**: DO NOT create temporary scripts, batch files, or workaround code files (`.py`, `.bat`, `.sh`, `.ps1`, etc.) under any circumstances. If execution encounters errors, STOP and report the exact error. Fixes must be applied to the Skill definition or source scripts — not patched at runtime.
|
|
10
10
|
|
|
@@ -21,24 +21,25 @@ Analyze one specific API controller from source code, extract all business featu
|
|
|
21
21
|
|
|
22
22
|
| Variable | Type | Description | Example |
|
|
23
23
|
|----------|------|-------------|---------|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
| `${feature}` | object | Complete feature object from features.json | - |
|
|
25
|
+
| `${fileName}` | string | Controller file name | `"UserController"`, `"OrderController"` |
|
|
26
|
+
| `${sourcePath}` | string | Relative path to source file | `"yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java"` |
|
|
27
|
+
| `${documentPath}` | string | Target path for generated document | `"speccrew-workspace/knowledges/bizs/admin-api/system/user/UserController.md"` |
|
|
28
|
+
| `${module}` | string | Business module name (from feature.module) | `"system"`, `"trade"`, `"_root"` |
|
|
29
|
+
| `${analyzed}` | boolean | Analysis status flag | `true` / `false` |
|
|
30
|
+
| `${platform_type}` | string | Platform type | `"admin-api"`, `"app-api"` |
|
|
31
|
+
| `${platform_subtype}` | string | Platform subtype | `"spring-boot"`, `"java"` |
|
|
32
|
+
| `${tech_stack}` | array | Platform tech stack | `["java", "spring-boot", "mybatis-plus"]` |
|
|
33
|
+
| `${completed_dir}` | string | Marker files output directory | `"speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed"` |
|
|
34
|
+
| `${sourceFile}` | string | Source features JSON file name | `"features-admin-api.json"` |
|
|
35
|
+
| `${language}` | string | Target language for content | `"zh"`, `"en"` |
|
|
35
36
|
|
|
36
37
|
## Language Adaptation
|
|
37
38
|
|
|
38
|
-
**CRITICAL**: Generate all content in the language specified by the
|
|
39
|
+
**CRITICAL**: Generate all content in the language specified by the `${language}` parameter.
|
|
39
40
|
|
|
40
|
-
-
|
|
41
|
-
-
|
|
41
|
+
- `${language} == "zh"` → Generate all content in 中文
|
|
42
|
+
- `${language} == "en"` → Generate all content in English
|
|
42
43
|
- Other languages → Use the specified language
|
|
43
44
|
|
|
44
45
|
**All output content (feature names, descriptions, business rules) must be in the target language only.**
|
|
@@ -47,10 +48,10 @@ Analyze one specific API controller from source code, extract all business featu
|
|
|
47
48
|
|
|
48
49
|
| Variable | Type | Description |
|
|
49
50
|
|----------|------|-------------|
|
|
50
|
-
|
|
|
51
|
-
|
|
|
52
|
-
|
|
|
53
|
-
|
|
|
51
|
+
| `${status}` | string | Analysis status: `"success"`, `"partial"`, or `"failed"` |
|
|
52
|
+
| `${feature_name}` | string | Name of the analyzed controller |
|
|
53
|
+
| `${generated_file}` | string | Path to the generated documentation file |
|
|
54
|
+
| `${message}` | string | Summary message for status update |
|
|
54
55
|
|
|
55
56
|
## Execution Requirements
|
|
56
57
|
|
|
@@ -59,18 +60,11 @@ This skill operates in **strict sequential execution mode**:
|
|
|
59
60
|
- Output step status after each step completion
|
|
60
61
|
- Do NOT skip any step
|
|
61
62
|
|
|
62
|
-
## 🚫 ABSOLUTE PROHIBITIONS
|
|
63
|
-
|
|
64
|
-
- **NEVER** use `create_file` for documents - use template copy + `search_replace`
|
|
65
|
-
- **NEVER** delete generated files - fix with `search_replace`
|
|
66
|
-
- **NEVER** rewrite entire document - use targeted `search_replace`
|
|
67
|
-
- **ALWAYS** copy template (Step 5a) before filling sections (Step 5b)
|
|
68
|
-
|
|
69
63
|
## Output
|
|
70
64
|
|
|
71
65
|
**Generated Files:**
|
|
72
|
-
1.
|
|
73
|
-
2.
|
|
66
|
+
1. `${documentPath}` - Controller documentation file
|
|
67
|
+
2. `${completed_dir}/{module}-{subpath}-{fileName}.done.json` - Completion status marker
|
|
74
68
|
|
|
75
69
|
**Graph Data Generation:**
|
|
76
70
|
Graph data (nodes, edges) construction is handled by `speccrew-knowledge-bizs-api-graph` Skill.
|
|
@@ -101,487 +95,17 @@ The return value is used by dispatch to update the feature status in `features-{
|
|
|
101
95
|
|
|
102
96
|
Before executing the workflow, verify the following inputs:
|
|
103
97
|
|
|
104
|
-
- Controller:
|
|
105
|
-
- Target:
|
|
106
|
-
- Language:
|
|
107
|
-
- Module:
|
|
108
|
-
- Platform:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
```mermaid
|
|
113
|
-
graph TB
|
|
114
|
-
Start([Start]) --> Step1[Step 1 Read Analysis Template]
|
|
115
|
-
Step1 --> Step2[Step 2 Read Controller and Analyze API Structure]
|
|
116
|
-
Step2 --> Step3[Step 3 Extract API Features]
|
|
117
|
-
Step3 --> Step4[Step 4 Find API Consumers]
|
|
118
|
-
Step4 --> Step5a[Step 5a Copy Template to Document Path]
|
|
119
|
-
Step5a --> Step5b[Step 5b Fill Each Section Using search_replace]
|
|
120
|
-
Step5b --> Step6[Step 6 Report Results]
|
|
121
|
-
Step6 --> Step7[Step 7 Write Completion Markers]
|
|
122
|
-
Step7 --> End([End])
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
---
|
|
126
|
-
|
|
127
|
-
### Step 1: Read Analysis Template
|
|
128
|
-
|
|
129
|
-
**Step 1 Status: 🔄 IN PROGRESS**
|
|
130
|
-
|
|
131
|
-
1. **Check Analysis Status:**
|
|
132
|
-
```
|
|
133
|
-
IF {{analyzed}} == true THEN
|
|
134
|
-
Output "Step 1 Status: ⏭️ SKIPPED (already analyzed)"
|
|
135
|
-
Skip to Step 6 with status="skipped"
|
|
136
|
-
ELSE
|
|
137
|
-
Proceed to next step
|
|
138
|
-
END IF
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
2. **Read the appropriate template based on tech stack:**
|
|
142
|
-
- Java/Spring Boot: Read `templates/FEATURE-DETAIL-TEMPLATE.md`
|
|
143
|
-
- FastAPI: Read `templates/FEATURE-DETAIL-TEMPLATE-FASTAPI.md`
|
|
144
|
-
- .NET: Read `templates/FEATURE-DETAIL-TEMPLATE-NET.md`
|
|
145
|
-
- **Other/Unknown**: Default to `templates/FEATURE-DETAIL-TEMPLATE.md` (generic template)
|
|
146
|
-
|
|
147
|
-
3. **Understand template structure and required information dimensions:**
|
|
148
|
-
- Review all sections in the template
|
|
149
|
-
- Identify what information needs to be extracted from source code
|
|
150
|
-
- Note the expected format for each section
|
|
151
|
-
|
|
152
|
-
**Template Analysis Scope:**
|
|
153
|
-
|
|
154
|
-
| Template Section | Information to Extract | Source |
|
|
155
|
-
|------------------|------------------------|--------|
|
|
156
|
-
| 1. Content Overview | Controller name, document path, source path, description | `{{fileName}}`, `{{documentPath}}`, `{{sourcePath}}` |
|
|
157
|
-
| 2. API Endpoints | All public API methods with HTTP methods and paths | Controller method annotations |
|
|
158
|
-
| 3. Business Flow | Request handling flow: validation → business logic → persistence | Controller → Service → Mapper/Repository |
|
|
159
|
-
| 4. Data Fields | Request DTOs, Response DTOs, Entity fields | DTO classes, Entity classes |
|
|
160
|
-
| 5. References | Services, Mappers, other controllers this controller uses | Field injections, imports |
|
|
161
|
-
| 6. Business Rules | Permission rules, validation rules, business logic rules | Code logic, annotations, comments |
|
|
162
|
-
|
|
163
|
-
**Handling VO/DTO Source Files:**
|
|
164
|
-
If the source file is a VO/DTO class (not a Controller), certain sections may be simplified, but ALL section headers and numbering must still be preserved:
|
|
165
|
-
- Section 2 (API Endpoint Definitions): Note "This is a VO/DTO class containing only data structure definitions, no API endpoints"
|
|
166
|
-
- Section 4 (References): Document fields and their types as the primary content
|
|
167
|
-
- Other sections: Use "N/A" or "Not applicable for VO/DTO classes"
|
|
168
|
-
- NEVER skip sections or reorganize the template structure
|
|
169
|
-
|
|
170
|
-
> ⚠️ CRITICAL: The template defines the EXACT output structure. You MUST:
|
|
171
|
-
> - Generate ALL sections listed in the template, in the SAME order
|
|
172
|
-
> - Fill ALL tables defined in the template (use "N/A" for unavailable data, never skip a table)
|
|
173
|
-
> - Follow the EXACT heading hierarchy and numbering from the template
|
|
174
|
-
> - Do NOT invent your own section structure or reorganize sections
|
|
175
|
-
|
|
176
|
-
**Output:** "Step 1 Status: ✅ COMPLETED - Template loaded, {{sectionCount}} sections identified for analysis"
|
|
177
|
-
|
|
178
|
-
### Step 2: Read Controller and Analyze API Structure
|
|
179
|
-
|
|
180
|
-
**Step 2 Status: 🔄 IN PROGRESS**
|
|
181
|
-
|
|
182
|
-
**Prerequisites:**
|
|
183
|
-
- Template has been loaded and understood from Step 1
|
|
184
|
-
- Controller file is a Java/Kotlin controller file (e.g., `UserController.java`)
|
|
185
|
-
|
|
186
|
-
**Actions:**
|
|
187
|
-
1. **Locate and Read the controller file:**
|
|
188
|
-
- Use `{{sourcePath}}` as the relative file path from project root
|
|
189
|
-
- Read the controller file content
|
|
190
|
-
|
|
191
|
-
2. **Analyze API handler structure based on template guidance:**
|
|
192
|
-
- **Java**: Parse `@RestController`, `@RequestMapping`, `@GetMapping`, etc.
|
|
193
|
-
- **FastAPI**: Parse `@router.get()`, `@router.post()`, Pydantic models
|
|
194
|
-
- **.NET**: Parse `[ApiController]`, `[Route]`, `[HttpGet]`, etc.
|
|
195
|
-
- **Other**: Parse based on common patterns (class/method definitions, decorators, attributes)
|
|
196
|
-
|
|
197
|
-
3. **Identify all public API endpoint methods**
|
|
198
|
-
|
|
199
|
-
4. **Extract method signatures, HTTP methods, and paths**
|
|
200
|
-
|
|
201
|
-
5. **Systematically gather information for EVERY section in the template:**
|
|
202
|
-
- For each template section, identify what source code information is needed
|
|
203
|
-
- If source code doesn't provide enough info for a section, note it for "N/A" filling later
|
|
204
|
-
- Do NOT skip gathering info just because it seems minor
|
|
205
|
-
|
|
206
|
-
**Output:** "Step 2 Status: ✅ COMPLETED - Read {{sourcePath}} ({{lineCount}} lines), Analyzed {{endpointCount}} endpoints, {{serviceCount}} services"
|
|
207
|
-
|
|
208
|
-
### Step 3: Extract API Features
|
|
209
|
-
|
|
210
|
-
**Step 3 Status: 🔄 IN PROGRESS**
|
|
211
|
-
|
|
212
|
-
Each public API endpoint in the controller = one feature.
|
|
213
|
-
|
|
214
|
-
**CRITICAL - Analysis Scope Limitation:**
|
|
215
|
-
|
|
216
|
-
- **ONLY analyze the single controller file specified by `{{sourcePath}}`**
|
|
217
|
-
- **DO NOT analyze or generate documentation for other controllers in the same package**
|
|
218
|
-
- **DO NOT generate separate documents for internal/private methods**
|
|
219
|
-
|
|
220
|
-
**Extraction Guidelines:**
|
|
221
|
-
|
|
222
|
-
- Document ALL public API endpoints with their HTTP methods and paths
|
|
223
|
-
- For **internal service methods**: only record references, do not document as separate features
|
|
224
|
-
- Document business flows for each API endpoint: request validation → business logic → data persistence → response
|
|
225
|
-
- **Read Configuration**: Read `speccrew-workspace/docs/rules/mermaid-rule.md` for Mermaid diagram guidelines
|
|
226
|
-
- **Generate Mermaid flowcharts** following the configuration (see [Reference Guides > Mermaid Guide](#mermaid-guide) for quick reference)
|
|
227
|
-
- Use `{{language}}` for all extracted content naming
|
|
228
|
-
|
|
229
|
-
**Example Code Analysis:**
|
|
230
|
-
|
|
231
|
-
```java
|
|
232
|
-
// From controller file (UserController.java)
|
|
233
|
-
@RestController
|
|
234
|
-
@RequestMapping("/admin-api/system/user")
|
|
235
|
-
public class UserController {
|
|
236
|
-
|
|
237
|
-
@GetMapping("/page") → Feature: list-users (Paged Query)
|
|
238
|
-
@PostMapping("/create") → Feature: create-user (Create User)
|
|
239
|
-
@PutMapping("/update") → Feature: update-user (Update User)
|
|
240
|
-
@DeleteMapping("/delete/{id}") → Feature: delete-user (Delete User)
|
|
241
|
-
@GetMapping("/get/{id}") → Feature: get-user-detail (Get User Detail)
|
|
242
|
-
}
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
**For Each API Feature, Document:**
|
|
246
|
-
|
|
247
|
-
1. **Feature Identification:**
|
|
248
|
-
- Feature name (from endpoint path and HTTP method)
|
|
249
|
-
- API method and path
|
|
250
|
-
- Entry point file path
|
|
251
|
-
|
|
252
|
-
2. **Request/Response Analysis:**
|
|
253
|
-
- Request DTO fields with validation rules
|
|
254
|
-
- Response DTO fields
|
|
255
|
-
- Error response codes
|
|
256
|
-
|
|
257
|
-
3. **Deep Backend Business Flow Analysis** (per API endpoint):
|
|
258
|
-
|
|
259
|
-
**CRITICAL**: Trace the complete call chain based on tech stack:
|
|
260
|
-
|
|
261
|
-
**Java/Spring Boot**: Controller → Service → Mapper → Database
|
|
262
|
-
**FastAPI**: Router → Service → CRUD/Repository → SQLAlchemy Model → Database
|
|
263
|
-
**.NET**: Controller → Service → Repository → EF Core → Database
|
|
264
|
-
|
|
265
|
-
- **API Handler Layer** (Controller/Router):
|
|
266
|
-
- Request receiving and parameter extraction
|
|
267
|
-
- Permission/role validation
|
|
268
|
-
- DTO/Schema validation
|
|
269
|
-
- Service method invocation
|
|
270
|
-
|
|
271
|
-
- **Service Layer** (Business Logic):
|
|
272
|
-
- Business rule validation
|
|
273
|
-
- Data transformation/processing
|
|
274
|
-
- Cross-module service calls (if any)
|
|
275
|
-
- Transaction boundaries
|
|
276
|
-
- Data access layer invocation
|
|
277
|
-
|
|
278
|
-
- **Data Access Layer** (Mapper/CRUD/Repository):
|
|
279
|
-
- SQL operations (SELECT/INSERT/UPDATE/DELETE)
|
|
280
|
-
- Database table names
|
|
281
|
-
- Join conditions and filters
|
|
282
|
-
|
|
283
|
-
- **Database Layer**:
|
|
284
|
-
- Table structure (fields, types, constraints)
|
|
285
|
-
- Index usage
|
|
286
|
-
- Relationships with other tables
|
|
287
|
-
|
|
288
|
-
**MANDATORY Analysis for Template Sections 6-7:**
|
|
289
|
-
- Trace the complete call chain to Service → Mapper/DAO → Database tables
|
|
290
|
-
- Analyze transaction boundaries (methods with @Transactional or equivalent)
|
|
291
|
-
- Analyze database operation types (SELECT/INSERT/UPDATE/DELETE) for each table
|
|
292
|
-
- Identify service dependencies and cross-module calls for Dependency Analysis section
|
|
293
|
-
- Note potential performance considerations (N+1 queries, large batch operations, missing indexes)
|
|
294
|
-
|
|
295
|
-
4. **Business Flow Visualization**:
|
|
296
|
-
- Generate Mermaid flowchart for **each API endpoint**
|
|
297
|
-
- Show complete flow: Request → Controller → Service → Mapper → Database → Response
|
|
298
|
-
- Include detailed business logic steps in Service layer
|
|
299
|
-
- Mark each step with source file reference (Controller/Service/Mapper)
|
|
300
|
-
|
|
301
|
-
**Output:** "Step 3 Status: ✅ COMPLETED - Extracted {{endpointCount}} API endpoints, {{flowCount}} business flows"
|
|
302
|
-
|
|
303
|
-
> **Note:** Graph data (nodes, edges) construction is handled by the `speccrew-knowledge-bizs-api-graph` Skill. This skill focuses on API analysis and documentation only.
|
|
304
|
-
|
|
305
|
-
### Step 4: Find API Consumers
|
|
306
|
-
|
|
307
|
-
**Step 4 Status: 🔄 IN PROGRESS**
|
|
308
|
-
|
|
309
|
-
Search frontend page files in the codebase to find which pages call the APIs in this controller.
|
|
310
|
-
|
|
311
|
-
**Search Methods:**
|
|
312
|
-
- Search for API client/service calls matching this controller's endpoints
|
|
313
|
-
- Search for imports of the API client class
|
|
314
|
-
- Search for HTTP requests to this controller's base path
|
|
315
|
-
|
|
316
|
-
**For Each Consumer Page, Record:**
|
|
317
|
-
| Field | Description |
|
|
318
|
-
|-------|-------------|
|
|
319
|
-
| Page Name | Name of the page that consumes this API |
|
|
320
|
-
| Function Description | How/why it uses this API (e.g., "Load user list on page init") |
|
|
321
|
-
| Source Path | Relative path to the consumer page source file |
|
|
322
|
-
| Document Path | Path to the consumer page's generated document |
|
|
323
|
-
|
|
324
|
-
**Output:** "Step 4 Status: ✅ COMPLETED - Found {{consumerCount}} API consumers"
|
|
325
|
-
|
|
326
|
-
---
|
|
327
|
-
|
|
328
|
-
### Step 5a: Copy Template to Document Path
|
|
329
|
-
|
|
330
|
-
**Step 5a Status: 🔄 IN PROGRESS**
|
|
331
|
-
|
|
332
|
-
Copy the appropriate template to the target document path and replace top-level placeholders.
|
|
333
|
-
|
|
334
|
-
**Template Selection:**
|
|
335
|
-
|
|
336
|
-
| Tech Stack | Template File | Description |
|
|
337
|
-
|------------|---------------|-------------|
|
|
338
|
-
| Java/Spring Boot/MyBatis | `templates/FEATURE-DETAIL-TEMPLATE.md` | Controller → Service → Mapper → Database |
|
|
339
|
-
| Python/FastAPI/SQLAlchemy | `templates/FEATURE-DETAIL-TEMPLATE-FASTAPI.md` | Router → Service → CRUD → SQLAlchemy Model |
|
|
340
|
-
| .NET/ASP.NET Core/EF Core | `templates/FEATURE-DETAIL-TEMPLATE-NET.md` | Controller → Service → Repository → EF Core |
|
|
341
|
-
| Other/Unknown | `templates/FEATURE-DETAIL-TEMPLATE.md` | Use as default/generic template |
|
|
342
|
-
|
|
343
|
-
**Actions:**
|
|
344
|
-
|
|
345
|
-
1. **Read the selected template file** based on `{{tech_stack}}`
|
|
346
|
-
|
|
347
|
-
2. **Replace top-level placeholders** with known variables:
|
|
348
|
-
|
|
349
|
-
| Placeholder | Replace With | Source |
|
|
350
|
-
|-------------|--------------|--------|
|
|
351
|
-
| `{Controller}` | `{{fileName}}` | Input variable |
|
|
352
|
-
| `{sourcePath}` | `{{sourcePath}}` | Input variable |
|
|
353
|
-
| `{documentPath}` | `{{documentPath}}` | Input variable |
|
|
354
|
-
| `{module}` | `{{module}}` | Input variable |
|
|
355
|
-
| `[Feature Name]` | `{{fileName}}` | Document title |
|
|
356
|
-
|
|
357
|
-
3. **Create the document file** using `create_file`:
|
|
358
|
-
- Target path: `{{documentPath}}`
|
|
359
|
-
- Content: Template with top-level placeholders replaced
|
|
360
|
-
- Ensure parent directory exists
|
|
361
|
-
|
|
362
|
-
4. **Verify the document skeleton**:
|
|
363
|
-
- Document should now have complete Section 1-10 structure
|
|
364
|
-
- Each section should have placeholder content waiting to be filled
|
|
365
|
-
|
|
366
|
-
**Output:** "Step 5a Status: ✅ COMPLETED - Template copied to {{documentPath}}, ready for section filling"
|
|
367
|
-
|
|
368
|
-
---
|
|
369
|
-
|
|
370
|
-
### Step 5b: Fill Each Section Using search_replace
|
|
371
|
-
|
|
372
|
-
**Step 5b Status: 🔄 IN PROGRESS**
|
|
373
|
-
|
|
374
|
-
Fill each section of the document with actual data extracted from source code analysis.
|
|
375
|
-
|
|
376
|
-
> ⚠️ **CRITICAL CONSTRAINTS:**
|
|
377
|
-
> - **禁止使用 create_file 重写整个文档** - 会丢失模板结构
|
|
378
|
-
> - **必须使用 search_replace 逐块替换**
|
|
379
|
-
> - **每个 Section 的标题和编号必须保留**,不得删除或修改
|
|
380
|
-
> - 若某 Section 无对应源码信息,保留 Section 标题,将占位内容替换为 "N/A - No applicable data found in source code"
|
|
381
|
-
|
|
382
|
-
**Section Filling Order:**
|
|
383
|
-
|
|
384
|
-
Fill sections in order (1 → 10), using `search_replace` for each content block.
|
|
385
|
-
|
|
386
|
-
---
|
|
387
|
-
|
|
388
|
-
#### Section 1-10: Fill Template Sections
|
|
389
|
-
|
|
390
|
-
Fill each section using `search_replace` with extracted data from source code analysis.
|
|
391
|
-
|
|
392
|
-
**Template Anchors:**
|
|
393
|
-
| Section | Anchor |
|
|
394
|
-
|---------|--------|
|
|
395
|
-
| 1. Content Overview | `<!-- AI-TAG: OVERVIEW -->` |
|
|
396
|
-
| 2. API Endpoints | `<!-- AI-TAG: API_ENDPOINTS -->` |
|
|
397
|
-
| 3. Data Fields | `<!-- AI-TAG: DATA_DEFINITION -->` |
|
|
398
|
-
| 4. References | `<!-- AI-TAG: REFERENCES -->` |
|
|
399
|
-
| 5. Business Rules | `<!-- AI-TAG: BUSINESS_RULES -->` |
|
|
400
|
-
| 6. Dependencies | `<!-- AI-TAG: DEPENDENCIES -->` |
|
|
401
|
-
| 7. Performance | `<!-- AI-TAG: PERFORMANCE -->` |
|
|
402
|
-
| 8. Troubleshooting | `<!-- AI-TAG: TROUBLESHOOTING -->` |
|
|
403
|
-
| 9. Notes | `<!-- AI-TAG: ADDITIONAL_NOTES -->` |
|
|
404
|
-
| 10. Appendix | End of document |
|
|
405
|
-
|
|
406
|
-
**Filling Guidelines:**
|
|
407
|
-
- Replace placeholder text with actual data extracted from source code
|
|
408
|
-
- Use the template's existing table structure
|
|
409
|
-
- Fill ALL tables, use "N/A" for unavailable data
|
|
410
|
-
- Generate Mermaid business flow diagrams for each API endpoint
|
|
411
|
-
- Preserve section headers and numbering
|
|
412
|
-
|
|
413
|
-
---
|
|
414
|
-
|
|
415
|
-
**Link Format Rules:**
|
|
416
|
-
|
|
417
|
-
❌ **NEVER use `file://` protocol in links** - This breaks Markdown preview
|
|
418
|
-
✅ **ALWAYS use relative paths** - Markdown links work correctly
|
|
419
|
-
|
|
420
|
-
**⚠️ CRITICAL - Dynamic Path Depth Calculation:**
|
|
421
|
-
|
|
422
|
-
文档生成位置深度**不固定**,必须动态计算 `../` 层数:
|
|
423
|
-
|
|
424
|
-
**计算方法:**
|
|
425
|
-
1. 文档路径格式:`speccrew-workspace/knowledges/bizs/{platform_id}/{module_path}/{file}.md`
|
|
426
|
-
2. 计算从文档所在目录到项目根需要的 `../` 层数
|
|
427
|
-
3. 公式:`../` 层数 = 文档路径中目录层级数
|
|
428
|
-
|
|
429
|
-
**示例计算:**
|
|
430
|
-
- 文档路径 `speccrew-workspace/knowledges/bizs/admin-api/system/user/UserController.md`
|
|
431
|
-
- 拆分:`speccrew-workspace/` + `knowledges/` + `bizs/` + `admin-api/` + `system/` + `user/` = 6层目录
|
|
432
|
-
- 需要:`../../../../../` (6个`../`) 返回项目根
|
|
433
|
-
- 文档路径 `speccrew-workspace/knowledges/bizs/backend-ai/chat/ChatController.md`
|
|
434
|
-
- 拆分:5层目录
|
|
435
|
-
- 需要:`../../../../../` (5个`../`) 返回项目根
|
|
436
|
-
|
|
437
|
-
**Source Traceability Format:**
|
|
438
|
-
- Format: `[Source]({dynamic_prefix}{sourcePath})`
|
|
439
|
-
- 动态前缀:根据 `{{documentPath}}` 计算所需的 `../` 层数
|
|
440
|
-
- 示例(文档在 `speccrew-workspace/knowledges/bizs/admin-api/system/user/`):
|
|
441
|
-
- `[Source](../../../../../yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java)`
|
|
442
|
-
|
|
443
|
-
**Source Column Rules:**
|
|
444
|
-
- Project source file: use `[Source](../../relative/path/to/file)` with valid relative path
|
|
445
|
-
- External framework/library class (e.g. Spring Security, MyBatis Plus): write plain text like `Spring Security` or `Framework` — do NOT wrap in link syntax
|
|
446
|
-
|
|
447
|
-
**Document Link Format:**
|
|
448
|
-
- Format: `[Doc]({dynamic_prefix}{documentPath})`
|
|
449
|
-
- 动态前缀:与 Source Link 使用相同计算方法
|
|
450
|
-
- 示例(文档在 `speccrew-workspace/knowledges/bizs/admin-api/system/user/`):
|
|
451
|
-
- `[Doc](../../../../../speccrew-workspace/knowledges/bizs/web-vue3/src/views/system/user/index.md)`
|
|
452
|
-
|
|
453
|
-
**实现步骤(AI Agent 执行时):**
|
|
454
|
-
1. 获取 `{{documentPath}}` 变量
|
|
455
|
-
2. 提取文档所在目录路径(去除文件名)
|
|
456
|
-
3. 按 `/` 分割目录路径,统计目录层级数 N
|
|
457
|
-
4. 生成 N 个 `../` 作为链接前缀
|
|
458
|
-
5. 组合为完整链接:`[Text]({"../".repeat(N)}{targetPath})`
|
|
459
|
-
|
|
460
|
-
**N/A Handling Rule:**
|
|
461
|
-
If a section has no applicable data from source code:
|
|
462
|
-
1. Keep the section header and structure
|
|
463
|
-
2. Replace placeholder content with: "N/A - No applicable data found in source code"
|
|
464
|
-
3. DO NOT remove the section or change its numbering
|
|
465
|
-
|
|
466
|
-
**Output:** "Step 5b Status: ✅ COMPLETED - All sections filled at {{documentPath}} ({{fileSize}} bytes)"
|
|
467
|
-
|
|
468
|
-
### Step 6: Report Results
|
|
469
|
-
|
|
470
|
-
**Step 6 Status: 🔄 IN PROGRESS**
|
|
471
|
-
|
|
472
|
-
Return analysis result summary to dispatch:
|
|
473
|
-
|
|
474
|
-
```json
|
|
475
|
-
{
|
|
476
|
-
"status": "{{status}}",
|
|
477
|
-
"feature": {
|
|
478
|
-
"fileName": "{{fileName}}",
|
|
479
|
-
"sourcePath": "{{sourcePath}}"
|
|
480
|
-
},
|
|
481
|
-
"platformType": "{{platform_type}}",
|
|
482
|
-
"module": "{{module}}",
|
|
483
|
-
"featureName": "{{feature_name}}",
|
|
484
|
-
"generatedFile": "{{generated_file}}",
|
|
485
|
-
"message": "{{message}}"
|
|
486
|
-
}
|
|
487
|
-
```
|
|
488
|
-
|
|
489
|
-
Or in case of failure:
|
|
490
|
-
|
|
491
|
-
```json
|
|
492
|
-
{
|
|
493
|
-
"status": "{{status}}",
|
|
494
|
-
"feature": {
|
|
495
|
-
"fileName": "{{fileName}}",
|
|
496
|
-
"sourcePath": "{{sourcePath}}"
|
|
497
|
-
},
|
|
498
|
-
"message": "{{message}}"
|
|
499
|
-
}
|
|
500
|
-
```
|
|
501
|
-
|
|
502
|
-
**Output:** "Step 6 Status: ✅ COMPLETED - Analysis {{status}}: {{message}}"
|
|
503
|
-
|
|
504
|
-
---
|
|
505
|
-
|
|
506
|
-
### Step 7: Write Completion Markers
|
|
507
|
-
|
|
508
|
-
**Step 7 Status: 🔄 IN PROGRESS**
|
|
509
|
-
|
|
510
|
-
**⚠️ MANDATORY - This step MUST be executed. The task is NOT complete until marker files are written.**
|
|
511
|
-
|
|
512
|
-
Write analysis results to marker files for dispatch batch processing.
|
|
513
|
-
|
|
514
|
-
**Input Parameters (from dispatch):**
|
|
515
|
-
- `{{completed_dir}}` - **REQUIRED** - Marker files output directory (e.g., `speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed`)
|
|
516
|
-
- `{{sourceFile}}` - **REQUIRED** - Source features JSON file name (e.g., `features-admin-api.json`)
|
|
517
|
-
- `{{language}}` - **REQUIRED** - Target language for content (see Language Adaptation section)
|
|
518
|
-
|
|
519
|
-
**Prerequisites:**
|
|
520
|
-
- Step 6 completed successfully
|
|
521
|
-
|
|
522
|
-
> **ASSUMPTION**: The `completed_dir` directory already exists (pre-created by dispatch Stage 2). If write fails, report error — do NOT attempt to create directories.
|
|
523
|
-
|
|
524
|
-
### Pre-write Checklist (VERIFY before writing each file):
|
|
525
|
-
- [ ] Filename follows `{module}-{subpath}-{fileName}` pattern (see naming convention below)
|
|
526
|
-
- [ ] File content is valid JSON (not empty)
|
|
527
|
-
- [ ] All required fields are present and non-empty
|
|
528
|
-
- [ ] File is written with UTF-8 encoding
|
|
529
|
-
|
|
530
|
-
**Pre-write Verification (MUST check before writing):**
|
|
531
|
-
- [ ] `.done.json` JSON: `fileName` does NOT contain file extension
|
|
532
|
-
- [ ] `.done.json` JSON: `sourceFile` matches `features-{platform}.json` pattern
|
|
533
|
-
- [ ] `.done.json` JSON: `module` field is present and non-empty
|
|
534
|
-
- [ ] Valid JSON (no trailing commas, all strings quoted)
|
|
535
|
-
|
|
536
|
-
---
|
|
537
|
-
|
|
538
|
-
### Marker File Naming Convention
|
|
539
|
-
|
|
540
|
-
**Format:** `{completed_dir}/{module}-{subpath}-{fileName}.done.json`
|
|
541
|
-
|
|
542
|
-
**Components:**
|
|
543
|
-
- `module`: Use `{{module}}` input variable
|
|
544
|
-
- `subpath`: Extract from sourcePath, replace `/` with `-` (e.g., `controller/admin/user` → `controller-admin-user`)
|
|
545
|
-
- `fileName`: `{{fileName}}` WITHOUT extension
|
|
546
|
-
|
|
547
|
-
**Example:** `system-controller-admin-user-UserController.done.json`
|
|
548
|
-
|
|
549
|
-
> **Note:** Graph data (`.graph.json`) files are generated by `speccrew-knowledge-bizs-api-graph` Skill.
|
|
550
|
-
|
|
551
|
-
---
|
|
552
|
-
|
|
553
|
-
### Path Format Rules
|
|
554
|
-
|
|
555
|
-
**⚠️ CRITICAL: ALWAYS use relative paths in JSON content, NEVER absolute paths.**
|
|
556
|
-
|
|
557
|
-
---
|
|
558
|
-
|
|
559
|
-
**1. Write .done.json file:**
|
|
560
|
-
|
|
561
|
-
Create valid JSON file at `{completed_dir}/{module}-{subpath}-{fileName}.done.json`:
|
|
562
|
-
|
|
563
|
-
```json
|
|
564
|
-
{
|
|
565
|
-
"fileName": "{{fileName}}",
|
|
566
|
-
"sourcePath": "{{sourcePath}}",
|
|
567
|
-
"sourceFile": "{{sourceFile}}",
|
|
568
|
-
"module": "{{module}}",
|
|
569
|
-
"documentPath": "{{documentPath}}",
|
|
570
|
-
"status": "{{status}}",
|
|
571
|
-
"analysisNotes": "{{message}}"
|
|
572
|
-
}
|
|
573
|
-
```
|
|
574
|
-
|
|
575
|
-
> **CRITICAL:**
|
|
576
|
-
> - `fileName` MUST NOT include file extension
|
|
577
|
-
> - All paths MUST be relative, not absolute
|
|
578
|
-
> - Content MUST be valid JSON (not plain text)
|
|
579
|
-
|
|
580
|
-
**Output:** "Step 7 Status: ✅ COMPLETED - Marker file written to {{completed_dir}}"
|
|
98
|
+
- Controller: `${fileName}` (`${sourcePath}`)
|
|
99
|
+
- Target: `${documentPath}`
|
|
100
|
+
- Language: `${language}`
|
|
101
|
+
- Module: `${module}`
|
|
102
|
+
- Platform: `${platform_type}`/`${platform_subtype}`
|
|
103
|
+
- Completed Dir: `${completed_dir}`
|
|
104
|
+
- Source File: `${sourceFile}`
|
|
581
105
|
|
|
582
|
-
|
|
106
|
+
## AgentFlow Definition
|
|
583
107
|
|
|
584
|
-
|
|
108
|
+
<!-- @agentflow: workflow.agentflow.xml -->
|
|
585
109
|
|
|
586
110
|
## Reference Guides
|
|
587
111
|
|
|
@@ -599,3 +123,28 @@ When generating Mermaid diagrams, follow compatibility guidelines:
|
|
|
599
123
|
- Focus on business operations
|
|
600
124
|
- Refer to `templates/FEATURE-DETAIL-TEMPLATE.md`
|
|
601
125
|
|
|
126
|
+
## Constraints
|
|
127
|
+
|
|
128
|
+
1. **DO NOT analyze files outside the specified `${sourcePath}`**
|
|
129
|
+
2. **DO NOT generate separate documents for internal/private methods**
|
|
130
|
+
3. **All content MUST be in the language specified by `${language}`**
|
|
131
|
+
4. **Use `search_replace` for section filling, NEVER rewrite entire document**
|
|
132
|
+
5. **Mermaid diagrams MUST follow the rules in `mermaid-rule.md`**
|
|
133
|
+
6. **All links MUST use relative paths, NEVER `file://` protocol**
|
|
134
|
+
7. **Marker files MUST follow naming convention: `{module}-{subpath}-{fileName}.done.json`**
|
|
135
|
+
8. **fileName in .done.json MUST NOT include file extension**
|
|
136
|
+
9. **ALL paths in JSON MUST be relative, not absolute**
|
|
137
|
+
|
|
138
|
+
## Checklist
|
|
139
|
+
|
|
140
|
+
- [ ] Template file selected based on `${tech_stack}`
|
|
141
|
+
- [ ] Template content read successfully
|
|
142
|
+
- [ ] Controller file read and analyzed
|
|
143
|
+
- [ ] API endpoints extracted with business flows
|
|
144
|
+
- [ ] API consumers found
|
|
145
|
+
- [ ] Template copied to document path
|
|
146
|
+
- [ ] All sections filled using search_replace
|
|
147
|
+
- [ ] All content in target language (`${language}`)
|
|
148
|
+
- [ ] Results reported in JSON format
|
|
149
|
+
- [ ] .done.json marker file written successfully
|
|
150
|
+
- [ ] .graph.json generation dispatched to graph skill
|