diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..963bba6 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,44 @@ +# SprintOS Container Environment + +## CRITICAL: Dev Server Binding + +This workspace runs inside a Docker container. All dev servers MUST bind to `0.0.0.0` or the preview panel will not work. + +**Always use these exact commands:** + +- **Vite**: `npx vite --host 0.0.0.0` or `npm run dev -- --host 0.0.0.0` +- **Next.js**: `npx next dev -H 0.0.0.0` +- **Express/Node**: Listen on `0.0.0.0` not `localhost` +- **Any other server**: Bind to `0.0.0.0`, never `127.0.0.1` or `localhost` + +**NEVER** start a dev server without the `--host 0.0.0.0` flag. This is mandatory. + +## CRITICAL: Validate Your Code + +After finishing any coding task, **always** run `npm run build` to verify the code compiles without errors. Fix any build errors before considering the task complete. + +## CRITICAL: End-to-End Testing + +After building a feature, **always** test it end-to-end like a real user would using the Playwright MCP. Start the dev server, then use the Playwright browser tools to navigate to the app, interact with it, and verify everything works as expected. Fix any issues you find before considering the task complete. + +## Playwright Browser Troubleshooting + +If the browser crashes or you get "Target crashed" errors during Playwright testing: + +1. **Restart Chrome** with the correct flags: + ```bash + pkill -f chrome + google-chrome-stable --remote-debugging-port=9222 --no-first-run --no-default-browser-check --disable-gpu --headless=new --no-sandbox --disable-dev-shm-usage --window-size=1920,1080 & + ``` + +2. **Wait for Chrome to be ready**, then resize the viewport: + ``` + Use playwright_browser_resize with width: 1920, height: 1080 + ``` + +3. **Ignore dbus errors** - these are non-critical warnings about system services not available in the container. + +The key flags for running Chrome in Docker: +- `--no-sandbox`: Required when running as root +- `--disable-dev-shm-usage`: Prevents memory issues in containers +- `--headless=new`: New headless mode, more stable than old headless diff --git a/README.md b/README.md index ca9b9d6..e733866 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Autonomous Coding Agent Demo (Linear-Integrated) +**Author:** Yacine Zahidi + A minimal harness demonstrating long-running autonomous coding with the Claude Agent SDK. This demo implements a two-agent pattern (initializer + coding agent) with **Linear as the core project management system** for tracking all work. ## Key Features diff --git a/SPRINTOS.md b/SPRINTOS.md new file mode 100644 index 0000000..d8446d2 --- /dev/null +++ b/SPRINTOS.md @@ -0,0 +1,7 @@ +# SprintOS + +> AI builds fast, +> Docs trace every line of code— +> No compromise made. + +Learn more at [sprintos.co](https://sprintos.co) diff --git a/agent.py b/agent.py index c3c9392..cfe21ea 100644 --- a/agent.py +++ b/agent.py @@ -9,7 +9,7 @@ from pathlib import Path from typing import Optional -from claude_code_sdk import ClaudeSDKClient +from claude_agent_sdk import ClaudeSDKClient from client import create_client from progress import print_session_header, print_progress_summary, is_linear_initialized diff --git a/client.py b/client.py index 0961566..06c198c 100644 --- a/client.py +++ b/client.py @@ -9,8 +9,8 @@ import os from pathlib import Path -from claude_code_sdk import ClaudeCodeOptions, ClaudeSDKClient -from claude_code_sdk.types import HookMatcher +from claude_agent_sdk import ClaudeAgentOptions, ClaudeSDKClient +from claude_agent_sdk.types import HookMatcher from security import bash_security_hook @@ -137,7 +137,7 @@ def create_client(project_dir: Path, model: str) -> ClaudeSDKClient: print() return ClaudeSDKClient( - options=ClaudeCodeOptions( + options=ClaudeAgentOptions( model=model, system_prompt="You are an expert full-stack developer building a production-quality web application. You use Linear for project management and tracking all your work.", allowed_tools=[ @@ -152,10 +152,8 @@ def create_client(project_dir: Path, model: str) -> ClaudeSDKClient: "linear": { "type": "http", "url": "https://mcp.linear.app/mcp", - "headers": { - "Authorization": f"Bearer {linear_api_key}" - } - } + "headers": {"Authorization": f"Bearer {linear_api_key}"}, + }, }, hooks={ "PreToolUse": [ diff --git a/requirements.txt b/requirements.txt index 0c981f6..838c4fc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -claude-code-sdk>=0.0.25 +claude-agent-sdk \ No newline at end of file