didev 1.0.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 (112) hide show
  1. package/README.md +378 -0
  2. package/dist/agents/analyst.d.ts +21 -0
  3. package/dist/agents/analyst.d.ts.map +1 -0
  4. package/dist/agents/analyst.js +69 -0
  5. package/dist/agents/analyst.js.map +1 -0
  6. package/dist/agents/architect.d.ts +21 -0
  7. package/dist/agents/architect.d.ts.map +1 -0
  8. package/dist/agents/architect.js +85 -0
  9. package/dist/agents/architect.js.map +1 -0
  10. package/dist/agents/base-agent.d.ts +56 -0
  11. package/dist/agents/base-agent.d.ts.map +1 -0
  12. package/dist/agents/base-agent.js +263 -0
  13. package/dist/agents/base-agent.js.map +1 -0
  14. package/dist/agents/developer.d.ts +21 -0
  15. package/dist/agents/developer.d.ts.map +1 -0
  16. package/dist/agents/developer.js +87 -0
  17. package/dist/agents/developer.js.map +1 -0
  18. package/dist/agents/orchestrator.d.ts +23 -0
  19. package/dist/agents/orchestrator.d.ts.map +1 -0
  20. package/dist/agents/orchestrator.js +287 -0
  21. package/dist/agents/orchestrator.js.map +1 -0
  22. package/dist/agents/reviewer.d.ts +15 -0
  23. package/dist/agents/reviewer.d.ts.map +1 -0
  24. package/dist/agents/reviewer.js +65 -0
  25. package/dist/agents/reviewer.js.map +1 -0
  26. package/dist/agents/tester.d.ts +15 -0
  27. package/dist/agents/tester.d.ts.map +1 -0
  28. package/dist/agents/tester.js +64 -0
  29. package/dist/agents/tester.js.map +1 -0
  30. package/dist/bmad/method.d.ts +6 -0
  31. package/dist/bmad/method.d.ts.map +1 -0
  32. package/dist/bmad/method.js +221 -0
  33. package/dist/bmad/method.js.map +1 -0
  34. package/dist/cli/commands/agent.d.ts +10 -0
  35. package/dist/cli/commands/agent.d.ts.map +1 -0
  36. package/dist/cli/commands/agent.js +28 -0
  37. package/dist/cli/commands/agent.js.map +1 -0
  38. package/dist/cli/commands/chat.d.ts +6 -0
  39. package/dist/cli/commands/chat.d.ts.map +1 -0
  40. package/dist/cli/commands/chat.js +556 -0
  41. package/dist/cli/commands/chat.js.map +1 -0
  42. package/dist/cli/commands/config.d.ts +3 -0
  43. package/dist/cli/commands/config.d.ts.map +1 -0
  44. package/dist/cli/commands/config.js +65 -0
  45. package/dist/cli/commands/config.js.map +1 -0
  46. package/dist/cli/commands/init.d.ts +8 -0
  47. package/dist/cli/commands/init.d.ts.map +1 -0
  48. package/dist/cli/commands/init.js +204 -0
  49. package/dist/cli/commands/init.js.map +1 -0
  50. package/dist/cli/commands/mcp.d.ts +5 -0
  51. package/dist/cli/commands/mcp.d.ts.map +1 -0
  52. package/dist/cli/commands/mcp.js +836 -0
  53. package/dist/cli/commands/mcp.js.map +1 -0
  54. package/dist/cli/commands/refactor.d.ts +8 -0
  55. package/dist/cli/commands/refactor.d.ts.map +1 -0
  56. package/dist/cli/commands/refactor.js +161 -0
  57. package/dist/cli/commands/refactor.js.map +1 -0
  58. package/dist/cli/commands/review.d.ts +9 -0
  59. package/dist/cli/commands/review.d.ts.map +1 -0
  60. package/dist/cli/commands/review.js +138 -0
  61. package/dist/cli/commands/review.js.map +1 -0
  62. package/dist/core/api.d.ts +73 -0
  63. package/dist/core/api.d.ts.map +1 -0
  64. package/dist/core/api.js +206 -0
  65. package/dist/core/api.js.map +1 -0
  66. package/dist/core/config.d.ts +42 -0
  67. package/dist/core/config.d.ts.map +1 -0
  68. package/dist/core/config.js +180 -0
  69. package/dist/core/config.js.map +1 -0
  70. package/dist/core/context.d.ts +33 -0
  71. package/dist/core/context.d.ts.map +1 -0
  72. package/dist/core/context.js +235 -0
  73. package/dist/core/context.js.map +1 -0
  74. package/dist/core/file-manager.d.ts +20 -0
  75. package/dist/core/file-manager.d.ts.map +1 -0
  76. package/dist/core/file-manager.js +133 -0
  77. package/dist/core/file-manager.js.map +1 -0
  78. package/dist/core/mcp.d.ts +31 -0
  79. package/dist/core/mcp.d.ts.map +1 -0
  80. package/dist/core/mcp.js +112 -0
  81. package/dist/core/mcp.js.map +1 -0
  82. package/dist/core/session.d.ts +16 -0
  83. package/dist/core/session.d.ts.map +1 -0
  84. package/dist/core/session.js +60 -0
  85. package/dist/core/session.js.map +1 -0
  86. package/dist/index.d.ts +3 -0
  87. package/dist/index.d.ts.map +1 -0
  88. package/dist/index.js +237 -0
  89. package/dist/index.js.map +1 -0
  90. package/dist/utils/banner.d.ts +2 -0
  91. package/dist/utils/banner.d.ts.map +1 -0
  92. package/dist/utils/banner.js +50 -0
  93. package/dist/utils/banner.js.map +1 -0
  94. package/dist/utils/git.d.ts +9 -0
  95. package/dist/utils/git.d.ts.map +1 -0
  96. package/dist/utils/git.js +49 -0
  97. package/dist/utils/git.js.map +1 -0
  98. package/dist/utils/logger.d.ts +42 -0
  99. package/dist/utils/logger.d.ts.map +1 -0
  100. package/dist/utils/logger.js +98 -0
  101. package/dist/utils/logger.js.map +1 -0
  102. package/dist/utils/resilience.d.ts +17 -0
  103. package/dist/utils/resilience.d.ts.map +1 -0
  104. package/dist/utils/resilience.js +41 -0
  105. package/dist/utils/resilience.js.map +1 -0
  106. package/dist/utils/token-counter.d.ts +7 -0
  107. package/dist/utils/token-counter.d.ts.map +1 -0
  108. package/dist/utils/token-counter.js +20 -0
  109. package/dist/utils/token-counter.js.map +1 -0
  110. package/package.json +62 -0
  111. package/scripts/postinstall.mjs +54 -0
  112. package/scripts/setup-path.sh +42 -0
