@semacode/cli 2.3.1 → 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.
Files changed (250) hide show
  1. package/README.md +265 -217
  2. package/dist/agentContextPack.js +14 -10
  3. package/dist/agentEntryPoints.d.ts +5 -0
  4. package/dist/agentEntryPoints.js +567 -557
  5. package/dist/angular-consumer-standalone.js +1 -1
  6. package/dist/bin.d.ts +6 -0
  7. package/dist/bin.js +130 -0
  8. package/dist/cliArgs.js +4 -4
  9. package/dist/cliControlError.d.ts +12 -0
  10. package/dist/cliControlError.js +47 -0
  11. package/dist/cliGrammar.d.ts +11 -0
  12. package/dist/cliGrammar.js +551 -0
  13. package/dist/cliHelp.d.ts +13 -0
  14. package/dist/cliHelp.js +19 -0
  15. package/dist/cliHelpTexto.d.ts +3 -0
  16. package/dist/cliHelpTexto.js +168 -0
  17. package/dist/cliRuntime.d.ts +2 -0
  18. package/dist/cliRuntime.js +31 -0
  19. package/dist/comandos.js +9 -22
  20. package/dist/contexto.js +5 -5
  21. package/dist/dev/index.d.ts +1 -0
  22. package/dist/dev/index.js +51 -9
  23. package/dist/discovery/catalog.js +3 -3
  24. package/dist/distribuicao/filesystemGlobal.d.ts +63 -0
  25. package/dist/distribuicao/filesystemGlobal.js +701 -0
  26. package/dist/distribuicao/index.d.ts +7 -0
  27. package/dist/distribuicao/index.js +227 -0
  28. package/dist/distribuicao/launcherGlobal.d.ts +53 -0
  29. package/dist/distribuicao/launcherGlobal.js +643 -0
  30. package/dist/distribuicao/launcherWindows.d.ts +28 -0
  31. package/dist/distribuicao/launcherWindows.js +326 -0
  32. package/dist/distribuicao/lockContextGlobal.d.ts +10 -0
  33. package/dist/distribuicao/lockContextGlobal.js +17 -0
  34. package/dist/distribuicao/lockGlobal.d.ts +6 -0
  35. package/dist/distribuicao/lockGlobal.js +520 -0
  36. package/dist/distribuicao/skillGlobal.d.ts +48 -0
  37. package/dist/distribuicao/skillGlobal.js +652 -0
  38. package/dist/distribuicao/skillIntentPolicy.d.ts +21 -0
  39. package/dist/distribuicao/skillIntentPolicy.js +115 -0
  40. package/dist/distribuicao/tipos.d.ts +50 -0
  41. package/dist/distribuicao/tipos.js +10 -0
  42. package/dist/distribuicao/versaoSemantica.d.ts +3 -0
  43. package/dist/distribuicao/versaoSemantica.js +62 -0
  44. package/dist/drift.part01.d.ts +26 -24
  45. package/dist/drift.part01.js +2 -1
  46. package/dist/drift.part04.d.ts +12 -3
  47. package/dist/drift.part04.js +88 -17
  48. package/dist/drift.part05.d.ts +2 -2
  49. package/dist/drift.part05.js +8 -6
  50. package/dist/drift.part06.d.ts +2 -2
  51. package/dist/drift.part06.js +113 -26
  52. package/dist/drift.part07.d.ts +11 -11
  53. package/dist/drift.part07.js +261 -265
  54. package/dist/drift.part08.d.ts +2 -2
  55. package/dist/drift.part08.js +35 -26
  56. package/dist/drift.part11.js +238 -56
  57. package/dist/drift.part12.d.ts +1 -1
  58. package/dist/drift.part12.js +193 -21
  59. package/dist/drift.part13.d.ts +20 -39
  60. package/dist/drift.part13.js +601 -647
  61. package/dist/drift.part14.js +21 -7
  62. package/dist/driftCacheCas.d.ts +43 -0
  63. package/dist/driftCacheCas.js +351 -0
  64. package/dist/driftCacheFilesystem.d.ts +64 -0
  65. package/dist/driftCacheFilesystem.js +313 -0
  66. package/dist/driftCacheModes.d.ts +38 -0
  67. package/dist/driftCacheModes.js +147 -0
  68. package/dist/driftCacheStore.d.ts +80 -0
  69. package/dist/driftCacheStore.js +603 -0
  70. package/dist/driftCatalogo.d.ts +2 -28
  71. package/dist/driftCatalogo.js +143 -284
  72. package/dist/driftEscopo.d.ts +1 -3
  73. package/dist/driftEscopo.js +235 -151
  74. package/dist/driftEscopoReferencias.d.ts +5 -1
  75. package/dist/driftEscopoReferencias.js +375 -28
  76. package/dist/driftOrcamento.d.ts +0 -6
  77. package/dist/driftOrcamento.js +2 -1
  78. package/dist/execucoesExternas.js +19 -5
  79. package/dist/geracaoCore.js +4 -6
  80. package/dist/iaPrompts.d.ts +3 -3
  81. package/dist/iaPrompts.js +312 -313
  82. package/dist/index.d.ts +4 -1
  83. package/dist/index.js +6 -25
  84. package/dist/index.part01.d.ts +20 -28
  85. package/dist/index.part01.js +16 -237
  86. package/dist/index.part02.js +36 -22
  87. package/dist/index.part03.d.ts +24 -2
  88. package/dist/index.part03.js +83 -19
  89. package/dist/index.part04.d.ts +10 -2
  90. package/dist/index.part04.js +142 -120
  91. package/dist/index.part05.js +80 -78
  92. package/dist/index.part06.js +34 -17
  93. package/dist/index.part07.js +7 -3
  94. package/dist/index.part08.d.ts +1 -1
  95. package/dist/index.part08.js +22 -27
  96. package/dist/initCommand.js +5 -1
  97. package/dist/initTemplatesBase.js +81 -79
  98. package/dist/pipelineConteudo/command.d.ts +1 -0
  99. package/dist/pipelineConteudo/command.js +9 -2
  100. package/dist/pipelineConteudo/help.d.ts +2 -0
  101. package/dist/pipelineConteudo/help.js +33 -0
  102. package/dist/profileAuthorCommand.js +3 -7
  103. package/dist/profileCommand.js +3 -7
  104. package/dist/projetoCarregar.js +35 -17
  105. package/dist/projetoCatalogo.d.ts +1 -0
  106. package/dist/projetoCatalogo.js +64 -25
  107. package/dist/projetoOrigens.d.ts +2 -0
  108. package/dist/projetoOrigens.js +65 -9
  109. package/dist/projetoTipos.d.ts +1 -0
  110. package/dist/resultadoCli.d.ts +20 -0
  111. package/dist/resultadoCli.js +57 -0
  112. package/dist/saidaCli.d.ts +35 -0
  113. package/dist/saidaCli.js +118 -0
  114. package/dist/sistemasInterativos/acceptanceEvidence.d.ts +22 -0
  115. package/dist/sistemasInterativos/acceptanceEvidence.js +345 -0
  116. package/dist/sistemasInterativos/engineObservation.d.ts +12 -0
  117. package/dist/sistemasInterativos/engineObservation.js +438 -0
  118. package/dist/sistemasInterativos/jobOrchestration.d.ts +2 -0
  119. package/dist/sistemasInterativos/jobOrchestration.js +204 -0
  120. package/dist/sistemasInterativos/operationPrimitives.d.ts +21 -0
  121. package/dist/sistemasInterativos/operationPrimitives.js +194 -0
  122. package/dist/sistemasInterativos/operations.d.ts +4 -39
  123. package/dist/sistemasInterativos/operations.js +5 -1164
  124. package/dist/skillCommand.d.ts +5 -0
  125. package/dist/skillCommand.js +88 -0
  126. package/docs/README.md +34 -30
  127. package/docs/ai-integration.md +25 -12
  128. package/docs/ai-onboarding.md +37 -18
  129. package/docs/ai-workflow.md +9 -7
  130. package/docs/cli.md +125 -7
  131. package/docs/commands.md +41 -20
  132. package/docs/deploy.md +21 -8
  133. package/docs/descoberta-capacidades.md +106 -106
  134. package/docs/documentation.md +49 -39
  135. package/docs/drift-cache.md +108 -0
  136. package/docs/getting-started.md +43 -18
  137. package/docs/pipeline-conteudo.md +246 -246
  138. package/docs/profiles.md +54 -54
  139. package/docs/repositories.md +19 -2
  140. package/docs/rollback.md +15 -8
  141. package/docs/security.md +25 -3
  142. package/docs/sistemas-interativos.md +379 -374
  143. package/docs/testing.md +139 -40
  144. package/exemplos/pipeline-conteudo/README.md +44 -44
  145. package/exemplos/pipeline-conteudo/alvos.json +23 -23
  146. package/exemplos/pipeline-conteudo/definicao.json +136 -136
  147. package/exemplos/profile_simulation.sema +211 -211
  148. package/exemplos/sistemas-interativos/README.md +100 -100
  149. package/exemplos/sistemas-interativos/advanced/acceptance-context-evaluate-valid.json +5 -5
  150. package/exemplos/sistemas-interativos/advanced/acceptance-lock-valid.json +16 -16
  151. package/exemplos/sistemas-interativos/advanced/asset-provenance-valid.json +32 -32
  152. package/exemplos/sistemas-interativos/advanced/autonomy-repair-valid.json +93 -93
  153. package/exemplos/sistemas-interativos/advanced/control-run-definition-valid.json +78 -78
  154. package/exemplos/sistemas-interativos/advanced/control-run-valid.json +27 -27
  155. package/exemplos/sistemas-interativos/advanced/distributed-workers-valid.json +79 -79
  156. package/exemplos/sistemas-interativos/advanced/editor-state-valid.json +42 -42
  157. package/exemplos/sistemas-interativos/advanced/engine-snapshot-after-valid.json +32 -32
  158. package/exemplos/sistemas-interativos/advanced/engine-snapshot-before-valid.json +23 -23
  159. package/exemplos/sistemas-interativos/advanced/job-orchestration-valid.json +39 -39
  160. package/exemplos/sistemas-interativos/advanced/multimodal-evidence-valid.json +46 -46
  161. package/exemplos/sistemas-interativos/advanced/multiplayer-authority-valid.json +39 -39
  162. package/exemplos/sistemas-interativos/advanced/playtest-fuzz-valid.json +37 -37
  163. package/exemplos/sistemas-interativos/advanced/portability-valid.json +104 -104
  164. package/exemplos/sistemas-interativos/advanced/temporal-evidence-valid.json +27 -27
  165. package/exemplos/sistemas-interativos/advanced/temporal-valid.json +118 -118
  166. package/exemplos/sistemas-interativos/experience-ir-valid.json +459 -459
  167. package/exemplos/sistemas-interativos/game-2d.json +83 -83
  168. package/exemplos/sistemas-interativos/game-3d-human.json +81 -81
  169. package/exemplos/sistemas-interativos/game-pixel-16-bit.json +97 -97
  170. package/exemplos/sistemas-interativos/game-pixel-8-bit.json +94 -94
  171. package/exemplos/sistemas-interativos/game-xr-human.json +80 -80
  172. package/exemplos/sistemas-interativos/hybrid-2-5d.json +108 -108
  173. package/exemplos/sistemas-interativos/protocol-mutating-rollback-valid.json +75 -75
  174. package/exemplos/sistemas-interativos/protocol-read-only-valid.json +58 -58
  175. package/exemplos/sistemas-interativos/simulation-2d-controlled.json +97 -97
  176. package/exemplos/sistemas-interativos/simulation-3d-calibrated-autonomous.json +141 -141
  177. package/exemplos/sistemas-interativos/simulation-headless-autonomous-batch.json +112 -112
  178. package/exemplos/sistemas-interativos/simulation-pixel-16-bit.json +103 -103
  179. package/exemplos/sistemas-interativos/simulation-text-controlled.json +95 -95
  180. package/node_modules/@sema/gerador-cpp/package.json +1 -1
  181. package/node_modules/@sema/gerador-dotnet/package.json +1 -1
  182. package/node_modules/@sema/gerador-lua/dist/index.js +51 -51
  183. package/node_modules/@sema/gerador-php/dist/index.js +113 -113
  184. package/node_modules/@sema/nucleo/dist/semantico/analisador.d.ts +1 -0
  185. package/node_modules/@sema/nucleo/dist/semantico/analisador.js +1 -0
  186. package/package.json +9 -4
  187. package/scripts/postinstall.mjs +148 -0
  188. package/skills/sema/SKILL.md +199 -0
  189. package/skills/sema/agents/openai.yaml +4 -0
  190. package/dist/driftCache.d.ts +0 -49
  191. package/dist/driftCache.js +0 -311
  192. package/dist/driftCacheIncremental.d.ts +0 -98
  193. package/dist/driftCacheIncremental.js +0 -596
  194. package/dist/driftCatalogoPersistente.d.ts +0 -8
  195. package/dist/driftCatalogoPersistente.js +0 -77
  196. package/node_modules/@sema/gerador-cpp/dist/index.js.map +0 -1
  197. package/node_modules/@sema/gerador-css/dist/index.js.map +0 -1
  198. package/node_modules/@sema/gerador-css/dist/index.part01.js.map +0 -1
  199. package/node_modules/@sema/gerador-css/dist/index.part02.js.map +0 -1
  200. package/node_modules/@sema/gerador-dart/dist/index.js.map +0 -1
  201. package/node_modules/@sema/gerador-dotnet/dist/index.js.map +0 -1
  202. package/node_modules/@sema/gerador-html/dist/index.js.map +0 -1
  203. package/node_modules/@sema/gerador-javascript/dist/index.js.map +0 -1
  204. package/node_modules/@sema/gerador-lua/dist/index.js.map +0 -1
  205. package/node_modules/@sema/gerador-php/dist/index.js.map +0 -1
  206. package/node_modules/@sema/gerador-python/dist/index.js.map +0 -1
  207. package/node_modules/@sema/gerador-python/dist/index.part01.js.map +0 -1
  208. package/node_modules/@sema/gerador-python/dist/index.part02.js.map +0 -1
  209. package/node_modules/@sema/gerador-typescript/dist/index.js.map +0 -1
  210. package/node_modules/@sema/gerador-typescript/dist/index.part01.js.map +0 -1
  211. package/node_modules/@sema/gerador-typescript/dist/index.part02.js.map +0 -1
  212. package/node_modules/@sema/gerador-typescript/dist/index.part03.js.map +0 -1
  213. package/node_modules/@sema/nucleo/dist/ast/tipos.js.map +0 -1
  214. package/node_modules/@sema/nucleo/dist/diagnosticos/index.js.map +0 -1
  215. package/node_modules/@sema/nucleo/dist/diagnosticos/melhorador.js.map +0 -1
  216. package/node_modules/@sema/nucleo/dist/diagnosticos/snippets.js.map +0 -1
  217. package/node_modules/@sema/nucleo/dist/formatador/index.js.map +0 -1
  218. package/node_modules/@sema/nucleo/dist/formatador/index.part01.js.map +0 -1
  219. package/node_modules/@sema/nucleo/dist/formatador/index.part02.js.map +0 -1
  220. package/node_modules/@sema/nucleo/dist/index.js.map +0 -1
  221. package/node_modules/@sema/nucleo/dist/ir/conversor.js.map +0 -1
  222. package/node_modules/@sema/nucleo/dist/ir/conversor.part01.js.map +0 -1
  223. package/node_modules/@sema/nucleo/dist/ir/conversor.part02.js.map +0 -1
  224. package/node_modules/@sema/nucleo/dist/ir/conversor.part03.js.map +0 -1
  225. package/node_modules/@sema/nucleo/dist/ir/modelos.js.map +0 -1
  226. package/node_modules/@sema/nucleo/dist/lexer/lexer.js.map +0 -1
  227. package/node_modules/@sema/nucleo/dist/lexer/tokens.js.map +0 -1
  228. package/node_modules/@sema/nucleo/dist/parser/parser.declaracoes.js.map +0 -1
  229. package/node_modules/@sema/nucleo/dist/parser/parser.js.map +0 -1
  230. package/node_modules/@sema/nucleo/dist/parser/parser.modulo.js.map +0 -1
  231. package/node_modules/@sema/nucleo/dist/parser/parser.part01.js.map +0 -1
  232. package/node_modules/@sema/nucleo/dist/parser/parser.part02.js.map +0 -1
  233. package/node_modules/@sema/nucleo/dist/parser/parser.part03.js.map +0 -1
  234. package/node_modules/@sema/nucleo/dist/persistencia/contratos.js.map +0 -1
  235. package/node_modules/@sema/nucleo/dist/semantico/analisador.js.map +0 -1
  236. package/node_modules/@sema/nucleo/dist/semantico/analisador.part01.js.map +0 -1
  237. package/node_modules/@sema/nucleo/dist/semantico/analisador.part02.js.map +0 -1
  238. package/node_modules/@sema/nucleo/dist/semantico/analisador.part03.js.map +0 -1
  239. package/node_modules/@sema/nucleo/dist/semantico/analisador.part04.js.map +0 -1
  240. package/node_modules/@sema/nucleo/dist/semantico/analisador.part05.js.map +0 -1
  241. package/node_modules/@sema/nucleo/dist/semantico/analisador.part06.js.map +0 -1
  242. package/node_modules/@sema/nucleo/dist/semantico/analisador.part07.js.map +0 -1
  243. package/node_modules/@sema/nucleo/dist/semantico/analisador.part08.js.map +0 -1
  244. package/node_modules/@sema/nucleo/dist/semantico/estruturas.js.map +0 -1
  245. package/node_modules/@sema/nucleo/dist/semantico/estruturas.part01.js.map +0 -1
  246. package/node_modules/@sema/nucleo/dist/semantico/estruturas.part02.js.map +0 -1
  247. package/node_modules/@sema/nucleo/dist/semantico/orcamentoSemantico.js.map +0 -1
  248. package/node_modules/@sema/nucleo/dist/semantico/seguranca.js.map +0 -1
  249. package/node_modules/@sema/nucleo/dist/util/arquivos.js.map +0 -1
  250. package/node_modules/@sema/padroes/dist/index.js.map +0 -1
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 modules, tasks, routes, entities, links, and expected files.
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,16 +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 inspecionar <arquivo-ou-pasta> [--drift none|cache|fresh] [--com-drift] --json`: inspects contracts; the default is contract-only `none` and leaves code scores absent.
34
- - `sema resumo <arquivo-ou-pasta> --micro [--drift none|cache|fresh] --json`: produces a small contract summary; the default is contract-only `none` and explicitly says implementation was not verified.
35
- - `sema drift <arquivo-ou-pasta> --escopo modulo [--cache auto|refresh|off] --json`: compares contract and implementation after planning the physical scope.
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.
36
45
  - `sema impacto <arquivo-ou-pasta> --alvo <token> --mudanca "<descricao>" --json`: maps impact before changing behavior.
37
46
  - `sema verificar <arquivo-ou-pasta> --json`: runs aggregated final verification.
38
47
  - `sema finalizar-mudanca --intencao "<acao>" --doc-lida <arquivo> --json`: proves documentation reading before closure.
39
48
 
40
- Honest closure: treat drift JSON as the source of truth. `sucesso:false`, `vinculos_quebrados`, `rotas_divergentes`, or broken impls mean the change is not complete yet. Do not report "clean drift" without green JSON.
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.
41
50
 
42
- Focused drift does not fall back to a global scan when it cannot prove a safe file anchor. With `--cache auto`, unchanged catalog snapshots, file metadata/content, dependency extraction, and semantic groups are reused only after schema, digest, identity, runtime-shape, and filesystem validation. The JSON fields `escopo_aplicado.catalogo`, `escopo_aplicado.cache.incremental`, and `escopo_aplicado.cache.fasesMs` expose visits, reads, hits, misses, extractions, writes, and phase timing.
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.
43
62
 
44
63
  ## Sema Code
45
64
 
@@ -67,6 +86,7 @@ Ready UI rule: if the task generates an app, site, dashboard, form, or static HT
67
86
  - `sema ajuda-ia`: short guidance for Codex.
68
87
  - `sema starter-ia`: operational starter.
69
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.
70
90
  - `sema prompt-curto <arquivo-ou-pasta> --json`: compact prompt.
71
91
  - `sema sync-codex --json`: synchronizes the official Codex entrypoint and local support docs.
72
92
  - `sema instalar-exemplos --json`: installs official examples in the workspace.
@@ -88,33 +108,34 @@ Ready UI rule: if the task generates an app, site, dashboard, form, or static HT
88
108
  - `sema conteudo planejar <definition.json> --alvos-arquivo <targets.json> --json`: creates a declarative multi-target plan for an external runner.
89
109
  - `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.
