@al76/tools-and-spec-workflow-mcp
Version:
MCP server for spec-driven development workflow with real-time web dashboard
165 lines (143 loc) • 6.61 kB
JavaScript
export const steeringGuideTool = {
name: 'steering-guide',
description: `加载创建项目指导文档的指南。
# 说明
仅在用户明确请求创建指导文档或询问项目架构文档时调用。不是标准规范工作流的一部分。为 product.md、tech.md 和 structure.md 的创建提供模板和指导。`,
inputSchema: {
type: 'object',
properties: {},
additionalProperties: false
}
};
export async function steeringGuideHandler(args, context) {
return {
success: true,
message: '指导工作流指南已加载 - 请严格按照此工作流执行',
data: {
guide: getSteeringGuide(),
dashboardUrl: context.dashboardUrl
},
nextSteps: [
'仅在用户请求指导文档时继续',
'首先创建 product.md',
'然后创建 tech.md 和 structure.md',
'在未来的规范中引用',
context.dashboardUrl ? `仪表板: ${context.dashboardUrl}` : '仪表板不可用'
]
};
}
function getSteeringGuide() {
return `# 指导工作流
## 概述
在明确请求时创建项目级指导文档。指导文档为已建立的代码库建立愿景、架构和约定。
## Workflow Diagram
\`\`\`mermaid
flowchart TD
Start([Start: Setup steering docs]) --> Guide[steering-guide<br/>Load workflow instructions]
%% Phase 1: Product
Guide --> P1_Template[get-template-context<br/>templateType: steering<br/>template: product]
P1_Template --> P1_Generate[Generate vision & goals]
P1_Generate --> P1_Create[create-steering-doc<br/>document: product]
P1_Create --> P1_Approve[request-approval<br/>filePath only]
P1_Approve --> P1_Status[get-approval-status<br/>poll status]
P1_Status --> P1_Check{Status?}
P1_Check -->|needs-revision| P1_Update[Update document using user comments for guidance]
P1_Update --> P1_Create
P1_Check -->|approved| P1_Clean[delete-approval]
P1_Clean -->|failed| P1_Status
%% Phase 2: Tech
P1_Clean -->|success| P2_Template[get-template-context<br/>templateType: steering<br/>template: tech]
P2_Template --> P2_Analyze[Analyze tech stack]
P2_Analyze --> P2_Create[create-steering-doc<br/>document: tech]
P2_Create --> P2_Approve[request-approval<br/>filePath only]
P2_Approve --> P2_Status[get-approval-status<br/>poll status]
P2_Status --> P2_Check{Status?}
P2_Check -->|needs-revision| P2_Update[Update document using user comments for guidance]
P2_Update --> P2_Create
P2_Check -->|approved| P2_Clean[delete-approval]
P2_Clean -->|failed| P2_Status
%% Phase 3: Structure
P2_Clean -->|success| P3_Template[get-template-context<br/>templateType: steering<br/>template: structure]
P3_Template --> P3_Analyze[Analyze codebase structure]
P3_Analyze --> P3_Create[create-steering-doc<br/>document: structure]
P3_Create --> P3_Approve[request-approval<br/>filePath only]
P3_Approve --> P3_Status[get-approval-status<br/>poll status]
P3_Status --> P3_Check{Status?}
P3_Check -->|needs-revision| P3_Update[Update document using user comments for guidance]
P3_Update --> P3_Create
P3_Check -->|approved| P3_Clean[delete-approval]
P3_Clean -->|failed| P3_Status
P3_Clean -->|success| Complete([Steering docs complete])
style Start fill:#e6f3ff
style Complete fill:#e6f3ff
style P1_Check fill:#ffe6e6
style P2_Check fill:#ffe6e6
style P3_Check fill:#ffe6e6
\`\`\`
## Steering Workflow Phases
### Phase 1: Product Document
**Purpose**: Define vision, goals, and user outcomes.
**Tools**:
- steering-guide: Load workflow instructions
- get-template-context: Load product template (templateType: "steering", template: "product")
- create-steering-doc: Create product.md
- request-approval: Get user approval
- get-approval-status: Check approval status
- delete-approval: Clean up after approval
**Process**:
1. Load steering guide for workflow overview
2. Load product template
3. Generate product vision and goals
4. Create document with create-steering-doc
5. Request approval (filePath only)
6. Poll status until approved/needs-revision (NEVER accept verbal approval)
7. If needs-revision: update document, create NEW approval, do NOT proceed
8. Once approved: delete-approval (must succeed) before proceeding
9. If delete-approval fails: STOP - return to polling
### Phase 2: Tech Document
**Purpose**: Document technology decisions and architecture.
**Tools**:
- get-template-context: Load tech template (templateType: "steering", template: "tech")
- create-steering-doc: Create tech.md
- request-approval: Get user approval
- get-approval-status: Check status
- delete-approval: Clean up
**Process**:
1. Load tech template
2. Analyze existing technology stack
3. Document architectural decisions and patterns
4. Create document and request approval
5. Poll status until approved/needs-revision
6. If needs-revision: update document, create NEW approval, do NOT proceed
7. Once approved: delete-approval (must succeed) before proceeding
8. If delete-approval fails: STOP - return to polling
### Phase 3: Structure Document
**Purpose**: Map codebase organization and patterns.
**Tools**:
- get-template-context: Load structure template (templateType: "steering", template: "structure")
- create-steering-doc: Create structure.md
- request-approval: Get user approval
- get-approval-status: Check status
- delete-approval: Clean up
**Process**:
1. Load structure template
2. Analyze directory structure and file organization
3. Document coding patterns and conventions
4. Create document and request approval
5. Poll status until approved/needs-revision
6. If needs-revision: update document, create NEW approval, do NOT proceed
7. Once approved: delete-approval (must succeed) before proceeding
8. If delete-approval fails: STOP - return to polling
9. After successful cleanup: "Steering docs complete. Ready for spec creation?"
## Workflow Rules
- Always use MCP tools, never create documents manually
- Follow exact template structures
- Get explicit user approval between phases
- Complete phases in sequence (no skipping)
- Approval requests: provide filePath only, never content
- BLOCKING: Never proceed if delete-approval fails
- CRITICAL: Must have approved status AND successful cleanup before next phase
- CRITICAL: Verbal approval is NEVER accepted - dashboard or VS Code extension only
- NEVER proceed on user saying "approved" - check system status only`;
}
//# sourceMappingURL=steering-guide.js.map