v1.31.0
conocimientoissue-tracker-syncreferences/

github-playbook.md

Referencia que issue-tracker-sync carga bajo demanda desde su SKILL.md.

issue-tracker-syncskill
referencescarpeta
16.250 Btamaño
2026-09-08último cambio del pack

Referencia técnica del camino GitHub de issue-tracker-sync: la API (gh CLI, REST y GraphQL) que usan el workflow references/workflow-github-sync.md y el modo activo de la regla devops-awareness (infraestructura.github.autoSync = true). Es el homólogo de azure-devops-rest-playbook.md. Se lee bajo demanda: la regla siempre-cargada solo lleva el resumen.


Prerrequisitos

  • gh autenticado (gh auth status). Scopes: repo cubre issues, labels, milestones y sub-issues; Projects v2 exige project (gh auth refresh -h github.com -s project; read:project basta para consultar).
  • Issues habilitadas en el repo (gh repo view --json hasIssuesEnabled --jq .hasIssuesEnabled; si no, gh repo edit --enable-issues).
  • Un Project v2 vive en la organización o el usuario, no en el repo: se crea allí y se enlaza al repo (gh project link). En una organización, el owner del proyecto es la organización.
  • infraestructura.github en _hilo/ESTADO_PROYECTO.json (lo escribe la primera sincronización, Fase 4).

Equivalencias Azure DevOps → GitHub

Azure DevOps (Boards/Wiki)GitHubNotas
Proceso Scrum / Basic / AgileNo hay procesos: open/closed + campo Status del ProjectLa detección de proceso no aplica
Epic → Feature → PBIIssue type:epic → sub-issues type:feature → sub-issues `type:task\bug\debt\docs`Sub-issues (REST /sub_issues); modo plano = PBIs directos bajo el Epic (equivale a Basic)
Estados New / Committed / Doneopen + Status Todo / open + Status In Progress / closed (completed) + Status DoneEn GitHub sí existe "In Progress": es la opción por defecto del Project
Área (Area Path) + Team includeChildrenLabels area:<x>Sin fix de Team: no hay backlog por área, se filtra por label
Prioridad 1-4Labels priority:P1..P4 (o campo single-select del Project)
Iteraciones / SprintsMilestones con due_on (+ campo Iteration del Project, solo desde la UI)gh project field-create no crea Iteration
System.AssignedTo = displayName de AD--assignee <login>equipo.miembros[].githubLogin; nunca email
About (descripción del proyecto)gh repo edit --description + sección «Estado» del READMELa descripción del repo cabe en ~350 chars
Dashboard (4 widgets Markdown)Vistas del Project (Board por Status, Table por area:*, Roadmap por milestone) + READMEInsights solo en planes Team/Enterprise
Wiki (9 páginas)docs/ del layout Ovillo (versionado, PR, CODEOWNERS); GitHub Wiki opcionalLa Wiki es otro repo git (<repo>.wiki.git) y hay que inicializarla desde la UI
Shared Queries (WIQL)Vistas guardadas del Project + recetas gh issue list --search en docs/management/ISSUE_QUERIES.mdNo hay API de queries guardadas
Branch policiesRulesets (skill git-best-practices, tools/github-rulesets.md)Ola de Git, no de Issues
NotificacionesWatch del repo, CODEOWNERS (auto-request de review), Discussions, menciones @org/teamNo hay API de suscripciones por usuario
WIQL @Megh issue list --assignee @me

Modelo de trabajo en GitHub

  • Jerarquía por sub-issues: el Epic es un issue type:epic; cada Feature un issue type:feature sub-issue del Epic; cada PBI un issue type:task (o bug/debt/docs) sub-issue de su Feature, con area:<x> y priority:Pn. Modo plano (repos pequeños): sin Features, los PBIs cuelgan del Epic y se agrupan por area:*.
  • Estados: open/closed con state_reason (completed | not_planned). Si hay Project, el campo Status (Todo / In Progress / Done por defecto) da el Kanban. Mapeo desde Azure: New → Todo, Committed → In Progress, Done → closed + Done.
  • Identidad: assignee por login (equipo.miembros[].githubLogin; si falta y usuario coincide con un login del repo, usarlo; si no, omitir y avisar). Nunca email.
  • Trazabilidad: mismo bloque Origen: (endpoint, archivo:línea, commit, tipo) en el cuerpo del issue. Los commits y PRs que digan Closes #<n> cierran el issue al llegar a la rama por defecto.

Labels canónicas (idempotente con -f)

