@semacode/cli 2.2.0 → 2.3.1
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/LICENSE +39 -39
- package/README.md +251 -141
- package/dist/agentContext.d.ts +1 -1
- package/dist/agentContextPack.js +6 -1
- package/dist/agentContextTipos.d.ts +4 -2
- package/dist/agentContextTipos.js +7 -0
- package/dist/agentEntryPoints.js +551 -499
- package/dist/angular-consumer-standalone.d.ts +3 -1
- package/dist/angular-consumer-standalone.js +12 -8
- package/dist/comandos.js +4 -0
- package/dist/discovery/catalog.d.ts +11 -0
- package/dist/discovery/catalog.js +521 -0
- package/dist/discovery/command.d.ts +11 -0
- package/dist/discovery/command.js +226 -0
- package/dist/discovery/index.d.ts +5 -0
- package/dist/discovery/index.js +8 -0
- package/dist/discovery/ranker.d.ts +3 -0
- package/dist/discovery/ranker.js +310 -0
- package/dist/discovery/redaction.d.ts +2 -0
- package/dist/discovery/redaction.js +21 -0
- package/dist/discovery/render.d.ts +2 -0
- package/dist/discovery/render.js +100 -0
- package/dist/discovery/types.d.ts +119 -0
- package/dist/discovery/types.js +13 -0
- package/dist/drift.part01.d.ts +32 -2
- package/dist/drift.part01.js +2 -0
- package/dist/drift.part04.d.ts +3 -2
- package/dist/drift.part04.js +6 -3
- package/dist/drift.part05.d.ts +2 -1
- package/dist/drift.part05.js +4 -3
- package/dist/drift.part06.d.ts +2 -1
- package/dist/drift.part06.js +9 -5
- package/dist/drift.part07.d.ts +11 -10
- package/dist/drift.part07.js +40 -30
- package/dist/drift.part08.d.ts +2 -1
- package/dist/drift.part08.js +4 -3
- package/dist/drift.part11.js +71 -6
- package/dist/drift.part12.js +14 -1
- package/dist/drift.part13.d.ts +42 -7
- package/dist/drift.part13.js +660 -36
- package/dist/driftCache.d.ts +49 -0
- package/dist/driftCache.js +311 -0
- package/dist/driftCacheIncremental.d.ts +98 -0
- package/dist/driftCacheIncremental.js +596 -0
- package/dist/driftCatalogo.d.ts +91 -0
- package/dist/driftCatalogo.js +657 -0
- package/dist/driftCatalogoPersistente.d.ts +8 -0
- package/dist/driftCatalogoPersistente.js +77 -0
- package/dist/driftEscopo.d.ts +23 -0
- package/dist/driftEscopo.js +563 -0
- package/dist/driftEscopoReferencias.d.ts +4 -0
- package/dist/driftEscopoReferencias.js +265 -0
- package/dist/driftOrcamento.d.ts +12 -0
- package/dist/driftOrcamento.js +19 -3
- package/dist/execucoesExternas.js +5 -19
- package/dist/exemplosOficiais.js +29 -8
- package/dist/iaPrompts.d.ts +1 -1
- package/dist/iaPrompts.js +310 -307
- package/dist/index.d.ts +2 -0
- package/dist/index.js +23 -5
- package/dist/index.part01.d.ts +17 -2
- package/dist/index.part01.js +119 -8
- package/dist/index.part02.js +21 -21
- package/dist/index.part03.d.ts +2 -2
- package/dist/index.part03.js +14 -3
- package/dist/index.part04.d.ts +2 -2
- package/dist/index.part04.js +113 -101
- package/dist/index.part05.d.ts +1 -1
- package/dist/index.part05.js +99 -22
- package/dist/index.part06.js +6 -2
- package/dist/index.part07.js +24 -24
- package/dist/index.part08.js +1 -1
- package/dist/init/templates.part01.js +393 -393
- package/dist/init/templates.part02.js +189 -189
- package/dist/initTemplatesBackend.js +73 -73
- package/dist/initTemplatesBase.js +81 -80
- package/dist/initTemplatesFlutter.js +137 -137
- package/dist/initTemplatesRuntime.js +350 -350
- package/dist/initTemplatesWeb.js +309 -309
- package/dist/pipelineConteudo/command.js +1 -36
- package/dist/profileArtefatoValidadores.d.ts +3 -2
- package/dist/profileArtefatoValidadores.js +81 -0
- package/dist/profileAuthorTipos.d.ts +4 -3
- package/dist/profileCatalogo.d.ts +5 -5
- package/dist/profileCatalogo.js +30 -0
- package/dist/profileCommand.d.ts +8 -2
- package/dist/profileCommand.js +15 -5
- package/dist/profileRegras.d.ts +5 -5
- package/dist/profileRegras.js +13 -1
- package/dist/profileRulePacks.js +68 -0
- package/dist/projeto.d.ts +1 -1
- package/dist/projetoCarregar.d.ts +2 -2
- package/dist/projetoCarregar.js +47 -24
- package/dist/projetoCatalogo.d.ts +7 -0
- package/dist/projetoCatalogo.js +125 -0
- package/dist/projetoTipos.d.ts +14 -5
- package/dist/sistemasInterativos/adapterProtocol.d.ts +3 -0
- package/dist/sistemasInterativos/adapterProtocol.js +240 -0
- package/dist/sistemasInterativos/advancedCatalog.d.ts +5 -0
- package/dist/sistemasInterativos/advancedCatalog.js +442 -0
- package/dist/sistemasInterativos/autonomy.d.ts +230 -0
- package/dist/sistemasInterativos/autonomy.js +753 -0
- package/dist/sistemasInterativos/canonical.d.ts +3 -0
- package/dist/sistemasInterativos/canonical.js +43 -0
- package/dist/sistemasInterativos/catalog.d.ts +116 -0
- package/dist/sistemasInterativos/catalog.js +543 -0
- package/dist/sistemasInterativos/command.d.ts +7 -0
- package/dist/sistemasInterativos/command.js +311 -0
- package/dist/sistemasInterativos/controlRun.d.ts +56 -0
- package/dist/sistemasInterativos/controlRun.js +391 -0
- package/dist/sistemasInterativos/evidence.d.ts +5 -0
- package/dist/sistemasInterativos/evidence.js +306 -0
- package/dist/sistemasInterativos/experienceIr.d.ts +12 -0
- package/dist/sistemasInterativos/experienceIr.js +895 -0
- package/dist/sistemasInterativos/experienceIrSemantics.d.ts +30 -0
- package/dist/sistemasInterativos/experienceIrSemantics.js +368 -0
- package/dist/sistemasInterativos/experienceIrTypes.d.ts +370 -0
- package/dist/sistemasInterativos/experienceIrTypes.js +5 -0
- package/dist/sistemasInterativos/extensionCommand.d.ts +391 -0
- package/dist/sistemasInterativos/extensionCommand.js +383 -0
- package/dist/sistemasInterativos/index.d.ts +19 -0
- package/dist/sistemasInterativos/index.js +22 -0
- package/dist/sistemasInterativos/operations.d.ts +40 -0
- package/dist/sistemasInterativos/operations.js +1167 -0
- package/dist/sistemasInterativos/operationsTypes.d.ts +297 -0
- package/dist/sistemasInterativos/operationsTypes.js +11 -0
- package/dist/sistemasInterativos/planner.d.ts +2 -0
- package/dist/sistemasInterativos/planner.js +159 -0
- package/dist/sistemasInterativos/portability.d.ts +164 -0
- package/dist/sistemasInterativos/portability.js +539 -0
- package/dist/sistemasInterativos/render.d.ts +3 -0
- package/dist/sistemasInterativos/render.js +179 -0
- package/dist/sistemasInterativos/temporal.d.ts +183 -0
- package/dist/sistemasInterativos/temporal.js +543 -0
- package/dist/sistemasInterativos/types.d.ts +215 -0
- package/dist/sistemasInterativos/types.js +4 -0
- package/dist/sistemasInterativos/validator.d.ts +2 -0
- package/dist/sistemasInterativos/validator.js +305 -0
- package/dist/sync/index.js +35 -35
- package/docs/README.md +34 -28
- package/docs/ai-onboarding.md +62 -62
- package/docs/ai-workflow.md +9 -4
- package/docs/auth.md +26 -26
- package/docs/cli.md +79 -79
- package/docs/commands.md +47 -2
- package/docs/database.md +15 -15
- package/docs/deploy.md +41 -41
- package/docs/descoberta-capacidades.md +106 -0
- package/docs/documentation.md +39 -39
- package/docs/env.md +16 -16
- package/docs/frontend.md +41 -41
- package/docs/getting-started.md +57 -57
- package/docs/i18n.md +15 -15
- package/docs/pipeline-conteudo.md +246 -246
- package/docs/profiles.md +54 -45
- package/docs/repositories.md +43 -43
- package/docs/rollback.md +31 -31
- package/docs/security.md +32 -32
- package/docs/sistemas-interativos.md +376 -0
- package/docs/support.md +8 -8
- package/docs/testing.md +51 -35
- package/docs/vocabulary.md +29 -29
- package/exemplos/agendamento.sema +1 -1
- package/exemplos/assinatura.sema +1 -1
- package/exemplos/auditoria.sema +1 -1
- package/exemplos/autenticacao.sema +1 -1
- package/exemplos/author_obra_comum.sema +1 -1
- package/exemplos/author_tema_sensivel.sema +1 -1
- package/exemplos/automacao.sema +1 -1
- package/exemplos/cadastro_usuario.sema +1 -1
- package/exemplos/calculadora.sema +1 -1
- package/exemplos/crud_simples.sema +1 -1
- package/exemplos/estoque.sema +1 -1
- package/exemplos/exportacao.sema +1 -1
- package/exemplos/fila.sema +1 -1
- package/exemplos/integracao_externa.sema +1 -1
- package/exemplos/multi_tenant.sema +1 -1
- package/exemplos/notificacao.sema +1 -1
- package/exemplos/operacao_estrategia.sema +132 -132
- package/exemplos/operacao_estrategia_discovery.sema +220 -220
- package/exemplos/operacao_estrategia_fluxo.sema +114 -114
- package/exemplos/operacao_estrategia_gates.sema +106 -106
- package/exemplos/operacao_estrategia_quarentena.sema +133 -133
- package/exemplos/operacao_estrategia_rollout.sema +124 -124
- package/exemplos/pagamento.sema +1 -1
- package/exemplos/pagamento_dominio.sema +1 -1
- package/exemplos/pedido.sema +1 -1
- package/exemplos/permissao.sema +1 -1
- package/exemplos/persistencia_vendor_first.sema +1 -1
- package/exemplos/pipeline-conteudo/README.md +44 -44
- package/exemplos/pipeline-conteudo/alvos.json +23 -23
- package/exemplos/pipeline-conteudo/definicao.json +136 -136
- package/exemplos/profile_conversas.sema +165 -165
- package/exemplos/profile_game.sema +1 -1
- package/exemplos/profile_legal.sema +1 -1
- package/exemplos/profile_ops.sema +1 -1
- package/exemplos/profile_research.sema +1 -1
- package/exemplos/profile_simulation.sema +211 -0
- package/exemplos/profile_software.sema +1 -1
- package/exemplos/profile_workflow_n8n.sema +1 -1
- package/exemplos/relatorio.sema +1 -1
- package/exemplos/replica_analitica_erp.sema +1 -1
- package/exemplos/sistemas-interativos/README.md +100 -0
- package/exemplos/sistemas-interativos/advanced/acceptance-context-evaluate-valid.json +5 -0
- package/exemplos/sistemas-interativos/advanced/acceptance-lock-valid.json +16 -0
- package/exemplos/sistemas-interativos/advanced/asset-provenance-valid.json +32 -0
- package/exemplos/sistemas-interativos/advanced/autonomy-repair-valid.json +93 -0
- package/exemplos/sistemas-interativos/advanced/control-run-definition-valid.json +78 -0
- package/exemplos/sistemas-interativos/advanced/control-run-valid.json +27 -0
- package/exemplos/sistemas-interativos/advanced/distributed-workers-valid.json +79 -0
- package/exemplos/sistemas-interativos/advanced/editor-state-valid.json +42 -0
- package/exemplos/sistemas-interativos/advanced/engine-snapshot-after-valid.json +32 -0
- package/exemplos/sistemas-interativos/advanced/engine-snapshot-before-valid.json +23 -0
- package/exemplos/sistemas-interativos/advanced/job-orchestration-valid.json +39 -0
- package/exemplos/sistemas-interativos/advanced/multimodal-evidence-valid.json +46 -0
- package/exemplos/sistemas-interativos/advanced/multiplayer-authority-valid.json +39 -0
- package/exemplos/sistemas-interativos/advanced/playtest-fuzz-valid.json +37 -0
- package/exemplos/sistemas-interativos/advanced/portability-valid.json +104 -0
- package/exemplos/sistemas-interativos/advanced/temporal-evidence-valid.json +27 -0
- package/exemplos/sistemas-interativos/advanced/temporal-valid.json +118 -0
- package/exemplos/sistemas-interativos/experience-ir-valid.json +459 -0
- package/exemplos/sistemas-interativos/game-2d.json +83 -0
- package/exemplos/sistemas-interativos/game-3d-human.json +81 -0
- package/exemplos/sistemas-interativos/game-pixel-16-bit.json +97 -0
- package/exemplos/sistemas-interativos/game-pixel-8-bit.json +94 -0
- package/exemplos/sistemas-interativos/game-xr-human.json +80 -0
- package/exemplos/sistemas-interativos/hybrid-2-5d.json +108 -0
- package/exemplos/sistemas-interativos/protocol-mutating-rollback-valid.json +75 -0
- package/exemplos/sistemas-interativos/protocol-read-only-valid.json +58 -0
- package/exemplos/sistemas-interativos/simulation-2d-controlled.json +97 -0
- package/exemplos/sistemas-interativos/simulation-3d-calibrated-autonomous.json +141 -0
- package/exemplos/sistemas-interativos/simulation-headless-autonomous-batch.json +112 -0
- package/exemplos/sistemas-interativos/simulation-pixel-16-bit.json +103 -0
- package/exemplos/sistemas-interativos/simulation-text-controlled.json +95 -0
- package/exemplos/testes_embutidos.sema +1 -1
- package/exemplos/tratamento_erro.sema +1 -1
- package/exemplos/upload_arquivo.sema +1 -1
- package/exemplos/webhook.sema +1 -1
- package/node_modules/@sema/gerador-cpp/dist/index.js +176 -176
- package/node_modules/@sema/gerador-cpp/package.json +1 -1
- package/node_modules/@sema/gerador-css/dist/index.part01.js +10 -10
- package/node_modules/@sema/gerador-css/dist/index.part02.js +460 -460
- package/node_modules/@sema/gerador-dotnet/dist/index.js +169 -169
- package/node_modules/@sema/gerador-dotnet/package.json +1 -1
- package/node_modules/@sema/gerador-html/dist/index.js +17 -17
- package/node_modules/@sema/gerador-lua/dist/index.js +76 -47
- package/node_modules/@sema/gerador-lua/dist/index.js.map +1 -1
- package/node_modules/@sema/gerador-php/dist/index.js +113 -113
- package/node_modules/@sema/gerador-python/dist/index.part02.js +3 -3
- package/node_modules/@sema/gerador-typescript/dist/index.part02.js +11 -11
- package/node_modules/@sema/nucleo/dist/diagnosticos/melhorador.js +42 -42
- package/package.json +3 -3
package/dist/agentEntryPoints.js
CHANGED
|
@@ -140,162 +140,163 @@ export function renderizarSemaBoot(agentContextPack) {
|
|
|
140
140
|
const politicaTimeout = agentContextPack.politicaTimeoutResumo;
|
|
141
141
|
const politicaDesign = agentContextPack.politicaDesignVisual;
|
|
142
142
|
const politicaPlataforma = agentContextPack.politicaPlataforma;
|
|
143
|
-
return `# SEMA_BOOT
|
|
144
|
-
|
|
145
|
-
Você está em um projeto governado por Sema. O contrato semântico vem antes de qualquer ação.
|
|
146
|
-
|
|
147
|
-
## Primeira ação
|
|
148
|
-
|
|
149
|
-
1. Confirme \`AGENTS.md\` na raiz e rode \`sema --version\`; se o comando não existir, pare e peça a instalação da CLI.
|
|
150
|
-
2. Use a CLI local diretamente para ler o workspace: \`sema resumo\`, \`sema docs-impacto\`, \`sema inspecionar\`, \`sema drift\` e \`sema impacto\`.
|
|
151
|
-
3.
|
|
152
|
-
4.
|
|
153
|
-
5.
|
|
154
|
-
6. Antes de
|
|
155
|
-
7. Antes de
|
|
156
|
-
8.
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
-
|
|
166
|
-
-
|
|
167
|
-
- IA
|
|
168
|
-
- IA
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
-
|
|
174
|
-
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
-
|
|
182
|
-
- Orçamento de
|
|
183
|
-
-
|
|
184
|
-
-
|
|
185
|
-
-
|
|
186
|
-
-
|
|
187
|
-
-
|
|
188
|
-
-
|
|
189
|
-
- IA
|
|
190
|
-
- IA
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
-
|
|
198
|
-
-
|
|
199
|
-
-
|
|
200
|
-
-
|
|
201
|
-
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
-
|
|
209
|
-
- IA
|
|
210
|
-
- IA
|
|
211
|
-
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
-
|
|
219
|
-
-
|
|
220
|
-
- IA
|
|
221
|
-
- IA
|
|
222
|
-
- ${politicaTimeout.
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
-
|
|
230
|
-
-
|
|
231
|
-
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
143
|
+
return `# SEMA_BOOT
|
|
144
|
+
|
|
145
|
+
Você está em um projeto governado por Sema. O contrato semântico vem antes de qualquer ação.
|
|
146
|
+
|
|
147
|
+
## Primeira ação
|
|
148
|
+
|
|
149
|
+
1. Confirme \`AGENTS.md\` na raiz e rode \`sema --version\`; se o comando não existir, pare e peça a instalação da CLI.
|
|
150
|
+
2. Use a CLI local diretamente para ler o workspace: \`sema resumo\`, \`sema docs-impacto\`, \`sema inspecionar\`, \`sema drift\` e \`sema impacto\`.
|
|
151
|
+
3. Se não estiver claro qual profile, workflow, pipeline, gerador ou adapter usar, rode \`sema descobrir recomendar --intencao "<objetivo>" --json\`; não execute automaticamente uma recomendação ambígua.
|
|
152
|
+
4. Não use fonte externa de workspace para substituir a CLI local quando ela estiver operacional.
|
|
153
|
+
5. Este boot é para workspace local em disco; se não houver workspace local, pare bloqueado em vez de inventar caminho.
|
|
154
|
+
6. Antes de criar módulo, rota, task ou contrato, inspecione o contrato \`.sema\` aplicável.
|
|
155
|
+
7. Antes de editar código existente, rode drift e impacto pela CLI local.
|
|
156
|
+
8. Antes de criar ou corrigir \`.sema\`, use os exemplos oficiais na CLI local.
|
|
157
|
+
9. Se qualquer etapa falhar, pare e diga que está bloqueado.
|
|
158
|
+
|
|
159
|
+
Não substitua esse fluxo por leitura manual de \`AGENTS.md\`, \`README.md\`, busca local, inferência pelo nome do projeto, bom senso ou ferramenta não citada aqui.
|
|
160
|
+
|
|
161
|
+
## Políticas da plataforma
|
|
162
|
+
|
|
163
|
+
${politicaPlataforma.regra}
|
|
164
|
+
|
|
165
|
+
- Escopo: ${politicaPlataforma.escopoGovernanca}
|
|
166
|
+
- Se houver alerta externo: ${politicaPlataforma.quandoHouverBloqueio}
|
|
167
|
+
- IA fraca: ${politicaPlataforma.porCapacidade.fraca}
|
|
168
|
+
- IA média: ${politicaPlataforma.porCapacidade.media}
|
|
169
|
+
- IA forte: ${politicaPlataforma.porCapacidade.forte}
|
|
170
|
+
|
|
171
|
+
## Capacidade do agente
|
|
172
|
+
|
|
173
|
+
- Fraca: leia \`${ARQUIVO_SEMA_SMALL_MODEL}\`, \`SEMA_BRIEF.micro.txt\`, \`${ARQUIVO_AGENT_CONTEXT_PACK}\` e só suba contexto se necessário.
|
|
174
|
+
- Média: leia este boot, \`${ARQUIVO_AGENT_CONTEXT_PACK}\`, \`SEMA_BRIEF.curto.txt\`, \`SEMA_INDEX.json\` e a doc indicada pelo Sema.
|
|
175
|
+
- Forte: leia este boot, \`${ARQUIVO_AGENT_CONTEXT_PACK}\`, \`SEMA_BRIEF.md\`, \`SEMA_INDEX.json\`, \`AGENTS.md\` e rode os gates completos.
|
|
176
|
+
|
|
177
|
+
## Código governado
|
|
178
|
+
|
|
179
|
+
${politicaCodigo.regra}
|
|
180
|
+
|
|
181
|
+
- Marcador: \`${politicaCodigo.marcador}\`.
|
|
182
|
+
- Orçamento de código: arquivo governado acima de ${LIMITE_AVISO_LINHAS_CODIGO_GOVERNADO} linhas gera diagnóstico; acima de ${LIMITE_BLOQUEIO_LINHAS_CODIGO_GOVERNADO} bloqueia conclusão, geração e snapshot. Documentação Markdown não entra nesse limite de código.
|
|
183
|
+
- Orçamento de contrato .sema: até ${LIMITE_AVISO_LINHAS_CONTRATO_SEMA} linhas é saudável; ${LIMITE_AVISO_LINHAS_CONTRATO_SEMA + 1}-${LIMITE_BLOQUEIO_LINHAS_CONTRATO_SEMA} é diagnóstico; acima de ${LIMITE_BLOQUEIO_LINHAS_CONTRATO_SEMA} bloqueia criação, edição, drift, finalização, geração e snapshot.
|
|
184
|
+
- Divida .sema por domínio/capacidade, nunca parte_1/parte_2. Um mesmo arquivo de código pode ter vários contratos governando via vinculos; preserve essa rastreabilidade no Sema Código.
|
|
185
|
+
- Payload inline: acima de ${LIMITE_CARACTERES_PAYLOAD_INLINE} caracteres em \`arquivos_codigo.conteudo\` ou \`conteudo\` não é timeout; divida por responsabilidade ou use anexo/caminho de servidor autorizado.
|
|
186
|
+
- Validação inline com score alto não substitui cabeçalho no arquivo físico: ela prova o payload enviado, não prepara a próxima IA que vai abrir o arquivo depois.
|
|
187
|
+
- Divisão correta é por responsabilidade real. Exemplo web: \`index.html\` para estrutura, \`styles/*.css\` para estilos, \`js/state.js\`, \`js/calc.js\`, \`js/render/*.js\` para comportamento, e \`data/*.json\` para dados.
|
|
188
|
+
- Proibido fatiar arquivo em \`index_p1.html\`, \`index_p2.html\` ou similares sem fronteira semântica só para passar no limite.
|
|
189
|
+
- IA fraca: ${politicaCodigo.porCapacidade.fraca}
|
|
190
|
+
- IA média: ${politicaCodigo.porCapacidade.media}
|
|
191
|
+
- IA forte: ${politicaCodigo.porCapacidade.forte}
|
|
192
|
+
|
|
193
|
+
## Sinal, evidência e ritual
|
|
194
|
+
|
|
195
|
+
Score composto, \`achados[]\` e \`decisaoAgente\` são sinais para guiar a próxima ação. Abaixo de 80 bloqueia; alvo evolui 0.5 ponto até 100; nada disso basta sozinho.
|
|
196
|
+
|
|
197
|
+
- Fraca: se o score passou, confira se cada achado tem evidência concreta; se não souber provar, pare.
|
|
198
|
+
- Média: conecte regra, arquivo, contrato e evidência antes de concluir aderência.
|
|
199
|
+
- Forte: não transforme regex, palavra-chave ou score 100 em ritual vazio; valide substância, risco e comportamento.
|
|
200
|
+
- Fechamento governado: se \`sema drift --json\` retornar \`sucesso:false\`, \`vinculos_quebrados\`, \`rotas_divergentes\` ou impls quebradas, não diga que passou limpo. Corrija e rode drift de novo.
|
|
201
|
+
- Experiência governada: se a tarefa cria ou altera site, sistema, app, UI, painel, jogo, CLI/TUI ou terminal, prove acabamento moderno, contextual e não genérico. Em UI estreita (ex. 390px), \`document.documentElement.scrollWidth <= document.documentElement.clientWidth\` precisa ser verdadeiro.
|
|
202
|
+
- Caminho fora do workspace local aberto pelo usuário não substitui a pasta local.
|
|
203
|
+
|
|
204
|
+
## Acabamento visual e terminal
|
|
205
|
+
|
|
206
|
+
${politicaDesign.regra}
|
|
207
|
+
|
|
208
|
+
- Aplicar quando: ${politicaDesign.aplicarQuando}
|
|
209
|
+
- IA fraca: ${politicaDesign.porCapacidade.fraca}
|
|
210
|
+
- IA média: ${politicaDesign.porCapacidade.media}
|
|
211
|
+
- IA forte: ${politicaDesign.porCapacidade.forte}
|
|
212
|
+
- Proibido: ${politicaDesign.proibicoes.slice(0, 5).join(", ")}.
|
|
213
|
+
|
|
214
|
+
## Timeout e retry
|
|
215
|
+
|
|
216
|
+
${politicaTimeout.regra}
|
|
217
|
+
|
|
218
|
+
- Timeout inicial recomendado para projeto inteiro: ${politicaTimeout.timeoutInicialSegundos}s.
|
|
219
|
+
- Escalonamento: ${politicaTimeout.escalonamentoSegundos.map((segundos) => `${segundos}s`).join(" -> ")}.
|
|
220
|
+
- IA fraca: ${politicaTimeout.porCapacidade.fraca}
|
|
221
|
+
- IA média: ${politicaTimeout.porCapacidade.media}
|
|
222
|
+
- IA forte: ${politicaTimeout.porCapacidade.forte}
|
|
223
|
+
- ${politicaTimeout.ateQuandoTentar}
|
|
224
|
+
|
|
225
|
+
## Idioma humano
|
|
226
|
+
|
|
227
|
+
${politica.regra}
|
|
228
|
+
|
|
229
|
+
- Use o idioma falado pelo usuário.
|
|
230
|
+
- Em PT-BR, escreva com acentos, cedilha e pontuação normal.
|
|
231
|
+
- Use vocabulário Sema canônico para conceitos de produto: pontuação, desvio semântico, trava, pré-checagem, ambiente de execução e perfil.
|
|
232
|
+
- Não traduza comandos, rotas, nomes de arquivos, endpoints, variáveis, pacotes, marcas, símbolos de código nem palavras-chave da DSL.
|
|
233
|
+
|
|
234
|
+
## Falha fechada
|
|
235
|
+
|
|
236
|
+
${agentContextPack.failClosed.map((regra) => `- ${regra}`).join("\n")}
|
|
236
237
|
`;
|
|
237
238
|
}
|
|
238
239
|
export function renderizarSemaSmallModel(agentContextPack) {
|
|
239
240
|
const politicaTimeout = agentContextPack.politicaTimeoutResumo;
|
|
240
241
|
const politicaDesign = agentContextPack.politicaDesignVisual;
|
|
241
242
|
const politicaPlataforma = agentContextPack.politicaPlataforma;
|
|
242
|
-
return `# SEMA_SMALL_MODEL
|
|
243
|
-
|
|
244
|
-
Leia isto primeiro se você tem pouco contexto, pouca memória, pouco tool use ou tendência a ignorar instruções longas.
|
|
245
|
-
|
|
246
|
-
1. Não edite nada antes de chamar Sema.
|
|
247
|
-
2. Em workspace local, rode \`sema --version\`; se falhar, pare e peça a instalação da CLI. Com a CLI disponível, opere diretamente sobre a pasta local e não use espelho externo.
|
|
248
|
-
3. Sema não contorna políticas da plataforma: ele governa contrato, escopo, drift, evidência e qualidade.
|
|
249
|
-
4. Se aparecer alerta de política: pare, explique de forma neutra e não tente burlar filtro.
|
|
250
|
-
5. Se não houver workspace local em disco: pare bloqueado e peça o fluxo apropriado; não invente leitura por caminho.
|
|
251
|
-
6. Se for escrever \`.sema\`: leia \`exemplos/\`; se a pasta estiver ausente, rode \`sema instalar-exemplos --json\` antes.
|
|
252
|
-
7. Se não houver contrato ou vínculo semântico do arquivo: inspecione o arquivo, crie ou edite o contrato aplicável e vincule antes do código.
|
|
253
|
-
8. Se não conseguir chamar Sema: pare e declare bloqueio.
|
|
254
|
-
9. Responda no idioma do usuário. Em PT-BR, use vocabulário Sema: pontuação, desvio semântico, pré-checagem, ambiente de execução e perfil; preserve comandos, endpoints e identificadores.
|
|
255
|
-
10. Se abrir código com \`${agentContextPack.politicaCodigoGovernado.marcador}\`: volte ao contrato, chame Sema e só então edite.
|
|
256
|
-
11. Score 100, achados atendidos ou validação inline são sinais; confira evidência real no contrato e no código.
|
|
257
|
-
12. Validação inline não dispensa cabeçalho \`${agentContextPack.politicaCodigoGovernado.marcador}\` no arquivo físico.
|
|
258
|
-
13. Não crie código governado acima de ${LIMITE_BLOQUEIO_LINHAS_CODIGO_GOVERNADO} linhas nem contrato .sema acima de ${LIMITE_BLOQUEIO_LINHAS_CONTRATO_SEMA}; acima de ${LIMITE_AVISO_LINHAS_CODIGO_GOVERNADO} em código ou ${LIMITE_AVISO_LINHAS_CONTRATO_SEMA} em .sema, planeje divisão por responsabilidade.
|
|
259
|
-
14. Divida por função real: HTML, CSS, estado, cálculo, renderização, dados. Não faça \`index_p1.html\` e \`index_p2.html\` sem sentido.
|
|
260
|
-
15. Payload inline acima de ${LIMITE_CARACTERES_PAYLOAD_INLINE} caracteres não é lentidão: divida por responsabilidade; não aumente timeout para tentar passar limite de transporte.
|
|
261
|
-
16. Se aparecer caminho que não pertence ao workspace local aberto pelo usuário, pare e confirme a fonte antes de agir.
|
|
262
|
-
17. Se Sema estourar por timeout local: aumente o timeout e tente de novo. Não trate isso como falha do Sema.
|
|
263
|
-
18. Se \`sema drift --json\` retornar \`sucesso:false\`, \`vinculos_quebrados\`, \`rotas_divergentes\` ou impl quebrada, não conclua. Corrija contrato/código e rode drift de novo.
|
|
264
|
-
19. Se a tarefa tiver site, sistema, app, UI, painel, jogo, CLI/TUI ou terminal: aplique acabamento moderno, contextual, responsivo/ergonômico, com hierarquia clara, estados e evidência. Em UI, valide mobile/desktop e prove \`scrollWidth <= clientWidth\` em viewport estreito como 390px.
|
|
265
|
-
20. Não substitua o contexto Sema por AGENTS.md, README.md, busca local, inferência por nome ou bom senso.
|
|
266
|
-
|
|
267
|
-
Ordem curta:
|
|
268
|
-
|
|
269
|
-
- \`${ARQUIVO_SEMA_BOOT}\`
|
|
270
|
-
- \`SEMA_BRIEF.micro.txt\`
|
|
271
|
-
- \`${ARQUIVO_AGENT_CONTEXT_PACK}\`
|
|
272
|
-
- \`SEMA_INDEX.json\`
|
|
273
|
-
- \`AGENTS.md\`
|
|
274
|
-
|
|
275
|
-
Políticas da plataforma:
|
|
276
|
-
|
|
277
|
-
- ${politicaPlataforma.regra}
|
|
278
|
-
- IA fraca: ${politicaPlataforma.porCapacidade.fraca}
|
|
279
|
-
- Se houver bloqueio externo: ${politicaPlataforma.quandoHouverBloqueio}
|
|
280
|
-
|
|
281
|
-
Timeout:
|
|
282
|
-
|
|
283
|
-
- Timeout local do agente não é falha do Sema.
|
|
284
|
-
- Projeto inteiro: comece com ${politicaTimeout.timeoutInicialSegundos}s ou mais.
|
|
285
|
-
- Escalonamento: ${politicaTimeout.escalonamentoSegundos.map((segundos) => `${segundos}s`).join(" -> ")}.
|
|
286
|
-
- Se o projeto inteiro for lento, escopar para \`sema resumo <arquivo.sema> --micro --para mudanca\`.
|
|
287
|
-
- ${politicaTimeout.ateQuandoTentar}
|
|
288
|
-
|
|
289
|
-
Acabamento visual e terminal:
|
|
290
|
-
|
|
291
|
-
- ${politicaDesign.regra}
|
|
292
|
-
- IA fraca: ${politicaDesign.porCapacidade.fraca}
|
|
293
|
-
- Evidência mínima: ${politicaDesign.evidencias.fraca.join(", ")}.
|
|
294
|
-
- Proibido: ${politicaDesign.proibicoes.slice(0, 5).join(", ")}.
|
|
295
|
-
|
|
296
|
-
Fail-closed:
|
|
297
|
-
|
|
298
|
-
${agentContextPack.failClosed.map((regra) => `- ${regra}`).join("\n")}
|
|
243
|
+
return `# SEMA_SMALL_MODEL
|
|
244
|
+
|
|
245
|
+
Leia isto primeiro se você tem pouco contexto, pouca memória, pouco tool use ou tendência a ignorar instruções longas.
|
|
246
|
+
|
|
247
|
+
1. Não edite nada antes de chamar Sema.
|
|
248
|
+
2. Em workspace local, rode \`sema --version\`; se falhar, pare e peça a instalação da CLI. Com a CLI disponível, opere diretamente sobre a pasta local e não use espelho externo.
|
|
249
|
+
3. Sema não contorna políticas da plataforma: ele governa contrato, escopo, drift, evidência e qualidade.
|
|
250
|
+
4. Se aparecer alerta de política: pare, explique de forma neutra e não tente burlar filtro.
|
|
251
|
+
5. Se não houver workspace local em disco: pare bloqueado e peça o fluxo apropriado; não invente leitura por caminho.
|
|
252
|
+
6. Se for escrever \`.sema\`: leia \`exemplos/\`; se a pasta estiver ausente, rode \`sema instalar-exemplos --json\` antes.
|
|
253
|
+
7. Se não houver contrato ou vínculo semântico do arquivo: inspecione o arquivo, crie ou edite o contrato aplicável e vincule antes do código.
|
|
254
|
+
8. Se não conseguir chamar Sema: pare e declare bloqueio.
|
|
255
|
+
9. Responda no idioma do usuário. Em PT-BR, use vocabulário Sema: pontuação, desvio semântico, pré-checagem, ambiente de execução e perfil; preserve comandos, endpoints e identificadores.
|
|
256
|
+
10. Se abrir código com \`${agentContextPack.politicaCodigoGovernado.marcador}\`: volte ao contrato, chame Sema e só então edite.
|
|
257
|
+
11. Score 100, achados atendidos ou validação inline são sinais; confira evidência real no contrato e no código.
|
|
258
|
+
12. Validação inline não dispensa cabeçalho \`${agentContextPack.politicaCodigoGovernado.marcador}\` no arquivo físico.
|
|
259
|
+
13. Não crie código governado acima de ${LIMITE_BLOQUEIO_LINHAS_CODIGO_GOVERNADO} linhas nem contrato .sema acima de ${LIMITE_BLOQUEIO_LINHAS_CONTRATO_SEMA}; acima de ${LIMITE_AVISO_LINHAS_CODIGO_GOVERNADO} em código ou ${LIMITE_AVISO_LINHAS_CONTRATO_SEMA} em .sema, planeje divisão por responsabilidade.
|
|
260
|
+
14. Divida por função real: HTML, CSS, estado, cálculo, renderização, dados. Não faça \`index_p1.html\` e \`index_p2.html\` sem sentido.
|
|
261
|
+
15. Payload inline acima de ${LIMITE_CARACTERES_PAYLOAD_INLINE} caracteres não é lentidão: divida por responsabilidade; não aumente timeout para tentar passar limite de transporte.
|
|
262
|
+
16. Se aparecer caminho que não pertence ao workspace local aberto pelo usuário, pare e confirme a fonte antes de agir.
|
|
263
|
+
17. Se Sema estourar por timeout local: aumente o timeout e tente de novo. Não trate isso como falha do Sema.
|
|
264
|
+
18. Se \`sema drift --json\` retornar \`sucesso:false\`, \`vinculos_quebrados\`, \`rotas_divergentes\` ou impl quebrada, não conclua. Corrija contrato/código e rode drift de novo.
|
|
265
|
+
19. Se a tarefa tiver site, sistema, app, UI, painel, jogo, CLI/TUI ou terminal: aplique acabamento moderno, contextual, responsivo/ergonômico, com hierarquia clara, estados e evidência. Em UI, valide mobile/desktop e prove \`scrollWidth <= clientWidth\` em viewport estreito como 390px.
|
|
266
|
+
20. Não substitua o contexto Sema por AGENTS.md, README.md, busca local, inferência por nome ou bom senso.
|
|
267
|
+
|
|
268
|
+
Ordem curta:
|
|
269
|
+
|
|
270
|
+
- \`${ARQUIVO_SEMA_BOOT}\`
|
|
271
|
+
- \`SEMA_BRIEF.micro.txt\`
|
|
272
|
+
- \`${ARQUIVO_AGENT_CONTEXT_PACK}\`
|
|
273
|
+
- \`SEMA_INDEX.json\`
|
|
274
|
+
- \`AGENTS.md\`
|
|
275
|
+
|
|
276
|
+
Políticas da plataforma:
|
|
277
|
+
|
|
278
|
+
- ${politicaPlataforma.regra}
|
|
279
|
+
- IA fraca: ${politicaPlataforma.porCapacidade.fraca}
|
|
280
|
+
- Se houver bloqueio externo: ${politicaPlataforma.quandoHouverBloqueio}
|
|
281
|
+
|
|
282
|
+
Timeout:
|
|
283
|
+
|
|
284
|
+
- Timeout local do agente não é falha do Sema.
|
|
285
|
+
- Projeto inteiro: comece com ${politicaTimeout.timeoutInicialSegundos}s ou mais.
|
|
286
|
+
- Escalonamento: ${politicaTimeout.escalonamentoSegundos.map((segundos) => `${segundos}s`).join(" -> ")}.
|
|
287
|
+
- Se o projeto inteiro for lento, escopar para \`sema resumo <arquivo.sema> --micro --para mudanca\`.
|
|
288
|
+
- ${politicaTimeout.ateQuandoTentar}
|
|
289
|
+
|
|
290
|
+
Acabamento visual e terminal:
|
|
291
|
+
|
|
292
|
+
- ${politicaDesign.regra}
|
|
293
|
+
- IA fraca: ${politicaDesign.porCapacidade.fraca}
|
|
294
|
+
- Evidência mínima: ${politicaDesign.evidencias.fraca.join(", ")}.
|
|
295
|
+
- Proibido: ${politicaDesign.proibicoes.slice(0, 5).join(", ")}.
|
|
296
|
+
|
|
297
|
+
Fail-closed:
|
|
298
|
+
|
|
299
|
+
${agentContextPack.failClosed.map((regra) => `- ${regra}`).join("\n")}
|
|
299
300
|
`;
|
|
300
301
|
}
|
|
301
302
|
export function renderizarDocumentoAgentesPorCapacidade(agentContextPack) {
|
|
@@ -418,367 +419,418 @@ function renderizarInstrucaoCodexSema(agentContextPack) {
|
|
|
418
419
|
const politicaTimeout = agentContextPack.politicaTimeoutResumo;
|
|
419
420
|
const politicaDesign = agentContextPack.politicaDesignVisual;
|
|
420
421
|
const politicaPlataforma = agentContextPack.politicaPlataforma;
|
|
421
|
-
return `# Sema para Codex
|
|
422
|
-
|
|
423
|
-
Este workspace é governado por Sema. Antes de qualquer ação em código, contrato, documentação operacional, workflow, profile ou deploy:
|
|
424
|
-
|
|
425
|
-
1. Leia \`${ARQUIVO_SEMA_BOOT}\`.
|
|
426
|
-
2. Rode \`sema --version\`; se falhar, pare e peça a instalação da CLI.
|
|
427
|
-
3. Use diretamente a CLI local: \`sema resumo\`, \`sema docs-impacto\`, \`sema inspecionar\`, \`sema drift\` e \`sema impacto\`.
|
|
428
|
-
4.
|
|
429
|
-
5.
|
|
430
|
-
6. Chame
|
|
431
|
-
7.
|
|
432
|
-
8. Antes de
|
|
433
|
-
9.
|
|
434
|
-
10.
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
-
|
|
445
|
-
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
-
|
|
453
|
-
-
|
|
454
|
-
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
-
|
|
459
|
-
-
|
|
460
|
-
-
|
|
461
|
-
-
|
|
462
|
-
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
-
|
|
467
|
-
-
|
|
468
|
-
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
-
|
|
473
|
-
-
|
|
474
|
-
-
|
|
475
|
-
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
-
|
|
480
|
-
-
|
|
481
|
-
-
|
|
422
|
+
return `# Sema para Codex
|
|
423
|
+
|
|
424
|
+
Este workspace é governado por Sema. Antes de qualquer ação em código, contrato, documentação operacional, workflow, profile ou deploy:
|
|
425
|
+
|
|
426
|
+
1. Leia \`${ARQUIVO_SEMA_BOOT}\`.
|
|
427
|
+
2. Rode \`sema --version\`; se falhar, pare e peça a instalação da CLI.
|
|
428
|
+
3. Use diretamente a CLI local: \`sema resumo\`, \`sema docs-impacto\`, \`sema inspecionar\`, \`sema drift\` e \`sema impacto\`.
|
|
429
|
+
4. Quando a capacidade correta não estiver clara, use \`sema descobrir recomendar --intencao "<objetivo>" --json\`; não autoexecute resultado ambíguo.
|
|
430
|
+
5. Não use fonte externa de workspace para substituir a CLI local quando ela estiver operacional.
|
|
431
|
+
6. Chame docs-impacto com a intenção declarada antes de agir.
|
|
432
|
+
7. Chame inspecionar no contrato \`.sema\` aplicável.
|
|
433
|
+
8. Antes de editar código existente, rode drift e impacto.
|
|
434
|
+
9. Antes de criar ou editar \`.sema\`, use exemplos oficiais.
|
|
435
|
+
10. Ao concluir mudança de contrato, rode validar.
|
|
436
|
+
11. Antes de finalizar, use finalizar-mudanca com as docs lidas.
|
|
437
|
+
|
|
438
|
+
É proibido substituir esse fluxo por leitura manual de \`AGENTS.md\`, \`README.md\`, busca local por arquivos, inferência pelo nome do projeto, bom senso ou ferramenta não citada nesta lista.
|
|
439
|
+
|
|
440
|
+
Entrypoint oficial do Codex: \`${agentContextPack.entrypointCodex}\`.
|
|
441
|
+
Capacidade padrão do Codex: ${capacidade}.
|
|
442
|
+
Ordem de leitura: ${guia.join(" -> ")}.
|
|
443
|
+
|
|
444
|
+
Políticas da plataforma:
|
|
445
|
+
- ${politicaPlataforma.regra}
|
|
446
|
+
- Capacidade ${capacidade}: ${politicaPlataforma.porCapacidade[capacidade]}
|
|
447
|
+
- Se houver alerta externo: ${politicaPlataforma.quandoHouverBloqueio}
|
|
448
|
+
|
|
449
|
+
Falha fechada:
|
|
450
|
+
${agentContextPack.failClosed.map((regra) => `- ${regra}`).join("\n")}
|
|
451
|
+
|
|
452
|
+
Timeout:
|
|
453
|
+
- Timeout local do agente não é falha do Sema.
|
|
454
|
+
- Se uma chamada Sema estourar, aumente o timeout e tente de novo antes de declarar bloqueio.
|
|
455
|
+
- Para projeto inteiro, comece com ${politicaTimeout.timeoutInicialSegundos}s ou mais; se for lento, escale ${politicaTimeout.escalonamentoSegundos.map((segundos) => `${segundos}s`).join(" -> ")}.
|
|
456
|
+
- Se possível, reduza escopo para \`sema resumo <arquivo.sema> --micro --para mudanca\`.
|
|
457
|
+
|
|
458
|
+
Código governado:
|
|
459
|
+
- Mantenha o marcador \`${agentContextPack.politicaCodigoGovernado.marcador}\` em código gerado ou governado.
|
|
460
|
+
- Ao encontrar esse marcador, volte ao contrato .sema aplicável e chame Sema antes de editar.
|
|
461
|
+
- Comentário de código é lembrete curto; não substitui drift, docs-impacto nem finalizar-mudanca.
|
|
462
|
+
- Validação inline prova o payload enviado; não dispensa o marcador no arquivo físico sincronizado.
|
|
463
|
+
- Payload inline acima de ${LIMITE_CARACTERES_PAYLOAD_INLINE} caracteres não deve virar retry de timeout: modularize por responsabilidade ou use anexo/caminho de servidor autorizado.
|
|
464
|
+
- Se um arquivo crescer, divida por responsabilidade real. Em web: \`index.html\`, \`styles/*.css\`, \`js/state.js\`, \`js/calc.js\`, \`js/render/*.js\`, \`data/*.json\`. Não fatie em p1/p2 sem fronteira semântica.
|
|
465
|
+
|
|
466
|
+
Sinal e evidência:
|
|
467
|
+
- Score composto, \`achados[]\` e \`decisaoAgente\` orientam a ação; abaixo de 80 bloqueia, alvo evolui 0.5 ponto até 100, e nada substitui evidência concreta.
|
|
468
|
+
- Palavra-chave ou regex passando não prova governança se contrato, código e comportamento não batem.
|
|
469
|
+
- \`sema drift --json\` com \`sucesso:false\`, \`vinculos_quebrados\`, \`rotas_divergentes\` ou impls quebradas bloqueia fechamento. Não diga "drift limpo" até rodar de novo e ficar verde.
|
|
470
|
+
- Caminho fora do workspace local aberto pelo usuário não substitui a pasta local.
|
|
471
|
+
|
|
472
|
+
Acabamento visual e terminal:
|
|
473
|
+
- Se houver site, sistema, app, UI, painel, jogo, CLI/TUI ou terminal, acabamento moderno, contextual e não genérico é requisito governado, não enfeite.
|
|
474
|
+
- Capacidade ${capacidade}: ${politicaDesign.porCapacidade[capacidade]}
|
|
475
|
+
- Evidências: ${politicaDesign.evidencias[capacidade].join(", ")}.
|
|
476
|
+
- Responsividade/ergonomia real: valide desktop/mobile e, em viewport estreito como 390px, confirme \`document.documentElement.scrollWidth <= document.documentElement.clientWidth\`; em terminal/CLI/TUI, rode smoke check de saída, erro e ajuda quando aplicável.
|
|
477
|
+
- Proibido: ${politicaDesign.proibicoes.slice(0, 5).join(", ")}.
|
|
478
|
+
|
|
479
|
+
Idioma:
|
|
480
|
+
- Responda no idioma do usuário.
|
|
481
|
+
- Em PT-BR, use vocabulário Sema canônico, acentos, cedilha, pontuação e símbolos normais.
|
|
482
|
+
- A DSL \`.sema\` pode ser ASCII; texto humano não precisa ser.
|
|
483
|
+
- Não traduza comandos, rotas, arquivos, endpoints, variáveis, pacotes, marcas, símbolos de código nem palavras-chave da DSL.
|
|
482
484
|
`;
|
|
483
485
|
}
|
|
484
486
|
function renderizarDocSintaxeSemaLocal(_agentContextPack) {
|
|
485
|
-
return `# Sema Syntax for Codex
|
|
486
|
-
|
|
487
|
-
Use this file as a compact reference before creating or fixing \`.sema\` contracts.
|
|
488
|
-
|
|
489
|
-
## Golden Rule
|
|
490
|
-
|
|
491
|
-
Contract comes before code. Before writing \`.sema\`, read the local examples in \`exemplos/\`.
|
|
492
|
-
|
|
493
|
-
## Minimal Example
|
|
494
|
-
|
|
495
|
-
\`\`\`sema
|
|
496
|
-
module app.example {
|
|
497
|
-
entity Item {
|
|
498
|
-
fields {
|
|
499
|
-
id: Id
|
|
500
|
-
name: Texto
|
|
501
|
-
active: Booleano
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
task create_item {
|
|
506
|
-
input {
|
|
507
|
-
name: Texto required
|
|
508
|
-
}
|
|
509
|
-
output {
|
|
510
|
-
item: Item
|
|
511
|
-
}
|
|
512
|
-
rules {
|
|
513
|
-
name deve_ser preenchido
|
|
514
|
-
}
|
|
515
|
-
effects {
|
|
516
|
-
persistencia Item
|
|
517
|
-
auditoria item_created
|
|
518
|
-
}
|
|
519
|
-
guarantees {
|
|
520
|
-
item existe
|
|
521
|
-
}
|
|
522
|
-
tests {
|
|
523
|
-
caso "creates valid item" {
|
|
524
|
-
given { name: "Item" }
|
|
525
|
-
expect { sucesso: verdadeiro }
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
\`\`\`
|
|
531
|
-
|
|
532
|
-
## Common Blocks
|
|
533
|
-
|
|
534
|
-
- \`docs\`: module summary and notes.
|
|
535
|
-
- \`entity\`: domain model.
|
|
536
|
-
- \`task\`: governed operation.
|
|
537
|
-
- \`input\` and \`output\`: input and output contracts.
|
|
538
|
-
- \`rules\`: validations and business rules.
|
|
539
|
-
- \`effects\`: persistence, reads, events, audit, and external calls.
|
|
540
|
-
- \`guarantees\`: what the task must provide after success.
|
|
541
|
-
- \`error\`: named errors and messages.
|
|
542
|
-
- \`tests\`: minimal behavior examples.
|
|
543
|
-
- \`route\`: public surface linked to a task.
|
|
544
|
-
- \`impl\` and \`vinculos\`: links between the contract and real code.
|
|
545
|
-
|
|
546
|
-
## Canonical \`use\` and \`impl\` Origins
|
|
547
|
-
|
|
548
|
-
Use these origins before inventing a new one:
|
|
549
|
-
|
|
550
|
-
- \`ts\` ou \`typescript\`
|
|
551
|
-
- \`js\` ou \`javascript\`
|
|
552
|
-
- \`py\` ou \`python\`
|
|
553
|
-
- \`dart\`
|
|
554
|
-
- \`lua\`
|
|
555
|
-
- \`cs\` ou \`dotnet\`
|
|
556
|
-
- \`java\`
|
|
557
|
-
- \`go\`
|
|
558
|
-
- \`rust\`
|
|
559
|
-
- \`cpp\`
|
|
560
|
-
|
|
561
|
-
Examples:
|
|
562
|
-
|
|
563
|
-
\`\`\`sema
|
|
564
|
-
use javascript app.web.expenses
|
|
565
|
-
|
|
566
|
-
impl {
|
|
567
|
-
js: src.app.saveExpense
|
|
568
|
-
}
|
|
569
|
-
\`\`\`
|
|
570
|
-
|
|
571
|
-
\`sema compilar --alvo javascript\` defines a generation target. \`impl { js: ... }\` defines the live-code origin linked to the contract. They are different layers and both are valid.
|
|
572
|
-
|
|
573
|
-
## Small Canonical Lists
|
|
574
|
-
|
|
575
|
-
- \`effects\`: \`persistencia\`, \`consulta\`, \`evento\`, \`auditoria\`, \`db.write\`, \`queue.publish\`, \`fs.write\`, \`network.egress\`, \`secret.read\`, \`shell.exec\`.
|
|
576
|
-
- \`audit.motivo\`: \`obrigatorio\`, \`opcional\`, \`dispensado\`.
|
|
577
|
-
|
|
578
|
-
## Contract Size
|
|
579
|
-
|
|
580
|
-
- up to ${LIMITE_AVISO_LINHAS_CONTRATO_SEMA} lines: healthy
|
|
581
|
-
- ${LIMITE_AVISO_LINHAS_CONTRATO_SEMA + 1}-${LIMITE_BLOQUEIO_LINHAS_CONTRATO_SEMA} lines: diagnostic warning, plan a split
|
|
582
|
-
- above ${LIMITE_BLOQUEIO_LINHAS_CONTRATO_SEMA}: blocks creation, edits, drift, finalization, generation, and snapshots
|
|
583
|
-
- split by real domain/capability, such as \`expenses_entry.sema\`, \`expenses_totals.sema\`, \`expenses_persistence.sema\`
|
|
584
|
-
- never use \`parte_1\`, \`parte_2\`, \`part_3\`, or equivalent names
|
|
585
|
-
- do not remove \`guarantees\`, \`tests\`, \`authz\`, \`dados\`, or \`vinculos\` just to fit under the limit
|
|
586
|
-
- multiple \`.sema\` contracts may govern the same code file through \`vinculos\`; this is expected
|
|
587
|
-
|
|
588
|
-
## JavaScript Is Supported
|
|
589
|
-
|
|
590
|
-
The CLI supports JavaScript generation:
|
|
591
|
-
|
|
592
|
-
\`\`\`bash
|
|
593
|
-
sema compilar contratos/orders.sema --alvo javascript --saida ./generated/javascript
|
|
594
|
-
\`\`\`
|
|
595
|
-
|
|
596
|
-
The project can also generate TypeScript, Python, PHP, Dart, Lua, HTML, CSS, C#/.NET (\`dotnet\`), and C++ (\`cpp\`) when those targets are enabled in \`sema.config.json\`.
|
|
597
|
-
|
|
598
|
-
## Support Files
|
|
599
|
-
|
|
600
|
-
- \`AGENTS.md\`: official Codex repository rules, loaded automatically.
|
|
601
|
-
- \`${ARQUIVO_SEMA_BOOT}\`: first Sema read for Codex.
|
|
602
|
-
- \`${ARQUIVO_SEMA_SMALL_MODEL}\`: compact guidance for a small context budget.
|
|
603
|
-
- \`${ARQUIVO_AGENT_CONTEXT_PACK}\`: structured Codex context pack.
|
|
604
|
-
- \`SEMA_INDEX.json\`: project index.
|
|
605
|
-
- \`docs/commands.md\`: command catalog, gates, and \`--saida\` rule.
|
|
606
|
-
- \`exemplos/\`: official DSL examples.
|
|
607
|
-
|
|
608
|
-
If Codex does not know which shape to use, it must open \`exemplos/calculadora.sema\`, \`exemplos/crud_simples.sema\`, \`exemplos/pagamento.sema\`, or \`exemplos/tratamento_erro.sema\` before inventing syntax.
|
|
609
|
-
|
|
610
|
-
Platform policy: Sema governs project contracts, scope, drift, evidence, and quality. It never bypasses platform policies, permissions, security controls, terms, or laws.
|
|
487
|
+
return `# Sema Syntax for Codex
|
|
488
|
+
|
|
489
|
+
Use this file as a compact reference before creating or fixing \`.sema\` contracts.
|
|
490
|
+
|
|
491
|
+
## Golden Rule
|
|
492
|
+
|
|
493
|
+
Contract comes before code. Before writing \`.sema\`, read the local examples in \`exemplos/\`.
|
|
494
|
+
|
|
495
|
+
## Minimal Example
|
|
496
|
+
|
|
497
|
+
\`\`\`sema
|
|
498
|
+
module app.example {
|
|
499
|
+
entity Item {
|
|
500
|
+
fields {
|
|
501
|
+
id: Id
|
|
502
|
+
name: Texto
|
|
503
|
+
active: Booleano
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
task create_item {
|
|
508
|
+
input {
|
|
509
|
+
name: Texto required
|
|
510
|
+
}
|
|
511
|
+
output {
|
|
512
|
+
item: Item
|
|
513
|
+
}
|
|
514
|
+
rules {
|
|
515
|
+
name deve_ser preenchido
|
|
516
|
+
}
|
|
517
|
+
effects {
|
|
518
|
+
persistencia Item
|
|
519
|
+
auditoria item_created
|
|
520
|
+
}
|
|
521
|
+
guarantees {
|
|
522
|
+
item existe
|
|
523
|
+
}
|
|
524
|
+
tests {
|
|
525
|
+
caso "creates valid item" {
|
|
526
|
+
given { name: "Item" }
|
|
527
|
+
expect { sucesso: verdadeiro }
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
\`\`\`
|
|
533
|
+
|
|
534
|
+
## Common Blocks
|
|
535
|
+
|
|
536
|
+
- \`docs\`: module summary and notes.
|
|
537
|
+
- \`entity\`: domain model.
|
|
538
|
+
- \`task\`: governed operation.
|
|
539
|
+
- \`input\` and \`output\`: input and output contracts.
|
|
540
|
+
- \`rules\`: validations and business rules.
|
|
541
|
+
- \`effects\`: persistence, reads, events, audit, and external calls.
|
|
542
|
+
- \`guarantees\`: what the task must provide after success.
|
|
543
|
+
- \`error\`: named errors and messages.
|
|
544
|
+
- \`tests\`: minimal behavior examples.
|
|
545
|
+
- \`route\`: public surface linked to a task.
|
|
546
|
+
- \`impl\` and \`vinculos\`: links between the contract and real code.
|
|
547
|
+
|
|
548
|
+
## Canonical \`use\` and \`impl\` Origins
|
|
549
|
+
|
|
550
|
+
Use these origins before inventing a new one:
|
|
551
|
+
|
|
552
|
+
- \`ts\` ou \`typescript\`
|
|
553
|
+
- \`js\` ou \`javascript\`
|
|
554
|
+
- \`py\` ou \`python\`
|
|
555
|
+
- \`dart\`
|
|
556
|
+
- \`lua\`
|
|
557
|
+
- \`cs\` ou \`dotnet\`
|
|
558
|
+
- \`java\`
|
|
559
|
+
- \`go\`
|
|
560
|
+
- \`rust\`
|
|
561
|
+
- \`cpp\`
|
|
562
|
+
|
|
563
|
+
Examples:
|
|
564
|
+
|
|
565
|
+
\`\`\`sema
|
|
566
|
+
use javascript app.web.expenses
|
|
567
|
+
|
|
568
|
+
impl {
|
|
569
|
+
js: src.app.saveExpense
|
|
570
|
+
}
|
|
571
|
+
\`\`\`
|
|
572
|
+
|
|
573
|
+
\`sema compilar --alvo javascript\` defines a generation target. \`impl { js: ... }\` defines the live-code origin linked to the contract. They are different layers and both are valid.
|
|
574
|
+
|
|
575
|
+
## Small Canonical Lists
|
|
576
|
+
|
|
577
|
+
- \`effects\`: \`persistencia\`, \`consulta\`, \`evento\`, \`auditoria\`, \`db.write\`, \`queue.publish\`, \`fs.write\`, \`network.egress\`, \`secret.read\`, \`shell.exec\`.
|
|
578
|
+
- \`audit.motivo\`: \`obrigatorio\`, \`opcional\`, \`dispensado\`.
|
|
579
|
+
|
|
580
|
+
## Contract Size
|
|
581
|
+
|
|
582
|
+
- up to ${LIMITE_AVISO_LINHAS_CONTRATO_SEMA} lines: healthy
|
|
583
|
+
- ${LIMITE_AVISO_LINHAS_CONTRATO_SEMA + 1}-${LIMITE_BLOQUEIO_LINHAS_CONTRATO_SEMA} lines: diagnostic warning, plan a split
|
|
584
|
+
- above ${LIMITE_BLOQUEIO_LINHAS_CONTRATO_SEMA}: blocks creation, edits, drift, finalization, generation, and snapshots
|
|
585
|
+
- split by real domain/capability, such as \`expenses_entry.sema\`, \`expenses_totals.sema\`, \`expenses_persistence.sema\`
|
|
586
|
+
- never use \`parte_1\`, \`parte_2\`, \`part_3\`, or equivalent names
|
|
587
|
+
- do not remove \`guarantees\`, \`tests\`, \`authz\`, \`dados\`, or \`vinculos\` just to fit under the limit
|
|
588
|
+
- multiple \`.sema\` contracts may govern the same code file through \`vinculos\`; this is expected
|
|
589
|
+
|
|
590
|
+
## JavaScript Is Supported
|
|
591
|
+
|
|
592
|
+
The CLI supports JavaScript generation:
|
|
593
|
+
|
|
594
|
+
\`\`\`bash
|
|
595
|
+
sema compilar contratos/orders.sema --alvo javascript --saida ./generated/javascript
|
|
596
|
+
\`\`\`
|
|
597
|
+
|
|
598
|
+
The project can also generate TypeScript, Python, PHP, Dart, Lua, HTML, CSS, C#/.NET (\`dotnet\`), and C++ (\`cpp\`) when those targets are enabled in \`sema.config.json\`.
|
|
599
|
+
|
|
600
|
+
## Support Files
|
|
601
|
+
|
|
602
|
+
- \`AGENTS.md\`: official Codex repository rules, loaded automatically.
|
|
603
|
+
- \`${ARQUIVO_SEMA_BOOT}\`: first Sema read for Codex.
|
|
604
|
+
- \`${ARQUIVO_SEMA_SMALL_MODEL}\`: compact guidance for a small context budget.
|
|
605
|
+
- \`${ARQUIVO_AGENT_CONTEXT_PACK}\`: structured Codex context pack.
|
|
606
|
+
- \`SEMA_INDEX.json\`: project index.
|
|
607
|
+
- \`docs/commands.md\`: command catalog, gates, and \`--saida\` rule.
|
|
608
|
+
- \`exemplos/\`: official DSL examples.
|
|
609
|
+
|
|
610
|
+
If Codex does not know which shape to use, it must open \`exemplos/calculadora.sema\`, \`exemplos/crud_simples.sema\`, \`exemplos/pagamento.sema\`, or \`exemplos/tratamento_erro.sema\` before inventing syntax.
|
|
611
|
+
|
|
612
|
+
Platform policy: Sema governs project contracts, scope, drift, evidence, and quality. It never bypasses platform policies, permissions, security controls, terms, or laws.
|
|
611
613
|
`;
|
|
612
614
|
}
|
|
613
615
|
function renderizarDocFluxoPraticoSemaLocal(_agentContextPack) {
|
|
614
|
-
return `# Practical Codex + Sema Workflow
|
|
615
|
-
|
|
616
|
-
This is the minimum workflow for Codex in a local workspace.
|
|
617
|
-
|
|
618
|
-
1. Read \`${ARQUIVO_SEMA_BOOT}\`.
|
|
619
|
-
2. Run \`sema --version\`. Success enables direct local execution; there is no login, license, token, billing, panel, or authorization gate.
|
|
620
|
-
3. Run \`sema resumo\`.
|
|
621
|
-
4. Run \`sema docs-impacto --intencao "<change>" --json\`.
|
|
622
|
-
5. Read every required document returned by the command.
|
|
623
|
-
6. Read \`docs/commands.md\` before selecting a command or interpreting \`--saida\`.
|
|
624
|
-
7.
|
|
625
|
-
8.
|
|
626
|
-
9. Run \`sema
|
|
627
|
-
10. Run \`sema
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
616
|
+
return `# Practical Codex + Sema Workflow
|
|
617
|
+
|
|
618
|
+
This is the minimum workflow for Codex in a local workspace.
|
|
619
|
+
|
|
620
|
+
1. Read \`${ARQUIVO_SEMA_BOOT}\`.
|
|
621
|
+
2. Run \`sema --version\`. Success enables direct local execution; there is no login, license, token, billing, panel, or authorization gate.
|
|
622
|
+
3. Run \`sema resumo\`.
|
|
623
|
+
4. Run \`sema docs-impacto --intencao "<change>" --json\`.
|
|
624
|
+
5. Read every required document returned by the command.
|
|
625
|
+
6. Read \`docs/commands.md\` before selecting a command or interpreting \`--saida\`.
|
|
626
|
+
7. If the right capability is unclear, run \`sema descobrir recomendar --intencao "<goal>" --json\`; do not auto-run ambiguous recommendations.
|
|
627
|
+
8. Use \`exemplos/\` and \`docs/syntax.md\` before creating or editing a contract.
|
|
628
|
+
9. Run \`sema drift\` and \`sema impacto\` before editing existing code.
|
|
629
|
+
10. Run \`sema formatar\` and \`sema validar\` after changing a \`.sema\` contract.
|
|
630
|
+
11. Run \`sema finalizar-mudanca\` with the documents read before closure.
|
|
631
|
+
|
|
632
|
+
Contract edit rule: \`.sema\` has its own size budget. Above ${LIMITE_AVISO_LINHAS_CONTRATO_SEMA} lines, plan a split by domain/capability; above ${LIMITE_BLOQUEIO_LINHAS_CONTRATO_SEMA}, do not create or edit before splitting. Do not use parte_1/parte_2 and do not force a 1:1 contract-to-file relationship; several contracts can govern the same file through \`vinculos\`.
|
|
633
|
+
|
|
634
|
+
Closing rule: \`sema drift --json\` must return \`sucesso:true\`. If it reports \`sucesso:false\`, \`vinculos_quebrados\`, \`rotas_divergentes\`, or broken impls, the task is still blocked. Passing unit tests do not replace green drift.
|
|
635
|
+
|
|
636
|
+
UI rule: if the task involves an interface, minimum evidence includes desktop and mobile. On a narrow viewport such as 390px, \`document.documentElement.scrollWidth <= document.documentElement.clientWidth\` must pass; horizontal scroll blocks closure.
|
|
637
|
+
|
|
638
|
+
Focused inspection rule: \`sema inspecionar <contrato.sema>\` and \`sema resumo <contrato.sema> --micro\` default to \`--drift none\`. They load the target plus its transitive \`use\` closure and must state that live code was not verified. Use \`--drift cache\`, \`--drift fresh\`, or \`--com-drift\` only when implementation evidence is required.
|
|
639
|
+
|
|
640
|
+
Drift scope rule: a file/module run plans its physical file set before cataloging and never falls back to a whole-project walk when no safe anchor exists. \`--cache auto\` reuses validated catalog, file, and semantic-group entries; \`--cache refresh\` recalculates them; \`--cache off\` disables persistent cache I/O. Inspect \`escopo_aplicado.catalogo\`, \`escopo_aplicado.cache.incremental\`, and \`escopo_aplicado.cache.fasesMs\` for the work actually performed.
|
|
641
|
+
|
|
642
|
+
## Codex Context Capacity
|
|
643
|
+
|
|
644
|
+
- Small context: \`${ARQUIVO_SEMA_SMALL_MODEL}\`, \`SEMA_BRIEF.micro.txt\`, \`${ARQUIVO_AGENT_CONTEXT_PACK}\`, \`SEMA_INDEX.json\`.
|
|
645
|
+
- Medium context: \`${ARQUIVO_SEMA_BOOT}\`, \`${ARQUIVO_AGENT_CONTEXT_PACK}\`, \`SEMA_BRIEF.curto.txt\`, \`SEMA_INDEX.json\`, \`AGENTS.md\`.
|
|
646
|
+
- Large context: \`${ARQUIVO_SEMA_BOOT}\`, \`${ARQUIVO_AGENT_CONTEXT_PACK}\`, \`SEMA_BRIEF.md\`, \`SEMA_INDEX.json\`, AST, IR, drift, and impact.
|
|
647
|
+
|
|
648
|
+
## When to Generate Code
|
|
649
|
+
|
|
650
|
+
If the delivery includes code derived from a contract, run \`sema compilar\`.
|
|
651
|
+
|
|
652
|
+
\`\`\`bash
|
|
653
|
+
sema compilar contratos/orders.sema --alvo javascript --saida ./generated/javascript
|
|
654
|
+
\`\`\`
|
|
655
|
+
|
|
656
|
+
Replace \`javascript\` with \`typescript\`, \`python\`, \`php\`, \`dart\`, \`lua\`, \`html\`, \`css\`, \`dotnet\`, or \`cpp\` when appropriate.
|
|
657
|
+
|
|
658
|
+
## Fail Closed
|
|
659
|
+
|
|
660
|
+
- If the local CLI is unavailable, stop before editing governed code or contracts and ask for \`@semacode/cli\` installation.
|
|
661
|
+
- If the applicable contract or semantic link is missing, create or repair it before code.
|
|
662
|
+
- If validation or drift reports failure, broken links, divergent routes, or broken implementations, fix the evidence and run the gate again.
|
|
663
|
+
- A local timeout is not authorization to skip Sema; retry with a larger timeout or a narrower scope.
|
|
657
664
|
`;
|
|
658
665
|
}
|
|
659
666
|
function renderizarDocComandosSemaLocal(agentContextPack) {
|
|
660
|
-
return `# Sema Command Catalog
|
|
661
|
-
|
|
662
|
-
Use this file when Codex does not know which command to run. A Sema command is an operational gate; do not replace it with a Markdown report.
|
|
663
|
-
|
|
664
|
-
## Minimum Local Flow
|
|
665
|
-
|
|
666
|
-
\`\`\`bash
|
|
667
|
-
sema --version
|
|
668
|
-
sema resumo
|
|
669
|
-
sema docs-impacto --intencao "<acao>" --json
|
|
670
|
-
\`\`\`
|
|
671
|
-
|
|
672
|
-
Then read every required doc returned by \`docs-impacto\`.
|
|
673
|
-
|
|
674
|
-
## Contract and Discovery
|
|
675
|
-
|
|
676
|
-
- \`sema iniciar --template <template> [--force]\`: creates a new Sema project and preserves existing files by default; \`--force\` is the only explicit overwrite path.
|
|
677
|
-
- \`sema validar <arquivo-ou-pasta> --json\`: validates \`.sema\` contracts.
|
|
678
|
-
- \`sema diagnosticos <arquivo.sema> --json\`: details errors and warnings.
|
|
679
|
-
- \`sema formatar <arquivo-ou-pasta>\`: formats contracts.
|
|
680
|
-
- \`sema inspecionar <arquivo-ou-pasta> --json\`: shows modules, tasks, routes, entities, links, and expected files.
|
|
681
|
-
- \`sema ast <arquivo.sema> --json\`: shows AST for syntax debugging.
|
|
682
|
-
- \`sema ir <arquivo.sema> --json\`: shows the IR used by gates and generators.
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
- \`sema
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
- \`sema
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
- \`sema
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
##
|
|
716
|
-
|
|
717
|
-
- \`
|
|
718
|
-
- \`
|
|
719
|
-
- \`
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
- \`sema
|
|
728
|
-
- \`sema
|
|
729
|
-
- \`sema
|
|
730
|
-
- \`sema
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
-
|
|
743
|
-
|
|
744
|
-
-
|
|
745
|
-
|
|
746
|
-
|
|
667
|
+
return `# Sema Command Catalog
|
|
668
|
+
|
|
669
|
+
Use this file when Codex does not know which command to run. A Sema command is an operational gate; do not replace it with a Markdown report.
|
|
670
|
+
|
|
671
|
+
## Minimum Local Flow
|
|
672
|
+
|
|
673
|
+
\`\`\`bash
|
|
674
|
+
sema --version
|
|
675
|
+
sema resumo
|
|
676
|
+
sema docs-impacto --intencao "<acao>" --json
|
|
677
|
+
\`\`\`
|
|
678
|
+
|
|
679
|
+
Then read every required doc returned by \`docs-impacto\`.
|
|
680
|
+
|
|
681
|
+
## Contract and Discovery
|
|
682
|
+
|
|
683
|
+
- \`sema iniciar --template <template> [--force]\`: creates a new Sema project and preserves existing files by default; \`--force\` is the only explicit overwrite path.
|
|
684
|
+
- \`sema validar <arquivo-ou-pasta> --json\`: validates \`.sema\` contracts.
|
|
685
|
+
- \`sema diagnosticos <arquivo.sema> --json\`: details errors and warnings.
|
|
686
|
+
- \`sema formatar <arquivo-ou-pasta>\`: formats contracts.
|
|
687
|
+
- \`sema inspecionar <arquivo-ou-pasta> --json\`: shows modules, tasks, routes, entities, links, and expected files.
|
|
688
|
+
- \`sema ast <arquivo.sema> --json\`: shows AST for syntax debugging.
|
|
689
|
+
- \`sema ir <arquivo.sema> --json\`: shows the IR used by gates and generators.
|
|
690
|
+
- \`sema descobrir catalogo --json\`: lists governance flows, profiles, specialized workflows, pipelines, generators, capability tokens, and adapters from their canonical registries.
|
|
691
|
+
- \`sema descobrir recomendar --intencao "<goal>" --json\`: ranks compatible capabilities deterministically without executing the selected command.
|
|
692
|
+
- \`sema descobrir explicar <id> --json\`: explains inputs, boundaries, reasons, and the command template for one capability.
|
|
693
|
+
- \`sema pipeline listar|descrever <id> --json\` and \`sema capabilities --json\`: compact projections of the same discovery catalog.
|
|
694
|
+
|
|
695
|
+
## Change and Closure
|
|
696
|
+
|
|
697
|
+
- \`sema docs-impacto --intencao "<acao>" --json\`: discovers required docs and documentary blockers.
|
|
698
|
+
- \`sema inspecionar <arquivo-ou-pasta> [--drift none|cache|fresh] [--com-drift] --json\`: inspects contracts; the default is contract-only \`none\` and leaves code scores absent.
|
|
699
|
+
- \`sema resumo <arquivo-ou-pasta> --micro [--drift none|cache|fresh] --json\`: produces a small contract summary; the default is contract-only \`none\` and explicitly says implementation was not verified.
|
|
700
|
+
- \`sema drift <arquivo-ou-pasta> --escopo modulo [--cache auto|refresh|off] --json\`: compares contract and implementation after planning the physical scope.
|
|
701
|
+
- \`sema impacto <arquivo-ou-pasta> --alvo <token> --mudanca "<descricao>" --json\`: maps impact before changing behavior.
|
|
702
|
+
- \`sema verificar <arquivo-ou-pasta> --json\`: runs aggregated final verification.
|
|
703
|
+
- \`sema finalizar-mudanca --intencao "<acao>" --doc-lida <arquivo> --json\`: proves documentation reading before closure.
|
|
704
|
+
|
|
705
|
+
Honest closure: treat drift JSON as the source of truth. \`sucesso:false\`, \`vinculos_quebrados\`, \`rotas_divergentes\`, or broken impls mean the change is not complete yet. Do not report "clean drift" without green JSON.
|
|
706
|
+
|
|
707
|
+
Focused drift does not fall back to a global scan when it cannot prove a safe file anchor. With \`--cache auto\`, unchanged catalog snapshots, file metadata/content, dependency extraction, and semantic groups are reused only after schema, digest, identity, runtime-shape, and filesystem validation. The JSON fields \`escopo_aplicado.catalogo\`, \`escopo_aplicado.cache.incremental\`, and \`escopo_aplicado.cache.fasesMs\` expose visits, reads, hits, misses, extractions, writes, and phase timing.
|
|
708
|
+
|
|
709
|
+
## Sema Code
|
|
710
|
+
|
|
711
|
+
- \`sema compilar <arquivo-ou-pasta> --alvo <typescript|python|php|dart|lua|javascript|html|css|dotnet|cpp> --saida <diretorio>\`: generates starter/support artifacts from the contract.
|
|
712
|
+
- \`sema testar <arquivo.sema> --alvo <alvo> --saida <diretorio-temporario>\`: generates and runs local tests when the target supports it.
|
|
713
|
+
- \`sema importar <fonte> <diretorio> --saida <diretorio> --json\`: imports a legacy project into initial contracts.
|
|
714
|
+
- \`sema renomear-semantico <arquivo-ou-pasta> --de <nome> --para <nome> --json\`: helps rename symbols semantically.
|
|
715
|
+
|
|
716
|
+
Rule for \`--saida\`: the folder passed to \`sema compilar --saida\` is generated output. It is not the final delivery by itself. The final delivery is the target files/links declared by the contract. If the contract asks for \`index.html\`, \`css/styles.css\`, and \`js/app.js\`, creating only \`saida/expense_control.ts\` does not complete the task.
|
|
717
|
+
|
|
718
|
+
Sema Code traceability rule: generated artifacts must point back to the source module/contract and preserve that the same final file may be governed by several \`.sema\` contracts through \`vinculos\`. Do not force a 1:1 contract-file relationship and do not treat \`saida/\` as the final project.
|
|
719
|
+
|
|
720
|
+
Ready UI rule: if the task generates an app, site, dashboard, form, or static HTML, run desktop/mobile visual validation when the surface allows it. On narrow mobile (for example 390px), \`scrollWidth <= clientWidth\` must pass; a layout that stacks but overflows horizontally is not responsive.
|
|
721
|
+
|
|
722
|
+
## Canonical Syntax Lists
|
|
723
|
+
|
|
724
|
+
- Origins for \`use\` and \`impl\`: \`ts/typescript\`, \`js/javascript\`, \`py/python\`, \`dart\`, \`lua\`, \`cs/dotnet\`, \`java\`, \`go\`, \`rust\`, \`cpp\`.
|
|
725
|
+
- Frequent \`effects\` categories: \`persistencia\`, \`consulta\`, \`evento\`, \`auditoria\`, \`db.write\`, \`queue.publish\`, \`fs.write\`, \`network.egress\`, \`secret.read\`, \`shell.exec\`.
|
|
726
|
+
- Accepted \`audit.motivo\` values: \`obrigatorio\`, \`opcional\`, \`dispensado\`.
|
|
727
|
+
|
|
728
|
+
\`sema compilar --alvo javascript\` is a generation target. \`impl { js: ... }\` is the live-code origin. Do not swap one for the other.
|
|
729
|
+
|
|
730
|
+
## Codex and Context
|
|
731
|
+
|
|
732
|
+
- \`sema ajuda-ia\`: short guidance for Codex.
|
|
733
|
+
- \`sema starter-ia\`: operational starter.
|
|
734
|
+
- \`sema contexto-ia <arquivo.sema> --saida <dir> --json\`: AI context package.
|
|
735
|
+
- \`sema prompt-curto <arquivo-ou-pasta> --json\`: compact prompt.
|
|
736
|
+
- \`sema sync-codex --json\`: synchronizes the official Codex entrypoint and local support docs.
|
|
737
|
+
- \`sema instalar-exemplos --json\`: installs official examples in the workspace.
|
|
738
|
+
- \`sema exemplos-prompt-ia\`: shows prompt examples, not \`.sema\` examples.
|
|
739
|
+
|
|
740
|
+
## Profiles and Author
|
|
741
|
+
|
|
742
|
+
- \`sema author iniciar|validar|briefing|revisar-cliches|validar-narrativa|validar-proibicoes\`: governs authorial writing.
|
|
743
|
+
- \`sema profile validar <software|workflow|ops|game|simulation|legal|research|redacao|propostas|conversas> <arquivo> --json\`: validates an artifact by profile.
|
|
744
|
+
- \`sema profile capabilities --json\`: lists profiles/capabilities.
|
|
745
|
+
- \`sema rule-packs --profile <profile> --json\`: lists rule packs.
|
|
746
|
+
|
|
747
|
+
\`author\` is a specialized \`sema author\` workflow, not a \`profile validar\` alias. Discovery exposes that distinction explicitly.
|
|
748
|
+
|
|
749
|
+
## AI-native Content Pipeline
|
|
750
|
+
|
|
751
|
+
- \`sema conteudo capabilities --json\`: lists generic producer, evaluator, and adapter capabilities without fixing a platform.
|
|
752
|
+
- \`sema conteudo validar <definition.json> --json\`: validates the content DAG, gates, and open adapters.
|
|
753
|
+
- \`sema conteudo planejar <definition.json> --alvos-arquivo <targets.json> --json\`: creates a declarative multi-target plan for an external runner.
|
|
754
|
+
- \`sema conteudo validar-envelope --envelope-arquivo <envelope.json> --confianca-arquivo <trust.json> --trust-root-digest <sha256:...> --revocation-digest <sha256:...> --payload-type <type> --json\`: verifies Ed25519 identity, authorization, freshness, scope, and the separately pinned trust root and current revocation overlay.
|
|
755
|
+
- \`sema conteudo registrar <ledger.ndjson> --envelope-arquivo <envelope.json> --politica-arquivo <policy-envelope.json> --confianca-arquivo <trust.json> --trust-root-digest <sha256:...> --revocation-digest <sha256:...> --ledger-id <id> --expected-head <sha256:...> --json\`: appends a verified envelope under the signed run policy to the local replay ledger at an externally retained head.
|
|
756
|
+
- \`sema conteudo status <definition.json> --politica-arquivo <policy-envelope.json> --confianca-arquivo <trust.json> --trust-root-digest <sha256:...> --revocation-digest <sha256:...> --ledger-arquivo <ledger.ndjson> --expected-head <sha256:...> --json\`: verifies the signed policy and derives verdicts, operational conditions, completion, and next actions from canonical events.
|
|
757
|
+
- \`sema conteudo projetar <definition.json> --politica-arquivo <policy-envelope.json> --confianca-arquivo <trust.json> --trust-root-digest <sha256:...> --revocation-digest <sha256:...> --ledger-arquivo <ledger.ndjson> --expected-head <sha256:...> --saida <manifest.json> --json\`: regenerates a non-authoritative manifest bound to the ledger head.
|
|
758
|
+
|
|
759
|
+
The content command never runs producers, evaluators, creative tools, or publication adapters; those belong to an external runner. It has no native human-review transition. A signed policy binds the run, definition, ledger, trust root, gates, complete target set, and authorization window. Stages select \`adapterPolicy\` as \`NONE\`, \`CONSTRAINTS\`, or \`CONFIRMATION\`; definition v1 accepts one output per stage. Constraint results must come from independent signed observations, including independently observed media type, not artifact metadata or executor claims.
|
|
760
|
+
|
|
761
|
+
Target metadata is an exact scalar allowlist from \`requiredMetadata + optionalMetadata\`; \`accountScope\` is a credential-free \`account:<alias>\` reference, and artifact metadata is prohibited in v1. Deterministic evidence and AI opinions have separate quorum fields. Evidence requires an exact attestation capability plus signed adapter binding where applicable.
|
|
762
|
+
|
|
763
|
+
Verdicts remain separate from operational conditions, and a generated manifest cannot alter canonical state. Append freshness uses the platform clock rather than caller-provided time, and an authority in the current revocation overlay cannot sign an accepted policy.
|
|
764
|
+
|
|
765
|
+
Local NDJSON plus a hash chain is portable replay evidence, not a strong append-only trust boundary. Retain the expected head, canonical trust-root digest, and current revocation digest externally, or use protected storage for high assurance. A workspace-local trust file additionally requires \`--development-local-trust\`; that flag does not disable digest pinning.
|
|
766
|
+
|
|
767
|
+
## AI-native Interactive Systems
|
|
768
|
+
|
|
769
|
+
- \`sema interativo capabilities --json\`: lists the canonical interactive capability vocabulary.
|
|
770
|
+
- \`sema interativo schema --json\`: exposes stable definition, extension-command, and data-schema shapes for AI clients.
|
|
771
|
+
- \`sema interativo pipelines --json\`: lists reusable game, simulation, and hybrid pipelines.
|
|
772
|
+
- \`sema interativo adapters [--spatial-model <NON_SPATIAL|TWO_D|TWO_POINT_FIVE_D|THREE_D>] [--render-mode <HEADLESS|TEXT|VISUAL|XR>] --json\`: lists compatible external adapter descriptors.
|
|
773
|
+
- \`sema interativo validar <definition.json> --json\`: validates independent kind, spatial model, render mode, visual profile, fidelity, control, time, world, budget, pipeline, and acceptance axes.
|
|
774
|
+
- \`sema interativo planejar <definition.json> --json\`: expands compatible stages and required evidence without running an engine.
|
|
775
|
+
- \`sema interativo validar-evidencias|status <definition.json> [--plano-arquivo <plan.json>] --bundle-arquivo <bundle.json> --json\`: validates a portable evidence bundle or derives non-authoritative status; \`--evidencias-arquivo\` is an alias and an omitted plan is recomputed deterministically.
|
|
776
|
+
- \`sema interativo validar-protocolo <adapter-run.json> --json\`: checks DETECT/PROBE/SNAPSHOT/PLAN/APPLY/VALIDATE/EVIDENCE/ROLLBACK ordering and stable target binding.
|
|
777
|
+
- Experience IR: \`validar-ir\`, \`indexar-ir\`, \`consultar-ir\`, \`chunk-ir\`, and \`descrever-ir\`.
|
|
778
|
+
- Operational state: \`validar-engine-snapshot\`, \`diff-engine-snapshots\`, \`validar-asset-provenance\`, \`validar-editor-state\`, \`planejar-jobs\`, \`validar-acceptance\`, \`operar-acceptance\`, and \`validar-multimodal\`.
|
|
779
|
+
- Temporal, autonomy, and testing: \`validar-temporal\`, \`validar-evidencia-temporal\`, \`validar-autonomia\`, \`validar-playtest-fuzz\`, and \`validar-multiplayer\`.
|
|
780
|
+
- Portability and workers: \`analisar-portabilidade\` and \`validar-workers\`.
|
|
781
|
+
|
|
782
|
+
Spatial model and render mode are orthogonal: \`THREE_D + HEADLESS\` is valid, while XR requires \`THREE_D\`. \`PIXEL_8_BIT\` and \`PIXEL_16_BIT\` are independent visual profiles available to games and simulations. Every command above is local and read-only; external runners own engine/editor execution, authorization, mutation, rollback, migration, rendering, playtest, and worker scheduling. Full local coverage is \`STRUCTURALLY_COMPLETE\`, never authoritative completion.
|
|
783
|
+
|
|
784
|
+
## Operational
|
|
785
|
+
|
|
786
|
+
- \`sema doctor\`: diagnoses local installation.
|
|
787
|
+
|
|
788
|
+
## Forbidden
|
|
789
|
+
|
|
790
|
+
- Do not use an external workspace source to inspect a local workspace when \`sema --version\` works.
|
|
791
|
+
- Do not search the entire disk for \`.sema\` syntax; use \`exemplos/\`, \`docs/syntax.md\`, and this catalog.
|
|
792
|
+
- Do not stop after \`sema compilar\` if the contract target files still do not exist.
|
|
793
|
+
- Do not replace \`sema compilar\` with \`sema testar\` when the contract requires generated code.
|
|
794
|
+
- Do not create a Markdown report to pretend a gate ran.
|
|
795
|
+
- Do not say drift passed when \`sema drift --json\` returned \`sucesso:false\`, broken link, divergent route, or broken impl.
|
|
796
|
+
- Do not declare a UI responsive without mobile/desktop proof; horizontal scroll at 390px blocks closure.
|
|
797
|
+
|
|
798
|
+
Governed code policy: keep the \`SEMA-GOVERNED\` marker, split large code by real responsibility, preserve contract links, and never treat a generated output directory as the final delivery.
|
|
747
799
|
`;
|
|
748
800
|
}
|
|
749
801
|
function renderizarAgentStarterLocal(_agentContextPack) {
|
|
750
|
-
return `# Codex Starter
|
|
751
|
-
|
|
752
|
-
Codex is operating in a Sema-governed project.
|
|
753
|
-
|
|
754
|
-
Read in this order:
|
|
755
|
-
|
|
756
|
-
1. \`${ARQUIVO_SEMA_BOOT}\`
|
|
757
|
-
2. \`${ARQUIVO_AGENT_CONTEXT_PACK}\`
|
|
758
|
-
3. \`SEMA_INDEX.json\`
|
|
759
|
-
4. \`AGENTS.md\`
|
|
760
|
-
5. \`docs/commands.md\`
|
|
761
|
-
6. \`docs/syntax.md\`
|
|
762
|
-
7. \`exemplos/\`
|
|
763
|
-
|
|
764
|
-
Basic commands:
|
|
765
|
-
|
|
766
|
-
\`\`\`bash
|
|
767
|
-
sema --version
|
|
768
|
-
sema resumo
|
|
769
|
-
sema docs-impacto --intencao "<acao>" --json
|
|
770
|
-
sema validar contratos/orders.sema --json
|
|
771
|
-
sema drift contratos/orders.sema --escopo modulo --json
|
|
772
|
-
sema compilar contratos/orders.sema --alvo javascript --saida ./generated/javascript
|
|
773
|
-
\`\`\`
|
|
774
|
-
|
|
775
|
-
Do not replace these gates with local search, guessing from a filename, or random contract reading outside the project.
|
|
776
|
-
|
|
777
|
-
Closure is not an opinion: \`sema drift --json\` must be green. \`sucesso:false\`, \`vinculos_quebrados\`, \`rotas_divergentes\`, or broken impls block closure.
|
|
778
|
-
|
|
779
|
-
Ready UI requires proof: desktop/mobile and a narrow viewport without horizontal overflow (\`scrollWidth <= clientWidth\`).
|
|
780
|
-
|
|
781
|
-
Keep \`SEMA-GOVERNED\` markers and follow the applicable contract before editing governed code.
|
|
802
|
+
return `# Codex Starter
|
|
803
|
+
|
|
804
|
+
Codex is operating in a Sema-governed project.
|
|
805
|
+
|
|
806
|
+
Read in this order:
|
|
807
|
+
|
|
808
|
+
1. \`${ARQUIVO_SEMA_BOOT}\`
|
|
809
|
+
2. \`${ARQUIVO_AGENT_CONTEXT_PACK}\`
|
|
810
|
+
3. \`SEMA_INDEX.json\`
|
|
811
|
+
4. \`AGENTS.md\`
|
|
812
|
+
5. \`docs/commands.md\`
|
|
813
|
+
6. \`docs/syntax.md\`
|
|
814
|
+
7. \`exemplos/\`
|
|
815
|
+
|
|
816
|
+
Basic commands:
|
|
817
|
+
|
|
818
|
+
\`\`\`bash
|
|
819
|
+
sema --version
|
|
820
|
+
sema resumo
|
|
821
|
+
sema docs-impacto --intencao "<acao>" --json
|
|
822
|
+
sema validar contratos/orders.sema --json
|
|
823
|
+
sema drift contratos/orders.sema --escopo modulo --json
|
|
824
|
+
sema compilar contratos/orders.sema --alvo javascript --saida ./generated/javascript
|
|
825
|
+
\`\`\`
|
|
826
|
+
|
|
827
|
+
Do not replace these gates with local search, guessing from a filename, or random contract reading outside the project.
|
|
828
|
+
|
|
829
|
+
Closure is not an opinion: \`sema drift --json\` must be green. \`sucesso:false\`, \`vinculos_quebrados\`, \`rotas_divergentes\`, or broken impls block closure.
|
|
830
|
+
|
|
831
|
+
Ready UI requires proof: desktop/mobile and a narrow viewport without horizontal overflow (\`scrollWidth <= clientWidth\`).
|
|
832
|
+
|
|
833
|
+
Keep \`SEMA-GOVERNED\` markers and follow the applicable contract before editing governed code.
|
|
782
834
|
`;
|
|
783
835
|
}
|
|
784
836
|
export async function sincronizarEntrypointCodex(baseProjeto, agentContextPack) {
|