90
110
  - `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.
91
- - `sema conteudo status <definition.json> --politica-arquivo <policy-envelope.json> --confianca-arquivo <trust.json> --trust-root-digest <sha256:...> --revocation-digest <sha256:...> --ledger-arquivo <ledger.ndjson> --expected-head <sha256:...> --json`: verifies the signed policy and derives verdicts, operational conditions, completion, and next actions from canonical events.
111
+ - `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.
92
112
  - `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.
93
113
 
94
- The content command never runs producers, evaluators, creative tools, or publication adapters; those belong to an external runner. It has no native human-review transition. A signed policy binds the run, definition, ledger, trust root, gates, complete target set, and authorization window. Stages select `adapterPolicy` as `NONE`, `CONSTRAINTS`, or `CONFIRMATION`; definition v1 accepts one output per stage. Constraint results must come from independent signed observations, including independently observed media type, not artifact metadata or executor claims.
114
+ 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.
95
115
 
96
- Target metadata is an exact scalar allowlist from `requiredMetadata + optionalMetadata`; `accountScope` is a credential-free `account:<alias>` reference, and artifact metadata is prohibited in v1. Deterministic evidence and AI opinions have separate quorum fields. Evidence requires an exact attestation capability plus signed adapter binding where applicable.
116
+ 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.
97
117
 
98
- Verdicts remain separate from operational conditions, and a generated manifest cannot alter canonical state. Append freshness uses the platform clock rather than caller-provided time, and an authority in the current revocation overlay cannot sign an accepted policy.
99
-
100
- Local NDJSON plus a hash chain is portable replay evidence, not a strong append-only trust boundary. Retain the expected head, canonical trust-root digest, and current revocation digest externally, or use protected storage for high assurance. A workspace-local trust file additionally requires `--development-local-trust`; that flag does not disable digest pinning.
118
+ 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.
101
119
 
102
120
  ## AI-native Interactive Systems
103
121
 
104
122
  - `sema interativo capabilities --json`: lists the canonical interactive capability vocabulary.
105
- - `sema interativo schema --json`: exposes stable definition, extension-command, and data-schema shapes for AI clients.
123
+ - `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.
106
124
  - `sema interativo pipelines --json`: lists reusable game, simulation, and hybrid pipelines.
