2026-03-09 17:00:25 +08:00
# Contributing to PageAgent
2025-09-29 16:33:15 +08:00
2026-03-24 17:42:56 +08:00
> **[A note from the maintainer](https://github.com/alibaba/page-agent/issues/349)** — Please read before opening issues or PRs.
2026-03-10 15:23:19 +08:00
♥️ We welcome contributions from everyone.
2025-09-29 16:33:15 +08:00
## 🚀 Quick Start
### Development Setup
1. **Prerequisites**
2026-03-10 15:23:19 +08:00
- `macOS` / `Linux` / `WSL`
2026-01-17 16:15:36 +08:00
- `node.js >= 20` with `npm >= 10`
- An editor that supports `ts/eslint/prettier`
2026-03-10 15:23:19 +08:00
- Make sure `eslint` , `prettier` and `commitlint` work well. Un-linted code won't pass the CI.
2025-09-29 16:33:15 +08:00
2025-09-29 16:58:07 +08:00
2. **Setup**
2025-10-10 17:20:14 +08:00
2026-01-17 16:15:36 +08:00
```bash
2026-03-10 15:23:19 +08:00
npm i
2026-01-17 16:15:36 +08:00
npm start # Start demo and documentation site
2026-03-09 17:15:16 +08:00
npm run build # Build libs and website
2026-01-17 16:15:36 +08:00
` ``
2025-09-29 16:33:15 +08:00
### Project Structure
2026-02-12 17:19:14 +08:00
This is a **monorepo** with npm workspaces containing **4 main packages**:
2025-09-29 16:33:15 +08:00
2026-01-19 16:47:48 +08:00
- **Page Agent** (` packages/page-agent/`) - Main entry with built-in UI Panel, published as ` page-agent` on npm
- **Core** (` packages/core/`) - Core agent logic without UI (npm: ` @page -agent/core`)
2026-02-12 17:19:14 +08:00
- **Extension** (` packages/extension/`) - Chrome extension for multi-page tasks and browser-level automation
2026-01-19 16:47:48 +08:00
- **Website** (` packages/website/`) - React documentation and landing page. Also as demo and test page for the core lib. private package ` @page -agent/website`
2025-12-01 20:11:12 +08:00
2026-03-09 17:00:25 +08:00
> We use a simplified monorepo solution with ` native npm-workspace + ts reference + vite alias`. No fancy tooling. Hoisting is required.
>
> - When developing. Use alias so that we don't have to pre-build.
2026-03-10 15:23:19 +08:00
> - When bundling. Use external and disable ts ` paths` alias.
> - When bundling ` IIFE` and ` Website`. Bundle everything together.
2025-09-29 16:33:15 +08:00
## 🤝 How to Contribute
### Reporting Issues
- Use the GitHub issue tracker to report bugs or request features
- Search existing issues before creating new ones
- Provide clear reproduction steps for bugs
- Include browser version and environment details
### Code Contributions
1. **Fork and Clone**
2025-10-10 17:20:14 +08:00
2026-01-17 16:15:36 +08:00
` ``bash
git clone https://github.com/your-username/page-agent.git
cd page-agent
` ``
2025-09-29 16:33:15 +08:00
2. **Create Feature Branch**
2025-10-10 17:20:14 +08:00
2026-01-17 16:15:36 +08:00
` ``bash
git checkout -b feat/your-feature-name
` ``
2025-09-29 16:33:15 +08:00
3. **Make Changes**
2026-01-17 16:15:36 +08:00
- Follow existing code style and patterns
- Add tests for new functionality
- Update documentation as needed
2025-09-29 16:33:15 +08:00
4. **Test Your Changes**
2026-03-10 15:23:19 +08:00
- Build and lint everything.
2026-01-17 16:15:36 +08:00
- Test in our demo website
- Test it on other websites if applicable
- ` @TODO: test suite`
2025-09-29 16:33:15 +08:00
5. **Commit and Push**
2025-10-10 17:20:14 +08:00
2026-01-17 16:15:36 +08:00
` ``bash
git add .
git commit -m "feat: add awesome feature"
git push origin feat/your-feature-name
` ``
2025-09-29 16:33:15 +08:00
6. **Create Pull Request**
2026-01-17 16:15:36 +08:00
- Provide clear description of changes
- Link related issues
- Include screenshots for UI changes
2025-09-29 16:33:15 +08:00
## 📝 Code Style
### General Guidelines
- Use TypeScript for type safety
- Follow existing naming conventions
- Write meaningful commit messages
- Keep functions small and focused
2025-09-29 16:58:07 +08:00
- Add JSDoc for public APIs
2026-03-09 17:00:25 +08:00
### Vibe Coding with AI
2026-03-10 15:23:19 +08:00
> [Vibe coding](https://en.wikipedia.org/wiki/Vibe_coding)
2025-09-29 16:58:07 +08:00
2026-03-09 17:00:25 +08:00
- Vibe coding is **RECOMMENDED** when maintaining **the demo, the website, the UI and tests**.
- We have a [website/AGENTS.md](packages/website/AGENTS.md) for that.
- Vibe coding is **NOT** allowed for the core lib!!!
- NEVER try to vibe coding the MV3 extension!!! It is HELL.
2025-09-29 16:58:07 +08:00
- Review anything AI wrote before make a commit. You are the author of anything you commit. NOT AI.
2025-09-29 16:33:15 +08:00
2026-03-09 17:00:25 +08:00
If your AI assistant does not support [AGENTS.md](https://agents.md/). Add an alias for it:
2026-01-26 15:21:48 +08:00
- claude-code (` CLAUDE.md`)
` ``markdown
@AGENTS.md
` ``
- antigravity (` .agent/rules/alias.md`)
` ``markdown
---
trigger: always_on
---
@../../AGENTS.md
` ``
2025-09-29 16:33:15 +08:00
## 🔧 Development Workflows
2026-01-16 19:04:26 +08:00
### Test With Your Own LLM API
- Create a ` .env` file in the repo root with your LLM API config
2026-01-17 16:15:36 +08:00
` ``env
LLM_MODEL_NAME=gpt-5.2
LLM_API_KEY=your-api-key
LLM_BASE_URL=https://api.your-llm-provider.com/v1
` ``
2026-01-16 19:04:26 +08:00
2026-02-02 16:51:51 +08:00
- **Ollama example** (tested on 0.15 + qwen3:14b, RTX3090 24GB):
` ``env
LLM_BASE_URL="http://localhost:11434/v1"
LLM_API_KEY="NA"
LLM_MODEL_NAME="qwen3:14b"
` ``
2026-03-09 17:00:25 +08:00
> @see https://alibaba.github.io/page-agent/docs/features/models#ollama for configuration
2026-02-02 16:51:51 +08:00
2026-03-09 17:00:25 +08:00
- **Restart the dev server** to load new env vars
- If not provided, the demo will use the free testing proxy by default. By using it, you agree to its [terms](https://github.com/alibaba/page-agent/blob/main/docs/terms-and-privacy.md).
2026-01-16 19:04:26 +08:00
2026-02-12 17:19:14 +08:00
### Extension Development
` ``bash
2026-03-09 17:00:25 +08:00
# make sure you ran ` npm run build:libs` first
# and every time you changed the core libs
2026-02-12 17:19:14 +08:00
npm run dev -w @page-agent/ext
npm run zip -w @page-agent/ext
` ``
2026-03-09 17:00:25 +08:00
- Update ` packages/extension/docs/extension_api.md` for API integration details
2026-02-12 17:19:14 +08:00
2026-01-16 19:04:26 +08:00
### Testing on Other Websites
2025-09-29 16:33:15 +08:00
2026-01-16 19:04:26 +08:00
- Start and serve a local ` iife` script
2025-12-05 20:10:12 +08:00
2026-01-17 16:15:36 +08:00
` ``bash
2026-01-21 00:44:09 +08:00
npm run dev:demo # Serving IIFE with auto rebuild at http://localhost:5174/page-agent.demo.js
2026-01-17 16:15:36 +08:00
` ``
2025-10-10 17:20:14 +08:00
2026-01-16 19:04:26 +08:00
- Add a new bookmark
2025-10-10 17:20:14 +08:00
2026-01-17 16:15:36 +08:00
` ``javascript
2026-01-21 00:44:09 +08:00
javascript:(function(){var s=document.createElement('script');s.src=` http://localhost:5174/page-agent.demo.js?t=${Math.random()}`;s.onload=()=>console.log(%27PageAgent ready!%27);document.head.appendChild(s);})();
2026-01-17 16:15:36 +08:00
` ``
2025-10-10 17:20:14 +08:00
2026-01-16 19:04:26 +08:00
- Click the bookmark on any page to load Page-Agent
2026-03-09 17:00:25 +08:00
> Warning: AK in your local ` .env` will be inlined in the iife script. Be very careful when you distribute the script.
2025-09-29 16:33:15 +08:00
### Adding Documentation
2026-01-16 19:04:26 +08:00
Ask an AI to help you add documentation to the ` website/` package. Follow the existing style.
> Our AGENTS.md file and guardrails are designed for this purpose. But please be careful and review anything AI generated.
2025-09-29 16:33:15 +08:00
## 🚫 What We Don't Accept
2026-03-09 17:00:25 +08:00
- Breaking changes and large PRs without prior discussion
- Heavy dependencies to core libs
2025-09-29 16:33:15 +08:00
- Contributions without proper testing
- Code that doesn't follow project conventions
2026-03-09 17:00:25 +08:00
- Dependencies or code with licenses incompatible with MIT
2026-03-10 22:06:41 +08:00
- Bot or AI-generated pull requests without meaningful human involvement
2025-09-29 16:33:15 +08:00
## 📄 Legal
By contributing to this project, you agree that your contributions will be licensed under the MIT License.
2026-03-10 15:23:19 +08:00
> CLA is optional.
2025-09-29 16:41:10 +08:00
2025-09-29 16:33:15 +08:00
## 💬 Questions?
- Open a GitHub issue for technical questions
- Check existing documentation and issues first
- Be respectful and constructive in discussions
2026-03-09 17:00:25 +08:00
Thank you for helping make PageAgent better! 🎉