🎁 Get the FREE AI Skills Starter GuideSubscribe →
BytesAgainBytesAgain
🦀 ClawHub

Fork Manager

by @glucksberg

Manage forks with open PRs - sync upstream, rebase branches, track PR status, and maintain production branches with pending contributions. Supports automatic...

Versionv2.1.1
Downloads2,106
Installs1
Stars1
TERMINAL
clawhub install fork-manager

📖 About This Skill


name: fork-manager description: Manage forks with open PRs - sync upstream, rebase branches, track PR status, and maintain production branches with pending contributions. Supports automatic conflict resolution via --auto-resolve flag (spawns AI subagents to resolve rebase conflicts). Use when syncing forks, rebasing PR branches, building production branches that combine all open PRs, reviewing closed/rejected PRs, or managing local patches kept outside upstream. Requires Git and GitHub CLI (gh). metadata: {"openclaw": {"requires": {"bins": ["git", "gh"]}}}

Fork Manager Skill

Manage forks where you contribute PRs but also use improvements before they're merged upstream. Includes support for local patches — fixes kept in the production branch even when the upstream PR was closed/rejected.

When to use

  • Sync a fork with upstream
  • Check status of open PRs
  • Rebase PR branches onto latest upstream
  • Build a production branch combining all open PRs + local patches
  • Review recently closed/rejected PRs and decide whether to keep locally
  • Manage local patches (fixes not submitted or rejected upstream)
  • When NOT to use

  • General GitHub queries (issues, PRs, CI status on any repo) → use github skill instead
  • Triaging/ranking/prioritizing issues → use issue-prioritizer skill instead
  • Reviewing code changes before publishing a PR → use pr-review skill instead
  • Creating new PRs from scratch (not fork sync) → use gh pr create directly
  • Execution Model — Orchestrator + Worker

    A skill NUNCA deve ser executada inline pelo agente principal. Sempre usar o padrão orchestrator/worker:

    Fluxo

    1. Orchestrator (agente principal) — prepara o contexto e spawna um subagente:

       sessions_spawn(
         task: "",
         model: "",
         mode: "run"
       )
       
    2. Worker (subagente) — executa o full-sync/status/rebase/etc. Lê a SKILL.md, segue o fluxo, escreve history. 3. Monitoramento — o orchestrator checa progresso a cada 4 minutos via sessions_list / sessions_history: - Se o worker estiver ativo e progredindo → aguarda - Se o worker estiver parado/travado (sem output novo por 2 checks consecutivos) → subagents kill + spawna novo worker - Se o worker completou → lê o resultado e reporta ao usuário 4. Fallback — se o worker falhar (crash, timeout, erro): - Orchestrator verifica o estado do repo (git status, último checkpoint) - Spawna novo worker com contexto atualizado incluindo o ponto onde parou - Máximo de 2 retries antes de reportar falha ao usuário

    Contexto para o Worker

    O orchestrator deve incluir no prompt do worker:

  • Path da SKILL.md (para o worker ler e seguir)
  • Config do repo (inline ou path)
  • Última entrada do history (resumo ou path)
  • Modo de execução (full-sync, status, rebase-all, etc.)
  • Se é cron mode ou manual
  • Quaisquer instruções específicas do usuário
  • Por que subagente?

  • Resiliência: se o worker falha, o orchestrator pode recuperar
  • Context window: a skill é pesada (145+ PRs = muito output). O worker gasta seu context sem poluir o agente principal
  • Paralelismo futuro: permite spawnar workers para repos diferentes simultaneamente
  • Cron Mode

    When invoked by a cron job (automated recurring sync), follow these guidelines for efficient execution:

    1. Skip interactive prompts — auto-resolve decisions that don't require human input: - Rebases: attempt automatically, report failures - Closed PRs: report but defer decision (don't drop or keep without human input) - Audit findings: report but don't act 2. Compact output — use the summary format, not full verbose report:

       🍴 Fork Sync Complete — 
       Main: synced N commits (old_sha → new_sha)
       PRs: X open, Y changed state
       - Rebased: A/B clean (C conflicts)
       Production: rebuilt clean | N conflicts
       Notable upstream: [1-3 bullet highlights]
       
    3. Checkpoint on failure — if a rebase fails or production build has conflicts, write state to repos//checkpoint.json so the next run (or manual invocation) can resume 4. Time budget — target <10 minutes total. If rebasing 20+ PRs, batch push at the end instead of per-branch

    Configuration

    Configs are organized per repository in repos//config.json relative to the skill directory:

    fork-manager/
    ├── SKILL.md
    └── repos/
        ├── project-a/
        │   └── config.json
        └── project-b/
            └── config.json
    

    Formato do config.json:

    {
      "repo": "owner/repo",
      "fork": "your-user/repo",
      "localPath": "/path/to/local/clone",
      "mainBranch": "main",
      "productionBranch": "main-with-all-prs",
      "upstreamRemote": "upstream",
      "forkRemote": "origin",
      "autoResolveConflicts": false,
      "openPRs": [123, 456],
      "prBranches": {
        "123": "fix/issue-123",
        "456": "feat/feature-456"
      },
      "localPatches": {
        "local/my-custom-fix": {
          "description": "Breve descrição do que o patch faz",
          "originalPR": 789,
          "closedReason": "rejected|superseded|duplicate|wontfix",
          "keepReason": "Motivo pelo qual mantemos localmente",
          "addedAt": "2026-02-07T00:00:00Z",
          "reviewDate": "2026-03-07T00:00:00Z"
        }
      },
      "lastSync": "2026-01-28T12:00:00Z",
      "notes": {
        "mergedUpstream": {},
        "closedWithoutMerge": {},
        "droppedPatches": {}
      }
    }
    

    Resolução automática de conflitos (autoResolveConflicts)

    A resolução automática pode ser ativada de duas formas (qualquer uma basta):

    1. Flag de invocação (ad-hoc, por execução):

       /fork-manager --auto-resolve
       /fork-manager full-sync --auto-resolve
       
    2. Config persistente (sempre ativo pra aquele repo):
       { "autoResolveConflicts": true }
       

    | Fonte | Comportamento | |-------|---------------| | Nenhuma (default) | Conflitos são reportados mas não resolvidos. Relatório inclui "⚠️ Conflitos requerem aval do desenvolvedor." | | --auto-resolve OU config.autoResolveConflicts: true | Spawna subagentes Opus para resolver conflitos. Resultados classificados como trivial/semântico/irresolvível. |

    Precedência: --auto-resolve na invocação ativa a resolução mesmo se o config diz false. Não existe --no-auto-resolve — se o config diz true e o usuário não quer resolver, basta não rodar o passo manualmente.

    Para usuários do ClawHub: basta passar --auto-resolve no comando. Nenhuma configuração de repo necessária.

    Campos de localPatches

    Cada entry em localPatches é uma branch local mantida na production branch mas sem PR aberto no upstream.

    | Campo | Descrição | |-------|-----------| | description | O que o patch faz | | originalPR | Número do PR original que foi fechado (opcional se criado direto como patch) | | closedReason | Por que o PR foi fechado: rejected (mantenedor recusou), superseded (outro PR resolve parcialmente mas não totalmente), duplicate (fechamos nós mesmos), wontfix (upstream não vai resolver) | | keepReason | Por que precisamos manter localmente | | addedAt | Data em que foi convertido para local patch | | reviewDate | Data para reavaliar se ainda é necessário (upstream pode ter resolvido) |

    Histórico de Execuções

    Cada repositório gerenciado tem um arquivo history.md que registra todas as execuções da skill como um livro de registro append-only:

    fork-manager/
    └── repos/
        ├── project-a/
        │   ├── config.json
        │   └── history.md
        └── project-b/
            ├── config.json
            └── history.md
    

    Regra: Ler último output antes de começar

    Antes de qualquer operação, ler o history.md do repositório alvo e extrair a última entrada (último bloco ---). Isso dá contexto sobre:

  • O que foi feito na última execução
  • Quais PRs tinham problemas
  • Quais decisões foram tomadas
  • Se ficou alguma ação pendente
  • # Ler última entrada do history (tudo após o último "---")
    tail -n +$(grep -n '^---$' "$SKILL_DIR/repos//history.md" | tail -1 | cut -d: -f1) "$SKILL_DIR/repos//history.md"
    

    Se o arquivo não existir, criar com o header e prosseguir normalmente.

    Regra: Registrar output ao finalizar

    Ao final de toda execução, fazer append ao history.md com o resultado completo. Formato:

    ---
    

    YYYY-MM-DD HH:MM UTC |

    Operator:

    Summary

  • Main:
  • PRs:
  • Local Patches:
  • Production:
  • Actions Taken

  • <"Rebased 21/21 branches clean">
  • <"PR #999 closed → kept as local patch local/my-fix">
  • <"PR #777 reopened → restored to openPRs (was in droppedPatches)">
  • Pending

  • <"3 local patches with expired reviewDate — run review-patches">
  • Full Report

    Importante: O bloco Full Report contém o relatório completo sem abreviação. Isso garante que o próximo agente que ler o history tenha toda a informação, não apenas o resumo.

    Fluxo de Análise

    1. Carregar config e histórico

    Resolve the skill directory (where SKILL.md lives):

    # SKILL_DIR is the directory containing this SKILL.md
    

    Resolve it relative to the agent's workspace or skill install path

    SKILL_DIR=""

    Load config for the target repo

    cat "$SKILL_DIR/repos//config.json"

    Ler último output do history para contexto

    HISTORY="$SKILL_DIR/repos//history.md" if [ -f "$HISTORY" ]; then # Extrair última entrada (após último ---) LAST_SEP=$(grep -n '^---$' "$HISTORY" | tail -1 | cut -d: -f1) if [ -n "$LAST_SEP" ]; then tail -n +"$LAST_SEP" "$HISTORY" fi fi

    2. Navegar para o repositório

    cd 
    

    3. Fetch de ambos remotes

    git fetch 
    git fetch 
    

    4. Analisar estado do main

    # Commits que upstream tem e origin/main não tem
    git log --oneline /../

    Contar commits atrás

    git rev-list --count /../

    5. Verificar PRs abertos via GitHub CLI

    # Listar PRs abertos do usuário
    gh pr list --state open --author @me --json number,title,headRefName,state

    Verificar status de um PR específico

    gh pr view --json state,mergedAt,closedAt,title

    6. Classificar cada PR

    Para cada PR no config, verificar:

    | Estado | Condição | Ação | | ------------ | --------------------------------- | --------------------------------------- | | open | PR aberto no GitHub | Manter, verificar se precisa rebase | | merged | PR foi mergeado | Remover do config, deletar branch local | | closed | PR fechado sem merge | Acionar review-closed (ver abaixo) | | conflict | Branch tem conflitos com upstream | Precisa rebase manual | | outdated | Branch está atrás do upstream | Precisa rebase |

    Comando para verificar se branch precisa rebase:

    git log --oneline /../ | wc -l  # commits à frente
    git log --oneline /../ | wc -l  # commits atrás
    

    7. Revisar PRs recém-fechados (review-closed)

    Quando um PR é detectado como fechado sem merge, NÃO remover automaticamente. Iniciar um fluxo de revisão interativo:

    #### 7.1. Coletar contexto do fechamento

    # Buscar comentários e motivo do fechamento
    gh pr view  --repo  --json title,closedAt,state,comments,labels

    Verificar se upstream resolveu o problema de outra forma

    (procurar PRs mergeados recentes que toquem os mesmos arquivos)

    gh pr list --state merged --repo --json number,title,mergedAt --limit 30

    #### 7.2. Classificar o motivo do fechamento

    | Categoria | Descrição | Ação padrão | |-----------|-----------|-------------| | resolved_upstream | Upstream corrigiu o problema por outro caminho | drop — não precisamos mais | | superseded_by_ours | Fechamos nós mesmos em favor de outro PR nosso | drop — o substituto já está em openPRs | | rejected_approach | Mantenedor não gostou da abordagem, mas o bug/feature existe | review — considerar resubmeter com abordagem diferente | | rejected_need | Mantenedor não concorda que é um problema | review — avaliar se precisamos localmente | | wontfix | Upstream marcou como wontfix | review — provável candidato a local patch |

    #### 7.3. Apresentar ao usuário para decisão

    Para cada PR fechado, apresentar:

    ### PR #
    <li style="color:#94a3b8;margin:3px 0"><strong style="color:#e5e7eb">Fechado em:</strong> <data></li>
    <li style="color:#94a3b8;margin:3px 0"><strong style="color:#e5e7eb">Motivo:</strong> <categoria></li>
    <li style="color:#94a3b8;margin:3px 0"><strong style="color:#e5e7eb">Comentários do mantenedor:</strong> <resumo></li>
    <li style="color:#94a3b8;margin:3px 0"><strong style="color:#e5e7eb">O fix ainda é relevante pra nós?</strong> Análise: <o que o patch faz e se upstream resolve></li></p><p style="margin:8px 0"><strong style="color:#e5e7eb">Opções:</strong>
    1. 🗑️ <strong style="color:#e5e7eb">Drop</strong> — remover completamente (branch local + remote)
    2. 📌 <strong style="color:#e5e7eb">Keep as local patch</strong> — mover para <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">localPatches</code>, manter na production branch
    3. 🔄 <strong style="color:#e5e7eb">Resubmit</strong> — retrabalhar e abrir novo PR com abordagem diferente
    4. ⏸️ <strong style="color:#e5e7eb">Defer</strong> — manter no limbo por agora, revisitar depois
    </code></pre></p><p style="margin:8px 0">#### 7.4. Executar a decisão</p><p style="margin:8px 0"><strong style="color:#e5e7eb">Drop:</strong>
    <pre style="background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0"><code style="color:#a5f3fc;background:none;padding:0;font-size:1em">git branch -D <branch> 2>/dev/null
    git push <originRemote> --delete <branch> 2>/dev/null
    <h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">Mover para notes.droppedPatches no config</h2>
    </code></pre></p><p style="margin:8px 0"><strong style="color:#e5e7eb">Keep as local patch:</strong>
    <pre style="background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0"><code style="color:#a5f3fc;background:none;padding:0;font-size:1em"># Branch continua existindo, mas sai de openPRs/prBranches
    <h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">Entra em localPatches com metadata completa</h2>
    <h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">Renomear branch de fix/xxx para local/xxx (opcional, para clareza)</h2>
    </code></pre></p><p style="margin:8px 0"><strong style="color:#e5e7eb">Resubmit:</strong>
    <pre style="background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0"><code style="color:#a5f3fc;background:none;padding:0;font-size:1em"># Manter branch, criar novo PR com descrição atualizada
    gh pr create --title "<novo titulo>" --body "<nova descrição com contexto>"
    <h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">Atualizar config com novo número de PR</h2>
    </code></pre></p><p style="margin:8px 0"><strong style="color:#e5e7eb">Defer:</strong>
    <pre style="background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0"><code style="color:#a5f3fc;background:none;padding:0;font-size:1em"># Mover para uma seção notes.deferred no config
    <h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">Será apresentado novamente no próximo full-sync</h2>
    </code></pre></p><p style="margin:8px 0"><h4 style="color:#d1d5db;margin:14px 0 6px;font-size:.95em">8. Auditar PRs abertos (<code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">audit-open</code>)</h4></p><p style="margin:8px 0">Análise proativa dos PRs <strong style="color:#e5e7eb">ainda abertos</strong> para detectar redundâncias e obsolescência. Deve rodar no <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">full-sync</code> depois do <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">update-config</code>.</p><p style="margin:8px 0">#### 8.1. Resolved upstream</p><p style="margin:8px 0">Verificar se o upstream já resolveu o problema que nosso PR corrige, sem mergear nosso PR:</p><p style="margin:8px 0"><pre style="background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0"><code style="color:#a5f3fc;background:none;padding:0;font-size:1em"># Para cada PR aberto, buscar os arquivos que ele toca
    gh pr view <number> --repo <repo> --json files --jq '[.files[].path]'</p><p style="margin:8px 0"><h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">Verificar se upstream alterou esses mesmos arquivos recentemente</h2>
    <h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">(commits no upstream/main que não estão no nosso PR branch)</h2>
    git log --oneline upstream/main --since="<lastSync>" -- <files></p><p style="margin:8px 0"><h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">Se houve mudanças upstream nos mesmos arquivos, verificar se o diff</h2>
    <h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">do nosso PR ainda faz diferença (pode ter sido absorvido)</h2>
    git diff upstream/main..origin/<branch> -- <files>
    </code></pre></p><p style="margin:8px 0"><strong style="color:#e5e7eb">Se o diff do PR estiver vazio</strong> (upstream absorveu as mudanças): marcar como <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">resolved_upstream</code>.
    <strong style="color:#e5e7eb">Se o diff for parcial</strong> (upstream resolveu parte): marcar como <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">partially_resolved</code> para revisão.</p><p style="margin:8px 0">#### 8.2. Duplicate externo</p><p style="margin:8px 0">Verificar se outra pessoa abriu um PR que resolve o mesmo problema:</p><p style="margin:8px 0"><pre style="background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0"><code style="color:#a5f3fc;background:none;padding:0;font-size:1em"># Buscar PRs abertos no upstream que tocam os mesmos arquivos
    gh pr list --state open --repo <repo> --json number,title,headRefName,files --limit 50</p><p style="margin:8px 0"><h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">Buscar PRs mergeados recentes que tocam os mesmos arquivos</h2>
    gh pr list --state merged --repo <repo> --json number,title,mergedAt,files --limit 30 \
      | jq '[.[] | select(.mergedAt >= "<lastSync>")]'
    </code></pre></p><p style="margin:8px 0">Para cada PR encontrado que toca os mesmos arquivos, comparar:
    <li style="color:#94a3b8;margin:3px 0">Mesmo issue referenciado?</li>
    <li style="color:#94a3b8;margin:3px 0">Mesma área de código?</li>
    <li style="color:#94a3b8;margin:3px 0">Mesmo tipo de fix?</li></p><p style="margin:8px 0">Se houver match forte: marcar como <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">duplicate_external</code> ou <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">superseded_external</code>.</p><p style="margin:8px 0">#### 8.3. Self-duplicate</p><p style="margin:8px 0">Detectar sobreposição entre nossos próprios PRs abertos:</p><p style="margin:8px 0"><pre style="background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0"><code style="color:#a5f3fc;background:none;padding:0;font-size:1em"># Coletar files de todos os nossos PRs abertos
    for pr in <openPRs>; do
      gh pr view $pr --repo <repo> --json number,files --jq '{number, files: [.files[].path]}'
    done</p><p style="margin:8px 0"><h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">Cruzar: se dois PRs tocam os mesmos arquivos, são candidatos a duplicata</h2>
    </code></pre></p><p style="margin:8px 0">Para cada par com overlap de arquivos:
    <li style="color:#94a3b8;margin:3px 0">Verificar se o diff é similar ou complementar</li>
    <li style="color:#94a3b8;margin:3px 0">Se similar: recomendar fechar o mais antigo/menos limpo</li>
    <li style="color:#94a3b8;margin:3px 0">Se complementar: ok, apenas nota informativa</li></p><p style="margin:8px 0">#### 8.4. Apresentar resultados</p><p style="margin:8px 0"><pre style="background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0"><code style="color:#a5f3fc;background:none;padding:0;font-size:1em">### Audit de PRs Abertos</p><p style="margin:8px 0">#### Possivelmente resolvidos upstream
    | # | Titulo | Arquivos em comum | Status |
    |---|--------|-------------------|--------|
    | 123 | fix(foo): bar | foo.ts (changed upstream 3 days ago) | ⚠️ Verificar |</p><p style="margin:8px 0">#### Possíveis duplicatas externas
    | Nosso PR | PR externo | Overlap | Recomendação |
    |----------|-----------|---------|--------------|
    | #123 | #456 (@user) | foo.ts, bar.ts | ⚠️ Mesmo issue, verificar |</p><p style="margin:8px 0">#### Self-duplicates (nossos PRs que se sobrepõem)
    | PR A | PR B | Arquivos em comum | Recomendação |
    |------|------|-------------------|--------------|
    | #6471 | #8386 | skills/refresh.ts | 🗑️ Fechar #6471 (duplicata) |</p><p style="margin:8px 0"><strong style="color:#e5e7eb">Opções por PR flagged:</strong>
    1. 🗑️ <strong style="color:#e5e7eb">Close</strong> — fechar o PR no upstream e drop
    2. ✅ <strong style="color:#e5e7eb">Keep</strong> — falso positivo, manter aberto
    3. 🔄 <strong style="color:#e5e7eb">Merge into</strong> — combinar com outro PR
    4. ⏸️ <strong style="color:#e5e7eb">Defer</strong> — revisitar depois
    </code></pre></p><p style="margin:8px 0"><h3 style="color:#e5e7eb;margin:18px 0 8px;font-size:1.05em">Comandos do Agente</h3></p><p style="margin:8px 0"><h4 style="color:#d1d5db;margin:14px 0 6px;font-size:.95em"><code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">status</code> - Verificar estado atual</h4></p><p style="margin:8px 0">1. Carregar config
    2. Fetch remotes
    3. Contar commits atrás do upstream
    4. Listar PRs e seus estados
    5. Reportar ao usuário</p><p style="margin:8px 0"><h4 style="color:#d1d5db;margin:14px 0 6px;font-size:.95em"><code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">sync</code> - Sincronizar main com upstream</h4></p><p style="margin:8px 0"><pre style="background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0"><code style="color:#a5f3fc;background:none;padding:0;font-size:1em">cd <localPath>
    git fetch <upstreamRemote>
    git checkout <mainBranch>
    git merge <upstreamRemote>/<mainBranch>
    git push <originRemote> <mainBranch>
    </code></pre></p><p style="margin:8px 0"><h4 style="color:#d1d5db;margin:14px 0 6px;font-size:.95em"><code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">rebase <branch></code> - Rebase de uma branch específica</h4></p><p style="margin:8px 0"><pre style="background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0"><code style="color:#a5f3fc;background:none;padding:0;font-size:1em">git checkout <branch>
    git fetch <upstreamRemote>
    git rebase <upstreamRemote>/<mainBranch>
    <h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">Se conflito: resolver e git rebase --continue</h2>
    git push <originRemote> <branch> --force-with-lease
    </code></pre></p><p style="margin:8px 0"><h4 style="color:#d1d5db;margin:14px 0 6px;font-size:.95em"><code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">rebase-all</code> - Rebase de todas as branches de PR</h4></p><p style="margin:8px 0">Para cada branch em <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">prBranches</code>:</p><p style="margin:8px 0">1. Checkout da branch
    2. Rebase no upstream/main
    3. Push com --force-with-lease
    4. Reportar sucesso/falha</p><p style="margin:8px 0"><h4 style="color:#d1d5db;margin:14px 0 6px;font-size:.95em"><code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">resolve-conflicts</code> - Resolução automática de conflitos via subagentes</h4></p><p style="margin:8px 0">> <strong style="color:#e5e7eb">Requer <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">--auto-resolve</code> na invocação OU <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">autoResolveConflicts: true</code> no config do repo.</strong> Se nenhum dos dois, este comando não é executado e conflitos são apenas reportados com a nota "⚠️ Conflitos requerem aval do desenvolvedor."</p><p style="margin:8px 0">Após <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">rebase-all</code> detectar conflitos, o <strong style="color:#e5e7eb">orchestrator</strong> (agente principal) spawna subagentes individuais para tentar resolver cada conflito automaticamente.</p><p style="margin:8px 0">#### Fluxo</p><p style="margin:8px 0">1. O worker do <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">rebase-all</code> retorna a lista de branches com conflito
    2. O orchestrator agrupa os conflitos e spawna <strong style="color:#e5e7eb">até 5 subagentes simultâneos</strong> (model: Opus)
    3. Conforme subagentes terminam, novos são lançados até esgotar a fila
    4. Cada subagente tem <strong style="color:#e5e7eb">timeout de 10 minutos</strong>
    5. Resultados são coletados e integrados no relatório final</p><p style="margin:8px 0">#### Prompt do subagente resolver</p><p style="margin:8px 0">Cada subagente recebe:</p><p style="margin:8px 0"><pre style="background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0"><code style="color:#a5f3fc;background:none;padding:0;font-size:1em">Resolve o conflito de rebase da branch <branch> (PR #<number>) no repo <localPath>.</p><p style="margin:8px 0"><h3 style="color:#e5e7eb;margin:18px 0 8px;font-size:1.05em">Contexto</h3>
    <li style="color:#94a3b8;margin:3px 0">Upstream: <upstreamRemote>/<mainBranch></li>
    <li style="color:#94a3b8;margin:3px 0">Branch do PR: <originRemote>/<branch></li>
    <li style="color:#94a3b8;margin:3px 0">Arquivos em conflito: <lista de arquivos do erro de rebase></li></p><p style="margin:8px 0"><h3 style="color:#e5e7eb;margin:18px 0 8px;font-size:1.05em">Passos</h3>
    1. cd <localPath>
    2. git checkout -B <branch> <originRemote>/<branch> --no-track
    3. git rebase <upstreamRemote>/<mainBranch>
       → O rebase vai parar com conflito
    4. Para cada arquivo em conflito:
       a. Ler o arquivo com os marcadores de conflito (<<<<<<<, =======, >>>>>>>)
       b. Entender o que o upstream mudou (OURS) vs o que o PR mudou (THEIRS)
       c. Resolver preservando a intenção de ambos
       d. git add <arquivo>
    5. git rebase --continue
    6. Se houver mais conflitos em commits subsequentes, repetir 4-5
    7. git push <originRemote> <branch> --force-with-lease</p><p style="margin:8px 0"><h3 style="color:#e5e7eb;margin:18px 0 8px;font-size:1.05em">Regras de resolução</h3>
    <li style="color:#94a3b8;margin:3px 0"><strong style="color:#e5e7eb">Arquivo deletado no upstream + modificado pelo PR:</strong> aceitar a deleção do upstream (nosso PR targeted código que não existe mais). git rm <arquivo> && git rebase --continue</li>
    <li style="color:#94a3b8;margin:3px 0"><strong style="color:#e5e7eb">Import/formatting conflicts:</strong> mesclar ambos, preservar imports de ambos os lados</li>
    <li style="color:#94a3b8;margin:3px 0"><strong style="color:#e5e7eb">Lógica alterada em ambos os lados:</strong> preservar a mudança do upstream E encaixar o fix do PR. Se o fix do PR não faz mais sentido com o novo código upstream, reportar como UNRESOLVABLE.</li>
    <li style="color:#94a3b8;margin:3px 0"><strong style="color:#e5e7eb">NUNCA alterar a lógica do PR</strong> — apenas adaptar ao novo contexto do upstream</li></p><p style="margin:8px 0"><h3 style="color:#e5e7eb;margin:18px 0 8px;font-size:1.05em">Output</h3>
    Responda com EXATAMENTE um destes formatos:</p><p style="margin:8px 0">RESOLVED|<branch>|trivial|<resumo de 1 linha>
    RESOLVED|<branch>|semantic|<resumo de 1 linha>
    UNRESOLVABLE|<branch>|<motivo de 1 linha>
    </code></pre></p><p style="margin:8px 0">#### Classificação do resultado</p><p style="margin:8px 0">| Resultado | Significado | Ação |
    |-----------|-------------|------|
    | <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">RESOLVED\|trivial</code> | Conflito mecânico resolvido (imports, formatting, deleted files) | ✅ Push feito, sem necessidade de revisão |
    | <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">RESOLVED\|semantic</code> | Conflito envolvendo lógica de negócio resolvido | ⚠️ Push feito, <strong style="color:#e5e7eb">marcar no report para revisão humana</strong> |
    | <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">UNRESOLVABLE</code> | Subagente não conseguiu resolver sem risco | ❌ Não faz push, escala no report |</p><p style="margin:8px 0">#### Após resolução</p><p style="margin:8px 0">Para branches resolvidas com sucesso:
    1. Verificar que o push foi feito (<code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">git log --oneline <originRemote>/<branch> -1</code>)
    2. Tentar rebase novamente para confirmar que está clean
    3. Atualizar <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">notes.conflictBranches</code> no config: remover entries resolvidas</p><p style="margin:8px 0">Para branches não resolvidas:
    1. Manter em <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">notes.conflictBranches</code> com ciclo incrementado
    2. Incluir no relatório com o motivo do subagente</p><p style="margin:8px 0">#### Integração com build-production</p><p style="margin:8px 0">Após <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">resolve-conflicts</code>, o <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">build-production</code> roda normalmente. Branches que foram resolvidas no rebase agora devem mergear clean na production. Se ainda houver conflito de <strong style="color:#e5e7eb">production merge</strong> (diferente do conflito de rebase), o <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">build-production</code> trata como sempre: abort e reportar.</p><p style="margin:8px 0"><h4 style="color:#d1d5db;margin:14px 0 6px;font-size:.95em"><code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">update-config</code> - Atualizar config com PRs atuais</h4></p><p style="margin:8px 0"><pre style="background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0"><code style="color:#a5f3fc;background:none;padding:0;font-size:1em"># Buscar PRs abertos
    gh pr list --state open --author @me --repo <repo> --json number,headRefName</p><p style="margin:8px 0"><h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">Atualizar o arquivo $SKILL_DIR/repos/<repo-name>/config.json com os PRs atuais</h2>
    <h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">Usar jq ou editar manualmente o JSON</h2>
    </code></pre></p><p style="margin:8px 0">#### Detecção de PRs reabertos</p><p style="margin:8px 0">Ao comparar a lista do GitHub (<code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">gh pr list --state open</code>) com o config local, detectar <strong style="color:#e5e7eb">três cenários</strong>:</p><p style="margin:8px 0">| Cenário | Condição | Ação |
    |---------|----------|------|
    | <strong style="color:#e5e7eb">PR novo</strong> | No GitHub mas não em <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">openPRs</code>, <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">localPatches</code>, nem <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">notes</code> | Adicionar a <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">openPRs</code> + <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">prBranches</code> normalmente |
    | <strong style="color:#e5e7eb">PR reaberto (dropped)</strong> | No GitHub como open, encontrado em <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">notes.closedWithoutMerge</code> ou <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">notes.droppedPatches</code> | <strong style="color:#e5e7eb">Restaurar</strong>: mover de volta para <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">openPRs</code> + <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">prBranches</code>, remover da seção <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">notes</code>. Fetch da branch: <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">git fetch <originRemote> <branch></code>. Logar no relatório como "🔄 Reopened" |
    | <strong style="color:#e5e7eb">PR reaberto (local patch)</strong> | No GitHub como open, encontrado em <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">localPatches</code> (via campo <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">originalPR</code>) | <strong style="color:#e5e7eb">Promover</strong>: mover de <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">localPatches</code> para <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">openPRs</code> + <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">prBranches</code>. Logar no relatório como "🔄 Reopened (was local patch)" |</p><p style="margin:8px 0"><strong style="color:#e5e7eb">Implementação:</strong></p><p style="margin:8px 0"><pre style="background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0"><code style="color:#a5f3fc;background:none;padding:0;font-size:1em"># Para cada PR open no GitHub que NÃO está em openPRs:
    <h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">1. Checar se o número está em notes.closedWithoutMerge ou notes.droppedPatches</h2>
    <h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">   → Se sim: PR foi reaberto. Restaurar automaticamente.</h2>
    <h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">2. Checar se algum entry em localPatches tem originalPR == número</h2>
    <h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">   → Se sim: PR foi reaberto. Promover de volta a openPRs.</h2>
    <h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">3. Se não encontrado em lugar nenhum: PR genuinamente novo.</h2></p><p style="margin:8px 0"><h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">Restaurar branch se foi deletada:</h2>
    git fetch <originRemote> <branch> 2>/dev/null || git fetch <originRemote> pull/<number>/head:<branch>
    </code></pre></p><p style="margin:8px 0"><strong style="color:#e5e7eb">Nota:</strong> A restauração é automática (sem interação) porque o mantenedor reabrir um PR é sinal claro de que ele deve voltar ao tracking. O relatório sempre lista os PRs restaurados para visibilidade.</p><p style="margin:8px 0"><h4 style="color:#d1d5db;margin:14px 0 6px;font-size:.95em"><code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">build-production</code> - Criar branch de produção com todos os PRs + local patches</h4></p><p style="margin:8px 0"><pre style="background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0"><code style="color:#a5f3fc;background:none;padding:0;font-size:1em">cd <localPath>
    git fetch <upstreamRemote>
    git fetch <originRemote></p><p style="margin:8px 0"><h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">⚠️ SEMPRE preservar arquivos não-commitados antes de trocar de branch</h2>
    if [ -n "$(git status --porcelain)" ]; then
      git stash push --include-untracked -m "fork-manager: pre-build-production $(date -u +%Y%m%dT%H%M%S)"
      STASHED=1
    fi</p><p style="margin:8px 0"><h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">Deletar branch antiga se existir</h2>
    git branch -D <productionBranch> 2>/dev/null || true</p><p style="margin:8px 0"><h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">Criar nova branch a partir do upstream</h2>
    git checkout -b <productionBranch> <upstreamRemote>/<mainBranch></p><p style="margin:8px 0"><h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">1. Mergear cada PR branch (contribuições upstream pendentes)</h2>
    for branch in <prBranches>; do
      git merge <originRemote>/$branch -m "Merge PR #<number>: <title>"
      # Se conflito, resolver
    done</p><p style="margin:8px 0"><h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">2. Mergear cada local patch (fixes mantidos localmente)</h2>
    for branch in <localPatches>; do
      git merge <originRemote>/$branch -m "Merge local patch: <description>"
      # Se conflito, resolver
    done</p><p style="margin:8px 0"><h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">Push</h2>
    git push <originRemote> <productionBranch> --force-with-lease</p><p style="margin:8px 0"><h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">Restaurar arquivos não-commitados</h2>
    if [ "$STASHED" = "1" ]; then
      git stash pop
    fi
    </code></pre></p><p style="margin:8px 0"><strong style="color:#e5e7eb">After rebuilding the production branch, remind the user to run their project's build command if needed.</strong></p><p style="margin:8px 0"><strong style="color:#e5e7eb">Ordem de merge:</strong> PRs abertos primeiro (ordem crescente por número), local patches depois. Isso garante que patches locais se aplicam sobre a base mais completa possível.</p><p style="margin:8px 0"><h4 style="color:#d1d5db;margin:14px 0 6px;font-size:.95em"><code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">audit-open</code> - Auditar PRs abertos por redundância/obsolescência</h4></p><p style="margin:8px 0">Análise proativa de todos os PRs abertos (seção 8 acima):</p><p style="margin:8px 0">1. Para cada PR aberto, coletar arquivos tocados
    2. <strong style="color:#e5e7eb">Resolved upstream</strong>: verificar se upstream alterou os mesmos arquivos desde último sync; se diff do PR ficou vazio, flaggar
    3. <strong style="color:#e5e7eb">Duplicate externo</strong>: buscar PRs upstream (open + recently merged) que tocam mesmos arquivos
    4. <strong style="color:#e5e7eb">Self-duplicate</strong>: cruzar arquivos entre nossos próprios PRs abertos
    5. Apresentar findings ao usuário com opções: close / keep / merge-into / defer
    6. Executar decisões
    7. Atualizar config</p><p style="margin:8px 0"><h4 style="color:#d1d5db;margin:14px 0 6px;font-size:.95em"><code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">review-closed</code> - Revisar PRs recém-fechados</h4></p><p style="margin:8px 0">Detecta PRs que foram fechados/mergeados desde o último sync e guia o usuário na decisão:</p><p style="margin:8px 0">1. Buscar todos os PRs do config no GitHub
    2. Identificar os que mudaram de estado (merged ou closed)
    3. Para <strong style="color:#e5e7eb">merged</strong>: mover para <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">notes.mergedUpstream</code>, deletar branches
    4. Para <strong style="color:#e5e7eb">closed sem merge</strong>: iniciar fluxo de revisão interativo (seção 7 acima)
    5. Para cada closed, apresentar contexto e opções ao usuário
    6. Executar decisão: drop / keep as local patch / resubmit / defer
    7. Atualizar config</p><p style="margin:8px 0"><h4 style="color:#d1d5db;margin:14px 0 6px;font-size:.95em"><code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">review-patches</code> - Reavaliar patches locais existentes</h4></p><p style="margin:8px 0">Para cada entry em <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">localPatches</code> cuja <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">reviewDate</code> já passou:</p><p style="margin:8px 0">1. Verificar se upstream resolveu o problema desde a última revisão
    2. Verificar se o patch ainda aplica limpo (sem conflitos)
    3. Apresentar ao usuário com opções: manter / drop / resubmit / estender reviewDate
    4. Atualizar config</p><p style="margin:8px 0"><h4 style="color:#d1d5db;margin:14px 0 6px;font-size:.95em"><code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">full-sync</code> - Sincronização completa</h4></p><p style="margin:8px 0">1. <strong style="color:#e5e7eb">Stash</strong> - <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">git stash --include-untracked</code> se houver arquivos não-commitados
    2. <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">sync</code> - Atualizar main
       - <strong style="color:#e5e7eb">Before sync:</strong> record <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">OLD_SHA=$(git rev-parse upstream/main)</code>
       - <strong style="color:#e5e7eb">After sync:</strong> record <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">NEW_SHA=$(git rev-parse upstream/main)</code>
    3. <strong style="color:#e5e7eb"><code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">post-sync hooks</code></strong> *(optional, repo-specific)* - Run custom post-sync actions
       - Skip if <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">OLD_SHA == NEW_SHA</code> (no upstream changes)
       - Hooks are defined per-repo in <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">config.json</code> under <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">"postSyncHooks"</code> (array of shell commands or descriptions)
       - Example: detect CHANGELOG changes, update downstream skills, trigger CI
       - If no hooks configured: skip this step entirely
    4. <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">update-config</code> - Atualizar lista de PRs
    5. <strong style="color:#e5e7eb"><code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">review-closed</code></strong> - Revisar PRs recém-fechados/mergeados (interativo)
    6. <strong style="color:#e5e7eb"><code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">audit-open</code></strong> - Auditar PRs abertos por redundância/obsolescência (interativo)
    7. <strong style="color:#e5e7eb"><code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">review-patches</code></strong> - Reavaliar local patches com reviewDate vencida (interativo)
    8. <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">rebase-all</code> - Rebase de todas as branches (PRs + local patches)
    9. <strong style="color:#e5e7eb"><code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">resolve-conflicts</code></strong> *(only if <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">--auto-resolve</code> flag OR <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">autoResolveConflicts: true</code> in config)* - Resolver conflitos de rebase automaticamente via subagentes (Opus, até 5 paralelos, 10min timeout cada). Se nenhum dos dois, pular este passo.
    10. <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">build-production</code> - Recriar branch de produção (PRs + local patches)
    11. <strong style="color:#e5e7eb">Pop stash</strong> - <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">git stash pop</code> para restaurar arquivos locais
    12. Remind user to run their project's build command if needed</p><p style="margin:8px 0"><strong style="color:#e5e7eb">Nota sobre ordem:</strong> <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">update-config</code> roda <strong style="color:#e5e7eb">antes</strong> de <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">review-closed</code> porque é ali que PRs reabertos são detectados e restaurados automaticamente. Depois, <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">review-closed</code> processa PRs que foram genuinamente fechados. Por fim, <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">audit-open</code> roda por último, já com a lista de PRs abertos atualizada (incluindo os reabertos).</p><p style="margin:8px 0"><h3 style="color:#e5e7eb;margin:18px 0 8px;font-size:1.05em">Relatório para o Usuário</h3></p><p style="margin:8px 0">Após qualquer operação, gerar relatório:</p><p style="margin:8px 0"><pre style="background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0"><code style="color:#a5f3fc;background:none;padding:0;font-size:1em">## 🍴 Fork Status: <repo></p><p style="margin:8px 0"><h4 style="color:#d1d5db;margin:14px 0 6px;font-size:.95em">Upstream Sync</h4></p><p style="margin:8px 0"><li style="color:#94a3b8;margin:3px 0"><strong style="color:#e5e7eb">Main branch:</strong> X commits behind upstream</li>
    <li style="color:#94a3b8;margin:3px 0"><strong style="color:#e5e7eb">Last sync:</strong> <date></li></p><p style="margin:8px 0"><h4 style="color:#d1d5db;margin:14px 0 6px;font-size:.95em">Open PRs (Y total)</h4></p><p style="margin:8px 0">| #   | Branch        | Status           | Action Needed     |
    | --- | ------------- | ---------------- | ----------------- |
    | 123 | fix/issue-123 | ✅ Up to date    | None              |
    | 456 | feat/feature  | ⚠️ Needs rebase  | Run rebase        |
    | 789 | fix/bug       | ❌ Has conflicts | Manual resolution |</p><p style="margin:8px 0">#### 🔧 Resolução Automática de Conflitos</p><p style="margin:8px 0">_Seção presente apenas quando resolução automática está ativa (<code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">--auto-resolve</code> ou <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">autoResolveConflicts: true</code>). Caso contrário, substituir por:_
    > ⚠️ <strong style="color:#e5e7eb">Conflitos requerem aval do desenvolvedor.</strong> Resolução automática não ativada. Use <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">--auto-resolve</code> para tentar resolver automaticamente.</p><p style="margin:8px 0">_Quando ativa: Conflitos semânticos (⚠️) foram resolvidos automaticamente mas <strong style="color:#e5e7eb">requerem revisão humana</strong> — o subagente pode ter interpretado mal a intenção do código._</p><p style="margin:8px 0">| #   | Branch        | Tipo      | Resultado          | Detalhe                          |
    | --- | ------------- | --------- | ------------------ | -------------------------------- |
    | 123 | fix/issue-123 | trivial   | ✅ Resolvido        | Removed deleted test file        |
    | 456 | fix/issue-456 | semântico | ⚠️ Resolvido (revisar) | Adapted runner call to new API   |
    | 789 | fix/issue-789 | —         | ❌ Não resolvido    | Lógica incompatível com upstream |</p><p style="margin:8px 0">#### 🔴 Conflitos persistentes (3+ ciclos)</p><p style="margin:8px 0">_Seção presente apenas quando há conflitos que persistem por 3 ou mais execuções consecutivas da skill, mesmo após tentativa de resolução automática. Esses PRs merecem atenção prioritária: considerar dropar, recriar sobre o main atual, ou resolver manualmente._</p><p style="margin:8px 0">| #   | Branch        | Ciclos | Arquivo(s)        | Recomendação        |
    | --- | ------------- | ------ | ----------------- | ------------------- |
    | 789 | fix/bug       | 5      | agent-runner.ts   | 🗑️ Dropar ou recriar |</p><p style="margin:8px 0"><h4 style="color:#d1d5db;margin:14px 0 6px;font-size:.95em">Local Patches (Z total)</h4></p><p style="margin:8px 0">| Branch             | Original PR | Motivo          | Review em  |
    | ------------------ | ----------- | --------------- | ---------- |
    | local/my-fix       | #321        | rejected_need   | 2026-03-07 |
    | local/custom-tweak | —           | wontfix         | 2026-04-01 |</p><p style="margin:8px 0"><h4 style="color:#d1d5db;margin:14px 0 6px;font-size:.95em">Audit de PRs Abertos</h4></p><p style="margin:8px 0">| #   | Título           | Flag                | Detalhe                          |
    | --- | ---------------- | ------------------- | -------------------------------- |
    | 123 | fix(foo): bar    | ⚠️ resolved_upstream | upstream changed foo.ts 3d ago   |
    | 456 | fix(baz): qux    | ⚠️ duplicate_external | similar to #789 by @user         |
    | 111 | fix(a): b        | ⚠️ self_duplicate    | overlaps with our #222           |</p><p style="margin:8px 0"><h4 style="color:#d1d5db;margin:14px 0 6px;font-size:.95em">PRs Reabertos (restaurados automaticamente)</h4></p><p style="margin:8px 0">| #   | Título           | Origem              | Ação                    |
    | --- | ---------------- | ------------------- | ----------------------- |
    | 777 | fix(foo): bar    | notes.droppedPatches | 🔄 Restored to openPRs |
    | 888 | feat(baz): qux   | localPatches         | 🔄 Promoted to openPRs |</p><p style="margin:8px 0">_Seção presente apenas quando há PRs reabertos no ciclo atual._</p><p style="margin:8px 0"><h4 style="color:#d1d5db;margin:14px 0 6px;font-size:.95em">PRs Recém-Fechados (aguardando decisão)</h4></p><p style="margin:8px 0">| #   | Título           | Fechado em | Motivo              | Recomendação     |
    | --- | ---------------- | ---------- | ------------------- | ---------------- |
    | 999 | fix(foo): bar    | 2026-02-05 | resolved_upstream   | 🗑️ Drop          |
    | 888 | feat(baz): qux   | 2026-02-06 | rejected_need       | 📌 Local patch   |</p><p style="margin:8px 0"><h4 style="color:#d1d5db;margin:14px 0 6px;font-size:.95em">Production Branch</h4></p><p style="margin:8px 0"><li style="color:#94a3b8;margin:3px 0"><strong style="color:#e5e7eb">Branch:</strong> main-with-all-prs</li>
    <li style="color:#94a3b8;margin:3px 0"><strong style="color:#e5e7eb">Contains:</strong> PRs #123, #456 + Local patches: local/my-fix, local/custom-tweak</li>
    <li style="color:#94a3b8;margin:3px 0"><strong style="color:#e5e7eb">Status:</strong> ✅ Up to date / ⚠️ Needs rebuild</li></p><p style="margin:8px 0"><h4 style="color:#d1d5db;margin:14px 0 6px;font-size:.95em">Recommended Actions</h4></p><p style="margin:8px 0">1. ...
    2. ...
    </code></pre></p><p style="margin:8px 0"><h3 style="color:#e5e7eb;margin:18px 0 8px;font-size:1.05em">Notas Importantes</h3></p><p style="margin:8px 0"><li style="color:#94a3b8;margin:3px 0">Sempre usar <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">--force-with-lease</code> em vez de <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">--force</code> para push</li>
    <li style="color:#94a3b8;margin:3px 0">Sempre fazer backup antes de operações destrutivas</li>
    <li style="color:#94a3b8;margin:3px 0">Use the project's package manager for build commands (bun/npm/yarn/pnpm)</li>
    <li style="color:#94a3b8;margin:3px 0">Manter o config atualizado após cada operação</li>
    <li style="color:#94a3b8;margin:3px 0"><strong style="color:#e5e7eb">Resolução automática de conflitos (requer <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">--auto-resolve</code> ou <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">autoResolveConflicts: true</code>):</strong> Quando ativa, após <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">rebase-all</code> a skill spawna subagentes (Opus, até 5 paralelos, 10min timeout cada) para tentar resolver conflitos. Conflitos triviais (imports, formatting, arquivos deletados) são resolvidos e pushed sem necessidade de revisão. <strong style="color:#e5e7eb">Conflitos semânticos</strong> (lógica de negócio) são resolvidos e pushed mas <strong style="color:#e5e7eb">marcados no relatório como ⚠️ para revisão humana</strong>. Se o subagente não conseguir resolver, marca como ❌ e não faz push. <strong style="color:#e5e7eb">Quando desativada</strong>, conflitos são apenas reportados.</li>
    <li style="color:#94a3b8;margin:3px 0"><strong style="color:#e5e7eb">Conflitos persistentes (3+ ciclos):</strong> Quando um conflito persiste por 3+ execuções consecutivas (tracked pelo sufixo "Nth cycle" em <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">notes.conflictBranches</code>), escalar no relatório com seção dedicada "🔴 Conflitos persistentes" e recomendar ação: dropar o PR, recriar a branch, ou resolver manualmente. O ciclo é incrementado a cada execução onde o conflito reaparece, <strong style="color:#e5e7eb">mesmo que a resolução automática tenha sido tentada e falhado</strong>.</li>
    <li style="color:#94a3b8;margin:3px 0"><strong style="color:#e5e7eb">Local patches são cidadãos de primeira classe:</strong> rebase, build e relatório incluem tanto PRs abertos quanto local patches</li>
    <li style="color:#94a3b8;margin:3px 0"><strong style="color:#e5e7eb">Nunca remover automaticamente um PR fechado sem merge.</strong> Sempre passar pelo fluxo <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">review-closed</code> para decisão do usuário</li>
    <li style="color:#94a3b8;margin:3px 0"><strong style="color:#e5e7eb">Review dates em local patches:</strong> ao criar um local patch, definir uma data de revisão (default: 30 dias). No <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">full-sync</code>, patches com review vencida são apresentados ao usuário para reavaliação</li>
    <li style="color:#94a3b8;margin:3px 0"><strong style="color:#e5e7eb">Naming convention para local patches:</strong> prefixo <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">local/</code> para distinguir de branches de PR (ex: <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">local/my-custom-fix</code>). A branch original pode ser renomeada ou mantida — o importante é que o config rastreie a branch correta</li></p><p style="margin:8px 0"><h4 style="color:#d1d5db;margin:14px 0 6px;font-size:.95em">⚠️ Proteger arquivos não-commitados antes de operações destrutivas</h4></p><p style="margin:8px 0">Antes de qualquer operação que troca de branch ou deleta/recria branches (especialmente <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">build-production</code> e <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">full-sync</code>), <strong style="color:#e5e7eb">sempre</strong> verificar e preservar arquivos unstaged, untracked e staged:</p><p style="margin:8px 0"><pre style="background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0"><code style="color:#a5f3fc;background:none;padding:0;font-size:1em">cd <localPath></p><p style="margin:8px 0"><h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">1. Checar se há arquivos em risco</h2>
    git status --porcelain</p><p style="margin:8px 0"><h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">2. Se houver arquivos modificados/untracked, fazer stash com untracked</h2>
    git stash push --include-untracked -m "fork-manager: pre-sync stash $(date -u +%Y%m%dT%H%M%S)"</p><p style="margin:8px 0"><h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">3. Executar a operação (rebase, checkout, merge, etc.)</h2>
    <h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">...</h2></p><p style="margin:8px 0"><h2 style="color:#f3f4f6;margin:20px 0 10px;font-size:1.15em">4. Após concluir, restaurar o stash</h2>
    git stash pop
    </code></pre></p><p style="margin:8px 0"><strong style="color:#e5e7eb">Por quê?</strong> Ao deletar e recriar a branch de produção (<code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">git branch -D <productionBranch></code>), arquivos que existiam apenas no working directory (não commitados) são perdidos permanentemente. Isso inclui:</p><p style="margin:8px 0"><li style="color:#94a3b8;margin:3px 0">Arquivos gerados (dashboards, history, state)</li>
    <li style="color:#94a3b8;margin:3px 0">Arquivos de configuração local (serve.ts, .env)</li>
    <li style="color:#94a3b8;margin:3px 0">Dados acumulados (JSON, SQLite)</li></p><p style="margin:8px 0"><strong style="color:#e5e7eb">Regra:</strong> Se <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">git status --porcelain</code> retornar qualquer saída, fazer <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">git stash --include-untracked</code> antes de prosseguir. Restaurar com <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">git stash pop</code> ao final.</p><p style="margin:8px 0"><h3 style="color:#e5e7eb;margin:18px 0 8px;font-size:1.05em">Security Notice</h3></p><p style="margin:8px 0">This skill performs operations that require broad filesystem and network access by design:</p><p style="margin:8px 0"><li style="color:#94a3b8;margin:3px 0"><strong style="color:#e5e7eb">Git operations</strong>: fetch, checkout, merge, rebase, push across multiple remotes and branches</li>
    <li style="color:#94a3b8;margin:3px 0"><strong style="color:#e5e7eb">GitHub CLI</strong>: reads PR status, creates PRs, queries repo metadata</li>
    <strong style="color:#e5e7eb">Before using this skill on a repository:</strong>
    <li style="color:#94a3b8;margin:3px 0">All git push operations use <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">--force-with-lease</code> (not <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">--force</code>) to prevent data loss</li>
    <li style="color:#94a3b8;margin:3px 0">The skill always stashes uncommitted files before destructive branch operations</li></p><p style="margin:8px 0">These capabilities are inherent to fork management and cannot be removed without breaking core functionality.</p><p style="margin:8px 0"><h3 style="color:#e5e7eb;margin:18px 0 8px;font-size:1.05em">Usage Examples</h3></p><p style="margin:8px 0"><h4 style="color:#d1d5db;margin:14px 0 6px;font-size:.95em">Basic sync</h4>
    User: "sync my fork of project-x"</p><p style="margin:8px 0">Agent:
    1. Load config from <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">$SKILL_DIR/repos/project-x/config.json</code>
    2. Run <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">status</code> to assess current state
    3. If main is behind, run <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">sync</code>
    4. If PRs need rebase, run <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">rebase-all</code>
    5. Update <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">productionBranch</code> if needed
    6. Remind user to rebuild if needed
    7. Report results to user</p><p style="margin:8px 0"><h4 style="color:#d1d5db;margin:14px 0 6px;font-size:.95em">Sync with auto-resolve</h4>
    User: "/fork-manager --auto-resolve" or "/fork-manager full-sync --auto-resolve"</p><p style="margin:8px 0">Agent:
    1. Same as basic sync, but after <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">rebase-all</code>:
    2. For each conflict, spawn a resolver subagent (Opus)
    3. Collect results (trivial ✅ / semantic ⚠️ / unresolvable ❌)
    4. Re-run <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">build-production</code> with resolved branches
    5. Report includes resolution table with review flags
    </p></div></section><section class="skill-card" style="margin-bottom:20px"><h2 style="color:#f8fafc;font-size:1.2em;font-weight:800;margin:0 0 16px;display:flex;align-items:center;gap:8px">⚡ When to Use</h2><div><table style="width:100%;border-collapse:collapse;border:1px solid #1e1e3f;border-radius:8px;overflow:hidden;font-size:.9em"><thead><tr style="background:#0a0a1c"><th style="padding:12px 16px;text-align:left;color:#818cf8;font-weight:700;border-bottom:2px solid #6366f130">Trigger</th><th style="padding:12px 16px;text-align:left;color:#818cf8;font-weight:700;border-bottom:2px solid #6366f130">Action</th></tr></thead><tbody><tr><td style="padding:12px 16px;border-bottom:1px solid #1e1e3f;color:#94a3b8" colspan="2">- Check status of open PRs</td></tr><tr><td style="padding:12px 16px;border-bottom:1px solid #1e1e3f;color:#94a3b8" colspan="2">- Rebase PR branches onto latest upstream</td></tr><tr><td style="padding:12px 16px;border-bottom:1px solid #1e1e3f;color:#94a3b8" colspan="2">- Build a production branch combining all open PRs + local patches</td></tr><tr><td style="padding:12px 16px;border-bottom:1px solid #1e1e3f;color:#94a3b8" colspan="2">- Review recently closed/rejected PRs and decide whether to keep locally</td></tr><tr><td style="padding:12px 16px;border-bottom:1px solid #1e1e3f;color:#94a3b8" colspan="2">- Manage local patches (fixes not submitted or rejected upstream)</td></tr></tbody></table></div></section><section class="skill-card" style="margin-bottom:20px"><h2 style="color:#f8fafc;font-size:1.2em;font-weight:800;margin:0 0 16px;display:flex;align-items:center;gap:8px">⚙️ Configuration</h2><div style="font-size:.92em;color:#94a3b8;line-height:1.75"><p style="margin:8px 0">Configs are organized per repository in <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">repos/<repo-name>/config.json</code> relative to the skill directory:</p><p style="margin:8px 0"><pre style="background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0"><code style="color:#a5f3fc;background:none;padding:0;font-size:1em">fork-manager/
    ├── SKILL.md
    └── repos/
        ├── project-a/
        │   └── config.json
        └── project-b/
            └── config.json
    </code></pre></p><p style="margin:8px 0">Formato do <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">config.json</code>:</p><p style="margin:8px 0"><pre style="background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0"><code style="color:#a5f3fc;background:none;padding:0;font-size:1em">{
      "repo": "owner/repo",
      "fork": "your-user/repo",
      "localPath": "/path/to/local/clone",
      "mainBranch": "main",
      "productionBranch": "main-with-all-prs",
      "upstreamRemote": "upstream",
      "forkRemote": "origin",
      "autoResolveConflicts": false,
      "openPRs": [123, 456],
      "prBranches": {
        "123": "fix/issue-123",
        "456": "feat/feature-456"
      },
      "localPatches": {
        "local/my-custom-fix": {
          "description": "Breve descrição do que o patch faz",
          "originalPR": 789,
          "closedReason": "rejected|superseded|duplicate|wontfix",
          "keepReason": "Motivo pelo qual mantemos localmente",
          "addedAt": "2026-02-07T00:00:00Z",
          "reviewDate": "2026-03-07T00:00:00Z"
        }
      },
      "lastSync": "2026-01-28T12:00:00Z",
      "notes": {
        "mergedUpstream": {},
        "closedWithoutMerge": {},
        "droppedPatches": {}
      }
    }
    </code></pre></p><p style="margin:8px 0"><h4 style="color:#d1d5db;margin:14px 0 6px;font-size:.95em">Resolução automática de conflitos (<code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">autoResolveConflicts</code>)</h4></p><p style="margin:8px 0">A resolução automática pode ser ativada de <strong style="color:#e5e7eb">duas formas</strong> (qualquer uma basta):</p><p style="margin:8px 0">1. <strong style="color:#e5e7eb">Flag de invocação</strong> (ad-hoc, por execução):
       <pre style="background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0"><code style="color:#a5f3fc;background:none;padding:0;font-size:1em">   /fork-manager --auto-resolve
       /fork-manager full-sync --auto-resolve
       </code></pre>
    2. <strong style="color:#e5e7eb">Config persistente</strong> (sempre ativo pra aquele repo):
       <pre style="background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0"><code style="color:#a5f3fc;background:none;padding:0;font-size:1em">   { "autoResolveConflicts": true }
       </code></pre></p><p style="margin:8px 0">| Fonte | Comportamento |
    |-------|---------------|
    | Nenhuma (default) | Conflitos são reportados mas <strong style="color:#e5e7eb">não resolvidos</strong>. Relatório inclui "⚠️ Conflitos requerem aval do desenvolvedor." |
    | <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">--auto-resolve</code> OU <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">config.autoResolveConflicts: true</code> | Spawna subagentes Opus para resolver conflitos. Resultados classificados como trivial/semântico/irresolvível. |</p><p style="margin:8px 0"><strong style="color:#e5e7eb">Precedência:</strong> <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">--auto-resolve</code> na invocação ativa a resolução mesmo se o config diz <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">false</code>. Não existe <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">--no-auto-resolve</code> — se o config diz <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">true</code> e o usuário não quer resolver, basta não rodar o passo manualmente.</p><p style="margin:8px 0"><strong style="color:#e5e7eb">Para usuários do ClawHub:</strong> basta passar <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">--auto-resolve</code> no comando. Nenhuma configuração de repo necessária.</p><p style="margin:8px 0"><h4 style="color:#d1d5db;margin:14px 0 6px;font-size:.95em">Campos de <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">localPatches</code></h4></p><p style="margin:8px 0">Cada entry em <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">localPatches</code> é uma branch local mantida na production branch mas <strong style="color:#e5e7eb">sem PR aberto</strong> no upstream.</p><p style="margin:8px 0">| Campo | Descrição |
    |-------|-----------|
    | <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">description</code> | O que o patch faz |
    | <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">originalPR</code> | Número do PR original que foi fechado (opcional se criado direto como patch) |
    | <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">closedReason</code> | Por que o PR foi fechado: <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">rejected</code> (mantenedor recusou), <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">superseded</code> (outro PR resolve parcialmente mas não totalmente), <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">duplicate</code> (fechamos nós mesmos), <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">wontfix</code> (upstream não vai resolver) |
    | <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">keepReason</code> | Por que precisamos manter localmente |
    | <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">addedAt</code> | Data em que foi convertido para local patch |
    | <code style="background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em">reviewDate</code> | Data para reavaliar se ainda é necessário (upstream pode ter resolvido) |</p></div></section></div><div class="two-col-side"></div></div></div><script>
            document.querySelectorAll('.copy-btn, .script-copy-btn').forEach(btn => {
              btn.addEventListener('click', () => {
                const cmd = btn.getAttribute('data-cmd');
                if (!cmd) return;
                navigator.clipboard.writeText(cmd).then(() => {
                  const orig = btn.textContent;
                  btn.textContent = 'Copied!';
                  setTimeout(() => btn.textContent = orig, 1500);
                }).catch(() => {});
              });
            });
          </script><!--$--><!--/$--></main><footer style="background:var(--bg-primary);border-top:1px solid var(--border-secondary);margin-top:60px"><div style="border-top:1px solid var(--border-light);max-width:1200px;margin:0 auto;padding:24px 20px"><div style="display:flex;justify-content:space-between;flex-wrap:wrap;gap:24px;margin-bottom:24px"><div><div style="font-weight:700;color:var(--text-muted);margin-bottom:8px">BytesAgain</div><div style="color:var(--text-muted3);font-size:.82em;max-width:200px">Discover the best AI agent skills for your workflow.</div></div><div><div style="color:var(--text-muted);font-size:.75em;text-transform:uppercase;letter-spacing:1px;margin-bottom:10px">Explore</div><div style="margin-bottom:6px"><a href="/skills" style="color:var(--text-muted2);text-decoration:none;font-size:.85em">Skills</a></div><div style="margin-bottom:6px"><a href="/articles" style="color:var(--text-muted2);text-decoration:none;font-size:.85em">Articles</a></div><div style="margin-bottom:6px"><a href="/use-case" style="color:var(--text-muted2);text-decoration:none;font-size:.85em">Cases</a></div></div><div><div style="color:var(--text-muted);font-size:.75em;text-transform:uppercase;letter-spacing:1px;margin-bottom:10px">Company</div><div style="margin-bottom:6px"><a href="/about" style="color:var(--text-muted2);text-decoration:none;font-size:.85em">About</a></div><div style="margin-bottom:6px"><a href="/contact" style="color:var(--text-muted2);text-decoration:none;font-size:.85em">Contact</a></div><div style="margin-bottom:6px"><a href="/privacy-policy" style="color:var(--text-muted2);text-decoration:none;font-size:.85em">Privacy Policy</a></div><div style="margin-bottom:6px"><a href="/terms" style="color:var(--text-muted2);text-decoration:none;font-size:.85em">Terms</a></div><div style="margin-bottom:6px"><a href="/feedback" style="color:var(--text-muted2);text-decoration:none;font-size:.85em">Feedback</a></div></div></div><div style="border-top:1px solid var(--border-light);padding-top:16px"><div style="color:var(--text-muted4);font-size:.8em;margin-bottom:8px">© <!-- -->2026<!-- --> BytesAgain. All rights reserved.</div><div style="color:var(--text-muted5);font-size:.75em;line-height:1.6;max-width:720px">BytesAgain is an independent skill directory. We index and link to third-party content (ClawHub, GitHub, LobeHub, Dify, etc.) for informational purposes only. All trademarks, skill names, and content are the property of their respective owners. BytesAgain does not claim ownership of any indexed content.</div></div></div></footer><button style="position:fixed;bottom:28px;right:28px;z-index:1000;width:48px;height:48px;border-radius:50%;border:none;cursor:pointer;background:linear-gradient(135deg,#667eea,#00d4ff);color:#fff;font-size:1.3em;box-shadow:0 4px 20px #667eea66;display:flex;align-items:center;justify-content:center;transition:transform .2s">💬</button><script src="/_next/static/chunks/0ze4gu236oq96.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[62894,[\"/_next/static/chunks/0ph_0rx9ah5dc.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/0i_x3w546rsb3.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/06ig5gym-0n-u.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\"],\"LangProvider\"]\n3:I[89220,[\"/_next/static/chunks/0ph_0rx9ah5dc.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/0i_x3w546rsb3.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/06ig5gym-0n-u.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\"],\"ThemeProvider\"]\n4:I[16988,[\"/_next/static/chunks/0ph_0rx9ah5dc.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/0i_x3w546rsb3.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/06ig5gym-0n-u.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\"],\"default\"]\ne:I[68027,[\"/_next/static/chunks/0ph_0rx9ah5dc.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/0i_x3w546rsb3.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/06ig5gym-0n-u.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\"],\"default\",1]\n:HL[\"/_next/static/chunks/051nc0vy_6.rl.css?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"style\"]\n:HL[\"/_next/static/media/caa3a2e1cccd8315-s.p.09~u27dqhyhd6.woff2?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n5:Td5e,"])</script><script>self.__next_f.push([1,"[{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"BytesAgain\",\"url\":\"https://bytesagain.com\",\"description\":\"Search 60,000+ verified AI agent skills via MCP API or REST. Supports 7 languages. Free, no auth required.\",\"inLanguage\":[\"en\",\"zh\",\"es\",\"fr\",\"de\",\"ja\",\"ko\"],\"potentialAction\":{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https://bytesagain.com/skills?q={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}},{\"@context\":\"https://schema.org\",\"@type\":\"Organization\",\"name\":\"BytesAgain\",\"url\":\"https://bytesagain.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://bytesagain.com/og-image.png\"},\"description\":\"AI agent skill directory. Search 60,000+ skills, 1,000+ use cases, and community requests.\",\"foundingDate\":\"2026\",\"foundingLocation\":{\"@type\":\"Place\",\"name\":\"Global\"},\"sameAs\":[\"https://x.com/bytesagain\",\"https://github.com/bytesagain/ai-skills\",\"https://clawhub.ai/profile/bytesagain\"],\"contactPoint\":{\"@type\":\"ContactPoint\",\"email\":\"hello@bytesagain.com\",\"contactType\":\"customer support\"},\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"value\":1}},{\"@context\":\"https://schema.org\",\"@type\":\"WebApplication\",\"name\":\"BytesAgain AI Skills Search\",\"url\":\"https://bytesagain.com\",\"applicationCategory\":\"DeveloperApplication\",\"operatingSystem\":\"Web\",\"description\":\"Search engine and MCP API for 60,000+ AI agent skills. Semantic search, role recommendations, and use case packs.\",\"offers\":{\"@type\":\"Offer\",\"price\":\"0\",\"priceCurrency\":\"USD\"},\"featureList\":[\"Search 60,000+ AI agent skills\",\"Role-based recommendations for developers, creators, and traders\",\"1,000+ curated use case packs\",\"Free MCP API and REST API\",\"Multi-language search (EN, ZH, ES, FR, DE, JA, KO)\"],\"potentialAction\":{\"@type\":\"SearchAction\",\"target\":\"https://bytesagain.com/skills?q={search_term_string}\",\"query-input\":\"required name=search_term_string\"},\"dateModified\":\"2026-07-15\"},{\"@context\":\"https://schema.org\",\"@type\":\"FAQPage\",\"mainEntity\":[{\"@type\":\"Question\",\"name\":\"What is BytesAgain?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"BytesAgain is a curated directory of 60,000+ AI agent skills from ClawHub, GitHub, LobeHub, and Dify. Search skills by keyword in 7 languages, browse by role (developer, creator, trader, marketer) or by use case.\"}},{\"@type\":\"Question\",\"name\":\"How do I find AI skills on BytesAgain?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Use the search bar on BytesAgain.com to search by keyword in 7 languages. You can also browse by role (developer, creator, trader, marketer) or by use case. Each skill shows install instructions for Claude, Cursor, OpenClaw, Continue, and more.\"}},{\"@type\":\"Question\",\"name\":\"Is BytesAgain free?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Yes, BytesAgain is completely free. No registration required for searching skills. The MCP API is also free with rate limits.\"}},{\"@type\":\"Question\",\"name\":\"Does BytesAgain have an API for AI agents?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Yes! BytesAgain provides a free MCP SSE endpoint at /api/mcp/sse for AI agents, plus a REST API at /api/mcp?action=search\u0026q=\u003cquery\u003e. No authentication needed.\"}},{\"@type\":\"Question\",\"name\":\"Can I request a new AI skill on BytesAgain?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Yes! Visit the Requests page on BytesAgain.com to submit a skill request. Your request will be visible to the community and notified to the site admin.\"}}]}]"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"skill\",\"fork-manager\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"skill\",{\"children\":[[\"slug\",\"fork-manager\",\"d\",null],{\"children\":[\"__PAGE__\",{}]}]}]},\"$undefined\",\"$undefined\",16],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/051nc0vy_6.rl.css?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/0ph_0rx9ah5dc.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-1\",{\"src\":\"/_next/static/chunks/0i_x3w546rsb3.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-2\",{\"src\":\"/_next/static/chunks/06ig5gym-0n-u.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"link\",null,{\"rel\":\"llms\",\"href\":\"/llms.txt\"}],[\"$\",\"link\",null,{\"rel\":\"llms-full\",\"href\":\"/llms-full.txt\"}],[\"$\",\"script\",null,{\"async\":true,\"src\":\"https://www.googletagmanager.com/gtag/js?id=G-3C1MM9FWYF\"}],[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"\\n          window.dataLayer = window.dataLayer || [];\\n          function gtag(){dataLayer.push(arguments);}\\n          gtag('js', new Date());\\n          gtag('config', 'G-3C1MM9FWYF');\\n        \"}}]]}],[\"$\",\"body\",null,{\"className\":\"geist_9e050971-module__05dp7a__className\",\"style\":{\"margin\":0},\"children\":[\"$\",\"$L2\",null,{\"children\":[\"$\",\"$L3\",null,{\"children\":[[\"$\",\"div\",null,{\"style\":{\"width\":\"100%\",\"background\":\"var(--bg-subscribe)\",\"borderBottom\":\"1px solid var(--border-primary)\",\"padding\":\"8px 20px\",\"textAlign\":\"center\",\"fontSize\":\".82em\",\"color\":\"#818cf8\"},\"children\":[\"🎁 \",[\"$\",\"strong\",null,{\"style\":{\"color\":\"var(--text-primary)\"},\"children\":\"Get the FREE AI Skills Starter Guide\"}],\" — \",[\"$\",\"a\",null,{\"href\":\"/register\",\"style\":{\"color\":\"#00d4ff\",\"textDecoration\":\"underline\"},\"children\":\"Subscribe →\"}]]}],[\"$\",\"$L4\",null,{}],[\"$\",\"script\",null,{\"type\":\"application/ld+json\",\"dangerouslySetInnerHTML\":{\"__html\":\"$5\"}}],\"$L6\",\"$L7\",\"$L8\"]}]}]}]]}]]}],{\"children\":[\"$L9\",{\"children\":[\"$La\",{\"children\":[\"$Lb\",{},null,false,null]},null,false,\"$@c\"]},null,false,\"$@c\"]},null,false,null],\"$Ld\",false]],\"m\":\"$undefined\",\"G\":[\"$e\",[\"$Lf\"]],\"S\":true,\"h\":null,\"s\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\"}\n"])</script><script>self.__next_f.push([1,"10:I[39756,[\"/_next/static/chunks/0ph_0rx9ah5dc.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/0i_x3w546rsb3.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/06ig5gym-0n-u.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\"],\"default\"]\n11:I[37457,[\"/_next/static/chunks/0ph_0rx9ah5dc.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/0i_x3w546rsb3.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/06ig5gym-0n-u.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\"],\"default\"]\n12:I[22016,[\"/_next/static/chunks/0ph_0rx9ah5dc.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/0i_x3w546rsb3.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/06ig5gym-0n-u.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/0ka051yepewro.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\"],\"\"]\n13:I[90940,[\"/_next/static/chunks/0ph_0rx9ah5dc.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/0i_x3w546rsb3.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/06ig5gym-0n-u.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\"],\"default\"]\n14:I[16397,[\"/_next/static/chunks/0ph_0rx9ah5dc.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/0i_x3w546rsb3.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/06ig5gym-0n-u.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\"],\"default\"]\n16:I[97367,[\"/_next/static/chunks/0ph_0rx9ah5dc.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/0i_x3w546rsb3.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/06ig5gym-0n-u.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\"],\"OutletBoundary\"]\n17:\"$Sreact.suspense\"\n1a:I[97367,[\"/_next/static/chunks/0ph_0rx9ah5dc.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/0i_x3w546rsb3.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/06ig5gym-0n-u.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\"],\"ViewportBoundary\"]\n1c:I[97367,[\"/_next/static/chunks/0ph_0rx9ah5dc.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/0i_x3w546rsb3.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/06ig5gym-0n-u.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\"],\"MetadataBoundary\"]\n"])</script><script>self.__next_f.push([1,"6:[\"$\",\"main\",null,{\"children\":[\"$\",\"$L10\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L11\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"main\",null,{\"style\":{\"minHeight\":\"100vh\",\"display\":\"flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\",\"background\":\"#050611\",\"color\":\"#e5e7eb\"},\"children\":[[\"$\",\"style\",null,{\"children\":\"\\n        .nf-box { text-align: center; padding: 60px 32px; }\\n        .nf-code { font-size: 6rem; font-weight: 900; color: #22d3ee; line-height: 1; margin: 0; }\\n        .nf-title { font-size: 1.8rem; font-weight: 800; margin: 12px 0 8px; }\\n        .nf-desc { color: var(--text-muted2); font-size: 1rem; margin-bottom: 32px; max-width: 440px; }\\n        .nf-link { display: inline-block; padding: 12px 28px; background: linear-gradient(135deg,#34d399,#22d3ee); color: #000; font-weight: 900; border-radius: 12px; text-decoration: none; }\\n      \"}],[\"$\",\"div\",null,{\"className\":\"nf-box\",\"children\":[[\"$\",\"p\",null,{\"className\":\"nf-code\",\"children\":\"404\"}],[\"$\",\"h1\",null,{\"className\":\"nf-title\",\"children\":\"Page Not Found\"}],[\"$\",\"p\",null,{\"className\":\"nf-desc\",\"children\":\"The skill or page you're looking for doesn't exist or has been moved.\"}],[\"$\",\"$L12\",null,{\"className\":\"nf-link\",\"href\":\"/\",\"children\":\"Back to BytesAgain\"}]]}]]}],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]\n"])</script><script>self.__next_f.push([1,"7:[\"$\",\"$L13\",null,{}]\n8:[\"$\",\"$L14\",null,{}]\n9:[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L10\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L11\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}]\na:[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L10\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L11\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}]\nb:[\"$\",\"$1\",\"c\",{\"children\":[\"$L15\",[[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/12w5ognupk9fb.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"$L16\",null,{\"children\":[\"$\",\"$17\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@18\"}]}]]}]\n19:[]\nc:\"$W19\"\nd:[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$L1a\",null,{\"children\":\"$L1b\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$L1c\",null,{\"children\":[\"$\",\"$17\",null,{\"name\":\"Next.Metadata\",\"children\":\"$L1d\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}]\nf:[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/051nc0vy_6.rl.css?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]\n"])</script><script>self.__next_f.push([1,"1b:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"1e:I[27201,[\"/_next/static/chunks/0ph_0rx9ah5dc.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/0i_x3w546rsb3.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/06ig5gym-0n-u.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\"],\"IconMark\"]\n18:null\n"])</script><script>self.__next_f.push([1,"1d:[[\"$\",\"title\",\"0\",{\"children\":\"Fork Manager — AI Agent Skill | BytesAgain | BytesAgain\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Manage forks with open PRs - sync upstream, rebase branches, track PR status, and maintain production branches with pending contributions. Supports automatic...\"}],[\"$\",\"meta\",\"2\",{\"name\":\"robots\",\"content\":\"index, follow\"}],[\"$\",\"meta\",\"3\",{\"name\":\"googlebot\",\"content\":\"index, follow, max-image-preview:large, max-snippet:-1\"}],[\"$\",\"meta\",\"4\",{\"name\":\"llms-txt\",\"content\":\"https://bytesagain.com/llms.txt\"}],[\"$\",\"meta\",\"5\",{\"name\":\"llms-full-txt\",\"content\":\"https://bytesagain.com/llms-full.txt\"}],[\"$\",\"link\",\"6\",{\"rel\":\"canonical\",\"href\":\"https://bytesagain.com/skill/fork-manager\"}],[\"$\",\"meta\",\"7\",{\"name\":\"baidu-site-verification\",\"content\":\"codeva-0evUqX1TFs\"}],[\"$\",\"meta\",\"8\",{\"property\":\"og:title\",\"content\":\"Fork Manager — AI Agent Skill | BytesAgain\"}],[\"$\",\"meta\",\"9\",{\"property\":\"og:description\",\"content\":\"Manage forks with open PRs - sync upstream, rebase branches, track PR status, and maintain production branches with pending contributions. Supports automatic...\"}],[\"$\",\"meta\",\"10\",{\"property\":\"og:url\",\"content\":\"https://bytesagain.com/skill/fork-manager\"}],[\"$\",\"meta\",\"11\",{\"property\":\"og:site_name\",\"content\":\"BytesAgain\"}],[\"$\",\"meta\",\"12\",{\"property\":\"og:image\",\"content\":\"https://bytesagain.com/social-preview.png\"}],[\"$\",\"meta\",\"13\",{\"property\":\"og:image:width\",\"content\":\"1200\"}],[\"$\",\"meta\",\"14\",{\"property\":\"og:image:height\",\"content\":\"630\"}],[\"$\",\"meta\",\"15\",{\"property\":\"og:type\",\"content\":\"website\"}],[\"$\",\"meta\",\"16\",{\"name\":\"twitter:card\",\"content\":\"summary_large_image\"}],[\"$\",\"meta\",\"17\",{\"name\":\"twitter:title\",\"content\":\"Fork Manager — AI Agent Skill | BytesAgain\"}],[\"$\",\"meta\",\"18\",{\"name\":\"twitter:description\",\"content\":\"Manage forks with open PRs - sync upstream, rebase branches, track PR status, and maintain production branches with pending contributions. Supports automatic...\"}],[\"$\",\"meta\",\"19\",{\"name\":\"twitter:image\",\"content\":\"https://bytesagain.com/social-preview.png\"}],[\"$\",\"meta\",\"20\",{\"name\":\"twitter:image:width\",\"content\":\"1200\"}],[\"$\",\"meta\",\"21\",{\"name\":\"twitter:image:height\",\"content\":\"630\"}],[\"$\",\"link\",\"22\",{\"rel\":\"icon\",\"href\":\"/favicon.ico?favicon.0x3dzn~oxb6tn.ico\",\"sizes\":\"256x256\",\"type\":\"image/x-icon\"}],[\"$\",\"$L1e\",\"23\",{}]]\n"])</script><script>self.__next_f.push([1,"1f:T1562,"])</script><script>self.__next_f.push([1,"\n        .skill-page { max-width: 1100px; margin: 0 auto; padding: 32px 20px 80px; }\n        .two-col { display: flex; gap: 32px; align-items: flex-start; }\n        .two-col-main { flex: 1; min-width: 0; }\n        .two-col-side { width: 300px; flex-shrink: 0; }\n        @media (max-width: 860px) {\n          .two-col { flex-direction: column; }\n          .two-col-side { width: 100%; }\n        }\n        .breadcrumb { font-size: .82em; color: var(--text-muted2); margin-bottom: 28px; }\n        .breadcrumb a { color: #818cf8; text-decoration: none; }\n        .breadcrumb a:hover { text-decoration: underline; }\n        .skill-card { background: var(--bg-card); border: 1px solid var(--border-card); border-radius: 20px; padding: 28px; margin-bottom: 24px; }\n        .skill-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }\n        .skill-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }\n        .skill-top-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }\n        .badge { display: inline-flex; align-items: center; gap: 5px; font-size: .75em; font-weight: 600; padding: 4px 12px; border-radius: 999px; border: 1px solid transparent; }\n        .skill-title { font-size: 1.6em; font-weight: 800; color: var(--text-primary); margin: 0 0 4px; line-height: 1.2; }\n        .skill-owner { font-size: .82em; color: var(--text-muted2); margin: 0 0 14px; }\n        .skill-owner span { color: #818cf8; }\n        .skill-desc { font-size: .92em; color: var(--text-secondary); line-height: 1.65; margin: 0 0 16px; }\n        .skill-meta { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--border-card); }\n        .meta-item { display: flex; flex-direction: column; gap: 2px; }\n        .meta-label { font-size: .7em; color: var(--text-muted5); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }\n        .meta-value { font-size: .92em; color: var(--text-muted2); font-weight: 600; }\n        .tags-row { display: flex; gap: 6px; flex-wrap: wrap; }\n        .tag { font-size: .75em; color: #6366f1; background: #6366f115; border: 1px solid #6366f130; border-radius: 6px; padding: 3px 10px; text-decoration: none; }\n        .tag:hover { background: #6366f125; }\n        .install-box { background: var(--bg-deep); border: 1px solid var(--border-card); border-radius: 12px; overflow: hidden; margin-bottom: 24px; }\n        .install-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--border-card); }\n        .install-dots { display: flex; gap: 6px; }\n        .dot { width: 10px; height: 10px; border-radius: 50%; }\n        .install-label { font-size: .72em; color: var(--text-muted5); font-family: monospace; letter-spacing: 1px; }\n        .install-body { padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }\n        .install-cmd { color: var(--text-code);\n font-family: 'Courier New', monospace; font-size: 1em; }\n        .copy-btn { font-size: .75em; color: #6366f1; background: #6366f115; border: 1px solid #6366f130; border-radius: 6px; padding: 5px 12px; cursor: pointer; white-space: nowrap; transition: all .15s; }\n        .copy-btn:hover { background: #6366f125; }\n        .btn-secondary { display: inline-flex; align-items: center; gap: 8px; padding: 13px 24px; background: transparent; border: 1px solid var(--border-card); border-radius: 10px; color: #6b7280; text-decoration: none; font-weight: 600; font-size: .95em; transition: all .15s; }\n        .btn-secondary:hover { border-color: #818cf8; color: #818cf8; }\n        .ours-badge { display: inline-flex; align-items: center; gap: 6px; font-size: .72em; font-weight: 700; color: #22d3ee; background: #22d3ee10; border: 1px solid #22d3ee30; border-radius: 999px; padding: 4px 14px; }\n        .section-card { background: var(--bg-card); border: 1px solid var(--border-card); border-radius: 16px; padding: 22px 24px; margin-bottom: 20px; }\n        .section-title { color: var(--text-primary); font-size: 1.08em; font-weight: 800; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }\n        /* Script box */\n        .script-header { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; background: var(--bg-input); border-bottom: 1px solid var(--border-card); }\n        .script-filename { font-size: .72em; color: var(--text-muted2); font-family: 'Courier New', monospace; }\n        .script-copy-btn { font-size: .72em; color: #6366f1; background: none; border: 1px solid #6366f130; border-radius: 4px; padding: 2px 10px; cursor: pointer; }\n        .script-copy-btn:hover { background: #6366f115; }\n        .script-body { padding: 14px 16px; font-family: 'Courier New', monospace; font-size: .82em; line-height: 1.6; color: var(--text-code); overflow-x: auto; max-height: 420px; overflow-y: auto; white-space: pre; }\n        /* Articles */\n        .article-card { display: block; background: var(--bg-secondary); border: 1px solid var(--border-primary); border-radius: 10px; padding: 14px 16px; text-decoration: none; transition: border-color .15s; }\n        .article-card:hover { border-color: #6366f1; }\n        @media (max-width: 600px) {\n          .skill-card { padding: 20px; }\n          .skill-title { font-size: 1.5em; }\n        }\n      "])</script><script>self.__next_f.push([1,"15:[[\"$\",\"style\",null,{\"children\":\"$1f\"}],\"$L20\",\"$L21\"]\n"])</script><script>self.__next_f.push([1,"22:I[78297,[\"/_next/static/chunks/0ph_0rx9ah5dc.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/0i_x3w546rsb3.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/06ig5gym-0n-u.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/12w5ognupk9fb.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\"],\"default\"]\n23:T13351,"])</script><script>self.__next_f.push([1,"\u003cp style=\"margin:8px 0\"\u003e\u003chr style=\"border:none;border-top:1px solid #1e1e3f;margin:12px 0\"\u003e\nname: fork-manager\ndescription: Manage forks with open PRs - sync upstream, rebase branches, track PR status, and maintain production branches with pending contributions. Supports automatic conflict resolution via --auto-resolve flag (spawns AI subagents to resolve rebase conflicts). Use when syncing forks, rebasing PR branches, building production branches that combine all open PRs, reviewing closed/rejected PRs, or managing local patches kept outside upstream. Requires Git and GitHub CLI (gh).\nmetadata: {\"openclaw\": {\"requires\": {\"bins\": [\"git\", \"gh\"]}}}\n\u003chr style=\"border:none;border-top:1px solid #1e1e3f;margin:12px 0\"\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003eFork Manager Skill\u003c/h2\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eManage forks where you contribute PRs but also use improvements before they're merged upstream. Includes support for local patches — fixes kept in the production branch even when the upstream PR was closed/rejected.\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch3 style=\"color:#e5e7eb;margin:18px 0 8px;font-size:1.05em\"\u003eWhen to use\u003c/h3\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eSync a fork with upstream\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eCheck status of open PRs\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eRebase PR branches onto latest upstream\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eBuild a production branch combining all open PRs + local patches\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eReview recently closed/rejected PRs and decide whether to keep locally\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eManage local patches (fixes not submitted or rejected upstream)\u003c/li\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch3 style=\"color:#e5e7eb;margin:18px 0 8px;font-size:1.05em\"\u003eWhen NOT to use\u003c/h3\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eGeneral GitHub queries (issues, PRs, CI status on any repo) → use \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003egithub\u003c/code\u003e skill instead\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eTriaging/ranking/prioritizing issues → use \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eissue-prioritizer\u003c/code\u003e skill instead\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eReviewing code changes before publishing a PR → use \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003epr-review\u003c/code\u003e skill instead\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eCreating new PRs from scratch (not fork sync) → use \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003egh pr create\u003c/code\u003e directly\u003c/li\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch3 style=\"color:#e5e7eb;margin:18px 0 8px;font-size:1.05em\"\u003eExecution Model — Orchestrator + Worker\u003c/h3\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eA skill NUNCA deve ser executada inline pelo agente principal.\u003c/strong\u003e Sempre usar o padrão orchestrator/worker:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003eFluxo\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e1. \u003cstrong style=\"color:#e5e7eb\"\u003eOrchestrator (agente principal)\u003c/strong\u003e — prepara o contexto e spawna um subagente:\n   \u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003e   sessions_spawn(\n     task: \"\u003cprompt completo com contexto do repo, config, último history\u003e\",\n     model: \"\u003cmodel adequado\u003e\",\n     mode: \"run\"\n   )\n   \u003c/code\u003e\u003c/pre\u003e\n2. \u003cstrong style=\"color:#e5e7eb\"\u003eWorker (subagente)\u003c/strong\u003e — executa o full-sync/status/rebase/etc. Lê a SKILL.md, segue o fluxo, escreve history.\n3. \u003cstrong style=\"color:#e5e7eb\"\u003eMonitoramento\u003c/strong\u003e — o orchestrator checa progresso a cada \u003cstrong style=\"color:#e5e7eb\"\u003e4 minutos\u003c/strong\u003e via \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003esessions_list\u003c/code\u003e / \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003esessions_history\u003c/code\u003e:\n   - Se o worker estiver ativo e progredindo → aguarda\n   - Se o worker estiver parado/travado (sem output novo por 2 checks consecutivos) → \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003esubagents kill\u003c/code\u003e + spawna novo worker\n   - Se o worker completou → lê o resultado e reporta ao usuário\n4. \u003cstrong style=\"color:#e5e7eb\"\u003eFallback\u003c/strong\u003e — se o worker falhar (crash, timeout, erro):\n   - Orchestrator verifica o estado do repo (\u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003egit status\u003c/code\u003e, último checkpoint)\n   - Spawna novo worker com contexto atualizado incluindo o ponto onde parou\n   - Máximo de \u003cstrong style=\"color:#e5e7eb\"\u003e2 retries\u003c/strong\u003e antes de reportar falha ao usuário\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003eContexto para o Worker\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eO orchestrator deve incluir no prompt do worker:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003ePath da SKILL.md (para o worker ler e seguir)\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eConfig do repo (inline ou path)\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eÚltima entrada do history (resumo ou path)\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eModo de execução (full-sync, status, rebase-all, etc.)\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eSe é cron mode ou manual\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eQuaisquer instruções específicas do usuário\u003c/li\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003ePor que subagente?\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eResiliência:\u003c/strong\u003e se o worker falha, o orchestrator pode recuperar\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eContext window:\u003c/strong\u003e a skill é pesada (145+ PRs = muito output). O worker gasta seu context sem poluir o agente principal\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eParalelismo futuro:\u003c/strong\u003e permite spawnar workers para repos diferentes simultaneamente\u003c/li\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch3 style=\"color:#e5e7eb;margin:18px 0 8px;font-size:1.05em\"\u003eCron Mode\u003c/h3\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eWhen invoked by a cron job (automated recurring sync), follow these guidelines for efficient execution:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e1. \u003cstrong style=\"color:#e5e7eb\"\u003eSkip interactive prompts\u003c/strong\u003e — auto-resolve decisions that don't require human input:\n   - Rebases: attempt automatically, report failures\n   - Closed PRs: report but defer decision (don't drop or keep without human input)\n   - Audit findings: report but don't act\n2. \u003cstrong style=\"color:#e5e7eb\"\u003eCompact output\u003c/strong\u003e — use the summary format, not full verbose report:\n   \u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003e   🍴 Fork Sync Complete — \u003crepo\u003e\n   Main: synced N commits (old_sha → new_sha)\n   PRs: X open, Y changed state\n   - Rebased: A/B clean (C conflicts)\n   Production: rebuilt clean | N conflicts\n   Notable upstream: [1-3 bullet highlights]\n   \u003c/code\u003e\u003c/pre\u003e\n3. \u003cstrong style=\"color:#e5e7eb\"\u003eCheckpoint on failure\u003c/strong\u003e — if a rebase fails or production build has conflicts, write state to \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003erepos/\u003cname\u003e/checkpoint.json\u003c/code\u003e so the next run (or manual invocation) can resume\n4. \u003cstrong style=\"color:#e5e7eb\"\u003eTime budget\u003c/strong\u003e — target \u003c10 minutes total. If rebasing 20+ PRs, batch push at the end instead of per-branch\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch3 style=\"color:#e5e7eb;margin:18px 0 8px;font-size:1.05em\"\u003eConfiguration\u003c/h3\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eConfigs are organized per repository in \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003erepos/\u003crepo-name\u003e/config.json\u003c/code\u003e relative to the skill directory:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003efork-manager/\n├── SKILL.md\n└── repos/\n    ├── project-a/\n    │   └── config.json\n    └── project-b/\n        └── config.json\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eFormato do \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003econfig.json\u003c/code\u003e:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003e{\n  \"repo\": \"owner/repo\",\n  \"fork\": \"your-user/repo\",\n  \"localPath\": \"/path/to/local/clone\",\n  \"mainBranch\": \"main\",\n  \"productionBranch\": \"main-with-all-prs\",\n  \"upstreamRemote\": \"upstream\",\n  \"forkRemote\": \"origin\",\n  \"autoResolveConflicts\": false,\n  \"openPRs\": [123, 456],\n  \"prBranches\": {\n    \"123\": \"fix/issue-123\",\n    \"456\": \"feat/feature-456\"\n  },\n  \"localPatches\": {\n    \"local/my-custom-fix\": {\n      \"description\": \"Breve descrição do que o patch faz\",\n      \"originalPR\": 789,\n      \"closedReason\": \"rejected|superseded|duplicate|wontfix\",\n      \"keepReason\": \"Motivo pelo qual mantemos localmente\",\n      \"addedAt\": \"2026-02-07T00:00:00Z\",\n      \"reviewDate\": \"2026-03-07T00:00:00Z\"\n    }\n  },\n  \"lastSync\": \"2026-01-28T12:00:00Z\",\n  \"notes\": {\n    \"mergedUpstream\": {},\n    \"closedWithoutMerge\": {},\n    \"droppedPatches\": {}\n  }\n}\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003eResolução automática de conflitos (\u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eautoResolveConflicts\u003c/code\u003e)\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eA resolução automática pode ser ativada de \u003cstrong style=\"color:#e5e7eb\"\u003eduas formas\u003c/strong\u003e (qualquer uma basta):\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e1. \u003cstrong style=\"color:#e5e7eb\"\u003eFlag de invocação\u003c/strong\u003e (ad-hoc, por execução):\n   \u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003e   /fork-manager --auto-resolve\n   /fork-manager full-sync --auto-resolve\n   \u003c/code\u003e\u003c/pre\u003e\n2. \u003cstrong style=\"color:#e5e7eb\"\u003eConfig persistente\u003c/strong\u003e (sempre ativo pra aquele repo):\n   \u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003e   { \"autoResolveConflicts\": true }\n   \u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e| Fonte | Comportamento |\n|-------|---------------|\n| Nenhuma (default) | Conflitos são reportados mas \u003cstrong style=\"color:#e5e7eb\"\u003enão resolvidos\u003c/strong\u003e. Relatório inclui \"⚠️ Conflitos requerem aval do desenvolvedor.\" |\n| \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003e--auto-resolve\u003c/code\u003e OU \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003econfig.autoResolveConflicts: true\u003c/code\u003e | Spawna subagentes Opus para resolver conflitos. Resultados classificados como trivial/semântico/irresolvível. |\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003ePrecedência:\u003c/strong\u003e \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003e--auto-resolve\u003c/code\u003e na invocação ativa a resolução mesmo se o config diz \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003efalse\u003c/code\u003e. Não existe \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003e--no-auto-resolve\u003c/code\u003e — se o config diz \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003etrue\u003c/code\u003e e o usuário não quer resolver, basta não rodar o passo manualmente.\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003ePara usuários do ClawHub:\u003c/strong\u003e basta passar \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003e--auto-resolve\u003c/code\u003e no comando. Nenhuma configuração de repo necessária.\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003eCampos de \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003elocalPatches\u003c/code\u003e\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eCada entry em \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003elocalPatches\u003c/code\u003e é uma branch local mantida na production branch mas \u003cstrong style=\"color:#e5e7eb\"\u003esem PR aberto\u003c/strong\u003e no upstream.\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e| Campo | Descrição |\n|-------|-----------|\n| \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003edescription\u003c/code\u003e | O que o patch faz |\n| \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eoriginalPR\u003c/code\u003e | Número do PR original que foi fechado (opcional se criado direto como patch) |\n| \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eclosedReason\u003c/code\u003e | Por que o PR foi fechado: \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003erejected\u003c/code\u003e (mantenedor recusou), \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003esuperseded\u003c/code\u003e (outro PR resolve parcialmente mas não totalmente), \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eduplicate\u003c/code\u003e (fechamos nós mesmos), \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ewontfix\u003c/code\u003e (upstream não vai resolver) |\n| \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ekeepReason\u003c/code\u003e | Por que precisamos manter localmente |\n| \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eaddedAt\u003c/code\u003e | Data em que foi convertido para local patch |\n| \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ereviewDate\u003c/code\u003e | Data para reavaliar se ainda é necessário (upstream pode ter resolvido) |\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch3 style=\"color:#e5e7eb;margin:18px 0 8px;font-size:1.05em\"\u003eHistórico de Execuções\u003c/h3\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eCada repositório gerenciado tem um arquivo \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ehistory.md\u003c/code\u003e que registra todas as execuções da skill como um livro de registro append-only:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003efork-manager/\n└── repos/\n    ├── project-a/\n    │   ├── config.json\n    │   └── history.md\n    └── project-b/\n        ├── config.json\n        └── history.md\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003eRegra: Ler último output antes de começar\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eAntes de qualquer operação\u003c/strong\u003e, ler o \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ehistory.md\u003c/code\u003e do repositório alvo e extrair a \u003cstrong style=\"color:#e5e7eb\"\u003eúltima entrada\u003c/strong\u003e (último bloco \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003e---\u003c/code\u003e). Isso dá contexto sobre:\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eO que foi feito na última execução\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eQuais PRs tinham problemas\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eQuais decisões foram tomadas\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eSe ficou alguma ação pendente\u003c/li\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003e# Ler última entrada do history (tudo após o último \"---\")\ntail -n +$(grep -n '^---$' \"$SKILL_DIR/repos/\u003crepo-name\u003e/history.md\" | tail -1 | cut -d: -f1) \"$SKILL_DIR/repos/\u003crepo-name\u003e/history.md\"\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eSe o arquivo não existir, criar com o header e prosseguir normalmente.\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003eRegra: Registrar output ao finalizar\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eAo final de toda execução\u003c/strong\u003e, fazer append ao \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ehistory.md\u003c/code\u003e com o resultado completo. Formato:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003e---\n\u003ch3 style=\"color:#e5e7eb;margin:18px 0 8px;font-size:1.05em\"\u003eYYYY-MM-DD HH:MM UTC | \u003ccomando\u003e\u003c/h3\u003e\n\u003cstrong style=\"color:#e5e7eb\"\u003eOperator:\u003c/strong\u003e \u003cclaude-code | openclaw-agent | manual\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003eSummary\u003c/h4\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eMain: \u003cstatus do sync\u003e\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003ePRs: \u003cX open, Y merged, Z closed, W reopened\u003e\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eLocal Patches: \u003cN total, M com review vencida\u003e\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eProduction: \u003crebuilt OK | not rebuilt | build failed\u003e\u003c/li\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003eActions Taken\u003c/h4\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003clista de ações executadas, ex: \"Synced main (was 12 commits behind)\"\u003e\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003c\"Rebased 21/21 branches clean\"\u003e\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003c\"PR #999 closed → kept as local patch local/my-fix\"\u003e\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003c\"PR #777 reopened → restored to openPRs (was in droppedPatches)\"\u003e\u003c/li\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003ePending\u003c/h4\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003cações que ficaram pendentes, ex: \"PR #456 has conflicts — needs manual resolution\"\u003e\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003c\"3 local patches with expired reviewDate — run review-patches\"\u003e\u003c/li\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003eFull Report\u003c/h4\u003e\n\u003co relatório completo que seria mostrado ao usuário, colado aqui na íntegra\u003e\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eImportante:\u003c/strong\u003e O bloco \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eFull Report\u003c/code\u003e contém o relatório completo sem abreviação. Isso garante que o próximo agente que ler o history tenha toda a informação, não apenas o resumo.\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch3 style=\"color:#e5e7eb;margin:18px 0 8px;font-size:1.05em\"\u003eFluxo de Análise\u003c/h3\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003e1. Carregar config e histórico\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eResolve the skill directory (where SKILL.md lives):\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003e# SKILL_DIR is the directory containing this SKILL.md\n\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003eResolve it relative to the agent's workspace or skill install path\u003c/h2\u003e\nSKILL_DIR=\"\u003cpath-to-fork-manager-skill\u003e\"\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003eLoad config for the target repo\u003c/h2\u003e\ncat \"$SKILL_DIR/repos/\u003crepo-name\u003e/config.json\"\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003eLer último output do history para contexto\u003c/h2\u003e\nHISTORY=\"$SKILL_DIR/repos/\u003crepo-name\u003e/history.md\"\nif [ -f \"$HISTORY\" ]; then\n  # Extrair última entrada (após último ---)\n  LAST_SEP=$(grep -n '^---$' \"$HISTORY\" | tail -1 | cut -d: -f1)\n  if [ -n \"$LAST_SEP\" ]; then\n    tail -n +\"$LAST_SEP\" \"$HISTORY\"\n  fi\nfi\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003e2. Navegar para o repositório\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003ecd \u003clocalPath\u003e\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003e3. Fetch de ambos remotes\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003egit fetch \u003cupstreamRemote\u003e\ngit fetch \u003coriginRemote\u003e\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003e4. Analisar estado do main\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003e# Commits que upstream tem e origin/main não tem\ngit log --oneline \u003coriginRemote\u003e/\u003cmainBranch\u003e..\u003cupstreamRemote\u003e/\u003cmainBranch\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003eContar commits atrás\u003c/h2\u003e\ngit rev-list --count \u003coriginRemote\u003e/\u003cmainBranch\u003e..\u003cupstreamRemote\u003e/\u003cmainBranch\u003e\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003e5. Verificar PRs abertos via GitHub CLI\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003e# Listar PRs abertos do usuário\ngh pr list --state open --author @me --json number,title,headRefName,state\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003eVerificar status de um PR específico\u003c/h2\u003e\ngh pr view \u003cnumber\u003e --json state,mergedAt,closedAt,title\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003e6. Classificar cada PR\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003ePara cada PR no config, verificar:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e| Estado       | Condição                          | Ação                                    |\n| ------------ | --------------------------------- | --------------------------------------- |\n| \u003cstrong style=\"color:#e5e7eb\"\u003eopen\u003c/strong\u003e     | PR aberto no GitHub               | Manter, verificar se precisa rebase     |\n| \u003cstrong style=\"color:#e5e7eb\"\u003emerged\u003c/strong\u003e   | PR foi mergeado                   | Remover do config, deletar branch local |\n| \u003cstrong style=\"color:#e5e7eb\"\u003eclosed\u003c/strong\u003e   | PR fechado sem merge              | \u003cstrong style=\"color:#e5e7eb\"\u003eAcionar \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ereview-closed\u003c/code\u003e\u003c/strong\u003e (ver abaixo) |\n| \u003cstrong style=\"color:#e5e7eb\"\u003econflict\u003c/strong\u003e | Branch tem conflitos com upstream | Precisa rebase manual                   |\n| \u003cstrong style=\"color:#e5e7eb\"\u003eoutdated\u003c/strong\u003e | Branch está atrás do upstream     | Precisa rebase                          |\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eComando para verificar se branch precisa rebase:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003egit log --oneline \u003cupstreamRemote\u003e/\u003cmainBranch\u003e..\u003coriginRemote\u003e/\u003cbranch\u003e | wc -l  # commits à frente\ngit log --oneline \u003coriginRemote\u003e/\u003cbranch\u003e..\u003cupstreamRemote\u003e/\u003cmainBranch\u003e | wc -l  # commits atrás\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003e7. Revisar PRs recém-fechados (\u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ereview-closed\u003c/code\u003e)\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eQuando um PR é detectado como fechado sem merge, \u003cstrong style=\"color:#e5e7eb\"\u003eNÃO remover automaticamente\u003c/strong\u003e. Iniciar um fluxo de revisão interativo:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e#### 7.1. Coletar contexto do fechamento\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003e# Buscar comentários e motivo do fechamento\ngh pr view \u003cnumber\u003e --repo \u003crepo\u003e --json title,closedAt,state,comments,labels\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003eVerificar se upstream resolveu o problema de outra forma\u003c/h2\u003e\n\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003e(procurar PRs mergeados recentes que toquem os mesmos arquivos)\u003c/h2\u003e\ngh pr list --state merged --repo \u003crepo\u003e --json number,title,mergedAt --limit 30\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e#### 7.2. Classificar o motivo do fechamento\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e| Categoria | Descrição | Ação padrão |\n|-----------|-----------|-------------|\n| \u003cstrong style=\"color:#e5e7eb\"\u003eresolved_upstream\u003c/strong\u003e | Upstream corrigiu o problema por outro caminho | \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003edrop\u003c/code\u003e — não precisamos mais |\n| \u003cstrong style=\"color:#e5e7eb\"\u003esuperseded_by_ours\u003c/strong\u003e | Fechamos nós mesmos em favor de outro PR nosso | \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003edrop\u003c/code\u003e — o substituto já está em \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eopenPRs\u003c/code\u003e |\n| \u003cstrong style=\"color:#e5e7eb\"\u003erejected_approach\u003c/strong\u003e | Mantenedor não gostou da abordagem, mas o bug/feature existe | \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ereview\u003c/code\u003e — considerar resubmeter com abordagem diferente |\n| \u003cstrong style=\"color:#e5e7eb\"\u003erejected_need\u003c/strong\u003e | Mantenedor não concorda que é um problema | \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ereview\u003c/code\u003e — avaliar se precisamos localmente |\n| \u003cstrong style=\"color:#e5e7eb\"\u003ewontfix\u003c/strong\u003e | Upstream marcou como wontfix | \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ereview\u003c/code\u003e — provável candidato a local patch |\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e#### 7.3. Apresentar ao usuário para decisão\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003ePara cada PR fechado, apresentar:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003e### PR #\u003cnumber\u003e — \u003ctitle\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eFechado em:\u003c/strong\u003e \u003cdata\u003e\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eMotivo:\u003c/strong\u003e \u003ccategoria\u003e\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eComentários do mantenedor:\u003c/strong\u003e \u003cresumo\u003e\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eO fix ainda é relevante pra nós?\u003c/strong\u003e Análise: \u003co que o patch faz e se upstream resolve\u003e\u003c/li\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eOpções:\u003c/strong\u003e\n1. 🗑️ \u003cstrong style=\"color:#e5e7eb\"\u003eDrop\u003c/strong\u003e — remover completamente (branch local + remote)\n2. 📌 \u003cstrong style=\"color:#e5e7eb\"\u003eKeep as local patch\u003c/strong\u003e — mover para \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003elocalPatches\u003c/code\u003e, manter na production branch\n3. 🔄 \u003cstrong style=\"color:#e5e7eb\"\u003eResubmit\u003c/strong\u003e — retrabalhar e abrir novo PR com abordagem diferente\n4. ⏸️ \u003cstrong style=\"color:#e5e7eb\"\u003eDefer\u003c/strong\u003e — manter no limbo por agora, revisitar depois\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e#### 7.4. Executar a decisão\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eDrop:\u003c/strong\u003e\n\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003egit branch -D \u003cbranch\u003e 2\u003e/dev/null\ngit push \u003coriginRemote\u003e --delete \u003cbranch\u003e 2\u003e/dev/null\n\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003eMover para notes.droppedPatches no config\u003c/h2\u003e\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eKeep as local patch:\u003c/strong\u003e\n\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003e# Branch continua existindo, mas sai de openPRs/prBranches\n\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003eEntra em localPatches com metadata completa\u003c/h2\u003e\n\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003eRenomear branch de fix/xxx para local/xxx (opcional, para clareza)\u003c/h2\u003e\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eResubmit:\u003c/strong\u003e\n\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003e# Manter branch, criar novo PR com descrição atualizada\ngh pr create --title \"\u003cnovo titulo\u003e\" --body \"\u003cnova descrição com contexto\u003e\"\n\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003eAtualizar config com novo número de PR\u003c/h2\u003e\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eDefer:\u003c/strong\u003e\n\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003e# Mover para uma seção notes.deferred no config\n\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003eSerá apresentado novamente no próximo full-sync\u003c/h2\u003e\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003e8. Auditar PRs abertos (\u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eaudit-open\u003c/code\u003e)\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eAnálise proativa dos PRs \u003cstrong style=\"color:#e5e7eb\"\u003eainda abertos\u003c/strong\u003e para detectar redundâncias e obsolescência. Deve rodar no \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003efull-sync\u003c/code\u003e depois do \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eupdate-config\u003c/code\u003e.\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e#### 8.1. Resolved upstream\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eVerificar se o upstream já resolveu o problema que nosso PR corrige, sem mergear nosso PR:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003e# Para cada PR aberto, buscar os arquivos que ele toca\ngh pr view \u003cnumber\u003e --repo \u003crepo\u003e --json files --jq '[.files[].path]'\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003eVerificar se upstream alterou esses mesmos arquivos recentemente\u003c/h2\u003e\n\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003e(commits no upstream/main que não estão no nosso PR branch)\u003c/h2\u003e\ngit log --oneline upstream/main --since=\"\u003clastSync\u003e\" -- \u003cfiles\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003eSe houve mudanças upstream nos mesmos arquivos, verificar se o diff\u003c/h2\u003e\n\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003edo nosso PR ainda faz diferença (pode ter sido absorvido)\u003c/h2\u003e\ngit diff upstream/main..origin/\u003cbranch\u003e -- \u003cfiles\u003e\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eSe o diff do PR estiver vazio\u003c/strong\u003e (upstream absorveu as mudanças): marcar como \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eresolved_upstream\u003c/code\u003e.\n\u003cstrong style=\"color:#e5e7eb\"\u003eSe o diff for parcial\u003c/strong\u003e (upstream resolveu parte): marcar como \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003epartially_resolved\u003c/code\u003e para revisão.\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e#### 8.2. Duplicate externo\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eVerificar se outra pessoa abriu um PR que resolve o mesmo problema:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003e# Buscar PRs abertos no upstream que tocam os mesmos arquivos\ngh pr list --state open --repo \u003crepo\u003e --json number,title,headRefName,files --limit 50\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003eBuscar PRs mergeados recentes que tocam os mesmos arquivos\u003c/h2\u003e\ngh pr list --state merged --repo \u003crepo\u003e --json number,title,mergedAt,files --limit 30 \\\n  | jq '[.[] | select(.mergedAt \u003e= \"\u003clastSync\u003e\")]'\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003ePara cada PR encontrado que toca os mesmos arquivos, comparar:\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eMesmo issue referenciado?\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eMesma área de código?\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eMesmo tipo de fix?\u003c/li\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eSe houver match forte: marcar como \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eduplicate_external\u003c/code\u003e ou \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003esuperseded_external\u003c/code\u003e.\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e#### 8.3. Self-duplicate\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eDetectar sobreposição entre nossos próprios PRs abertos:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003e# Coletar files de todos os nossos PRs abertos\nfor pr in \u003copenPRs\u003e; do\n  gh pr view $pr --repo \u003crepo\u003e --json number,files --jq '{number, files: [.files[].path]}'\ndone\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003eCruzar: se dois PRs tocam os mesmos arquivos, são candidatos a duplicata\u003c/h2\u003e\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003ePara cada par com overlap de arquivos:\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eVerificar se o diff é similar ou complementar\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eSe similar: recomendar fechar o mais antigo/menos limpo\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eSe complementar: ok, apenas nota informativa\u003c/li\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e#### 8.4. Apresentar resultados\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003e### Audit de PRs Abertos\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e#### Possivelmente resolvidos upstream\n| # | Titulo | Arquivos em comum | Status |\n|---|--------|-------------------|--------|\n| 123 | fix(foo): bar | foo.ts (changed upstream 3 days ago) | ⚠️ Verificar |\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e#### Possíveis duplicatas externas\n| Nosso PR | PR externo | Overlap | Recomendação |\n|----------|-----------|---------|--------------|\n| #123 | #456 (@user) | foo.ts, bar.ts | ⚠️ Mesmo issue, verificar |\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e#### Self-duplicates (nossos PRs que se sobrepõem)\n| PR A | PR B | Arquivos em comum | Recomendação |\n|------|------|-------------------|--------------|\n| #6471 | #8386 | skills/refresh.ts | 🗑️ Fechar #6471 (duplicata) |\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eOpções por PR flagged:\u003c/strong\u003e\n1. 🗑️ \u003cstrong style=\"color:#e5e7eb\"\u003eClose\u003c/strong\u003e — fechar o PR no upstream e drop\n2. ✅ \u003cstrong style=\"color:#e5e7eb\"\u003eKeep\u003c/strong\u003e — falso positivo, manter aberto\n3. 🔄 \u003cstrong style=\"color:#e5e7eb\"\u003eMerge into\u003c/strong\u003e — combinar com outro PR\n4. ⏸️ \u003cstrong style=\"color:#e5e7eb\"\u003eDefer\u003c/strong\u003e — revisitar depois\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch3 style=\"color:#e5e7eb;margin:18px 0 8px;font-size:1.05em\"\u003eComandos do Agente\u003c/h3\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003e\u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003estatus\u003c/code\u003e - Verificar estado atual\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e1. Carregar config\n2. Fetch remotes\n3. Contar commits atrás do upstream\n4. Listar PRs e seus estados\n5. Reportar ao usuário\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003e\u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003esync\u003c/code\u003e - Sincronizar main com upstream\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003ecd \u003clocalPath\u003e\ngit fetch \u003cupstreamRemote\u003e\ngit checkout \u003cmainBranch\u003e\ngit merge \u003cupstreamRemote\u003e/\u003cmainBranch\u003e\ngit push \u003coriginRemote\u003e \u003cmainBranch\u003e\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003e\u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003erebase \u003cbranch\u003e\u003c/code\u003e - Rebase de uma branch específica\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003egit checkout \u003cbranch\u003e\ngit fetch \u003cupstreamRemote\u003e\ngit rebase \u003cupstreamRemote\u003e/\u003cmainBranch\u003e\n\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003eSe conflito: resolver e git rebase --continue\u003c/h2\u003e\ngit push \u003coriginRemote\u003e \u003cbranch\u003e --force-with-lease\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003e\u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003erebase-all\u003c/code\u003e - Rebase de todas as branches de PR\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003ePara cada branch em \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eprBranches\u003c/code\u003e:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e1. Checkout da branch\n2. Rebase no upstream/main\n3. Push com --force-with-lease\n4. Reportar sucesso/falha\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003e\u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eresolve-conflicts\u003c/code\u003e - Resolução automática de conflitos via subagentes\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003e \u003cstrong style=\"color:#e5e7eb\"\u003eRequer \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003e--auto-resolve\u003c/code\u003e na invocação OU \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eautoResolveConflicts: true\u003c/code\u003e no config do repo.\u003c/strong\u003e Se nenhum dos dois, este comando não é executado e conflitos são apenas reportados com a nota \"⚠️ Conflitos requerem aval do desenvolvedor.\"\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eApós \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003erebase-all\u003c/code\u003e detectar conflitos, o \u003cstrong style=\"color:#e5e7eb\"\u003eorchestrator\u003c/strong\u003e (agente principal) spawna subagentes individuais para tentar resolver cada conflito automaticamente.\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e#### Fluxo\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e1. O worker do \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003erebase-all\u003c/code\u003e retorna a lista de branches com conflito\n2. O orchestrator agrupa os conflitos e spawna \u003cstrong style=\"color:#e5e7eb\"\u003eaté 5 subagentes simultâneos\u003c/strong\u003e (model: Opus)\n3. Conforme subagentes terminam, novos são lançados até esgotar a fila\n4. Cada subagente tem \u003cstrong style=\"color:#e5e7eb\"\u003etimeout de 10 minutos\u003c/strong\u003e\n5. Resultados são coletados e integrados no relatório final\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e#### Prompt do subagente resolver\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eCada subagente recebe:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003eResolve o conflito de rebase da branch \u003cbranch\u003e (PR #\u003cnumber\u003e) no repo \u003clocalPath\u003e.\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch3 style=\"color:#e5e7eb;margin:18px 0 8px;font-size:1.05em\"\u003eContexto\u003c/h3\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eUpstream: \u003cupstreamRemote\u003e/\u003cmainBranch\u003e\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eBranch do PR: \u003coriginRemote\u003e/\u003cbranch\u003e\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eArquivos em conflito: \u003clista de arquivos do erro de rebase\u003e\u003c/li\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch3 style=\"color:#e5e7eb;margin:18px 0 8px;font-size:1.05em\"\u003ePassos\u003c/h3\u003e\n1. cd \u003clocalPath\u003e\n2. git checkout -B \u003cbranch\u003e \u003coriginRemote\u003e/\u003cbranch\u003e --no-track\n3. git rebase \u003cupstreamRemote\u003e/\u003cmainBranch\u003e\n   → O rebase vai parar com conflito\n4. Para cada arquivo em conflito:\n   a. Ler o arquivo com os marcadores de conflito (\u003c\u003c\u003c\u003c\u003c\u003c\u003c, =======, \u003e\u003e\u003e\u003e\u003e\u003e\u003e)\n   b. Entender o que o upstream mudou (OURS) vs o que o PR mudou (THEIRS)\n   c. Resolver preservando a intenção de ambos\n   d. git add \u003carquivo\u003e\n5. git rebase --continue\n6. Se houver mais conflitos em commits subsequentes, repetir 4-5\n7. git push \u003coriginRemote\u003e \u003cbranch\u003e --force-with-lease\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch3 style=\"color:#e5e7eb;margin:18px 0 8px;font-size:1.05em\"\u003eRegras de resolução\u003c/h3\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eArquivo deletado no upstream + modificado pelo PR:\u003c/strong\u003e aceitar a deleção do upstream (nosso PR targeted código que não existe mais). git rm \u003carquivo\u003e \u0026\u0026 git rebase --continue\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eImport/formatting conflicts:\u003c/strong\u003e mesclar ambos, preservar imports de ambos os lados\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eLógica alterada em ambos os lados:\u003c/strong\u003e preservar a mudança do upstream E encaixar o fix do PR. Se o fix do PR não faz mais sentido com o novo código upstream, reportar como UNRESOLVABLE.\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eNUNCA alterar a lógica do PR\u003c/strong\u003e — apenas adaptar ao novo contexto do upstream\u003c/li\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch3 style=\"color:#e5e7eb;margin:18px 0 8px;font-size:1.05em\"\u003eOutput\u003c/h3\u003e\nResponda com EXATAMENTE um destes formatos:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eRESOLVED|\u003cbranch\u003e|trivial|\u003cresumo de 1 linha\u003e\nRESOLVED|\u003cbranch\u003e|semantic|\u003cresumo de 1 linha\u003e\nUNRESOLVABLE|\u003cbranch\u003e|\u003cmotivo de 1 linha\u003e\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e#### Classificação do resultado\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e| Resultado | Significado | Ação |\n|-----------|-------------|------|\n| \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eRESOLVED\\|trivial\u003c/code\u003e | Conflito mecânico resolvido (imports, formatting, deleted files) | ✅ Push feito, sem necessidade de revisão |\n| \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eRESOLVED\\|semantic\u003c/code\u003e | Conflito envolvendo lógica de negócio resolvido | ⚠️ Push feito, \u003cstrong style=\"color:#e5e7eb\"\u003emarcar no report para revisão humana\u003c/strong\u003e |\n| \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eUNRESOLVABLE\u003c/code\u003e | Subagente não conseguiu resolver sem risco | ❌ Não faz push, escala no report |\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e#### Após resolução\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003ePara branches resolvidas com sucesso:\n1. Verificar que o push foi feito (\u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003egit log --oneline \u003coriginRemote\u003e/\u003cbranch\u003e -1\u003c/code\u003e)\n2. Tentar rebase novamente para confirmar que está clean\n3. Atualizar \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003enotes.conflictBranches\u003c/code\u003e no config: remover entries resolvidas\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003ePara branches não resolvidas:\n1. Manter em \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003enotes.conflictBranches\u003c/code\u003e com ciclo incrementado\n2. Incluir no relatório com o motivo do subagente\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e#### Integração com build-production\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eApós \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eresolve-conflicts\u003c/code\u003e, o \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ebuild-production\u003c/code\u003e roda normalmente. Branches que foram resolvidas no rebase agora devem mergear clean na production. Se ainda houver conflito de \u003cstrong style=\"color:#e5e7eb\"\u003eproduction merge\u003c/strong\u003e (diferente do conflito de rebase), o \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ebuild-production\u003c/code\u003e trata como sempre: abort e reportar.\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003e\u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eupdate-config\u003c/code\u003e - Atualizar config com PRs atuais\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003e# Buscar PRs abertos\ngh pr list --state open --author @me --repo \u003crepo\u003e --json number,headRefName\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003eAtualizar o arquivo $SKILL_DIR/repos/\u003crepo-name\u003e/config.json com os PRs atuais\u003c/h2\u003e\n\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003eUsar jq ou editar manualmente o JSON\u003c/h2\u003e\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e#### Detecção de PRs reabertos\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eAo comparar a lista do GitHub (\u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003egh pr list --state open\u003c/code\u003e) com o config local, detectar \u003cstrong style=\"color:#e5e7eb\"\u003etrês cenários\u003c/strong\u003e:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e| Cenário | Condição | Ação |\n|---------|----------|------|\n| \u003cstrong style=\"color:#e5e7eb\"\u003ePR novo\u003c/strong\u003e | No GitHub mas não em \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eopenPRs\u003c/code\u003e, \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003elocalPatches\u003c/code\u003e, nem \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003enotes\u003c/code\u003e | Adicionar a \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eopenPRs\u003c/code\u003e + \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eprBranches\u003c/code\u003e normalmente |\n| \u003cstrong style=\"color:#e5e7eb\"\u003ePR reaberto (dropped)\u003c/strong\u003e | No GitHub como open, encontrado em \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003enotes.closedWithoutMerge\u003c/code\u003e ou \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003enotes.droppedPatches\u003c/code\u003e | \u003cstrong style=\"color:#e5e7eb\"\u003eRestaurar\u003c/strong\u003e: mover de volta para \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eopenPRs\u003c/code\u003e + \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eprBranches\u003c/code\u003e, remover da seção \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003enotes\u003c/code\u003e. Fetch da branch: \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003egit fetch \u003coriginRemote\u003e \u003cbranch\u003e\u003c/code\u003e. Logar no relatório como \"🔄 Reopened\" |\n| \u003cstrong style=\"color:#e5e7eb\"\u003ePR reaberto (local patch)\u003c/strong\u003e | No GitHub como open, encontrado em \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003elocalPatches\u003c/code\u003e (via campo \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eoriginalPR\u003c/code\u003e) | \u003cstrong style=\"color:#e5e7eb\"\u003ePromover\u003c/strong\u003e: mover de \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003elocalPatches\u003c/code\u003e para \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eopenPRs\u003c/code\u003e + \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eprBranches\u003c/code\u003e. Logar no relatório como \"🔄 Reopened (was local patch)\" |\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eImplementação:\u003c/strong\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003e# Para cada PR open no GitHub que NÃO está em openPRs:\n\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003e1. Checar se o número está em notes.closedWithoutMerge ou notes.droppedPatches\u003c/h2\u003e\n\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003e   → Se sim: PR foi reaberto. Restaurar automaticamente.\u003c/h2\u003e\n\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003e2. Checar se algum entry em localPatches tem originalPR == número\u003c/h2\u003e\n\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003e   → Se sim: PR foi reaberto. Promover de volta a openPRs.\u003c/h2\u003e\n\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003e3. Se não encontrado em lugar nenhum: PR genuinamente novo.\u003c/h2\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003eRestaurar branch se foi deletada:\u003c/h2\u003e\ngit fetch \u003coriginRemote\u003e \u003cbranch\u003e 2\u003e/dev/null || git fetch \u003coriginRemote\u003e pull/\u003cnumber\u003e/head:\u003cbranch\u003e\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eNota:\u003c/strong\u003e A restauração é automática (sem interação) porque o mantenedor reabrir um PR é sinal claro de que ele deve voltar ao tracking. O relatório sempre lista os PRs restaurados para visibilidade.\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003e\u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ebuild-production\u003c/code\u003e - Criar branch de produção com todos os PRs + local patches\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003ecd \u003clocalPath\u003e\ngit fetch \u003cupstreamRemote\u003e\ngit fetch \u003coriginRemote\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003e⚠️ SEMPRE preservar arquivos não-commitados antes de trocar de branch\u003c/h2\u003e\nif [ -n \"$(git status --porcelain)\" ]; then\n  git stash push --include-untracked -m \"fork-manager: pre-build-production $(date -u +%Y%m%dT%H%M%S)\"\n  STASHED=1\nfi\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003eDeletar branch antiga se existir\u003c/h2\u003e\ngit branch -D \u003cproductionBranch\u003e 2\u003e/dev/null || true\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003eCriar nova branch a partir do upstream\u003c/h2\u003e\ngit checkout -b \u003cproductionBranch\u003e \u003cupstreamRemote\u003e/\u003cmainBranch\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003e1. Mergear cada PR branch (contribuições upstream pendentes)\u003c/h2\u003e\nfor branch in \u003cprBranches\u003e; do\n  git merge \u003coriginRemote\u003e/$branch -m \"Merge PR #\u003cnumber\u003e: \u003ctitle\u003e\"\n  # Se conflito, resolver\ndone\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003e2. Mergear cada local patch (fixes mantidos localmente)\u003c/h2\u003e\nfor branch in \u003clocalPatches\u003e; do\n  git merge \u003coriginRemote\u003e/$branch -m \"Merge local patch: \u003cdescription\u003e\"\n  # Se conflito, resolver\ndone\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003ePush\u003c/h2\u003e\ngit push \u003coriginRemote\u003e \u003cproductionBranch\u003e --force-with-lease\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003eRestaurar arquivos não-commitados\u003c/h2\u003e\nif [ \"$STASHED\" = \"1\" ]; then\n  git stash pop\nfi\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eAfter rebuilding the production branch, remind the user to run their project's build command if needed.\u003c/strong\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eOrdem de merge:\u003c/strong\u003e PRs abertos primeiro (ordem crescente por número), local patches depois. Isso garante que patches locais se aplicam sobre a base mais completa possível.\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003e\u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eaudit-open\u003c/code\u003e - Auditar PRs abertos por redundância/obsolescência\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eAnálise proativa de todos os PRs abertos (seção 8 acima):\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e1. Para cada PR aberto, coletar arquivos tocados\n2. \u003cstrong style=\"color:#e5e7eb\"\u003eResolved upstream\u003c/strong\u003e: verificar se upstream alterou os mesmos arquivos desde último sync; se diff do PR ficou vazio, flaggar\n3. \u003cstrong style=\"color:#e5e7eb\"\u003eDuplicate externo\u003c/strong\u003e: buscar PRs upstream (open + recently merged) que tocam mesmos arquivos\n4. \u003cstrong style=\"color:#e5e7eb\"\u003eSelf-duplicate\u003c/strong\u003e: cruzar arquivos entre nossos próprios PRs abertos\n5. Apresentar findings ao usuário com opções: close / keep / merge-into / defer\n6. Executar decisões\n7. Atualizar config\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003e\u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ereview-closed\u003c/code\u003e - Revisar PRs recém-fechados\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eDetecta PRs que foram fechados/mergeados desde o último sync e guia o usuário na decisão:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e1. Buscar todos os PRs do config no GitHub\n2. Identificar os que mudaram de estado (merged ou closed)\n3. Para \u003cstrong style=\"color:#e5e7eb\"\u003emerged\u003c/strong\u003e: mover para \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003enotes.mergedUpstream\u003c/code\u003e, deletar branches\n4. Para \u003cstrong style=\"color:#e5e7eb\"\u003eclosed sem merge\u003c/strong\u003e: iniciar fluxo de revisão interativo (seção 7 acima)\n5. Para cada closed, apresentar contexto e opções ao usuário\n6. Executar decisão: drop / keep as local patch / resubmit / defer\n7. Atualizar config\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003e\u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ereview-patches\u003c/code\u003e - Reavaliar patches locais existentes\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003ePara cada entry em \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003elocalPatches\u003c/code\u003e cuja \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ereviewDate\u003c/code\u003e já passou:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e1. Verificar se upstream resolveu o problema desde a última revisão\n2. Verificar se o patch ainda aplica limpo (sem conflitos)\n3. Apresentar ao usuário com opções: manter / drop / resubmit / estender reviewDate\n4. Atualizar config\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003e\u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003efull-sync\u003c/code\u003e - Sincronização completa\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e1. \u003cstrong style=\"color:#e5e7eb\"\u003eStash\u003c/strong\u003e - \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003egit stash --include-untracked\u003c/code\u003e se houver arquivos não-commitados\n2. \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003esync\u003c/code\u003e - Atualizar main\n   - \u003cstrong style=\"color:#e5e7eb\"\u003eBefore sync:\u003c/strong\u003e record \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eOLD_SHA=$(git rev-parse upstream/main)\u003c/code\u003e\n   - \u003cstrong style=\"color:#e5e7eb\"\u003eAfter sync:\u003c/strong\u003e record \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eNEW_SHA=$(git rev-parse upstream/main)\u003c/code\u003e\n3. \u003cstrong style=\"color:#e5e7eb\"\u003e\u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003epost-sync hooks\u003c/code\u003e\u003c/strong\u003e *(optional, repo-specific)* - Run custom post-sync actions\n   - Skip if \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eOLD_SHA == NEW_SHA\u003c/code\u003e (no upstream changes)\n   - Hooks are defined per-repo in \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003econfig.json\u003c/code\u003e under \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003e\"postSyncHooks\"\u003c/code\u003e (array of shell commands or descriptions)\n   - Example: detect CHANGELOG changes, update downstream skills, trigger CI\n   - If no hooks configured: skip this step entirely\n4. \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eupdate-config\u003c/code\u003e - Atualizar lista de PRs\n5. \u003cstrong style=\"color:#e5e7eb\"\u003e\u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ereview-closed\u003c/code\u003e\u003c/strong\u003e - Revisar PRs recém-fechados/mergeados (interativo)\n6. \u003cstrong style=\"color:#e5e7eb\"\u003e\u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eaudit-open\u003c/code\u003e\u003c/strong\u003e - Auditar PRs abertos por redundância/obsolescência (interativo)\n7. \u003cstrong style=\"color:#e5e7eb\"\u003e\u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ereview-patches\u003c/code\u003e\u003c/strong\u003e - Reavaliar local patches com reviewDate vencida (interativo)\n8. \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003erebase-all\u003c/code\u003e - Rebase de todas as branches (PRs + local patches)\n9. \u003cstrong style=\"color:#e5e7eb\"\u003e\u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eresolve-conflicts\u003c/code\u003e\u003c/strong\u003e *(only if \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003e--auto-resolve\u003c/code\u003e flag OR \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eautoResolveConflicts: true\u003c/code\u003e in config)* - Resolver conflitos de rebase automaticamente via subagentes (Opus, até 5 paralelos, 10min timeout cada). Se nenhum dos dois, pular este passo.\n10. \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ebuild-production\u003c/code\u003e - Recriar branch de produção (PRs + local patches)\n11. \u003cstrong style=\"color:#e5e7eb\"\u003ePop stash\u003c/strong\u003e - \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003egit stash pop\u003c/code\u003e para restaurar arquivos locais\n12. Remind user to run their project's build command if needed\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eNota sobre ordem:\u003c/strong\u003e \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eupdate-config\u003c/code\u003e roda \u003cstrong style=\"color:#e5e7eb\"\u003eantes\u003c/strong\u003e de \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ereview-closed\u003c/code\u003e porque é ali que PRs reabertos são detectados e restaurados automaticamente. Depois, \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ereview-closed\u003c/code\u003e processa PRs que foram genuinamente fechados. Por fim, \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eaudit-open\u003c/code\u003e roda por último, já com a lista de PRs abertos atualizada (incluindo os reabertos).\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch3 style=\"color:#e5e7eb;margin:18px 0 8px;font-size:1.05em\"\u003eRelatório para o Usuário\u003c/h3\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eApós qualquer operação, gerar relatório:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003e## 🍴 Fork Status: \u003crepo\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003eUpstream Sync\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eMain branch:\u003c/strong\u003e X commits behind upstream\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eLast sync:\u003c/strong\u003e \u003cdate\u003e\u003c/li\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003eOpen PRs (Y total)\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e| #   | Branch        | Status           | Action Needed     |\n| --- | ------------- | ---------------- | ----------------- |\n| 123 | fix/issue-123 | ✅ Up to date    | None              |\n| 456 | feat/feature  | ⚠️ Needs rebase  | Run rebase        |\n| 789 | fix/bug       | ❌ Has conflicts | Manual resolution |\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e#### 🔧 Resolução Automática de Conflitos\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e_Seção presente apenas quando resolução automática está ativa (\u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003e--auto-resolve\u003c/code\u003e ou \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eautoResolveConflicts: true\u003c/code\u003e). Caso contrário, substituir por:_\n\u003e ⚠️ \u003cstrong style=\"color:#e5e7eb\"\u003eConflitos requerem aval do desenvolvedor.\u003c/strong\u003e Resolução automática não ativada. Use \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003e--auto-resolve\u003c/code\u003e para tentar resolver automaticamente.\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e_Quando ativa: Conflitos semânticos (⚠️) foram resolvidos automaticamente mas \u003cstrong style=\"color:#e5e7eb\"\u003erequerem revisão humana\u003c/strong\u003e — o subagente pode ter interpretado mal a intenção do código._\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e| #   | Branch        | Tipo      | Resultado          | Detalhe                          |\n| --- | ------------- | --------- | ------------------ | -------------------------------- |\n| 123 | fix/issue-123 | trivial   | ✅ Resolvido        | Removed deleted test file        |\n| 456 | fix/issue-456 | semântico | ⚠️ Resolvido (revisar) | Adapted runner call to new API   |\n| 789 | fix/issue-789 | —         | ❌ Não resolvido    | Lógica incompatível com upstream |\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e#### 🔴 Conflitos persistentes (3+ ciclos)\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e_Seção presente apenas quando há conflitos que persistem por 3 ou mais execuções consecutivas da skill, mesmo após tentativa de resolução automática. Esses PRs merecem atenção prioritária: considerar dropar, recriar sobre o main atual, ou resolver manualmente._\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e| #   | Branch        | Ciclos | Arquivo(s)        | Recomendação        |\n| --- | ------------- | ------ | ----------------- | ------------------- |\n| 789 | fix/bug       | 5      | agent-runner.ts   | 🗑️ Dropar ou recriar |\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003eLocal Patches (Z total)\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e| Branch             | Original PR | Motivo          | Review em  |\n| ------------------ | ----------- | --------------- | ---------- |\n| local/my-fix       | #321        | rejected_need   | 2026-03-07 |\n| local/custom-tweak | —           | wontfix         | 2026-04-01 |\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003eAudit de PRs Abertos\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e| #   | Título           | Flag                | Detalhe                          |\n| --- | ---------------- | ------------------- | -------------------------------- |\n| 123 | fix(foo): bar    | ⚠️ resolved_upstream | upstream changed foo.ts 3d ago   |\n| 456 | fix(baz): qux    | ⚠️ duplicate_external | similar to #789 by @user         |\n| 111 | fix(a): b        | ⚠️ self_duplicate    | overlaps with our #222           |\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003ePRs Reabertos (restaurados automaticamente)\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e| #   | Título           | Origem              | Ação                    |\n| --- | ---------------- | ------------------- | ----------------------- |\n| 777 | fix(foo): bar    | notes.droppedPatches | 🔄 Restored to openPRs |\n| 888 | feat(baz): qux   | localPatches         | 🔄 Promoted to openPRs |\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e_Seção presente apenas quando há PRs reabertos no ciclo atual._\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003ePRs Recém-Fechados (aguardando decisão)\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e| #   | Título           | Fechado em | Motivo              | Recomendação     |\n| --- | ---------------- | ---------- | ------------------- | ---------------- |\n| 999 | fix(foo): bar    | 2026-02-05 | resolved_upstream   | 🗑️ Drop          |\n| 888 | feat(baz): qux   | 2026-02-06 | rejected_need       | 📌 Local patch   |\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003eProduction Branch\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eBranch:\u003c/strong\u003e main-with-all-prs\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eContains:\u003c/strong\u003e PRs #123, #456 + Local patches: local/my-fix, local/custom-tweak\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eStatus:\u003c/strong\u003e ✅ Up to date / ⚠️ Needs rebuild\u003c/li\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003eRecommended Actions\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e1. ...\n2. ...\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch3 style=\"color:#e5e7eb;margin:18px 0 8px;font-size:1.05em\"\u003eNotas Importantes\u003c/h3\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eSempre usar \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003e--force-with-lease\u003c/code\u003e em vez de \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003e--force\u003c/code\u003e para push\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eSempre fazer backup antes de operações destrutivas\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eUse the project's package manager for build commands (bun/npm/yarn/pnpm)\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eManter o config atualizado após cada operação\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eResolução automática de conflitos (requer \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003e--auto-resolve\u003c/code\u003e ou \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eautoResolveConflicts: true\u003c/code\u003e):\u003c/strong\u003e Quando ativa, após \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003erebase-all\u003c/code\u003e a skill spawna subagentes (Opus, até 5 paralelos, 10min timeout cada) para tentar resolver conflitos. Conflitos triviais (imports, formatting, arquivos deletados) são resolvidos e pushed sem necessidade de revisão. \u003cstrong style=\"color:#e5e7eb\"\u003eConflitos semânticos\u003c/strong\u003e (lógica de negócio) são resolvidos e pushed mas \u003cstrong style=\"color:#e5e7eb\"\u003emarcados no relatório como ⚠️ para revisão humana\u003c/strong\u003e. Se o subagente não conseguir resolver, marca como ❌ e não faz push. \u003cstrong style=\"color:#e5e7eb\"\u003eQuando desativada\u003c/strong\u003e, conflitos são apenas reportados.\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eConflitos persistentes (3+ ciclos):\u003c/strong\u003e Quando um conflito persiste por 3+ execuções consecutivas (tracked pelo sufixo \"Nth cycle\" em \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003enotes.conflictBranches\u003c/code\u003e), escalar no relatório com seção dedicada \"🔴 Conflitos persistentes\" e recomendar ação: dropar o PR, recriar a branch, ou resolver manualmente. O ciclo é incrementado a cada execução onde o conflito reaparece, \u003cstrong style=\"color:#e5e7eb\"\u003emesmo que a resolução automática tenha sido tentada e falhado\u003c/strong\u003e.\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eLocal patches são cidadãos de primeira classe:\u003c/strong\u003e rebase, build e relatório incluem tanto PRs abertos quanto local patches\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eNunca remover automaticamente um PR fechado sem merge.\u003c/strong\u003e Sempre passar pelo fluxo \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ereview-closed\u003c/code\u003e para decisão do usuário\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eReview dates em local patches:\u003c/strong\u003e ao criar um local patch, definir uma data de revisão (default: 30 dias). No \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003efull-sync\u003c/code\u003e, patches com review vencida são apresentados ao usuário para reavaliação\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eNaming convention para local patches:\u003c/strong\u003e prefixo \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003elocal/\u003c/code\u003e para distinguir de branches de PR (ex: \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003elocal/my-custom-fix\u003c/code\u003e). A branch original pode ser renomeada ou mantida — o importante é que o config rastreie a branch correta\u003c/li\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003e⚠️ Proteger arquivos não-commitados antes de operações destrutivas\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eAntes de qualquer operação que troca de branch ou deleta/recria branches (especialmente \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ebuild-production\u003c/code\u003e e \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003efull-sync\u003c/code\u003e), \u003cstrong style=\"color:#e5e7eb\"\u003esempre\u003c/strong\u003e verificar e preservar arquivos unstaged, untracked e staged:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003ecd \u003clocalPath\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003e1. Checar se há arquivos em risco\u003c/h2\u003e\ngit status --porcelain\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003e2. Se houver arquivos modificados/untracked, fazer stash com untracked\u003c/h2\u003e\ngit stash push --include-untracked -m \"fork-manager: pre-sync stash $(date -u +%Y%m%dT%H%M%S)\"\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003e3. Executar a operação (rebase, checkout, merge, etc.)\u003c/h2\u003e\n\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003e...\u003c/h2\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch2 style=\"color:#f3f4f6;margin:20px 0 10px;font-size:1.15em\"\u003e4. Após concluir, restaurar o stash\u003c/h2\u003e\ngit stash pop\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003ePor quê?\u003c/strong\u003e Ao deletar e recriar a branch de produção (\u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003egit branch -D \u003cproductionBranch\u003e\u003c/code\u003e), arquivos que existiam apenas no working directory (não commitados) são perdidos permanentemente. Isso inclui:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eArquivos gerados (dashboards, history, state)\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eArquivos de configuração local (serve.ts, .env)\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eDados acumulados (JSON, SQLite)\u003c/li\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eRegra:\u003c/strong\u003e Se \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003egit status --porcelain\u003c/code\u003e retornar qualquer saída, fazer \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003egit stash --include-untracked\u003c/code\u003e antes de prosseguir. Restaurar com \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003egit stash pop\u003c/code\u003e ao final.\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch3 style=\"color:#e5e7eb;margin:18px 0 8px;font-size:1.05em\"\u003eSecurity Notice\u003c/h3\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eThis skill performs operations that require broad filesystem and network access by design:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eGit operations\u003c/strong\u003e: fetch, checkout, merge, rebase, push across multiple remotes and branches\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003eGitHub CLI\u003c/strong\u003e: reads PR status, creates PRs, queries repo metadata\u003c/li\u003e\n\u003cstrong style=\"color:#e5e7eb\"\u003eBefore using this skill on a repository:\u003c/strong\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eAll git push operations use \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003e--force-with-lease\u003c/code\u003e (not \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003e--force\u003c/code\u003e) to prevent data loss\u003c/li\u003e\n\u003cli style=\"color:#94a3b8;margin:3px 0\"\u003eThe skill always stashes uncommitted files before destructive branch operations\u003c/li\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eThese capabilities are inherent to fork management and cannot be removed without breaking core functionality.\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch3 style=\"color:#e5e7eb;margin:18px 0 8px;font-size:1.05em\"\u003eUsage Examples\u003c/h3\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003eBasic sync\u003c/h4\u003e\nUser: \"sync my fork of project-x\"\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eAgent:\n1. Load config from \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003e$SKILL_DIR/repos/project-x/config.json\u003c/code\u003e\n2. Run \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003estatus\u003c/code\u003e to assess current state\n3. If main is behind, run \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003esync\u003c/code\u003e\n4. If PRs need rebase, run \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003erebase-all\u003c/code\u003e\n5. Update \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eproductionBranch\u003c/code\u003e if needed\n6. Remind user to rebuild if needed\n7. Report results to user\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003eSync with auto-resolve\u003c/h4\u003e\nUser: \"/fork-manager --auto-resolve\" or \"/fork-manager full-sync --auto-resolve\"\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eAgent:\n1. Same as basic sync, but after \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003erebase-all\u003c/code\u003e:\n2. For each conflict, spawn a resolver subagent (Opus)\n3. Collect results (trivial ✅ / semantic ⚠️ / unresolvable ❌)\n4. Re-run \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ebuild-production\u003c/code\u003e with resolved branches\n5. Report includes resolution table with review flags\n\u003c/p\u003e"])</script><script>self.__next_f.push([1,"20:[\"$\",\"div\",null,{\"className\":\"skill-page\",\"children\":[[\"$\",\"script\",null,{\"type\":\"application/ld+json\",\"dangerouslySetInnerHTML\":{\"__html\":\"{\\\"@context\\\":\\\"https://schema.org\\\",\\\"@type\\\":\\\"SoftwareApplication\\\",\\\"name\\\":\\\"Fork Manager\\\",\\\"description\\\":\\\"Manage forks with open PRs - sync upstream, rebase branches, track PR status, and maintain production branches with pending contributions. Supports automatic...\\\",\\\"url\\\":\\\"https://bytesagain.com/skill/fork-manager\\\",\\\"applicationCategory\\\":\\\"clawhub\\\",\\\"operatingSystem\\\":\\\"Any\\\",\\\"offers\\\":{\\\"@type\\\":\\\"Offer\\\",\\\"price\\\":\\\"0\\\",\\\"priceCurrency\\\":\\\"USD\\\"},\\\"publisher\\\":{\\\"@type\\\":\\\"Organization\\\",\\\"name\\\":\\\"BytesAgain\\\",\\\"url\\\":\\\"https://bytesagain.com\\\"}}\"}}],[\"$\",\"div\",null,{\"className\":\"breadcrumb\",\"children\":[[\"$\",\"a\",null,{\"href\":\"/\",\"children\":\"BytesAgain\"}],\" › \",[\"$\",\"a\",null,{\"href\":\"/skills\",\"children\":\"Skills\"}],\" › \",\"Fork Manager\"]}],[\"$\",\"div\",null,{\"className\":\"two-col\",\"children\":[[\"$\",\"div\",null,{\"className\":\"two-col-main\",\"children\":[[\"$\",\"div\",null,{\"className\":\"skill-card\",\"children\":[[\"$\",\"div\",null,{\"className\":\"skill-header\",\"children\":[[\"$\",\"div\",null,{\"className\":\"skill-badges\",\"children\":[[\"$\",\"span\",null,{\"className\":\"badge\",\"style\":{\"color\":\"#818cf8\",\"background\":\"#818cf822\",\"borderColor\":\"#818cf844\"},\"children\":[\"🦀\",\" \",\"ClawHub\"]}],false]}],[\"$\",\"div\",null,{\"className\":\"skill-top-actions\",\"children\":[\"$\",\"$L22\",null,{\"slug\":\"fork-manager\"}]}]]}],[\"$\",\"h1\",null,{\"className\":\"skill-title\",\"children\":\"Fork Manager\"}],[\"$\",\"p\",null,{\"className\":\"skill-owner\",\"children\":[\"by \",[\"$\",\"span\",null,{\"children\":[\"@\",\"glucksberg\"]}]]}],[\"$\",\"p\",null,{\"className\":\"skill-desc\",\"children\":\"Manage forks with open PRs - sync upstream, rebase branches, track PR status, and maintain production branches with pending contributions. Supports automatic...\"}],[\"$\",\"div\",null,{\"className\":\"skill-meta\",\"children\":[[\"$\",\"div\",null,{\"className\":\"meta-item\",\"children\":[[\"$\",\"span\",null,{\"className\":\"meta-label\",\"children\":\"Version\"}],[\"$\",\"span\",null,{\"className\":\"meta-value\",\"children\":[\"v\",\"2.1.1\"]}]]}],[\"$\",\"div\",null,{\"className\":\"meta-item\",\"children\":[[\"$\",\"span\",null,{\"className\":\"meta-label\",\"children\":\"Downloads\"}],[\"$\",\"span\",null,{\"className\":\"meta-value\",\"children\":\"2,106\"}]]}],[\"$\",\"div\",null,{\"className\":\"meta-item\",\"children\":[[\"$\",\"span\",null,{\"className\":\"meta-label\",\"children\":\"Installs\"}],[\"$\",\"span\",null,{\"className\":\"meta-value\",\"children\":\"1\"}]]}],[\"$\",\"div\",null,{\"className\":\"meta-item\",\"children\":[[\"$\",\"span\",null,{\"className\":\"meta-label\",\"children\":\"Stars\"}],[\"$\",\"span\",null,{\"className\":\"meta-value\",\"children\":[\"⭐ \",\"1\"]}]]}],false,[\"$\",\"div\",null,{\"className\":\"meta-item\",\"style\":{\"flexDirection\":\"row\",\"gap\":6,\"alignItems\":\"center\"},\"children\":[[\"$\",\"a\",\"legal\",{\"href\":\"/?q=legal\",\"className\":\"tag\",\"children\":[\"#\",\"legal\"]}],[\"$\",\"a\",\"automation\",{\"href\":\"/?q=automation\",\"className\":\"tag\",\"children\":[\"#\",\"automation\"]}],[\"$\",\"a\",\"productivity\",{\"href\":\"/?q=productivity\",\"className\":\"tag\",\"children\":[\"#\",\"productivity\"]}]]}]]}],[\"$\",\"div\",null,{\"style\":{\"marginTop\":6},\"children\":[\"$\",\"a\",null,{\"href\":\"https://clawhub.ai/glucksberg/fork-manager\",\"target\":\"_blank\",\"rel\":\"noopener\",\"className\":\"btn-secondary\",\"style\":{\"padding\":\"6px 12px\",\"fontSize\":\".82em\",\"borderRadius\":8,\"background\":\"transparent\",\"border\":\"1px solid var(--border-card)\",\"color\":\"var(--text-muted2)\",\"textDecoration\":\"none\",\"whiteSpace\":\"nowrap\"},\"children\":[\"View on \",\"ClawHub\",\" →\"]}]}]]}],[\"$\",\"div\",null,{\"className\":\"install-box\",\"children\":[[\"$\",\"div\",null,{\"className\":\"install-header\",\"children\":[[\"$\",\"div\",null,{\"className\":\"install-dots\",\"children\":[[\"$\",\"div\",null,{\"className\":\"dot\",\"style\":{\"background\":\"#ef4444\"}}],[\"$\",\"div\",null,{\"className\":\"dot\",\"style\":{\"background\":\"#eab308\"}}],[\"$\",\"div\",null,{\"className\":\"dot\",\"style\":{\"background\":\"#22c55e\"}}]]}],[\"$\",\"span\",null,{\"className\":\"install-label\",\"children\":\"TERMINAL\"}]]}],[\"$\",\"div\",null,{\"className\":\"install-body\",\"style\":{\"flexWrap\":\"wrap\"},\"children\":[[\"$\",\"code\",null,{\"className\":\"install-cmd\",\"children\":\"clawhub install fork-manager\"}],[\"$\",\"button\",null,{\"className\":\"copy-btn\",\"data-cmd\":\"clawhub install fork-manager\",\"style\":{\"fontWeight\":700},\"children\":\"Copy\"}]]}]]}],[\"$\",\"section\",null,{\"className\":\"skill-card\",\"style\":{\"marginBottom\":20},\"children\":[[\"$\",\"h2\",null,{\"style\":{\"color\":\"#f8fafc\",\"fontSize\":\"1.2em\",\"fontWeight\":800,\"margin\":\"0 0 16px\",\"display\":\"flex\",\"alignItems\":\"center\",\"gap\":8},\"children\":\"📖 About This Skill\"}],[\"$\",\"div\",null,{\"style\":{\"fontSize\":\".92em\",\"color\":\"#94a3b8\",\"lineHeight\":1.75},\"dangerouslySetInnerHTML\":{\"__html\":\"$23\"}}]]}],\"$L24\",null,\"$L25\",null,null,null,null,false,false]}],\"$L26\"]}]]}]\n"])</script><script>self.__next_f.push([1,"21:[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"\\n        document.querySelectorAll('.copy-btn, .script-copy-btn').forEach(btn =\u003e {\\n          btn.addEventListener('click', () =\u003e {\\n            const cmd = btn.getAttribute('data-cmd');\\n            if (!cmd) return;\\n            navigator.clipboard.writeText(cmd).then(() =\u003e {\\n              const orig = btn.textContent;\\n              btn.textContent = 'Copied!';\\n              setTimeout(() =\u003e btn.textContent = orig, 1500);\\n            }).catch(() =\u003e {});\\n          });\\n        });\\n      \"}}]\n"])</script><script>self.__next_f.push([1,"29:I[71521,[\"/_next/static/chunks/0ph_0rx9ah5dc.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/0i_x3w546rsb3.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/06ig5gym-0n-u.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\",\"/_next/static/chunks/12w5ognupk9fb.js?dpl=dpl_9zPFH6pojPkqyspdDNz28GzCc6KQ\"],\"default\"]\n27:T4c6,\u003ctable style=\"width:100%;border-collapse:collapse;border:1px solid #1e1e3f;border-radius:8px;overflow:hidden;font-size:.9em\"\u003e\u003cthead\u003e\u003ctr style=\"background:#0a0a1c\"\u003e\u003cth style=\"padding:12px 16px;text-align:left;color:#818cf8;font-weight:700;border-bottom:2px solid #6366f130\"\u003eTrigger\u003c/th\u003e\u003cth style=\"padding:12px 16px;text-align:left;color:#818cf8;font-weight:700;border-bottom:2px solid #6366f130\"\u003eAction\u003c/th\u003e\u003c/tr\u003e\u003c/thead\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd style=\"padding:12px 16px;border-bottom:1px solid #1e1e3f;color:#94a3b8\" colspan=\"2\"\u003e- Check status of open PRs\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd style=\"padding:12px 16px;border-bottom:1px solid #1e1e3f;color:#94a3b8\" colspan=\"2\"\u003e- Rebase PR branches onto latest upstream\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd style=\"padding:12px 16px;border-bottom:1px solid #1e1e3f;color:#94a3b8\" colspan=\"2\"\u003e- Build a production branch combining all open PRs + local patches\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd style=\"padding:12px 16px;border-bottom:1px solid #1e1e3f;color:#94a3b8\" colspan=\"2\"\u003e- Review recently closed/rejected PRs and decide whether to keep locally\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd style=\"padding:12px 16px;border-bottom:1px solid #1e1e3f;color:#94a3b8\" colspan=\"2\"\u003e- Manage local patches (fixes not submitted or rejected upstream)\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e24:[\"$\",\"section\",null,{\"className\":\"skill-card\",\"style\":{\"marginBottom\":20},\"children\":[[\"$\",\"h2\",null,{\"style\":{\"color\":\"#f8fafc\",\"fontSize\":\"1.2em\",\"fontWeight\":800,\"margin\":\"0 0 16px\",\"display\":\"flex\",\"alignItems\":\"center\",\"gap\":8},\"children\":\"⚡ When to Use\"}],[\"$\",\"div\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"$27\"}}]]}]\n28:T1ab1,"])</script><script>self.__next_f.push([1,"\u003cp style=\"margin:8px 0\"\u003eConfigs are organized per repository in \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003erepos/\u003crepo-name\u003e/config.json\u003c/code\u003e relative to the skill directory:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003efork-manager/\n├── SKILL.md\n└── repos/\n    ├── project-a/\n    │   └── config.json\n    └── project-b/\n        └── config.json\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eFormato do \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003econfig.json\u003c/code\u003e:\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003e{\n  \"repo\": \"owner/repo\",\n  \"fork\": \"your-user/repo\",\n  \"localPath\": \"/path/to/local/clone\",\n  \"mainBranch\": \"main\",\n  \"productionBranch\": \"main-with-all-prs\",\n  \"upstreamRemote\": \"upstream\",\n  \"forkRemote\": \"origin\",\n  \"autoResolveConflicts\": false,\n  \"openPRs\": [123, 456],\n  \"prBranches\": {\n    \"123\": \"fix/issue-123\",\n    \"456\": \"feat/feature-456\"\n  },\n  \"localPatches\": {\n    \"local/my-custom-fix\": {\n      \"description\": \"Breve descrição do que o patch faz\",\n      \"originalPR\": 789,\n      \"closedReason\": \"rejected|superseded|duplicate|wontfix\",\n      \"keepReason\": \"Motivo pelo qual mantemos localmente\",\n      \"addedAt\": \"2026-02-07T00:00:00Z\",\n      \"reviewDate\": \"2026-03-07T00:00:00Z\"\n    }\n  },\n  \"lastSync\": \"2026-01-28T12:00:00Z\",\n  \"notes\": {\n    \"mergedUpstream\": {},\n    \"closedWithoutMerge\": {},\n    \"droppedPatches\": {}\n  }\n}\n\u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003eResolução automática de conflitos (\u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eautoResolveConflicts\u003c/code\u003e)\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eA resolução automática pode ser ativada de \u003cstrong style=\"color:#e5e7eb\"\u003eduas formas\u003c/strong\u003e (qualquer uma basta):\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e1. \u003cstrong style=\"color:#e5e7eb\"\u003eFlag de invocação\u003c/strong\u003e (ad-hoc, por execução):\n   \u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003e   /fork-manager --auto-resolve\n   /fork-manager full-sync --auto-resolve\n   \u003c/code\u003e\u003c/pre\u003e\n2. \u003cstrong style=\"color:#e5e7eb\"\u003eConfig persistente\u003c/strong\u003e (sempre ativo pra aquele repo):\n   \u003cpre style=\"background:#0a0a1c;border:1px solid #1e1e3f;border-radius:6px;padding:10px 12px;overflow-x:auto;font-size:.9em;margin:8px 0\"\u003e\u003ccode style=\"color:#a5f3fc;background:none;padding:0;font-size:1em\"\u003e   { \"autoResolveConflicts\": true }\n   \u003c/code\u003e\u003c/pre\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e| Fonte | Comportamento |\n|-------|---------------|\n| Nenhuma (default) | Conflitos são reportados mas \u003cstrong style=\"color:#e5e7eb\"\u003enão resolvidos\u003c/strong\u003e. Relatório inclui \"⚠️ Conflitos requerem aval do desenvolvedor.\" |\n| \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003e--auto-resolve\u003c/code\u003e OU \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003econfig.autoResolveConflicts: true\u003c/code\u003e | Spawna subagentes Opus para resolver conflitos. Resultados classificados como trivial/semântico/irresolvível. |\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003ePrecedência:\u003c/strong\u003e \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003e--auto-resolve\u003c/code\u003e na invocação ativa a resolução mesmo se o config diz \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003efalse\u003c/code\u003e. Não existe \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003e--no-auto-resolve\u003c/code\u003e — se o config diz \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003etrue\u003c/code\u003e e o usuário não quer resolver, basta não rodar o passo manualmente.\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003cstrong style=\"color:#e5e7eb\"\u003ePara usuários do ClawHub:\u003c/strong\u003e basta passar \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003e--auto-resolve\u003c/code\u003e no comando. Nenhuma configuração de repo necessária.\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e\u003ch4 style=\"color:#d1d5db;margin:14px 0 6px;font-size:.95em\"\u003eCampos de \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003elocalPatches\u003c/code\u003e\u003c/h4\u003e\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003eCada entry em \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003elocalPatches\u003c/code\u003e é uma branch local mantida na production branch mas \u003cstrong style=\"color:#e5e7eb\"\u003esem PR aberto\u003c/strong\u003e no upstream.\u003c/p\u003e\u003cp style=\"margin:8px 0\"\u003e| Campo | Descrição |\n|-------|-----------|\n| \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003edescription\u003c/code\u003e | O que o patch faz |\n| \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eoriginalPR\u003c/code\u003e | Número do PR original que foi fechado (opcional se criado direto como patch) |\n| \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eclosedReason\u003c/code\u003e | Por que o PR foi fechado: \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003erejected\u003c/code\u003e (mantenedor recusou), \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003esuperseded\u003c/code\u003e (outro PR resolve parcialmente mas não totalmente), \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eduplicate\u003c/code\u003e (fechamos nós mesmos), \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ewontfix\u003c/code\u003e (upstream não vai resolver) |\n| \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ekeepReason\u003c/code\u003e | Por que precisamos manter localmente |\n| \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003eaddedAt\u003c/code\u003e | Data em que foi convertido para local patch |\n| \u003ccode style=\"background:#0d0d1e;color:#a5f3fc;padding:1px 5px;border-radius:3px;font-size:.88em\"\u003ereviewDate\u003c/code\u003e | Data para reavaliar se ainda é necessário (upstream pode ter resolvido) |\u003c/p\u003e"])</script><script>self.__next_f.push([1,"25:[\"$\",\"section\",null,{\"className\":\"skill-card\",\"style\":{\"marginBottom\":20},\"children\":[[\"$\",\"h2\",null,{\"style\":{\"color\":\"#f8fafc\",\"fontSize\":\"1.2em\",\"fontWeight\":800,\"margin\":\"0 0 16px\",\"display\":\"flex\",\"alignItems\":\"center\",\"gap\":8},\"children\":\"⚙️ Configuration\"}],[\"$\",\"div\",null,{\"style\":{\"fontSize\":\".92em\",\"color\":\"#94a3b8\",\"lineHeight\":1.75},\"dangerouslySetInnerHTML\":{\"__html\":\"$28\"}}]]}]\n26:[\"$\",\"div\",null,{\"className\":\"two-col-side\",\"children\":[\"$\",\"$L29\",null,{\"category\":\"clawhub\",\"currentSlug\":\"fork-manager\",\"name\":\"Fork Manager\",\"tags\":[\"legal\",\"automation\",\"productivity\"]}]}]\n"])</script></body></html>