@semacode/cli 2.3.1 → 3.5.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 (281) 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 +592 -568
  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/docs.part01.d.ts +4 -1
  45. package/dist/docs.part01.js +8 -0
  46. package/dist/docs.part02.js +9 -1
  47. package/dist/drift.part01.d.ts +33 -25
  48. package/dist/drift.part01.js +2 -1
  49. package/dist/drift.part04.d.ts +26 -5
  50. package/dist/drift.part04.js +123 -19
  51. package/dist/drift.part05.d.ts +2 -2
  52. package/dist/drift.part05.js +8 -6
  53. package/dist/drift.part06.d.ts +2 -2
  54. package/dist/drift.part06.js +113 -26
  55. package/dist/drift.part07.d.ts +11 -11
  56. package/dist/drift.part07.js +261 -265
  57. package/dist/drift.part08.d.ts +2 -2
  58. package/dist/drift.part08.js +35 -26
  59. package/dist/drift.part09.d.ts +2 -2
  60. package/dist/drift.part09.js +10 -3
  61. package/dist/drift.part11.js +261 -58
  62. package/dist/drift.part12.d.ts +1 -1
  63. package/dist/drift.part12.js +193 -21
  64. package/dist/drift.part13.d.ts +20 -39
  65. package/dist/drift.part13.js +601 -647
  66. package/dist/drift.part14.js +23 -7
  67. package/dist/driftCacheCas.d.ts +43 -0
  68. package/dist/driftCacheCas.js +351 -0
  69. package/dist/driftCacheFilesystem.d.ts +64 -0
  70. package/dist/driftCacheFilesystem.js +313 -0
  71. package/dist/driftCacheModes.d.ts +38 -0
  72. package/dist/driftCacheModes.js +147 -0
  73. package/dist/driftCacheStore.d.ts +80 -0
  74. package/dist/driftCacheStore.js +603 -0
  75. package/dist/driftCatalogo.d.ts +2 -28
  76. package/dist/driftCatalogo.js +143 -284
  77. package/dist/driftEscopo.d.ts +1 -3
  78. package/dist/driftEscopo.js +235 -151
  79. package/dist/driftEscopoReferencias.d.ts +5 -1
  80. package/dist/driftEscopoReferencias.js +375 -28
  81. package/dist/driftOrcamento.d.ts +0 -6
  82. package/dist/driftOrcamento.js +2 -1
  83. package/dist/execucoesExternas.js +19 -5
  84. package/dist/exemplosOficiais.d.ts +2 -1
  85. package/dist/exemplosOficiais.js +9 -3
  86. package/dist/geracaoCore.d.ts +1 -0
  87. package/dist/geracaoCore.js +6 -6
  88. package/dist/iaPrompts.d.ts +3 -3
  89. package/dist/iaPrompts.js +312 -313
  90. package/dist/importador.part01.d.ts +1 -1
  91. package/dist/importador.part06.d.ts +2 -0
  92. package/dist/importador.part06.js +87 -1
  93. package/dist/importador.part09.js +7 -1
  94. package/dist/index.d.ts +4 -1
  95. package/dist/index.js +6 -25
  96. package/dist/index.part01.d.ts +20 -28
  97. package/dist/index.part01.js +16 -237
  98. package/dist/index.part02.js +36 -22
  99. package/dist/index.part03.d.ts +24 -2
  100. package/dist/index.part03.js +83 -19
  101. package/dist/index.part04.d.ts +10 -2
  102. package/dist/index.part04.js +152 -123
  103. package/dist/index.part05.js +80 -78
  104. package/dist/index.part06.js +34 -17
  105. package/dist/index.part07.d.ts +8 -2
  106. package/dist/index.part07.js +153 -7
  107. package/dist/index.part08.d.ts +1 -1
  108. package/dist/index.part08.js +25 -30
  109. package/dist/initCommand.d.ts +1 -0
  110. package/dist/initCommand.js +20 -4
  111. package/dist/initTemplatesBase.js +6 -4
  112. package/dist/pipelineConteudo/command.d.ts +1 -0
  113. package/dist/pipelineConteudo/command.js +9 -2
  114. package/dist/pipelineConteudo/help.d.ts +2 -0
  115. package/dist/pipelineConteudo/help.js +33 -0
  116. package/dist/profileAuthorCommand.js +3 -7
  117. package/dist/profileCommand.js +3 -7
  118. package/dist/projetoCarregar.js +35 -17
  119. package/dist/projetoCatalogo.d.ts +1 -0
  120. package/dist/projetoCatalogo.js +64 -25
  121. package/dist/projetoConfig.js +2 -0
  122. package/dist/projetoLegado.js +18 -0
  123. package/dist/projetoOrigens.d.ts +2 -0
  124. package/dist/projetoOrigens.js +65 -9
  125. package/dist/projetoTipos.d.ts +1 -0
  126. package/dist/resultadoCli.d.ts +20 -0
  127. package/dist/resultadoCli.js +57 -0
  128. package/dist/saidaCli.d.ts +35 -0
  129. package/dist/saidaCli.js +118 -0
  130. package/dist/sistemasInterativos/acceptanceEvidence.d.ts +22 -0
  131. package/dist/sistemasInterativos/acceptanceEvidence.js +345 -0
  132. package/dist/sistemasInterativos/engineObservation.d.ts +12 -0
  133. package/dist/sistemasInterativos/engineObservation.js +438 -0
  134. package/dist/sistemasInterativos/jobOrchestration.d.ts +2 -0
  135. package/dist/sistemasInterativos/jobOrchestration.js +204 -0
  136. package/dist/sistemasInterativos/operationPrimitives.d.ts +21 -0
  137. package/dist/sistemasInterativos/operationPrimitives.js +194 -0
  138. package/dist/sistemasInterativos/operations.d.ts +4 -39
  139. package/dist/sistemasInterativos/operations.js +5 -1164
  140. package/dist/skillCommand.d.ts +5 -0
  141. package/dist/skillCommand.js +88 -0
  142. package/dist/tipos.d.ts +1 -1
  143. package/dist/typescript-http-modelos.d.ts +1 -1
  144. package/dist/typescript-http-rotas.d.ts +1 -0
  145. package/dist/typescript-http-rotas.js +93 -0
  146. package/dist/typescript-http.d.ts +1 -1
  147. package/dist/typescript-http.js +1 -1
  148. package/dist/verificacaoCache.d.ts +25 -0
  149. package/dist/verificacaoCache.js +80 -0
  150. package/docs/README.md +34 -30
  151. package/docs/ai-integration.md +25 -12
  152. package/docs/ai-onboarding.md +37 -18
  153. package/docs/ai-workflow.md +9 -7
  154. package/docs/cli.md +125 -7
  155. package/docs/commands.md +41 -20
  156. package/docs/deploy.md +21 -8
  157. package/docs/descoberta-capacidades.md +106 -106
  158. package/docs/documentation.md +49 -39
  159. package/docs/drift-cache.md +108 -0
  160. package/docs/getting-started.md +43 -18
  161. package/docs/pipeline-conteudo.md +246 -246
  162. package/docs/profiles.md +54 -54
  163. package/docs/repositories.md +19 -2
  164. package/docs/rollback.md +15 -8
  165. package/docs/security.md +25 -3
  166. package/docs/sistemas-interativos.md +379 -374
  167. package/docs/syntax.md +14 -0
  168. package/docs/testing.md +139 -40
  169. package/exemplos/express_crud.sema +139 -0
  170. package/exemplos/fastify_crud.sema +146 -0
  171. package/exemplos/pipeline-conteudo/README.md +44 -44
  172. package/exemplos/pipeline-conteudo/alvos.json +23 -23
  173. package/exemplos/pipeline-conteudo/definicao.json +136 -136
  174. package/exemplos/profile_simulation.sema +211 -211
  175. package/exemplos/sistemas-interativos/README.md +100 -100
  176. package/exemplos/sistemas-interativos/advanced/acceptance-context-evaluate-valid.json +5 -5
  177. package/exemplos/sistemas-interativos/advanced/acceptance-lock-valid.json +16 -16
  178. package/exemplos/sistemas-interativos/advanced/asset-provenance-valid.json +32 -32
  179. package/exemplos/sistemas-interativos/advanced/autonomy-repair-valid.json +93 -93
  180. package/exemplos/sistemas-interativos/advanced/control-run-definition-valid.json +78 -78
  181. package/exemplos/sistemas-interativos/advanced/control-run-valid.json +27 -27
  182. package/exemplos/sistemas-interativos/advanced/distributed-workers-valid.json +79 -79
  183. package/exemplos/sistemas-interativos/advanced/editor-state-valid.json +42 -42
  184. package/exemplos/sistemas-interativos/advanced/engine-snapshot-after-valid.json +32 -32
  185. package/exemplos/sistemas-interativos/advanced/engine-snapshot-before-valid.json +23 -23
  186. package/exemplos/sistemas-interativos/advanced/job-orchestration-valid.json +39 -39
  187. package/exemplos/sistemas-interativos/advanced/multimodal-evidence-valid.json +46 -46
  188. package/exemplos/sistemas-interativos/advanced/multiplayer-authority-valid.json +39 -39
  189. package/exemplos/sistemas-interativos/advanced/playtest-fuzz-valid.json +37 -37
  190. package/exemplos/sistemas-interativos/advanced/portability-valid.json +104 -104
  191. package/exemplos/sistemas-interativos/advanced/temporal-evidence-valid.json +27 -27
  192. package/exemplos/sistemas-interativos/advanced/temporal-valid.json +118 -118
  193. package/exemplos/sistemas-interativos/experience-ir-valid.json +459 -459
  194. package/exemplos/sistemas-interativos/game-2d.json +83 -83
  195. package/exemplos/sistemas-interativos/game-3d-human.json +81 -81
  196. package/exemplos/sistemas-interativos/game-pixel-16-bit.json +97 -97
  197. package/exemplos/sistemas-interativos/game-pixel-8-bit.json +94 -94
  198. package/exemplos/sistemas-interativos/game-xr-human.json +80 -80
  199. package/exemplos/sistemas-interativos/hybrid-2-5d.json +108 -108
  200. package/exemplos/sistemas-interativos/protocol-mutating-rollback-valid.json +75 -75
  201. package/exemplos/sistemas-interativos/protocol-read-only-valid.json +58 -58
  202. package/exemplos/sistemas-interativos/simulation-2d-controlled.json +97 -97
  203. package/exemplos/sistemas-interativos/simulation-3d-calibrated-autonomous.json +141 -141
  204. package/exemplos/sistemas-interativos/simulation-headless-autonomous-batch.json +112 -112
  205. package/exemplos/sistemas-interativos/simulation-pixel-16-bit.json +103 -103
  206. package/exemplos/sistemas-interativos/simulation-text-controlled.json +95 -95
  207. package/node_modules/@sema/gerador-cpp/package.json +1 -1
  208. package/node_modules/@sema/gerador-dotnet/package.json +1 -1
  209. package/node_modules/@sema/gerador-lua/dist/index.js +51 -51
  210. package/node_modules/@sema/gerador-php/dist/index.js +113 -113
  211. package/node_modules/@sema/nucleo/dist/ir/conversor.part01.js +37 -38
  212. package/node_modules/@sema/nucleo/dist/ir/modelos.d.ts +1 -0
  213. package/node_modules/@sema/nucleo/dist/semantico/analisador.d.ts +1 -0
  214. package/node_modules/@sema/nucleo/dist/semantico/analisador.js +1 -0
  215. package/node_modules/@sema/nucleo/dist/semantico/analisador.part01.d.ts +7 -0
  216. package/node_modules/@sema/nucleo/dist/semantico/analisador.part01.js +33 -10
  217. package/package.json +9 -4
  218. package/scripts/postinstall.mjs +148 -0
  219. package/skills/sema/SKILL.md +199 -0
  220. package/skills/sema/agents/openai.yaml +4 -0
  221. package/dist/driftCache.d.ts +0 -49
  222. package/dist/driftCache.js +0 -311
  223. package/dist/driftCacheIncremental.d.ts +0 -98
  224. package/dist/driftCacheIncremental.js +0 -596
  225. package/dist/driftCatalogoPersistente.d.ts +0 -8
  226. package/dist/driftCatalogoPersistente.js +0 -77
  227. package/node_modules/@sema/gerador-cpp/dist/index.js.map +0 -1
  228. package/node_modules/@sema/gerador-css/dist/index.js.map +0 -1
  229. package/node_modules/@sema/gerador-css/dist/index.part01.js.map +0 -1
  230. package/node_modules/@sema/gerador-css/dist/index.part02.js.map +0 -1
  231. package/node_modules/@sema/gerador-dart/dist/index.js.map +0 -1
  232. package/node_modules/@sema/gerador-dotnet/dist/index.js.map +0 -1
  233. package/node_modules/@sema/gerador-html/dist/index.js.map +0 -1
  234. package/node_modules/@sema/gerador-javascript/dist/index.js.map +0 -1
  235. package/node_modules/@sema/gerador-lua/dist/index.js.map +0 -1
  236. package/node_modules/@sema/gerador-php/dist/index.js.map +0 -1
  237. package/node_modules/@sema/gerador-python/dist/index.js.map +0 -1
  238. package/node_modules/@sema/gerador-python/dist/index.part01.js.map +0 -1
  239. package/node_modules/@sema/gerador-python/dist/index.part02.js.map +0 -1
  240. package/node_modules/@sema/gerador-typescript/dist/index.js.map +0 -1
  241. package/node_modules/@sema/gerador-typescript/dist/index.part01.js.map +0 -1
  242. package/node_modules/@sema/gerador-typescript/dist/index.part02.js.map +0 -1
  243. package/node_modules/@sema/gerador-typescript/dist/index.part03.js.map +0 -1
  244. package/node_modules/@sema/nucleo/dist/ast/tipos.js.map +0 -1
  245. package/node_modules/@sema/nucleo/dist/diagnosticos/index.js.map +0 -1
  246. package/node_modules/@sema/nucleo/dist/diagnosticos/melhorador.js.map +0 -1
  247. package/node_modules/@sema/nucleo/dist/diagnosticos/snippets.js.map +0 -1
  248. package/node_modules/@sema/nucleo/dist/formatador/index.js.map +0 -1
  249. package/node_modules/@sema/nucleo/dist/formatador/index.part01.js.map +0 -1
  250. package/node_modules/@sema/nucleo/dist/formatador/index.part02.js.map +0 -1
  251. package/node_modules/@sema/nucleo/dist/index.js.map +0 -1
  252. package/node_modules/@sema/nucleo/dist/ir/conversor.js.map +0 -1
  253. package/node_modules/@sema/nucleo/dist/ir/conversor.part01.js.map +0 -1
  254. package/node_modules/@sema/nucleo/dist/ir/conversor.part02.js.map +0 -1
  255. package/node_modules/@sema/nucleo/dist/ir/conversor.part03.js.map +0 -1
  256. package/node_modules/@sema/nucleo/dist/ir/modelos.js.map +0 -1
  257. package/node_modules/@sema/nucleo/dist/lexer/lexer.js.map +0 -1
  258. package/node_modules/@sema/nucleo/dist/lexer/tokens.js.map +0 -1
  259. package/node_modules/@sema/nucleo/dist/parser/parser.declaracoes.js.map +0 -1
  260. package/node_modules/@sema/nucleo/dist/parser/parser.js.map +0 -1
  261. package/node_modules/@sema/nucleo/dist/parser/parser.modulo.js.map +0 -1
  262. package/node_modules/@sema/nucleo/dist/parser/parser.part01.js.map +0 -1
  263. package/node_modules/@sema/nucleo/dist/parser/parser.part02.js.map +0 -1
  264. package/node_modules/@sema/nucleo/dist/parser/parser.part03.js.map +0 -1
  265. package/node_modules/@sema/nucleo/dist/persistencia/contratos.js.map +0 -1
  266. package/node_modules/@sema/nucleo/dist/semantico/analisador.js.map +0 -1
  267. package/node_modules/@sema/nucleo/dist/semantico/analisador.part01.js.map +0 -1
  268. package/node_modules/@sema/nucleo/dist/semantico/analisador.part02.js.map +0 -1
  269. package/node_modules/@sema/nucleo/dist/semantico/analisador.part03.js.map +0 -1
  270. package/node_modules/@sema/nucleo/dist/semantico/analisador.part04.js.map +0 -1
  271. package/node_modules/@sema/nucleo/dist/semantico/analisador.part05.js.map +0 -1
  272. package/node_modules/@sema/nucleo/dist/semantico/analisador.part06.js.map +0 -1
  273. package/node_modules/@sema/nucleo/dist/semantico/analisador.part07.js.map +0 -1
  274. package/node_modules/@sema/nucleo/dist/semantico/analisador.part08.js.map +0 -1
  275. package/node_modules/@sema/nucleo/dist/semantico/estruturas.js.map +0 -1
  276. package/node_modules/@sema/nucleo/dist/semantico/estruturas.part01.js.map +0 -1
  277. package/node_modules/@sema/nucleo/dist/semantico/estruturas.part02.js.map +0 -1
  278. package/node_modules/@sema/nucleo/dist/semantico/orcamentoSemantico.js.map +0 -1
  279. package/node_modules/@sema/nucleo/dist/semantico/seguranca.js.map +0 -1
  280. package/node_modules/@sema/nucleo/dist/util/arquivos.js.map +0 -1
  281. package/node_modules/@sema/padroes/dist/index.js.map +0 -1
