@aksp/opencrew 1.7.1 → 1.9.0

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +129 -0
  2. package/README.md +87 -4
  3. package/package.json +1 -1
  4. package/src/commands/update.js +9 -3
  5. package/src/lib/blocos.js +7 -3
  6. package/src/lib/resumo.js +3 -0
  7. package/templates/AGENTS.md +4 -0
  8. package/templates/_opencrew/.opencrew-version +1 -1
  9. package/templates/_opencrew/core/prompts/discovery.prompt.md +1 -1
  10. package/templates/_opencrew/core/prompts/entrega.prompt.md +205 -0
  11. package/templates/_opencrew/core/prompts/export.prompt.md +5 -81
  12. package/templates/_opencrew/core/runner.pipeline.md +32 -23
  13. package/templates/_opencrew/core/scripts/entrega/argumentos.mjs +50 -0
  14. package/templates/_opencrew/core/scripts/entrega/canais.mjs +53 -0
  15. package/templates/_opencrew/core/scripts/entrega/comparar.mjs +104 -0
  16. package/templates/_opencrew/core/scripts/entrega/copia.mjs +138 -0
  17. package/templates/_opencrew/core/scripts/entrega/destino.mjs +98 -0
  18. package/templates/_opencrew/core/scripts/entrega/fora.mjs +50 -0
  19. package/templates/_opencrew/core/scripts/entrega/gravar.mjs +83 -0
  20. package/templates/_opencrew/core/scripts/entrega/guardar.mjs +60 -0
  21. package/templates/_opencrew/core/scripts/entrega/leiame.mjs +125 -0
  22. package/templates/_opencrew/core/scripts/entrega/leitor.mjs +133 -0
  23. package/templates/_opencrew/core/scripts/entrega/lembrar.mjs +65 -0
  24. package/templates/_opencrew/core/scripts/entrega/longas.mjs +109 -0
  25. package/templates/_opencrew/core/scripts/entrega/nomes.mjs +78 -0
  26. package/templates/_opencrew/core/scripts/entrega/passos.mjs +104 -0
  27. package/templates/_opencrew/core/scripts/entrega/pendencias.mjs +97 -0
  28. package/templates/_opencrew/core/scripts/entrega/ressalvas.mjs +78 -0
  29. package/templates/_opencrew/core/scripts/entrega/resumo.mjs +29 -0
  30. package/templates/_opencrew/core/scripts/entrega/retrato.mjs +42 -0
  31. package/templates/_opencrew/core/scripts/entrega/separar.mjs +106 -0
  32. package/templates/_opencrew/core/scripts/entrega/texto.mjs +95 -0
  33. package/templates/_opencrew/core/scripts/entregar.mjs +166 -0
  34. package/templates/_opencrew/core/scripts/verificar/argumentos.mjs +4 -4
  35. package/templates/_opencrew/core/scripts/verificar/entradas.mjs +26 -0
  36. package/templates/_opencrew/core/scripts/verificar/gravacao.mjs +41 -0
  37. package/templates/_opencrew/core/scripts/verificar/pecas.mjs +4 -4
  38. package/templates/_opencrew/core/scripts/verificar/relatorio.mjs +10 -3
  39. package/templates/_opencrew/core/scripts/verificar/secoes.mjs +22 -2
  40. package/templates/_opencrew/core/scripts/verificar.mjs +21 -29
  41. package/templates/gitignore +1 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,135 @@
3
3
  All notable changes to opencrew are documented here.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/).
5
5
 