package/README.md ADDED
@@ -0,0 +1,378 @@
1
+ # didev — AI-Powered Development CLI
2
+
3
+ > Персональная команда AI-разработчиков прямо в вашем терминале.
4
+ > A specialized AI agent family for your codebase, powered by DeepSeek API.
5
+
6
+ **Автор:** Симонов Михаил Сергеевич
7
+
8
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-blue)](https://www.typescriptlang.org/)
9
+ [![DeepSeek API](https://img.shields.io/badge/DeepSeek-API-cyan)](https://platform.deepseek.com)
10
+ [![MCP Protocol](https://img.shields.io/badge/MCP-Protocol-green)](https://modelcontextprotocol.io)
11
+ [![Node.js](https://img.shields.io/badge/Node.js-18+-brightgreen)](https://nodejs.org)
12
+
13
+ ---
14
+
15
+ ## What is didev?
16
+
17
+ didev is a CLI tool that brings an entire team of specialized AI agents to your terminal. Unlike generic AI assistants, each agent in didev knows its role — frontend, backend, architecture, security, testing — and works in a coordinated pipeline to complete real development tasks.
18
+
19
+ **Key difference from ChatGPT / Copilot:** didev reads your actual project files, understands your codebase structure, and agents pass context to each other — each building on the previous agent's work.
20
+
21
+ ---
22
+
23
+ ## Models
24
+
25
+ | Model | Use case |
26
+ |-------|----------|
27
+ | `deepseek-v4-flash` *(default)* | Fast, 1M context window, 384K max output. Daily tasks. |
28
+ | `deepseek-v4-pro` | Thinking model — complex architecture decisions |
29
+
30
+ > **Note:** `deepseek-chat` and `deepseek-reasoner` aliases are deprecated as of 2026-07-24.
31
+
32
+ ---
33
+
34
+ ## Installation
35
+
36
+ ```bash
37
+ npm install -g didev-cli
38
+ ```
39
+
40
+ ---
41
+
42
+ ## Quick Start
43
+
44
+ ```bash
45
+ cd my-project
46
+ didev init
47
+ didev config set DEEPSEEK_API_KEY=sk-xxx
48
+ didev agent "Add JWT authentication to Express API"
49
+ didev chat
50
+ ```
51
+
52
+ ---
53
+
54
+ ## Commands
55
+
56
+ ### `didev init`
57
+ Initialize didev in the current project. Auto-detects language, framework, and project type.
58
+
59
+ ```bash
60
+ didev init # interactive
61
+ didev init --frontend # force frontend type
62
+ didev init --backend
63
+ didev init --fullstack
64
+ didev init -y # non-interactive
65
+ ```
66
+
67
+ Creates `.didev/` with config, context file, sessions dir, and BMad dirs.
68
+
69
+ ---
70
+
71
+ ### `didev config`
72
+
73
+ ```bash
74
+ didev config set DEEPSEEK_API_KEY=sk-xxx
75
+ didev config set api.model=deepseek-v4-pro
76
+ didev config set api.temperature=0.5
77
+ didev config show
78
+ ```
79
+
80
+ API key stored in `~/.didev/config.yaml` — never committed to the project.
81
+
82
+ ---
83
+
84
+ ### `didev chat`
85
+ Interactive REPL with full project context.
86
+
87
+ ```bash
88
+ didev chat
89
+ didev chat -m deepseek-v4-pro
90
+ didev chat -f src/api/routes.ts
91
+ ```
92
+
93
+ **Slash commands:** `/files` `/add <path>` `/apply` `/save` `/load <id>` `/sessions` `/clear` `/exit`
94
+
95
+ ---
96
+
97
+ ### `didev agent`
98
+ Run the multi-agent pipeline on a development task.
99
+
100
+ ```bash
101
+ didev agent "Add Stripe payment integration"
102
+ didev agent --type frontend "Build a responsive dashboard"
103
+ didev agent --mode light "Fix the login bug"
104
+ didev agent --mode developer-only "Add input validation"
105
+ didev agent --skip Tester "Quick feature"
106
+ ```
107
+
108
+ **Orchestration modes:**
109
+ | Mode | Pipeline |
110
+ |------|----------|
111
+ | `full` | Analyst → Architect → Developer → [Reviewer ∥ Tester] |
112
+ | `light` | Analyst → Developer → Reviewer |
113
+ | `developer-only` | Developer only |
114
+
115
+ > В режиме `full` стадия Reviewer и Tester выполняется **параллельно** — это сокращает общее время пайплайна.
116
+
117
+ ---
118
+
119
+ ### `didev review`
120
+
121
+ ```bash
122
+ didev review # review git diff
123
+ didev review --all # all source files
124
+ didev review --file src/api.ts
125
+ didev review --pr # vs main branch
126
+ ```
127
+
128
+ ---
129
+
130
+ ### `didev refactor`
131
+
132
+ ```bash
133
+ didev refactor "Extract service layer from controllers"
134
+ didev refactor --auto
135
+ didev refactor --dry-run "Rename userId to user_id"
136
+ ```
137
+
138
+ ---
139
+
140
+ ### `didev mcp`
141
+ Manage MCP (Model Context Protocol) servers. Connected tools become available to all agents and chat.
142
+
143
+ ```bash
144
+ # From GitHub / GitLab / Bitbucket (clones, installs, builds)
145
+ didev mcp add https://github.com/owner/repo.git
146
+ didev mcp add https://gitlab.com/owner/repo.git
147
+ didev mcp add https://bitbucket.org/owner/repo.git
148
+
149
+ # From npm
150
+ didev mcp add @modelcontextprotocol/server-filesystem
151
+
152
+ # Interactive wizard
153
+ didev mcp add
154
+
155
+ didev mcp list
156
+ didev mcp test
157
+ didev mcp remove my-server
158
+ ```
159
+
160
+ **`didev mcp add <git-url>` flow:**
161
+ 1. Clones repo to `~/.didev/mcp/<name>/`
162
+ 2. Detects Node.js / Python
163
+ 3. `npm install` + `npm run build` (or `pip install`)
164
+ 4. Detects entry point automatically
165
+ 5. Reads README → finds required env vars
166
+ 6. Private repo? → prompts for GitHub/GitLab token or Bitbucket credentials
167
+ 7. Credentials saved to `.didev/.env` (gitignored); config stores `${VAR}` references
168
+ 8. Tests MCP connection, lists available tools
169
+ 9. Saves to `.didev/config.yaml`
170
+
171
+ ---
172
+
173
+ ### `didev bmad`
174
+ BMad Method — Behavior-Motivated Agile Development.
175
+
176
+ ```bash
177
+ didev bmad init
178
+ didev bmad epic
179
+ didev bmad story
180
+ didev bmad implement
181
+ didev bmad review
182
+ ```
183
+
184
+ ---
185
+
186
+ ## Agent Families
187
+
188
+ ### Why specialized agents?
189
+ Each agent has a focused system prompt optimized for its role. A frontend agent doesn't need to reason about database internals. A security auditor doesn't write React components. Specialization produces significantly better output than one generic "do everything" agent.
190
+
191
+ Think of it like a craftsman's workshop: each wall holds tools for a specific trade. The carpenter's wall has chisels and planes; the electrician's wall has testers and crimpers. The master (Orchestrator) knows which specialist to engage and when.
192
+
193
+ ### Frontend Family
194
+ | Agent | Specialty |
195
+ |-------|-----------|
196
+ | FrontendAnalyst | UX requirements, component design |
197
+ | FrontendArchitect | State management, component architecture |
198
+ | FrontendDeveloper | React, CSS, TypeScript implementation |
199
+ | Reviewer | Code quality, accessibility |
200
+ | Tester | RTL tests, Playwright |
201
+
202
+ ### Backend Family
203
+ | Agent | Specialty |
204
+ |-------|-----------|
205
+ | BackendAnalyst | API design, data modeling |
206
+ | BackendArchitect | Service architecture, DB schema |
207
+ | BackendDeveloper | Node.js, Express, DB implementation |
208
+ | SecurityAuditor | OWASP, auth review |
209
+ | Reviewer | Error handling, code quality |
210
+ | Tester | Unit + integration tests |
211
+
212
+ ### Fullstack Family
213
+ Analyst → Architect → Developer → Reviewer → Tester (cross-cutting)
214
+
215
+ ---
216
+
217
+ ## MCP Integration
218
+
219
+ MCP tools are namespaced as `serverName__toolName` to avoid conflicts:
220
+ ```
221
+ github__create_issue
222
+ postgres__query
223
+ filesystem__read_file
224
+ ```
225
+
226
+ ### Popular servers
227
+
228
+ | Server | Command |
229
+ |--------|---------|
230
+ | Filesystem | `didev mcp add @modelcontextprotocol/server-filesystem` |
231
+ | GitHub | `didev mcp add @modelcontextprotocol/server-github` |
232
+ | PostgreSQL | `didev mcp add https://github.com/Neovaryag/mcp-pgs-tool.git` |
233
+ | Java CVE scanner | `didev mcp add https://github.com/Neovaryag/java-vuln-remediation.git` |
234
+ | Brave Search | `didev mcp add @modelcontextprotocol/server-brave-search` |
235
+ | Memory | `didev mcp add @modelcontextprotocol/server-memory` |
236
+
237
+ ---
238
+
239
+ ## Project Structure
240
+
241
+ ```
242
+ .didev/
243
+ config.yaml # project config (commit this, no secrets inside)
244
+ context.md # project context for AI (commit this)
245
+ .env # MCP credentials (gitignored)
246
+ sessions/ # chat history (gitignored)
247
+ bmad/ # epics, stories, architecture docs
248
+
249
+ ~/.didev/
250
+ config.yaml # global config — API key lives here
251
+ .env # global git credentials for private MCP repos
252
+ mcp/ # globally cloned MCP servers
253
+ ```
254
+
255
+ ---
256
+
257
+ ## Security Model
258
+
259
+ | What | Where stored | Committed? |
260
+ |------|-------------|------------|
261
+ | DeepSeek API key | `~/.didev/config.yaml` or env var | Never |
262
+ | MCP env vars (DB URL, tokens) | `.didev/.env` | No (gitignored) |
263
+ | Git tokens for private MCP repos | `~/.didev/.env` | No |
264
+ | Project config | `.didev/config.yaml` with `${VAR}` placeholders | Yes |
265
+
266
+ ---
267
+
268
+ ## Configuration Reference
269
+
270
+ ```yaml
271
+ # .didev/config.yaml
272
+ api:
273
+ provider: deepseek
274
+ apiKey: ${DEEPSEEK_API_KEY}
275
+ model: deepseek-v4-flash
276
+ maxTokens: 32768
277
+ temperature: 0.3
278
+ baseUrl: https://api.deepseek.com/v1
279
+
280
+ context:
281
+ maxFiles: 100
282
+ maxTokens: 128000
283
+ autoDiscover: true
284
+ excludePatterns: [node_modules/**, dist/**, .git/**, "*.lock"]
285
+
286
+ agents:
287
+ family: full # full | light | developer-only
288
+ orchestrate: true
289
+ reviewRequired: true
290
+ autoApply: false # prompt before writing files
291
+
292
+ mcp:
293
+ servers:
294
+ - name: postgres
295
+ command: node
296
+ args: [/home/user/.didev/mcp/mcp-pgs-tool/dist/index.js]
297
+ env:
298
+ DATABASE_URL: ${DATABASE_URL}
299
+ ```
300
+
301
+ ---
302
+
303
+ ## Getting DeepSeek API Key & Billing
304
+
305
+ 1. Go to **[platform.deepseek.com](https://platform.deepseek.com)**
306
+ 2. Sign up / log in
307
+ 3. **API Keys** → Create new secret key → copy it
308
+ 4. **Billing** → Top up balance (minimum ~$5)
309
+ 5. Set the key:
310
+ ```bash
311
+ didev config set DEEPSEEK_API_KEY=sk-xxxxxxxxxxxxxxxx
312
+ ```
313
+
314
+ **Pricing** (2026):
315
+ - `deepseek-v4-flash`: ~$0.27 / 1M input tokens · ~$1.10 / 1M output tokens
316
+ - Context window: **1,000,000 tokens**
317
+ - Max output per response: **384,000 tokens**
318
+
319
+ DeepSeek API is 10–20× cheaper than OpenAI GPT-4o for equivalent tasks.
320
+
321
+ ---
322
+
323
+ ## Architecture
324
+
325
+ ```
326
+ src/
327
+ index.ts CLI entry (Commander.js) + graceful shutdown (SIGTERM/SIGINT)
328
+ core/
329
+ api.ts DeepSeek client (chat, stream, tool loop) — with retry + timeout
330
+ config.ts Config load/save (global + local merge)
331
+ context.ts Project detection + file loading
332
+ file-manager.ts Read/write/diff — path validation, 10MB limit
333
+ mcp.ts MCP manager (connect, call, tool namespacing) — with timeout
334
+ session.ts Chat session persistence
335
+ agents/
336
+ base-agent.ts BaseAgent abstract class + MCP integration
337
+ analyst.ts Analyst variants
338
+ architect.ts Architect variants
339
+ developer.ts Developer variants
340
+ reviewer.ts Reviewer + SecurityAuditor
341
+ tester.ts Tester + PerformanceAuditor
342
+ orchestrator.ts Pipeline builder + execution (parallel review phase)
343
+ cli/commands/
344
+ init.ts didev init
345
+ config.ts didev config
346
+ chat.ts didev chat (REPL + MCP)
347
+ agent.ts didev agent
348
+ review.ts didev review
349
+ refactor.ts didev refactor
350
+ mcp.ts didev mcp (add/list/test/remove)
351
+ bmad/method.ts BMad workflow
352
+ utils/
353
+ logger.ts Styled output (chalk, ora, boxen)
354
+ git.ts Git diff helpers — with timeout
355
+ resilience.ts withTimeout + retryWithBackoff utilities
356
+ ```
357
+
358
+ ---
359
+
360
+ ## Отказоустойчивость
361
+
362
+ didev реализует несколько уровней защиты от сбоев:
363
+
364
+ | Механизм | Где применяется | Детали |
365
+ | -------- | --------------- | ------- |
366
+ | **Таймауты** | API запросы, MCP, git | 30s на HTTP, 60s на stream-чанк, 10s на MCP connect, 15s на git |
367
+ | **Retry с backoff** | DeepSeek API | 3 попытки, экспоненциальный backoff + jitter, только транзитные ошибки |
368
+ | **Graceful shutdown** | SIGTERM / SIGINT | Закрывает MCP серверы, 5s на очистку, затем force exit |
369
+ | **Параллельный review** | Orchestrator full mode | Reviewer + Tester запускаются одновременно |
370
+ | **Лимит файлов** | file-manager | Отказ записи если файл >10MB |
371
+ | **Безопасные пути** | file-manager | path.normalize(), блок `../` traversal |
372
+ | **Логирование ошибок** | config, context, session | Все `catch` логируют через `logger.warn/debug` |
373
+
374
+ ---
375
+
376
+ ## License
377
+
378
+ MIT — Симонов Михаил Сергеевич, 2026
@@ -0,0 +1,21 @@
1
+ import { BaseAgent } from './base-agent.js';
2
+ import type { ProjectContext } from '../core/context.js';
3
+ export declare class AnalystAgent extends BaseAgent {
4
+ readonly name = "Analyst";
5
+ readonly role = "Requirements Analysis";
6
+ readonly emoji = "\uD83C\uDFAF";
7
+ protected buildSystemPrompt(ctx: ProjectContext, task: string): string;
8
+ }
9
+ export declare class FrontendAnalystAgent extends BaseAgent {
10
+ readonly name = "Frontend Analyst";
11
+ readonly role = "Frontend Requirements & User Stories";
12
+ readonly emoji = "\uD83C\uDFAF";
13
+ protected buildSystemPrompt(ctx: ProjectContext, task: string): string;
14
+ }
15
+ export declare class BackendAnalystAgent extends BaseAgent {
16
+ readonly name = "Backend Analyst";
17
+ readonly role = "Backend Requirements & API Contracts";
18
+ readonly emoji = "\uD83C\uDFAF";
19
+ protected buildSystemPrompt(ctx: ProjectContext, task: string): string;
20
+ }
21
+ //# sourceMappingURL=analyst.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyst.d.ts","sourceRoot":"","sources":["../../src/agents/analyst.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,qBAAa,YAAa,SAAQ,SAAS;IACzC,QAAQ,CAAC,IAAI,aAAa;IAC1B,QAAQ,CAAC,IAAI,2BAA2B;IACxC,QAAQ,CAAC,KAAK,kBAAQ;IAEtB,SAAS,CAAC,iBAAiB,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;CAqBvE;AAED,qBAAa,oBAAqB,SAAQ,SAAS;IACjD,QAAQ,CAAC,IAAI,sBAAsB;IACnC,QAAQ,CAAC,IAAI,0CAA0C;IACvD,QAAQ,CAAC,KAAK,kBAAQ;IAEtB,SAAS,CAAC,iBAAiB,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;CAevE;AAED,qBAAa,mBAAoB,SAAQ,SAAS;IAChD,QAAQ,CAAC,IAAI,qBAAqB;IAClC,QAAQ,CAAC,IAAI,0CAA0C;IACvD,QAAQ,CAAC,KAAK,kBAAQ;IAEtB,SAAS,CAAC,iBAAiB,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;CAevE"}
@@ -0,0 +1,69 @@
1
+ import { BaseAgent } from './base-agent.js';
2
+ import { contextToSystemPrompt } from '../core/context.js';
3
+ export class AnalystAgent extends BaseAgent {
4
+ name = 'Analyst';
5
+ role = 'Requirements Analysis';
6
+ emoji = '🎯';
7
+ buildSystemPrompt(ctx, task) {
8
+ return `You are an expert Software Analyst specializing in requirements analysis and user story creation.
9
+
10
+ ${contextToSystemPrompt(ctx)}
11
+
12
+ Your responsibilities:
13
+ 1. Analyze the given task thoroughly
14
+ 2. Break it down into clear user stories with acceptance criteria
15
+ 3. Identify edge cases and potential risks
16
+ 4. Define clear success metrics
17
+ 5. Consider the existing codebase architecture
18
+
19
+ Output format:
20
+ - Start with a brief task analysis
21
+ - Create user stories in format: "As a <role>, I want <feature>, so that <benefit>"
22
+ - List Acceptance Criteria (AC) for each story
23
+ - Identify dependencies and risks
24
+ - Suggest the implementation order
25
+
26
+ Be practical and specific to the project context. Read existing code when needed.`;
27
+ }
28
+ }
29
+ export class FrontendAnalystAgent extends BaseAgent {
30
+ name = 'Frontend Analyst';
31
+ role = 'Frontend Requirements & User Stories';
32
+ emoji = '🎯';
33
+ buildSystemPrompt(ctx, task) {
34
+ return `You are an expert Frontend Analyst specializing in UI/UX requirements.
35
+
36
+ ${contextToSystemPrompt(ctx)}
37
+
38
+ Your responsibilities:
39
+ 1. Analyze frontend requirements
40
+ 2. Define UI/UX acceptance criteria
41
+ 3. Identify required components and state changes
42
+ 4. Consider accessibility (a11y) requirements
43
+ 5. Define responsive design requirements
44
+
45
+ Focus on: components needed, user interactions, state management, data flow.
46
+ Read existing components to understand patterns used in the project.`;
47
+ }
48
+ }
49
+ export class BackendAnalystAgent extends BaseAgent {
50
+ name = 'Backend Analyst';
51
+ role = 'Backend Requirements & API Contracts';
52
+ emoji = '🎯';
53
+ buildSystemPrompt(ctx, task) {
54
+ return `You are an expert Backend Analyst specializing in API design and system requirements.
55
+
56
+ ${contextToSystemPrompt(ctx)}
57
+
58
+ Your responsibilities:
59
+ 1. Analyze backend requirements
60
+ 2. Define API contracts (endpoints, request/response schemas)
61
+ 3. Identify data models and database changes
62
+ 4. Security considerations
63
+ 5. Performance requirements and SLAs
64
+
65
+ Focus on: API design, data models, business logic, error handling, validation.
66
+ Read existing code to understand current patterns and conventions.`;
67
+ }
68
+ }
69
+ //# sourceMappingURL=analyst.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyst.js","sourceRoot":"","sources":["../../src/agents/analyst.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,MAAM,OAAO,YAAa,SAAQ,SAAS;IAChC,IAAI,GAAG,SAAS,CAAC;IACjB,IAAI,GAAG,uBAAuB,CAAC;IAC/B,KAAK,GAAG,IAAI,CAAC;IAEZ,iBAAiB,CAAC,GAAmB,EAAE,IAAY;QAC3D,OAAO;;EAET,qBAAqB,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;kFAgBsD,CAAC;IACjF,CAAC;CACF;AAED,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IACxC,IAAI,GAAG,kBAAkB,CAAC;IAC1B,IAAI,GAAG,sCAAsC,CAAC;IAC9C,KAAK,GAAG,IAAI,CAAC;IAEZ,iBAAiB,CAAC,GAAmB,EAAE,IAAY;QAC3D,OAAO;;EAET,qBAAqB,CAAC,GAAG,CAAC;;;;;;;;;;qEAUyC,CAAC;IACpE,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,SAAS;IACvC,IAAI,GAAG,iBAAiB,CAAC;IACzB,IAAI,GAAG,sCAAsC,CAAC;IAC9C,KAAK,GAAG,IAAI,CAAC;IAEZ,iBAAiB,CAAC,GAAmB,EAAE,IAAY;QAC3D,OAAO;;EAET,qBAAqB,CAAC,GAAG,CAAC;;;;;;;;;;mEAUuC,CAAC;IAClE,CAAC;CACF"}
@@ -0,0 +1,21 @@
1
+ import { BaseAgent } from './base-agent.js';
2
+ import type { ProjectContext } from '../core/context.js';
3
+ export declare class ArchitectAgent extends BaseAgent {
4
+ readonly name = "Architect";
5
+ readonly role = "System Architecture Design";
6
+ readonly emoji = "\uD83C\uDFD7\uFE0F";
7
+ protected buildSystemPrompt(ctx: ProjectContext): string;
8
+ }
9
+ export declare class FrontendArchitectAgent extends BaseAgent {
10
+ readonly name = "Frontend Architect";
11
+ readonly role = "Frontend Architecture & State Management";
12
+ readonly emoji = "\uD83C\uDFD7\uFE0F";
13
+ protected buildSystemPrompt(ctx: ProjectContext): string;
14
+ }
15
+ export declare class BackendArchitectAgent extends BaseAgent {
16
+ readonly name = "Backend Architect";
17
+ readonly role = "Backend Architecture & Database Design";
18
+ readonly emoji = "\uD83C\uDFD7\uFE0F";
19
+ protected buildSystemPrompt(ctx: ProjectContext): string;
20
+ }
21
+ //# sourceMappingURL=architect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"architect.d.ts","sourceRoot":"","sources":["../../src/agents/architect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,qBAAa,cAAe,SAAQ,SAAS;IAC3C,QAAQ,CAAC,IAAI,eAAe;IAC5B,QAAQ,CAAC,IAAI,gCAAgC;IAC7C,QAAQ,CAAC,KAAK,wBAAS;IAEvB,SAAS,CAAC,iBAAiB,CAAC,GAAG,EAAE,cAAc,GAAG,MAAM;CAsBzD;AAED,qBAAa,sBAAuB,SAAQ,SAAS;IACnD,QAAQ,CAAC,IAAI,wBAAwB;IACrC,QAAQ,CAAC,IAAI,8CAA8C;IAC3D,QAAQ,CAAC,KAAK,wBAAS;IAEvB,SAAS,CAAC,iBAAiB,CAAC,GAAG,EAAE,cAAc,GAAG,MAAM;CAsBzD;AAED,qBAAa,qBAAsB,SAAQ,SAAS;IAClD,QAAQ,CAAC,IAAI,uBAAuB;IACpC,QAAQ,CAAC,IAAI,4CAA4C;IACzD,QAAQ,CAAC,KAAK,wBAAS;IAEvB,SAAS,CAAC,iBAAiB,CAAC,GAAG,EAAE,cAAc,GAAG,MAAM;CAuBzD"}
@@ -0,0 +1,85 @@
1
+ import { BaseAgent } from './base-agent.js';
2
+ import { contextToSystemPrompt } from '../core/context.js';
3
+ export class ArchitectAgent extends BaseAgent {
4
+ name = 'Architect';
5
+ role = 'System Architecture Design';
6
+ emoji = '🏗️';
7
+ buildSystemPrompt(ctx) {
8
+ return `You are a senior Software Architect with deep expertise in ${ctx.language} and ${ctx.framework}.
9
+
10
+ ${contextToSystemPrompt(ctx)}
11
+
12
+ Your responsibilities:
13
+ 1. Design the technical architecture for the given task
14
+ 2. Define the file structure and module organization
15
+ 3. Design interfaces, types, and data models
16
+ 4. Choose appropriate patterns (Repository, Service, Factory, etc.)
17
+ 5. Consider scalability, maintainability, and testability
18
+ 6. Define integration points with existing code
19
+
20
+ Output:
21
+ - Architecture overview
22
+ - File structure to create (list every file with its purpose)
23
+ - Key interfaces and types
24
+ - Data flow diagram (text format)
25
+ - Integration points with existing modules
26
+
27
+ Read existing code structure before making decisions. Match existing patterns.`;
28
+ }
29
+ }
30
+ export class FrontendArchitectAgent extends BaseAgent {
31
+ name = 'Frontend Architect';
32
+ role = 'Frontend Architecture & State Management';
33
+ emoji = '🏗️';
34
+ buildSystemPrompt(ctx) {
35
+ return `You are a senior Frontend Architect specializing in ${ctx.framework} applications.
36
+
37
+ ${contextToSystemPrompt(ctx)}
38
+
39
+ Your responsibilities:
40
+ 1. Design component hierarchy and architecture
41
+ 2. Plan state management strategy (Context, Redux, Zustand, etc.)
42
+ 3. Define routing and code splitting strategy
43
+ 4. Design data fetching patterns (SWR, React Query, etc.)
44
+ 5. Performance optimization strategy
45
+ 6. Identify reusable components and hooks
46
+
47
+ Output:
48
+ - Component tree diagram
49
+ - State management architecture
50
+ - List of files to create (components, hooks, contexts, utils)
51
+ - Props interfaces for key components
52
+ - Data fetching strategy
53
+
54
+ Read existing components and hooks to match current patterns.`;
55
+ }
56
+ }
57
+ export class BackendArchitectAgent extends BaseAgent {
58
+ name = 'Backend Architect';
59
+ role = 'Backend Architecture & Database Design';
60
+ emoji = '🏗️';
61
+ buildSystemPrompt(ctx) {
62
+ return `You are a senior Backend Architect specializing in ${ctx.framework} services.
63
+
64
+ ${contextToSystemPrompt(ctx)}
65
+
66
+ Your responsibilities:
67
+ 1. Design service/module architecture
68
+ 2. Database schema design and migrations
69
+ 3. API layer design (controllers, services, repositories)
70
+ 4. Middleware and middleware chain design
71
+ 5. Error handling strategy
72
+ 6. Authentication/authorization architecture (if needed)
73
+ 7. Caching strategy
74
+
75
+ Output:
76
+ - Architecture layers description
77
+ - Database schema (if applicable)
78
+ - List of files to create (controllers, services, repos, models)
79
+ - Key interfaces and DTOs
80
+ - Middleware chain
81
+
82
+ Read existing code to understand current layered architecture.`;
83
+ }
84
+ }
85
+ //# sourceMappingURL=architect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"architect.js","sourceRoot":"","sources":["../../src/agents/architect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,MAAM,OAAO,cAAe,SAAQ,SAAS;IAClC,IAAI,GAAG,WAAW,CAAC;IACnB,IAAI,GAAG,4BAA4B,CAAC;IACpC,KAAK,GAAG,KAAK,CAAC;IAEb,iBAAiB,CAAC,GAAmB;QAC7C,OAAO,8DAA8D,GAAG,CAAC,QAAQ,QAAQ,GAAG,CAAC,SAAS;;EAExG,qBAAqB,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;+EAiBmD,CAAC;IAC9E,CAAC;CACF;AAED,MAAM,OAAO,sBAAuB,SAAQ,SAAS;IAC1C,IAAI,GAAG,oBAAoB,CAAC;IAC5B,IAAI,GAAG,0CAA0C,CAAC;IAClD,KAAK,GAAG,KAAK,CAAC;IAEb,iBAAiB,CAAC,GAAmB;QAC7C,OAAO,uDAAuD,GAAG,CAAC,SAAS;;EAE7E,qBAAqB,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;8DAiBkC,CAAC;IAC7D,CAAC;CACF;AAED,MAAM,OAAO,qBAAsB,SAAQ,SAAS;IACzC,IAAI,GAAG,mBAAmB,CAAC;IAC3B,IAAI,GAAG,wCAAwC,CAAC;IAChD,KAAK,GAAG,KAAK,CAAC;IAEb,iBAAiB,CAAC,GAAmB;QAC7C,OAAO,sDAAsD,GAAG,CAAC,SAAS;;EAE5E,qBAAqB,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;+DAkBmC,CAAC;IAC9D,CAAC;CACF"}
@@ -0,0 +1,56 @@
1
+ import { DeepSeekClient } from '../core/api.js';
2
+ import type { Tool } from '../core/api.js';
3
+ import type { ProjectContext } from '../core/context.js';
4
+ export interface AgentResult {
5
+ agentName: string;
6
+ role: string;
7
+ emoji: string;
8
+ output: string;
9
+ artifacts: AgentArtifact[];
10
+ fileChanges: FileChange[];
11
+ pendingWrites: Map<string, {
12
+ content: string;
13
+ description?: string;
14
+ }>;
15
+ duration: number;
16
+ }
17
+ export interface AgentArtifact {
18
+ type: 'story' | 'spec' | 'architecture' | 'tests' | 'review' | 'analysis' | 'plan';
19
+ title: string;
20
+ content: string;
21
+ }
22
+ export interface FileChange {
23
+ path: string;
24
+ content: string;
25
+ description?: string;
26
+ }
27
+ export interface AgentOptions {
28
+ client: DeepSeekClient;
29
+ model: string;
30
+ projectContext: ProjectContext;
31
+ rootDir: string;
32
+ task: string;
33
+ previousResults?: AgentResult[];
34
+ maxRounds?: number;
35
+ /** When true, write_file calls are queued in pendingWrites instead of written immediately */
36
+ dryRun?: boolean;
37
+ }
38
+ export declare const AGENT_TOOLS: Tool[];
39
+ export declare abstract class BaseAgent {
40
+ abstract readonly name: string;
41
+ abstract readonly role: string;
42
+ abstract readonly emoji: string;
43
+ protected abstract buildSystemPrompt(ctx: ProjectContext, task: string): string;
44
+ protected pendingWrites: Map<string, {
45
+ content: string;
46
+ description?: string;
47
+ }>;
48
+ run(options: AgentOptions): Promise<AgentResult>;
49
+ protected buildUserMessage(task: string, previousResults?: AgentResult[]): string;
50
+ protected executeToolCall(name: string, args: Record<string, unknown>, rootDir: string, fileChanges: FileChange[], pendingWrites?: Map<string, {
51
+ content: string;
52
+ description?: string;
53
+ }>): Promise<string>;
54
+ protected extractArtifacts(output: string): AgentArtifact[];
55
+ }
56
+ //# sourceMappingURL=base-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-agent.d.ts","sourceRoot":"","sources":["../../src/agents/base-agent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAc,MAAM,gBAAgB,CAAC;AAC5D,OAAO,KAAK,EAAW,IAAI,EAAY,MAAM,gBAAgB,CAAC;AAE9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AASzD,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACtE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,cAAc,GAAG,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;IACnF,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,cAAc,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,cAAc,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,WAAW,EAAE,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6FAA6F;IAC7F,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,WAAW,EAAE,IAAI,EA0E7B,CAAC;AAEF,8BAAsB,SAAS;IAC7B,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAChC,SAAS,CAAC,QAAQ,CAAC,iBAAiB,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAE/E,SAAS,CAAC,aAAa;iBAA8B,MAAM;sBAAgB,MAAM;OAAM;IAEjF,GAAG,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IAkFtD,SAAS,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,WAAW,EAAE,GAAG,MAAM;cAgBjE,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,UAAU,EAAE,EACzB,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GACrE,OAAO,CAAC,MAAM,CAAC;IAsFlB,SAAS,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,EAAE;CAkB5D"}