package/docs/syntax.md CHANGED
@@ -87,6 +87,20 @@ impl {
87
87
 
88
88
  `sema compilar --alvo javascript` defines a generation target. `impl { js: ... }` defines the live-code origin linked to the contract. They are different layers and both are valid.
89
89
 
90
+ ## Layered `impl` Roles
91
+
92
+ Layered code (route + service + persistence in the same language) can declare one `impl` per role. Append a supported role to the origin: `rota`, `servico`, `persistencia` or `repositorio`.
93
+
94
+ ```sema
95
+ impl {
96
+ ts_rota: server.routes.monitores.criarMonitor
97
+ ts_servico: server.services.monitores.criarMonitor
98
+ ts_persistencia: server.repositories.monitores.criar
99
+ }
100
+ ```
101
+
102
+ Each origin-plus-role pair must appear at most once; the bare origin (for example `ts`) stays valid for single-layer tasks, and drift resolves every role independently.
103
+
90
104
  ## Small Canonical Lists
91
105
 
92
106
  - `effects`: `persistencia`, `consulta`, `evento`, `auditoria`, `db.write`, `queue.publish`, `fs.write`, `network.egress`, `secret.read`, `shell.exec`.
package/docs/testing.md CHANGED
@@ -1,51 +1,150 @@
1
- # Testing
2
-
3
- Public Sema tests should run locally.
4
-
1
+ # Testing
2
+
3
+ Public Sema tests should run locally.
4
+
5
5
  Recommended checks:
6
-
7
- ```bash
8
- npm run build
9
- npm run status:check
10
- npm run repo:verificar-publico
11
- npm run plugin:testar-codex
12
- npm run cli:empacotar-publica
13
- npm run cli:testar-pacote-publico
14
- node pacotes/cli/dist/index.js --help
15
- node pacotes/cli/dist/index.js --version
16
- node pacotes/cli/dist/index.js resumo exemplos/calculadora.sema --micro --json
17
- node pacotes/cli/dist/index.js validar exemplos/calculadora.sema --json
18
- node pacotes/cli/dist/index.js testar exemplos/calculadora.sema --alvo dotnet --saida .tmp/testing-dotnet
19
- node pacotes/cli/dist/index.js testar exemplos/calculadora.sema --alvo cpp --saida .tmp/testing-cpp
20
- npm run release:preparar-publica
6
+
7
+ ```bash
8
+ npm run build
9
+ npm run status:check
10
+ npm run repo:verificar-publico
11
+ npm run plugin:testar-codex
12
+ npm run cli:empacotar-publica
13
+ npm run cli:testar-pacote-publico
14
+ node pacotes/cli/dist/bin.js --help
15
+ node pacotes/cli/dist/bin.js --version
16
+ node pacotes/cli/dist/bin.js resumo exemplos/calculadora.sema --micro --json
17
+ node pacotes/cli/dist/bin.js validar exemplos/calculadora.sema --json
18
+ node pacotes/cli/dist/bin.js testar exemplos/calculadora.sema --alvo dotnet --saida .tmp/testing-dotnet
19
+ node pacotes/cli/dist/bin.js testar exemplos/calculadora.sema --alvo cpp --saida .tmp/testing-cpp
20
+ npm run release:preparar-publica
21
21
  npm run release:verificar-drift
22
22
  ```
23
23
 
24
- Focused drift regressions live in:
25
-
26
- - `testes/unidade/projeto-carregamento-escopo.test.ts`: a file target loads only itself plus the transitive `use` closure.
27
- - `testes/integracao/drift-cli-modes.test.ts`: `inspecionar` and `resumo --micro` do not run fresh drift implicitly and do not publish code scores when drift is `none`.
28
- - `testes/integracao/drift-escopo-io.test.ts`: focused drift never opens unrelated `firecrawl`, training, or SQL dump files; the warm cache performs no source read or AST creation; one changed unit leaves unrelated groups reusable; project scope shares one catalog walk and one physical read per file.
29
- - `testes/unidade/drift-catalogo-cache.test.ts`: validated catalog snapshots, metadata/content hits, configuration identity invalidation, runtime payload validation, corruption recovery, and realpath containment remain explicit.
30
-
31
- Do not require private or sensitive operational material for public test
32
- evidence. The public-package smoke must also reject the removed authorization
33
- command, legacy gate markers, any stale billing artifact, secrets, and broken
34
- encoding in every published document. The plugin smoke must validate the repo
35
- marketplace, manifest version, installed skill copy, and absence of Sema MCP.
36
- After push and npm publication, `npm run release:verificar-distribuicao` must
37
- repeat that installation from the remote `gerlanss/Sema` marketplace and prove
38
- that GitHub HEAD, the installed skill, and the manifest-declared npm version
39
- all describe the same release.
24
+ `npm run cli:empacotar-publica` is the only supported package factory. It
25
+ builds a private, per-run stage outside `pacotes/cli`, invokes npm there with
26
+ lifecycle scripts disabled, validates the complete tarball, and publishes the
27
+ final `.tgz` without replacing a different concurrent winner. Running `npm
28
+ pack` directly in the source workspace must fail closed and leave the source
29
+ tree byte-for-byte unchanged.
40
30
 
31
+ Packaging regressions must prove rejection of pre-existing source or output
32
+ junctions, zero external writes in those cases, cross-volume publication,
33
+ cleanup after injected faults, concurrent no-replace publication, and a full
34
+ stage sweep for source maps, credentials, environment files, and billing
35
+ artifacts. Post-operation identity checks detect ordinary path swaps, but tests
36
+ must not claim containment against a hostile same-user process racing path
37
+ operations; that stronger guarantee requires native directory-handle-relative
38
+ filesystem primitives that Node.js does not provide cross-platform.
39
+
40
+ Do not require private or sensitive operational material for public test
41
+ evidence. The public-package smoke must also reject the removed authorization
42
+ command, legacy gate markers, any stale billing artifact, secrets, and broken
43
+ encoding in every published document. The plugin smoke must validate the repo
44
+ marketplace, manifest version, installed skill copy, and absence of Sema MCP.
45
+ After push and npm publication, `npm run release:verificar-distribuicao` must
46
+ repeat that installation from the remote `gerlanss/Sema` marketplace and prove
47
+ that GitHub HEAD, the installed skill, and the manifest-declared npm version
48
+ all describe the same release.
49
+
41
50
  The local public-package smoke installs the generated tarball in an isolated
42
51
  sandbox. It must import the root API without executing the CLI, materialize
43
52
  nested interactive examples, and execute discovery, interactive schema,
44
53
  definition validation, planning, and adapter-protocol validation through the
45
- installed binary. Passing this smoke proves the local tarball only; it does not
46
- mean that npm or a GitHub release was published.
54
+ installed binary. Its global-install phase uses an isolated home, prefix, npm
55
+ cache, and user cache; it verifies the absolute launcher with Node.js/npm absent
56
+ from `PATH`, exact skill digests, read-only status, idempotent repair, and zero
57
+ changes to the real home or workspace. On Windows it must resolve `sema.ps1`
58
+ from a restricted `PATH`, invoke `sema-managed.ps1` with the absolute system
59
+ `powershell.exe`, and exercise `sema.cmd` with conventional `cmd.exe` arguments.
60
+ Byte-exact arbitrary argv is proved through the PowerShell entrypoints. Passing this smoke proves
61
+ the local tarball only; it does not mean that npm or a GitHub release was
62
+ published.
63
+
64
+ The same installed-package smoke must execute root help plus `iniciar --help`,
65
+ `dev --help`, `formatar --help`, `sync-codex --help`, `skill sync --help`, short
66
+ `-h`, and help after unknown arguments. Each text and `--json` invocation runs
67
+ from an empty isolated workspace with an isolated HOME, user cache, plugin
68
+ cache, and npm cache. A recursive content fingerprint before and after every
69
+ invocation must remain identical, and every help path must finish within the
70
+ smoke timeout with exit code `0` and empty stderr.
71
+
72
+ The purity preload also fails on reads under the isolated workspace, HOME, or
73
+ cache roots, subprocess creation, and network primitives. Module reads from the
74
+ installed package itself remain allowed. The smoke invokes the real installed
75
+ launcher with PATH emptied, so a passing direct `node dist/bin.js` probe alone
76
+ is not accepted as launcher evidence.
77
+
78
+ JSON help must be one parseable `sema.cli.control/v1` document containing
79
+ exactly `schemaVersion`, `ok`, `kind`, `code`, `message`, and `exitCode`. The
80
+ smoke must also prove a non-zero `UNKNOWN_COMMAND` control response whose
81
+ process status equals `exitCode`, with no stack, absolute path, raw argv, or
82
+ second JSON document. Every syntactically valid command using `--json` must be
83
+ one parseable `sema.cli.result/v1` document containing exactly
84
+ `schemaVersion`, `ok`, `kind`, `command`, `code`, `message`, `exitCode`, and
85
+ `payload`. Smoke assertions must unwrap `payload` before checking
86
+ command-specific fields, and recorded fixtures must contain that payload rather
87
+ than either public CLI envelope. Coverage must include object, array, scalar,
88
+ and `null` payloads, coherent `SUCCESS` and `DOMAIN_ERROR` results, process
89
+ status equality, empty stderr, no `data` alias, and rejection of missing,
90
+ extra, nested, or mismatched envelope fields. `--version` remains a plain exact
91
+ SemVer text check.
92
+
93
+ Focused distribution tests live in
94
+ `testes/unidade/distribuicao-launcher-global.test.ts`,
95
+ `testes/unidade/distribuicao-skill-global.test.ts`, and
96
+ `testes/unidade/distribuicao-global.test.ts`. They must cover spaces, Unicode,
97
+ argument forwarding, stale targets, ownership conflicts, symlink/junction
98
+ escapes, atomic replacement, idempotent upgrades, the PowerShell fallback with
99
+ an absolute system executable, a detected Claude mirror, and a local lifecycle
100
+ no-op. No test may write to the real user home or a plugin cache.
101
+
102
+ The public-package smoke has one orchestrator and named helpers under
103
+ `scripts/cli-publico/`. All helpers share the same temporary sandbox and the
104
+ same installed tarball; splitting the checks must never multiply installations
105
+ or weaken the single `try/finally` cleanup boundary.
106
+
107
+ Focused drift regressions live in
108
+ `testes/unidade/drift-escopo-dependencias.test.ts`,
109
+ `testes/unidade/drift-escopo-referencias.test.ts`,
110
+ `testes/unidade/drift-catalogo.test.ts`,
111
+ `testes/unidade/drift-leitura-compartilhada.test.ts`, and
112
+ `testes/integracao/drift-escopo-io.test.ts`, plus the external-path attack
113
+ regressions in `testes/integracao/drift-caminhos-externos.test.ts`. They must prove planning before
114
+ cataloging, path confinement, dependency closure, one physical read and one AST
115
+ per canonical file, no homonymous last-write-wins resolution, and no
116
+ project-wide walk for `arquivo` or `modulo` scope. Project-loading regressions
117
+ also prove deferred code discovery and rejection of external configured roots
118
+ or contract origins before enumeration. In project scope, physical file
119
+ bindings outside code roots must enter the safe catalog individually, including
120
+ non-indexable assets, without causing a walk of their parent directories.
121
+ Drift, impact, and semantic rename must not expose an external path or read its
122
+ contents.
123
+ Persistent-cache regressions live in
124
+ `testes/unidade/drift-cache-modes.test.ts`,
125
+ `testes/unidade/drift-cache-store.test.ts`,
126
+ `testes/integracao/drift-cache-persistente.test.ts`, and
127
+ `testes/integracao/drift-cli-modes.test.ts`. They must prove all three modes,
128
+ query defaults, nullable non-evidence, zero cache I/O for `none`, storage outside
129
+ the workspace, opaque paths, strong-content invalidation even with restored
130
+ metadata, corruption recovery, immutable concurrent publication, and semantic
131
+ equivalence between fresh and warm results. Shape-valid semantic tampering with
132
+ only the envelope `payloadDigest` recalculated must fail the cross-index
133
+ invariants, become a corrupt miss, recalculate, and match the fresh result. The
134
+ payload must derive symbol, route, resource, and known-file aggregates from its
135
+ canonical per-extractor indices instead of trusting redundant aggregate lists.
136
+ A warm hit may skip AST/extractor work, but it never reuses the final score,
137
+ links, diagnostics, or success decision. Junctions, symlinks, hardlinks, path
138
+ traversal, drive-relative paths,
139
+ intermediate-directory swaps, and cache unavailability must fail closed or
140
+ degrade to an in-memory calculation without mutating the workspace.
141
+
142
+ Cache digests are corruption checks, not authentication against a hostile
143
+ process running as the same operating-system user. Tests must not present a
144
+ warm cache hit as a protected trust boundary; final closure evidence uses
145
+ `--cache fresh`.
47
146
 
48
147
  Native generator evidence is mandatory when changing C#/.NET or C++ support.
49
- The `dotnet` smoke must compile and execute through the local .NET SDK. The
50
- `cpp` smoke must compile and execute through GCC, Clang, or MSVC; checking only
51
- for generated files is not sufficient.
148
+ The `dotnet` smoke must compile and execute through the local .NET SDK. The
149
+ `cpp` smoke must compile and execute through GCC, Clang, or MSVC; checking only
150
+ for generated files is not sufficient.
@@ -0,0 +1,139 @@
1
+ module exemplos.express.crud {
2
+ entity Monitor {
3
+ fields {
4
+ id: Id
5
+ nome: Texto
6
+ url: Texto
7
+ ativo: Booleano
8
+ }
9
+ }
10
+
11
+ task criar_monitor {
12
+ input {
13
+ nome: Texto required
14
+ url: Texto required
15
+ }
16
+ output {
17
+ monitor: Monitor
18
+ }
19
+ rules {
20
+ nome deve_ser preenchido
21
+ url deve_ser preenchido
22
+ }
23
+ effects {
24
+ persistencia Monitor
25
+ auditoria monitor_criado
26
+ }
27
+ guarantees {
28
+ monitor existe
29
+ }
30
+ tests {
31
+ caso "cria monitor" {
32
+ given {
33
+ nome: "API Pagamentos"
34
+ url: "https://api.exemplo.dev/status"
35
+ }
36
+
37
+ expect {
38
+ sucesso: verdadeiro
39
+ }
40
+ }
41
+ }
42
+ }
43
+
44
+ task listar_monitores {
45
+ input {
46
+ ativo: Booleano
47
+ }
48
+ output {
49
+ monitores: Lista
50
+ }
51
+ effects {
52
+ consulta Monitor
53
+ }
54
+ guarantees {
55
+ monitores existe
56
+ }
57
+ tests {
58
+ caso "lista monitores" {
59
+ given {
60
+ ativo: verdadeiro
61
+ }
62
+
63
+ expect {
64
+ sucesso: verdadeiro
65
+ }
66
+ }
67
+ }
68
+ }
69
+
70
+ task remover_monitor {
71
+ input {
72
+ id: Id required
73
+ }
74
+ output {
75
+ removido: Booleano
76
+ }
77
+ rules {
78
+ id deve_ser valido
79
+ }
80
+ effects {
81
+ persistencia Monitor
82
+ auditoria monitor_removido
83
+ }
84
+ guarantees {
85
+ removido == verdadeiro
86
+ }
87
+ tests {
88
+ caso "remove monitor por id" {
89
+ given {
90
+ id: "mon_1"
91
+ }
92
+
93
+ expect {
94
+ sucesso: verdadeiro
95
+ }
96
+ }
97
+ }
98
+ }
99
+
100
+ route monitores_criar {
101
+ metodo: POST
102
+ caminho: /monitores
103
+ task: criar_monitor
104
+ finalidade: cadastro_monitor
105
+ input {
106
+ nome: Texto
107
+ url: Texto
108
+ }
109
+ output {
110
+ monitor: Monitor
111
+ }
112
+ }
113
+
114
+ route monitores_listar {
115
+ metodo: GET
116
+ caminho: /monitores
117
+ task: listar_monitores
118
+ finalidade: consulta_monitores
119
+ input {
120
+ ativo: Booleano
121
+ }
122
+ output {
123
+ monitores: Lista
124
+ }
125
+ }
126
+
127
+ route monitores_remover {
128
+ metodo: DELETE
129
+ caminho: "/monitores/{id}"
130
+ task: remover_monitor
131
+ finalidade: exclusao_monitor
132
+ input {
133
+ id: Id
134
+ }
135
+ output {
136
+ removido: Booleano
137
+ }
138
+ }
139
+ }
@@ -0,0 +1,146 @@
1
+ module exemplos.fastify.crud {
2
+ entity Pedido {
3
+ fields {
4
+ id: Id
5
+ cliente: Texto
6
+ total: Decimal
7
+ status: Texto
8
+ }
9
+ }
10
+
11
+ task criar_pedido {
12
+ input {
13
+ cliente: Texto required
14
+ total: Decimal required
15
+ }
16
+ output {
17
+ pedido: Pedido
18
+ }
19
+ rules {
20
+ cliente deve_ser preenchido
21
+ total deve_ser positivo
22
+ }
23
+ effects {
24
+ persistencia Pedido
25
+ auditoria pedido_criado
26
+ }
27
+ guarantees {
28
+ pedido existe
29
+ }
30
+ tests {
31
+ caso "cria pedido" {
32
+ given {
33
+ cliente: "Ana"
34
+ total: 149.9
35
+ }
36
+
37
+ expect {
38
+ sucesso: verdadeiro
39
+ }
40
+ }
41
+ }
42
+ }
43
+
44
+ task obter_pedido {
45
+ input {
46
+ id: Id required
47
+ }
48
+ output {
49
+ pedido: Pedido
50
+ }
51
+ rules {
52
+ id deve_ser valido
53
+ }
54
+ effects {
55
+ consulta Pedido
56
+ }
57
+ guarantees {
58
+ pedido existe
59
+ }
60
+ tests {
61
+ caso "obtem pedido por id" {
62
+ given {
63
+ id: "ped_1"
64
+ }
65
+
66
+ expect {
67
+ sucesso: verdadeiro
68
+ }
69
+ }
70
+ }
71
+ }
72
+
73
+ task atualizar_pedido {
74
+ input {
75
+ id: Id required
76
+ status: Texto required
77
+ }
78
+ output {
79
+ pedido: Pedido
80
+ }
81
+ rules {
82
+ id deve_ser valido
83
+ status deve_ser preenchido
84
+ }
85
+ effects {
86
+ persistencia Pedido
87
+ auditoria pedido_atualizado
88
+ }
89
+ guarantees {
90
+ pedido existe
91
+ }
92
+ tests {
93
+ caso "atualiza status do pedido" {
94
+ given {
95
+ id: "ped_1"
96
+ status: "pago"
97
+ }
98
+
99
+ expect {
100
+ sucesso: verdadeiro
101
+ }
102
+ }
103
+ }
104
+ }
105
+
106
+ route pedidos_criar {
107
+ metodo: POST
108
+ caminho: /pedidos
109
+ task: criar_pedido
110
+ finalidade: cadastro_pedido
111
+ input {
112
+ cliente: Texto
113
+ total: Decimal
114
+ }
115
+ output {
116
+ pedido: Pedido
117
+ }
118
+ }
119
+
120
+ route pedidos_obter {
121
+ metodo: GET
122
+ caminho: "/pedidos/{id}"
123
+ task: obter_pedido
124
+ finalidade: consulta_pedido
125
+ input {
126
+ id: Id
127
+ }
128
+ output {
129
+ pedido: Pedido
130
+ }
131
+ }
132
+
133
+ route pedidos_atualizar {
134
+ metodo: PATCH
135
+ caminho: "/pedidos/{id}"
136
+ task: atualizar_pedido
137
+ finalidade: alteracao_pedido
138
+ input {
139
+ id: Id
140
+ status: Texto
141
+ }
142
+ output {
143
+ pedido: Pedido
144
+ }
145
+ }
146
+ }
@@ -1,44 +1,44 @@
1
- # Content pipeline example
2
-
3
- This fixture proves that the pipeline core is independent from a platform,
4
- brand, or media type. One definition creates a global editorial core and two
5
- isolated target branches: a long-form document and a spoken audio episode.
6
- The same AI-native plan can add any number of channels and formats without
7
- making this experience the only delivery path.
8
-
9
- Definition v1 declares exactly one output per stage. Each stage also selects an
10
- `adapterPolicy`: `NONE`, `CONSTRAINTS`, or `CONFIRMATION`. Constraint gates are
11
- satisfied only by independently signed observations bound to the produced
12
- artifact, including an independently observed media type; producer metadata
13
- is not evidence of its own correctness.
14
-
15
- ```bash
16
- sema conteudo validar exemplos/pipeline-conteudo/definicao.json --json
17
- sema conteudo planejar exemplos/pipeline-conteudo/definicao.json --alvos-arquivo exemplos/pipeline-conteudo/alvos.json --json
18
- ```
19
-
20
- The example intentionally contains no private keys, signed policy, trust pins,
21
- ledger checkpoint, or signed events. In a live run, an authorized policy
22
- authority must sign a policy bound to the execution and complete target set
23
- through `runId` and `targetSetDigest`, with explicit `issuedAt` and `expiresAt`
24
- authorization bounds. Every event must be recorded within that interval, and
25
- every append also supplies that policy envelope. Keep the
26
- trust-root digest, current `revocationDigest`, and
27
- required `expectedHead` outside the runner-controlled workspace. Generate
28
- events in independently controlled producer, evaluator, and adapter processes;
29
- never commit production private keys to a Sema workspace. The adapter's
30
- `requiredMetadata + optionalMetadata` is the exact scalar public allowlist;
31
- artifact metadata is unavailable in v1. The runner resolves credentials
32
- externally from a strict `account:<alias>` reference.
33
-
34
- Every gate declares separate deterministic-attester and semantic-AI quorums.
35
- Use `content.evidence.attest:<evidenceType>` for ordinary attestations. Adapter
36
- observations use the stricter
37
- `content.adapter.attest:<adapterId>@<version>:<evidenceType>` capability and
38
- signed adapter/version binding; a generic receipt capability is intentionally
39
- insufficient.
40
-
41
- The runner executes and resumes work from Sema's derived `nextActions`. It does
42
- not calculate verdicts or edit completion state. Operational conditions remain
43
- separate from gate verdicts, and every generated manifest is a non-authoritative
44
- projection of the canonical ledger. There is no native human-review fallback.
1
+ # Content pipeline example
2
+
3
+ This fixture proves that the pipeline core is independent from a platform,
4
+ brand, or media type. One definition creates a global editorial core and two
5
+ isolated target branches: a long-form document and a spoken audio episode.
6
+ The same AI-native plan can add any number of channels and formats without
7
+ making this experience the only delivery path.
8
+
9
+ Definition v1 declares exactly one output per stage. Each stage also selects an
10
+ `adapterPolicy`: `NONE`, `CONSTRAINTS`, or `CONFIRMATION`. Constraint gates are
11
+ satisfied only by independently signed observations bound to the produced
12
+ artifact, including an independently observed media type; producer metadata
13
+ is not evidence of its own correctness.
14
+
15
+ ```bash
16
+ sema conteudo validar exemplos/pipeline-conteudo/definicao.json --json
17
+ sema conteudo planejar exemplos/pipeline-conteudo/definicao.json --alvos-arquivo exemplos/pipeline-conteudo/alvos.json --json
18
+ ```
19
+
20
+ The example intentionally contains no private keys, signed policy, trust pins,
21
+ ledger checkpoint, or signed events. In a live run, an authorized policy
22
+ authority must sign a policy bound to the execution and complete target set
23
+ through `runId` and `targetSetDigest`, with explicit `issuedAt` and `expiresAt`
24
+ authorization bounds. Every event must be recorded within that interval, and
25
+ every append also supplies that policy envelope. Keep the
26
+ trust-root digest, current `revocationDigest`, and
27
+ required `expectedHead` outside the runner-controlled workspace. Generate
28
+ events in independently controlled producer, evaluator, and adapter processes;
29
+ never commit production private keys to a Sema workspace. The adapter's
30
+ `requiredMetadata + optionalMetadata` is the exact scalar public allowlist;
31
+ artifact metadata is unavailable in v1. The runner resolves credentials
32
+ externally from a strict `account:<alias>` reference.
33
+
34
+ Every gate declares separate deterministic-attester and semantic-AI quorums.
35
+ Use `content.evidence.attest:<evidenceType>` for ordinary attestations. Adapter
36
+ observations use the stricter
37
+ `content.adapter.attest:<adapterId>@<version>:<evidenceType>` capability and
38
+ signed adapter/version binding; a generic receipt capability is intentionally
39
+ insufficient.
40
+
41
+ The runner executes and resumes work from Sema's derived `nextActions`. It does
42
+ not calculate verdicts or edit completion state. Operational conditions remain
43
+ separate from gate verdicts, and every generated manifest is a non-authoritative
44
+ projection of the canonical ledger. There is no native human-review fallback.
@@ -1,23 +1,23 @@
1
- [
2
- {
3
- "targetId": "documento-principal",
4
- "adapterId": "destination.document",
5
- "accountScope": "account:publisher.site-a",
6
- "formatProfileId": "long-form",
7
- "locale": "pt-BR",
8
- "metadata": {
9
- "title": "Exemplo de conteúdo multiformato"
10
- }
11
- },
12
- {
13
- "targetId": "episodio-audio",
14
- "adapterId": "destination.audio-feed",
15
- "accountScope": "account:publisher.feed-a",
16
- "formatProfileId": "spoken-episode",
17
- "locale": "pt-BR",
18
- "metadata": {
19
- "title": "Exemplo de conteúdo multiformato",
20
- "description": "A mesma intenção editorial em um destino de áudio independente."
21
- }
22
- }
23
- ]
1
+ [
2
+ {
3
+ "targetId": "documento-principal",
4
+ "adapterId": "destination.document",
5
+ "accountScope": "account:publisher.site-a",
6
+ "formatProfileId": "long-form",
7
+ "locale": "pt-BR",
8
+ "metadata": {
9
+ "title": "Exemplo de conteúdo multiformato"
10
+ }
11
+ },
12
+ {
13
+ "targetId": "episodio-audio",
14
+ "adapterId": "destination.audio-feed",
15
+ "accountScope": "account:publisher.feed-a",
16
+ "formatProfileId": "spoken-episode",
17
+ "locale": "pt-BR",
18
+ "metadata": {
19
+ "title": "Exemplo de conteúdo multiformato",
20
+ "description": "A mesma intenção editorial em um destino de áudio independente."
21
+ }
22
+ }
23
+ ]