↵select↑↓navigateescclose
Search frappe-nix

App standards

Interface spec

The contract the app standards are built to: managed files, profiles, CI gates, tools, versioning and acceptance tests.

Updated
Tags
  • app-standards
  • spec
On this page

App Standards and Quality Gates: Interface Spec (frappe-nix v1)

  • Spec version: 1.2, 2026-10-07. This is 1.1 with two changes: every internal name is replaced by a neutral one (S33), and the standards are opt-in and profile-driven (S34–S38, §8). The spec covers frappe-nix v1.x, [tool.frappe-nix] schema = 1 and profile schema = 1.

  • Inputs:

    • the approved internal project plan (D1–D16, Phases 1 and 1.5, §6, and §7 including the 2026-10-07 defaults). "Plan §N" below refers to that plan, never to this spec;

    • the Phase 0 track results (p0-results.json);

    • carbon_frappe on PR #53;

    • frappe-nix main at 9e63c96;

    • docusystem v0.1.0;

    • the in-progress frappe-types worktrees (feat/presets-and-jsdoc, feat/gen-doctypes-and-drift-ci).

  • Audience:

    • the agents implementing frappe-nix PRs N1–N6 in parallel, and the profile repository P;

    • anyone using frappe-nix app mode, inside or outside Avunu;

    • the 12 Avunu app migrations, which are the first adopters and the worked example.

  • Normative language: MUST, MUST NOT, SHOULD and MAY are used as in RFC 2119. "Render" means "produce with the template engine in §3". "The app" means a Frappe app repository in frappe-nix app mode. <app> is its Python package name, <App-hyphen> is that name with _ replaced by -, and <major> is the Frappe major (16 in the examples).

  • Opted-in app. An app is opted in when its pyproject.toml has a [tool.frappe-nix] table (S35). Everything in §2–§5 applies only to opted-in apps, and within one only to the modules its resolved profile enables (§8). Without the table, frappe-init behaves exactly as it does in frappe-nix main today.

  • Built-in and org values. frappe-nix itself carries only vendor-neutral values. Organisation values (publisher, contact e-mail, copyright holder, licence, brand colour, URL templates, GitHub owner, registry fork, README badges and links) come from a profile or the app's config (S37). Where this spec names an Avunu value, the text says "Avunu profile" or "Avunu fleet": those values live in Avunu/frappe-standards-profile (§8.6), not in frappe-nix.


0. Decisions this spec makes

These either settle points the plan leaves open or resolve contradictions the Phase 0 tracks found. Every later section assumes them. S1–S32 are from 1.1, reworded only where the profile model changes them; S33–S43 are new in 1.2. A decision about a module applies only while that module is enabled (§8.2).

#DecisionWhy
S1ruff is pinned once, in tools/uv.lock. It runs as repo: local hooks through uv run --frozen --project tools ruff …. The remote astral-sh/ruff-pre-commit hook is forbidden in apps.The ssort-prek track found D3 and A.4 contradict each other. The uv lock is what carbon_frappe already uses, and one pin then serves the hook, CI, yarn lint:py and editors. dependabot uv (/tools) is the single mover, so a remote rev and a lock can never disagree. All write-mode hooks give the ssort → isort → lint → format order D4 needs. To keep it the only ruff in an opted-in app, N1's ensure-root (lib/frappe-workspace.py, which adds ruff>=0.15.0, pre-commit>=4.5.1 and semgrep to a new root's dev group today) drops each of the three from the generated app-mode root only when the app's tracked tools/pyproject.toml pins its replacement: ruff when it lists ruff, semgrep when it lists semgrep, pre-commit when it lists prek. That file exists only in an opted-in app with those modules on (§2.15). Every other root keeps them: a non-opted-in app-mode root, every bench-mode root, and templates/bench/pyproject.toml, from which N1 removes nothing (it only adds coverage and unittest-xml-reporting, which frappe-test needs; S35).
S2ssort stays a remote hook. It is bwhmather/ssort with rev floor 0.17.0, language_version: python3.14, and the narrow exclude '/doctype/([^/]+)/\1\.py$'. dependabot pre-commit moves it.This is D3 and A.4 as written. prek 0.5.5 accepts the backreference (ssort-prek track).
S3The required check contexts are fixed names, one per gate: ci / pr-policy, ci / lint, ci / typecheck, ci / test and ci / marketplace, each with integration_id: 15368. An app requires exactly the contexts of the gates its profile enables (S39); a context's name never depends on which other gates are on.A job of a reusable workflow reports as <caller job> / <job name> (github-capabilities track). Every caller job that calls an app-*.yml gate carries name: ci, and every reusable job name equals the gate's name.
S4pr-policy has its own caller file (.github/workflows/pr-policy.yml), separate from ci.yml.It must re-run on edited, when a PR is retitled. If ci.yml itself re-ran on edited and skipped test, the skipped ci / test would replace an earlier failure, and GitHub treats skipped as passing.
S5frappe-nix reaches an app with CI callers through frappe-nix's rollout.yml (§5.8): after each release it opens one PR per consumer on the branch standards/frappe-nix, with the Avunu Release Manager GitHub App's token (Workflows write; its key is an environment secret of frappe-nix's frappe-nix-rollout environment and nothing else), and only after frappe-nix ci verify-rollout-patch accepted the patch. The consumers are the ones the frappe-nix variable FRAPPE_NIX_ROLLOUT_REPOS names, a subset of the fleet list. frappe-nix repo rollout (or the equivalent manual nix flake update frappe-nix && frappe-init --sync commit), made with the user's gh token (scope workflow), is the manual fallback, run by hand only. An org profile input moves by hand that way (S38). The app's flake input is github:Avunu/frappe-nix/release. frappe-init --sync rewrites the caller workflows' uses: …@<sha> # vX.Y.Z from flake.lock. Both dependabot entries ignore frappe-nix: github-actions ignores Avunu/frappe-nix and Avunu/frappe-nix/* (Dependabot names a reusable workflow by its path), and nix ignores the input frappe-nix. A github-actions PR that moves only frappe-nix pins is closed (§4.5). Dependabot nix still moves frappe and the siblings, which never touch a workflow file. No app workflow ever pushes a commit that changes .github/workflows/* (S29); rollout.yml's publish job, in frappe-nix, is the one workflow that does.This changes D9 on purpose. A frappe-nix bump has to rewrite the caller SHAs, and GitHub refuses a GITHUB_TOKEN push that creates or changes a workflow file ("refusing to allow a GitHub App to create or update workflow … without workflows permission"). permissions: can't grant that scope, so relock-push could never finish a frappe-nix bump. One pin plus sync still keeps the workflow SHA and the tool versions identical by construction. The nightly drift job and audit row A10 report when an app is behind. rollout.yml automates the bump without a PAT: the token that may change workflow files is the App's, minted in frappe-nix for one consumer at a time, in a job that never runs the app's code, after the patch was checked against the tag's own render.
S6frappe-nix stays on main. Its releases are tags vX.Y.Z, and one moving branch, release, is fast-forwarded to every new tag, whatever its major.Apps need a ref that only moves on a release, so an update proposes releases rather than every main commit. release carries every release, a major one too: an app is protected by its pinned flake.lock and by the rollout PR's checks (§5.8), not by the branch name. frappe-nix has no Frappe major to track, so version-* branches have no meaning for it.
S7App parameters live in [tool.frappe-nix] in the app's pyproject.toml. Facts that can be read from the tracked tree are discovered at sync time, never declared (§2.2).This keeps one file, and A.3 already puts the override allow-list in pyproject. The registry and pilot ignore unknown tool.* tables.
S8Managed files use one of five strategies (§3.2): whole, whole with local regions, toml-merge, json-merge, seed and blocks. JSON and JSONC tool configs are customised only through [tool.frappe-nix.<tool>] parameters, never through text regions.Text regions inside JSON need trailing-comma tolerance that oxlint's parser doesn't promise. Parameters can be validated.
S9Versions moved by dependabot are floors, not values. These are pre-commit rev:s of third-party hooks, the toolchain devDependencies ranges, the versions in tools/uv.lock, and third-party uses: SHAs in caller files. Sync never lowers one and --check accepts anything at or above the floor.Otherwise every dependabot bump is drift, and sync reverts it.
S10One self-contained Python package, frappe-nix-tools (import name frappe_nix_tools, CLI frappe-nix), lives at frappe-nix/py/frappe_nix_tools. It serves both sides. Every data file it reads ships inside the package, under py/frappe_nix_tools/frappe_nix_tools/data/: the built-in profiles, the templates, manifest fragments, README templates, node-lock seeds, known-apps.json, the schemas and the semgrep rules. It reads them through importlib.resources. In the Nix dev shell it is built by lib/standards/package.nix. In no-Nix CI jobs it is installed with uv tool install "frappe-nix-tools @ git+https://github.com/Avunu/frappe-nix@<rev>#subdirectory=py/frappe_nix_tools", where <rev> is read from the app's flake.lock.lint, typecheck, pr-policy and marketplace stay Nix-free (D3), yet they run exactly the tool version the app pins (plan §6 DoD row 3). A wheel built from the subdirectory contains nothing outside it, so any data kept elsewhere in frappe-nix would be missing in CI.
S11With releases.version-scheme = "frappe-major", the first release uses a Release-As: <major>.0.0 footer on the squash commit of the app's adoption PR (Avunu fleet: PR B). PR B is merged with gh pr merge --squash --body-file <f>, where the last paragraph of <f> is exactly Release-As: <major>.0.0. Before merging, npx release-please release-pr --dry-run on PR B's head must propose <major>.0.0. The repo setting squash_merge_commit_message stays COMMIT_MESSAGES. No release-as key goes in the config.carbon_frappe cut 16.0.0 with this footer (3c16b00, a direct commit). In a squash of several commits, COMMIT_MESSAGES produces a body of * subject blocks, and release-please reads only a trailing footer, so the merge body is set explicitly. A release-as key in the config would have to be removed after the release, and until then it is drift.
S12There is no separate guard-major commit status. Under version-scheme = "frappe-major" the major rule is part of frappe-nix compat (a prek hook in lint) and of pr-policy, and both run on the dispatched release PR. Under "semver" there is no major rule.Fewer moving parts. The rule then blocks merging through a required check instead of an advisory status.
S13The release flow needs no App. An org may name one in ci.github-app (§4.1 "A GitHub App"), whose token then replaces GITHUB_TOKEN for release-please, every bot push and PR, and auto-merge, and dispatch-ci and the other dispatches step aside; nothing else changes. Its parts, for the develop+version branching model (under main+tags, S41 and §4.4, there is no fast-forward):
  • release-please runs with GITHUB_TOKEN;
  • dispatch-ci runs ci.yml and pr-policy.yml on the release branch;
  • a REST fast-forward moves version-<major>, with GitHub Actions (integration 15368) as the only bypass actor on version-*;
  • release runs on a daily cron;
  • a nightly ci.yml cron runs on develop;
  • a daily sweep re-dispatches CI for bot PRs whose head has no ci / * runs.
    This is plan §7 decision 3 as the github-capabilities track refined it. The org has deploy keys disabled, so a DeployKey bypass isn't available.
    S14pilot assets are built by gh workflow run assets.yml --ref version-<major>, dispatched after the fast-forward.pilot's app-assets.yml names its release assets-$GITHUB_REF_NAME. Called from the release run, which is on develop, it would publish assets-develop.
    S15The binary cache is a drop-in, and only trusted runs can write to it. The caller passes vars.FRAPPE_NIX_CACHE (empty, cachix:<name> or attic:<endpoint>/<cache>) and two secrets: FRAPPE_NIX_CACHE_TOKEN (write; org Actions secret only) and FRAPPE_NIX_CACHE_READ_TOKEN (pull-only; org Actions and Dependabot secret; leave it unset for a public cache). The write token reaches a step only when github.ref == 'refs/heads/<integration branch>' && (github.event_name == 'push' || github.event_name == 'schedule'), where the integration branch is branches.integration (§2.3). Every other run (PRs, Dependabot, dispatched release, relock and sweep runs) gets the read token or none. When FRAPPE_NIX_CACHE is empty, the app's Nix jobs use no cache action at all; magic-nix-cache is kept only for frappe-nix's own small self-test closures.Today there is no cache (ci-timing track). Adding one later is an org variable plus secrets, with no app PR. Dependency bumps run third-party code in the same job, so they must never hold a credential that could poison the cache. magic-nix-cache was throttled in 48 of 48 carbon bench and integration jobs, and it competes with the node_modules caches for the repo's 10 GB Actions cache (9.09 GB already used).
    S16CI mode is FRAPPE_NIX_CI=1, with exactly one nix develop --no-pure-eval -c frappe-test --ci per job. CI mode skips the shell hook's node verify and yarn installs and its banner. The clean nix build .#default (a second evaluation) runs on PRs only when the diff touches build inputs (§4.2), and always on develop pushes, schedules and dispatches.The ci-timing track found 2.1–2.2 minutes of yarn per shell entry, about 1.8 minutes of evaluation per extra nix develop, and a 7.6-minute p50 for the bench build.
    S17frappe-test measures coverage itself. It runs coverage run --source=<repo>/<app> -m frappe.utils.bench_helper frappe … run-tests and never uses frappe's --coverage. coverage goes into the bench root's dev group.In app mode, frappe's --coverage counts .frappe-nix/bench/apps/{frappe,erpnext,hrms} (frappe-nix-runtime track).
    S18The whitelist and hook test check is dynamic. It reads the evaluated hooks from frappe.get_hooks(app_name=…), and a target counts as tested when at least one line of its body ran during the same coverage run.Static parsing misses conditional hooks such as esign's if frappe_version >= 16: (rename-mechanics track). Coverage data is already there.
    S19The test-utils module (off by default) provides selected agritheory/test_utils hooks only, at rev floor v1.30.1. The ones that work standalone are in the default stage. validate_customizations and clean_customized_doctypes are stages: [manual], run in lint inside a fabricated sparse mini-bench (§5.9), with a guard that fails when the bench layout is missing. The fixtures are not used.This follows the test-utils track: outside a bench those two hooks are silent no-ops, sql_registry aborts the run, and the repo has no license.
    S20Registry checks are pinned through frappe-nix flake inputs: marketplace (frappe/marketplace 2dd4be42…), pilot (frappe/pilot e2364936…) and frappe-semgrep-rules. They reach apps through the app's flake.lock. The get-app validator runs with the declared dependency apps on its bench, which mirrors frappe/marketplace#29.The plan wants pinned copies, and frappe-nix's dependabot nix moves them. Without the dependency apps on the bench, 5 apps fail ImportCheck for reasons that aren't theirs (registry-dryrun track).
    S21The semgrep baseline is a multiset. An entry is keyed by (rule, path, sha1(normalised matched line)) and carries a count. A key found more often than its count fails, and so does a count that is now too high. Baselines only shrink, and publishing requires an empty one.Line numbers move. OSS semgrep returns "requires login" as the fingerprint. Identical matched lines share a key: erpnext_taskview's api.py has 12 identical frappe.db.commit() lines, and a set would let one entry cover any number of new ones.
    S22With the icons module on, the <app>/desktop_icon/<app>.json fixture is committed, for application-type apps only. It is generated by frappe-icon and checked for freshness. The PNGs are not committed.This deviates from D14 because frappe v16 imports desktop_icon/*.json from the installed package (import_desktop_icon_fixtures). A file that isn't committed never ships.
    S23With the screenshots module on, screenshots are made repeatable by running the bench under libfaketime with a fixed start time (FAKETIME="@<demo date> 09:00:00", so the clock advances from there), plus CDP timezone, locale and media overrides, no animations, masks, and lossless WebP. The refresh PR is merged automatically only under dependabot.auto-merge-policy = "all" (S44).ERPNext demo data is relative to "today". Freezing the clock outright would hang timeouts.
    S24Ratchets are coverage fail_under, the ty: ignore count, semgrep baseline counts, and the [[tool.frappe-nix.untested]], [[tool.frappe-nix.unchecked-js]] and [[tool.frappe-nix.coverage-omit]] lists. They are compared against the PR's merge-base (git merge-base "$BASE_SHA" HEAD), never the base tip. They apply only once the base already has [tool.frappe-nix] (in the Avunu fleet, from PR B onward), and are skipped on integration-branch pushes and schedules. Each ratchet belongs to its module and is off with it. Coverage also ratchets upward: frappe-test fails when coverage has climbed tests.coverage.raise-margin points (default 2) past a fail_under below tests.coverage.target (default 80) (§5.1 stage 4).The adoption PR (PR B) is the PR that sets each starting value. The base tip would fail a PR that branched before develop raised fail_under. Plan decision 5 wants a floor that only rises towards the target, and a notice alone never raises it.
    S25Release PRs get screenshots from the nightly run, not a dispatched run.A release branch differs from develop only in the version and changelog, so a separate run would show nothing new. This adjusts D16.
    S26The README "Development" block links to the profile value org.dev-docs-url. The built-in default is frappe-nix's own docs in its repository, https://github.com/Avunu/frappe-nix/tree/main/docs/app-standards. The Avunu profile sets https://docs.avunu.net/frappe-nix/docs/app-standards/.A link to frappe-nix's own repository is not an org value; a site an organisation hosts is. Avunu's documentation is one site, docs.avunu.net, built by Avunu/site-docs; frappe-nix's address on it is its path in that repository's projects.json.
    S27ruff rules. With python-lint on, an app gets these values from the recommended profile (carbon_frappe's set), each one a parameter (§8.2):
    • select = F,E,W,I,UP,B,RUF,SIM,C4,PIE,PERF,T20;
    • ignore is exactly E501, W191;
    • tabs, 110 columns, typing-modules = ["frappe.types.DF"]. frappe-nix's own Frappe-tracking ruff config (v0.14.10) is unrelated and unchanged.
      This is D4. The completeness critic confirmed it isn't a user decision.
      S28[tool.bench.frappe-dependencies] ranges always use the comma form ">=16.0.0,<17.0.0". payments is ">=0.0.1,<1.0.0".packaging.SpecifierSet, which pilot uses, rejects the -dev space form (completeness critic). payments' version-16 __version__ is 0.0.1 (registry-dryrun track).
      S29No workflow pushes a commit that changes .github/workflows/*, except frappe-nix's rollout.yml. relock-push, relock-upgrade-push and nightly shots-push refuse a patch that touches that path (exit 1, naming the file); they refuse anything under .github/, and any path outside the few their plan job writes. rollout.yml's publish job pushes the caller rewrite of a frappe-nix release with the App's token (Workflows write), and only a tree frappe-nix ci verify-rollout-patch accepted (§5.8). Moving version-* and release with a REST ref PATCH to a commit that already exists on develop or main is how releases move them, but GitHub refuses that PATCH from GITHUB_TOKEN too when the commits it moves the branch across change .github/workflows/ (#230): with ci.github-app the fast-forward uses the App's token, with contents and workflows write, and without one it fails with an error that names the cause and the manual PATCH.GitHub refuses such pushes from GITHUB_TOKEN. An early fast-forward across workflow changes (carbon_frappe's version-16, 1ed9df5 to 30a4be4) succeeded, but carbon_theme's v16.3.1 (run 40582535573) was refused with HTTP 403 across 12 changed workflow files, and the same PATCH with a token that may change workflow files succeeded.
      S30Vite outputs are registered by the app's own build, not only by Nix. Every app with a tracked Vite config gets the managed scripts/vite-register.mjs, and its build script must end with node scripts/vite-register.mjs. frappe-nix's esbuild-preload runs the same module (§5.11), and running both is idempotent.frappe's esbuild.js writes assets.json and then runs each app's yarn build, so a post-build step in the app works on a stock bench: Frappe Cloud, pilot's get-app bench and registry installs. Without it, taskview.bundle.js, timerdock.bundle.js and timeclock's bundle 404 everywhere except Nix.
      S31Legacy files are retired by sync. A retire list in the manifest names files that sync deletes and that --check reports as drift (§2.4.1).Otherwise carbon's and taskview's old check.yml, release-please.yml and dependabot-auto-merge.yml keep running beside the new callers: two release flows race for tags, and an auto-merger ignores needs-review.
      S32Sync bootstraps in two phases (§3.3): phase A writes flake.nix and .envrc, locks, and re-reads the frappe-nix rev; phase B renders everything else. App migrations start only once the release branch exists, which frappe-nix's release workflow creates.postgrid_integration and jwt_auth have no flake; carbon, taskview and timeclock lock frappe-nix main. A single pass would render the callers with a rev that the same run then changes.
      S33Neutral names only. The concept is "app standards" (docs section "App standards and quality gates", docs/app-standards/). The Python project is py/frappe_nix_tools (distribution frappe-nix-tools, import name frappe_nix_tools) with the CLI entry point frappe-nix; the former stand-alone apply, audit and rollout tools are frappe-nix repo apply|audit|rollout. The app table is [tool.frappe-nix]; markers are frappe-nix:managed, frappe-nix:local-begin <name> and frappe-nix:local-end <name>; repo policy JSON lives in repo-policy/; the cache variables are FRAPPE_NIX_CACHE, FRAPPE_NIX_CACHE_TOKEN and FRAPPE_NIX_CACHE_READ_TOKEN, and every other tool variable is FRAPPE_NIX_*. The conventional-commit scope for this work is standards, and its branches start with standards/. No public artifact (code, names, tables, markers, docs, workflows, variables, branches, PR text, commit messages) uses the internal project codename.frappe-nix is used outside Avunu. An internal codename in a config table or a marker means nothing to those users and leaks an internal plan. §9 lists what the in-flight PRs rename.
      S34Standards are profile-driven. A profile is a TOML file (§8.1) that enables modules and sets their parameters and the org values. frappe-nix ships two built-in profiles, minimal (the dev shell only) and recommended (vendor-neutral defaults, shipped as frozen snapshots, S42). An org profile layers on top of one built-in. The resolved configuration is the deep merge built-in < org profile < the app's [tool.frappe-nix] (§8.4).Other agencies and developers use frappe-nix with their own conventions. One file per organisation, pinned like any other input, keeps the fleet consistent without frappe-nix carrying any organisation's choices.
      S35Opt-in, never by default. Without [tool.frappe-nix], frappe-init --app writes only flake.nix, .envrc and .gitignore, exactly as frappe-nix main does, and frappe-init --sync/--check refuse with exit 2 and a hint. An app opts in by adding the table or with frappe-init --standards <profile>, which creates it. A table without profile means profile = "minimal". The opt-in also gates what the dev shell adds: frappe-nix, nixfmt/statix/deadnix and the blame.ignoreRevsFile setting appear only in an opted-in app's shell. lib/standards/shell.nix decides this with a line match, never a TOML parse: it reads pyproject.toml as a string and tests for a line matching ^\[tool\.frappe-nix[].] (builtins.split plus builtins.match). Nix's fromTOML rejects valid TOML (datetimes) and its errors escape builtins.tryEval, so a parse would break evaluation for apps that never opted in. The same opt-in gates the bench root's dev-group trim (S1), its bench-dev group (every app's [tool.bench.dev-dependencies], what bench setup requirements --dev installs; the generated root of an app that has not opted in keeps of it only what its committed lock's root lists there, which for a lock main wrote is nothing), the worktree port salt (§5.12) and the docs-site node-target exclusion (§5.11). The runtime changes that apply to every app-mode user are FRAPPE_NIX_CI (inert unless set), the Vite registration in the Nix preload, which only adds assets.json keys for hashed Vite bundles that 404 today (§5.11; Q7), and the runtime port leases (§5.12). On free preferred ports a bench serves where it did, but the leases add to every shell a frappe-ports process, the frappe-nix-ports command, nginx's /__frappe_nix/bench route and X-Frappe-Nix-Bench header, and a FRAPPE_NIX_PORTS_FILE variable. Where a preferred port is taken, an app-mode bench moves to the next free one. For an app that has not opted in, the outcome this replaces was its nginx failing to bind and its readiness check passing against another bench's, a hang or a wrong-bench pass, never a working bench; for an opted-in app it was a clean refusal, which becomes a move (FRAPPE_NIX_STRICT_PORTS=1 keeps the refusal). That is the one amendment to "no change". Bench mode refuses a taken port instead (strict), naming its holder. N1 also adds three things that change nothing until they are used: the frappe-test command in every app-mode shell (§5.1), the frappe-rename-app command in every shell, bench mode included (§5.10), and reconcile-apps' FRAPPE_NIX_RECONCILE_SKIP check, which skips nothing while replacedApps is empty. One more change reaches every app's repository but not its shell or outputs: on its next frappe-nix update, the app's flake.lock gains the three flake = false nodes S20 adds (marketplace, pilot, frappe-semgrep-rules, about 9 MB fetched once). Its Python env, its generated workspace and its nix/uv.lock stay exactly main's. The dev shell gets new derivations for the commands above, and so do the shell's workspace scripts, packages.default and the relock app, because frappe-nix-workspace's script text (lib/frappe-workspace.py) changed; the workspace they generate is byte for byte main's.Existing app-mode users must see no change from upgrading frappe-nix. minimal is the smallest step that still puts the app under sync.
      S36Every gate and module is individually toggleable, and a file or job exists only for an enabled module. Each manifest entry names its module (§2.4); a caller job exists only for an enabled gate (S39). Turning a module off makes sync delete its whole files and retract its merged keys (§3.3 step 6). Modules that need each other say so (§8.2), and an inconsistent combination is exit 2, never a silent fix. Tool choices are parameters where more than one tool is reasonable (js.tool = "oxc" | "none").Teams adopt standards piecemeal. A module that can't be switched off forces a fork of frappe-nix.
      S37No organisation value is hard-coded in frappe-nix. Publisher, contact e-mail, copyright holder, licence, brand colours, website and docs URL templates, GitHub owner, registry fork, README badges and links come from [org] in a profile or the app's [tool.frappe-nix.org] (§8.1). Built-in profiles leave them empty, and a module that needs an empty value is exit 2 naming the key. A frappe-nix nix check (standards-vendor-neutral, §7) fails when an Avunu value (Avunu LLC, avunu.net, avu.nu, #834AFF, any Avunu/ other than Avunu/frappe-nix, Avunu/frappe-runtime and Avunu/python-devops-nix, …) appears in a built-in profile, template, manifest, schema, known-apps.json, repo-policy/ default, the frappe-nix-tools Python code, lib/**, or the reusable app-*.yml and fleet-audit.yml workflows. Docs may show such values only inside a block marked as the Avunu example.The same tool must render a correct app for any organisation. A check is the only way the rule survives later edits.
      S38Org profiles live in their own repository and reach an app as a pinned flake input. profile = "github:<owner>/<repo>[/<ref>]" (or a gitlab: or git+https: flake URL, §8.3) makes sync's phase A add the input standards-profile (flake = false) to flake.nix and lock it. A single-app team that has no profile repository writes profile = "./<dir>" instead: an in-repo profile with the same layout, versioned with the app itself (§8.3). The profile is read from the locked tree (frappe-nix pin-path standards-profile in no-Nix CI). Dependabot ignores the input, as it does frappe-nix, because a profile change can rewrite workflow files (S29); it moves with frappe-nix repo rollout --profile-to or a manual nix flake update standards-profile && frappe-init --sync commit, by hand (rollout.yml moves frappe-nix only; automating the profile's rollout is a follow-up). Avunu's choices are the profile Avunu/frappe-standards-profile (§8.6), created by item P (§1.3), which frappe-nix does not own.The profile then moves through the same reviewed, versioned path as frappe-nix itself, and every app commit renders from exactly one profile revision.
      S39CI callers contain only enabled gates. The single app-ci.yml of 1.1 becomes one reusable workflow per gate: app-lint.yml, app-typecheck.yml, app-test.yml and app-marketplace.yml (§4.2). The rendered ci.yml has one caller job per enabled gate (job ids lint, typecheck, test, marketplace), each with name: ci, so the contexts stay ci / <gate>. pr-policy.yml, release.yml, deps.yml, nightly.yml and assets.yml exist only when their module is on. The required checks a ruleset lists are computed from the same enabled set (§4.8).A disabled gate should leave no skipped job, which GitHub would show and which a ruleset would treat as passing. Stable context names mean turning a gate on later never renames another one.
      S40Repo policy is optional. repo-policy.enable (off in recommended) decides whether frappe-nix repo apply manages an app's settings and rulesets and whether audit rows A1 and A3 apply. The fleet list that --all iterates is not part of frappe-nix: it is fleet.json in an org profile repository, passed with --fleet (§5.6). The org-wide scorecard workflow lives there too.Applying rulesets needs repo admin and encodes review policy, which differs between teams. A fleet list is an organisation's inventory.
      S41The branching model and the version scheme are parameters. releases.branching is "develop+version" (integration branch develop, release branch version-<major> fast-forwarded to each tag; the Avunu choice and the Frappe convention) or "main+tags" (integration branch main, tags only). releases.version-scheme is "frappe-major" (the app's major equals the Frappe major, with the S12 rule) or "semver". Every develop and version-<major> in §2–§5 is the context value branches.integration or branches.release (§2.3). The integration branch's name is its own app key, [tool.frappe-nix] integration-branch, which defaults to the branching model's (develop or main) and may name any branch (master, dev, trunk), with or without releases (§2.1).Both models are common among Frappe app publishers. Encoding one in templates would force it on everyone.
      S42Built-in profiles are versioned snapshots. recommended ships as frozen files recommended@<frappe-nix minor> (recommended@1.0 first). A snapshot never changes after its release, apart from fixes that make it accept strictly more code. profile = "recommended" means the newest snapshot of the running frappe-nix-tools; profile = "recommended@1.0" (and an org profile's extends = "recommended@1.0") stays on that snapshot through every later v1.x. minimal is frozen for all of v1 and has no snapshots.A MINOR may tighten recommended (§6.3). Without snapshots, taking a frappe-nix bug fix would also turn on new gates, and the only way to stay stable would be to maintain an org profile repository.
      S43The gates are frappe-nix commands; GitHub is one host. Each no-Nix gate's steps live in frappe-nix gate lint|typecheck|marketplace (N4), which any CI runs; the GitHub reusable workflows only set up node, uv and the tools and then call it. The test gate is already frappe-test --ci. Siblings, org profiles, pin-path and minibench accept github:, gitlab: and git+https: sources, and use the optional fetch token FRAPPE_NIX_FETCH_TOKEN for private ones. The modules that are GitHub-only in v1 are listed in §8.2; on another host they resolve to off.Other hosts must be able to run the same checks without copying step lists out of GitHub YAML. Agencies keep client apps and shared libraries private.
      S44Bot PRs can merge and stay current without a person, by profile choice. dependabot.auto-merge-policy is "decision-table" (the §4.5 table; the default, and today's behaviour) or "all": every Dependabot PR, majors and the table's needs-review rows included, and the nightly screenshots PR get auto-merge, under the same safety rule, so the required checks alone decide. A nix bump still waits for its relock, a move of a rollout input is still closed, and the frappe-nix pin is still never merged (S5). dependabot.update-branches (default false) brings every bot PR that is behind the integration branch up to date after each push to it, through the update-branch API (Dependabot ignores @dependabot rebase from a bot); never release-please's PR. With a GitHub App (§4.1) its auto-merges raise the push that drives this, and its updates start CI.The required checks are what protect the integration branch (§4.5), so a review step on top of them is the org's choice, not frappe-nix's. A fleet merged by one person or agent wants its maintenance PRs to land by themselves; recommended keeps the table.

      1. Repository layout in frappe-nix, and PR ownership

      1.1 Landing order

      1. N3a "hook points" lands first. It is a small PR, owned by the N3 agent, that only creates seams. It MUST merge before any other N-PR is rebased for merge. Every other PR MAY start before it merges, by branching from N3a's branch.

      2. Development of N1, N2, N3 (the rest), N4, N5 and N6 proceeds in parallel after that.

      3. Merge order follows what each PR's acceptance tests exercise:

        StepPRsWhy
        1N3aSeams, the data directory, the [tool.frappe-nix] and profile schemas, the two built-in profiles.
        2N1 and N3, in either orderN1 needs only N3a's loaders and the resolved-config reader. N3 is the sync engine and the profile resolver everything renders through.
        3N2 and N5, after N3N2's managed scripts/vite-register.mjs and N5's README blocks and marketplace.json fragment render through N3's engine.
        4N4, after N1, N3 and N5selftest-ci runs frappe-nix sync --check (N3), frappe-test --ci (N1) and frappe-nix listing check (N5).
        5N6frappe-nix's own pr-policy.yml runs frappe-nix policy (N4). N6's PR may merge earlier if its policy job is temporarily non-required.
        6tag v1.0.0N6's first release PR is merged only after N1–N5 are in, so v1.0.0 is the first complete platform and the release branch exists.
        • The frappe-nix main ruleset (repo-policy/self/rulesets/main.json) is applied with frappe-nix repo apply only after N4 merges, because it uses N4's tool.

        • P, the Avunu org profile (Avunu/frappe-standards-profile, §8.6), is created once N3 has merged, because frappe-nix profile validate (N3) checks it. Its v1.0.0 tag is made after frappe-nix v1.0.0, against which its CI validates it.

        • App migrations in the Avunu fleet (PR A, PR B) start only after frappe-nix v1.0.0 and P's v1.0.0 are tagged (S32, S38). Apps outside Avunu opt in whenever they choose, with any profile.

      Overlap rule. Only the files listed below as shared are touched by more than one PR. For each shared file, N3a creates the seam and the later PR edits only its own hunk. Everything else has exactly one owner, and a PR MUST NOT edit a file it doesn't own. If a PR needs a change in another PR's file, it states that in its PR description and the owner makes the change.

      1.2 The tree

      [N…] marks the owner. (shared) files list each PR's hunk.

      frappe-nix/
      ├── version.txt                                [N3a creates "0.0.0"; N6 makes release-please own it]
      ├── release-please-config.json                 [N6]
      ├── .release-please-manifest.json              [N6]
      ├── committed.toml                             [N6]
      ├── CHANGELOG.md                               [release-please]
      ├── flake.nix  (shared)
      │     N3a: three new flake=false inputs (marketplace, pilot, frappe-semgrep-rules);
      │          `packages`/`apps` merged with `import ./lib/standards/outputs.nix`;
      │          `checks` merged with `import ./tests/standards { … }`
      │     nobody else edits flake.nix
      ├── flake.lock                                 [N3a for the new inputs; afterwards dependabot]
      ├── py/frappe_nix_tools/                       Python project `frappe-nix-tools`, import name `frappe_nix_tools`,
      │   │                                          console script `frappe-nix` (S10, S33); self-contained
      │   ├── pyproject.toml                         [N3a]  deps: jinja2>=3.1,<4; tomlkit>=0.13 (no upper cap: the
      │   │                                                  locked nixpkgs ships 0.15.0); packaging>=24.
      │   │                                                  [project.scripts] frappe-nix = "frappe_nix_tools.cli:main";
      │   │                                                  flit's include ships frappe_nix_tools/data/**
      │   ├── frappe_nix_tools/__init__.py           [N3a]  release-please version block (N6 adds it to extra-files)
      │   ├── frappe_nix_tools/cli.py                [N3a]  `frappe-nix <command>`; imports every module in commands/;
      │   │                                                  `repo` is a command group (apply, audit, rollout)
      │   ├── frappe_nix_tools/common/               [N3a]  repo.py, flakelock.py, pyproject.py ([tool.frappe-nix] loader),
      │   │                                                  config.py (profile resolution and the merge, §8.4),
      │   │                                                  known_apps.py, gh.py (thin `gh api` wrapper), report.py,
      │   │                                                  pins.py (fetch a flake-locked GitHub tree into .dev-dist/pins/
      │   │                                                  and verify its narHash), nar.py
      │   ├── frappe_nix_tools/commands/paths.py     [N3a]  `frappe-nix data-path <rel>` (importlib.resources over
      │   │                                                  frappe_nix_tools/data), `frappe-nix pin-path <input>` for any locked
      │   │                                                  GitHub input: frappe-nix's (frappe-semgrep-rules, marketplace,
      │   │                                                  pilot), the app's own (frappe, erpnext, …) or `standards-profile`
      │   ├── frappe_nix_tools/commands/config.py    [N3a]  `frappe-nix config <key>` (prints a resolved value, §8.4)
      │   ├── frappe_nix_tools/data/                 everything sync, listing and the hooks read at run time (S10):
      │   │   ├── profiles/minimal.toml              [N3a creates both in full from §8.5; then N3; others ask N3]
      │   │   ├── profiles/recommended@1.0.toml      [N3a, then N3]  frozen once v1.0.0 is tagged; a later MINOR that
      │   │   │                                              changes `recommended` adds recommended@1.<minor>.toml (S42)
      │   │   ├── tsconfig/base.json                 [N3]   the inline TypeScript preset (`typescript.preset = "inline"`, §2.9)
      │   │   ├── schema/tool-frappe-nix.schema.json [N3a; N3 extends it, others ask N3]
      │   │   ├── schema/profile.schema.json         [N3a; N3 extends it, others ask N3]
      │   │   ├── known-apps.json                    [N3a]  (frappe, erpnext, hrms, payments only; §2.1)
      │   │   ├── manifest.d/core.json               [N3]
      │   │   ├── manifest.d/assets.json             [N2]   (scripts/vite-register.mjs)
      │   │   ├── manifest.d/ci.json                 [N4]
      │   │   ├── manifest.d/marketplace.json        [N5]
      │   │   ├── templates/**                       [N3]   except templates/.github/** [N4], templates/marketplace/** [N5],
      │   │   │                                              templates/scripts/vite-register.mjs [N2]
      │   │   ├── readme/*.md.j2                     [N5]
      │   │   ├── node-locks/version-16/{frappe/ui,erpnext/banking,hrms/frontend,hrms/roster}/{yarn.lock,source.json} [N3]
      │   │   ├── semgrep/test-correctness.yml       [N4]   (carbon_frappe's semgrep/test-correctness.yml)
      │   │   ├── ci/nightly.sh                      [N4]   (§4.6)
      │   │   └── shots/shots.d.ts                   [N5]   (copy of lib/shots/shots.d.ts; a nix check asserts equality)
      │   ├── frappe_nix_tools/commands/sync.py      [N3]   `frappe-nix sync --write|--check`
      │   ├── frappe_nix_tools/commands/profile.py   [N3]   `frappe-nix profile show|validate` (§5.13)
      │   ├── frappe_nix_tools/commands/compat.py    [N3]
      │   ├── frappe_nix_tools/commands/unchecked_js.py [N3] `frappe-nix unchecked-js --stale` (§2.9)
      │   ├── frappe_nix_tools/commands/testmap.py   [N1]   plus frappe_nix_tools/bench/{testmap_probe,composition}.py [N1]
      │   ├── frappe_nix_tools/commands/policy.py    [N4]
      │   ├── frappe_nix_tools/commands/ratchet.py   [N4]
      │   ├── frappe_nix_tools/commands/minibench.py [N4]
      │   ├── frappe_nix_tools/commands/gate.py      [N4]   `frappe-nix gate lint|typecheck|marketplace` (S43, §4.2)
      │   ├── frappe_nix_tools/commands/repo/{apply,audit,rollout,doctor}.py [N4]  `frappe-nix repo apply|audit|rollout|doctor`
      │   ├── frappe_nix_tools/commands/listing.py   [N5]   plus frappe_nix_tools/listing/** [N5]
      │   ├── frappe_nix_tools/commands/icon.py      [N5]   plus frappe_nix_tools/icon/** [N5]
      │   └── tests/test_<module>.py                 [owner of <module>]
      ├── lib/standards/
      │   ├── package.nix                            [N3a]  python314 build of py/frappe_nix_tools against the locked nixpkgs
      │   │                                                  (pythonRuntimeDepsCheck stays on; a nix check builds it)
      │   ├── outputs.nix                            [N3a]  reads lib/standards/tools/*.nix → {packages, apps}
      │   ├── shell.nix                              [N3a]  app-mode dev-shell packages and enterShell snippet; adds
      │   │                                                  `frappe-nix` only to opted-in apps' shells; exports the
      │   │                                                  opt-in test (a line match, never fromTOML; S35) as
      │   │                                                  `optedIn` for modules/devenv.nix
      │   └── tools/
      │       ├── frappe-nix.nix                     [N3a]  `frappe-nix` with git and gh on its PATH (the `repo` group needs gh)
      │       └── frappe-listing.nix, frappe-icon.nix, frappe-shots.nix          [N5]
      ├── lib/scripts.nix  (shared)                  N3a: one line merging lib/scripts.d/*.nix; nobody else
      ├── lib/scripts.d/
      │   ├── frappe-test.nix, frappe-rename-app.nix [N1]
      │   └── frappe-demo.nix, frappe-shots.nix      [N5]
      ├── py/frappe_nix_tools/…/app_tools/          [N1, N5] frappe-test, frappe-demo, frappe-shots (Python)
      ├── py/frappe_nix_tools/…/frappe_init/        [N3]   (frappe-init, in Python; new flags: --sync, --check, --standards, --format, --only)
      ├── lib/init.nix                               [N3]   (frappe-init's wrapper, and the frappe-nix-tools runtime input)
      ├── lib/rename/frappe_rename_app.py            [N1]   (ported from the Phase 0 rename-mechanics prototype)
      ├── lib/demo/frappe_demo.py                    [N5]
      ├── lib/shots/{cdp.ts,runner.ts,diff.ts,shots.d.ts,package.json,yarn.lock} [N5]
      ├── lib/js/esbuild-preload.js                  [N2]   (requires lib/js/vite-register.cjs)
      ├── lib/js/vite-register.cjs                   [N2]   the one registration implementation (S30); the managed
      │                                                      scripts/vite-register.mjs is a build-time copy of it
      ├── lib/node-targets.nix, lib/node-locks.nix   [N2]   (the `excludeNodeTargets` option, §5.11)
      ├── lib/frappe-workspace.py                    [N1]   (`coverage` in the generated root's dev group; `ruff`,
      │                                                      `pre-commit` and `semgrep` dropped only from an opted-in
      │                                                      app-mode root whose tools/pyproject.toml pins them, S1)
      ├── templates/bench/pyproject.toml             [N1]   adds `coverage` and `unittest-xml-reporting` only; ruff,
      │                                                      pre-commit and semgrep stay (S1, S35)
      ├── modules/devenv.nix  (shared)
      │     N3a: app-mode `apps.frappe-init`; import of lib/standards/shell.nix
      │     N1:  port offset salt (opted-in apps, or `ports.worktreeSalt = true`) and FRAPPE_NIX_PORT_OFFSET;
      │          FRAPPE_NIX_CI in enterShell; nixfmt/statix/deadnix in an opted-in app-mode shell; frappe-nix.renamedApps
      ├── modules/nixos.nix                          [N1]   (services.frappe-nix.sites.<site>.renamedApps)
      ├── templates/app/
      │   └── flake.nix, .envrc, .gitignore          unchanged from frappe-nix `main` (S35). `frappe-init --app` without
      │                                                      `--standards` copies exactly this, as today. N3 MUST NOT change
      │                                                      these files; the opted-in forms are rendered by the engine from
      │                                                      data/templates/{flake.nix.j2,envrc.j2,gitignore.block} (§2.5, §2.6)
      ├── repo-policy/                               vendor-neutral defaults, parameterised by the resolved config (§4.8, §4.9)
      │   ├── repo-settings.json                     [N4]
      │   ├── rulesets/{integration,integration-provisional,release-branch,tags}.json   [N4]
      │   └── self/{repo-settings.json,rulesets/{main,release,tags}.json} [N6]   (frappe-nix's own repository)
      ├── .github/
      │   ├── workflows/app-lint.yml, app-typecheck.yml, app-test.yml, app-marketplace.yml,
      │   │   app-pr-policy.yml, app-release.yml, app-deps.yml, app-nightly.yml   [N4]   reusable (S39)
      │   ├── workflows/fleet-audit.yml              [N4]   reusable (`workflow_call` only): the scorecard an org
      │   │                                                  schedules from its profile repository (§5.7)
      │   ├── workflows/selftest-runtime.yml         [N1]
      │   ├── workflows/selftest-assets.yml          [N2]   (stock-bench Vite registration, §7)
      │   ├── workflows/selftest-scaffold.yml        [N3]
      │   ├── workflows/selftest-ci.yml              [N4]
      │   ├── workflows/selftest-product.yml         [N5]
      │   ├── workflows/check.yml  (shared)
      │   │     N3a: the "offline checks" step builds `.#checks.x86_64-linux.standards-all` in addition to its list
      │   │     N6:  SHA-pin actions/checkout; add a `vm-tests` boolean dispatch input (default false) and
      │   │          gate the vm-tests job on `inputs.vm-tests == true` instead of on any dispatch
      │   ├── workflows/pr-policy.yml                [N6]   frappe-nix's own, non-reusable `pr-policy` job (§4.10)
      │   ├── workflows/release.yml                  [N6]
      │   ├── workflows/dependabot-auto-merge.yml    [N6]   (every Dependabot PR, kept current; §4.10)
      │   └── dependabot.yml                         [N6]
      ├── tests/standards/default.nix                [N3a]  reads tests/standards/*.nix; exposes `standards-all` (linkFarm)
      ├── tests/standards/vendor-neutral.nix         [N3a]  the S37 check, with tests/standards/vendor-denylist.txt [N3a]
      │                                                      (the denylist names org values only, never the codename; §7 N3a)
      ├── tests/standards/<area>.nix                 [owner of <area>] (sync, profiles, compat, ports, preload-vite,
      │                                                       node-targets-docs-site, policy, ratchet, listing, icon, …)
      ├── tests/fixtures/standards-app/              [N3a: app sources; N3: the managed files sync renders, committed]
      ├── tests/fixtures/profiles/                   [N3]   an org-profile fixture (`example-org`, fictitious values, §7 N3);
      │                                                      [N4] `docs-compat`, which sets the docs tool's own identifiers (§7 N4)
      ├── tests/fixtures/spa-app/                    [N2]   (root-level Vite config, a `portal/` SPA with no package.json,
      │                                                      `[[tool.frappe-nix.typescript.spa]]` entries)
      ├── tests/fixtures/rename-esign/               [N1]   (hooks naming `esign.desk.bundle.js`, the matching files)
      └── docs/app-standards/                        docs section "App standards and quality gates"
          ├── README.md (index, links to all pages)  [N3a]
          └── <page>.md                              [N3a creates one-line stubs; each owner fills its page:
                                                      profiles.md N3, managed-files.md N3, testing.md N1, assets.md N2,
                                                      ci.md N4, github.md N4, marketplace.md N5, icons.md N5,
                                                      screenshots.md N5, versioning.md N6, rename.md N1]

      Outside frappe-nix:

      Avunu/frappe-standards-profile/                [P; owned and released by Avunu, not by any N-PR]
      ├── profile.toml                               the Avunu org profile (§8.6)
      ├── templates/                                 optional template overrides (§8.1)
      ├── fleet.json                                 the Avunu fleet that `frappe-nix repo … --all` iterates (§4.9)
      ├── resolved.snapshot.json                     `frappe-nix profile show --format json` of the fixture app (§6.4)
      ├── repo-policy/                               P's own settings and rulesets: main.json, release.json (`refs/heads/v*`),
      │                                              tags.json, applied with `frappe-nix repo apply --policy-dir` (§5.6)
      ├── .github/workflows/fleet-audit.yml          caller of frappe-nix's reusable fleet-audit.yml, nightly (§5.7)
      ├── .github/workflows/validate.yml             on every PR: `frappe-nix profile validate profile.toml`, the snapshot
      │                                              comparison, `sync --write` and `sync --check` of a copy of the fixture app, and fleet.json
      ├── .github/workflows/release.yml              release-please, then a REST fast-forward of `v1` (§6.4)
      └── release-please config, CHANGELOG.md        tags vX.Y.Z and a moving `v1` branch (§6.4)

      1.3 What each PR delivers

      • N3a, hook points. It delivers:

        • the seams listed above;

        • frappe-nix --version and the command dispatcher;

        • the py/frappe_nix_tools/frappe_nix_tools/data/ layout, frappe-nix data-path, and data/known-apps.json;

        • the two built-in profiles in full (§8.5), schema/profile.schema.json, and the resolver common/config.py with frappe-nix config reading resolved values, so every later PR reads module switches the same way (§8.4);

        • the standards-vendor-neutral nix check and its denylist (S37);

        • the fixture app sources in tests/fixtures/standards-app/: an app standards_fixture with one DocType, one whitelisted function with a test, one deliberately untested whitelisted function listed in [[tool.frappe-nix.untested]], doc_events on ToDo, one scheduler job, extend_doctype_class on ToDo, demo.py, marketplace/listing.toml, the icon pair and marketplace/screenshots.ts;

        • the new flake inputs;

        • the docs stubs, under docs/app-standards/.

        It has no behaviour of its own.

      • N1, runtime. It delivers:

        • frappe-test;

        • coverage scoping;

        • coverage in the bench root dev group;

        • the testmap and composition checks;

        • FRAPPE_NIX_CI;

        • nixfmt, statix and deadnix in an opted-in app-mode shell;

        • the worktree port salt and FRAPPE_NIX_PORT_OFFSET, with the documentation corrections;

        • frappe-rename-app (code and site halves) and the renamedApps and replacedApps NixOS and devenv options;

        • the shell-checks stage of frappe-test --ci;

        • ruff, pre-commit and semgrep dropped from the generated root's dev group of an opted-in app whose tools/pyproject.toml pins their replacements, and from no other root (S1);

        • selftest-runtime.yml.

        N1 MAY split the rename work into a follow-up PR, N1b.

      • N2, assets. It delivers:

        • Vite manifest registration as one module, lib/js/vite-register.cjs, run by esbuild-preload.js (with an unconditional child_process wrap) and shipped to apps as the managed scripts/vite-register.mjs (S30), plus its manifest.d/assets.json fragment and the frappe-nix compat rule C8;

        • the excludeNodeTargets option in node-targets.nix and node-locks.nix (default empty; an opted-in app's flake.nix sets [ "docs-site" ] while the docs-site module is on, §5.11);

        • the tests/fixtures/spa-app/ builtBench check;

        • docs/app-standards/assets.md, which covers the <name>.bundle.[hash] naming convention, bundled_asset() in www templates and [tool.bench.assets] for pilot.

      • N3, scaffold. It delivers:

        • the sync engine, including the two-phase bootstrap (S32), the retire list (S31), module gating and retraction (S36, §3.3 step 6), and template overrides (§8.1);

        • org profile resolution: the standards-profile flake input in phase A, pin-path of it in no-Nix CI, frappe-nix profile show|validate (§5.13), and docs/app-standards/profiles.md;

        • every template in manifest.d/core.json;

        • frappe-init --sync, --check and --standards <profile>; templates/app/ left unchanged, and cmd_app_init delegating to frappe-nix sync --write only for an opted-in app (S35);

        • frappe-nix compat;

        • node-lock seeding;

        • the committed managed files of the fixture app;

        • selftest-scaffold.yml.

      • N4, CI. It delivers:

        • the eight reusable workflows (four gates, plus pr-policy, release, deps and nightly; S39) and the reusable fleet-audit.yml;

        • frappe-nix gate lint|typecheck|marketplace, the host-agnostic gate steps the reusable workflows call (S43);

        • the caller templates (manifest.d/ci.json), each gated by its module: ci.yml, pr-policy.yml, release.yml, deps.yml, nightly.yml, assets.yml, dependabot.yml and zizmor.yml;

        • frappe-nix policy, frappe-nix ratchet, frappe-nix minibench, frappe-nix repo apply, frappe-nix repo audit, frappe-nix repo rollout and frappe-nix repo doctor;

        • repo-policy/*.json (rulesets and repo settings; the fleet list moved to the org profile repository, §8.6);

        • selftest-ci.yml.

      • N5, product tools. It delivers:

        • frappe-listing check|registry|readme;

        • frappe-icon, frappe-demo and frappe-shots;

        • the README block templates;

        • marketplace/shots.d.ts;

        • selftest-product.yml.

      • N6, frappe-nix self-release. It delivers:

        • release-please for frappe-nix;

        • release.yml, which runs release-please, dispatch-ci, the release fast-forward and the v* tags;

        • committed.toml;

        • SHA pins across frappe-nix's own workflows;

        • frappe-nix's own pr-policy.yml and the vm-tests dispatch input on check.yml;

        • repo-policy/self/*.json;

        • frappe-nix's dependabot commit prefixes (§6.3).

      • P, the Avunu org profile (Avunu/frappe-standards-profile; owned by Avunu, outside frappe-nix's PR set). It delivers:

        • profile.toml as in §8.6, extending the frozen snapshot recommended@1.0 and setting every value Avunu relies on explicitly;

        • any template overrides Avunu wants (none are required);

        • fleet.json, the 12-app fleet list that 1.1 kept in frappe-nix, each entry with profile (§4.9);

        • a scheduled caller of frappe-nix's reusable fleet-audit.yml, holding the FRAPPE_NIX_AUDIT_TOKEN secret (§5.7);

        • a validate.yml that runs frappe-nix profile validate from the frappe-nix release it targets, compares frappe-nix profile show --format json on a copy of the fixture app with the committed resolved.snapshot.json (so a frappe-nix release that changes any Avunu value fails P's CI), and syncs that copy offline and checks it;

        • release-please releases (tags vX.Y.Z, moving branch v1) with a release.yml that runs release-please and then fast-forwards v1 by REST PATCH, with GitHub Actions (integration 15368) as the only bypass actor on v* branches (§6.4);

        • its own repo-policy/ (main.json, release.json on refs/heads/v*, tags.json on refs/tags/v*, as frappe-nix's repo-policy/self/ with the v* ref instead of release), applied with frappe-nix repo apply --policy-dir repo-policy --repo Avunu/frappe-standards-profile once N4 has merged.

        P is small and has no frappe-nix code. Nothing in frappe-nix depends on it: frappe-nix's own tests use the fictitious tests/fixtures/profiles/example-org profile.

      1.4 Seam interfaces (N3a)

      What N3a's seams accept, so each later PR adds files without editing the seam.

      SeamA contribution isSignature
      py/frappe_nix_tools/frappe_nix_tools/commands/<name>.pya module (or a subpackage, for a command group such as repo); cli.py imports every one there, in name orderregister(subparsers), adding one or more subcommands with set_defaults(func=run), where run(args) -> int is the exit code. Raise frappe_nix_tools.common.report.FrappeNixError (ConfigError → 2, EnvError → 3) for a one-line failure.
      py/frappe_nix_tools/frappe_nix_tools/data/**a fileRead with frappe_nix_tools.common.data_path(rel) (a Path), or printed by frappe-nix data-path <rel>.
      frappe_nix_tools.common.config(N3a; every consumer reads through it)resolve(pyproject_path, *, lock_path=None, profile_dir=None) -> Resolved and resolve_doc(doc, *, root, …), with Resolved.cfg, .modules, .profile, .sources (the layer that set each key, for --explain), .repo_host, .notices and .get(dotted_key). No [tool.frappe-nix] raises NotOptedIn (exit 2). Schemas are validated by frappe_nix_tools.common.schema (the keywords the shipped schemas use; x-app-only marks app-only module parameters).
      lib/standards/tools/<name>.nixa file; becomes packages.<name>, apps.<name>, a dev-shell package in an opted-in app, and .#<name> in an opted-in app's flake. A name the flakes already use (default, frappe-init, frappe-nix-tools, backup-fetch, relock) fails evaluation.{ pkgs, lib, frappeNixTools, ... }: <derivation with meta.mainProgram>. It must propagate nothing (no propagatedBuildInputs, no Python package such as frappeNixTools itself): the dev shell would put a propagated Python's site-packages on PYTHONPATH, ahead of the bench venv's. Wrap a Python program's bin/ instead, as tools/frappe-nix.nix does; standards-app-flake fails otherwise.
      lib/scripts.d/<name>.nixa file; merged over lib/scripts.nix's scripts in name order. Redefining any script fails evaluation.{ lib, pkgs, appMode, lockDir, pythonBin, benchBin, atBench, atRepo, siteFlag, … }: { <script> = { exec; description; }; } (every lib/scripts.nix argument and snippet: also offlineMigrateEnv, workspaceBin, registerWorkspaceMember, refreshNodeModules[Soft], regenNodeLocks[Soft], syncRegistry; take ...; see lib/scripts.d/README.md)
      tests/standards/<area>.nixa file; its checks join the flake's checks and standards-all. Every check is named standards-<name> (no frappe-nix check is), so none can replace another. Two areas defining the same check, a name without the prefix, or standards-all fail evaluation.{ pkgs, lib, self, inputs, frappeNixTools, checks, ... }: { standards-<check> = <derivation>; }, where checks is python-devops-nix's lib.checks.mk for frappe-nix (checks.script "standards-<check>" { … } ''…'')
      lib/standards/shell.nix(N3a only){ pkgs, pyproject ? null }: { optedIn, packages, apps, enterShell, devenvModule }; modules/devenv.nix passes the app's pyproject.toml and, in app mode, adds apps to the flake and imports devenvModule (packages and enterShell) into the shell. All of them are empty unless optedIn (S35). packages also carries N1's nixfmt/statix/deadnix. optedIn is for the other opt-in-gated parts of modules/devenv.nix (N1's port salt and bench-root dev-group trim).

      frappe-nix pin-path <input> reads --lock, by default the nearest flake.lock at or above the current directory without leaving the git work tree (so an app in a subdirectory, like frappe-nix's tests/fixtures/standards-app, reads its own), falling back to the work tree root's. It prints the Nix store path when the tree the lock's narHash implies is already in the store, and otherwise fetches it into .dev-dist/pins/<name>-<rev>/ beside that lock: a github node from codeload, a gitlab node from the GitLab API archive (host defaults to gitlab.com), a git node by git clone --filter=blob:none and a checkout of the locked rev. FRAPPE_NIX_FETCH_TOKEN, when set, is sent as Authorization: Bearer (for git, through http.extraHeader); without it a 401, 403 or 404 exits 3 with the hint to set it. A tree already in .dev-dist/pins is reused only after its NAR hash is recomputed and matches the lock; otherwise it is refetched (no stamp file is trusted, since .dev-dist sits in the app checkout, where a PR could commit any tree under that name). A locked owner, repo or host that is not a name, a git url that is not an https, http, ssh or file URL with a path, or a rev that is not a 40-hex SHA, exits 2 before anything is fetched or written. frappe-nix's own pins (frappe-semgrep-rules, marketplace, pilot) are read only through the lock's frappe-nix node (the root's inputs only in frappe-nix's own lock, which has no frappe-nix input), so a root input of the same name never shadows them, and each must lock github:frappe/semgrep-rules, frappe/marketplace or frappe/pilot respectively (case-insensitively); any other repository exits 2. standards-profile is read only from the root's inputs. Any other input is the root's own, else frappe-nix's. FRAPPE_NIX_PIN_URL (with {host}, {owner}, {repo}, {rev}) replaces a tarball URL, for mirrors and tests. frappe-nix config <key> reads --pyproject, by default the nearest pyproject.toml found the same way, resolves it (§8.4), takes dotted keys (tests.setup, modules.ssort, profile.name), prints a list one item per line, a boolean as true/false, and a table as one line of JSON (--json prints any value as JSON); on an app without [tool.frappe-nix] it exits 2 with the opt-in hint.


      2. What an app gets: the managed-file contract

      This section applies to opted-in apps only (S35). What an app gets is decided by its resolved configuration, so §8 (profiles and modules) is the companion to read first: every file below names the module that enables it and the profile values it reads. Values shown are the recommended ones unless a section says otherwise.

      2.1 [tool.frappe-nix]: the app's parameters

      [tool.frappe-nix] lives in the app's pyproject.toml and is app-owned: sync creates it once (only on opt-in, S35), never rewrites it, and validates it against frappe_nix_tools/data/schema/tool-frappe-nix.schema.json. Unknown keys are errors (exit 2).

      The table holds two kinds of key:

      • App keys, which only an app can set: the top-level keys below and the [[…]] lists. A profile that sets one is exit 2.

      • Module tables ([tool.frappe-nix.<module>]) and [tool.frappe-nix.org], which have the same shape as in a profile (§8.1). The app's values are the last layer of the merge (§8.4): an app switches a module on or off, or changes one parameter, by writing just that key.

      [tool.frappe-nix]
      schema = 1                                   # required
      profile = "recommended"                      # optional; "minimal" when absent (S35). A built-in name ("minimal",
                                                   # "recommended", or a frozen snapshot "recommended@1.0", S42), an org
                                                   # profile flake URL ("github:<owner>/<repo>[/<ref>]", "gitlab:…",
                                                   # "git+https://…"), or an in-repo profile "./<dir>" (§8.3)
      frappe-major = 16                            # required. Drives every version-<major> string, range and branch
      siblings = ["erpnext", "hrms"]               # bench apps besides frappe, in install order. Each is a key of
                                                   # known-apps.json (or of a profile's or this table's [known-apps]),
                                                   # "<owner>/<repo>" for any app on GitHub, or an object (below).
                                                   # Default when created: hooks.required_apps, in order
      # siblings = ["erpnext", { repo = "example/shared_lib", branch = "main", range = ">=2.0.0,<3.0.0" }]
      #                                            # object form: any of repo, flake-url (gitlab:/git+https:), branch,
      #                                            # range, desk_global; unset fields come from the matching known-apps rule
      repo = "example/my_app"                      # optional; "<owner>/<repo>" (or "<host>/<group>/…/<repo>" off GitHub).
                                                   # Default: from origin (§2.2)
      integration-branch = "develop"               # optional; any branch name. Default: "develop" under
                                                   # releases.branching = "develop+version", "main" under "main+tags",
                                                   # whether or not releases is on. `--standards` writes origin's default
                                                   # branch here when it differs from that default (S41)
      retire-keep = []                             # paths exempt from every retire rule (§2.4.1)
      site = "carbon-theme.localhost"              # optional; default "<App-hyphen>.localhost"
      nightly-suites = []                          # shell commands nightly runs inside the dev shell with the site up,
                                                   # e.g. ["node scripts/test-tables.ts"]; env FRAPPE_SITE_URL,
                                                   # FRAPPE_ADMIN_PASSWORD and FRAPPE_NIX_ARTIFACT_DIR are set (§4.6)
      generated = []                               # globs of tracked generated files, e.g. ["<app>/public/js/generated/**",
                                                   # "<app>/public/js/job_timeclock/types.ts", "components.d.ts"].
                                                   # Fed into the prek global exclude, oxfmt and oxlint ignorePatterns, and
                                                   # the validate_copyright exclude (§2.14). Their freshness is the app's
                                                   # job, through shell-checks or ci:typecheck
      build = false                                # true: the app's `build` script is a real build step even though no Vite
                                                   # config, nested frontend or SPA exists (carbon's patch-assets/audits)
      shell-checks = []                            # commands that need the dev shell and a git-clean result afterwards, e.g.
                                                   # ["yarn -s generate-types"]; run by `frappe-test --ci` (§5.1 stage 8b)
      frappe-node-modules = false                  # true: typecheck installs frappe's node_modules under FRAPPE_PATH (§4.2)
      
      [[tool.frappe-nix.untested]]                 # module tests: testmap exemptions; shrink-only (S24)
      target = "standards_fixture.api.legacy"      # dotted path of a target (§5.1.1)
      reason = "Removed in 16.2; kept for old kiosk bundles"   # ≥ 10 characters
      
      [[tool.frappe-nix.coverage-omit]]            # module tests: extra coverage omit globs; shrink-only (R7), amber in A8
      glob = "timeclock/www/job_timeclock_legacy/*"
      reason = "Legacy kiosk page, replaced by job_timeclock in 16.3"     # ≥ 10 characters
      
      [[tool.frappe-nix.unchecked-js]]             # module typescript (check-js on): desk/web JS files excluded from
      path = "esign/public/js/controls/upload.js"  # strict checkJs; shrink-only (R6), amber in A7. A path, not a glob;
      reason = "Pre-typing legacy control; JSDoc pass tracked in #41"     # it must be a tracked .js file; ≥ 10 characters
      
      [[tool.frappe-nix.override-doctype-class]]   # module metadata: A.3 allow-list; every override_doctype_class
      doctype = "Version"                          # hook needs an entry
      reason = "Must replace, not extend: …"       # ≥ 20 characters
      
      # Module tables. Every key is optional here; the profile supplies the rest (§8.5). Shown: the app-only
      # parameters each module has, plus two examples of overriding a profile value.
      
      [tool.frappe-nix.ssort]
      enable = true                                # example: switch on a module the profile leaves off
      
      [tool.frappe-nix.org]
      publisher = "Example Apps Ltd"               # example: an org value for this app only (S37)
      
      [tool.frappe-nix.dev-shell]                  # app-only flake parameters (§2.5); custom inputs go in its local region
      systems = ["x86_64-linux", "aarch64-linux", "aarch64-darwin"]   # flake systems
      extra-substituters = []                      # appended to nixConfig.extra-substituters
      extra-trusted-public-keys = []               # appended to nixConfig.extra-trusted-public-keys
      frappe-nix-url = ""                          # "" = github:Avunu/frappe-nix/release. Any flake URL (a fork, a
                                                   # mirror, a tag or a rev); see §2.5 for what CI then needs
      
      [tool.frappe-nix.known-apps."example/shared_lib"]   # optional; same shape as a profile's [known-apps] (§8.1)
      repo = "example/shared_lib"
      branch = "main"
      range = ">=2.0.0,<3.0.0"
      
      [tool.frappe-nix.tests]
      setup = []                                   # steps before the app's tests. Each is "module:<dotted test module>"
                                                   # (bench run-tests --module) or "execute:<dotted callable>".
                                                   # Default when empty: "module:erpnext.tests.bootstrap_test_data" if
                                                   # erpnext is a sibling, else "execute:frappe.utils.install.complete_setup_wizard"
      devguard-disable = []                        # dev guards frappe-test's test processes run without, e.g. ["mail"]
                                                   # for a mail transport; never egress. The shell and devenv up keep them
      js-coverage-min = 50                         # node:test line-coverage minimum; only used when test/unit/ exists
      
      [tool.frappe-nix.releases]
      bootstrap-sha = "3c33bb4b…"                  # optional; rendered into release-please-config.json
      
      [tool.frappe-nix.pilot-assets]
      enable = false                               # true → managed .github/workflows/assets.yml and the release dispatch
      
      [tool.frappe-nix.listing]
      approved = false                             # true once the app's marketplace listing is approved: the README links it (§2.19)
      
      [tool.frappe-nix.test-utils]
      track-overrides = false                      # true → the test_utils track_overrides hook (needs HASH:/REPO: annotations)
      
      [tool.frappe-nix.typescript]                 # app-only parameters (the profile sets enable, strict-extras, check-js)
      browser = true                               # false: no tsconfig.browser.json even when public/**/*.ts is tracked
      browser-include = []                         # replaces the default browser include (§2.9)
      web-include = []                             # globs of JS under the package that run on web pages, not the desk
                                                   # (e.g. "esign/public/js/web/**"): moved from desk to web in tsc and oxlint
      paths = {}                                   # compilerOptions.paths, in tsconfig.base.json
      exclude = []                                 # appended to every project's exclude. Only non-source paths: an entry
                                                   # matching a tracked .js/.ts/.vue file under the package is exit 2
                                                   # (use unchecked-js or an spa entry)
      audit-consumer = false                       # true: typecheck runs `frappe-types audit-consumer --strict` (§4.2)
      
      [[tool.frappe-nix.typescript.spa]]           # a Vue/Vite SPA that lives at the root or inside the package and has no
      root = "portal"                              # package.json of its own. "." for the repo root (timeclock)
      include = ["portal/src/**"]                  # its sources; removed from the browser, desk and web projects
      tsconfig = "portal/tsconfig.json"            # app-owned; MAY extend another SPA's app-owned config (portal's
                                                   # "../tsconfig.json" when an SPA owns the root), never a managed file
      check = "node scripts/vue-tsc.cjs --noEmit -p portal/tsconfig.json"   # run by `typecheck`, chained into scripts.check
      
      [tool.frappe-nix.js.oxlint]
      ignore = []                                  # appended to ignorePatterns
      globals = {}                                 # merged into the desk- and web-JS globals
      overrides = []                               # appended; each {files=[…], rules={…}, globals={…}}.
                                                   # While js.locked-rules is true it MUST NOT name the locked rules
                                                   # (typescript/no-explicit-any, typescript/ban-ts-comment,
                                                   # typescript/consistent-type-imports) or change categories (exit 2)
      
      [tool.frappe-nix.js.oxfmt]
      ignore = []                                  # appended to ignorePatterns
      
      [tool.frappe-nix.stylelint]
      globs = []                                   # default: discovered "<app>/public/**/*.scss" when any exist

      A [[…]] list belongs to the module named in its comment. While that module is off, the list is ignored and not validated, and its ratchet doesn't run.

      How the two SPA layouts in the fleet are declared:

      # erpnext_taskview: desk Vue in public/js built by the root vite.config.ts, plus portal/ (no package.json)
      [[tool.frappe-nix.typescript.spa]]
      root = "."
      include = ["erpnext_taskview/public/js/**"]
      tsconfig = "tsconfig.json"                   # app-owned, so the managed solution is tsconfig.solution.json
      check = "node scripts/vue-tsc.cjs --noEmit -p tsconfig.json"
      [[tool.frappe-nix.typescript.spa]]
      root = "portal"
      include = ["portal/src/**"]
      tsconfig = "portal/tsconfig.json"            # keeps "extends": "../tsconfig.json"
      check = "node scripts/vue-tsc.cjs --noEmit -p portal/tsconfig.json"
      
      # timeclock: vite.config.ts and tsconfig.json at the root, sources in the package
      [[tool.frappe-nix.typescript.spa]]
      root = "."
      include = ["timeclock/public/js/timeclock/**", "timeclock/public/js/job_timeclock/**"]
      tsconfig = "tsconfig.json"
      check = "node scripts/vue-tsc.cjs --noEmit -p tsconfig.json"

      frappe_nix_tools/data/known-apps.json (N3a) holds the template for each known sibling. {n} is the major and {n1} is the major plus one. It names only Frappe's own apps and one generic rule for any GitHub-hosted app; a profile's [known-apps] table, and then the app's [tool.frappe-nix.known-apps], add or override entries with the same shape (§8.1, §8.4). The generic rule assumes the Frappe convention (version-{n} branches, major-tracking versions). A sibling on another convention (a main-branch, semver shared library) is declared with the object form in siblings or a known-apps entry, and every check that compares a sibling's branch or range (C3, C4, L3) uses that resolved value.

      {
        "frappe":   { "repo": "frappe/frappe",   "branch": "version-{n}", "range": ">={n}.0.0,<{n1}.0.0", "desk_global": null },
        "erpnext":  { "repo": "frappe/erpnext",  "branch": "version-{n}", "range": ">={n}.0.0,<{n1}.0.0", "desk_global": "erpnext" },
        "hrms":     { "repo": "frappe/hrms",     "branch": "version-{n}", "range": ">={n}.0.0,<{n1}.0.0", "desk_global": "hrms" },
        "payments": { "repo": "frappe/payments", "branch": "version-{n}", "range": ">=0.0.1,<1.0.0",       "desk_global": null },
        "*/*":      { "repo": "{owner}/{name}",  "branch": "version-{n}", "range": ">={n}.0.0,<{n1}.0.0", "desk_global": null }
      }

      For an <owner>/<repo> sibling, the app name is the repo name. The flake input name is the app name. The flake URL is github:<owner>/<repo>/<branch>, or the object's flake-url (gitlab:<group>/<repo>/<branch>, git+https://<host>/<path>?ref=<branch>) for a sibling hosted elsewhere. The required_apps spelling is "<owner>/<repo>" (D6). The frappe-dependencies key is the bare app name. A bare name that is in none of known-apps.json, the profile's [known-apps] and the app's [tool.frappe-nix.known-apps] is exit 2 ("unknown sibling; write it as /"). The Avunu profile adds no entries: its siblings are written Avunu/<repo> and use the generic rule.

      2.2 Discovered facts (never declared)

      Sync computes these from git ls-files (tracked files only), so the result is the same on every machine. --check recomputes them, so adding a first .ts file, for example, shows up as drift until sync is run.

      FactRule
      spa_globsThe union of every [[tool.frappe-nix.typescript.spa]].include, plus <root>/** for each SPA whose root isn't .
      desk_jsTracked <app>/**/*.js excluding *.bundle.js, **/public/dist/**, **/node_modules/**, <app>/www/**, **/web_form/**, <app>/templates/**, every nested frontend, spa_globs, typescript.web-include and cfg.generated
      web_jsTracked <app>/www/**/*.js, <app>/**/web_form/**/*.js, <app>/templates/**/*.js and typescript.web-include, excluding spa_globs and cfg.generated
      browser_tstypescript.browser is not false, and either a non-empty typescript.browser-include or tracked <app>/public/**/*.ts (not public/dist) that remain after removing spa_globs and cfg.generated
      viteA tracked vite.config.* or vite.*.config.* at the root or in a nested frontend
      solution"tsconfig.json", or "tsconfig.solution.json" when any SPA's tsconfig is tsconfig.json
      scripts_tsTracked scripts/**/*.ts, marketplace/**/*.ts or ci/**/*.ts
      test_tsTracked test/**/*.ts
      unit_testsTracked test/unit/**/*.test.ts
      scssstylelint.globs, or ["<app>/public/**/*.scss"] when any such file is tracked
      nested_frontendsTop-level directories other than node_modules, .frappe-nix, nix and (while the docs-site module is on) docs-site that contain a tracked package.json. A frontend without its own package.json, such as taskview's portal/, is declared as an SPA instead.
      docs_siteA tracked docs-site/package.json
      vue_sfcA tracked *.vue file outside every nested frontend, docs-site/ and **/node_modules/**: a Vue component the app's own package.json builds (§2.8.1)
      gitmodulesA tracked .gitmodules
      github_workflowsAny tracked file under .github/workflows/
      has_listingA tracked marketplace/listing.toml
      has_shotsA tracked marketplace/screenshots.ts
      app_typelisting.toml type; "extension" when there is no listing
      repo[tool.frappe-nix].repo when set; else origin's URL normalised to its path (<owner>/<repo> on GitHub; <group>/<subgroup>/…/<repo> elsewhere, with repo_host set to the host); else <org.github-owner>/<app> when the resolved org.github-owner is set; else exit 2 asking for repo. Only the modules that render a repository URL (ci, listing, readme, releases) need it; for the others an unknown repo is not an error. On a non-GitHub repo the GitHub-only modules resolve to off (§8.2), and an app table that explicitly enables one is exit 2 naming it.
      frappe_nix{rev, version, owner, name, url}. rev is flake.lock → nodes[root.inputs["frappe-nix"]].locked.rev, and owner/name that node's locked.owner/locked.repo (Avunu/frappe-nix unless dev-shell.frappe-nix-url names a fork), read after sync's phase A (§3.3), so a missing flake or a main-locked frappe-nix is fixed before anything uses it. version is the running frappe_nix_tools.__version__. --check fails with exit 3 if the running frappe-nix-tools was not built from rev and the environment variable FRAPPE_NIX_ALLOW_SKEW is unset (§3.7).

      2.3 Template context

      Every Jinja template (StrictUndefined; files end in .j2) receives this context:

      app, app_hyphen, dist (pyproject [project].name), repo, title, tagline (listing → hooks app_title/app_description),
      frappe = {major, next, branch: "version-<major>", preset: "version-<major>", range},
      siblings = [{name, input, flake_url, branch, range, desk_global, required: bool}],   # required = in hooks.required_apps
      site, cfg (= the resolved configuration, §8.4: app keys plus every module table, defaults applied),
      modules (= {<module>: bool}, the resolved `enable` of each module after the dependency rules of §8.2),
      org (= cfg.org, with copyright-holder defaulted to publisher), profile = {name, source, rev},
      branches = {integration: <integration-branch>, release: "version-<major>" | null},   # S41; release from releases.branching
      gates = [enabled gate names, in the order pr-policy, lint, typecheck, test, marketplace],   # §4.2
      discover (§2.2), frappe_nix = {rev, version, owner, name, url}, floors (§2.4), app_type

      profile.source is "builtin" or the org profile's flake URL, and profile.rev its locked revision (empty for a built-in). No template renders either into a file, so a profile release changes only the files whose content changes (§3.6). branches is computed even when releases is off, because dependabot's target-branch and the CI triggers use it: branches.integration is always [tool.frappe-nix] integration-branch (§2.1), and branches.release is version-<major> only while releases is on with develop+version, else null.

      2.4 Inventory

      Every file below is listed in a manifest.d/*.json fragment. Each entry has the form {path, template, strategy, module, when, uses, floors?, overridable?}:

      • module is the module (§8.2) that enables the entry. The entry is live only when modules[<module>] is true and when is true. module may be a list, meaning any of them (the shared infrastructure files: .pre-commit-config.yaml and tools/).

      • when is a Python expression over the context (for example "discover.scss"), "True" when the module alone decides.

      • uses lists the profile values (org.* and module parameters) the template reads. It is documentation the engine checks: a template that reads a cfg/org key missing from uses fails the N3 nix check standards-manifest, and a live entry whose uses names an empty org value is exit 2 naming it (S37).

      • overridable: true lets an org profile replace the template (§8.1).

      Files whose entry isn't live MUST NOT exist. Sync deletes them (and retracts merged keys) as §3.3 step 6 says; otherwise --check reports exit 1 "file should not exist".

      Merged files. pyproject.toml and package.json are touched by several modules. Each managed key or table belongs to one module and is managed only while that module is on (§2.8, §2.12). The file itself is "live" while any of its key groups is.

      PathStrategyModule (when)Profile values usedOwner
      flake.nixwhole + local region inputs (§2.5)dev-shelldev-shell.systems, dev-shell.extra-substituters, dev-shell.extra-trusted-public-keys, dev-shell.frappe-nix-url (the standards-profile input comes from profile, §8.3)N3
      .envrcwhole + local region envrcdev-shellnoneN3
      .gitignoreblocks (# >>> frappe-nix >>> block, legacy markers kept)dev-shellnoneN3
      .editorconfigwhole + local region editorconfigeditorconfigeditorconfig.indent, editorconfig.line-lengthN3
      .pre-commit-config.yamlwhole + local region repos; third-party revs are floorsany hook module: python-lint, ssort, js, stylelint, workflow-lint, shell-lint, hygiene, metadata (compat hook), commits, test-utilseach hook's module switch; hygiene.max-file-kb; test-utils.hooks, test-utils.track-overridesN3
      committed.tomlwholecommitscommits.allowed-types, commits.subject-length, releases.version-scheme (comment only)N3
      tools/pyproject.tomlwhole; version floors checked in tools/uv.lockany module with a tool pinned there: python-lint, python-types, semgrep, workflow-lint, shell-lint, commits, or .pre-commit-config.yaml live (prek)the dependency list is the union of the enabled modules' toolsN3
      tools/uv.lockseed (uv lock --project tools)as tools/pyproject.tomlnoneN3
      pyproject.tomltoml-merge (§2.12)key groups of metadata, python-lint, python-types, tests, test-utilsmetadata.build-backend, python-lint.* (select, ignore, line-length, indent-style, quote-style, typing-modules), python-types.error-on-warning, tests.coverage.initial-floorN3
      <app>/__init__.pyblocks (x-release-please block, §2.13)releasesnoneN3
      package.jsonjson-merge (§2.8)key groups of metadata, js, stylelint, typescript, tests, python-lint, python-types, vite-registerorg.license, org.publisher (only when set), metadata.package-type, metadata.package-manager, metadata.node-engine, typescript.preset, tests.js-coverage-minN3
      yarn.lockseed (yarn install)as package.jsonnoneN3
      .oxlintrc.jsonwhole (JSON, no header)js (tool oxc)js.oxlint.*, js.locked-rulesN3
      .oxfmtrc.jsoncwholejs (tool oxc)js.oxfmt.*, js.format-width, js.format-tabs, js.format-tab-widthN3
      .stylelintrc.jsonjson-mergestylelint (discover.scss)noneN3
      tsconfig.json or tsconfig.solution.json (discover.solution)wholetypescript (any managed TS project)noneN3
      tsconfig.base.jsonwholetypescript (browser_ts or scripts_ts or test_ts)typescript.strict-extras, typescript.presetN3
      tsconfig.browser.jsonwholetypescript (browser_ts)noneN3
      tsconfig.scripts.jsonwholetypescript (scripts_ts)noneN3
      tsconfig.test.jsonwholetypescript (test_ts)noneN3
      tsconfig.desk.jsonwholetypescript (typescript.check-js and desk_js)noneN3
      tsconfig.web.jsonwholetypescript (typescript.check-js and web_js)noneN3
      release-please-config.jsonwhole (JSON, no header)releasesreleases.tool, releases.tag-prefix; README.md as an extra file when readme is on under main+tags (§2.19)N3
      .release-please-manifest.jsonseed {".": "<__version__>"}; when seeding, sync also sets package.json version to __version__ (§2.16)releasesnoneN3
      scripts/vite-register.mjswhole (ts header)vite-register (discover.vite)noneN2
      scripts/vue-tsc.cjswhole (ts header)typescript (vue_typescript5: a tracked .vue file outside a nested frontend and docs-site/, and a managed TS project or an SPA entry)noneN3
      scripts/vue-sfc-typescript.mjswhole (ts header)typescript (vue_typescript5 and discover.vite)noneN3
      .git-blame-ignore-revsseed (header only) and validated (§2.20)hygienenoneN3
      nix/node-locks/<key>/{yarn.lock,source.json}seed from frappe_nix_tools/data/node-locks/version-<major>/dev-shell (sibling present and no lock)noneN3
      .github/workflows/ci.ymlwhole (frappe-nix SHA sync-owned); one caller job per enabled gate (S39)cici.test-timeout-minutes, ci.schedules.ci, ci.runs-on; the gate listN4
      .github/workflows/pr-policy.ymlwholeci and commitsreleases.version-schemeN4
      .github/workflows/release.ymlwholeci and releasesreleases.branching, releases.tag-prefix, ci.schedules.release, ci.github-app, listing.publish, listing.registry-fork, pilot-assets.enableN4
      .github/workflows/deps.ymlwholeci and dependabotdependabot.auto-merge, dependabot.auto-merge-policy, dependabot.update-branches, ci.schedules.deps-sweep, ci.schedules.deps-relock, ci.github-app, repo-policy.merge-methodsN4
      .github/workflows/nightly.ymlwholeci (ci.nightly)ci.schedules.nightly, ci.github-app (with screenshots), dependabot.auto-merge-policy with dependabot.auto-merge and repo-policy.merge-methods (with screenshots and dependabot); the nightly job switches (§4.6)N4
      .github/workflows/assets.ymlwhole; the pilot SHA is a floor (preserved)pilot-assetsnoneN4
      .github/dependabot.ymlwhole + local region updatesdependabotdependabot.ecosystems, dependabot.cadence, dependabot.cooldown-days, dependabot.ignore, docs-site.action-patterns, docs-site.cooldown-exclude-actions, docs-site.package-namesN4
      .github/zizmor.ymlwholeworkflow-lint (when there is a workflow or dependabot.yml to audit)dependabot.cooldown-days, workflow-lint.release-tag-workflowsN4
      marketplace/shots.d.tswholescreenshots (discover.has_shots)noneN5
      marketplace/semgrep-baseline.jsonseed {"schema":1,"findings":[]} and validated (§5.2)listingnoneN5
      marketplace/listing.tomlseed from templates/marketplace/listing.toml.j2 (overridable) and validated by frappe-listinglisting (sync --init-listing only)org.website-url, org.docs-urlN5
      README.mdblocks (<!-- frappe-nix:begin <name> -->, §2.19); block templates overridablereadme (discover.has_listing)org.license, org.copyright-holder, org.email, org.support-url, org.docs-url, org.dev-docs-url, org.repo-url, org.readme.badges, org.readme.links, readme.install-refN5
      <app>/desktop_icon/<app>.jsongenerated by frappe-icon build --write-fixture; freshness checked by frappe-icon checkicons (app_type == "application")noneN5
      each [[extra-files]] entry of the org profilewhole or seed (§8.1)the module the entry namesas the entry declaresP (the profile)

      These are not managed, but are checked or tolerated:

      • docs/ is owned by the app's docs tool (in the Avunu fleet, Avunu/site-docs, which publishes it at docs.avunu.net; the app's docs.yml calls its shared check), and so is docs-site/ where an org builds a site in each app (the docs-site module). The tool's workflows are left alone, but zizmor and actionlint lint them when workflow-lint is on.

      • nix/uv.lock and nix/node-locks/** belong to relock, and so does types/doctypes.d.ts after a nix bump (§2.9, §4.5).

      • CHANGELOG.md belongs to release-please.

      • semgrep/*.yml is the app's own extra rules, which lint runs.

      • nix/local.nix is the app's flake-parts module.

      2.4.1 Retired files (S31)

      manifest.d/core.json carries a retire list (N3 owns it; N4 adds the workflow rules). Each rule belongs to the module that replaces the function it retires, and applies only while that module is on: an app that doesn't enable releases keeps its own release workflow, one without dependabot keeps its own auto-merger, and one without ci keeps every workflow. An org profile adds rules of the same shape with [[retire]] (§8.1), and an app exempts any path from every rule with [tool.frappe-nix] retire-keep. Sync deletes every tracked match of an applying rule. --check reports each one as exit 1 with the problem legacy file. Audit row A9 evaluates the same list, through frappe-nix sync --check --format json, so the two can't diverge.

      RuleModuleMatches
      Legacy release workflowreleases (with ci)Any tracked .github/workflows/*.y*ml that isn't a managed caller and isn't a docs tool's docs*.yml, and whose text contains release-please-action. In the Avunu fleet: carbon's release-please.yml.
      Legacy auto-merge workflowdependabot (with ci)The same set of files, whose text contains gh pr merge --auto or dependabot/fetch-metadata. In the Avunu fleet: carbon's and taskview's dependabot-auto-merge.yml.
      Legacy JS configjs (tool oxc).oxfmtrc.json (the managed file is .jsonc), .eslintrc*, eslint.config.*, .prettierrc*, prettier.config.*.
      Legacy Python configpython-lint.flake8, setup.cfg with only a [flake8] section.
      Legacy packagingmetadata (with build-backend = "flit")MANIFEST.in, requirements.txt (retired when sync runs).
      Legacy Nixdev-shellnix/node-offline-hashes.json (frappe-nix throws on its option).
      Legacy asset registrationvite-registerupdate-assets.mjs.

      Name-only rules are not built in: a file name says nothing about what a workflow does, so check.yml and version-branch-guard.yml, whose jobs moved to ci.yml in the Avunu fleet, are retired by the Avunu profile's [[retire]] entries (§8.6), not by frappe-nix. A file that matches but has app-specific content worth keeping is still deleted unless it is in retire-keep; the PR diff shows it. Retiring is a one-way step, so the adoption PR (Avunu fleet: PR A) is the PR that carries these deletions.

      2.5 flake.nix (whole)

      Module dev-shell (every opted-in app, including minimal). Parameters (app-only, [tool.frappe-nix.dev-shell]): systems, extra-substituters, extra-trusted-public-keys, frappe-nix-url. py/frappe_nix_tools/frappe_nix_tools/data/templates/flake.nix.j2. The output MUST be byte-stable under nixfmt (an acceptance test checks this). An app that has not opted in keeps the flake.nix that templates/app/ gave it, untouched (S35).

      Where an app's own Nix goes:

      • Extra inputs go in the local region inputs, inside the inputs attribute set. Its content is kept verbatim; a name that collides with a managed input (frappe-nix, nixpkgs, frappe, standards-profile, a sibling) is exit 2.

      • Outputs (packages, overlays, nixosModules, checks, extra dev-shell settings) go in nix/local.nix, a flake-parts module imported below; it can define perSystem and flake.* outputs and reads the extra inputs through inputs.

      • Systems and binary caches are the parameters above.

      • The frappe-nix source. frappe-nix-url replaces github:Avunu/frappe-nix/release with any flake URL: a tag (…/v1.2.3), a rev, a fork or a mirror. Phase A then re-locks only when the locked node's original differs from that URL (§3.3), so a pin is never undone. A GitHub fork is supported everywhere: the caller workflows' uses: and the no-Nix install read the locked owner/repo (§2.2 frappe_nix, §3.7, §4.1), and the deps, nightly and release callers pass a fork as frappe-nix-repo, the one repository from which their jobs that can hold the GitHub App's key install frappe-nix-tools (any other flake.lock owner fails those jobs; Avunu/frappe-nix is the default). A non-GitHub URL (git+https:) works for the dev shell and sync, and is exit 2 while ci is on, because a GitHub uses: can't name it. The skew rule (§3.7) compares the locked rev with the rev the running frappe-nix-tools was built from, so any pin works as long as the two agree.

      First opt-in. When an app opts in (--standards) and its existing flake.nix has no managed header, sync compares it with what templates/app/flake.nix renders for the app. If they differ, sync exits 2, prints the diff of what would be replaced, and names the three places above; --force replaces it anyway. The same rule applies to .envrc. (Avunu fleet: PR A passes --force where an app's flake predates the template, after its diff is reviewed.)

      # frappe-nix:managed — generated by frappe-nix (`frappe-init --sync`); edit only inside the frappe-nix:local region.
      # App-specific Nix goes in nix/local.nix, a flake-parts module imported below when it exists.
      {
        description = "{{ app }}: {{ title }}";
      
        inputs = {
          frappe-nix.url = "{{ cfg['dev-shell']['frappe-nix-url'] or 'github:Avunu/frappe-nix/release' }}";
          nixpkgs.follows = "frappe-nix/nixpkgs";
          frappe = {
            url = "github:frappe/frappe/{{ frappe.branch }}";
            flake = false;
          };
      {%- if profile.source != "builtin" %}
          standards-profile = {
            url = "{{ profile.source }}";
            flake = false;
          };
      {%- endif %}
      {%- for s in siblings %}
          {{ s.input }} = {
            url = "{{ s.flake_url }}";
            flake = false;
          };
      {%- endfor %}
          # frappe-nix:local-begin inputs
          # frappe-nix:local-end inputs
        };
      
        nixConfig = {
          extra-substituters = [ "https://devenv.cachix.org"{% for u in cfg['dev-shell']['extra-substituters'] %} "{{ u }}"{% endfor %} ];
          extra-trusted-public-keys = [
            "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="
      {%- for k in cfg['dev-shell']['extra-trusted-public-keys'] %}
            "{{ k }}"
      {%- endfor %}
          ];
        };
      
        outputs =
          { frappe-nix, ... }@inputs:
          frappe-nix.lib.mkFlake { inherit inputs; } (
            { lib, ... }:
            {
              imports = [
                frappe-nix.flakeModules.default
              ]
              ++ lib.optional (builtins.pathExists ./nix/local.nix) ./nix/local.nix;
      
              systems = [
      {%- for sys in cfg['dev-shell'].systems | sort %}
                "{{ sys }}"
      {%- endfor %}
              ];
      
              perSystem =
                { pkgs, ... }:
                {
                  formatter = pkgs.nixfmt;
                  frappe-nix = {
                    enable = true;
                    defaultSite = "{{ site }}";
                    app = {
                      enable = true;
                      frappeVersion = "{{ frappe.preset }}";
                      inherit (inputs) frappe;
      {%- if modules["docs-site"] %}
                      excludeNodeTargets = [ "docs-site" ];   # §5.11
      {%- endif %}
                      siblings = [
      {%- for s in siblings %}
                        {
                          name = "{{ s.name }}";
                          src = inputs.{{ s.input }};
                        }
      {%- endfor %}
                      ];
                    };
                  };
                };
            }
          );
      }

      standards-profile is the org profile's input (S38, §8.3). Nothing in the app's Nix evaluation reads it; it is in flake.nix so that flake.lock pins the profile revision the rendered files came from. Sync writes this file and locks it in phase A (§3.3), before anything reads flake.lock. nix is required for --sync; --check never runs it and reports missing lock nodes as exit 1.

      2.6 .envrc (whole) and the .gitignore block

      Module dev-shell. Profile values: none. These are the opted-in forms, rendered from data/templates/envrc.j2 and data/templates/gitignore.block; templates/app/.envrc and templates/app/.gitignore stay as they are in main for apps that have not opted in.

      .envrc (local region envrc, for dotenv, exports and other direnv lines; it is sourced after use flake):

      # frappe-nix:managed — generated by frappe-nix; edit only inside the frappe-nix:local region.
      use flake . --no-pure-eval
      # frappe-nix:local-begin envrc
      # frappe-nix:local-end envrc

      The .gitignore managed block (between the existing # >>> frappe-nix >>> markers) is the templates/app/.gitignore body plus:

      /.dev-dist/
      *.tsbuildinfo
      .ruff_cache/
      __pycache__/

      2.7 .editorconfig (whole + local region)

      Module editorconfig. Profile values: editorconfig.indent ("tab", Frappe's convention, in recommended; or "space", which renders indent_style = space with indent_size = 4) and editorconfig.line-length (110). This fixes two bugs in carbon_frappe's copy: YAML and Nix can't use tabs.

      # frappe-nix:managed — generated by frappe-nix (`frappe-init --sync`); edit only inside the frappe-nix:local region.
      root = true
      
      [*]
      charset = utf-8
      end_of_line = lf
      insert_final_newline = true
      trim_trailing_whitespace = true
      
      [*.{py,js,mjs,cjs,ts,mts,vue,css,scss,html,jinja,toml,json,jsonc,sh}]
      indent_style = {{ cfg.editorconfig.indent }}
      indent_size = 4
      max_line_length = {{ cfg.editorconfig["line-length"] }}
      
      [*.{yml,yaml,nix}]
      indent_style = space
      indent_size = 2
      
      # frappe's exporter: 1-space JSON, no final newline, for everything under the package
      [{{ app }}/**.json]
      indent_style = space
      indent_size = 1
      insert_final_newline = false
      
      [*.md]
      trim_trailing_whitespace = false
      
      # frappe-nix:local-begin editorconfig
      # frappe-nix:local-end editorconfig

      2.8 package.json (json-merge)

      Live while any module with a key group below is on. Profile values: org.license, org.publisher, metadata.package-type, metadata.package-manager, metadata.node-engine, typescript.preset, tests.js-coverage-min. No module needs another module's key group: js, typescript, stylelint and vite-register need only that package.json exists, which any of them makes true.

      Sync creates package.json if it's missing, as {"name": "<App-hyphen>", "version": "<__version__ or 0.1.0>", "private": true, "description": <tagline>}, plus "license": <org.license> and "author": <org.publisher> when those org values are set. After that, only the keys below are managed, each only while its module is on. Every other key is app-owned (for example dependencies, build, codegen, ci:lint, ci:typecheck). version is owned by release-please (module releases), except once: when sync seeds .release-please-manifest.json, it first sets version to __version__ (taskview has 1.0.0 against 0.0.1, timeclock 0.0.0 against 0.0.1), because __version__ is what the registry reads.

      KeyModuleRule
      privatemetadataexactly true
      typemetadataexactly metadata.package-type ("module" in recommended); app-owned when that is "" (CommonJS config files keep working)
      licensemetadataexactly org.license when it is set; app-owned when it is empty (then L2 only checks that it equals hooks.app_license)
      authormetadataexactly org.publisher when it is set; app-owned otherwise
      engines.nodemetadataexactly metadata.node-engine (">=24"); app-owned when ""
      packageManagermetadataexactly metadata.package-manager ("yarn@1.22.22"); app-owned when "". The CI gates install with yarn classic (yarn install --frozen-lockfile) whatever this says, so an app on another package manager keeps its own ci:* scripts for anything that needs it. A pnpm app sets it to "" and pins pnpm through devEngines.packageManager instead, because yarn 1 refuses a packageManager that names pnpm. The bench installs such an app with pnpm, from its pnpm-lock.yaml (locks)
      frappemetadataexactly {"major": "<major>", "branch": "version-<major>"} (string major, as carbon_frappe has it; the Frappe branch, not the app's release branch)
      scripts.formatjs"oxfmt"
      scripts.format:checkjs"oxfmt --check"
      scripts.lintjs (tool oxc)"oxlint". With js off (tool = "none", the route for teams on eslint, prettier or biome) lint is app-owned and sync never writes it
      scripts.lint:cssstylelint (discover.scss)stylelint "<glob>" for each scss glob, joined by &&
      scripts.typechecktypescript"tsc --build <discover.solution>" when the solution is rendered, followed by && <check> for each [[tool.frappe-nix.typescript.spa]] in order; just the SPA checks joined by && when there is no solution; absent when there is neither. TS 7's tsc can't check .vue imports, so SPAs keep vue-tsc (a devDependencies key the app owns), run through the managed scripts/vue-tsc.cjs (check = "node scripts/vue-tsc.cjs --noEmit -p tsconfig.json", §2.8.1)
      scripts.buildvite-registerApp-owned, but when discover.vite: it MUST end with && node scripts/vite-register.mjs (sync appends it if missing, exit 1 under --check). This is frappe-nix compat C8.
      scripts.test:unittests (tests.js-unit)"node --test --experimental-test-coverage --test-coverage-include='<app>/public/js/**' --test-coverage-lines=<tests.js-coverage-min> 'test/unit/**/*.test.ts'"; iff discover.unit_tests
      scripts.lint:pypython-lint"uv run --frozen --project tools ruff check . && uv run --frozen --project tools ruff format --check ."
      scripts.typecheck:pypython-types"uv run --frozen --project tools ty check --python \"${FRAPPE_BENCH_ROOT:-.frappe-nix/bench}/env\""
      scripts.checkjs (tool oxc)the parts joined by &&, in this order: yarn -s format:check, yarn -s lint, yarn -s lint:css, yarn -s typecheck, yarn -s test:unit, each only if that script is present, whoever owns it. With js off, check is app-owned, so an adopter's own lint and format steps never fall out of it
      devDependencies.<pkg>per packagefloor (S9). The app's range MUST be a caret or exact range whose minimum is ≥ the floor; otherwise sync sets ^<floor>. Floors: oxlint 1.87.0 and oxfmt 0.72.0 (js); typescript 7.0.2, frappe-types 16.5.0 (the minor that ships tsconfig/* presets, frappe-types/web and gen-doctypes; only with typescript.preset = "frappe-types", §2.9) and @types/node 26.6.4 (typescript, when any TS or desk project exists); the alias typescript5 at npm:typescript@^5.9.3 (typescript, as typescript, when a Vue single-file component is tracked outside a nested frontend and docs-site/, §2.8.1: an alias floor holds for an alias of the same package whose range meets it); stylelint 17.16.0 and stylelint-config-standard-scss 17.0.0 (stylelint, when discover.scss).

      When a module turns off, sync removes its keys whose values still equal what it would render (a toolchain devDependencies entry counts as equal when its range is ^<floor> or higher), and leaves any other value as app-owned, with a warning (§3.3 step 6).

      Forbidden (exit 2), each only while the named module is on:

      • (metadata) a build script when none of these holds: discover.vite, a nested frontend, an SPA entry, or [tool.frappe-nix] build = true (carbon sets it for its patch-assets, audits and ai-chat build). frappe's esbuild runs every app's build, so a stray one runs on every bench. Conversely, build = true without a build script is exit 2.

      • (js, tool oxc) eslint*, prettier*, @typescript-eslint/* or eslint-config-* in any dependency map;

      • (any) scripts keys starting with frappe-nix:, which are reserved.

      2.8.1 Vue single-file components on TypeScript 5

      The typescript floor is the native TypeScript 7 build, which ships no JS API. Two Vue tools need that API. @vue/compiler-sfc, which @vitejs/plugin-vue runs, reads the types defineProps<T>() and defineEmits<T>() import from another file (frappe-ui's components do) through it, and fails with "No fs option provided to compileScript". vue-tsc 3 drives only the JS compiler. So when the app's own package builds Vue single-file components (vue_typescript5: module typescript on, a tracked .vue file outside a nested frontend and docs-site/, and a managed TS project or an SPA entry), sync adds the typescript5 alias (§2.8, npm:typescript@^5.9.3) and renders two whole files that point those tools at it:

      • scripts/vue-tsc.cjs runs vue-tsc on typescript5/lib/tsc. An SPA's check calls it: node scripts/vue-tsc.cjs --noEmit -p tsconfig.json. An app's own copy at that path is replaced by the managed one.

      • scripts/vue-sfc-typescript.mjs, with discover.vite, registers typescript5 with compiler-sfc's CommonJS build, the one @vitejs/plugin-vue loads, after that build's own default (typescript). The app's Vite config imports it before any component is compiled: import "./scripts/vue-sfc-typescript.mjs"; (one line in an app-owned file; sync doesn't edit it). The managed .oxlintrc.json turns import/no-unassigned-import off for discover.vite_configs then, since the import is there for what it does on load.

      Both files live and retract with module typescript, like the alias.

      2.9 TypeScript configs (whole, JSONC with header)

      Module typescript. Profile values: typescript.strict-extras (the three extra compiler options in tsconfig.base.json; true in recommended), typescript.check-js (whether the desk and web projects exist at all: false in recommended, true in the Avunu profile) and typescript.preset (below). With check-js off, desk and web JS is still linted by oxlint when js is on, but not type-checked, and [[tool.frappe-nix.unchecked-js]], R6 and A7's amber are inactive.

      Every file starts with // frappe-nix:managed — generated by frappe-nix (\frappe-init --sync`); do not edit. Customise via [tool.frappe-nix.typescript].`

      The preset dependency. With typescript.preset = "frappe-types" (the recommended value), the compiler presets and the Frappe type declarations come from the npm package frappe-types (≥ 16.5.0; MIT; source github.com/Avunu/frappe-types, maintained by the frappe-nix authors): frappe-types/tsconfig/base.json, frappe-types/tsconfig/desk-js.json, frappe-types/global and frappe-types/web. 16.5.0, the first release with the presets and frappe-types/web, is on npm (published 2026-10-07). It is a third-party open-source dependency like oxlint, not an org value: nothing of Avunu's is rendered into the app, and dependabot moves it in the toolchain group. With typescript.preset = "inline", tsconfig.base.json carries the compiler options itself (from frappe-nix-tools' data/tsconfig/base.json, a copy of the preset's options) instead of extends, the frappe-types devDependency is not managed, and the frappe-types/* entries are dropped from types. check-js, audit-consumer and the gen-doctypes freshness step need the Frappe declarations, so each of them with preset = "inline" is exit 2.

      The solution file is named discover.solution: tsconfig.json, or tsconfig.solution.json when an SPA owns the root tsconfig.json (taskview, timeclock). Sync never writes over an SPA's config. It lists only the projects that exist, in the order browser, scripts, test, desk, web:

      {
      	"files": [],
      	"references": [{ "path": "./tsconfig.browser.json" }, { "path": "./tsconfig.scripts.json" }, { "path": "./tsconfig.test.json" }, { "path": "./tsconfig.desk.json" }, { "path": "./tsconfig.web.json" }]
      }

      tsconfig.base.json holds the app-level strictness the frappe-types preset leaves out (the compilerOptions keys below other than paths are omitted when typescript.strict-extras is false). With preset = "inline", extends is absent and the preset's options are rendered into compilerOptions first:

      {
      	"extends": "frappe-types/tsconfig/base.json",
      	"compilerOptions": {
      		"noUnusedLocals": true,
      		"noUnusedParameters": true,
      		"noImplicitReturns": true,
      		"paths": { /* [tool.frappe-nix.typescript].paths; key omitted when empty */ }
      	}
      }

      tsconfig.browser.json:

      {
      	"extends": "./tsconfig.base.json",
      	"compilerOptions": { "composite": true, "types": ["frappe-types/global"], "allowImportingTsExtensions": true },
      	"include": ["<app>/public/js/**/*.ts", "<app>/public/js/**/*.d.ts", "types/**/*.d.ts"],   // or browser-include
      	"exclude": ["node_modules", "<app>/public/dist", /* spa_globs, typescript.exclude */]
      }

      cfg.generated is not in the browser project's exclude: a generated .ts module that the bundles import (an icon set, a palette) must be part of the composite project, or tsc --build fails with TS6307. Generated files are kept out of the formatters, the linters and validate_copyright (§2.14), not out of the type check.

      tsconfig.scripts.json:

      {
      	"extends": "./tsconfig.base.json",
      	"compilerOptions": { "composite": true, "types": ["node"], "allowImportingTsExtensions": true },
      	"include": ["scripts/**/*.ts", "marketplace/**/*.ts", "ci/**/*.ts"],
      	"exclude": ["node_modules"]
      }

      tsconfig.test.json:

      {
      	"extends": "./tsconfig.base.json",
      	"compilerOptions": { "composite": true, "types": ["node", "frappe-types/global"], "allowImportingTsExtensions": true },
      	"include": ["test/**/*.ts", "<app>/public/js/**/*.ts", "scripts/lib/**/*.ts"],
      	"exclude": ["node_modules", "<app>/public/dist"]
      }

      tsconfig.desk.json checks uncompiled desk JS with JSDoc (D5), only when typescript.check-js is true:

      {
      	"extends": "frappe-types/tsconfig/desk-js.json",
      	"compilerOptions": { "composite": true },
      	"include": ["<app>/**/*.js", "types/doctypes.d.ts", "types/<app>.augment.d.ts"],
      	"exclude": ["node_modules", "**/*.bundle.js", "**/public/dist/**", "<app>/www/**", "**/web_form/**",
      	            "<app>/templates/**", /* each nested frontend dir, spa_globs, typescript.web-include,
      	            cfg.generated, each unchecked-js path, typescript.exclude */]
      }

      tsconfig.web.json covers web form and www scripts, and the files typescript.web-include moves out of the desk (esign's public/js/web/**, which uses frappe.web_form, frappe.ready and frappe.form_dirty):

      {
      	"extends": "frappe-types/tsconfig/desk-js.json",
      	"compilerOptions": { "composite": true, "types": ["frappe-types/web"] },
      	"include": ["<app>/www/**/*.js", "<app>/**/web_form/**/*.js", "<app>/templates/**/*.js",
      	            /* typescript.web-include */ "types/doctypes.d.ts", "types/<app>.augment.d.ts"],
      	"exclude": ["node_modules", "**/public/dist/**", /* spa_globs, cfg.generated, each unchecked-js path,
      	            typescript.exclude */]
      }

      The desk and web projects are rendered from the same file sets as discover.desk_js and discover.web_js, and so are the oxlint overrides (§2.10). Both are rendered only when their file set is non-empty after the exclusions, so an app can't hit TS18003 ("no inputs") by excluding everything.

      Migrating to strict checkJs (when an app turns typescript.check-js on). The frappe-types track measured esign at 274 errors, timeclock at about 238 (plus 4,056 in a committed legacy bundle), jailbreak 59, postgrid 36 and jwt_auth 6. The adoption PR (Avunu fleet: PR B) lists each file it can't fix yet in [[tool.frappe-nix.unchecked-js]] with a reason. That list is rendered into the desk and web excludes and ratchets like untested: R6 lets it only shrink. An entry naming a file that is no longer tracked is stale (frappe-nix compat C9, exit 1). An entry whose file no longer has any error is also stale: the typecheck job runs frappe-nix unchecked-js --stale (N3), which runs tsc -p once over a generated temporary project that includes every listed file and fails naming each listed file with zero diagnostics. Audit row A7 is amber while the list is non-empty. // @ts-nocheck stays forbidden (typescript/ban-ts-comment). A committed build output such as timeclock/www/job_timeclock_legacy/index.js belongs in cfg.generated or should be deleted, not listed as unchecked.

      SPAs ([[tool.frappe-nix.typescript.spa]]) keep their own app-owned tsconfig. Their globs are removed from the browser, desk and web projects and from the desk-globals override; typecheck runs each check. Nested frontends with a package.json work as before: typecheck runs their own typecheck script.

      • types/doctypes.d.ts, if the app has it, is the output of frappe-types gen-registry (named gen-doctypes in earlier drafts). It is committed and checked for freshness in typecheck (§4.2). Its input includes the DocType JSON of frappe and the siblings, so a Dependabot nix bump makes it stale: relock-plan regenerates it with the same command, less --check (frappe-nix ci relock-doctypes, §4.5), and the relock commit carries it.

      • App symbols on the frappe namespace. An app declares the members it adds to frappe (taskview's frappe.views.TasksView, esign's frappe.ui.form.ControlFontSelect and frappe.esign_context, jailbreak's frappe.ui.merge_records, timeclock's frappe.ui.form.show_workday_bulk_add) in exactly one file, types/<app>.augment.d.ts, as declare global { namespace frappe.<sub> { … } } augmentations. Each member carries a // app-owned: <reason> comment on the line before it. App-owned, never managed.

      • Hand-written frappe globals are an frappe-nix compat C7 failure (exit 1), which is plan §6 row "no hand-written frappe globals". C7 matches redeclarations only: declare (var|let|const) frappe, interface Window { containing a frappe member, declare namespace frappe anywhere, and any namespace frappe augmentation outside types/<app>.augment.d.ts or without its // app-owned: comments. taskview's public/js/types/frappe.d.ts and timeclock's public/js/timeclock/env.d.ts are deleted in their PR B, and their app-owned members move to the augment file.

      2.10 .oxlintrc.json (whole JSON, no comments) and .oxfmtrc.jsonc (whole)

      Module js with js.tool = "oxc" ("none" renders neither file and no format/lint scripts). Profile values: js.oxlint.categories (the categories object below is the recommended value), js.locked-rules (when true, the three typescript/* rules below are "error" and an app override may not touch them; when false they are ordinary rules an app may override), js.format-width (110), js.format-tabs (true) and js.format-tab-width (2, the columns a tab counts for), plus the app's js.oxlint and js.oxfmt lists.

      .oxlintrc.json. The desk and web overrides are generated from the same file sets tsc uses (§2.2), not from fixed globs:

      • <desk-files> is discover.desk_js rendered as a sorted list of paths (oxlint matches literal paths as globs). A new desk file is therefore drift until sync runs, which is the same rule tsconfig already follows.

      • <web-files> is discover.web_js, likewise.

      • Files in spa_globs get neither override; their globals come from their own imports.

      • <desk-globals> and <web-globals> are the globals of the installed frappe-types' lint/desk-globals.json and lint/web-globals.json (frappe-types 16.7.1 and later), generated from its declarations; they leave out moment, which the desk override adds. oxlint's extends drops top-level globals, so the config cannot import them and sync copies them. Without those files (a clone without node_modules, or the inline preset) sync keeps the globals of the committed override for the same files, so such a clone reports no drift; with no committed override either (the first sync, before yarn install), it renders frappe, __, cur_frm, cur_list, locals, $ and jQuery for desk and frappe, __, $ and jQuery for web, which the next sync after the install widens.

      {
      	"$schema": "./node_modules/oxlint/configuration_schema.json",
      	"plugins": ["typescript", "unicorn", "oxc", "import"],
      	"categories": { "correctness": "error", "suspicious": "error", "perf": "warn", "pedantic": "off" },   // js.oxlint.categories
      	"env": { "builtin": true, "es2024": true, "browser": true },
      	"rules": {
      		"typescript/no-explicit-any": "error",
      		"typescript/ban-ts-comment": "error",
      		"typescript/consistent-type-imports": "error",
      		"no-console": ["warn", { "allow": ["error", "warn"] }],
      		"import/no-cycle": "off",
      		"no-underscore-dangle": "off",
      		"unicorn/consistent-function-scoping": "off",
      		"unicorn/no-array-sort": "off"
      	},
      	"ignorePatterns": ["<app>/public/dist/**", ".frappe-nix/**", ".dev-dist/**", ".venv/**", "nix/**", "docs-site/**", "types/doctypes.d.ts"
      	                   /* + cfg.generated + [tool.frappe-nix.js.oxlint].ignore */],
      	"overrides": [
      		{ "files": ["scripts/**", "marketplace/**", "ci/**", "test/**"], "env": { "node": true },
      		  "rules": { "no-console": "off", "no-await-in-loop": "off", "import/no-unassigned-import": "off" } },
      		{ "files": ["<app>/public/js/*.bundle.ts", "<app>/public/js/*.bundle.js"], "rules": { "import/no-unassigned-import": "off" } },
      		{ "files": <desk-files>, "globals": { /* <desk-globals> */ "moment": "readonly"
      		  /* + "<desk_global>": "readonly" for each sibling with one, + [tool.frappe-nix.js.oxlint].globals */ } },
      		{ "files": <web-files>, "globals": { /* <web-globals> + [tool.frappe-nix.js.oxlint].globals */ } }
      		/* + [tool.frappe-nix.js.oxlint].overrides */
      	]
      }

      An override whose file list is empty is omitted.

      .oxfmtrc.jsonc:

      // frappe-nix:managed — generated by frappe-nix (`frappe-init --sync`); do not edit. Customise via [tool.frappe-nix.js.oxfmt].
      // Tabs and 110 columns are frappe's convention. Anything .gitignore'd is skipped without being listed.
      {
      	"$schema": "./node_modules/oxfmt/configuration_schema.json",
      	"useTabs": true,      // js.format-tabs
      	"tabWidth": 2,        // js.format-tab-width; oxfmt 0.74+ otherwise reads .editorconfig's indent_size
      	"printWidth": 110,    // js.format-width
      	"ignorePatterns": [
      		// frappe's exporter writes every JSON under the package and rewrites it on export
      		"<app>/**/*.json",
      		"nix/**",
      		"docs-site/**",
      		"docs/screenshots/**",
      		// written by release-please
      		"CHANGELOG.md",
      		".release-please-manifest.json",
      		// generated by frappe-types gen-doctypes
      		"types/doctypes.d.ts"
      		/* + cfg.generated + [tool.frappe-nix.js.oxfmt].ignore */
      	]
      }

      Every whole-strategy text file that oxfmt formats (YAML, TOML, Markdown, JSONC) MUST already be in oxfmt's output form, whether or not the app enables js. N3 and N4 acceptance tests run oxfmt --check over a freshly rendered fixture. An app whose own formatter (prettier or biome, added through the repos local region or outside prek) reformats these files is not in drift: while js.tool isn't "oxc", --check compares YAML, JSON, JSONC and TOML whole files semantically, and sync leaves a file alone when it is semantically equal to the rendered one (§3.2).

      2.11 .stylelintrc.json (json-merge, only when discover.scss)

      Module stylelint. Profile values: none. Managed keys:

      • extends: exactly ["stylelint-config-standard-scss"];

      • ignoreFiles: MUST contain "<app>/public/dist/**".

      Any other key (rules, more ignoreFiles entries) is app-owned.

      2.12 pyproject.toml (toml-merge)

      The engine is tomlkit, which preserves comments and order. Each managed group belongs to one module and is managed only while that module is on; when the module turns off, sync removes the group's keys that still hold the rendered values (§3.3 step 6). Groups: [project] requires-python/dynamic, [build-system] (only with metadata.build-backend = "flit"; with "any" it is app-owned, so setuptools, hatchling and poetry-core work) and [tool.bench.frappe-dependencies] → metadata; [tool.ruff*] → python-lint; [tool.ty*] → python-types; [tool.coverage*] → tests (tests.coverage.enable); [tool.vulture] and [tool.test_utils.*] → test-utils. Profile values: python-lint.line-length, .select, .ignore, .typing-modules, .quote-style, .indent-style; python-types.error-on-warning; tests.coverage.initial-floor.

      Managed exact. Sync sets these and --check compares their values. Shown with the recommended values.

      [project]                                  # metadata
      requires-python = ">=3.14"                 # from the frappe-nix preset for version-<major>
      dynamic = ["version"]                      # must contain "version"
      
      [build-system]                             # metadata.build-backend = "flit" only
      requires = ["flit_core >=3.4,<4"]
      build-backend = "flit_core.buildapi"
      
      [tool.bench.frappe-dependencies]           # exactly {"frappe"} ∪ hooks.required_apps (bare names); values from known-apps.json
      frappe = ">=16.0.0,<17.0.0"
      erpnext = ">=16.0.0,<17.0.0"
      
      [tool.ruff]                                # python-lint
      line-length = 110                          # python-lint.line-length
      target-version = "py314"
      
      [tool.ruff.lint]
      select = ["F", "E", "W", "I", "UP", "B", "RUF", "SIM", "C4", "PIE", "PERF", "T20"]   # python-lint.select
      ignore = ["E501", "W191"]                  # python-lint.ignore
      typing-modules = ["frappe.types.DF"]       # python-lint.typing-modules
      
      [tool.ruff.format]
      quote-style = "double"                     # python-lint.quote-style
      indent-style = "tab"                       # python-lint.indent-style
      docstring-code-format = true
      
      [tool.ty.environment]                      # python-types
      python-version = "3.14"
      
      [tool.ty.src]
      include = ["<app>"]
      
      [tool.ty.terminal]
      error-on-warning = false                   # python-types.error-on-warning (the Avunu profile sets true)
      
      [tool.coverage.run]                        # tests
      omit = ["*/tests/*", "*/test_*.py", "*/patches/*"]   # + each [[tool.frappe-nix.coverage-omit]].glob, in order.
                                                          # Patches match testmap's own **/patches/** exclusion: a fresh
                                                          # install marks them complete without running them.
      
      [tool.coverage.report]
      show_missing = true
      skip_covered = true
      precision = 1
      exclude_also = ["if TYPE_CHECKING:", "raise NotImplementedError", "@(abc\\.)?abstractmethod"]

      App-owned, but validated. Sync never touches these. Each rule applies while the module in brackets is on.

      KeyValidation
      [project] name, authors, description, readme, license, dependencies[metadata] dependencies MUST NOT name frappe, erpnext, hrms or payments (exit 1). When org.license is set, license (if present) MUST equal it.
      tool.coverage.report.fail_under[tests] Required; a number from 0 to 100, seeded as tests.coverage.initial-floor when missing. Ratcheted (S24).
      tool.ruff.extend-exclude[python-lint] Allowed. frappe-nix repo audit reports a non-empty list as amber.
      tool.ruff.lint.per-file-ignores[python-lint] Allowed, except that F401 and E402 MUST NOT appear for a glob that matches <app>/** or ** (exit 2)
      tool.ty.src.exclude[python-types] Allowed; reported as amber in audit
      [dependency-groups]App-owned. The app's test-only packages go here (responses, …).
      [tool.bench.assets]App-owned. Required when the pilot-assets module is on: build_dir, out_dir and index_html_path (frappe-listing validates them).
      [tool.frappe-nix]§2.1

      Forbidden (exit 2), while the module in brackets is on:

      • [python-lint] tool.ruff.lint.extend-select, extend-ignore, ignore beyond python-lint.ignore, unfixable, tool.ruff.lint.isort (the app changes the rule set through [tool.frappe-nix.python-lint], not around it);

      • [python-types] tool.ty.rules with any value other than "error", and tool.ty.overrides;

      • [tests] tool.coverage.run.source and tool.coverage.run.relative_files, which belong to frappe-test;

      • [metadata with build-backend = "flit"] [tool.poetry] (D6 uses flit);

      • [metadata with build-backend = "flit"] requirements.txt existing anywhere tracked (retired when sync runs).

      2.13 <app>/__init__.py (blocks)

      Module releases (the block is what release-please's generic updater rewrites). Profile values: none. The side-effect rule below (L5) belongs to listing.

      # x-release-please-start-version
      __version__ = "16.1.0"
      # x-release-please-end
      • Only comment lines are allowed outside the block, such as test_utils' copyright stamp and its blank line. A docstring and any statement count as side effects (marketplace rule): exit 1.

      • The version value is app-owned (release-please writes it). Sync only converts carbon_frappe's trailing # x-release-please-version form into the block form and keeps the value.

      • Whitelisted functions or any other code in __init__.py (jailbreak's assert_capability and check_capability) move to <app>/api.py in the adoption PR (Avunu fleet: PR B). The old dotted paths stay reachable through an override_whitelisted_methods shim in hooks.py for one minor release, as for renames (§5.10).

      • frappe-nix compat (C5, module releases) requires: __version__ = package.json version = manifest ".". The registry parses the line __version__ = "…" (add_release.py dynamic_version), so nothing may follow the closing quote.

      2.14 .pre-commit-config.yaml (whole + local region repos; third-party revs are floors)

      Live while any hook module is on (§2.4). This is the rendered form with every module on (the Avunu profile); {% if %} marks the parts that depend on discovered facts. Each hook, or each remote repo: block, is additionally wrapped in {% if modules[<module>] %} as this table gives, and a remote block whose hooks are all off is omitted with its rev::

      HooksModuleProfile values
      pre-commit-hooks block (check-merge-conflict … check-added-large-files)hygienehygiene.max-file-kb (1024)
      ssort blockssortnone
      ruff-isort, ruff-check, ruff-formatpython-lintnone (the rules live in pyproject.toml, §2.12)
      oxfmt, oxlintjs (tool oxc)none
      stylelintstylelintnone
      zizmor, actionlintworkflow-lintnone
      shellcheckshell-lintnone
      frappe-nix-compatmetadata (C2–C4, C6, C7), releases (C1, C5), vite-register (C8), tests/typescript (C9) — one hook that runs the rules of whichever of these is onnone
      committed, frappe-nix-commit-msgcommits (the second hook's major rule only under releases.version-scheme = "frappe-major")none
      agritheory/test_utils blocktest-utilstest-utils.hooks (the list of hook ids rendered; the default is every hook shown), test-utils.track-overrides

      default_install_hook_types lists commit-msg only when commits is on.

      # frappe-nix:managed — generated by frappe-nix (`frappe-init --sync`); edit only inside the frappe-nix:local region.
      #
      # Run by prek (`prek install` once per clone, in the dev shell) and by CI's `lint` job:
      #   uv run --frozen --project tools prek run --all-files --show-diff-on-failure
      # A hook that rewrites a file fails CI. ruff, ty, committed, zizmor, actionlint and shellcheck are pinned
      # by tools/uv.lock; oxfmt, oxlint and stylelint by package.json; ssort, pre-commit-hooks and test_utils by the
      # `rev:`s below. dependabot moves all three.
      default_install_hook_types: [pre-commit, commit-msg]
      default_stages: [pre-commit]
      default_language_version:
        python: python3.14
      fail_fast: false
      exclude: ^(nix/|\.frappe-nix/|docs-site/|CHANGELOG\.md$|types/doctypes\.d\.ts${% for g in cfg.generated %}|{{ g | glob_to_regex }}{% endfor %})
      
      repos:
        - repo: https://github.com/pre-commit/pre-commit-hooks
          rev: v6.0.0
          hooks:
            - id: check-merge-conflict
            - id: check-ast
            - id: check-toml
            - id: check-yaml
              args: [--allow-multiple-documents]
            - id: check-json
              exclude: ^(tsconfig(\.[a-z]+)?\.json|\.vscode/.*)$
            - id: debug-statements
            - id: detect-private-key
            - id: check-added-large-files
              args: [--maxkb={{ cfg.hygiene["max-file-kb"] }}]
              exclude: ^docs/screenshots/
      
        # Definitions before their first use; nothing else reordered. ssort can't resolve names
        # imported inside the class-body `if TYPE_CHECKING:` block frappe generates, so only
        # <doctype>/<doctype>.py controllers are excluded. Tests and helpers in doctype folders are sorted.
        - repo: https://github.com/bwhmather/ssort
          rev: 0.17.0
          hooks:
            - id: ssort
              exclude: '/doctype/([^/]+)/\1\.py$'
      
        - repo: local
          hooks:
            - id: ruff-isort
              name: ruff import sorter
              language: system
              entry: uv run --frozen --project tools ruff check --select I --fix
              types: [python]
            - id: ruff-check
              name: ruff check
              language: system
              entry: uv run --frozen --project tools ruff check --fix
              types: [python]
            - id: ruff-format
              name: ruff format
              language: system
              entry: uv run --frozen --project tools ruff format
              types: [python]
            - id: oxfmt
              name: oxfmt
              language: system
              entry: yarn -s oxfmt
              pass_filenames: false
              always_run: true
            - id: oxlint
              name: oxlint
              language: system
              entry: yarn -s oxlint
              pass_filenames: false
              types_or: [javascript, jsx, ts, tsx, vue]
      {% if discover.scss %}
            - id: stylelint
              name: stylelint
              language: system
              entry: yarn -s stylelint {{ scss globs, quoted }}
              pass_filenames: false
              types: [scss]
      {% endif %}
            - id: zizmor
              name: zizmor
              language: system
              entry: uv run --frozen --project tools zizmor --config .github/zizmor.yml .github/workflows .github/dependabot.yml
              pass_filenames: false
              files: ^\.github/
            - id: actionlint
              name: actionlint
              language: system
              entry: uv run --frozen --project tools actionlint
              pass_filenames: false
              files: ^\.github/workflows/
            - id: shellcheck
              name: shellcheck
              language: system
              entry: uv run --frozen --project tools shellcheck --severity=warning
              types: [shell]
              exclude: ^\.envrc$
            - id: frappe-nix-compat
              name: frappe-nix compat (versions, ranges, majors)
              language: system
              entry: sh -c 'if command -v frappe-nix >/dev/null; then exec frappe-nix compat; fi; echo "frappe-nix-compat skipped (frappe-nix not on PATH; CI runs it)" >&2'
              pass_filenames: false
              always_run: true
              verbose: true
            - id: committed
              name: committed (conventional commit)
              language: system
              entry: uv run --frozen --project tools committed --commit-file
              stages: [commit-msg]
            - id: frappe-nix-commit-msg
              name: no major bump through a commit message
              language: system
              entry: sh -c 'if command -v frappe-nix >/dev/null; then exec frappe-nix policy --commit-msg-file "$1"; fi; echo "frappe-nix-commit-msg skipped (frappe-nix not on PATH; pr-policy runs it)" >&2' --
              stages: [commit-msg]
      
        # agritheory/test_utils: selected hooks only (S19). sql_registry/sql_rewriter abort the run,
        # mypy is replaced by ty, and validate_*_dependencies crash outside a bench, so none of those are here.
        - repo: https://github.com/agritheory/test_utils
          rev: v1.30.1
          hooks:
            - id: validate_frappe_project
            - id: validate_patches
              args: [--app, {{ app }}]
            - id: static_analysis
              entry: python -c '…' static_analysis   # its walk pruned at the unmanaged directories
              args: ["."]
            - id: validate_doctype_python_types
            - id: validate_copyright
              args: [--app, {{ app }}]
              # Never stamp a managed file (its header is line 1) or a generated one (its freshness diff would fail).
              exclude: ^(docs/|docs-site/|marketplace/shots\.d\.ts$|types/doctypes\.d\.ts$|scripts/vite-register\.mjs$|tsconfig[^/]*\.json${% for g in cfg.generated %}|{{ g | glob_to_regex }}{% endfor %})
            # Bench-aware: silent no-ops outside a bench. CI runs them in a mini-bench (`frappe-nix minibench`).
            - id: validate_customizations
              stages: [manual]
            - id: clean_customized_doctypes
              stages: [manual]
            # Nightly only (jscpd through npx, needs the network).
            - id: check_code_duplication
              stages: [manual]
      {% if cfg["test-utils"]["track-overrides"] %}
            - id: track_overrides
              entry: python -c '…' track_overrides   # as static_analysis
              args: [--app, {{ app }}, --base-branch, {{ frappe.branch }}]
      {% endif %}
      
        # frappe-nix:local-begin repos
        # frappe-nix:local-end repos

      Generated files. cfg.generated reaches every tool that would otherwise rewrite or stamp a generated file: the global exclude above (so ruff, ssort and test_utils skip it), validate_copyright's exclude, and the oxfmt and oxlint ignorePatterns. glob_to_regex is a fixed filter in the engine (** → .*, * → [^/]*, anchored at the end with $). The managed files whose first line is the managed header are excluded from validate_copyright by name, so sync and the stamp never rewrite each other.

      zizmor scope (workflow-lint). zizmor audits .github/workflows and .github/dependabot.yml. Every rendered dependabot entry therefore carries a cooldown (§2.17), which zizmor's dependabot-cooldown audit requires. The docs tool's own workflows (docs*.yml) are audited too.

      Floor semantics (S9). The renderer emits rev: {{ rev(url, floor) }}. When the existing file has a rev for the same repo: URL that compares ≥ the floor, that rev is kept. Revs compare with packaging.version after stripping a leading v. The floors are v6.0.0, 0.17.0 and v1.30.1.

      frappe-nix is on PATH in an opted-in app's dev shell (N3a shell.nix) and in CI (§4.1). So is prek, a wrapper for uv run --frozen --project <app>/tools prek: the prek tools/uv.lock pins, the one CI's lint runs, so prek install and prek run work in the shell without a second pin. A commit made outside the dev shell (a GUI git client, an editor's commit button) skips the two frappe-nix hooks with a warning instead of failing: CI's lint (compat, through the same hook with frappe-nix installed) and pr-policy (the commit-message rules) still enforce them. The uv run, yarn and committed hooks need uv and node on PATH, as any prek setup does.

      2.15 committed.toml and tools/pyproject.toml (whole)

      committed.toml (module commits; profile values commits.allowed-types and commits.subject-length, shown with the recommended values, which are frappe's commitlint types) is carbon_frappe's file with the managed header. The second comment paragraph depends on releases.version-scheme:

      # frappe-nix:managed — generated by frappe-nix (`frappe-init --sync`); do not edit.
      {% if cfg.releases["version-scheme"] == "frappe-major" %}
      # Conventional commits. `fix:` → patch, `feat:` → minor. There is no way to bump the major: it is the
      # Frappe major, and `frappe-nix policy` refuses `!` and BREAKING CHANGE (S12).
      {% else %}
      # Conventional commits. `fix:` → patch, `feat:` → minor, `!` or BREAKING CHANGE → major.
      {% endif %}
      style = "conventional"
      allowed_types = ["build", "chore", "ci", "docs", "feat", "fix", "perf", "refactor", "revert", "style", "test", "deprecate"]
      subject_length = 100
      line_length = 0
      subject_capitalized = false
      subject_not_punctuated = true
      imperative_subject = false
      no_wip = true
      no_fixup = true
      merge_commit = false

      tools/pyproject.toml (live while any module with a tool here is on, §2.4). dependencies is the union of the enabled modules' tools, sorted: prek whenever .pre-commit-config.yaml is live, ruff (python-lint), ty (python-types), semgrep (semgrep), zizmor and actionlint-py (workflow-lint), shellcheck-py (shell-lint), committed (commits). Shown with all of them:

      # frappe-nix:managed — generated by frappe-nix (`frappe-init --sync`); do not edit.
      # Python-side tooling. Pinned by tools/uv.lock (dependabot uv, directory /tools). Run as
      # `uv run --frozen --project tools <tool>`. A separate project because app mode's workspace lock is nix/uv.lock.
      [project]
      name = "{{ app_hyphen }}-tools"
      version = "0"
      requires-python = ">=3.14"
      dependencies = ["actionlint-py", "committed", "prek", "ruff", "semgrep", "shellcheck-py", "ty", "zizmor"]
      
      [tool.uv]
      package = false

      Lock floors (S9). --check reads tools/uv.lock and requires, for each tool that is in dependencies:

      ToolFloor
      ruff0.16.10
      ty0.0.84
      zizmor1.30.1
      committed1.1.11
      actionlint-py1.7.12.25
      semgrep1.179.0
      prek0.5.5
      shellcheck-py0.11.0.1

      A lock below a floor is drift (exit 1). Sync fixes it with uv lock --project tools --upgrade-package <pkg>.

      2.16 release-please-config.json (whole JSON) and manifest (seed)

      Module releases (releases.tool = "release-please", the only tool in v1). Profile values: releases.version-scheme (only in the bullets below) and releases.tag-prefix ("v" or ""; include-v-in-tag is true exactly when it is "v", and the tag ruleset, assets trigger, guard and audit rows use the same prefix). The branch release-please targets is branches.integration, passed by app-release.yml (§4.4), not written here. When readme is on under main+tags, extra-files also lists { "type": "generic", "path": "README.md" }, so the release PR moves the installation line's version (§2.19).

      {
      	"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
      	"include-v-in-tag": true,
      	"include-component-in-tag": false,
      	"separate-pull-requests": true,
      	"bootstrap-sha": "<[tool.frappe-nix.releases].bootstrap-sha; key omitted when unset>",
      	"packages": {
      		".": {
      			"release-type": "node",
      			"package-name": "<App-hyphen>",
      			"changelog-path": "CHANGELOG.md",
      			"extra-files": [{ "type": "generic", "path": "<app>/__init__.py" }]
      		}
      	}
      }
      • .release-please-manifest.json is seeded as {".": "<__version__>"}. In the same step sync sets package.json version to __version__, so C5 and L4 hold from the first sync. From then on both are owned by release-please.

      • Under version-scheme = "frappe-major": for the first release, the adoption PR's (Avunu fleet: PR B's) last commit ends with the footer Release-As: <major>.0.0, and npx release-please release-pr --dry-run --target-branch <that PR's branch> must propose <major>.0.0 before merging. The PR is then merged with gh pr merge --squash --body-file <f> whose last paragraph is that same footer, so the squash commit on the integration branch carries it as a trailing footer (S11). If the release PR still proposes another version, C1 fails it. frappe-nix policy --pr still checks the major in any Release-As it finds in that PR's commits.

      • Under version-scheme = "semver" nothing special happens: release-please proposes the next version from the commits, and C1 does not apply.

      2.17 .github/dependabot.yml (whole + local region updates)

      Module dependabot. Profile values: dependabot.ecosystems (one switch per ecosystem below), dependabot.cadence ("weekly" in recommended, "daily" in the Avunu profile) and dependabot.cadence-overrides (per ecosystem), dependabot.cooldown-days (7: the schema default and recommended@2.10's value, which plain recommended resolves to; recommended@1.0 sets 3), dependabot.ignore ({}; below), and, when docs-site is on, docs-site.action-patterns (the docs-actions group and auto-merge patterns), docs-site.cooldown-exclude-actions (the github-actions entry's cooldown exclude, exact names) and docs-site.package-names (the /docs-site npm entry's cooldown exclude). All three are empty in recommended. The Avunu profile leaves the module off, because its documentation is built by Avunu/site-docs and not by a docs-site/ in each app (until 2026-10 it set ["Avunu/docusystem*"], ["Avunu/docusystem"] and ["@avunu/docusystem"] for docusystem, the npm package that built those sites). The group takes glob patterns, while a docs tool's own check may expect an exact name in the cooldown exclude (docusystem's doctor tested excludes.includes("Avunu/docusystem")), so the two are separate parameters. Each entry is rendered only when its ecosystem switch is on (and, as before, its {% if %} fact holds). {{ cadence(<ecosystem>) }} is the override for that ecosystem, else dependabot.cadence; a weekly cadence renders day: monday.

      Commit types: fix(deps) for nix, github-actions, pre-commit and gitsubmodule, so each bump that changes what the app runs ships as a patch release; chore(deps) for uv /tools and npm /docs-site. The npm root and nested-frontend entries commit production dependencies as fix(deps), and prefix-development: chore(deps) sends their devDependencies (Dependabot's Development dependency group) to chore(deps). Those two entries write their prefixes whole, without include: scope, as frappe-nix's own .github/dependabot.yml does for its uv /dev entry. Each npm entry has a production and a development group, split by dependency-type, so a grouped PR holds one kind of dependency.

      dependabot.ignore adds Dependabot ignore conditions to the managed entries, because the updates region can add an entry but never redefine one. Its keys are an ecosystem, which reaches every managed entry of that ecosystem, or <ecosystem>:<directory>, which reaches the one entry for that directory ("npm:/docs-site"). The directory is one a managed entry can have: / for every ecosystem but uv, /tools for uv, and /<dir> (one path segment, no trailing slash) for npm; any other is exit 2. Each value is a list of conditions with dependency-name (required), versions and update-types, as Dependabot reads them; any other key is exit 2. An entry gets its own ignores first, then the ecosystem's, then its directory's. A key whose entry isn't rendered renders nothing, so a profile can name /docs-site for the apps that have one. An app's own "npm:/<dir>" key that names no managed npm entry is a sync notice, which catches a mistyped directory. An app keeps a deliberate major cap this way:

      [tool.frappe-nix.dependabot]
      ignore = { npm = [{ dependency-name = "tailwindcss", versions = [">=4"] }] }
      # frappe-nix:managed — generated by frappe-nix (`frappe-init --sync`); edit only inside the frappe-nix:local region.
      # Every entry targets {{ branches.integration }}. Bumps that change what the app runs commit as fix(deps) and ship as patch
      # releases: nix, github-actions, pre-commit, gitsubmodule and the npm entries' dependencies. Each npm entry has a production
      # and a development group (dependency-type), so a grouped PR holds one kind of dependency. prefix-development chore(deps) on
      # the npm root and nested entries sends devDependencies (Dependabot's Development dependency group) to chore(deps), which
      # ships nothing; those two write their prefixes whole, without include: scope. uv /tools and npm /docs-site commit as
      # chore(deps)/chore(deps-dev).
      {% if modules.ci %}
      # deps.yml decides what merges automatically (§4.5).
      {% endif %}
      version: 2
      updates:
      {% if cfg.dependabot.ecosystems["github-actions"] %}
        # One entry for /, which is also the entry a docs tool scaffolds. Separate groups,
        # so a docs or pilot bump never holds up the rest.
        - package-ecosystem: github-actions
          directory: /
          target-branch: {{ branches.integration }}
          schedule: { interval: {{ cadence("github-actions") }} }
          cooldown: { default-days: {{ cfg.dependabot["cooldown-days"] }}{% if docs_cooldown_exclude %}, exclude: {{ docs_cooldown_exclude | tojson }}{% endif %} }
          commit-message: { prefix: fix, include: scope }
          labels: [dependencies]
          # frappe-nix pins move through the frappe-nix release rollout (`frappe-nix repo rollout`), not Dependabot (S5).
          # Dependabot names a reusable workflow by its path, hence the /* entry.
          ignore:
            - dependency-name: {{ frappe_nix.owner }}/{{ frappe_nix.name }}
            - dependency-name: {{ frappe_nix.owner }}/{{ frappe_nix.name }}/*
      {{ ignore_items("github-actions", "/") }}
          groups:
      {% if docs_actions %}
            docs-actions:             # needs-review: a merge publishes the docs site with the new workflow code
              patterns: {{ docs_actions | tojson }}
      {% endif %}
      {% if modules["pilot-assets"] %}
            pilot:                    # needs-review: builds release assets
              patterns: ["frappe/pilot*"]
      {% endif %}
            actions:
              patterns: ["*"]
              exclude-patterns: {{ (docs_actions + pilot_patterns) | tojson }}   # key omitted when empty
      {% endif %}
      {% if cfg.dependabot.ecosystems.npm and package_json_live %}
        - package-ecosystem: npm
          directory: /
          target-branch: {{ branches.integration }}
          schedule: { interval: {{ cadence("npm") }} }
          cooldown: { default-days: {{ cfg.dependabot["cooldown-days"] }} }
          commit-message: { prefix: fix(deps), prefix-development: chore(deps) }
          labels: [dependencies]
      {{ ignore("npm", "/") }}
          groups:
            production:
              dependency-type: production
              patterns: ["*"]
              update-types: [minor, patch]
            development:
              dependency-type: development
              patterns: ["*"]
              update-types: [minor, patch]
      {% for d in discover.nested_frontends %}
        - package-ecosystem: npm
          directory: /{{ d }}
          target-branch: {{ branches.integration }}
          schedule: { interval: {{ cadence("npm") }} }
          cooldown: { default-days: {{ cfg.dependabot["cooldown-days"] }} }
          commit-message: { prefix: fix(deps), prefix-development: chore(deps) }
          labels: [dependencies]
      {{ ignore("npm", "/" ~ d) }}
          groups:
            {{ d }}-production: { dependency-type: production, patterns: ["*"], update-types: [minor, patch] }
            {{ d }}-development: { dependency-type: development, patterns: ["*"], update-types: [minor, patch] }
      {% endfor %}
      {% if discover.docs_site and modules["docs-site"] %}
        # docs-site/: a merge publishes the site, so deps.yml never merges these automatically
        - package-ecosystem: npm
          directory: /docs-site
          target-branch: {{ branches.integration }}
          schedule: { interval: weekly }
          cooldown: { default-days: 7{% if docs_packages %}, exclude: {{ docs_packages | tojson }}{% endif %} }
          commit-message: { prefix: chore, include: scope }
          labels: [dependencies]
      {{ ignore("npm", "/docs-site") }}
          groups:
            docs-site-production: { dependency-type: production, patterns: ["*"] }
            docs-site-development: { dependency-type: development, patterns: ["*"] }
      {% endif %}
      {% endif %}
      {% if cfg.dependabot.ecosystems.uv and tools_live %}
        - package-ecosystem: uv
          directory: /tools
          target-branch: {{ branches.integration }}
          schedule: { interval: {{ cadence("uv") }} }
          cooldown: { default-days: {{ cfg.dependabot["cooldown-days"] }} }
          commit-message: { prefix: chore, include: scope }
          labels: [dependencies]
      {{ ignore("uv", "/tools") }}
          groups:
            tools: { patterns: ["*"], update-types: [minor, patch] }
      {% endif %}
      {% if cfg.dependabot.ecosystems["pre-commit"] and precommit_has_remote_hooks %}
        - package-ecosystem: pre-commit
          directory: /
          target-branch: {{ branches.integration }}
          schedule: { interval: {{ cadence("pre-commit") }} }
          cooldown: { default-days: {{ cfg.dependabot["cooldown-days"] }} }
          commit-message: { prefix: fix, include: scope }
          labels: [dependencies]
      {{ ignore("pre-commit", "/") }}
          groups:
            hooks:
              patterns: ["*"]
              exclude-patterns: ["*agritheory/test_utils*"]
            test-utils:               # rendered only when test-utils is on
              patterns: ["*agritheory/test_utils*"]
      {% endif %}
      {% if cfg.dependabot.ecosystems.nix %}
        - package-ecosystem: nix
          directory: /
          target-branch: {{ branches.integration }}
          schedule: { interval: {{ cadence("nix") }} }
          cooldown: { default-days: {{ cfg.dependabot["cooldown-days"] }} }
          open-pull-requests-limit: 5
          commit-message: { prefix: fix, include: scope }
          labels: [dependencies]
          # frappe-nix and the org profile move only through `frappe-nix repo rollout` (S5, S38): their bump can rewrite
          # workflow files, which GITHUB_TOKEN can't push. Dependabot moves frappe and the siblings, which never touch one.
          ignore:
            - dependency-name: frappe-nix
      {% if profile.source != "builtin" %}
            - dependency-name: standards-profile
      {% endif %}
      {{ ignore_items("nix", "/") }}
          groups:
            flake-inputs: { patterns: ["*"] }
      {% endif %}
      {% if discover.gitmodules and cfg.dependabot.ecosystems.gitsubmodule %}
        - package-ecosystem: gitsubmodule
          directory: /
          target-branch: {{ branches.integration }}
          schedule: { interval: {{ cadence("gitsubmodule") }} }
          cooldown: { default-days: {{ cfg.dependabot["cooldown-days"] }} }
          commit-message: { prefix: fix, include: scope }
          labels: [dependencies]
      {{ ignore("gitsubmodule", "/") }}
      {% endif %}
        # frappe-nix:local-begin updates
        # frappe-nix:local-end updates

      docs_actions, docs_cooldown_exclude and docs_packages are docs-site.action-patterns, docs-site.cooldown-exclude-actions and docs-site.package-names when docs-site is on, else empty lists; pilot_patterns is ["frappe/pilot*"] when pilot-assets is on. package_json_live, tools_live and precommit_has_remote_hooks say whether those files are live and whether the pre-commit config has a remote repo: block. ignore_items(<ecosystem>, <directory>) is that entry's dependabot.ignore conditions, one list item each, with string values JSON-quoted and versions and update-types as block sequences, which oxfmt keeps at any length; ignore(<ecosystem>, <directory>) is the same under an ignore: key, or nothing when there are none. The github-actions ignore names the repository the app locks frappe-nix from (Avunu/frappe-nix, or a fork set through dev-shell.frappe-nix-url), read from flake.lock, and every path under it (Avunu/frappe-nix/*, the reusable workflows); frappe-nix's own repository is the one org name a built-in template may contain (S37).

      The rendered output is expanded to block style by oxfmt's rules; the template stores the oxfmt-formatted result. Major npm and uv updates arrive as individual PRs, because the groups only take minor and patch updates. deps.yml labels them needs-review.

      • Docs-tool compatibility. For docusystem (the Avunu fleet's docs tool until 2026-10; the Avunu profile has the module off now), the /docs-site npm entry and the github-actions entry for / are the entries docusystem init scaffolds, with the cooldown exclusions its doctor checks (@avunu/docusystem and Avunu/docusystem, which come from the profile's docs-site values). docusystem upgrade only adds an entry when none exists for that ecosystem and directory, so on a synced repo it writes nothing. The acceptance test is in N4 (§7), run with the docs-compat fixture profile, whose three docs-site values are the ones the Avunu profile had until then.

      • Dependabot ignores for nix. If the nix ecosystem doesn't honour ignore for a flake input, deps.yml still never auto-merges a PR that moves the frappe-nix or standards-profile lock node: relock-plan detects it, and the auto-merge job comments <input> moves through frappe-nix repo rollout and closes the PR.

      2.18 .github/zizmor.yml (whole)

      Module workflow-lint, live only when zizmor has something to audit: the app tracks a workflow (discover.github_workflows), or this sync renders one (ci, pilot-assets) or .github/dependabot.yml (dependabot). The zizmor hook (§2.14) reads it with --config whenever a .github/ file changes. Testing the modules as well as the tracked files means a first sync renders it in the same pass as the callers, instead of on the next sync once they are tracked. Profile values: workflow-lint.release-tag-workflows, the reusable workflows (zizmor policy keys: owner/repo/.github/workflows/<file>, or owner/repo/* or owner/*, which also cover that repository's or owner's actions) whose call may name its exact release tag (vX.Y.Z) instead of a commit SHA. Each becomes a ref-pin policy; steps and composite actions stay hash-pinned under "*". zizmor cannot tell a tag from a branch, so the lint gate's reusable-pins step (§4.2) refuses a branch in any reusable call and a tag in a call to a workflow the list does not name. The built-in default is empty (S37): an org lists its own workflows in its profile. Shown with the default:

      # frappe-nix:managed — generated by frappe-nix (`frappe-init --sync`); do not edit.
      # Every `uses:` is hash-pinned with a version comment. dependabot moves third-party pins;
      # `frappe-init --sync` moves Avunu/frappe-nix's.
      rules:
        unpinned-uses:
          config:
            policies:
              "*": hash-pin

      With a non-empty list the header says which calls may name a release tag, and each listed workflow follows "*": hash-pin. An Avunu profile example (the Avunu org profile's [workflow-lint], not a built-in value):

      [workflow-lint]
      release-tag-workflows = [
        "Avunu/site-docs/.github/workflows/check-docs.yml",
        "Avunu/frappe-nix/.github/workflows/app-deps.yml",
        "Avunu/frappe-nix/.github/workflows/app-lint.yml",
        "Avunu/frappe-nix/.github/workflows/app-marketplace.yml",
        "Avunu/frappe-nix/.github/workflows/app-nightly.yml",
        "Avunu/frappe-nix/.github/workflows/app-pr-policy.yml",
        "Avunu/frappe-nix/.github/workflows/app-release.yml",
        "Avunu/frappe-nix/.github/workflows/app-test.yml",
        "Avunu/frappe-nix/.github/workflows/app-typecheck.yml",
        "Avunu/gitops/.github/workflows/dependabot-auto-merge.yml",
        "Avunu/gitops/.github/workflows/dependabot-update-branches.yml",
        "Avunu/python-devops-nix/.github/workflows/dependabot-auto-merge.yml",
        "Avunu/python-devops-nix/.github/workflows/dependabot-update-branches.yml",
      ]

      2.19 README generated blocks (N5; blocks, only when discover.has_listing)

      Module readme (needs listing; off in recommended). Profile values: org.license, org.copyright-holder, org.email, org.support-url, org.docs-url, org.dev-docs-url, org.repo-url, org.readme.badges, org.readme.links, readme.install-ref, listing.approved. Each block template is overridable by an org profile (§8.1). A block that needs an empty org value is exit 2 naming the key (S37), except org.email and org.support-url, of which the support block needs one.

      Blocks are delimited by <!-- frappe-nix:begin <name> --> and <!-- frappe-nix:end <name> -->. They are rendered by frappe-listing readme --write, which sync calls (§3.5), from frappe_nix_tools/data/readme/<name>.md.j2 or the profile's override. The required blocks, in this order, are header, compatibility, installation, support, development and license, plus the hand-written sections in between, as D15 sets out. Missing markers are an error: frappe-listing readme --check exits 2 and names the missing block.

      • header: a centred <div> containing:

        • the logo <img src="<app>/public/images/<app>-logo.svg" width="80"> (only when icons is on);

        • the H1 title, and the tagline;

        • badges: CI (actions/workflows/ci.yml/badge.svg?branch=<branches.integration>, when ci is on), latest release (shields github/v/release, when releases is on and the repo is on GitHub), licence (org.license), and Frappe v<major>; then, when org.docs-url is set, [![Documentation](https://img.shields.io/badge/docs-<host>-blue)](<docs URL>); then each org.readme.badges entry {label, image, link} in order. <docs URL> is org.docs-url with {app}, {app_hyphen} and {repo} substituted, the same substitution as the listing seed's documentation and L12 (one function, the templates' org_url filter); <host> is its host, escaped for a shields.io static badge;

        • a hero <picture> with a dark <source media="(prefers-color-scheme: dark)" srcset="docs/screenshots/<hero>-dark.webp"> and <img src="docs/screenshots/<hero>-light.webp" alt="<alt>">. <hero> is the shot with readme: "hero". The <picture> is omitted when there are no shots or screenshots is off.

      • compatibility: a table with Frappe <major> → <branches.release or branches.integration> and each required app with its range.

      • installation: the line On Frappe Cloud, install <title> from the [Frappe marketplace](https://cloud.frappe.io/marketplace/apps/<app>)., only when the app sets listing.approved (its listing is approved and live; listing.publish alone, which opens registry pull requests, never adds it), plus

        bench get-app <repo URL> --branch <ref>
        bench --site <site> install-app <app>

        <repo URL> is org.repo-url with {repo} substituted (default https://github.com/{repo}; a GitLab or self-hosted organisation sets its own template). <ref> is readme.install-ref when set; otherwise branches.release under develop+version, and under main+tags the latest released tag, <tag-prefix><__version__>, never main (which holds unreleased code). The main+tags form wraps the code block in <!-- x-release-please-start-version --> and <!-- x-release-please-end -->, and README.md is a release-please extra file (§2.16), so the release PR that bumps __version__ moves this line in the same commit and the block never drifts.

      • support: first - Documentation: [<host><path>](<docs URL>) when org.docs-url is set, then org.support-url (default: the repo's issues page), org.email when set, and each org.readme.links entry. With org.docs-url empty (recommended, minimal) neither the badge nor this line is rendered.

      • development: nix develop (or direnv allow), prek install (when .pre-commit-config.yaml is live; the dev shell's prek runs the tools/uv.lock pin, §2.14), frappe-test (when tests is on), and a link to org.dev-docs-url (S26).

      • license: <org.license>, Copyright (c) <first-commit-year>–present <org.copyright-holder> → license.txt. <first-commit-year> is the year of git log --reverse --format=%cs | head -1, which never changes. Nothing in a rendered block depends on today's date (§3.4).

      Avunu profile example: MIT, Copyright (c) 2024–present Avunu LLC → license.txt, support mail@avu.nu.

      2.20 .git-blame-ignore-revs (seed + validated)

      Module hygiene. Profile values: none.

      Seed:

      # Mass reformats (style: PRs), one squash SHA per line with its subject as a comment.
      # GitHub reads this file; locally the dev shell sets blame.ignoreRevsFile.

      Validation (frappe-nix compat):

      • every non-comment line is <40-hex> # <subject> (two spaces before #);

      • every SHA is reachable from HEAD. This is checked only when the history is available (lint has fetch-depth: 0).

      In the Avunu fleet, PR B adds PR A's squash SHA. The helper frappe-nix compat --add-blame-ignore <sha> appends the line with the commit subject.

      The dev shell's enterShell (N3a shell.nix) runs git config blame.ignoreRevsFile .git-blame-ignore-revs when the file exists and the setting differs.

      2.21 Marketplace files (N5)

      Module listing (off in recommended), and screenshots, demo and icons for the files those modules name. Profile values: org.website-url, org.docs-url (the expected URL patterns, L12, and the seed's values).

      marketplace/listing.toml is app-owned and validated by frappe-listing (§5.2). The example is an Avunu fleet app:

      schema = 1
      title = "Carbon Theme for Frappe"          # ≤ 40 chars; third-party marks only as "… for X" / "… via X"
      tagline = "IBM Carbon design for the Frappe desk, website, email, charts and tables"  # 40–80 chars, no trailing period
      type = "extension"                         # application | extension | integration | utility
      category = "Extensions"                    # Applications | Compliance | Developer Tools | Extensions | Integrations | Utilities
      categories = ["Theme", "UI"]               # non-empty
      website = "https://avunu.net/open-source/carbon_theme/"
      documentation = "https://docs.avunu.net/carbon-theme/"
      apps_screen = false
      
      [apps_screen_entry]                        # required iff apps_screen = true
      route = "/app/taskview"
      has_permission = "erpnext_taskview.api.has_app_permission"
      
      [registry]                                 # optional
      stars = 0
      channel = "stable"

      Expected URL patterns are the profile's templates, with {app} and {app_hyphen} substituted:

      • website: org.website-url (Avunu profile: https://avunu.net/open-source/{app}/);

      • documentation: org.docs-url (Avunu profile: https://docs.avunu.net/{app_hyphen}/).

      A value that differs is a warning, not an error (docs-and-urls track). With an empty template there is no expected pattern and L12 is skipped. sync --init-listing seeds both URLs from the templates, or leaves them as "" (which L1 then reports) when the templates are empty.

      marketplace/screenshots.ts (module screenshots) is app-owned. marketplace/shots.d.ts is managed: it is the ShotSpec types (§5.5), rendered from frappe_nix_tools/data/shots/shots.d.ts, the packaged copy of lib/shots/shots.d.ts. The spec file is written as

      import type { ShotSpec } from "./shots.d.ts";
      export default { … } satisfies ShotSpec;

      so Node's type stripping runs it with no runtime import.

      marketplace/semgrep-baseline.json schema:

      { "schema": 1, "marketplace_rev": "<sha it was produced against>",
        "findings": [ { "rule": "frappe-manual-commit", "path": "erpnext_taskview/erpnext_taskview/api.py",
                        "line_sha1": "<sha1 of the stripped matched first line>", "count": 12, "reason": "…" } ] }

      The baseline is a multiset (S21). (rule, path, line_sha1) is unique within the file, and count ≥ 1. L7 fails when a key is found more often than its count (new finding) or less often (the count must be lowered: stale). R3 compares counts per key, head ≤ base.

      <app>/demo.py (module demo) is app-owned: setup(ctx) (§5.4). Icons (module icons) are app-owned sources: <app>/public/images/<app>-symbolic.svg, and <app>-logo.svg, which frappe-icon tile generates and which is committed.


      3. The managed-file mechanism (N3)

      3.1 Where the data lives

      • Everything lives inside the package (S10): templates in py/frappe_nix_tools/frappe_nix_tools/data/templates/**, with .j2 meaning Jinja, and manifest fragments in py/frappe_nix_tools/frappe_nix_tools/data/manifest.d/*.json. The engine reads the union of all fragments through importlib.resources, so a uv tool install from the git subdirectory has the same data as the Nix build. The built-in profiles live beside them in data/profiles/. templates/app/ (flake.nix, .envrc, .gitignore) is left exactly as in main: frappe-init --app copies it for an app that has not opted in, and the engine never reads it.

      • Org profile data (S38) comes from the locked standards-profile tree, or from the app's own tree for an in-repo profile (profile = "./<dir>"): profile.toml, and the optional templates/ overrides and [[extra-files]] templates (§8.1). For an entry with overridable: true, the engine renders <profile tree>/templates/<template> when that file exists, else the built-in template. An override of a non-overridable template is exit 2 naming it.

      • A path listed in more than one fragment is a frappe-nix build error. tests/standards/sync.nix checks for it.

      • A fragment entry looks like this:

      { "path": ".github/workflows/ci.yml", "template": ".github/workflows/ci.yml.j2", "strategy": "whole",
        "module": "ci", "when": "True", "uses": ["ci.test-timeout-minutes"], "overridable": false,
        "local_regions": [], "floors": {}, "header": "yaml" }

      header is one of yaml|toml|shell|ini|nix (#), jsonc|ts (//), or none (plain JSON). The header is the first line or lines of the rendered output, and it is part of the byte comparison.

      3.2 Strategies

      StrategySync writesCheck comparesLocal changes
      wholeThe full rendered file, unless the current file is already equal to it under the comparison in the next columnBytes, after carrying local regions and floors (below) over from the current file. Exception: while js.tool isn't "oxc", a YAML, JSON, JSONC or TOML file is compared as parsed data plus its first-line header, so a formatter the app chose (prettier, biome) may restyle it without driftOnly in local_regions and through [tool.frappe-nix.*] parameters
      toml-mergeSets managed keys with tomlkit, creating missing tables after the last existing [tool.*] table, and leaves every other key byte-for-byteParsed values of the managed keys; validation rules for the app-owned keys; forbidden keysEvery key that isn't managed
      json-mergeSets managed keys and raises floors, keeping key order (new keys appended to the object) and indentation (tabs)Parsed values; floors as "minimum of range ≥ floor"Every key that isn't managed
      seedOnly when the file is missingPresence plus the file's own validation rulesAll of it
      blocksOnly the content between markersBytes of the block contentEverything outside the markers

      Local regions (only in YAML, INI-style, shell-style and Nix files, all of which use # comments) look like this:

      # frappe-nix:local-begin <name>
      …kept verbatim…
      # frappe-nix:local-end <name>
      • The names and their order are fixed by the template.

      • A missing region is treated as empty and recreated.

      • An unknown region, a duplicate region or an unbalanced marker is a configuration error (exit 2).

      • After merging, the result MUST still parse (YAML; Nix through nix-instantiate --parse when Nix is available) and MUST NOT redefine a managed hook id, an updates entry with the same ecosystem and directory, an EditorConfig section that's already managed, or a managed flake input. Any of these is exit 2.

      Floors are expressed in the template as {{ rev("<repo-url>", "<floor>") }} and {{ pin("<owner>/<repo>/<path>", "<sha>", "<version>") }}, the latter for third-party uses: in caller files:

      • pre-commit revs: the existing value is kept if its version is ≥ the floor.

      • third-party SHA pins (pilot in assets.yml): the existing SHA line is always kept once present, because dependabot owns it.

      • frappe-nix's own uses: (<frappe_nix.owner>/<frappe_nix.name>/.github/workflows/app-*.yml) is never a floor. It is always @<frappe_nix.rev> # v<frappe_nix.version>.

      Formatting. After writing, sync runs yarn -s oxfmt <written files> when js.tool = "oxc" and node_modules/.bin/oxfmt exists, and uv run --frozen --project tools ruff format <app>/__init__.py when python-lint is on. --check compares toml-merge and json-merge files semantically, so formatting changes made by oxfmt are never drift.

      3.3 frappe-init --sync and --check: the CLI

      frappe-init --sync  [--standards <profile>] [--force] [--dry-run] [--skip-lock] [--only <path>[,<path>…]]
                          [--init-listing] [--frappe-version version-16] [--profile-path <dir>]
      frappe-init --check [--format text|json|github] [--only …] [--expect-rev <sha>] [--profile-path <dir>]
      frappe-init --app   [--standards <profile>] …                      (the existing app-mode flags)
      • Both imply --app mode. Both run in the current directory, which MUST be a git work tree whose pyproject.toml [project].name names a package containing hooks.py.

      • Opt-in (S35). --sync and --check on an app without [tool.frappe-nix] exit 2 with this app has not opted in to frappe-nix app standards; run frappe-init --sync --standards minimal|recommended|github:<owner>/<repo>, and write nothing. --standards <profile> creates the table with profile = "<profile>" (step 1) and is otherwise ignored when the table exists and names the same profile; naming a different one is exit 2 (edit profile instead). frappe-init --app without --standards, on an app without the table, does exactly what it does in main: it copies templates/app/ and stops. With --standards, or on an app that has the table, it copies templates/app/ with install_template keep and then runs frappe-nix sync --write.

      • --profile-path <dir> reads the org profile from a local directory instead of the locked input, for profile authors. It is never rendered into flake.nix, it prints a warning on every run, and --check with it exits 3 when CI is set.

      • frappe-init (frappe_init/app_mode.py) execs frappe-nix sync --write|--check … from frappe-nix-tools in its runtimeInputs.

      • Bootstrap (an app with no flake, or one that locks frappe-nix main), from outside any dev shell:

        nix run github:Avunu/frappe-nix/release#frappe-init -- --app --sync --version version-16

        with --standards <profile> added the first time. This is the single documented entry point for an adoption PR (Avunu fleet: PR A). It needs only nix and git. The flake follows release, which frappe-nix's release workflow creates (S32).

      • Later runs inside an app: nix run .#frappe-init -- --sync is preferred. It uses the frappe-nix from flake.lock, and the app-mode flake exposes apps.frappe-init (N3a).

      • A new app: frappe-init --app alone gives today's three files; frappe-init --app --standards recommended gives those, then everything the recommended profile renders (N3).

      --sync runs in two phases (S32). Each step is a no-op when there is nothing to do.

      Phase A: the flake.

      1. Load [tool.frappe-nix], or create it when --standards is given (otherwise exit 2, above). When creating it:

        • profile comes from --standards;

        • frappe-major comes from --frappe-version, else the existing flake.nix frappeVersion, else it is an error;

        • siblings comes from hooks.required_apps, with the existing flake siblings appended (an existing sibling whose flake URL the generic rule wouldn't produce is written in the object form, so its branch is kept);

        • integration-branch is written only when git symbolic-ref --short refs/remotes/origin/HEAD names a branch other than the branching model's default. Then resolve the profile far enough to know its source (§8.3): a built-in name or an in-repo ./<dir> needs nothing more; a flake URL is the standards-profile input.

      2. Render and write flake.nix and .envrc only. On first opt-in, an existing unmanaged flake.nix or .envrc that differs from what templates/app/ renders stops here with exit 2 unless --force is given (§2.5).

      3. If flake.lock is missing, its input set differs from flake.nix (this covers adding, removing or re-pointing standards-profile), or its frappe-nix node's original doesn't match the rendered URL (release, or dev-shell.frappe-nix-url when set): nix flake lock (moving frappe-nix in the last case). A pinned tag, rev, fork or mirror in frappe-nix-url is therefore kept on every run. The lock now holds a release commit and, for an org profile, a standards-profile commit. Then read profile.toml from the locked standards-profile tree and finish resolving the configuration (§8.4); a resolution error is exit 2 before phase B writes anything. For frappe-nix's own self-tests only, FRAPPE_NIX_URL_OVERRIDE (e.g. path:$GITHUB_WORKSPACE) is passed as --override-input frappe-nix <url> to the lock step and every later nix call; it is never rendered into flake.nix, and sync refuses it unless FRAPPE_NIX_ALLOW_SKEW=1.

      4. Re-read frappe_nix.rev from the new lock. If it differs from the running frappe-nix-tools' own rev (a bootstrap from a newer or older release), sync re-executes itself as nix run --no-pure-eval .#frappe-init -- --sync <same args> once, so phase B always renders with the frappe-nix-tools that the lock pins. The environment variable FRAPPE_NIX_SYNC_REEXEC=1 prevents a second re-exec.

      Phase B: everything else. If yarn or uv is missing from PATH, sync re-enters through FRAPPE_NIX_CI=1 nix develop --no-pure-eval -c frappe-nix sync --write --phase b <same args> once, so the lock steps below always run.

      1. Render every other live entry (module on and when true, §2.4), and apply its strategy. When this turns a module on that needs a repository setting (releases, dependabot with auto-merge), sync prints run frappe-nix repo doctor (§5.6).

      2. Retract what isn't live. This is how turning a module off removes its files (S36):

        • a whole file is deleted when it still opens with its managed header and its local regions are empty; with a non-empty local region it is left, and sync exits 2 naming the region, so local content is never lost silently;

        • a seed file is left (it is app content once seeded) and reported;

        • a blocks file has its managed blocks and markers removed;

        • in a merged file, each managed key of an off module is removed when its value still equals the rendered one, and is otherwise left as app-owned with a warning (§2.8, §2.12);

        • a caller workflow of an off gate is a whole file and is deleted like any other, which removes the gate's job (S39).

      3. Delete every match of an applying retire rule (§2.4.1), except paths in retire-keep.

      4. If tools/pyproject.toml changed, tools/uv.lock is missing, or a lock floor isn't met: uv lock --project tools [--upgrade-package …].

      5. If a managed package.json key changed or yarn.lock is missing: yarn install --non-interactive.

      6. Seed the missing nix/node-locks/<key> for each present sibling, where key ∈ {frappe/ui, erpnext/banking, hrms/frontend, hrms/roster}.

      7. If the frappe-nix or a sibling lock node changed since the last relock, and --skip-lock isn't given: nix run --no-pure-eval .#relock. The last relocked state is recorded in nix/uv.lock's header comment, which relock writes.

      8. If readme is on and discover.has_listing: frappe-nix listing readme --write.

      9. git add -A every path written or deleted. Nothing is committed.

      --dry-run prints the unified diff of steps 2, 5, 6 and 7 and the commands the other steps would run, and writes nothing. A dry run on an unbootstrapped app renders phase B against the rev phase A would lock, resolved with git ls-remote https://github.com/Avunu/frappe-nix refs/heads/release.

      --check performs steps 1, 2, 5, 6 and 7 in memory, then validates (each item only while its module is on):

      • the lock floors (step 8);

      • that flake.lock contains a node for every input in flake.nix, and that the standards-profile node is locked from the URL profile names;

      • that the version skew is zero (§3.7);

      • the README blocks (frappe-nix listing readme --check, when installed);

      • .git-blame-ignore-revs;

      • the validation rules for app-owned keys (§2.12).

      It never runs nix, uv or yarn, so it works in no-Nix CI. It reads an org profile through pin-path standards-profile (narHash-verified, §5.2 "Pins").

      Exit codes, which both modes share:

      CodeMeaning
      0Clean: nothing to write, or everything written.
      1Drift: a managed file is missing, differs, or should not exist; a retired file is tracked; or a lock floor isn't met. --check only.
      2Invalid configuration that sync can't fix: not opted in; a [tool.frappe-nix] or profile schema error; an unknown or unresolvable profile; a module dependency that isn't met (§8.2); an org value a live module needs that is empty; an override of a non-overridable template; an unknown sibling; a forbidden key; a malformed local region; a retracted file with local content; a missing README marker; an unmanaged flake.nix/.envrc that would be replaced on first opt-in without --force; or an app table that explicitly enables a GitHub-only module (S43) on a repository hosted elsewhere.
      3Environment error: not an app, not a git repo, flake.lock unreadable, the org profile tree can't be fetched or fails its narHash, a profile whose requires-frappe-nix excludes the running version, version skew.

      When several apply, the highest code wins.

      Output.

      • text: one block per file with path, strategy, the problem, and a unified diff (--- current / +++ rendered). The last line is frappe-nix: N file(s) drifted — run \frappe-init --sync`orfrappe-nix: clean`.

      • json: {"status":"clean|drift|invalid|error","frappe_nix":{"rev","version"},"profile":{"name","source","rev"},"modules":{"<module>":bool},"files":[{"path","strategy","module","problem","diff"}]}. frappe-nix repo audit consumes it.

      • github: the text form plus ::error file=<path>::<problem> annotations.

      3.4 Idempotency

      • --sync run twice in a row MUST leave the tree byte-identical after the second run, and --check MUST exit 0 right after any --sync that exited 0.

      • Rendering MUST be deterministic:

        • no timestamps and nothing derived from the current date (dates come from git history only);

        • sorted iteration wherever order isn't given by data;

        • git ls-files discovery;

        • a fixed Jinja configuration (trim_blocks=True, lstrip_blocks=True, keep_trailing_newline=True).

      3.5 Parameters and app-specific values (summary)

      ValueSource
      Which modules are on, and their parametersThe resolved configuration (§8.4): built-in profile < org profile < [tool.frappe-nix.<module>]
      Organisation valuesorg.* from the same merge (S37)
      App name[project].name
      Frappe major and branch[tool.frappe-nix].frappe-major
      Siblings and their order[tool.frappe-nix].siblings (+ known-apps.json)
      Nested frontend dirsDiscovered (§2.2)
      SPAs without a package.json[[tool.frappe-nix.typescript.spa]]
      Generated files[tool.frappe-nix].generated
      Strict-checkJs and coverage exemptions[[tool.frappe-nix.unchecked-js]], [[tool.frappe-nix.coverage-omit]] (shrink-only)
      Dev-shell freshness checks[tool.frappe-nix].shell-checks
      SCSS globs[tool.frappe-nix.stylelint].globs, or discovered
      Unit-test pathsDiscovered test/unit/**/*.test.ts; minimum from tests.js-coverage-min
      Python test setup[tool.frappe-nix.tests].setup
      Coverage minimum[tool.coverage.report].fail_under (app-owned value, managed table)
      pilot assetspilot-assets.enable + [tool.bench.assets]
      Integration and release branchesreleases.branching → branches (§2.3, S41); the release branch is version-<frappe-major>
      Site name[tool.frappe-nix].site

      3.6 Headers

      KindHeader
      yaml, toml, ini, shell, nix# frappe-nix:managed — generated by frappe-nix (\frappe-init --sync`); do not edit[; edit only inside the frappe-nix region(s)].`
      jsonc, tsThe same text after // .
      noneNo header, because the format allows no comments. Listed in the manifest and in docs/app-standards/managed-files.md.

      The header names no version and no profile, so a frappe-nix or profile release only touches files whose content actually changed.

      3.7 Version skew

      Let rev be the frappe-nix rev in flake.lock. All of the following MUST hold:

      • Every <frappe_nix.owner>/<frappe_nix.name>/.github/workflows/app-*.yml@<sha> in the caller workflows has <sha> == rev and the comment # v<frappe_nix_tools.__version__>.

      • The running frappe-nix was built from rev. Nix knows this directly, because the dev shell's frappe-nix comes from the locked frappe-nix. In CI the install step records the rev, and lint passes it as --expect-rev "$FRAPPE_NIX_EXPECT_REV" (§4.1). frappe-nix sync --check is the same as frappe-init --check, and both accept --expect-rev.

      If any of these fails, --check exits 3. The exceptions, the only places that set FRAPPE_NIX_ALLOW_SKEW=1:

      • frappe-nix repo audit --against latest and the nightly drift job;

      • frappe-nix's own self-tests: when an app-*.yml gets a non-empty frappe-nix-override, the install step exports FRAPPE_NIX_ALLOW_SKEW=1 and lint omits --expect-rev. A commit can't contain its own SHA, so the fixture's rendered callers can never match the commit under test.


      4. CI: the reusable workflows and their callers (N4)

      Everything in this section exists in an app only while the ci module is on (S36), and each workflow and job only while its own module is on:

      Gate or workflowContext (required when listed in §4.8)Present when
      lint (app-lint.yml)ci / lintci. It always runs frappe-nix sync --check, the managed-file gate, so it exists for every app with CI; its other steps follow their modules.
      typecheck (app-typecheck.yml)ci / typecheckci and (typescript, or tests.js-unit with discover.unit_tests)
      test (app-test.yml)ci / testci and any of tests, python-types, nix-lint, or a non-empty shell-checks (all need the dev shell)
      marketplace (app-marketplace.yml)ci / marketplaceci and listing
      pr-policy (app-pr-policy.yml, own caller)ci / pr-policyci and commits
      release.yml → app-release.ymlnoneci and releases
      deps.yml → app-deps.ymlnoneci and dependabot
      nightly.yml → app-nightly.ymlnoneci and ci.nightly
      assets.yml → pilotnonepilot-assets (which needs ci and releases)

      The gates context list (§2.3) is the first five rows' gates that are present. The gate logic is a command, not YAML (S43). frappe-nix gate lint|typecheck|marketplace runs that gate's steps in order, each only when its module is on (it resolves the configuration itself), and exits non-zero when any step failed, after running all of them. The test gate is frappe-test --ci, which reads the same switches (§5.1). A reusable workflow therefore only checks out, installs node, uv and frappe-nix-tools, runs the gate command, and uploads its report; any other CI (GitLab CI, Woodpecker, a laptop) runs the same command after the same setup, which docs/app-standards/ci.md lists. Workflow-level steps that do need a module switch (the node cache, the frappe node_modules install) read it from frappe-nix config --github-output modules (step id cfg). The gate workflows take no input per module, and a parameter change never needs a caller change; only turning a whole gate or workflow on or off changes the rendered callers. (app-nightly.yml is the exception: its optional jobs take run-* inputs, §4.6.)

      <integration> below is branches.integration (any branch name, S41), passed to each reusable workflow as the input integration-branch by the rendered caller; <release> is branches.release, empty under main+tags.

      Private sources (S43). Every reusable workflow accepts the optional secret FETCH_TOKEN, which callers pass from secrets.FRAPPE_NIX_FETCH_TOKEN. When it is non-empty, the install step exports it as FRAPPE_NIX_FETCH_TOKEN, which pin-path and minibench use for authenticated fetches of a private org profile, frappe fork or sibling (§5.2 "Pins"), and the Nix setup adds access-tokens = github.com=<token> to the job's Nix configuration (NIX_CONFIG in $GITHUB_ENV, which needs no sudo). It needs only Contents read on those repositories. For Dependabot runs it must also be a Dependabot secret.

      A GitHub App (ci.github-app, optional). What a workflow pushes, opens or merges with GITHUB_TOKEN starts no workflow, or one that waits for approval (a repository whose fork-PR approval policy is first_time_contributors treats github-actions[bot] as a first-time contributor), so without an App the release flow and the deps and nightly jobs dispatch ci.yml and pr-policy.yml themselves (§4.4, §4.5, §4.6). An org that has a GitHub App installed on its app repositories, with Contents and Pull requests read and write (the token asks for nothing else), names it in ci.github-app (§8.2): app-id, the Actions variable holding its ID (or client ID), and private-key, the secret holding its private key. These are names, never values. The callers of app-release.yml, app-deps.yml and app-nightly.yml (the last only with screenshots on) then pass two optional secrets, APP_ID: ${{ vars.<app-id> || secrets.<app-id> }} and APP_PRIVATE_KEY: ${{ secrets.<private-key> }} (§4.7); a caller's with: can't read secrets, and a Dependabot run sees only Dependabot secrets, so the ID travels as a secret, and the secret fallback lets a Dependabot secret of the same name serve Dependabot's runs (the private key must be a Dependabot secret too). Never secrets: inherit. In each job that pushes, opens or updates a PR, labels or enables auto-merge (release-please, relock-push, auto-merge, relock-upgrade-push, shots-push), all on ubuntu-latest (§4.1, "Runner"), a step app sets enabled to ${{ secrets.APP_ID != '' && secrets.APP_PRIVATE_KEY != '' }}, and when it is true actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 mints a token for the current repository alone with permission-contents: write and permission-pull-requests: write, revoked when the job ends. It is minted after any step that runs the app's or third-party code, right before it is used. Those steps then use ${{ steps.app-token.outputs.token || github.token }}, and the dispatches of ci.yml and pr-policy.yml that make up for a GITHUB_TOKEN push run only when enabled is not true. With either secret empty everything is as without the key, byte for byte in the callers. The fast-forward mints its own token, after the tools are installed, with permission-contents: write and permission-workflows: write (GitHub refuses a ref update from GITHUB_TOKEN onto commits that change .github/workflows/, S29), with continue-on-error, so an App without Workflows write falls back to GITHUB_TOKEN; if the release-branch ruleset restricts updates, the App must be on its bypass list. fetch-metadata, the drift issues, the test-report comment and pilot's assets.yml dispatch keep GITHUB_TOKEN: none of them needs to start a workflow.

      4.1 Conventions shared by every app-*.yml

      • Third-party actions are SHA-pinned with a version comment, matching the zizmor policy "*": hash-pin. A reusable workflow call may instead name its exact release tag when workflow-lint.release-tag-workflows lists that workflow (§2.18; empty by default; the reusable-pins gate refuses a branch). The pins below are the current ones from carbon_frappe and frappe-nix; N4 resolves actions/* to SHAs.

        • DeterminateSystems/nix-installer-action@3138316df39ed29be04236d7ffc686fa525866aa # v23 (determinate: false)

        • DeterminateSystems/magic-nix-cache-action@84c0677f58dcedf3b91f8223ce36a9ea5b3c84b7 # v15 (use-flakehub: false, diagnostic-endpoint: ""; frappe-nix self-tests only, S15)

        • astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0

        • googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0

        • dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0

        • actions/checkout, actions/setup-node, actions/cache, actions/upload-artifact and cachix/cachix-action, each @<sha> # vN.

      • Checkouts always use persist-credentials: false, with no exception. The three jobs that push — relock-push and relock-upgrade-push (§4.5) and nightly shots-push (§4.6) — push to an explicit remote, git push "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" HEAD:<ref>, with GH_TOKEN: ${{ github.token }} (or the App's token, ci.github-app) in that step's env: only. Before pushing, each runs git diff --name-only <base>..HEAD | grep -q '^\.github/workflows/' && exit 1 (S29).

      • Permissions. Each workflow sets permissions: {} at the top, and every job declares exactly what it needs.

      • Environment. FORCE_COLOR: "1". Every run: uses set -euo pipefail (bash), and every ${{ }} value from an event, an input or a secret goes through a step's env: rather than being interpolated into run:, as zizmor's template-injection rule requires. A job-level if: reads only inputs, github and needs, never secrets (the context isn't available there); a condition on a secret is tested inside the script, e.g. [ -n "$REGISTRY_TOKEN" ] || { echo "::notice::…"; exit 0; }.

      • Shell conditionals under set -e are written as if …; then …; fi, never [ … ] && … as a last line, whose false test would fail the step.

      • Working directory. app-root (default .) is applied per job as defaults.run.working-directory: ${{ inputs.app-root }}; workflow-level defaults can't read inputs. uses: steps ignore it, so every path input of an action is prefixed explicitly: node-version-file: ${{ inputs.app-root }}/package.json, actions/cache path: and key: hash globs, setup-uv cache-dependency-glob, and upload-artifact paths.

      • Install frappe-nix-tools. lint, typecheck, marketplace and pr-policy all use the same step. Resolving the configuration afterwards fetches an org profile with pin-path standards-profile, so these jobs need no extra checkout:

      - name: Install frappe-nix-tools at the frappe-nix revision flake.lock pins
        env:
          OVERRIDE: ${{ inputs.frappe-nix-override }}
        run: |
          set -euo pipefail
          node="$(jq -c '.nodes[.nodes.root.inputs["frappe-nix"]].locked' flake.lock)"
          rev="$(jq -r .rev <<<"$node")"; src="$(jq -r '"\(.owner)/\(.repo)"' <<<"$node")"   # Avunu/frappe-nix or a fork
          if [ -n "$OVERRIDE" ]; then
            uv tool install --python 3.14 "$GITHUB_WORKSPACE/$OVERRIDE/py/frappe_nix_tools"
            echo "FRAPPE_NIX_ALLOW_SKEW=1" >> "$GITHUB_ENV"      # self-test only (§3.7)
            echo "FRAPPE_NIX_EXPECT_REV=" >> "$GITHUB_ENV"
          else
            uv tool install --python 3.14 "frappe-nix-tools @ git+https://github.com/${src}@${rev}#subdirectory=py/frappe_nix_tools"
            echo "FRAPPE_NIX_EXPECT_REV=$rev" >> "$GITHUB_ENV"
          fi

      lint passes --expect-rev "$FRAPPE_NIX_EXPECT_REV" only when the variable is non-empty. The package is self-contained (S10), so this install has every template and data file.

      • Nix setup. The test, relock-plan and nightly Nix jobs all use the same steps, in this order:

        1. Free disk: sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL, on a GitHub-hosted runner only (if: runner.environment == 'github-hosted').

        2. nix-installer, on a GitHub-hosted runner only; a self-hosted runner brings its own Nix (§4.2 "Runner").

        3. Cache selection (S15). Let trusted be github.ref == format('refs/heads/{0}', inputs.integration-branch) && (github.event_name == 'push' || github.event_name == 'schedule'). A step maps TOKEN in its env: to ${{ (trusted) && secrets.NIX_CACHE_TOKEN || secrets.NIX_CACHE_READ_TOKEN }}; nothing else ever sees the write token.

          • inputs.nix-cache == '' → no cache action. (magic-nix-cache is throttled in every bench-sized job and evicts the node_modules caches; frappe-nix's own self-tests may still use it for their small closures.)

          • On a self-hosted runner with a cache set, XDG_CONFIG_HOME is the job's $RUNNER_TEMP/config, so the cache credentials that cachix and attic write never outlive the job in the runner's shared home.

          • cachix:<name> → cachix/cachix-action with name: <name>, authToken from that step's mapped token, and skipPush: ${{ !(trusted) }}.

          • attic:<endpoint>/<cache> → nix build --no-link --print-out-paths --inputs-from . nixpkgs#attic-client^out (pinned by the app's flake.lock; its bin goes on $GITHUB_PATH, and never into a profile, which on a self-hosted runner would outlive the job), then always attic login ci <endpoint> ${TOKEN:+"$TOKEN"} (a public cache needs no token but still needs the server configured), then attic use ci:<cache>. A final step if: success() && <trusted> runs attic push ci:<cache> ./result .dev-dist/devshell-profile with the write token.

        4. Every nix develop uses --profile .dev-dist/devshell-profile, so the dev-shell closure can be pushed.

        Org setup: FRAPPE_NIX_CACHE is an org variable; FRAPPE_NIX_CACHE_TOKEN (write) is an org Actions secret only; FRAPPE_NIX_CACHE_READ_TOKEN (pull-only, or unset for a public cache) is an org Actions secret and an org Dependabot secret. That is the whole drop-in. Dependabot runs, which execute bumped third-party code, never hold a credential that can write the cache.

      • Self-test only. The input frappe-nix-override (a path relative to the workspace) adds --override-input frappe-nix "path:$GITHUB_WORKSPACE/<override>" to every nix call, installs frappe-nix-tools from that path, and allows skew (§3.7).

      4.2 The gate workflows: app-lint.yml, app-typecheck.yml, app-test.yml, app-marketplace.yml

      1.1's single app-ci.yml is split so that a caller includes only the gates the app enables (S39). Each file holds exactly one job, named as its gate, and takes the subset of these inputs it uses:

      on:
        workflow_call:
          inputs:
            app:                  { type: string, required: true }
            app-root:             { type: string, default: "." }
            integration-branch:   { type: string, default: "develop" }   # branches.integration (S41)
            nix-cache:            { type: string, default: "" }      # app-test.yml: "", "cachix:<name>", "attic:<endpoint>/<cache>"
            test-timeout-minutes: { type: number, default: 75 }      # app-test.yml
            frappe-nix-override:  { type: string, default: "" }      # frappe-nix self-test only
            runs-on:              { type: string, default: '["ubuntu-latest"]' }  # JSON: a label or a list of labels (ci.runs-on)
          secrets:
            NIX_CACHE_TOKEN:      { required: false }                # app-test.yml; write; used only on trusted runs (S15)
            NIX_CACHE_READ_TOKEN: { required: false }                # app-test.yml
            FETCH_TOKEN:          { required: false }                # every gate; private profile, frappe or siblings (§4)
          outputs:
            coverage: { value: "${{ jobs.test.outputs.coverage }}" }  # app-test.yml only, e.g. "63.2"
      permissions: {}

      Every gate job carries if: ${{ !startsWith(github.ref, 'refs/heads/version-') }} (a no-op under main+tags).

      Runner. Every Linux job of every reusable workflow (the gates, app-pr-policy.yml, app-release.yml, app-deps.yml, app-nightly.yml, fleet-audit.yml) has runs-on: ${{ github.event.pull_request.head.repo.fork && 'ubuntu-latest' || fromJSON(inputs.runs-on) }}, except the jobs that hold a write token for pushing, merging or releasing: app-release.yml's release-please and fast-forward, app-deps.yml's relock-push, auto-merge, sweep, update-branches and relock-upgrade-push, and app-nightly.yml's shots-push have runs-on: ubuntu-latest, which no input changes. A self-hosted runner is shared: one user, a persistent home and Nix store, and jobs from every repository that uses it, so what one job leaves there another can see, and the GitHub App's key (§4.1) must never be on it. Those jobs run no app or dependency code either: where a job used to run the app and then push, it is split into a plan job that runs it with contents: read and no secret but the read ones and uploads a patch, and a hosted push job that checks the patch and pushes it (relock-plan/relock-push, relock-upgrade-plan/relock-upgrade-push, shots/shots-push; §4.5, §4.6). With the default input that is ubuntu-latest, as before; a caller passes runs-on only when the app's ci.runs-on is set (§4.7, §8.2). A pull request from a fork always runs on ubuntu-latest, so a fork's code never reaches a self-hosted runner. The steps that only a GitHub-hosted image needs (free disk, nix-installer, apt) carry if: runner.environment == 'github-hosted', and the self-hosted path gets the same tools from Nix instead (the marketplace job's mysqlclient build inputs; yarn classic through npm when the runner has none). setup-uv puts uv's tool directories in $RUNNER_TEMP, because uv tool install of a path it already has is a no-op and a self-hosted runner's home outlives the job. On a self-hosted runner each job's first step clears what an earlier job left in $RUNNER_TEMP (the runner's own cleanup skips read-only files) and makes the existing contents of $GITHUB_WORKSPACE writable, without deleting them, so that checkout can clean what an interrupted job left there (read-only copies out of the Nix store, such as .frappe-nix/bench/.apps.new). What such a runner needs is in docs/app-standards/ci.md ("Runners"). The 1.1 input run-test is gone: frappe-nix's self-test simply doesn't call app-test.yml on PRs (§7 N4).

      Context names (S3, S39). In the rendered ci.yml the caller job ids are lint, typecheck, test and marketplace, and every one has name: ci, so the check runs are ci / lint, … as in 1.1. N4's selftest-ci asserts these exact check-run names on its first run. If GitHub were to report the caller job id instead of its name, the fallback is a single reusable app-ci.yml with one boolean input per gate and job-level if: inputs.<gate>, called from one caller job ci; a disabled gate then shows as a skipped job, which is acceptable only because §4.8 never lists a disabled gate. N4 records which form shipped in docs/app-standards/ci.md.

      • Dispatch mode is when github.event_name == 'workflow_dispatch'. In that mode, the first step of every gate job looks up the open PR whose headRefName == github.ref_name. If one exists, it asserts headRefOid == github.sha and fails with ::error::stale dispatch otherwise. Every gate job therefore has pull-requests: read (with explicit permissions, an unlisted scope is none, and the lookup would fail with "Resource not accessible by integration").

      • Ratchet base (BASE, S24).

        • pull_request: git merge-base "$BASE_SHA" HEAD, with BASE_SHA = github.event.pull_request.base.sha passed through env:.

        • dispatch: git merge-base "origin/$INTEGRATION" HEAD.

        • push to the integration branch, and schedule: the ratchet is skipped.

      Steps marked [module] run only when that module is on. Steps that need package.json or tools/ run only when those files are live. In lint, typecheck and marketplace, the steps from "install frappe-nix-tools" onwards (excluding uploads) are what frappe-nix gate <job> runs, with the ratchet base passed as --base "$BASE" and dispatch mode detected from GITHUB_EVENT_NAME; the workflow itself runs only the setup steps before it, the single frappe-nix gate <job> --format github step, and the upload.

      Job (name:)runs-on / timeoutPermissionsSteps
      lintubuntu-latest / 45contents: read, pull-requests: read
      1. dispatch guard (above)
      2. checkout, fetch-depth: 0
      3. setup-node (node-version-file: ${{ inputs.app-root }}/package.json)
      4. actions/cache of node_modules, keyed on yarn.lock
      5. yarn install --frozen-lockfile --non-interactive
      6. setup-uv, with cache-dependency-glob: ${{ inputs.app-root }}/tools/uv.lock
      7. uv lock --check --project tools && uv sync --frozen --project tools
      8. install frappe-nix-tools; the cfg step
      9. frappe-nix sync --check --format github, plus --expect-rev "$FRAPPE_NIX_EXPECT_REV" when that is non-empty
      10. when .pre-commit-config.yaml is live: uv run --frozen --project tools prek run --all-files --show-diff-on-failure
      11. [test-utils, with either hook in test-utils.hooks] frappe-nix minibench --mode customizations --dest .dev-dist/minibench and then, from the worktree it creates, prek run --hook-stage manual validate_customizations --all-files --show-diff-on-failure and the same for clean_customized_doctypes. minibench exits 1 if sites/, env/ or apps/ is missing (the guard).
      12. [semgrep] semgrep (below)
      13. frappe-nix ratchet --base "$BASE", unless the ratchet is skipped for this event; it runs only the ratchets whose modules are on (§5.9)
      14. yarn -s ci:lint if package.json has that script
        typecheckubuntu-latest / 45contents: read, pull-requests: read
        1. dispatch guard
        2. checkout
        3. node
        4. cache
        5. yarn install --frozen-lockfile
        6. setup-uv; install frappe-nix-tools
        7. export FRAPPE_PATH="$(frappe-nix pin-path frappe)" (pin-path --writable with frappe-node-modules, which writes into the tree: never the read-only store path) into $GITHUB_ENV: the app's locked frappe tree, fetched and narHash-verified (carbon's compile and audit:drift read it)
        8. [typescript] if [tool.frappe-nix] frappe-node-modules = true: yarn --cwd "$FRAPPE_PATH" install --frozen-lockfile --ignore-scripts --non-interactive, cached on frappe's yarn.lock hash
        9. [typescript] if the typecheck script exists: yarn -s typecheck (the managed solution, then each SPA's check)
        10. [typescript with check-js] if [[tool.frappe-nix.unchecked-js]] is non-empty: frappe-nix unchecked-js --stale (§2.9)
        11. [tests with js-unit] if test:unit exists: assert at least one test/unit/**/*.test.ts, then yarn -s test:unit
        12. for each nested frontend whose package.json has a typecheck script: yarn --cwd <d> install --frozen-lockfile && yarn --cwd <d> typecheck
        13. [typescript] if types/doctypes.d.ts is tracked: frappe-nix minibench --mode doctypes --dest .dev-dist/minibench, then yarn -s frappe-types gen-registry --bench .dev-dist/minibench --app <app> [--include-siblings <csv>] --out types/doctypes.d.ts --check, where <csv> is the siblings hooks.required_apps names (a sibling there only for the tests is not typed in full; with none the flag is left out). gen-registry merges the app's Custom Field definitions (custom/*.json and fixtures/*.json, which minibench copies) into the core doctypes they extend.
        14. [typescript] if [tool.frappe-nix.typescript] audit-consumer = true: yarn -s frappe-types audit-consumer --app . --strict --types 'types/*.d.ts'. Otherwise, when the subcommand exists, it runs without --strict and its summary is a ::notice::. The default flips to on in a later frappe-nix MINOR, once frappe-types ships --types and the string-literal fix; today --strict fails 9 of 12 apps, partly on false positives.
        15. yarn -s ci:typecheck if present (it sees FRAPPE_PATH)
          testubuntu-latest / inputs.test-timeout-minutescontents: read, pull-requests: read (its test-report job: pull-requests: write, so the caller grants write)
          1. dispatch guard
          2. checkout, fetch-depth: 0
          3. Nix setup (§4.1)
          4. Clean bench build, nix build .#default -L --no-pure-eval (also compiles every app's assets, so it exercises S30): always on push, schedule and dispatch; on pull_request only when git diff --name-only "$(git merge-base "$BASE_SHA" HEAD)" HEAD touches package.json, yarn.lock, flake.nix, flake.lock, nix/**, vite*.config.*, scripts/vite-register.mjs, <app>/public/**, a nested frontend, an SPA root or <app>/hooks.py. Every release PR is dispatched, so it always gets the build.
          5. FRAPPE_NIX_CI=1 nix develop --no-pure-eval --profile .dev-dist/devshell-profile -c frappe-test --ci (the single shell entry; §5.1). --ci turns on exactly the stages whose modules are on: tests and coverage (tests), testmap and composition (tests.testmap, tests.composition), ty (python-types), nix-lint (nix-lint) and the shell-checks stage.
          6. if: failure(): tail 200 lines of each .frappe-nix/bench/logs/*.log in a group
          7. if: always(): upload .dev-dist/test/ as the artifact test-report
          8. cache push (§4.1, trusted runs only)
          9. the output coverage is read from .dev-dist/test/frappe-test-report.json (empty when tests is off)Then the test-report job (ci / test-report, 5 minutes, pull-requests: write only, no checkout), needs: test, unless the run was cancelled or test was skipped, on a pull request from a branch of the repository or a dispatched run: it downloads test-report and keeps one comment per app on the pull request (python-devops-nix's sticky-comment, marker frappe-test-<app>) holding summary.md: the verdict, the stage table, the failed tests with their tracebacks, and the coverage. A run that died before frappe-test wrote it comments that, with the link to the run. A fork's pull request gets no comment: its token is read-only.
            marketplaceubuntu-latest / 30contents: read, pull-requests: read
            1. dispatch guard
            2. checkout
            3. sudo apt-get install -y --no-install-recommends pkg-config libmysqlclient-dev (mysqlclient has no Linux wheel, and L9 installs frappe from source; registry-dryrun track); on a self-hosted runner instead nix build nixpkgs#gcc nixpkgs#pkg-config nixpkgs#libmysqlclient.dev, onto $GITHUB_PATH and PKG_CONFIG_PATH
            4. setup-uv, cache-dependency-glob: ${{ inputs.app-root }}/flake.lock
            5. install frappe-nix-tools
            6. EIO_BACKEND=posix frappe-nix listing check --format github (§5.2: listing, hooks metadata against the org values, pyproject ranges, version, override allow-list, logo structure when icons is on, registry semgrep at the pinned marketplace rev with the baseline, pilot get-app validator at the pinned pilot rev with the dependency apps on the bench when listing.getapp-check is on)
            7. upload .dev-dist/marketplace/ as the artifact marketplace-reportThe pip/uv caches for L9's validation bench are kept under actions/cache keyed on the pinned frappe and pilot revs; selftest-product (N5) measures L9 and fails if a cold run exceeds 25 minutes, leaving 5 minutes of margin.

              There is no version-guard job. version-* only ever moves through the release workflow's REST PATCH, which raises no push event, so a push-triggered guard would never run. The fast-forward job asserts the D8 invariant itself right after the PATCH (§4.4), and audit row A2 checks it nightly. Under main+tags there is no release branch and nothing to guard.

              The semgrep step in lint (module semgrep; semgrep.frappe-rules and semgrep.test-correctness switch the first two scans), with RULES set to the frappe-semgrep-rules store path read from the app's flake.lock (frappe-nix pin-path frappe-semgrep-rules fetches and verifies that tree, then prints its path):

              RULES="$(frappe-nix pin-path frappe-semgrep-rules)"
              uv run --frozen --project tools semgrep scan --error --metrics=off --config "$RULES/rules" <app>
              uv run --frozen --project tools semgrep scan --error --metrics=off --include='**/test_*.py' \
                --config "$(frappe-nix data-path semgrep/test-correctness.yml)" <app>
              if [ -d semgrep ]; then
                uv run --frozen --project tools semgrep scan --error --metrics=off --config semgrep <app>
              fi

              r/python.lang.correctness, which carbon_frappe uses, is dropped because it is unpinned.

              4.3 app-pr-policy.yml: the job behind ci / pr-policy

              Module commits (with ci). The major rule applies only under releases.version-scheme = "frappe-major", and frappe-nix policy reads that from the resolved configuration.

              on:
                workflow_call:
                  inputs:
                    app:                 { type: string, required: true }
                    integration-branch:  { type: string, default: "develop" }
                    frappe-nix-override: { type: string, default: "" }
              permissions: {}
              jobs:
                pr-policy:
                  name: pr-policy
                  runs-on: ubuntu-latest
                  timeout-minutes: 10
                  permissions: { contents: read, pull-requests: read }

              Steps:

              1. checkout with fetch-depth: 0;

              2. setup-uv, then uv sync --frozen --project tools;

              3. install frappe-nix-tools;

              4. frappe-nix policy --pr, with env GH_TOKEN: ${{ github.token }}, INTEGRATION (inputs.integration-branch), EVENT_NAME, BASE_REF (github.event.pull_request.base.ref), HEAD_SHA (github.event.pull_request.head.sha || github.sha), PR_TITLE, PR_AUTHOR (github.event.pull_request.user.login) and REF_NAME. On a dispatch, BASE_REF, PR_TITLE and PR_AUTHOR are empty; frappe-nix policy then takes them from the PR it looks up (§5.9).

              What frappe-nix policy --pr checks is in §5.9.

              4.4 app-release.yml: releases without an App, or with one

              Module releases (with ci). Profile values: releases.branching, listing.publish, listing.registry-fork, pilot-assets.enable, all rendered into the caller's with: (§4.7), and ci.github-app, rendered into its secrets:.

              on:
                workflow_call:
                  inputs:
                    app:                { type: string, required: true }
                    integration-branch: { type: string, default: "develop" }   # branches.integration
                    release-branch:     { type: string, default: "" }          # branches.release: "version-16", or "" under main+tags
                    publish:            { type: boolean, default: false }      # caller: listing.publish && vars.MARKETPLACE_PUBLISH == 'true'
                    pilot-assets:       { type: boolean, default: false }
                    registry-fork:      { type: string, default: "" }          # listing.registry-fork; required when publish is true
                  secrets:
                    REGISTRY_TOKEN:  { required: false }
                    APP_ID:          { required: false }   # ci.github-app (§4.1)
                    APP_PRIVATE_KEY: { required: false }
                  outputs:
                    released: { value: "${{ jobs.release-please.outputs.releases_created }}" }
                    tag:      { value: "${{ jobs.release-please.outputs.tag_name }}" }
              permissions: {}
              Jobneeds / ifPermissionsWhat it does
              release-pleaseif: github.ref == format('refs/heads/{0}', inputs.integration-branch)contents: write, pull-requests: writeThe App's token when the caller passes one (§4.1). release-please-action with token (the App's, else GITHUB_TOKEN), config-file, manifest-file and target-branch: <integration>. Outputs: releases_created, sha, tag_name, and app (true with an App). If the action fails because the repository doesn't let GitHub Actions create pull requests, the job adds ::error:: naming the setting and frappe-nix repo doctor (§5.6).
              dispatch-cineeds release-please; if: always() && needs.release-please.result == 'success' && needs.release-please.outputs.app != 'true': an App's release PR starts its own CIactions: write, checks: read, pull-requests: readFinds the open PR: gh pr list --base <integration> --label 'autorelease: pending' --state open --json number,headRefName,headRefOid. Accepts it only if headRefName == "release-please--branches--<integration>--components--<package-name>" or "release-please--branches--<integration>". Then checks each required context on the head SHA independently (gh api repos/$R/commits/$SHA/check-runs?check_name=<ctx>): if ci / lint is absent, gh workflow run ci.yml --ref "$head"; if ci / pr-policy is absent and pr-policy.yml exists, gh workflow run pr-policy.yml --ref "$head". A dispatch that failed or was cancelled by a concurrency group is therefore retried by the next run. Idempotent under the daily cron.
              fast-forwardneeds release-please; if: needs.release-please.outputs.releases_created == 'true' && inputs.release-branch != ''contents: write, actions: writegh api repos/$R/git/ref/heads/$VB exists → gh api -X PATCH repos/$R/git/refs/heads/$VB -f sha=$SHA -F force=false; otherwise gh api -X POST repos/$R/git/refs -f ref=refs/heads/$VB -f sha=$SHA, which happens on the first release. GitHub refuses anything that isn't a fast-forward. $VB is inputs.release-branch. $SHA is a commit already on the integration branch, so the PATCH never introduces a new workflow file, but GitHub still refuses it from GITHUB_TOKEN when the commits it crosses change one (S29): it runs with the App's token when there is one, and a 403 fails with ::error:: naming that cause and the manual gh api -X PATCH … -F force=false. Guard (D8): it then reads the ref back and the tag this run created, needs.release-please.outputs.tag_name (peeled), and fails with ::error:: unless they are equal. This holds under both version schemes: under semver the release branch version-16 carries tags v1.x, v2.x, … and never a v16.* tag. Under frappe-major it also fails unless that tag starts with <tag-prefix><major>.. Then, if inputs.pilot-assets, a step with GITHUB_TOKEN: gh workflow run assets.yml --ref "$VB" (S14).
              assets-on-tagneeds release-please; if: needs.release-please.outputs.releases_created == 'true' && inputs.release-branch == '' && inputs.pilot-assetsactions: writemain+tags only: gh workflow run assets.yml --ref "$TAG", so pilot names the release assets-<tag>.
              publishneeds fast-forward (or release-please under main+tags); if: inputs.publishcontents: write (to edit the release notes)env: REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}, FORK: ${{ inputs.registry-fork }}, TAG, VB. Fails with ::error:: naming the missing secret if $REGISTRY_TOKEN is empty, or the missing value if $FORK is. Otherwise: install frappe-nix-tools; GH_TOKEN="$REGISTRY_TOKEN" frappe-nix listing registry --tag "$TAG" --branch "${VB:-$INTEGRATION}" --fork "$FORK". On success, gh release edit "$TAG" --notes-file …, with GITHUB_TOKEN, appends Marketplace: <registry PR URL>.
              • Merging the release PR is the "ship it" moment. In the Avunu fleet (plan §7 decision 6), a person or the main agent does it. GitHub then cuts the tag through release-please on the next run: either the push from a human merge (or one auto-merged by the App), or the daily cron if the merge was done with GITHUB_TOKEN.

              • Concurrency is set by the caller: group: release, cancel-in-progress: false.

              4.5 app-deps.yml: relock, auto-merge, sweep

              Module dependabot (with ci). Profile values: dependabot.auto-merge (the auto-merge input; true in both built-in profiles that enable dependabot), dependabot.auto-merge-policy (the auto-merge-policy input, passed only when it is "all" and auto-merge is on; S44), dependabot.update-branches (the update-branches input and the caller's push trigger, rendered only when true), and dependabot.ecosystems (only ecosystems that are on can produce PRs). A job for an ecosystem that is off never triggers, because no such PR exists.

              on:
                workflow_call:
                  inputs:
                    app:                { type: string, required: true }
                    integration-branch: { type: string, default: "develop" }
                    nix-cache:          { type: string, default: "" }
                    auto-merge:         { type: boolean, default: true }
                    auto-merge-policy:  { type: string, default: "decision-table" }   # or "all" (S44)
                    update-branches:    { type: boolean, default: false }
                    merge-method:       { type: string, default: "squash" }   # first of repo-policy.merge-methods
                    relock-cron:        { type: string, default: "0 8 * * 1" } # ci.schedules.deps-relock; "" = no weekly relock
                  secrets:
                    NIX_CACHE_TOKEN:      { required: false }
                    NIX_CACHE_READ_TOKEN: { required: false }
                    FETCH_TOKEN:          { required: false }
                    APP_ID:               { required: false }   # ci.github-app (§4.1); vars || secrets, for Dependabot runs
                    APP_PRIVATE_KEY:      { required: false }
              permissions: {}

              A GitHub App (§4.1), when the caller passes one, gives relock-push, auto-merge and relock-upgrade the token they push, open PRs, label and enable auto-merge with. Its pushes start ci.yml, pr-policy.yml and deps.yml on the PR like any other push, so the dispatches below are skipped; and an auto-merge it enables raises a push on the integration branch when it merges, which starts ci.yml and release.yml without waiting for their crons.

              Auto-merge safety. Auto-merge is only safe when required checks protect the integration branch, and it only works when the repository allows it; recommended turns on dependabot.auto-merge but leaves repo-policy off, so neither can be assumed. Before any gh pr merge --auto, the job (auto-merge, relock-push or relock-upgrade) reads GET /repos/{r}/rules/branches/<integration> (readable with contents: read) and the classic protection summary, and requires a required_status_checks rule that lists every enabled gate's ci / <gate> context. If none does, or if gh pr merge --auto fails because auto-merge is disabled for the repository, the job labels the PR needs-review, writes a ::notice:: naming frappe-nix repo doctor, and succeeds. Every job that applies a label first runs gh label create <name> --color <c> --description <d> --force for it (idempotent; pull-requests: write suffices), so the dependencies, needs-review and screenshots labels exist without repo-policy.

              Let isDependabot be github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]'. zizmor's bot-conditions rule requires reading the PR author rather than github.actor.

              What dependabot nix moves. frappe and the siblings only (S5). Their bump changes flake.lock, nix/uv.lock, possibly nix/node-locks/** and, in an app that tracks it, types/doctypes.d.ts (§2.9), never a workflow file, so relock-push can push it with GITHUB_TOKEN. Dependabot writes flake.lock; the relock patch is checked against an allowlist of the other paths, and flake.lock is not one of them: relock-plan ran the PR's code, so relock-push takes the patch as untrusted data and refuses anything else (below), and a patched flake.lock could re-point the frappe-nix node the key-holding jobs install their tools from. frappe-nix moves through frappe-nix's rollout.yml (§5.8) and standards-profile through frappe-nix repo rollout --profile-to, either also by frappe-nix repo rollout or a manual commit made by hand (S5, S38).

              JobifPermissionsSteps
              relock-planisDependabot && startsWith(github.head_ref, 'dependabot/nix/')contents: read
              1. checkout the PR head SHA, fetch-depth: 0
              2. Nix setup (read token only)
              3. if the PR moves the frappe-nix or the standards-profile lock node (compare flake.lock against the merge-base): write rollout-input-moved to the job output and stop; the auto-merge job closes the PR (§2.17)
              4. nix run --no-pure-eval .#relock
              5. FRAPPE_NIX_CI=1 nix develop --no-pure-eval -c frappe-init --sync --skip-lock
              6. if pyproject.toml changed: nix run --no-pure-eval .#relock again
              7. frappe-nix ci relock-doctypes --probe, which looks for the tracked file before it loads the profile, so an app without it has nothing more that can fail; when the typescript module is on and types/doctypes.d.ts is tracked (doctypes=true): actions/setup-node from package.json, a restore-only actions/cache/restore of the typecheck job's node_modules (same key), yarn classic on a self-hosted runner without it, then yarn install --frozen-lockfile --non-interactive && frappe-nix ci relock-doctypes, which is the typecheck gate's doctypes step without --check (gate.doctypes, the one argument list both use: the doctypes mini-bench, then frappe-types gen-registry … --out types/doctypes.d.ts). Each of these steps is continue-on-error; if any fails, the file stays as committed and a ::notice:: says so, and the job goes on to push the lock without it, since the lock is right on its own and ci / typecheck on the pushed head still names the stale registry (and, being required, holds auto-merge). The mini-bench is a blob-less sparse clone of each pin's DocType JSON, and node_modules is usually a cache hit, so this adds a minute or two only to apps that track the file. The tools are the integration branch's (above), and ci / typecheck uses the PR head's: if a rollout that changes the command lands on the integration branch after Dependabot opened the PR, the regenerated file can still fail --check until Dependabot rebases, as it would have without this step
              8. git add -A && git diff --cached --binary > relock.patch (sync stages its writes, and new files such as fresh nix/node-locks/** are untracked, so the plain git diff would miss both)
              9. if relock.patch names any path under .github/workflows/: fail with ::error::relock would change a workflow; run frappe-nix repo rollout (S29)
              10. output empty=true|false; upload the patch as an artifact. This job runs PR code, so it has no write token and no secrets apart from the read-only cache token.
                relock-pushneeds relock-plan; needs.relock-plan.outputs.empty == 'false'contents: write, actions: write, pull-requests: write
                1. checkout the PR head SHA relock-plan made its patch on, with its history, persist-credentials: false
                2. download the patch and check it before any token exists; nothing else runs. Refused: a rename, copy or mode change; any mode but 100644 (no executable, symlink or submodule); a change other than add, modify or delete; an absolute, . or .. path; anything under .github/ (S29); and any path but nix/uv.lock, nix/node-locks/** and types/doctypes.d.ts (flake.lock included). Before that, it computes from the PR head's and the merge-base's flake.lock (contents API, jq) whether the PR moves frappe-nix or standards-profile, and refuses when it does. Then git apply --index relock.patch, and the same checks on what the index holds against HEAD
                3. the job runs on ubuntu-latest (§4.1, "Runner"), and installs frappe-nix-tools (for the lock check and the auto-merge safety rule), hash-locked (§4.5, N4 in §7), before it mints the App's token
                4. frappe-nix ci verify-relock --base <merge-base> --head $(git write-tree): what the lock files say, against the PR's merge-base (below, "The relock's lock files"). reject fails the job and nothing is pushed
                5. unless the lock check says ok: frappe-nix ci hold turns off an auto-merge an earlier run enabled (GitHub keeps it on across a push by anyone with write access; the step fails if it stays on) and labels the PR needs-review, before the push
                6. git -c user.name=github-actions[bot] -c user.email=41898282+github-actions[bot]@users.noreply.github.com commit -m "chore(deps): relock and sync after flake bump [dependabot skip]"
                7. push to the explicit token remote (§4.1) HEAD:refs/heads/$HEAD_REF, not forced (refused if the branch moved since the event), with the App's token when there is one
                8. without an App: gh workflow run ci.yml --ref "$HEAD_REF" && gh workflow run pr-policy.yml --ref "$HEAD_REF"
                9. if inputs.auto-merge and the lock check said ok: gh pr merge --auto --<merge-method> --match-head-commit <the pushed SHA> "$PR_URL" under the auto-merge safety rule above, which is the only place a nix PR's auto-merge is enabled after a relockWith GITHUB_TOKEN the push creates only 0-job action_required runs; with an App it starts deps.yml again, whose relock-plan then finds nothing to relock, so neither can loop. [dependabot skip] lets Dependabot keep rebasing; each rebase triggers relock again, and a new head SHA cancels any pending auto-merge only after the required checks re-run on it.
                  auto-mergeisDependabot && inputs.auto-mergecontents: write, pull-requests: writefetch-metadata, then the decision table below, or under inputs.auto-merge-policy == 'all' the same table with every review verdict turned to auto (except a github_actions bump, which stays review; relock and close stay). When the verdict is auto, gh pr merge --auto --<merge-method> "$PR_URL" under the auto-merge safety rule above; when it is review, gh pr edit "$PR_URL" --add-label needs-review. Every gh pr merge --auto names the head the verdict was made on (--match-head-commit, from --head-sha), and a review verdict first turns off an auto-merge an earlier run enabled (gh pr merge --disable-auto). For nix this job never enables auto-merge itself: it needs: relock-plan and enables it only when relock-plan reported empty == 'true' (nothing to relock) and frappe-nix ci verify-relock, run here on the PR head (checked out as data at .head) against its merge-base, says ok: that empty comes from a job that ran the PR's code, and the PR may carry a relock an earlier run pushed and held for review. needs-review holds the PR; reject fails the job. Otherwise relock-push enables it after its push, so a stale nix/uv.lock can't merge on green checks that ran before the relock landed. When the PR moves frappe-nix or standards-profile, it comments and closes the PR; this job computes that itself from the PR's and the merge-base's flake.lock, and fails, leaving the PR for review, when relock-plan reported rollout-input-moved and the lock moves neither.
                  disarmisDependabot && inputs.auto-merge and a dependabot/nix/ branch; ubuntu-latest; no needscontents: write, pull-requests: writegh pr merge --disable-auto when auto-merge is on, with GITHUB_TOKEN alone, nothing checked out or run. GitHub keeps an auto-merge an earlier head's run enabled across Dependabot's push of a new head and checks --match-head-commit only when auto-merge is enabled, while a nix PR's verdict waits for relock-plan: every new head starts with auto-merge off, and relock-push or auto-merge enables it again for the head it checked.
                  holdalways(), isDependabot && inputs.auto-merge, and disarm, relock-plan, relock-push or auto-merge failed or was cancelled, or auto-merge said wait and relock-push did not succeed; needs all four; ubuntu-latestcontents: write, pull-requests: writeWith GITHUB_TOKEN alone, nothing checked out or run: auto-merge off (fails if it stays on), then gh label create needs-review … --force and the label. A head no job reached a verdict on (relock-plan's outputs are a job's that ran the PR's code) is never merged on green checks alone.
                  sweep(github.event_name == 'schedule' && github.event.schedule != inputs.relock-cron) || github.event_name == 'workflow_dispatch'actions: write, checks: read, pull-requests: readFor each open PR whose author is app/dependabot or app/github-actions, check each required context on its head SHA independently: dispatch ci.yml when ci / lint is absent, and pr-policy.yml when ci / pr-policy is absent. This is the fallback if a Dependabot-triggered job can't be granted actions: write (inferred, not proven), and it retries a dispatch that failed or was cancelled.
                  update-branchesinputs.update-branches && (github.event_name == 'push' || (github.event_name == 'schedule' && github.event.schedule != inputs.relock-cron) || github.event_name == 'workflow_dispatch'); concurrency: update-branches-<repo>, not cancelled, so a burst of pushes leaves one run pendingcontents: write, pull-requests: write, actions: write, checks: readInstall frappe-nix-tools from the integration branch's lock; with an App, mint its token asking for permission-workflows: write as well (continue-on-error), and without that permission mint it with Contents and Pull requests only; then frappe-nix ci update-branches --integration <int> (with --dispatch-ci when the token is GITHUB_TOKEN). For each open PR into the integration branch that is Dependabot's, or a bot's (GitHub Actions or an App) on a standards/* branch (not a fork's; never a release-please--* branch or an autorelease: label; no other bot's, such as a coding agent's), oldest first and at most 10 per run, that GET repos/{r}/compare/<int>...<head> says is behind: PUT repos/{r}/pulls/{n}/update-branch with expected_head_sha. Not @dependabot rebase: Dependabot answers it from a GitHub App or github-actions[bot] with "only users with push access can use that command". A refusal (conflict, a workflow change without Workflows write) is a ::notice::. With --dispatch-ci the job waits for the new head and runs ensure_ci on it (§4.4).
                  relock-upgrade-plan(inputs.relock-cron != '' && github.event.schedule == inputs.relock-cron) || (github.event_name == 'workflow_dispatch')contents: read
                  1. checkout the integration branch, persist-credentials: false
                  2. Nix setup, with the read token only even though it is a schedule: it resolves new third-party packages
                  3. nix run --no-pure-eval .#relock -- --upgrade
                  4. frappe-nix ci relock-patch (git add -A, the binary patch without renames, the workflow refusal, S29); output empty and the commit it relocked, and upload the patch. types/doctypes.d.ts is not regenerated here: --upgrade moves only the Python packages in nix/uv.lock, never flake.lock's frappe and sibling pins or the app's own yarn.lock (frappe-types), so the registry's inputs don't change. This job runs third-party code: no write token, and no secret but the read ones
                    relock-upgrade-pushneeds relock-upgrade-plan; empty == 'false'; ubuntu-latestcontents: write, pull-requests: write, actions: write
                    1. checkout the integration branch with its history, persist-credentials: false; refuse unless the commit the plan relocked (its sha output) is a full SHA that is an ancestor of that head (git merge-base --is-ancestor), keep the head in a worktree for the auto-merge safety rule, and switch to the commit
                    2. download the patch and check it as relock-push does, with nix/uv.lock and nix/node-locks/** the only paths; git apply --index
                    3. frappe-nix ci verify-relock --base <the plan's commit> --head $(git write-tree), and again with --base the integration branch's head (the plan job, which ran third-party code, names its commit itself), before the token is minted; reject in either fails the job, and only ok in both is ok
                    4. unless it says ok, frappe-nix ci hold on an open PR of the branch before the push
                    5. commit chore(deps): relock python on branch standards/relock-python, and force-push to the token remote (§4.1)
                    6. open or update the PR with GITHUB_TOKEN, or the App's token
                    7. without an App, dispatch ci.yml and pr-policy.yml on it
                    8. unless the lock check said ok, frappe-nix ci hold on the PR; else if inputs.auto-merge: gh pr merge --auto --<merge-method> --match-head-commit <the pushed SHA>, under the auto-merge safety rule above

                      The relock's lock files (frappe-nix ci verify-relock, ci/lockcheck.py). The "Check and apply" step bounds which paths a plan's patch touches; this bounds what the lock files say, so a plan job that a shared runner has poisoned cannot have the App push, or auto-merge, more than an honest relock of the bumped dependency writes. It compares nix/uv.lock and nix/node-locks/** in the tree to push with a commit the integration branch holds, reading git only, and decides ok, needs-review or reject:

                      • nix/uv.lock is not deleted. A package entry that is not the base's (same name, version, source and files) comes from PyPI (registry = "https://pypi.org/simple"), a source the base lock has, or a directory inside one the base lock installs editable (an editable or directory source whose plain relative path, with no ., .., empty segment, backslash, : or ~, extends the base's by whole segments: Frappe's flow harness, apps/frappe/flow/harness, under apps/frappe; its files are that app's, pinned by the flake.lock the relock does not touch), and each of its files is an https URL on files.pythonhosted.org whose filename names that package and version, or a URL the base lock has; else reject. A git source the base has at another commit (frappe's pypika or gunicorn fork after a frappe bump) is needs-review.

                      • nix/node-locks/** holds only yarn.lock and source.json. A yarn.lock is classic (berry is reject) and exactly the shape yarn writes, read on \n only: blank and comment lines, unindented key lines, two-space version/resolved/integrity/name/uid lines with one value (quoted without whitespace or escapes, or bare), two-space dependencies:/optionalDependencies: headers and the four-space lines under them, no field twice in an entry and no spec in two entries; and python-devops-nix's lib/node/yarn-lock.nix line regexes (last field wins) must find the same entries and values; else reject, because a line this check skips but the offline mirror, fixup-yarn-lock or yarn takes would let the lock say one thing here and another to the build. Every resolved URL is https on registry.yarnpkg.com or registry.npmjs.org, or one the base's locks have, and an entry that is not the base's resolves the npm tarball of the name and version it names (/<name>/-/<base name>-<version>.tgz); else reject. A new target equal to the seed frappe-nix-tools ships for the base's frappe-major is the seed's. A source.json is the base's, the seed's, or that stamp with other manifest hashes; forced, the one field the build acts on (lib/bench.nix takes the fallback over the app's own lock), stays what the base or, for a new target, the seed says; else reject. Deleting the yarn.lock or the source.json of a target the base forces while the other stays turns the override off too, and is reject; pruning the whole forced target is needs-review.

                      • A package name no base lock of that file had (uv or yarn), or a new yarn entry with no resolved URL or with a name or uid, is needs-review: an honest relock adds one only when the bumped dependency does, and a person should see it.

                      needs-review is pushed with auto-merge off and the PR labelled; reject pushes nothing. types/doctypes.d.ts is declarations only and is not checked. The helpers it shares with the rollout's patch check (#281) live in this module.

                      The PAT-free automation spike (N4, not blocking v1). N4 tests, on a scratch repo, whether a GITHUB_TOKEN can land a commit that changes a workflow file through the Git Data API (POST git/blobs, git/trees, git/commits, then PATCH git/refs/heads/<branch> with force=false). If it can, a later frappe-nix MINOR adds an opt-in frappe-nix-bump job that does what frappe-nix repo rollout does. If it can't, frappe-nix repo rollout stays the only path and nothing changes. The result is written into docs/app-standards/github.md. Since then, frappe-nix's rollout.yml (§5.8) automates the frappe-nix bump with the org's GitHub App token, which has Workflows write, so the spike no longer blocks anything.

                      Auto-merge decisions, using fetch-metadata's package-ecosystem, update-type, dependency-group, dependency-names and directory. The ecosystem strings are fetch-metadata v3's own values; N4 adds a unit test with recorded metadata for each row.

                      package-ecosystemMerged automaticallyLabelled needs-review
                      github_actionsneverevery one, whatever its group (actions, docs-actions, pilot): the action or reusable workflow it moves runs in the app's workflows, where jobs can hold the GitHub App's key (§4.1), and required checks cannot tell a compromised release from a good one. Avunu/frappe-nix and its workflows (Avunu/frappe-nix/*) are ignored; a PR that moves only those pins is closed
                      npm_and_yarnminor and patch in / and nested frontendsdirectory == /docs-site; any version-update:semver-major
                      uv (/tools)minor and patchsemver-major
                      pre_commithooks groupthe test-utils group, i.e. anything touching agritheory/test_utils (S19, test-utils track)
                      nixenabled by relock-push after its push when its lock check says ok, or by this job when there was nothing to relock and the PR's lock files check oka relock whose lock check says needs-review; a PR that moves frappe-nix or standards-profile is closed instead (S5, S38)
                      submodulesalways—

                      With auto-merge-policy = "all" (S44) every Labelled needs-review cell above becomes "merged automatically", apart from github_actions, which stays labelled; the nix row, its lock check and its closing of rollout inputs stay.

                      The required checks are the gate, and auto-merge waits for them on the newest head SHA. enable-automerge leaves a PR whose auto-merge is already on as it is, so the weekly relock and the nightly screenshots can enable it again on the PR they update.

                      4.6 app-nightly.yml

                      Module ci with ci.nightly. Each job has its own switch, rendered by the caller as a boolean input (nightly jobs are never required checks, so a skipped one is harmless): integration (tests), shots (screenshots), links (listing), duplication (test-utils with check_code_duplication in test-utils.hooks), registry-refresh (listing.publish); drift always runs.

                      on:
                        workflow_call:
                          inputs:
                            app:              { type: string, required: true }
                            integration-branch: { type: string, default: "develop" }
                            nix-cache:        { type: string, default: "" }
                            publish:          { type: boolean, default: false }
                            run-integration:  { type: boolean, default: true }
                            run-shots:        { type: boolean, default: false }
                            run-links:        { type: boolean, default: false }
                            run-duplication:  { type: boolean, default: false }
                            auto-merge:       { type: boolean, default: false }   # the screenshots PR; dependabot.auto-merge-policy = "all"
                            merge-method:     { type: string, default: "squash" }
                          secrets:
                            NIX_CACHE_TOKEN:      { required: false }
                            NIX_CACHE_READ_TOKEN: { required: false }
                            REGISTRY_TOKEN:       { required: false }
                            APP_ID:               { required: false }   # ci.github-app (§4.1), passed only with screenshots on
                            APP_PRIVATE_KEY:      { required: false }
                      permissions: {}
                      JobPermissionsSteps
                      integration (inputs.run-integration)contents: readNix setup, then no FRAPPE_NIX_CI, because node modules are needed for bench build. Then nix develop --no-pure-eval -c bash -c 'bash "$(frappe-nix data-path ci/nightly.sh)"' (the dev shell's frappe-nix resolves the path), running the script below. Every failure is kept, and the job fails if the tests, the build or any suite failed. Uploads .dev-dist/.
                      shots (inputs.run-shots)contents: readRuns only if marketplace/screenshots.ts is tracked. Nix setup; nix develop -c frappe-shots --update; the diff images are uploaded. If git status --porcelain docs/screenshots is non-empty: git add -A -- docs/screenshots, and the binary patch of docs/screenshots without renames is uploaded, with the commit it ran on. This job runs the app: no write token, and no secret but the read ones.
                      shots-push (shots changed something; ubuntu-latest)contents: write, pull-requests: write, actions: writeRuns no app code. Checks out the integration branch with its history and switches to the commit shots ran on only when it is a full SHA that is an ancestor of that head, downloads the patch and checks it as relock-push does (§4.5), with docs/screenshots/<name>-<theme>.webp and docs/screenshots/manifest.json the only paths; git apply --index. Then commits docs: refresh screenshots on branch standards/screenshots, force-pushes to the token remote (§4.1), opens or updates a PR labelled screenshots, and dispatches ci.yml and pr-policy.yml. With an App (§4.1) its token, minted in this job alone, does the push, the label and the PR, and the dispatch is skipped. Auto-merged only with inputs.auto-merge (the caller passes it when dependabot.auto-merge-policy is "all", with auto-merge and the dependabot module on, S44): frappe-nix-tools is installed from the integration branch's lock, hash-locked, before the token is minted, and frappe-nix ci enable-automerge runs under the §4.5 safety rule from the integration branch's head. The job summary links the diff images artifact.
                      links (inputs.run-links)contents: readInstall frappe-nix-tools; frappe-nix listing check --links-only (both URLs must return 200 over https). When icons is on, with Nix set up, also nix run --no-pure-eval .#frappe-icon -- check for the raster checks, so resvg comes from the app's locked frappe-nix, not the registry nixpkgs.
                      duplication (inputs.run-duplication)contents: readuv run --frozen --project tools prek run --hook-stage manual check_code_duplication --all-files. The check_code_duplication hook is in the managed test_utils block with stages: [manual] (§2.14). It runs jscpd through npx, needs the network, and is informational: continue-on-error: true.
                      driftcontents: read, issues: writeInstalls the latest frappe-nix release's frappe-nix-tools and runs FRAPPE_NIX_ALLOW_SKEW=1 frappe-nix sync --check --format json. If the pinned frappe-nix is older than the latest release, it opens or updates the issue "frappe-nix vX.Y.Z available" with the drift summary and the command frappe-nix repo rollout --to vX.Y.Z --repo <repo>, and closes it when current. For an org profile it also compares the locked standards-profile rev with the head of the ref profile names (git ls-remote), and keeps a second issue "standards profile update available" with frappe-nix repo rollout --profile-to latest --repo <repo>. These issues are the reminders for the manual mover (S5, S38).
                      registry-refreshcontents: readRuns only if inputs.publish. The step maps REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} into env: and exits 0 with a notice when it is empty; otherwise GH_TOKEN="$REGISTRY_TOKEN" frappe-nix listing registry --refresh, which rebuilds the open registry PR branch on the current upstream main, because registry CI requires it to be up to date.

                      The nightly script (N4, py/frappe_nix_tools/frappe_nix_tools/data/ci/nightly.sh):

                      set -uo pipefail
                      rc=0
                      export FRAPPE_ADMIN_PASSWORD="${FRAPPE_NIX_TEST_ADMIN_PASSWORD:-admin}"
                      export FRAPPE_NIX_ARTIFACT_DIR="$PWD/.dev-dist/nightly"; mkdir -p "$FRAPPE_NIX_ARTIFACT_DIR"
                      frappe-test --ci --keep-up || rc=$?
                      bench build || rc=1
                      port="$(jq .webserver_port "$FRAPPE_BENCH_ROOT/sites/common_site_config.json")"
                      export FRAPPE_SITE_URL="http://127.0.0.1:${port}"
                      export CF_SITE_URL="$FRAPPE_SITE_URL" CF_SHOT_DIR="$FRAPPE_NIX_ARTIFACT_DIR"   # the names carbon's suites read
                      while IFS= read -r s; do
                        bash -c "$s" || rc=1
                      done < <(frappe-nix config nightly-suites)
                      frappe-test --down
                      exit "$rc"

                      frappe-nix config <key> (N3a) prints a resolved configuration value (§8.4), one list item per line.

                      4.7 Caller files (rendered into each app; whole; N4)

                      Every caller file has the YAML header and permissions: {}. <fn> is <frappe_nix.owner>/<frappe_nix.name> (Avunu/frappe-nix unless the app locks a fork, §2.5), <rev> is frappe_nix.rev, <v> is frappe_nix.version, <int> is branches.integration and <rel> is branches.release (empty under main+tags). Each file and each job exists only as §4's table says.

                      .github/workflows/ci.yml (module ci). One caller job per enabled gate (S39); shown with all four:

                      name: ci
                      on:
                        push:
                          branches: [<int>]
                        pull_request:
                      {% if cfg.ci.schedules.ci %}
                        schedule:
                          - cron: "<ci.schedules.ci>"   # "0 6 * * *": integration branch, daily: GITHUB_TOKEN auto-merges raise no push
                      {% endif %}
                        workflow_dispatch:
                      permissions: {}
                      concurrency:
                        group: ci-${{ github.event.pull_request.number || github.ref }}
                        cancel-in-progress: ${{ github.event_name == 'pull_request' }}
                      jobs:
                      {% if "lint" in gates %}
                        lint:
                          name: ci
                          permissions:
                            contents: read
                            pull-requests: read
                          uses: <fn>/.github/workflows/app-lint.yml@<rev> # v<v>
                          with:
                            app: <app>
                            integration-branch: <int>
                      {% if cfg.ci["runs-on"] is defined %}
                            runs-on: '<ci.runs-on as compact JSON>'   # e.g. '["self-hosted","nixos"]'
                      {% endif %}
                          secrets:
                            FETCH_TOKEN: ${{ secrets.FRAPPE_NIX_FETCH_TOKEN }}
                      {% endif %}
                      {% if "typecheck" in gates %}
                        typecheck:
                          name: ci
                          permissions:
                            contents: read
                            pull-requests: read
                          uses: <fn>/.github/workflows/app-typecheck.yml@<rev> # v<v>
                          with:
                            app: <app>
                            integration-branch: <int>
                      {% if cfg.ci["runs-on"] is defined %}
                            runs-on: '<ci.runs-on as compact JSON>'   # e.g. '["self-hosted","nixos"]'
                      {% endif %}
                          secrets:
                            FETCH_TOKEN: ${{ secrets.FRAPPE_NIX_FETCH_TOKEN }}
                      {% endif %}
                      {% if "test" in gates %}
                        test:
                          name: ci
                          permissions:
                            contents: read
                            pull-requests: write
                          uses: <fn>/.github/workflows/app-test.yml@<rev> # v<v>
                          with:
                            app: <app>
                            integration-branch: <int>
                      {% if cfg.ci["runs-on"] is defined %}
                            runs-on: '<ci.runs-on as compact JSON>'   # e.g. '["self-hosted","nixos"]'
                      {% endif %}
                            nix-cache: ${{ vars.FRAPPE_NIX_CACHE || '' }}
                            test-timeout-minutes: <ci.test-timeout-minutes>
                          secrets:
                            NIX_CACHE_TOKEN: ${{ secrets.FRAPPE_NIX_CACHE_TOKEN }}
                            NIX_CACHE_READ_TOKEN: ${{ secrets.FRAPPE_NIX_CACHE_READ_TOKEN }}
                            FETCH_TOKEN: ${{ secrets.FRAPPE_NIX_FETCH_TOKEN }}
                      {% endif %}
                      {% if "marketplace" in gates %}
                        marketplace:
                          name: ci
                          permissions:
                            contents: read
                            pull-requests: read
                          uses: <fn>/.github/workflows/app-marketplace.yml@<rev> # v<v>
                          with:
                            app: <app>
                            integration-branch: <int>
                      {% if cfg.ci["runs-on"] is defined %}
                            runs-on: '<ci.runs-on as compact JSON>'   # e.g. '["self-hosted","nixos"]'
                      {% endif %}
                          secrets:
                            FETCH_TOKEN: ${{ secrets.FRAPPE_NIX_FETCH_TOKEN }}
                      {% endif %}

                      .github/workflows/pr-policy.yml (modules ci and commits):

                      name: pr-policy
                      on:
                        pull_request:
                          types: [opened, edited, synchronize, reopened]
                        workflow_dispatch:
                      permissions: {}
                      concurrency:
                        group: pr-policy-${{ github.event.pull_request.number || github.ref }}
                        cancel-in-progress: true
                      jobs:
                        ci:
                          permissions:
                            contents: read
                            pull-requests: read
                          uses: <fn>/.github/workflows/app-pr-policy.yml@<rev> # v<v>
                          with:
                            app: <app>
                            integration-branch: <int>
                      {% if cfg.ci["runs-on"] is defined %}
                            runs-on: '<ci.runs-on as compact JSON>'   # e.g. '["self-hosted","nixos"]'
                      {% endif %}
                          secrets:
                            FETCH_TOKEN: ${{ secrets.FRAPPE_NIX_FETCH_TOKEN }}

                      .github/workflows/release.yml (modules ci and releases):

                      name: release
                      on:
                        push:
                          branches: [<int>]
                      {% if cfg.ci.schedules.release %}
                        schedule:
                          - cron: "<ci.schedules.release>"   # "30 5 * * *": auto-merged commits raise no push
                      {% endif %}
                        workflow_dispatch:
                      permissions: {}
                      concurrency:
                        group: release
                        cancel-in-progress: false
                      jobs:
                        release:
                          permissions:
                            contents: write
                            pull-requests: write
                            actions: write
                            checks: read
                          uses: <fn>/.github/workflows/app-release.yml@<rev> # v<v>
                          with:
                            app: <app>
                            integration-branch: <int>
                      {% if cfg.ci["runs-on"] is defined %}
                            runs-on: '<ci.runs-on as compact JSON>'   # e.g. '["self-hosted","nixos"]'
                      {% endif %}
                            release-branch: <rel>                 # "" under main+tags
                      {% if cfg.listing.publish %}
                            publish: ${{ vars.MARKETPLACE_PUBLISH == 'true' }}
                            registry-fork: <listing.registry-fork>
                      {% endif %}
                            pilot-assets: <pilot-assets.enable>
                      {% if <fn> is not Avunu/frappe-nix %}
                            frappe-nix-repo: <fn>                 # a fork: where the jobs that can hold the App's key install frappe-nix-tools from
                      {% endif %}
                          secrets:
                      {% if cfg.listing.publish %}
                            REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
                      {% endif %}
                            FETCH_TOKEN: ${{ secrets.FRAPPE_NIX_FETCH_TOKEN }}
                      {% if cfg.ci["github-app"] is defined %}
                            APP_ID: ${{ vars.<ci.github-app.app-id> || secrets.<ci.github-app.app-id> }}
                            APP_PRIVATE_KEY: ${{ secrets.<ci.github-app.private-key> }}
                      {% endif %}

                      .github/workflows/deps.yml (modules ci and dependabot):

                      name: deps
                      on:
                        pull_request:
                      {% if cfg.dependabot["update-branches"] %}
                        push:
                          branches: [<int>]                      # update-branches after each push
                      {% endif %}
                      {% if cfg.ci.schedules["deps-sweep"] or cfg.ci.schedules["deps-relock"] %}
                        schedule:
                      {% if cfg.ci.schedules["deps-sweep"] %}
                          - cron: "<ci.schedules.deps-sweep>"    # "0 9 * * *": re-dispatch CI for bot PRs
                      {% endif %}
                      {% if cfg.ci.schedules["deps-relock"] %}
                          - cron: "<ci.schedules.deps-relock>"   # "0 8 * * 1": python relock; passed as relock-cron below
                      {% endif %}
                      {% endif %}
                        workflow_dispatch:
                      permissions: {}
                      jobs:
                        deps:
                          permissions:
                            contents: write
                            pull-requests: write
                            actions: write
                            checks: read
                          uses: <fn>/.github/workflows/app-deps.yml@<rev> # v<v>
                          with:
                            app: <app>
                            integration-branch: <int>
                      {% if cfg.ci["runs-on"] is defined %}
                            runs-on: '<ci.runs-on as compact JSON>'   # e.g. '["self-hosted","nixos"]'
                      {% endif %}
                            nix-cache: ${{ vars.FRAPPE_NIX_CACHE || '' }}
                            auto-merge: <dependabot.auto-merge>
                      {% if cfg.dependabot["auto-merge"] and cfg.dependabot["auto-merge-policy"] != "decision-table" %}
                            auto-merge-policy: <dependabot.auto-merge-policy>
                      {% endif %}
                      {% if cfg.dependabot["update-branches"] %}
                            update-branches: true
                      {% endif %}
                            merge-method: <repo-policy.merge-methods[0]>
                            relock-cron: "<ci.schedules.deps-relock>"
                      {% if <fn> is not Avunu/frappe-nix %}
                            frappe-nix-repo: <fn>                 # a fork: where the jobs that can hold the App's key install frappe-nix-tools from
                      {% endif %}
                          secrets:
                            NIX_CACHE_TOKEN: ${{ secrets.FRAPPE_NIX_CACHE_TOKEN }}
                            NIX_CACHE_READ_TOKEN: ${{ secrets.FRAPPE_NIX_CACHE_READ_TOKEN }}
                            FETCH_TOKEN: ${{ secrets.FRAPPE_NIX_FETCH_TOKEN }}
                      {% if cfg.ci["github-app"] is defined %}
                            APP_ID: ${{ vars.<ci.github-app.app-id> || secrets.<ci.github-app.app-id> }}
                            APP_PRIVATE_KEY: ${{ secrets.<ci.github-app.private-key> }}
                      {% endif %}

                      .github/workflows/nightly.yml (module ci with ci.nightly):

                      name: nightly
                      on:
                        schedule:
                          - cron: "<ci.schedules.nightly>"   # "0 7 * * *"
                        workflow_dispatch:
                      permissions: {}
                      concurrency:
                        group: nightly
                        cancel-in-progress: false
                      jobs:
                        nightly:
                          permissions:
                            contents: write
                            pull-requests: write
                            actions: write
                            issues: write
                          uses: <fn>/.github/workflows/app-nightly.yml@<rev> # v<v>
                          with:
                            app: <app>
                            integration-branch: <int>
                      {% if cfg.ci["runs-on"] is defined %}
                            runs-on: '<ci.runs-on as compact JSON>'   # e.g. '["self-hosted","nixos"]'
                      {% endif %}
                            nix-cache: ${{ vars.FRAPPE_NIX_CACHE || '' }}
                            run-integration: <modules.tests>
                            run-shots: <modules.screenshots>
                            run-links: <modules.listing>
                            run-duplication: <test-utils on with check_code_duplication>
                      {% if modules.screenshots and modules.dependabot and cfg.dependabot["auto-merge"] and cfg.dependabot["auto-merge-policy"] == "all" %}
                            auto-merge: true
                            merge-method: <repo-policy.merge-methods[0]>
                      {% endif %}
                      {% if cfg.listing.publish %}
                            publish: ${{ vars.MARKETPLACE_PUBLISH == 'true' }}
                      {% endif %}
                      {% if <fn> is not Avunu/frappe-nix %}
                            frappe-nix-repo: <fn>                 # a fork: where the jobs that can hold the App's key install frappe-nix-tools from
                      {% endif %}
                          secrets:
                            NIX_CACHE_TOKEN: ${{ secrets.FRAPPE_NIX_CACHE_TOKEN }}
                            NIX_CACHE_READ_TOKEN: ${{ secrets.FRAPPE_NIX_CACHE_READ_TOKEN }}
                            FETCH_TOKEN: ${{ secrets.FRAPPE_NIX_FETCH_TOKEN }}
                      {% if cfg.ci["github-app"] is defined and modules.screenshots %}
                            APP_ID: ${{ vars.<ci.github-app.app-id> || secrets.<ci.github-app.app-id> }}
                            APP_PRIVATE_KEY: ${{ secrets.<ci.github-app.private-key> }}
                      {% endif %}
                      {% if cfg.listing.publish %}
                            REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
                      {% endif %}

                      .github/workflows/assets.yml (module pilot-assets). The pilot SHA is a floor and is moved by dependabot. Under develop+version it runs on the release branch; under main+tags the release workflow dispatches it on the tag.

                      name: assets
                      on:
                        workflow_dispatch:
                      permissions: {}
                      jobs:
                        assets:
                          if: {% if branches.release %}startsWith(github.ref, 'refs/heads/version-'){% else %}startsWith(github.ref, 'refs/tags/v'){% endif %}
                          permissions:
                            contents: write
                          uses: frappe/pilot/.github/workflows/app-assets.yml@e2364936eb0a4f89a5309d22fb198056f14ff86a # develop
                      • zizmor MUST pass on every rendered caller, in every combination of enabled gates the N4 fixture matrix renders (§7), and on frappe-nix's own app-*.yml, with the shipped zizmor.yml. If zizmor's excessive-permissions audit flags a caller job's union of permissions, N4 adds a narrowly scoped rules.excessive-permissions.ignore for ci.yml, release.yml, deps.yml and nightly.yml to the template, with a comment that reusable callers must grant the union.

                      • A docs tool's own workflows (a docs site's docs.yml and docs-publish.yml, or the docs.yml that calls a shared check) stay as that tool renders them.

                      • Schedules are parameters (ci.schedules, §8.2): ci ("0 6 * * *"), release ("30 5 * * *"), deps-sweep ("0 9 * * *"), deps-relock ("0 8 * * 1") and nightly ("0 7 * * *"), each a cron string or "" for none. The defaults suit a public repo (unlimited Actions minutes). A private repo that pays for minutes turns off what it doesn't need. The ci and release crons exist because a GITHUB_TOKEN auto-merge raises no push (one enabled with the App of ci.github-app does): with them off and auto-merge on, the integration branch's CI status and the release PR catch up only on the next human push, and repo doctor says so. deps-sweep is the fallback for dispatches Dependabot runs can't make (§4.5). In the Avunu fleet (plan §7 decision 2), a private repo (timeclock today) is made public before its PR A, which its fleet.json entry (private: true) enforces (§5.6).

                      • ci.yml doesn't run on version-*: that branch only moves by the release workflow's PATCH, which raises no event (§4.2).

                      4.8 Rulesets (repo-policy/rulesets/*.json, N4)

                      Module repo-policy (off in recommended, S40). Nothing here touches a repository unless someone with admin runs frappe-nix repo apply (§5.6) for an app whose resolved configuration has repo-policy.enable = true. Profile values: repo-policy.required-approvals, repo-policy.require-code-owner-review, repo-policy.required-checks, repo-policy.release-bypass, repo-policy.merge-methods, repo-policy.require-thread-resolution, releases.branching, releases.tag-prefix. The files are JSON with {placeholders} that repo apply fills from the app's resolved configuration; an org profile MAY override them (overridable, §8.1).

                      integration.json (1.1's develop.json):

                      {
                        "name": "{integration_branch}",
                        "target": "branch",
                        "enforcement": "active",
                        "conditions": { "ref_name": { "include": ["refs/heads/{integration_branch}"], "exclude": [] } },
                        "bypass_actors": [],
                        "rules": [
                          { "type": "deletion" },
                          { "type": "non_fast_forward" },
                          { "type": "pull_request", "parameters": {
                              "allowed_merge_methods": "{merge_methods}",
                              "required_approving_review_count": "{required_approvals}",
                              "dismiss_stale_reviews_on_push": false,
                              "require_code_owner_review": "{require_code_owner_review}",
                              "require_last_push_approval": false,
                              "required_review_thread_resolution": "{require_thread_resolution}" } },
                          { "type": "required_status_checks", "parameters": {
                              "strict_required_status_checks_policy": false,
                              "do_not_enforce_on_create": false,
                              "required_status_checks": "{required_checks}" } }
                        ]
                      }
                      • {required_checks} is one {"context": "ci / <gate>", "integration_id": 15368} per gate, in the order pr-policy, lint, typecheck, test, marketplace. With repo-policy.required-checks = "gates" (both built-in profiles) the gates are exactly the app's enabled gates (§2.3), so a disabled gate is never required and an enabled one always is. An explicit list of gate names is allowed and MUST be a subset of gates (exit 2 otherwise). With no gates (ci off), the required_status_checks rule is omitted.

                      • {required_approvals} is repo-policy.required-approvals (recommended: 1; Avunu profile: 0, because its PRs are merged by the main agent or auto-merge after checks). With a value above 0, Dependabot auto-merge (§4.5) waits for an approval like any other PR.

                      • {merge_methods} is repo-policy.merge-methods (["squash"] in both built-in profiles; any of squash, merge, rebase), and {require_thread_resolution} is repo-policy.require-thread-resolution (true). Squash stays the default because S11's Release-As footer and the managed auto-merge (--<first method>) assume a single commit per PR; with another first method, frappe-major adoption sets the footer on the merge commit instead.

                      • integration-provisional.json is the same without the required_status_checks rule, and with the same name, so the full ruleset later replaces it in place.

                      release-branch.json (1.1's version.json; applied only under develop+version):

                      {
                        "name": "version-* (release automation only)",
                        "target": "branch",
                        "enforcement": "active",
                        "conditions": { "ref_name": { "include": ["refs/heads/version-*"], "exclude": [] } },
                        "bypass_actors": [ { "actor_type": "Integration", "actor_id": 15368, "bypass_mode": "always" } ],
                        "rules": [
                          { "type": "creation" },
                          { "type": "update", "parameters": { "update_allows_fetch_and_merge": false } },
                          { "type": "deletion" },
                          { "type": "non_fast_forward" }
                        ]
                      }

                      tags.json:

                      {
                        "name": "{tag_prefix}* tags",
                        "target": "tag",
                        "enforcement": "active",
                        "conditions": { "ref_name": { "include": ["refs/tags/{tag_prefix}*"], "exclude": [] } },
                        "bypass_actors": [],
                        "rules": [
                          { "type": "deletion" },
                          { "type": "update", "parameters": { "update_allows_fetch_and_merge": false } },
                          { "type": "non_fast_forward" }
                        ]
                      }

                      Creating tags isn't restricted, because release-please creates them through the Releases API with GITHUB_TOKEN. {tag_prefix} is releases.tag-prefix ("v"); with "" the pattern is refs/tags/[0-9]*. assets-version-16 matches neither.

                      repo-policy.release-bypass selects the bypass_actors of release-branch.json: "github-actions" (the above, both built-in profiles) or "user:<id>". If the API rejects Integration 15368 with a 422, frappe-nix repo apply stops for that repo and prints the two fallbacks, in order:

                      1. "user:<id>": bypass_actors: [{"actor_type": "User", "actor_id": <machine user id>, "bypass_mode": "always"}] (the User bypass actor type, GA 2026-05-07, github-capabilities track). The fast-forward step then uses that machine user's token (VERSION_BRANCH_TOKEN) instead of GITHUB_TOKEN.

                      2. A DeployKey bypass, through an org template override of release-branch.json. Unusable in the Avunu org today: it has deploy keys disabled (deploy_keys_enabled_for_repositories: false), and only an org owner can enable them.

                      Both need the user (Q2).

                      4.9 Repo settings (repo-policy/repo-settings.json, N4) and the fleet list

                      {
                        "repository": {
                          "default_branch": "{integration_branch}",          // only with repo-policy.manage-default-branch
                          "allow_squash_merge": "{squash in merge_methods}",
                          "allow_merge_commit": "{merge in merge_methods}",
                          "allow_rebase_merge": "{rebase in merge_methods}",
                          "allow_auto_merge": true,
                          "allow_update_branch": true,
                          "delete_branch_on_merge": "{delete_branch_on_merge}",
                          "squash_merge_commit_title": "PR_TITLE",
                          "squash_merge_commit_message": "COMMIT_MESSAGES",
                          "has_wiki": false,                                   // these two only with repo-policy.manage-features
                          "has_projects": false,
                          "homepage": "{documentation}",
                          "security_and_analysis": {
                            "secret_scanning": { "status": "enabled" },
                            "secret_scanning_push_protection": { "status": "enabled" }
                          }
                        },
                        "actions_workflow_permissions": { "default_workflow_permissions": "read", "can_approve_pull_request_reviews": true },
                        "vulnerability_alerts": true,
                        "automated_security_fixes": true,
                        "labels": [
                          { "name": "dependencies", "color": "0366d6", "description": "Dependency updates" },
                          { "name": "needs-review", "color": "d93f0b", "description": "Not merged automatically; a person reviews it" },
                          { "name": "screenshots",  "color": "c5def5", "description": "Screenshot refresh from nightly" }
                        ]
                      }
                      • {documentation} is the listing's documentation URL when listing is on, else the fleet entry's documentation, else the field is left unchanged.

                      • security_and_analysis follows repo-policy.secret-scanning (true in both built-in profiles); labels lists only the labels of enabled modules (screenshots needs screenshots; the other two need dependabot).

                      • can_approve_pull_request_reviews: true is required so GITHUB_TOKEN can open PRs (release-please, relock-upgrade, shots). With ci.github-app the App opens them instead and this setting is no longer needed for them; the App must be installed on the repository, and its ID and private key readable by Actions (and, for deps.yml, by Dependabot).

                      • The keys marked in comments are parameters (§8.2), with the values shown as their defaults: repo-policy.merge-methods, repo-policy.delete-branch-on-merge (true), repo-policy.manage-default-branch (true; false leaves default_branch alone) and repo-policy.manage-features (true; false leaves has_wiki and has_projects alone). The comments are not part of the JSON file.

                      • Without repo-policy, nobody applies these settings. frappe-nix repo doctor (§5.6) reports which of them the enabled modules need.

                      The fleet list is not part of frappe-nix (S40). frappe-nix repo apply|audit|rollout --all read it from --fleet <file>, a local path (the Avunu fleet's is fleet.json in a checkout of P); without --fleet, --all is exit 2. Its schema (frappe_nix_tools/data/schema/fleet.schema.json, N4):

                      { "schema": 1, "profile": "github:<owner>/<profile repo>/v1", "apps": [
                        { "repo": "<owner>/<repo>", "app": "<app>", "target_app": "<app after a rename>", "private": false, "list": true,
                          "documentation": "https://…", "rename_mode": "rename", "profile": "…", "integration_branch": "…" }
                      ] }

                      The top-level profile (and an entry's own profile, which wins) is the profile repo apply resolves for a repository that has no [tool.frappe-nix] yet (§5.6); integration_branch overrides the branch that profile implies for it.

                      target_app is the post-rename package name, and a repo rename updates repo. rename_mode is "rename" (the default, frappe-rename-app) or "replace" (Avunu fleet: jailbreak → data_steward, §5.10). private gates frappe-nix repo apply --phase full (§5.6). The Avunu fleet's file is Avunu/frappe-standards-profile/fleet.json, with one entry per app for all 12 apps, for example:

                      { "repo": "Avunu/carbon_frappe", "app": "carbon_frappe", "target_app": "carbon_theme", "private": false, "list": true,
                        "documentation": "https://docs.avunu.net/carbon-theme/" }

                      4.10 frappe-nix's own settings (N6)

                      • repo-policy/self/repo-settings.json is the same as §4.9, except default_branch: "main" and no labels.

                      • repo-policy/self/rulesets/main.json is the integration ruleset with the ref refs/heads/main, 0 required approvals, and the required contexts lint and flake (frappe-nix's own check.yml jobs) and pr-policy. None is a reusable-workflow job, so the names are bare.

                      • pr-policy lives in its own .github/workflows/pr-policy.yml (N6), not in check.yml, for the reason S4 gives: it runs on pull_request types opened, edited, synchronize and reopened, plus workflow_dispatch, and re-running check.yml on every retitle would rebuild flake. Its one job is named pr-policy and isn't reusable. It installs frappe-nix-tools from the checkout (uv tool install ./py/frappe_nix_tools), because frappe-nix's own flake.lock has no frappe-nix node, and runs frappe-nix policy --pr --major-free (no Release-As major rule; frappe-nix has its own semver, §6.3).

                      • check.yml gains a boolean workflow_dispatch input vm-tests (default false), and its vm-tests job runs only when inputs.vm-tests == true. frappe-nix's release flow dispatches check.yml on its release PR without it, so a release dispatch never starts the NixOS VM tests, which a hosted runner can't carry.

                      • repo-policy/self/rulesets/release.json is release-branch.json with the ref refs/heads/release.

                      • release.yml uses the org's GitHub App when the repository can read it, from the org variable and secret the org profile's ci.github-app names (frappe-nix's own workflows other than app-*.yml and fleet-audit.yml are outside S37's scan, so they may name them): release-please and fixture mint its token (§4.1 "A GitHub App") and open, update and push to the release PR with it, which then starts check.yml, pr-policy.yml and docs.yml by itself, and dispatch-ci runs only without it (needs.release-please.outputs.app != 'true').

                      • repo-policy/self/rulesets/tags.json is tags.json.

                      • dependabot-auto-merge.yml is S44's all and update-branches for frappe-nix itself, through python-devops-nix's reusable dependabot-auto-merge.yml and dependabot-update-branches.yml (python-devops-nix docs/conventions.md, CI), pinned at e76d5d8 (python-devops-nix#72): every nix, uv and pre-commit Dependabot PR gets auto-merge (squash) at the head it was decided on. Every other one, github-actions above all, is held by its hold job (auto-merge off, labelled needs-review, GITHUB_TOKEN only): an action or reusable-workflow pin here runs in jobs that hold the App's key, in this repository's release.yml and, once a release carries it, in every app's app-*.yml. The ecosystem is read from Dependabot's branch name (dependabot/<ecosystem>/…), and a name the list lacks is held. The call passes exclude-ecosystems: github_actions and, under review-dependencies, every action a key job runs (and Avunu/python-devops-nix), so the reusable workflow's diff job also holds a PR the branch name lets through whose diff changes a workflow or action file or one of those references. The org's App (AVUNU_CI_APP_ID, AVUNU_CI_PRIVATE_KEY, passed as APP_ID and APP_PRIVATE_KEY) enables the auto-merge and updates the branches, so a merge raises a push. At that pin every job of both reusable workflows runs on ubuntu-latest, and the job that mints the token checks nothing out, runs only create-github-app-token and gh, and runs only when policy (fetch-metadata) and diff (the PR's diff, read with gh alone), which hold no key, both say merge (§4.1, "Runner"). standards-ci-workflows refuses the key to a reusable workflow at any pin it does not name as hosted (0c9a3a0, which ran them on the shared ["self-hosted","nixos"] runners, among them). Without the App, GITHUB_TOKEN: the merge raises no push, and release.yml's daily cron catches up. Its update-branches job runs on pushes to main and daily and brings each Dependabot PR that is behind main up to date; without the App it dispatches check.yml, docs.yml and pr-policy.yml on each updated head.

                      The selftest workflows are not required checks, because they are path-filtered and expensive.


                      5. Tool CLIs

                      Every Nix-side tool is reachable in two ways:

                      • as a dev-shell command in app mode (lib/scripts.d/*.nix or lib/standards/shell.nix);

                      • as a flake app (nix run github:Avunu/frappe-nix#<tool>, or .#<tool> in an app, through lib/standards/outputs.nix).

                      The Python-side commands are frappe-nix <cmd> (one console script, S33). The Nix wrappers are frappe-nix itself (with git and gh on PATH, which the repo group needs), frappe-listing (= frappe-nix listing) and frappe-icon (= frappe-nix icon, with resvg on PATH). The 1.1 stand-alone apply, audit and rollout wrappers are the subcommands frappe-nix repo apply|audit|rollout.

                      Org values (S37). Every tool below that needs an organisation value reads it from the app's resolved configuration (org.* and module parameters, §8.4), never from a constant. Where a tool needs one that is empty, it exits 2 naming the key (for example org.brand.tile-color is empty; set it in your profile or [tool.frappe-nix.org.brand]). A tool's own module must be on for it to run in CI; run by hand on an app with the module off, it prints a notice and exits 0, except frappe-test, which always runs the stages it is asked for.

                      5.1 frappe-test (N1)

                      frappe-test [--app APP] [--site SITE] [--reuse-site] [--keep-up | --down] [--ci]
                                  [--module M] [--doctype DT] [--test T]
                                  [--no-coverage] [--no-testmap] [--no-composition] [--ty] [--nix-lint] [--shell-checks]
                                  [--junit PATH] [--out DIR]

                      Environment. The dev shell provides FRAPPE_BENCH_ROOT, FRAPPE_SITE, DEVENV_ROOT (the repo root) and PC_SOCKET_PATH. The script also reads:

                      • FRAPPE_NIX_CI;

                      • GITHUB_STEP_SUMMARY;

                      • FRAPPE_NIX_TEST_ADMIN_PASSWORD (default admin; FRAPPE_TEST_ADMIN_PASSWORD, its name before, was read with a warning through 1.x and is not read since 2.0.0).

                      Defaults.

                      OptionDefault
                      --appfrappe-nix.app.name
                      --site$FRAPPE_SITE
                      --out$DEVENV_ROOT/.dev-dist/test

                      --ci turns on, from the resolved configuration, exactly the stages whose modules are on: stages 3–4 (tests, coverage only with tests.coverage.enable), 5 (tests.testmap), 6 (tests.composition), 7 (python-types, as --ty), 8 (nix-lint, as --nix-lint) and 8b (--shell-checks, when shell-checks is non-empty), plus --junit $OUT/junit.xml, the step summary and frappe-test-report.json. With tests off it skips stages 1–6 entirely (no bench is started) and runs only 7, 8 and 8b. A skipped stage is "skipped" in the report. frappe-test itself is a dev-shell command for every app-mode user; in an app without [tool.frappe-nix] it reads no configuration and --ci uses the recommended values (stage 7 only when tools/pyproject.toml exists, Appendix I).

                      Stages. frappe-test runs these in order. Every stage after 3 runs even when an earlier one failed.

                      1. Up.

                        • If no process-compose is listening on $PC_SOCKET_PATH: DEVENV_IN_DIRENV_SHELL=true PC_TUI_ENABLED=0 devenv up -D, with a trap that runs process-compose -U -u "$PC_SOCKET_PATH" down unless --keep-up is given.

                        • Wait at most 300 s (FRAPPE_NIX_UP_TIMEOUT seconds when set) for mariadb-admin --socket "$FRAPPE_DB_SOCKET" ping, then for an HTTP answer on 127.0.0.1:$(jq .webserver_port sites/common_site_config.json).

                        • Failure → exit 10.

                      2. Site.

                        • When sites/assets/assets.json is missing, the compiled assets first, because frappe reads that registry for every island check and every boot:

                          • in CI mode (FRAPPE_NIX_CI), with the shell's FRAPPE_NIX_PINNED_ASSETS_DRV set (app mode): nix-store --realise it (a builtBench of every app but the one under test, rooted at <bench>/.frappe-nix-pinned-assets), copy each of its apps' trees and the files of its sites/assets into the bench, run the FRAPPE_NIX_APP_NODE_MODULES_DRV linker on the bench (the app under test's node_modules from the store, where it has none), then bench build --app A past the dev shell's wrapper (_FRAPPE_BENCH_RAW=1, so no yarn install; YARN_IGNORE_SCRIPTS=true when FRAPPE_NIX_YARN_IGNORE_SCRIPTS is set);

                          • otherwise, or when that derivation cannot be realized: bench-build.

                        • Unless --reuse-site is given and the site exists: printf '\n' | bench provision "$ADMIN_PW".

                        • Then bench --site S set-config allow_tests true.

                        • Then each [tool.frappe-nix.tests].setup step, or the default (§2.1):

                          • module:X → bench --site S run-tests --module X, with no coverage;

                          • execute:X → bench --site S execute X.

                        • Failure → exit 10.

                      3. Tests with coverage. --no-coverage drops the coverage run wrapper. From $FRAPPE_BENCH_ROOT/sites:

                        "$FRAPPE_BENCH_ROOT/env/bin/python" -m coverage run \
                            --rcfile="$DEVENV_ROOT/pyproject.toml" --data-file="$OUT/.coverage" \
                            --source="$DEVENV_ROOT/$APP" \
                            -m frappe.utils.bench_helper frappe --site "$SITE" run-tests --app "$APP" \
                            [--module M] [--doctype DT] [--test T] [--junit-xml-output "$JUNIT"]

                        frappe's --coverage MUST NOT be passed (S17). Test failure → stage verdict 1.

                      4. Coverage gate.

                        • coverage json -o $OUT/coverage.json, coverage xml -o $OUT/coverage.xml, then coverage report. The report reads fail_under from [tool.coverage.report], and coverage's exit status 2 maps to stage verdict 2.

                        • A per-module table is written to the step summary.

                        • Upward ratchet (S24, plan decision 5). Let target be tests.coverage.target (80 in both built-in profiles) and margin be tests.coverage.raise-margin (2.0). If fail_under < target and total ≥ fail_under + margin, the stage fails with verdict 2 and the message coverage is <total>; raise [tool.coverage.report] fail_under to <min(target, floor(total) - 1)>. After that raise, total - fail_under < margin, so the rule settles. raise-margin = 0 turns the upward ratchet off. The PR that adds the tests carries the raise.

                        • The gate is skipped when any filter (--module, --doctype, --test) is given.

                        • Scoping. coverage stores real paths. --source is the repo's package dir, so .frappe-nix/bench/apps/*, which holds real directories under the repo root but outside <app>/, is never measured.

                        • Acceptance. No key of coverage.json files may contain /.frappe-nix/.

                      5. Testmap (§5.1.1) → verdict 3. Skipped with filters.

                      6. Composition (§5.1.2) → verdict 4.

                      7. ty (--ty). From the repo root: uv run --frozen --project tools ty check --python "$FRAPPE_BENCH_ROOT/env" --output-format concise. Records the diagnostic count and the ty: ignore count. → verdict 5.

                      8. nix-lint (--nix-lint). nixfmt --check flake.nix $(git ls-files 'nix/*.nix'), statix check . and deadnix --fail --exclude .frappe-nix .. The binaries are pinned through frappe-nix's nixpkgs, are in frappe-test's own runtimeInputs (so the stage works in any app-mode shell), and are added to an opted-in app's shell by N1 for interactive use. → verdict 6.

                        • 8b. Shell checks (--shell-checks). For each [tool.frappe-nix] shell-checks command, in order, from the repo root: run it (bash -c), then git status --porcelain must be empty, so a generator whose output is committed (timeclock's pydantic2ts generate-types, carbon's codegen) proves its output fresh. Each failure is listed with the diff. → verdict 7. Node-based checks here may need node_modules, which CI mode doesn't install; such a command installs them itself (yarn install --frozen-lockfile && …), or the check moves to ci:typecheck, which runs in the no-Nix typecheck job with node_modules and FRAPPE_PATH.

                      9. Report. Write $OUT/frappe-test-report.json (below) and $OUT/summary.md, and append the summary to $GITHUB_STEP_SUMMARY.

                      Exit status is the verdict of the first failing stage, in the order 1 (tests), 2, 3, 4, 5, 6, 7. It is 10 for an environment failure in stage 1 or 2, and 0 otherwise.

                      frappe-test-report.json:

                      { "schema": 1, "app": "carbon_frappe", "frappe_nix": {"rev": "…", "version": "1.0.0"}, "git_sha": "…",
                        "tests": {"ran": 39, "failures": 0, "errors": 0, "skipped": 0},
                        "coverage": {"percent": 63.2, "fail_under": 60.0, "modules": {"carbon_frappe/api.py": 81.0}},
                        "testmap": {"targets": 14, "untested": [], "exempt": 1, "stale_exemptions": []},
                        "composition": {"ok": true, "doctypes": {"ToDo": {"layers": ["…"], "app_first_ok": true}}},
                        "ty": {"diagnostics": 0, "ignores": 3}, "nix_lint": "ok", "exit": 0 }

                      --down stops a bench that --keep-up left running, and exits.

                      5.1.1 Testmap: the whitelist and hook coverage algorithm (N1, frappe-nix testmap; tests.testmap)

                      frappe-test invokes it with the bench interpreter, so the evaluated hooks are visible:

                      $FRAPPE_BENCH_ROOT/env/bin/python <store>/frappe_nix_tools/bench/testmap_probe.py --site S --app A \
                          --coverage-json $OUT/coverage.json --pyproject $DEVENV_ROOT/pyproject.toml --out $OUT/testmap.json

                      The probe runs frappe.init(site) and frappe.connect() (the site exists by stage 5), then hooks = frappe.get_hooks(app_name=A). Because the hooks are evaluated, conditional hooks are included. Connecting matters because some modules query the database when imported (timeclock's utilities.py calls frappe.get_all at module level). A target whose module fails to import is reported as untested, with the exception text in its error field; the probe itself never crashes on it.

                      Targets. Each target is a dotted path to a Python function or method:

                      • T1: every FunctionDef or AsyncFunctionDef under <app>/, excluding **/tests/**, **/test_*.py and **/patches/**, that is decorated with frappe.whitelist, frappe.whitelist(...), whitelist or whitelist(...) (where whitelist is imported from frappe). Methods are named module.Class.method.

                      • T2: every string in hooks["scheduler_events"], for all keys including cron, that starts with A..

                      • T3: every handler in hooks["doc_events"][*][*], string or list, that starts with A..

                      • T4: for each extend_doctype_class or override_doctype_class value that starts with A.: import the class, and take every function defined in its own __dict__. Dunders are skipped except __init__, and names starting with _ are skipped.

                      • T5: values of override_whitelisted_methods, permission_query_conditions and has_permission that start with A..

                      • T6: every string, or string in a list, that starts with A. under these callable-valued hooks: auth_hooks, before_request, after_request, on_session_creation, on_login, on_logout, boot_session, jinja.methods, jinja.filters, additional_timeline_content (every list in the dict), website_context values that are dotted callables or /api/method/A.… URLs (the path after /api/method/), after_install, after_sync, after_migrate, before_uninstall, before_tests. This covers jwt_auth's validate_auth, handle_redirects and on_logout, carbon's after_request injector, and esign's jinja and timeline methods. The install and migrate kinds (after_install, after_sync, after_migrate, before_uninstall) run before coverage starts, so a test must call them directly or they need a [[tool.frappe-nix.untested]] entry with a reason.

                      Body lines. Resolve each target, inspect.unwrap it, and call inspect.getsourcelines. The body lines are the executable lines after the def line, its decorators and its docstring, taken from coverage's analysis of that file (coverage.json files[realpath].executed_lines ∪ missing_lines).

                      Tested means at least one body line is in executed_lines.

                      Exemptions. A target listed in [[tool.frappe-nix.untested]] is exempt. An exemption whose target is now tested, or is no longer a target, is stale and counts as a failure: the list only shrinks.

                      Output. testmap.json holds {targets:[{path, kind, file, line, tested, exempt, error?}], untested:[…], stale_exemptions:[…]}, and a markdown table goes to the summary. The verdict is 3 when untested or stale_exemptions is non-empty.

                      5.1.2 Composition check (A.3; tests.composition)

                      <store>/frappe_nix_tools/bench/composition.py --site S --app A connects to the site. Then:

                      1. Collect every doctype that A names in extend_doctype_class or override_doctype_class, read from the merged hooks of all installed apps.

                      2. For each, after clearing frappe's controller cache (frappe.controllers = {} plus frappe.clear_cache()), call frappe.get_controller(dt). Assert that no TypeError is raised and that A's class is in __mro__.

                      3. Repeat with frappe.get_installed_apps monkeypatched to return the real order with A moved directly after frappe. This is the A.0 #4 failure mode.

                      The verdict is 4 on any failure, and the message names the doctype and the order.

                      5.2 frappe-listing (N5; frappe-nix listing)

                      Module listing (readme for the readme subcommand). Profile values: org.publisher, org.email, org.license (L2), org.website-url, org.docs-url (L12), listing.registry-fork, listing.registry-upstream, listing.getapp-check.

                      frappe-listing check    [--release --tag vX.Y.Z] [--links-only] [--no-getapp] [--format text|json|github]
                      frappe-listing registry [--tag vX.Y.Z | --ref SHA] [--branch <release or integration branch>] [--onboard] [--refresh]
                                              [--fork <listing.registry-fork>] [--upstream <listing.registry-upstream>] [--dry-run]
                      frappe-listing readme   --write | --check

                      Pins.

                      • The marketplace and pilot revisions are the app's flake.lock nodes reached as nodes[nodes["frappe-nix"].inputs.marketplace] and ….pilot. They come from frappe-nix's flake inputs (S20).

                      • In Nix they are store paths. In no-Nix CI, frappe-nix fetches each locked tree into .dev-dist/pins/<name>-<rev>/ and verifies it against the lock's narHash, using nix-hash semantics implemented in Python (frappe_nix_tools.common.nar). The fetch follows the lock node's type: github → https://codeload.github.com/<owner>/<repo>/tar.gz/<rev>; gitlab → https://<host>/api/v4/projects/<url-encoded path>/repository/archive.tar.gz?sha=<rev>; git → git clone --filter=blob:none of url and a checkout of rev. The same pin-path serves the marketplace and pilot pins, the app's frappe and siblings, and standards-profile.

                      • Authentication. When FRAPPE_NIX_FETCH_TOKEN is set (§4), the fetch sends it (Authorization: Bearer for codeload and the GitLab API, http.extraHeader for git), so a private org profile, frappe fork or sibling works. Without it, a 404 or 401 is exit 3 with the hint set FRAPPE_NIX_FETCH_TOKEN (Contents read on <repo>).

                      • If the hash doesn't match, exit 3.

                      check rules. These rules apply whatever listing.toml says, so they are the registry-readiness checks of every app with listing on, listed or not; publishing is the separate switch listing.publish. L1, L2, L8, L10 and L12 apply only when listing.toml exists.

                      IdRuleSeverity
                      L1listing.toml passes its schema (§2.21): the enums, the tagline at 40–80 characters with no trailing ., the title at ≤ 40 characters, a non-empty categories, and https URLserror
                      L2hooks.py, read by AST at top level, with any conditional assignments reported as warnings: app_name == <app>, app_title == title, app_description == tagline, app_publisher == org.publisher, app_email == org.email, app_license == org.license (each comparison only when that org value is set; otherwise the hook value MUST be non-empty, and app_license MUST equal package.json license). No app_logo_url. No app_icon == "octicon octicon-file-directory" and no app_color == "grey". add_to_apps_screen always present with its logo /assets/<app>/images/<app>-logo.svg, because that is where Frappe's About dialog reads it. With apps_screen, the route and has_permission come from [apps_screen_entry]. Without it, there is a route and has_permission is <app>.apps_screen.not_listed, a function <app>/apps_screen.py defines.error
                      L3[tool.bench.frappe-dependencies]: the keys are exactly {frappe} ∪ required_apps (bare); each value equals the sibling's resolved range (§2.1); each parses with packaging.SpecifierSet; for frappe and each sibling on the generic Frappe rule, the lower bound's major equals frappe-major (payments and object-form or known-apps siblings with their own range are exempt); frappe isn't in required_apps; [project.dependencies] names none of frappe, erpnext, hrms or paymentserror
                      L4The version block is in block form. __version__ = package.json = manifest. With --release: __version__ == tag.lstrip("v"), and the tag's commit is an ancestor of origin/<branch>error
                      L5__init__.py has no side effects (§2.13). No tracked symlink points outside the repo.error
                      L6Every override_doctype_class key in hooks has a [[tool.frappe-nix.override-doctype-class]] entry, and every entry has a hookerror
                      L7Registry semgrep. Import validation/semgrep_check.py from the pinned marketplace tree (SemgrepValidator(repo_root, app), run as registry CI runs it, with EIO_BACKEND=posix). Each blocking finding is keyed (rule, path, sha1(stripped first matched line)) (S21), and findings are counted per key. For every key, the number found must equal the baseline entry's count (absent = 0): more is a new finding, fewer means the count must be lowered (stale). Either is an error, so the baseline only shrinks. With --release, the baseline MUST be empty. Advisory findings go into the report only.error
                      L8Logo structure: frappe-nix icon check --structural (§5.3); only when icons is onerror
                      L9pilot get-app (when listing.getapp-check is on). Build a temporary validation bench with pilot.core.bench.Bench. Python is >=3.14,<3.15 from uv. apps/frappe and each dependency app are source trees at the app's flake.lock revisions, fetched like the pins; this mirrors marketplace#29. Install the app, and run every check in pilot.core.app.validator.validator._all_checks() individually, as scratchpad p0-registry-dryrun/scripts/run_sim.py does. Building frappe's mysqlclient needs the MySQL client headers and library on the host; the marketplace job installs them with pkg-config (§4.2), and in Nix the frappe-listing wrapper sets MYSQLCLIENT_CFLAGS/MYSQLCLIENT_LDFLAGS to nixpkgs' mariadb-connector-c (as defaults the caller can override). Every check must pass. --no-getapp skips this rule, for local use only.error
                      L10With --links-only or --release: website and documentation return 200 over https after redirects, using GET with a 20 s timeout and 2 retrieserror
                      L11With --release: every <owner>/<repo> entry in required_apps appears in the upstream apps.json on mainerror
                      L12website and documentation follow the profile's URL templates (§2.21); skipped when a template is emptywarning

                      check exit codes: 0 pass (warnings allowed); 1 any error; 2 a config or parse error in listing.toml or pyproject.toml; 3 an environment problem (network, a pin hash mismatch, the pilot bench couldn't be built).

                      The JSON report goes to .dev-dist/marketplace/report.json.

                      registry (needs listing.publish and a non-empty listing.registry-fork, else exit 2). The token is GH_TOKEN: in CI that is REGISTRY_TOKEN, and locally it is gh auth token (in the Avunu fleet, under plan decision 15, the user's own account). <fork-branch> below is <lowercased fork owner>/<app> (Avunu profile: avunu/<app>).

                      1. Resolve the commit to its full 40-character SHA, and check that it is reachable from origin/<branch>.

                      2. Run check --release --tag. Abort on failure.

                      3. Clone the upstream main shallowly into a temp dir, and create the branch <fork-branch> from it, so it is always up to date with main.

                      4. Collect the pending entries: the new entry, plus every entry in the fork branch's apps/<app>.json whose commit isn't in upstream's file.

                      5. For each pending entry, run the pinned tools/add_release.py, with APP, BRANCH, COMMIT and CHANNEL=stable set, --app-dir as a git worktree of that commit, and --registry as the clone.

                      6. With --onboard, or when the app isn't in upstream apps.json, append the index entry to apps.json and create apps/<app>.json with {"name": app, "releases": []} before step 5. The index entry is {name, title, description: tagline, repo: "https://github.com/<repo>", logo_url: "https://raw.githubusercontent.com/<repo>/<branch>/<app>/public/images/<app>-logo.svg", website, documentation, category, categories, stars: <registry.stars or 0>, releases: "apps/<app>.json"}. It keeps the file's existing indentation.

                      7. Commit with the message <app>: <version>, or <app>: onboard and <version>. Force-push to <fork>:<fork-branch>.

                      8. Run gh pr create --repo <upstream> --base main --head <fork-owner>:<fork-branch>, or gh pr edit when one is open. The title is <app>: <newest version>, and the body is generated: the pending versions, the local check summary, and the semgrep baseline state.

                      9. Print the PR URL. --refresh does steps 3–8 with no new entry, and only when the fork branch is behind upstream main. --dry-run stops before the push and prints the diff.

                      Exit codes: 0 PR opened or updated (or nothing to do); 1 the gate failed; 3 a git, gh or network error.

                      readme. It renders the §2.19 blocks from frappe_nix_tools/data/readme/*.md.j2. Its exit codes match sync's (0, 1 for drift, 2 for a missing marker).

                      5.3 frappe-icon (N5; frappe-nix icon, with resvg from nixpkgs)

                      Module icons (off in recommended). Profile values: org.brand.tile-color (required; exit 2 when empty) and org.brand.glyph-color (default #FFFFFF).

                      frappe-icon check [--structural] [--format …]     # --structural: no rasterisation (no-Nix CI)
                      frappe-icon tile                                   # <app>-symbolic.svg → <app>-logo.svg (deterministic)
                      frappe-icon build [--out .dev-dist/icons] [--write-fixture]

                      Inputs. <app>/public/images/<app>-symbolic.svg, and the generated, committed <app>-logo.svg.

                      Structural checks (pure Python, xml.etree plus a path-bbox parser):

                      • symbolic:

                        • viewBox="0 0 32 32";

                        • only <svg>, <g>, <path>, <circle>, <rect>, <ellipse>, <polygon>, <polyline> and <title>;

                        • no <text>, <image>, <style>, class, gradients, filters, masks or clip paths;

                        • every fill is currentColor or none;

                        • no stroke, so outlines must be converted to paths;

                        • the union bbox lies within [2, 30] on both axes (safe area).

                      • tile:

                        • viewBox="0 0 1024 1024";

                        • the first child is a <rect width=1024 height=1024 rx=ry=293> (28.6%, ±1) with fill="<org.brand.tile-color>";

                        • the glyph group is all <org.brand.glyph-color>, centred to within ±4 units;

                        • the glyph bbox's longer side is 573 (56%, ±12);

                        • it equals frappe-icon tile's output byte for byte (freshness).

                      Raster checks (resvg, Nix only). They run under frappe-icon check without --structural: in the dev shell, in selftest-product, and in the nightly links job through nix run --no-pure-eval .#frappe-icon -- check, so resvg is the one frappe-nix's locked nixpkgs provides. They are not part of a required check.

                      • At 16, 32 and 256 px, render the symbolic icon black on transparent.

                      • The alpha coverage at 16 and 32 px is within [0.10, 0.65].

                      • The number of 8-connected components at 32 px equals the number at 256 px, so no feature merges or disappears at the marketplace-card size.

                      Build outputs go to .dev-dist/icons/ and are not committed: logo-512.png, favicon-32.png and favicon-16.png. When app_type == "application" and --write-fixture is given, it writes <app>/desktop_icon/<app>.json (S22):

                      { "app": "<app>", "doctype": "Desktop Icon", "name": "<title>", "label": "<title>", "icon_type": "App",
                        "link_type": "External", "link": "<apps_screen_entry.route>", "logo_url": "/assets/<app>/images/<app>-logo.svg",
                        "hidden": 0, "standard": 1, "idx": 100, "roles": [], "docstatus": 0, "owner": "Administrator",
                        "modified_by": "Administrator", "creation": "<kept or first-write time>", "modified": "<kept unless content changed>" }

                      check compares the fixture ignoring creation and modified.

                      Exit codes: 0 pass; 1 a rule failed (each failure listed); 2 a file is missing or unparsable.

                      5.4 frappe-demo (N5; dev-shell script)

                      Module demo (off in recommended; screenshots needs it). Profile values: demo.company-name, demo.company-abbr, demo.country, demo.currency, demo.timezone, demo.language, demo.date, demo.seed, demo.erpnext-demo.

                      frappe-demo [--site S] [--fresh] [--erpnext-demo | --no-erpnext-demo] [--date YYYY-MM-DD] [--seed N] [--no-up]

                      The defaults come from marketplace/screenshots.ts's demo block when it exists, otherwise from the demo module parameters (recommended values shown):

                      OptionDefault
                      datedemo.date, 2026-01-15
                      seeddemo.seed, 1
                      ERPNext demo datademo.erpnext-demo, off
                      1. Bring the bench up as frappe-test stage 1 does, unless --no-up. With --fresh, or when the site is missing, run bench provision.

                      2. Run the setup wizard with fixed arguments:

                        language <demo.language>, country <demo.country>, currency <demo.currency>, timezone <demo.timezone>,
                        company_name <demo.company-name>, company_abbr <demo.company-abbr>, fy_start_date <year>-01-01,
                        fy_end_date <year>-12-31, chart_of_accounts Standard, full_name "Demo User", email demo@example.com,
                        password <admin pw>

                        recommended: English, United States, USD, America/New_York, "Demo Company", "DC". The Avunu profile sets "Avunu Demo", "AD". The company and fiscal-year keys are passed only when erpnext is installed.

                      3. When ERPNext demo data is on and erpnext is installed: erpnext.setup.demo.setup_demo_data().

                      4. If <app>.demo is importable, call setup(ctx), where

                        class DemoContext(TypedDict):
                            today: datetime.date        # the --date value; never date.today()
                            seed: int
                            company: str | None         # demo.company-name when erpnext is installed
                            erpnext_demo: bool

                        The hook contract:

                        • it runs as Administrator;

                        • it MUST be idempotent: a second call creates nothing new (named records, or ignore_if_duplicate);

                        • it MUST NOT reach external services; mock clients instead;

                        • it MUST derive every date from ctx["today"];

                        • it MUST NOT commit. frappe-demo commits once at the end.

                      5. Write sites/<site>/demo.json with {date, seed, apps: {name: version}, erpnext_demo}.

                      When frappe-shots invokes it, the whole bench runs under libfaketime (§5.5).

                      Exit codes: 0 ok; 1 the hook raised; 10 an environment error.

                      5.5 frappe-shots (N5)

                      Module screenshots (off in recommended; needs demo). Profile values: screenshots.timezone and screenshots.locale, the defaults for the spec fields of the same names, and screenshots.change-threshold (a share from 0 to 1, default 0), the share of a screenshot's pixels that must differ before --update replaces it.

                      frappe-shots [--spec marketplace/screenshots.ts] [--only a,b] [--theme light|dark]
                                   [--update | --check] [--reuse-site] [--out docs/screenshots] [--video <name>]

                      The default is --update. Nightly uses --update, then checks git status: when no screenshot reached change-threshold, nothing changed and it pushes nothing. --check writes diffs only and exits 1 if anything differs past maxDiffRatio; change-threshold does not apply to it.

                      The engine is lib/shots/:

                      • cdp.ts is carbon_frappe's zero-dependency CDP driver, moved here.

                      • runner.ts, diff.ts and shots.d.ts are new.

                      • It runs under Node 24 with type stripping.

                      • pixelmatch and pngjs come from lib/shots/yarn.lock, built as a Nix node_modules.

                      • cwebp, dwebp (libwebp), chromium, ffmpeg and libfaketime come from nixpkgs.

                      • Fonts come from a fixed FONTCONFIG_FILE: the Inter, IBM Plex and Noto sets from nixpkgs.

                      ShotSpec. This is lib/shots/shots.d.ts, copied to marketplace/shots.d.ts:

                      export type Theme = "light" | "dark";
                      export interface Viewport { width: number; height: number; deviceScaleFactor?: number }
                      export type Action =
                      	| { click: string } | { hover: string } | { press: string }
                      	| { type: { selector: string; text: string } } | { scroll: { selector?: string; y: number } }
                      	| { wait: number } | { waitFor: string } | { eval: string };
                      export interface Shot {
                      	name: string;                 // /^[a-z0-9-]+$/, unique
                      	route: string;                // starts with "/"
                      	alt: string;                  // required; used by the README and the org's website
                      	waitFor?: string;             // CSS selector
                      	waitForFn?: string;           // JS expression, truthy when ready
                      	actions?: Action[];
                      	clip?: string;                // selector; capture its bounding box
                      	fullPage?: boolean;
                      	mask?: string[];              // painted #8C8C8C
                      	hide?: string[];              // visibility: hidden
                      	themes?: Theme[];
                      	viewport?: Viewport;
                      	featured?: boolean;           // an org website may show featured shots
                      	readme?: "hero" | "feature";  // at most one "hero"
                      	threshold?: number;           // pixelmatch per-pixel threshold, default 0.1
                      	maxDiffRatio?: number;        // allowed share of differing pixels, default 0.001
                      }
                      export interface VideoFlow { name: string; route: string; steps: Action[]; seconds?: number }
                      export interface ShotSpec {
                      	viewport?: Viewport;          // default { width: 1440, height: 900, deviceScaleFactor: 2 }
                      	themes?: Theme[];             // default ["light", "dark"]
                      	timezone?: string;            // default screenshots.timezone ("America/New_York" in recommended)
                      	locale?: string;              // default screenshots.locale ("en-US" in recommended)
                      	user?: string;                // default "Administrator"
                      	demo?: { erpnextDemo?: boolean; date?: string; seed?: number };
                      	css?: string;
                      	shots: Shot[];
                      	videos?: VideoFlow[];
                      }

                      How a run works.

                      1. Unless --reuse-site: export LD_PRELOAD=<libfaketime> and FAKETIME="@<demo.date> 09:00:00" (a start time; the clock advances) into the environment that devenv up is started from, so every bench process (web, workers, MariaDB) sees the same day. Then run frappe-demo --fresh with the spec's demo options. Then bench build. Shots therefore run without FRAPPE_NIX_CI.

                      2. Launch chromium (cdp.launch) with --headless=new --hide-scrollbars --force-color-profile=srgb --disable-lcd-text --font-render-hinting=none --disable-gpu. Log in through the API.

                      3. For each theme and each shot:

                        • set the user's desk_theme (Light or Dark) through frappe.client.set_value, and use Emulation.setEmulatedMedia for prefers-color-scheme;

                        • set Emulation.setTimezoneOverride, Emulation.setLocaleOverride, and the viewport and DPR;

                        • navigate;

                        • inject CSS that turns off animations, transitions and the caret (*,*::before,*::after{animation:none!important;transition:none!important;caret-color:transparent!important}), plus spec.css;

                        • wait for document.fonts.ready, then network idle (no request in flight for 500 ms), then waitFor or waitForFn (timeout 30 s → exit 4);

                        • run the actions, apply hide and mask;

                        • capture clip, fullPage or the viewport as PNG.

                      4. Write the master to .dev-dist/shots/<name>-<theme>.png. Decode the committed docs/screenshots/<name>-<theme>.webp with dwebp and run pixelmatch(threshold) (anti-aliased pixels do not count). A shot with no committed WebP, or of another size (ratio 1), always differs. If the differing ratio is above maxDiffRatio: in update mode, write cwebp -lossless -exact -z 9 when the ratio is also at least screenshots.change-threshold (runner.ts --change-threshold, default 0), and otherwise keep the committed WebP; in check mode, record the diff PNG under .dev-dist/shots/diff/.

                      5. Write docs/screenshots/manifest.json (committed): [{name, theme, alt, featured, readme, width, height, sha256}], sorted. The README and any org website read it.

                      Exit codes: 0 no differences, or updated; 1 differences in --check; 2 a spec error (validation against the types runs at runtime); 3 environment; 4 a capture error (navigation, timeout or JS error).

                      With --video <name>, it records the flow with Page.startScreencast and encodes .dev-dist/shots/<name>.mp4 with ffmpeg. Never committed.

                      5.6 frappe-nix repo apply (N4)

                      frappe-nix repo apply <owner/repo>… | --all --fleet <file>  [--phase provisional|full] [--profile <ref>]
                                            [--rename-default-branch] [--self | --policy-dir <dir>] [--dry-run]
                                            [--settings-only | --rulesets-only]
                      frappe-nix repo doctor [<owner/repo>] [--format text|json]

                      It needs gh authenticated with repo scope, and admin on the target. It never needs admin:org. Module repo-policy. For each target it makes a shallow clone of the repository's default branch and resolves the configuration (§8.4, fetching an org profile like --check does):

                      • An opted-in repo (its default branch has [tool.frappe-nix]): the app's own configuration. If the default branch isn't yet branches.integration, the clone is retried on branches.integration when that exists.

                      • A repo that hasn't opted in yet (the Avunu fleet before PR A, plan Phase 4 step 1): the profile named by --profile <ref>, else the fleet entry's profile, else the fleet file's top-level profile, resolved with an empty app layer (frappe-major is not needed for the settings and the provisional ruleset). Only --phase provisional is allowed (settings, labels and integration-provisional.json); --phase full needs the gates, so it is exit 2 for that repo until the table exists. Without any profile it is skipped with a notice.

                      A repo whose resolved repo-policy.enable is false is skipped with a notice (exit 0 for it), so the tool never applies policy an app or its profile didn't opt into. When branches.integration doesn't exist on the remote, the settings step would point default_branch at nothing: with --rename-default-branch it first runs POST /repos/{r}/branches/<default>/rename with new_name=<integration> (GitHub retargets open PRs and redirects the old name); without it, that repo fails with the command to run. --policy-dir <dir> reads settings and rulesets from a local directory (P applies its own repo-policy/ this way, §1.3); --self is shorthand for frappe-nix's repo-policy/self/.

                      1. Read repo-policy/repo-settings.json and repo-policy/rulesets/*.json, or the org profile's overrides of them (§8.1), and the fleet entry when --all. With --self, it reads repo-policy/self/* and targets frappe-nix's own repository; with --policy-dir, that directory.

                      2. PATCH /repos/{r} with the settings, after substituting {integration_branch} and {documentation}.

                      3. PUT /repos/{r}/actions/permissions/workflow.

                      4. PUT vulnerability-alerts, and PUT automated-security-fixes.

                      5. Create or update each label.

                      6. Rulesets, matched by name: GET /repos/{r}/rulesets, then for each wanted ruleset PUT …/rulesets/{id} if it differs, or POST if it is missing.

                        • provisional = integration-provisional.json;

                        • full = integration.json (with the app's {required_checks}, §4.8) + release-branch.json (only under develop+version) + tags.json (only when releases is on).

                        • Unknown rulesets are listed, never deleted.

                      7. Private repos. Rulesets work on private repositories on GitHub Team and Enterprise plans and return 403 on the Free plan. repo apply therefore tries the rulesets API on a private repo and fails that repo (exit 1) only on an actual 403, with the message that its plan doesn't support rulesets on private repositories, so the required checks would be missing. A fleet entry with private: true is refused for --phase full before any call (exit 1 for that repo): that is how an organisation records "make it public first" (Avunu fleet, plan §7 decision 2: timeclock goes public before its PR A). Private repos also pay for scheduled minutes, which ci.schedules controls (§4.7).

                      --dry-run prints a JSON diff per repo and changes nothing.

                      Exit codes: 0 applied or already matching; 1 some repo failed (the rest continue); 2 config error.

                      frappe-nix repo doctor is read-only and needs no admin. For the app in the cwd (or <owner/repo>), it lists every repository setting the enabled modules rely on, each as ok, missing or unknown (not readable without admin), with where to change it:

                      • releases: Actions may create pull requests (can_approve_pull_request_reviews), needed by release-please; under develop+version, the fast-forward needs GitHub Actions to be allowed to move version-* (a ruleset bypass, or no ruleset on it);

                      • dependabot with auto-merge: allow_auto_merge, and a ruleset or branch protection on branches.integration that requires every enabled gate's context (otherwise deps.yml labels instead of merging, §4.5);

                      • ci with ci.schedules.ci or release off while auto-merge is on: the catch-up caveat of §4.7;

                      • screenshots, dependabot: their labels (deps.yml and nightly create them on first use);

                      • listing.publish: the REGISTRY_TOKEN secret and the registry fork;

                      • any private source: FRAPPE_NIX_FETCH_TOKEN (Actions, and Dependabot when dependabot is on).

                      Sync prints run frappe-nix repo doctor whenever it turns on a module that needs one of these (§3.3 step 5). Exit 0 when nothing is missing, else 1.

                      5.7 frappe-nix repo audit (N4): the plan's §6 scorecard, mapped to checks

                      frappe-nix repo audit [--repo R… | --all --fleet <file>] [--format md|json] [--out PATH]
                                            [--issue --issue-repo <owner/repo>] [--against pinned|latest]

                      For each repo, the audit makes a shallow clone of the integration branch (resolved as repo apply does, §5.6), installs frappe-nix-tools at the repo's flake.lock rev into a temp venv (or the latest release's, with --against latest), resolves the app's configuration, and evaluates the rows below. A row whose module is off is n/a (the module is in brackets); a profile that turns modules off therefore never turns the scorecard red. develop and version-<major> below are branches.integration and branches.release.

                      RowPlan §6 itemConcrete checkData source
                      A1[repo-policy] default branch is the integration branchrepo.default_branch == branches.integrationREST
                      A2[releases, develop+version only] version-<major> exists and equals the newest release tagref SHA == the peeled SHA of the newest tag: under frappe-major the newest <tag-prefix><major>.* tag; under semver the newest <tag-prefix>* tag by version order (v1 maintains one release branch, §6.3)REST
                      A3[repo-policy] settings and rulesets match repo-policy/ as rendered for this appField-by-field diff of the settings; normalised ruleset diff, by name (private repo → n/a)REST
                      A4managed files present and --check clean at the pinned versionfrappe-nix sync --check --format json → status == cleanclone
                      A5[ci] the enabled gates are green on the integration branch's HEAD, and nightly is greenThe latest completed ci.yml run on the integration branch (push or schedule) concluded success with every gate job present successful; the latest pr-policy on any merged PR is green (when commits is on); the latest nightly.yml run concluded success (when ci.nightly is on)REST runs
                      A6[python-types] ty: 0 diagnostics, and the ignore count ≤ baselineThe test-report artifact of the run in A5 → ty.diagnostics == 0. The ignore count isn't higher than in the report 30 days earlier, and it is enforced per PR by the ratchet.artifact
                      A7[typescript] tsc clean on every project; no hand-written frappe globalstypecheck job success (A5), plus frappe-nix compat C7 (redeclarations only; augmentations confined to types/<app>.augment.d.ts). The augment file's member count is reported. Amber while [[tool.frappe-nix.unchecked-js]] is non-empty (with check-js on).clone
                      A8[tests] coverage ≥ minimum, rising towards the target; testmap passingreport: coverage.percent ≥ fail_under and testmap.untested == []. Amber when fail_under < tests.coverage.target or [[tool.frappe-nix.coverage-omit]] is non-empty.artifact
                      A9no legacy toolingNo file matches an applying retire rule (§2.4.1), read from the same sync --check --format json as A4 so the lists can't diverge; no tracked **/public/dist/**; no pyupgrade or codesorter in the pre-commit config; ruff and ssort managed when their modules are on (A4). Amber when tool.ruff.extend-exclude is non-empty.clone
                      A10[dependabot] every enabled ecosystem configured; the last nix bump merged automatically with relock; frappe-nix and the org profile currentA4 covers the config. The newest merged PR with head dependabot/nix/* (frappe and siblings): merged through auto-merge, and it contains a commit starting chore(deps): relock and sync unless its relock was empty. The pinned frappe-nix is the latest release, or one released less than 14 days ago; otherwise amber, naming the frappe-nix repo rollout command (S5). The same 14-day rule applies to the locked standards-profile rev against its ref's head (S38).REST
                      A11[releases] at least one release cut by release-pleaseA release tag exists (<tag-prefix><major>.* under frappe-major, any <tag-prefix>* version tag under semver), and its GitHub release was authored by a bot: github-actions[bot], or the App of ci.github-app (any login ending in [bot])REST
                      A12[readme] README follows D15 and its blocks are in syncfrappe-nix listing readme --check == 0, and the README contains the org.dev-docs-url link (S26)clone
                      A13[icons] icons pass; hooks wired by type; no app_logo_url or scaffold app_iconfrappe-nix icon check --structural == 0, and L2clone
                      A14[listing] frappe-listing check clean; semgrep baseline empty; links 200frappe-nix listing check --links-only and check (without --no-getapp) == 0, and the baseline's findings == []clone
                      A15[screenshots] screenshot spec runs in CI; committed shots match the latest nightlyThe latest nightly shots job succeeded, and there is no open screenshots PR older than 7 daysREST
                      A16[listing.publish] registry index merged; newest registry release == latest tagThe upstream apps.json on main has the app, and apps/<app>.json releases[0].version == latest tagraw.githubusercontent
                      A17[docs-site] docs site (docs-and-urls track)GET /repos/{r}/pages: cname set and https_enforced: true; DOCS_SITE_ENABLED == "true"REST
                      • Every row is green, amber, red, n/a or unknown. unknown means the data couldn't be read, for example because the token lacks admin. For a fleet entry with list: false, A16 is n/a and A14 evaluates check and the baseline but not the links (an unlisted app has no listing.toml); the registry-readiness checks still apply to it (§8.6).

                      • --issue opens or updates one issue per app in --issue-repo (required with --issue) titled scorecard: <repo>. The Avunu caller passes Avunu/frappe-standards-profile.

                      • Scheduling. frappe-nix ships .github/workflows/fleet-audit.yml as a reusable workflow only (workflow_call; inputs fleet (a path in the caller's checkout), issue-repo, frappe-nix-version; secret FRAPPE_NIX_AUDIT_TOKEN). An organisation schedules it from its own profile repository (P for Avunu, nightly). FRAPPE_NIX_AUDIT_TOKEN is a read-only fine-grained PAT with Administration and Contents read on the fleet's repos. Without that token, the settings and ruleset rows are unknown.

                      Exit codes: 0 everything green or n/a; 1 any amber or red; 2 error.

                      5.8 frappe-nix repo rollout and rollout.yml (N4)

                      frappe-nix repo rollout [--to vX.Y.Z] [--profile-to <ref>|latest] [--repo R… | --all --fleet <file>]
                                              [--no-auto-merge] [--dry-run]
                      frappe-nix repo rollout --to vX.Y.Z --repo R --base <sha> --emit-patch DIR [--tag-sha <sha>]
                      frappe-nix ci verify-rollout-patch --repo R --base-sha B --tag T --tag-sha TS --patch FILE --worktree DIR --out FILE
                      frappe-nix ci rollout-contract

                      rollout.yml in frappe-nix is how a frappe-nix release reaches apps with CI callers (S5). It runs after every successful release run on main (workflow_run; resolve goes on only for this repository's own .github/workflows/release.yml run from a push, schedule or dispatch, since the trigger's filter would also match a fork's pull request with a workflow of that name), daily an hour after release.yml's cron, and by dispatch (inputs repos, dry-run, auto-merge). It has permissions: {} at the top, one concurrency group frappe-nix-rollout that never cancels, and every job runs on ubuntu-latest:

                      JobHoldsDoes
                      resolvecontents: read, pull-requests: read; no secretThe release: release's head (TAG_SHA), the tag v<version.txt at that commit>, which must point at exactly that commit (another v* tag there is ignored), and the PR into main it is the merge commit of; else it fails. Installs the tag's frappe-nix-tools and skips, with a notice, a tag whose ci rollout-contract does not print 1. The targets: FRAPPE_NIX_ROLLOUT_REPOS (unset or empty: none; all: the fleet; else a comma list) or the dispatch input, a subset of fleet.json from Avunu/frappe-standards-profile (read anonymously). Each must be an Avunu repository, public, with [tool.frappe-nix] on its integration branch (frappe-nix config integration-branch). Per repository it records the integration branch, its head (base_sha) and the locked frappe-nix rev. It skips a repository at TAG_SHA and one whose rev TAG_SHA does not descend from. It pauses one whose latest standards/frappe-nix PR for this tag was closed unmerged (until the next tag), or whose branch has a commit not both authored and committed by avunu-release-manager[bot] (an amend or rebase keeps the author) that an open PR, or no PR, holds. A branch still at the head of its merged or closed latest PR is what that PR left behind: stale, and replaced. It also leaves alone an open PR already built for this tag on this base.
                      plan (matrix, at most 4 at a time)contents: read; no secret, environment or cacheSucceeds as superseded when release moved past TAG_SHA. Otherwise it installs Nix (the pinned installer of app-deps.yml, with an empty github-token: the installer would write the job's token into /etc/nix/nix.conf, which every user reads) and runs nix run github:Avunu/frappe-nix/<TAG_SHA>#frappe-nix -- repo rollout --emit-patch --tag-sha <TAG_SHA> with FRAPPE_NIX_YARN_IGNORE_SCRIPTS=1, as a separate user without sudo and without any token (with --tag-sha the tool reads nothing from GitHub, and git and nix fetch the public repositories anonymously), so the app's code can read neither the runner's token for artifacts and caches nor change the runner. Only the regular files patch and meta.json leave that user's home, as the artifact rollout-<owner>__<repo> (3 days).
                      publish (matrix)environment frappe-nix-rollout; contents: read, then the App tokenChecks meta.json against resolve's matrix (the repository, tag, tag SHA and base come only from there), and takes its state as a claim: superseded only when release has moved past TAG_SHA, noop (and later an empty patch) only when base_sha already locks TAG_SHA, else the repository is failing. It checks out the consumer at base_sha without credentials. Then it runs the tag's ci verify-rollout-patch, before any token exists. On publish or needs-review it checks the patch's sha256 again, re-derives the tree in a fresh clone at base_sha (read-tree, apply --cached, write-tree) and re-checks modes and paths in shell. Only then does it mint the Avunu Release Manager App token (the environment's own vars.FRAPPE_NIX_ROLLOUT_APP_ID and secrets.FRAPPE_NIX_ROLLOUT_PRIVATE_KEY, owner Avunu, that one repository, Contents, Pull requests, Workflows and Issues write; none in a dry run). Before it pushes, and before it keeps a head that cannot end PR open, it turns off any auto-merge an earlier run enabled (GitHub keeps it on across a push; one that stays on fails the job). It commits that tree on base_sha as avunu-release-manager[bot] (identity from the environment only) and pushes standards/frappe-nix with --force-with-lease to the head it saw, unless the branch already holds the tree. A branch with someone else's commits gets a comment and is left alone while an open PR (or no PR) holds them; one its merged or closed PR left behind is replaced. It opens or edits chore(deps): frappe-nix vX.Y.Z and closes the legacy standards/frappe-nix-v* PRs. It enables auto-merge through frappe-nix ci enable-automerge --head-sha <the commit it pushed> (the §4.5 rule, read again; gh pr merge --match-head-commit) when the decision is publish with automerge, the repository allows auto-merge and the auto-merge input is on, removes a needs-review label, and reports the PR open only once GitHub holds auto-merge for the head it verified. Otherwise it turns off any auto-merge again and labels the PR needs-review.
                      reportissues: write (the workflow's own token); no environment or secretA per-repository table (at tag, PR open, failing, needs-review, rejected, paused, superseded, skipped) in the job summary and in the pinned issue "frappe-nix rollout status". Each detail is one inline code span (it carries package names and paths the plan chose, and commit names), so no link or mention in it renders; so are the needs-review reasons in the PR body. It fails the run when a patch was rejected.

                      verify-rollout-patch takes only the lock files from the plan (flake.lock, nix/uv.lock, nix/node-locks/**, tools/uv.lock, yarn.lock, each checked: the frappe-nix node at exactly the tag, every other flake node as at the base, uv and yarn sources from the registries or already in the base; a local uv source only inside a directory the base installs editable, by verify-relock's rule, or the lock's own virtual = "." root). frappe-runtime is nix/uv.lock's only, once, and exactly the tag's: a git source at TAG_SHA (subdirectory runtime), no file to download, and the version and dependencies (names and extras) runtime/pyproject.toml declares at the tag, each one without a marker and none it does not declare (uv may leave out one with a marker that cannot hold); else reject. A yarn lock is read with verify-relock's reader (ci/lockcheck.py): exactly the shape yarn writes, and the same entries and values as lib/node/yarn-lock.nix finds, else reject. Each entry is tied to what it names: a uv package's name and version the base locks keep the base's source, files (URL and hash) and dependency edges, a new version's PyPI files are named for it (else reject), a yarn spec the base has keeps its version, resolved, integrity and dependency lines, an npm URL is /<name>/-/<base name>-<version>.tgz for its package (or npm: alias) and version (else reject), a new or changed yarn entry locks a version its spec's range allows (node-semver's rules; else a person looks), a new npm: alias and both its names are shown to a person, and a node-lock source.json follows verify-relock's stamp rules (forced as at the base or the seed) and is the base's or the seed's. A version move in nix/uv.lock outside frappe-runtime's closure, or in tools/uv.lock outside the closure of the tools the release raises a floor for, is unexplained; both closures walk the base lock's edges and the tag's declared frappe-runtime dependencies, never the plan's, and a new version of a name the base has that depends on a base package outside the closure (and not a dependency of that name at the base) is unexplained too. A uv version that goes down is unexplained wherever it is. Every other path must be byte for byte what the tag's sync engine renders from the base and those locks, and sync --check --expect-rev <tag sha> must pass on the result. A lock change the release does not explain, or a problem the base already had, is needs-review; anything else wrong is reject. It exits 0 with any decision, 2 for a bad argument and 3 for an environment error.

                      One-time settings in frappe-nix: the environment frappe-nix-rollout (Settings → Environments; deployment branches: main only, required reviewers optional), the Actions variable FRAPPE_NIX_ROLLOUT_REPOS (unset means no repository), and the GitHub App avunu-release-manager (Contents, Pull requests, Workflows and Issues write, installed on the fleet's consumers), whose client ID is the environment variable FRAPPE_NIX_ROLLOUT_APP_ID and whose key is the environment secret FRAPPE_NIX_ROLLOUT_PRIVATE_KEY of frappe-nix-rollout, never a repository or organisation secret: an environment's deployment-branch rule guards only its own secrets, so a key any frappe-nix workflow or branch could read would let it push workflows to every consumer. rollout.yml does not use AVUNU_CI_PRIVATE_KEY.

                      frappe-nix repo rollout, run by hand, is the fallback, and the mover for an org profile (S38). At least one of --to and --profile-to is required. It runs locally, needs Nix, and uses the user's gh token, which must have the workflow scope (gh auth refresh -s workflow), because the commit rewrites the caller workflows' uses: SHAs. For each repo, in a temp clone of the integration branch:

                      nix flake update frappe-nix                     # with --to
                      nix flake update standards-profile             # with --profile-to (after setting the ref in `profile` when it changes)
                      nix run --no-pure-eval .#relock && nix run --no-pure-eval .#frappe-init -- --sync

                      The nix commands run with no *_TOKEN, *_KEY, *_SECRET or *_PASSWORD variable and with gh pointed at an empty configuration. A repo whose profile is a built-in is skipped by --profile-to. frappe-init --sync runs from the newly locked frappe-nix (phase A re-execs if needed, §3.3). Rollout then commits chore(deps): frappe-nix vX.Y.Z (or chore(deps): standards profile <short rev>, or both in one subject) and pushes the one branch standards/frappe-nix (or standards/profile-<short rev>) with --force-with-lease. It leaves alone a branch with another author's commits while an open PR (or no PR) holds them, and comments on the open PR. Only a chore(deps): frappe-nix commit authored and committed by the user, or by exactly the login rollout.yml's env.BOT names (read from the locked frappe-nix repository at --to, since that login is an org value S37 keeps out of the code), is the rollout's own; any other bot's commit is another author's, whatever its subject. A branch still at the head of its merged or closed latest PR is replaced. With --no-auto-merge, or when the §4.5 rule fails, it turns off an auto-merge an earlier run enabled. It opens or edits the PR with the user's token, closes the legacy standards/frappe-nix-v* PRs and, unless --no-auto-merge, enables auto-merge under the §4.5 rule with the first of repo-policy.merge-methods (squash by default), or labels needs-review. A user-token push triggers CI normally, and the user-token merge raises a normal push event. If a stricter rule in the new version fails the app, the PR waits for a fix pushed to its branch. --emit-patch DIR (with one --repo, --to and --base) is rollout.yml's plan: it writes DIR/patch and DIR/meta.json and pushes nothing; with --tag-sha <sha> it also reads nothing from GitHub (a lock not at that commit after the update is superseded, which publish checks).

                      In the Avunu fleet rollout.yml moves frappe-nix after each release; the main agent runs frappe-nix repo rollout --profile-to latest --all --fleet <P>/fleet.json after each P release, and --to only by hand when rollout.yml can't (a repository outside FRAPPE_NIX_ROLLOUT_REPOS). A paused repository is not moved by hand either, since the same rule leaves its branch alone: merge or close its open PR (for commits no PR holds, open one first, or delete the branch), and the next rollout moves it. The nightly drift issues (§4.6), audit row A10 and the "frappe-nix rollout status" issue are the reminders. An app without CI callers needs none of this: nix flake update frappe-nix && frappe-init --sync in any commit is enough.

                      5.9 frappe-nix policy, frappe-nix ratchet, frappe-nix compat, frappe-nix minibench

                      Module commits for policy; each compat and ratchet rule names its module, and a rule whose module is off is skipped. minibench serves test-utils and typescript.

                      frappe-nix policy --commit-msg-file F is the commit-msg hook. Under releases.version-scheme = "frappe-major" it rejects:

                      • a subject matching ^[a-z]+(\([^)]*\))?!:;

                      • a BREAKING[ -]CHANGE: footer;

                      • a Release-As: X.y.z whose major isn't frappe-major.

                      Under "semver" (or with releases off) it rejects nothing beyond what committed checks, and the hook is not rendered.

                      frappe-nix policy --pr runs in CI. When EVENT_NAME == workflow_dispatch, it finds the PR with gh pr list --head $REF_NAME --state open --json number,title,baseRefName,headRefOid,author and asserts that headRefOid == HEAD_SHA. It then takes the title, base and author from that result instead of PR_TITLE, BASE_REF and PR_AUTHOR, which are empty on a dispatch; if either is missing from the result, it fails rather than check an empty value. If there is no PR, it passes, for example on a branch dispatched by the sweep after the PR closed. It then checks:

                      1. The base is allowed: base == $INTEGRATION (branches.integration); or base matches a pattern in commits.pr-allowed-bases (fnmatch, default []; e.g. ["version-*"] for maintenance PRs); or, while commits.allow-stacked is true (recommended; false in the Avunu profile, plan §5 "no stacked PRs"), base is the head branch of another open PR in the same repository, so a stacked PR passes and is re-checked when GitHub retargets it after its parent merges. Otherwise the error message is retarget: gh pr edit <n> --base <integration>.

                      2. The title passes committed --commit-file <(title) and the subject rules above that apply.

                      3. Every commit in git rev-list --no-merges base..head passes committed <sha> and the rules above that apply, including the Release-As major rule under frappe-major.

                      4. On a release-please--* branch: frappe-nix compat. Under frappe-major, C1 then requires the proposed package.json version's major to equal frappe-major.

                      In a Dependabot PR (the PR's author, never the spoofable github.actor, is dependabot[bot]), the title and the commits Dependabot authored are checked with committed.toml's subject_length turned off, because a bump of a SHA-pinned action or reusable workflow gets a subject far past 100 characters; every other rule, ! and BREAKING CHANGE included, still applies.

                      Exit 0 or 1. --major-free (frappe-nix itself, §4.10, which has no [tool.frappe-nix]) drops the Release-As major rule and check 4, and takes the integration branch from --base-branch (default main).

                      frappe-nix compat is the prek hook (C1–C9):

                      IdRule
                      C1[releases, frappe-major scheme] The package.json version's major is ≤ frappe-major. It MUST equal frappe-major once any v<major>.* tag exists, or on a release-please--* branch.
                      C2[metadata] package.json frappe = {major, branch}.
                      C3[metadata] flake.nix frappeVersion and the flake.lock frappe node's original.ref are version-<major>; each sibling's original.ref is that sibling's resolved branch (§2.1: version-<major> under the generic rule, else the object's or known-apps entry's branch).
                      C4[metadata] The L3 range rules (shared code).
                      C5[releases] The version block holds, and __version__ = package.json = manifest.
                      C6[metadata] hooks.required_apps ⊆ siblings; frappe isn't in required_apps.
                      C7[typescript; the blame-ignore part hygiene] No hand-written frappe globals (§2.9): no declare (var|let|const) frappe, no interface Window { with a frappe member, no declare namespace frappe, and namespace frappe augmentations only inside declare global in types/<app>.augment.d.ts, each member preceded by // app-owned: <reason>. Also: .git-blame-ignore-revs is valid (§2.20).
                      C8[vite-register] When discover.vite: scripts.build ends with node scripts/vite-register.mjs (S30).
                      C9[typescript with check-js for unchecked-js; tests for coverage-omit] Every [[tool.frappe-nix.unchecked-js]] path and every [[tool.frappe-nix.coverage-omit]] glob matches at least one tracked file; reasons are ≥ 10 characters.

                      Exit 0 or 1, or 2 when a file can't be parsed.

                      frappe-nix ratchet --base <sha> applies only if the base's pyproject.toml has [tool.frappe-nix] (S24).

                      IdRule
                      R1[tests.coverage] fail_under(head) ≥ fail_under(base)
                      R2[python-types] The count of ty: ignore comments in head ≤ the count in base. Every ty: ignore matches #\s*ty:\s*ignore\[[a-z0-9-]+(,\s*[a-z0-9-]+)*\]\s+#\s+\S.{9,}, so it names a rule and gives a reason of at least 10 characters.
                      R3[listing] For every semgrep baseline key, count(head) ≤ count(base), and head has no key that base lacks
                      R4[tests.testmap] The [[tool.frappe-nix.untested]] targets in head ⊆ those in base
                      R6[typescript.check-js] The [[tool.frappe-nix.unchecked-js]] paths in head ⊆ those in base (a renamed file counts as new)
                      R7[tests.coverage] The [[tool.frappe-nix.coverage-omit]] globs in head ⊆ those in base
                      R5[semgrep or listing] Every nosemgrep comment names a rule (# nosemgrep: <rule-id>), and the same or the previous line carries a justification comment. A format rule, not a count.

                      A module switched on in head but off in base has no base value: its ratchets start from head. A module switched off in head drops its ratchets. Exit 0 or 1, listing each violation.

                      frappe-nix minibench --mode customizations|doctypes --dest D builds a fake bench from the app's flake.lock. For frappe and each sibling: git clone --filter=blob:none --no-checkout --sparse <clone URL> (from the lock node: https://github.com/<owner>/<repo>, https://<host>/<path> for gitlab, or the git node's url; authenticated with FRAPPE_NIX_FETCH_TOKEN when set, §5.2), check out the locked rev, and set the sparse patterns (non-cone): /*/modules.txt, /*/hooks.py, /pyproject.toml, /*/*/doctype/**/*.json, /*/*/custom/*.json, /*/fixtures/*.json. Then:

                      • write D/sites/apps.txt and D/sites/apps.json, listing frappe, the siblings and the app;

                      • mkdir D/env;

                      • in customizations mode, git worktree add --detach D/apps/<app> HEAD; in doctypes mode, a sparse copy of the app's /<app>/*/doctype/**/*.json, /<app>/*/custom/*.json and /<app>/fixtures/*.json, so gen-doctypes sees the app's Custom Fields on core doctypes (postgrid's address and notification, jailbreak's version, automated_subscriptions' sales_invoice, timeclock's fixtures) and merges them into FrappeDocTypes.

                      The guard: exit 1 unless D/sites, D/env and D/apps/frappe/frappe/modules.txt exist. In customizations mode, the caller then runs the manual-stage hooks from D/apps/<app>, and --show-diff-on-failure reports what they rewrote.

                      5.10 frappe-rename-app (N1; dev-shell script and NixOS step)

                      This follows the rename-mechanics track. The code half is for PR 0, and the site half runs before migrate.

                      Code half:

                      frappe-rename-app code --from OLD --to NEW [--fleet <file> | --profile <ref> | --no-replace-check] [--dry-run]
                      1. Refuse (exit 1) when the pair is a replace pair. Replace pairs come from the app's resolved configuration, [[replace-apps]] of its org profile (§8.1), which needs no flag, and from a "rename_mode": "replace" entry of the fleet file given with --fleet <file>. frappe-nix has no built-in pairs (S37); the Avunu profile declares jailbreak → data_steward (§8.6), so running the code half in a jailbreak checkout synced with that profile refuses with or without --fleet. Because the Avunu fleet's renames (PR 0) land before the app opts in, an app without [tool.frappe-nix] must name where its replace pairs come from: --fleet <file>, --profile <ref> (resolved as repo apply does, §5.6), or an explicit --no-replace-check; with none of them, code exits 2 before touching the tree. A replace goes through the replace path below instead.

                      2. git mv OLD NEW. Every module folder and every modules.txt line stays the same. Then git mv every tracked file under NEW/ whose basename starts with OLD. to the same name with NEW. (esign's esign.desk.bundle.js and esign.control.bundle.js, timeclock's timeclock.app.bundle.js, their .css/.scss twins), so the bundle names in hooks and the files agree.

                      3. Rewrite the tracked text files with the boundary regex (?<![\w./])OLD(?=[.\/]), covering imports, dotted paths in hooks.py, patches.txt (line by line), JS method strings, /assets/OLD/ and OLD/templates/…. A match inside a string that is a bare filename (OLD.<rest> with no / and no further dotted module segment that resolves) is rewritten only if step 1 renamed a file with that basename; otherwise it is left alone and listed in the report. Also rewrite pyproject [project].name, package.json name, app_name, flit's include, the CI --app and release-please package-name.

                      4. Bump modified in every standard JSON whose content changed (import_file.py:150).

                      5. Append an override_whitelisted_methods shim, mapping each old whitelisted dotted path to its new one, between # frappe-nix:rename-shim-begin OLD and # frappe-nix:rename-shim-end in hooks.py. Keep it for at least one minor release.

                      6. Print what it deliberately left alone: custom fieldnames, DocType names, Communication types, CSS classes, localStorage keys, and module names. Module names are kept (Q5).

                      Exit 0, or 1 when the tree is dirty or the pair is a replace.

                      Replace path (generic; the Avunu fleet's case is jailbreak → data_steward, A.2). data_steward is a new app with its own module (Data Steward) and doctypes (Data Steward Settings), so it never collides with jailbreak's Jailbreak Module Def or Jailbreak Settings while both are installed; Q5's keep-the-module-names rule doesn't apply to it. Its after_install copies the Jailbreak Settings values across, mapping each capability, and is idempotent. Wiring:

                      • NixOS: services.frappe-nix.sites.<site>.replacedApps = { jailbreak = "data_steward"; }. Inside the existing snapshot and rollback, after setMaintenance on: bench --site S install-app data_steward (if not installed), then bench --site S uninstall-app jailbreak --yes --no-backup (the snapshot is the backup), then migrate as usual. When jailbreak isn't installed it is a no-op.

                      • devenv: frappe-nix.replacedApps does the same in reconcile-apps.

                      • jailbreak's whitelisted assert_capability and check_capability lived in jailbreak/__init__.py; in data_steward they are data_steward.api.assert_capability and data_steward.api.check_capability (L5 forbids code in __init__.py). The JS namespace changes from jailbreak.check_capability(...) to data_steward.check_capability(...) in public/js/data_steward.js, and capabilities are delivered at boot (A.2). No shim is kept: the old app is uninstalled, so nothing can call the old paths.

                      Site half:

                      frappe-rename-app --site S OLD=NEW [OLD=NEW…] [--dry-run] [--scan] [--yes]

                      Abort conditions (exit 1):

                      • OLD and NEW are both installed;

                      • NEW isn't in apps.txt;

                      • NEW's modules.txt doesn't declare every module OLD owns.

                      When OLD isn't installed, it prints OLD not installed on S: nothing to do and exits 0.

                      One transaction:

                      • the installed_apps global in tabDefaultValue, with order kept;

                      • Module Def.app_name, including custom rows;

                      • Patch Log.patch, for the OLD. prefix and execute: lines;

                      • Scheduled Job Type.method and Scheduler Event.method, in place;

                      • the exact-match app columns: Desktop Icon.app, Dock.app, Sidebar.app, Sidebar Item Group.app, Workspace Sidebar.app, Notification Log.app, User.default_app, System Settings.default_app, User Invitation.app_name and Website Theme Ignore App.app;

                      • token rewrites ((?<![\w./])OLD\. and /assets/OLD/) in Report.javascript and report_script, Server Script.script, Client Script.script, Print Format.html and css, Web Form.client_script and custom_css, Web Page.main_section, the Web Template fields, Custom HTML Block.html, script and style, Letter Head.content, Website Route Redirect.source and target, Number Card.method, DocType Action.action and Navbar Item.action.

                      After commit: rewrite the site_config.json installed_apps mirror, and delete the redis keys app_modules, installed_app_modules, installed_apps and all_apps.

                      --scan is read-only. It reports every remaining regex match across all text columns, from information_schema.

                      Exit codes: 0 ok; 1 a precondition failed; 2 a database error, rolled back.

                      Wiring:

                      • NixOS: services.frappe-nix.sites.<site>.renamedApps = { esign = "esign_webforms"; } runs the site half right after setMaintenance on, and before offline-migrate and bench migrate, inside the existing snapshot and rollback.

                      • devenv: frappe-nix.renamedApps makes reconcile-apps run the same step before install-app.

                      • Before production: pause the scheduler and drain RQ (rename-mechanics track, deploy order).

                      5.11 Vite manifest registration and the docs-site exclusion (N2)

                      One implementation, two callers (S30). lib/js/vite-register.cjs exports register({ appDir, app, sitesDir, log }):

                      1. Glob <appDir>/<app>/public/dist/**/manifest*.json and <appDir>/<app>/public/dist/**/.vite/manifest*.json.

                      2. For each manifest entry with isEntry: true, consider file and every member of css; for the record whose manifest key is style.css (the one stylesheet a cssCodeSplit: false build writes, which no entry lists in its css), consider its file. For each path whose basename matches ^(?<name>[^/]+)\.bundle\.[A-Za-z0-9_-]{6,}\.(?<ext>js|css)$, produce "<name>.bundle.<ext>": "/assets/<app>/dist/<path relative to public/dist>". Skip a path whose file is not on disk, logged as <app>: skipping <path>: not on disk: public/dist survives between builds, and frappe's build cleanup deletes an old <name>.bundle.* but never the manifest that named it. When two entries (in one manifest or in two, such as a Vite 4 manifest.json left beside Vite 5's .vite/manifest.json) produce the same key, the one whose file has the newer mtime takes it, whatever order the manifests are read in, and the other is logged as <app>: skipping <path>: <newer path> is newer.

                      3. Merge into <sitesDir>/assets/assets.json: write a temp file and rename it. Vite keys overwrite same-named esbuild keys, and each overwrite is logged as <app>: <key> -> <value> (vite), unless the file the key names now (under <sitesDir>) is newer than the Vite file: then the key stays, logged as <app>: <key> kept: <value> is older. The app's yarn build runs after esbuild writes, so a bundle Vite just built always wins. The result is the same whichever caller runs first, and running both changes nothing the second time.

                      4. If <sitesDir>/assets/<app> is a real directory rather than a symlink to <appDir>/<app>/public (bench build --hard-link, or an image build that copied public/ before the app's build ran), copy <appDir>/<app>/public/dist/ and every other directory under public/ that a Vite config writes to (taskview's public/portal/) into it. This replaces taskview's copyPortal().

                      5. For every <name>.bundle.css produced, also produce rtl_<name>.bundle.css and merge it into <sitesDir>/assets/assets-rtl.json by the rules of step 3. Its value is the app's own right-to-left build of that stylesheet when one exists, a css path from step 2 that passes through a directory ending in -rtl (frappe's css-rtl/; a js path there produces nothing); otherwise the left-to-right file, logged as <app>: <key> -> <value> (vite, no rtl build).

                      Caller 1: the app's own build (every bench, including Frappe Cloud and pilot's get-app bench). scripts/vite-register.mjs is a managed copy of the module with a small entry point, and scripts.build ends with node scripts/vite-register.mjs (C8). frappe's esbuild.js writes assets.json first and then runs each app's yarn build, with cwd <bench>/apps/<app>, so the registration lands after esbuild's own write. The entry point resolves sitesDir as $FRAPPE_BENCH_ROOT/sites when set, else path.resolve(process.env.PWD ?? process.cwd(), "../../sites") (the logical path, since apps/<app> may be a symlink), else the realpath of ../../sites, and uses the first one containing apps.txt. When none does (a standalone yarn build outside a bench), it prints vite-register: no bench found; skipped and exits 0.

                      Caller 2: lib/js/esbuild-preload.js (Nix builds, where the app dir is a store path). The child_process wrapper returned to esbuild.js becomes unconditional. Only the carry-on behaviour stays behind FRAPPE_NIX_KEEP_GOING. After every execSync whose command matches /^yarn( run)? build\b/ and which succeeds, and every spawn of such a command whose child closes with code 0 (frappe develop's esbuild.js runs each app's build with spawn("yarn build", { cwd, shell: true }), several at once), with cwd <bench>/apps/<x> and <x> != "frappe", it calls register with sitesDir = $FRAPPE_BENCH_ROOT/sites when set, else three levels above esbuild.js's parent.filename.

                      frappe's --using-cached glob uses the same <name>.bundle.<ext> keys, so pilot's prebuilt assets resolve identically.

                      Conventions for apps (docs/app-standards/assets.md):

                      • A Vite entry is emitted as <name>.bundle.[hash].js and .css under public/dist/, with build.manifest: true.

                      • Vite sources MUST NOT be named *.bundle.* under public/, or esbuild compiles them a second time; taskview moves them to src/*.entry.ts.

                      • www templates use {{ bundled_asset('<name>.bundle.js') }} instead of fixed paths, because production serves /assets with a one-year cache.

                      • update-assets.mjs is deleted (it is on the retire list, §2.4.1); scripts/vite-register.mjs replaces it.

                      • [tool.bench.assets], for pilot, is declared only by apps with the pilot-assets module on.

                      lib/node-targets.nix and lib/node-locks.nix. A new option, frappe-nix.app.excludeNodeTargets (a list of top-level directory names, default []), removes directories from node-target discovery; both discovery implementations honour it. Its default changes nothing for any app, so a non-opted-in app with a nested frontend named docs-site keeps being built (S35). An opted-in app's managed flake.nix sets [ "docs-site" ] while the docs-site module is on (§2.5), because a docs tool's site (docusystem's, in the Avunu fleet until 2026-10) is built by its own workflow, never by the bench; an app adds other names through nix/local.nix.

                      5.12 CI mode and the worktree port salt (N1, modules/devenv.nix)

                      These are dev-shell behaviours, not standards modules. FRAPPE_NIX_CI applies to every app-mode user and is inert unless set; the port salt applies only to opted-in apps unless an app turns it on (S35); the port leases apply to every bench and change nothing while its preferred ports are free (S35).

                      FRAPPE_NIX_CI=1 is read when enterShell runs, not at evaluation, so one shell derivation serves both modes. When it is set, enterShell:

                      • skips frappe-nix-node-verify and frappe-nix-node-modules for every app;

                      • skips frappe-nix-sources enter (the apps report), which only runs in bench mode anyway;

                      • replaces the banner with the single line frappe-nix: CI mode (<bench>, site <site>);

                      • exports DEVENV_IN_DIRENV_SHELL=true and PC_TUI_ENABLED=0.

                      Everything else, including app materialisation, the env symlink and bench patches, runs unchanged. frappe-test, ty and bench --site … run-tests don't need node_modules. bench build does, and so do the shots, so the nightly integration and shots jobs don't set the flag.

                      Ports. A new option frappe-nix.ports.worktreeSalt defaults to the opt-in test of lib/standards/shell.nix (true with [tool.frappe-nix], false without), so a non-opted-in app's linked worktrees keep today's ports; any app may set it either way. In app mode, define seed:

                      • cfg.name + "@" + builtins.getEnv "PWD" when ports.worktreeSalt is true and PWD/.git is a regular file, which means a linked worktree;

                      • otherwise cfg.name, which keeps today's ports.

                      The new option frappe-nix.ports.offset defaults to portOffsetFor seed. The environment variable FRAPPE_NIX_PORT_OFFSET, read with builtins.getEnv (evaluation is already impure), overrides it when it is a number from 0 to 899.

                      webBase, dbBase and the Mailpit SMTP, HTTP and POP3 defaults (devenv.nix<752>, <770> and <816>) all derive from ports.offset. They are the preferred ports.

                      Bench mode keeps the name-derived offset. Its common_site_config.json is committed, so a port derived from the path would dirty the tree.

                      Port leases. devenv's port allocator is the identity under its flake integration, so nothing evaluated can move a taken port, and the salt cannot tell apart two copies of one app that are not linked worktrees (CI checkouts, a fixture copied twice). devenv up therefore leases the TCP ports a bench binds (nginx's, Mailpit's SMTP, UI and POP3), in every mode:

                      • The first process, frappe-ports (lib/port-lease.py), walks from each preferred port to preferred + ports.span - 1 (default 100). It claims a port host-wide (an abstract unix socket @frappe-nix/port/<port> on Linux, which every process in the network namespace sees, systemd-sandboxed CI runners included; an flock under /tmp/frappe-nix-ports elsewhere), checks with a SO_REUSEADDR bind that nothing outside frappe-nix has it, and holds the claim until the bench stops; the kernel drops it however the process ends. A connect to a claim reads the holder's identity.

                      • It renders $DEVENV_RUNTIME/frappe-nix/nginx.conf and writes $DEVENV_RUNTIME/frappe-nix/ports.json (bench_id, name, root, pid, the leased ports, preferred, moved). nginx, Mailpit and the frappe:config task run after it and read their ports there; frappe:config writes webserver_port (app mode) and devguard-runtime.json from it. frappe-nix-ports prints it.

                      • Before it claims anything it takes an exclusive flock on $DEVENV_RUNTIME/frappe-nix/ports.lock, holds it until it exits, and removes a ports.json a killed holder left; a second holder on the same runtime is refused. The lease is up when ports.json is there and that lock is held. The frappe-ports readiness probe, frappe:config's wait and the check before devenv up test exactly that with frappe-nix-lease-ready (lib/port-lease-ready.sh: a file test and a non-blocking flock, no Python), and frappe-nix-port-lease ready decides the same way. frappe:config waits for it up to FRAPPE_NIX_UP_TIMEOUT (300 when unset) less 30 seconds, at least 30, then fails, naming what is missing in the process's log as it happens. The holder logs frappe-nix: frappe-ports: leased nginx=127.0.0.1:<port> … once ports.json is written. frappe-nix-port-lease runs its interpreter isolated (python3 -I), so no import searches PYTHONPATH or the directory its script is in, /nix/store.

                      • nginx answers GET /__frappe_nix/bench with the bench's identity, <name>/<basename of $DEVENV_RUNTIME>, and adds X-Frappe-Nix-Bench to every response. frappe-test, frappe-demo and frappe-shots wait for the web port to answer with their own bench's identity, so a neighbour's nginx on the same port never passes their readiness check.

                      • Strictness (frappe-nix.ports.strict, null by default). Unset, app mode moves and bench mode refuses, because bench mode's web port is committed; ports.base is never moved while it is unset. Strict, only the preferred port is tried, and devenv up stops before anything starts with frappe-nix: cannot start <name>: already in use: nginx=127.0.0.1:<port> …, the holder's bench, directory and pid (or "a process outside frappe-nix"), and a hint: in app mode FRAPPE_NIX_PORT_OFFSET, in bench mode, which ignores that variable, ports.offset or ports.base in flake.nix. A port lost after that check, to a bench starting at the same time, ends devenv up with the same message (frappe-ports exits on failure). FRAPPE_NIX_STRICT_PORTS=1 makes any devenv up strict and =0 lets an app-mode one move. Bench mode never moves: its committed webserver_port and socketio_port have to be nginx's port, so ports.strict = false there is an evaluation error. With sockets.enable = false the ports are always strict: the processes take them from their command lines.

                      • A bench already up. The check is skipped while the bench's own frappe-ports holds its lease, so a second devenv up attaches to the running process manager as before. It runs only under process-compose (devenv's native manager has no before hook); frappe-ports takes the leases under either.

                      • Identity in TCP mode. With sockets.enable = false there is no nginx to answer /__frappe_nix/bench, so ports.json records "identity": false and the three tools accept any answer on the port, as before.

                      5.13 frappe-nix profile (N3)

                      frappe-nix profile show [--explain] [--format toml|json]      # the resolved configuration of the app in the cwd
                      frappe-nix profile validate <profile.toml> [--templates <dir>] # an org profile, before it is published
                      frappe-nix profile list                                        # the built-in profiles, with their descriptions
                      • show prints the resolved configuration (§8.4) and modules. --explain adds, per value, the layer that set it. It exits 2 on any resolution error, with the same message sync would give.

                      • validate checks a profile file on its own: the profile schema; extends names a built-in; no app-only key; every module's needs are met under the profile's own switches (an app can still break them, which its sync reports); requires-frappe-nix admits the running version; each file in --templates (default: templates/ beside the file) overrides an overridable template or is named by an [[extra-files]] entry, and renders against the fixture contexts of §7 N3 without an undefined variable; [[extra-files]] paths collide with no manifest path. Exit 0, 2 (invalid) or 3 (environment).

                      • list prints minimal and every recommended@<minor> snapshot, marking the one plain recommended resolves to (S42). For an app on the floating recommended, sync (and so repo rollout) prints a warning, exit 0, when the running frappe-nix is newer than the version HEAD ran (read from the # vX.Y.Z comment of HEAD's callers or HEAD's flake.lock rev) and recommended resolves to a different snapshot than that version did: it lists each value that changed and suggests pinning recommended@<old minor>. The bump PR therefore says in its own log which defaults moved.

                      • frappe-nix config <key> [--json] (N3a) prints one resolved value, a list one item per line; frappe-nix config --github-output modules appends <module>=true|false for every module to $GITHUB_OUTPUT (the CI cfg step, §4).

                      Exit codes as sync's (§3.3).


                      6. Versioning and compatibility

                      6.1 How an app pins frappe-nix

                      • flake.nix: frappe-nix.url = "github:Avunu/frappe-nix/release", unless the app pins another source with dev-shell.frappe-nix-url (§2.5).

                      • flake.lock records the commit, which is always a release tag commit for the default URL, because release only fast-forwards to tags.

                      • The caller workflows use @<that commit> # v<version>, which sync enforces (§3.7).

                      • The no-Nix jobs install frappe-nix-tools at the same commit (§4.1).

                      • An app with an org profile also locks standards-profile (S38), so its rendered files come from exactly one profile revision too.

                      The result is one frappe-nix version, and one profile revision, per app commit, everywhere.

                      6.2 How a release propagates

                      1. A frappe-nix PR merges to main. frappe-nix's release-please opens or updates its release PR. Its dispatch-ci dispatches check.yml (with vm-tests false) and pr-policy.yml on that PR. A person or the main agent merges it.

                      2. release-please tags vX.Y.Z. frappe-nix's release.yml fast-forwards release to the tag, whatever its major (REST; the release ruleset's only bypass is integration 15368).

                      3. frappe-nix's rollout.yml moves the apps FRAPPE_NIX_ROLLOUT_REPOS names (§5.8): for each one it updates the frappe-nix lock node, relocks and runs frappe-init --sync (which rewrites the caller SHAs and every changed managed file) with no token, verifies the patch, and opens chore(deps): frappe-nix vX.Y.Z on standards/frappe-nix with the App's token, with auto-merge on when the app's required checks protect its integration branch. Any other app is moved by hand (frappe-nix repo rollout --to vX.Y.Z, with the user's gh token). Until it is moved, each app's nightly drift job keeps an issue open and audit row A10 turns amber after 14 days.

                      4. Auto-merge happens once ci / * is green. If a stricter rule in the new version fails the app, the PR waits, and a person or agent pushes the fix to the PR branch.

                      Dependabot nix never moves frappe-nix or standards-profile (S5, S38). It moves frappe and the siblings at dependabot.cadence; deps.yml relocks those PRs with GITHUB_TOKEN, which works because they change no workflow file. An app without ci or dependabot simply runs nix flake update frappe-nix && frappe-init --sync when it wants a new release.

                      6.3 frappe-nix's own versioning (N6)

                      • Release. release-please-config.json:

                        • release-type: simple, which uses version.txt;

                        • include-v-in-tag: true and target-branch: main;

                        • extra-files: py/frappe_nix_tools/frappe_nix_tools/__init__.py (generic block) and py/frappe_nix_tools/pyproject.toml (type: toml, jsonpath: $.project.version).

                      • First release. The first release is v1.0.0, via Release-As: 1.0.0 in N6's commit.

                      • Commit types for dependabot in frappe-nix:

                        • fix(deps) for nix (nixpkgs, devenv, and the marketplace, pilot and semgrep-rules pins), for github-actions (the action SHAs inside the app-*.yml files), and for pre-commit, so each bump that changes what apps run ships as a patch release;

                        • chore(deps) for uv /dev and npm /docs-site.

                      • Semver contract:

                        • MAJOR: a removed or renamed reusable-workflow input, secret, output or job name; changed required-check contexts; a new [tool.frappe-nix] schema or profile schema; a removed or renamed module or module parameter; a changed meaning of an existing parameter value; a strategy change that can't be applied by --sync alone; a removed tool or CLI flag; turning a module on in minimal; any change to an already released recommended@<minor> snapshot other than one that accepts strictly more code (S42); or a change of the schema default of releases.branching, releases.version-scheme, releases.tag-prefix or integration-branch, which would move every repository's branches, tags and rulesets. A major moves release like any other release; an app keeps its pinned flake.lock until a rollout PR, gated by its checks, moves it (§5.8).

                        • MINOR: new managed content or checks that --sync applies, even if they make previously passing code fail (it then waits in the bump PR); a new module (off in both built-in profiles and every existing snapshot); a new recommended@<minor> snapshot, which may turn modules on or change defaults and which plain recommended then means; new parameters with defaults (a new parameter's default reproduces the old behaviour); new optional inputs with defaults; new tools or flags. An app on a pinned snapshot, or an org profile extending one, therefore sees only new checks of modules it already has on, never new modules or new defaults.

                        • PATCH: fixes and pin bumps.

                      • Compatibility guarantees within v1:

                        • app-*.yml at any v1.y accepts a caller rendered by any v1.x, because inputs are only ever added, with defaults;

                        • [tool.frappe-nix] schema = 1 keys, profile schema = 1 keys and module names are never removed;

                        • deprecated keys keep working for one minor and --check warns about them, with exit 0;

                        • minimal renders the same file set in every v1.x, and a released recommended@<minor> resolves to the same values in every later v1.x (§7 N3);

                        • an app that has not opted in is never touched by any v1.x (S35).

                      • Frappe major bump (v17). Set frappe-major = 17, run --sync (the flake inputs, ranges, package.json stanza and release branch all follow), and, under version-scheme = "frappe-major", land a Release-As: 17.0.0 commit. Keeping version-16 maintained alongside it is out of scope for v1 of this spec. Reserved key: [tool.frappe-nix] maintenance-branches.

                      6.4 Org profile versioning

                      • An org profile repository SHOULD release like frappe-nix: tags vX.Y.Z and a moving branch v<major> fast-forwarded to each tag. Apps then write profile = "github:<owner>/<repo>/v1", and the lock pins a tag commit. (A profile pinned to a branch that moves on every commit works, but every commit then becomes a rollout.)

                      • Its own semver: MAJOR for a change that makes frappe-nix profile validate or an app's --check fail without an app edit (a module turned on that needs app config, a stricter value); MINOR for new modules turned on or changed parameters that --sync applies; PATCH for org-value fixes (a URL, an e-mail).

                      • requires-frappe-nix (§8.1) declares the frappe-nix versions it is written for. Sync refuses a profile whose range excludes the running frappe-nix-tools (exit 3), so an app that moves frappe-nix past a profile's range must move the profile in the same PR.

                      • A frappe-nix MINOR never breaks an org profile that validated against an earlier v1.x: new keys get defaults and no key is removed (§6.3).

                      • P (Avunu) follows this; its CI validates profile.toml against the frappe-nix release named in its requires-frappe-nix lower bound and against the latest one, and compares the resolved configuration of the fixture app with the committed resolved.snapshot.json, so any frappe-nix release that would change an Avunu value fails P's CI before it can reach an app.

                      • P's release and protection. P's release.yml runs release-please on main (tags vX.Y.Z) and then moves v1 with a REST PATCH (force=false) to the tag commit, exactly as frappe-nix's N6 flow moves release. P's rulesets (repo-policy/ in P, applied with frappe-nix repo apply --policy-dir): main requires a PR and P's validate check; refs/heads/v* allows only GitHub Actions (integration 15368) to update, with no deletion and no force-push; refs/tags/v* forbids deletion and update. A push to v1 reaches every app only through a reviewed frappe-nix repo rollout --profile-to PR (S38), and these rules keep anything but the release workflow from moving v1.


                      7. Acceptance tests per PR

                      Each PR's own CI MUST prove these. A "nix check" is under tests/standards/ and runs in check.yml through standards-all. A "selftest" is the PR's own selftest-*.yml workflow, path-filtered to its files plus workflow_dispatch. Tests that need an org profile use the fictitious tests/fixtures/profiles/example-org (publisher "Example Org", example.org URLs, tile #336699), never Avunu's values. The cross-cutting tests 1.2 adds are marked [1.2]: default app mode unchanged without opt-in (N1, N2, N3), minimal renders nothing extra (N3), toggling a module off removes its files and jobs (N3, N4), no vendor strings in frappe-nix (N3a), and the review-round cases of Appendix R2.

                      N3a: hook points

                      • nix flake check --no-build passes, and nix build .#frappe-nix-tools builds against the locked nixpkgs (tomlkit 0.15.0) with pythonRuntimeDepsCheck on. frappe-nix --version prints 0.0.0, and frappe-nix nonexistent exits 2 listing the commands.

                      • Self-contained package: in a job with no frappe-nix checkout, uv tool install "frappe-nix-tools @ git+file://$PWD#subdirectory=py/frappe_nix_tools" from a clean clone, then frappe-nix data-path known-apps.json and frappe-nix data-path schema/tool-frappe-nix.schema.json print existing files. (N3 extends this to frappe-nix sync --check on the fixture.)

                      • .#checks.x86_64-linux.standards-all builds.

                      • Profiles: data/profiles/minimal.toml and recommended@1.0.toml are byte-identical to §8.5 (modulo the header comment) and validate against schema/profile.schema.json; every module named in §8.2 has a table in each; minimal enables only dev-shell; profile = "recommended" and "recommended@1.0" resolve identically, and "recommended@9.9" is exit 2. From N6's first release on, a nix check compares every released snapshot file with its content at the tag that introduced it (S42). A pytest of common/config.py covers the merge order of §8.4 (a value set in all three layers resolves to the app's; a table merges key by key; an array replaces), an app-only key in a profile (exit 2), a profile-only key in the app table (exit 2), an unmet module dependency (exit 2 naming both modules), and frappe-nix config modules.ssort printing the resolved boolean.

                      • [1.2] No vendor strings in frappe-nix (standards-vendor-neutral, S37): the check scans py/frappe_nix_tools/frappe_nix_tools/** (all code and data, excluding tests/ and fixtures), lib/**, repo-policy/repo-settings.json, repo-policy/rulesets/**, templates/app/**, and .github/workflows/app-*.yml and fleet-audit.yml, with the patterns in tests/standards/vendor-denylist.txt: case-insensitive avunu not followed by /frappe-nix, /frappe-runtime or /python-devops-nix, avu\.nu, #834AFF, Avunu LLC, mail@avu, carbon-theme and docusystem (the docs tool is reached only through profile values). Planted variants each fail naming the file and line: "author": "Avunu LLC" in a template, #834aff in recommended@1.0.toml, a REPLACE_PAIRS entry naming jailbreak with an avunu comment in lib/rename/, and registry-fork: { default: "Avunu/marketplace" } in app-release.yml. docs/**, tests/** and repo-policy/self/** are out of scope; docs show Avunu values only inside blocks introduced by "Avunu profile example" (a doc lint in N3a's docs check). The frappe-types dependency's source URL is allowed in docs (§2.9).

                      • Opt-in shell: the app-mode shell of an app without [tool.frappe-nix] has neither frappe-nix nor nixfmt/statix/deadnix on PATH and doesn't set blame.ignoreRevsFile; with the table, it has them (string assertion on lib/standards/shell.nix's output for both fixture pyprojects). [1.2] A third fixture pyproject that Nix's fromTOML rejects (a TOML datetime, released = 1979-05-27T07:32:00Z) and has no table evaluates the shell without error as not opted in; the same file with a [tool.frappe-nix] line is opted in; a line # [tool.frappe-nix] (a comment) is not.

                      • A test lib/scripts.d/ file and a test lib/standards/tools/ file (fixtures under tests/standards/fixtures/) are picked up by the loaders, proven by a nix eval check.

                      • The opted-in app-mode shell exposes frappe-nix and frappe-init, and the flake exposes apps.frappe-init. Proven with the fixture app's flake and --override-input frappe-nix path:..

                      • The docs stubs pass the existing docs workflow's check, and the docs index is titled "App standards and quality gates".

                      • [1.2] Naming (a pre-merge check, deliberately not committed, so the tree never has to contain the word it looks for): the reviewer or merging agent runs git grep -i -e "$TERM" over the tree (excluding nothing), git log -i --grep "$TERM" <base>..HEAD and a search of the PR title and body, with $TERM taken from Appendix N of the internal copy of this spec; all find nothing. frappe-nix MAY add a CI step to its own pr-policy.yml that reads the terms from the Actions secret FRAPPE_NIX_DENY_TERMS (newline-separated; secrets are masked in logs and absent on fork PRs, where the step is skipped), but no committed file names them.

                      N1: runtime

                      • Nix checks:

                        • Port offset: the primary checkout's offset is unchanged from today; in an opted-in app, a linked worktree (.git is a file) gets a different one; [1.2] in a non-opted-in app it keeps today's offset unless ports.worktreeSalt = true; FRAPPE_NIX_PORT_OFFSET=123 sets all of web, db and the three Mailpit ports from 123.

                        • coverage is importable from the generated root's dev env (python -c 'import coverage' over devPythonEnv).

                        • FRAPPE_NIX_CI=1 enterShell renders without the node-verify and node-modules calls (string assertion on the rendered enterShell).

                        • The generated bench root's dev group has coverage. [1.2] For an opted-in fixture whose tools/pyproject.toml lists ruff, semgrep and prek, the generated root has none of ruff, pre-commit or semgrep, also after ensure-root runs on a root that had them; with tools/pyproject.toml listing only ruff, only ruff is dropped. A non-opted-in app-mode root and an existing bench-mode root (fixture copies of templates/bench/pyproject.toml with the three entries) keep all three after ensure-root, byte-identical, and templates/bench/pyproject.toml still lists all three.

                      • selftest-runtime.yml on the fixture app:

                        • FRAPPE_NIX_CI=1 nix develop --override-input frappe-nix path:$GITHUB_WORKSPACE -c frappe-test --ci exits 0, and the log contains no Installing node_modules.

                        • coverage.json has no key containing /.frappe-nix/, and contains standards_fixture/api.py.

                        • A variant with fail_under = 100 exits 2, and a variant with fail_under 5 points below the measured total exits 2 with the raise … fail_under message.

                        • A variant with the exemption removed exits 3 and names standards_fixture.api.legacy.

                        • A variant whose extension class subclasses another app's extension (the A.0 #4 shape) exits 4.

                        • frappe-test-report.json validates against its schema.

                        • The default setup works with erpnext as a sibling (module:erpnext.tests.bootstrap_test_data), in a variant with the erpnext sibling.

                        • The fixture's after_request hook (T6) is a target and is reported tested; a variant whose module calls frappe.get_all at import time is probed without crashing, and a variant whose module raises on import reports that target untested with the error.

                        • A variant with shell-checks = ["touch stray.txt"] exits 7 and names the untracked file.

                        • Module switches: a variant with [tool.frappe-nix.tests] enable = false runs frappe-test --ci without starting the bench (no process-compose socket appears) and reports stages 1–6 as skipped; a variant with python-types off reports stage 7 skipped; a variant with tests.coverage.target = 60 and fail_under = 55 passes the upward ratchet when the total is 59, and fails it at 57 with raise-margin = 2 turned to the message naming 60 as the cap.

                      • frappe-rename-app:

                        • On a scratch site, the fixture renamed to standards_fixture2 migrates cleanly. Data, the Patch Log and the Scheduled Job Type name and stopped values are kept.

                        • A second run prints nothing to do.

                        • code --dry-run shows the expected diff.

                        • On tests/fixtures/rename-esign, code --from esign --to esign_webforms renames esign.desk.bundle.js and esign.control.bundle.js to esign_webforms.*, and every app_include_js entry in the rewritten hooks.py names an existing file. A bare esign.<x> string with no matching file is left alone and reported.

                        • code --from jailbreak --to data_steward --fleet <fixture fleet with that replace entry> exits 1 (replace pair); in a fixture app synced with a profile whose [[replace-apps]] has the pair, it exits 1 without --fleet; in a non-opted-in fixture without --fleet, --profile or --no-replace-check it exits 2 and changes nothing. The replacedApps NixOS check installs a stand-in new app, uninstalls the old one inside the snapshot, and is a no-op on a second run.

                      • Docs: docs/development/README.md:36 and docs/reference/dev-shell-options.md:12 no longer claim the allocator walks forward.

                      N2: assets

                      • Nix check tests/esbuild-preload.js, extended:

                        • a fixture app's public/dist/.vite/manifest.json with js/foo.bundle.AbC123.js and css/foo.bundle.XyZ.css registers foo.bundle.js and foo.bundle.css in assets.json under /assets/<app>/dist/…;

                        • a non-matching index-AbC.js is ignored;

                        • registration happens without FRAPPE_NIX_KEEP_GOING;

                        • frappe's own keys aren't touched.

                      • Nix check: the node-targets fixture with a top-level docs-site/package.json yields no docs-site target, in either the Nix discovery or node-locks.sh, when excludeNodeTargets = [ "docs-site" ]; [1.2] with the default [] it yields one, exactly as on main.

                      • Nix check: tests/fixtures/spa-app/, whose build script writes a hashed bundle and a manifest with no network, built as a builtBench, has assets.json mapping spa.bundle.js to the hashed file.

                      • Stock bench (no preload). In selftest-assets.yml (N2): a plain frappe bench made with bench init from the pinned frappe, no NODE_OPTIONS, bench get-app of the spa-app fixture, bench build --app spa_app; sites/assets/assets.json maps spa.bundle.js and spa.bundle.css to the hashed files. A second bench build under frappe-nix's preload leaves assets.json byte-identical (idempotent). With --hard-link, sites/assets/spa_app/dist/ contains the hashed bundle.

                      • Nix check: lib/js/vite-register.cjs and the packaged scripts/vite-register.mjs template contain the same function body (a string comparison after stripping the entry point).

                      N3: scaffold

                      • [1.2] Default app mode unchanged without opt-in (nix check standards-optin):

                        • templates/app/ is byte-identical to frappe-nix main at 9e63c96 (flake.nix, .envrc, .gitignore);

                        • frappe-init --app --version version-16 in a fixture app without [tool.frappe-nix] writes exactly flake.nix, .envrc and .gitignore, byte-identical to what main's frappe-init writes for the same app, and leaves pyproject.toml untouched;

                        • frappe-init --sync and --check on that app exit 2 with the opt-in hint and write nothing (git status --porcelain empty).

                      • [1.2] minimal renders nothing extra: frappe-init --sync --standards minimal on the same app (offline) changes exactly flake.nix, .envrc, the .gitignore block and pyproject.toml (the new [tool.frappe-nix] table, two keys plus schema; no other key of pyproject.toml changes), plus flake.lock; --check then exits 0. The manifest's live entries for minimal are exactly the three dev-shell paths (plus node-lock seeds when siblings exist).

                      • [1.2] Toggling a module off removes its files (nix check standards-toggle), on a fixture synced with recommended:

                        • setting [tool.frappe-nix.js] tool = "none" and re-syncing deletes .oxlintrc.json and .oxfmtrc.jsonc, removes the oxfmt/oxlint hooks, the format, format:check, lint and check scripts (each still equal to its rendered value) and the oxlint/oxfmt devDependencies, and --check exits 0;

                        • setting [tool.frappe-nix.ci] enable = false deletes every .github/workflows/*.yml sync rendered and leaves an app-owned .github/workflows/custom.yml; dependabot.yml stays (its module is separate);

                        • setting [tool.frappe-nix.typescript] enable = false removes the typecheck caller job from ci.yml (the other jobs are byte-identical) and deletes every tsconfig*.json sync wrote;

                        • turning a module off whose file has a non-empty local region (.pre-commit-config.yaml with content in repos, after turning off every hook module) exits 2 naming the region and deletes nothing;

                        • a managed pyproject.toml key the app changed ([tool.ruff] line-length = 120) is left in place with a warning when python-lint turns off;

                        • turning the module back on restores the files byte-identically;

                        • [1.2] js off keeps the adopter's scripts: with js.tool = "none", stylelint on and an existing "lint": "eslint . && stylelint 'x/**/*.scss'" and "check": "yarn lint && vitest", sync leaves lint and check untouched, writes lint:css, deletes no .eslintrc*, and --check exits 0;

                        • [1.2] third-party formatter: with js.tool = "none", reformatting the rendered .pre-commit-config.yaml, .github/dependabot.yml, ci.yml and release-please-config.json with prettier's defaults (2-space, quote and wrap changes) gives --check exit 0 and a following --sync writes nothing; changing a value in any of them is still exit 1;

                        • [1.2] metadata parameters: with metadata.build-backend = "any", package-type = "" and package-manager = "", a setuptools [build-system], a [tool.poetry] table, requirements.txt, MANIFEST.in, "type": "commonjs" and "packageManager": "pnpm@9" all survive sync and --check exits 0, while typescript, js and releases stay on;

                        • [1.2] retire rules by function: with ci on and releases off, a tracked .github/workflows/release.yml containing release-please-action survives; with dependabot off, one containing dependabot/fetch-metadata survives; a tracked .github/workflows/check.yml survives under recommended and is retired under the example-org profile's [[retire]] entry; a path in retire-keep survives every rule;

                        • [1.2] the app's own flake: on first opt-in, a fixture flake.nix with an extra input and an x86_64-linux-only systems exits 2 with the diff and writes nothing; with --force it is replaced; content in the inputs and envrc local regions survives later syncs; a local input named frappe is exit 2; dev-shell.systems = ["x86_64-linux"] renders one system; dev-shell.frappe-nix-url = "github:Avunu/frappe-nix/v1.0.0" is locked once and not re-locked by a second sync;

                        • [1.2] siblings off the Frappe convention: an object-form sibling { repo = "example/shared_lib", branch = "main", range = ">=2.0.0,<3.0.0" } renders github:example/shared_lib/main and that range, and C3, C4 and L3 pass with original.ref = "main";

                        • [1.2] TypeScript preset: typescript.preset = "inline" renders tsconfig.base.json without extends, no frappe-types devDependency and no frappe-types/* types, tsc --build passes on the fixture's browser project, and check-js = true with it is exit 2.

                      • Profiles (nix check standards-profiles):

                        • recommended renders the file set §8.5 lists for the fixture, and --check exits 0;

                        • the example-org fixture, used with --profile-path, renders its org values: package.json author, the README license block, L2's expected publisher; its template override of readme/support.md.j2 is used; its [[extra-files]] entry (SECURITY.md, module hygiene) is rendered, and deleted when hygiene is turned off;

                        • an override of a non-overridable template (.github/workflows/ci.yml.j2) is exit 2;

                        • readme on with an empty org.license is exit 2 naming org.license; releases on with commits off is exit 2 naming both;

                        • profile = "github:example/profile" adds the standards-profile input to flake.nix (phase A, with FRAPPE_NIX_URL_OVERRIDE-style override for the test) and the dependabot nix ignore entry; switching back to "recommended" removes both;

                        • --check in a no-Nix job reads the org profile through pin-path standards-profile, and a tampered tree fails its narHash with exit 3;

                        • a profile with requires-frappe-nix = ">=9" is exit 3;

                        • frappe-nix profile validate tests/fixtures/profiles/example-org/profile.toml exits 0, and exits 2 on a copy with an unknown module;

                        • main+tags: with releases.branching = "main+tags", every rendered target-branch, branches: trigger and integration-branch input is main, release.yml passes release-branch: "", and the README installation block names v<__version__> inside the release-please version markers, with README.md in extra-files;

                        • [1.2] integration branch: integration-branch = "trunk" with releases off renders trunk in every target-branch, trigger and input; --standards on a fixture whose origin/HEAD is master writes integration-branch = "master";

                        • [1.2] snapshots: a fixture pinned to recommended@1.0 resolves identically under a test copy of the package that adds a recommended@1.1 snapshot turning ssort on, while a fixture on plain recommended turns it on and sync prints the changed-defaults warning naming ssort.enable;

                        • [1.2] in-repo profile: profile = "./.standards-profile" (a tracked directory with profile.toml extending recommended and a templates/readme/support.md.j2 override) renders its org values and override with no standards-profile flake input, and --check in a no-Nix job reads it from the checkout;

                        • [1.2] other hosts: a profile gitlab:example/profile and an object-form sibling with flake-url = "git+https://git.example.org/libs/shared_lib?ref=main" render the expected flake inputs; pin-path fetches both from a local test server (GitLab archive API and smart-HTTP git) and verifies their narHash; with the server requiring a bearer token, the fetch fails with exit 3 and the FRAPPE_NIX_FETCH_TOKEN hint, and passes with the variable set.

                      • Nix check standards-manifest: every manifest entry names a module that exists; every cfg/org key a template reads is in its uses; every uses key exists in the profile schema.

                      • Nix check standards-sync, on a copy of the fixture app (synced with the example-org profile, which turns every module on):

                        • --sync, then --check, exits 0;

                        • a second --sync changes no bytes;

                        • editing a managed file gives --check exit 1 with the diff;

                        • content in a local region survives --sync;

                        • an app-owned pyproject key (extend-exclude) and app-owned package.json scripts survive;

                        • adding ignore = ["F401"] gives exit 2;

                        • raising the pre-commit ssort rev to 0.18.0, the oxlint range to ^1.99.0 and the ruff lock to 0.17.0 is accepted, while lowering any of them gives exit 1;

                        • a malformed local region gives exit 2;

                        • the __init__.py trailing-comment form is converted to the block form with the value kept;

                        • adding a first .ts file under scripts/ makes --check report the missing tsconfig.scripts.json;

                        • a tracked .github/workflows/old.yml containing release-please-action, a .oxfmtrc.json and an update-assets.mjs are each reported as legacy file by --check and deleted by --sync;

                        • with an SPA entry whose tsconfig is tsconfig.json, the solution is rendered as tsconfig.solution.json, the app's tsconfig.json is untouched, and scripts.typecheck is tsc --build tsconfig.solution.json && vue-tsc …; with typescript.browser = false no browser project exists;

                        • a web-include glob moves a file from tsconfig.desk.json and the oxlint desk override to tsconfig.web.json and the web override;

                        • an unchecked-js entry appears in the desk exclude; one naming an untracked file is C9 exit 1; typescript.exclude naming a tracked .js under the package is exit 2;

                        • a generated glob appears in the prek exclude, the validate_copyright exclude and the oxfmt and oxlint ignorePatterns, and prek run validate_copyright --all-files followed by --check exits 0 (no stamp/sync fight on marketplace/shots.d.ts);

                        • a fixture with package.json 1.0.0 and __version__ = "0.0.1" and no manifest gets package.json 0.0.1 and manifest 0.0.1 on its first sync, and C5 passes;

                        • the README license block renders identically with the system clock set to 31 December and to 1 January.

                      • Nix check: no path appears in two manifest fragments; every template renders for the fixture contexts {plain, erpnext+hrms siblings, scss, nested frontend, SPA at root, SPA in portal/ without package.json, docs-site, pilot-assets, Vite} × {minimal, recommended, example-org}.

                      • Nix check: frappe-init --app --standards recommended in a fixture produces templates/app/'s three files, then what frappe-nix sync --write renders for recommended, and nothing else.

                      • selftest-scaffold.yml, on the rendered fixture:

                        • nixfmt --check flake.nix, oxfmt --check, ruff format --check, actionlint, zizmor and uv lock --check --project tools all pass;

                        • after yarn install, prek run --all-files passes; this needs the network for the remote hooks;

                        • tsc --build passes against the published frappe-types 16.5.0 (on npm since 2026-10-07);

                        • nix flake lock && nix eval .#packages.x86_64-linux.default.drvPath succeeds;

                        • frappe-init --check on a read-only clone of carbon_frappe (which has no [tool.frappe-nix] at its pinned commit) exits 2 with the opt-in hint and no crash; with --standards given through a temporary copy that adds [tool.frappe-nix] profile = "recommended", it reports drift and no crash.

                        • Bootstrap: on a copy of the fixture with no flake.nix and no flake.lock (the postgrid and jwt_auth shape), and on one whose lock pins frappe-nix main (the carbon, taskview and timeclock shape), one frappe-init --sync --standards recommended --version version-16 run with FRAPPE_NIX_URL_OVERRIDE=path:$GITHUB_WORKSPACE FRAPPE_NIX_ALLOW_SKEW=1 and without yarn or uv on PATH leaves a tree on which --check exits 0 immediately: phase A locked, phase B re-entered the dev shell, yarn.lock and tools/uv.lock exist.

                        • No-Nix install: uv tool install "frappe-nix-tools @ git+file://…#subdirectory=py/frappe_nix_tools" in a job without the frappe-nix checkout on disk, then frappe-nix sync --check on the rendered fixture, exits 0 (FRAPPE_NIX_ALLOW_SKEW=1).

                      • Nix check: with the erpnext and hrms siblings, node-lock seeding writes nix/node-locks/{frappe/ui,erpnext/banking,hrms/frontend,hrms/roster} into an empty fixture and leaves existing ones alone.

                      N4: CI

                      • actionlint and zizmor (strict hash-pin) pass on frappe-nix's .github/workflows/*.yml, on every rendered caller for the fixture under recommended, example-org (everything on) and a gate matrix (each of typescript, tests, listing, commits, releases, dependabot off in turn), and on the rendered .github/dependabot.yml (every entry has a cooldown). A planted dependabot entry without cooldown makes the zizmor hook fail. actionlint accepts per-job defaults.run.working-directory: ${{ inputs.app-root }} and finds no job-level if: reading secrets.

                      • [1.2] Callers contain only enabled gates: with every gate on, ci.yml has the jobs lint, typecheck, test, marketplace, each name: ci; turning typescript off removes exactly the typecheck job; turning listing off removes marketplace; commits off removes pr-policy.yml; releases off removes release.yml; dependabot off removes deps.yml and dependabot.yml. The unit test compares each rendered file against its all-on form with the job's block removed.

                      • Required checks follow the gates: frappe-nix repo apply --dry-run against a mocked API renders integration.json with exactly the contexts of the app's enabled gates (ci / lint and ci / test for a fixture with only those on; all five with everything on), required_approving_review_count from repo-policy.required-approvals, and no release-branch.json under main+tags; for an app with repo-policy.enable = false it makes no API call and exits 0 with a notice.

                      • docs-site compatibility: on the rendered fixture with docs-site/ and the docs-compat fixture profile, whose docs-site values are the ones the Avunu profile had until its documentation moved to Avunu/site-docs (action-patterns = ["Avunu/docusystem*"], cooldown-exclude-actions = ["Avunu/docusystem"], package-names = ["@avunu/docusystem"]; the docs tool's own identifiers, not org values), docusystem doctor reports no dependabot warning and docusystem upgrade --dry-run plans no change to .github/dependabot.yml. A variant whose cooldown exclude is the glob Avunu/docusystem* makes doctor warn, which proves the test sees the difference.

                      • Python tests (py/frappe_nix_tools/tests, run as a nix check with pytest):

                        • policy: under frappe-major, rejects feat!: x, a BREAKING CHANGE: footer, and Release-As: 17.0.0 when the major is 16; accepts chore(deps): bump … and chore(develop): release 16.1.0; under semver accepts feat!: x; with main+tags, a PR based on develop fails check 1 naming main; [1.2] a PR based on another open PR's head passes check 1 with allow-stacked = true and fails with false; a PR based on version-16 passes with pr-allowed-bases = ["version-*"];

                        • ratchet: R1–R7 positive and negative cases, inactive when the base lacks [tool.frappe-nix], and each rule skipped when its module is off;

                        • minibench: the layout guard;

                        • ruleset and settings JSON: validated against a vendored schema of GitHub's ruleset API;

                        • apply: --dry-run produces no PUTs for an already-matching mocked API; --phase full on a fleet entry with private: true exits 1; --all without --fleet exits 2; [1.2] on a private repo without a fleet entry, a mocked 201 from the rulesets API applies them and a mocked 403 fails that repo with the plan message; a not-yet-opted-in fleet entry (no [tool.frappe-nix] on its default branch main) with the fleet's profile set gets the settings, labels and integration-provisional.json for develop with --phase provisional --rename-default-branch (the mocked rename call is made first), and --phase full on it exits 2; --policy-dir reads a P-style directory with a refs/heads/v* release ruleset;

                        • auto-merge decisions: recorded fetch-metadata v3 outputs for each ecosystem row (github_actions with the docs-actions, pilot and actions groups, npm_and_yarn, uv, pre_commit, nix, submodules) give the table's verdicts, and a nix PR never gets --auto from the auto-merge job when relock has a patch; [1.2] with a mocked branch-rules response that lacks a required_status_checks rule, or a mocked gh pr merge --auto failure "auto-merge is not allowed", the verdict auto becomes the needs-review label and a notice, with exit 0; the label is created first when missing;

                        • [1.2] release guard under semver: the fast-forward step in --dry-run with branching = "develop+version", version-scheme = "semver", version-16 and release-please's tag_name = "v1.3.0" passes the guard (and fails it when the ref read back differs from v1.3.0); under frappe-major a tag_name of v1.3.0 fails it; audit rows A2 and A11 are green on a mocked repo with only v1.* tags under semver;

                        • [1.2] gate commands: frappe-nix gate lint, gate typecheck and gate marketplace run on the fixture outside GitHub Actions (no GITHUB_* variables) with the same results as the workflows, and each step of a module that is off is reported skipped;

                        • [1.2] doctor: against mocked API responses, frappe-nix repo doctor reports missing for disabled auto-merge with dependabot.auto-merge on and for disallowed Actions PR creation with releases on, unknown for settings needing admin, and exit 0 when everything is ok;

                        • relock patch: a fixture where sync writes a new untracked nix/node-locks/x/yarn.lock and stages a change produces a patch that git apply --index reproduces exactly; a patch touching .github/workflows/ is refused.

                        • nightly script: with a stubbed frappe-test that exits 1 and a suite that exits 0, nightly.sh exits non-zero; with all stubs passing it exits 0;

                        • relock-plan: a PR moving the standards-profile lock node is reported rollout-input-moved, like one moving frappe-nix.

                        • relock-doctypes: with types/doctypes.d.ts tracked, it runs the gate's doctypes mini-bench and gen-registry command without --check, after which gate typecheck passes the doctypes step; without the file it prints doctypes=false without loading the profile, and with typescript off likewise; --probe runs nothing; a failing gen-registry that wrote part of the file exits 1 with the committed file restored; a ConfigError exits 2 with the file untouched. standards-ci-workflows asserts that app-deps.yml's relock-plan keeps contents: read, restores the node_modules cache without ever saving it, marks each doctypes step continue-on-error, and runs them all before relock-patch.

                      • [1.2] schedules: with ci.schedules = { ci = "", release = "", deps-sweep = "", deps-relock = "", nightly = "" }, ci.yml, release.yml and deps.yml render without a schedule: key, nightly.yml keeps only workflow_dispatch, deps.yml passes relock-cron: "", and actionlint and zizmor still pass.

                      • GitHub App (ci.github-app): unset, no caller passes APP_ID or APP_PRIVATE_KEY; set in the app or the profile, release.yml, deps.yml and (with screenshots on) nightly.yml pass exactly APP_ID: ${{ vars.<app-id> || secrets.<app-id> }} and APP_PRIVATE_KEY: ${{ secrets.<private-key> }}, nothing else in any file moves, and no caller uses secrets: inherit; a missing private-key, a value that is not a variable name (an ID, a PEM, an expression) or an unknown key is exit 2 (test_ci_callers.py). The github-app case of the fixture matrix passes actionlint and zizmor.

                      • selftest-ci.yml:

                        • calls ./.github/workflows/app-lint.yml, app-typecheck.yml and app-marketplace.yml with app-root: tests/fixtures/standards-app and frappe-nix-override: . (which allows skew, §3.7) from caller jobs with name: ci, and app-test.yml only on schedule (weekly) and workflow_dispatch; lint, typecheck and marketplace succeed on every PR touching .github/, py/frappe_nix_tools/ or templates/;

                        • [1.2] context names: a step queries the run's check runs and asserts the names ci / lint, ci / typecheck and ci / marketplace (S39); if it fails, N4 ships the §4.2 fallback instead;

                        • on a dispatch, every gate job's dispatch guard succeeds (it has pull-requests: read), and app-pr-policy.yml passes with no PR found;

                        • in the minibench job, a planted owner: someone@example.com in a fixture custom/*.json makes validate_customizations fail.

                      • frappe-nix repo audit --repo <a public repo synced with the fixture profile> --format json runs end to end with GITHUB_TOKEN, where rows needing admin are unknown, and produces all 17 rows; rows of modules the app has off are n/a.

                      • Reusable fleet-audit.yml: actionlint and zizmor pass on it, and it has no schedule trigger (only workflow_call).

                      • Spike (recorded, not gating): on a scratch repo, whether GITHUB_TOKEN can land a workflow-file change through the Git Data API (§4.5). The result goes into docs/app-standards/github.md.

                      N5: product tools

                      • frappe-listing:

                        • check --no-getapp passes on the fixture with the example-org profile;

                        • org values: L2 expects app_publisher == "Example Org" from that profile; with org.publisher empty it only requires a non-empty app_publisher; L12 is skipped with empty URL templates; registry --dry-run uses <listing.registry-fork> and the branch <fork owner>/<app>, and exits 2 when the fork is empty;

                        • negative fixtures each fail with their rule id: the tagline is 85 characters (L1); the -dev range (L3); frappe in required_apps (L3); __version__ with a trailing comment (L4); a print in __init__ (L5); an override with no allow-list entry (L6); a stale baseline entry (L7); three identical findings against a baseline count of 2 (L7, new finding) and one against a count of 2 (L7, stale count).

                      • selftest-product.yml:

                        • check with L9 passes on the fixture with the pinned pilot, on ubuntu-latest with only the marketplace job's apt packages added, and a cold run takes under 25 minutes;

                        • registry --dry-run --onboard produces an apps/<app>.json entry byte-identical to running the pinned tools/add_release.py directly.

                      • frappe-icon:

                        • check passes on the good fixture pair rendered with org.brand.tile-color = "#336699", and fails one by one on the bad fixtures: <text>, a non-square viewBox, a stroke, outside the safe area, a stale tile, and a tile whose fill is not the profile colour; with the colour empty, icon check exits 2 naming org.brand.tile-color;

                        • build output hashes are stable across two runs.

                      • frappe-demo: run twice on one site, a record count per doctype is unchanged the second time; with erpnext installed, the company is demo.company-name.

                      • frappe-shots:

                        • two runs from two fresh sites in the same job are pixel-identical (maxDiffRatio 0);

                        • --check against the committed fixture shots exits 0;

                        • a 1-pixel CSS change in a variant exits 1 and writes a diff PNG.

                      • readme --check passes on the fixture, and removing a marker exits 2. [1.2] With org.repo-url = "https://git.example.org/{repo}" the installation line uses that host; under main+tags it names v<__version__>, and after npx release-please release-pr --dry-run bumps __version__ and README.md together, readme --check still passes. The rendered license block names org.copyright-holder and org.license, and the development block links org.dev-docs-url (the built-in default when the profile leaves it unset). With org.docs-url set the header has the documentation badge after the Frappe badge and the support block starts with the documentation line, both linking the URL the listing seed's documentation names; with it empty neither is rendered.

                      N6: frappe-nix self-release

                      • npx release-please release-pr --dry-run --repo-url Avunu/frappe-nix --target-branch main proposes 1.0.0 from Release-As, and bumps version.txt and both frappe-nix-tools version locations.

                      • Every uses: in frappe-nix's own workflows is SHA-pinned (zizmor).

                      • .github/workflows/pr-policy.yml has one non-reusable job named pr-policy (committed plus the no-! rule, --major-free) that installs frappe-nix-tools from the checkout, fails a feat!: title in a test PR, and re-runs on a retitle without re-running check.yml.

                      • A workflow_dispatch of check.yml without inputs (what the release flow does) skips vm-tests; with vm-tests: true it runs it.

                      • The release fast-forward step is exercised in --dry-run mode, printing the REST calls.

                      • repo-policy/self/rulesets/*.json pass the N4 schema test.


                      8. Profiles

                      A profile decides which modules an opted-in app gets and with which parameters, and supplies the organisation's values (S34, S37). This section is the contract for profile files, for how an app selects one, and for how the layers merge. Every module, parameter and org value named in §2–§5 is defined here.

                      8.1 The profile file

                      A profile is one TOML file. A built-in profile is frappe_nix_tools/data/profiles/<name>.toml. An org profile is profile.toml at the root of its own repository, optionally with templates/ beside it. The schema is frappe_nix_tools/data/schema/profile.schema.json (N3a; N3 extends it). Unknown keys are exit 2.

                      schema = 1                                  # required
                      name = "example-org"                        # required; ^[a-z0-9][a-z0-9-]*$
                      description = "Example Org's app standards" # optional
                      extends = "recommended@1.0"                 # org profiles only, required there: "minimal", "recommended" or a
                                                                  # frozen snapshot "recommended@<minor>" (S42; recommended for org
                                                                  # profiles). Built-in profiles have no `extends`. Chains are not allowed.
                      requires-frappe-nix = ">=1.2,<2"            # optional; PEP 440 specifier against frappe_nix_tools.__version__ (§6.4)
                      
                      [org]                                       # organisation values (S37). Every string defaults to "" (unset).
                      publisher = ""                              # hooks.app_publisher (L2), package.json author (§2.8)
                      email = ""                                  # hooks.app_email (L2), README support block (§2.19)
                      copyright-holder = ""                       # README licence line; "" means: use publisher
                      license = ""                                # SPDX id: package.json license, hooks.app_license, README licence line
                      github-owner = ""                           # default owner for `repo` when origin is unset (§2.2)
                      website-url = ""                            # template with {app}, {app_hyphen}: listing website and L12 (§2.21)
                      docs-url = ""                               # template with {app}, {app_hyphen}: listing documentation, L12 and the README docs link
                      dev-docs-url = "https://github.com/Avunu/frappe-nix/tree/main/docs/app-standards"   # README development link (S26)
                      support-url = ""                            # README support link; "" means: https://github.com/<repo>/issues
                      repo-url = "https://github.com/{repo}"      # template with {repo}: the clone URL in README installation (§2.19)
                      
                      [org.brand]
                      tile-color = ""                             # "#RRGGBB"; the icon tile fill (§5.3); required by `icons`
                      glyph-color = "#FFFFFF"                     # the icon tile glyph
                      palette = {}                                # name → "#RRGGBB"; passed to templates as org.brand.palette, for overrides
                      
                      [[org.readme.badges]]                       # optional; extra README header badges, in order (§2.19)
                      label = "Docs"
                      image = "https://img.shields.io/badge/docs-online-blue"
                      link = "https://docs.example.org/"
                      
                      [[org.readme.links]]                        # optional; extra links in the README support block
                      label = "Community forum"
                      url = "https://forum.example.org/"
                      
                      [known-apps."example/shared_lib"]           # optional; sibling templates added to or overriding known-apps.json
                      repo = "example/shared_lib"
                      branch = "version-{n}"
                      range = ">={n}.0.0,<{n1}.0.0"
                      desk_global = "shared_lib"
                      
                      [<module>]                                  # one table per module (§8.2): `enable` plus its parameters
                      enable = true
                      
                      [[retire]]                                  # optional; retire rules added to the built-in ones (§2.4.1)
                      paths = [".github/workflows/check.yml"]     # globs over tracked files
                      contains = []                               # optional; regexes, any of which the file's text must match
                      module = "ci"                               # applies only while this module is on
                      
                      [[replace-apps]]                            # optional; app pairs frappe-rename-app must replace, not rename (§5.10)
                      from = "old_app"
                      to = "new_app"
                      
                      [[extra-files]]                             # optional; files the org adds to every app that uses the profile
                      path = "SECURITY.md"                        # must not be a path any manifest fragment manages (exit 2)
                                                                  # nor be absolute, use .., or enter .git/, .direnv/, .frappe-nix/, .venv/ or node_modules/ (exit 2)
                      template = "SECURITY.md.j2"                 # under the profile's templates/
                      strategy = "seed"                           # "whole" (managed, with header) or "seed" (written once)
                      module = "hygiene"                          # live only while this module is on
                      when = "True"                               # optional; a Python expression over the context (§2.4)
                      header = "none"                             # for whole: the §3.6 header kind

                      Template overrides. A file templates/<template path> in the org profile's directory (its repository, or the in-repo profile directory, §8.3) replaces the built-in template with the same path, for manifest entries marked overridable: true only:

                      • the README block templates readme/<block>.md.j2 (§2.19);

                      • the listing seed marketplace/listing.toml.j2 (§2.21);

                      • the repo policy JSON repo-policy/repo-settings.json and repo-policy/rulesets/*.json (§4.8, §4.9), read by frappe-nix repo apply.

                      An override gets the same context (§2.3) and the same StrictUndefined rules. Everything else (tool configs, merged keys, caller workflows) is a contract with a reusable workflow or a check, so it changes through parameters, never through an override; an override of any other path is exit 2. A managed file rendered from an override keeps frappe-nix's header.

                      App-only and profile-only keys. The app keys of §2.1 (top-level [tool.frappe-nix] keys and the [[…]] lists) and the app-only module parameters (typescript.browser, browser-include, web-include, paths, exclude, spa; tests.setup, devguard-disable; releases.bootstrap-sha; listing.approved; js.oxlint.ignore, globals, overrides; js.oxfmt.ignore; stylelint.globs) are refused in a profile (exit 2). schema, name, description, extends, requires-frappe-nix, retire, replace-apps and extra-files are refused in [tool.frappe-nix]; a single app that needs them uses an in-repo profile (§8.3). [known-apps] is allowed in both: the app's [tool.frappe-nix.known-apps] is the last layer, so an app without an org profile can describe a sibling that doesn't follow the Frappe convention.

                      8.2 Modules

                      Every module has enable (boolean). A module is effectively on when its own enable is true and every module in its "Needs" column is on; a module whose needs aren't met while its own enable is true is exit 2 naming both, never switched off silently (S36). Modules marked "CI only" act only inside CI jobs; without ci they have no effect, which is not an error. For a module with a tool parameter, tool = "none" is the same as enable = false.

                      ModuleWhat it controlsParameters (type, recommended value)NeedsminimalrecommendedAvunu
                      dev-shellflake.nix, .envrc, the .gitignore block, node-lock seeds (§2.5, §2.6)app-only: systems (list, the four systems); extra-substituters, extra-trusted-public-keys (lists, []); frappe-nix-url (string, "")—on (required: enable = false is exit 2)onon
                      editorconfig.editorconfig (§2.7)indent ("tab"|"space", "tab"); line-length (int, 110)—offonon
                      metadatapyproject.toml build system, requires-python, frappe-dependencies; package.json base keys; C2–C4, C6; the override allow-listbuild-backend ("flit"|"any", "flit"); package-type ("module"|"", "module"); package-manager (string|"", "yarn@1.22.22"); node-engine (string|"", ">=24"). "any"/"" leaves that key app-owned (§2.8, §2.12)—offonon
                      python-lintruff hooks, [tool.ruff*], lint:py (§2.12, §2.14)tool ("ruff"|"none", "ruff"); select (list, carbon's 12 codes, S27); ignore (list, ["E501","W191"]); line-length (int, 110); indent-style ("tab"|"space", "tab"); quote-style ("double"|"single", "double"); typing-modules (list, ["frappe.types.DF"])—offonon
                      ssortthe ssort hook (S2)none—offoffon
                      python-typesty: [tool.ty*], typecheck:py, frappe-test stage 7, R2tool ("ty"|"none", "ty"); error-on-warning (bool, false)—offonon (error-on-warning = true)
                      jsoxlint and oxfmt: configs, hooks, format/lint scripts, devDependencies (§2.10)tool ("oxc"|"none", "oxc"); locked-rules (bool, true); format-width (int, 110); format-tabs (bool, true); format-tab-width (int, 2); oxlint.categories (table, {correctness="error", suspicious="error", perf="warn", pedantic="off"})—offonon
                      typescripttsconfig*.json, typecheck script and job, C7, C9 (§2.9)preset ("frappe-types"|"inline", "frappe-types"); strict-extras (bool, true); check-js (bool, false); audit-consumer (bool, false)—offonon (check-js = true)
                      stylelint.stylelintrc.json, its hook and lint:css script, when SCSS exists (§2.11)none—offonon
                      testsfrappe-test gate (ci / test), coverage tables, testmap, composition, JS unit tests, R1/R4/R7 (§5.1)coverage.enable (bool, true); coverage.target (number, 80); coverage.raise-margin (number, 2.0; 0 turns the upward ratchet off); coverage.initial-floor (number, 0); testmap (bool, true); composition (bool, true); js-unit (bool, true); js-coverage-min (int, 50)—offonon
                      semgrepthe semgrep scans in lint (§4.2); CI onlyfrappe-rules (bool, true); test-correctness (bool, true)—offonon
                      workflow-lintzizmor and actionlint hooks, .github/zizmor.yml (§2.18)release-tag-workflows (list of zizmor policy keys, [])—offonon
                      shell-lintthe shellcheck hooknone—offonon
                      nix-lintfrappe-test stage 8; nixfmt, statix, deadnix in the shellnone—offonon
                      hygienepre-commit-hooks basics, .git-blame-ignore-revs (§2.20)max-file-kb (int, 1024)—offonon
                      commitscommitted.toml, commit-msg hooks, pr-policy (§2.15, §4.3)tool ("committed", "committed"); allowed-types (list, frappe's commitlint types); subject-length (int, 100); allow-stacked (bool, true); pr-allowed-bases (list of globs, []) (§5.9)—offonon (allow-stacked = false)
                      releasesrelease-please config and manifest, the version block, release.yml, C1, C5 (§2.13, §2.16, §4.4)tool ("release-please"|"none", "release-please"); branching ("develop+version"|"main+tags", "develop+version"); version-scheme ("semver"|"frappe-major", "semver"); tag-prefix ("v"|"", "v")commitsoffonon (version-scheme = "frappe-major")
                      dependabot.github/dependabot.yml, deps.yml (§2.17, §4.5)cadence ("daily"|"weekly"|"monthly", "weekly"); cadence-overrides (table ecosystem → cadence, {}); cooldown-days (int, default 7; recommended@1.0 sets 3); ignore (table ecosystem or <ecosystem>:<directory> → list of Dependabot ignore conditions, {}; §2.17); auto-merge (bool, true; acts only where required checks protect the integration branch, §4.5); auto-merge-policy ("decision-table"|"all", "decision-table"; S44); update-branches (bool, false; S44); ecosystems (table of bools: github-actions, npm, uv, pre-commit, nix, gitsubmodule; all true)—offonon (cadence = "daily", overrides below)
                      cithe caller workflows (§4.7) and so every gate jobprovider ("github", "github"; other values reserved); nightly (bool, true); test-timeout-minutes (int, 75); runs-on (a runner label or a list of labels, unset: the reusable workflows' ubuntu-latest; a fork's PR always runs there, §4.2 "Runner"); github-app (a table of two names, app-id, the Actions variable or secret with a GitHub App's ID, and private-key, the secret with its private key, each ^[A-Za-z_][A-Za-z0-9_]*$; unset: no App, GITHUB_TOKEN and dispatches, §4.1 "A GitHub App"); schedules (table of cron strings, "" = none: ci "0 6 * * *", release "30 5 * * *", deps-sweep "0 9 * * *", deps-relock "0 8 * * 1", nightly "0 7 * * *")—offonon
                      repo-policyrulesets and repo settings applied by frappe-nix repo apply; audit A1, A3 (§4.8, §4.9)required-approvals (int, 1); require-code-owner-review (bool, false); required-checks ("gates" or a list of gate names, "gates"); release-bypass ("github-actions" or "user:", "github-actions"); secret-scanning (bool, true); merge-methods (list of "squash"|"merge"|"rebase", ["squash"]); require-thread-resolution (bool, true); delete-branch-on-merge (bool, true); manage-default-branch (bool, true); manage-features (bool, true)—offoffon (required-approvals = 0)
                      vite-registerscripts/vite-register.mjs and C8, when Vite exists (§5.11)none—offonon
                      pilot-assetsassets.yml and its dispatchnoneci, releasesoffoffoff (apps turn it on)
                      listingregistry readiness: marketplace files, ci / marketplace, L1–L12, R3; and registry publishing when publish is on (§2.21, §5.2); the README's marketplace link when approved is on (§2.19). An app that isn't listed keeps it on with publish = false and no listing.tomlpublish (bool, false); app-only approved (bool, false; true once the app's marketplace listing is approved); registry-upstream (string, "frappe/marketplace"); registry-fork (string, ""; required when publish); getapp-check (bool, true)metadataoffoffon (publish = true, fork "Avunu/marketplace")
                      readmeREADME generated blocks (§2.19)install-ref (string, "" = automatic)listingoffoffon
                      iconsicon checks, desktop-icon fixture (§5.3)none (org.brand)—offoffon
                      screenshotsmarketplace/shots.d.ts, frappe-shots, nightly shots (§5.5)timezone (string, "America/New_York"); locale (string, "en-US"); change-threshold (number 0 to 1, 0)demooffoffon
                      demofrappe-demo (§5.4)company-name ("Demo Company"); company-abbr ("DC"); country ("United States"); currency ("USD"); timezone ("America/New_York"); language ("English"); date ("2026-01-15"); seed (1); erpnext-demo (false)—offoffon (company "Avunu Demo", "AD")
                      test-utilsthe agritheory/test_utils hooks (S19), minibench customizations, nightly duplicationhooks (list of hook ids, all eight of §2.14); track-overrides (bool, false)—offoffon
                      docs-sitedependabot entries and groups for a docs site (§2.17), and the docs-site node-target exclusion (§5.11)action-patterns (list, []); cooldown-exclude-actions (list, []); package-names (list, [])dependabotoffoffoff

                      Notes:

                      • GitHub-only modules (S43). ci, releases (release-please through the workflows), dependabot, repo-policy, pilot-assets, docs-site (its dependabot entries) and listing.publish (the registry is a GitHub repository); the commits module's PR check needs ci. Every other module, the gate commands (frappe-nix gate …, frappe-test --ci) and the commit-msg hooks work on any host. On a repository whose repo isn't on GitHub, the GitHub-only modules resolve to off (and modules that need only them follow), with one notice listing them, so recommended works unchanged; an app whose own [tool.frappe-nix] sets enable = true on one of them gets exit 2 naming it, as §3.3 lists.

                      • Shared infrastructure is not a module. .pre-commit-config.yaml is live while any hook module is on, tools/ while any module with a tool there is on, package.json while any module with a key group is on (§2.4).

                      • Gates are derived, not configured: §4's table says which gate exists for which modules, and gates (§2.3) lists them. Turning a gate off means turning off its module.

                      • recommended is chosen to be useful for any organisation with no further edits: Frappe's own conventions (tabs, 110 columns, frappe's commit types, version-<major> branches) where Frappe has one, the strict tools on, and everything that needs an org value, admin rights or extra infrastructure (repo policy, listing, readme, icons, screenshots, demo, test_utils, docs site, pilot assets) off. Choices that are taste rather than safety (ssort, strict check-js, ty error-on-warning, frappe-major versioning, daily cadence, zero required approvals) are off or neutral in recommended and turned on by the Avunu profile.

                      8.3 Selecting and pinning a profile

                      [tool.frappe-nix] profile takes one of:

                      ValueMeaningWhere it is read from
                      absent"minimal" (S35)the package
                      "minimal", "recommended"a built-in profile; recommended is the newest snapshotthe package, so it moves with frappe-nix
                      "recommended@<minor>"a frozen recommended snapshot (S42)the package; identical in every later v1.x
                      "github:<owner>/<repo>[/<ref>]", "gitlab:<group>/<repo>[/<ref>]", "git+https://<host>/<path>?ref=<ref>"an org profilethe flake input standards-profile
                      "./<dir>"an in-repo profile: <dir>/profile.toml (with extends) and optional <dir>/templates/, tracked in the appthe app's own checkout, so it is versioned with the app and needs no input, no lock node and no rollout

                      Pinning. For an org profile, sync's phase A (§3.3 steps 1–3) renders the input into flake.nix (§2.5):

                      standards-profile = {
                        url = "github:Avunu/frappe-standards-profile/v1";
                        flake = false;
                      };

                      and locks it, so flake.lock records the exact commit and its narHash. Every later step reads profile.toml (and templates/) from that locked tree: from the store when Nix is available, and through frappe-nix pin-path standards-profile in no-Nix CI, which fetches https://codeload.github.com/<owner>/<repo>/tar.gz/<rev> and verifies the narHash like every other pin (§5.2). pin-path accepts standards-profile only as a root input of the app's own lock, and fetches github, gitlab and git lock nodes (§5.2), with FRAPPE_NIX_FETCH_TOKEN for a private profile repository. Changing profile (to another org profile, a ref, or a built-in) re-points or removes the input in phase A, and the lock follows (Appendix I, N3: an input whose URL changed is stale).

                      Updating. Dependabot never moves standards-profile (S38, §2.17). It moves when someone commits

                      nix flake update standards-profile && nix run --no-pure-eval .#frappe-init -- --sync

                      with a token that may change workflow files (S5), or runs frappe-nix repo rollout --profile-to <ref>|latest over a fleet (§5.8). The nightly drift job and audit row A10 report a profile that is behind its ref (§4.6, §5.7). Moving to a new profile major means editing the ref in profile (…/v1 → …/v2), like a frappe-nix major.

                      Authoring. A profile author works against a local checkout with frappe-init --sync --profile-path ../my-profile on a test app (never rendered, never in CI; §3.3) and validates the file with frappe-nix profile validate (§5.13), which the profile repository's own CI should run. A solo developer or a single-app agency doesn't need a repository at all: the in-repo form profile = "./.standards-profile" gives the full profile (template overrides, [[extra-files]], [[retire]], [known-apps], repo-policy overrides) and works in CI, because it is part of the checkout.

                      8.4 Resolution and merge order

                      common/config.py (N3a) resolves an app's configuration the same way for every consumer: sync, --check, frappe-nix config, frappe-test, the CI cfg step, repo apply and repo audit.

                      1. Read [tool.frappe-nix]. No table: not opted in (S35); the caller decides what that means (sync exits 2, the dev shell adds nothing).

                      2. Load the layers, lowest first:

                        1. the built-in profile: profile itself when it is a built-in name or snapshot, else the org profile's extends (recommended resolving to the newest snapshot, S42);

                        2. the org profile's profile.toml, when there is one (from the locked input, or from ./<dir> for an in-repo profile);

                        3. the app's [tool.frappe-nix].

                      3. Validate each layer against its schema on its own: profile schema for 1 and 2 (with the profile-only keys), app schema for 3 (with the app-only keys) (§8.1).

                      4. Merge 1 ← 2 ← 3. Tables merge key by key, recursively. Scalars and arrays are replaced whole by the higher layer (an app that sets python-lint.ignore gives the complete list). [known-apps] merges by key across all three layers. [[extra-files]], [[retire]] and [[replace-apps]] come only from the org profile. org.copyright-holder falls back to org.publisher after the merge.

                      5. Apply defaults from the schema for anything still unset, then apply the module rules of §8.2 (needs, tool = "none"), computing modules.

                      6. Check that every org value a live entry uses is non-empty (S37), and requires-frappe-nix (exit 3 when it excludes the running version).

                      The result is the cfg of §2.3. frappe-nix profile show --explain prints every resolved value with the layer that set it (builtin:recommended, org:github:Avunu/frappe-standards-profile@<rev>, app, default), which is how a developer answers "why is this gate on".

                      8.5 The built-in profiles

                      Both ship in frappe_nix_tools/data/profiles/, as minimal.toml and recommended@1.0.toml (the first recommended snapshot, S42). They are given here in full; N3a creates them byte-for-byte (apart from the comment header) and the N3a nix check compares them. A later MINOR that changes recommended adds a new snapshot file and never edits this one.

                      minimal.toml, the dev shell and nothing else:

                      schema = 1
                      name = "minimal"
                      description = "The frappe-nix dev shell only: flake.nix, .envrc and the .gitignore block."
                      
                      [org]
                      dev-docs-url = "https://github.com/Avunu/frappe-nix/tree/main/docs/app-standards"
                      
                      [dev-shell]
                      enable = true
                      
                      [editorconfig]
                      enable = false
                      [metadata]
                      enable = false
                      [python-lint]
                      enable = false
                      [ssort]
                      enable = false
                      [python-types]
                      enable = false
                      [js]
                      enable = false
                      [typescript]
                      enable = false
                      [stylelint]
                      enable = false
                      [tests]
                      enable = false
                      [semgrep]
                      enable = false
                      [workflow-lint]
                      enable = false
                      [shell-lint]
                      enable = false
                      [nix-lint]
                      enable = false
                      [hygiene]
                      enable = false
                      [commits]
                      enable = false
                      [releases]
                      enable = false
                      [dependabot]
                      enable = false
                      [ci]
                      enable = false
                      [repo-policy]
                      enable = false
                      [vite-register]
                      enable = false
                      [pilot-assets]
                      enable = false
                      [listing]
                      enable = false
                      [readme]
                      enable = false
                      [icons]
                      enable = false
                      [screenshots]
                      enable = false
                      [demo]
                      enable = false
                      [test-utils]
                      enable = false
                      [docs-site]
                      enable = false

                      minimal sets no parameters: a module turned on by an app on top of minimal gets the schema defaults, which are the recommended values.

                      recommended@1.0.toml, vendor-neutral defaults:

                      schema = 1
                      name = "recommended"
                      description = "Vendor-neutral app standards: lint, format, types, tests, conventional commits, releases, dependabot and CI. Nothing that needs an organisation's values or repo admin."
                      
                      [org]
                      publisher = ""
                      email = ""
                      copyright-holder = ""
                      license = ""
                      github-owner = ""
                      website-url = ""
                      docs-url = ""
                      dev-docs-url = "https://github.com/Avunu/frappe-nix/tree/main/docs/app-standards"
                      support-url = ""
                      repo-url = "https://github.com/{repo}"
                      
                      [org.brand]
                      tile-color = ""
                      glyph-color = "#FFFFFF"
                      palette = {}
                      
                      [dev-shell]
                      enable = true
                      
                      [editorconfig]
                      enable = true
                      indent = "tab"
                      line-length = 110
                      
                      [metadata]
                      enable = true
                      build-backend = "flit"
                      package-type = "module"
                      package-manager = "yarn@1.22.22"
                      node-engine = ">=24"
                      
                      [python-lint]
                      enable = true
                      tool = "ruff"
                      select = ["F", "E", "W", "I", "UP", "B", "RUF", "SIM", "C4", "PIE", "PERF", "T20"]
                      ignore = ["E501", "W191"]
                      line-length = 110
                      indent-style = "tab"
                      quote-style = "double"
                      typing-modules = ["frappe.types.DF"]
                      
                      [ssort]
                      enable = false
                      
                      [python-types]
                      enable = true
                      tool = "ty"
                      error-on-warning = false
                      
                      [js]
                      enable = true
                      tool = "oxc"
                      locked-rules = true
                      format-width = 110
                      format-tabs = true
                      format-tab-width = 2
                      
                      [js.oxlint.categories]
                      correctness = "error"
                      suspicious = "error"
                      perf = "warn"
                      pedantic = "off"
                      
                      [typescript]
                      enable = true
                      preset = "frappe-types"
                      strict-extras = true
                      check-js = false
                      audit-consumer = false
                      
                      [stylelint]
                      enable = true
                      
                      [tests]
                      enable = true
                      testmap = true
                      composition = true
                      js-unit = true
                      js-coverage-min = 50
                      
                      [tests.coverage]
                      enable = true
                      target = 80
                      raise-margin = 2.0
                      initial-floor = 0
                      
                      [semgrep]
                      enable = true
                      frappe-rules = true
                      test-correctness = true
                      
                      [workflow-lint]
                      enable = true
                      
                      [shell-lint]
                      enable = true
                      
                      [nix-lint]
                      enable = true
                      
                      [hygiene]
                      enable = true
                      max-file-kb = 1024
                      
                      [commits]
                      enable = true
                      tool = "committed"
                      allowed-types = ["build", "chore", "ci", "docs", "feat", "fix", "perf", "refactor", "revert", "style", "test", "deprecate"]
                      subject-length = 100
                      allow-stacked = true
                      pr-allowed-bases = []
                      
                      [releases]
                      enable = true
                      tool = "release-please"
                      branching = "develop+version"
                      version-scheme = "semver"
                      tag-prefix = "v"
                      
                      [dependabot]
                      enable = true
                      cadence = "weekly"
                      cadence-overrides = {}
                      cooldown-days = 3
                      auto-merge = true
                      
                      [dependabot.ecosystems]
                      github-actions = true
                      npm = true
                      uv = true
                      pre-commit = true
                      nix = true
                      gitsubmodule = true
                      
                      [ci]
                      enable = true
                      provider = "github"
                      nightly = true
                      test-timeout-minutes = 75
                      
                      [ci.schedules]
                      ci = "0 6 * * *"
                      release = "30 5 * * *"
                      deps-sweep = "0 9 * * *"
                      deps-relock = "0 8 * * 1"
                      nightly = "0 7 * * *"
                      
                      [repo-policy]
                      enable = false
                      required-approvals = 1
                      require-code-owner-review = false
                      required-checks = "gates"
                      release-bypass = "github-actions"
                      secret-scanning = true
                      merge-methods = ["squash"]
                      require-thread-resolution = true
                      delete-branch-on-merge = true
                      manage-default-branch = true
                      manage-features = true
                      
                      [vite-register]
                      enable = true
                      
                      [pilot-assets]
                      enable = false
                      
                      [listing]
                      enable = false
                      publish = false
                      registry-upstream = "frappe/marketplace"
                      registry-fork = ""
                      getapp-check = true
                      
                      [readme]
                      enable = false
                      install-ref = ""
                      
                      [icons]
                      enable = false
                      
                      [screenshots]
                      enable = false
                      timezone = "America/New_York"
                      locale = "en-US"
                      
                      [demo]
                      enable = false
                      company-name = "Demo Company"
                      company-abbr = "DC"
                      country = "United States"
                      currency = "USD"
                      timezone = "America/New_York"
                      language = "English"
                      date = "2026-01-15"
                      seed = 1
                      erpnext-demo = false
                      
                      [test-utils]
                      enable = false
                      hooks = ["validate_frappe_project", "validate_patches", "static_analysis", "validate_doctype_python_types",
                               "validate_copyright", "validate_customizations", "clean_customized_doctypes", "check_code_duplication"]
                      track-overrides = false
                      
                      [docs-site]
                      enable = false
                      action-patterns = []
                      cooldown-exclude-actions = []
                      package-names = []

                      What recommended renders for a plain app (no TypeScript, no SCSS, no Vite, no siblings): flake.nix, .envrc, the .gitignore block, .editorconfig, .pre-commit-config.yaml (hygiene, ruff, oxc, zizmor, actionlint, shellcheck, compat, committed hooks), committed.toml, tools/pyproject.toml and tools/uv.lock, the managed pyproject.toml groups, the <app>/__init__.py version block, package.json and yarn.lock, .oxlintrc.json, .oxfmtrc.jsonc, release-please-config.json and its manifest, .git-blame-ignore-revs, .github/workflows/{ci,pr-policy,release,deps,nightly}.yml, .github/dependabot.yml and .github/zizmor.yml. Its ci.yml has the lint and test jobs; typecheck appears with the first TypeScript file. With repo-policy turned on, it requires ci / pr-policy, ci / lint and ci / test. No file names an organisation. Without repo-policy, dependabot.auto-merge acts only once the integration branch requires those checks (§4.5), and frappe-nix repo doctor lists the two repository settings to turn on by hand (Actions may create pull requests; allow auto-merge).

                      8.6 Example org profile: Avunu (worked example)

                      This profile lives in Avunu/frappe-standards-profile/profile.toml (item P), not in frappe-nix. It is the reference for what an org profile looks like, and it is how the Avunu fleet gets exactly the behaviour 1.1 specified: an app synced with it renders what 1.1 describes, apart from the S33 renames, the S39 caller split and the review changes of Appendix R2. 1.1 fixed these values inside frappe-nix; here the profile owns them, so it extends the frozen snapshot recommended@1.0 and sets explicitly every value the fleet relies on, including those that equal today's recommended. A later frappe-nix MINOR that changes recommended, or a flipped Q9 default, therefore can't move an Avunu app. P's CI proves it: it compares the resolved configuration of a copy of the frappe-nix fixture app with the committed resolved.snapshot.json (§6.4).

                      schema = 1
                      name = "avunu"
                      description = "Avunu's app standards: every gate on, Frappe-major versioning, develop + version-<major>, Marketplace publishing."
                      extends = "recommended@1.0"
                      requires-frappe-nix = ">=1.0,<2"
                      
                      [org]
                      publisher = "Avunu LLC"
                      email = "mail@avu.nu"
                      copyright-holder = "Avunu LLC"
                      license = "MIT"
                      github-owner = "Avunu"
                      website-url = "https://avunu.net/open-source/{app}/"
                      docs-url = "https://docs.avunu.net/{app_hyphen}/"
                      dev-docs-url = "https://docs.avunu.net/frappe-nix/docs/app-standards/"
                      repo-url = "https://github.com/{repo}"
                      
                      [org.brand]
                      tile-color = "#834AFF"
                      glyph-color = "#FFFFFF"
                      
                      [editorconfig]
                      enable = true
                      indent = "tab"
                      line-length = 110
                      
                      [metadata]
                      enable = true
                      build-backend = "flit"
                      package-type = "module"
                      package-manager = "yarn@1.22.22"
                      node-engine = ">=24"
                      
                      [python-lint]
                      enable = true
                      tool = "ruff"
                      select = ["F", "E", "W", "I", "UP", "B", "RUF", "SIM", "C4", "PIE", "PERF", "T20"]
                      ignore = ["E501", "W191"]
                      line-length = 110
                      indent-style = "tab"
                      quote-style = "double"
                      typing-modules = ["frappe.types.DF"]
                      
                      [ssort]
                      enable = true
                      
                      [python-types]
                      enable = true
                      tool = "ty"
                      error-on-warning = true
                      
                      [js]
                      enable = true
                      tool = "oxc"
                      locked-rules = true
                      format-width = 110
                      format-tabs = true
                      format-tab-width = 2
                      
                      [js.oxlint.categories]
                      correctness = "error"
                      suspicious = "error"
                      perf = "warn"
                      pedantic = "off"
                      
                      [typescript]
                      enable = true
                      preset = "frappe-types"
                      strict-extras = true
                      check-js = true
                      audit-consumer = false
                      
                      [stylelint]
                      enable = true
                      
                      [tests]
                      enable = true
                      testmap = true
                      composition = true
                      js-unit = true
                      js-coverage-min = 50
                      
                      [tests.coverage]
                      enable = true
                      target = 80
                      raise-margin = 2.0
                      initial-floor = 0
                      
                      [semgrep]
                      enable = true
                      frappe-rules = true
                      test-correctness = true
                      
                      [workflow-lint]
                      enable = true
                      
                      [shell-lint]
                      enable = true
                      
                      [nix-lint]
                      enable = true
                      
                      [hygiene]
                      enable = true
                      max-file-kb = 1024
                      
                      [commits]
                      enable = true
                      tool = "committed"
                      allowed-types = ["build", "chore", "ci", "docs", "feat", "fix", "perf", "refactor", "revert", "style", "test", "deprecate"]
                      subject-length = 100
                      allow-stacked = false                       # plan §5: every PR targets develop, no stacked PRs
                      pr-allowed-bases = []
                      
                      [releases]
                      enable = true
                      tool = "release-please"
                      branching = "develop+version"
                      version-scheme = "frappe-major"
                      tag-prefix = "v"
                      
                      [dependabot]
                      enable = true
                      cadence = "daily"
                      cadence-overrides = { uv = "weekly", pre-commit = "weekly", nix = "weekly", gitsubmodule = "weekly" }
                      cooldown-days = 3
                      auto-merge = true
                      auto-merge-policy = "all"                   # S44: every Dependabot PR and the screenshots PR
                      update-branches = true                      # S44: bot PRs follow develop
                      
                      [dependabot.ecosystems]
                      github-actions = true
                      npm = true
                      uv = true
                      pre-commit = true
                      nix = true
                      gitsubmodule = true
                      
                      [ci]
                      enable = true
                      nightly = true
                      test-timeout-minutes = 75
                      
                      [ci.schedules]
                      ci = "0 6 * * *"
                      release = "30 5 * * *"
                      deps-sweep = "0 9 * * *"
                      deps-relock = "0 8 * * 1"
                      nightly = "0 7 * * *"
                      
                      [repo-policy]
                      enable = true
                      required-approvals = 0
                      require-code-owner-review = false
                      required-checks = "gates"
                      release-bypass = "github-actions"
                      secret-scanning = true
                      merge-methods = ["squash"]
                      require-thread-resolution = true
                      delete-branch-on-merge = true
                      manage-default-branch = true
                      manage-features = true
                      
                      [vite-register]
                      enable = true
                      
                      [pilot-assets]
                      enable = false                              # apps with prebuilt assets turn it on
                      
                      [listing]
                      enable = true                               # registry readiness for every app, listed or not
                      publish = true
                      registry-upstream = "frappe/marketplace"
                      registry-fork = "Avunu/marketplace"
                      getapp-check = true
                      
                      [readme]
                      enable = true
                      install-ref = ""
                      
                      [icons]
                      enable = true
                      
                      [screenshots]
                      enable = true
                      timezone = "America/New_York"
                      locale = "en-US"
                      
                      [demo]
                      enable = true
                      company-name = "Avunu Demo"
                      company-abbr = "AD"
                      country = "United States"
                      currency = "USD"
                      timezone = "America/New_York"
                      language = "English"
                      date = "2026-01-15"
                      seed = 1
                      erpnext-demo = false
                      
                      [test-utils]
                      enable = true
                      hooks = ["validate_frappe_project", "validate_patches", "static_analysis", "validate_doctype_python_types",
                               "validate_copyright", "validate_customizations", "clean_customized_doctypes", "check_code_duplication"]
                      track-overrides = false
                      
                      [docs-site]
                      enable = false                              # the documentation is built by Avunu/site-docs, not from a docs-site/ in each app
                      
                      [[retire]]                                  # the fleet's old workflows whose jobs moved to ci.yml (§2.4.1)
                      paths = [".github/workflows/check.yml", ".github/workflows/version-branch-guard.yml"]
                      module = "ci"
                      
                      [[replace-apps]]                            # A.2: data_steward replaces jailbreak (§5.10)
                      from = "jailbreak"
                      to = "data_steward"

                      An Avunu app then needs only:

                      [tool.frappe-nix]
                      schema = 1
                      profile = "github:Avunu/frappe-standards-profile/v1"
                      frappe-major = 16
                      siblings = ["erpnext"]

                      plus its app keys, and per-app switches where the fleet differs:

                      • An app that isn't listed (list: false in P's fleet.json) sets [tool.frappe-nix.listing] publish = false and has no marketplace/listing.toml. It keeps listing on, so, as in 1.1, it still has the ci / marketplace gate and its required check, L3–L7 and L9, the semgrep baseline, and R3. Without listing.toml, L1, L2, L8, L10, L12, the README blocks and the nightly links job have nothing to check, and release.yml publishes nothing.

                      • An app whose marketplace listing is approved sets [tool.frappe-nix.listing] approved = true, and its README's installation block links the listing (§2.19). Until then no README names the marketplace, whatever publish says. The key is app-only: approval is a fact about one app, so a profile cannot claim it for the fleet.

                      • An app with prebuilt assets sets [tool.frappe-nix.pilot-assets] enable = true.

                      Another organisation copies this file, changes [org] and the switches, publishes it as github:<owner>/<repo>, and points its apps at it. A team that wants no org profile writes profile = "recommended" and sets a few [tool.frappe-nix.org] values in each app.


                      9. Migration of in-flight PRs #58, #59 and #60

                      The three open PRs implement 1.1 under the internal codename. Before any of them merges, each MUST be brought to 1.2 as listed here. Appendix N gives the full old → new table; this section says what each PR does with it, and what it restructures. The frappe[dev]/pypika relock failure on #59 is being fixed separately by the user and is not part of this migration.

                      For all three PRs:

                      • Text. PR title and body, every commit message (subject and body), every file name and every file's content are free of the codename (S33). The conventional-commit scope becomes standards (feat(standards): …). Titles:

                        • N3a: feat(standards): add the hook points the app standards build on (N3a);

                        • N3: feat(standards): add the managed-file engine, frappe-init --sync/--check and frappe-nix compat (N3);

                        • N1: feat(standards): add frappe-test, CI mode, the worktree port salt and frappe-rename-app (N1).

                      • Why a message rewrite is not enough. The codename is in every commit's tree on the three branches, not only in messages: 201 to 271 distinct codename tokens per branch (docs/<codename>/spec.md, the Python project path, the config table, the environment variables, …). A message-only reword keeps those trees, and GitHub keeps them browsable from each PR's commit list and its "force-pushed" links. The PR pages also keep a public record that editing can't remove: title-change events with the old title, the body's edit history, the force-push links to the old commits, and existing review comments.

                      • History: fresh branches, new PRs. Each branch is rebuilt as new commits of its 1.2 content, with no ancestor that contains the codename: start from main (N3a) or from the rebuilt N3a branch (N3, N1), apply the PR's final tree with the Appendix N path renames and content replacements, then the 1.2 restructuring below, and commit in a few logical commits with neutral messages. (git filter-repo with the Appendix N path and content replacements over the old commits is an acceptable alternative when per-commit history is worth keeping; the result must pass the naming check of §7 N3a on every commit, git log -p.) The rebuilt branches are pushed as new branches standards/n3a-hook-points, standards/n3-scaffold and standards/n1-runtime, and opened as new PRs with the titles above, stacked as before (N3 and N1 based on N3a's branch). #59 and #60 are not rebased or renamed in place.

                      • The old PRs. #58, #59 and #60 are closed with the neutral comment Superseded by #<new>, after their titles are edited to the neutral ones above (which hides the codename from the current page but not from the timeline), and their head branches are deleted. Their pages, timelines and the commits reachable from refs/pull/<n>/head stay public unless GitHub Support is asked to remove the PRs' refs and cached views (Q8). New branches use the standards/ prefix.

                      • The spec. The committed 1.1 spec moves to docs/app-standards/spec.md with this 1.2 text, without Appendix N, plus the PR's own Appendix I rows with the renames applied.

                      • Mechanical renames, by Appendix N: paths, the package, the CLI, the table, markers, environment variables, nix check names, fixture names.

                      #58 (N3a), additionally:

                      • Move the Python project to py/frappe_nix_tools/ (distribution frappe-nix-tools, import frappe_nix_tools, console script frappe-nix); the Nix seam directory to lib/standards/, its tool file becoming tools/frappe-nix.nix (git and gh on PATH); the nix tests to tests/standards/ with the standards- check prefix rule; the fixture app to tests/fixtures/standards-app/ with the app standards_fixture; the docs to docs/app-standards/, index titled "App standards and quality gates", plus a profiles.md stub (every old path is in Appendix N).

                      • Flake outputs: packages.frappe-nix-tools, apps.frappe-nix, checks.standards-all; check.yml builds standards-all; modules/devenv.nix, ty.toml and dev/env.nix follow the new paths.

                      • Schema: schema/tool-frappe-nix.schema.json for [tool.frappe-nix], with profile, repo and the module tables of §2.1; its $id is a URL under github.com/Avunu/frappe-nix (not an org website). Siblings accept any <owner>/<repo>, not only Avunu/….

                      • New: data/profiles/minimal.toml and data/profiles/recommended@1.0.toml (§8.5, S42), schema/profile.schema.json (with [[retire]], [[replace-apps]], org.repo-url and the review-round parameters of §8.2), common/config.py (§8.4) behind frappe-nix config (snapshots, in-repo ./<dir> profiles, the app's [known-apps] layer, GitHub-only modules off on other hosts), known-apps.json with the generic */* rule instead of Avunu/*, tests/standards/vendor-neutral.nix with its denylist over the wider S37 scope (Python code, lib/**, the reusable workflows), pin-path for github, gitlab and git lock nodes with FRAPPE_NIX_FETCH_TOKEN, and lib/standards/shell.nix adding frappe-nix and blame.ignoreRevsFile only for opted-in apps, decided by a line match, never fromTOML (S35).

                      • The schema's siblings accepts the object form, [tool.frappe-nix] gains integration-branch, retire-keep and [tool.frappe-nix.dev-shell], and profile accepts snapshots, other flake hosts and ./<dir> (§2.1).

                      • The naming check of §7 N3a is a pre-merge check; no committed file contains the codename, including the denylist.

                      • The fixture app uses fictitious values (publisher "Example Org", example.org URLs) in hooks.py, license.txt, pyproject.toml, marketplace/listing.toml and its logo tile, and adds profile = "recommended" to its [tool.frappe-nix]; tests/fixtures/profiles/example-org/ is N3's.

                      • Environment variables in code and docs: the pin URL, debug, allow-skew, expect-rev, artifact-dir and three cache variables become FRAPPE_NIX_PIN_URL, FRAPPE_NIX_DEBUG, FRAPPE_NIX_ALLOW_SKEW, FRAPPE_NIX_EXPECT_REV, FRAPPE_NIX_ARTIFACT_DIR, FRAPPE_NIX_CACHE, FRAPPE_NIX_CACHE_TOKEN and FRAPPE_NIX_CACHE_READ_TOKEN. The CLI description and --help texts link docs/app-standards.

                      #59 (N3), additionally:

                      • Move the scaffold package to frappe_nix_tools/scaffold/ and rename every template, marker and header (frappe-nix:managed, frappe-nix:local-begin|end, README frappe-nix:begin|end), the solution file tsconfig.solution.json, the hook ids frappe-nix-compat and frappe-nix-commit-msg, and scripts/vite-register.mjs; the sync variables become FRAPPE_NIX_OFFLINE, FRAPPE_NIX_URL_OVERRIDE, FRAPPE_NIX_SYNC_REEXEC, FRAPPE_NIX_SYNC_REENTERED, FRAPPE_NIX_SYNC_RESULT, FRAPPE_NIX_SYNC_LOCK_CHANGED and FRAPPE_NIX_LOCKED_REV (Appendix N); the CI temp dir is $RUNNER_TEMP/frappe-nix.

                      • Restore the default app mode (S35): put templates/app/flake.nix back and leave templates/app/ byte-identical to main; cmd_app_init keeps main's behaviour without --standards, and calls frappe-nix sync --write only with --standards or an existing table; --sync/--check without the table exit 2 with the hint; add --standards and --profile-path to lib/sh/main.sh and app-sync.sh. The engine's flake.nix.j2, envrc.j2 and gitignore.block stay as the opted-in forms.

                      • Module gating: every manifest entry gets module, uses and overridable (§2.4, §3.1); live = module on and when true; retraction of whole files, blocks and merged keys when a module turns off (§3.3 step 6); retire rules carry their module (§2.4.1); package.json and pyproject.toml key groups per module (§2.8, §2.12); the pre-commit template wraps each hook in its module (§2.14); tools/pyproject.toml lists only enabled tools (§2.15); committed.toml's comment and the commit-msg hook follow version-scheme.

                      • Org values out of code: scaffold/package_json.py stops writing "author": "Avunu LLC" and "license": "MIT" and uses org.publisher and org.license when set; test helpers use the example-org values; lib/sh/main.sh's help link points at docs/app-standards.

                      • Review-round changes (Appendix R2): flake.nix and .envrc get the inputs and envrc local regions, the dev-shell parameters and the first-opt-in refusal with --force; phase A re-locks frappe-nix only when the locked original differs from the rendered URL; metadata's four parameters, and the module needs of §8.2 without metadata for js, typescript, stylelint, vite-register and releases; scripts.lint and scripts.check owned by js only, lint:css for stylelint; semantic comparison of YAML/JSON/JSONC/TOML whole files while js.tool isn't oxc; retire rules by function, profile [[retire]] and retire-keep; sibling objects and the resolved-branch C3; integration-branch; typescript.preset; releases.tag-prefix; the frappe-nix hooks that skip outside the dev shell; excludeNodeTargets in the flake template; caller uses: and dependabot ignores from the locked frappe-nix owner; the changed-defaults warning for floating recommended.

                      • Profiles: phase A adds, re-points or removes the standards-profile input and reads the locked profile; template overrides and [[extra-files]] (§8.1); frappe-nix profile show|validate (§5.13); branches and gates in the context; editorconfig, python-lint, python-types, typescript (strict-extras, check-js) and js parameters rendered from cfg.

                      • Its acceptance tests gain the [1.2] cases of §7 N3, and selftest-scaffold runs with the example-org profile (every module on) as well as recommended.

                      #60 (N1), additionally:

                      • Move bench/, commands/testmap.py and commands/test_report.py into frappe_nix_tools/, and rename the report frappe-test-report.json and its schema schema/frappe-test-report.schema.json, the rename shim markers # frappe-nix:rename-shim-begin|end, the nix checks (standards-ports, standards-ci-mode, standards-frappe-test, standards-coverage-env, standards-bench-dev-group, standards-rename-code, standards-rename-devenv, standards-rename-nixos), the fixtures standards_fixture2, standards-fixture.localhost and FixtureToDo, and the selftest's scratch path (/standards-n1/).

                      • frappe-test reads module switches from frappe-nix config (§5.1): --ci enables exactly the stages of enabled modules, skips stages 1–6 with tests off, and takes tests.coverage.target and raise-margin for the upward ratchet instead of the constants 80 and 2.0.

                      • No built-in replace pair: remove REPLACE_PAIRS = {"jailbreak": "data_steward"} from lib/rename/frappe_rename_app.py and the matching comment in lib/scripts.d/frappe-rename-app.nix; replace pairs come from the resolved profile's [[replace-apps]] and from --fleet <file>, and a non-opted-in app must pass --fleet, --profile or --no-replace-check (§5.10).

                      • lib/standards/shell.nix's opt-in rule also gates nixfmt, statix and deadnix (S35); FRAPPE_NIX_CI stays unconditional, and the port salt becomes ports.worktreeSalt, defaulting to the opt-in test (§5.12).

                      • Bench dev group (S1): lib/frappe-workspace.py drops ruff, pre-commit and semgrep only from an opted-in app-mode root whose tools/pyproject.toml pins their replacements, and never from other roots; restore pre-commit>=4.5.1, ruff>=0.15.0 and semgrep in templates/bench/pyproject.toml (keeping the PR's coverage and unittest-xml-reporting additions) and drop its comment saying an app pins them; the standards-bench-dev-group check covers both directions (§7 N1).

                      Not affected: the frappe-nix code outside these three PRs; N2, N4, N5 and N6, which haven't started and are written against 1.2 directly.


                      10. Open questions that need the user

                      Everything else in this spec is decided. These need the user, and none blocks writing the code. Q1–Q6 are from 1.1 (Q3 and Q4 reworded for the profile repository); Q7–Q9 are new, and were narrowed by the review round (Appendix R2). The user has decided Q7, Q8 and Q9; each decision is recorded under its question.

                      1. Q1. Binary cache. Attic (host plus S3) or Cachix (plan and token)? Then set the org variable FRAPPE_NIX_CACHE, the write secret FRAPPE_NIX_CACHE_TOKEN (Actions store only), and, for a private cache, the pull-only FRAPPE_NIX_CACHE_READ_TOKEN (Actions and Dependabot stores).

                        • Until then, ci / test takes about 26–28 minutes (ci-timing track), against a 15-minute target.

                        • The CI design doesn't change when the cache is added.

                      2. Q2. The version-* bypass actor. This spec uses GitHub Actions (integration 15368); only applying a ruleset proves it's accepted. If it returns 422: may we create a machine user for a User bypass (repo-policy.release-bypass = "user:<id>" in the Avunu profile, its token stored as VERSION_BRANCH_TOKEN), or would you rather enable deploy keys for the org? Also confirm that any workflow in the repo with contents: write being able to move version-* is acceptable.

                      3. Q3. Registry credential. REGISTRY_TOKEN, a classic PAT with public_repo from your account (plan decision 15), has to be added as a repo secret on each listed app before Phase 6, along with the Avunu/marketplace fork named in the Avunu profile. Alternatively, publishing stays local: frappe-listing registry uses your gh login.

                      4. Q4. FRAPPE_NIX_AUDIT_TOKEN. A read-only fine-grained PAT (Administration and Contents read, on the 13 repos), stored as a secret of Avunu/frappe-standards-profile, whose scheduled caller runs the scorecard (§5.7). Without it, those rows are unknown.

                      5. Q5. Module names under in-place renames. The validated zero-data-move path keeps the old module names, such as "Carbon Frappe", "Frappe UI Editor Integration", "JWT Auth" and "Mercury Integration". Is keeping marks like "Frappe" in module names acceptable? Renaming them needs a module-rename mode in frappe-rename-app, which isn't specified here. (data_steward is a fresh install and gets new module names regardless.)

                      6. Q6. frappe/marketplace#29. Until it merges, upstream registry CI fails ImportCheck for the 5 apps that import erpnext or hrms, even though our marketplace check (which mirrors #29) passes. Engage upstream, or wait?

                      7. Q7. The one runtime change for apps that haven't opted in. After this review, everything else waits for opt-in (the dev-group trim, the port salt and the docs-site exclusion now do too). What remains is the Vite registration in the Nix preload (§5.11): on a Nix-built bench it adds assets.json keys for hashed Vite bundles (<name>.bundle.<hash>.js) that 404 today, and a Vite key overwrites a same-named esbuild key. Keep it for every app-mode user (it fixes broken pages and touches no file), or gate it on opt-in like the rest?

                        • Decided (2026-10-07): keep the Vite registration in the Nix preload for every app-mode user. It is a runtime fix for bundles that 404 today and touches no file, so it is not gated on opt-in (S35's one exception besides the inert FRAPPE_NIX_CI).

                      8. Q8. Replacing the in-flight PRs. The codename is in the trees of every commit on #58, #59 and #60, not only in their messages, so §9 rebuilds the three branches as fresh standards/* branches and opens new PRs, then closes #58–#60 with a neutral "Superseded by" comment. Reviewers lose the old PR threads (the new PRs link to them). The old PR pages, their title history and the commits behind refs/pull/<n>/head stay public unless GitHub Support removes them. Go ahead with the new PRs, and should we also ask GitHub Support to purge #58–#60?

                        • Decided (2026-10-07): rebuild the three branches as fresh standards/* PRs, as §9 says, and close #58, #59 and #60 with a Superseded by #<new> comment and delete their branches.

                      9. Q9. The recommended defaults. Outside users will meet these first. The judgment calls are: ssort off; ty without error-on-warning; desk check-js off; version-scheme = "semver"; develop+version branching (Frappe's convention, but heavier than main+tags for a small app); Dependabot weekly with auto-merge (which now acts only where required checks protect the branch); ci.nightly on; repo policy off but, when turned on, 1 required approval; stacked PRs allowed. Confirm, or name the ones to flip. Avunu's own apps are unaffected either way: the Avunu profile extends the frozen recommended@1.0 and sets each of these values explicitly (§8.6), and P's snapshot check fails if any of them would move.

                        • Decided (2026-10-07): ship recommended@1.0 exactly as §8.5 gives it; no default is flipped.

                      Not questions, but things the user does once: make timeclock public before its PR A (plan §7 decision 2); refresh the gh login with the workflow scope (gh auth refresh -s workflow) on the machine that runs frappe-nix repo rollout by hand; in frappe-nix, create the environment frappe-nix-rollout (deployment branches: main only) and set the variable FRAPPE_NIX_ROLLOUT_REPOS (unset means no repository; canary Avunu/ui_text_editor, then Avunu/employee_timeclock, then all), and create the GitHub App avunu-release-manager (Contents, Pull requests, Workflows and Issues write, installed on the fleet's consumers) with its client ID and key as that environment's variable FRAPPE_NIX_ROLLOUT_APP_ID and secret FRAPPE_NIX_ROLLOUT_PRIVATE_KEY; create the public repository Avunu/frappe-standards-profile (P). The former Q6 of 1.0 (validate_copyright stamping) stays settled: D7 keeps it, and §2.14 excludes managed and generated files, so it no longer fights sync.