Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/commands/create-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ Create a new file using this XML structure:
**Output path:** `$ARGUMENTS/prompts/initializer_prompt.md`

If the output directory has an existing `initializer_prompt.md`, read it and update the feature count.
If not, copy from `.claude/templates/initializer_prompt.template.md` first, then update.
If not, copy from `.opencode/templates/initializer_prompt.template.md` first, then update.

**CRITICAL: You MUST update the feature count placeholder:**

Expand Down
10 changes: 7 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@

# CLI Command Selection
# Choose which CLI command to use for the agent.
# - claude: Uses Anthropic's official Claude Code CLI (default)
# - opencode: Uses Opencode's CLI or SDK-backed workflow (default)
# - glm: Uses GLM CLI (or any other compatible CLI)
# Defaults to 'claude' if not specified
# CLI_COMMAND=claude
# Defaults to 'opencode' if not specified
# CLI_COMMAND=opencode

# Opencode API Key (preferred):
# Set OPENCODE_API_KEY to use the Opencode SDK directly instead of a CLI.
# OPENCODE_API_KEY=your_key_here

# Playwright Browser Mode
# Controls whether Playwright runs Chrome in headless mode (no visible browser window).
Expand Down
53 changes: 53 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copilot Instructions for Contributors (Autocoder)

Purpose: give AI coding agents (and humans) the immediate context and concrete commands needed to be productive in this repo.

Quick-start workflow
- Python setup: `python -m venv venv && source venv/bin/activate && pip install -r requirements.txt`.
- Run the CLI agent: `python autonomous_agent_demo.py --project-dir <path|registered_name>`.
- YOLO (fast prototyping): add `--yolo` (skips Playwright-based browser tests and marks features as passing after lint/type-check).
- Web UI: in `ui/` run `npm ci` then `npm run dev` (dev) or `npm run build` (production). `start_ui.sh`/`start_ui.bat` serve `ui/dist/`.

Key verification & CI commands
- Lint: `ruff check .`
- Security checks: `python test_security.py` (covers bash command allowlist and scripts like `init.sh`).
- Full local check (as used in project templates): `ruff check . && python test_security.py && cd ui && npm run lint && npm run build`.
- GitHub CI uses Python 3.11 and Node 20 (.github/workflows/ci.yml).

Big-picture architecture & data flow (short)
- Agent runtime: `autonomous_agent_demo.py` (entry) -> `agent.py` (session loop) -> `client.py` (Opencode client adapter config, MCP servers, allowed tool lists).
- MCP servers: `mcp_server/feature_mcp.py` exposes feature management tools; Playwright MCP available for browser automation in non-YOLO mode.
- Features & tests: stored in project `features.db` (SQLAlchemy models in `api/database.py`). Agents operate via MCP tools like `mcp__features__feature_get_next` and `mcp__features__feature_mark_passing`.
- UI: FastAPI backend `start_ui.py` + `server/routers/*`; `ui/src/*` consumes REST + WebSocket (`/ws/projects/{project_name}`) for logs and progress.

Project-specific conventions & important patterns
- Prompt fallback chain: project-specific `prompts/{name}.md` -> `.opencode/templates/{name}.template.md` (See `prompts.py`).
- YOLO mode: `--yolo` flag in `autonomous_agent_demo.py` and toggle in UI. In YOLO:
- Playwright MCP server is skipped
- Regression testing is skipped
- Features are marked passing on lint/type-check success
- Security: all bash commands are validated in `security.py` and tested in `test_security.py`. Example rules:
- `chmod +x init.sh` is allowed; numeric modes (`chmod 777`) and recursive `-R` are blocked.
- `./init.sh` is allowed; `bash init.sh` or other script names may be blocked.
- When changing the allowlist, update `test_security.py` accordingly.
- Tool allowlists and Playwright tooling are configured in `client.py`. Note: `mcp__playwright__browser_run_code` was removed due to crashes—avoid reintroducing without tests.

Where to look first (most impact)
- `OPENCODE.md` — project overview & workflows (already maintained and authoritative).
- `client.py` — how agents are configured, allowed tools, and Playwright headless flag (`PLAYWRIGHT_HEADLESS`).
- `security.py` & `test_security.py` — bash security rules and tests.
- `mcp_server/feature_mcp.py` — available MCP tools and their behavior.
- `autonomous_agent_demo.py` / `agent.py` — agent lifecycle and prompts used.
- `ui/` — run and build steps; `ui/src/hooks/useWebSocket.ts` and `ui/src/hooks/useProjects.ts` for real-time behavior.

Examples agents should follow
- To run the same checks CI uses: `ruff check . && python test_security.py && cd ui && npm run lint && npm run build`.
- To run agent locally with Playwright (standard mode): `python autonomous_agent_demo.py --project-dir <project>` (ensure Playwright is available or use default environment from `start.sh`).
- When adding an MCP tool, add a corresponding test and document it in `mcp_server/feature_mcp.py` and `client.py`.

Editing guidelines
- Keep prompt changes additive and preserve existing prompt templates in `.opencode/templates`. (rename `.claude/templates` → `.opencode/templates`)
- If you change security rules or allowed commands, add/adjust tests in `test_security.py`.
- When updating the UI, remember the `start_ui.*` scripts serve the pre-built `ui/dist/`; a `npm run build` is required before using those scripts.

If anything here is unclear or you'd like a different level of detail (examples or links to specific functions), tell me which sections to expand and I'll iterate. ✅
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@ Structure your review as follows:
- Be thorough but constructive - explain why something is an issue
- Provide specific, actionable feedback with examples
- Acknowledge good code when you see it
- Consider the project's existing patterns and conventions (from CLAUDE.md)
- Consider the project's existing patterns and conventions (from OPENCODE.md)
- Prioritize issues that have the highest impact
- Never approve code that has critical or high-priority issues
- If the code is excellent, say so - but still look for any possible improvements

## Standards Alignment

Always align your review with the project's established patterns from CLAUDE.md, including:
Always align your review with the project's established patterns from OPENCODE.md, including:
- The project's architecture and design patterns
- Existing coding conventions
- Technology-specific best practices
Expand Down
2 changes: 1 addition & 1 deletion .claude/agents/coder.md → .opencode/agents/coder.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Before writing ANY code, you MUST:
- Existing similar implementations to use as reference
- Configuration files (package.json, pyproject.toml, tsconfig.json, etc.)
- README files and documentation
- CLAUDE.md or similar project instruction files
- OPENCODE.md or similar project instruction files

2. **Identify Patterns and Standards**: Search for and document:
- Naming conventions (files, functions, classes, variables)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ You have access to powerful tools - USE THEM EXTENSIVELY:

4. **Risk Awareness**: Always consider what could go wrong. Security, performance, maintainability, edge cases.

5. **Context Sensitivity**: Align recommendations with the project's existing patterns, constraints, and standards (including any CLAUDE.md guidance).
5. **Context Sensitivity**: Align recommendations with the project's existing patterns, constraints, and standards (including any OPENCODE.md guidance).

## Output Structure

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ IMPORTANT:
- Do NOT skip any files - include everything
- Make the commit message descriptive enough that someone reviewing the git log can understand what was accomplished
- Follow the project's existing commit message conventions (check git log first)
- Include the Claude Code co-author attribution in the commit message
- Include the Opencode co-author attribution in the commit message
Loading