REPO=$(gh repo view --json nameWithOwner --jq .nameWithOwner)
gh label create "type:epic"    -c 3E4B9E -d "Epic: iniciativa o proyecto completo" -f
gh label create "type:feature" -c 5319E7 -d "Feature: agrupa PBIs de un área" -f
gh label create "type:task"    -c 0E8A16 -d "PBI / tarea" -f
gh label create "type:bug"     -c D73A4A -d "Bug" -f
gh label create "type:debt"    -c FBCA04 -d "Deuda técnica (DT-*)" -f
gh label create "type:docs"    -c 0075CA -d "Documentación" -f
for a in api seguridad integraciones observabilidad calidad basedatos ui configuracion devops; do
  gh label create "area:$a" -c C5DEF5 -d "Área: $a" -f
done
gh label create "priority:P1" -c B60205 -d "Crítica" -f
gh label create "priority:P2" -c D93F0B -d "Alta" -f
gh label create "priority:P3" -c FBCA04 -d "Media" -f
gh label create "priority:P4" -c C2E0C6 -d "Baja" -f

Organizaciones con Issue Types habilitados pueden además fijar el tipo nativo (Epic, Feature, Task, Bug) desde la UI o la REST (-f type=Epic). Para Ovillo la fuente de verdad siguen siendo las labels type:*, que funcionan en cualquier plan.

Crear la jerarquía (Epic → Feature → PBI)

