Deterministic repository management for GitHub.
tentactl helps you manage GitHub repositories as code. You define repository settings in /.github/tentactl.config.ts, review changes locally, and then apply them with the CLI.
- Pulls the current state of a repository into a local config file
- Shows the diff between your local config and GitHub
- Applies repository settings from your config back to GitHub
- Supports GitHub.com and GitHub Enterprise Server
You can manage settings such as:
- Repository metadata and merge settings
- Topics
- Branch protection for the default branch
- Labels
- Team access
- Rulesets
- Deployment environments
- Custom property values
- Interaction limits
# npm
npx tentactl@latest
# pnpm
pnpm dlx tentactl@latest
# bun
bunx tentactl@latest
# deno
deno run -A npm:tentactl@latestTo install it globally:
pnpm add -g tentactlYou need:
- A GitHub Personal Access Token (PAT)
- Repository access for the target repository
- These token scopes:
repo,read:org, andworkflow
tentactl reads GH_TOKEN from your environment first. If it does not find one, it can save a token to /.env.local in your project root.
- Sign in.
- Pull your repository settings into a config file.
- Review the diff.
- Apply changes back to GitHub.
tentactl login
tentactl pull
tentactl diff
tentactl pushBy default, tentactl uses /.github/tentactl.config.ts.
Fetches the current GitHub repository state and writes it to your config file.
tentactl pull
tentactl pull --config .github/tentactl.config.tsIf the config file does not exist, tentactl prompts for the organization and repository name.
Shows the difference between your local config and the current remote state.
tentactl diff
tentactl diff --config .github/tentactl.config.tsUse this command before push to confirm the exact changes you want to make.
Applies your local config to GitHub.
tentactl push
tentactl push --config .github/tentactl.config.tsUse these commands to manage your token:
tentactl login
tentactl whoami
tentactl logoutCreate /.github/tentactl.config.ts and export a config with defineConfig.
import { defineConfig } from "tentactl";
export default defineConfig({
org: "t128n",
repo: "tentactl",
repository: {
description: "Manage GitHub repositories as code",
homepage: "https://github.com/t128n/tentactl",
visibility: "public",
has_issues: true,
has_projects: false,
has_wiki: false,
allow_squash_merge: true,
allow_merge_commit: false,
allow_rebase_merge: false,
delete_branch_on_merge: true,
},
topics: ["cli", "github", "typescript"],
branch_protection: {
branch: "main",
required_status_checks: {
strict: true,
contexts: [],
},
enforce_admins: true,
required_pull_request_reviews: null,
restrictions: null,
},
labels: {
items: [
{ name: "bug", color: "d73a4a", description: "Something is not working" },
{ name: "documentation", color: "0075ca", description: "Documentation changes" },
{ name: "enhancement", color: "a2eeef", description: "New feature or request" },
],
},
collaborators: {
items: [{ username: "octocat", permission: "push" }],
},
teams: {
items: [{ team_slug: "platform", permission: "maintain" }],
},
});The root config supports these fields:
host: GitHub host override for GitHub Enterprise Serverorg: GitHub organization or user namerepo: Repository namestrict: Global strict mode fallbackrepository: Repository settings from the GitHub repository APItopics: Repository topicsbranch_protection: Branch protection for a specific branchlabels: Repository labelscollaborators: Direct user collaborators and their permissionsteams: Team permissions for the repositoryrulesets: Repository rulesetsenvironments: Deployment environmentscustom_properties: Repository custom property valuesinteraction_limit: Repository interaction limit
Strict mode lets you remove managed items that are not present in your config.
strict: trueapplies strict mode globallylabels.strict,collaborators.strict,teams.strict, andrulesets.strictoverride the global setting per section
When strict mode is enabled for a section, tentactl deletes items in GitHub that are not listed in that section of your config.
Use collaborators for direct user access and teams for organization team access.
- Supported permissions for both are
pull,triage,push,maintain, andadmin collaborators.itemsuses{ username, permission }teams.itemsuses{ team_slug, permission }- Set
collaborators.strictorteams.strictto remove access entries not declared in config
Set host when you want to target GitHub Enterprise Server.
import { defineConfig } from "tentactl";
export default defineConfig({
host: "github.example.com",
org: "octo-org",
repo: "platform",
});# 1. Pull the current repository state
tentactl pull
# 2. Edit .github/tentactl.config.ts
# 3. Review the change
tentactl diff
# 4. Apply the change
tentactl pushpullanddiffread live data from GitHubpushapplies only the sections you define in your config- Some GitHub rules or settings depend on your repository visibility, plan, or GitHub edition
Published under the MIT license.
Made by @t128n and community π
π€ auto updated with automd