architect-to-product 0.1.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.
Files changed (55) hide show
  1. package/.mcp.json +9 -0
  2. package/LICENSE +21 -0
  3. package/README.md +306 -0
  4. package/package.json +36 -0
  5. package/setup.sh +66 -0
  6. package/src/index.ts +14 -0
  7. package/src/prompts/build-slice.ts +203 -0
  8. package/src/prompts/deploy.ts +124 -0
  9. package/src/prompts/e2e-testing.ts +83 -0
  10. package/src/prompts/onboarding.ts +217 -0
  11. package/src/prompts/planning.ts +99 -0
  12. package/src/prompts/refactor.ts +81 -0
  13. package/src/prompts/security-gate.ts +128 -0
  14. package/src/prompts/shared.ts +13 -0
  15. package/src/server.ts +367 -0
  16. package/src/state/state-manager.ts +459 -0
  17. package/src/state/types.ts +175 -0
  18. package/src/state/validators.ts +163 -0
  19. package/src/tools/add-slice.ts +147 -0
  20. package/src/tools/complete-phase.ts +79 -0
  21. package/src/tools/create-build-plan.ts +233 -0
  22. package/src/tools/generate-deployment.ts +167 -0
  23. package/src/tools/get-checklist.ts +216 -0
  24. package/src/tools/get-state.ts +48 -0
  25. package/src/tools/init-project.ts +193 -0
  26. package/src/tools/record-finding.ts +57 -0
  27. package/src/tools/run-e2e.ts +70 -0
  28. package/src/tools/run-quality.ts +75 -0
  29. package/src/tools/run-sast.ts +224 -0
  30. package/src/tools/run-tests.ts +122 -0
  31. package/src/tools/set-architecture.ts +179 -0
  32. package/src/tools/setup-companions.ts +197 -0
  33. package/src/tools/update-slice.ts +109 -0
  34. package/src/utils/constants.ts +2 -0
  35. package/src/utils/process-runner.ts +38 -0
  36. package/tests/e2e-workflow.test.ts +1010 -0
  37. package/tests/integration/__snapshots__/mcp-json-schema.test.ts.snap +85 -0
  38. package/tests/integration/mcp-dry-run.test.ts +689 -0
  39. package/tests/integration/mcp-json-schema.test.ts +431 -0
  40. package/tests/process-runner.test.ts +88 -0
  41. package/tests/prompts/deploy-paths.test.ts +422 -0
  42. package/tests/prompts/mcp-integration.test.ts +756 -0
  43. package/tests/state-manager.test.ts +651 -0
  44. package/tests/tools/add-slice.test.ts +293 -0
  45. package/tests/tools/complete-phase.test.ts +197 -0
  46. package/tests/tools/create-build-plan.test.ts +293 -0
  47. package/tests/tools/deployment.test.ts +383 -0
  48. package/tests/tools/init-project.test.ts +103 -0
  49. package/tests/tools/run-tests.test.ts +186 -0
  50. package/tests/tools/set-architecture.test.ts +534 -0
  51. package/tests/tools/setup-companions.test.ts +399 -0
  52. package/tests/tools/tool-hardening.test.ts +555 -0
  53. package/tests/tools/update-slice.test.ts +226 -0
  54. package/tsconfig.json +19 -0
  55. package/vitest.config.ts +8 -0