# Epic
EPIC_URL=$(gh issue create -t "Epic: <Proyecto>" -F epic.md -l type:epic)
EPIC_N=${EPIC_URL##*/}

# Feature = sub-issue del Epic. sub_issue_id es el ID NUMÉRICO del issue (campo .id), NO su número (#n).
F_URL=$(gh issue create -t "Feature: Seguridad" -b "Agrupa los PBIs de autenticación, CORS y cabeceras" -l type:feature -l area:seguridad)
F_N=${F_URL##*/}
F_ID=$(gh api "repos/$REPO/issues/$F_N" --jq .id)
gh api -X POST "repos/$REPO/issues/$EPIC_N/sub_issues" -F sub_issue_id=$F_ID      # -F: parámetro tipado (entero)

# PBI = sub-issue de la Feature, con área, prioridad, asignado y milestone
P_URL=$(gh issue create -t "Configurar SSO con el IdP" -F pbi.md -l type:task -l area:seguridad -l priority:P1 -a <login> -m "Sprint 1")
P_ID=$(gh api "repos/$REPO/issues/${P_URL##*/}" --jq .id)
gh api -X POST "repos/$REPO/issues/$F_N/sub_issues" -F sub_issue_id=$P_ID

# Ver / reordenar / mover de padre
gh api "repos/$REPO/issues/$EPIC_N/sub_issues" --jq '.[] | "\(.number)\t\(.title)\t\(.state)"'
gh api -X POST "repos/$REPO/issues/<nuevo_padre>/sub_issues" -F sub_issue_id=$P_ID -F replace_parent=true
gh api "repos/$REPO/issues/${P_URL##*/}/parent" --jq .number

Cuerpo del PBI (pbi.md), con la trazabilidad obligatoria:

Origen:
- Endpoint: POST /api/scholarships
- Archivo: src/MyCompany.Scholarships.Web/Controllers/ScholarshipsController.cs:45
- Commit: abc123 "feat(scholarships): crear endpoint POST"
- Tipo: feat

Milestones (sprints)

gh api -X POST "repos/$REPO/milestones" -f title="Sprint 1" -f description="2026-09-08 → 2026-09-21" -f due_on="2026-09-21T00:00:00Z"
gh api "repos/$REPO/milestones?state=open" --jq '.[] | "\(.number)\t\(.title)\t\(.due_on)"'
gh issue edit <n> -m "Sprint 1"                 # asignar por título
gh api -X PATCH "repos/$REPO/milestones/<number>" -f state=closed
calendario.release_cycleMilestones a crear
continuoNinguno (flujo libre; el Project da el Kanban)
semanal4 milestones de 1 semana
quincenal4 milestones de 2 semanas
mensual3 milestones de 1 mes
por_sprintPreguntar duración
nullNinguno (configurar en /hv:onboarding)

Projects v2

OWNER=<org|@me>
NUM=$(gh project create --owner $OWNER --title "<Proyecto>" --format json --jq .number)
gh project link $NUM --owner <login-u-org> --repo $REPO      # con el LOGIN literal: `link --owner @me` falla ("has different owner from '@me'")
PROJECT_ID=$(gh project view $NUM --owner $OWNER --format json --jq .id)                       # PVT_...
gh project field-list $NUM --owner $OWNER --format json --jq '.fields[] | {id, name, options}'    # Status y sus opciones (PVTSSF_... / PVTSSFO... ids)

# Añadir un issue y fijar Status
ITEM_ID=$(gh project item-add $NUM --owner $OWNER --url $P_URL --format json --jq .id)          # PVTI_...
gh project item-edit --project-id $PROJECT_ID --id $ITEM_ID --field-id <statusFieldId> --single-select-option-id <optionId>

# Campos propios (TEXT | SINGLE_SELECT | DATE | NUMBER; Iteration solo desde la UI)
gh project field-create $NUM --owner $OWNER --name "Área" --data-type SINGLE_SELECT --single-select-options "api,seguridad,integraciones,observabilidad,calidad"

Equivalente GraphQL (para scripts que no quieran gh project; scope project):

query { organization(login: "ORG") { projectV2(number: NUM) { id } } }          # user(login:) para proyectos de usuario
query { node(id: "PROJECT_ID") { ... on ProjectV2 { fields(first: 20) { nodes {
  ... on ProjectV2SingleSelectField { id name options { id name } } } } } } }
mutation { addProjectV2ItemById(input: {projectId: "PROJECT_ID" contentId: "ISSUE_NODE_ID"}) { item { id } } }
mutation { updateProjectV2ItemFieldValue(input: {projectId: "PROJECT_ID" itemId: "ITEM_ID" fieldId: "FIELD_ID"
  value: { singleSelectOptionId: "OPTION_ID" }}) { projectV2Item { id } } }
mutation { updateProjectV2ItemFieldValue(input: {projectId: "PROJECT_ID" itemId: "ITEM_ID" fieldId: "FIELD_ID"
  value: { iterationId: "ITERATION_ID" }}) { projectV2Item { id } } }

ISSUE_NODE_ID = gh api repos/$REPO/issues/<n> --jq .node_id. Con gh api graphql -f query='...'.

Vistas = dashboard: Board agrupado por Status (Kanban), Table agrupada por label area:*, Roadmap por milestone. Se crean desde la UI (la API no crea vistas); el workflow imprime la receta. Los workflows integrados del Project («Item closed → Status Done», «Item added → Todo») evitan actualizar Status a mano: activarlos desde la UI del Project.

docs/ en vez de Wiki

El layout Ovillo ya tiene docs/ (management/, architecture/, api/, manuals/, testing/, support/): las 9 páginas de la Wiki de Azure se escriben ahí y viajan con el código (PR, CODEOWNERS, historia). La GitHub Wiki es opcional (gh repo edit --enable-wiki): es un repo git aparte (https://github.com/<o>/<r>.wiki.git) que hay que inicializar desde la UI con una primera página antes de poder clonarlo, y no pasa por PR.

Página (Azure)Destino en docs/
HomeREADME.md del repo (sección «Estado»)
Arquitecturadocs/architecture/ARQUITECTURA.md
Endpointsdocs/api/ENDPOINTS.md
Seguridad · Resiliencia · Observabilidad · Configuracióndocs/architecture/{SEGURIDAD,RESILIENCIA,OBSERVABILIDAD,CONFIGURACION}.md
Desarrollodocs/manuals/DESARROLLO.md
Equipodocs/management/EQUIPO.md

Recetas de consulta (sustituyen a las Shared Queries)

Guardar en docs/management/ISSUE_QUERIES.md; las vistas del Project las persisten en la UI.

gh issue list --assignee @me --state open                                    # Mi trabajo
gh issue list --label type:bug --state open                                  # Bugs abiertos
gh issue list --label type:debt --state all                                  # Deuda técnica
gh issue list --state closed --search "closed:>=$(date -d '-7 days' +%F)"    # Completados esta semana (pwsh: (Get-Date).AddDays(-7).ToString('yyyy-MM-dd'))
gh issue list --milestone "Sprint 1" --json number,title,state,assignees     # Sprint actual
gh issue list --search "HV-19 in:title" --json number --jq '.[0].number'     # Localizar un evolutivo por código

Modo activo (autoSync)

Prerrequisitos: github.autoSync = true y github.epicIssue != null. Si falta alguno, modo pasivo.

EventoAcción en GitHub
/hv:nuevo-evolutivo (HV-*)gh issue create -t "{codigo}: {titulo}" -F body.md -l type:task -l area:<x> -l priority:P1 -a <login> → sub-issue de features.<area> (o del Epic en modo plano) → gh project item-add + Status In Progress
Nueva DT en DEUDA_TECNICA.mdIssue type:debt, prioridad por severidad (Alta P1 · Media P2 · Baja P3), Status Todo
DT que se empieza a trabajarStatus → In Progress
/hv:finalizar-evolutivogh issue close <n> --reason completed (+ Status Done si el Project no tiene el workflow «closed → Done»)
DT ❌ descartadagh issue close <n> --reason "not planned" -c "<motivo>"
/hv:commitSugerir #<n> en el mensaje (Closes #<n> en el PR cierra al mergear)
# Localizar el issue de un evolutivo por su código
N=$(gh issue list --search "{CODIGO} in:title" --state all --json number --jq '.[0].number')
gh issue edit $N --add-assignee <login> --add-label priority:P1
gh issue close $N --reason completed

Coherencia de Features: Feature con sub-issues abiertos → sigue open; todos cerrados → puede cerrarse (gh api repos/$REPO/issues/<f>/sub_issues --jq '[.[] | select(.state=="open")] | length').

Error de conectividad — graceful degradation

NO bloquear el trabajo. Warning + continuar, y encolar en _hilo/devops_pending_ops.json (se reintenta con /issue-tracker-sync --retry):

[
  { "plataforma": "github", "tipo": "crear_issue", "codigo": "HV-19", "titulo": "Filtro de scholarships por estado",
    "featureArea": "endpoints", "prioridad": 1, "fecha": "2026-09-07", "reintentos": 0 }
]

Tras cada sincronización, resumen: ✅ GitHub actualizado: #42 "HV-19: …" → In Progress.

Configuración en ESTADO_PROYECTO.json

"infraestructura": {
  "github": {
    "owner": "myorg",
    "repo": "my-repo",
    "epicIssue": 12,
    "features": { "endpoints": 13, "integraciones": 14, "seguridad": 15, "observabilidad": 16, "calidad": 17 },
    "modoPlano": false,
    "labels": ["type:*", "area:*", "priority:*"],
    "milestones": { "Sprint 1": 3, "Sprint 2": 4 },
    "project": {
      "owner": "myorg", "number": 7, "id": "PVT_kwDO…",
      "statusFieldId": "PVTSSF_…",
      "statusOptions": { "todo": "f75ad846", "inProgress": "47fc9ee4", "done": "98236657" }
    },
    "docsEnLugarDeWiki": true,
    "autoSync": false,
    "ultimaSync": null,
    "pendingOps": "_hilo/devops_pending_ops.json"
  }
}

Si github no existe → sin recordatorios. Si epicIssue = null → sugerir /issue-tracker-sync. Si autoSync = true pero epicIssue = null → modo pasivo con warning. features = {} en modo plano.

Gotchas

  • sub_issue_id es el id de base de datos del issue (.id), no su número: gh api repos/{o}/{r}/issues/{n} --jq .id. Con gh api, pasar el entero con -F (tipado), no con -f (string).
  • Projects v2: scope project (gh auth refresh -s project); --owner obligatorio en todos los gh project; el proyecto es de la organización o del usuario y se enlaza al repo. En gh project link el --owner debe ser el login literal (@me da «has different owner»); create, view, item-add sí aceptan @me.
  • Iteration no se crea por API ni por gh project field-create: usar milestones para los sprints; si el Project ya tiene un campo Iteration (UI), asignar con --iteration-id.
  • Wiki: inicializar desde la UI antes de clonar <repo>.wiki.git; por eso el default es docs/.
  • gh label create -f es idempotente (actualiza color/descripción); los nombres con : son válidos.
  • due_on en ISO 8601 YYYY-MM-DDTHH:MM:SSZ; GitHub lo muestra en la zona del usuario (poner la fecha del día siguiente a 00:00Z si el sprint acaba a final de día).
  • Rate limit: 5.000 peticiones/h REST por token; una sincronización de 50 issues con sub-issues y Project consume ~200. Reintentar con backoff ante 403 rate limit.
  • Un repo Free privado tiene issues, sub-issues, labels, milestones y Projects; lo que no tiene son reviewers de environments (eso es CI/CD, no Issues).

Referencia issue-tracker-sync — GitHub Issues y Projects v2. Homólogo de azure-devops-rest-playbook.md.

← Volver a la ficha de issue-tracker-sync

Ovillo v1.31.0tag v1.31.0 (2026-10-06) · sin decisiones posteriores69 skills · 19 agents · 22 hooks · 3 reglas · 15 tools · 103 decisionesfuente: ovillo/.claude/skills/issue-tracker-sync/references/github-playbook.mdCopyright 2026 Hugo Valer Rojas · Apache-2.0