@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/docs/cli.md
CHANGED
|
@@ -1,79 +1,197 @@
|
|
|
1
|
-
# Sema CLI
|
|
2
|
-
|
|
3
|
-
Sema is a Codex-native local CLI distribution. The public package reads the
|
|
4
|
-
workspace on the user's machine, validates `.sema` contracts, checks drift,
|
|
5
|
-
maps impact, and generates code without login, user authorization, license
|
|
6
|
-
activation, tokens, credits, billing services, a control panel, or external
|
|
7
|
-
service credentials.
|
|
8
|
-
|
|
9
|
-
Support: suporte@otimitare.online
|
|
10
|
-
|
|
11
|
-
## Install
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npm install -g @semacode/cli
|
|
15
|
-
sema --version
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
1
|
+
# Sema CLI
|
|
2
|
+
|
|
3
|
+
Sema is a Codex-native local CLI distribution. The public package reads the
|
|
4
|
+
workspace on the user's machine, validates `.sema` contracts, checks drift,
|
|
5
|
+
maps impact, and generates code without login, user authorization, license
|
|
6
|
+
activation, tokens, credits, billing services, a control panel, or external
|
|
7
|
+
service credentials.
|
|
8
|
+
|
|
9
|
+
Support: suporte@otimitare.online
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install -g @semacode/cli
|
|
15
|
+
sema --version
|
|
16
|
+
sema skill status --json
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The global install bundles the portable Sema skill and creates a launcher under
|
|
20
|
+
`~/.sema/bin` with absolute Node.js and CLI paths. If the npm shim is absent
|
|
21
|
+
from `PATH`, run `~/.sema/bin/sema` on macOS/Linux. On Windows, PowerShell
|
|
22
|
+
resolves `sema.ps1` from `PATH`, while `cmd.exe` resolves `sema.cmd`; invoke the
|
|
23
|
+
managed fallback through the absolute system executable:
|
|
24
|
+
|
|
25
|
+
```powershell
|
|
26
|
+
& "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "$HOME\.sema\bin\sema-managed.ps1" --version
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Use `sema skill sync --json` to repair an installation performed with lifecycle
|
|
30
|
+
scripts disabled.
|
|
31
|
+
|
|
32
|
+
For development inside this repository:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install
|
|
36
|
+
npm run build
|
|
37
|
+
node pacotes/cli/dist/bin.js --help
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Side-Effect-Free Help
|
|
41
|
+
|
|
42
|
+
`--help` and `-h` take precedence wherever they appear in argv, including after
|
|
43
|
+
an unknown command or option. The CLI exits with status `0` before command
|
|
44
|
+
runtime import, command dispatch, or handler resolution. Help does not inspect or mutate the workspace,
|
|
45
|
+
home, user cache, or plugin cache, start a subprocess, or make a network call.
|
|
46
|
+
|
|
47
|
+
`dist/bin.js` is the executable bootstrap and imports the operational runtime
|
|
48
|
+
only after these control paths finish. `dist/index.js` remains the package API
|
|
49
|
+
entrypoint and is not an executable alias.
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
sema iniciar --help
|
|
53
|
+
sema formatar --help
|
|
54
|
+
sema sync-codex --help
|
|
55
|
+
sema skill sync --help
|
|
56
|
+
sema unknown --option value --help
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Public JSON Output
|
|
60
|
+
|
|
61
|
+
`sema --version` (and its version aliases) prints one plain exact SemVer string.
|
|
62
|
+
It is intentionally not wrapped in JSON.
|
|
63
|
+
|
|
64
|
+
### Help and command control
|
|
65
|
+
|
|
66
|
+
Adding `--json` to help or a command-control failure emits exactly one JSON
|
|
67
|
+
document on stdout and keeps stderr empty:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"schemaVersion": "sema.cli.control/v1",
|
|
72
|
+
"ok": true,
|
|
73
|
+
"kind": "HELP",
|
|
74
|
+
"code": "CLI_HELP",
|
|
75
|
+
"message": "Sema CLI help",
|
|
76
|
+
"exitCode": 0
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
The envelope contains exactly `schemaVersion`, `ok`, `kind`, `code`, `message`,
|
|
81
|
+
and `exitCode`. Supported control kinds are `HELP`, `UNKNOWN_COMMAND`,
|
|
82
|
+
`ARGUMENT_ERROR`, and `FATAL_ERROR`. Help uses exit code `0`; failures preserve
|
|
83
|
+
a non-zero process status equal to `exitCode`. Failure messages are public and
|
|
84
|
+
redacted: they do not include stacks, absolute paths, raw argv, or internal
|
|
85
|
+
causes.
|
|
86
|
+
|
|
87
|
+
Command-control failures are unknown top-level commands or subcommands, missing
|
|
88
|
+
or invalid required CLI arguments/options rejected before valid dispatch, and
|
|
89
|
+
uncaught runtime exceptions. An uncaught exception uses the redacted
|
|
90
|
+
`FATAL_ERROR` control envelope. `sema.cli.control/v1` is never nested inside a
|
|
91
|
+
command result.
|
|
92
|
+
|
|
93
|
+
### Valid command results
|
|
94
|
+
|
|
95
|
+
In 3.0.0, every syntactically valid command invoked with `--json` emits exactly
|
|
96
|
+
one `sema.cli.result/v1` document on stdout with empty stderr:
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"schemaVersion": "sema.cli.result/v1",
|
|
101
|
+
"ok": true,
|
|
102
|
+
"kind": "SUCCESS",
|
|
103
|
+
"command": "resumo",
|
|
104
|
+
"code": "CLI_SUCCESS",
|
|
105
|
+
"message": null,
|
|
106
|
+
"exitCode": 0,
|
|
107
|
+
"payload": {
|
|
108
|
+
"comando": "resumo",
|
|
109
|
+
"sucesso": true
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The result envelope contains exactly `schemaVersion`, `ok`, `kind`, `command`,
|
|
115
|
+
`code`, `message`, `exitCode`, and `payload`; extra or missing fields are
|
|
116
|
+
invalid, and `data` is not an alias for `payload`. `command` is the canonical
|
|
117
|
+
top-level command name. `payload` is always present and may be any JSON value,
|
|
118
|
+
including an object, array, scalar, or `null`.
|
|
119
|
+
|
|
120
|
+
- `SUCCESS` requires `ok: true`, `code: "CLI_SUCCESS"`, `message: null`, and
|
|
121
|
+
`exitCode: 0`.
|
|
122
|
+
- `DOMAIN_ERROR` requires `ok: false`, `code: "CLI_DOMAIN_ERROR"`, a non-empty
|
|
123
|
+
safe public `message`, and a positive `exitCode` equal to the process status.
|
|
124
|
+
|
|
125
|
+
The envelope describes the CLI result transport and classification. It does
|
|
126
|
+
not replace the command's domain model: consumers must unwrap `payload` and
|
|
127
|
+
evaluate fields such as `payload.sucesso`, `payload.aprovado`,
|
|
128
|
+
`payload.bloqueado`, or another command-specific verdict separately. A
|
|
129
|
+
syntactically valid operation that returns a structured domain failure uses
|
|
130
|
+
`DOMAIN_ERROR`; it does not fall back to `sema.cli.control/v1`.
|
|
131
|
+
|
|
132
|
+
## Codex Setup
|
|
133
|
+
|
|
134
|
+
`AGENTS.md` is the official Sema entrypoint for Codex. Create or refresh it from
|
|
135
|
+
the local CLI:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
sema sync-codex --json
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Codex automatically loads `AGENTS.md` as repository guidance. Sema is an
|
|
142
|
+
independent product and is not affiliated with or endorsed by OpenAI.
|
|
143
|
+
|
|
144
|
+
## Required Local Flow
|
|
145
|
+
|
|
146
|
+
Codex and humans should use the same local sequence before changing governed
|
|
147
|
+
code, contracts, workflows, release scripts, or operational docs:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
sema --version
|
|
151
|
+
sema resumo --drift none
|
|
152
|
+
sema docs-impacto --intencao "describe the change" --json
|
|
153
|
+
sema inspecionar contratos/example.sema --drift none --json
|
|
154
|
+
sema drift contratos/example.sema --escopo modulo --cache fresh --json
|
|
155
|
+
sema impacto contratos/example.sema --alvo sema.example.target --mudanca "describe the change" --json
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Commands run directly against the local workspace. If `sema --version` fails,
|
|
159
|
+
try the managed absolute launcher before declaring the CLI unavailable. If both
|
|
160
|
+
fail, install or repair the npm package; there is no separate authorization
|
|
161
|
+
gate.
|
|
162
|
+
|
|
163
|
+
## Core Commands
|
|
164
|
+
|
|
165
|
+
- `sema iniciar`: create a governed starting point.
|
|
166
|
+
- `sema validar`: validate `.sema` contracts.
|
|
167
|
+
- `sema inspecionar`: inspect the applicable contract surface; add `--drift cache|fresh` to request code evidence.
|
|
168
|
+
- `sema drift`: compare contracts and implementation with `--cache none|cache|fresh` (default `fresh`).
|
|
169
|
+
- `sema impacto`: map the blast radius of a planned change.
|
|
170
|
+
- `sema docs-impacto`: identify docs that must be read or updated.
|
|
171
|
+
- `sema finalizar-mudanca`: close the governed change with evidence.
|
|
172
|
+
- `sema compilar`: generate code from contracts.
|
|
173
|
+
- `sema testar`: generate, compile, and execute local contract tests, including `dotnet` and `cpp`.
|
|
174
|
+
- `sema verificar`: run the final local verification bundle.
|
|
175
|
+
- `sema contexto-ia`: build local AI context from a contract.
|
|
176
|
+
- `sema sync-codex`: create or refresh the official `AGENTS.md` entrypoint.
|
|
177
|
+
- `sema skill status|sync`: inspect or repair the managed launcher and bundled
|
|
178
|
+
global skill without touching plugin caches or workspace files.
|
|
179
|
+
|
|
180
|
+
`resumo` and `inspecionar` default to `--drift none`, so they do not fabricate
|
|
181
|
+
scores or implementation evidence. In this mode those fields inside `payload`
|
|
182
|
+
are `null` or explicitly not evaluated. `sema drift --cache none` still runs
|
|
183
|
+
the analysis but does not touch persistent cache. `cache` reuses only a validated extraction hit;
|
|
184
|
+
`fresh` ignores hits and republishes recalculated extraction data. Cache objects
|
|
185
|
+
live in the operating system's user-cache directory outside the workspace, and
|
|
186
|
+
the final links, diagnostics, score, and success decision are always recomputed.
|
|
187
|
+
|
|
188
|
+
Generation targets are `typescript`, `python`, `php`, `dart`, `lua`,
|
|
189
|
+
`javascript`, `html`, `css`, `dotnet`, and `cpp`. The aliases `cs` and
|
|
190
|
+
`csharp` select `dotnet`; `c++`, `cxx`, and `cc` select `cpp`.
|
|
191
|
+
Native targets are opt-in in `sema.config.json.alvos` for project-wide
|
|
192
|
+
verification because they require local compiler toolchains.
|
|
193
|
+
|
|
194
|
+
## Public Boundary
|
|
195
|
+
|
|
196
|
+
Do not publish private or sensitive operational material in public Sema
|
|
197
|
+
artifacts.
|
package/docs/commands.md
CHANGED
|
@@ -7,19 +7,30 @@ Use this file when Codex does not know which command to run. A Sema command is a
|
|
|
7
7
|
|
|
8
8
|
```bash
|
|
9
9
|
sema --version
|
|
10
|
-
sema resumo
|
|
10
|
+
sema resumo --drift none
|
|
11
11
|
sema docs-impacto --intencao "<acao>" --json
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
+
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.
|
|
15
|
+
|
|
14
16
|
Then read every required doc returned by `docs-impacto`.
|
|
15
17
|
|
|
18
|
+
## Public JSON output
|
|
19
|
+
|
|
20
|
+
`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.
|
|
21
|
+
|
|
22
|
+
## Global Distribution
|
|
23
|
+
|
|
24
|
+
- `sema skill status --json`: diagnoses the managed launcher and bundled skill without writing.
|
|
25
|
+
- `sema skill sync --json`: repairs only Sema-managed launcher and skill destinations; it never writes into the workspace or plugin caches.
|
|
26
|
+
|
|
16
27
|
## Contract and Discovery
|
|
17
28
|
|
|
18
29
|
- `sema iniciar --template <template> [--force]`: creates a new Sema project and preserves existing files by default; `--force` is the only explicit overwrite path.
|
|
19
30
|
- `sema validar <arquivo-ou-pasta> --json`: validates `.sema` contracts.
|
|
20
31
|
- `sema diagnosticos <arquivo.sema> --json`: details errors and warnings.
|
|
21
32
|
- `sema formatar <arquivo-ou-pasta>`: formats contracts.
|
|
22
|
-
- `sema inspecionar <arquivo-ou-pasta> --json`: shows
|
|
33
|
+
- `sema inspecionar <arquivo-ou-pasta> [--drift <none|cache|fresh>] --json`: shows the contract surface; drift is skipped by default.
|
|
23
34
|
- `sema ast <arquivo.sema> --json`: shows AST for syntax debugging.
|
|
24
35
|
- `sema ir <arquivo.sema> --json`: shows the IR used by gates and generators.
|
|
25
36
|
- `sema descobrir catalogo --json`: lists governance flows, profiles, specialized workflows, pipelines, generators, capability tokens, and adapters from their canonical registries.
|
|
@@ -30,12 +41,24 @@ Then read every required doc returned by `docs-impacto`.
|
|
|
30
41
|
## Change and Closure
|
|
31
42
|
|
|
32
43
|
- `sema docs-impacto --intencao "<acao>" --json`: discovers required docs and documentary blockers.
|
|
33
|
-
- `sema drift <arquivo-ou-pasta> --escopo modulo --json`: compares contract and implementation.
|
|
44
|
+
- `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.
|
|
34
45
|
- `sema impacto <arquivo-ou-pasta> --alvo <token> --mudanca "<descricao>" --json`: maps impact before changing behavior.
|
|
35
46
|
- `sema verificar <arquivo-ou-pasta> --json`: runs aggregated final verification.
|
|
36
47
|
- `sema finalizar-mudanca --intencao "<acao>" --doc-lida <arquivo> --json`: proves documentation reading before closure.
|
|
37
48
|
|
|
38
|
-
Honest closure:
|
|
49
|
+
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.
|
|
50
|
+
|
|
51
|
+
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.
|
|
52
|
+
|
|
53
|
+
Drift analysis and cache modes are explicit:
|
|
54
|
+
|
|
55
|
+
- `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.
|
|
56
|
+
- `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`.
|
|
57
|
+
- When a query explicitly runs drift, `payload.analiseDrift.sucesso` exposes the result and a failed requested analysis returns a nonzero exit code.
|
|
58
|
+
- 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.
|
|
59
|
+
- 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.
|
|
60
|
+
|
|
61
|
+
A cache hit is acceleration, not final evidence; closure still requires fresh drift.
|
|
39
62
|
|
|
40
63
|
## Sema Code
|
|
41
64
|
|
|
@@ -63,6 +86,7 @@ Ready UI rule: if the task generates an app, site, dashboard, form, or static HT
|
|
|
63
86
|
- `sema ajuda-ia`: short guidance for Codex.
|
|
64
87
|
- `sema starter-ia`: operational starter.
|
|
65
88
|
- `sema contexto-ia <arquivo.sema> --saida <dir> --json`: AI context package.
|
|
89
|
+
- `sema resumo <arquivo-ou-pasta> [--drift <none|cache|fresh>] --json`: compact context; drift is not executed unless requested.
|
|
66
90
|
- `sema prompt-curto <arquivo-ou-pasta> --json`: compact prompt.
|
|
67
91
|
- `sema sync-codex --json`: synchronizes the official Codex entrypoint and local support docs.
|
|
68
92
|
- `sema instalar-exemplos --json`: installs official examples in the workspace.
|
|
@@ -119,12 +143,12 @@ Spatial model and render mode are orthogonal: `THREE_D + HEADLESS` is valid, whi
|
|
|
119
143
|
|
|
120
144
|
## Forbidden
|
|
121
145
|
|
|
122
|
-
- Do not use an external workspace source to inspect a local workspace when `sema --version` works.
|
|
146
|
+
- Do not use an external workspace source to inspect a local workspace when `sema --version` or the managed launcher works.
|
|
123
147
|
- Do not search the entire disk for `.sema` syntax; use `exemplos/`, `docs/syntax.md`, and this catalog.
|
|
124
148
|
- Do not stop after `sema compilar` if the contract target files still do not exist.
|
|
125
149
|
- Do not replace `sema compilar` with `sema testar` when the contract requires generated code.
|
|
126
150
|
- Do not create a Markdown report to pretend a gate ran.
|
|
127
|
-
- Do not say drift passed when `sema drift --json` returned `sucesso:false`,
|
|
151
|
+
- 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.
|
|
128
152
|
- Do not declare a UI responsive without mobile/desktop proof; horizontal scroll at 390px blocks closure.
|
|
129
153
|
|
|
130
154
|
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.
|
package/docs/database.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
# Database Boundary
|
|
2
|
-
|
|
3
|
-
The public Sema CLI does not require a database.
|
|
4
|
-
|
|
5
|
-
Sema reads contracts and source files from the local workspace. Any database used
|
|
6
|
-
by an application governed by Sema belongs to that application, not to the public
|
|
7
|
-
Sema CLI distribution.
|
|
8
|
-
|
|
9
|
-
## Public Rule
|
|
10
|
-
|
|
11
|
-
Do not ship private database material, real credentials, operational schemas, or
|
|
12
|
-
project-specific data in the public Sema package.
|
|
13
|
-
|
|
14
|
-
Application-specific database docs should live in the application repository
|
|
15
|
-
that owns the database.
|
|
1
|
+
# Database Boundary
|
|
2
|
+
|
|
3
|
+
The public Sema CLI does not require a database.
|
|
4
|
+
|
|
5
|
+
Sema reads contracts and source files from the local workspace. Any database used
|
|
6
|
+
by an application governed by Sema belongs to that application, not to the public
|
|
7
|
+
Sema CLI distribution.
|
|
8
|
+
|
|
9
|
+
## Public Rule
|
|
10
|
+
|
|
11
|
+
Do not ship private database material, real credentials, operational schemas, or
|
|
12
|
+
project-specific data in the public Sema package.
|
|
13
|
+
|
|
14
|
+
Application-specific database docs should live in the application repository
|
|
15
|
+
that owns the database.
|
package/docs/deploy.md
CHANGED
|
@@ -1,41 +1,54 @@
|
|
|
1
|
-
# Deployment Boundary
|
|
2
|
-
|
|
3
|
-
The public Sema repository documents
|
|
4
|
-
local
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
npm run
|
|
12
|
-
npm run
|
|
13
|
-
npm run
|
|
14
|
-
npm run
|
|
15
|
-
npm
|
|
16
|
-
npm
|
|
17
|
-
npm run release:
|
|
18
|
-
npm run release:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
1
|
+
# Deployment Boundary
|
|
2
|
+
|
|
3
|
+
The public Sema repository documents one coordinated npm artifact containing
|
|
4
|
+
the local CLI, its absolute managed launcher, and the portable bootstrap skill.
|
|
5
|
+
The repository Codex plugin remains an optional namespaced distribution channel
|
|
6
|
+
for the same versioned skill.
|
|
7
|
+
|
|
8
|
+
Run the complete public gate:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm run build
|
|
12
|
+
npm run codex:sync-entrypoint
|
|
13
|
+
npm run status:check
|
|
14
|
+
npm run repo:verificar-publico
|
|
15
|
+
npm run plugin:testar-codex
|
|
16
|
+
npm test
|
|
17
|
+
npm run release:verificar-drift
|
|
18
|
+
npm run release:preparar-publica
|
|
19
|
+
npm run release:publicar-npm-dry-run
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`release:preparar-publica` performs the Codex entrypoint sync before checking
|
|
23
|
+
the public boundary, so a clean clone does not depend on ignored generated
|
|
24
|
+
handshake files left by a previous local run.
|
|
25
|
+
|
|
26
|
+
All release and local-install routes delegate to `npm run
|
|
27
|
+
cli:empacotar-publica`. The factory uses a unique private stage, disables npm
|
|
28
|
+
lifecycle scripts while packing that stage, and publishes only a fully
|
|
29
|
+
validated tarball. Do not use `npm pack --workspace @semacode/cli`; the source
|
|
30
|
+
package guard rejects that unsupported path without staging files in the
|
|
31
|
+
workspace.
|
|
32
|
+
|
|
33
|
+
The public-package smoke performs a global install with isolated home, npm
|
|
34
|
+
prefix, npm cache, and user cache. It proves the launcher works through its
|
|
35
|
+
absolute path with Node.js and npm removed from `PATH`. On Windows it exercises
|
|
36
|
+
`sema.ps1` as the PowerShell `PATH` entrypoint, `sema-managed.ps1` through the
|
|
37
|
+
absolute `%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe`, and
|
|
38
|
+
`sema.cmd` through `cmd.exe`. The smoke also proves the synchronized
|
|
39
|
+
skill matches the packaged source, the real user home is unchanged, and local
|
|
40
|
+
installs leave global state untouched. The plugin smoke independently compares
|
|
41
|
+
its cached skill with the versioned source and proves no Sema MCP server was
|
|
42
|
+
registered. Plugin and CLI versions must match before the commit is pushed.
|
|
43
|
+
|
|
44
|
+
Push the commit containing `.agents/plugins/marketplace.json` and
|
|
45
|
+
`plugins/sema/` before telling users to install from `gerlanss/Sema`. Publish
|
|
46
|
+
the npm package only after the tarball smoke passes. After npm publication, run
|
|
47
|
+
`npm run release:verificar-distribuicao` to verify the registry and live GitHub
|
|
48
|
+
state. That final verifier also requires the remote GitHub HEAD to match the
|
|
49
|
+
local commit, installs `sema@sema` from `gerlanss/Sema` in an isolated
|
|
50
|
+
`CODEX_HOME`, compares the remote skill with the versioned source, and proves
|
|
51
|
+
that the remote plugin registers no Sema MCP. The current contract does not
|
|
52
|
+
permit creating a GitHub Release or release asset.
|
|
53
|
+
|
|
54
|
+
Do not publish private or sensitive operational material in this repository.
|
package/docs/documentation.md
CHANGED
|
@@ -35,14 +35,15 @@ sema finalizar-mudanca \
|
|
|
35
35
|
- Keep commands, file paths, package names, environment variable names, and DSL
|
|
36
36
|
keywords literal.
|
|
37
37
|
- Do not include private or sensitive operational material.
|
|
38
|
-
- Prefer local CLI examples.
|
|
39
|
-
- Point support requests to suporte@otimitare.online.
|
|
40
|
-
|
|
41
|
-
## Contract
|
|
38
|
+
- Prefer local CLI examples.
|
|
39
|
+
- Point support requests to suporte@otimitare.online.
|
|
40
|
+
|
|
41
|
+
## Contract Structure
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
Documentation governance is split by capability: required-document resolution
|
|
44
|
+
stays in `governanca_ia_documentacao.sema`, while localization and
|
|
45
|
+
change-finalization evidence live in explicitly named child contracts. The
|
|
46
|
+
same rule applies to drift and semantic-budget governance: keep a cohesive
|
|
47
|
+
primary capability in the root contract and move secondary responsibilities to
|
|
48
|
+
named children. Preserve task names, guarantees, implementations, and
|
|
49
|
+
`vinculos`; never create numbered part files.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Drift Cache And Query Evidence
|
|
2
|
+
|
|
3
|
+
Sema exposes three drift modes, but the `none` mode intentionally means
|
|
4
|
+
different things for direct drift execution and for query commands. The
|
|
5
|
+
defaults preserve honest, low-cost queries while keeping an explicit drift run
|
|
6
|
+
fresh by default.
|
|
7
|
+
|
|
8
|
+
| Mode | `sema drift --cache <mode>` | `sema resumo --drift <mode>` / `sema inspecionar --drift <mode>` |
|
|
9
|
+
| --- | --- | --- |
|
|
10
|
+
| `none` | Runs drift without reading or writing persistent cache. | Skips drift analysis. This is the query default. |
|
|
11
|
+
| `cache` | Reuses a valid cache entry; otherwise recalculates and publishes a new entry. | Runs drift with the same reuse-or-recalculate behavior. |
|
|
12
|
+
| `fresh` | Does not reuse a prior hit, recalculates, and publishes a fresh entry. This is the direct drift default. | Runs drift from fresh inputs without reusing prior extraction data, then publishes the resulting entry. |
|
|
13
|
+
|
|
14
|
+
Use `--cache none` when a direct analysis must leave no persistent cache access.
|
|
15
|
+
Use `--drift none` when a summary or inspection should not perform drift at all.
|
|
16
|
+
The two forms are not interchangeable.
|
|
17
|
+
|
|
18
|
+
## Honest Query Evidence
|
|
19
|
+
|
|
20
|
+
`sema resumo` and `sema inspecionar` default to `--drift none`. Their JSON
|
|
21
|
+
payload includes an `analiseDrift` envelope that makes the omitted evaluation
|
|
22
|
+
explicit:
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"analiseDrift": {
|
|
27
|
+
"modo": "none",
|
|
28
|
+
"executada": false,
|
|
29
|
+
"sucesso": null,
|
|
30
|
+
"cache": null
|
|
31
|
+
},
|
|
32
|
+
"scoreDrift": null,
|
|
33
|
+
"confiancaGeral": null
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The surrounding payload varies by command. A human-readable `aviso` or
|
|
38
|
+
`avisos` entry explains why drift was not evaluated. Drift-derived framework,
|
|
39
|
+
route, surface, bridge, and module implementation evidence is also `null` when
|
|
40
|
+
applicable. In this context, `null` means **not evaluated**; it must never be
|
|
41
|
+
interpreted as zero, empty, passing, or absent drift.
|
|
42
|
+
|
|
43
|
+
Request `--drift cache` or `--drift fresh` when a query needs evaluated drift
|
|
44
|
+
evidence. In that case, `payload.analiseDrift.sucesso` is `true` or `false`, and a
|
|
45
|
+
failed requested analysis makes the command exit nonzero instead of hiding the
|
|
46
|
+
failure behind a successful query response.
|
|
47
|
+
|
|
48
|
+
## External Cache Location
|
|
49
|
+
|
|
50
|
+
Persistent drift cache is stored outside the governed workspace:
|
|
51
|
+
|
|
52
|
+
| Platform | Cache root |
|
|
53
|
+
| --- | --- |
|
|
54
|
+
| Windows | `%LOCALAPPDATA%\Sema\Cache`, falling back to `%USERPROFILE%\AppData\Local\Sema\Cache` |
|
|
55
|
+
| macOS | `~/Library/Caches/Sema` |
|
|
56
|
+
| Linux and other Unix systems | `$XDG_CACHE_HOME/sema`, falling back to `~/.cache/sema` |
|
|
57
|
+
|
|
58
|
+
Drift entries live below `drift/v3/workspaces/<opaque-id>/objects/` inside that
|
|
59
|
+
root. Public output represents such paths as `$SEMA_CACHE/drift/v3/...`.
|
|
60
|
+
`$SEMA_CACHE` is a safe display placeholder, not a promise that an environment
|
|
61
|
+
variable with that name exists, and Sema does not expose the real user cache
|
|
62
|
+
path.
|
|
63
|
+
|
|
64
|
+
Sema never writes persistent drift cache inside the repository, `.sema`,
|
|
65
|
+
`.tmp`, generated project folders, or any other workspace location.
|
|
66
|
+
|
|
67
|
+
## Authority And Recovery
|
|
68
|
+
|
|
69
|
+
The cache is an acceleration layer, not governance evidence and not a source of
|
|
70
|
+
truth. Contracts, source files, the active analysis plan, and the validated
|
|
71
|
+
result remain authoritative.
|
|
72
|
+
|
|
73
|
+
- A corrupt or incompatible entry is treated as a recoverable miss: Sema
|
|
74
|
+
recalculates instead of trusting it.
|
|
75
|
+
- If external cache storage is unavailable, analysis continues by
|
|
76
|
+
recalculating; cache persistence does not become a governance blocker.
|
|
77
|
+
- `cache` may reuse only a valid entry for the current workspace and inputs.
|
|
78
|
+
- `fresh` never reuses cached extraction data before analysis. Publication may
|
|
79
|
+
read and validate an existing content-addressed winner to preserve CAS
|
|
80
|
+
integrity without changing the freshly calculated result.
|
|
81
|
+
- Direct `none` performs no persistent cache reads or writes.
|
|
82
|
+
|
|
83
|
+
These rules keep cache failures from hiding drift and keep the governed
|
|
84
|
+
workspace free of machine-local state.
|
|
85
|
+
|
|
86
|
+
## Semantic Integrity And Trust Limit
|
|
87
|
+
|
|
88
|
+
The reusable payload stores canonical per-extractor indices. It does not store
|
|
89
|
+
`todosSimbolos`, route aggregates, resource aggregates, or known-file
|
|
90
|
+
aggregates as independent sources. Sema derives those values again after a
|
|
91
|
+
cache entry is restored, so a redundant aggregate cannot silently override its
|
|
92
|
+
source indices.
|
|
93
|
+
|
|
94
|
+
Before accepting a hit, Sema checks exact field allowlists, relative catalog
|
|
95
|
+
paths, extractor-specific file extensions and symbol origins, consumer-surface
|
|
96
|
+
to route relationships, and derived integrity digests across symbols, routes,
|
|
97
|
+
resources, surfaces, and persistence details. Detectable structural or
|
|
98
|
+
semantic inconsistency becomes a corrupt miss, followed by a fresh in-memory
|
|
99
|
+
calculation and repair. A valid hit is therefore limited to a compatible
|
|
100
|
+
payload produced for the same CLI, schema, extractor, workspace identity, Git
|
|
101
|
+
HEAD, plan, configuration, contracts, and content-digested members.
|
|
102
|
+
|
|
103
|
+
These SHA-256 digests detect corruption and incoherent rewriting; they do not
|
|
104
|
+
authenticate a hostile process running as the same operating-system user. Such
|
|
105
|
+
a process can read the implementation and rewrite both data and checksums. The
|
|
106
|
+
external cache is not a security boundary, a signature, or final evidence.
|
|
107
|
+
Use `--cache fresh` for closure and retain stronger evidence outside the local
|
|
108
|
+
user cache when the threat model includes local-user compromise.
|