feat: add MCP server for semantic code search with FastMCP integration

This commit is contained in:
catlog22
2026-03-17 23:03:20 +08:00
parent ef2c5a58e1
commit ad9d3f94e0
80 changed files with 3427 additions and 21329 deletions

View File

@@ -0,0 +1,96 @@
# Node Catalog — Available Executors
All executors available for node resolution in Phase 2.
## Skill Nodes
| Executor | Type | Input Ports | Output Ports | Typical Args Template |
|----------|------|-------------|--------------|----------------------|
| `workflow-lite-plan` | skill | requirement | plan | `"{goal}"` |
| `workflow-plan` | skill | requirement, specification | detailed-plan | `"{goal}"` |
| `workflow-execute` | skill | detailed-plan, verified-plan | code | `--resume-session {prev_session_id}` |
| `workflow-test-fix` | skill | failing-tests, code | test-passed | `--session {prev_session_id}` |
| `workflow-tdd-plan` | skill | requirement | tdd-tasks | `"{goal}"` |
| `workflow-multi-cli-plan` | skill | requirement | multi-cli-plan | `"{goal}"` |
| `review-cycle` | skill | code, session | review-findings | `--session {prev_session_id}` |
| `brainstorm` | skill | exploration-topic | brainstorm-analysis | `"{goal}"` |
| `spec-generator` | skill | requirement | specification | `"{goal}"` |
## Command Nodes (namespace skills)
| Executor | Type | Input Ports | Output Ports | Typical Args Template |
|----------|------|-------------|--------------|----------------------|
| `workflow:refactor-cycle` | command | codebase | refactored-code | `"{goal}"` |
| `workflow:integration-test-cycle` | command | requirement | test-passed | `"{goal}"` |
| `workflow:brainstorm-with-file` | command | exploration-topic | brainstorm-document | `"{goal}"` |
| `workflow:analyze-with-file` | command | analysis-topic | discussion-document | `"{goal}"` |
| `workflow:debug-with-file` | command | bug-report | understanding-document | `"{goal}"` |
| `workflow:collaborative-plan-with-file` | command | requirement | plan-note | `"{goal}"` |
| `workflow:roadmap-with-file` | command | requirement | execution-plan | `"{goal}"` |
| `workflow:unified-execute-with-file` | command | plan-note, discussion-document | code | (no args — reads from session) |
| `issue:discover` | command | codebase | pending-issues | (no args) |
| `issue:plan` | command | pending-issues | issue-plans | `--all-pending` |
| `issue:queue` | command | issue-plans | execution-queue | (no args) |
| `issue:execute` | command | execution-queue | completed-issues | `--queue auto` |
| `issue:convert-to-plan` | command | plan | converted-plan | `--latest-lite-plan` |
| `team-planex` | skill | requirement, execution-plan | code | `"{goal}"` |
## CLI Nodes
CLI nodes use `ccw cli` with a tool + mode + rule.
| Use Case | cli_tool | cli_mode | cli_rule |
|----------|----------|----------|----------|
| Architecture analysis | gemini | analysis | analysis-review-architecture |
| Code quality review | gemini | analysis | analysis-review-code-quality |
| Bug root cause | gemini | analysis | analysis-diagnose-bug-root-cause |
| Security assessment | gemini | analysis | analysis-assess-security-risks |
| Performance analysis | gemini | analysis | analysis-analyze-performance |
| Code patterns | gemini | analysis | analysis-analyze-code-patterns |
| Task breakdown | gemini | analysis | planning-breakdown-task-steps |
| Architecture design | gemini | analysis | planning-plan-architecture-design |
| Feature implementation | gemini | write | development-implement-feature |
| Refactoring | gemini | write | development-refactor-codebase |
| Test generation | gemini | write | development-generate-tests |
**CLI node args_template format**:
```
PURPOSE: {goal}
TASK: • [derived from step description]
MODE: analysis
CONTEXT: @**/* | Memory: {memory_context}
EXPECTED: [derived from step output_ports]
CONSTRAINTS: {scope}
```
## Agent Nodes
| subagent_type | Use Case | run_in_background |
|---------------|----------|-------------------|
| `general-purpose` | Freeform analysis or implementation | false |
| `team-worker` | Worker in team-coordinate pipeline | true |
| `code-reviewer` | Focused code review | false |
**Agent node args_template format**:
```
Task: {goal}
Context from previous step:
{prev_output}
Deliver: [specify expected output format]
```
## Checkpoint Nodes
Checkpoints are auto-generated — not selected from catalog.
| auto_continue | When to Use |
|---------------|-------------|
| `true` | Background save, execution continues automatically |
| `false` | Pause for user review before proceeding |
Set `auto_continue: false` when:
- The next node is user-facing (plan display, spec review)
- The user requested an explicit pause in their workflow description
- The next node spawns a background agent (give user chance to cancel)

View File

