From 40d3b21e71cae8df842d1c657ecd2abe12db3ec8 Mon Sep 17 00:00:00 2001 From: Zhe Yuan Date: Fri, 11 Sep 2026 10:59:41 -0400 Subject: [PATCH] Add AGENTS.md and fill the gaps in the README AGENTS.md describes the project for anyone -- human or agent -- changing a script: what the repository is, where it sits inside the OpenWrt tree, which scripts run from where, the shell conventions the existing code follows, and the bash traps that have already caused bugs here. README: document the options that were missing (--refresh, --skip-defconfig, --extras-file/--no-extras-file, --extras, --wrap), distinguish --extras from --extras-file, and replace the Debian-only Go install line with a distribution-neutral description of how update-go-path.sh finds a toolchain. Drop the hedged MIT claim, since no LICENSE file exists. Both documents stay environment-neutral: no absolute home paths and no assumption of a distribution, with platform-specific advice kept under an explicit conditional heading. Co-Authored-By: Claude Opus 5 --- AGENTS.md | 149 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 32 +++++++++--- 2 files changed, 173 insertions(+), 8 deletions(-) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..16bb7a5 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,149 @@ +# AGENTS.md + +Guidance for coding agents working in this repository. + +## What this is + +A set of Bash scripts that automate building OpenWrt from source: install the +host dependencies, fetch the source tree, import a device's official +configuration, and apply a per-device package list. + +There is no build system, no test suite and no dependency manifest. The +deliverable *is* the scripts. Everything is plain Bash plus `curl`/`wget`, +`git`, `awk`, `sed` and `python3` (only for reading JSON — `jq` is deliberately +not required). + +The governing design rule: **a new OpenWrt release must not require editing any +file here.** Anything version specific is fetched from `downloads.openwrt.org` +at run time; only the user's own package choices are stored in git. Reject +changes that would reintroduce a version-pinned file, a hardcoded device table +or a copied-in package list. + +## Repository layout + +This repository is `helper/` *inside* an OpenWrt source tree. `prepare-openwrt.sh` +puts it there on first run: + +``` +/openwrt/ OpenWrt source root (not this repository) +/openwrt/helper/ this repository +/openwrt-build-helper symlink to openwrt/helper, for stale shells +``` + +``` +helper/ + *.sh the scripts + lib-openwrt-upstream.sh shared library, sourced not executed + packages/.txt tracked: the user's packages for one device + .generated/ ignored: combined lists, saved buildinfo + README.md user-facing documentation +``` + +`` is the official OpenWrt profile id (`linksys_mx8500`), so the +filename, the `--device` argument and upstream's `profiles.json` key are always +the same string. + +## Where the scripts run from + +Two groups, and mixing them up is the most common mistake: + +- `prepare-openwrt-env.sh` and `prepare-openwrt.sh` run from **this directory**; + they exist to create the OpenWrt tree, so they cannot assume one. +- Everything else runs from the **OpenWrt root** (`./helper/