agentleFS
kvothessonkvothesson/ar-plugins/skills/setup-ci/SKILL.md

setup-ci

Skill5 starsChanged 18 days agoMITView on GitHub

Configura CI/CD en un repo plugin de ar-plugins. Agrega conventional commits, check de version bump y branch protection en master. Usalo con /ar-plugins:setup-ci <owner/repo>.

  • Commits and pushes

6 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions6 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 6

    1. wyeworks/accountable-review★ 42same name
    2. ecorkran/context-forge★ 5same name
    3. aprameyak/coding-skills★ 1same name
    4. Dmkdok/product-factory★ 1same name
    5. stackql/stackql-skills★ 0same name
    6. talhaMah56/claude_skills★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repositoryOne other file it gives its agents.

The file

Files
SKILL.md

Skill: /ar-plugins:setup-ci

Dado un repo plugin, agrega:

  • Workflow de conventional commits (commitlint)
  • Workflow de version bump (solo en repos con plugin.json)
  • .commitlintrc.json
  • Branch protection ruleset en master (PR obligatorio + checks requeridos)

Uso

/ar-plugins:setup-ci kvothesson/<nombre>

Si no se pasa repo, preguntar al usuario cuál quiere configurar.


Paso 1 — Verificar y obtener scope workflow

gh auth status 2>&1 | grep "Token scopes"

Si el output no contiene workflow, correrlo automáticamente:

gh auth refresh -s workflow

Este comando abre el browser para que el usuario apruebe el scope. Avisarle antes:

Necesito el scope `workflow` para crear los archivos en .github/workflows/.
Abriendo el browser para que lo apruebes — es un solo click en "Authorize".

Esperar a que el comando termine (el usuario aprueba en el browser y el CLI confirma). Luego verificar que el scope quedó:

gh auth status 2>&1 | grep "Token scopes"

Si sigue sin tener workflow, reportar el error y detener.


Paso 2 — Detectar tipo de repo

gh api repos/<owner>/<repo>/contents/.claude-plugin/plugin.json 2>&1 | grep -c '"content"'
  • Si retorna 1 → repo plugin → setup completo (version-bump + commitlint + ruleset)
  • Si retorna 0 → repo sin plugin.json → solo commitlint + ruleset (ej: ar-plugins)

Paso 3 — Clonar y crear branch

gh repo clone <owner>/<repo> /tmp/<repo>-setup-ci
cd /tmp/<repo>-setup-ci
git checkout -b ci/setup-ci

Paso 4 — Agregar archivos

.commitlintrc.json (siempre)

cat > /tmp/<repo>-setup-ci/.commitlintrc.json << 'EOF'
{
  "extends": ["@commitlint/config-conventional"],
  "rules": {
    "type-enum": [
      2,
      "always",
      ["feat", "fix", "chore", "docs", "refactor", "test", "ci"]
    ],
    "subject-case": [2, "never", ["start-case", "pascal-case", "upper-case"]],
    "header-max-length": [2, "always", 100]
  }
}
EOF

Workflow commitlint (siempre)

mkdir -p /tmp/<repo>-setup-ci/.github/workflows
cat > /tmp/<repo>-setup-ci/.github/workflows/check-commits.yml << 'EOF'
name: Check commit messages

on:
  pull_request:

jobs:
  commitlint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Lint commit messages
        uses: wagoid/commitlint-github-action@v6
        with:
          configFile: .commitlintrc.json
EOF

Workflow version bump (solo si tiene plugin.json)

cat > /tmp/<repo>-setup-ci/.github/workflows/check-version-bump.yml << 'EOF'
name: Check version bump

on:
  pull_request:
    paths:
      - '.claude-plugin/plugin.json'
      - 'skills/**'

jobs:
  version-bump:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Get version on base branch
        id: base
        run: |
          git fetch origin ${{ github.base_ref }}
          BASE_VERSION=$(git show origin/${{ github.base_ref }}:.claude-plugin/plugin.json | python3 -c "import sys,json; print(json.load(sys.stdin)['version'])")
          echo "version=$BASE_VERSION" >> $GITHUB_OUTPUT

      - name: Get version on PR branch
        id: pr
        run: |
          PR_VERSION=$(python3 -c "import json; print(json.load(open('.claude-plugin/plugin.json'))['version'])")
          echo "version=$PR_VERSION" >> $GITHUB_OUTPUT

      - name: Fail if version was not bumped
        run: |
          BASE="${{ steps.base.outputs.version }}"
          PR="${{ steps.pr.outputs.version }}"
          echo "Base version: $BASE"
          echo "PR version:   $PR"
          if [ "$BASE" = "$PR" ]; then
            echo "::error file=.claude-plugin/plugin.json::La version no fue actualizada (sigue en $PR). Bumpeala en .claude-plugin/plugin.json antes de mergear."
            exit 1
          fi
          echo "Version bumped: $BASE -> $PR OK"
EOF

Paso 5 — Commit y push

cd /tmp/<repo>-setup-ci
git add .github/workflows/ .commitlintrc.json
git commit -m "ci: agregar conventional commits y check de version bump"
git push origin ci/setup-ci

Paso 6 — Abrir PR

gh pr create \
  --repo <owner>/<repo> \
  --title "ci: setup conventional commits y branch protection" \
  --body "## Qué agrega este PR

- Workflow de conventional commits (commitlint) en todos los PRs
- Workflow de version bump en PRs que tocan \`skills/\` o \`plugin.json\`
- \`.commitlintrc.json\` con tipos: feat, fix, chore, docs, refactor, test, ci

## Branch protection

Después del merge, aplicar ruleset vía API:
\`\`\`bash
/ar-plugins:setup-ci <owner>/<repo> --solo-ruleset
\`\`\`
O manualmente en Settings → Branches → Add ruleset."

Paso 7 — Aplicar branch protection ruleset

Después de que el PR esté mergeado (o si se corre con --solo-ruleset):

cat > /tmp/ruleset-<repo>.json << 'EOF'
{
  "name": "Protect master",
  "target": "branch",
  "enforcement": "active",
  "conditions": {
    "ref_name": {
      "include": ["refs/heads/master"],
      "exclude": []
    }
  },
  "rules": [
    {
      "type": "pull_request",
      "parameters": {
        "required_approving_review_count": 0,
        "dismiss_stale_reviews_on_push": false,
        "require_code_owner_review": false,
        "require_last_push_approval": false,
        "required_review_thread_resolution": false
      }
    },
    {
      "type": "required_status_checks",
      "parameters": {
        "required_status_checks": [
          { "context": "version-bump" },
          { "context": "commitlint" }
        ],
        "strict_required_status_checks_policy": false
      }
    },
    { "type": "non_fast_forward" }
  ]
}
EOF

gh api repos/<owner>/<repo>/rulesets --method POST --input /tmp/ruleset-<repo>.json

Para repos sin plugin.json (ej: ar-plugins), omitir version-bump de required_status_checks:

"required_status_checks": [
  { "context": "commitlint" }
]

Paso 8 — Confirmar

Reportar al usuario:

CI configurado en <owner>/<repo>:

  ✓ .commitlintrc.json
  ✓ .github/workflows/check-commits.yml
  ✓ .github/workflows/check-version-bump.yml  (si aplica)
  ✓ Branch protection ruleset activo en master

PR: <url>

Si algún paso falló, reportar el error exacto y qué hay que hacer manualmente.


Tono

Directo. Si hay un blocker (scope faltante, repo no encontrado), reportarlo y detenerse — no intentar workarounds silenciosos.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.