codeswarm 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.
- package/.codeswarm/skills/prd_template.md +98 -0
- package/AGENT_TIPS.md +206 -0
- package/BROWSER_TESTING.md +177 -0
- package/COORDINATOR.md +151 -0
- package/LICENSE +21 -0
- package/README.md +253 -0
- package/TASK_PROTOCOL.md +111 -0
- package/WORKFLOWS.md +174 -0
- package/bin/codeswarm.js +15 -0
- package/config.yaml +55 -0
- package/coordinator.sh +1762 -0
- package/dashboard/package-lock.json +1036 -0
- package/dashboard/package.json +14 -0
- package/dashboard/public/index.html +758 -0
- package/dashboard/server.js +444 -0
- package/docs/prd-example.md +90 -0
- package/docs/prd-template.md +45 -0
- package/orchestrate.sh +467 -0
- package/package.json +62 -0
- package/playwright.config.ts +19 -0
- package/setup.sh +142 -0
package/orchestrate.sh
ADDED
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# orchestrate.sh — Multi-Agent Orchestration Script
|
|
4
|
+
# Coordinates Claude Code, Gemini CLI, and Codex CLI in Plan → Execute → Review pipeline.
|
|
5
|
+
#
|
|
6
|
+
# Usage:
|
|
7
|
+
# ./orchestrate.sh --project <path> --task "description" [options]
|
|
8
|
+
#
|
|
9
|
+
# Options:
|
|
10
|
+
# --project <path> Target project directory (required)
|
|
11
|
+
# --task <description> Task description (required)
|
|
12
|
+
# --planner <agent> Agent for planning (claude|gemini|codex) default: from config.yaml
|
|
13
|
+
# --executor <agent> Agent for execution (claude|gemini|codex) default: from config.yaml
|
|
14
|
+
# --reviewer <agent> Agent for review (claude|gemini|codex) default: from config.yaml
|
|
15
|
+
# --model <model> Override model for planner (e.g. opus, sonnet, o3)
|
|
16
|
+
# --browser-test Enable browser testing after review
|
|
17
|
+
# --test-url <url> Base URL for browser tests
|
|
18
|
+
# --skip-plan Skip planning phase (use existing plan.md)
|
|
19
|
+
# --skip-review Skip review phase
|
|
20
|
+
# --config <path> Custom config file (default: ./config.yaml)
|
|
21
|
+
# --verbose Show full agent output
|
|
22
|
+
# --dry-run Print commands without executing
|
|
23
|
+
|
|
24
|
+
set -euo pipefail
|
|
25
|
+
|
|
26
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
27
|
+
CONFIG_FILE="${SCRIPT_DIR}/config.yaml"
|
|
28
|
+
|
|
29
|
+
# ─── Colors ─────────────────────────────────────────────
|
|
30
|
+
RED='\033[0;31m'
|
|
31
|
+
GREEN='\033[0;32m'
|
|
32
|
+
YELLOW='\033[1;33m'
|
|
33
|
+
BLUE='\033[0;34m'
|
|
34
|
+
CYAN='\033[0;36m'
|
|
35
|
+
BOLD='\033[1m'
|
|
36
|
+
NC='\033[0m'
|
|
37
|
+
|
|
38
|
+
# ─── Defaults ───────────────────────────────────────────
|
|
39
|
+
PROJECT=""
|
|
40
|
+
TASK=""
|
|
41
|
+
PLANNER=""
|
|
42
|
+
EXECUTOR=""
|
|
43
|
+
REVIEWER=""
|
|
44
|
+
MODEL_OVERRIDE=""
|
|
45
|
+
BROWSER_TEST=false
|
|
46
|
+
TEST_URL=""
|
|
47
|
+
SKIP_PLAN=false
|
|
48
|
+
SKIP_REVIEW=false
|
|
49
|
+
VERBOSE=false
|
|
50
|
+
DRY_RUN=false
|
|
51
|
+
|
|
52
|
+
# ─── Parse Arguments ────────────────────────────────────
|
|
53
|
+
while [[ $# -gt 0 ]]; do
|
|
54
|
+
case $1 in
|
|
55
|
+
--project) PROJECT="$2"; shift 2 ;;
|
|
56
|
+
--task) TASK="$2"; shift 2 ;;
|
|
57
|
+
--planner) PLANNER="$2"; shift 2 ;;
|
|
58
|
+
--executor) EXECUTOR="$2"; shift 2 ;;
|
|
59
|
+
--reviewer) REVIEWER="$2"; shift 2 ;;
|
|
60
|
+
--model) MODEL_OVERRIDE="$2"; shift 2 ;;
|
|
61
|
+
--browser-test) BROWSER_TEST=true; shift ;;
|
|
62
|
+
--test-url) TEST_URL="$2"; shift 2 ;;
|
|
63
|
+
--skip-plan) SKIP_PLAN=true; shift ;;
|
|
64
|
+
--skip-review) SKIP_REVIEW=true; shift ;;
|
|
65
|
+
--config) CONFIG_FILE="$2"; shift 2 ;;
|
|
66
|
+
--verbose) VERBOSE=true; shift ;;
|
|
67
|
+
--dry-run) DRY_RUN=true; shift ;;
|
|
68
|
+
-h|--help) head -20 "$0" | tail -18; exit 0 ;;
|
|
69
|
+
*) echo -e "${RED}Unknown option: $1${NC}"; exit 1 ;;
|
|
70
|
+
esac
|
|
71
|
+
done
|
|
72
|
+
|
|
73
|
+
# ─── Validate ────────────────────────────────────────────
|
|
74
|
+
if [[ -z "$PROJECT" ]]; then
|
|
75
|
+
echo -e "${RED}Error: --project is required${NC}"
|
|
76
|
+
exit 1
|
|
77
|
+
fi
|
|
78
|
+
if [[ -z "$TASK" ]]; then
|
|
79
|
+
echo -e "${RED}Error: --task is required${NC}"
|
|
80
|
+
exit 1
|
|
81
|
+
fi
|
|
82
|
+
if [[ ! -d "$PROJECT" ]]; then
|
|
83
|
+
echo -e "${RED}Error: Project directory not found: $PROJECT${NC}"
|
|
84
|
+
exit 1
|
|
85
|
+
fi
|
|
86
|
+
|
|
87
|
+
# ─── Read Config (simple YAML parsing via grep/sed) ──────
|
|
88
|
+
read_config() {
|
|
89
|
+
local key="$1"
|
|
90
|
+
local default="$2"
|
|
91
|
+
if [[ -f "$CONFIG_FILE" ]]; then
|
|
92
|
+
local val
|
|
93
|
+
val=$(grep -E "^\s+${key}:" "$CONFIG_FILE" 2>/dev/null | head -1 | sed 's/.*:\s*//' | sed 's/#.*//' | sed 's/"//g' | xargs)
|
|
94
|
+
if [[ -n "$val" ]]; then
|
|
95
|
+
echo "$val"
|
|
96
|
+
return
|
|
97
|
+
fi
|
|
98
|
+
fi
|
|
99
|
+
echo "$default"
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
# Apply config defaults where CLI flags not provided
|
|
103
|
+
[[ -z "$PLANNER" ]] && PLANNER=$(read_config "planner" "claude")
|
|
104
|
+
[[ -z "$EXECUTOR" ]] && EXECUTOR=$(read_config "executor" "gemini")
|
|
105
|
+
[[ -z "$REVIEWER" ]] && REVIEWER=$(read_config "reviewer" "codex")
|
|
106
|
+
|
|
107
|
+
# ─── Artifacts & Logging ─────────────────────────────────
|
|
108
|
+
ARTIFACTS="${PROJECT}/.codeswarm"
|
|
109
|
+
SESSION_ID="run_$(date +%Y%m%d_%H%M%S)"
|
|
110
|
+
SESSION_DIR="${ARTIFACTS}/sessions/${SESSION_ID}"
|
|
111
|
+
PLAN_FILE="${SESSION_DIR}/plan.md"
|
|
112
|
+
EXEC_LOG="${SESSION_DIR}/execution.log"
|
|
113
|
+
REVIEW_FILE="${SESSION_DIR}/review.md"
|
|
114
|
+
SCREENSHOTS_DIR="${SESSION_DIR}/screenshots"
|
|
115
|
+
TIMESTAMP=$(date +"%Y-%m-%d_%H-%M-%S") # This variable is not used in the provided snippet, keeping it for consistency if used elsewhere.
|
|
116
|
+
|
|
117
|
+
mkdir -p "$SESSION_DIR" "$SCREENSHOTS_DIR"
|
|
118
|
+
|
|
119
|
+
# ─── Logging ─────────────────────────────────────────────
|
|
120
|
+
log() { echo -e "${CYAN}[$(date +%H:%M:%S)]${NC} $1"; }
|
|
121
|
+
success() { echo -e "${GREEN}✓${NC} $1"; }
|
|
122
|
+
warn() { echo -e "${YELLOW}⚠${NC} $1"; }
|
|
123
|
+
error() { echo -e "${RED}✗${NC} $1"; }
|
|
124
|
+
header() {
|
|
125
|
+
echo ""
|
|
126
|
+
echo -e "${BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
|
127
|
+
echo -e "${BOLD} $1${NC}"
|
|
128
|
+
echo -e "${BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
# ─── Agent Command Builders ─────────────────────────────
|
|
132
|
+
run_agent() {
|
|
133
|
+
local agent="$1"
|
|
134
|
+
local prompt="$2"
|
|
135
|
+
local working_dir="$3"
|
|
136
|
+
local output_file="$4"
|
|
137
|
+
local permission_mode="${5:-plan}"
|
|
138
|
+
|
|
139
|
+
local cmd=""
|
|
140
|
+
case "$agent" in
|
|
141
|
+
claude)
|
|
142
|
+
local model_flag=""
|
|
143
|
+
if [[ -n "$MODEL_OVERRIDE" ]]; then
|
|
144
|
+
model_flag="--model $MODEL_OVERRIDE"
|
|
145
|
+
else
|
|
146
|
+
local default_model
|
|
147
|
+
default_model=$(read_config "claude" "opus")
|
|
148
|
+
[[ -n "$default_model" ]] && model_flag="--model $default_model"
|
|
149
|
+
fi
|
|
150
|
+
cmd="cd '$working_dir' && claude -p $model_flag --permission-mode $permission_mode '$prompt'"
|
|
151
|
+
;;
|
|
152
|
+
gemini)
|
|
153
|
+
local model_flag=""
|
|
154
|
+
local default_model
|
|
155
|
+
default_model=$(read_config "gemini" "")
|
|
156
|
+
[[ -n "$default_model" ]] && model_flag="--model $default_model"
|
|
157
|
+
local approval_mode="default"
|
|
158
|
+
[[ "$permission_mode" == "plan" ]] && approval_mode="plan"
|
|
159
|
+
[[ "$permission_mode" == "auto_edit" ]] && approval_mode="auto_edit"
|
|
160
|
+
[[ "$permission_mode" == "bypassPermissions" ]] && approval_mode="yolo"
|
|
161
|
+
cmd="cd '$working_dir' && gemini -p '$prompt' $model_flag --approval-mode $approval_mode"
|
|
162
|
+
;;
|
|
163
|
+
codex)
|
|
164
|
+
local sandbox_flag="--sandbox read-only"
|
|
165
|
+
[[ "$permission_mode" == "auto_edit" ]] && sandbox_flag=""
|
|
166
|
+
cmd="cd '$working_dir' && codex exec $sandbox_flag '$prompt'"
|
|
167
|
+
;;
|
|
168
|
+
*)
|
|
169
|
+
error "Unknown agent: $agent"
|
|
170
|
+
exit 1
|
|
171
|
+
;;
|
|
172
|
+
esac
|
|
173
|
+
|
|
174
|
+
if $DRY_RUN; then
|
|
175
|
+
echo -e "${YELLOW}[DRY RUN]${NC} $cmd"
|
|
176
|
+
echo "# Dry run — no output" > "$output_file"
|
|
177
|
+
return 0
|
|
178
|
+
fi
|
|
179
|
+
|
|
180
|
+
log "Running ${BOLD}$agent${NC}..."
|
|
181
|
+
if $VERBOSE; then
|
|
182
|
+
eval "$cmd" 2>&1 | tee "$output_file"
|
|
183
|
+
else
|
|
184
|
+
eval "$cmd" > "$output_file" 2>&1
|
|
185
|
+
fi
|
|
186
|
+
local exit_code=$?
|
|
187
|
+
|
|
188
|
+
if [[ $exit_code -ne 0 ]]; then
|
|
189
|
+
warn "$agent exited with code $exit_code"
|
|
190
|
+
else
|
|
191
|
+
success "$agent completed successfully"
|
|
192
|
+
fi
|
|
193
|
+
return $exit_code
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
# ─── Banner ──────────────────────────────────────────────
|
|
197
|
+
echo ""
|
|
198
|
+
echo -e "${BOLD}${CYAN}"
|
|
199
|
+
echo " ╔═══════════════════════════════════════════╗"
|
|
200
|
+
echo " ║ 🤖 AGENTIC ORCHESTRATOR v1.0 ║"
|
|
201
|
+
echo " ╚═══════════════════════════════════════════╝"
|
|
202
|
+
echo -e "${NC}"
|
|
203
|
+
echo -e " ${BOLD}Task:${NC} $TASK"
|
|
204
|
+
echo -e " ${BOLD}Project:${NC} $PROJECT"
|
|
205
|
+
echo -e " ${BOLD}Planner:${NC} $PLANNER"
|
|
206
|
+
echo -e " ${BOLD}Executor:${NC} $EXECUTOR"
|
|
207
|
+
echo -e " ${BOLD}Reviewer:${NC} $REVIEWER"
|
|
208
|
+
echo -e " ${BOLD}Browser:${NC} $BROWSER_TEST"
|
|
209
|
+
echo ""
|
|
210
|
+
|
|
211
|
+
# ─── PHASE 1: PLANNING ──────────────────────────────────
|
|
212
|
+
if ! $SKIP_PLAN; then
|
|
213
|
+
header "📋 Phase 1: Planning ($PLANNER)"
|
|
214
|
+
|
|
215
|
+
PLAN_PROMPT="You are the PLANNER agent in a multi-agent development team.
|
|
216
|
+
|
|
217
|
+
TASK: $TASK
|
|
218
|
+
|
|
219
|
+
PROJECT DIRECTORY: $PROJECT
|
|
220
|
+
|
|
221
|
+
Your job is to analyze the task and produce a detailed implementation plan.
|
|
222
|
+
|
|
223
|
+
OUTPUT FORMAT (write as markdown):
|
|
224
|
+
# Implementation Plan
|
|
225
|
+
|
|
226
|
+
## Task Summary
|
|
227
|
+
<One-paragraph summary of what needs to be done>
|
|
228
|
+
|
|
229
|
+
## File Changes
|
|
230
|
+
For each file to modify/create/delete:
|
|
231
|
+
### [MODIFY|NEW|DELETE] <filepath>
|
|
232
|
+
- What to change and why
|
|
233
|
+
|
|
234
|
+
## Testing Strategy
|
|
235
|
+
- How to verify the changes work
|
|
236
|
+
- What to test manually
|
|
237
|
+
- What automated tests to add
|
|
238
|
+
|
|
239
|
+
## Risk Assessment
|
|
240
|
+
- Potential issues or breaking changes
|
|
241
|
+
- Dependencies to be aware of
|
|
242
|
+
|
|
243
|
+
## Estimated Complexity
|
|
244
|
+
Rate 1-10 and explain why.
|
|
245
|
+
|
|
246
|
+
IMPORTANT:
|
|
247
|
+
- Be specific about file paths relative to the project root
|
|
248
|
+
- Include code snippets where helpful
|
|
249
|
+
- Consider the existing codebase patterns
|
|
250
|
+
- Think about edge cases"
|
|
251
|
+
|
|
252
|
+
PLANNER_PERMISSION=$(read_config "planner" "plan")
|
|
253
|
+
run_agent "$PLANNER" "$PLAN_PROMPT" "$PROJECT" "$PLAN_FILE" "$PLANNER_PERMISSION"
|
|
254
|
+
|
|
255
|
+
log "Plan saved to: $PLAN_FILE"
|
|
256
|
+
echo ""
|
|
257
|
+
echo -e "${YELLOW}─── Plan Preview ──────────────────────────────────${NC}"
|
|
258
|
+
head -30 "$PLAN_FILE"
|
|
259
|
+
echo -e "${YELLOW}───────────────────────────────────────────────────${NC}"
|
|
260
|
+
echo ""
|
|
261
|
+
|
|
262
|
+
# Optional: pause for human review
|
|
263
|
+
if [[ -t 0 ]]; then
|
|
264
|
+
read -p "$(echo -e ${BOLD})Review plan and press Enter to continue (or Ctrl+C to abort)...$(echo -e ${NC}) "
|
|
265
|
+
fi
|
|
266
|
+
else
|
|
267
|
+
log "Skipping planning phase (using existing plan)"
|
|
268
|
+
if [[ ! -f "$PLAN_FILE" ]]; then
|
|
269
|
+
error "No existing plan found at $PLAN_FILE"
|
|
270
|
+
exit 1
|
|
271
|
+
fi
|
|
272
|
+
fi
|
|
273
|
+
|
|
274
|
+
# ─── PHASE 2: EXECUTION ─────────────────────────────────
|
|
275
|
+
header "⚡ Phase 2: Execution ($EXECUTOR)"
|
|
276
|
+
|
|
277
|
+
PLAN_CONTENT=$(cat "$PLAN_FILE")
|
|
278
|
+
|
|
279
|
+
EXEC_PROMPT="You are the EXECUTOR agent in a multi-agent development team.
|
|
280
|
+
|
|
281
|
+
TASK: $TASK
|
|
282
|
+
|
|
283
|
+
You must implement the following plan EXACTLY. Do not deviate from the plan unless you encounter a blocker.
|
|
284
|
+
|
|
285
|
+
=== PLAN ===
|
|
286
|
+
$PLAN_CONTENT
|
|
287
|
+
=== END PLAN ===
|
|
288
|
+
|
|
289
|
+
INSTRUCTIONS:
|
|
290
|
+
1. Read the relevant files first to understand current state
|
|
291
|
+
2. Make the changes described in the plan
|
|
292
|
+
3. After making changes, run any build/compile commands to verify
|
|
293
|
+
4. If you encounter issues, fix them and document what you changed
|
|
294
|
+
|
|
295
|
+
IMPORTANT:
|
|
296
|
+
- Follow the plan precisely
|
|
297
|
+
- Create new files where specified
|
|
298
|
+
- Modify existing files as described
|
|
299
|
+
- Run tests if the plan includes a testing strategy
|
|
300
|
+
- Log any deviations from the plan"
|
|
301
|
+
|
|
302
|
+
EXECUTOR_PERMISSION=$(read_config "executor" "auto_edit")
|
|
303
|
+
run_agent "$EXECUTOR" "$EXEC_PROMPT" "$PROJECT" "$EXEC_LOG" "$EXECUTOR_PERMISSION"
|
|
304
|
+
|
|
305
|
+
log "Execution log saved to: $EXEC_LOG"
|
|
306
|
+
|
|
307
|
+
# ─── PHASE 3: REVIEW ────────────────────────────────────
|
|
308
|
+
if ! $SKIP_REVIEW; then
|
|
309
|
+
header "🔍 Phase 3: Review ($REVIEWER)"
|
|
310
|
+
|
|
311
|
+
# Capture git diff for the reviewer
|
|
312
|
+
DIFF_OUTPUT=""
|
|
313
|
+
if command -v git &>/dev/null && git -C "$PROJECT" rev-parse --is-inside-work-tree &>/dev/null; then
|
|
314
|
+
DIFF_OUTPUT=$(git -C "$PROJECT" diff --stat 2>/dev/null || echo "No git diff available")
|
|
315
|
+
DIFF_DETAIL=$(git -C "$PROJECT" diff 2>/dev/null | head -500 || echo "")
|
|
316
|
+
fi
|
|
317
|
+
|
|
318
|
+
REVIEW_PROMPT="You are the REVIEWER agent in a multi-agent development team.
|
|
319
|
+
|
|
320
|
+
TASK: $TASK
|
|
321
|
+
|
|
322
|
+
You must review the changes made by the executor agent.
|
|
323
|
+
|
|
324
|
+
=== ORIGINAL PLAN ===
|
|
325
|
+
$PLAN_CONTENT
|
|
326
|
+
=== END PLAN ===
|
|
327
|
+
|
|
328
|
+
=== GIT DIFF SUMMARY ===
|
|
329
|
+
$DIFF_OUTPUT
|
|
330
|
+
=== END DIFF SUMMARY ===
|
|
331
|
+
|
|
332
|
+
=== DIFF DETAIL (first 500 lines) ===
|
|
333
|
+
$DIFF_DETAIL
|
|
334
|
+
=== END DIFF ===
|
|
335
|
+
|
|
336
|
+
REVIEW CHECKLIST:
|
|
337
|
+
1. ✅ Does the implementation match the plan?
|
|
338
|
+
2. ✅ Are there any bugs or logic errors?
|
|
339
|
+
3. ✅ Code quality: naming, structure, patterns
|
|
340
|
+
4. ✅ Are edge cases handled?
|
|
341
|
+
5. ✅ Security considerations
|
|
342
|
+
6. ✅ Performance concerns
|
|
343
|
+
7. ✅ Missing tests or documentation
|
|
344
|
+
8. ✅ Breaking changes
|
|
345
|
+
|
|
346
|
+
OUTPUT FORMAT (markdown):
|
|
347
|
+
# Code Review Report
|
|
348
|
+
|
|
349
|
+
## Summary
|
|
350
|
+
<Overall assessment: APPROVED | NEEDS_CHANGES | REJECTED>
|
|
351
|
+
|
|
352
|
+
## Findings
|
|
353
|
+
### Critical Issues
|
|
354
|
+
- ...
|
|
355
|
+
|
|
356
|
+
### Warnings
|
|
357
|
+
- ...
|
|
358
|
+
|
|
359
|
+
### Suggestions
|
|
360
|
+
- ...
|
|
361
|
+
|
|
362
|
+
## Plan Adherence
|
|
363
|
+
<Did the executor follow the plan? Any deviations?>
|
|
364
|
+
|
|
365
|
+
## Verdict
|
|
366
|
+
<Final recommendation with reasoning>"
|
|
367
|
+
|
|
368
|
+
REVIEWER_PERMISSION=$(read_config "reviewer" "plan")
|
|
369
|
+
run_agent "$REVIEWER" "$REVIEW_PROMPT" "$PROJECT" "$REVIEW_FILE" "$REVIEWER_PERMISSION"
|
|
370
|
+
|
|
371
|
+
log "Review saved to: $REVIEW_FILE"
|
|
372
|
+
fi
|
|
373
|
+
|
|
374
|
+
# ─── PHASE 4: BROWSER TESTING ───────────────────────────
|
|
375
|
+
if $BROWSER_TEST; then
|
|
376
|
+
header "🌐 Phase 4: Browser Testing (Playwright MCP)"
|
|
377
|
+
|
|
378
|
+
if [[ -z "$TEST_URL" ]]; then
|
|
379
|
+
TEST_URL=$(read_config "base_url" "http://localhost:4200")
|
|
380
|
+
fi
|
|
381
|
+
|
|
382
|
+
BROWSER_PROMPT="You are a QA agent performing browser-based testing.
|
|
383
|
+
|
|
384
|
+
TASK: Test the changes made for: $TASK
|
|
385
|
+
|
|
386
|
+
TEST URL: $TEST_URL
|
|
387
|
+
|
|
388
|
+
INSTRUCTIONS:
|
|
389
|
+
1. Navigate to $TEST_URL
|
|
390
|
+
2. Login with test credentials if required
|
|
391
|
+
3. Navigate to the relevant pages affected by the task
|
|
392
|
+
4. Click buttons, fill forms, and interact with the UI
|
|
393
|
+
5. Take a screenshot at EACH significant step
|
|
394
|
+
6. Verify that the expected behavior matches the plan
|
|
395
|
+
7. Report any visual glitches, broken layouts, or errors
|
|
396
|
+
|
|
397
|
+
OUTPUT FORMAT (markdown):
|
|
398
|
+
# Browser Test Report
|
|
399
|
+
|
|
400
|
+
## Test Environment
|
|
401
|
+
- URL: $TEST_URL
|
|
402
|
+
- Browser: Chromium
|
|
403
|
+
- Date: $TIMESTAMP
|
|
404
|
+
|
|
405
|
+
## Test Steps
|
|
406
|
+
### Step 1: [Description]
|
|
407
|
+
- Action: ...
|
|
408
|
+
- Expected: ...
|
|
409
|
+
- Actual: ...
|
|
410
|
+
- Screenshot: [filename]
|
|
411
|
+
- Status: PASS | FAIL
|
|
412
|
+
|
|
413
|
+
## Summary
|
|
414
|
+
- Total steps: N
|
|
415
|
+
- Passed: N
|
|
416
|
+
- Failed: N
|
|
417
|
+
- Screenshots: [list]"
|
|
418
|
+
|
|
419
|
+
# Use Claude with --chrome or Playwright MCP for browser testing
|
|
420
|
+
BROWSER_AGENT="${PLANNER}" # default to planner agent for browser tests
|
|
421
|
+
TEST_REPORT="${AGENTIC_DIR}/test-report.md"
|
|
422
|
+
|
|
423
|
+
run_agent "$BROWSER_AGENT" "$BROWSER_PROMPT" "$PROJECT" "$TEST_REPORT" "default"
|
|
424
|
+
|
|
425
|
+
log "Test report saved to: $TEST_REPORT"
|
|
426
|
+
fi
|
|
427
|
+
|
|
428
|
+
# ─── FINAL REPORT ────────────────────────────────────────
|
|
429
|
+
header "📊 Final Summary"
|
|
430
|
+
|
|
431
|
+
REPORT_FILE="${AGENTIC_DIR}/report-${TIMESTAMP}.md"
|
|
432
|
+
cat > "$REPORT_FILE" <<EOF
|
|
433
|
+
# Orchestration Report
|
|
434
|
+
|
|
435
|
+
**Date:** $TIMESTAMP
|
|
436
|
+
**Task:** $TASK
|
|
437
|
+
**Project:** $PROJECT
|
|
438
|
+
|
|
439
|
+
## Agent Assignments
|
|
440
|
+
| Role | Agent |
|
|
441
|
+
|------|-------|
|
|
442
|
+
| Planner | $PLANNER |
|
|
443
|
+
| Executor | $EXECUTOR |
|
|
444
|
+
| Reviewer | $REVIEWER |
|
|
445
|
+
|
|
446
|
+
## Artifacts
|
|
447
|
+
- Plan: [plan.md](./plan.md)
|
|
448
|
+
- Execution Log: [execution.log](./execution.log)
|
|
449
|
+
- Review: [review.md](./review.md)
|
|
450
|
+
$(if $BROWSER_TEST; then echo "- Test Report: [test-report.md](./test-report.md)"; fi)
|
|
451
|
+
|
|
452
|
+
## Quick Links
|
|
453
|
+
- \`cat ${PLAN_FILE}\`
|
|
454
|
+
- \`cat ${REVIEW_FILE}\`
|
|
455
|
+
EOF
|
|
456
|
+
|
|
457
|
+
success "Report saved to: $REPORT_FILE"
|
|
458
|
+
echo ""
|
|
459
|
+
echo -e "${GREEN}${BOLD}All phases complete!${NC}"
|
|
460
|
+
echo -e " 📋 Plan: ${PLAN_FILE}"
|
|
461
|
+
echo -e " ⚡ Log: ${EXEC_LOG}"
|
|
462
|
+
echo -e " 🔍 Review: ${REVIEW_FILE}"
|
|
463
|
+
if $BROWSER_TEST; then
|
|
464
|
+
echo -e " 🌐 Tests: ${AGENTIC_DIR}/test-report.md"
|
|
465
|
+
fi
|
|
466
|
+
echo -e " 📊 Report: ${REPORT_FILE}"
|
|
467
|
+
echo ""
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "codeswarm",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Multi-agent AI orchestration framework — coordinate Claude, Gemini, Codex, Amp, and OpenCode as a unified dev team",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Mustafa Kutlu <your-email@example.com>",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/mskutlu/codeswarm.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/mskutlu/codeswarm#readme",
|
|
12
|
+
"bugs": "https://github.com/mskutlu/codeswarm/issues",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"ai",
|
|
15
|
+
"agent",
|
|
16
|
+
"multi-agent",
|
|
17
|
+
"orchestration",
|
|
18
|
+
"claude",
|
|
19
|
+
"gemini",
|
|
20
|
+
"codex",
|
|
21
|
+
"amp",
|
|
22
|
+
"opencode",
|
|
23
|
+
"coding-agent",
|
|
24
|
+
"autonomous",
|
|
25
|
+
"prd",
|
|
26
|
+
"dashboard",
|
|
27
|
+
"workflow"
|
|
28
|
+
],
|
|
29
|
+
"bin": {
|
|
30
|
+
"codeswarm": "bin/codeswarm.js"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"bin/",
|
|
34
|
+
"coordinator.sh",
|
|
35
|
+
"orchestrate.sh",
|
|
36
|
+
"setup.sh",
|
|
37
|
+
"config.yaml",
|
|
38
|
+
"dashboard/",
|
|
39
|
+
".codeswarm/",
|
|
40
|
+
"docs/",
|
|
41
|
+
"playwright.config.ts",
|
|
42
|
+
"COORDINATOR.md",
|
|
43
|
+
"AGENT_TIPS.md",
|
|
44
|
+
"TASK_PROTOCOL.md",
|
|
45
|
+
"BROWSER_TESTING.md",
|
|
46
|
+
"WORKFLOWS.md",
|
|
47
|
+
"LICENSE",
|
|
48
|
+
"README.md"
|
|
49
|
+
],
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=18.0.0"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"test": "bash coordinator.sh --project /tmp/codeswarm-test --prd docs/prd-example.md --dry-run",
|
|
55
|
+
"dashboard": "node dashboard/server.js"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"chokidar": "^3.6.0",
|
|
59
|
+
"express": "^4.21.0",
|
|
60
|
+
"ws": "^8.18.0"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineConfig } from '@playwright/test';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
testDir: './tests',
|
|
5
|
+
timeout: 30000,
|
|
6
|
+
retries: 1,
|
|
7
|
+
use: {
|
|
8
|
+
baseURL: process.env.TEST_URL || 'http://localhost:4200',
|
|
9
|
+
headless: true,
|
|
10
|
+
screenshot: 'on',
|
|
11
|
+
video: 'retain-on-failure',
|
|
12
|
+
trace: 'on-first-retry',
|
|
13
|
+
},
|
|
14
|
+
reporter: [
|
|
15
|
+
['html', { outputFolder: 'playwright-report' }],
|
|
16
|
+
['json', { outputFile: '.codeswarm/test-results.json' }],
|
|
17
|
+
],
|
|
18
|
+
outputDir: '.codeswarm/screenshots',
|
|
19
|
+
});
|
package/setup.sh
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# setup.sh — Install dependencies for the Agentic Orchestration Framework
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
9
|
+
|
|
10
|
+
GREEN='\033[0;32m'
|
|
11
|
+
YELLOW='\033[1;33m'
|
|
12
|
+
RED='\033[0;31m'
|
|
13
|
+
BOLD='\033[1m'
|
|
14
|
+
NC='\033[0m'
|
|
15
|
+
|
|
16
|
+
echo -e "${BOLD}🤖 Agentic Setup${NC}"
|
|
17
|
+
echo ""
|
|
18
|
+
|
|
19
|
+
# ─── Check Prerequisites ────────────────────────────────
|
|
20
|
+
check_cmd() {
|
|
21
|
+
if command -v "$1" &>/dev/null; then
|
|
22
|
+
echo -e " ${GREEN}✓${NC} $1 found: $(command -v "$1")"
|
|
23
|
+
return 0
|
|
24
|
+
else
|
|
25
|
+
echo -e " ${RED}✗${NC} $1 not found"
|
|
26
|
+
return 1
|
|
27
|
+
fi
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
echo -e "${BOLD}Checking prerequisites...${NC}"
|
|
31
|
+
MISSING=0
|
|
32
|
+
check_cmd "claude" || MISSING=1
|
|
33
|
+
check_cmd "gemini" || MISSING=1
|
|
34
|
+
check_cmd "codex" || MISSING=1
|
|
35
|
+
check_cmd "node" || MISSING=1
|
|
36
|
+
check_cmd "npm" || MISSING=1
|
|
37
|
+
check_cmd "git" || MISSING=1
|
|
38
|
+
|
|
39
|
+
if [[ $MISSING -eq 1 ]]; then
|
|
40
|
+
echo ""
|
|
41
|
+
echo -e "${YELLOW}⚠ Some tools are missing. Install them before running the orchestrator.${NC}"
|
|
42
|
+
echo ""
|
|
43
|
+
echo " Install CLI agents:"
|
|
44
|
+
echo " Claude Code: npm install -g @anthropic/claude-code"
|
|
45
|
+
echo " Gemini CLI: npm install -g @anthropic/gemini-cli (or via Google's installer)"
|
|
46
|
+
echo " Codex CLI: npm install -g @openai/codex"
|
|
47
|
+
echo ""
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
# ─── Install Node Dependencies ──────────────────────────
|
|
51
|
+
echo ""
|
|
52
|
+
echo -e "${BOLD}Installing Node dependencies...${NC}"
|
|
53
|
+
cd "$SCRIPT_DIR"
|
|
54
|
+
|
|
55
|
+
if [[ ! -f package.json ]]; then
|
|
56
|
+
npm init -y --silent
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
npm install --save-dev playwright @playwright/test 2>/dev/null || true
|
|
60
|
+
|
|
61
|
+
echo ""
|
|
62
|
+
echo -e "${BOLD}Installing Playwright browsers...${NC}"
|
|
63
|
+
npx playwright install chromium 2>/dev/null || true
|
|
64
|
+
|
|
65
|
+
# ─── Make scripts executable ─────────────────────────────
|
|
66
|
+
chmod +x "$SCRIPT_DIR/orchestrate.sh"
|
|
67
|
+
chmod +x "$SCRIPT_DIR/setup.sh"
|
|
68
|
+
|
|
69
|
+
# ─── MCP Configuration ──────────────────────────────────
|
|
70
|
+
echo ""
|
|
71
|
+
echo -e "${BOLD}MCP Configuration${NC}"
|
|
72
|
+
echo ""
|
|
73
|
+
echo " To enable Playwright MCP for each agent, add the following:"
|
|
74
|
+
echo ""
|
|
75
|
+
echo -e " ${YELLOW}Claude Code${NC} (~/.claude/mcp.json):"
|
|
76
|
+
echo ' { "mcpServers": { "playwright": { "command": "npx", "args": ["@anthropic/mcp-server-playwright"] } } }'
|
|
77
|
+
echo ""
|
|
78
|
+
echo -e " ${YELLOW}Gemini CLI${NC} (~/.gemini/settings.json):"
|
|
79
|
+
echo ' { "mcpServers": { "playwright": { "command": "npx", "args": ["@anthropic/mcp-server-playwright"] } } }'
|
|
80
|
+
echo ""
|
|
81
|
+
echo -e " ${YELLOW}Codex CLI${NC} (~/.codex/config.toml):"
|
|
82
|
+
echo ' [mcp_servers.playwright]'
|
|
83
|
+
echo ' command = "npx"'
|
|
84
|
+
echo ' args = ["@anthropic/mcp-server-playwright"]'
|
|
85
|
+
echo ""
|
|
86
|
+
|
|
87
|
+
# ─── Create Example Test ─────────────────────────────────
|
|
88
|
+
mkdir -p "$SCRIPT_DIR/tests"
|
|
89
|
+
if [[ ! -f "$SCRIPT_DIR/tests/example.spec.ts" ]]; then
|
|
90
|
+
cat > "$SCRIPT_DIR/tests/example.spec.ts" << 'EOTEST'
|
|
91
|
+
import { test, expect } from '@playwright/test';
|
|
92
|
+
|
|
93
|
+
test.describe('Smoke Test', () => {
|
|
94
|
+
test('should load login page', async ({ page }) => {
|
|
95
|
+
await page.goto(process.env.TEST_URL || 'http://localhost:4200');
|
|
96
|
+
await page.screenshot({ path: '.codeswarm/screenshots/login-page.png' });
|
|
97
|
+
// Verify the page loads without errors
|
|
98
|
+
const title = await page.title();
|
|
99
|
+
expect(title).toBeTruthy();
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test('should login and navigate', async ({ page }) => {
|
|
103
|
+
const baseUrl = process.env.TEST_URL || 'http://localhost:4200';
|
|
104
|
+
await page.goto(baseUrl);
|
|
105
|
+
|
|
106
|
+
// Attempt login (adjust selectors to your app)
|
|
107
|
+
const usernameInput = page.locator('input[type="text"], input[name="username"], #username');
|
|
108
|
+
const passwordInput = page.locator('input[type="password"], input[name="password"], #password');
|
|
109
|
+
const loginButton = page.locator('button[type="submit"], button:has-text("Login"), button:has-text("Giriş")');
|
|
110
|
+
|
|
111
|
+
if (await usernameInput.isVisible()) {
|
|
112
|
+
await usernameInput.fill(process.env.TEST_USER || 'admin');
|
|
113
|
+
await passwordInput.fill(process.env.TEST_PASS || 'admin');
|
|
114
|
+
await loginButton.click();
|
|
115
|
+
await page.waitForTimeout(3000);
|
|
116
|
+
await page.screenshot({ path: '.codeswarm/screenshots/after-login.png' });
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
EOTEST
|
|
121
|
+
echo -e " ${GREEN}✓${NC} Created example test: tests/example.spec.ts"
|
|
122
|
+
fi
|
|
123
|
+
|
|
124
|
+
# ─── Create .gitignore ───────────────────────────────────
|
|
125
|
+
if [[ ! -f "$SCRIPT_DIR/.gitignore" ]]; then
|
|
126
|
+
cat > "$SCRIPT_DIR/.gitignore" << 'EOIGNORE'
|
|
127
|
+
node_modules/
|
|
128
|
+
.codeswarm/
|
|
129
|
+
*.log
|
|
130
|
+
test-results/
|
|
131
|
+
playwright-report/
|
|
132
|
+
EOIGNORE
|
|
133
|
+
echo -e " ${GREEN}✓${NC} Created .gitignore"
|
|
134
|
+
fi
|
|
135
|
+
|
|
136
|
+
echo ""
|
|
137
|
+
echo -e "${GREEN}${BOLD}Setup complete!${NC}"
|
|
138
|
+
echo ""
|
|
139
|
+
echo " Next steps:"
|
|
140
|
+
echo " 1. Review config.yaml and adjust defaults"
|
|
141
|
+
echo " 2. Run: ./orchestrate.sh --project <path> --task \"your task\""
|
|
142
|
+
echo ""
|