@garethdaine/agentops 0.9.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/.claude-plugin/plugin.json +10 -0
- package/LICENSE +21 -0
- package/README.md +410 -0
- package/agents/architecture-researcher.md +115 -0
- package/agents/code-critic.md +190 -0
- package/agents/delegation-router.md +40 -0
- package/agents/feature-researcher.md +117 -0
- package/agents/interrogator.md +11 -0
- package/agents/pitfalls-researcher.md +112 -0
- package/agents/plan-validator.md +173 -0
- package/agents/proposer.md +61 -0
- package/agents/security-reviewer.md +189 -0
- package/agents/skill-builder.md +43 -0
- package/agents/spec-compliance-reviewer.md +154 -0
- package/agents/stack-researcher.md +89 -0
- package/commands/build.md +766 -0
- package/commands/code-analysis.md +39 -0
- package/commands/code-field.md +22 -0
- package/commands/compliance-check.md +34 -0
- package/commands/configure.md +178 -0
- package/commands/cost-report.md +17 -0
- package/commands/enterprise/adr.md +78 -0
- package/commands/enterprise/brainstorm.md +461 -0
- package/commands/enterprise/design.md +203 -0
- package/commands/enterprise/dev-setup.md +136 -0
- package/commands/enterprise/docker-dev.md +229 -0
- package/commands/enterprise/e2e.md +233 -0
- package/commands/enterprise/feature.md +218 -0
- package/commands/enterprise/gap-analysis.md +204 -0
- package/commands/enterprise/handover.md +195 -0
- package/commands/enterprise/herd.md +152 -0
- package/commands/enterprise/knowledge.md +173 -0
- package/commands/enterprise/onboard.md +86 -0
- package/commands/enterprise/qa-check.md +80 -0
- package/commands/enterprise/reason.md +196 -0
- package/commands/enterprise/review.md +177 -0
- package/commands/enterprise/scaffold.md +153 -0
- package/commands/enterprise/status-report.md +101 -0
- package/commands/enterprise/tech-catalog.md +170 -0
- package/commands/enterprise/test-gen.md +138 -0
- package/commands/evolve.md +39 -0
- package/commands/flags.md +44 -0
- package/commands/interrogate.md +263 -0
- package/commands/lesson.md +15 -0
- package/commands/lessons.md +10 -0
- package/commands/plan.md +44 -0
- package/commands/prune.md +27 -0
- package/commands/star.md +17 -0
- package/commands/supply-chain-scan.md +44 -0
- package/commands/unicode-scan.md +63 -0
- package/commands/verify.md +41 -0
- package/commands/workflow.md +436 -0
- package/hooks/ai-guardrails.sh +114 -0
- package/hooks/audit-log.sh +26 -0
- package/hooks/auto-delegate.sh +45 -0
- package/hooks/auto-evolve.sh +22 -0
- package/hooks/auto-lesson.sh +26 -0
- package/hooks/auto-plan.sh +59 -0
- package/hooks/auto-test.sh +46 -0
- package/hooks/auto-verify.sh +30 -0
- package/hooks/budget-check.sh +24 -0
- package/hooks/code-field-preamble.sh +30 -0
- package/hooks/compliance-gate.sh +50 -0
- package/hooks/content-trust.sh +22 -0
- package/hooks/credential-redact.sh +23 -0
- package/hooks/delegation-trust.sh +15 -0
- package/hooks/detect-test-run.sh +19 -0
- package/hooks/enforcement-lib.sh +60 -0
- package/hooks/evolve-gate.sh +32 -0
- package/hooks/evolve-lib.sh +32 -0
- package/hooks/exfiltration-check.sh +67 -0
- package/hooks/failure-collector.sh +27 -0
- package/hooks/feature-flags.sh +67 -0
- package/hooks/file-provenance.sh +31 -0
- package/hooks/flag-utils.sh +36 -0
- package/hooks/hooks.json +145 -0
- package/hooks/injection-scan.sh +58 -0
- package/hooks/integrity-verify.sh +91 -0
- package/hooks/lessons-check.sh +17 -0
- package/hooks/lockfile-audit.sh +109 -0
- package/hooks/patterns-lib.sh +22 -0
- package/hooks/plan-gate.sh +18 -0
- package/hooks/redact-lib.sh +15 -0
- package/hooks/runtime-mode.sh +56 -0
- package/hooks/session-cleanup.sh +74 -0
- package/hooks/skill-validator.sh +28 -0
- package/hooks/standards-enforce.sh +106 -0
- package/hooks/star-gate.sh +93 -0
- package/hooks/star-preamble.sh +10 -0
- package/hooks/telemetry.sh +33 -0
- package/hooks/todo-prune.sh +84 -0
- package/hooks/unicode-firewall.sh +122 -0
- package/hooks/unicode-lib.sh +66 -0
- package/hooks/unicode-scan-session.sh +96 -0
- package/hooks/validate-command.sh +103 -0
- package/hooks/validate-env.sh +51 -0
- package/hooks/validate-path.sh +81 -0
- package/package.json +40 -0
- package/settings.json +6 -0
- package/templates/ai-config/tool-standards.md +56 -0
- package/templates/architecture/api-first.md +192 -0
- package/templates/architecture/auth-patterns.md +302 -0
- package/templates/architecture/caching-strategy.md +359 -0
- package/templates/architecture/database-patterns.md +347 -0
- package/templates/architecture/event-driven.md +252 -0
- package/templates/architecture/integration-patterns.md +185 -0
- package/templates/architecture/multi-tenancy.md +104 -0
- package/templates/architecture/service-boundaries.md +200 -0
- package/templates/build/brief-template.md +86 -0
- package/templates/build/summary-template.md +100 -0
- package/templates/build/task-plan-template.md +133 -0
- package/templates/communication/effort-estimate.md +54 -0
- package/templates/communication/incident-response.md +59 -0
- package/templates/communication/post-mortem.md +109 -0
- package/templates/communication/risk-register.md +43 -0
- package/templates/communication/sprint-demo-checklist.md +64 -0
- package/templates/communication/stakeholder-presentation-outline.md +84 -0
- package/templates/communication/technical-proposal.md +77 -0
- package/templates/delivery/deployment/deployment-checklist.md +49 -0
- package/templates/delivery/design/solution-design-checklist.md +37 -0
- package/templates/delivery/discovery/stakeholder-questions.md +33 -0
- package/templates/delivery/handover/knowledge-transfer-checklist.md +75 -0
- package/templates/delivery/handover/operational-runbook.md +117 -0
- package/templates/delivery/handover/support-escalation-matrix.md +56 -0
- package/templates/delivery/implementation/blocker-escalation-template.md +55 -0
- package/templates/delivery/implementation/sprint-planning-template.md +49 -0
- package/templates/delivery/implementation/task-decomposition-guide.md +59 -0
- package/templates/delivery/qa/test-plan-template.md +76 -0
- package/templates/delivery/qa/test-results-template.md +55 -0
- package/templates/delivery/qa/uat-signoff-template.md +44 -0
- package/templates/governance/codeowners.md +60 -0
- package/templates/integration/adapter-pattern.md +160 -0
- package/templates/scaffolds/env-validation.md +85 -0
- package/templates/scaffolds/error-handling.md +171 -0
- package/templates/scaffolds/graceful-shutdown.md +139 -0
- package/templates/scaffolds/health-check.md +109 -0
- package/templates/scaffolds/structured-logging.md +134 -0
- package/templates/standards/engineering-standards.md +413 -0
- package/templates/standards/standards-checklist.md +125 -0
- package/templates/tech-catalog.json +663 -0
- package/templates/utilities/project-detection.md +75 -0
- package/templates/utilities/requirements-collection.md +68 -0
- package/templates/utilities/template-rendering.md +81 -0
- package/templates/workflows/architecture-decision.md +90 -0
- package/templates/workflows/bug-investigation.md +83 -0
- package/templates/workflows/feature-implementation.md +80 -0
- package/templates/workflows/refactoring.md +83 -0
- package/templates/workflows/spike-exploration.md +82 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dev-setup
|
|
3
|
+
description: Full local development setup — choose Herd or Docker, then set up and run E2E tests
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are a development environment orchestrator. You run the complete local setup pipeline: configure the local dev environment (Herd or Docker), then optionally set up and execute E2E browser tests.
|
|
7
|
+
|
|
8
|
+
## CRITICAL RULE: Use AskUserQuestion Tool
|
|
9
|
+
|
|
10
|
+
You MUST use the `AskUserQuestion` tool for EVERY question. DO NOT print questions as plain text. This is a BLOCKING REQUIREMENT.
|
|
11
|
+
|
|
12
|
+
**Before starting, check the feature flag:**
|
|
13
|
+
Run: `source hooks/feature-flags.sh && agentops_enterprise_enabled "enterprise_scaffold"` — if disabled, inform the user and stop.
|
|
14
|
+
|
|
15
|
+
Arguments: $ARGUMENTS
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Step 0: Choose Dev Environment
|
|
20
|
+
|
|
21
|
+
Call `AskUserQuestion`:
|
|
22
|
+
- question: "How would you like to run the local development environment?"
|
|
23
|
+
- header: "Dev Env"
|
|
24
|
+
- options: [{label: "Laravel Herd (Recommended)", description: "Native macOS — fast, zero Docker overhead, SSL, managed services"}, {label: "Docker", description: "Containerised — portable, consistent, matches production"}, {label: "Both", description: "Herd for the app, Docker for services (database, cache)"}]
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Step 1: Environment Setup
|
|
29
|
+
|
|
30
|
+
Based on the choice in Step 0:
|
|
31
|
+
|
|
32
|
+
### If Herd selected:
|
|
33
|
+
|
|
34
|
+
Run the `/agentops:herd` workflow:
|
|
35
|
+
1. Verify Herd is installed
|
|
36
|
+
2. Detect project type
|
|
37
|
+
3. Configure and link the site (domain, SSL, PHP/Node version)
|
|
38
|
+
4. Start any required services (database, cache)
|
|
39
|
+
5. Verify the site is accessible at `https://[site-name].test`
|
|
40
|
+
|
|
41
|
+
**Base URL for E2E:** `https://[site-name].test`
|
|
42
|
+
|
|
43
|
+
### If Docker selected:
|
|
44
|
+
|
|
45
|
+
Run the `/agentops:docker-dev` workflow:
|
|
46
|
+
1. Verify Docker is installed
|
|
47
|
+
2. Generate Dockerfile and docker-compose.yml (if not present)
|
|
48
|
+
3. Select services (database, cache)
|
|
49
|
+
4. Build and start containers
|
|
50
|
+
5. Verify all services are healthy
|
|
51
|
+
|
|
52
|
+
**Base URL for E2E:** `http://localhost:[port]`
|
|
53
|
+
|
|
54
|
+
### If Both selected:
|
|
55
|
+
|
|
56
|
+
1. Run `/agentops:docker-dev` for services only — database, cache, queues (skip app container)
|
|
57
|
+
2. Run `/agentops:herd` for the application — link site, configure proxy/PHP
|
|
58
|
+
3. Update `.env` to point the app at Docker service ports (e.g., `DB_HOST=127.0.0.1` instead of `db`)
|
|
59
|
+
|
|
60
|
+
**Base URL for E2E:** `https://[site-name].test`
|
|
61
|
+
|
|
62
|
+
### Gate
|
|
63
|
+
|
|
64
|
+
Verify the application is accessible at the base URL before proceeding.
|
|
65
|
+
|
|
66
|
+
If setup fails, call `AskUserQuestion`:
|
|
67
|
+
- question: "Environment setup encountered an issue. How would you like to proceed?"
|
|
68
|
+
- header: "Continue?"
|
|
69
|
+
- options: [{label: "Retry setup", description: "Try the configuration again"}, {label: "Skip to E2E", description: "Continue without local environment — provide a URL manually"}, {label: "Stop", description: "Fix the issue manually first"}]
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Step 2: E2E Test Setup & Run
|
|
74
|
+
|
|
75
|
+
Call `AskUserQuestion`:
|
|
76
|
+
- question: "Would you like to set up and run E2E browser tests?"
|
|
77
|
+
- header: "E2E"
|
|
78
|
+
- options: [{label: "Yes — full setup (Recommended)", description: "Install framework, generate tests, run them"}, {label: "Run existing tests only", description: "Tests already configured, just execute them"}, {label: "Skip E2E", description: "No browser testing needed right now"}]
|
|
79
|
+
|
|
80
|
+
If yes or run only, execute the `/agentops:e2e` workflow:
|
|
81
|
+
1. Check for existing E2E framework or install one
|
|
82
|
+
2. Generate test files for detected routes/flows
|
|
83
|
+
3. Run the test suite against the environment URL from Step 1
|
|
84
|
+
4. Report results
|
|
85
|
+
|
|
86
|
+
**Important:** Pass the base URL from Step 1 via `E2E_BASE_URL` environment variable or configure directly in the test config.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Final Report
|
|
91
|
+
|
|
92
|
+
After all steps complete, present a combined summary:
|
|
93
|
+
|
|
94
|
+
```markdown
|
|
95
|
+
## Development Environment Ready
|
|
96
|
+
|
|
97
|
+
### Environment
|
|
98
|
+
| Setting | Value |
|
|
99
|
+
|---------|-------|
|
|
100
|
+
| Mode | Herd / Docker / Both |
|
|
101
|
+
| App URL | [URL] |
|
|
102
|
+
| SSL | [Yes/No] |
|
|
103
|
+
|
|
104
|
+
### Services
|
|
105
|
+
| Service | Provider | Port | Status |
|
|
106
|
+
|---------|----------|------|--------|
|
|
107
|
+
| App | [Herd/Docker] | [port] | Running |
|
|
108
|
+
| Database | [Herd/Docker] | [port] | Healthy |
|
|
109
|
+
| Cache | [Herd/Docker] | [port] | Running |
|
|
110
|
+
|
|
111
|
+
### E2E Tests (if run)
|
|
112
|
+
| Metric | Value |
|
|
113
|
+
|--------|-------|
|
|
114
|
+
| Framework | [Playwright/Cypress] |
|
|
115
|
+
| Tests | [N] total, [N] passing |
|
|
116
|
+
| Browsers | [list] |
|
|
117
|
+
|
|
118
|
+
### Quick Reference
|
|
119
|
+
| Task | Command |
|
|
120
|
+
|------|---------|
|
|
121
|
+
| Start dev server | `[dev command]` |
|
|
122
|
+
| Run E2E tests | `npx playwright test` |
|
|
123
|
+
| View test report | `npx playwright show-report` |
|
|
124
|
+
| Stop environment | `[herd unlink / docker compose down]` |
|
|
125
|
+
| Run code review | `/agentops:review` |
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Error Handling
|
|
131
|
+
|
|
132
|
+
- If neither Herd nor Docker is installed, report both and suggest installing one
|
|
133
|
+
- If Step 1 fails and the user skips, Step 2 should ask for the dev server URL manually via AskUserQuestion
|
|
134
|
+
- If Step 2 fails because the site isn't running, provide clear start instructions
|
|
135
|
+
- Never leave the environment in a half-configured state
|
|
136
|
+
- If all steps succeed: "Development environment is fully configured and tested."
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: docker-dev
|
|
3
|
+
description: Set up and configure the local development environment using Docker and Docker Compose
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are a local development environment assistant. You configure the current project to run in Docker, handling container builds, service orchestration, networking, and volume mounts.
|
|
7
|
+
|
|
8
|
+
## CRITICAL RULE: Use AskUserQuestion Tool
|
|
9
|
+
|
|
10
|
+
You MUST use the `AskUserQuestion` tool for EVERY question. DO NOT print questions as plain text. This is a BLOCKING REQUIREMENT.
|
|
11
|
+
|
|
12
|
+
**Before starting, check the feature flag:**
|
|
13
|
+
Run: `source hooks/feature-flags.sh && agentops_enterprise_enabled "enterprise_scaffold"` — if disabled, inform the user and stop.
|
|
14
|
+
|
|
15
|
+
Arguments: $ARGUMENTS
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Phase 1: Detect Environment
|
|
20
|
+
|
|
21
|
+
1. **Verify Docker is installed:**
|
|
22
|
+
- Check: `docker --version` and `docker compose version`
|
|
23
|
+
- If not found, inform the user: "Docker is not installed. Download from https://www.docker.com/products/docker-desktop/" and stop
|
|
24
|
+
|
|
25
|
+
2. **Detect existing Docker configuration:**
|
|
26
|
+
- Check for `Dockerfile`, `docker-compose.yml`, `docker-compose.yaml`, `compose.yml`, `compose.yaml`
|
|
27
|
+
- Check for `.dockerignore`
|
|
28
|
+
- If found, report what exists
|
|
29
|
+
|
|
30
|
+
3. **Detect project type** using `templates/utilities/project-detection.md`
|
|
31
|
+
|
|
32
|
+
4. If Docker config already exists, call `AskUserQuestion`:
|
|
33
|
+
- question: "Docker configuration found. What would you like to do?"
|
|
34
|
+
- header: "Action"
|
|
35
|
+
- options: [{label: "Start services (Recommended)", description: "Build and start existing Docker setup"}, {label: "Reconfigure", description: "Regenerate Docker configuration"}, {label: "Add services", description: "Add database, cache, or other services"}]
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Phase 2: Configure Docker
|
|
40
|
+
|
|
41
|
+
If no Docker config exists, or user chose reconfigure:
|
|
42
|
+
|
|
43
|
+
### 2.1 Application Container
|
|
44
|
+
|
|
45
|
+
Based on the detected project type, generate an appropriate `Dockerfile`:
|
|
46
|
+
|
|
47
|
+
**Node.js / TypeScript projects:**
|
|
48
|
+
```dockerfile
|
|
49
|
+
FROM node:22-alpine AS base
|
|
50
|
+
WORKDIR /app
|
|
51
|
+
|
|
52
|
+
FROM base AS deps
|
|
53
|
+
COPY package.json pnpm-lock.yaml* package-lock.json* yarn.lock* ./
|
|
54
|
+
RUN corepack enable && \
|
|
55
|
+
if [ -f pnpm-lock.yaml ]; then pnpm install --frozen-lockfile; \
|
|
56
|
+
elif [ -f yarn.lock ]; then yarn install --frozen-lockfile; \
|
|
57
|
+
else npm ci; fi
|
|
58
|
+
|
|
59
|
+
FROM base AS dev
|
|
60
|
+
COPY --from=deps /app/node_modules ./node_modules
|
|
61
|
+
COPY . .
|
|
62
|
+
EXPOSE 3000
|
|
63
|
+
CMD ["pnpm", "dev"]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**PHP / Laravel projects:**
|
|
67
|
+
```dockerfile
|
|
68
|
+
FROM php:8.4-fpm-alpine AS base
|
|
69
|
+
# Install extensions, composer, etc.
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Python projects:**
|
|
73
|
+
```dockerfile
|
|
74
|
+
FROM python:3.13-slim AS base
|
|
75
|
+
WORKDIR /app
|
|
76
|
+
COPY requirements.txt .
|
|
77
|
+
RUN pip install -r requirements.txt
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Adapt the Dockerfile to the actual detected stack — these are starting points, not rigid templates.
|
|
81
|
+
|
|
82
|
+
### 2.2 Services
|
|
83
|
+
|
|
84
|
+
Call `AskUserQuestion`:
|
|
85
|
+
- question: "Which services does your project need?"
|
|
86
|
+
- header: "Services"
|
|
87
|
+
- multiSelect: true
|
|
88
|
+
- options: [{label: "PostgreSQL", description: "Relational database on port 5432"}, {label: "MySQL", description: "Relational database on port 3306"}, {label: "Redis", description: "Cache, sessions, queues on port 6379"}, {label: "MongoDB", description: "Document database on port 27017"}]
|
|
89
|
+
|
|
90
|
+
### 2.3 Generate docker-compose.yml
|
|
91
|
+
|
|
92
|
+
Build a `docker-compose.yml` with:
|
|
93
|
+
- **app** service: build from Dockerfile, volume mount for hot reload, expose dev port
|
|
94
|
+
- **Selected database** service: with persistent volume, health check, default credentials in `.env`
|
|
95
|
+
- **Selected cache** service: with persistence if applicable
|
|
96
|
+
- **Network**: shared bridge network for service discovery
|
|
97
|
+
- **Volumes**: named volumes for data persistence
|
|
98
|
+
|
|
99
|
+
Example structure:
|
|
100
|
+
```yaml
|
|
101
|
+
services:
|
|
102
|
+
app:
|
|
103
|
+
build:
|
|
104
|
+
context: .
|
|
105
|
+
target: dev
|
|
106
|
+
ports:
|
|
107
|
+
- "${PORT:-3000}:3000"
|
|
108
|
+
volumes:
|
|
109
|
+
- .:/app
|
|
110
|
+
- /app/node_modules
|
|
111
|
+
env_file: .env
|
|
112
|
+
depends_on:
|
|
113
|
+
db:
|
|
114
|
+
condition: service_healthy
|
|
115
|
+
|
|
116
|
+
db:
|
|
117
|
+
image: postgres:17-alpine
|
|
118
|
+
ports:
|
|
119
|
+
- "5432:5432"
|
|
120
|
+
environment:
|
|
121
|
+
POSTGRES_DB: ${DB_NAME:-app}
|
|
122
|
+
POSTGRES_USER: ${DB_USER:-postgres}
|
|
123
|
+
POSTGRES_PASSWORD: ${DB_PASSWORD:-postgres}
|
|
124
|
+
volumes:
|
|
125
|
+
- db_data:/var/lib/postgresql/data
|
|
126
|
+
healthcheck:
|
|
127
|
+
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
128
|
+
interval: 5s
|
|
129
|
+
timeout: 5s
|
|
130
|
+
retries: 5
|
|
131
|
+
|
|
132
|
+
volumes:
|
|
133
|
+
db_data:
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### 2.4 Generate .dockerignore
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
node_modules
|
|
140
|
+
.git
|
|
141
|
+
.env
|
|
142
|
+
dist
|
|
143
|
+
build
|
|
144
|
+
.next
|
|
145
|
+
coverage
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### 2.5 Update .env.example
|
|
149
|
+
|
|
150
|
+
Add Docker-specific environment variables:
|
|
151
|
+
```bash
|
|
152
|
+
# Docker Development
|
|
153
|
+
DB_HOST=db
|
|
154
|
+
DB_PORT=5432
|
|
155
|
+
DB_NAME=app
|
|
156
|
+
DB_USER=postgres
|
|
157
|
+
DB_PASSWORD=postgres
|
|
158
|
+
REDIS_URL=redis://redis:6379
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Phase 3: Build & Start
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Build containers
|
|
167
|
+
docker compose build
|
|
168
|
+
|
|
169
|
+
# Start services in background
|
|
170
|
+
docker compose up -d
|
|
171
|
+
|
|
172
|
+
# Wait for health checks
|
|
173
|
+
docker compose ps
|
|
174
|
+
|
|
175
|
+
# Show logs
|
|
176
|
+
docker compose logs --tail=20
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
If the build fails:
|
|
180
|
+
- Read the error output
|
|
181
|
+
- Common fixes: missing `.dockerignore`, wrong base image, missing system dependencies
|
|
182
|
+
- Offer to fix and retry
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Phase 4: Verify & Report
|
|
187
|
+
|
|
188
|
+
1. Wait for health checks to pass: `docker compose ps` — all services should show "healthy" or "running"
|
|
189
|
+
2. Check app is accessible: `curl -s -o /dev/null -w "%{http_code}" http://localhost:${PORT:-3000}`
|
|
190
|
+
3. Check database connectivity from app container: `docker compose exec app [db-check-command]`
|
|
191
|
+
|
|
192
|
+
Report results:
|
|
193
|
+
|
|
194
|
+
```markdown
|
|
195
|
+
## Docker Dev Environment Ready
|
|
196
|
+
|
|
197
|
+
| Service | Image | Port | Status |
|
|
198
|
+
|---------|-------|------|--------|
|
|
199
|
+
| app | [image] | [port] | Running |
|
|
200
|
+
| db | postgres:17-alpine | 5432 | Healthy |
|
|
201
|
+
| redis | redis:7-alpine | 6379 | Running |
|
|
202
|
+
|
|
203
|
+
### Connection Details
|
|
204
|
+
| Setting | Value |
|
|
205
|
+
|---------|-------|
|
|
206
|
+
| App URL | http://localhost:[port] |
|
|
207
|
+
| Database | postgresql://postgres:postgres@localhost:5432/app |
|
|
208
|
+
| Redis | redis://localhost:6379 |
|
|
209
|
+
|
|
210
|
+
### Quick Reference
|
|
211
|
+
| Task | Command |
|
|
212
|
+
|------|---------|
|
|
213
|
+
| Start services | `docker compose up -d` |
|
|
214
|
+
| Stop services | `docker compose down` |
|
|
215
|
+
| View logs | `docker compose logs -f app` |
|
|
216
|
+
| Shell into app | `docker compose exec app sh` |
|
|
217
|
+
| Reset database | `docker compose down -v && docker compose up -d` |
|
|
218
|
+
| Rebuild after Dockerfile change | `docker compose build && docker compose up -d` |
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Error Handling
|
|
224
|
+
|
|
225
|
+
- If Docker isn't running, prompt: "Start Docker Desktop and try again"
|
|
226
|
+
- If port conflicts, detect which port is in use and suggest alternatives
|
|
227
|
+
- If build fails, read the error and suggest fixes
|
|
228
|
+
- If a service won't start, check logs: `docker compose logs [service]`
|
|
229
|
+
- Always provide the manual command for retry
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: e2e
|
|
3
|
+
description: Set up and run automated end-to-end browser testing
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are an E2E testing assistant. You set up a browser testing framework, generate test files, and execute automated tests against the running application.
|
|
7
|
+
|
|
8
|
+
## CRITICAL RULE: Use AskUserQuestion Tool
|
|
9
|
+
|
|
10
|
+
You MUST use the `AskUserQuestion` tool for EVERY question. DO NOT print questions as plain text. This is a BLOCKING REQUIREMENT.
|
|
11
|
+
|
|
12
|
+
**Before starting, check the feature flag:**
|
|
13
|
+
Run: `source hooks/feature-flags.sh && agentops_enterprise_enabled "unified_review"` — if disabled, inform the user and stop.
|
|
14
|
+
|
|
15
|
+
Arguments: $ARGUMENTS
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Mode Detection
|
|
20
|
+
|
|
21
|
+
Parse arguments to determine the mode:
|
|
22
|
+
|
|
23
|
+
- **No arguments** → Full setup + run (Phase 1 through Phase 5)
|
|
24
|
+
- **`setup`** → Setup only (Phase 1 through Phase 3)
|
|
25
|
+
- **`run`** → Run existing tests only (Phase 4 and Phase 5)
|
|
26
|
+
- **`generate`** → Generate new test files for specified pages/flows (Phase 3 only)
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Phase 1: Detect Existing Setup
|
|
31
|
+
|
|
32
|
+
1. **Check for existing E2E framework:**
|
|
33
|
+
- Look for `playwright.config.ts`, `playwright.config.js` → Playwright already configured
|
|
34
|
+
- Look for `cypress.config.ts`, `cypress.config.js`, `cypress.json` → Cypress already configured
|
|
35
|
+
- Check `package.json` for `@playwright/test`, `cypress`, `puppeteer`
|
|
36
|
+
|
|
37
|
+
2. **If framework exists:**
|
|
38
|
+
- Report what was found
|
|
39
|
+
- Call `AskUserQuestion`:
|
|
40
|
+
- question: "E2E framework already configured. What would you like to do?"
|
|
41
|
+
- header: "Action"
|
|
42
|
+
- options: [{label: "Run existing tests", description: "Execute the current test suite"}, {label: "Generate new tests", description: "Add tests for additional pages or flows"}, {label: "Reconfigure", description: "Change framework settings or base URL"}]
|
|
43
|
+
|
|
44
|
+
3. **If no framework exists:** proceed to Phase 2.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Phase 2: Framework Selection & Installation
|
|
49
|
+
|
|
50
|
+
Read the tech catalog from `templates/tech-catalog.json` for testing framework options.
|
|
51
|
+
|
|
52
|
+
Call `AskUserQuestion`:
|
|
53
|
+
- question: "Which E2E testing framework?"
|
|
54
|
+
- header: "Framework"
|
|
55
|
+
- options: [{label: "Playwright (Recommended)", description: "Cross-browser, auto-waiting, codegen, trace viewer"}, {label: "Cypress", description: "Time-travel debugging, component testing, dashboard"}, {label: "Puppeteer", description: "Chrome/Firefox, lower-level, lightweight"}]
|
|
56
|
+
|
|
57
|
+
Then call `AskUserQuestion`:
|
|
58
|
+
- question: "Which browsers should tests run in?"
|
|
59
|
+
- header: "Browsers"
|
|
60
|
+
- multiSelect: true
|
|
61
|
+
- options: [{label: "Chromium (Recommended)", description: "Chrome/Edge engine"}, {label: "Firefox", description: "Gecko engine"}, {label: "WebKit", description: "Safari engine"}]
|
|
62
|
+
|
|
63
|
+
### Install the chosen framework:
|
|
64
|
+
|
|
65
|
+
**Playwright:**
|
|
66
|
+
```bash
|
|
67
|
+
# Install Playwright and browsers
|
|
68
|
+
[package-manager] add -D @playwright/test
|
|
69
|
+
npx playwright install [selected-browsers]
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Generate `playwright.config.ts`:
|
|
73
|
+
```typescript
|
|
74
|
+
import { defineConfig, devices } from '@playwright/test';
|
|
75
|
+
|
|
76
|
+
export default defineConfig({
|
|
77
|
+
testDir: './e2e',
|
|
78
|
+
fullyParallel: true,
|
|
79
|
+
forbidOnly: !!process.env.CI,
|
|
80
|
+
retries: process.env.CI ? 2 : 0,
|
|
81
|
+
workers: process.env.CI ? 1 : undefined,
|
|
82
|
+
reporter: [['html'], ['list']],
|
|
83
|
+
use: {
|
|
84
|
+
baseURL: process.env.E2E_BASE_URL ?? 'https://[site-name].test',
|
|
85
|
+
trace: 'on-first-retry',
|
|
86
|
+
screenshot: 'only-on-failure',
|
|
87
|
+
},
|
|
88
|
+
projects: [
|
|
89
|
+
// Dynamically include selected browsers
|
|
90
|
+
],
|
|
91
|
+
});
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Cypress:**
|
|
95
|
+
```bash
|
|
96
|
+
[package-manager] add -D cypress
|
|
97
|
+
npx cypress open # First-run setup
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Phase 3: Generate Test Files
|
|
103
|
+
|
|
104
|
+
Analyse the project to identify testable pages and flows:
|
|
105
|
+
|
|
106
|
+
1. **Scan for routes/pages:**
|
|
107
|
+
- Next.js: read `app/` or `pages/` directory structure
|
|
108
|
+
- Remix: read `app/routes/`
|
|
109
|
+
- SPA: read router config files
|
|
110
|
+
- Laravel: read `routes/web.php`
|
|
111
|
+
- Generic: ask the user for key URLs
|
|
112
|
+
|
|
113
|
+
2. **Identify critical user flows:**
|
|
114
|
+
- Authentication (login, logout, register)
|
|
115
|
+
- Main navigation / page loads
|
|
116
|
+
- Form submissions
|
|
117
|
+
- CRUD operations
|
|
118
|
+
- Error pages (404, 500)
|
|
119
|
+
|
|
120
|
+
3. Call `AskUserQuestion`:
|
|
121
|
+
- question: "Which flows should I generate tests for?"
|
|
122
|
+
- header: "Flows"
|
|
123
|
+
- multiSelect: true
|
|
124
|
+
- options built dynamically from detected routes/pages (up to 4, with "Other" for custom)
|
|
125
|
+
|
|
126
|
+
4. **Generate test files** in `e2e/` directory:
|
|
127
|
+
|
|
128
|
+
**Playwright example:**
|
|
129
|
+
```typescript
|
|
130
|
+
import { test, expect } from '@playwright/test';
|
|
131
|
+
|
|
132
|
+
test.describe('Home Page', () => {
|
|
133
|
+
test('should load successfully', async ({ page }) => {
|
|
134
|
+
await page.goto('/');
|
|
135
|
+
await expect(page).toHaveTitle(/[Project Name]/);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
test('should display main navigation', async ({ page }) => {
|
|
139
|
+
await page.goto('/');
|
|
140
|
+
await expect(page.getByRole('navigation')).toBeVisible();
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
test.describe('Authentication', () => {
|
|
145
|
+
test('should show login form', async ({ page }) => {
|
|
146
|
+
await page.goto('/login');
|
|
147
|
+
await expect(page.getByRole('form')).toBeVisible();
|
|
148
|
+
await expect(page.getByLabel('Email')).toBeVisible();
|
|
149
|
+
await expect(page.getByLabel('Password')).toBeVisible();
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
test('should reject invalid credentials', async ({ page }) => {
|
|
153
|
+
await page.goto('/login');
|
|
154
|
+
await page.getByLabel('Email').fill('invalid@example.com');
|
|
155
|
+
await page.getByLabel('Password').fill('wrongpassword');
|
|
156
|
+
await page.getByRole('button', { name: /sign in|log in/i }).click();
|
|
157
|
+
await expect(page.getByText(/invalid|incorrect|error/i)).toBeVisible();
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Phase 4: Run Tests
|
|
165
|
+
|
|
166
|
+
1. **Verify the application is running:**
|
|
167
|
+
- Check if the base URL is accessible: `curl -s -o /dev/null -w "%{http_code}" [base-url]`
|
|
168
|
+
- If not running, inform the user: "Start your dev server first, then re-run `/agentops:e2e run`"
|
|
169
|
+
|
|
170
|
+
2. **Execute tests:**
|
|
171
|
+
|
|
172
|
+
**Playwright:**
|
|
173
|
+
```bash
|
|
174
|
+
npx playwright test
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**Cypress:**
|
|
178
|
+
```bash
|
|
179
|
+
npx cypress run
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
3. **If tests fail:**
|
|
183
|
+
- Read the failure output
|
|
184
|
+
- Identify whether failures are test issues or application issues
|
|
185
|
+
- For test issues: offer to fix the test files
|
|
186
|
+
- For application issues: report them as findings
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Phase 5: Report Results
|
|
191
|
+
|
|
192
|
+
Present results:
|
|
193
|
+
|
|
194
|
+
```markdown
|
|
195
|
+
## E2E Test Results
|
|
196
|
+
|
|
197
|
+
**Framework:** [Playwright/Cypress]
|
|
198
|
+
**Base URL:** [URL]
|
|
199
|
+
**Browsers:** [list]
|
|
200
|
+
**Date:** [date]
|
|
201
|
+
|
|
202
|
+
### Summary
|
|
203
|
+
| Metric | Value |
|
|
204
|
+
|--------|-------|
|
|
205
|
+
| Total tests | [N] |
|
|
206
|
+
| Passed | [N] |
|
|
207
|
+
| Failed | [N] |
|
|
208
|
+
| Skipped | [N] |
|
|
209
|
+
| Duration | [time] |
|
|
210
|
+
|
|
211
|
+
### Failed Tests
|
|
212
|
+
| Test | Error | File |
|
|
213
|
+
|------|-------|------|
|
|
214
|
+
| [test name] | [error summary] | [file:line] |
|
|
215
|
+
|
|
216
|
+
### Screenshots / Traces
|
|
217
|
+
[Location of failure screenshots and trace files]
|
|
218
|
+
|
|
219
|
+
### Next Steps
|
|
220
|
+
1. Review failures: `npx playwright show-report` (or `npx cypress open`)
|
|
221
|
+
2. Fix failing tests or application issues
|
|
222
|
+
3. Add to CI: include in `.github/workflows/ci.yml`
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Error Handling
|
|
228
|
+
|
|
229
|
+
- If Herd site isn't set up, suggest running `/agentops:herd` first
|
|
230
|
+
- If the dev server isn't running, provide the start command
|
|
231
|
+
- If browser installation fails, suggest `npx playwright install --with-deps`
|
|
232
|
+
- If tests time out, suggest increasing timeout in config
|
|
233
|
+
- Never leave broken test files — if generation fails, clean up
|