Skip to content

Commit 8da3a74

Browse files
committed
docs: add state machine and component diagrams to README
1 parent 67d7094 commit 8da3a74

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,72 @@ The state machine drives the entire flow. Each state uses GitHub MCP tools via s
2020

2121
---
2222

23+
## Diagrams
24+
25+
### State Machine
26+
27+
```mermaid
28+
stateDiagram-v2
29+
direction LR
30+
[*] --> Idle
31+
Idle --> Analyzing
32+
Analyzing --> Branching
33+
Branching --> Editing
34+
Editing --> Validating
35+
Validating --> Committing
36+
Committing --> PrCreating
37+
PrCreating --> Reviewing
38+
Reviewing --> Documenting
39+
Documenting --> [*]
40+
```
41+
42+
**State descriptions:**
43+
44+
- **Idle** — Fetches repository metadata and full issue body from GitHub via MCP. Reads labels and default branch.
45+
- **Analyzing** — Asks Claude to produce an implementation plan: branch name, files to modify, summary, and whether tests are required. Retries up to 3 times if JSON parse fails.
46+
- **Branching** — Creates a new feature branch from the default branch. Idempotent: if the branch already exists, resumes from it.
47+
- **Editing** — For each file in the plan, runs a ReAct loop: reads current content, asks Claude to edit it, commits the result via `create_or_update_file`. Max 20 turns per file.
48+
- **Validating** — Runs four gates: file safety blocklist, merge conflict pre-flight, diff size, and test coverage intent. Blocks on critical failures; warns on soft failures.
49+
- **Committing** — Confirms the final commit SHA is present on the branch by calling `get_branch`. Records the commit URL.
50+
- **PrCreating** — Generates a PR title and body via Claude, then opens the pull request. Idempotent: checks for an existing open PR from the same branch before creating.
51+
- **Reviewing** — Posts a bot review comment explaining what changed and why. Requests reviewers from `GSD_REVIEWERS` env var if configured.
52+
- **Documenting** — Updates `docs/github-mcp-tools.md` and `CHANGELOG.md` on the default branch. If `GSD_AUTO_MERGE=true`, squash-merges the PR.
53+
54+
---
55+
56+
### Component Topology
57+
58+
```mermaid
59+
flowchart LR
60+
subgraph Orchestrator["GSD Orchestrator (.NET 10)"]
61+
SM[GsdStateMachine]
62+
MCP[McpStdioClient]
63+
LLM[Anthropic.SDK]
64+
CP[FileCheckpointStore]
65+
end
66+
67+
subgraph GitHub["GitHub"]
68+
MCPS[github-mcp-server.exe]
69+
GHAPI[GitHub API]
70+
end
71+
72+
subgraph Anthropic["Anthropic"]
73+
CLAUDE[Claude API]
74+
end
75+
76+
subgraph Storage["Local Storage"]
77+
CKPT[.gsd/state/]
78+
end
79+
80+
SM --> MCP
81+
MCP -->|stdio| MCPS
82+
MCPS --> GHAPI
83+
SM --> LLM
84+
LLM --> CLAUDE
85+
SM --> CP
86+
CP --> CKPT
87+
```
88+
2389
## Prerequisites
2490

2591
- Windows (Task Scheduler integration for auto-start)

0 commit comments

Comments
 (0)