diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..3bb2455 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,62 @@ +# Contributing + +This page is for people who change the code. To use the program, start with the [README](README.md). Terms are defined in the [glossary](docs/glossary_EN.md). + +## Set up + +1. Use Python 3.12, the version CI uses (`.github/workflows/ci.yml`). +2. Install the requirements and pytest: + ```bash + python -m pip install -r requirements.txt pytest + ``` +3. Copy the example config. `config.yaml` is local only and is never committed: + ```bash + cp config.example.yaml config.yaml + ``` + +## Before you commit + +Run the same checks CI runs: + +```bash +python -m pytest -q +python -m ruff check --select E9,F auto_dev_crew scripts tests +``` + +Install ruff with `python -m pip install ruff==0.17.1` (the version pinned in CI). CI runs the test job on Windows, so tests that use paths or processes should pass there too. + +If you changed the GUI, also run `python scripts/gui_smoke.py` while the GUI is open (see [tools-and-scripts.md](docs/tools-and-scripts_EN.md)). + +## Rules + +- Never commit `config.yaml`, `.env`, or any key. +- Never force-push. +- Never push straight to the default branch. Merge only through a pull request. +- Never delete or skip a test. If a test looks wrong, stop and ask the owner. +- Branches that the agent creates start with `ai/`. Name your own branches differently. + +## Project layout + +- `auto_dev_crew/`: the package. `runner.py` runs the job queue, clone, agent call, tests, PRs, merge, and reports. `gui.py` is the local web GUI. +- `prompts/`: prompts for issue work, test fixes, and the personas. +- `scripts/`: helper scripts, such as `gui_smoke.py` and `gui_e2e.py`. +- `tests/`: the pytest suite. +- `docs/`: documentation. Each page has an English file (`NAME_EN.md`) and a Thai file (`NAME_TH.md`) with the same name. +- `config.example.yaml`: the tracked config template. +- `state/`: local job history (`state/history.json`). It is not committed. + +## Where things are + +- [docs/architecture_EN.md](docs/architecture_EN.md): how one job flows through the runner, the slots, the quality gates, and the merge decision. +- [docs/configuration_EN.md](docs/configuration_EN.md): every setting and its default. +- [docs/tools-and-scripts_EN.md](docs/tools-and-scripts_EN.md): the test suite, CI jobs, and helper scripts. +- [docs/github-workflow_EN.md](docs/github-workflow_EN.md): labels, the life of an issue, and feature plans. +- `prompts/`: the prompts for issue work, test fixes, and personas. `prompts/_rules.md` holds the rules the agent follows when it edits code. + +## Pull requests + +Describe what changed and why. Include the output of the checks above. A bug fix should come with a test that fails before the fix and passes after it. + +## Documentation + +When you change an English page, change its Thai pair with the same name in the same pull request. Keep the headings and links in the same order in both files of a pair. The root `README.md` and `README_TH.md` follow the same rule. diff --git a/README.md b/README.md index 8cf2ac9..59a95b3 100644 --- a/README.md +++ b/README.md @@ -1,229 +1,60 @@ # Auto Dev Crew 🤖 -## English +**Auto Dev Crew is a local AI coding agent.** It takes work from GitHub issues and opens pull requests for that work. When no issues are waiting, four [personas](docs/glossary_EN.md) scan the code and look for improvements. -**Auto Dev Crew is a local AI coding agent.** It takes work from GitHub issues and opens pull requests for that work. When its queue is empty, four personas (⚡🛡️🎨🧪) scan the code on their own and look for improvements. - -**Languages:** English (this section) · [ภาษาไทย](#ภาษาไทย) · Thai-only file: [README.th.md](README.th.md) - -It uses the **Antigravity CLI (`agy`)** with a Google AI Pro account as its main engine, and supports **Multi-Engine Failover (F6)**: when a quota runs out, it switches automatically to OpenCode or NVIDIA Build (primary) and Pollinations.ai or Mistral (backup). Budget target: 0 THB. +**Languages:** English (this file) · [ภาษาไทย](README_TH.md) > **Status:** experimental project, private repository. -- Full requirements: [REQUIREMENTS.md](REQUIREMENTS.md) (early draft, kept as design history; see the note at the end). -- Detailed description, AI usage, and GUI status: [docs/en/ABOUT.md](docs/en/ABOUT.md) -- Thai docs: [docs/README.md](docs/README.md) +## Requirements +- Python 3.12 (the version CI uses) +- Git +- GitHub CLI (`gh`), signed in with `gh auth login` +- Antigravity CLI (`agy`), the main AI engine +- Python packages listed in `requirements.txt` -## Install (once) -1. Install Python 3.12+, Git, the GitHub CLI (`gh auth login`), and the Antigravity CLI (signed in with the AI Pro account). -2. `pip install -r requirements.txt` -3. Edit `config.yaml` (repo, merge mode, personas). Start from `config.example.yaml`, which is the tracked template. +## Install +1. Install the requirements above. +2. From the project folder, run `pip install -r requirements.txt` +3. Copy `config.example.yaml` to `config.yaml` and set `owner` to your GitHub login. `config.yaml` stays on your machine and is never committed. -## How to give work -- Open an issue in the target repo and add the label **`ai-task`** (only the `owner` account set in the config counts). -- Emergency stop: open any issue and add the label **`ai-pause`** (close the issue to resume). +## Give the agent work +- Open an issue in the target repository and add the label `ai-task`. Only issues opened by the `owner` account count. +- To stop the agent, add the label `ai-pause` to any open issue. Close that issue to resume. -## GUI (local web page) +## Run it +Open the local web GUI. It listens only on `127.0.0.1`: ```bash -python -m auto_dev_crew.gui # opens http://127.0.0.1:8765 automatically -python -m auto_dev_crew.gui --auto # same, plus starts the agent in --loop mode right away -# (the Desktop button / start-auto-dev-crew.bat opens the GUI and waits for you to press start) +python -m auto_dev_crew.gui ``` -The main page is `http://127.0.0.1:8765/`. The left menu has 5 pages: -- **Overview**: press **▶ Run 1 task** (does one item and stops) or **⟳ Run continuously** (keeps going until you stop). **■ Stop** cancels the current task (asks for confirmation). **🔄 Restart** is under "More". Shows the 3 work slots and a card for each repo. -- **Jobs**: live logs and job history (view diffs). -- **Studio**: ask the AI to change code in a chosen repo, view diffs, find `[AI-TODO]`, run a deep scan, and make feature plans (`ai-plan`). -- **AI keys**: keys and providers, failover order, recent usage. -- **Settings**: merge mode, CI checks, quality checks (judge), the full glossary, and shutting down the server. - -The GUI only listens on this machine (127.0.0.1). Requests that change data (POST) need a token embedded in the page. - -**Restart the agent when**: you edit `config.yaml` directly, or change a key's role (Coder/Judge/Scan). Press restart on the Overview page (this cancels the current task and starts a new round with the same settings; open PRs are not closed). -- After changing a key's role, **reload the page** first, because the engine list in the dropdown is read when the page loads, and then restart. -- Before restarting or stopping, check on the Overview page whether the slots are empty. If a task is running, it will be cancelled. -- If you run `python -m auto_dev_crew --loop` outside the GUI yourself, the GUI will see that runner and you can stop it with the stop button. - -**Key terms** (full list on Settings › Glossary): -- **Slot**: one worker. Up to 3 can run in parallel. Slot 1 handles issues you request; slots 2–3 look for improvements on their own according to their persona. -- **judge**: the AI that scores the changed code before a PR is opened. Needs a key with the Judge role. -- **Gates 1–4**: Gate 1, the judge confirms the bug before a fix · Gate 2, the judge sees the full file after the fix · Gate 3, every issue run that names a file must touch that file · Gate 4, deep-scan re-checks before an issue is created. -- **key role**: Coder = writes the main code (default for every key) · Judge = scores · Scan = looks for problems. Variable names containing `_JUDGE` or `_SCAN` get that role automatically if you do not set it yourself. -- **F6 failover (fallback order)**: switch to the next provider when a quota runs out. The top one is tried first. -- **ai-task**: an issue the agent picks up (you requested it, or the system created it from deep-scan or an approved plan). -- **ai-plan**: an issue proposing a feature that waits for approval. Once approved, the system creates an `ai-task` for it. -- **deep-scan**: the AI reads the code section by section and reports problems. Results that pass Gate 4 can become `ai-task` issues. Gate 4 applies only to automatic issue creation; the per-finding create button skips it. -- **check_convergence** (`auto_dev_crew/evaluator.py`): checks whether the score has stopped improving. It runs in the repair loop after evaluation (`runner.py`) when `evaluation.plateau_stop` is true (the default). If the score does not improve, the repair rounds stop and no more quota is spent. - -## Command-line usage -```bash -python -m auto_dev_crew --dry-run # try locally, does not touch GitHub -python -m auto_dev_crew --dry-run --persona bolt # try one persona -python -m auto_dev_crew # do one task, then open a PR -python -m auto_dev_crew --loop # keep going until no work / quota out / PRs pending -``` - -Personas: `bolt` (performance) · `sentinel` (security) · `palette` (UX/UI) · `quality` (tests/quality) - -## Merge modes (`merge_mode` in config.yaml or the Settings page) -This is the global default for the whole system. The mode in use is shown in the `merge:` badge at the top right of the GUI and in the Settings page. The code reads this value directly from config.yaml, so the file must always contain it. - -| Mode | Result | -|---|---| -| `review-all` | Only opens PRs. The system does not merge. A person merges. | -| `small-only` | Merges by itself only small PRs (no more than `small_pr.max_lines` lines; the value in config.yaml is 50) that do not touch `small_pr.protected_paths`, such as `.github/` and `requirements*`. Everything else waits for review. | -| `merge-all` | Merges every PR by itself when CI passes. The GUI asks for confirmation before switching to this mode. | - -- **Merge level per repo** (set in a new feature plan in the GUI, or `merge_level` per repo): if a repo has its own level, that level is used instead of the global mode. -- **New values apply to the next merge decision** (the system rereads the config while it runs). If you edit the file yourself, restart to be sure. - -## CI check before merge (`ci.allow_no_ci` global, can be set per repo) -- **Flexible** (`allow_no_ci: true`): a repo with no CI on GitHub can merge once the local tests pass. -- **Strict** (`allow_no_ci: false`): a repo with no CI never merges. CI must exist and pass on GitHub. -- In both cases: if CI exists and fails, nothing merges. If a workflow exists but no check has run on the PR yet, the system waits for the next round. - -## judge (quality check before a PR is opened) -The judge is an AI that scores the diff. It passes when the score reaches the threshold and it meets the safety and task-match conditions. It needs a key with the `judge` role (the system chooses keys by role). You can turn it off on the Settings page. - -## Harness settings -These are set under `context`, `loop`, and `routing` in `config.yaml`. You do not need to edit the file; the defaults are in the code. -- `context.repo_map` (default `true`): attaches the structure of Python code (function and class names and signatures) to the prompt. Set to `false` to turn it off. -- `context.repo_map_chars` (default `6000`): maximum characters for the repo map. -- `loop.require_test_for_bugfix` (default `true`): a bug fix (an issue containing "bug" or "fix") that does not touch any test file gets one more round in which the agent adds a regression test, before the result is evaluated. Set to `false` to turn it off. -- `routing.enabled` (default `true`): orders the engines by merge results in the job history (`state/history.json`), separately for each triage path. An engine with at least `routing.min_samples` summarized results moves up first (sorted by merge rate, high to low). The rest keep their order from config.yaml. Set to `false` to always use the order in config.yaml. -- `routing.min_samples` (default `5`): minimum number of summarized results per engine before its data is used for ordering. -- `routing.demote_below` (default `0.2`): an engine whose merge rate is below this value (and that has enough samples) moves to the end, after engines with no data yet. No engine is removed. - -If the repo contains `AGENTS.md`, `CLAUDE.md`, or `.github/copilot-instructions.md`, it is attached automatically as "Repository Notes" (up to 4000 characters). - -## Files -- `auto_dev_crew/runner.py`: job queue, clone, calling the agent, tests, PRs, merge, reports -- `prompts/`: prompts for issue work, test fixes, and the 4 personas (`_rules.md` = shared rules) -- `state/history.json`: memory of what was already proposed (not committed) -- Temporary work: `~/.auto-dev-crew/work`; the venv for each repo: `~/.auto-dev-crew/venvs` - -## Important rules -- Never force-push, and never push straight to `main`. Merge only through a PR. -- Never commit `config.yaml` (it holds owner-specific values). -- Never print or copy values from `.env`. You may check only variable names or lengths. -- Never delete or skip tests. If a test looks wrong, stop and ask the owner. -- The scan and create-issue buttons in the GUI ask for `confirm()` first. Do not bypass this with JavaScript. -- Agent branches start with `ai/` and can open PRs (the name `self/*` is used only in revert plans). +It opens http://127.0.0.1:8765 in your browser. Options: `--port`, `--no-browser`, `--auto`. -## Check that the system still works -1. Full test suite: `python -m pytest -q -p no:cacheprovider` (there must be no failures). -2. Open the GUI: `python -m auto_dev_crew.gui --no-browser`, then `curl http://127.0.0.1:8765/api/status` should return JSON. -3. Smoke test (the GUI must be open and a slot free): `python scripts/gui_smoke.py` should print `PASS`. This step only reads and does not press run buttons. -4. e2e test (the GUI must be open and a slot free): `python scripts/gui_e2e.py --repo OWNER/NAME` presses the run button in a real dry run. Run it only when a slot is free, because if a slot is busy it may collide with a running task. - -> **Note:** [REQUIREMENTS.md](REQUIREMENTS.md) is an early v0.2 draft. The system now uses the Antigravity CLI (`agy`) as the main engine and does not run on GitHub Actions as that draft describes. Read it as design history, not as the current specification. - ---- - -## ภาษาไทย -เอเจนต์เขียนโค้ดเบื้องหลังแทน Jules — รับงานจาก GitHub issue แล้วเปิด PR, และเมื่อคิวว่างให้ตัวละคร ⚡🛡️🎨🧪 หาจุดปรับปรุงเอง -ใช้ **Antigravity CLI (`agy`)** บัญชี Google AI Pro เป็นหลัก และรองรับ **Multi-Engine Failover (F6)** สลับไปยัง OpenCode หรือ NVIDIA Build (ค่าหลัก) และ Pollinations.ai หรือ Mistral (สำรอง) อัตโนมัติเมื่อโควตาหมด งบ 0 บาท - -ดูข้อกำหนดทั้งหมดใน [REQUIREMENTS.md](REQUIREMENTS.md) -คำอธิบายการทำงานอย่างละเอียด การใช้ AI และสถานะ GUI ดูที่ [docs/ABOUT.md](docs/ABOUT.md) -English: [English section](#english) · English docs (About, configuration, API, and more): [docs/en/README.md](docs/en/README.md) - -## ติดตั้ง (ครั้งเดียว) -1. ติดตั้ง Python 3.12+, Git, GitHub CLI (`gh auth login`) และ Antigravity CLI (ล็อกอินบัญชี AI Pro แล้ว) -2. `pip install -r requirements.txt` -3. แก้ `config.yaml` (repo, โหมด merge, ตัวละคร) - -## วิธีสั่งงาน -- เปิด issue ใน repo เป้าหมาย แล้วติดป้าย **`ai-task`** (ต้องเป็นบัญชี `owner` ใน config เท่านั้น) -- หยุดเอเจนต์ฉุกเฉิน: เปิด issue ใดก็ได้แล้วติดป้าย **`ai-pause`** (ปิด issue เพื่อให้ทำต่อ) - -## GUI (เว็บในเครื่อง) +Or use the command line: ```bash -python -m auto_dev_crew.gui # เปิด http://127.0.0.1:8765 ให้อัตโนมัติ -python -m auto_dev_crew.gui --auto # เหมือนข้างบน + เริ่มเอเจนต์ --loop ทันที -# (ปุ่ม Desktop / start-auto-dev-crew.bat จะเปิด GUI แบบรอเรากดเริ่มเอง) +python -m auto_dev_crew --dry-run # try locally; does not touch GitHub +python -m auto_dev_crew # do one task, then open a PR +python -m auto_dev_crew --loop # keep going until no work is left ``` -หน้าหลักคือ `http://127.0.0.1:8765/` เมนูซ้ายมี 5 หน้า: -- **ภาพรวม**: กด **▶ ทำ 1 งาน** (ทำหนึ่งชิ้นแล้วหยุดเอง) หรือ **⟳ ทำต่อเนื่อง** (ทำไปเรื่อย ๆ จนกดหยุด) · **■ หยุด** ยกเลิกงานที่กำลังทำ (ถามยืนยันก่อน) · **🔄 รีสตาร์ท** อยู่ในหัวข้อ "เพิ่มเติม" · ดูช่องทำงาน 3 ช่อง และการ์ดคลังโค้ดแต่ละ repo -- **งาน**: บันทึกสด (log) และประวัติงาน (ดู diff) -- **สตูดิโอ**: สั่ง AI แก้โค้ดใน repo ที่เลือก, ดู diff, หา `[AI-TODO]`, สแกนลึก, แผนฟีเจอร์ (`ai-plan`) -- **คีย์ AI**: คีย์และผู้ให้บริการ, ลำดับสำรอง (failover), การใช้งานล่าสุด -- **ตั้งค่า**: โหมด merge, การตรวจ CI, การตรวจคุณภาพ (judge), คำศัพท์ทั้งหมด, ปิดเซิร์ฟเวอร์ -GUI เปิดให้เฉพาะเครื่องนี้ (127.0.0.1) และคำสั่งที่เปลี่ยนแปลงข้อมูล (POST) ต้องมี token ที่ฝังในหน้าเว็บ +## Settings to change first +| Setting | Default | Meaning | +|---|---|---| +| `owner` | `example-owner` (placeholder) | Your GitHub login. Only issues from this account are picked up. | +| `merge_mode` | `review-all` | `review-all` only opens PRs · `small-only` merges small PRs · `merge-all` merges when CI passes | +| `parallel.slots` | `3` | Number of parallel slots | -**ต้องรีสตาร์ทเอเจนต์เมื่อ**: แก้ `config.yaml` โดยตรง หรือเปลี่ยนบทบาทของคีย์ (Coder/Judge/Scan) — กดรีสตาร์ทในหน้าภาพรวม (ผลคือยกเลิกงานที่กำลังทำ แล้วเริ่มรอบใหม่ด้วยค่าเดิม; PR ที่เปิดแล้วไม่ถูกปิด) -- หลังเปลี่ยนบทบาทคีย์ ให้**รีโหลดหน้า** ก่อน เพราะรายการ engine ใน dropdown อ่านค่าตอนโหลดหน้า แล้วจึงรีสตาร์ท -- ก่อนรีสตาร์ทหรือหยุด ให้ดูว่าช่องทำงานว่างหรือไม่ในหน้าภาพรวม ถ้ามีงานกำลังทำ งานนั้นจะถูกยกเลิก -- ถ้ารัน `python -m auto_dev_crew --loop` นอก GUI เอง GUI จะเห็น runner นั้นและหยุดได้จากปุ่มหยุด +Provider API keys go in `.env`. Copy variable names from `.env.example`. Never paste key values into issues, logs, or docs. -**คำศัพท์หลัก** (อธิบายครบในหน้า ตั้งค่า › คำศัพท์): -- **ช่อง (slot)**: ตัวทำงาน 1 ตัว รันได้พร้อมกัน 3 ช่อง · ช่อง 1 ทำ issue ที่คุณสั่ง · ช่อง 2–3 หาจุดปรับปรุงเองตามบทบาท -- **judge**: AI ที่ให้คะแนนโค้ดที่แก้ก่อนเปิด PR ต้องใช้คีย์บทบาท Judge -- **ด่านตรวจ 1–4**: ด่าน 1 judge ยืนยันบั๊กก่อนแก้ · ด่าน 2 judge เห็นไฟล์เต็มหลังแก้ · ด่าน 3 รอบซ่อมต้องแตะไฟล์ที่ issue ระบุ · ด่าน 4 deep-scan ตรวจซ้ำก่อนสร้าง issue -- **key role**: Coder = เขียนโค้ดหลัก (ค่าเริ่มต้นของคีย์ทุกตัว) · Judge = ให้คะแนน · Scan = สแกนหาปัญหา · ชื่อตัวแปรที่มี `_JUDGE` / `_SCAN` ได้บทบาทนั้นอัตโนมัติถ้าไม่ได้ตั้งเอง -- **F6 failover (ลำดับสำรอง)**: สลับไปผู้ให้บริการตัวถัดไปเมื่อโควตาหมด ตัวบนสุดก่อน -- **ai-task**: issue ที่เอเจนต์หยิบไปทำ (คุณสั่งเอง หรือระบบสร้างจาก deep-scan / แผนที่อนุมัติ) -- **ai-plan**: issue เสนอฟีเจอร์ที่รอการอนุมัติ เมื่ออนุมัติแล้วระบบสร้าง `ai-task` ให้ -- **deep-scan (สแกนลึก)**: ให้ AI อ่านโค้ดทีละส่วนแล้วรายงานปัญหา ผลที่ผ่านด่าน 4 สร้างเป็น `ai-task` ได้ -- **check_convergence** (`auto_dev_crew/evaluator.py`): ตรวจว่าคะแนนค้างแล้วหรือยัง ถูกเรียกในลูปซ่อมหลังประเมิน (`runner.py`) เมื่อ `evaluation.plateau_stop` เป็น true (ค่าเริ่มต้น) ถ้าคะแนนไม่ดีขึ้นจะหยุดรอบซ่อมและไม่ใช้โควตาซ้ำ - -## วิธีรันแบบคำสั่ง +## Run the tests ```bash -python -m auto_dev_crew --dry-run # ทดลองในเครื่อง ไม่แตะ GitHub -python -m auto_dev_crew --dry-run --persona bolt # ทดลองตัวละครตัวเดียว -python -m auto_dev_crew # ทำ 1 งาน แล้วเปิด PR -python -m auto_dev_crew --loop # ทำต่อเนื่องจนหมดงาน/โควตาหมด/มี PR ค้าง +python -m pip install -r requirements.txt pytest +python -m pytest -q ``` -ตัวละคร: `bolt` (performance) · `sentinel` (security) · `palette` (UX/UI) · `quality` (เทสต์/คุณภาพ) - -## โหมด merge (`merge_mode` ใน config.yaml หรือหน้า ตั้งค่า) -ค่านี้เป็นค่ากลางของทั้งระบบ ค่าที่ใช้อยู่ตอนนี้ดูได้ที่ป้าย `merge:` มุมขวาบนของ GUI และตัวเลือกในหน้า ตั้งค่า · โค้ดอ่านค่านี้จาก config.yaml โดยตรง จึงต้องมีค่าในไฟล์เสมอ - -| โหมด | ผล | -|---|---| -| `review-all` | เปิด PR อย่างเดียว ระบบไม่ merge เอง คนเป็นผู้ merge | -| `small-only` | merge เองเฉพาะ PR เล็ก (ไม่เกิน `small_pr.max_lines` บรรทัด ค่าใน config.yaml = 50) และไม่แตะ `small_pr.protected_paths` เช่น `.github/`, `requirements*` ที่เหลือรอคนตรวจ | -| `merge-all` | merge เองทุก PR เมื่อ CI ผ่าน (GUI จะถามยืนยันก่อนเปลี่ยนมาเป็นโหมดนี้) | - -- **ระดับ merge รายคลังโค้ด** (ตั้งในแผนฟีเจอร์ใหม่ใน GUI หรือ `merge_level` ต่อ repo): ถ้า repo มีระดับของตัวเอง จะใช้ระดับนั้นแทนค่ากลาง -- **ค่าใหม่มีผลกับการตัดสิน merge ครั้งถัดไป** (ระบบอ่าน config ใหม่ระหว่างทำงาน) แต่ถ้าแก้ไฟล์เองให้รีสตาร์ทเพื่อความแน่นอน - -## ตรวจ CI ก่อน merge (`ci.allow_no_ci` ค่ากลาง, ตั้งรายคลังโค้ดได้) -- **ยืดหยุ่น** (`allow_no_ci: true`): repo ที่ไม่มี CI บน GitHub → merge ได้หลังเทสต์ในเครื่องผ่าน -- **บังคับ** (`allow_no_ci: false`): repo ที่ไม่มี CI → ไม่ merge เลย ต้องมี CI และผ่านบน GitHub -- ทั้งสองแบบ: ถ้ามี CI แล้วล้มเหลว จะไม่ merge; ถ้ามี workflow แต่ยังไม่มี check รันบน PR ระบบจะรอรอบถัดไป - -## judge (ตรวจคุณภาพก่อนเปิด PR) -judge คือ AI ที่ให้คะแนน diff ผ่านเมื่อคะแนนถึงเกณฑ์และผ่านเงื่อนไขความปลอดภัย/ความตรงกับงาน ต้องมีคีย์ที่มีบทบาท `judge` (ระบบจะเลือกคีย์ตามบทบาท) ปิดได้ที่หน้า ตั้งค่า - -## Harness settings -ตั้งค่าเพิ่มเติมใต้ `context` ใน `config.yaml` (ไม่ต้องแก้ไฟล์ — ค่าเริ่มต้นอยู่ในโค้ด) -- `context.repo_map` (ค่าเริ่มต้น `true`) — แนบโครงสร้างโค้ด Python (ชื่อฟังก์ชัน/คลาสและ signature) ลงใน prompt; ตั้งเป็น `false` เพื่อปิด -- `context.repo_map_chars` (ค่าเริ่มต้น `6000`) — จำนวนตัวอักษรสูงสุดของ repo map -- `loop.require_test_for_bugfix` (ค่าเริ่มต้น `true`) — งานแก้บั๊ก (issue ที่มีคำว่า bug/fix) ที่ไม่ได้แก้ไฟล์เทสต์เลย จะได้เอเจนต์เพิ่มเทสต์ regression อีก 1 รอบก่อนประเมินผล; ตั้งเป็น `false` เพื่อปิด -- `routing.enabled` (ค่าเริ่มต้น `true`) — จัดลำดับเอ็นจินตามผล merge ในประวัติงาน (`state/history.json`) แยกตาม triage path; เอ็นจินที่มีผลสรุปอย่างน้อย `routing.min_samples` ครั้งจะถูกย้ายขึ้นก่อน (เรียงตาม merge rate มาก→น้อย) ที่เหลือคงลำดับใน `config.yaml`; ตั้งเป็น `false` เพื่อใช้ลำดับใน config เสมอ -- `routing.min_samples` (ค่าเริ่มต้น `5`) — จำนวนผลสรุปขั้นต่ำต่อเอ็นจินก่อนจะใช้ข้อมูลในการจัดลำดับ -- `routing.demote_below` (ค่าเริ่มต้น `0.2`) — เอ็นจินที่มี merge rate ต่ำกว่าค่านี้ (และมีข้อมูลครบ `min_samples`) จะถูกย้ายไปท้ายสุด หลังเอ็นจินที่ยังไม่มีข้อมูล; ไม่มีการตัดเอ็นจินออก - -ไฟล์ `AGENTS.md` หรือ `CLAUDE.md` (หรือ `.github/copilot-instructions.md`) ในรีโพจะถูกแนบเป็น "Repository Notes" อัตโนมัติ (สูงสุด 4000 ตัวอักษร) - -## ไฟล์ -- `auto_dev_crew/runner.py` — คิวงาน, clone, เรียกเอเจนต์, เทสต์, PR, merge, รายงาน -- `prompts/` — prompt งาน issue, การแก้เทสต์, และตัวละครทั้ง 4 (`_rules.md` = กฎร่วม) -- `state/history.json` — ความจำว่าเคยเสนออะไรไปแล้ว (ไม่ commit) -- งานชั่วคราว: `~/.auto-dev-crew/work`, venv ของแต่ละ repo: `~/.auto-dev-crew/venvs` - -## ข้อห้ามสำคัญ -- ห้าม force-push และห้าม push เข้า `main` ตรง ๆ ต้อง merge ผ่าน PR เท่านั้น -- ห้าม commit `config.yaml` (ค่าเฉพาะของเจ้าของ) -- ห้ามพิมพ์หรือคัดลอกค่าใน `.env` ตรวจได้แค่ชื่อตัวแปรหรือความยาว -- ห้ามลบหรือข้ามเทสต์ ถ้าเทสต์ดูผิดจริงให้หยุดแล้วถามเจ้าของ -- ปุ่มสแกนและสร้าง issue ใน GUI มี `confirm()` ก่อนทำงาน ห้ามข้ามด้วย JavaScript -- เอเจนต์สร้าง branch ที่ขึ้นต้นด้วย `ai/` และเปิด PR ได้ (ชื่อ `self/*` ใช้เฉพาะแผน revert) - -## ตรวจว่าระบบยังใช้งานได้ -1. เทสต์ชุดเต็ม: `python -m pytest -q -p no:cacheprovider` (ต้องไม่มี failed) -2. เปิด GUI: `python -m auto_dev_crew.gui --no-browser` แล้วทดสอบ `curl http://127.0.0.1:8765/api/status` ต้องได้ JSON -3. smoke test (GUI ต้องเปิดอยู่และ slot ว่าง): `python scripts/gui_smoke.py` ต้องขึ้น `PASS` ขั้นนี้อ่านอย่างเดียว ไม่กดปุ่มรันงาน -4. e2e test (GUI ต้องเปิดอยู่และ slot ว่าง): `python scripts/gui_e2e.py --repo OWNER/NAME` กดปุ่มทำงานแบบ dry-run จริง รันเมื่อ slot ว่างเท่านั้น เพราะถ้า slot ไม่ว่างอาจชนกับงานที่รันอยู่ +## Learn more +- [Glossary](docs/glossary_EN.md): short definitions of project terms. +- [Documentation index](docs/README_EN.md): every page. Start with the [About page](docs/ABOUT_EN.md). +- [Configuration](docs/configuration_EN.md): every setting and its default. +- [GUI guide](docs/gui_EN.md) and [command line](docs/cli_EN.md). +- [Contributing](CONTRIBUTING.md): rules, checks, and project layout. +- [REQUIREMENTS.md](REQUIREMENTS.md): early design draft, kept as history. It is not the current spec. diff --git a/README.th.md b/README.th.md deleted file mode 100644 index 214c606..0000000 --- a/README.th.md +++ /dev/null @@ -1,109 +0,0 @@ -# Auto Dev Crew 🤖 - -เอเจนต์เขียนโค้ดเบื้องหลังแทน Jules — รับงานจาก GitHub issue แล้วเปิด PR, และเมื่อคิวว่างให้ตัวละคร ⚡🛡️🎨🧪 หาจุดปรับปรุงเอง -ใช้ **Antigravity CLI (`agy`)** บัญชี Google AI Pro เป็นหลัก และรองรับ **Multi-Engine Failover (F6)** สลับไปยัง OpenCode หรือ NVIDIA Build (ค่าหลัก) และ Pollinations.ai หรือ Mistral (สำรอง) อัตโนมัติเมื่อโควตาหมด งบ 0 บาท - -ดูข้อกำหนดทั้งหมดใน [REQUIREMENTS.md](REQUIREMENTS.md) -คำอธิบายการทำงานอย่างละเอียด การใช้ AI และสถานะ GUI ดูที่ [docs/ABOUT.md](docs/ABOUT.md) -English README (main version): [README.md](README.md) · English docs (About, configuration, API, and more): [docs/en/README.md](docs/en/README.md) - -## ติดตั้ง (ครั้งเดียว) -1. ติดตั้ง Python 3.12+, Git, GitHub CLI (`gh auth login`) และ Antigravity CLI (ล็อกอินบัญชี AI Pro แล้ว) -2. `pip install -r requirements.txt` -3. แก้ `config.yaml` (repo, โหมด merge, ตัวละคร) - -## วิธีสั่งงาน -- เปิด issue ใน repo เป้าหมาย แล้วติดป้าย **`ai-task`** (ต้องเป็นบัญชี `owner` ใน config เท่านั้น) -- หยุดเอเจนต์ฉุกเฉิน: เปิด issue ใดก็ได้แล้วติดป้าย **`ai-pause`** (ปิด issue เพื่อให้ทำต่อ) - -## GUI (เว็บในเครื่อง) -```bash -python -m auto_dev_crew.gui # เปิด http://127.0.0.1:8765 ให้อัตโนมัติ -python -m auto_dev_crew.gui --auto # เหมือนข้างบน + เริ่มเอเจนต์ --loop ทันที -# (ปุ่ม Desktop / start-auto-dev-crew.bat จะเปิด GUI แบบรอเรากดเริ่มเอง) -``` -หน้าหลักคือ `http://127.0.0.1:8765/` เมนูซ้ายมี 5 หน้า: -- **ภาพรวม**: กด **▶ ทำ 1 งาน** (ทำหนึ่งชิ้นแล้วหยุดเอง) หรือ **⟳ ทำต่อเนื่อง** (ทำไปเรื่อย ๆ จนกดหยุด) · **■ หยุด** ยกเลิกงานที่กำลังทำ (ถามยืนยันก่อน) · **🔄 รีสตาร์ท** อยู่ในหัวข้อ "เพิ่มเติม" · ดูช่องทำงาน 3 ช่อง และการ์ดคลังโค้ดแต่ละ repo -- **งาน**: บันทึกสด (log) และประวัติงาน (ดู diff) -- **สตูดิโอ**: สั่ง AI แก้โค้ดใน repo ที่เลือก, ดู diff, หา `[AI-TODO]`, สแกนลึก, แผนฟีเจอร์ (`ai-plan`) -- **คีย์ AI**: คีย์และผู้ให้บริการ, ลำดับสำรอง (failover), การใช้งานล่าสุด -- **ตั้งค่า**: โหมด merge, การตรวจ CI, การตรวจคุณภาพ (judge), คำศัพท์ทั้งหมด, ปิดเซิร์ฟเวอร์ - -GUI เปิดให้เฉพาะเครื่องนี้ (127.0.0.1) และคำสั่งที่เปลี่ยนแปลงข้อมูล (POST) ต้องมี token ที่ฝังในหน้าเว็บ - -**ต้องรีสตาร์ทเอเจนต์เมื่อ**: แก้ `config.yaml` โดยตรง หรือเปลี่ยนบทบาทของคีย์ (Coder/Judge/Scan) — กดรีสตาร์ทในหน้าภาพรวม (ผลคือยกเลิกงานที่กำลังทำ แล้วเริ่มรอบใหม่ด้วยค่าเดิม; PR ที่เปิดแล้วไม่ถูกปิด) -- หลังเปลี่ยนบทบาทคีย์ ให้**รีโหลดหน้า** ก่อน เพราะรายการ engine ใน dropdown อ่านค่าตอนโหลดหน้า แล้วจึงรีสตาร์ท -- ก่อนรีสตาร์ทหรือหยุด ให้ดูว่าช่องทำงานว่างหรือไม่ในหน้าภาพรวม ถ้ามีงานกำลังทำ งานนั้นจะถูกยกเลิก -- ถ้ารัน `python -m auto_dev_crew --loop` นอก GUI เอง GUI จะเห็น runner นั้นและหยุดได้จากปุ่มหยุด - -**คำศัพท์หลัก** (อธิบายครบในหน้า ตั้งค่า › คำศัพท์): -- **ช่อง (slot)**: ตัวทำงาน 1 ตัว รันได้พร้อมกัน 3 ช่อง · ช่อง 1 ทำ issue ที่คุณสั่ง · ช่อง 2–3 หาจุดปรับปรุงเองตามบทบาท -- **judge**: AI ที่ให้คะแนนโค้ดที่แก้ก่อนเปิด PR ต้องใช้คีย์บทบาท Judge -- **ด่านตรวจ 1–4**: ด่าน 1 judge ยืนยันบั๊กก่อนแก้ · ด่าน 2 judge เห็นไฟล์เต็มหลังแก้ · ด่าน 3 รอบซ่อมต้องแตะไฟล์ที่ issue ระบุ · ด่าน 4 deep-scan ตรวจซ้ำก่อนสร้าง issue -- **key role**: Coder = เขียนโค้ดหลัก (ค่าเริ่มต้นของคีย์ทุกตัว) · Judge = ให้คะแนน · Scan = สแกนหาปัญหา · ชื่อตัวแปรที่มี `_JUDGE` / `_SCAN` ได้บทบาทนั้นอัตโนมัติถ้าไม่ได้ตั้งเอง -- **F6 failover (ลำดับสำรอง)**: สลับไปผู้ให้บริการตัวถัดไปเมื่อโควตาหมด ตัวบนสุดก่อน -- **ai-task**: issue ที่เอเจนต์หยิบไปทำ (คุณสั่งเอง หรือระบบสร้างจาก deep-scan / แผนที่อนุมัติ) -- **ai-plan**: issue เสนอฟีเจอร์ที่รอการอนุมัติ เมื่ออนุมัติแล้วระบบสร้าง `ai-task` ให้ -- **deep-scan (สแกนลึก)**: ให้ AI อ่านโค้ดทีละส่วนแล้วรายงานปัญหา ผลที่ผ่านด่าน 4 สร้างเป็น `ai-task` ได้ -- **check_convergence** (`auto_dev_crew/evaluator.py`): ตรวจว่าคะแนนค้างแล้วหรือยัง ถูกเรียกในลูปซ่อมหลังประเมิน (`runner.py`) เมื่อ `evaluation.plateau_stop` เป็น true (ค่าเริ่มต้น) ถ้าคะแนนไม่ดีขึ้นจะหยุดรอบซ่อมและไม่ใช้โควตาซ้ำ - -## วิธีรันแบบคำสั่ง -```bash -python -m auto_dev_crew --dry-run # ทดลองในเครื่อง ไม่แตะ GitHub -python -m auto_dev_crew --dry-run --persona bolt # ทดลองตัวละครตัวเดียว -python -m auto_dev_crew # ทำ 1 งาน แล้วเปิด PR -python -m auto_dev_crew --loop # ทำต่อเนื่องจนหมดงาน/โควตาหมด/มี PR ค้าง -``` - -ตัวละคร: `bolt` (performance) · `sentinel` (security) · `palette` (UX/UI) · `quality` (เทสต์/คุณภาพ) - -## โหมด merge (`merge_mode` ใน config.yaml หรือหน้า ตั้งค่า) -ค่านี้เป็นค่ากลางของทั้งระบบ ค่าที่ใช้อยู่ตอนนี้ดูได้ที่ป้าย `merge:` มุมขวาบนของ GUI และตัวเลือกในหน้า ตั้งค่า · โค้ดอ่านค่านี้จาก config.yaml โดยตรง จึงต้องมีค่าในไฟล์เสมอ - -| โหมด | ผล | -|---|---| -| `review-all` | เปิด PR อย่างเดียว ระบบไม่ merge เอง คนเป็นผู้ merge | -| `small-only` | merge เองเฉพาะ PR เล็ก (ไม่เกิน `small_pr.max_lines` บรรทัด ค่าใน config.yaml = 50) และไม่แตะ `small_pr.protected_paths` เช่น `.github/`, `requirements*` ที่เหลือรอคนตรวจ | -| `merge-all` | merge เองทุก PR เมื่อ CI ผ่าน (GUI จะถามยืนยันก่อนเปลี่ยนมาเป็นโหมดนี้) | - -- **ระดับ merge รายคลังโค้ด** (ตั้งในแผนฟีเจอร์ใหม่ใน GUI หรือ `merge_level` ต่อ repo): ถ้า repo มีระดับของตัวเอง จะใช้ระดับนั้นแทนค่ากลาง -- **ค่าใหม่มีผลกับการตัดสิน merge ครั้งถัดไป** (ระบบอ่าน config ใหม่ระหว่างทำงาน) แต่ถ้าแก้ไฟล์เองให้รีสตาร์ทเพื่อความแน่นอน - -## ตรวจ CI ก่อน merge (`ci.allow_no_ci` ค่ากลาง, ตั้งรายคลังโค้ดได้) -- **ยืดหยุ่น** (`allow_no_ci: true`): repo ที่ไม่มี CI บน GitHub → merge ได้หลังเทสต์ในเครื่องผ่าน -- **บังคับ** (`allow_no_ci: false`): repo ที่ไม่มี CI → ไม่ merge เลย ต้องมี CI และผ่านบน GitHub -- ทั้งสองแบบ: ถ้ามี CI แล้วล้มเหลว จะไม่ merge; ถ้ามี workflow แต่ยังไม่มี check รันบน PR ระบบจะรอรอบถัดไป - -## judge (ตรวจคุณภาพก่อนเปิด PR) -judge คือ AI ที่ให้คะแนน diff ผ่านเมื่อคะแนนถึงเกณฑ์และผ่านเงื่อนไขความปลอดภัย/ความตรงกับงาน ต้องมีคีย์ที่มีบทบาท `judge` (ระบบจะเลือกคีย์ตามบทบาท) ปิดได้ที่หน้า ตั้งค่า - -## Harness settings -ตั้งค่าเพิ่มเติมใต้ `context` ใน `config.yaml` (ไม่ต้องแก้ไฟล์ — ค่าเริ่มต้นอยู่ในโค้ด) -- `context.repo_map` (ค่าเริ่มต้น `true`) — แนบโครงสร้างโค้ด Python (ชื่อฟังก์ชัน/คลาสและ signature) ลงใน prompt; ตั้งเป็น `false` เพื่อปิด -- `context.repo_map_chars` (ค่าเริ่มต้น `6000`) — จำนวนตัวอักษรสูงสุดของ repo map -- `loop.require_test_for_bugfix` (ค่าเริ่มต้น `true`) — งานแก้บั๊ก (issue ที่มีคำว่า bug/fix) ที่ไม่ได้แก้ไฟล์เทสต์เลย จะได้เอเจนต์เพิ่มเทสต์ regression อีก 1 รอบก่อนประเมินผล; ตั้งเป็น `false` เพื่อปิด -- `routing.enabled` (ค่าเริ่มต้น `true`) — จัดลำดับเอ็นจินตามผล merge ในประวัติงาน (`state/history.json`) แยกตาม triage path; เอ็นจินที่มีผลสรุปอย่างน้อย `routing.min_samples` ครั้งจะถูกย้ายขึ้นก่อน (เรียงตาม merge rate มาก→น้อย) ที่เหลือคงลำดับใน `config.yaml`; ตั้งเป็น `false` เพื่อใช้ลำดับใน config เสมอ -- `routing.min_samples` (ค่าเริ่มต้น `5`) — จำนวนผลสรุปขั้นต่ำต่อเอ็นจินก่อนจะใช้ข้อมูลในการจัดลำดับ -- `routing.demote_below` (ค่าเริ่มต้น `0.2`) — เอ็นจินที่มี merge rate ต่ำกว่าค่านี้ (และมีข้อมูลครบ `min_samples`) จะถูกย้ายไปท้ายสุด หลังเอ็นจินที่ยังไม่มีข้อมูล; ไม่มีการตัดเอ็นจินออก - -ไฟล์ `AGENTS.md` หรือ `CLAUDE.md` (หรือ `.github/copilot-instructions.md`) ในรีโพจะถูกแนบเป็น "Repository Notes" อัตโนมัติ (สูงสุด 4000 ตัวอักษร) - -## ไฟล์ -- `auto_dev_crew/runner.py` — คิวงาน, clone, เรียกเอเจนต์, เทสต์, PR, merge, รายงาน -- `prompts/` — prompt งาน issue, การแก้เทสต์, และตัวละครทั้ง 4 (`_rules.md` = กฎร่วม) -- `state/history.json` — ความจำว่าเคยเสนออะไรไปแล้ว (ไม่ commit) -- งานชั่วคราว: `~/.auto-dev-crew/work`, venv ของแต่ละ repo: `~/.auto-dev-crew/venvs` - -## ข้อห้ามสำคัญ -- ห้าม force-push และห้าม push เข้า `main` ตรง ๆ ต้อง merge ผ่าน PR เท่านั้น -- ห้าม commit `config.yaml` (ค่าเฉพาะของเจ้าของ) -- ห้ามพิมพ์หรือคัดลอกค่าใน `.env` ตรวจได้แค่ชื่อตัวแปรหรือความยาว -- ห้ามลบหรือข้ามเทสต์ ถ้าเทสต์ดูผิดจริงให้หยุดแล้วถามเจ้าของ -- ปุ่มสแกนและสร้าง issue ใน GUI มี `confirm()` ก่อนทำงาน ห้ามข้ามด้วย JavaScript -- เอเจนต์สร้าง branch ที่ขึ้นต้นด้วย `ai/` และเปิด PR ได้ (ชื่อ `self/*` ใช้เฉพาะแผน revert) - -## ตรวจว่าระบบยังใช้งานได้ -1. เทสต์ชุดเต็ม: `python -m pytest -q -p no:cacheprovider` (ต้องไม่มี failed) -2. เปิด GUI: `python -m auto_dev_crew.gui --no-browser` แล้วทดสอบ `curl http://127.0.0.1:8765/api/status` ต้องได้ JSON -3. smoke test (GUI ต้องเปิดอยู่และ slot ว่าง): `python scripts/gui_smoke.py` ต้องขึ้น `PASS` ขั้นนี้อ่านอย่างเดียว ไม่กดปุ่มรันงาน -4. e2e test (GUI ต้องเปิดอยู่และ slot ว่าง): `python scripts/gui_e2e.py --repo OWNER/NAME` กดปุ่มทำงานแบบ dry-run จริง รันเมื่อ slot ว่างเท่านั้น เพราะถ้า slot ไม่ว่างอาจชนกับงานที่รันอยู่ diff --git a/README_TH.md b/README_TH.md new file mode 100644 index 0000000..e395029 --- /dev/null +++ b/README_TH.md @@ -0,0 +1,60 @@ +# Auto Dev Crew 🤖 + +**Auto Dev Crew คือเอเจนต์เขียนโค้ด AI ที่รันในเครื่องของคุณ** รับงานจาก GitHub issue แล้วเปิด pull request ให้ เมื่อไม่มี issue รอ [ตัวละคร](docs/glossary_TH.md) ทั้งสี่ (⚡🛡️🎨🧪) จะสแกนโค้ดเองและหาจุดที่ควรปรับปรุง + +**ภาษา:** [English](README.md) · ภาษาไทย (ไฟล์นี้) + +> **สถานะ:** โครงการทดลอง เป็น repository แบบส่วนตัว + +## ความต้องการของระบบ +- Python 3.12 (เวอร์ชันที่ CI ใช้) +- Git +- GitHub CLI (`gh`) ล็อกอินด้วย `gh auth login` +- Antigravity CLI (`agy`) เป็นเอนจิน AI หลัก +- แพ็กเกจ Python ที่ระบุใน `requirements.txt` + +## ติดตั้ง +1. ติดตั้งสิ่งที่ต้องมีด้านบน +2. ในโฟลเดอร์โปรเจกต์ รัน `pip install -r requirements.txt` +3. คัดลอก `config.example.yaml` เป็น `config.yaml` แล้วตั้ง `owner` เป็นชื่อ GitHub ของคุณ ไฟล์ `config.yaml` อยู่ในเครื่องของคุณและไม่ถูก commit + +## สั่งงานให้เอเจนต์ +- เปิด issue ใน repository เป้าหมายแล้วติดป้าย `ai-task` เฉพาะ issue ที่เปิดโดยบัญชี `owner` เท่านั้นที่นับ +- เพื่อหยุดเอเจนต์ ติดป้าย `ai-pause` บน issue ที่เปิดอยู่ใดก็ได้ ปิด issue นั้นเพื่อให้ทำงานต่อ + +## วิธีรัน +เปิด GUI บนเว็บในเครื่อง ระบบรับการเชื่อมต่อเฉพาะ `127.0.0.1`: +```bash +python -m auto_dev_crew.gui +``` +ระบบจะเปิด http://127.0.0.1:8765 ในเบราว์เซอร์ ตัวเลือก: `--port`, `--no-browser`, `--auto` + +หรือใช้คำสั่ง: +```bash +python -m auto_dev_crew --dry-run # ทดลองในเครื่อง ไม่แตะ GitHub +python -m auto_dev_crew # ทำ 1 งาน แล้วเปิด PR +python -m auto_dev_crew --loop # ทำต่อจนไม่มีงานเหลือ +``` + +## การตั้งค่าที่ควรแก้ก่อน +| การตั้งค่า | ค่าเริ่มต้น | ความหมาย | +|---|---|---| +| `owner` | `example-owner` (ค่าตัวอย่าง) | ชื่อ GitHub ของคุณ ระบบจะหยิบเฉพาะ issue จากบัญชีนี้ | +| `merge_mode` | `review-all` | `review-all` เปิด PR อย่างเดียว · `small-only` merge เองเฉพาะ PR เล็ก · `merge-all` merge เองเมื่อ CI ผ่าน | +| `parallel.slots` | `3` | จำนวนช่องทำงานที่รันพร้อมกัน | + +คีย์ของผู้ให้บริการ AI ใส่ในไฟล์ `.env` คัดลอกชื่อตัวแปรจาก `.env.example` ห้ามวางค่าคีย์ลงใน issue, log หรือเอกสาร + +## รันเทสต์ +```bash +python -m pip install -r requirements.txt pytest +python -m pytest -q +``` + +## อ่านเพิ่มเติม +- [คำศัพท์](docs/glossary_TH.md): คำนิยามสั้น ๆ ของศัพท์ในโครงการ +- [ดัชนีเอกสาร](docs/README_TH.md): ทุกหน้า เริ่มจาก [หน้าเกี่ยวกับ](docs/ABOUT_TH.md) +- [การตั้งค่า](docs/configuration_TH.md): ทุกคีย์และค่าเริ่มต้น +- [คู่มือ GUI](docs/gui_TH.md) และ [คำสั่งบรรทัดคำสั่ง](docs/cli_TH.md) +- [การมีส่วนร่วม](CONTRIBUTING.md): กฎ การตรวจก่อน commit และโครงสร้างโปรเจกต์ (ภาษาอังกฤษ) +- [REQUIREMENTS.md](REQUIREMENTS.md): ร่างการออกแบบฉบับแรก เก็บไว้เป็นประวัติ ไม่ใช่สเปกปัจจุบัน diff --git a/STATE-github-docs-skill.md b/STATE-github-docs-skill.md new file mode 100644 index 0000000..13ba90e --- /dev/null +++ b/STATE-github-docs-skill.md @@ -0,0 +1,43 @@ +# STATE: github-docs skill (Library Router) + +## Goal +Build a deep, reusable skill `github-docs` in the Library Router catalog. When the user asks in this app to "write documentation" for a repo, the agent reads the code, verifies every claim, writes Thai and English docs, runs checks, and opens a PR. It may also cover release notes and repo About text. Chosen approach: option 1 (one broad skill with reference files per doc type). + +## Open +- [ ] Write the full design doc (file path TBD, under docs/superpowers/specs or the catalog) — AI · ready +- [ ] User approves the design doc — user · needs-approval +- [ ] Build skill dir + check_links.py / check_claims.py / release-notes length check — AI · needs-approval (after approval) +- [ ] Add to catalog and sync with scripts/sync_local_skills.py, then verify search returns it — AI · needs-approval +- [ ] Decide where the skill lives: a local source folder read by the sync script (e.g. ~/.claude/skills) vs. the catalog checkout — user · ready + +## In progress (for the next agent) +Research done, no files written. Comparison: +- github/awesome-copilot documentation-writer: Diataxis, no code checks, no PR flow. +- antinomyhq/forge write-release-notes: GitHub release/PR fetch, length check (under 2000 chars). +- Our edge: claim checks, link checks, bilingual pairs, PR/release flow in one skill. + +## Done (verified unless noted) +- DATAelectricWORKs: PR #203 (user guide + README EN/TH) merged, commit 17d8650. +- DATAelectricWORKs: PR #204 (build script + launcher) merged, commit c28bc9c. +- Release v1.0.0 asset rebuilt from c28bc9c; checksum matches 1ee624a7…c409c4; exe health 200. +- Repo description and topics set. Not verified: upload flow in the exe; guide screenshots. + +## Files +- C:\Users\Smart\Documents\DATAelectricWORKs (README*, docs\USER_GUIDE_*, packaging\, tests\test_launcher.py) +- Router skill: C:\Users\Smart\.claude\skills\library-router-plugin\skills\router\SKILL.md +- Catalog checkout: C:\Users\Smart\Documents\ChatGPT\test (scripts\sync_local_skills.py) + +## How to check +restart: read this file, then write the design doc. Do not build before approval. +- cd C:\Users\Smart\Documents\DATAelectricWORKs; python -m unittest discover -s tests -p "test_*.py" (expect 203 tests, 1 skipped) +- gh release view v1.0.0 -R OkayOkay101/DATAelectricWORKs + +## Decisions +- Work starts from this app (not @claude on GitHub). Build the skill in the Library Router. +- Option 1: one broad skill with reference files, not a skill family. +- Release and PR steps: merge only after the user says so; replace release assets only after a build check. + +## Summary +- เป้าหมาย: สร้างสกิล github-docs ใน Library Router ให้เขียนเอกสาร GitHub ได้ลึก +- ค้นสกิลคล้ายกันแล้ว ยังไม่มีตัวไหนตรวจกับโค้ดและทำ PR ครบ +- รอคุณอนุมัติ design doc ก่อนสร้างสกิล diff --git a/STATE.md b/STATE.md index f409cb8..24c46e5 100644 --- a/STATE.md +++ b/STATE.md @@ -15,12 +15,15 @@ Auto Dev Crew: local GUI (`auto_dev_crew/gui.py`) + runner. Thai and English UI - [x] B6 endpoint `/api/github/*` และ `github_login.py` ที่ UI ไม่ใช้: ลบแล้ว 2026-11-18 (อนุมัติโดยผู้ใช้) - [x] B7 ลบ route `/classic` แล้ว 2026-11-18 (อนุมัติโดยผู้ใช้) — ไฟล์ `static/index.html` ยังอยู่เพราะ test_gui_layout และ test_api_crud ยังอ่านไฟล์นี้ (ไม่ถูกเสิร์ฟ) - [x] B8 ลบ `deploy/oracle/` และ config.yaml ที่ผูกกับ Oracle ออกจาก git (commit `6d9e186`); เหลือ `config.example.yaml` เป็นไฟล์ tracked -- [x] B9 ทำเอกสารให้ตรงกับโค้ด: README หลักเป็นภาษาอังกฤษ, ภาษาไทยอยู่ทั้งใน README.md (ส่วนท้าย) และ `README.th.md`; GitHub description เป็นภาษาอังกฤษ (2026-11-18) -- [ ] B10 ให้คนที่อ่านภาษาอังกฤษได้ตรวจ `docs/en/` และ README.md ส่วนอังกฤษ (ยังไม่ได้ทำ; ผู้ช่วยทำเองไม่ได้) +- [x] B9 ทำเอกสารให้ตรงกับโค้ด: README หลักเป็นภาษาอังกฤษ, README.md เป็นอังกฤษอย่างเดียว ภาษาไทยอยู่ใน `README_TH.md` (`README.th.md` ถูกลบแล้ว `f32b0e2`); GitHub description เป็นภาษาอังกฤษ (2026-11-18) +- [ ] B10 ให้คนที่อ่านภาษาอังกฤษได้ตรวจ `docs/*_EN.md` และ README.md ส่วนอังกฤษ (ยังไม่ได้ทำ; ผู้ช่วยทำเองไม่ได้) - [ ] B11 เทียบเอกสารไทย/อังกฤษทีละประโยค (ตรวจแล้วแค่ส่วนที่มีความต่างชัดเจนและ token ในโค้ด) ## In progress -- ไม่มี งานที่ค้างอยู่ระหว่างทำ +- Task: github-docs pass on this repo (user approved outline 2026-11-18: pairs NAME_EN/NAME_TH, whole set in one round, release notes skipped). Done in working tree; not committed. +- Next step: user decides commit branch and PR (not done). Then B10 native-speaker review, B11 sentence-by-sentence sync. +- Files: `C:\Users\Smart\Documents\auto-dev-crew-clean\README.md`, `...\README_TH.md`, `...\docs\ABOUT.md` +- Watch out (2026-11-18, after rename): README pair passes check_bilingual. Pairs are `NAME_EN.md` / `NAME_TH.md` in `docs/`; anchors differ by language, so per-page check_bilingual flags anchor text (checker limitation). Not committed yet. ## Done (verified) - Commits: `60f941c` (login + ฐาน i18n), `badfc44` (ADC_INIT, /api/i18n, /api/settings/language, แปล 46 ข้อความ error ฝั่ง backend), `890be71` (แก้ flaky test fake_sleep), `6d9e186` (ลบ Oracle/GitHub login), `e054139`, `eedfc7d` (sync เอกสาร และ gate 3/4 wording), `fed6d2b` (README อังกฤษหลัก), `dab0da5` (handoff) @@ -32,7 +35,7 @@ Auto Dev Crew: local GUI (`auto_dev_crew/gui.py`) + runner. Thai and English UI ## Files - Core: `auto_dev_crew/i18n.py`, `i18n_routes.py`, `locales/en.json`, `static/i18n.js` - gui.py: `_inject_adc_init`, `set_config_path`, route `/api/i18n`, `/api/settings/language` -- README: `README.md` (อังกฤษ + ไทย), `README.th.md` (ไทย) +- README: `README.md` (อังกฤษ), `README_TH.md` (ไทย) - Handoff: `docs/HANDOFF.md` - Plan: `docs/superpowers/plans/2026-11-18-bilingual-th-en.md`; spec: `docs/superpowers/specs/2026-11-18-bilingual-th-en-design.md` diff --git a/docs/en/ABOUT.md b/docs/ABOUT_EN.md similarity index 85% rename from docs/en/ABOUT.md rename to docs/ABOUT_EN.md index 3248415..1e4a73e 100644 --- a/docs/en/ABOUT.md +++ b/docs/ABOUT_EN.md @@ -1,6 +1,6 @@ # About Auto Dev Crew -This document explains what the program does, how it works, where AI is used (both to build it and at runtime), and which parts of the GUI are still incomplete. Installation steps and commands are in the [README](../../README.md). Requirements are in [REQUIREMENTS.md](../../REQUIREMENTS.md), which is an early draft (see [the index](README.md)). +This document explains what the program does, how it works, where AI is used (both to build it and at runtime), and which parts of the GUI are still incomplete. Installation steps and commands are in the [README](../README.md). Requirements are in [REQUIREMENTS.md](../REQUIREMENTS.md), which is an early draft (see [the index](README_EN.md)). > Status: **experimental project, not production-ready.** The repository is private. @@ -56,16 +56,16 @@ GitHub issue (ai-task) or deep-scan / persona - **Slots:** up to three jobs run at the same time. Slot 1 handles issues you request. Slots 2 and 3 handle personas or extra issues. - **F6 failover:** when one provider's quota is used up, the agent moves to the next engine in the configured order. -- **Quality gates 1–4:** gate 1, the judge confirms a bug is real before a fix (only when the issue names an existing file); gate 2, the judge reviews the whole file after the fix; gate 3, the change must touch a file the issue names (applies to every issue run); gate 4, deep-scan re-checks findings before an automatic issue is created. See [architecture](architecture.md#6-quality-gates) for the code details and [troubleshooting](troubleshooting.md) row 16 for the GUI wording mismatch. +- **Quality gates 1–4:** gate 1, the judge confirms a bug is real before a fix (only when the issue names an existing file); gate 2, the judge reviews the whole file after the fix; gate 3, the change must touch a file the issue names (applies to every issue run); gate 4, deep-scan re-checks findings before an automatic issue is created. See [architecture](architecture_EN.md#6-quality-gates) for the code details and [troubleshooting](troubleshooting_EN.md) row 16 for the GUI wording mismatch. - **ai-plan:** a proposed feature waiting for approval. When approved, the system creates `ai-task` issues for it. - **ai-pause:** add this label to any issue to stop new work in that repository. - **Memory:** `state/history.json` records what was already proposed and how it turned out. It is not committed. ### Boundaries and safety -- The GUI listens only on `127.0.0.1`. Actions that change data (POST) need a token embedded in the page. +- The GUI listens only on `127.0.0.1`. Actions that change data (POST) need a token embedded in the page, and some read endpoints that read repo data also need it. - API keys live in `.env`, which is git-ignored. -- Autonomous-mode hooks for Claude Code block `git push`, `gh pr merge`, `gh release`, `deploy`, `git reset --hard`, `git clean -f`, recursive deletes (`rm -r…`, `Remove-Item -Recurse`, `del /s`), and deletion of the autonomous flag file. They do **not** single out force-push. +- The rules against force-push and direct pushes to `main` are written in this documentation. The guard script for autonomous mode (`scripts/autonomous_guard_hook.py`) blocks `git push`, `gh pr merge`, `gh release`, `deploy`, `git reset --hard`, `git clean -f`, recursive deletes (`rm -r…`, `Remove-Item -Recurse`, `del /s`), and deletion of the autonomous flag file. They do **not** single out force-push. - Code written by the agent must pass tests, quality gates, and CI before merging. It has **not** undergone a professional security audit. --- @@ -76,7 +76,7 @@ GitHub issue (ai-task) or deep-scan / persona - Many parts of the project were done together with AI: the GUI translation, removing the password login, and fixing a flaky test. Progress is recorded in `STATE.md` and `docs/superpowers/`. - The developer set the goals, made architecture decisions, and checked the results. -- The most recent recorded test run (2026-11-18) was `pytest`: **1442 passed, 6 skipped**. +- The most recent recorded test run (2026-11-18) was `pytest`: **1401 passed, 6 skipped**. - **AI-written code can still contain bugs or security issues nobody has found yet.** Read and test it before relying on it. The program **also uses AI while it runs**. It sends code from the target repository to the configured AI providers (Antigravity, OpenCode, NVIDIA Build, Pollinations.ai, Mistral, and others). Code from those repositories therefore leaves your machine and is processed by those providers under their terms. @@ -104,6 +104,6 @@ If you find a GUI problem that is not in this table, treat it as not yet checked ## 5. Before you use it - **Never commit or share `.env`.** Do not print key values into logs or chat. -- `config.yaml` holds owner-specific settings and should not be committed to a public repository. It is no longer tracked by git (removed in `6d9e186`). +- `config.yaml` holds owner-specific settings and and the README says it should not be committed. It is no longer tracked by git (removed in `6d9e186`). - Automatic merging (`merge-all`) can put unreviewed code into the main branch. Start with `review-all`. - Run `--dry-run` first whenever you change settings or add a new repository. diff --git a/docs/ABOUT.md b/docs/ABOUT_TH.md similarity index 95% rename from docs/ABOUT.md rename to docs/ABOUT_TH.md index 31fff40..7f80a27 100644 --- a/docs/ABOUT.md +++ b/docs/ABOUT_TH.md @@ -1,7 +1,7 @@ # เกี่ยวกับ Auto Dev Crew เอกสารนี้อธิบายว่าโปรแกรมทำงานอย่างไร ใช้ AI ตรงไหนบ้าง และตอนนี้ GUI ยังไม่สมบูรณ์ในเรื่องใด -รายละเอียดการติดตั้งและคำสั่งอยู่ใน [README.th.md](../README.th.md) (ฉบับภาษาอังกฤษ: [README.md](../README.md)) ข้อกำหนดอยู่ใน [REQUIREMENTS.md](../REQUIREMENTS.md) +รายละเอียดการติดตั้งและคำสั่งอยู่ใน [README](../README_TH.md) ข้อกำหนดอยู่ใน [REQUIREMENTS.md](../REQUIREMENTS.md) (ดู [ดัชนีเอกสาร](README_TH.md)) > สถานะ: **โครงการทดลอง / ยังไม่ production** รีโพนี้เป็น private @@ -57,7 +57,7 @@ GitHub issue (ai-task) หรือ deep-scan / ตัวละคร - **ช่อง (slot)**: รันได้พร้อมกันสูงสุด 3 งาน ช่อง 1 ทำ issue ที่ผู้ใช้สั่ง ช่อง 2–3 หาจุดปรับปรุงเอง - **F6 failover**: เมื่อโควตาของผู้ให้บริการตัวหนึ่งหมด ระบบสลับไปตัวถัดไปตามลำดับใน `config.yaml` -- **ด่านตรวจ 1–4**: ด่าน 1 judge ยืนยันว่าบั๊กมีจริงก่อนแก้ (เฉพาะเมื่อ issue อ้างไฟล์ที่มีอยู่จริง) ด่าน 2 judge ดูไฟล์เต็มหลังแก้ ด่าน 3 ตรวจว่าการแก้แตะไฟล์ที่ issue ระบุ (ทุกการทำงานของ issue) ด่าน 4 deep-scan ตรวจซ้ำก่อนสร้าง issue อัตโนมัติ +- **ด่านตรวจ 1–4**: ด่าน 1 judge ยืนยันว่าบั๊กมีจริงก่อนแก้ (เฉพาะเมื่อ issue อ้างไฟล์ที่มีอยู่จริง) ด่าน 2 judge ดูไฟล์เต็มหลังแก้ ด่าน 3 ตรวจว่าการแก้แตะไฟล์ที่ issue ระบุ (ทุกการทำงานของ issue) ด่าน 4 deep-scan ตรวจซ้ำก่อนสร้าง issue อัตโนมัติ ดูรายละเอียดโค้ดที่ [สถาปัตยกรรม](architecture_TH.md#6-ด่านตรวจ) และแถว 16 ของ [การแก้ปัญหา](troubleshooting_TH.md) สำหรับข้อความใน GUI ที่ไม่ตรงกัน - **ai-plan**: ข้อเสนอฟีเจอร์ที่รอการอนุมัติ เมื่ออนุมัติแล้วระบบสร้าง `ai-task` ให้ - **ai-pause**: ติดป้ายนี้บน issue ใดก็ได้เพื่อหยุดเอเจนต์ฉุกเฉิน - **ความจำ**: `state/history.json` เก็บว่าเคยเสนออะไรไปแล้วและผล merge ไม่ถูก commit @@ -77,7 +77,7 @@ GitHub issue (ai-task) หรือ deep-scan / ตัวละคร - งานหลายชิ้นในโปรเจกต์ทำร่วมกับ AI เช่น การแปลข้อความ GUI, การลบระบบล็อกอิน และการแก้เทสต์ที่ flaky บันทึกความคืบหน้าอยู่ใน `STATE.md` และ `docs/superpowers/` - ผู้พัฒนาเป็นผู้กำหนดเป้าหมาย ตัดสินใจเรื่องสถาปัตยกรรม และยืนยันผลการทำงาน -- ผลทดสอบที่บันทึกไว้ใน `STATE.md` คือ `pytest` ผ่าน 1442 รายการ ข้าม 6 รายการ ณ วันที่ 2026-11-18 +- ผลทดสอบที่บันทึกไว้ใน `STATE.md` คือ `pytest` ผ่าน 1401 รายการ ข้าม 6 รายการ ณ วันที่ 2026-11-18 - **โค้ดที่ AI เขียนอาจมีบั๊กหรือช่องโหว่ที่ยังไม่ถูกพบ** จึงควรอ่านและทดสอบก่อนนำไปใช้จริง นอกจากการพัฒนาแล้ว ตัวโปรแกรมเองก็ **ใช้ AI ขณะรันงาน** ด้วย โดยส่งโค้ดของ repo เป้าหมายไปให้ผู้ให้บริการ AI ที่ตั้งไว้ (Antigravity, OpenCode, NVIDIA Build, Pollinations.ai, Mistral) ดังนั้นโค้ดของ repo นั้นจะถูกส่งออกไปยังผู้ให้บริการเหล่านั้นตามการตั้งค่า diff --git a/docs/HANDOFF.md b/docs/HANDOFF.md index 9619ed8..2db14b0 100644 --- a/docs/HANDOFF.md +++ b/docs/HANDOFF.md @@ -25,12 +25,12 @@ Updated: 2026-11-18. Read this first when starting a new chat. Then read `STATE. | `merge_level` 1/2/3 | (traced) | Matches `runner.py`; documented in `docs/architecture.md` section 8.1. | | GUI gate 3 and gate 4 wording | `eedfc7d` | Fixed in `static/index_sidebar.html`, `static/index.html`, `locales/en.json`. Guarded by `tests/test_gate_wording_gui.py`. | | Docs sync (Thai vs English) | `e054139` | Guard-hook list, config.yaml tracking statements, and English README note fixed. Checked by structure and inline code tokens only, not sentence by sentence. | -| Main README in English | `fed6d2b` | `README.md` is English. Thai text moved to `README.th.md`. Both link to each other. | +| Main README in English | `fed6d2b` | `README.md` is English. Thai text moved to `README.th.md`. Both link to each other. Later, `README.md` was made English only and the Thai file became `README_TH.md` (`6b22e13`); `README.th.md` was removed (`f32b0e2`). | ## 3. Working rules from the user (apply in the next chat) - Reply in Thai. -- Documentation: write in English first, Thai afterward. The main `README.md` is English; `README.th.md` is the Thai version. +- Documentation: write in English first, Thai afterward. The main `README.md` is English; `README_TH.md` is the Thai version. - Use the Library Router search once per chat. - Do not spawn subagents unless the user asks. - Commit or push only when the user asks. Push was requested on 2026-11-18. @@ -52,7 +52,7 @@ Updated: 2026-11-18. Read this first when starting a new chat. Then read `STATE. ## 5. Open items -- **Native-speaker review of `docs/en/` and `README.md`**: not done. It needs a person who reads English well. Nobody on the assistant side can do this. +- **Native-speaker review of `docs/*_EN.md` and `README.md`**: not done. It needs a person who reads English well. Nobody on the assistant side can do this. - **Thai/English docs sync**: only the flagged differences were fixed. A sentence-by-sentence comparison of all ~3000 lines has not been done. - **Test count**: 1401 now, versus 1442 recorded earlier. The likely cause is the GitHub login tests removed in `6d9e186`. Not confirmed by a line-by-line count. - **Old doc text in `static/index.html`**: updated, but the file is not served. diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index 45b9fdb..0000000 --- a/docs/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# คู่มือเอกสาร Auto Dev Crew - -ดัชนีเอกสารทั้งหมดของโปรเจกต์ เริ่มอ่านจากหัวข้อที่ตรงกับสิ่งที่ต้องการทำ - -| ไฟล์ | อ่านเมื่อ | -|---|---| -| [ABOUT.md](ABOUT.md) | อยากเข้าใจภาพรวม การใช้ AI และสถานะ GUI | -| [installation.md](installation.md) | ติดตั้งครั้งแรก เตรียมเครื่อง และรันครั้งแรก | -| [configuration.md](configuration.md) | ต้องการรู้ความหมายของทุกคีย์ใน `config.yaml` | -| [cli.md](cli.md) | รันจาก terminal ด้วยคำสั่ง `python -m auto_dev_crew` | -| [gui.md](gui.md) | ใช้หน้าเว็บควบคุมในเครื่อง ทีละหน้า | -| [architecture.md](architecture.md) | อยากรู้ว่างานไหลผ่านโค้ดอย่างไร ตั้งแต่ issue จนถึง merge | -| [github-workflow.md](github-workflow.md) | ป้าย (label) และวงจรชีวิตของ issue กับ PR | -| [providers-and-keys.md](providers-and-keys.md) | เพิ่มผู้ให้บริการ AI, ตั้งคีย์, กำหนดบทบาทคีย์ | -| [api.md](api.md) | endpoint ของ GUI สำหรับนักพัฒนาหรือสคริปต์ | -| [tools-and-scripts.md](tools-and-scripts.md) | สคริปต์ใน `scripts/`, MCP server, โหมด autonomous, CI และเทสต์ | -| [troubleshooting.md](troubleshooting.md) | แก้ปัญหาที่พบบ่อย และรายการข้อจำกัดที่ทราบแล้ว | - -## เอกสารที่ควรรู้ว่าล้าสมัย -- [../REQUIREMENTS.md](../REQUIREMENTS.md) เป็น **ร่างข้อกำหนด v0.2 (2026-10-30)** เขียนตอนออกแบบครั้งแรก ตอนนี้ระบบใช้ **Antigravity CLI (`agy`)** เป็นหลัก ไม่ได้รันบน GitHub Actions แบบที่ร่างไว้ และ F6 ทำแล้วบางส่วน อ่านเป็นประวัติการออกแบบได้ แต่ไม่ใช่สเปกปัจจุบัน -- โฟลเดอร์ `docs/superpowers/` มี spec และ plan ของงานแต่ละชิ้น ใช้อ้างอิงประวัติการตัดสินใจ - -## แหล่งความจริงของเอกสารนี้ -ทุกหัวข้ออ้างอิงจากโค้ดในรีโป ณ วันที่ 2026-11-18 ถ้าโค้ดเปลี่ยนแล้วเอกสารไม่ตาม ให้ยึดโค้ดเป็นหลัก แล้วแก้เอกสาร diff --git a/docs/README_EN.md b/docs/README_EN.md new file mode 100644 index 0000000..1681205 --- /dev/null +++ b/docs/README_EN.md @@ -0,0 +1,28 @@ +# Auto Dev Crew Documentation (English) + +Index of the English documentation. Start with the page that matches what you want to do. Each English page has a Thai pair with the same name ending in `_TH.md`. + +| File | Read it when | +|---|---| +| [ABOUT_EN.md](ABOUT_EN.md) | You want the overview, how AI was used, and the GUI status | +| [installation_EN.md](installation_EN.md) | Installing for the first time and running once | +| [configuration_EN.md](configuration_EN.md) | You need the meaning of every key in `config.yaml` | +| [cli_EN.md](cli_EN.md) | Running from a terminal with `python -m auto_dev_crew` | +| [gui_EN.md](gui_EN.md) | Using the local control panel, page by page | +| [architecture_EN.md](architecture_EN.md) | You want to know how a job flows from issue to merge | +| [github-workflow_EN.md](github-workflow_EN.md) | Labels and the life cycle of issues and PRs | +| [providers-and-keys_EN.md](providers-and-keys_EN.md) | Adding AI providers, setting keys, assigning roles | +| [api_EN.md](api_EN.md) | GUI endpoints for developers or scripts | +| [tools-and-scripts_EN.md](tools-and-scripts_EN.md) | Scripts in `scripts/`, MCP server, autonomous mode, CI and tests | +| [troubleshooting_EN.md](troubleshooting_EN.md) | Common problems and the list of known limitations | +| [glossary_EN.md](glossary_EN.md) | You meet a project term and want its short meaning | + +## Notes +- Write the English page first, then the Thai pair with the same headings and links. If the two ever disagree, the code is the source of truth. +- The root [README.md](../README.md) is the front page. [CONTRIBUTING.md](../CONTRIBUTING.md) is for people who change the code. +- [REQUIREMENTS.md](../REQUIREMENTS.md) is an early draft (v0.2, 2026-10-30). The system now uses the Antigravity CLI (`agy`) as the main engine, not GitHub Actions as described there. Read it as design history, not as the current specification. +- `docs/superpowers/` contains the specs and plans for individual pieces of work and records past decisions. + +## Source of the facts + +Pages were checked against the code in this repository on 2026-11-18. A full sentence-by-sentence review by a native English speaker has not been done yet. When the code changes, update the code-linked pages. diff --git a/docs/README_TH.md b/docs/README_TH.md new file mode 100644 index 0000000..4fe87c4 --- /dev/null +++ b/docs/README_TH.md @@ -0,0 +1,27 @@ +# คู่มือเอกสาร Auto Dev Crew + +ดัชนีเอกสารทั้งหมดของโปรเจกต์ เริ่มอ่านจากหัวข้อที่ตรงกับสิ่งที่ต้องการทำ แต่ละหน้าภาษาไทยมีคู่เป็นหน้าภาษาอังกฤษที่ชื่อเดียวกัน ลงท้ายด้วย `_EN.md` + +| ไฟล์ | อ่านเมื่อ | +|---|---| +| [ABOUT_TH.md](ABOUT_TH.md) | อยากเข้าใจภาพรวม การใช้ AI และสถานะ GUI | +| [installation_TH.md](installation_TH.md) | ติดตั้งครั้งแรก เตรียมเครื่อง และรันครั้งแรก | +| [configuration_TH.md](configuration_TH.md) | ต้องการรู้ความหมายของทุกคีย์ใน `config.yaml` | +| [cli_TH.md](cli_TH.md) | รันจาก terminal ด้วยคำสั่ง `python -m auto_dev_crew` | +| [gui_TH.md](gui_TH.md) | ใช้หน้าเว็บควบคุมในเครื่อง ทีละหน้า | +| [architecture_TH.md](architecture_TH.md) | อยากรู้ว่างานไหลผ่านโค้ดอย่างไร ตั้งแต่ issue จนถึง merge | +| [github-workflow_TH.md](github-workflow_TH.md) | ป้าย (label) และวงจรชีวิตของ issue กับ PR | +| [providers-and-keys_TH.md](providers-and-keys_TH.md) | เพิ่มผู้ให้บริการ AI, ตั้งคีย์, กำหนดบทบาทคีย์ | +| [api_TH.md](api_TH.md) | endpoint ของ GUI สำหรับนักพัฒนาหรือสคริปต์ | +| [tools-and-scripts_TH.md](tools-and-scripts_TH.md) | สคริปต์ใน `scripts/`, MCP server, โหมด autonomous, CI และเทสต์ | +| [troubleshooting_TH.md](troubleshooting_TH.md) | แก้ปัญหาที่พบบ่อย และรายการข้อจำกัดที่ทราบแล้ว | +| [glossary_TH.md](glossary_TH.md) | พบศัพท์ของโครงการและอยากรู้ความหมายสั้น ๆ | + +## หมายเหตุ +- เขียนหน้าภาษาอังกฤษก่อน แล้วจึงเขียนหน้าภาษาไทยคู่กันที่มีหัวข้อและลิงก์เหมือนกัน ถ้าสองภาษาไม่ตรงกัน ให้ยึดโค้ดเป็นหลัก +- [README_TH.md](../README_TH.md) คือหน้าแรกภาษาไทย ส่วน [CONTRIBUTING.md](../CONTRIBUTING.md) (ภาษาอังกฤษ) สำหรับผู้ที่แก้ไขโค้ด +- [../REQUIREMENTS.md](../REQUIREMENTS.md) เป็น **ร่างข้อกำหนด v0.2 (2026-10-30)** เขียนตอนออกแบบครั้งแรก ตอนนี้ระบบใช้ **Antigravity CLI (`agy`)** เป็นหลัก ไม่ได้รันบน GitHub Actions แบบที่ร่างไว้ และ F6 ทำแล้วบางส่วน อ่านเป็นประวัติการออกแบบได้ แต่ไม่ใช่สเปกปัจจุบัน +- โฟลเดอร์ `docs/superpowers/` มี spec และ plan ของงานแต่ละชิ้น ใช้อ้างอิงประวัติการตัดสินใจ + +## แหล่งความจริงของเอกสารนี้ +หน้าต่าง ๆ ถูกตรวจกับโค้ดในรีโปเมื่อวันที่ 2026-11-18 ยังไม่มีการอ่านทวนทีละประโยคโดยเจ้าของภาษาอังกฤษ ถ้าโค้ดเปลี่ยนแล้วเอกสารไม่ตาม ให้ยึดโค้ดเป็นหลัก แล้วแก้เอกสาร diff --git a/docs/en/api.md b/docs/api_EN.md similarity index 94% rename from docs/en/api.md rename to docs/api_EN.md index bd529da..a440e0f 100644 --- a/docs/en/api.md +++ b/docs/api_EN.md @@ -58,8 +58,7 @@ A missing or wrong token is refused (checked in `gui_patches.verify_request_secu | `/api/byop/pool` | Key pool (needs token). | ### GitHub -| Path | Meaning | -|---|---| +No GitHub endpoints remain (`/api/github/*` was removed on 2026-11-18). ### Repositories and jobs | Path | Meaning | @@ -100,7 +99,7 @@ Every POST needs `X-Token`. The table below groups endpoints by purpose. The sys |---|---| | `/api/repos/add` | Add a repository. | | `/api/repos/remove` | Remove a repository from the config. | -| `/api/repos/delete` | Delete a repository entry (the page asks first). | +| `/api/repos/delete` | Remove a repository from the AI system (does not delete code on GitHub; the page asks first). | | `/api/repos/toggle` | Enable or disable a repository. | | `/api/repos/scan` | Scan a repository. | | `/api/repos/bootstrap-ci` | Install CI in a repository. | @@ -122,7 +121,7 @@ Every POST needs `X-Token`. The table below groups endpoints by purpose. The sys | `/api/key/reset` | Reset a key's status. | | `/api/key/favorite` | Pin a key. | | `/api/key/roles` | Set a key's roles. | -| `/api/provider/add` | Add a provider (see [providers-and-keys.md](providers-and-keys.md)). | +| `/api/provider/add` | Add a provider (see [providers-and-keys.md](providers-and-keys_EN.md)). | | `/api/engine/create` | Add an engine. | | `/api/engine/update` | Change an engine. | | `/api/engine/delete` | Delete an engine. | @@ -163,9 +162,8 @@ Every POST needs `X-Token`. The table below groups endpoints by purpose. The sys | `/api/mcp/preview` | Preview MCP data. | | `/api/playground/reset` | Reset the playground. | -### GitHub (the UI does not use these; decision pending) -| Path | Meaning | -|---|---| +### GitHub +No GitHub endpoints remain (`/api/github/*` was removed on 2026-11-18). ### System | Path | Meaning | @@ -192,5 +190,5 @@ curl -X POST http://127.0.0.1:8765/api/stop -H "X-Token: " ## 5. Cautions - Endpoints that start real work can use quota or change GitHub. When unsure, use `--dry-run` or the GUI. -- Deleting a repository or a key cannot be undone. +- Deleting a key cannot be undone. `/api/repos/delete` only removes a repository from the AI system; it does not delete code on GitHub. - Do not expose the server to an external network without additional protection. diff --git a/docs/api.md b/docs/api_TH.md similarity index 93% rename from docs/api.md rename to docs/api_TH.md index f08a0bd..650996d 100644 --- a/docs/api.md +++ b/docs/api_TH.md @@ -43,7 +43,7 @@ GUI เปิด HTTP API ที่ `http://127.0.0.1:` สำหรับ ### คีย์และ engine | path | ความหมาย | |---|---| -| `/api/keys` | รายการคีย์และสถานะ (ตรวจในโค้ดว่าแต่ละฟิลด์คืออะไร) | +| `/api/keys` | รายการคีย์และสถานะ | | `/api/key-roles` | การจับคู่บทบาทของคีย์ | | `/api/engines` | รายการ engine | | `/api/engine` | ข้อมูล engine เดี่ยว | @@ -58,8 +58,7 @@ GUI เปิด HTTP API ที่ `http://127.0.0.1:` สำหรับ | `/api/byop/pool` | พูลคีย์ (ต้องมี token) | ### GitHub -| path | ความหมาย | -|---|---| +ไม่มี endpoint ของ GitHub เหลือแล้ว (`/api/github/*` ถูกลบเมื่อ 2026-11-18) ### repo และงาน | path | ความหมาย | @@ -100,7 +99,7 @@ GUI เปิด HTTP API ที่ `http://127.0.0.1:` สำหรับ |---|---| | `/api/repos/add` | เพิ่ม repo | | `/api/repos/remove` | เอา repo ออกจาก config | -| `/api/repos/delete` | ลบ repo (ตรวจสอบก่อนที่ GUI ส่งมา) | +| `/api/repos/delete` | เอา repo ออกจากระบบ AI (ไม่ลบโค้ดบน GitHub; หน้าเว็บถามยืนยันก่อน) | | `/api/repos/toggle` | เปิดหรือปิด repo | | `/api/repos/scan` | สแกน repo | | `/api/repos/bootstrap-ci` | ติดตั้ง CI ให้ repo | @@ -122,7 +121,7 @@ GUI เปิด HTTP API ที่ `http://127.0.0.1:` สำหรับ | `/api/key/reset` | รีเซ็ตสถานะคีย์ | | `/api/key/favorite` | ปักหมุดคีย์ | | `/api/key/roles` | กำหนดบทบาทของคีย์ | -| `/api/provider/add` | เพิ่มผู้ให้บริการ (ดู [providers-and-keys.md](providers-and-keys.md)) | +| `/api/provider/add` | เพิ่มผู้ให้บริการ (ดู [providers-and-keys.md](providers-and-keys_TH.md)) | | `/api/engine/create` | เพิ่ม engine | | `/api/engine/update` | แก้ไข engine | | `/api/engine/delete` | ลบ engine | @@ -163,9 +162,8 @@ GUI เปิด HTTP API ที่ `http://127.0.0.1:` สำหรับ | `/api/mcp/preview` | ดูตัวอย่างข้อมูลของ MCP | | `/api/playground/reset` | รีเซ็ต playground | -### GitHub (endpoint ที่ UI ไม่ได้ใช้ รอการตัดสินใจ) -| path | ความหมาย | -|---|---| +### GitHub +ไม่มี endpoint ของ GitHub เหลือแล้ว (`/api/github/*` ถูกลบเมื่อ 2026-11-18) ### ระบบ | path | ความหมาย | @@ -192,5 +190,5 @@ curl -X POST http://127.0.0.1:8765/api/stop -H "X-Token: <ค่าจากห ## 5. ข้อควรระวัง - endpoint ที่สั่งงานจริงอาจใช้โควตาหรือเปลี่ยน GitHub ได้ ให้ใช้ `--dry-run` หรือหน้าจอ GUI เมื่อยังไม่แน่ใจ -- ลบ repo และลบคีย์ไม่มีการกู้คืน +- การลบคีย์ไม่มีการกู้คืน `/api/repos/delete` เอา repo ออกจากระบบ AI เท่านั้น ไม่ลบโค้ดบน GitHub - ห้ามเปิดเซิร์ฟเวอร์ให้เครือข่ายภายนอกโดยไม่มีการป้องกันเพิ่ม diff --git a/docs/en/architecture.md b/docs/architecture_EN.md similarity index 99% rename from docs/en/architecture.md rename to docs/architecture_EN.md index b4aae0d..0aaac08 100644 --- a/docs/en/architecture.md +++ b/docs/architecture_EN.md @@ -96,7 +96,7 @@ The GUI describes the gates this way. The code does the following: - **Gate 3 (the change must touch a file the issue names):** `quality_gates.repair_gate_violation` applies to **every issue run**, not only repair rounds. If the issue names an existing production file and the diff touches none of them, the run is blocked before the judge sees it. If the issue names no file, nothing is blocked. - **Gate 4 (deep-scan re-checks before an issue is created):** applies only to the **automatic** path (`file_findings_automatically` when `auto_issue.enabled` is on). The per-finding create button (`/api/deep-scan/file`) skips this re-check. -Note: the GUI wording for gates 3 and 4 now matches the code (fixed 2026-11-18; see [troubleshooting](troubleshooting.md) row 16). +Note: the GUI wording for gates 3 and 4 now matches the code (fixed 2026-11-18; see [troubleshooting](troubleshooting_EN.md) row 16). --- diff --git a/docs/architecture.md b/docs/architecture_TH.md similarity index 98% rename from docs/architecture.md rename to docs/architecture_TH.md index 481a217..e0aa24e 100644 --- a/docs/architecture.md +++ b/docs/architecture_TH.md @@ -96,7 +96,7 @@ - **ด่าน 3 (การแก้ต้องแตะไฟล์ที่ issue ระบุ):** `quality_gates.repair_gate_violation` ใช้กับ **ทุกการทำงานของ issue** ไม่ใช่เฉพาะรอบซ่อม ถ้า issue ระบุไฟล์ production ที่มีอยู่จริงและ diff ไม่แตะไฟล์นั้นเลย งานจะถูกบล็อกก่อนส่งให้ judge ถ้า issue ไม่ได้ระบุไฟล์ จะไม่บล็อก - **ด่าน 4 (deep-scan ตรวจซ้ำก่อนสร้าง issue):** ใช้เฉพาะเส้นทาง **สร้าง issue อัตโนมัติ** (`file_findings_automatically` เมื่อ `auto_issue.enabled`) ปุ่มสร้าง issue ทีละรายการ (`/api/deep-scan/file`) ไม่ผ่านการตรวจซ้ำนี้ -หมายเหตุ: ข้อความใน GUI ด่าน 3 และด่าน 4 ตรงกับโค้ดแล้ว (แก้ 2026-11-18 ดู [troubleshooting](troubleshooting.md) แถว 16) +หมายเหตุ: ข้อความใน GUI ด่าน 3 และด่าน 4 ตรงกับโค้ดแล้ว (แก้ 2026-11-18 ดู [troubleshooting](troubleshooting_TH.md) แถว 16) --- @@ -104,7 +104,7 @@ - ถ้าผ่านทุกด่าน ระบบ push branch และเปิด PR ด้วย `create_pr` (`runner.py` บรรทัด 1491) - PR ได้ป้าย `ai-generated` -- PR body สร้างจาก `pr_body.py` +- PR body สร้างจาก `pr_body.py` (รายละเอียดของส่วนที่ใส่ในเนื้อหายังไม่ได้ไล่ตรวจทั้งหมด) - งานที่ไม่ผ่านจะถูกติดป้าย `ai-failed` และคอมเมนต์เหตุผลใน issue (ไม่เปิด PR) --- diff --git a/docs/en/cli.md b/docs/cli_EN.md similarity index 98% rename from docs/en/cli.md rename to docs/cli_EN.md index d20961a..aeb3557 100644 --- a/docs/en/cli.md +++ b/docs/cli_EN.md @@ -3,9 +3,9 @@ There are two entry points from a terminal: 1. **Runner:** `python -m auto_dev_crew` (the main worker that reads the queue and opens PRs) -2. **GUI:** `python -m auto_dev_crew.gui` (the web control panel, see [gui.md](gui.md)) +2. **GUI:** `python -m auto_dev_crew.gui` (the web control panel, see [gui.md](gui_EN.md)) -There are also helper tools: `python -m auto_dev_crew.mcp_server` and the scripts in `scripts/` (see [tools-and-scripts.md](tools-and-scripts.md)). +There are also helper tools: `python -m auto_dev_crew.mcp_server` and the scripts in `scripts/` (see [tools-and-scripts.md](tools-and-scripts_EN.md)). Run every command from the project root, because `config.yaml` and `.env` are resolved from there. @@ -86,7 +86,7 @@ python -m auto_dev_crew --scan-todos OkayOkay101/cyberpunk-pomodoro Prints each `[AI-TODO]` hit as `path:line text` and exits. It never creates issues. -To create issues from the results, use the **Studio** page in the GUI, or schedule scans with `todo_scan.schedule_minutes` (see [configuration.md](configuration.md)). +To create issues from the results, use the **Studio** page in the GUI, or schedule scans with `todo_scan.schedule_minutes` (see [configuration.md](configuration_EN.md)). --- diff --git a/docs/cli.md b/docs/cli_TH.md similarity index 96% rename from docs/cli.md rename to docs/cli_TH.md index 9baddd0..05d35f6 100644 --- a/docs/cli.md +++ b/docs/cli_TH.md @@ -3,9 +3,9 @@ ระบบมีสองจุดเข้าใช้งานจาก terminal: 1. **runner** `python -m auto_dev_crew` (ตัวทำงานหลัก อ่านคิวและเปิด PR) -2. **GUI** `python -m auto_dev_crew.gui` (หน้าเว็บควบคุม ดู [gui.md](gui.md)) +2. **GUI** `python -m auto_dev_crew.gui` (หน้าเว็บควบคุม ดู [gui.md](gui_TH.md)) -และมีเครื่องมือเสริม `python -m auto_dev_crew.mcp_server` และ `scripts/` (ดู [tools-and-scripts.md](tools-and-scripts.md)) +และมีเครื่องมือเสริม `python -m auto_dev_crew.mcp_server` และ `scripts/` (ดู [tools-and-scripts.md](tools-and-scripts_TH.md)) ทุกคำสั่งรันจากรากโปรเจกต์ เพราะ `config.yaml` และ `.env` อ้างจากตำแหน่งนั้น @@ -86,7 +86,7 @@ python -m auto_dev_crew --scan-todos OkayOkay101/cyberpunk-pomodoro พิมพ์รายการ `[AI-TODO]` ที่พบในรูปแบบ `path:line ข้อความ` แล้วจบ ไม่สร้าง issue (`create=False`) -การสร้าง issue จริงทำได้จาก GUI (หน้า **สตูดิโอ**) หรือเปิดการสแกนตามเวลาด้วย `todo_scan.schedule_minutes` ดู [configuration.md](configuration.md) +การสร้าง issue จริงทำได้จาก GUI (หน้า **สตูดิโอ**) หรือเปิดการสแกนตามเวลาด้วย `todo_scan.schedule_minutes` ดู [configuration.md](configuration_TH.md) --- @@ -97,7 +97,7 @@ python -m auto_dev_crew --scan-todos OkayOkay101/cyberpunk-pomodoro | `--transport` | `stdio` (เท่านั้น) | ใช้ JSON-RPC 2.0 ผ่าน stdin/stdout | | `--config ` | `config.yaml` | ไฟล์ตั้งค่าทางเลือก | -เซิร์ฟเวอร์นี้เปิด tool แบบอ่านอย่างเดียวสำหรับ MCP client เช่น สถานะ daemon, สถานะช่องทำงาน, `merge_mode` และสุขภาพของ engine (F6) ตัวอย่างหนึ่งคือสรุป PR ที่ merge แล้วข้ามคืน +เซิร์ฟเวอร์นี้เปิด tool แบบอ่านอย่างเดียวสำหรับ MCP client เช่น สถานะ daemon, สถานะช่องทำงาน, `merge_mode` และสุขภาพของ engine (F6) ตัวอย่างหนึ่งคือสรุป PR ที่ merge แล้วข้ามคืนพร้อมคำขออนุมัติที่ค้าง ตั้งค่า MCP client ตามเอกสารของ client นั้น --- diff --git a/docs/en/configuration.md b/docs/configuration_EN.md similarity index 98% rename from docs/en/configuration.md rename to docs/configuration_EN.md index 580697c..faf75a6 100644 --- a/docs/en/configuration.md +++ b/docs/configuration_EN.md @@ -4,7 +4,7 @@ **How values are read:** if a key is missing from the file, the code uses the default listed in the "Code default" column. Some keys have a different value in the file than in the code. The file value always wins. -**Editing:** you can edit the file by hand, or use the GUI, which writes the values for you. After a manual edit, restart the agent so the change takes effect for sure (see [gui.md](gui.md)). +**Editing:** you can edit the file by hand, or use the GUI, which writes the values for you. After a manual edit, restart the agent so the change takes effect for sure (see [gui.md](gui_EN.md)). --- @@ -13,7 +13,7 @@ | Key | Type | Value in file | Code default | Meaning | |---|---|---|---|---| | `owner` | string | `example-owner` | (none) | GitHub account of the owner. Issues are picked up only if their author matches this value (case-insensitive). If unset, the agent picks up nothing. | -| `merge_mode` | string | `review-all` | `review-all` | Global merge policy: `review-all`, `small-only`, or `merge-all`. See [architecture.md](architecture.md#8-merge-decisions). | +| `merge_mode` | string | `review-all` | `review-all` | Global merge policy: `review-all`, `small-only`, or `merge-all`. See [architecture.md](architecture_EN.md#8-merge-decisions). | | `max_fix_attempts` | integer | `3` | `2` | Maximum repair rounds when tests fail or the coder changes nothing. The file value (3) applies. | | `engine_timeout_cooldown_minutes` | number | `20` | `20` | After an engine times out, it is paused for this many minutes. | | `ui_language` | string | (not in file) | `th` | UI and backend message language: `th` or `en`. Any other or unreadable value falls back to `th`. Set from the **Settings** page or `POST /api/settings/language`. | @@ -102,7 +102,7 @@ The result is a `fast` or `heavy` path. `routing` uses that path to keep separat Currently only `opencode-pollinations` is enabled. The others are set to `enabled: false`. -Details on keys and roles: [providers-and-keys.md](providers-and-keys.md). +Details on keys and roles: [providers-and-keys.md](providers-and-keys_EN.md). --- @@ -116,7 +116,7 @@ Details on keys and roles: [providers-and-keys.md](providers-and-keys.md). | `failed` | `ai-failed` | Added when the job fails or does not pass evaluation. | | `pr` | `ai-generated` | Added to PRs the agent opens. | -The life cycle of these labels is described in [github-workflow.md](github-workflow.md). +The life cycle of these labels is described in [github-workflow.md](github-workflow_EN.md). --- @@ -154,7 +154,7 @@ Each entry in the list has these keys: | `scanners` | Map from persona name to the list of scan commands run for that persona in this repository. | | `ci` | Per-repository override of `ci` settings, such as `auto_bootstrap_ci`. | | `enabled` | `false` = skip this repository. | -| `merge_level` | (not in file) Per-repository merge level, set from a feature plan in the GUI: 1 = human reviews, 2 = auto-merge once CI passes and no risky files, 3 = auto-merge once CI passes. If unset, the global `merge_mode` applies (see [architecture](architecture.md#8-merge-decisions)). | +| `merge_level` | (not in file) Per-repository merge level, set from a feature plan in the GUI: 1 = human reviews, 2 = auto-merge once CI passes and no risky files, 3 = auto-merge once CI passes. If unset, the global `merge_mode` applies (see [architecture](architecture_EN.md#8-merge-decisions)). | Repository currently in the file: `OkayOkay101/cyberpunk-pomodoro` (base `main`, test `node test-runner.js`). diff --git a/docs/configuration.md b/docs/configuration_TH.md similarity index 96% rename from docs/configuration.md rename to docs/configuration_TH.md index 6a32fb9..842af3d 100644 --- a/docs/configuration.md +++ b/docs/configuration_TH.md @@ -4,7 +4,7 @@ **หลักการอ่านค่า:** ถ้าคีย์ไม่มีในไฟล์ โค้ดจะใช้ค่าเริ่มต้นที่ระบุไว้ในคอลัมน์ "ค่าเริ่มต้นในโค้ด" บางคีย์ค่าในไฟล์ต่างจากค่าเริ่มต้นในโค้ด ระบบใช้ค่าในไฟล์เสมอ -**การแก้ไข:** แก้ด้วยมือได้ หรือผ่านหน้า GUI ที่เขียนค่าลงไฟล์ให้เอง หลังแก้ไฟล์ด้วยมือ ให้รีสตาร์ทเอเจนต์เพื่อให้มีผลแน่นอน (ดู [gui.md](gui.md)) +**การแก้ไข:** แก้ด้วยมือได้ หรือผ่านหน้า GUI ที่เขียนค่าลงไฟล์ให้เอง หลังแก้ไฟล์ด้วยมือ ให้รีสตาร์ทเอเจนต์เพื่อให้มีผลแน่นอน (ดู [gui.md](gui_TH.md)) --- @@ -13,7 +13,7 @@ | คีย์ | ชนิด | ค่าในไฟล์ | ค่าเริ่มต้นในโค้ด | ความหมาย | |---|---|---|---|---| | `owner` | สตริง | `example-owner` | (ไม่มี) | ชื่อบัญชี GitHub ของเจ้าของ งานจาก issue จะถูกหยิบเฉพาะถ้าผู้เขียนตรงกับค่านี้ (ไม่สนตัวพิมพ์ใหญ่เล็ก) ค่าที่ไม่ตั้งทำให้เอเจนต์ไม่หยิบงานใด | -| `merge_mode` | สตริง | `review-all` | `review-all` | โหมดการ merge กลางของระบบ ค่าที่ใช้ได้: `review-all`, `small-only`, `merge-all` รายละเอียดที่ [architecture.md](architecture.md#8-การตัดสิน-merge) | +| `merge_mode` | สตริง | `review-all` | `review-all` | โหมดการ merge กลางของระบบ ค่าที่ใช้ได้: `review-all`, `small-only`, `merge-all` รายละเอียดที่ [architecture.md](architecture_TH.md#8-การตัดสิน-merge) | | `max_fix_attempts` | จำนวนเต็ม | `3` | `2` | จำนวนรอบแก้ซ้ำสูงสุดเมื่อเทสต์ไม่ผ่านหรือ coder ไม่ได้แก้อะไร ค่าในไฟล์ (3) มีผลจริง | | `engine_timeout_cooldown_minutes` | จำนวน | `20` | `20` | เมื่อ engine เกิด timeout จะพักการใช้ engine นั้นเป็นเวลาเท่านี้ก่อนลองอีก | | `ui_language` | สตริง | (ไม่มีในไฟล์ปัจจุบัน) | `th` | ภาษาของ UI และข้อความ backend ค่าที่ใช้ได้: `th` หรือ `en` ค่าอื่นหรืออ่านไม่ได้ให้ใช้ `th` ตั้งได้จากหน้า **ตั้งค่า** หรือ `POST /api/settings/language` | @@ -59,7 +59,7 @@ | คีย์ | ค่าในไฟล์ | ความหมาย | |---|---|---| | `enabled` | `true` | เปิดการจัดประเภท issue | -| `use_llm_fallback` | `false` | เมื่อจัดประเภทด้วยป้ายไม่ได้ ให้ใช้ LLM ช่วยตัดสินหรือไม่ ค่าปิดหมายถึงใช้เฉพาะกฎป้าย | +| `use_llm_fallback` | `false` | เมื่อจัดประเภทด้วยป้ายไม่ได้ ให้ใช้ LLM ช่วยตัดสินหรือไม่ ค่าปิดหมายถึงใช้เฉพาะป้ายและ heuristic | | `fast_labels` | `quick-fix, typo, docs, documentation, minor, small, lint` | ป้ายที่ถือว่าเป็นงานเล็ก เร็ว | | `heavy_labels` | `feature, architecture, refactor, breaking, complex, security` | ป้ายที่ถือว่าเป็นงานใหญ่ (เส้นทาง `heavy`) งาน persona `sentinel` ถูกจัดเป็น heavy เสมอ | @@ -102,7 +102,7 @@ engine ที่เปิดใช้อยู่ในไฟล์ตอนนี้: `opencode-pollinations` (เท่านั้น) ตัวอื่นตั้งเป็น `enabled: false` ไว้ -รายละเอียดคีย์และบทบาทอยู่ที่ [providers-and-keys.md](providers-and-keys.md) +รายละเอียดคีย์และบทบาทอยู่ที่ [providers-and-keys.md](providers-and-keys_TH.md) --- @@ -111,12 +111,12 @@ engine ที่เปิดใช้อยู่ในไฟล์ตอนน | คีย์ | ค่า | ความหมาย | |---|---|---| | `task` | `ai-task` | ป้ายงานที่ให้เอเจนต์หยิบ | -| `pause` | `ai-pause` | ถ้ามี issue ที่เปิดอยู่ติดป้ายนี้ อีกบางรายการ runner จะหยุดทำงานใหม่ | +| `pause` | `ai-pause` | ถ้ามี issue ที่เปิดอยู่ติดป้ายนี้ runner จะไม่เริ่มงานใหม่ในรีโปนั้น | | `working` | `ai-working` | ติดระหว่างที่เอเจนต์กำลังทำงานนั้น | | `failed` | `ai-failed` | ติดเมื่อทำงานไม่สำเร็จ | | `pr` | `ai-generated` | ป้ายที่ติดบน PR ที่เอเจนต์เปิด | -วงจรชีวิตของป้ายอยู่ที่ [github-workflow.md](github-workflow.md) +วงจรชีวิตของป้ายอยู่ที่ [github-workflow.md](github-workflow_TH.md) --- @@ -154,7 +154,7 @@ engine ที่เปิดใช้อยู่ในไฟล์ตอนน | `scanners` | ชื่อตัวละคร → ลิสต์คำสั่งสแกนที่รันให้ตัวละครนั้นใน repo นี้ | | `ci` | ค่า override ของ `ci` ระดับ repo เช่น `auto_bootstrap_ci` | | `enabled` | `false` = ข้าม repo นี้ | -| `merge_level` | (ไม่มีในไฟล์) ระดับ merge ต่อ repo ตั้งได้จากแผนฟีเจอร์ใน GUI: 1 = คนรีวิว, 2 = merge เองเมื่อ CI ผ่านและไม่มีไฟล์เสี่ยง, 3 = merge เองเมื่อ CI ผ่าน (ดู [architecture](architecture.md#8-การตัดสิน-merge)) ถ้าไม่ตั้งใช้ `merge_mode` กลาง | +| `merge_level` | (ไม่มีในไฟล์) ระดับ merge ต่อ repo ตั้งได้จากแผนฟีเจอร์ใน GUI: 1 = คนรีวิว, 2 = merge เองเมื่อ CI ผ่านและไม่มีไฟล์เสี่ยง, 3 = merge เองเมื่อ CI ผ่าน (ดู [architecture](architecture_TH.md#8-การตัดสิน-merge)) ถ้าไม่ตั้งใช้ `merge_mode` กลาง | repo ที่มีในไฟล์ตอนนี้: `OkayOkay101/cyberpunk-pomodoro` (base `main`, test `node test-runner.js`) @@ -164,7 +164,7 @@ repo ที่มีในไฟล์ตอนนี้: `OkayOkay101/cyberpunk | ส่วน | คีย์ | ค่าในไฟล์ | ความหมาย | |---|---|---|---| -| `autonomous` | `max_turns_per_session` | `40` | จำนวนรอบสูงสุดของโหมด autonomous ต่อหนึ่งเซสชัน (ใช้โดย `scripts/autonomous_common.py`) | +| `autonomous` | `max_turns_per_session` | `40` | จำนวนรอบสูงสุดของโหมด autonomous ใน Claude Code ต่อหนึ่งเซสชัน (ใช้โดย `scripts/autonomous_common.py`) | | `todo_scan` | `max_issues_per_run` | `5` | จำนวน issue สูงสุดที่สร้างจากแท็ก `[AI-TODO]` ต่อการรันหนึ่งครั้ง | | `todo_scan` | `schedule_minutes` | `0` | สแกนซ้ำทุกกี่นาที `0` หรือไม่ตั้ง = ไม่สแกนตามเวลา | | `auto_issue` | `enabled` | `false` | สร้าง issue จากผล deep-scan อัตโนมัติหรือไม่ | diff --git a/docs/en/README.md b/docs/en/README.md deleted file mode 100644 index 2060b41..0000000 --- a/docs/en/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# Auto Dev Crew Documentation (English) - -Index of the English documentation. Start with the page that matches what you want to do. - -| File | Read it when | -|---|---| -| [ABOUT.md](ABOUT.md) | You want the overview, how AI was used, and the GUI status | -| [installation.md](installation.md) | Installing for the first time and running once | -| [configuration.md](configuration.md) | You need the meaning of every key in `config.yaml` | -| [cli.md](cli.md) | Running from a terminal with `python -m auto_dev_crew` | -| [gui.md](gui.md) | Using the local control panel, page by page | -| [architecture.md](architecture.md) | You want to know how a job flows from issue to merge | -| [github-workflow.md](github-workflow.md) | Labels and the life cycle of issues and PRs | -| [providers-and-keys.md](providers-and-keys.md) | Adding AI providers, setting keys, assigning roles | -| [api.md](api.md) | GUI endpoints for developers or scripts | -| [tools-and-scripts.md](tools-and-scripts.md) | Scripts in `scripts/`, MCP server, autonomous mode, CI and tests | -| [troubleshooting.md](troubleshooting.md) | Common problems and the list of known limitations | - -## Notes -- New documentation is written in English first. The Thai documentation in [`../`](../) is a translation of this set and is updated afterward. If the two ever disagree, the code is the source of truth. -- [REQUIREMENTS.md](../../REQUIREMENTS.md) is an early draft (v0.2, 2026-10-30). The system now uses the Antigravity CLI (`agy`) as the main engine, not GitHub Actions as described there. Read it as design history, not as the current specification. -- `docs/superpowers/` contains the specs and plans for individual pieces of work and records past decisions. - -All statements here were checked against the code in this repository as of 2026-11-18. When the code changes, update the code-linked pages. diff --git a/docs/en/github-workflow.md b/docs/github-workflow_EN.md similarity index 95% rename from docs/en/github-workflow.md rename to docs/github-workflow_EN.md index c32c0d0..f96f769 100644 --- a/docs/en/github-workflow.md +++ b/docs/github-workflow_EN.md @@ -69,7 +69,7 @@ Flow: 3. The system creates an `ai-task` issue for each step of the plan. 4. From there, the normal issue flow applies. -Proposing and approving go through `/api/feature-gen/propose` and `/api/feature-gen/approve` (see [api.md](api.md)). +Proposing and approving go through `/api/feature-gen/propose` and `/api/feature-gen/approve` (see [api.md](api_EN.md)). The merge level for a plan can be set when it is created (per-repository `merge_level`). @@ -80,7 +80,7 @@ The merge level for a plan can be set when it is created (per-repository `merge_ - Branch names: `ai/issue--` for issues, or `ai/-` for personas. - Label: `ai-generated`. - Titles carry an icon that depends on the job type (`ICONS` in the code). -- The body is built by `pr_body.py`. +- The body is built by `pr_body.py` (the full list of what it includes has not been traced line by line). Reviewers should check: - Whether the diff matches the issue. @@ -92,7 +92,7 @@ Reviewers should check: ## 6. Permissions and tokens - The GitHub account used by `gh` needs write access to the target repository, to push branches, open PRs, create labels, and comment. -- The system does not force-push, according to the rules in this documentation. (The enforced limits are described in [troubleshooting.md](troubleshooting.md#2-known-limitations).) +- The system does not force-push, according to the rules in this documentation. (The enforced limits are described in [troubleshooting.md](troubleshooting_EN.md#2-known-limitations).) - Never paste a token into an issue or comment. The system hides known token formats (`redact.py`) before showing or logging text, but cannot guarantee that every format is caught. --- diff --git a/docs/github-workflow.md b/docs/github-workflow_TH.md similarity index 98% rename from docs/github-workflow.md rename to docs/github-workflow_TH.md index 50f2a2b..6b7310d 100644 --- a/docs/github-workflow.md +++ b/docs/github-workflow_TH.md @@ -69,7 +69,7 @@ 3. ระบบสร้าง issue `ai-task` สำหรับแต่ละขั้นของแผน 4. ผลดำเนินต่อไปตามวงจรของ issue ที่ผู้ใช้สั่ง -รายละเอียดการ propose และ approve ผ่าน `/api/feature-gen/propose` และ `/api/feature-gen/approve` (ดู [api.md](api.md)) +รายละเอียดการ propose และ approve ผ่าน `/api/feature-gen/propose` และ `/api/feature-gen/approve` (ดู [api.md](api_TH.md)) ระดับ merge ของแผนตั้งได้ตอนสร้าง (ค่า `merge_level` ต่อ repo) @@ -92,7 +92,7 @@ ## 6. ข้อควรรู้เรื่องสิทธิ์และ token - บัญชี GitHub ที่ `gh` ใช้ ต้องมีสิทธิ์เขียน repo เป้าหมาย เพื่อ push branch, เปิด PR, สร้างป้าย และคอมเมนต์ -- ระบบไม่ force-push ตามข้อกำหนดในเอกสาร (รายละเอียดข้อจำกัดอยู่ที่ [troubleshooting.md](troubleshooting.md#2-ข้อจำกัดที่ทราบแล้ว)) +- ระบบไม่ force-push ตามข้อกำหนดในเอกสาร (รายละเอียดข้อจำกัดอยู่ที่ [troubleshooting.md](troubleshooting_TH.md#2-ข้อจำกัดที่ทราบแล้ว)) - ห้ามใส่ token ลงใน issue หรือคอมเมนต์ ระบบจะซ่อนค่าที่รู้จัก (`redact.py`) ก่อนแสดงหรือบันทึก แต่ไม่ได้รับประกันว่าทุกรูปแบบจะถูกจับได้ --- diff --git a/docs/glossary_EN.md b/docs/glossary_EN.md new file mode 100644 index 0000000..37c7804 --- /dev/null +++ b/docs/glossary_EN.md @@ -0,0 +1,24 @@ +# Glossary + +Short definitions of the project's terms. Each entry links to the page with the details. + +| Term | Meaning | Details | +|---|---|---| +| **Owner** | The GitHub account set as `owner` in `config.yaml`. Only issues opened by this account count as work for the agent. | [github-workflow.md](github-workflow_EN.md) | +| **`ai-task`** | Label an owner adds to an issue to give it to the agent. | [github-workflow.md](github-workflow_EN.md) | +| **`ai-pause`** | Label that stops the agent for a repository while any open issue carries it. Closing the issue lets it resume. | [github-workflow.md](github-workflow_EN.md) | +| **Slot** | One of the parallel workers (`parallel.slots`, default `3`). Slot 1 takes only owner issues. Slots 2 and 3 take personas, or extra issues. | [architecture.md](architecture_EN.md) | +| **Persona** | An autonomous agent that scans the code for one kind of improvement when no issues are waiting. The enabled personas are `bolt` (performance), `sentinel` (security), `palette` (UX/UI), and `quality` (tests and code quality). | [architecture.md](architecture_EN.md) | +| **Engine** | An AI service that does the coding or judging. The main engine is the Antigravity CLI (`agy`). | [providers-and-keys.md](providers-and-keys_EN.md) | +| **F6 failover** | When an engine's quota runs out or it times out, the system tries the next engine in the failover order. A timed-out engine is paused for `engine_timeout_cooldown_minutes`. | [providers-and-keys.md](providers-and-keys_EN.md) | +| **Routing** | Orders engines by past merge results when `routing.enabled` is `true`. Engines need `routing.min_samples` results before their data is used. | [configuration.md](configuration_EN.md) | +| **Merge mode** | The global rule for merging PRs: `review-all` (a person merges), `small-only` (small PRs merge by themselves), or `merge-all` (merge once CI passes). | [architecture.md](architecture_EN.md) | +| **Merge level** | A per-repository override of the merge mode, with values `1`, `2`, or `3`. Level 1 always waits for a person. Level 2 merges automatically unless the file risk check finds risky files. Level 3 merges automatically once CI passes. | [architecture.md](architecture_EN.md) | +| **Protected paths** | Paths that never count as a small PR, such as `.github/` and `requirements`. | [configuration.md](configuration_EN.md) | +| **Quality gates** | Checks a change must pass before a PR opens: the diff is not empty, Python files parse, static checks pass, and the judge scores the change at or above `min_pass_score` (0.75). | [architecture.md](architecture_EN.md) | +| **Judge (evaluator)** | The AI step that scores a change against a rubric. If no other engine is available, the coder's own engine judges it. | [architecture.md](architecture_EN.md) | +| **Feature plan (`ai-plan`)** | A proposed set of features filed as an issue. After a person adds `ai-plan-approved`, the system creates one `ai-task` issue per step. | [github-workflow.md](github-workflow_EN.md) | +| **Deep scan** | A scan of the whole repository that can file new issues. | [architecture.md](architecture_EN.md) | +| **Dry run** | A local run that does not touch GitHub. Use `--dry-run`. | [cli.md](cli_EN.md) | +| **`[AI-TODO]`** | A marker in code comments that `--scan-todos` lists. The scan does not create issues. | [cli.md](cli_EN.md) | +| **Small PR** | A PR with at most `small_pr.max_lines` changed lines (default `50`) that touches no protected path. | [configuration.md](configuration_EN.md) | diff --git a/docs/glossary_TH.md b/docs/glossary_TH.md new file mode 100644 index 0000000..c230dc1 --- /dev/null +++ b/docs/glossary_TH.md @@ -0,0 +1,24 @@ +# คำศัพท์ + +คำนิยามสั้น ๆ ของศัพท์ในโครงการ แต่ละรายการลิงก์ไปยังหน้าที่มีรายละเอียด + +| ศัพท์ | ความหมาย | รายละเอียด | +|---|---|---| +| **Owner** (เจ้าของ) | บัญชี GitHub ที่ตั้งเป็น `owner` ใน `config.yaml` เฉพาะ issue ที่เปิดโดยบัญชีนี้ถือเป็นงานของเอเจนต์ | [github-workflow_TH.md](github-workflow_TH.md) | +| **`ai-task`** | ป้ายที่เจ้าของเพิ่มให้ issue เพื่อมอบงานให้เอเจนต์ | [github-workflow_TH.md](github-workflow_TH.md) | +| **`ai-pause`** | ป้ายที่หยุดเอเจนต์สำหรับ repository หนึ่ง ตราบใดที่ยังมี issue เปิดที่ติดป้ายนี้ ปิด issue เพื่อให้ทำงานต่อ | [github-workflow_TH.md](github-workflow_TH.md) | +| **Slot** (ช่องทำงาน) | ผู้ทำงานคู่ขนานหนึ่งตัว (`parallel.slots` ค่าเริ่มต้น `3`) Slot 1 รับเฉพาะ issue ของเจ้าของ Slot 2 และ 3 รับตัวละครหรือ issue เพิ่มเติม | [architecture_TH.md](architecture_TH.md) | +| **Persona** (ตัวละคร) | เอเจนต์อัตโนมัติที่สแกนหาการปรับปรุงหนึ่งด้านเมื่อไม่มี issue รอ ตัวละครที่เปิดใช้คือ `bolt` (performance), `sentinel` (security), `palette` (UX/UI) และ `quality` (tests and code quality) | [architecture_TH.md](architecture_TH.md) | +| **Engine** (เอนจิน) | บริการ AI ที่ทำการเขียนโค้ดหรือให้คะแนน เอนจินหลักคือ Antigravity CLI (`agy`) | [providers-and-keys_TH.md](providers-and-keys_TH.md) | +| **F6 failover** (การสลับเอนจินสำรอง) | เมื่อโควตาของเอนจินหมดหรือหมดเวลา ระบบจะลองเอนจินถัดไปตามลำดับสำรอง เอนจินที่หมดเวลาจะถูกพักตาม `engine_timeout_cooldown_minutes` | [providers-and-keys_TH.md](providers-and-keys_TH.md) | +| **Routing** (การจัดลำดับ) | จัดลำดับเอนจินตามผล merge ที่ผ่านมา เมื่อ `routing.enabled` เป็น `true` เอนจินต้องมีผลอย่างน้อย `routing.min_samples` ครั้งก่อนข้อมูลจะถูกใช้ | [configuration_TH.md](configuration_TH.md) | +| **Merge mode** (โหมด merge) | กฎกลางของการ merge PR: `review-all` (คนเป็นผู้ merge), `small-only` (PR เล็ก merge เอง) หรือ `merge-all` (merge เมื่อ CI ผ่าน) | [architecture_TH.md](architecture_TH.md) | +| **Merge level** (ระดับ merge) | การกำหนดแทน merge mode ราย repository ค่าคือ `1`, `2` หรือ `3` ระดับ 1 รอคนเสมอ ระดับ 2 merge เองเว้นแต่การตรวจความเสี่ยงของไฟล์พบไฟล์เสี่ยง ระดับ 3 merge เองเมื่อ CI ผ่าน | [architecture_TH.md](architecture_TH.md) | +| **Protected paths** (พาธที่ป้องกัน) | พาธที่ไม่นับเป็น PR เล็กเด็ดขาด เช่น `.github/` และ `requirements` | [configuration_TH.md](configuration_TH.md) | +| **Quality gates** (ด่านตรวจคุณภาพ) | การตรวจที่การเปลี่ยนแปลงต้องผ่านก่อนเปิด PR: diff ไม่ว่าง ไฟล์ Python แยกวิเคราะห์ได้ การตรวจ static ผ่าน และ judge ให้คะแนนอย่างน้อย `min_pass_score` (0.75) | [architecture_TH.md](architecture_TH.md) | +| **Judge (evaluator)** (ผู้ตัดสิน) | ขั้นที่ AI ให้คะแนนการเปลี่ยนแปลงตามเกณฑ์ ถ้าไม่มีเอนจินอื่นให้ใช้ เอนจินของตัวเขียนโค้ดจะเป็นผู้ตัดสินเอง | [architecture_TH.md](architecture_TH.md) | +| **Feature plan (`ai-plan`)** (แผนฟีเจอร์) | ชุดฟีเจอร์ที่เสนอในรูปของ issue เมื่อมีคนเพิ่มป้าย `ai-plan-approved` ระบบจะสร้าง issue `ai-task` หนึ่งใบต่อหนึ่งขั้น | [github-workflow_TH.md](github-workflow_TH.md) | +| **Deep scan** (สแกนลึก) | การสแกนทั้ง repository ที่สามารถสร้าง issue ใหม่ได้ | [architecture_TH.md](architecture_TH.md) | +| **Dry run** (ทดลองแห้ง) | การรันในเครื่องที่ไม่แตะ GitHub ใช้ `--dry-run` | [cli_TH.md](cli_TH.md) | +| **`[AI-TODO]`** | เครื่องหมายในคอมเมนต์โค้ดที่ `--scan-todos` แสดงรายการ การสแกนนี้ไม่สร้าง issue | [cli_TH.md](cli_TH.md) | +| **Small PR** (PR เล็ก) | PR ที่มีบรรทัดที่เปลี่ยนไม่เกิน `small_pr.max_lines` (ค่าเริ่มต้น `50`) และไม่แตะพาธที่ป้องกัน | [configuration_TH.md](configuration_TH.md) | diff --git a/docs/en/gui.md b/docs/gui_EN.md similarity index 92% rename from docs/en/gui.md rename to docs/gui_EN.md index a2ddd85..534d212 100644 --- a/docs/en/gui.md +++ b/docs/gui_EN.md @@ -34,8 +34,8 @@ Before restarting or stopping, check whether slots are idle. If a job is running - Ask the AI to change code in a selected repository. - Review the resulting diff. - Find `[AI-TODO]` tags and create issues from them. -- Run a deep scan. See [architecture.md](architecture.md#10-deep-scan). -- Feature plans (`ai-plan`). See [github-workflow.md](github-workflow.md#4-feature-plans-ai-plan). +- Run a deep scan. See [architecture.md](architecture_EN.md#10-deep-scan). +- Feature plans (`ai-plan`). See [github-workflow.md](github-workflow_EN.md#4-feature-plans-ai-plan). ### 2.4 Keys (AI keys) - View and add provider keys. @@ -43,7 +43,7 @@ Before restarting or stopping, check whether slots are idle. If a job is running - Set the failover order of engines. - See today's usage per engine (from `state/usage.jsonl`). -Details: [providers-and-keys.md](providers-and-keys.md). +Details: [providers-and-keys.md](providers-and-keys_EN.md). ### 2.5 Settings - Merge mode (`review-all`, `small-only`, `merge-all`). @@ -59,7 +59,7 @@ Details: [providers-and-keys.md](providers-and-keys.md). |---|---| | Slot | One worker. Up to three can run in parallel. | | Judge | The AI that scores code before a PR. Needs a key with the judge role. | -| Gates 1–4 | Checks before a PR is opened. See [architecture.md](architecture.md#6-quality-gates). | +| Gates 1–4 | Checks before a PR is opened. See [architecture.md](architecture_EN.md#6-quality-gates). | | Key role | `coder` (writes the main code), `judge` (scores), `scan` (looks for problems). | | F6 failover | Move to the next provider when a quota runs out. | | `ai-task` | An issue the agent will pick up. | @@ -81,8 +81,8 @@ If you run `python -m auto_dev_crew --loop` from a terminal, the GUI sees that r - `python scripts/gui_smoke.py`: read-only check that the page loads with no JavaScript errors. The GUI must be running and slots must be idle. - `python scripts/gui_e2e.py --repo OWNER/NAME`: presses the run button in a dry run. Use a test repository only, and run only when slots are idle. -Details: [tools-and-scripts.md](tools-and-scripts.md). +Details: [tools-and-scripts.md](tools-and-scripts_EN.md). ## 7. Known limitations -See [troubleshooting.md](troubleshooting.md#2-known-limitations). +See [troubleshooting.md](troubleshooting_EN.md#2-known-limitations). diff --git a/docs/gui.md b/docs/gui_TH.md similarity index 95% rename from docs/gui.md rename to docs/gui_TH.md index a89bbd3..d3f93fd 100644 --- a/docs/gui.md +++ b/docs/gui_TH.md @@ -34,8 +34,8 @@ GUI เป็นเว็บเซิร์ฟเวอร์ในเครื - สั่ง AI แก้โค้ดใน repo ที่เลือก - ดู diff ที่ได้ - หา `[AI-TODO]` และสร้าง issue จากผล -- สแกนลึก (deep-scan) ดู [architecture.md](architecture.md#10-deep-scan) -- แผนฟีเจอร์ (`ai-plan`) ดู [github-workflow.md](github-workflow.md#4-แผนฟีเจอร์-ai-plan) +- สแกนลึก (deep-scan) ดู [architecture.md](architecture_TH.md#10-deep-scan) +- แผนฟีเจอร์ (`ai-plan`) ดู [github-workflow.md](github-workflow_TH.md#4-แผนฟีเจอร์-ai-plan) ### 2.4 คีย์ AI (Keys) - ดูและเพิ่มคีย์ของผู้ให้บริการ @@ -43,7 +43,7 @@ GUI เป็นเว็บเซิร์ฟเวอร์ในเครื - ลำดับสำรอง (failover) ของ engine - ประวัติการใช้งานล่าสุดต่อวัน (จาก `state/usage.jsonl`) -รายละเอียดที่ [providers-and-keys.md](providers-and-keys.md) +รายละเอียดที่ [providers-and-keys.md](providers-and-keys_TH.md) ### 2.5 ตั้งค่า (Settings) - โหมด merge (`review-all`, `small-only`, `merge-all`) @@ -59,7 +59,7 @@ GUI เป็นเว็บเซิร์ฟเวอร์ในเครื |---|---| | ช่อง (slot) | ตัวทำงานหนึ่งตัว ทำงานพร้อมกันได้ 3 ช่อง | | judge | AI ที่ให้คะแนนโค้ดก่อนเปิด PR ต้องใช้คีย์บทบาท judge | -| ด่านตรวจ 1–4 | ขั้นตรวจก่อนเปิด PR ดู [architecture.md](architecture.md#6-ด่านตรวจ) | +| ด่านตรวจ 1–4 | ขั้นตรวจก่อนเปิด PR ดู [architecture.md](architecture_TH.md#6-ด่านตรวจ) | | key role | บทบาทของคีย์: `coder` (เขียนโค้ดหลัก), `judge` (ให้คะแนน), `scan` (สแกนหาปัญหา) | | F6 failover | สลับไปผู้ให้บริการตัวถัดไปเมื่อโควตาหมด | | ai-task | issue ที่เอเจนต์จะหยิบไปทำ | @@ -81,8 +81,8 @@ GUI เป็นเว็บเซิร์ฟเวอร์ในเครื - `python scripts/gui_smoke.py`: อ่านอย่างเดียว ตรวจว่าหน้าโหลดได้โดยไม่มี JS error (ต้องเปิด GUI อยู่และช่องว่าง) - `python scripts/gui_e2e.py --repo OWNER/NAME`: กดปุ่มทำงานแบบ dry-run จริง ใช้ repo ทดสอบเท่านั้น และรันเมื่อช่องว่าง -รายละเอียดที่ [tools-and-scripts.md](tools-and-scripts.md) +รายละเอียดที่ [tools-and-scripts.md](tools-and-scripts_TH.md) ## 7. ข้อจำกัดที่ทราบแล้ว -ดู [troubleshooting.md](troubleshooting.md#2-ข้อจำกัดที่ทราบแล้ว) +ดู [troubleshooting.md](troubleshooting_TH.md#2-ข้อจำกัดที่ทราบแล้ว) diff --git a/docs/en/installation.md b/docs/installation_EN.md similarity index 96% rename from docs/en/installation.md rename to docs/installation_EN.md index 62dcb51..82a94cb 100644 --- a/docs/en/installation.md +++ b/docs/installation_EN.md @@ -53,9 +53,9 @@ The file lives in the project root and has defaults that work out of the box, bu 2. `repos`: the target repositories, in `owner/name` form. 3. `engines`: enable only the engines you have keys or executables for (`enabled: true`). -Every key is explained in [configuration.md](configuration.md). +Every key is explained in [configuration.md](configuration_EN.md). -**Caution:** `config.yaml` is no longer tracked by git (removed from the index in `6d9e186`). Use `config.example.yaml` as the template and keep owner-specific values on your machine only. See [troubleshooting.md](troubleshooting.md#2-known-limitations). +**Caution:** `config.yaml` is no longer tracked by git (removed from the index in `6d9e186`). Use `config.example.yaml` as the template and keep owner-specific values on your machine only. See [troubleshooting.md](troubleshooting_EN.md#2-known-limitations). ## 5. Set API keys @@ -87,7 +87,7 @@ Then check system health from the GUI (`/api/doctor`) or the **Settings** page. python -m auto_dev_crew.gui ``` -This opens `http://127.0.0.1:8765/` automatically. See [gui.md](gui.md). +This opens `http://127.0.0.1:8765/` automatically. See [gui.md](gui_EN.md). On Windows you can also double-click `start-auto-dev-crew.bat`. It starts the GUI in a minimized window. If the server is already running, it just opens the page. diff --git a/docs/installation.md b/docs/installation_TH.md similarity index 97% rename from docs/installation.md rename to docs/installation_TH.md index a494427..39de2d7 100644 --- a/docs/installation.md +++ b/docs/installation_TH.md @@ -53,9 +53,9 @@ python -m playwright install chromium 2. `repos` เป็นรายชื่อ repo เป้าหมาย รูปแบบ `owner/name` 3. `engines` เปิดใช้ engine ที่มีคีย์หรือไฟล์จริง (`enabled: true`) -รายละเอียดทุกคีย์อยู่ที่ [configuration.md](configuration.md) +รายละเอียดทุกคีย์อยู่ที่ [configuration.md](configuration_TH.md) -**ข้อควรระวัง:** `config.yaml` ไม่ได้ถูก track ใน git แล้ว (ลบออกจากดัชนีใน `6d9e186`) ใช้ `config.example.yaml` เป็นต้นแบบและเก็บค่าเฉพาะของเจ้าของไว้ในเครื่อง ดู [troubleshooting.md](troubleshooting.md#2-ข้อจำกัดที่ทราบแล้ว) +**ข้อควรระวัง:** `config.yaml` ไม่ได้ถูก track ใน git แล้ว (ลบออกจากดัชนีใน `6d9e186`) ใช้ `config.example.yaml` เป็นต้นแบบและเก็บค่าเฉพาะของเจ้าของไว้ในเครื่อง ดู [troubleshooting.md](troubleshooting_TH.md#2-ข้อจำกัดที่ทราบแล้ว) ## 5. ตั้งคีย์ API @@ -87,7 +87,7 @@ python -m auto_dev_crew --dry-run python -m auto_dev_crew.gui ``` -เปิด `http://127.0.0.1:8765/` อัตโนมัติ ดูรายละเอียดที่ [gui.md](gui.md) +เปิด `http://127.0.0.1:8765/` อัตโนมัติ ดูรายละเอียดที่ [gui.md](gui_TH.md) บน Windows ดับเบิลคลิก `start-auto-dev-crew.bat` ก็ได้ สคริปต์จะเปิด GUI ในหน้าต่างย่อ และถ้า server ทำงานอยู่แล้วจะเปิดเฉพาะหน้าเว็บ diff --git a/docs/en/providers-and-keys.md b/docs/providers-and-keys_EN.md similarity index 100% rename from docs/en/providers-and-keys.md rename to docs/providers-and-keys_EN.md diff --git a/docs/providers-and-keys.md b/docs/providers-and-keys_TH.md similarity index 100% rename from docs/providers-and-keys.md rename to docs/providers-and-keys_TH.md diff --git a/docs/superpowers/plans/2026-11-18-github-docs.md b/docs/superpowers/plans/2026-11-18-github-docs.md new file mode 100644 index 0000000..60168be --- /dev/null +++ b/docs/superpowers/plans/2026-11-18-github-docs.md @@ -0,0 +1,345 @@ +# github-docs Skill Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** Build the `github-docs` skill: it writes and checks README, user guide, About text, and release notes in Thai and English, verifies each claim against the code, and hands off a PR only after the user approves. + +**Architecture:** One skill folder with a workflow in `SKILL.md`, reference files per document type, and four stdlib-only Python checkers. Each checker is a small CLI that exits 0 on pass and 1 with a report on failure. + +**Tech Stack:** Python 3 standard library only (`unittest`, `re`, `pathlib`, `subprocess`), Markdown. + +**Spec:** [docs/superpowers/specs/2026-11-18-github-docs-design.md](../specs/2026-11-18-github-docs-design.md) + +## Global Constraints + +- Python standard library only; no `pip install` in any task. +- Documents are Thai and English. Thai file names: `README_TH.md`. +- Release notes: under 2000 characters; a `Breaking Changes` heading is always present, even when empty. +- No commit, push, PR, merge, or release-asset replacement without the user's explicit instruction. +- Do not copy code or text from doc-drift-detector (MIT + Commons Clause) or travcunn/diataxis-skill (CC BY-SA 4.0). +- Skill location is open (spec section 11, item 1). Tasks 1-7 build in `auto-dev-crew-clean/skills/github-docs/`; Task 8 moves or syncs it to the chosen location. + +## Review Focus + +1. **Thai UTF-8 with BOM or CRLF (Windows)**: the checkers must read `README_TH.md` written by Windows editors and still match headings and links. Test in Task 5. +2. **Windows path separators in links**: `docs\guide.md` or `..\x` in Markdown links must resolve like `/`. Test in Task 2. +3. **Links inside fenced code blocks**: examples in code must not count as broken links. Test in Task 2. +4. **Repo without git tags or PR history**: release-notes flow must stop with a clear message, not guess a range. Test in Task 4. +5. **Claim that matches a word, not a symbol**: `port` in prose must not count as a claim that the code defines it. Test in Task 3. + +## File Structure + +- Create: `skills/github-docs/SKILL.md` — workflow (spec 7.2) +- Create: `skills/github-docs/references/{readme,user-guide,release-notes,about-text,diataxis}.md` +- Create: `skills/github-docs/scripts/{check_links,check_claims,check_release_notes,check_bilingual}.py` +- Create: `skills/github-docs/tests/test_*.py` — one test module per script +- Create: `skills/github-docs/scripts/_md.py` — shared Markdown helpers (fence stripping, heading list, link extraction, UTF-8 BOM-safe read) + +--- + +### Task 1: Shared Markdown helpers + +**Files:** +- Create: `skills/github-docs/scripts/_md.py` +- Test: `skills/github-docs/tests/test_md.py` + +**Interfaces:** +- Produces: `read_text(path: Path) -> str` (strips UTF-8 BOM, normalises CRLF to LF); `strip_fences(text: str) -> str` (blanks fenced code blocks, keeps line count); `headings(text: str) -> list[tuple[int, str]]` (level, title, outside fences); `links(text: str) -> list[tuple[int, str]]` (line number, target, outside fences). + +- [ ] **Step 1: Write the failing test** + +```python +def test_read_text_strips_bom_and_crlf(tmp_path): + p = tmp_path / "README_TH.md" + p.write_bytes("\ufeff# หัวข้อ\r\n".encode("utf-8")) + assert read_text(p) == "# หัวข้อ\n" + +def test_links_ignore_fenced_blocks(): + text = "[ok](a.md)\n```\n[fake](missing.md)\n```\n" + assert links(text) == [(1, "a.md")] +``` + +- [ ] **Step 2: Run test to verify it fails** + +Run: `python -m unittest skills/github-docs/tests/test_md.py -v` +Expected: FAIL with `ModuleNotFoundError: _md` + +- [ ] **Step 3: Implement the four helpers in `skills/github-docs/scripts/_md.py`** + +Fence detection toggles on lines starting with three backticks or tildes. `strip_fences` replaces fenced lines with empty lines so line numbers stay correct. + +- [ ] **Step 4: Run test to verify it passes** + +Run: `python -m unittest skills/github-docs/tests/test_md.py -v` +Expected: PASS (2 tests) + +- [ ] **Step 5: Commit** — only when the user asks (see Global Constraints). + +--- + +### Task 2: check_links.py + +**Files:** +- Create: `skills/github-docs/scripts/check_links.py` +- Test: `skills/github-docs/tests/test_check_links.py` + +**Interfaces:** +- Consumes: `_md.read_text`, `_md.links`, `_md.headings`. +- Produces: `check_file(md: Path, root: Path) -> list[str]` returning one message per broken link; CLI `python check_links.py ` exits 1 when any message exists. + +- [ ] **Step 1: Write the failing tests** + +```python +def test_missing_relative_file_is_reported(tmp_path): + (tmp_path / "README.md").write_text("[g](docs/guide.md)\n", encoding="utf-8") + msgs = check_file(tmp_path / "README.md", tmp_path) + assert len(msgs) == 1 and "docs/guide.md" in msgs[0] + +def test_windows_separator_resolves(tmp_path): + (tmp_path / "docs").mkdir() + (tmp_path / "docs" / "guide.md").write_text("x", encoding="utf-8") + (tmp_path / "README.md").write_text("[g](docs\\guide.md)\n", encoding="utf-8") + assert check_file(tmp_path / "README.md", tmp_path) == [] + +def test_missing_anchor_is_reported(tmp_path): + (tmp_path / "README.md").write_text("# Title\n[x](#nope)\n", encoding="utf-8") + assert len(check_file(tmp_path / "README.md", tmp_path)) == 1 + +def test_link_in_code_fence_is_ignored(tmp_path): + (tmp_path / "README.md").write_text("```\n[x](missing.md)\n```\n", encoding="utf-8") + assert check_file(tmp_path / "README.md", tmp_path) == [] + +def test_external_urls_are_skipped(tmp_path): + (tmp_path / "README.md").write_text("[x](https://example.com/a)\n", encoding="utf-8") + assert check_file(tmp_path / "README.md", tmp_path) == [] +``` + +- [ ] **Step 2: Run test to verify it fails** + +Run: `python -m unittest skills/github-docs/tests/test_check_links.py -v` +Expected: FAIL with `ImportError: check_links` + +- [ ] **Step 3: Implement `check_file` and the CLI** + +Replace `\` with `/` before resolving. Skip `http(s)://`, `mailto:`. For `#anchor`, compare with GitHub-style slugs of the file's own headings (lowercase, spaces to `-`, drop punctuation except `-` and `_`; Thai characters kept). + +- [ ] **Step 4: Run test to verify it passes** + +Run: `python -m unittest skills/github-docs/tests/test_check_links.py -v` +Expected: PASS (5 tests) + +- [ ] **Step 5: Commit** — only when the user asks. + +--- + +### Task 3: check_claims.py + +**Files:** +- Create: `skills/github-docs/scripts/check_claims.py` +- Test: `skills/github-docs/tests/test_check_claims.py` + +**Interfaces:** +- Consumes: `_md.read_text`, `_md.strip_fences`. +- Produces: `extract_claims(text: str) -> list[Claim]` where `Claim` is `(line: int, kind: str, value: str)`, kind is `path` or `command`; `find_evidence(claim, repo: Path) -> str | None` returns `path:line` or `None`; CLI prints `claim -> path:line` or `UNSUPPORTED`, and exits 1 on any unsupported claim. + +Only inline code spans are claims (backticks). Prose words are not claims. A `path` claim is a span containing `/` or `\` or ending in a known extension (`.py .md .json .ps1 .bat .toml .yml`). A `command` claim is a span starting with `python`, `npm`, `git`, `gh`, or `./`. + +- [ ] **Step 1: Write the failing tests** + +```python +def test_inline_path_is_extracted_and_prose_is_not(): + claims = extract_claims("Run `scripts/run.py` to start. The port is important.\n") + assert [(c.kind, c.value) for c in claims] == [("path", "scripts/run.py")] + +def test_path_with_evidence(tmp_path): + (tmp_path / "scripts").mkdir() + (tmp_path / "scripts" / "run.py").write_text("x\ny\n", encoding="utf-8") + assert find_evidence(Claim(1, "path", "scripts/run.py"), tmp_path) == "scripts/run.py:1" + +def test_missing_path_is_unsupported(tmp_path): + assert find_evidence(Claim(1, "path", "scripts/nope.py"), tmp_path) is None + +def test_windows_path_claim_resolves(tmp_path): + (tmp_path / "packaging").mkdir() + (tmp_path / "packaging" / "build.ps1").write_text("x", encoding="utf-8") + assert find_evidence(Claim(1, "path", "packaging\\build.ps1"), tmp_path) is not None + +def test_fenced_span_is_not_a_claim(): + assert extract_claims("```\n`scripts/run.py`\n```\n") == [] +``` + +- [ ] **Step 2: Run test to verify it fails** + +Run: `python -m unittest skills/github-docs/tests/test_check_claims.py -v` +Expected: FAIL with `ImportError: check_claims` + +- [ ] **Step 3: Implement extraction, evidence lookup, and CLI** + +For `command` claims, evidence is the first file under `repo` whose name matches the script in the command (e.g., `tests/test_launcher.py`). If none, report `UNSUPPORTED`. Keep command checks shallow; do not execute anything. + +- [ ] **Step 4: Run test to verify it passes** + +Run: `python -m unittest skills/github-docs/tests/test_check_claims.py -v` +Expected: PASS (5 tests) + +- [ ] **Step 5: Commit** — only when the user asks. + +--- + +### Task 4: check_release_notes.py + +**Files:** +- Create: `skills/github-docs/scripts/check_release_notes.py` +- Test: `skills/github-docs/tests/test_check_release_notes.py` + +**Interfaces:** +- Consumes: `_md.read_text`, `_md.headings`. +- Produces: `check_notes(text: str) -> list[str]` (empty list means pass); CLI `python check_release_notes.py `. Also `range_from_tags(repo: Path) -> tuple[str, str] | None` that returns `None` when the repo has fewer than two tags, with a message telling the user to supply the range manually. + +- [ ] **Step 1: Write the failing tests** + +```python +def test_long_notes_fail(): + assert any("2000" in m for m in check_notes("# v1\n" + "a" * 2001 + "\n## Breaking Changes\n- none\n")) + +def test_missing_breaking_heading_fails(): + assert any("Breaking Changes" in m for m in check_notes("# v1\n- fix\n")) + +def test_thai_notes_counted_by_characters_pass(): + assert check_notes("# v1\n## Breaking Changes\n- ไม่มี\n") == [] + +def test_range_from_tags_returns_none_with_fewer_than_two_tags(tmp_path, monkeypatch): + monkeypatch.setattr("check_release_notes._git_tags", lambda repo: ["v1.0.0"]) + assert range_from_tags(tmp_path) is None +``` + +- [ ] **Step 2: Run test to verify it fails** + +Run: `python -m unittest skills/github-docs/tests/test_check_release_notes.py -v` +Expected: FAIL with `ImportError: check_release_notes` + +- [ ] **Step 3: Implement `check_notes`, `range_from_tags`, `_git_tags` (wraps `git tag --sort=-creatordate`), and the CLI** + +- [ ] **Step 4: Run test to verify it passes** + +Run: `python -m unittest skills/github-docs/tests/test_check_release_notes.py -v` +Expected: PASS (4 tests) + +- [ ] **Step 5: Commit** — only when the user asks. + +--- + +### Task 5: check_bilingual.py + +**Files:** +- Create: `skills/github-docs/scripts/check_bilingual.py` +- Test: `skills/github-docs/tests/test_check_bilingual.py` + +**Interfaces:** +- Consumes: `_md.read_text`, `_md.headings`, `_md.links`. +- Produces: `compare(en: Path, th: Path) -> list[str]` comparing heading levels in order and link targets in order; CLI `python check_bilingual.py `. + +- [ ] **Step 1: Write the failing tests** + +```python +def test_same_structure_passes(tmp_path): + en = tmp_path / "README.md"; th = tmp_path / "README_TH.md" + en.write_text("# A\n## B\n[x](a.md)\n", encoding="utf-8") + th.write_text("\ufeff# ก\r\n## ข\r\n[x](a.md)\r\n", encoding="utf-8") + assert compare(en, th) == [] + +def test_missing_heading_in_thai_fails(tmp_path): + en = tmp_path / "README.md"; th = tmp_path / "README_TH.md" + en.write_text("# A\n## B\n", encoding="utf-8") + th.write_text("# ก\n", encoding="utf-8") + assert any("heading" in m for m in compare(en, th)) + +def test_link_target_mismatch_fails(tmp_path): + en = tmp_path / "README.md"; th = tmp_path / "README_TH.md" + en.write_text("[x](docs/a.md)\n", encoding="utf-8") + th.write_text("[x](docs/b.md)\n", encoding="utf-8") + assert any("link" in m for m in compare(en, th)) +``` + +- [ ] **Step 2: Run test to verify it fails** + +Run: `python -m unittest skills/github-docs/tests/test_check_bilingual.py -v` +Expected: FAIL with `ImportError: check_bilingual` + +- [ ] **Step 3: Implement `compare` and the CLI** + +- [ ] **Step 4: Run test to verify it passes** + +Run: `python -m unittest skills/github-docs/tests/test_check_bilingual.py -v` +Expected: PASS (3 tests) + +- [ ] **Step 5: Commit** — only when the user asks. + +--- + +### Task 6: SKILL.md and reference files + +**Files:** +- Create: `skills/github-docs/SKILL.md` +- Create: `skills/github-docs/references/readme.md`, `user-guide.md`, `release-notes.md`, `about-text.md`, `diataxis.md` + +**Interfaces:** +- Consumes: the four CLIs from Tasks 2-5 (names and exit codes exactly as above). +- Produces: nothing for code; the workflow steps the agent follows. + +- [ ] **Step 1: Check frontmatter with a one-off command** + +Run: `python -c "import pathlib,re; t=pathlib.Path('skills/github-docs/SKILL.md').read_text(encoding='utf-8'); assert re.match(r'^---\nname: github-docs\ndescription: .+\n---', t), 'bad frontmatter'; print('ok')"` +Expected: `ok` (this step fails until Step 2 is done) + +- [ ] **Step 2: Write `SKILL.md`** with frontmatter (`name: github-docs`, one-line `description` that says when to use it), then the seven workflow steps from spec 7.2, the four check commands, and the rule that PR and release steps wait for user approval. Keep it under 150 lines; put detail in references. + +- [ ] **Step 3: Write the five reference files.** Each one covers one doc type: section order, required headings, and what counts as evidence. `diataxis.md` is used only when the user asks for Diátaxis structure. + +- [ ] **Step 4: Run the Step 1 command again** + +Expected: `ok` + +- [ ] **Step 5: Commit** — only when the user asks. + +--- + +### Task 7: Dry run on a real repo + +**Files:** +- None created. Output goes to the chat report only. + +**Interfaces:** +- Consumes: all four CLIs and the SKILL.md workflow. + +- [ ] **Step 1: Run the four checks against `C:\Users\Smart\Documents\DATAelectricWORKs`** (read-only; no files written there) + +Run: `python skills/github-docs/scripts/check_links.py C:/Users/Smart/Documents/DATAelectricWORKs` +Run: `python skills/github-docs/scripts/check_bilingual.py C:/Users/Smart/Documents/DATAelectricWORKs/README.md C:/Users/Smart/Documents/DATAelectricWORKs/README_TH.md` +Expected: each exits 0, or lists specific real problems to report. Do not fix the target repo. + +- [ ] **Step 2: Report results** to the user with the exact output. Mark anything not checked (for example, command claims) as not verified. + +--- + +### Task 8: Install into the chosen location and verify catalog search + +**Files:** +- Depends on the user's answer to spec section 11, item 1. + +**Interfaces:** +- Consumes: the finished folder from Tasks 1-7. + +- [ ] **Step 1: Ask the user** where the skill lives (local `~/.claude/skills` or catalog checkout `C:\Users\Smart\Documents\ChatGPT\test`). Do not guess. + +- [ ] **Step 2: Copy the folder to that location** and, for the catalog, run `scripts/sync_local_skills.py` from that checkout. + +- [ ] **Step 3: Verify.** Run `search_skills` for "github docs README" and confirm `github-docs` appears. Report found, loaded, and tested as three separate lines. Searching only proves found. + +--- + +## Self-Review Notes + +- Spec coverage: sections 7.1-7.4 map to Tasks 1-6; section 9 testing maps to each task's tests and Task 7; section 11 items map to Task 8 and the Global Constraints note. +- Types: `Claim(line, kind, value)`, `check_file`, `check_notes`, `range_from_tags`, and `compare` are used with the same names in every task that references them. +- Review Focus lines each have a test in their owning task (Tasks 5, 2, 2, 4, 3). diff --git a/docs/superpowers/specs/2026-11-18-github-docs-design.md b/docs/superpowers/specs/2026-11-18-github-docs-design.md new file mode 100644 index 0000000..855ef34 --- /dev/null +++ b/docs/superpowers/specs/2026-11-18-github-docs-design.md @@ -0,0 +1,137 @@ +# Design: github-docs skill (Library Router) + +- วันที่: 2026-11-18 +- สถานะ: **ร่าง รอการอนุมัติ** ยังไม่ได้สร้างสกิล ยังไม่ได้ commit +- ที่มา: [STATE-github-docs-skill.md](../../../STATE-github-docs-skill.md) และผลค้นหาสกิลภายนอกในแชทนี้ + +## 1. เจตนาและเหตุผล (Intent) + +เมื่อผู้ใช้สั่งใน Claude Code ว่า "เขียนเอกสาร" ให้ repo หนึ่ง เอเจนต์มักเขียนจากความจำหรือเดา ทำให้ลิงก์พัง คำสั่งไม่ตรงกับโค้ด และ README ภาษาไทยกับอังกฤษไม่ตรงกัน สกิล `github-docs` ต้องทำให้ทุกข้อความในเอกสารมีที่มาในโค้ด ตรวจได้ด้วยสคริปต์ และส่งต่อเป็น PR โดยผู้ใช้อนุมัติก่อนทุกขั้นที่ส่งผลออกนอกเครื่อง + +## 2. เป้าหมาย (Goals) + +1. สร้างหรือปรับ README, คู่มือผู้ใช้, About text, และ release notes ของ repo ได้ +2. เขียนคู่ภาษาไทยและอังกฤษ โดยให้โครงสร้างและลิงก์ตรงกัน +3. ทุก claim เชิงข้อเท็จจริง (คำสั่ง, path, พอร์ต, ชื่อฟังก์ชัน, ค่าเริ่มต้น) ต้องชี้ไปยังไฟล์และบรรทัดในโค้ดได้ +4. ตรวจลิงก์เสียและความยาว release notes ด้วยสคริปต์ +5. ผ่านกระบวนการ outline → อนุมัติ → เขียน → ตรวจ → รายงาน → PR + +## 3. ไม่ทำ (Non-goals) + +- ไม่สร้าง Diátaxis scaffolding ทั้งสี่โฟลเดอร์โดยอัตโนมัติ (ตามที่ Roritharr/diataxis-skill ระบุว่าไม่ควรทำ) +- ไม่แปลเอกสารเป็นภาษาอื่นนอกจากไทยและอังกฤษ +- ไม่ publish release และไม่ merge PR เอง +- ไม่ดาวน์โหลดหรือรันซอฟต์แวร์จาก catalog ตามกฎ Library Router + +## 4. ข้อห้าม (Anti-goals) + +ถ้าเกิดเหตุการณ์ต่อไปนี้ ถือว่าสกิลล้มเหลวแม้ไฟล์จะถูก: + +- เขียนคำสั่งหรือ path ที่รันไม่ได้โดยไม่มีการตรวจกับโค้ด +- แก้ไฟล์ release asset หรือ merge PR โดยไม่ได้รับคำสั่งจากผู้ใช้ +- เขียนทับ `CHANGELOG.md` หรือเอกสารเดิมโดยไม่แจ้ง +- ใส่ลิงก์ PR ที่สืบย้อนไม่ได้ว่าเป็นของ commit นั้นจริง + +## 5. ข้อจำกัด (Constraints) + +- Library Router: สถานะ `checked` หมายถึงผ่านการตรวจแบบ static เท่านั้น ไม่ใช่ผ่านการทดสอบการใช้งานจริง +- ใช้ไลเซนส์ที่ยืนยันแล้วเท่านั้น ห้ามคัดลอกโค้ดหรือเนื้อหาจาก doc-drift-detector (MIT + Commons Clause) และ travcunn/diataxis-skill (CC BY-SA 4.0) ให้อ้างอิงแนวคิดแล้วเขียนเอง +- สคริปต์ตรวจต้องใช้ Python standard library อย่างเดียว เพื่อไม่ต้องติดตั้งเพิ่ม +- ไม่ commit หรือ push จนกว่าผู้ใช้จะสั่ง +- ไม่ใส่ path ส่วนตัวของผู้ใช้ลงในผลลัพธ์ที่จะ publish + +## 6. แนวทางที่พิจารณา (Approaches) + +| แนวทาง | ข้อดี | ข้อเสีย | +|---|---|---| +| **A. สกิลกว้างหนึ่งตัว + ไฟล์ reference ต่อประเภทเอกสาร** | ใช้ง่าย มี workflow เดียว แชร์สคริปต์ตรวจร่วมกัน | SKILL.md ต้องกระชับ ต้องแยกเนื้อหาไปไว้ใน references | +| B. ตระกูลสกิลแยกตามประเภท (readme-, release-, about-) | แต่ละตัวเล็ก | ผู้ใช้ต้องเลือกเอง และตรวจซ้ำในหลายที่ | +| C. ห่อสกิลภายนอกตัวเดียว (เช่น awesome-copilot) | ติดตั้งไวที่สุด | ไม่มีการตรวจ claim และไม่มี PR flow ซึ่งเป็นเป้าหมายหลัก | + +**ที่เลือก: A** เพราะตรงกับการตัดสินใจที่บันทึกไว้ใน STATE เดิม และเป็นทางเดียวที่รวมการตรวจกับ PR flow ไว้ในที่เดียว ผู้ใช้ยังไม่ได้ยืนยันการเลือกนี้ในแชท จึงถือเป็น **ข้อเสนอของผม** ที่ต้องรับการอนุมัติ + +## 7. การออกแบบ (Design) + +### 7.1 โครงสร้างไฟล์ + +``` +github-docs/ +├── SKILL.md # workflow หลัก กระชับ +├── references/ +│ ├── readme.md # โครง README (ผู้ใช้/นักพัฒนา) +│ ├── user-guide.md # คู่มือผู้ใช้ตามภาพหน้าจอและขั้นตอน +│ ├── release-notes.md # เทมเพลต, Breaking Changes, การอ้าง PR +│ ├── about-text.md # About + topics ของ repo +│ └── diataxis.md # ใช้เมื่อผู้ใช้ขอโครงแบบ Diátaxis +└── scripts/ + ├── check_links.py # ลิงก์ภายในและ anchor ที่เสีย + ├── check_claims.py # claim → file:line ที่รองรับ + ├── check_release_notes.py # ความยาว (< 2000 ตัวอักษร) และหมวดหัวข้อ + └── check_bilingual.py # โครงหัวข้อและลิงก์ของคู่ไฟล์ EN/TH ตรงกัน +``` + +`check_bilingual.py` เป็นข้อเสนอของผมที่ไม่ได้อยู่ในแผนเดิม (ดูข้อ 10) + +### 7.2 Workflow + +1. **ระบุประเภทและผู้อ่าน** (Diátaxis ข้อแรก): ถามผู้ใช้เฉพาะเมื่อไม่ชัด เช่น README เพื่อใคร และต้องการภาษาไหน +2. **สำรวจโค้ด** อ่านจุดเข้าใช้งาน, ไฟล์ config, สคริปต์ build, และ test ที่เกี่ยวข้อง ก่อนเขียนอะไรทั้งสิ้น +3. **เสนอ outline แล้วรออนุมัติ** (จาก awesome-copilot) ไม่เขียนเนื้อหาเต็มก่อนผู้ใช้ตอบ +4. **เขียนคู่ภาษา** เช่น `README.md` กับ `README_TH.md` โดยหัวข้อและลิงก์ต้องเท่ากัน +5. **ตรวจ** รันสคริปต์ทั้งสี่ตัว ทุกตัวต้องออก exit 0 หรือรายงานข้อที่ต้องแก้ +6. **รายงาน** แสดงผลตรวจ สิ่งที่ไม่ได้ตรวจ และ claim ที่ยังไม่มีที่มา +7. **PR** สร้างเฉพาะเมื่อผู้ใช้สั่ง ไม่ merge เอง +8. **Release** ไม่แทนที่ asset จนกว่าจะผ่านการ build check และได้รับคำสั่ง + +### 7.3 การตรวจ claim (หัวใจของสกิล) + +- ดึง claim จากเอกสารที่ร่าง เช่น คำสั่ง `python ...`, ชื่อไฟล์, พอร์ต, ค่า default +- ค้นหาในโค้ดแล้วบันทึกคู่ `claim → path:line` +- claim ที่หาไม่เจอ ให้ตกไปที่รายการ "ยังไม่มีที่มา" และบังคับให้ผู้ใช้ตัดสินใจ ไม่ปล่อยผ่านเงียบ ๆ +- ใส่ลิงก์ PR ใน release notes เฉพาะเมื่อ bullet นั้นสืบย้อนไปถึง merge commit ได้ (จาก paperclip) + +### 7.4 Release notes + +- อ่าน PR title ก่อน commit message เมื่อโปรเจกต์ใช้ PR (จาก kangminhyuk) +- มีหมวด Breaking Changes เสมอ แม้จะว่าง (จาก wshobson) +- วางผลลงในแชทเป็น Markdown พร้อมคัดลอก ไม่เขียนทับ `CHANGELOG.md` (จาก ycs77) +- เขียนไฟล์เฉพาะเมื่อผู้ใช้ขอ และไม่ทับไฟล์เดิมโดยไม่ถาม + +## 8. ฟิวชั่นกับแหล่งภายนอก + +| สิ่งที่นำมา | จากไหน | ปรับเป็นอย่างไร | +|---|---|---| +| ระบุประเภทเอกสารก่อนเขียน | Diátaxis ใน awesome-copilot และ Roritharr | เป็นขั้นที่ 1 | +| หยุดรอ outline | awesome-copilot | ตรงกับเกตอนุมัติของเรา | +| ตรวจลิงก์ และ claim กับโค้ด | doc-drift-detector | เขียนเองโดยไม่คัดลอกโค้ด | +| ไม่เขียนทับ ไม่ publish เอง | paperclip release-changelog | เป็นกฎ | +| ลิงก์ PR เฉพาะที่สืบได้ | paperclip | เป็นกฎตรวจ | +| หมวด Breaking Changes | wshobson | อยู่ในเทมเพลต | +| ใช้ PR title | kangminhyuk | อยู่ในขั้นสรุป release | +| คู่ไฟล์ README_TH.md | multi-lang-readme และ readme-bilingual-sync | ตั้งชื่อตามนี้ และเพิ่มการตรวจ parity | + +## 9. การทดสอบ + +- สคริปต์แต่ละตัวมี unit test ด้วย `unittest` พร้อม fixture ของ repo ปลอม ทั้งกรณีผ่านและกรณีเสีย +- ทดลองรันบน `C:\Users\Smart\Documents\DATAelectricWORKs` (โหมด dry run ไม่เขียนไฟล์) เพื่อดูว่าตรวจจับของจริงได้ +- สถานะจะเป็น "ผ่านการตรวจแบบ static" จนกว่าจะรันเอเจนต์จริงกับงานเขียนเอกสารหนึ่งชิ้น ซึ่งยังไม่ได้ทำ + +## 10. ข้อตัดสินใจที่ผมตัดสินเอง (ตรวจได้) + +1. ชื่อไฟล์ไทยเป็น `README_TH.md` (ตามที่ repo DATAelectricWORKs ใช้จริง ปรับตามคำสั่งผู้ใช้ 2026-11-18) +2. เพิ่ม `check_bilingual.py` เพราะคู่ภาษาเป็นข้อกำหนดหลักแต่แผนเดิมไม่มีการตรวจนี้ +3. สกิลไม่เรียกเว็บเอง ใช้เฉพาะโค้ดใน repo และไฟล์ที่ผู้ใช้ชี้มา +4. ใช้ Diátaxis เป็นแนวคิด ไม่คัดลอกเนื้อหาจาก travcunn (CC BY-SA) + +## 11. ข้อที่ต้องให้ผู้ใช้ตัดสิน + +1. **ที่อยู่ของสกิล**: โฟลเดอร์ local ที่สคริปต์ sync อ่าน (เช่น `~/.claude/skills`) หรือ catalog checkout ที่ `C:\Users\Smart\Documents\ChatGPT\test` +2. **แนวทาง**: เห็นด้วยกับแนวทาง A หรือไม่ (ข้อ 6) +3. **ขอบเขต release**: รวม release notes และ About text ในรอบแรก หรือแยกเป็นรอบหลัง +4. **การอนุมัติทีละขั้น**: ต้องการเกต outline ทุกครั้ง หรือเฉพาะงานที่ใหญ่ + +## 12. สิ่งที่ยังไม่ได้ทำ + +- ยังไม่ได้ builder check ด้วย subagent ตามกระบวนการ brainstorming ผู้เขียนอ่านเอกสารนี้เองแล้ว และสรุปเป็นข้อตัดสินใจในข้อ 10 และ 11 +- ยังไม่ได้ commit ไฟล์นี้ +- ยังไม่ได้ตรวจ license และสถานะการดูแลของ Roritharr/diataxis-skill และ multi-lang-readme diff --git a/docs/en/tools-and-scripts.md b/docs/tools-and-scripts_EN.md similarity index 98% rename from docs/en/tools-and-scripts.md rename to docs/tools-and-scripts_EN.md index 89155d6..e0e624d 100644 --- a/docs/en/tools-and-scripts.md +++ b/docs/tools-and-scripts_EN.md @@ -71,7 +71,7 @@ How it works: ```bash python -m pytest -q -p no:cacheprovider ``` -Latest recorded result (2026-11-18): **1442 passed, 6 skipped** (see `STATE.md`). +Latest recorded result (2026-11-18): **1401 passed, 6 skipped** (see `STATE.md`). The `tests/` folder holds about 170 entries, including test files and some support files. diff --git a/docs/tools-and-scripts.md b/docs/tools-and-scripts_TH.md similarity index 99% rename from docs/tools-and-scripts.md rename to docs/tools-and-scripts_TH.md index b3a4f55..ff7ab97 100644 --- a/docs/tools-and-scripts.md +++ b/docs/tools-and-scripts_TH.md @@ -71,7 +71,7 @@ python scripts/autonomous_ctl.py status ```bash python -m pytest -q -p no:cacheprovider ``` -ผลที่บันทึกล่าสุด (2026-11-18): **1442 passed, 6 skipped** (ดู `STATE.md`) +ผลที่บันทึกล่าสุด (2026-11-18): **1401 passed, 6 skipped** (ดู `STATE.md`) โฟลเดอร์ `tests/` มีไฟล์ประมาณ 170 รายการ รวมไฟล์เทสต์และไฟล์สนับสนุนบางตัว diff --git a/docs/en/troubleshooting.md b/docs/troubleshooting_EN.md similarity index 97% rename from docs/en/troubleshooting.md rename to docs/troubleshooting_EN.md index b207fdd..34e3c0a 100644 --- a/docs/en/troubleshooting.md +++ b/docs/troubleshooting_EN.md @@ -43,7 +43,7 @@ The system uses the coder's engine as the judge and records `judge_same_as_coder ### 1.5 The GUI will not start, or the port is busy - Stop the old process using port 8765, or start with `--port`. -- If the GUI freezes, restart it (see [gui.md](gui.md)). +- If the GUI freezes, restart it (see [gui.md](gui_EN.md)). ### 1.6 Changes to `config.yaml` have no effect @@ -84,7 +84,7 @@ Checked against the code as of 2026-11-18. | 7 | `reserve_for_issues` has no effect | The key is in the config, but the running code does not read it (only tests do). | Removed 2026-11-18 | | 8 | Default for `max_fix_attempts` differs from the config | Code uses 2 when unset; the config sets 3. | The config value applies | | 9 | The guard hook does not single out force-push | In autonomous mode it blocks all `git push`. | Intentional or not, not yet decided | -| 10 | Some README wording about branch `self/*` | Agents create branches named `ai/...`. `self/*` is used only in revert plans. | Documentation fixed in the Thai README; English docs follow the code | +| 10 | Some README wording about branch `self/*` | Agents create branches named `ai/...`. `self/*` is used only in revert plans. | Fixed: the docs say `self/*` is used only in revert plans. | | 11 | `merge_level` values 1, 2, 3 | Traced: 1 = human reviews, 2 = auto-merge once CI passes and no risky files, 3 = auto-merge once CI passes. | See architecture §8.1 | | 12 | The GUI is not tested in every browser or screen size | Tested in a local browser only. | Testing limit | | 13 | Gates 1–4 | Traced against the code (see architecture §6). Gate 3 applies to every issue run, and the per-finding create button skips gate 4. | See row 16 | diff --git a/docs/troubleshooting.md b/docs/troubleshooting_TH.md similarity index 98% rename from docs/troubleshooting.md rename to docs/troubleshooting_TH.md index 379cfbf..0013e3e 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting_TH.md @@ -43,7 +43,7 @@ ### 1.5 GUI เปิดไม่ได้ หรือพอร์ตถูกใช้อยู่ - ปิดโปรเซสเก่าที่ใช้พอร์ต 8765 หรือเปิดด้วย `--port` -- ถ้า GUI ค้าง ให้รีสตาร์ท (ดู [gui.md](gui.md)) +- ถ้า GUI ค้าง ให้รีสตาร์ท (ดู [gui.md](gui_TH.md)) ### 1.6 แก้ค่าใน `config.yaml` แล้วไม่มีผล @@ -84,7 +84,7 @@ python scripts/opencode_db_doctor.py --apply # สำรองแล้วซ | 7 | `reserve_for_issues` ไม่มีผล | คีย์นี้อยู่ใน config แต่โค้ดที่ใช้งานจริงไม่อ่าน (พบเฉพาะในเทสต์) | ลบแล้ว (2026-11-18) | | 8 | ค่าเริ่มต้นของ `max_fix_attempts` ไม่ตรงกับ config | โค้ดใช้ 2 ถ้าไม่ระบุ, config ตั้ง 3 | ค่าใน config มีผล | | 9 | `guard hook` ไม่บล็อก force-push เฉพาะ | บล็อก `git push` ทั้งหมดในโหมด autonomous แต่ไม่ได้แยก force-push | ตั้งใจหรือไม่ยังไม่ตัดสิน | -| 10 | ข้อความ README บางข้อเกี่ยวกับ branch `self/*` | เอเจนต์สร้าง branch เป็น `ai/...` ส่วน `self/*` ใช้ใน revert plan เท่านั้น | ต้องแก้เอกสาร | +| 10 | ข้อความ README บางข้อเกี่ยวกับ branch `self/*` | เอเจนต์สร้าง branch เป็น `ai/...` ส่วน `self/*` ใช้ใน revert plan เท่านั้น | แก้แล้ว: เอกสารระบุว่า `self/*` ใช้เฉพาะแผน revert | | 11 | `merge_level` 1/2/3 | ไล่ตรวจแล้ว: 1 = คนรีวิว, 2 = auto-merge เมื่อ CI ผ่านและไม่มีไฟล์เสี่ยง, 3 = auto-merge เมื่อ CI ผ่าน | ดู architecture §8.1 | | 12 | GUI ยังไม่ได้ทดสอบทุกเบราว์เซอร์และทุกขนาดหน้าจอ | ทดสอบบนเบราว์เซอร์ในเครื่องแล้ว | ข้อจำกัดของการทดสอบ | | 13 | ด่านตรวจ 1–4 | ไล่ตรวจกับโค้ดแล้ว (ดู architecture §6) ด่าน 3 ใช้กับทุกการทำงานของ issue และด่าน 4 ไม่รวมปุ่มสร้าง issue ทีละรายการ | ดูแถว 16 |