107
125
  - `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.
108
126
  - `sema interativo validar <definition.json> --json`: validates independent kind, spatial model, render mode, visual profile, fidelity, control, time, world, budget, pipeline, and acceptance axes.
109
127
  - `sema interativo planejar <definition.json> --json`: expands compatible stages and required evidence without running an engine.
110
128
  - `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.
111
129
  - `sema interativo validar-protocolo <adapter-run.json> --json`: checks DETECT/PROBE/SNAPSHOT/PLAN/APPLY/VALIDATE/EVIDENCE/ROLLBACK ordering and stable target binding.
112
- - Experience IR: `validar-ir`, `indexar-ir`, `consultar-ir`, `chunk-ir`, and `descrever-ir`.
113
- - Operational state: `validar-engine-snapshot`, `diff-engine-snapshots`, `validar-asset-provenance`, `validar-editor-state`, `planejar-jobs`, `validar-acceptance`, `operar-acceptance`, and `validar-multimodal`.
114
- - Temporal, autonomy, and testing: `validar-temporal`, `validar-evidencia-temporal`, `validar-autonomia`, `validar-playtest-fuzz`, and `validar-multiplayer`.
130
+ - Experience IR: `validar-ir`, `indexar-ir`, `consultar-ir --semantic-id <id>`, `chunk-ir --semantic-id <id> [--raso]`, and `descrever-ir`.
131
+ - 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`.
132
+ - Temporal, autonomy, and testing: `validar-temporal`, `validar-evidencia-temporal --bundle-arquivo <file>`, `validar-autonomia`, `validar-playtest-fuzz`, and `validar-multiplayer`.
115
133
  - Portability and workers: `analisar-portabilidade` and `validar-workers`.
134
+ - `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.
135
+
136
+ 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.
116
137
 