6
+ ## [1.9.0] — 2026-10-07
7
+
8
+ Fase U3a, fatia 2 "Entrega no projeto" (`specs/fase-u3a2-entrega-no-projeto.md`). Chega a quem já
9
+ usa com um `npx @aksp/opencrew@latest update`, e funciona nas crews que já existem.
10
+
11
+ Ainda não nesta versão: a crew que publica sozinha continua publicando como na 1.8.0 (o publicador
12
+ ainda não lê a pasta da entrega); legenda, post e tweet continuam medidos sem as hashtags no fim
13
+ (só o alerta); documento Word fica para a 1.10.0.
14
+
15
+ ### Added
16
+ - **A entrega vai para uma pasta do seu projeto.** Na primeira entrega de cada crew, a IA pergunta
17
+ "Quer que eu copie o resultado para uma pasta do projeto?". Com a pasta escolhida (por exemplo,
18
+ `Conteudo/Prontos`), cada execução ganha a sua subpasta, `<pasta>/<execução>/`, com o LEIA-ME e
19
+ as pastas dos canais prontos. Antes, a entrega só existia em `crews/<crew>/output/…/entrega/`,
20
+ fora do git, e quem queria guardar copiava à mão.
21
+ - **A pergunta é feita uma vez.** A resposta — também o "não" — fica na linha `entrega.destino` do
22
+ `crew.yaml` da crew; o arquivo anterior é guardado em `crew.yaml.bak`.
23
+ - **Nada do que foi copiado é sobrescrito.** Entregar de novo sem mudança não cria nada; canal que
24
+ ficou pronto depois entra na mesma pasta; se algo já copiado mudou, a entrega nova vai para
25
+ `<execução>-reentrega-2`, ao lado, e o LEIA-ME da anterior avisa. Arquivo seu dentro da cópia
26
+ nunca é tocado: você pode editar a cópia à vontade, porque a entrega seguinte é comparada com o
27
+ que foi copiado, e não com o que você mudou depois.
28
+ - **"Entregar assim mesmo".** Quando um canal não está pronto, a crew oferece três saídas: corrigir
29
+ agora, entregar assim mesmo ou deixar para depois. Em "entregar assim mesmo", o que falta fica
30
+ escrito como ressalva no começo do LEIA-ME, o canal aparece como "Pronto, com ressalva" e é
31
+ copiado com os outros. Pendência nova depois do aceite pede novo aceite — também a que foi
32
+ resolvida e voltou.
33
+ - **Legenda de Instagram sem marcador.** Arquivo de legenda que é só o texto, pronto para colar,
34
+ sai como `instagram/legenda.txt`, com um aviso para conferir e com o alerta de tamanho. Antes, o
35
+ arquivo ia inteiro, sem ser medido.
36
+ - **Mudar a pasta da cópia depois.** Peça à IA ("muda a pasta de entrega", "não quero mais cópia",
37
+ "volta a copiar"): ela refaz a entrega da última execução e grava a resposta nova.
38
+ - **"Não tenho esse dado".** Na aprovação final, se você não tem a informação de um `[PREENCHER]`,
39
+ a crew não insiste e não inventa: deixa o `[PREENCHER]` no texto e você decide na entrega.
40
+
41
+ ### Changed
42
+ - **PDF e "posts formatados" deixaram de ser gerados.** O PDF era prometido e o método não
43
+ funcionava; o "post formatado" foi substituído pela entrega por canal. Para ter um PDF, abra o
44
+ arquivo e use Imprimir → Salvar como PDF (o LEIA-ME ensina). Crew antiga com um passo de
45
+ `format: pdf` ou `format: formatted-post`: a execução avisa que o formato não é mais gerado e o
46
+ passo grava o texto em markdown (`.md`); nenhum `.pdf` é criado. O CSV continua.
47
+ - **Canal que não está pronto não é copiado para o projeto.** Ele continua em `entrega/`, marcado
48
+ como "Não está pronto", e entra na cópia quando ficar pronto ou quando você aceitar a ressalva.
49
+ - **"Corrigir agora" corrige no arquivo de origem**, verifica o texto de novo e só então monta a
50
+ entrega. Antes, a correção podia ser feita sem nova verificação.
51
+ - **`[PREENCHER]` aparece no relatório como "✏️ A preencher"**, e não mais como "❌ Bloqueio"; o
52
+ resumo conta à parte ("1 a preencher"). O que impede a entrega não mudou: texto com `[PREENCHER]`
53
+ continua "Não está pronto" até você preencher ou aceitar.
54
+ - No LEIA-ME, o aviso de trecho que ficou fora do texto para colar diz em qual arquivo de origem
55
+ ele está.
56
+ - No laço de revisão, "Aceitar assim mesmo" diz que a escolha fica registrada na entrega.
57
+ - **`update` em instalação que não terminou** (`_opencrew/core` sem o registro de versão): não
58
+ altera nada e pede `npx @aksp/opencrew init`, que conclui. Antes, atualizava mostrando a versão
59
+ "unknown".
60
+
61
+ ### Fixed
62
+ - **O relatório de cada ciclo de revisão é gravado pelo verificador**
63
+ (`verificacao-ciclo-N.md`). Antes, a IA copiava a saída à mão e podia truncar.
64
+ - **`.gitignore` com um marcador do bloco sem o par** (só `# opencrew:start` ou só
65
+ `# opencrew:end`): o `update` guarda o arquivo como estava em `.opencrew-backup/<data>/`, põe um
66
+ bloco completo no fim e lista a cópia. Nenhuma linha sua é apagada.
67
+
68
+ ### Internal
69
+ - O bloco do `.gitignore` começa por `# gerenciado pelo OpenCrew: suas linhas ficam fora deste
70
+ bloco` (o primeiro `update` regrava só o bloco).
71
+ - `entregar.mjs` ganha `--destino`, `--lembrar-destino` e `--aceitar-pendencias`; `verificar.mjs`
72
+ ganha `--relatorio`; módulos novos em `scripts/entrega/` e `scripts/verificar/` (sem dependência,
73
+ até 200 linhas cada). `export.prompt.md` fica só com o CSV. O runner não cresceu (874 linhas).
74
+
75
+ ## [1.8.0] — 2026-10-07
76
+
77
+ Fase U3a, fatia 1 "Pasta de entrega" (`specs/fase-u3a1-pasta-de-entrega.md`). Chega a quem já usa
78
+ com um `npx @aksp/opencrew@latest update`, e funciona nas crews que já existem, sem mexer nelas.
79
+
80
+ Ainda não nesta versão: PDF e "posts formatados" não são gerados pela entrega (`artigo.md`,
81
+ `corpo.md` e os roteiros saem em markdown, e o LEIA-ME ensina a salvar como PDF pelo "Imprimir");
82
+ copiar a entrega para uma pasta do projeto, registrar "entregar assim mesmo" e marcar "já
83
+ publicado" ficam para a 1.9.0. O LEIA-ME e os nomes dos arquivos são só em português.
84
+
85
+ ### Added
86
+ - **Pasta `entrega/`: o que você usa, separado por canal.** Depois da aprovação final, a crew
87
+ monta `crews/<crew>/output/<execução>/entrega/` com uma pasta por canal (`instagram/`,
88
+ `linkedin/`, `blog/`, `email/`, `whatsapp/`, `twitter/`, `youtube/`; só os que a execução tem).
89
+ Antes, você recebia a pasta da execução com `v1`, `v2`, relatórios e textos cheios de `#`, `**`
90
+ e rótulos.
91
+ - **Texto pronto para colar.** `legenda.txt`, `post.txt` e `tweet.txt` saem sem `#`, `**`, rótulos
92
+ nem recados internos, com as hashtags no fim. O primeiro comentário do LinkedIn vem em arquivo
93
+ à parte; a thread, em `tweet-1.txt`, `tweet-2.txt`…; o blog, em `seo.txt` (título, meta
94
+ description, palavra-chave, slug) e `artigo.md`; o e-mail, em `assunto.txt`, `previa.txt` e
95
+ `corpo.md`; o WhatsApp, em `mensagem.txt`. As imagens vão para a pasta do canal com o nome
96
+ original, sem alteração; o HTML dos slides, para `editaveis/`.
97
+ - **`LEIA-ME.md` em cada entrega.** Diz o que fazer com cada arquivo, canal por canal, em passos
98
+ numerados; marca cada canal como "Pronto" ou "Não está pronto"; lista em "Antes de usar" o que
99
+ falta; e diz o que não foi conferido (links e fatos, texto dentro das imagens, aparência final
100
+ em cada rede).
101
+ - **O que não está pronto fica marcado.** Texto com `[PREENCHER]`, acima de um limite ou arquivo
102
+ que faltou: o canal aparece como "Não está pronto" e a crew pergunta se você quer corrigir agora
103
+ ou seguir assim. Se a legenda, o post ou o tweet passar do limite por causa das hashtags no fim,
104
+ o LEIA-ME traz um alerta.
105
+ - **Arquivo sem canal não se perde.** Proposta, minuta, relatório ou formato que não é de rede
106
+ nenhuma vai inteiro para `outros/`, com o nome original, e aparece no LEIA-ME.
107
+ - **Entrega de uma execução antiga.** Peça à IA para montar a entrega de uma execução já
108
+ encerrada: ela lista os arquivos, pede o seu "sim" e monta a pasta.
109
+ - Crew que publica sozinha (Instagram, por exemplo): a entrega é montada antes da publicação, e
110
+ o LEIA-ME avisa "Esta crew publica este canal sozinha. Antes de postar à mão, confira se já saiu."
111
+
112
+ ### Changed
113
+ - **O fim da execução aponta para `entrega/` e para o LEIA-ME**, não mais para a pasta da execução
114
+ e para um "arquivo final" que ninguém dizia qual era. A cópia do arquivo final na raiz da
115
+ execução deixa de ser feita.
116
+ - A pasta `entrega/` é refeita do zero a cada entrega e fica fora do git: o que você editar ali se
117
+ perde. Para guardar, copie a pasta para outro lugar do projeto (o LEIA-ME avisa).
118
+ - Se o script da entrega não rodar (sem Node, por exemplo), a execução não para: a crew avisa e
119
+ lista os arquivos aprovados.
120
+
121
+ ### Fixed
122
+ - **O título do arquivo era lido como legenda.** Num arquivo com `# Legenda — …` no topo e a
123
+ legenda de verdade mais abaixo, o verificador media duas legendas e podia dar alerta falso.
124
+ Agora o título do arquivo não conta como peça.
125
+
126
+ ### Internal
127
+ - `_opencrew/core/scripts/entregar.mjs` e os módulos de `scripts/entrega/` (sem dependência, até
128
+ 200 linhas cada); `_opencrew/core/prompts/entrega.prompt.md`; seção `### Entrega` no runner, que
129
+ perde "Save final output", "Run folder" e "Output saved to".
130
+ - Regra 15 do `AGENTS.md`: script do runtime só escreve onde foi combinado.
131
+ - Travas novas: `tests/entregar*.test.js`, `tests/runtime-contracts-u3a.test.js`,
132
+ `tests/upgrade-u3a.test.js` e o U3a-14c em `tests/package.test.js`.
133
+ - Roteiro renumerado: U3a fatia 2 = 1.9.0, U3b = 1.10.0, U4 = 1.11.0.
134
+
6
135
  ## [1.7.1] — 2026-10-06
