Loading...
Loading...
Set up a repo with IsaiaScope governance defaults — GitHub repo creation, prod/test/dev branch structure with protection, prod-gate CI, commitlint, version-bump hook, and /deploy-cascade command. Use when the user runs /iso-init-repo or asks to set up repo governance.
npx skill4agent add isaiascope/ai iso-init-repotemplates/command -v git &>/dev/null \
|| { echo "✗ git not found. Install Xcode CLI tools: xcode-select --install"; exit 1; }if ! command -v gh &>/dev/null; then
echo "⚠ gh not found — installing..."
brew install gh
command -v gh &>/dev/null \
|| { echo "✗ gh install failed. Run manually: brew install gh"; exit 1; }
echo "✓ gh installed"
fiif ! gh auth status &>/dev/null; then
echo "⚠ gh not authenticated."
echo " Run: gh auth login"
echo " Then re-run /iso-init-repo"
exit 1
figit remote get-url origin 2>/dev/null || echo "no remote"package.jsonif [ -f package.json ] && ! command -v npx &>/dev/null; then
echo "⚠ node/npx not found — Steps 5–6 (commitlint, version-bump) will be skipped."
echo " Install Node.js: https://nodejs.org or via nvm/fnm"
figh repo create <name> --private --source=. --remote=origin --pushgh repo viewdevtestprodORIGIN=$(git symbolic-ref --short HEAD) # current default, likely 'main'
# Create prod from current default
git checkout -b prod 2>/dev/null || git checkout prod
git push -u origin prod
# Create test and dev from prod
git checkout -b test prod && git push -u origin test
git checkout -b dev prod && git push -u origin dev
# Set dev as GitHub default branch
gh repo edit --default-branch dev
# Delete original default (main) if it was the starting point
if [ "$ORIGIN" = "main" ]; then
git push origin --delete main
git branch -d main
fimainprodREPO=$(gh repo view --json nameWithOwner -q .nameWithOwner)
# prod — PR required, no force push. ci-prod-gate enforces source=test.
gh api "repos/$REPO/branches/prod/protection" --method PUT \
--input - <<'EOF'
{
"required_status_checks": null,
"enforce_admins": false,
"required_pull_request_reviews": { "required_approving_review_count": 0 },
"restrictions": null
}
EOF
# test — PR required, no force push
gh api "repos/$REPO/branches/test/protection" --method PUT \
--input - <<'EOF'
{
"required_status_checks": null,
"enforce_admins": false,
"required_pull_request_reviews": { "required_approving_review_count": 0 },
"restrictions": null
}
EOF
# dev — PR required, no force push
gh api "repos/$REPO/branches/dev/protection" --method PUT \
--input - <<'EOF'
{
"required_status_checks": null,
"enforce_admins": false,
"required_pull_request_reviews": { "required_approving_review_count": 0 },
"restrictions": null
}
EOFci-prod-gate.ymltemplates/ci-prod-gate.yml.github/workflows/ci-prod-gate.ymlgit checkout dev
git add .github/
git commit -m "chore(repo): add prod-gate workflow"
git push origin devpackage.jsonif [ -f pnpm-lock.yaml ]; then echo "pnpm"
elif [ -f yarn.lock ]; then echo "yarn"
elif [ -f bun.lockb ] || [ -f bun.lock ]; then echo "bun"
else echo "npm"; fi.husky/[ -d .husky ] || npx husky initpackage.jsonpnpm add -D -w @commitlint/cli @commitlint/config-conventional # pnpm
yarn add -D -W @commitlint/cli @commitlint/config-conventional # yarn
bun add -d @commitlint/cli @commitlint/config-conventional # bun
npm install --save-dev @commitlint/cli @commitlint/config-conventional # npm"prepare": "husky"package.jsontemplates/commit-msg.sh.husky/commit-msggrep -q "commitlint" .husky/commit-msg 2>/dev/null \
&& echo "commit-msg: already configured, skipping" \
|| { cat templates/commit-msg.sh > .husky/commit-msg && chmod +x .husky/commit-msg; }[ -f commitlint.config.js ] \
&& echo "commitlint.config.js: already exists, skipping — review manually if needed" \
|| cp templates/commitlint.config.js commitlint.config.jsscope-enumgit log --oneline | sed -n 's/[^(]*(\([^)]*\)).*/\1/p' | sort -uscope-enumls apps/ packages/cidepsdocsreposcope-enumscope-emptygit add .husky/ commitlint.config.js package.json
git commit -m "chore(repo): add commitlint"
git push origin devpackage.jsontemplates/post-commit-version-bump.sh.husky/post-commit-version-bump.sh.husky/post-commitbash "$(dirname "$0")/post-commit-version-bump.sh"git add .husky/
git commit -m "chore(repo): add version-bump post-commit hook"
git push origin devtemplates/deploy-cascade-command.md.claude/commands/deploy-cascade.md/deploy-cascadeprodmkdir -p .claude/commands
git add .claude/commands/deploy-cascade.md
git commit -m "chore(repo): add /deploy-cascade command"
git push origin dev✓ GitHub repo created/configured
✓ Branches: dev (default) ← test ← prod
✓ Protection: PR required on dev, test, prod (no direct push)
✓ .github/workflows/ci-prod-gate.yml — prod accepts PRs from test only
✓ .husky/commit-msg + commitlint.config.js [or: skipped — no package.json]
✓ .husky/post-commit-version-bump.sh [or: skipped — no package.json]
✓ .claude/commands/deploy-cascade.md — /deploy-cascade command<any branch> → dev → test → prod/deploy-cascadeprodprodtest