@@ -0,0 +1,202 @@
# Workflow Template Schema
## File Location
`.workflow/templates/<slug>.json`
## Full Schema
```json
{
"template_id": "wft-<slug>-<YYYYMMDD>",
"name": "Human readable template name",
"description": "Brief description of what this workflow achieves",
"version": "1.0",
"created_at": "2026-03-17T10:00:00Z",
"source_session": "WFD-<slug>-<date>",
"tags": ["feature", "medium"],
"context_schema": {
"goal": {
"type": "string",
"required": true,
"description": "Main task goal or feature to implement"
},
"scope": {
"type": "string",
"required": false,
"description": "Target file or module scope",
"default": "src/**/*"
}
},
"nodes": [
{
"id": "N-001",
"name": "Plan Feature",
"type": "skill",
"executor": "workflow-lite-plan",
"args_template": "{goal}",
"input_ports": ["requirement"],
"output_ports": ["plan"],
"parallel_group": null,
"on_fail": "abort"
},
{
"id": "CP-01",
"name": "Checkpoint: After Plan",
"type": "checkpoint",
"description": "Plan artifact saved before execution proceeds",
"auto_continue": true,
"save_fields": ["session_id", "artifacts", "output_path"]
},
{
"id": "N-002",
"name": "Execute Implementation",
"type": "skill",
"executor": "workflow-execute",
"args_template": "--resume-session {N-001.session_id}",
"input_ports": ["plan"],
"output_ports": ["code"],
"parallel_group": null,
"on_fail": "abort"
},
{
"id": "CP-02",
"name": "Checkpoint: Before Testing",
"type": "checkpoint",
"description": "Implementation complete, ready for test validation",
"auto_continue": true,
"save_fields": ["session_id", "artifacts"]
},
{
"id": "N-003",
"name": "Run Tests",
"type": "skill",
"executor": "workflow-test-fix",
"args_template": "--session {N-002.session_id}",
"input_ports": ["code"],
"output_ports": ["test-passed"],
"parallel_group": null,
"on_fail": "abort"
}
],
"edges": [
{ "from": "N-001", "to": "CP-01" },
{ "from": "CP-01", "to": "N-002" },
{ "from": "N-002", "to": "CP-02" },
{ "from": "CP-02", "to": "N-003" }
],
"checkpoints": ["CP-01", "CP-02"],
"atomic_groups": [
{
"name": "planning-execution",
"nodes": ["N-001", "CP-01", "N-002"],
"description": "Plan must be followed by execution"
}
],
"execution_mode": "serial",
"metadata": {
"node_count": 3,
"checkpoint_count": 2,
"estimated_duration": "20-40 min"
}
}
```
## Node Type Definitions
### `skill` node
```json
{
"id": "N-<seq>",
"name": "<descriptive name>",
"type": "skill",
"executor": "<skill-name>",
"args_template": "<string with {variable} and {prev-node-id.field} refs>",
"input_ports": ["<port-name>"],
"output_ports": ["<port-name>"],
"parallel_group": "<group-name> | null",
"on_fail": "abort | skip | retry"
}
```
### `cli` node
```json
{
"id": "N-<seq>",
"name": "<descriptive name>",
"type": "cli",
"executor": "ccw cli",
"cli_tool": "gemini | qwen | codex",
"cli_mode": "analysis | write",
"cli_rule": "<rule-template-name>",
"args_template": "PURPOSE: {goal}\nTASK: ...\nMODE: analysis\nCONTEXT: @**/*\nEXPECTED: ...\nCONSTRAINTS: ...",
"input_ports": ["analysis-topic"],
"output_ports": ["analysis"],
"parallel_group": null,
"on_fail": "abort"
}
```
### `command` node
```json
{
"id": "N-<seq>",
"name": "<descriptive name>",
"type": "command",
"executor": "workflow:refactor-cycle",
"args_template": "{goal}",
"input_ports": ["codebase"],
"output_ports": ["refactored-code"],
"parallel_group": null,
"on_fail": "abort"
}
```
### `agent` node
```json
{
"id": "N-<seq>",
"name": "<descriptive name>",
"type": "agent",
"executor": "general-purpose",
"args_template": "Task: {goal}\n\nContext from previous step:\n{prev_output}",
"input_ports": ["requirement"],
"output_ports": ["analysis"],
"parallel_group": "<group-name> | null",
"run_in_background": false,
"on_fail": "abort"
}
```
### `checkpoint` node
```json
{
"id": "CP-<seq>",
"name": "Checkpoint: <description>",
"type": "checkpoint",
"description": "<what was just completed, what comes next>",
"auto_continue": true,
"save_fields": ["session_id", "artifacts", "output_path"]
}
```
## Runtime Reference Syntax
In `args_template` strings, these references are resolved at execution time by `wf-player`:
| Reference | Resolves To |
|-----------|-------------|
| `{variable}` | Value from context (bound at run start) |
| `{N-001.session_id}` | `node_states["N-001"].session_id` |
| `{N-001.output_path}` | `node_states["N-001"].output_path` |
| `{N-001.artifacts[0]}` | First artifact from N-001 |
| `{prev_session_id}` | session_id of the immediately preceding work node |
| `{prev_output}` | Full output text of the immediately preceding node |
| `{prev_output_path}` | Output file path of the immediately preceding node |