spec-first-copilot 0.8.0-beta.1 → 0.8.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-first-copilot",
3
- "version": "0.8.0-beta.1",
3
+ "version": "0.8.0-beta.2",
4
4
  "description": "Spec-first workflow kit for GitHub Copilot — AI-driven development with specs, not guesswork",
5
5
  "bin": {
6
6
  "spec-first-copilot": "bin/cli.js"
@@ -8,6 +8,23 @@
8
8
 
9
9
  ---
10
10
 
11
+ ## 0.8.0-beta.2 (2026-05-11) — Auth check pré-clone
12
+
13
+ `/sf-onboard` agora verifica autenticação git **antes** de tentar clonar,
14
+ detectando SSH vs HTTPS e testando ssh-agent / credential helper / GH CLI.
15
+ Falha cedo com mensagem específica em vez de erro genérico do `git clone`.
16
+
17
+ ### Adicionado
18
+
19
+ - Passo 0 do `/sf-onboard`: verificação proativa de auth
20
+ - SSH: `ssh-add -l` (agent vazio?) + `ssh -T git@<host>` (chave autorizada?)
21
+ - HTTPS: `git config credential.helper` + `gh auth status` + `git ls-remote`
22
+ - 6 mensagens de erro específicas (ssh-agent off, agent vazio, chave não
23
+ autorizada, sem helper nem GH CLI, GH CLI deslogado, falha desconhecida)
24
+ - Nota Windows/PowerShell sobre ssh-agent + alternativas (GH CLI, PAT)
25
+
26
+ ---
27
+
11
28
  ## 0.8.0-beta.1 (2026-05-11) — Brownfield onboarding
12
29
 
13
30
  Skill nova `/sf-onboard` pra assumir aplicações **já existentes**. Lê o
@@ -52,11 +52,77 @@ execução adiciona uma entry em `projetos.yaml` e merge aditivo no TRD.
52
52
  | # | Validação | Se falhar |
53
53
  |---|-----------|-----------|
54
54
  | 1 | `<git-url>` informado | Parar → "Informe a URL do repositório. Ex: /sf-onboard https://github.com/org/app.git" |
55
- | 2 | `git` instalado no PATH | Parar → "Git não encontrado no PATH" |
56
- | 3 | URL acessível (auth do user) | Parar "Falha ao clonar. Configure SSH/PAT antes de rodar /sf-onboard" |
55
+ | 2 | `git` instalado no PATH (`git --version`) | Parar → "Git não encontrado no PATH" |
56
+ | 3 | **Auth git pré-verificada** (ver passo 0) | Parar com instrução específica conforme tipo de URL |
57
57
  | 4 | `--branch` e `--tag` não usados juntos | Parar → "Use --branch OU --tag, não ambos" |
58
58
  | 5 | Scope `onboard_<repo>` não está em `analyzing` | Se sim → "Onboarding anterior incompleto. Rode novamente pra retomar" |
59
59
 
60
+ ### Passo 0 — Verificar autenticação ANTES de clonar
61
+
62
+ Detectar tipo de URL e testar auth proativamente. Falhar cedo com mensagem
63
+ clara é melhor que esperar o `git clone` quebrar sem contexto.
64
+
65
+ **Detectar tipo de URL**:
66
+
67
+ | Padrão | Tipo |
68
+ |--------|------|
69
+ | `git@<host>:<org>/<repo>.git` | SSH |
70
+ | `ssh://git@<host>/...` | SSH |
71
+ | `https://<host>/...` | HTTPS |
72
+
73
+ **Se SSH** — testar agente + conectividade:
74
+
75
+ ```bash
76
+ # 1. ssh-agent rodando com chave carregada?
77
+ ssh-add -l
78
+ # Saída esperada: linha(s) com fingerprint. Se "The agent has no identities",
79
+ # user precisa rodar `ssh-add ~/.ssh/id_ed25519` (ou similar).
80
+ # Se "Could not open a connection to your authentication agent",
81
+ # user precisa iniciar o ssh-agent.
82
+
83
+ # 2. Host autenticável? (extrair host da URL, ex: github.com)
84
+ ssh -T -o StrictHostKeyChecking=accept-new -o BatchMode=yes git@<host>
85
+ # GitHub retorna exit 1 com "Hi <user>! You've successfully authenticated"
86
+ # GitLab/Bitbucket têm mensagens análogas.
87
+ # Exit 255 ou "Permission denied (publickey)" → chave não autorizada.
88
+ ```
89
+
90
+ **Se HTTPS** — testar credential helper ou GH CLI:
91
+
92
+ ```bash
93
+ # 1. Git credential helper configurado?
94
+ git config --get credential.helper
95
+ # Vazio → user usa GH CLI ou vai ser perguntado credencial no clone.
96
+
97
+ # 2. (Se host = github.com) GH CLI autenticado?
98
+ gh auth status --hostname github.com
99
+ # Exit 0 + "Logged in to github.com" → ok
100
+ # Exit 1 → não logado
101
+
102
+ # 3. Alternativa: tentar ls-remote sem clonar (mais leve que clone)
103
+ GIT_TERMINAL_PROMPT=0 git ls-remote --heads <git-url> HEAD
104
+ # Exit 0 → auth ok
105
+ # Exit ≠ 0 + "Authentication failed" → credencial ausente/inválida
106
+ # Exit ≠ 0 + "could not read Username" → terminal prompt bloqueado, sem credential helper
107
+ ```
108
+
109
+ **Mensagens de erro específicas**:
110
+
111
+ | Cenário | Mensagem |
112
+ |---------|----------|
113
+ | SSH sem ssh-agent | "ssh-agent não está rodando. Inicie com `eval $(ssh-agent)` (Linux/Mac) ou `Start-Service ssh-agent` (Windows)" |
114
+ | SSH agent vazio | "Nenhuma chave SSH carregada. Rode `ssh-add ~/.ssh/id_ed25519` (ajuste o nome se diferente)" |
115
+ | SSH host nega | "Chave SSH não autorizada em `<host>`. Verifique se a chave pública está cadastrada em `<host>/settings/keys` (GitHub) ou equivalente" |
116
+ | HTTPS sem helper nem GH CLI | "Credencial HTTPS não configurada. Opções: (1) `gh auth login` se host=github.com; (2) configurar credential helper (`git config --global credential.helper manager`); (3) usar URL SSH (`git@<host>:...`)" |
117
+ | HTTPS GH CLI deslogado | "GH CLI não autenticado. Rode `gh auth login` e tente novamente" |
118
+ | `ls-remote` falha por motivo desconhecido | "Falha ao acessar o repo: `<stderr do ls-remote>`. Verifique a URL e suas credenciais" |
119
+
120
+ **Sucesso**: log breve "Auth OK ({tipo})" e prosseguir para o Passo 1.
121
+
122
+ > **Nota Windows/PowerShell**: comandos `ssh-add`, `ssh -T`, `gh`, `git`
123
+ > assumem disponíveis no PATH. Em ambientes sem ssh-agent nativo (Windows
124
+ > antigo), instruir uso do GH CLI ou HTTPS+PAT.
125
+
60
126
  ## Passos
61
127
 
62
128
  ### 1. Resolver nome do scope e path
@@ -343,7 +409,8 @@ Se `--name` diferentes → scopes separados (raro, mas suportado).
343
409
 
344
410
  | Erro | Ação |
345
411
  |------|------|
346
- | URL não acessível | Parar, sugerir checar SSH/PAT |
412
+ | Auth falha (capturado no Passo 0) | Parar com mensagem específica conforme cenário (ver tabela do Passo 0) |
413
+ | Clone falha mesmo com auth OK | Reportar `stderr` do git; verificar se a URL e branch existem |
347
414
  | Repo vazio | Parar — "Nada a onboardar" |
348
415
  | Nenhum reader produziu fragmento (stack desconhecida) | Parar — "Stack não reconhecida. Detalhe TRD manualmente ou peça suporte" |
349
416
  | `projetos/<repo-name>/` já existe e NÃO é clone do mesmo URL | Parar — "Path já em uso por outro repo. Use --name pra dar outro nome" |