117
- Spatial model and render mode are orthogonal: `THREE_D + HEADLESS` is valid, while XR requires `THREE_D`. `PIXEL_8_BIT` and `PIXEL_16_BIT` are independent visual profiles available to games and simulations. Every command above is local and read-only; external runners own engine/editor execution, authorization, mutation, rollback, migration, rendering, playtest, and worker scheduling. Full local coverage is `STRUCTURALLY_COMPLETE`, never authoritative completion.
138
+ 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.
118
139
 
119
140
  ## Operational
120
141
 
@@ -122,12 +143,12 @@ Spatial model and render mode are orthogonal: `THREE_D + HEADLESS` is valid, whi
122
143
 
123
144
  ## Forbidden
124
145
 
125
- - 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.
126
147
  - Do not search the entire disk for `.sema` syntax; use `exemplos/`, `docs/syntax.md`, and this catalog.
127
148
  - Do not stop after `sema compilar` if the contract target files still do not exist.
128
149
  - Do not replace `sema compilar` with `sema testar` when the contract requires generated code.
129
150
  - Do not create a Markdown report to pretend a gate ran.
130
- - Do not say drift passed when `sema drift --json` returned `sucesso:false`, broken link, divergent route, or broken impl.
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.
131
152
  - Do not declare a UI responsive without mobile/desktop proof; horizontal scroll at 390px blocks closure.
