# 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/