7
136
 
8
137
  Fase R3 "Reparos do runner em uso real" (`specs/fase-r3-runner-em-uso-real.md`): dois defeitos
package/README.md CHANGED
@@ -30,8 +30,12 @@ dentro da sua IDE.**
30
30
  rejeita o mesmo erro 3 vezes, vira Regra de Ouro automática.
31
31
  - 📦 **Templates prontos** — blog semanal, Instagram carrossel, newsletter
32
32
  mensal, lançamento de produto. Comece em 2 minutos.
33
- - 📤 **Exportação multi-formato** — PDF, CSV e posts formatados por plataforma,
34
- sem abrir editor nenhum.
33
+ - 📤 **Tabelas em CSV** — as tabelas de um resultado saem em CSV, prontas para a planilha.
34
+ - 📬 **Entrega por canal** — depois de aprovar, você encontra a pasta `entrega/`: uma pasta por
35
+ canal (Instagram, LinkedIn, blog, e-mail, WhatsApp, X/Twitter, YouTube), o texto pronto para
36
+ colar, as imagens e um `LEIA-ME.md` com o passo a passo. O que não está pronto fica marcado.
37
+ - 📁 **Entrega no seu projeto** — a crew pergunta uma vez onde guardar e copia a entrega para uma
38
+ pasta do seu projeto, uma subpasta por execução, sem sobrescrever nada.
35
39
  - 🎛️ **Seleção inteligente de agentes** — o sistema analisa seu pedido e
36
40
  sugere quais agentes são necessários para aquela tarefa. Você confirma ou
37
41
  ajusta com um clique. Agentes pulados não gastam tokens naquele run.
@@ -178,9 +182,9 @@ meu-projeto/
178
182
  │ │ ├── skills.engine.md ← gerenciador de skills
179
183
  │ │ ├── architect.agent.yaml ← definição do Arquiteto
180
184
  │ │ ├── best-practices/ ← 22 guias de melhores práticas + _catalog.yaml
181
- │ │ ├── scripts/ ← verificador, conferência de fontes e os scripts do Escritório
185
+ │ │ ├── scripts/ ← verificador, conferência de fontes, caminhos, entrega e os scripts do Escritório
182
186
  │ │ ├── escritorio/ ← página do Escritório ao vivo (abre com /opencrew dashboard)
183
- │ │ └── prompts/ ← 13 prompts de fase (discovery, design, build, etc.)
187
+ │ │ └── prompts/ ← 14 prompts de fase (discovery, design, build, entrega, etc.)
184
188
  │ ├── agents/ ← 5 agentes base compartilhados
185
189
  │ │ ├── researcher.agent.md
186
190
  │ │ ├── copywriter.agent.md
@@ -194,6 +198,9 @@ meu-projeto/
194
198
  │
195
199
  ├── crews/ ← suas crews vivem aqui
196
200
  │ ├── blog-semanal/ ← template: blog semanal
