@semacode/cli 2.3.0 → 3.0.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.
- package/LICENSE +39 -39
- package/README.md +112 -41
- package/dist/agentContextPack.js +14 -10
- package/dist/agentEntryPoints.d.ts +5 -0
- package/dist/agentEntryPoints.js +102 -91
- package/dist/angular-consumer-standalone.d.ts +3 -1
- package/dist/angular-consumer-standalone.js +12 -8
- package/dist/bin.d.ts +6 -0
- package/dist/bin.js +130 -0
- package/dist/cliArgs.js +4 -4
- package/dist/cliControlError.d.ts +12 -0
- package/dist/cliControlError.js +47 -0
- package/dist/cliGrammar.d.ts +11 -0
- package/dist/cliGrammar.js +551 -0
- package/dist/cliHelp.d.ts +13 -0
- package/dist/cliHelp.js +19 -0
- package/dist/cliHelpTexto.d.ts +3 -0
- package/dist/cliHelpTexto.js +168 -0
- package/dist/cliRuntime.d.ts +2 -0
- package/dist/cliRuntime.js +31 -0
- package/dist/comandos.js +9 -22
- package/dist/contexto.js +5 -5
- package/dist/dev/index.d.ts +1 -0
- package/dist/dev/index.js +51 -9
- package/dist/discovery/catalog.js +3 -3
- package/dist/distribuicao/filesystemGlobal.d.ts +63 -0
- package/dist/distribuicao/filesystemGlobal.js +701 -0
- package/dist/distribuicao/index.d.ts +7 -0
- package/dist/distribuicao/index.js +227 -0
- package/dist/distribuicao/launcherGlobal.d.ts +53 -0
- package/dist/distribuicao/launcherGlobal.js +643 -0
- package/dist/distribuicao/launcherWindows.d.ts +28 -0
- package/dist/distribuicao/launcherWindows.js +326 -0
- package/dist/distribuicao/lockContextGlobal.d.ts +10 -0
- package/dist/distribuicao/lockContextGlobal.js +17 -0
- package/dist/distribuicao/lockGlobal.d.ts +6 -0
- package/dist/distribuicao/lockGlobal.js +520 -0
- package/dist/distribuicao/skillGlobal.d.ts +48 -0
- package/dist/distribuicao/skillGlobal.js +652 -0
- package/dist/distribuicao/skillIntentPolicy.d.ts +21 -0
- package/dist/distribuicao/skillIntentPolicy.js +115 -0
- package/dist/distribuicao/tipos.d.ts +50 -0
- package/dist/distribuicao/tipos.js +10 -0
- package/dist/distribuicao/versaoSemantica.d.ts +3 -0
- package/dist/distribuicao/versaoSemantica.js +62 -0
- package/dist/drift.part01.d.ts +34 -2
- package/dist/drift.part01.js +3 -0
- package/dist/drift.part04.d.ts +12 -2
- package/dist/drift.part04.js +89 -15
- package/dist/drift.part05.d.ts +2 -1
- package/dist/drift.part05.js +9 -6
- package/dist/drift.part06.d.ts +2 -1
- package/dist/drift.part06.js +115 -24
- package/dist/drift.part07.d.ts +11 -10
- package/dist/drift.part07.js +261 -255
- package/dist/drift.part08.d.ts +2 -1
- package/dist/drift.part08.js +35 -25
- package/dist/drift.part11.js +279 -32
- package/dist/drift.part12.d.ts +1 -1
- package/dist/drift.part12.js +196 -11
- package/dist/drift.part13.d.ts +18 -2
- package/dist/drift.part13.js +654 -76
- package/dist/drift.part14.js +21 -7
- package/dist/driftCacheCas.d.ts +43 -0
- package/dist/driftCacheCas.js +351 -0
- package/dist/driftCacheFilesystem.d.ts +64 -0
- package/dist/driftCacheFilesystem.js +313 -0
- package/dist/driftCacheModes.d.ts +38 -0
- package/dist/driftCacheModes.js +147 -0
- package/dist/driftCacheStore.d.ts +80 -0
- package/dist/driftCacheStore.js +603 -0
- package/dist/driftCatalogo.d.ts +65 -0
- package/dist/driftCatalogo.js +516 -0
- package/dist/driftEscopo.d.ts +21 -0
- package/dist/driftEscopo.js +647 -0
- package/dist/driftEscopoReferencias.d.ts +8 -0
- package/dist/driftEscopoReferencias.js +612 -0
- package/dist/driftOrcamento.d.ts +6 -0
- package/dist/driftOrcamento.js +20 -3
- package/dist/geracaoCore.js +4 -6
- package/dist/iaPrompts.d.ts +3 -3
- package/dist/iaPrompts.js +13 -14
- package/dist/index.d.ts +4 -1
- package/dist/index.js +6 -25
- package/dist/index.part01.d.ts +21 -14
- package/dist/index.part01.js +20 -165
- package/dist/index.part02.js +57 -43
- package/dist/index.part03.d.ts +23 -1
- package/dist/index.part03.js +83 -8
- package/dist/index.part04.d.ts +10 -2
- package/dist/index.part04.js +48 -14
- package/dist/index.part05.d.ts +1 -1
- package/dist/index.part05.js +109 -30
- package/dist/index.part06.js +34 -16
- package/dist/index.part07.js +31 -27
- package/dist/index.part08.d.ts +1 -1
- package/dist/index.part08.js +23 -28
- package/dist/init/templates.part01.js +393 -393
- package/dist/init/templates.part02.js +189 -189
- package/dist/initCommand.js +5 -1
- package/dist/initTemplatesBackend.js +73 -73
- package/dist/initTemplatesBase.js +7 -5
- package/dist/initTemplatesFlutter.js +137 -137
- package/dist/initTemplatesRuntime.js +350 -350
- package/dist/initTemplatesWeb.js +309 -309
- package/dist/pipelineConteudo/command.d.ts +1 -0
- package/dist/pipelineConteudo/command.js +4 -32
- package/dist/pipelineConteudo/help.d.ts +2 -0
- package/dist/pipelineConteudo/help.js +33 -0
- package/dist/profileAuthorCommand.js +3 -7
- package/dist/profileCommand.js +3 -7
- package/dist/projeto.d.ts +1 -1
- package/dist/projetoCarregar.d.ts +2 -2
- package/dist/projetoCarregar.js +69 -28
- package/dist/projetoCatalogo.d.ts +8 -0
- package/dist/projetoCatalogo.js +164 -0
- package/dist/projetoOrigens.d.ts +2 -0
- package/dist/projetoOrigens.js +65 -9
- package/dist/projetoTipos.d.ts +15 -5
- package/dist/resultadoCli.d.ts +20 -0
- package/dist/resultadoCli.js +57 -0
- package/dist/saidaCli.d.ts +35 -0
- package/dist/saidaCli.js +118 -0
- package/dist/sistemasInterativos/acceptanceEvidence.d.ts +22 -0
- package/dist/sistemasInterativos/acceptanceEvidence.js +345 -0
- package/dist/sistemasInterativos/engineObservation.d.ts +12 -0
- package/dist/sistemasInterativos/engineObservation.js +438 -0
- package/dist/sistemasInterativos/jobOrchestration.d.ts +2 -0
- package/dist/sistemasInterativos/jobOrchestration.js +204 -0
- package/dist/sistemasInterativos/operationPrimitives.d.ts +21 -0
- package/dist/sistemasInterativos/operationPrimitives.js +194 -0
- package/dist/sistemasInterativos/operations.d.ts +4 -39
- package/dist/sistemasInterativos/operations.js +5 -1164
- package/dist/skillCommand.d.ts +5 -0
- package/dist/skillCommand.js +88 -0
- package/dist/sync/index.js +35 -35
- package/docs/README.md +11 -7
- package/docs/ai-integration.md +18 -11
- package/docs/ai-onboarding.md +81 -62
- package/docs/ai-workflow.md +10 -4
- package/docs/auth.md +26 -26
- package/docs/cli.md +197 -79
- package/docs/commands.md +30 -6
- package/docs/database.md +15 -15
- package/docs/deploy.md +54 -41
- package/docs/documentation.md +11 -10
- package/docs/drift-cache.md +108 -0
- package/docs/env.md +16 -16
- package/docs/frontend.md +41 -41
- package/docs/getting-started.md +82 -57
- package/docs/i18n.md +15 -15
- package/docs/repositories.md +60 -43
- package/docs/rollback.md +38 -31
- package/docs/security.md +54 -32
- package/docs/sistemas-interativos.md +27 -27
- package/docs/support.md +8 -8
- package/docs/testing.md +123 -17
- 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/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_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/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-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-html/dist/index.js +17 -17
- 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/node_modules/@sema/nucleo/dist/semantico/analisador.d.ts +1 -0
- package/node_modules/@sema/nucleo/dist/semantico/analisador.js +1 -0
- package/package.json +7 -2
- package/scripts/postinstall.mjs +148 -0
- package/skills/sema/SKILL.md +199 -0
- package/skills/sema/agents/openai.yaml +4 -0
- package/node_modules/@sema/gerador-cpp/dist/index.js.map +0 -1
- package/node_modules/@sema/gerador-css/dist/index.js.map +0 -1
- package/node_modules/@sema/gerador-css/dist/index.part01.js.map +0 -1
- package/node_modules/@sema/gerador-css/dist/index.part02.js.map +0 -1
- package/node_modules/@sema/gerador-dart/dist/index.js.map +0 -1
- package/node_modules/@sema/gerador-dotnet/dist/index.js.map +0 -1
- package/node_modules/@sema/gerador-html/dist/index.js.map +0 -1
- package/node_modules/@sema/gerador-javascript/dist/index.js.map +0 -1
- package/node_modules/@sema/gerador-lua/dist/index.js.map +0 -1
- package/node_modules/@sema/gerador-php/dist/index.js.map +0 -1
- package/node_modules/@sema/gerador-python/dist/index.js.map +0 -1
- package/node_modules/@sema/gerador-python/dist/index.part01.js.map +0 -1
- package/node_modules/@sema/gerador-python/dist/index.part02.js.map +0 -1
- package/node_modules/@sema/gerador-typescript/dist/index.js.map +0 -1
- package/node_modules/@sema/gerador-typescript/dist/index.part01.js.map +0 -1
- package/node_modules/@sema/gerador-typescript/dist/index.part02.js.map +0 -1
- package/node_modules/@sema/gerador-typescript/dist/index.part03.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/ast/tipos.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/diagnosticos/index.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/diagnosticos/melhorador.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/diagnosticos/snippets.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/formatador/index.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/formatador/index.part01.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/formatador/index.part02.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/index.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/ir/conversor.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/ir/conversor.part01.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/ir/conversor.part02.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/ir/conversor.part03.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/ir/modelos.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/lexer/lexer.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/lexer/tokens.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/parser/parser.declaracoes.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/parser/parser.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/parser/parser.modulo.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/parser/parser.part01.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/parser/parser.part02.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/parser/parser.part03.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/persistencia/contratos.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/analisador.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/analisador.part01.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/analisador.part02.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/analisador.part03.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/analisador.part04.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/analisador.part05.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/analisador.part06.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/analisador.part07.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/analisador.part08.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/estruturas.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/estruturas.part01.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/estruturas.part02.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/orcamentoSemantico.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/semantico/seguranca.js.map +0 -1
- package/node_modules/@sema/nucleo/dist/util/arquivos.js.map +0 -1
- package/node_modules/@sema/padroes/dist/index.js.map +0 -1
package/dist/agentEntryPoints.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// SEMA-GOVERNED: sema.produto.governanca_ia.contexto.entrypoints, sema.produto.escrita_segura_workspace
|
|
2
|
-
// Descrição: sincroniza o
|
|
1
|
+
// SEMA-GOVERNED: sema.produto.governanca_ia.contexto.entrypoints, sema.produto.escrita_segura_workspace, sema.produto.governanca_ia.drift.cache.modos
|
|
2
|
+
// Descrição: sincroniza o protocolo Codex, incluindo a distinção entre contexto contratual e evidência fresh de drift.
|
|
3
3
|
import { readFile, rm, rmdir, stat } from 'node:fs/promises';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { escreverArquivoWorkspaceSeguro, validarDestinosEscritaWorkspace, } from './workspaceWrite.js';
|
|
@@ -146,13 +146,13 @@ Você está em um projeto governado por Sema. O contrato semântico vem antes de
|
|
|
146
146
|
|
|
147
147
|
## Primeira ação
|
|
148
148
|
|
|
149
|
-
1. Confirme \`AGENTS.md\` na raiz e rode \`sema --version
|
|
150
|
-
2. Use a CLI local diretamente para ler o workspace: \`sema resumo\`, \`sema docs-impacto\`, \`sema inspecionar\`, \`sema drift\` e \`sema impacto\`.
|
|
149
|
+
1. Confirme \`AGENTS.md\` na raiz e rode \`sema --version\`. Se o shell não localizar o comando, use \`$HOME/.sema/bin/sema\` no macOS/Linux; no Windows, PowerShell usa \`sema.ps1\` no PATH, cmd.exe usa \`sema.cmd\`, e o fallback absoluto é \`& "$env:SystemRoot\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$HOME\\.sema\\bin\\sema-managed.ps1" --version\`. Só então declare a CLI indisponível.
|
|
150
|
+
2. Use a CLI local diretamente para ler o workspace: \`sema resumo --drift none\`, \`sema docs-impacto\`, \`sema inspecionar --drift none\`, \`sema drift --cache fresh\` e \`sema impacto\`. Na 3.0.0, \`sema --version\` continua texto SemVer exato; com \`--json\`, help e falhas de controle usam \`sema.cli.control/v1\`, enquanto comandos sintaticamente válidos usam o envelope exato de oito campos \`sema.cli.result/v1\`, com o resultado aninhado em \`payload\` e \`ok\` separado do veredito de domínio desse payload.
|
|
151
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
152
|
4. Não use fonte externa de workspace para substituir a CLI local quando ela estiver operacional.
|
|
153
153
|
5. Este boot é para workspace local em disco; se não houver workspace local, pare bloqueado em vez de inventar caminho.
|
|
154
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.
|
|
155
|
+
7. Antes de editar código existente, rode \`sema drift --cache fresh\` e impacto pela CLI local.
|
|
156
156
|
8. Antes de criar ou corrigir \`.sema\`, use os exemplos oficiais na CLI local.
|
|
157
157
|
9. Se qualquer etapa falhar, pare e diga que está bloqueado.
|
|
158
158
|
|
|
@@ -197,7 +197,10 @@ Score composto, \`achados[]\` e \`decisaoAgente\` são sinais para guiar a próx
|
|
|
197
197
|
- Fraca: se o score passou, confira se cada achado tem evidência concreta; se não souber provar, pare.
|
|
198
198
|
- Média: conecte regra, arquivo, contrato e evidência antes de concluir aderência.
|
|
199
199
|
- Forte: não transforme regex, palavra-chave ou score 100 em ritual vazio; valide substância, risco e comportamento.
|
|
200
|
-
-
|
|
200
|
+
- Consultas honestas: \`resumo\` e \`inspecionar\` usam \`--drift none\` por padrão; score, confiança, implementação, rotas e superfícies não observadas ficam nulos/não avaliados.
|
|
201
|
+
- Se uma consulta executar drift explicitamente, \`payload.analiseDrift.sucesso\` expõe o resultado e uma falha solicitada retorna exit code diferente de zero.
|
|
202
|
+
- Cache: \`sema drift\` usa \`fresh\` por padrão. \`--cache none\` ainda executa sem persistência; \`cache\` acelera extrações validadas, mas não é prova final.
|
|
203
|
+
- Fechamento governado: se o \`payload\` de \`sema drift --cache fresh --json\` retornar \`sucesso:false\`, \`vinculos_quebrados\`, \`rotas_divergentes\` ou \`impls_quebrados\`, não diga que passou limpo. Corrija e rode drift de novo.
|
|
201
204
|
- 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
205
|
- Caminho fora do workspace local aberto pelo usuário não substitui a pasta local.
|
|
203
206
|
|
|
@@ -245,7 +248,7 @@ export function renderizarSemaSmallModel(agentContextPack) {
|
|
|
245
248
|
Leia isto primeiro se você tem pouco contexto, pouca memória, pouco tool use ou tendência a ignorar instruções longas.
|
|
246
249
|
|
|
247
250
|
1. Não edite nada antes de chamar Sema.
|
|
248
|
-
2. Em workspace local, rode \`sema --version\`; se falhar,
|
|
251
|
+
2. Em workspace local, rode \`sema --version\`; se o shell falhar, use \`$HOME/.sema/bin/sema\` no macOS/Linux. No Windows, PowerShell usa \`sema.ps1\` no PATH e cmd.exe usa \`sema.cmd\`; o fallback absoluto é \`& "$env:SystemRoot\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$HOME\\.sema\\bin\\sema-managed.ps1" --version\`. Só então pare e peça instalação ou reparo.
|
|
249
252
|
3. Sema não contorna políticas da plataforma: ele governa contrato, escopo, drift, evidência e qualidade.
|
|
250
253
|
4. Se aparecer alerta de política: pare, explique de forma neutra e não tente burlar filtro.
|
|
251
254
|
5. Se não houver workspace local em disco: pare bloqueado e peça o fluxo apropriado; não invente leitura por caminho.
|
|
@@ -261,7 +264,7 @@ Leia isto primeiro se você tem pouco contexto, pouca memória, pouco tool use o
|
|
|
261
264
|
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
265
|
16. Se aparecer caminho que não pertence ao workspace local aberto pelo usuário, pare e confirme a fonte antes de agir.
|
|
263
266
|
17. Se Sema estourar por timeout local: aumente o timeout e tente de novo. Não trate isso como falha do Sema.
|
|
264
|
-
18.
|
|
267
|
+
18. Para fechamento, rode \`sema drift --cache fresh --json\`; cache persistente só acelera navegação e não é prova final. Se o \`payload\` retornar \`sucesso:false\`, \`vinculos_quebrados\`, \`rotas_divergentes\` ou \`impls_quebrados\`, não conclua. Na 3.0.0, não procure campos de domínio no topo do envelope \`sema.cli.result/v1\` nem use \`ok\` como substituto do veredito do payload.
|
|
265
268
|
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
269
|
20. Não substitua o contexto Sema por AGENTS.md, README.md, busca local, inferência por nome ou bom senso.
|
|
267
270
|
|
|
@@ -284,7 +287,7 @@ Timeout:
|
|
|
284
287
|
- Timeout local do agente não é falha do Sema.
|
|
285
288
|
- Projeto inteiro: comece com ${politicaTimeout.timeoutInicialSegundos}s ou mais.
|
|
286
289
|
- Escalonamento: ${politicaTimeout.escalonamentoSegundos.map((segundos) => `${segundos}s`).join(" -> ")}.
|
|
287
|
-
- Se o projeto inteiro for lento, escopar para \`sema resumo <arquivo.sema> --micro --para mudanca\`.
|
|
290
|
+
- Se o projeto inteiro for lento, escopar para \`sema resumo <arquivo.sema> --micro --para mudanca --drift none\`.
|
|
288
291
|
- ${politicaTimeout.ateQuandoTentar}
|
|
289
292
|
|
|
290
293
|
Acabamento visual e terminal:
|
|
@@ -315,18 +318,22 @@ export function renderizarDocumentoAgentesPorCapacidade(agentContextPack) {
|
|
|
315
318
|
"",
|
|
316
319
|
"## Before AGENTS.md Exists",
|
|
317
320
|
"",
|
|
318
|
-
"The official Sema skill is the
|
|
319
|
-
"
|
|
321
|
+
"The official Sema skill is the first-contact bootstrap for a project that does",
|
|
322
|
+
"not have Sema yet. A global CLI install bundles and synchronizes it:",
|
|
320
323
|
"",
|
|
321
324
|
"```bash",
|
|
322
|
-
"
|
|
323
|
-
"
|
|
325
|
+
"npm install -g @semacode/cli",
|
|
326
|
+
"sema skill status --json",
|
|
324
327
|
"```",
|
|
325
328
|
"",
|
|
326
|
-
"The
|
|
327
|
-
"
|
|
329
|
+
"The package creates an absolute launcher under `~/.sema/bin`, synchronizes the",
|
|
330
|
+
"canonical skill under `~/.agents/skills/sema`, and mirrors Claude only when",
|
|
331
|
+
"detected. Informational requests stay read-only; before implementation the skill asks",
|
|
332
|
+
"for explicit project-adoption authorization, then generates `AGENTS.md` and delegates",
|
|
333
|
+
"ongoing governance. Installing or updating the global CLI authorizes distribution only.",
|
|
334
|
+
"Already-open tasks may need a reload. The distribution contains no",
|
|
328
335
|
"MCP server, remote workspace bridge, login, license, billing, token, credit,",
|
|
329
|
-
"panel, or authorization gate.",
|
|
336
|
+
"panel, or runtime authorization gate.",
|
|
330
337
|
"",
|
|
331
338
|
`Supported capacity labels: ${supportedCapacities}.`,
|
|
332
339
|
"",
|
|
@@ -336,10 +343,11 @@ export function renderizarDocumentoAgentesPorCapacidade(agentContextPack) {
|
|
|
336
343
|
"",
|
|
337
344
|
"```bash",
|
|
338
345
|
"sema --version",
|
|
339
|
-
"sema resumo",
|
|
346
|
+
"sema resumo --drift none",
|
|
340
347
|
"```",
|
|
341
348
|
"",
|
|
342
|
-
"
|
|
349
|
+
"If the shell cannot resolve `sema`, use `~/.sema/bin/sema` on macOS/Linux. On Windows, PowerShell uses `sema.ps1` from PATH and cmd.exe uses `sema.cmd`; use `& \"$env:SystemRoot\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File \"$HOME\\.sema\\bin\\sema-managed.ps1\" --version` as the absolute fallback",
|
|
350
|
+
"before declaring the CLI unavailable. A successful version check is enough. Local",
|
|
343
351
|
"commands require no login, activation key, license check, token, credits, billing",
|
|
344
352
|
"service, control panel, or external authorization request.",
|
|
345
353
|
"",
|
|
@@ -347,13 +355,15 @@ export function renderizarDocumentoAgentesPorCapacidade(agentContextPack) {
|
|
|
347
355
|
"",
|
|
348
356
|
"```bash",
|
|
349
357
|
"sema docs-impacto --intencao \"describe the change\" --json",
|
|
350
|
-
"sema inspecionar contratos/example.sema --json",
|
|
351
|
-
"sema drift contratos/example.sema --escopo modulo --json",
|
|
358
|
+
"sema inspecionar contratos/example.sema --drift none --json",
|
|
359
|
+
"sema drift contratos/example.sema --escopo modulo --cache fresh --json",
|
|
352
360
|
"sema impacto contratos/example.sema --alvo app.example --mudanca \"describe the change\" --json",
|
|
353
361
|
"```",
|
|
354
362
|
"",
|
|
355
363
|
"Read every document listed by `docs-impacto` before changing code, contracts,",
|
|
356
364
|
"operational docs, generated artifacts, workflows, profiles, or release material.",
|
|
365
|
+
"A cache hit is acceleration, not evidence: closing requires `--cache fresh`,",
|
|
366
|
+
"while contract-only queries keep unobserved implementation fields null inside the command payload.",
|
|
357
367
|
"",
|
|
358
368
|
"## Codex Context Tiers",
|
|
359
369
|
"",
|
|
@@ -430,13 +440,13 @@ function renderizarInstrucaoCodexSema(agentContextPack) {
|
|
|
430
440
|
Este workspace é governado por Sema. Antes de qualquer ação em código, contrato, documentação operacional, workflow, profile ou deploy:
|
|
431
441
|
|
|
432
442
|
1. Leia \`${ARQUIVO_SEMA_BOOT}\`.
|
|
433
|
-
2. Rode \`sema --version\`; se falhar, pare e peça
|
|
434
|
-
3. Use diretamente a CLI local: \`sema resumo\`, \`sema docs-impacto\`, \`sema inspecionar\`, \`sema drift\` e \`sema impacto\`.
|
|
443
|
+
2. Rode \`sema --version\`; se o shell falhar, use \`$HOME/.sema/bin/sema\` no macOS/Linux. No Windows, PowerShell usa \`sema.ps1\` no PATH e cmd.exe usa \`sema.cmd\`; use \`& "$env:SystemRoot\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$HOME\\.sema\\bin\\sema-managed.ps1" --version\` como fallback absoluto. Só então pare e peça instalação ou reparo.
|
|
444
|
+
3. Use diretamente a CLI local: \`sema resumo --drift none\`, \`sema docs-impacto\`, \`sema inspecionar --drift none\`, \`sema drift --cache fresh\` e \`sema impacto\`. Na 3.0.0, \`sema --version\` continua texto SemVer exato; com \`--json\`, help e falhas de controle usam \`sema.cli.control/v1\`, enquanto comandos sintaticamente válidos usam o envelope exato de oito campos \`sema.cli.result/v1\`, com resultado em \`payload\` e \`ok\` distinto do veredito de domínio do payload.
|
|
435
445
|
4. Quando a capacidade correta não estiver clara, use \`sema descobrir recomendar --intencao "<objetivo>" --json\`; não autoexecute resultado ambíguo.
|
|
436
446
|
5. Não use fonte externa de workspace para substituir a CLI local quando ela estiver operacional.
|
|
437
447
|
6. Chame docs-impacto com a intenção declarada antes de agir.
|
|
438
448
|
7. Chame inspecionar no contrato \`.sema\` aplicável.
|
|
439
|
-
8. Antes de editar código existente, rode drift e impacto.
|
|
449
|
+
8. Antes de editar código existente, rode \`sema drift --cache fresh\` e impacto.
|
|
440
450
|
9. Antes de criar ou editar \`.sema\`, use exemplos oficiais.
|
|
441
451
|
10. Ao concluir mudança de contrato, rode validar.
|
|
442
452
|
11. Antes de finalizar, use finalizar-mudanca com as docs lidas.
|
|
@@ -459,7 +469,7 @@ Timeout:
|
|
|
459
469
|
- Timeout local do agente não é falha do Sema.
|
|
460
470
|
- Se uma chamada Sema estourar, aumente o timeout e tente de novo antes de declarar bloqueio.
|
|
461
471
|
- Para projeto inteiro, comece com ${politicaTimeout.timeoutInicialSegundos}s ou mais; se for lento, escale ${politicaTimeout.escalonamentoSegundos.map((segundos) => `${segundos}s`).join(" -> ")}.
|
|
462
|
-
- Se possível, reduza escopo para \`sema resumo <arquivo.sema> --micro --para mudanca\`.
|
|
472
|
+
- Se possível, reduza escopo para \`sema resumo <arquivo.sema> --micro --para mudanca --drift none\`.
|
|
463
473
|
|
|
464
474
|
Código governado:
|
|
465
475
|
- Mantenha o marcador \`${agentContextPack.politicaCodigoGovernado.marcador}\` em código gerado ou governado.
|
|
@@ -472,7 +482,8 @@ Código governado:
|
|
|
472
482
|
Sinal e evidência:
|
|
473
483
|
- 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.
|
|
474
484
|
- Palavra-chave ou regex passando não prova governança se contrato, código e comportamento não batem.
|
|
475
|
-
- \`
|
|
485
|
+
- \`resumo\` e \`inspecionar\` usam \`--drift none\` por padrão; campos derivados nulos significam não avaliados, nunca zero.
|
|
486
|
+
- \`sema drift --cache fresh --json\` com \`payload.sucesso:false\`, \`payload.vinculos_quebrados\`, \`payload.rotas_divergentes\` ou \`payload.impls_quebrados\` bloqueia fechamento. Cache persistente é aceleração, não prova final.
|
|
476
487
|
- Caminho fora do workspace local aberto pelo usuário não substitui a pasta local.
|
|
477
488
|
|
|
478
489
|
Acabamento visual e terminal:
|
|
@@ -624,20 +635,26 @@ function renderizarDocFluxoPraticoSemaLocal(_agentContextPack) {
|
|
|
624
635
|
This is the minimum workflow for Codex in a local workspace.
|
|
625
636
|
|
|
626
637
|
1. Read \`${ARQUIVO_SEMA_BOOT}\`.
|
|
627
|
-
2. Run \`sema --version\`.
|
|
628
|
-
3. Run \`sema resumo
|
|
638
|
+
2. Run \`sema --version\`. If the shell cannot find it, use \`$HOME/.sema/bin/sema\` on macOS/Linux. On Windows, PowerShell resolves \`sema.ps1\` from PATH and cmd.exe resolves \`sema.cmd\`; use \`& "$env:SystemRoot\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$HOME\\.sema\\bin\\sema-managed.ps1" --version\` as the absolute fallback. Only then declare the CLI unavailable.
|
|
639
|
+
3. Run \`sema resumo --drift none\` for contract-only orientation; request \`--drift cache\` or \`--drift fresh\` only when code evidence is needed.
|
|
629
640
|
4. Run \`sema docs-impacto --intencao "<change>" --json\`.
|
|
630
641
|
5. Read every required document returned by the command.
|
|
631
642
|
6. Read \`docs/commands.md\` before selecting a command or interpreting \`--saida\`.
|
|
632
643
|
7. If the right capability is unclear, run \`sema descobrir recomendar --intencao "<goal>" --json\`; do not auto-run ambiguous recommendations.
|
|
633
644
|
8. Use \`exemplos/\` and \`docs/syntax.md\` before creating or editing a contract.
|
|
634
|
-
9. Run \`sema drift\` and \`sema impacto\` before editing existing code.
|
|
645
|
+
9. Run \`sema drift --cache fresh\` and \`sema impacto\` before editing existing code.
|
|
635
646
|
10. Run \`sema formatar\` and \`sema validar\` after changing a \`.sema\` contract.
|
|
636
647
|
11. Run \`sema finalizar-mudanca\` with the documents read before closure.
|
|
637
648
|
|
|
638
649
|
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\`.
|
|
639
650
|
|
|
640
|
-
Closing rule: \`sema drift --json\` must return \`sucesso:true\`. If it reports \`sucesso:false\`, \`vinculos_quebrados\`, \`rotas_divergentes\`, or
|
|
651
|
+
Closing rule: the \`payload\` of \`sema drift --cache fresh --json\` must return \`sucesso:true\`. If it reports \`sucesso:false\`, \`vinculos_quebrados\`, \`rotas_divergentes\`, or \`impls_quebrados\`, the task is still blocked. Passing unit tests or a cache hit do not replace fresh green drift. In 3.0.0, \`ok\` describes the CLI result path and never replaces a command-specific domain verdict.
|
|
652
|
+
|
|
653
|
+
Focused drift rule: file and module scopes plan their physical file set before cataloging. They never fall back to a whole-project walk when no safe anchor exists. All indexers and semantic-budget checks reuse the same in-memory source read; a global walk is reserved for explicit \`--escopo projeto\`. Code discovery is deferred until that plan exists, homonymous candidates fail as ambiguous, and configured contract origins or code roots resolving outside the workspace are rejected before enumeration. \`inspecionar\`, \`impacto\`, and \`renomear-semantico\` preserve the same directed boundary. Missing local dependencies make coverage partial and block success.
|
|
654
|
+
|
|
655
|
+
Cache rule: a closure gate should use \`sema drift <contrato> --escopo modulo --cache fresh --json\`. \`--cache none\` executes the same analysis without persistent-cache I/O, while \`--cache cache\` may reuse only extraction data whose schema, workspace identity, Git HEAD, plan, configuration, contracts, member paths, and strong content digests all match. Cache objects are stored in the operating system's user-cache directory, never below the workspace. A hit is acceleration, not evidence: final links, diagnostics, score, and success are always recalculated. Corruption or an unavailable cache degrades to an in-memory calculation.
|
|
656
|
+
|
|
657
|
+
Query honesty rule: \`resumo\` and \`inspecionar\` default to \`--drift none\`. When analysis is skipped, score, confidence, implementation, routes, and other unobserved code claims inside the command payload must be \`null\` or explicitly marked not evaluated; zero is not a substitute for absent evidence.
|
|
641
658
|
|
|
642
659
|
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.
|
|
643
660
|
|
|
@@ -673,20 +690,31 @@ Use this file when Codex does not know which command to run. A Sema command is a
|
|
|
673
690
|
## Minimum Local Flow
|
|
674
691
|
|
|
675
692
|
\`\`\`bash
|
|
676
|
-
sema --version
|
|
677
|
-
sema resumo
|
|
678
|
-
sema docs-impacto --intencao "<acao>" --json
|
|
679
|
-
\`\`\`
|
|
680
|
-
|
|
681
|
-
|
|
693
|
+
sema --version
|
|
694
|
+
sema resumo --drift none
|
|
695
|
+
sema docs-impacto --intencao "<acao>" --json
|
|
696
|
+
\`\`\`
|
|
697
|
+
|
|
698
|
+
If \`sema\` is absent from \`PATH\`, use \`$HOME/.sema/bin/sema\` on macOS/Linux. On Windows, PowerShell resolves \`sema.ps1\` from PATH, cmd.exe resolves \`sema.cmd\`, and the absolute fallback is \`& "$env:SystemRoot\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$HOME\\.sema\\bin\\sema-managed.ps1" --version\`. \`sema skill sync --json\` repairs launcher and skill without touching the workspace or plugin caches.
|
|
682
699
|
|
|
683
|
-
|
|
700
|
+
Then read every required doc returned by \`docs-impacto\`.
|
|
701
|
+
|
|
702
|
+
## Public JSON output
|
|
703
|
+
|
|
704
|
+
\`sema --version\` stays plain exact SemVer text. With \`--json\`, help and command-control failures use exactly one six-field \`sema.cli.control/v1\` document on stdout with empty stderr. Every syntactically valid command uses exactly one eight-field \`sema.cli.result/v1\` document containing only \`schemaVersion\`, \`ok\`, \`kind\`, \`command\`, \`code\`, \`message\`, \`exitCode\`, and \`payload\`. The command-specific result is nested under \`payload\`, never \`data\`; envelope \`ok\` does not replace domain fields inside that payload. Valid structured domain failures use \`DOMAIN_ERROR\`, while uncaught runtime exceptions remain redacted \`FATAL_ERROR\` control failures.
|
|
705
|
+
|
|
706
|
+
## Global Distribution
|
|
707
|
+
|
|
708
|
+
- \`sema skill status --json\`: diagnoses the managed launcher and bundled skill without writing.
|
|
709
|
+
- \`sema skill sync --json\`: repairs only Sema-managed launcher and skill destinations; it never writes into the workspace or plugin caches.
|
|
710
|
+
|
|
711
|
+
## Contract and Discovery
|
|
684
712
|
|
|
685
713
|
- \`sema iniciar --template <template> [--force]\`: creates a new Sema project and preserves existing files by default; \`--force\` is the only explicit overwrite path.
|
|
686
714
|
- \`sema validar <arquivo-ou-pasta> --json\`: validates \`.sema\` contracts.
|
|
687
715
|
- \`sema diagnosticos <arquivo.sema> --json\`: details errors and warnings.
|
|
688
716
|
- \`sema formatar <arquivo-ou-pasta>\`: formats contracts.
|
|
689
|
-
- \`sema inspecionar <arquivo-ou-pasta> --json\`: shows
|
|
717
|
+
- \`sema inspecionar <arquivo-ou-pasta> [--drift <none|cache|fresh>] --json\`: shows the contract surface; drift is skipped by default.
|
|
690
718
|
- \`sema ast <arquivo.sema> --json\`: shows AST for syntax debugging.
|
|
691
719
|
- \`sema ir <arquivo.sema> --json\`: shows the IR used by gates and generators.
|
|
692
720
|
- \`sema descobrir catalogo --json\`: lists governance flows, profiles, specialized workflows, pipelines, generators, capability tokens, and adapters from their canonical registries.
|
|
@@ -697,12 +725,24 @@ Then read every required doc returned by \`docs-impacto\`.
|
|
|
697
725
|
## Change and Closure
|
|
698
726
|
|
|
699
727
|
- \`sema docs-impacto --intencao "<acao>" --json\`: discovers required docs and documentary blockers.
|
|
700
|
-
- \`sema drift <arquivo-ou-pasta> --escopo modulo --json\`: compares contract and implementation.
|
|
728
|
+
- \`sema drift <arquivo-ou-pasta> --escopo modulo [--cache <none|cache|fresh>] --json\`: plans a safe physical scope, then compares contract and implementation without a global fallback.
|
|
701
729
|
- \`sema impacto <arquivo-ou-pasta> --alvo <token> --mudanca "<descricao>" --json\`: maps impact before changing behavior.
|
|
702
730
|
- \`sema verificar <arquivo-ou-pasta> --json\`: runs aggregated final verification.
|
|
703
731
|
- \`sema finalizar-mudanca --intencao "<acao>" --doc-lida <arquivo> --json\`: proves documentation reading before closure.
|
|
704
732
|
|
|
705
|
-
Honest closure:
|
|
733
|
+
Honest closure: unwrap drift JSON and treat its command payload as the source of truth. \`payload.sucesso:false\`, non-empty \`payload.vinculos_quebrados\`, non-empty \`payload.rotas_divergentes\`, or non-empty \`payload.impls_quebrados\` mean the change is not complete yet. Do not report "clean drift" without a green payload.
|
|
734
|
+
|
|
735
|
+
Focused drift exposes its planned, declared, inferred, and missing files plus catalog visit/read metrics in \`escopo_aplicado\`. File and module scopes fail closed without a safe anchor, with homonymous implementation candidates, or with missing local dependencies; only \`--escopo projeto\` may walk every configured code root. Logical roots such as \`src\` are probed deterministically without a discovery walk. Configured contract origins and code roots are confined before enumeration, and \`inspecionar\`, \`impacto\`, and \`renomear-semantico\` reuse the same directed boundary without reopening arbitrary external paths.
|
|
736
|
+
|
|
737
|
+
Drift analysis and cache modes are explicit:
|
|
738
|
+
|
|
739
|
+
- \`sema drift\` defaults to \`--cache fresh\`. \`none\` still executes drift but performs zero persistent-cache I/O; \`cache\` reuses a fully validated extraction hit and publishes misses; \`fresh\` ignores hits, recalculates, and publishes the new extraction.
|
|
740
|
+
- \`sema resumo\` and \`sema inspecionar\` default to \`--drift none\`. In that mode their payload does not execute drift and returns \`null\` for score, confidence, implementation, routes, or other code evidence that was not observed. Use \`--drift cache\` or \`--drift fresh\` when that evidence is required. \`--com-drift\` remains a temporary alias for \`--drift fresh\`.
|
|
741
|
+
- When a query explicitly runs drift, \`payload.analiseDrift.sucesso\` exposes the result and a failed requested analysis returns a nonzero exit code.
|
|
742
|
+
- The value aliases \`off\`, \`auto\`, and \`refresh\` normalize to \`none\`, \`cache\`, and \`fresh\` for one compatibility release and emit a structured deprecation warning. Wrong flags, repeated flags, conflicts, and invalid values fail instead of falling back silently.
|
|
743
|
+
- Persistent cache objects live outside the workspace under the operating system's user-cache directory. Workspace identity is hashed; public JSON and events expose only an opaque key and \`$SEMA_CACHE/...\` paths. Corruption or cache unavailability becomes a miss and never changes the drift result. Only validated extraction data is reused; links, diagnostics, scores, and the final success decision are recalculated.
|
|
744
|
+
|
|
745
|
+
A cache hit is acceleration, not final evidence; closure still requires fresh drift.
|
|
706
746
|
|
|
707
747
|
## Sema Code
|
|
708
748
|
|
|
@@ -729,7 +769,8 @@ Ready UI rule: if the task generates an app, site, dashboard, form, or static HT
|
|
|
729
769
|
|
|
730
770
|
- \`sema ajuda-ia\`: short guidance for Codex.
|
|
731
771
|
- \`sema starter-ia\`: operational starter.
|
|
732
|
-
- \`sema contexto-ia <arquivo.sema> --saida <dir> --json\`: AI context package.
|
|
772
|
+
- \`sema contexto-ia <arquivo.sema> --saida <dir> --json\`: AI context package.
|
|
773
|
+
- \`sema resumo <arquivo-ou-pasta> [--drift <none|cache|fresh>] --json\`: compact context; drift is not executed unless requested.
|
|
733
774
|
- \`sema prompt-curto <arquivo-ou-pasta> --json\`: compact prompt.
|
|
734
775
|
- \`sema sync-codex --json\`: synchronizes the official Codex entrypoint and local support docs.
|
|
735
776
|
- \`sema instalar-exemplos --json\`: installs official examples in the workspace.
|
|
@@ -751,34 +792,34 @@ Ready UI rule: if the task generates an app, site, dashboard, form, or static HT
|
|
|
751
792
|
- \`sema conteudo planejar <definition.json> --alvos-arquivo <targets.json> --json\`: creates a declarative multi-target plan for an external runner.
|
|
752
793
|
- \`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.
|
|
753
794
|
- \`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.
|
|
754
|
-
- \`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 its \`targetSetDigest\`, then derives verdicts, operational conditions, completion, and next actions from canonical events.
|
|
795
|
+
- \`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 its \`targetSetDigest\`, then derives verdicts, operational conditions, completion, and next actions from canonical events.
|
|
755
796
|
- \`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.
|
|
756
797
|
|
|
757
|
-
The content command is an AI-native, multi-channel, multi-format control plane. It 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 \`runId\`, definition, ledger, trust root, gates, complete target set, and the full \`issuedAt\`/\`expiresAt\` authorization window; no event may be recorded outside it. 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. 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 \`content.evidence.attest:<evidenceType>\` capability; adapter evidence requires \`content.adapter.attest:<adapterId>@<version>:<evidenceType>\` plus signed adapter binding.
|
|
798
|
+
The content command is an AI-native, multi-channel, multi-format control plane. It 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 \`runId\`, definition, ledger, trust root, gates, complete target set, and the full \`issuedAt\`/\`expiresAt\` authorization window; no event may be recorded outside it. 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. 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 \`content.evidence.attest:<evidenceType>\` capability; adapter evidence requires \`content.adapter.attest:<adapterId>@<version>:<evidenceType>\` plus signed adapter binding.
|
|
758
799
|
|
|
759
|
-
Verdicts such as \`APROVADO\`, \`REPROVADO\`, and \`INCONCLUSIVO\` remain separate from operational conditions such as \`AGUARDANDO_EVENTO_EXTERNO\` and \`FERRAMENTA_INDISPONIVEL\`. A generated manifest is only a projection and cannot alter canonical state.
|
|
800
|
+
Verdicts such as \`APROVADO\`, \`REPROVADO\`, and \`INCONCLUSIVO\` remain separate from operational conditions such as \`AGUARDANDO_EVENTO_EXTERNO\` and \`FERRAMENTA_INDISPONIVEL\`. A generated manifest is only a projection and cannot alter canonical state.
|
|
760
801
|
|
|
761
|
-
Local NDJSON plus a hash chain is portable evidence for replay, not a strong append-only trust boundary. Retain \`expectedHead\`, the canonical trust-root digest, and the current revocation digest externally, or use protected storage for high assurance. The trust-root pin identifies the authority snapshot independently from the revocation overlay. A workspace-local trust file additionally requires \`--development-local-trust\`; the flag does not disable digest pinning. Append freshness uses the platform clock rather than caller-provided \`recordedAt\`, and an authority in the current revocation overlay cannot sign an accepted policy.
|
|
802
|
+
Local NDJSON plus a hash chain is portable evidence for replay, not a strong append-only trust boundary. Retain \`expectedHead\`, the canonical trust-root digest, and the current revocation digest externally, or use protected storage for high assurance. The trust-root pin identifies the authority snapshot independently from the revocation overlay. A workspace-local trust file additionally requires \`--development-local-trust\`; the flag does not disable digest pinning. Append freshness uses the platform clock rather than caller-provided \`recordedAt\`, and an authority in the current revocation overlay cannot sign an accepted policy.
|
|
762
803
|
|
|
763
804
|
## AI-native Interactive Systems
|
|
764
805
|
|
|
765
806
|
- \`sema interativo capabilities --json\`: lists the canonical interactive capability vocabulary.
|
|
766
|
-
- \`sema interativo schema --json\`: exposes the stable read-only definition schema, enum matrix, constraints, extension-command and data-schema shapes, plus canonical example paths for AI clients.
|
|
807
|
+
- \`sema interativo schema --json\`: exposes the stable read-only definition schema, enum matrix, constraints, extension-command and data-schema shapes, plus canonical example paths for AI clients.
|
|
767
808
|
- \`sema interativo pipelines --json\`: lists reusable game, simulation, and hybrid pipelines.
|
|
768
809
|
- \`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.
|
|
769
810
|
- \`sema interativo validar <definition.json> --json\`: validates independent kind, spatial model, render mode, visual profile, fidelity, control, time, world, budget, pipeline, and acceptance axes.
|
|
770
811
|
- \`sema interativo planejar <definition.json> --json\`: expands compatible stages and required evidence without running an engine.
|
|
771
812
|
- \`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.
|
|
772
813
|
- \`sema interativo validar-protocolo <adapter-run.json> --json\`: checks DETECT/PROBE/SNAPSHOT/PLAN/APPLY/VALIDATE/EVIDENCE/ROLLBACK ordering and stable target binding.
|
|
773
|
-
- Experience IR: \`validar-ir\`, \`indexar-ir\`, \`consultar-ir --semantic-id <id>\`, \`chunk-ir --semantic-id <id> [--raso]\`, and \`descrever-ir\`.
|
|
774
|
-
- Operational state: \`validar-engine-snapshot\`, \`diff-engine-snapshots\`, \`validar-asset-provenance\`, \`validar-editor-state\`, \`planejar-jobs\`, \`validar-acceptance\`, \`operar-acceptance --operation <VALIDATE|EVALUATE|INVALIDATE> --context-file <file>\`, and \`validar-multimodal\`.
|
|
775
|
-
- Temporal, autonomy, and testing: \`validar-temporal\`, \`validar-evidencia-temporal --bundle-arquivo <file>\`, \`validar-autonomia\`, \`validar-playtest-fuzz\`, and \`validar-multiplayer\`.
|
|
776
|
-
- Portability and workers: \`analisar-portabilidade\` and \`validar-workers\`.
|
|
777
|
-
- \`sema interativo validar-control-run <control-run.json> --definition-arquivo <definition.json> --plano-arquivo <plan.json> --contrato-arquivo <validation-contract.json> --entrada-arquivo <input.json> [--entrada-auxiliar-arquivo <supporting-input.json>] --evidencia-arquivo <evidence.json> --resultado-arquivo <result.json> --json\`: binds one advanced validation to its complete local digest chain instead of trusting a standalone result.
|
|
778
|
-
|
|
779
|
-
The control-run command recomputes the canonical plan and selected pure validator, then verifies the definition, pipeline descriptor, validation contract, schema-declared inputs, evidence, and result digests. Prefix advanced items with \`sema interativo\` and pass the documented JSON file as the positional argument; an agent does not have to infer the validator or payload shape from a filename or visual style. The machine-readable schema publishes command maps, input/output schema links, required top-level fields, \`outputTargets\` path segments from the payload root, at least one real output shape per command, and official fixtures for all 20 advanced commands. Validation-result shapes describe \`payload.resultado\`; projected IR values use \`indice\`, \`entry\`, \`chunk\`, or \`descriptor\`; operation projections such as \`engineDiff\` and \`jobOrchestrationPlan\` live under \`payload.resultado.value\`; the job plan's ordered \`queue\` is the assignment list and exposes kind, priority, adapter, dependencies, locks, budgets, heartbeat, checkpoint, and recovery data.
|
|
780
|
-
|
|
781
|
-
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 rejects unknown, duplicate, missing-value, or invalid-enum arguments, remains local, read-only, and non-authoritative, and leaves engine/editor execution, authorization, mutation, rollback, migration, rendering, playtest, and worker scheduling to external runners. Full local coverage is \`STRUCTURALLY_COMPLETE\`, never authoritative completion, and a local evidence bundle is never presented as authoritative trust.
|
|
814
|
+
- Experience IR: \`validar-ir\`, \`indexar-ir\`, \`consultar-ir --semantic-id <id>\`, \`chunk-ir --semantic-id <id> [--raso]\`, and \`descrever-ir\`.
|
|
815
|
+
- Operational state: \`validar-engine-snapshot\`, \`diff-engine-snapshots\`, \`validar-asset-provenance\`, \`validar-editor-state\`, \`planejar-jobs\`, \`validar-acceptance\`, \`operar-acceptance --operation <VALIDATE|EVALUATE|INVALIDATE> --context-file <file>\`, and \`validar-multimodal\`.
|
|
816
|
+
- Temporal, autonomy, and testing: \`validar-temporal\`, \`validar-evidencia-temporal --bundle-arquivo <file>\`, \`validar-autonomia\`, \`validar-playtest-fuzz\`, and \`validar-multiplayer\`.
|
|
817
|
+
- Portability and workers: \`analisar-portabilidade\` and \`validar-workers\`.
|
|
818
|
+
- \`sema interativo validar-control-run <control-run.json> --definition-arquivo <definition.json> --plano-arquivo <plan.json> --contrato-arquivo <validation-contract.json> --entrada-arquivo <input.json> [--entrada-auxiliar-arquivo <supporting-input.json>] --evidencia-arquivo <evidence.json> --resultado-arquivo <result.json> --json\`: binds one advanced validation to its complete local digest chain instead of trusting a standalone result.
|
|
819
|
+
|
|
820
|
+
The control-run command recomputes the canonical plan and selected pure validator, then verifies the definition, pipeline descriptor, validation contract, schema-declared inputs, evidence, and result digests. Prefix advanced items with \`sema interativo\` and pass the documented JSON file as the positional argument; an agent does not have to infer the validator or payload shape from a filename or visual style. The machine-readable schema publishes command maps, input/output schema links, required top-level fields, \`outputTargets\` path segments from the payload root, at least one real output shape per command, and official fixtures for all 20 advanced commands. Validation-result shapes describe \`payload.resultado\`; projected IR values use \`indice\`, \`entry\`, \`chunk\`, or \`descriptor\`; operation projections such as \`engineDiff\` and \`jobOrchestrationPlan\` live under \`payload.resultado.value\`; the job plan's ordered \`queue\` is the assignment list and exposes kind, priority, adapter, dependencies, locks, budgets, heartbeat, checkpoint, and recovery data.
|
|
821
|
+
|
|
822
|
+
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 rejects unknown, duplicate, missing-value, or invalid-enum arguments, remains local, read-only, and non-authoritative, and leaves engine/editor execution, authorization, mutation, rollback, migration, rendering, playtest, and worker scheduling to external runners. Full local coverage is \`STRUCTURALLY_COMPLETE\`, never authoritative completion, and a local evidence bundle is never presented as authoritative trust.
|
|
782
823
|
|
|
783
824
|
## Operational
|
|
784
825
|
|
|
@@ -786,52 +827,17 @@ Spatial model and render mode are orthogonal: \`THREE_D + HEADLESS\` is valid, w
|
|
|
786
827
|
|
|
787
828
|
## Forbidden
|
|
788
829
|
|
|
789
|
-
- Do not use an external workspace source to inspect a local workspace when \`sema --version\` works.
|
|
830
|
+
- Do not use an external workspace source to inspect a local workspace when \`sema --version\` or the managed launcher works.
|
|
790
831
|
- Do not search the entire disk for \`.sema\` syntax; use \`exemplos/\`, \`docs/syntax.md\`, and this catalog.
|
|
791
832
|
- Do not stop after \`sema compilar\` if the contract target files still do not exist.
|
|
792
833
|
- Do not replace \`sema compilar\` with \`sema testar\` when the contract requires generated code.
|
|
793
834
|
- Do not create a Markdown report to pretend a gate ran.
|
|
794
|
-
- Do not say drift passed when \`sema drift --json\` returned \`sucesso:false\`,
|
|
835
|
+
- Do not say drift passed when the unwrapped \`sema drift --cache fresh --json\` payload returned \`sucesso:false\`, a non-empty \`vinculos_quebrados\`, \`rotas_divergentes\`, or \`impls_quebrados\` list.
|
|
795
836
|
- Do not declare a UI responsive without mobile/desktop proof; horizontal scroll at 390px blocks closure.
|
|
796
837
|
|
|
797
838
|
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.
|
|
798
839
|
`;
|
|
799
840
|
}
|
|
800
|
-
function renderizarAgentStarterLocal(_agentContextPack) {
|
|
801
|
-
return `# Codex Starter
|
|
802
|
-
|
|
803
|
-
Codex is operating in a Sema-governed project.
|
|
804
|
-
|
|
805
|
-
Read in this order:
|
|
806
|
-
|
|
807
|
-
1. \`${ARQUIVO_SEMA_BOOT}\`
|
|
808
|
-
2. \`${ARQUIVO_AGENT_CONTEXT_PACK}\`
|
|
809
|
-
3. \`SEMA_INDEX.json\`
|
|
810
|
-
4. \`AGENTS.md\`
|
|
811
|
-
5. \`docs/commands.md\`
|
|
812
|
-
6. \`docs/syntax.md\`
|
|
813
|
-
7. \`exemplos/\`
|
|
814
|
-
|
|
815
|
-
Basic commands:
|
|
816
|
-
|
|
817
|
-
\`\`\`bash
|
|
818
|
-
sema --version
|
|
819
|
-
sema resumo
|
|
820
|
-
sema docs-impacto --intencao "<acao>" --json
|
|
821
|
-
sema validar contratos/orders.sema --json
|
|
822
|
-
sema drift contratos/orders.sema --escopo modulo --json
|
|
823
|
-
sema compilar contratos/orders.sema --alvo javascript --saida ./generated/javascript
|
|
824
|
-
\`\`\`
|
|
825
|
-
|
|
826
|
-
Do not replace these gates with local search, guessing from a filename, or random contract reading outside the project.
|
|
827
|
-
|
|
828
|
-
Closure is not an opinion: \`sema drift --json\` must be green. \`sucesso:false\`, \`vinculos_quebrados\`, \`rotas_divergentes\`, or broken impls block closure.
|
|
829
|
-
|
|
830
|
-
Ready UI requires proof: desktop/mobile and a narrow viewport without horizontal overflow (\`scrollWidth <= clientWidth\`).
|
|
831
|
-
|
|
832
|
-
Keep \`SEMA-GOVERNED\` markers and follow the applicable contract before editing governed code.
|
|
833
|
-
`;
|
|
834
|
-
}
|
|
835
841
|
export async function sincronizarEntrypointCodex(baseProjeto, agentContextPack) {
|
|
836
842
|
const resultados = [];
|
|
837
843
|
await validarDestinosEscritaWorkspace(baseProjeto, listarDestinosEntrypointCodex(agentContextPack.entrypointCodex));
|
|
@@ -869,10 +875,15 @@ export async function sincronizarEntrypointCodex(baseProjeto, agentContextPack)
|
|
|
869
875
|
codexNativo: true,
|
|
870
876
|
cliLocalSemAutorizacao: true,
|
|
871
877
|
skillBootstrapCodexDocumentada: true,
|
|
878
|
+
launcherGlobalFallbackDocumentado: true,
|
|
879
|
+
cliIndisponivelSomenteAposFallback: true,
|
|
880
|
+
skillGlobalDelegaAgentsMd: true,
|
|
872
881
|
idiomaHumanoPreservado: true,
|
|
873
882
|
retryTimeoutProgressivo: true,
|
|
874
883
|
politicaPlataformaExplicita: true,
|
|
875
884
|
politicaSinalVsRitualExplicita: true,
|
|
885
|
+
politicaModosDriftExplicita: true,
|
|
886
|
+
docsComandos: true,
|
|
876
887
|
divisaoPorResponsabilidadeExplicita: true,
|
|
877
888
|
contextoLocalSemEspelho: true,
|
|
878
889
|
destinosEntrypointPrevalidados: true,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
1
2
|
export interface SuperficieAngularStandaloneConsumer {
|
|
2
3
|
rota: string;
|
|
3
4
|
arquivo: string;
|
|
4
5
|
tipoArquivo: "app" | "component";
|
|
5
6
|
}
|
|
6
|
-
export
|
|
7
|
+
export type LeitorTextoAngularConsumer = (arquivo: string) => Promise<string>;
|
|
8
|
+
export declare function coletarSuperficiesAngularStandaloneConsumer(baseProjeto: string, arquivos: string[], leitorTexto?: LeitorTextoAngularConsumer, sourceFiles?: ReadonlyMap<string, ts.SourceFile>): Promise<SuperficieAngularStandaloneConsumer[]>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// SEMA-GOVERNED: sema.produto.governanca_ia.drift
|
|
2
|
+
// Descricao: extrai superficies Angular com leitura compartilhada opcional, sem manter cache proprio.
|
|
1
3
|
import { readFile } from "node:fs/promises";
|
|
2
4
|
import path from "node:path";
|
|
3
5
|
import ts from "typescript";
|
|
@@ -134,7 +136,7 @@ function extrairIdentificadorImportado(expressao) {
|
|
|
134
136
|
}
|
|
135
137
|
return undefined;
|
|
136
138
|
}
|
|
137
|
-
async function extrairTemplateAngularStandalone(baseProjeto, relacaoArquivo, metadata) {
|
|
139
|
+
async function extrairTemplateAngularStandalone(baseProjeto, relacaoArquivo, metadata, leitorTexto) {
|
|
138
140
|
const templateInline = extrairTextoLiteral(obterExpressaoPropriedade(metadata, "template"));
|
|
139
141
|
if (templateInline) {
|
|
140
142
|
return templateInline;
|
|
@@ -148,19 +150,21 @@ async function extrairTemplateAngularStandalone(baseProjeto, relacaoArquivo, met
|
|
|
148
150
|
return "";
|
|
149
151
|
}
|
|
150
152
|
try {
|
|
151
|
-
|
|
153
|
+
const arquivo = path.join(baseProjeto, templateRelativo);
|
|
154
|
+
return leitorTexto ? await leitorTexto(arquivo) : await readFile(arquivo, "utf8");
|
|
152
155
|
}
|
|
153
156
|
catch {
|
|
154
157
|
return "";
|
|
155
158
|
}
|
|
156
159
|
}
|
|
157
|
-
async function indexarComponenteAngularStandalone(baseProjeto, arquivo) {
|
|
160
|
+
async function indexarComponenteAngularStandalone(baseProjeto, arquivo, leitorTexto, sourceFiles) {
|
|
158
161
|
const relacaoArquivo = normalizarCaminhoConsumer(path.relative(baseProjeto, arquivo));
|
|
159
162
|
if (!arquivoEhComponenteAngularStandalone(relacaoArquivo)) {
|
|
160
163
|
return undefined;
|
|
161
164
|
}
|
|
162
|
-
const codigo = await readFile(arquivo, "utf8");
|
|
163
|
-
const sourceFile =
|
|
165
|
+
const codigo = leitorTexto ? await leitorTexto(arquivo) : await readFile(arquivo, "utf8");
|
|
166
|
+
const sourceFile = sourceFiles?.get(path.resolve(arquivo))
|
|
167
|
+
?? ts.createSourceFile(arquivo, codigo, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
164
168
|
const imports = extrairImportsTypeScriptAngular(relacaoArquivo, codigo);
|
|
165
169
|
for (const statement of sourceFile.statements) {
|
|
166
170
|
if (!ts.isClassDeclaration(statement)) {
|
|
@@ -192,7 +196,7 @@ async function indexarComponenteAngularStandalone(baseProjeto, arquivo) {
|
|
|
192
196
|
arquivo: relacaoArquivo,
|
|
193
197
|
selector: extrairTextoLiteral(obterExpressaoPropriedade(metadata, "selector")),
|
|
194
198
|
imports: [...importsArquivos],
|
|
195
|
-
template: await extrairTemplateAngularStandalone(baseProjeto, relacaoArquivo, metadata),
|
|
199
|
+
template: await extrairTemplateAngularStandalone(baseProjeto, relacaoArquivo, metadata, leitorTexto),
|
|
196
200
|
raiz: arquivoEhRaizAngularStandalone(relacaoArquivo),
|
|
197
201
|
};
|
|
198
202
|
}
|
|
@@ -205,10 +209,10 @@ function templateReferenciaSelector(template, selector) {
|
|
|
205
209
|
const escapado = selector.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
206
210
|
return new RegExp(`<${escapado}(?:\\s|>)`, "i").test(template);
|
|
207
211
|
}
|
|
208
|
-
export async function coletarSuperficiesAngularStandaloneConsumer(baseProjeto, arquivos) {
|
|
212
|
+
export async function coletarSuperficiesAngularStandaloneConsumer(baseProjeto, arquivos, leitorTexto, sourceFiles) {
|
|
209
213
|
const componentes = new Map();
|
|
210
214
|
for (const arquivo of arquivos) {
|
|
211
|
-
const componente = await indexarComponenteAngularStandalone(baseProjeto, arquivo);
|
|
215
|
+
const componente = await indexarComponenteAngularStandalone(baseProjeto, arquivo, leitorTexto, sourceFiles);
|
|
212
216
|
if (componente) {
|
|
213
217
|
componentes.set(componente.arquivo, componente);
|
|
214
218
|
}
|
package/dist/bin.d.ts
ADDED