package/.mcp.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "mcpServers": {
3
+ "codebase-memory": {
4
+ "command": "codebase-memory-mcp",
5
+ "args": [],
6
+ "env": {}
7
+ }
8
+ }
9
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Bernhard Jackiewicz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,306 @@
1
+ # A2P — Architect-to-Product
2
+
3
+ MCP server that turns AI-generated code into production-ready software with TDD, security scanning, and deployment automation. Up to 100 times fewer exploration tokens for claude code.
4
+
5
+ **15 MCP tools** · **527 tests** · **Architecture → Plan → Build → Security → Deploy**
6
+
7
+ [![npm version](https://img.shields.io/npm/v/architect-to-product)](https://www.npmjs.com/package/architect-to-product)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
9
+ [![Tests: 527 passing](https://img.shields.io/badge/tests-527%20passing-brightgreen)]()
10
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.9-blue)]()
11
+
12
+ ---
13
+
14
+ Vibe coding with Claude Code, Cursor, or any AI coding assistant generates code fast — but ships it without tests, with security holes, and with no deployment story. You spend more time fixing what the AI wrote than you saved.
15
+
16
+ - AI-generated code frequently introduces security vulnerabilities — and coding agents will delete validation, disable auth, or relax database policies just to make errors go away
17
+ - "It works on my machine" turns into a 3am production incident
18
+
19
+ **Architect-to-Product** is an MCP server that turns AI-generated code into production-ready software. It adds TDD, static code analysis, and deployment automation to AI coding workflows.
20
+
21
+ AI-driven test driven development (AI TDD) ensures every feature works. Built-in SAST tools (Semgrep for all languages, Bandit for Python) run static code analysis and OWASP Top 10 reviews before deploy. Stack-specific deployment configs mean you ship on day one, not day thirty.
22
+
23
+ ## Quick Start
24
+
25
+ ```bash
26
+ npm install -g architect-to-product
27
+ claude mcp add architect-to-product -- npx architect-to-product
28
+ ```
29
+
30
+ Then restart Claude Code and type: **`/a2p`**
31
+
32
+ The onboarding will co-develop your architecture, auto-configure companion MCP servers, and install SAST tools. One restart, then you're building.
33
+
34
+ ## What A2P Actually Does
35
+
36
+ A2P is an MCP server that orchestrates an AI engineering workflow. Instead of vibe coding features, A2P builds software in vertical slices with TDD and security gates.
37
+
38
+ It coordinates:
39
+ - **Up to 100x fewer exploration tokens** — codebase-memory-mcp builds a code graph instead of scanning files raw
40
+ - **Test-driven development** — every feature has tests before implementation
41
+ - **Static code analysis** — Semgrep + Bandit scan for vulnerabilities automatically
42
+ - **Security reviews** — OWASP Top 10 review before deploy
43
+ - **Deployment generation** — stack-specific Dockerfile, docker-compose, Caddyfile, backup scripts
44
+
45
+ A2P is not a replacement for engineers. It is an engineering safety net for AI-generated code.
46
+
47
+ ## Without vs. With architect-to-product
48
+
49
+ | Without a2p | With a2p |
50
+ |---|---|
51
+ | Vibe code a feature | Architecture-driven vertical slices |
52
+ | Manually write some tests (maybe) | TDD per slice: RED → GREEN → REFACTOR |
53
+ | Miss security vulnerabilities | Automated SAST + OWASP Top 10 review |
54
+ | Copy-paste a Dockerfile from StackOverflow | Generated Dockerfile + docker-compose + Caddyfile + backup scripts |
55
+ | Hope for the best | Ship to production with confidence |
56
+
57
+ ## Key Benefits
58
+
59
+ - **100x fewer tokens** — Code graph intelligence via codebase-memory-mcp replaces raw file scanning — saves context window and money
60
+ - **Develop faster** — Vertical slices with TDD, no yak shaving
61
+ - **Fewer bugs** — AI-driven test driven development (TDD): every feature has tests before implementation (RED → GREEN → REFACTOR)
62
+ - **Ship secure** — Static code analysis (Semgrep + Bandit) + OWASP Top 10 review built into the AI coding workflow
63
+ - **Deploy on day one** — Stack-specific Dockerfile, docker-compose, Caddyfile, backup scripts
64
+ - **Code quality** — Built-in code quality tool: dead code detection, redundancy analysis, coupling metrics
65
+ - **Any stack** — Python, TypeScript, Go, Rust, Java, Ruby, PHP, C#, PostgreSQL, MySQL, MongoDB, Redis
66
+
67
+ ## How it works
68
+
69
+ The full AI workflow automation pipeline:
70
+
71
+ ```
72
+ AI Assistant
73
+
74
+
75
+ Architecture
76
+
77
+
78
+ Planning (vertical slices)
79
+
80
+
81
+ Build (TDD loop per slice)
82
+
83
+
84
+ Security Gate (SAST + OWASP)
85
+
86
+
87
+ Deployment
88
+ ```
89
+
90
+ For multi-phase projects (e.g. Phase 0: Spikes, Phase 1: MVP, Phase 2: Scale), this loop repeats per phase automatically.
91
+
92
+ ```
93
+ Phase 0: Plan → Build → Security → Deploy → complete_phase
94
+ Phase 1: Plan → Build → Security → Deploy → complete_phase
95
+ ...
96
+ ```
97
+
98
+ 1. **Onboarding**: Capture or co-develop the AI software architecture. Detect database and frontend tech. Describe UI via text, upload wireframes/mockups/screenshots, or let AI generate a design concept. Set up companion MCP servers via the MCP protocol. If the architecture defines phases, they get extracted automatically.
99
+ 2. **Planning**: Break the architecture into ordered vertical slices, each a deployable feature unit with acceptance criteria. Three slice types: `feature` (default), `integration` (library/API adapters with TDD), `infrastructure` (CI, auth, monitoring).
100
+ 3. **Build Loop**: TDD per slice: RED (write failing tests) → GREEN (minimal implementation) → REFACTOR (clean up) → SAST (lightweight AI security testing). Frontend slices with `hasUI: true` get visual verification via Playwright between GREEN and REFACTOR. Configurable review checkpoints (`reviewMode`: `off`, `all`, `ui-only`) pause after slices for human approval. Domain logic triggers a WebSearch step before tests to verify facts (tax rates, regulations, standards).
101
+ 4. **Security Gate**: Full SAST scan (static code analysis via Semgrep + Bandit), OWASP Top 10 manual review, dependency audit. Acts as an AI code review tool and AI code scanner for your entire codebase. Fix all critical/high findings.
102
+ 5. **Deployment**: Generate Dockerfile, docker-compose, Caddyfile, backup scripts, hardening guides. Stack-specific launch checklist.
103
+
104
+ ## Client Configuration
105
+
106
+ Works with Claude Code, Cursor AI, and any MCP-compatible AI coding assistant:
107
+
108
+ ### Claude Code (CLI)
109
+
110
+ ```bash
111
+ claude mcp add architect-to-product -- npx architect-to-product
112
+ ```
113
+
114
+ ### Claude Desktop
115
+
116
+ Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
117
+
118
+ ```json
119
+ {
120
+ "mcpServers": {
121
+ "architect-to-product": {
122
+ "command": "npx",
123
+ "args": ["architect-to-product"]
124
+ }
125
+ }
126
+ }
127
+ ```
128
+
129
+ ### Cursor AI
130
+
131
+ Add to `.cursor/mcp.json` in your project root:
132
+
133
+ ```json
134
+ {
135
+ "mcpServers": {
136
+ "architect-to-product": {
137
+ "command": "npx",
138
+ "args": ["architect-to-product"]
139
+ }
140
+ }
141
+ }
142
+ ```
143
+
144
+ ### VS Code
145
+
146
+ Add to `.vscode/mcp.json`:
147
+
148
+ ```json
149
+ {
150
+ "servers": {
151
+ "architect-to-product": {
152
+ "command": "npx",
153
+ "args": ["architect-to-product"]
154
+ }
155
+ }
156
+ }
157
+ ```
158
+
159
+ ## MCP Tools (15)
160
+
161
+ | Tool | Phase | Description |
162
+ |------|-------|-------------|
163
+ | `a2p_init_project` | 0 | Scaffold project with CLAUDE.md, hooks, agents, state |
164
+ | `a2p_set_architecture` | 0 | Parse architecture, detect DB/frontend, extract phases, set review mode, capture UI design |
165
+ | `a2p_setup_companions` | 0 | Register companion MCP servers |
166
+ | `a2p_create_build_plan` | 1 | Architecture → ordered vertical slices (supports `append` for multi-phase) |
167
+ | `a2p_add_slice` | 1,2 | Insert a single slice mid-project (e.g. integration discovered during build) |
168
+ | `a2p_complete_phase` | 4 | Complete current product phase, advance to next |
169
+ | `a2p_get_state` | * | Read current project state (includes phase info) |
170
+ | `a2p_update_slice` | 2 | Update slice status with review checkpoints and slice summaries |
171
+ | `a2p_run_tests` | 2 | Execute test command, parse results (pytest/vitest/jest/go) |
172
+ | `a2p_run_quality` | 2.5 | Code quality analysis — dead code, redundancy, coupling metrics |
173
+ | `a2p_run_e2e` | 2.6 | Record Playwright E2E test results |
174
+ | `a2p_run_sast` | 2,3 | Static code analysis with Semgrep/Bandit, deduplicated findings |
175
+ | `a2p_record_finding` | 3 | Manually record a security finding |
176
+ | `a2p_generate_deployment` | 4 | Stack-specific deployment guidance |
177
+ | `a2p_get_checklist` | 4 | Pre/post-deployment verification checklist |
178
+
179
+ ## Prompts (7)
180
+
181
+ MCP prompts are invoked with `/` in Claude Code:
182
+
183
+ | Command | What it does |
184
+ |---------|-------------|
185
+ | `/a2p` | Start onboarding — define architecture, UI design, tech stack, companions |
186
+ | `/a2p_planning` | Break architecture into ordered vertical slices |
187
+ | `/a2p_build_slice` | Build the current slice with TDD (RED → GREEN → REFACTOR → SAST) |
188
+ | `/a2p_refactor` | Code quality tool — analyze codebase for dead code, redundancy, coupling |
189
+ | `/a2p_e2e_testing` | AI testing tool — run visual E2E tests with Playwright |
190
+ | `/a2p_security_gate` | Full SAST scan + OWASP Top 10 review |
191
+ | `/a2p_deploy` | Generate deployment configs and launch checklist |
192
+
193
+ ### When to use which prompt
194
+
195
+ You don't have to run the full pipeline. Each prompt works standalone — pick what you need:
196
+
197
+ **Full project from scratch:**
198
+ `/a2p` → `/a2p_planning` → `/a2p_build_slice` (repeat per slice) → `/a2p_security_gate` → `/a2p_deploy`
199
+
200
+ **MVP built with vibe coding, now make it production-ready:**
201
+ - `/a2p_security_gate` — find the vulnerabilities that vibe coding missed
202
+ - `/a2p_refactor` — clean up the spaghetti, remove dead code
203
+ - `/a2p_deploy` — generate Dockerfile, docker-compose, Caddyfile instead of guessing
204
+
205
+ **Added features without tests, need confidence before shipping:**
206
+ - `/a2p_refactor` — identify dead code and coupling from the feature sprawl
207
+ - `/a2p_e2e_testing` — visually verify nothing is broken
208
+ - `/a2p_security_gate` — catch injection, auth holes, hardcoded secrets
209
+
210
+ **Existing project, just need deployment:**
211
+ - `/a2p_deploy` — stack-specific configs, backup scripts, hardening guide
212
+
213
+ **Built the MVP with slices, now entering Phase 2:**
214
+ - `/a2p_planning` — create new slices for the next phase
215
+ - `/a2p_build_slice` — TDD per slice as usual
216
+
217
+ ## Supported Stacks
218
+
219
+ | Category | Technologies |
220
+ |----------|-------------|
221
+ | **Languages** | Python, TypeScript/Node.js, Go, Rust, Java/Kotlin, Ruby, PHP, C#/.NET |
222
+ | **Databases** | SQLite, PostgreSQL, MySQL/MariaDB, MongoDB, Redis |
223
+ | **Hosting** | Hetzner, DigitalOcean, AWS, Fly.io, Railway, Vercel, Cloudflare, Render, any VPS |
224
+
225
+ ## Supported Deploy Targets
226
+
227
+ | Target | Method | What gets generated |
228
+ |--------|--------|-------------------|
229
+ | **Docker VPS** (Hetzner, DigitalOcean, any VPS) | Dockerfile + docker-compose + Caddy | Dockerfile, docker-compose.prod.yml, Caddyfile, backup.sh, DEPLOYMENT.md |
230
+ | **Vercel** | Vercel CLI | vercel.json, Edge Middleware, env var setup |
231
+ | **Cloudflare** (Pages/Workers) | Wrangler CLI / MCP | wrangler.toml, Page Rules, DNS config |
232
+ | **Railway** | Railway CLI | railway.toml / Procfile, service config |
233
+ | **Fly.io** | Fly CLI | fly.toml, secrets, volumes |
234
+ | **Render** | Blueprint | render.yaml, health checks, auto-deploy |
235
+
236
+ Each deploy path includes: env var handling, basic hardening, smoke checks, and domain checklist.
237
+
238
+ ## Companion MCP Servers
239
+
240
+ a2p auto-configures companion MCP servers based on your tech stack. Each companion is integration-tested against its real server to verify tool availability. These MCP tools extend your AI development tool with specialized capabilities.
241
+
242
+ ### Core (always installed)
243
+
244
+ | Companion | What it adds | Verified Tools |
245
+ |-----------|-------------|----------------|
246
+ | [codebase-memory-mcp](https://github.com/DeusData/codebase-memory-mcp) | Code graph intelligence — up to 100x fewer exploration tokens vs. raw file scanning | 11 tools: `index_repository`, `search_graph`, `search_code`, `trace_call_path`, ... |
247
+ | [mcp-server-git](https://github.com/modelcontextprotocol/servers) | Git history, commits, diffs | 12 tools: `git_log`, `git_diff`, `git_commit`, `git_status`, ... |
248
+ | [@modelcontextprotocol/server-filesystem](https://github.com/modelcontextprotocol/servers) | File operations | 14 tools: `write_file`, `list_directory`, `read_file`, `search_files`, ... |
249
+ | [@modelcontextprotocol/server-sequential-thinking](https://github.com/modelcontextprotocol/servers) | Step-by-step reasoning for complex decisions | 1 tool: `sequentialthinking` |
250
+
251
+ ### Conditional (installed based on stack)
252
+
253
+ | Companion | When | Verified Tools |
254
+ |-----------|------|----------------|
255
+ | [Playwright MCP](https://github.com/microsoft/playwright-mcp) | Frontend projects | 22 tools: `browser_navigate`, `browser_click`, `browser_fill_form`, `browser_take_screenshot`, `browser_resize`, ... |
256
+ | [GitHub MCP](https://github.com/github/github-mcp-server) | GitHub repos | 41 tools: `list_issues`, `create_pull_request`, `search_code`, `get_file_contents`, ... |
257
+ | [Supabase MCP](https://github.com/supabase-community/supabase-mcp) | Supabase projects | 29 tools: `execute_sql`, `list_tables`, `apply_migration`, `deploy_edge_function`, ... |
258
+ | [@stripe/mcp](https://github.com/stripe/agent-toolkit) | Payment/billing | 28 tools: `create_product`, `create_price`, `create_payment_link`, `create_customer`, ... |
259
+ | [@cloudflare/mcp-server-cloudflare](https://github.com/cloudflare/mcp-server-cloudflare) | Cloudflare hosting | 85 tools: `worker_deploy`, `kv_put`, `d1_query`, `r2_put_object`, `zones_list`, `secret_put`, ... |
260
+ | [@sentry/mcp-server](https://github.com/getsentry/sentry-mcp-server) | Error tracking | 22 tools: `list_issues`, `get_issue_details`, `find_projects`, `analyze_issue_with_seer`, ... |
261
+ | [@upstash/mcp-server](https://github.com/upstash/mcp-server) | Serverless Redis/Queue | 26 tools: `redis_database_run_redis_commands`, `qstash_publish_message`, `workflow_logs_list`, ... |
262
+ | [Semgrep MCP](https://semgrep.dev/) | Semgrep Pro users | `semgrep_scan`, `security_check`, `get_abstract_syntax_tree` (OSS uses CLI fallback) |
263
+ | [Atlassian MCP](https://developer.atlassian.com/) | Jira/Confluence | Remote MCP via OAuth |
264
+
265
+ ### Database MCPs
266
+
267
+ | Companion | When |
268
+ |-----------|------|
269
+ | [@modelcontextprotocol/server-postgres](https://github.com/modelcontextprotocol/servers) | PostgreSQL |
270
+ | [@mongodb-js/mongodb-mcp-server](https://github.com/mongodb-js/mongodb-mcp-server) | MongoDB |
271
+ | [mcp-server-mysql](https://github.com/benborla/mcp-server-mysql) | MySQL/MariaDB |
272
+
273
+ ### CLI-only (no MCP server, uses CLI commands)
274
+
275
+ | Tool | When |
276
+ |------|------|
277
+ | Vercel CLI (`vercel`) | Vercel / Next.js hosting |
278
+ | Clerk | Auth integration |
279
+ | Resend | Email integration |
280
+
281
+ > **Security note:** Companion MCPs are third-party software with access to your project files and databases. Before enabling a companion: check the source repo (author, stars, open issues), review the `.mcp.json` that gets generated, and confirm you trust the server. Official packages (`@modelcontextprotocol/*`, `@playwright/mcp`, `mcp.supabase.com`) are maintained by their respective organizations. Community packages are not audited by us — use at your own discretion.
282
+
283
+ ## How is this different?
284
+
285
+ - **vs. AI coding assistants alone (Claude Code, Cursor AI, Copilot)** — They generate code. a2p adds the TDD, security scanning, and deployment that AI coding assistants skip.
286
+ - **vs. create-\*-app scaffolders** — Static templates vs. dynamic architecture-driven AI app builder with TDD and security gates.
287
+ - **vs. manual deployment setup** — Weeks of DevOps vs. generated configs on day one.
288
+ - **vs. vibe coding without a2p** — You ship fast but accumulate security debt, untested features, and manual deployment. a2p is the safety net that makes vibe coding production-viable.
289
+
290
+ Works alongside autonomous AI agents — a2p adds the engineering rigor (TDD, SAST, deployment) that autonomous AI coding needs.
291
+
292
+ ## Development
293
+
294
+ ```bash
295
+ git clone https://github.com/BernhardJackiewicz/architect-to-product.git
296
+ cd architect-to-product
297
+ npm install
298
+ npm run typecheck # Type checking
299
+ npm test # 527 tests
300
+ npm run build # Build
301
+ npm run dev # Dev mode
302
+ ```
303
+
304
+ ## License
305
+
306
+ MIT
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "architect-to-product",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "dist/index.js",
6
+ "bin": {
7
+ "architect-to-product": "dist/index.js"
8
+ },
9
+ "scripts": {
10
+ "build": "tsc",
11
+ "dev": "tsx src/index.ts",
12
+ "test": "vitest run",
13
+ "test:watch": "vitest",
14
+ "typecheck": "tsc --noEmit"
15
+ },
16
+ "keywords": [
17
+ "mcp",
18
+ "architecture",
19
+ "tdd",
20
+ "code-quality"
21
+ ],
22
+ "author": "",
23
+ "license": "MIT",
24
+ "description": "MCP server that turns software architectures into tested, secure products",
25
+ "dependencies": {
26
+ "@modelcontextprotocol/sdk": "^1.27.1",
27
+ "zod": "^4.3.6"
28
+ },
29
+ "devDependencies": {
30
+ "@playwright/mcp": "^0.0.68",
31
+ "@types/node": "^25.5.0",
32
+ "tsx": "^4.21.0",
33
+ "typescript": "^5.9.3",
34
+ "vitest": "^4.1.0"
35
+ }
36
+ }
package/setup.sh ADDED
@@ -0,0 +1,66 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ echo "=== architect-to-product Setup ==="
5
+ echo ""
6
+
7
+ # 1. Build the MCP server
8
+ echo "1/4 Building MCP server..."
9
+ npm install
10
+ npm run build
11
+ echo " ✓ Built successfully"
12
+
13
+ # 2. Register architect-to-product in Claude Code
14
+ echo ""
15
+ echo "2/4 Registering architect-to-product MCP server..."
16
+ claude mcp add architect-to-product -- node "$(pwd)/dist/index.js"
17
+ echo " ✓ Registered"
18
+
19
+ # 3. Install codebase-memory-mcp
20
+ echo ""
21
+ echo "3/4 Installing codebase-memory-mcp..."
22
+ ARCH=$(uname -m)
23
+ OS=$(uname -s | tr '[:upper:]' '[:lower:]')
24
+
25
+ if [ "$OS" = "darwin" ] && [ "$ARCH" = "arm64" ]; then
26
+ BINARY="codebase-memory-mcp-darwin-arm64"
27
+ elif [ "$OS" = "darwin" ] && [ "$ARCH" = "x86_64" ]; then
28
+ BINARY="codebase-memory-mcp-darwin-amd64"
29
+ elif [ "$OS" = "linux" ] && [ "$ARCH" = "x86_64" ]; then
30
+ BINARY="codebase-memory-mcp-linux-amd64"
31
+ else
32
+ echo " ⚠ Unsupported platform: $OS/$ARCH"
33
+ echo " Download manually from https://github.com/DeusData/codebase-memory-mcp/releases"
34
+ BINARY=""
35
+ fi
36
+
37
+ if [ -n "$BINARY" ]; then
38
+ if command -v codebase-memory-mcp &>/dev/null; then
39
+ echo " ✓ Already installed"
40
+ else
41
+ curl -sL "https://github.com/DeusData/codebase-memory-mcp/releases/latest/download/$BINARY" -o /usr/local/bin/codebase-memory-mcp
42
+ chmod +x /usr/local/bin/codebase-memory-mcp
43
+ echo " ✓ Installed to /usr/local/bin/codebase-memory-mcp"
44
+ fi
45
+ claude mcp add codebase-memory -- codebase-memory-mcp
46
+ echo " ✓ Registered in Claude Code"
47
+ fi
48
+
49
+ # 4. Check for Playwright MCP (optional)
50
+ echo ""
51
+ echo "4/4 Checking Playwright MCP (optional, for frontend E2E testing)..."
52
+ if npm list -g @playwright/mcp &>/dev/null 2>&1; then
53
+ echo " ✓ Already installed"
54
+ else
55
+ echo " ℹ Not installed. Install later with: npm install -g @playwright/mcp"
56
+ echo " ℹ Then register: claude mcp add playwright -- npx @playwright/mcp"
57
+ fi
58
+
59
+ echo ""
60
+ echo "=== Setup complete! ==="
61
+ echo ""
62
+ echo "Start a new project:"
63
+ echo " 1. Open Claude Code"
64
+ echo " 2. Use the a2p prompt"
65
+ echo " 3. Or call a2p_init_project directly"
66
+ echo ""
package/src/index.ts ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
3
+ import { createServer } from "./server.js";
4
+
5
+ async function main() {
6
+ const server = createServer();
7
+ const transport = new StdioServerTransport();
8
+ await server.connect(transport);
9
+ }
10
+
11
+ main().catch((err) => {
12
+ console.error("Fatal:", err);
13
+ process.exit(1);
14
+ });
@@ -0,0 +1,203 @@
1
+ import { ENGINEERING_LOOP } from "./shared.js";
2
+
3
+ export const BUILD_SLICE_PROMPT = `Du bist ein TDD-Engineer, der einen Slice nach dem Anthropic-Workflow baut: RED → GREEN → REFACTOR → SAST.
4
+ ${ENGINEERING_LOOP}
5
+ ## Kontext
6
+ Lies zuerst den aktuellen State mit \`a2p_get_state\`. Der aktuelle Slice und seine Akzeptanzkriterien stehen dort.
7
+
8
+ ## Scope-Lock
9
+ Halte den Scope strikt auf die Akzeptanzkriterien des aktuellen Slice begrenzt.
10
+ - Keine neuen Features im GREEN
11
+ - Keine Architektur-Umbauten im REFACTOR
12
+ - Keine Test-Änderungen im GREEN (ausser offensichtliche Test-Infrastruktur-Fixes)
13
+ - Scope-Erweiterungen → neuer Slice oder explizite Planänderung
14
+
15
+ ## Phase EXPLORE: Kontext aufbauen
16
+ Bevor du Code schreibst — verstehe die Situation:
17
+
18
+ 1. Lies State und Akzeptanzkriterien des aktuellen Slice
19
+ 2. Wenn codebase-memory-mcp verfügbar:
20
+ - \`index_repository\` — Index aktualisieren
21
+ - \`search_code\` — existierenden Code finden der zum Slice passt (verhindert doppelte Implementierungen)
22
+ - \`trace_call_path\` — verstehen wie bestehender Code zusammenhängt
23
+ 3. Lies betroffene Dateien und angrenzenden Code
24
+ 4. Formuliere einen Mini-Plan: Ziel, betroffene Dateien, Risiken
25
+
26
+ ### Domänenwissen prüfen
27
+ Wenn der Slice Fachlogik enthält (Berechnungen, Steuersätze, rechtliche Regeln, Branchenstandards):
28
+ 1. Nutze WebSearch um relevante Fakten zu verifizieren
29
+ 2. Wenn unklar → Rückfrage an den Menschen
30
+ 3. Dokumentiere recherchierte Fakten als Kommentar in den Tests
31
+
32
+ ## TDD-Zyklus (STRIKT einhalten!)
33
+
34
+ ### Phase RED: Tests schreiben
35
+ **Ziel**: Fehlschlagende Tests, die die Akzeptanzkriterien abdecken.
36
+
37
+ Nutze den test-writer Subagent (.claude/agents/test-writer.md) für Kontext-Isolation — Tests werden isoliert geschrieben, nicht zusammen mit Implementation.
38
+
39
+ 1. Schreibe Tests die FEHLSCHLAGEN:
40
+ - Happy Path (Normalfall)
41
+ - Edge Cases (leere Eingaben, Grenzwerte)
42
+ - Error Cases (ungültige Eingaben, fehlende Auth)
43
+ 2. Führe Tests aus mit \`a2p_run_tests\` — sie MÜSSEN fehlschlagen
44
+ 3. Markiere Slice als "red" mit \`a2p_update_slice\`
45
+
46
+ **Schreibe KEINE Implementation in dieser Phase!**
47
+
48
+ ### Phase GREEN: Minimale Implementation
49
+ **Ziel**: Tests grün machen mit minimalem Code.
50
+
51
+ 1. Schreibe die minimale Implementation, damit alle Tests grün werden
52
+ 2. Keine Über-Engineering! Nur was nötig ist, damit Tests passen
53
+ 3. Führe Tests aus mit \`a2p_run_tests\` — sie MÜSSEN jetzt bestehen
54
+ 4. Markiere Slice als "green" mit \`a2p_update_slice\`
55
+
56
+ **Ändere NICHT die Tests in dieser Phase!**
57
+
58
+ ### Datenbank-Slices (wenn DB-MCP verfügbar)
59
+ Wenn der Slice Datenbank-Änderungen enthält (Migrations, Schema, CRUD):
60
+ 1. Prüfe das aktuelle Schema mit dem DB-MCP (z.B. \`list_tables\`, \`describe_table\`)
61
+ 2. Nach Migrations: Verifiziere dass das Schema korrekt angelegt wurde
62
+ 3. Nach Seed-Data: Prüfe dass Testdaten vorhanden sind
63
+ 4. Bei CRUD: Teste mit echten DB-Queries ob die Daten korrekt gespeichert werden
64
+
65
+ ### UI-Design als Referenz nutzen (bei Frontend-Slices)
66
+ Wenn der aktuelle Slice \`hasUI: true\` hat UND \`architecture.uiDesign\` existiert:
67
+ 1. Lies die \`uiDesign.description\` und den \`style\` aus dem State
68
+ 2. Prüfe die \`references\`:
69
+ - Wenn \`type: "wireframe"\` oder \`"mockup"\` oder \`"screenshot"\` mit \`path\` → lies das Bild und verwende es als visuelle Referenz
70
+ - Wenn \`type: "description"\` → nutze den Text als Designvorgabe
71
+ 3. Implementiere das UI **gemäss diesen Vorgaben** — nicht nach eigenem Ermessen
72
+
73
+ ### Visual Verification (nur bei Frontend-Slices)
74
+ Wenn der aktuelle Slice \`hasUI: true\` hat (Frontend-Komponenten, Seiten, Formulare):
75
+
76
+ **PFLICHT nach GREEN, vor REFACTOR:**
77
+ 1. App starten (oder sicherstellen dass sie läuft)
78
+ 2. \`browser_navigate\` zur relevanten Seite
79
+ 3. \`browser_take_screenshot\` — visueller Check:
80
+ - Stimmt es mit den uiDesign-References überein?
81
+ - Layout, Abstände, Farben konsistent?
82
+ 4. \`browser_console_messages\` — keine Errors?
83
+ 5. Interaktionen testen:
84
+ - \`browser_click\` — Buttons, Navigation
85
+ - \`browser_fill_form\` — Formulare, Validierung
86
+ 6. \`browser_resize\` auf Mobile (375x667) → Screenshot → zurück Desktop (1280x720)
87
+
88
+ **Wenn visuell nicht ok:** Fix in GREEN Phase, erneut prüfen.
89
+ **Wenn kein Frontend (\`hasUI\` nicht gesetzt):** direkt zu REFACTOR.
90
+
91
+ ### Phase REFACTOR: Code aufräumen
92
+ **Ziel**: Code-Qualität verbessern ohne Verhalten zu ändern.
93
+
94
+ 1. Prüfe: Funktionen <50 Zeilen? Selbsterklärende Namen? Keine Duplizierung? Error Handling? Types?
95
+ 2. Refactore wo nötig
96
+ 3. Führe Tests aus nach JEDEM Refactoring — müssen grün bleiben
97
+ 4. Markiere Slice als "refactor" mit \`a2p_update_slice\`
98
+
99
+ ### Phase SAST: Security-Prüfung
100
+ **Ziel**: Offensichtliche Security-Issues im neuen Code finden.
101
+
102
+ 1. Rufe \`a2p_run_sast\` mit mode="slice" auf
103
+ 2. Führe \`a2p_run_tests\` aus — finale Bestätigung
104
+ 3. Wenn codebase-memory-mcp verfügbar: \`index_repository\` — Graph aktualisieren
105
+ 4. Findings triagieren:
106
+ - CRITICAL/HIGH → sofort fixen, Tests + SAST wiederholen
107
+ - MEDIUM → fixen wenn einfach, sonst dokumentieren
108
+ - LOW → dokumentieren
109
+ 5. Markiere Slice als "sast" und dann "done" mit \`a2p_update_slice\`
110
+
111
+ ## Nach jedem abgeschlossenen Slice: Summary ausgeben
112
+ Erstelle eine kurze Zusammenfassung:
113
+
114
+ **Akzeptanzkriterien:**
115
+ - [Was der Slice laut Plan können soll]
116
+
117
+ **Tests prüfen:**
118
+ - [Konkrete Testfälle mit Beispielwerten]
119
+
120
+ **Implementiertes Verhalten:**
121
+ - [Was tatsächlich gebaut wurde, inkl. Annahmen und Einschränkungen]
122
+
123
+ **Recherchierte Fakten:**
124
+ - [Falls WebSearch genutzt wurde: Quellen und verifizierte Werte]
125
+
126
+ ## Checkpoint nach Slice-Completion
127
+ Prüfe den Output von \`a2p_update_slice\`:
128
+ - Wenn \`awaitingHumanReview: true\` → STOPPE. Zeige die Summary.
129
+ Sage: "Slice X ist fertig. Bitte reviewe und bestätige, bevor ich
130
+ mit dem nächsten Slice fortfahre."
131
+ Warte auf explizite Bestätigung.
132
+ - Wenn \`awaitingHumanReview: false\` → Zeige die Summary, fahre fort.
133
+
134
+ ## Git-Commits nach jeder TDD-Phase (wenn Git MCP verfügbar)
135
+ Wenn der Git MCP konfiguriert ist, committe nach jeder abgeschlossenen Phase:
136
+ - Nach RED: \`test:\` commit — \`git_log\` prüfen, \`git_diff\` für Änderungen
137
+ - Nach GREEN: \`feat:\` commit
138
+ - Nach REFACTOR: \`refactor:\` commit
139
+ Nutze konventionelle Commit-Messages: \`feat:\`, \`test:\`, \`refactor:\`
140
+
141
+ ## Filesystem MCP für Migrations (wenn Filesystem MCP verfügbar)
142
+ Wenn der Filesystem MCP konfiguriert ist:
143
+ - Nutze \`write_file\` für Migration-Dateien (konsistente Formatierung)
144
+ - Nutze \`list_directory\` um bestehende Migrations zu prüfen
145
+ - Stelle sicher dass Migration-Dateien korrekt benannt sind (Timestamp-Prefix)
146
+
147
+ ## Semgrep MCP bevorzugt vor CLI (wenn Semgrep Pro MCP verfügbar)
148
+ Wenn der Semgrep MCP konfiguriert ist (braucht Semgrep Pro Engine), bevorzuge ihn vor dem CLI-Aufruf:
149
+ - Nutze \`semgrep_scan\` für gezielte Scans einzelner Dateien
150
+ - Nutze \`security_check\` für Security-spezifische Checks
151
+ - Nutze \`get_abstract_syntax_tree\` für tiefe Code-Analyse
152
+
153
+ Ohne Semgrep Pro: Nutze \`a2p_run_sast\` — das ruft die Semgrep CLI direkt auf (funktioniert mit der kostenlosen OSS-Version).
154
+
155
+ ## Stripe MCP bei Payment-Slices (wenn Stripe MCP verfügbar)
156
+ Wenn der Slice Payment/Billing-Funktionalität enthält und der Stripe MCP konfiguriert ist:
157
+ - Erstelle Products und Prices über den Stripe MCP
158
+ - Konfiguriere Webhooks für Payment-Events
159
+ - Teste den Payment-Flow mit Stripe-Testmodus
160
+ - Validiere Webhook-Signaturen im Code
161
+
162
+ ## Sentry MCP nach GREEN (wenn Sentry MCP verfügbar)
163
+ Wenn der Sentry MCP konfiguriert ist und der Slice einen neuen Service/Endpoint einführt:
164
+ - Konfiguriere Error-Tracking für den neuen Service
165
+ - Setze Sentry-Tags für den Slice (slice-id, phase)
166
+ - Prüfe ob Source Maps korrekt hochgeladen werden
167
+
168
+ ## Nach jedem Slice: Codebase-Index aktualisieren
169
+ Wenn codebase-memory-mcp verfügbar:
170
+ - Rufe \`index_repository\` auf — das hält den Code-Graphen aktuell für:
171
+ - Spätere Slices (finden bestehenden Code statt ihn neu zu schreiben)
172
+ - Die Refactor-Phase (Dead Code Detection braucht aktuellen Index)
173
+
174
+ Dann:
175
+ 1. Prüfe: Gibt es einen nächsten Slice? → Weiter mit dem nächsten
176
+ 2. Alle Slices done? → Weiter zur Refactoring-Phase (a2p_refactor Prompt)
177
+
178
+ ## Integration-Slices (type: "integration")
179
+ Wenn ein Slice eine externe Library/Service/API integriert:
180
+
181
+ ### RED Phase:
182
+ - Schreibe Tests die das GEWÜNSCHTE Verhalten der Integration prüfen
183
+ - Teste gegen das echte Interface, nicht gegen Mocks
184
+ - Teste Fehlerszenarien: Library nicht verfügbar, falsches Format, Timeout
185
+
186
+ ### GREEN Phase:
187
+ - Wrapper/Adapter-Pattern: eigene Schnittstelle VOR der Library
188
+ - Library-spezifischer Code NUR im Adapter, nie im Business-Code
189
+ - Konfiguration externalisieren (nicht hardcoded)
190
+ - Error Handling: Library-Exceptions in eigene Fehlertypen übersetzen
191
+
192
+ ### REFACTOR Phase:
193
+ - Ist der Adapter austauschbar?
194
+ - Sind Library-Types nach aussen geleckt?
195
+ - Gibt es unnötige Kopplungen?
196
+
197
+ ## Invarianten
198
+ - NIEMALS Tests und Implementation gleichzeitig schreiben
199
+ - NIEMALS einen Slice als "done" markieren ohne grüne Tests
200
+ - NIEMALS Security-Findings ignorieren
201
+ - Scope bleibt auf aktuellem Slice — Erweiterungen werden neue Slices
202
+ - Bei jedem Fehler: Hypothese → Test → Fix → Verify (Debugging-Workflow)
203
+ `;