Install rules from other repos
An organization’s rules can live in one repo’s .adhere/rules/, and other repos
copy them in with adhere install:
adhere list darkmatter/standards # each rule there, with its descriptionadhere install darkmatter/standards # every ruleadhere install darkmatter/standards/data # the data topicadhere install darkmatter/standards/data/brand-ports # one ruleadhere install darkmatter/standards#v3 # every rule, as tagged v3- Copies land in this repo’s
.adhere/rules/org/repo/, sodata/brand-portsfrom darkmatter/standards lands in.adhere/rules/darkmatter/standards/data/brand-ports/as the ruledarkmatter/standards/data/brand-ports, and two repos’ rules never collide. - The copies are the repo’s own rules from then on: commit them, edit them, or start new rules from them. Nothing tracks where they came from.
- A later install skips a rule already there, just as init does.
--forcereplaces its directory, edits and all. - A rule’s whole directory is copied. The source’s config, its inline rules, and its cache are not.
Read what you install. A
RULE.tsis copied with the helpers beside it, and runs whenever lint does, in CI too.adhere listnames aRULE.tswithout its description, since reading the description would run the file.
The source is cloned with git from https://github.com/org/repo.git, so a
private repo needs git’s credentials for GitHub, which gh auth setup-git sets
up. To clone over SSH instead, let git rewrite the URL:
git config --global url.git@github.com:.insteadOf https://github.com/.
Creating a shared repo
Section titled “Creating a shared repo”adhere init --shared org/repo scaffolds a repo whose rules other repos copy in
with adhere install, instead of one that lints itself. It writes the two
example rules and no config, since install copies only rule files, and with
them:
README.mdsays what the repo is for, how to install its rules, and how to add one..github/workflows/adhere.yamlrunsadhere validateon every push to main and every pull request, with theTYPESAFE_API_KEYsecret. A pull request from a fork gets no secrets, so validate refuses there.alchemy.run.tsis an alchemy stack that creates the GitHub repo, or adopts it, and sets that secret fromTYPESAFE_API_KEYwhen deployed withnpx alchemy deploy.package.jsonpins alchemy and effect, which init installs, to versions that work together..gitignorekeeps the installed packages and alchemy’s state out of git.
The repo is public unless you answer yes when init asks, at a terminal, whether
to make it private. Other repos then need git’s credentials for it to list and
install its rules. Without a terminal it is public: change visibility in the
stack to make it private.