Skip to content

repo-setup

Recipe card from the charly-internals plugin (Development — contributor internals).

repo-setup — the opencharly org, dotgithub config, and new-repo setup

Section titled “repo-setup — the opencharly org, dotgithub config, and new-repo setup”

This skill is the companion to /charly-internals:git-workflow: git-workflow owns the AUTHOR’s branch/PR discipline; repo-setup owns the ORG-LEVEL configuration that discipline relies on and the checklist for standing up a NEW repository.

The org model (verified against the live settings)

Section titled “The org model (verified against the live settings)”
  • The opencharly org is on GitHub Team, so org rulesets and the workflows rule (“Require workflows to pass”) are available.
  • ONE organization branch ruleset named org-wide required workflow & main protection is the single source of main protection and the required workflow. It targets ~ALL repositories MINUS an explicit exclude set, on refs/heads/main, and carries:
    • workflows — requires opencharly/.github/.github/workflows/org-wide-pr-validator-required.yml@refs/heads/main (read from the .github repo at the pinned ref);
    • required_status_checks — strict: true, exactly ONE context validate / validate;
    • non_fast_forward, deletion, creation. The ONLY bypass actor is the charly-auto-merge GitHub App (its protected-main CHANGELOG writes must land). There is NO human bypass and NO pull_request review rule — the validator IS the gate.
  • Owner script: opencharly/.github/scripts/org-ruleset.sh (apply / verify). It builds two org rulesets from ONE payload builder — A for the active non-fork main-default repos, B for the active forks on ~DEFAULT_BRANCH — deletes redundant per-repo rulesets and any surviving legacy branch protection, and enforces the settings that have NO org-level default: allow_auto_merge=true, delete_branch_on_merge=true, and allow_update_branch=false.
  • The sets are discover_repos (active, non-fork, default main) and discover_forks (active forks, with their default branch). Ruleset A targets the first on refs/heads/main; ruleset B targets the second on ~DEFAULT_BRANCH — stable/master included — with the same rules, including the workflows rule. So a fork’s validate / validate is produced by the ORG required workflow and no per-fork pr-validator.yml is copied into a fork. The gate cannot be switched off by deleting a fork file.
  • A first-party fork is therefore a LANDING TARGET like any other. The one file it carries is .github/workflows/tag-on-merge.yml, installed and kept canonical by reconcile-tag-on-merge-callers.sh with SCOPE=forks — which also INSTALLS it where absent. A fork left out of ruleset B fails org-ruleset.sh verify by name until the next apply (the staleness control).
  • A fork’s workflows rule blocks DIRECT pushes, so a user-token gh repo sync fails (measured, opencharly/.github#179). Sync through .github/workflows/sync-forks.yml, which uses the charly-auto-merge App token — the ruleset bypass actor. It never forces; a conflict is reported.
  • Still outside the gate: an archived repo, a vendored upstream on a non-main default (pixelflux → av1), and an artifact-branch sink (omarchy-eval-artifacts → runs).

What happens automatically on every PR (the landing chain)

Section titled “What happens automatically on every PR (the landing chain)”
  1. A PR is opened/updated → the org ruleset runs org-wide-pr-validator-required.yml in the TARGET repo’s context (definition from opencharly/.github at the pinned ref) → it calls the reusable pr-validator.yml → the single required check validate / validate.

  2. On a PASS verdict the validator enables GitHub native auto-merge (squash) inline — there is NO separate auto-merge workflow. main is squash-only.

  3. After the merge, the PER-REPO caller .github/workflows/tag-on-merge.yml fires (on workflow_run of charly/pr-validator + push to main) → calls the org reusable tag-on-merge.yml, which mints the CalVer tag v<YYYY>.<DDD>.<HHMM> at the merge commit and writes CHANGELOG/<CalVer>.md from the merged PR body (the body IS the changelog). Proxy-consumed root modules (sdk, spec, plugin-gh) get the Go-module v0.<YYYYDDD>.<HHMM> form instead.

    A landing in one of those repos is not tagged at the merge instant. The org sweep that mints the tag runs on workflow_run of charly/pr-validator and scans the last 24h of merged PRs, so a native-auto-merge squash - which GitHub Actions creates ZERO runs for - is tagged when the NEXT validator completes in that repo, not when it merges. Measured and diagnosed on sdk’s own .github/workflows/tag-on-merge.yml, whose header RCA states it: do not read a missing tag minutes after a merge in sdk, spec or plugin-gh as a defect.

  4. A body-only fix after the head was pushed needs NO empty commit: re-run the failed run MANUALLY with gh api -X POST repos/<owner>/<repo>/actions/runs/<run-id>/rerun (not gh run rerun, which 404s on the org-required workflow; the re-run’s newer check run supersedes the failure). The org-wide rerun label sweep was RETIRED.

Step 0 — choose the class and the name (do this BEFORE step 1)

Section titled “Step 0 — choose the class and the name (do this BEFORE step 1)”

The repo name is not a free choice: it carries the class, and the class decides what the repo may hold. Settle the class first, then the name, then run the checklist below.

  1. What is the entity? A candy or image, a VM, a plugin, a service bundle, a packaging repo, a distro family, or a whole product family — the KIND axis.
  2. Which family does it belong to (openclaw, strata, punktfunk, …)? The family word is also the skill namespace (/charly-<family>:<skill>) and the corpus directory.
  3. Which repo owns it? One canonical owner per behaviour (the rulebook’s R2); every other repo references it by @github.com/<owner>/<repo>:<vX.Y.Z> or a namespace import.
  4. Name it by its class. Bare names are for core/contract (charly, sdk, spec, marketplace, docs) and appliances only. Everything else carries its prefix — distro-, charly-/pkg-, layer-, plugin-, pod-, vm- — and a product family is a layer-<family> repo (layer-openclaw is the canonical example). A family is never a bare name.

The full class → name → “may hold” mapping is the umbrella README.md (“The org map”), verified by charly task org-map; the rule itself is in the umbrella AGENTS.md (“Repo classes and naming”). Do not copy either table into this skill: they are the canonical surfaces, and a copy drifts.

A repo whose only content is skills is not a class. No prefix exists for it, and none may be invented. A layer-*, distro-*, plugin-*, pod-*, vm-*, charly-* or pkg-* repo must hold the code, plugin or config its name promises, with its skills beside that content (umbrella AGENTS.md Part II #5). A *-skills carrier REPO that exists only to own prose is retired by this rule. Its skills move to the repo of the entity they describe, or to the umbrella when they are general guidance. A carrier CANDY inside a repo that already holds code is a different thing and is unaffected: it is the shape image-owned skills need (/charly-internals:skills).

Worked counter-example, because it happened: a product family was created as a bare openclaw. It held a box, a candy, a disposable bed and two skills — a layer-<family> shape — so the name did not fit its class and the repo was renamed to layer-openclaw. A bare name holding anything beyond core/contract or an appliance is the defect this step exists to catch.

The org ruleset’s creation rule makes the naive path IMPOSSIBLE, and it is the first step every new repo gets wrong: a repo’s first main cannot be created by git push, by the contents API, by repo auto_init, or by a branch rename — each fails with “Cannot create ref due to creations being restricted” (and auto_init leaves the repo with no refs at all). The only actor that can create that ref is the charly-auto-merge App, and the org ships a workflow that mints exactly that token for this purpose. So the order is:

  1. Create the repo EMPTY and non-fork — gh repo create opencharly/<name> --public, with no --add-readme, --gitignore, license or auto_init (blocked anyway; see above). Adopting an existing upstream is an explicit choice: NON-FORK (it gains the org gate and CalVer tags) or a fork (it lands on its own CI, as openclaw-enterprise does, or on its own repo-scoped ruleset, as crabbox does, and the org mints no tag for it).

  2. Push ONE throwaway seed branch. Creating any ref that is not main is allowed: git push origin HEAD:refs/heads/seed. The seed must carry no content you will ship — main is created at it, and a PR whose diff is empty is a no-op.

  3. Bootstrap main with the org workflow: gh workflow run bootstrap-repo-main.yml --repo opencharly/.github -f repos=<name>. It mints the App token, creates refs/heads/main at the seed, and INSTALLS and asserts the per-repo .github/workflows/tag-on-merge.yml caller — so do NOT hand-add that file. The installed caller IS the canonical tag-on-merge-dispatcher.yml; a committed copy differs by a byte (no final newline) and fights every future template regeneration.

  4. Set the three repository settings the App cannot (it holds no administration permission):

    Terminal window
    gh api --method PATCH repos/opencharly/<name> \
    -f default_branch=main -f allow_auto_merge=true -f delete_branch_on_merge=true

    Until this runs the repo is outside the org gate: no required validate / validate, no CalVer tag, no CHANGELOG (org-ruleset.sh verify reports it as needs_operator_settings=<n>). Do NOT re-apply the org ruleset on its behalf — the ONE ruleset targets ~ALL minus an explicit exclude set, so a new repo is already covered; only these three settings have no org-level default.

  5. Land the content as ONE PR off main (never a direct push): a feat/ branch, the commit, the change-class gate on that tree, the whole body, one push, a ready PR. Because step 3 installed the caller, the FIRST merge is tagged.

  6. In the umbrella, the gitlink and the pin’s INTENT land in the SAME commit. git submodule add <url> <path> writes no branch =, and a path with neither an intent: entry nor a branch= is unpinned — which fails charly task verify structurally:

    Terminal window
    git submodule add <url> <path>
    git config -f .gitmodules submodule.<path>.branch main # the pin's INTENT (a leaf)

    then the import: key (if the repo has entities to address), the README org-map row and the counts that reconciler checks. The mechanism and the why are /charly-internals:git-workflow (its pin-intent-and-currency reference, “A submodule is BORN unpinned”); this checklist repeats the two commands because a checklist is read on its own, and cites the owner of the rule rather than restating the reasoning. Advance THIS pin with the narrow mechanism, NOT with charly task ff: that verb is an ORG-WIDE wave (Part II #3), it fast-forwards every pin the umbrella declares onto its branch tip, and it holds the worktree’s index while it runs.

  7. Verify the org issue labels (this is the whole label contract for a new repo):

    a. opencharly/.github owns everything label-related — the taxonomy (labels/taxonomy.json), the generic rules (labels/category-rules.json), the org issue form (.github/ISSUE_TEMPLATE/issue.yml, the default community-health file), the sync/audit workflows and the tests. A repository ships no label configuration of its own, ever. b. The bootstrap sync provisions the labels. bootstrap-repo-main.yml runs scripts/labels.sh sync --repo <name>; the 12 labels (category:runtime, category:delivery, category:verification, category:experience, category:governance, category:hygiene; type:fix, type:feat, type:design, type:spec, type:docs, type:chore) exist in every non-archived repo. Verify them: gh label list -R opencharly/<name> --limit 100 | grep -E '^(category|type):' must show all 12; if the label sync has not run, run gh workflow run label-sync.yml --repo opencharly/.github -f repos=<name>. c. Do not ship a repository-specific issue template unless it carries the same four required fields as the org form — Category, Type, Remedy / files the remedy will touch, and Cited design decision or org-rulebook rule (or none). A repo template overrides the org default (a GitHub limitation), so a template without those fields silently breaks mandatory labelling for that repo. The safest choice is no template at all. d. No repository-specific label. Labels are fully generic: the repository name is never a classification signal, every category is available in every repo, and a new or future repo needs no mapping. A label like session:, owner:, priority:, severity:, size:, status: or any repo/product-named label is a defect the audit reports. e. File through the org form or scripts/gh/cli.ts issue, which refuses without category:, type:, remedy/files, the cited rule, the verified RCA and a --blocking/--non-blocking classification — never a bare gh issue create. The full “which label” rules, the split protocol and the DESIGN/rulebook violation table are in /charly-internals:git-workflow, under its issue-labels reference page. f. Expect the org label-audit to check the new repo daily: it reports missing axes, two values on one axis, retired/default labels and unknown labels (report-only by default); label-sync re-provisions the 12 labels because GitHub recreates its 9 defaults on every new repository.

  1. Do not add a repo-scoped ruleset and do not add a pr-validator.yml. Run scripts/org-ruleset.sh apply; ruleset B picks the fork up from discover_forks. A fork missing from B fails verify until apply runs — that is the staleness control, not a warning.
  2. Install the tag-on-merge caller: dispatch .github/workflows/reconcile-tag-on-merge-callers.yml with scope=forks. An absent caller is INSTALLED there (the targets scope never installs); a copy that pins the reusable to a SHA keeps that policy with the current .github main sha.
  3. Confirm the settings org-ruleset.sh apply asserts (allow_auto_merge, delete_branch_on_merge, allow_update_branch=false). With auto-merge disabled, an approved PR renders as a FAILED check (opencharly/.github#212).
  4. Land one canary PR. Confirm exactly ONE validate / validate run on the head (two is a duplicate producer — stop), native squash auto-merge armed, the merge, and a CalVer tag plus CHANGELOG/<CalVer>.md on the fork’s DEFAULT branch.
  5. Sync from upstream with sync-forks.yml, never a user-token gh repo sync (the workflows rule blocks a direct push).
  6. Tag-on-merge means the fork mints CalVer: a landing on the fork’s default branch is tagged by the caller, like every repo. The umbrella no longer asks a pin’s relation to a tag.

A repo created WITHOUT the tag-on-merge.yml caller still MERGES (the org workflow validates it) but NEVER gets a CalVer tag: measured on layer-nerdctl and plugin-nerdctl (no .github directory at all; their two v2026.266.* tags were minted manually).

Three DIFFERENT things sit outside the gate, and they are not one category:

  • A vendored upstream on a non-main default — pixelflux (default av1): consumed as a pin, not a landing target.
  • An artifact-branch sink — omarchy-eval-artifacts (default runs): a branch that receives published output, not a landing target.
  • An archived repo — pod-immich-ml: read-only, so GitHub rejects pushes and new PRs. org-ruleset.sh verify names any archived fork too.

A first-party FORK is no longer in this set: ruleset B gates it, and it mints CalVer once its tag-on-merge caller is installed. The org mints no AUTOMATIC tag for a repo with no caller, so a CalVer tag you find there was minted out-of-band.

  • /charly-internals:git-workflow — the author’s branch/PR/landing discipline and the after-merge close-out checklist (B8).
  • opencharly/.github — scripts/org-ruleset.sh, scripts/lib-org.sh, scripts/retire-per-repo-dispatchers.sh, scripts/reconcile-tag-on-merge-callers.sh, scripts/sync-forks.sh, and the workflows org-wide-pr-validator-required.yml, pr-validator.yml, tag-on-merge.yml, tag-on-merge-dispatcher.yml, bootstrap-repo-main.yml, reconcile-tag-on-merge-callers.yml, sync-forks.yml.

Invoke when creating or onboarding a repository in the opencharly org, when adding or changing CI/landing workflows, or when explaining what the org ruleset and dotgithub workflows do automatically versus what each repo must configure.