132
153
 
133
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/deploy.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # Deployment Boundary
2
2
 
3
- The public Sema repository documents two coordinated release surfaces: the
4
- local npm CLI and the Codex bootstrap skill. The skill remains a separate,
5
- explicit Codex installation and is never injected by npm lifecycle scripts.
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.
6
7
 
7
8
  Run the complete public gate:
8
9
 
@@ -22,11 +23,23 @@ npm run release:publicar-npm-dry-run
22
23
  the public boundary, so a clean clone does not depend on ignored generated
23
24
  handshake files left by a previous local run.
24
25
 
25
- The plugin smoke installs the repo marketplace into an isolated `CODEX_HOME`,
26
- installs `sema@sema`, compares the cached skill with the versioned source, and
27
- proves no Sema MCP server was registered. Plugin and CLI versions must match
28
- before the commit is pushed. The release command itself runs the full test suite
29
- and project-wide Sema drift gate; these are not optional manual preliminaries.
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.
30
43
 
31
44
  Push the commit containing `.agents/plugins/marketplace.json` and
32
45
  `plugins/sema/` before telling users to install from `gerlanss/Sema`. Publish
@@ -1,106 +1,106 @@
1
- # Capability Discovery
2
-
3
- Sema exposes one explainable catalog so an AI can distinguish a validation
4
- profile, an orchestration pipeline, a specialized workflow, a generator, a
5
- governance gate, an adapter descriptor, and an opaque capability token.
6
-
7
- Discovery is local, deterministic, and read-only. It recommends or explains a
8
- capability but never executes the recommended command:
9
-
10
- ```bash
11
- sema descobrir catalogo --json
12
- sema descobrir recomendar --intencao "validar simulador 3D autonomo calibrado" --json
13
- sema descobrir recomendar --intencao "port a 16-bit game to another engine and declare losses" --json
14
- sema descobrir explicar interactive.portability --json
15
- sema pipeline listar --json
16
- sema pipeline descrever interactive.playtest --json
17
- sema capabilities --json
18
- ```
19
-
20
- The response schema is `sema.discovery/v1` and always reports:
21
-
22
- - `executed: false`;
23
- - `workspaceMutated: false`;
24
- - `externalCalls: false`;
25
- - actionable command templates with placeholders;
26
- - required inputs and execution boundaries;
27
- - matched signals, reasons, missing inputs, and stable scores.
28
-
29
- Advanced interactive intent is routed to the narrowest local validator or
30
- analyzer (`validar-temporal`, `validar-playtest-fuzz`, `analisar-portabilidade`,
31
- and peers). A broad profile or engine descriptor does not outrank that specific
32
- pipeline, and the suggested template retains every required file and flag.
33
-
34
- Raw paths and credential-like values supplied in intents or filters are used
35
- only for the in-memory lookup and are redacted from JSON and human output.
36
-
37
- ## Catalog coverage
38
-
39
- The interactive catalog exposes **35 unique pipelines** and **28 unique
40
- external adapter descriptors**. The pipeline set covers the original game and
41
- simulation lifecycle plus P0/P1/P2 operational capabilities:
42
-
43
- - P0 representation and observation: Experience IR, engine snapshots, asset
44
- provenance, editor state, multimodal evidence, resumable jobs, and acceptance
45
- locks;
46
- - P1 behavior over time: timeline validation, shot/camera checks, physics
47
- relations, temporal QA, clean-install/launch/smoke checks, and hardware
48
- budgets;
49
- - P2 autonomy and scale: safe repair cycles, bot playtests, state fuzzing,
50
- multiplayer authority, engine migration, portability with declared losses,
51
- and distributed job DAGs.
52
-
53
- These entries apply across 3D, 2.5D, 2D, 8-bit, 16-bit, text, XR, and headless
54
- games and simulations. Discovery ranks the requested goal independently from
55
- the spatial model and visual profile.
56
-
57
- The 28 adapters are **descriptors for external capabilities**. Catalog lookup
58
- does not detect an installed engine, inspect an editor, enumerate plug-ins,
59
- probe processes, contact a worker, or prove that any integration is available.
60
- An external runner must establish runtime availability and return bound
61
- evidence.
62
-
63
- ## Capability kinds
64
-
65
- - `GOVERNANCE_FLOW`: contract, drift, impact, verification, and closure gates.
66
- - `PROFILE_GATE`: semantic validation such as game, simulation, software, or ops.
67
- - `SPECIALIZED_WORKFLOW`: dedicated surfaces such as `sema author`.
68
- - `ORCHESTRATION_PIPELINE`: a staged workflow such as content, interactive
69
- playtest, temporal validation, portability, or distributed jobs.
70
- - `CAPABILITY_TOKEN`: an opaque producer, evaluator, runtime, or evidence token.
71
- - `GENERATOR`: code generation targets.
72
- - `ADAPTER`: compatibility descriptors for external engines, editors, runtimes,
73
- observers, verifiers, asset tools, build systems, and workers.
74
-
75
- `author` is intentionally a specialized workflow, not a fake
76
- `sema profile validar author` command. Likewise, `profile.game` validates game
77
- semantics; it is not the same thing as the `interactive.playtest` pipeline.
78
-
79
- ## Deterministic recommendation
80
-
81
- The base router normalizes accents and aliases, applies positive and negative
82
- signals, scores the entry kind and domain, and sorts by score then stable ID.
83
- The minimum recommendation score is 60. When the top two candidates are within
84
- seven points, the response reports ambiguity and does not choose a command.
85
-
86
- This rule is deliberate: an AI should request more concrete intent instead of
87
- silently running the wrong pipeline.
88
-
89
- Interactive pipeline entries point to declarative planning with
90
- `sema interativo planejar <definition.json> --json`. The definition must list
91
- the recommended pipeline ID; the secondary `descrever` template remains
92
- available when the AI first needs the pipeline contract. Advanced entries point
93
- to their dedicated `sema interativo` validator or analyzer. Those commands
94
- still return local, non-authoritative results and do not execute engines,
95
- editors, plug-ins, or workers.
96
-
97
- Legacy views remain available:
98
-
99
- ```bash
100
- sema profile capabilities --json
101
- sema conteudo capabilities --json
102
- sema interativo capabilities --json
103
- ```
104
-
105
- They are projections of the same authoritative catalog sources, not separate
106
- manually maintained product maps.
1
+ # Capability Discovery
2
+
3
+ Sema exposes one explainable catalog so an AI can distinguish a validation
4
+ profile, an orchestration pipeline, a specialized workflow, a generator, a
5
+ governance gate, an adapter descriptor, and an opaque capability token.
6
+
7
+ Discovery is local, deterministic, and read-only. It recommends or explains a
8
+ capability but never executes the recommended command:
9
+
10
+ ```bash
11
+ sema descobrir catalogo --json
12
+ sema descobrir recomendar --intencao "validar simulador 3D autonomo calibrado" --json
13
+ sema descobrir recomendar --intencao "port a 16-bit game to another engine and declare losses" --json
14
+ sema descobrir explicar interactive.portability --json
15
+ sema pipeline listar --json
16
+ sema pipeline descrever interactive.playtest --json
17
+ sema capabilities --json
18
+ ```
19
+
20
+ The response schema is `sema.discovery/v1` and always reports:
21
+
22
+ - `executed: false`;
23
+ - `workspaceMutated: false`;
24
+ - `externalCalls: false`;
25
+ - actionable command templates with placeholders;
26
+ - required inputs and execution boundaries;
27
+ - matched signals, reasons, missing inputs, and stable scores.
28
+
29
+ Advanced interactive intent is routed to the narrowest local validator or
30
+ analyzer (`validar-temporal`, `validar-playtest-fuzz`, `analisar-portabilidade`,
31
+ and peers). A broad profile or engine descriptor does not outrank that specific
32
+ pipeline, and the suggested template retains every required file and flag.
33
+
34
+ Raw paths and credential-like values supplied in intents or filters are used
35
+ only for the in-memory lookup and are redacted from JSON and human output.
36
+
37
+ ## Catalog coverage
38
+
39
+ The interactive catalog exposes **35 unique pipelines** and **28 unique
40
+ external adapter descriptors**. The pipeline set covers the original game and
41
+ simulation lifecycle plus P0/P1/P2 operational capabilities:
42
+
43
+ - P0 representation and observation: Experience IR, engine snapshots, asset
44
+ provenance, editor state, multimodal evidence, resumable jobs, and acceptance
45
+ locks;
46
+ - P1 behavior over time: timeline validation, shot/camera checks, physics
47
+ relations, temporal QA, clean-install/launch/smoke checks, and hardware
48
+ budgets;
49
+ - P2 autonomy and scale: safe repair cycles, bot playtests, state fuzzing,
50
+ multiplayer authority, engine migration, portability with declared losses,
51
+ and distributed job DAGs.
52
+
53
+ These entries apply across 3D, 2.5D, 2D, 8-bit, 16-bit, text, XR, and headless
54
+ games and simulations. Discovery ranks the requested goal independently from
55
+ the spatial model and visual profile.
56
+
57
+ The 28 adapters are **descriptors for external capabilities**. Catalog lookup
58
+ does not detect an installed engine, inspect an editor, enumerate plug-ins,
59
+ probe processes, contact a worker, or prove that any integration is available.
60
+ An external runner must establish runtime availability and return bound
61
+ evidence.
62
+
63
+ ## Capability kinds
64
+
65
+ - `GOVERNANCE_FLOW`: contract, drift, impact, verification, and closure gates.
66
+ - `PROFILE_GATE`: semantic validation such as game, simulation, software, or ops.
67
+ - `SPECIALIZED_WORKFLOW`: dedicated surfaces such as `sema author`.
68
+ - `ORCHESTRATION_PIPELINE`: a staged workflow such as content, interactive
69
+ playtest, temporal validation, portability, or distributed jobs.
70
+ - `CAPABILITY_TOKEN`: an opaque producer, evaluator, runtime, or evidence token.
71
+ - `GENERATOR`: code generation targets.
72
+ - `ADAPTER`: compatibility descriptors for external engines, editors, runtimes,
73
+ observers, verifiers, asset tools, build systems, and workers.
74
+
75
+ `author` is intentionally a specialized workflow, not a fake
76
+ `sema profile validar author` command. Likewise, `profile.game` validates game
77
+ semantics; it is not the same thing as the `interactive.playtest` pipeline.
78
+
79
+ ## Deterministic recommendation
80
+
81
+ The base router normalizes accents and aliases, applies positive and negative
82
+ signals, scores the entry kind and domain, and sorts by score then stable ID.
83
+ The minimum recommendation score is 60. When the top two candidates are within
84
+ seven points, the response reports ambiguity and does not choose a command.
85
+
86
+ This rule is deliberate: an AI should request more concrete intent instead of
87
+ silently running the wrong pipeline.
88
+
89
+ Interactive pipeline entries point to declarative planning with
90
+ `sema interativo planejar <definition.json> --json`. The definition must list
91
+ the recommended pipeline ID; the secondary `descrever` template remains
92
+ available when the AI first needs the pipeline contract. Advanced entries point
93
+ to their dedicated `sema interativo` validator or analyzer. Those commands
94
+ still return local, non-authoritative results and do not execute engines,
95
+ editors, plug-ins, or workers.
96
+
97
+ Legacy views remain available:
98
+
99
+ ```bash
100
+ sema profile capabilities --json
101
+ sema conteudo capabilities --json
102
+ sema interativo capabilities --json
103
+ ```
104
+
105
+ They are projections of the same authoritative catalog sources, not separate
106
+ manually maintained product maps.
@@ -1,39 +1,49 @@
1
- # Documentation Governance
2
-
3
- Documentation is part of every governed change. Codex must use
4
- `sema docs-impacto` before editing contracts, code, operational docs, workflows,
5
- profiles, generated artifacts, or release material.
6
-
7
- Public Sema documentation is English and local-only.
8
-
9
- ## Required Flow
10
-
11
- ```bash
12
- sema docs-impacto --intencao "describe the change" --json
13
- ```
14
-
15
- The result lists:
16
-
17
- - `leituraObrigatoria`: files that must be read before the change;
18
- - `docsAusentes`: missing docs that block the change;
19
- - `docsCriadas`: generated draft docs that must be completed by Codex;
20
- - `bloqueios`: blocking diagnostics.
21
-
22
- Before closing the change, prove the required docs were read:
23
-
24
- ```bash
25
- sema finalizar-mudanca \
26
- --intencao "describe the change" \
27
- --doc-lida README.md \
28
- --doc-lida docs/documentation.md \
29
- --json
30
- ```
31
-
32
- ## Public Docs Rules
33
-
34
- - Write public docs in English.
35
- - Keep commands, file paths, package names, environment variable names, and DSL
36
- keywords literal.
37
- - Do not include private or sensitive operational material.
38
- - Prefer local CLI examples.
39
- - Point support requests to suporte@otimitare.online.
1
+ # Documentation Governance
2
+
3
+ Documentation is part of every governed change. Codex must use
4
+ `sema docs-impacto` before editing contracts, code, operational docs, workflows,
5
+ profiles, generated artifacts, or release material.
6
+
7
+ Public Sema documentation is English and local-only.
8
+
9
+ ## Required Flow
10
+
11
+ ```bash
12
+ sema docs-impacto --intencao "describe the change" --json
13
+ ```
14
+
15
+ The result lists:
16
+
17
+ - `leituraObrigatoria`: files that must be read before the change;
18
+ - `docsAusentes`: missing docs that block the change;
19
+ - `docsCriadas`: generated draft docs that must be completed by Codex;
20
+ - `bloqueios`: blocking diagnostics.
21
+
22
+ Before closing the change, prove the required docs were read:
23
+
24
+ ```bash
25
+ sema finalizar-mudanca \
26
+ --intencao "describe the change" \
27
+ --doc-lida README.md \
28
+ --doc-lida docs/documentation.md \
29
+ --json
30
+ ```
31
+
32
+ ## Public Docs Rules
33
+
34
+ - Write public docs in English.
35
+ - Keep commands, file paths, package names, environment variable names, and DSL
36
+ keywords literal.
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 Structure
42
+
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.