201
+ │ │ └── output/<execução>/ ← criada a cada execução
202
+ │ │ ├── v1/ v2/ … ← o que cada passo gravou
203
+ │ │ └── entrega/ ← o que você usa: LEIA-ME.md + uma pasta por canal (copiada para a pasta do projeto que você escolher)
197
204
  │ ├── instagram-carrossel/ ← template: Instagram carrossel
198
205
  │ ├── newsletter-mensal/ ← template: newsletter
199
206
  │ └── lancamento-produto/ ← template: lançamento
@@ -209,6 +216,76 @@ meu-projeto/
209
216
 
210
217
  ---
211
218
 
219
+ ## Entrega por canal
220
+
221
+ Depois da aprovação final, a crew monta a pasta `entrega/` dentro da pasta da execução
222
+ (`crews/<crew>/output/<execução>/entrega/`). É ali que está o que você vai usar:
223
+
224
+ ```
225
+ entrega/
226
+ ├── LEIA-ME.md ← comece por aqui: o que fazer com cada arquivo, canal por canal
227
+ ├── instagram/ ← legenda.txt (hashtags no fim) e as imagens, com o nome original
228
+ ├── linkedin/ ← post.txt e, se houver, post-comentario.txt (o primeiro comentário)
229
+ ├── blog/ ← seo.txt (título, meta description, palavra-chave, slug) e artigo.md
230
+ ├── email/ ← assunto.txt, previa.txt e corpo.md
231
+ ├── whatsapp/ ← mensagem.txt
232
+ ├── twitter/ ← tweet.txt (na thread: tweet-1.txt, tweet-2.txt…)
233
+ ├── youtube/ ← o roteiro
234
+ ├── outros/ ← arquivo sem canal (proposta, minuta, relatório), como está
235
+ └── editaveis/ ← o HTML dos slides, para quem quiser ajustar
236
+ ```
237
+
238
+ Só aparecem as pastas que a execução tem.
239
+
240
+ - **Texto pronto para colar.** Os `.txt` saem sem `#`, `**`, rótulos nem recados internos, com as
241
+ hashtags no fim. Com mais de uma peça do mesmo tipo, os arquivos são numerados (`post-1.txt`,
242
+ `post-2.txt`).
243
+ - **O `LEIA-ME.md` diz o que fazer.** Cada canal tem a situação ("Pronto", "Pronto, com ressalva"
244
+ ou "Não está pronto"), os arquivos, de onde cada um veio e os passos, numerados. "Antes de usar"
245
+ junta o que falta e o que foi entregue com ressalva; "O que não foi conferido" lembra o que
246
+ ninguém mediu (links e fatos, texto dentro das imagens, aparência final em cada rede).
247
+ - **O que não está pronto fica marcado, e você escolhe.** Sobrou um `[PREENCHER]` ou um texto
248
+ acima do limite? O canal aparece como "Não está pronto" e a crew oferece três saídas:
249
+ 1. **Corrigir agora** — ela ajusta no arquivo de origem, verifica e monta a entrega de novo.
250
+ 2. **Entregar assim mesmo** — o que falta fica escrito como ressalva no começo do LEIA-ME, e o
251
+ canal passa a "Pronto, com ressalva".
252
+ 3. **Deixar para depois** — o canal fica como "Não está pronto" e não é copiado para o projeto.
253
+ Quando o dado existir, peça a entrega dessa execução de novo.
254
+ - **Não tem o dado na hora?** Na aprovação final, diga "não tenho esse dado": a crew não insiste e
255
+ não inventa — o `[PREENCHER]` fica no texto e você decide na entrega.
256
+ - **Arquivo sem canal vai para `outros/`**, inteiro e com o nome original: nada some.
257
+ - **A pasta `entrega/` é refeita a cada entrega e fica fora do git.** O que você editar ali se
258
+ perde: o que é para guardar está na cópia do seu projeto (abaixo).
259
+ - **Execução antiga?** Peça à IA: "monte a entrega da execução X da crew Y". Ela lista os
260
+ arquivos, pede o seu "sim" e monta a pasta. Funciona em crews criadas antes da 1.8.0, depois
261
+ do `update`.
262
+
263
+ ### A cópia no seu projeto
264
+
265
+ Na primeira entrega de cada crew, a IA pergunta: "Quer que eu copie o resultado para uma pasta do
266
+ projeto?". Se você disser uma pasta (por exemplo, `Conteudo/Prontos`), a crew copia a entrega para
267
+ uma pasta do seu projeto, uma subpasta por execução: `<pasta>/<execução>/`, com o `LEIA-ME.md` e
268
+ as pastas dos canais prontos.
269
+
270
+ - **A pergunta é feita uma vez por crew.** A resposta — também o "não" — fica na linha
271
+ `entrega.destino` do `crew.yaml` da crew (o arquivo anterior fica em `crew.yaml.bak`). Para
272
+ mudar depois, peça à IA ou edite essa linha.
273
+ - **Nada é sobrescrito.** Entregar de novo sem mudança não cria nada. Canal que ficou pronto
274
+ depois entra na mesma pasta. Se algo que já foi copiado mudou, a entrega nova vai para
275
+ `<execução>-reentrega-2` (depois `-3`…), ao lado, e a anterior fica como estava, com um aviso no
276
+ LEIA-ME dela. O que você editar ou guardar na cópia continua lá, e editar a cópia não faz a
277
+ entrega seguinte virar reentrega.
278
+ - **Só vai o que está pronto.** Canal "Não está pronto" fica fora da cópia, a menos que você
279
+ escolha "Entregar assim mesmo".
280
+ - **A pasta fica dentro do projeto**, fora de `_opencrew/`, `crews/`, `skills/`, `.git/` e
281
+ `node_modules/`; se não existe, é criada. Se ela entra no git, a escolha é sua.
282
+
283
+ A entrega não gera PDF nem imagem: `artigo.md`, `corpo.md` e os roteiros saem em markdown, e o
284
+ LEIA-ME ensina a salvar como PDF pelo "Imprimir" do seu editor. O LEIA-ME e os nomes dos arquivos
285
+ são sempre em português.
286
+
287
+ ---
288
+
212
289
  ## Escritório ao vivo
213
290
 
214
291
  Quer ver a equipe trabalhando? O **Escritório** é uma página em pixel-art, aberta no navegador,
@@ -273,6 +350,12 @@ o que você fez:
273
350
  copiou. Essa pasta fica fora do git (entra no bloco do `.gitignore`). No primeiro `update` para
274
351
  a 1.6.3 há cópia do `.gitignore` mesmo sem edição sua: as versões anteriores não registravam o
275
352
  bloco.
353
+ - **O `.gitignore` tem um marcador do bloco sem o par** (só `# opencrew:start` ou só
354
+ `# opencrew:end`)? Nenhuma linha sua é apagada: o `update` guarda o arquivo como estava e põe
355
+ um bloco completo no fim. O bloco começa por um comentário que diz que ele é do OpenCrew: as
356
+ suas linhas ficam fora dele.
357
+ - **A instalação anterior parou no meio?** O `update` não altera nada e pede para você rodar
358
+ `npx @aksp/opencrew init`, que conclui a instalação sem apagar o que já existe.
276
359
  - **Apagou um modelo de crew ou um skill do catálogo?** Ele volta no `update`, e a saída diz o
277
360
  que foi entregue de novo.
278
361
  - **Removeu o servidor Playwright do `.mcp.json`?** O `update` o entrega uma única vez; se você
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aksp/opencrew",
3
- "version": "1.7.1",
3
+ "version": "1.9.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -9,7 +9,7 @@ import { detectInstalledIdes } from '../lib/deteccao.js';
9
9
  import { withoutLegacy } from '../lib/legado.js';
10
10
  import { updateMcp } from '../lib/mcp.js';
11
11
  import { compareVersions, installedVersion, findLeftovers } from '../lib/migrations.js';
12
- import { say, recreatedLines, updateSummary, UNTOUCHED } from '../lib/resumo.js';
12
+ import { say, recreatedLines, updateSummary, UNTOUCHED, INTERRUPTED } from '../lib/resumo.js';
13
13
  import { c, log, info, ok, warn, err, step } from '../lib/ui.js';
14
14
 
15
15
  const tpl = (...p) => path.join(templatesDir, ...p);
@@ -39,7 +39,13 @@ export async function update(opts = {}) {
39
39
  return;
40
40
  }
41
41
 
42
- const current = (await installedVersion(target)) ?? 'unknown';
42
+ // No stamp = an install that did not finish: nothing is written or stamped (rule 31).
43
+ const current = await installedVersion(target);
44
+ if (!current) {
45
+ err(INTERRUPTED);
46
+ process.exitCode = 1;
47
+ return;
48
+ }
43
49
  log(`\n${c.bold(c.cyan('opencrew update'))}`);
44
50
  log(c.dim(`Installed: ${current} → Package: ${version}\n`));
45
51
  if (canApply(opts, current, version)) await apply(target, version);
@@ -47,7 +53,7 @@ export async function update(opts = {}) {
47
53
 
48
54
  /** `--check` only reports, and a package older than the workspace stops: false = write nothing. */
49
55
  function canApply(opts, current, version) {
50
- const newer = current !== 'unknown' && compareVersions(current, version) > 0;
56
+ const newer = compareVersions(current, version) > 0;
51
57
  if (opts.check) {
52
58
  if (current === version) ok(`Up to date (v${version}).`);
53
59
  else if (newer) info(`A versão instalada (v${current}) é mais nova que este pacote (v${version}).`);
package/src/lib/blocos.js CHANGED
@@ -70,11 +70,14 @@ function planBlock(file, text, marked) {
70
70
  const block = bytesOf(marked).replace(/\n/g, eol);
71
71
  const ranges = blockRanges(text, file);
72
72
  if (!ranges.length) {
73
+ // A marker left alone (its pair deleted by hand): the block still goes in whole, and the
74
+ // file as it was is copied first (spec U3a-2, rule 30).
75
+ const orphan = markersOf(file).some((marker) => text.includes(marker));
73
76
  const bom = text.startsWith(BOM) ? BOM : '';
74
77
  const added = AT_END.has(file)
75
78
  ? `${text.replace(/[ \t\r\n]+$/, '')}${eol}${eol}${block}${eol}`
76
79
  : `${bom}${block}${eol}${eol}${text.slice(bom.length).replace(/^[ \t\r\n]+/, '')}`;
77
- return { action: 'added', text: added, hashes: [] };
80
+ return { action: 'added', text: added, hashes: [], orphan };
78
81
  }
79
82
  const hashes = ranges.map(([from, to]) => hashOf(Buffer.from(text.slice(from, to), 'latin1').toString('utf8')));
80
83
  if (hashes.every((h) => h === hashOf(marked))) return { action: 'kept', hashes };
@@ -85,7 +88,8 @@ function planBlock(file, text, marked) {
85
88
  * Put `content` between the opencrew markers of `file` (path relative to the project root,
86
89
  * with `/`) and record the block in `ctx.files`.
87
90
  * - no file → `created`; file with no block → `added` at the top (at the end in .gitignore
88
- * and .env.example), the user's content kept, no copy;
91
+ * and .env.example), the user's content kept, no copy — unless a marker was left alone
92
+ * in it: then the whole file is copied first;
89
93
  * - block equal to the new one → `kept`, nothing written;
90
94
  * - otherwise → `updated`: only the block is rewritten, in the line ending of the file. The
91
95
  * whole file is copied first unless the block is exactly what the manifest recorded.
@@ -102,7 +106,7 @@ export async function deliverBlock(ctx, file, content) {
102
106
  const edited = plan.action === 'updated' && !plan.hashes.every((h) => h === record);
103
107
  // A UTF-16 file cannot take a UTF-8 block without damage: the whole file is copied first.
104
108
  const risky = raw && plan.text !== undefined && isUtf16(raw);
105
- const copied = (edited || risky) && (await backupFile(ctx, file));
109
+ const copied = (edited || risky || plan.orphan) && (await backupFile(ctx, file));
106
110
  if (plan.text !== undefined) {
107
111
  await fs.mkdir(path.dirname(dest), { recursive: true });
108
112
  await fs.writeFile(dest, Buffer.from(plan.text, 'latin1'));
package/src/lib/resumo.js CHANGED
@@ -15,6 +15,9 @@ export const UNTOUCHED = 'Não foram alterados: as crews que você criou, `_open
15
15
  /** `init` in a workspace that is already installed (rule 15). */
16
16
  export const ALREADY_INSTALLED = 'Para atualizar, rode `npx @aksp/opencrew@latest update`. Não apague `_opencrew/` para reinstalar: a pasta guarda a sua memória (`_opencrew/_memory/`) e as suas best-practices (`_opencrew/best-practices.local/`).';
17
17
 
18
+ /** `update` over `_opencrew/core` with no version stamp (spec U3a-2, rule 31). */
19
+ export const INTERRUPTED = 'A instalação anterior não terminou. Rode `npx @aksp/opencrew init` para concluir.';
20
+
18
21
  const NO_BRIDGES = 'Nenhuma ponte de IDE encontrada: nada a atualizar. Para criar a ponte de uma IDE: `npx @aksp/opencrew@latest init --repair-bridges --ide=<id>`.';
19
22
  const LEAK_REMOVED = 'CLAUDE.md: removi a seção de STATUS.md que as versões 1.4.0 e 1.4.1 gravaram por engano.';
20
23
  const FIRST_PROTECTED = 'Primeira atualização com proteção: sem registro anterior, guardamos tudo o que diferia. Daqui em diante, só o que você editar.';
@@ -61,6 +61,8 @@ Route input to the matching action:
61
61
  | `/opencrew dashboard` | Turn on and open the Escritório (live view) — see "Dashboard (Optional)" |
62
62
  | `/opencrew dashboard off` | Turn the Escritório off — see "Dashboard (Optional)" |
63
63
  | `/opencrew reset` | Confirm and reset all configuration |
64
+ | Request to deliver a run that already ended ("monte a entrega da execução …") | Load `_opencrew/core/prompts/entrega.prompt.md` → build the `entrega/` folder of that run |
65
+ | Request to change where the delivery is copied ("muda a pasta de entrega", "não quero mais cópia", "volta a copiar") | Load `_opencrew/core/prompts/entrega.prompt.md` → "Changing the folder later" |
64
66
  | Natural language about crews | Infer intent and route accordingly |
65
67
 
66
68
  ## Loading Agents
@@ -120,6 +122,8 @@ and touch nothing else: stop no process, delete no file.
120
122
  - Exception: crew memory scaffolding (`memories.md` headers, `runs.md` columns)
121
123
  keeps fixed PT-BR structural labels regardless of the user's language —
122
124
  see `_opencrew/core/runner.pipeline.md`
125
+ - Exception: the delivery folder (`entrega/`) — its folder names, file names and the `LEIA-ME.md`
126
+ are written by a script in fixed PT-BR, whatever the user's language
123
127
 
124
128
  ## Critical Rules
125
129
 
@@ -1 +1 @@
1
- 1.7.1
1
+ 1.9.0
@@ -112,7 +112,7 @@ Based on the detected domain, ask the most relevant contextual question first. W
112
112
  **If domain = `analysis`:**
113
113
  1. Where does the data come from? (open-ended — let the user describe their data sources)
114
114
  2. What decisions should this analysis help you make? (open-ended)
115
- 3. What format should the output take? (multiple choice: dashboard / PDF report / spreadsheet / automated alert / other)
115
+ 3. What format should the output take? (multiple choice: dashboard / written report / spreadsheet / automated alert / other)
116
116
 
117
117
  **If domain = `mixed`:**
118
118
  Ask the most pressing question from each relevant domain, starting with the primary one. Cap at 3 questions total in this step.
@@ -0,0 +1,205 @@
1
+ # Entrega — The Delivery Folder of a Run
2
+
3
+ One script turns the approved files of a run into `crews/{name}/output/{run_id}/entrega/`: one
4
+ folder per channel, text ready to paste and a `LEIA-ME.md` that tells the user what to do with each
5
+ file. The same script copies what is ready to a folder of the project the user chose, one folder per
6
+ run. Your part is to build the list of files, run the script, act on its last line and ask, once per
7
+ crew, where the copy goes.
8
+
9
+ You do NOT copy, split, rename or rewrite a file yourself, and you never write inside `entrega/`:
10
+ the script rebuilds that folder from scratch on every call. **When** the delivery runs is in the
11
+ section "Entrega" of `_opencrew/core/runner.pipeline.md`; a request to deliver a run that is
12
+ already over starts at "A run that already ended", below.
13
+
14
+ ## Step 1: Build the list
15
+
16
+ `{lista}` is one item per file, separated by commas, each written `{caminho}={formato}`.
17
+
18
+ - **What goes in:** for each **creation or rendering step** of the approved run, every path the
19
+ `saida` action of `caminho.mjs` returned the **last time** the step ran (a step sent back by the
20
+ reviewer ran more than once: only its last version counts) — all the output files of the step,
21
+ images and HTML included. Use the paths you stored during the run. Never look for a `vN` folder
22
+ by yourself and never assume `v1`.
23
+ - **`{formato}`** is the `format:` of the step that wrote the file. A rendering step with no
24
+ `format:` uses the `format:` of the content step it renders (the slides of an `instagram-feed`
25
+ carousel go as `=instagram-feed`). With no format either way, with an export format (`pdf`,
26
+ `csv`, `formatted-post`) or with one outside `[a-z0-9-]+`, the item goes without `={formato}`:
27
+ the script puts that file in `outros/`.
28
+ This list is **not** the list of the checker (`verificar.mjs`), where a step with no `format:`
29
+ goes without one: here the rendering step (images, HTML) takes the format of the content step it
30
+ renders — the step that wrote its `inputFile`. Without it the images land in `outros/`.
31
+ - **Stay out:** research, briefing, the reviewer's verdict, checkpoint answers and every skipped
32
+ step (a deselected agent, or a step the user skipped).
33
+ - **Safe names** — the safe-name rule (nome seguro) of the runner applies. A file that rule left
34
+ out of commands stays out of the list too; tell the user:
35
+ `{arquivo} — ficou fora da entrega: nome com caractere que não vai em comando`.
36
+
37
+ ## Step 2: Channels the crew publishes by itself
38
+
39
+ Add `--vai-publicar {canal}` once for each channel of the list that has an irreversible step in the
40
+ pipeline (`side_effects: irreversible`, in the step or in the agent's skill), whether that step
41
+ already ran or not. The `LEIA-ME.md` then opens that channel with: "Esta crew publica este canal
42
+ sozinha. Antes de postar à mão, confira se já saiu."
43
+
44
+ - The channel of a step is the `platform:` of its `format:` — read it in
45
+ `_opencrew/best-practices.local/{format}.md` when that file declares `platform:`, otherwise in
46
+ `_opencrew/core/best-practices/{format}.md`. For a step with no `format:`, the one of the skill
47
+ (`instagram-publisher` → `instagram`). With neither, do not pass the option.
48
+ - `{canal}` is the folder name: `instagram`, `linkedin`, `blog`, `email`, `whatsapp`, `twitter` or
49
+ `youtube`. Only a channel that has an item in the list (an item whose format has that
50
+ `platform:`) — for any other the script stops with `Canal não encontrado nesta entrega: {canal}.`
51
+
52
+ ## Step 3: Run the script
53
+
54
+ From the project root, one line, everything between double quotes:
55
+
56
+ `node _opencrew/core/scripts/entregar.mjs --crew "crews/{name}" --run "{run_id}" --arquivo "{lista}"`
57
+
58
+ With channels from Step 2, the same command ends with one option per channel:
59
+
60
+ `node _opencrew/core/scripts/entregar.mjs --crew "crews/{name}" --run "{run_id}" --arquivo "{lista}" --vai-publicar {canal}`
61
+
62
+ ## Step 4: Show the result and read the last line
63
+
64
+ The output of the script is the final summary of the run (the folder, each channel as "Pronto",
65
+ "Pronto, com ressalva" or "Não está pronto", what is missing, the line of the copy, the path of
66
+ the `LEIA-ME.md`): show it to the user as it came,
67
+ without the `ENTREGA:` line. Do not rewrite it and do not add files it does not list. Besides the
68
+ `entrega/` folder, the script also writes `crews/{name}/output/{run_id}/verificacao-entrega.md`,
69
+ the report of the check made at delivery time (it is not part of the delivery).
70
+
71
+ - `ENTREGA:OK` → go on with the run (Step 5 first, when it applies).
72
+ - `ENTREGA:COM_RESSALVA` → everything that was missing is a ressalva the user accepted: the
73
+ `LEIA-ME.md` opens with it and the channel is "Pronto, com ressalva"; go on as with `ENTREGA:OK`.
74
+ - `ENTREGA:INCOMPLETA` → a channel is not ready, the destination was refused or a file could not be
75
+ written. `entrega/` was generated anyway and the `LEIA-ME.md` marks the channel; a channel that
76
+ is not ready is not copied to the project. The channels that are ready were already copied by
77
+ this same call, before the user answers: nothing waits for the answer. Show what is missing and
78
+ ask:
79
+ ```
80
+ ⚠️ A entrega ficou incompleta: {o que falta}
81
+ 1. Corrigir agora (eu ajusto no arquivo de origem, verifico e monto a entrega de novo)
82
+ 2. Entregar assim mesmo (fica registrado como ressalva no LEIA-ME)
83
+ 3. Deixar para depois (o canal fica como "Não está pronto" e não é copiado)
84
+ ```
85
+ Wait for the answer.
86
+ - **1** — for each item that is missing, fix it in the source file the pending item names, never
87
+ inside `entrega/`, and in place — the same file at the same path, no new `vN` folder and no
88
+ copy — so the list does not change: ask the user for the real information of every
89
+ `[PREENCHER: …]`, shorten what is over a limit, write again a file that is not there. Then run
90
+ the checker on that file
91
+ (`node _opencrew/core/scripts/verificar.mjs --crew "crews/{name}" --arquivo "{caminho}={formato}"`)
92
+ and only then run the delivery again, with the same list.
93
+ - **2** — run the same command again, ending with `--aceitar-pendencias`: the script records
94
+ each pending item as a ressalva (in `ressalvas.json`, in the run folder, and at the top of the
95
+ `LEIA-ME.md`), the channel becomes "Pronto, com ressalva" and is copied like the ready ones.
96
+ It does **not** solve a file that does not exist, a refused destination or a file that could
97
+ not be written: for those, see below.
98
+ - **3** — go on: the channel stays "Não está pronto" and is not copied. Every irreversible step
99
+ still asks for its own confirmation, as it does today. Tell the user what is missing and that
100
+ it is enough to ask for the delivery of this run when the data exists.
101
+ - **Destination refused, or a file that could not be written** (the lines "Não copiei: …" and
102
+ "Não consegui gravar …"): show the message as it came and ask for another folder (Step 5, with
103
+ the new answer) or for a new attempt, which is the same command again. A file of the list that
104
+ does not exist: ask for it, or take it out of the list.
105
+
106
+ The first call never has `--aceitar-pendencias`. Outside option 2 it goes only when the user
107
+ already chose "Aceitar assim mesmo" in the review loop of this run and what is missing is only
108
+ what was accepted there: then run the command again with it, without asking.
109
+
110
+ After "Edit this content" (the final menu of the runner) changes an approved file, or any step
111
+ runs again after the delivery, run the delivery again with the new paths: the folder is rebuilt
112
+ from scratch, so whatever was edited inside `entrega/` is lost — the `LEIA-ME.md` says so. The copy
113
+ in the project is never overwritten: when something already copied changed, the script puts the
114
+ new delivery in a folder beside it (`{run_id}-reentrega-2`) and the summary says so.
115
+
116
+ ## Step 5: The folder of the project that keeps the copy
117
+
118
+ The line `Cópia:` of the summary says what was copied and where (or "Criei a pasta …" before it):
119
+ show it as it came. A crew whose answer was "não" has no such line, and nothing is asked.
120
+
121
+ After **any** delivery whose summary has the line "Cópia: nenhuma pasta escolhida para esta crew."
122
+ — `ENTREGA:OK` and `ENTREGA:COM_RESSALVA` included — ask, once. When the last line was
123
+ `ENTREGA:INCOMPLETA`, ask only after it was resolved (Step 4):
124
+
125
+ ```
126
+ Quer que eu copie o resultado para uma pasta do projeto? Se sim, diga qual (por exemplo, `Conteudo/Prontos`). Se não, não pergunto de novo.
127
+ ```
128
+
129
+ - A folder → run the same command again (same list, same options), ending with
130
+ `--lembrar-destino "{pasta}"`.
131
+ - "Não" → the same command again, ending with `--lembrar-destino nao`.
132
+
133
+ The script writes the answer in the `crew.yaml` of the crew (`entrega.destino`, with a `.bak` copy
134
+ of the file) and makes the copy in the same call: never edit the `crew.yaml` yourself for this. The
135
+ next deliveries of the crew do not ask again.
136
+
137
+ - **`{pasta}` was typed by the user and goes into a command** — the safe-name rule (nome seguro)
138
+ of the runner applies: between double quotes and only if it is made of letters (accents
139
+ included), digits, space and `. _ - / \ : ( )`. With any other character do NOT run the command;
140
+ say `⚠️ O nome `{pasta}` tem um caractere que não posso usar em comandos ({caractere}). Use só letras, números, espaço, ponto, hífen, sublinhado e parênteses.`
141
+ and ask for the folder again.
142
+ - The folder is a path inside the project, written from its root (`Conteudo/Prontos`). When the
143
+ script refuses it ("Não copiei: …"), nothing was recorded — also when it is the only line of the
144
+ output, with no `ENTREGA:` line: show it as it came and ask for another folder (or "não").
145
+ - To copy one delivery somewhere else without changing the answer of the crew, the same command
146
+ ends with `--destino "{pasta}"` (same rule for `{pasta}`); only when the user asks for it.
147
+
148
+ ## Changing the folder later
149
+
150
+ When the user asks to change where the copy goes, to stop copying or to copy again ("muda a pasta
151
+ de entrega", "não quero mais cópia", "volta a copiar"): run the delivery of the **last run** of the
152
+ crew ("A run that already ended", below), with the command ending with
153
+ `--lembrar-destino "{pasta}"` (same rule for `{pasta}`), or with `--lembrar-destino nao` to stop.
154
+ With no folder in the request, ask which. Never edit the `crew.yaml` by hand.
155
+
156
+ ## When the script does not run
157
+
158
+ The script did not run when there is no Node, an error, or no `ENTREGA:` line at the end (it prints
159
+ one line in PT-BR and stops, with nothing written). Then never build the folder by hand. If the line points to something in the
160
+ command you wrote (an option, a channel, the run), fix the command and run it once more. Otherwise
161
+ tell the user, list the approved files (the paths of your list) and go on with the run:
162
+
163
+ ```
164
+ ⚠️ A entrega automática não rodou: {motivo}
165
+ Os arquivos aprovados estão em:
166
+ - {caminho}
167
+ ```
168
+
169
+ `{motivo}` is the line the script printed, or what kept it from running. The completion summary
170
+ of the runner then shows this list in place of the `entrega/` folder.
171
+
172
+ **A refused destination is not that.** When the only line is "Não copiei: … Recebi: {valor}." (the
173
+ folder given to `--lembrar-destino` was refused; nothing was written), the script did run: show
174
+ that line to the user as it came and ask for another folder (or "não"), as in Step 5 — never answer
175
+ it with "A entrega automática não rodou".
176
+
177
+ ## A run that already ended
178
+
179
+ When the user asks to deliver a run that is over (it was run before this folder existed, or the
180
+ delivery did not run):
181
+
182
+ 1. Find the crew and the run. If the user did not say which, list the folders of
183
+ `crews/{name}/output/` with the IDE's folder-listing tool (no shell command) and ask.
184
+ 2. Read the steps of `crews/{name}/pipeline/`. For the `outputFile` of each creation or rendering
185
+ step (same rules of Step 1 for what stays out and for `{formato}`), run:
186
+ `node _opencrew/core/scripts/caminho.mjs "{name}" entrada --run "{run_id}" --arquivo "{outputFile}"`
187
+ `CAMINHO:OK {path}` → that path is the item. `CAMINHO:FALTA` → the file is not in that run:
188
+ leave it out.
189
+ 3. Nobody recorded what was approved in that run, so show the list and wait for the "sim":
190
+ ```
191
+ Entrega da execução {run_id} da crew {name}. Arquivos:
192
+ - {caminho} ({formato})
193
+ Posso montar a entrega com esta lista? (sim / não)
194
+ ```
195
+ 4. On "sim", follow Steps 2 to 5. No step of the pipeline runs again, and nothing is published.
196
+
197
+ ## Rules
198
+
199
+ - **DO** show the output of the script as it came; the folder and file names and the `LEIA-ME.md`
200
+ are fixed PT-BR, whatever the user's language.
201
+ - **DO** run the delivery again whenever an approved file changes.
202
+ - **DO NOT** create, edit or delete anything inside `entrega/` yourself.
203
+ - **DO NOT** write the destination in the `crew.yaml` yourself, nor copy the delivery by hand.
204
+ - **DO NOT** put in the list a file the user did not approve, nor a path you guessed.
205
+ - **DO NOT** treat `ENTREGA:INCOMPLETA` as an error of the script: it is its answer.